Administration
July 10, 2000
"Great," you say. "So now my writers can publish their own content.
What happened to the proofreading and editing you promised me?"
Fear not, this is the best part. We want to build a system that allows
the editors (most likely you) to proof, publish, delete, and otherwise
play with the article that was just submitted by the writer. Since all
the important info is stored in the database, this part will be a snap.
First, build an adminstrator's form. Using a for loop, loop through all
the documents in the database that are not marked 'Published' and list
them in an HTML Select element. For each option, store a unique
variable that identifies that particular article, such as the UID:
<%
Set connArticles = Server.CreateObject("ADODB.connection")
Set rstArticles = Server.CreateObject("ADODB.Recordset")
connArticles.Open "dsn=my_db;DATABASE=my_db"
strSQL = "SELECT * FROM tblContent WHERE NOT Published = True"
rstArticles.Open strSQL, ConnArticles, adOpenKeyset, adLockOptimistic
if not rstArticles.EOF then
%>
<select name="DocTitle" size="10">
<% do until rstArticles.EOF %>
<option value="<% = rstArticles("UID") %>"><% = rstArticles("Title") %>lt;/option>
<% rstArticles.movenext
loop
%>
</select>
<% end if
rstArticles.Close
set rstArticles = nothing
set connArticles = nothing
%>
<input type="submit" value=" Edit Title " name="Submit">
<input type="submit" value=" Publish " name="Submit">
<input type="submit" value=" Delete Article " name="Submit">
When the form is submitted, simply check the value of the submit input
by using a Request.Form("Submit"). If the value is
'Edit Title', then redirect to a page that allows the user to change
the title of the article in the database. The 'Publish' option would
change the Published field in the database to true, and the
'Delete Article' option deletes the article from the database, and uses
the file system object to delete the actual file. Since you know the
path/filename of the article, by providing a link to it on the
same page, the editor can also proofread it or save a local copy on
his/her hard drive. If you'd like to edit the content online, simply
use the file system object to extract the content and place it in an
HTML textarea. Make your changes in the textarea, and use the FSO to
write the changes to the file when you're done.
What about images?
Content Management Made Easy with ASP
A few notes
|