Record Not Found!
Another administrator has deleted this record!'); result = false; request.mode =""; } return result; } /*====================================================================== The ins_db_files_rec function inserts a single file record into the database. This is a method of the file object. ====================================================================== */ function ins_db_files_rec() { this.description = check_size(this.description, 255); result = database.execute('INSERT INTO file (filename, location, description, format, ownerid, folderid, expirationdate, activationdate, modifieddate ) VALUES ("'+this.filename+'","' + this.location +'","' +this.description +'","' +this.format +'","' +this.ownerid +'",' +this.folderid +',"' +this.expirationdate +'","' +this.activationdate +'", CURRENT)' ); if (result != 0) {write('The following file has been added.
');} } /*====================================================================== The del_db_file_rec function deletes a single file record from the database. This is a method of the file object. ====================================================================== */ function del_db_files_rec() { result = database.execute('DELETE FROM file WHERE filename="'+this.filename+'"'); if (result != 0) {write('The following file has been updated.
'); return result;} } //File Object function files_rec(filename, location, description, format, ownerid, folderid, activationdate, expirationdate, modifieddate, foldername, group) { this.filename = filename; this.location = location; this.description = description; this.format = format; this.ownerid = ownerid; this.folderid = folderid; this.expirationdate = expirationdate; this.activationdate = activationdate; this.modifieddate = modifieddate; this.foldername = foldername; this.group = group; this.ins_db_files_rec = ins_db_files_rec; this.upd_db_files_rec = upd_db_files_rec; this.get_db_files_rec = get_db_files_rec; this.del_db_files_rec = del_db_files_rec; } /*====================================================================== The load_Files_Tbl function creates the file object and loads it with initial values. The appropriate method is then executed against the current object based on the mode the form is in. The form basically has two main categories of modes: user and database. User modes are add, D (delete), M (modify). Database modes are insert, dump, and update. Once the initial method has been called on the object, the specifics of the page formatting are determined based on field, user access, and mode. ====================================================================== */ function load_Files_Tbl() { if (request.mode == "insert") { temp_files = new files_rec(request.filename, "", request.description, request.format, request.ownerid, request.folderid, request.activationdate, request.expirationdate, request.modifieddate, request.foldername, request.group); temp_files.location = determine_location(temp_files.group, temp_files.filename); temp_files.ins_db_files_rec(); result = temp_files.get_db_files_rec(); } if (request.mode == "add") { todays_date = makeToday(); expir_date = todayPlus(1, "M"); temp_files = new files_rec("","","","",client.userid, request.folderid,todays_date,expir_date,"","",request.group); temp_files.location = determine_location(temp_files.group, ""); result = true; } if (request.mode == "dump") { temp_files = new files_rec(request.filename, "", request.description, request.format, request.ownerid, request.folderid, request.activationdate, request.expirationdate, request.modifieddate, request.foldername, request.group); temp_files.del_db_files_rec(); } if ((request.mode == "M") || (request.mode == "D")) { temp_files = new files_rec(unescape(request.filename), "", request.description, request.format, request.ownerid, request.folderid, request.activationdate, request.expirationdate, request.modifieddate, request.foldername, request.group); result = temp_files.get_db_files_rec(); temp_files.location = determine_location(temp_files.group, ""); request.group = temp_files.group; } if (request.mode == "update") { temp_files = new files_rec(request.filename, "", request.description, request.format, request.ownerid, request.folderid, request.activationdate, request.expirationdate, request.modifieddate, request.foldername, request.group); temp_files.location = determine_location(temp_files.group, temp_files.filename); upd = temp_files.upd_db_files_rec(); if (upd == 0 ) {result = temp_files.get_db_files_rec();} else { result = false;} } if ((request.mode != "dump") && (result)) { write(''); write(''); write('Description | '); write(''); if ((request.mode == "add") || (request.mode == "M")) { write(''); } else {write(''); write(temp_files.description); } write(' | '); write('
---|---|
Format | '); write(''+temp_files.format+' |
Folder | '); write(''+temp_files.foldername+' |
Owner ID | '); write(''); write(''); write(temp_files.ownerid); write(' | '); write('