Gossamer Forum
Home : Products : Links 2.0 : Discussions :

Modify Link - "Modify" "Delete" - what if I don't want to modify or delete

Quote Reply
Modify Link - "Modify" "Delete" - what if I don't want to modify or delete
Subject says it all?

If I decline to modify a link, in order to move it out of the "validation area" - I have to choose delete - and it is removed.

Isnt there a way to say "no" to a modification, and to keep the record in the database, but yet remove it from the queue?

I searched and couldn't find this anywhere. :/
Quote Reply
Re: Modify Link - "Modify" "Delete" - what if I don't want to modify or delete In reply to
I've said "delete" to a modification request and it didn't delete the existing record. I think it only deletes the modification request from the validate db...it doesn't do anything to links.db unless you select the modify box in the admin.
Quote Reply
Re: Modify Link - "Modify" "Delete" - what if I don't want to modify or delete In reply to
I've done a quick mod to move deleted records to a new database, called delete.db, where they just sit until I decide what to do with them. I did this because, when I delete links that are broken, I want to be able to go back and see if they ever become valid again, but I have not written any code to restore them back to links.db. I think the validate script could be modified to do the same with validate.db if you want the code I use. Let me know.

[This message has been edited by Bobsie (edited August 07, 1999).]
Quote Reply
Re: Modify Link - "Modify" "Delete" - what if I don't want to modify or delete In reply to
Bobsie,
I`d find your code very useful, thanks.
Email or post.
chmod
Quote Reply
Re: Modify Link - "Modify" "Delete" - what if I don't want to modify or delete In reply to
Well, I was incorrect when I said they were stored in delete.db. The actual file name they are stored in is linksdel.db.

In db.pl, sub delete-records, I changed this code:

Code:
# Search the database for a record to delete.
open (DB, "<$db_file_name") or &cgierr("error in delete_records. unable to open db file: $db_file_name.\nReason: $!");
if ($db_use_flock) { flock(DB, 1); }
LINE: while (<DB> ) {
(/^#/) and ($output .= $_ and next LINE);
(/^\s*$/) and next LINE;
chomp;
@data = &split_decode($_);

$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 .= "$_\n"); # otherwise print it.
}
close DB;

To read:

Code:
# Search the database for a record to delete.
open (DB, "<$db_file_name") or &cgierr("error in delete_records. unable to open db file: $db_file_name.\nReason: $!");
if ($db_use_flock) { flock(DB, 1); }
LINE: while (<DB> ) {
(/^#/) and ($output .= $_ and next LINE);
(/^\s*$/) and next LINE;
chomp;
@data = &split_decode($_);

# If this is the ID of a record to delete, mark it as deleted and store
# it in the linksdel.db database for possible future reactivation. Do not
# print it to the links.db database. If it is not the ID of a record to
# delete, then include the record in $output for writing to links.db.
if ($delete_list{$data[$db_key_pos]}) {
$delete_list{$data[$db_key_pos]} = 0;
open (DELDB, ">>$db_script_path/data/linksdel.db")
or &cgierr("Unable to open $db_script_path/data/linksdel.db.\nReason: $!");
print DELDB "$_\n";
close DELDB;
}
else { $output .= "$_\n"; }

# $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 .= "$_\n"); # otherwise print it.
}
close DB;

You could do something similar for the sub validate_records routine in db.pl.

I hope this helps.

[This message has been edited by Bobsie (edited August 08, 1999).]