Gossamer Forum
Home : Products : DBMan : Customization :

Validate only if image changes?

Quote Reply
Validate only if image changes?
I'm just curious if it would be possible to only have records go into validate if new images are uploaded? I'm not too worried about text, just new images. I just think it would make things a little easier for admins to only have to validate new additions and new image uploads instead of having to validate new additions and everything that's modified.
Thanks!


DBMan SQL Version 1 mods available at:
http://dbmansqlmods.rainbowroomies.com
(Mods based on JPDeni's original mods.)
Quote Reply
Re: [shann123] Validate only if image changes? In reply to
I would suggest adding within sub modify_record in your db.cgi file in the areas where it's checking for your graphic to include the line:

(!$per_admin) and ($in{'Validated'} = "No");

Not sure this will work but it may be worth a try.

If your using the single file upload you might also be able to setup an email notification when the field changes.

Unoffical DBMan FAQ

http://creativecomputingweb.com/dbman/index.shtml/
Quote Reply
Re: [LoisC] Validate only if image changes? In reply to
Hi Lois,
I think I know what ya meant and I tried adding that in the file upload part of it, but it still went in for validation when I just modified the text.
I tried putting it in different places, then got to thinking that maybe there needs to be something else added like an elsif $new_files = 0 or something, but not sure where I'd add that. Here's how it stands right now (note: This is the setup for the sql version, but it should work for both which is why I'm posting in here)

($auth_user_field >= 0) and ($in{$auth_user_field} = $db_userid);


# Check to make sure the record passes the reg exp and null checks.


foreach $key (keys %in) {
if ($in{$key} eq 'delete') {
unlink "$SAVE_DIRECTORY/$in{$db_key}/$key";
}
}

$num_files=0;
if (-e "$SAVE_DIRECTORY/$in{$db_key}") {
opendir (GRAPHIC, "$SAVE_DIRECTORY/$in{$db_key}") or &cgierr("unable to open directory: $SAVE_DIRECTORY/$rec{$db_key}. Reason: $!");
@files = readdir(GRAPHIC);
closedir (GRAPHIC);
foreach $file (@files) {
next if ($file =~ /^\./); # Skip "." and ".." entries..
next if ($file =~ /^index/); # Skip index.htm type files..
++$num_files;
}
}

if ($num_files or $in{'file-to-upload-1'}) { $in{'Graphic'} = 'Yes'; }
else { $in{'Graphic'} = ''; }

(!$per_admin) and ($in{$db_validated_field} = "No");

$status = &validate_record; # Check to make sure the modifications are ok!

if (($status eq "ok") && ($in{'file-to-upload-1'})) { $status = &validate_upload; } #Validate Pictures

if ($status eq "ok") {

Thanks again!


DBMan SQL Version 1 mods available at:
http://dbmansqlmods.rainbowroomies.com
(Mods based on JPDeni's original mods.)