Gossamer Forum
Home : Products : DBMan : Customization :

Modify_success

Quote Reply
Modify_success
Hi!

On the modify/delete/validate success screens with short&long, I notice that the confirmation message passed from db.pl is
Quote:
'The following records were *ed: 1,3,5'

This is a bit meaningless to my visitors! Is there a way (read as 'how can ...') I can change this to the titles rather than the DB Keys?

It seems to be calling it from db.pl so I'm not really very confident about fiddling!!




------------------
Ben

-------------------------
http:/www.t-e.co.uk

Quote Reply
Re: Modify_success In reply to
The modify success screen should show the record after it was modified. And your users won't be using the validate function, so they won't see that screen.

In order to change what is displayed on the delete success screen, you'll have to pull the data from the record before it is deleted.

In db.cgi, there are the following lines:

Code:
$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.

You'll need to change these lines to

Code:
if ($delete_list{$data[$db_key_pos]}) {
$delete_list{$data[$db_key_pos]} = 0;
$succstr .= "$data[the number of the field you want to return],";
}
else {
$output .= $line . "\n";
}

You'll also need to change

Code:
foreach $key (keys %delete_list) {
$delete_list{$key} ? # Check to see if any items weren't deleted
($errstr .= "$key,") : # that should have been.
($succstr .= "$key,"); # For logging, we'll remember the one's we deleted.

to

Code:
foreach $key (keys %delete_list) {
if ($delete_list{$key}) {
$errstr .= "$key,";
}
}

I'm pretty sure this will work.


------------------
JPD






Quote Reply
Re: Modify_success In reply to
 
Quote:
I'm pretty sure this will work.

As ever, I type in awe!

Works a treat!

------------------
Ben

-------------------------
http:/www.t-e.co.uk

Quote Reply
Re: Modify_success In reply to
Whew! I'm never as sure of myself as I seem to be when I'm typing here. I sorta hold my breath until I know how it turned out. Glad this one worked. Smile


------------------
JPD






Quote Reply
Re: [JPDeni] Modify_success In reply to
I made the changes to show the Title (field 11) but I still got a 500 error, but I also have the multiple-upload-mod.

I looked it over and over again but cannot find the error (a typo? 1 } to much?)

This piece of code I have now;

Code:
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]));

if ($delete_list{$data[$db_key_pos]}) {
$delete_list{$data[$db_key_pos]} = 0;
$succstr .= "$data[11],";
} if ($db_upload) {
if (-e "$SAVE_DIRECTORY/$data[$db_key_pos]") {
opendir (GRAPHIC, "$SAVE_DIRECTORY/$data[$db_key_pos]") or &cgierr("unable to open directory in delete records: $SAVE_DIRECTORY/$data[$db_key_pos]. Reason: $!");
@files = readdir(GRAPHIC);
closedir (GRAPHIC);
foreach $file (@files) {
unlink ("$SAVE_DIRECTORY/$data[$db_key_pos]/$file");
}
rmdir "$SAVE_DIRECTORY/$data[$db_key_pos]";
}
}
}
else { $output .= $line . "\n"; }



}

foreach $key (keys %delete_list) {
if ($delete_list{$key}) {
$errstr .= "$key,";
}
}
chop($succstr); # Remove trailing delimeter
chop($errstr); # Remove trailing delimeter
Anyone did the same with the same error?
Quote Reply
Re: [Foton] Modify_success In reply to
It looks as though you may have added the lines in the wrong place with the extra coding for the upload mod. Try using this and see if it helps:

($output .= "$line\n" and next LINE) if ($restricted and ($db_userid ne $data[$auth_user_field]));

if ($delete_list{$data[$db_key_pos]}) {
$delete_list{$data[$db_key_pos]} = 0;
# $succstr .= "$data[11],";
# }
if ($db_upload) {
if (-e "$SAVE_DIRECTORY/$data[$db_key_pos]") {
opendir (GRAPHIC, "$SAVE_DIRECTORY/$data[$db_key_pos]") or &cgierr("unable to open directory in delete records: $SAVE_DIRECTORY/$data[$db_key_pos]. Reason: $!");
@files = readdir(GRAPHIC);
closedir (GRAPHIC);
foreach $file (@files) {
unlink ("$SAVE_DIRECTORY/$data[$db_key_pos]/$file");
}
rmdir "$SAVE_DIRECTORY/$data[$db_key_pos]";
}
}
}
# else { $output .= $line . "\n"; }
$succstr .= "$data[the number of the field you want to return],";
}
else {
$output .= $line . "\n";
}
}

foreach $key (keys %delete_list) {
if ($delete_list{$key}) {
$errstr .= "$key,";
}
}
chop($succstr); # Remove trailing delimeter

If not, it's most likey just a matter of matching up the brackets correctly.

Let us know if it works

Unoffical DBMan FAQ

http://creativecomputingweb.com/dbman/index.shtml/
Quote Reply
Re: [LoisC] Modify_success In reply to
Hi LoisC,



As usual, you were right....Wink
I had a hard time finding the 1 to much '}', it was the one just beneath:

rmdir "$SAVE_DIRECTORY/$data[$db_key_pos]";


Finally after deleting one of the } there was no 500 error anymore and the scripts shows the deleted titles beautifully. I added an extra linebreak in the successtring so the titles would show in a list;
$succstr .= "$data[11]<br>";

Thank you for your everlasting suipport.
You are a wonderful person...Angelic