Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 132
  • Last Modified:

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?
0
g118481
Asked:
g118481
  • 4
  • 4
  • 2
1 Solution
 
nathansCommented:
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?

0
 
g118481Author Commented:
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?
0
 
cheekycjCommented:
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
0
Easily Design & Build Your Next Website

Squarespace’s all-in-one platform gives you everything you need to express yourself creatively online, whether it is with a domain, website, or online store. Get started with your free trial today, and when ready, take 10% off your first purchase with offer code 'EXPERTS'.

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

CJ
0
 
nathansCommented:
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?





0
 
g118481Author Commented:
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?
0
 
cheekycjCommented:
you will have to trigger the DB update when the file is downloaded.

your links will be like:

<a href="checkout.cfm?file=filename.doc">Click to download</a><br>


checkout.cfm will look like:

<cfif isdefined("URL.file")>
    <!--- put query here to update flag to check out file --->
    <CFHEADER NAME="Content-Disposition" VALUE="filename=#URL.file#">
    <cfcontent type="attachment" file="/path/to/downloads/#URL.file#">
</cfif>

Does that make sense?

CJ

0
 
g118481Author Commented:
cheekycj,

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

CJ
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get 10% Off Your First Squarespace Website

Ready to showcase your work, publish content or promote your business online? With Squarespace’s award-winning templates and 24/7 customer service, getting started is simple. Head to Squarespace.com and use offer code ‘EXPERTS’ to get 10% off your first purchase.

  • 4
  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now