Gossamer Forum
Home : Products : DBMan : Customization :

m3u, ram and asx on the rebound

Quote Reply
m3u, ram and asx on the rebound
Goodday,

I've been tinkering a bit in anticipation for some input and came across a number of
routines which allow text export.
In part I have tried to apply a routine posted in the unofficial FAQ
Link http://webmagic.hypermart.net/dbman/view30.txt

Parts of this routine have been pasted in the delete routine of db.cgi
unfortunantly I can not figure out how to
a) get the deleted records in the $output variable
b) subsequently parse the deleted line to specific field values

The code reads as thus...

Once again any suggestions would be appriciated.

my ($key, %delete_list, $rec_to_delete, @lines, $line, @data, $errstr, $succstr, $output, $restricted);
$rec_to_delete = 0;
foreach $key (keys %in) { # Build a hash of keys to delete.
if ($in{$key} eq "delete") {
$delete_list{$key} = 1;
$rec_to_delete = 1;
}
}
if (!$rec_to_delete) {
&html_delete_failure("geen records gespecificeert.");
return;
}


($restricted = 1) if ($auth_modify_own and !$per_admin);

$output = qq|Insert anything you want as introductory text here.
# You can just put carriage returns within the text for new lines.
# Be sure to end with \n\n in order to get a double space. Before the start of the record printout. |;

LINE: foreach $line (@lines) {
if ($line =~ /^$/) { next LINE; }
if ($line =~ /^#/) { $output .= $line; next LINE; }
chomp ($line);
@data = &split_decode($line);
($output .= "$line\n" and next LINE) if ($restricted and ($db_userid ne $data[$auth_user_field]));

$delete_list{$data[$db_key_pos]} ? # if this id is one we want to delete
($delete_list{$data[$db_key_pos]} = 0) : # then mark it deleted and don't print it to the new database.
($output .= $line . "\n"); # otherwise print it.
}
$output .= "$delete_list{'Title'}\n$rec{'Artist'}\n$rec{'File'}\n\n";
open (TEXT, ">/home/w/wemos/WWW.cgi/mm/text.txt") or &cgierr("error in writing text file. \nReason: $!");
if ($db_use_flock) {
flock(TEXT, 2) or &cgierr("unable to get exclusive lock on text file.\nReason: $!");
}
print TEXT $output;
close TEXT;

&html_print_headers;
print qq|
<html><head><title>$html_title: Text File Saved</title></head>
<insert body tag here>
<center><table border=1 cellpadding=5 cellspacing=3 width=500>
<tr><td colspan=2><FONT size=1><b>$html_title: Text File Saved</b></td></tr>
<tr><td> <p><center><$font_title><b>Text File Saved</b></font></center><P>
<$font>The text file was successfully saved.</FONT><P>|;
&html_footer; $output;
print qq|</td></tr></table></center></body></html>|;
}