home *** CD-ROM | disk | FTP | other *** search
/ Australian Personal Computer 1999 April / APC443.iso / features / grpware / coldfus / coldfusi.exe / data1.cab / Examples / publish / admin / addcontent.req.cfm < prev    next >
Encoding:
Text File  |  1998-10-08  |  3.5 KB  |  124 lines

  1. <!--- This template gets user input for REQUIRED content types.
  2.     The Session variable Session.AddContent.ReqContentTypes
  3.     holds a list of content types to be added, and the variable
  4.     URL.CurrPos indicates which item on the list we are dealing
  5.     with. --->
  6.  
  7. <CFSET CurrID = ListGetAt(Session.AddContent.ReqContentTypes, URL.CurrPos)>
  8. <CFSET CurrName = ListGetAt(Session.AddContent.ReqContentTypeNames, URL.CurrPos)>
  9.  
  10. <!--- Find out whether this content type is a file --->
  11. <CFQUERY DATASOURCE="CFexamples" NAME="GetContentType">
  12. SELECT * FROM PubContentTypes
  13. WHERE TypeID = #CurrID#
  14. </CFQUERY>
  15.  
  16. <CFIF GetContentType.RecordCount NEQ 0>
  17.     <CFIF "Headline,Teaser,Body" CONTAINS GetContentType.TypeName>
  18.         <CFSET SampleText = "Enter your text...">
  19.     <CFELSEIF GetContentType.TypeName IS "HREF">
  20.         <CFSET SampleText = "http://your.server.com/">
  21.     </CFIF>
  22. </CFIF>
  23. <CFPARAM NAME="SampleText" DEFAULT="">
  24.  
  25. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
  26.  
  27. <HTML>
  28. <HEAD>
  29.     <TITLE>Add Content</TITLE>
  30. <STYLE TYPE="text/css">
  31. <!-- A {text-decoration: none} -->
  32. </STYLE>
  33. </HEAD>
  34.  
  35. <BODY BGCOLOR="#660000" TEXT="#FFFFFF" LINK="#FFFF00" VLINK="#FFFF00">
  36.  
  37. <TABLE ALIGN="RIGHT" CELLPADDING="0" CELLSPACING="0">
  38. <TR>
  39.     <TD ALIGN="RIGHT">
  40.     <FONT FACE="MS Sans Serif, Helvetica" SIZE="-2">
  41.         <A HREF="index.cfm">Administrator Home</A>
  42.     </FONT>
  43.     </TD>
  44. </TR>
  45. </TABLE>
  46.  
  47. <P><IMG SRC="images/addcontent.gif" WIDTH=109 HEIGHT=20 BORDER=0 ALT="Add Content"></P>
  48.  
  49. <FORM ACTION="addcontent2.req.cfm" METHOD="POST">
  50.  
  51. <CFOUTPUT>
  52.     <INPUT TYPE="HIDDEN" NAME="CurrPos" VALUE="#URL.CurrPos#">
  53.     <INPUT TYPE="HIDDEN" NAME="CurrItem" VALUE="#CurrID#">
  54. </CFOUTPUT>
  55.  
  56. <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0">
  57. <TR>
  58.  
  59.     <TD VALIGN="TOP" WIDTH="100">
  60.  
  61.     <P><FONT FACE="MS Sans Serif, Helvetica" SIZE="-1">
  62.     <CFLOOP LIST="#Session.AddContent.ReqContentTypeNames#" INDEX="TypeName">
  63.         <CFIF TypeName IS CurrName>
  64.             <B><CFOUTPUT>#TypeName#</CFOUTPUT></B><BR>
  65.         <CFELSE>
  66.             <FONT COLOR="#999999"><CFOUTPUT>#TypeName#</CFOUTPUT></FONT><BR>
  67.         </CFIF>
  68.     </CFLOOP>
  69.     </FONT></P>
  70.  
  71.     <P><FONT FACE="MS Sans Serif, Helvetica" SIZE="-1">
  72.     <CFLOOP LIST="#Session.AddContent.OptContentTypeNames#" INDEX="TypeName">
  73.         <FONT COLOR="#999999"><CFOUTPUT>#TypeName#</CFOUTPUT></FONT><BR>
  74.     </CFLOOP>
  75.     </FONT></P>
  76.  
  77.     </TD>
  78.  
  79.     <TD>   </TD>
  80.  
  81.     <TD VALIGN="TOP">
  82.  
  83.     <CFIF GetContentType.TypeFile IS TRUE>
  84.  
  85.         <CFDIRECTORY ACTION="LIST" DIRECTORY="#ExpandPath("../binarydata")#" NAME="BinDir">
  86.  
  87.         <CFOUTPUT><SELECT NAME="Type#CurrID#" SIZE="#Min(10,BinDir.RecordCount)#" onChange="if (this.selectedIndex == 1) this.selectedIndex = 0"></CFOUTPUT>
  88.             <OPTION VALUE="|0">Upload new file...
  89.             <OPTION VALUE="|1">------------------------
  90.         <CFOUTPUT QUERY="BinDir">
  91.             <CFIF NOT (Name IS "." OR Name IS "..")><OPTION>#Name#</CFIF>
  92.         </CFOUTPUT>
  93.         </SELECT>
  94.  
  95.     <CFELSE>
  96.  
  97.         <CFIF IsDefined("Session.AddContent.Content.Type" & CurrID)>
  98.             <CFSET PreviousText = evaluate("Session.AddContent.Content.Type" & CurrID)>
  99.         <CFELSE>
  100.             <CFSET PreviousText = "">
  101.         </CFIF>
  102.     
  103.         <CFOUTPUT>
  104.             <CFIF PreviousText IS "">
  105.                 <TEXTAREA COLS="40" ROWS="12" NAME="Type#CurrID#">#SampleText#</TEXTAREA>
  106.             <CFELSE>
  107.                 <TEXTAREA COLS="40" ROWS="12" NAME="Type#CurrID#">#evaluate("Session.AddContent.Content.Type" & CurrID)#</TEXTAREA>
  108.             </CFIF>
  109.         </CFOUTPUT>
  110.  
  111.     </CFIF>
  112.  
  113.     <P><INPUT TYPE="SUBMIT" VALUE="Next >"></P>        
  114.  
  115.     </TD>
  116.     
  117. </TR>
  118. </TABLE>
  119.  
  120. </FORM>
  121.  
  122. </BODY>
  123. </HTML>
  124.