Link to home
Start Free TrialLog in
Avatar of g118481
g118481

asked on

How do I show a file is checked out?

I'm using cffile to upload files to a folder, and I am writing the data on the files to a db table.

Now I want to institute some kind of check in, check out system for the files.  Does anyone have any ideas on how I should do this?
Avatar of Nathan Stanford Sr
Nathan Stanford Sr
Flag of United States of America image

You are going to shoot me but why do not add a field for the id of who checked it out and make it 0 when it is checked back in.  This way you will know who checked out the file as well as the fact it is checked out?

Plus that way you can have an admin who can see if the person who checked out the file is on vacation or left work without checking it back in... they can then check it back in.

Is this what your wanting? or something more?

Avatar of g118481
g118481

ASKER

nathans,

You raised a very good point.
I will have to work on that aspect after I get my primary task figured out

Which is, how do I or what mechanism do you suggest I use to check out the file?  Right now in test I have a link to the document, and they would be able to download this document there.  Also, the update(edit) form allows them to update an existing document.  How can I write a 1 or 0 to the checked out field, and then the checked in field?  How will it know?
what is the purpose of this.. do you want to lock down a file completely when a user has downloaded it until they upload/update it again or just for the duration of the upload/update.

CJ
Avatar of g118481

ASKER

yes, I need to be able to lock the upload/update function when someone is working on a document.
I am assuming that the site requires authentication?

CJ
Sorry to sound bad but do you know how to update a database using SQL?

If so then simply

<cfquery name="qry" datasource="dsn">
update mytable
Set
  Checkout=1
</cfquery>

Done... now don't allow downloads of the ones with Checkout equal 1


On upload of the new version...

<cfquery name="qry" datasource="dsn">
update mytable
Set
  Checkout=0
</cfquery>

Done... now allow downloads of the ones with Checkout equal 0


Am I missing something? or is this the answer? or do you need more?  Are you meaning in Studio or from your web App?





Avatar of g118481

ASKER

cheekycj,

yes, the web app will do authentication for upload/update of files.

nathans,

my question is based more around the framework for applying this procedure to the web app.

The obstacle I need to overcome is how will the db table know the file has been downloaded?  At first sight this may be a silly question to you.  However, listen to this scanario.

The user can click on a link to each file and download it. Then they can go to the upload page and upload or update that same document without ever checking it out.

How do I place a query to change the new field (checkout) in the table to checked out when the user clicks on the link to the file?  The links are simply a listing of the files in the repository that have been uploaded.

How do I overcome this?
ASKER CERTIFIED SOLUTION
Avatar of cheekycj
cheekycj
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of g118481

ASKER

cheekycj,

your framework works perfect.
thanks for your time.
Glad I could help and thanx for the "A".

CJ