Gossamer Forum
Home : Products : DBMan : Customization :

Check if a record is already open for modify

Quote Reply
Check if a record is already open for modify
I want to check if a record is already open by a user for modyfy it.
for example

User 1 open the record with the Record ID 10 for modify
User 2 open the record with the Record ID 10 for modify

now i want to display a message to user 2

Message:

error the record you want to modify is already open for modify
user 1 is working on it

Does anyone know how to do this

Thanks

Luis

Quote Reply
Re: Check if a record is already open for modify In reply to
I can't write the code for you, but I can point you in the right direction. I would create a new sub directory and reuse some of the code already written in the authorization routines (e.g. instead of writing/deleting a file when a user logs in/out, writing/deleting a file when a user modifies/ends modifying a record). If you pay attention to the section of code with $auth_dir/$db_uid in subs auth_check_password and auth_cleanup in auth.pl, you should be able to get it to work. The problem will be when a user begins to modify a record, and then doesn't by clicking to another page that may be outside of your site. You could get around this by using JavaScript to create a time-out for modifying a record.