Additional Considerations
October 9, 2000
You may be wondering, "Great, so how do I get the files into
the database in the first place?" Well, you can add them in one
by one, manually, but we know you don't want to do that. One
easy way would be to build a simple recursive FileSystemObject
script that starts at a specified directory, and inputs all files
under it. For example:
<%
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
call AddFiles(fso.GetFolder("c:\inetpub\wwwroot\blah"))
Function AddFiles(Folder)
For Each File In Folder.Files
'insert files into database here
Next
For Each Subfolder In Folder.SubFolders
call AddFiles(Subfolder)
Next
End Function
%>
This would be a nice and easy way to get all your documents in the
right places in one batch update. You could then build a simple interface
to add individual files later on.
Another topic we haven't covered here is version control.
Version control is a feature of many commercial source control systems
today - essentially, it allows you to revert to, and compare between,
previous versions
of a file. To accomplish this, immediately before a user checks
a file in, you would have to save a copy of the original file in a
different location. Each time the user checks a file in, you save a new
copy. This archive can get quite large quickly, so backups or archiving
may be in order. You will also need to store the version information
in a database, so users can easily keep track of them, as well as
develop a naming scheme so that the copies' filenames will always
be unique.
It may also be helpful to ensure that each user has a unique username
in the database. If two different users are using the same account,
then they may run the chance that one person could check the other
person's files in and out. With the system we designed, it isn't
much of a problem, because the users will always have a local
copy of the file as well, so no changed will get lost, theoretically.
Still, it is a good safety mechanism.
The system described so far does not allow users to view files that are
currently checked out. An easy remedy to this would be to add links
to the PrintTree function we outlined a few pages ago. You could
hyperlink the file names, which would take you to a download form
like the one on the previous page. The only difference would be
that this download form doesn't do anything with the file
attributes - the copy the user downloads would be read-only, and
they would not check the file out. Thus, anyone can view the files
at any time - this is helpful if you needed a second pair of eyes
to help you figure out a nasty problem, or just to check up on someone.
For example:
if strComp(rst(2), strUser) = 0 then
Response.write("|-<input type=""checkbox"" name=""file"" " & _
"value=" & rs(1) & " CHECKED><b><a href=""downloadform.asp?id=" & _
rs(1) & """>" & rst(0) & "</a></b><br>")
elseif rst(2) <> "" then
Response.write("|-<input type=""checkbox"" name=""file"" " & _
"value=" & rs(1) & " CHECKED DISABLED><a href=""downloadform.asp?id=" & _
rs(1) & """>" & rst(0) & "</a><br>")
else
Response.write("|-<input type=""checkbox"" name=""file"" " & _
"value=" & rs(1) & " ><a href=""downloadform.asp?id=" & _
rs(1) & """>" & rst(0) & "</a><br>")
end if
Finally, it is important to realize the benefit of this application as
a web based system. For one thing, users can check out and edit documents
wherever they are. This paradigm also overcomes a lot of the problems
traditional source control applications endure, such as developers
who are in different geographic locations and cannot work on the same
network. We won't even mention the difficulties in setting up and
configuring traditional applications (okay, so maybe we'll just
mention it).
Getting Files
Effective Source Control
Conclusion
|