form_entry.cfm


<!--- template name: form_entry.cfm  --->

<!--- Test for existence of formfields, a requirement for this template --->

<CFIF parameterExists(form.last_name)>

<!--- Insert form values into database, I've setup an ODBC mapping in the ColdFusion administrator and named it 'cfauthors',  --->

<CFINSERT datasource="cfauthors" tablename="dealer" formfields="first_name,last_name,phone,email,bio,synopsis">

<!--- Now that the bio has been entered, its time to fill-in the index table  --->
<CFQUERY datasource="cfauthors" name="Last_entry">
   SELECT max(record_id) as newrecord_id
   FROM dealer
</cfquery>

<!--- I'll loop over the comma delimited department list, a natural product of a multiple select box or a series of checkboxes.  Its HTTP 101 and reminds me that list functions are the key to happiness. --->

<CFLOOP FROM="1" TO="#ListLen(form.department)#" index="getat">
	<CFSET variables.hold_dept = ListGetAt(form.department,getat)>
	<CFQUERY datasource="cfauthors" name="index_to_depts">
		INSERT INTO department (record_id,department)
		VALUES (#Last_entry.newrecord_id#,'#variables.hold_dept#')
	</cfquery>
</cfloop>

<!--- Present some indication that insert was successful --->

<h2>Record Added, Departments Indexed</h2><br>
To return to the admin home page, <a href="codelist.cfm">press here</a>.<br>
If you would like to make another entry, use the form below.<br>
</cfif>

<CFFORM action="form_entry.cfm" method="post">
First Name: <CFINPUT type="text" name="first_name" required="yes" message="Don't forget the First Name"><br>
Last Name: <CFINPUT type="text" name="last_name" required="yes" message="Don't forget the Last Name"><br>
Phone: <CFINPUT type="text" name="phone" required="yes" message="Don't forget the phone number"><br>
Email: <CFINPUT type="text" name="email" required="yes" message="Don't forget email!"><br>
Synopsis: <textarea name="synopsis" rows="2" cols="40" wrap="VIRTUAL"></textarea><br>
Bio: <textarea name="bio" rows="4" cols="40" wrap="VIRTUAL"></textarea><br>
Departments:<br>
	<input type="checkbox" name="department" value="Ferrari Sales">Ferrari Sales<br>
	<input type="checkbox" name="department" value="Yugo Sales">Yugo Sales<br>
	<input type="checkbox" name="department" value="Ferrari Service">Ferrari Service<br>
	<input type="checkbox" name="department" value="Yugo Service">Yugo Service<br>
	<input type="checkbox" name="department" value="Financing">Financing<br>
<input type="checkbox" name="department" value="Management">Management<br>
<input type="submit" value=" - - Add Your Employee - - ">
</cfform>

edit_list_all.cfm


<!--- edit_list_all.cfm --->
<CFQUERY datasource="cfauthors" name="get_all_records">
TABLE DEALER
</cfquery>
 Hey Enzo, press on the employee's name below to edit his/her record:<br>
<CFOUTPUT query="get_all_records">
<a href="edit_record.cfm?record_id=#record_id#">#first_name# #last_name#</a><br>
</cfoutput>

edit_record.cfm


<!--- template name: edit_record.cfm --->
<CFSET variables.dept_list = " ">

<!--- Query both data tables, use inner join to create a full record for each available pair --->
<CFQUERY datasource="cfauthors" name="get_this_record">
    SELECT dealer.Record_ID, dealer.Last_Name, dealer.First_Name, dealer.email, dealer.phone,     
    dealer.synopsis, dealer.bio, department.department
    FROM dealer INNER JOIN department ON dealer.Record_ID = department.record_id
    WHERE dealer.Record_ID = #url.record_id#
</cfquery>

<!--- Convert query results to a list--->
<CFOUTPUT query="get_this_record">
	<CFSET variables.dept_list = listAppend(variables.dept_list, Department)>
</cfoutput>

edit_record2.cfm


<CFOUTPUT>
<FORM action="process_edit.cfm" method="post">
First Name: <INPUT type="text" name="first_name" value="#get_this_record.first_name#"><br>
Last Name: <INPUT type="text" name="last_name" value="#get_this_record.last_name#"><br>
Phone: <INPUT type="text" name="phone" value="#get_this_record.phone#"><br>
Email: <INPUT type="text" name="email" value="#get_this_record.email#"><br>
Synopsis: <textarea name="synopsis" rows="2" cols="40" wrap="VIRTUAL">#get_this_record.synopsis#</textarea><br>
Bio: <textarea name="bio" rows="4" cols="40" wrap="VIRTUAL">#get_this_record.bio#</textarea><br>

edit_record3.cfm


   <input type="checkbox" name="department" value="Ferrari Sales" <CFIF variables.dept_list CONTAINS "Ferrari Sales">checked</cfif>>Ferrari Sales<br>
	<input type="checkbox" name="department" value="Yugo Sales" <CFIF variables.dept_list CONTAINS "Yugo Sales">checked</cfif>>Yugo Sales<br>
	<input type="checkbox" name="department" value="Ferrari Service" <CFIF variables.dept_list CONTAINS "Ferrari Service">checked</cfif>>Ferrari Service<br>
	<input type="checkbox" name="department" value="Yugo Service" <CFIF variables.dept_list CONTAINS "Yugo Service">checked</cfif>>Yugo Service<br>
	<input type="checkbox" name="department" value="Financing" <CFIF variables.dept_list CONTAINS "Financing">checked</cfif>>Financing<br>
	<input type="checkbox" name="department" value="Management" <CFIF variables.dept_list CONTAINS "Management">checked</cfif>>Management<br>
	<input type="hidden" name="record_id" value="#url.record_id#">
	<input type="submit" value=" - - Update Your Employee - - ">
</form>
<br>
To delete this employee, <a href="process_edit.cfm?record_id=#record_id#">Press This</a>
</cfoutput>

process_edit.cfm


<CFIF parameterExists(form.record_id)>
<!--- CFUPDATE must include a primary key field (in this case, record_id) --->
<!--- Formfields must be specified, because there are extraneous fields submitted from the department --->
<CFUPDATE datasource="cfauthors" tablename="dealer" formfields="Record_ID, Last_Name, First_Name, email, phone, synopsis, bio">

<!--- Since deleting a department is a function of "unchecking" a checkbox, you must delete all departments associated with a record_id then rebuild the departments --->
<CFQUERY datasource="cfauthors" name="delete_departments">
	DELETE * FROM department WHERE record_id = #form.record_id#
</cfquery>

<!--- Checkboxes return a list, so this loop will insert a record_id:department pair for each checkbox selected. Note the 2 functions: ListLen and ListGetAt --->
<CFIF ParameterExists(form.department)>
	<CFLOOP FROM="1" TO="#ListLen(form.department)#" index="getat">
		<CFSET local.dept = ListGetAt(form.department,getat)>
		<CFQUERY datasource="cfauthors" name="loopins">
			INSERT INTO department (record_id,department)
			VALUES (#form.record_id#,'#local.dept#')
		</cfquery>
	</cfloop>
</cfif>

</cfif>
<!--- a url.record_id is passed to delete this record --->
<CFIF ParameterExists(url.record_id)>
	<CFQUERY datasource="cfauthors" name="delete_record">
		DELETE * FROM department WHERE record_id = #url.record_id#
	</cfquery>
	<CFQUERY datasource="cfauthors" name="delete_record">
		DELETE * FROM dealer WHERE record_id = #url.record_id#
	</cfquery>
</cfif>
<CFLOCATION url="edit_list_all.cfm">

display.cfm


<!--- template name: display.cfm --->
<!--- build a static page that has links to this app appended with a urlencoded department name --->
<CFPARAM default="ferrari sales" name="url.department">
<!--- just in case --->

<CFQUERY datasource="cfauthors" name="getEmployees">
	SELECT department.department, department.record_id, dealer.Last_Name, dealer.First_Name, dealer.synopsis
	FROM dealer INNER JOIN department ON dealer.Record_ID = department.record_id
	GROUP BY department.department, department.record_id, dealer.Last_Name, dealer.First_Name, dealer.synopsis
	HAVING  department.department = '#url.department#'
</cfquery>

<CFOUTPUT group="department" query="getEmployees">
<b>#department#</b><br>
	<CFOUTPUT>
	<a href="display_employee.cfm?record_id=#record_id#">#first_name# #last_name#</a> #synopsis#<br>
	</cfoutput>
</cfoutput>

display_employee.cfm


<!--- template name: display_employee.cfm --->

<CFQUERY datasource="cfauthors" name="show_employee">
	SELECT * FROM dealer 

</cfquery>

<CFOUTPUT query="show_employee">
<b>#First_Name# #Last_Name#</b> #phone# <a href="mailto:#email#">#email#</a><br>
#bio#<br><br>
</cfoutput>

codelist.cfm


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- Rod 3/10/00 -->
<html>
<head>
	<title>Untitled</title>
</head>

<body>
<p>
<a href="form_entry.cfm">form_entry.cfm</a>  Enter New Employee<br>
<a href="edit_list_all.cfm">edit_list_all.cfm</a> Edit Employees<br>
edit_record.cfm<br>
process_edit.cfm<br>
<a href="display.cfm?department=ferrari%20sales">display.cfm</a>  Ferrari Sales<br>
<a href="display.cfm?department=ferrari%20service">display.cfm</a>  Ferrari Service<br>
<a href="display.cfm?department=Yugo%20sales">display.cfm</a>  Yugo Sales<br>
<a href="display.cfm?department=Yugo%20service">display.cfm</a>  Yugo Service<br>
<a href="display.cfm?department=Financing">display.cfm</a>  Financing<br>
<a href="display.cfm?department=Management">display.cfm</a>  Management<br>
<a href="display_employee.cfm">display_employee.cfm</a>  Display All Employees<br>

<p><a href="bunkie.zip">Download Zipped .cfm Files</a>

</body>
</html>

JSV_getFullYear.cfm




function JSV_getFullYear() {
    var yearInQuestion = 
            ( typeof JSV_getFullYear.arguments[0] == "object" ? 
              JSV_getFullYear.arguments[0].getYear() : 
              parseInt(JSV_getFullYear.arguments[0])
            );
    return ( yearInQuestion < 1000 ? yearInQuestion + 1900 : yearInQuestion );
}

JSV_getDocumentLastModified.cfm




function JSV_getDocumentLastModified() {
    var cutOffYear = 
	(  JSV_getDocumentLastModified.arguments.length == 1 ?
                        parseInt(JSV_getDocumentLastModified.arguments[0]) :
                        60 );
    var dlm = document.lastModified;
    var documentLastModified = 
	"unknown";
    if ( Date.parse(dlm) != 0 ) {
        var between_Date_and_Time = 
		dlm.indexOf(" ");
        var datePortion = dlm.substring(0,between_Date_and_Time);
        var dlmYear = 
		parseInt( datePortion.substring(6,datePortion.length) );
        if ( datePortion.length != 10 ) {
             dlmYear = 
		( dlmYear < 
			cutOffYear ? dlmYear+2000 : dlmYear+1900 );
        }
        documentLastModified =  datePortion.substring(0,6) + 
             dlmYear + 
             " " + 
             dlm.substring(between_Date_and_Time+1,dlm.length);
    }
    return documentLastModified;
}

JSV_isLeapYear.cfm




function JSV_isLeapYear(year) {
    return (year%4 
	== 0 && (year%100 != 0 || year%400 == 0)
		 ? true : false);
}

Figure2.cfm


Figure 2 - Example CSS for JSV_calendar

<STYLE TYPE="text/css"></style>
.jsvCalendarTable {
    font-size : 9pt;
    font-family : Verdana,Helvetica,Arial;
}

.jsvCalendarHeader  {
    font-size : 9pt;
    font-family : Verdana,Helvetica,Arial;
    font-weight : bold;
    text-align : center;
    font-style : normal;
    color : White;
    background-color : #800000;
}

.jsvCalendarDayHeader {
    font-size : 9pt;
    font-family : Verdana,Helvetica,Arial;
    font-weight : bold;
    text-align : center;
    font-style : normal;
    color : White;
    background-color : Black;
}

.jsvCalendarDay {
    font-size : 9pt;
    font-family : Verdana,Helvetica,Arial;
    font-weight : normal;
    text-align : center;
    font-style : normal;
    color : Black;
    background-color : White;
}

.jsvCurrentDay {
    font-size : 9pt;
    font-family : Verdana,Helvetica,Arial;
    font-weight : normal;
    text-align : center;
    font-style : normal;
    color : White;
    background-color : #800000;
}

.jsvBlankCells {
    font-size : 9pt;
    font-family : Verdana,Helvetica,Arial;
    font-weight : bold;
    text-align : center;
    font-style : normal;
    color : Black;
    background-color : White;
}

Figure3.cfm


Figure 3 - JSV_calendar Code

function _tableAttributes(expT) {
    var attributes = '';
    if (expT != null) {
        var attributesArray = expT.split(':');
        var attributesLength = attributesArray.length;
        if (attributesLength >= 2 && attributesLength % 2 == 0) {
            var i = 0;
            for (i=0; i<attributesLength; i++) {
                if ( i % 2 == 0 )
                    attributes = attributes + ' ' + attributesArray[i] + '=' + '\"';
                else
                    attributes = attributes + attributesArray[i] + '\"';
            }
        }
    }
    return ( attributes.length == 0 ? ' border=\"1\"' : attributes );
}

function JSV_calendar(expD, expT) {
    var today = new Date();
    if (expD != null) today = expD;

    var tableAttributes = _tableAttributes(expT);

    var thisYear = JSV_getFullYear(expD),
        thisDay = expD.getDate(),
        thisMonth = expD.getMonth(),
        nDays = daysInMonth[thisMonth];

    if (thisMonth == 1) nDays += (JSV_isLeapYear(thisYear) ? 1 : 0);
    var internalDate = new Date(thisYear, thisMonth, 1);
    internalDate.setDate(1);
    var startDay = internalDate.getDay();

    document.write("<table" + tableAttributes + " CLASS=\"jsvCalendarTable\">");
    document.write("<tr class=\"jsvCalendarHeader\"><th colspan=\"7\">");
    document.write(JSV_cMonth(today));
    document.write(" ");
    document.write( thisYear );
    document.write("</th>");
    document.write("<tr class=\"jsvCalendarDayHeader\"><th>Sun</th><th>Mon</th><th>Tue</th><th>Wed</th><th>Thu</th><th>Fri</th><th>Sat</th>");
    document.write("<tr>");

    column = 0;
    for (i=0; i<startDay; i++) {
        document.write("<td class=\"jsvBlankCells\"> </td>");
        column++;
    }

    for (i=1; i<=nDays; i++) {
        if (column == 0) document.write("<tr>");

        if (i == thisDay) {
            document.write("<td align=\"center\" class=\"jsvCurrentDay\">");
            document.write("<FONT COLOR=\"red\" class=\"jsvCurrentDay\">");
        }
        else
            document.write("<td align=\"center\" class=\"jsvCalendarDay\">");
        document.write(i);
        if (i == thisDay) document.write("</FONT>");
        document.write("</td>");

        column++;
        if (column == 7) {
            document.write("</tr>"); 
            if (i != nDays) column = 0;
        }
    }
    if (column != 7) {
        for (i=0; i<7-column; i++) document.write("<td class=\"jsvBlankCells\"> </td>");
    }
    document.write("</tr></table>");
}

create_collection.cfm


<!--- template name: create_collection.cfm --->

<CFINDEX 
	ACTION="REFRESH" 
	COLLECTION="KnowledgeBase"
	KEY="X:\knowledgebase" 
	TYPE="PATH" 
	EXTENSIONS=".htm, .cfm, .dbm, .txt, .htm*, .doc, .rtf, .pdf, *." 
	RECURSE="Yes">

collection_timer_advise.cfm


<!--- template name: collection_timer_advise.cfm --->

<CFSET starttime=now()>
<CFINDEX ACTION="REFRESH"
	COLLECTION="KnowledgeBase"
	KEY="\\mswebserver\x-drive\knowledgebase"
	TYPE="PATH"
	EXTENSIONS=".htm, .cfm, .dbm, .txt, .htm*, .doc, .rtf, .pdf, *."
	RECURSE="Yes">
<CFMAIL 
	TO="michael@teratech.com" FROM="michael@teratech.com"
	SUBJECT="Knowledgebase refresh"
	SMTPSERVER="smtp.teratech.com">
Knowledge base successfully refeshed
Time taken: #DateDiff('s', starttime, now())# seconds.<br>
</cfmail>

index_queryset.cfm


<!--- template name: index_queryset.cfm --->

<CFQUERY NAME="Messages" DATASOURCE="TestDatasource">
   SELECT Message_ID , Body, UserName
   FROM Messages 
</CFQUERY>
<CFINDEX COLLECTION="Messages" 
   ACTION="UPDATE" 
   TYPE="CUSTOM"  
   BODY="Body"  
   KEY="Message_ID"  
   TITLE="UserName" 
   QUERY="Messages">

title_attribute.cfm


<!--- template name: title_attribute.cfm --->

<CFOUTPUT>
   Message number #SearchOutput.Message_ID# was written by
     #SearchOutput.TITLE#.
</CFOUTPUT>

search_results.cfm


<!--- template name: search_results.cfm --->

<TABLE BORDER="0" CELLPADDING="2" CELLSPACING="2">
<TR>
<TD><B>Score</B></TD><TD><B>Summary</B></TD>
</TR>
<CFOUTPUT QUERY="Articles" STARTROW=#StartAt# MAXROWS=#stepsize#>
<TR>
<TD WIDTH="30%" VALIGN="TOP">#score#</td>
<TD WIDTH="70%" VALIGN="TOP">
<A HREF="/knowledgebase/#URLEncodedFormat(url)#/#Replace(url, ' ', '','ALL')#" TARGET="_new">
<B>#Replace(key, "\\mswebserver\x-drive\knowledgebase\", '','ALL')#</B></A>
<BR>#HTMLEditFormat(Summary)# 
</TD>
</TR>
</CFOUTPUT>
</TABLE>

Example 1.1, Inserting a Date in Oracle 7.3


<!--- Example 1.1, Inserting a Date in Oracle 7.3 --->

<CFQUERY NAME="TABLE1" DATASOURCE="MyDataSource">
UPDATE 	TABLE1
SET 	THEDATE = #CreateODBCDateTime(Now())#
</CFQUERY>

Example 1.2, Inserting or Updating a Date in 8I


<!--- Example 1.2, Inserting or Updating a Date in 8I --->

<cfset theDate = #DateFormat(CreateODBCDateTime(Now()), "MM/DD/YYYY")#>
<cfset theTime = #TimeFormat(CreateODBCDateTime(Now()), "HH:MM")#>

<CFQUERY NAME="TABLE1" DATASOURCE="MyDataSource">
UPDATE 	TABLE1
SET 	THEDATE = TO_DATE('#theDate# #theTime#', 'MM/DD/YYYY HH24:MI') 
</CFQUERY>

Example 2.1, Updating a Date information from one table to another


<!--- Example 2.1, Updating a Date information from one table to another --->

Previously:

<CFQUERY NAME="TABLE1" DATASOURCE="MyDataSource">
SELECT	*
FROM	TABLE1
</CFQUERY>

<CFQUERY NAME="Table2" DATASOURCE="MyDataSource">
INSERT INTO TABLE2(THISDATE) 
VALUES(TO_DATE('#TABLE1.THISDATE#', 'YYYY-MM-DD HH24:MI:SS'))
</CFQUERY>


8i:

<CFQUERY NAME="TABLE1" DATASOURCE="MyDataSource">
SELECT	*
FROM	TABLE1
</CFQUERY>

<CFQUERY NAME="SomeQuery" DATASOURCE="MyDataSource">
INSERT INTO TABLE2(THISDATE)
VALUES('#TABLE1.THISDATE#')
</CFQUERY>

Example 3.1, Date selection without mask


<!--- Example 3.1, Date selection without mask  --->

Previously:

<cfquery name="GetTime" datasource="MyDataSource">
SELECT   StartTime
FROM     TABLE1
</cfquery>

Reference the time value as "#GetTime.StartTime#"

Example 3.2, Selecting a Date in 8i correctly


<!--- Example 3.2, Selecting a Date in 8i correctly --->

<cfquery name="GetTime" datasource="MyDataSource">
SELECT TO_CHAR(StartTime,'DD-MM-YYYY HH24:MI:SS') PROPER_TIME
FROM TABLE1
</cfquery>

Reference the time value as "#GetTime.proper_time#"

WddxExtract.cfm Extract data


<!--- WddxExtract.cfm Extract data --->

<CFQUERY NAME="getData" DATASOURCE="#URL.DataSource#">
		SELECT * 
		FROM #URL.TableName#
	</CFQUERY>

<!--- Serialize data extracted to WDDX format--->

<CFWDDX ACTION="CFML2WDDX" INPUT="#getData#">

LoadData.cfm - Run extract on development server


<!--- LoadData.cfm - Run extract on development server --->

<CFHTTP
URL="http://devweb.yourcompany.com/somedirectory/WddxEXtract.cfm?TableName=Incidents&DataSource=DevDb"
METHOD="GET"
PROXYPORT="81">
</CFHTTP>		

<!--- Convert data extracted from WDDX format to CFML --->

<CFWDDX ACTION="WDDX2CFML" INPUT="#CFHTTP.FileContent#" OUTPUT="getData"> 
		
<!--- Optional: Create new table --->		
<!--- Insert table creation SQL below --->

<!--- Optional: Delete data from production table --->
<!--- Insert delete SQL below --->	
	
<!--- Loop through extracted data and insert into production table --->	

<CFOUTPUT QUERY="getData">		
<CFQUERY NAME="insData" DATASOURCE="ProdDb" DBTYPE="ODBC">
	INSERT INTO Incidents
	VALUES('#getData.ID#',
		 '#getData.Severity#',
		 '#getData.LastName#',
		 '#getData.FirstName#',
	    '#getData.CallDetails#',
	    #CreateODBCDateTime(getData.DateOccurred)#,
		 '#getData.Status#',
		 '#getData.AssignedTo#',
		 '#getData.Submittedby#')
</CFQUERY> 
</CFOUTPUT>

ShowCatalog1.cfm


<CFQUERY NAME="GetCatalog1" DATASOURCE="MondoMIDI">
   SELECT * FROM Catalog
</CFQUERY>

<HTML>
<HEAD>
   <TITLE>Mondo MIDI's MIDI Catalog</TITLE>
</HEAD>
<BODY>
Mondo MIDI Catalog
<P>
<CFOUTPUT QUERY="GetCatalog1">
#ItemNbr# #Title# #ArtistID# #ProducerID# #PathName# #Description# #UploadedBy#<BR>
</CFOUTPUT>
</BODY>
</HTML>

ShowCatalog2.cfm


<CFQUERY NAME="GetCatalog1" DATASOURCE="MondoMIDI">
   SELECT * FROM Catalog
</CFQUERY>

<HTML>
<HEAD>
   <TITLE>Mondo MIDI's MIDI Catalog</TITLE>
</HEAD>
<BODY>
Mondo MIDI Catalog
<P>

<CFTABLE QUERY="GetCatalog1">
   <CFCOL HEADER="<B>Cat.##</B>" WIDTH=5 ALIGN="right" TEXT="#ItemNbr#">
   <CFCOL HEADER="<B>Title</B>" WIDTH=25 TEXT="#Title#">
   <CFCOL HEADER="<B>Description</B>" WIDTH=60 TEXT="#Description#">
   <CFCOL HEADER="<B>Uploaded by</B>" WIDTH=20 TEXT="#UploadedBy#">
</CFTABLE>

</BODY>
</HTML>

ShowCatalog3.cfm


<CFQUERY NAME="GetCatalog2" DATASOURCE="MondoMIDI">
   SELECT Catalog.Title, Catalog.Description, Artists.GroupName, Producers.ProducerFName, 
   Producers.ProducerLName, Producers.ProducerOrg, Categories.Category, Categories.SortPosition
   FROM (((Catalog INNER JOIN Artists ON Catalog.ArtistID = Artists.ArtistID) 
   INNER JOIN Producers ON Catalog.ProducerID = Producers.ProducerID) 
   INNER JOIN CatalogCategories ON Catalog.ItemNbr = CatalogCategories.ItemNbr) 
   INNER JOIN Categories ON CatalogCategories.CategoryID = Categories.CategoryID
   ORDER BY Categories.SortPosition
</CFQUERY>

<HTML>
<HEAD>
   <TITLE>Mondo MIDI's MIDI Catalog</TITLE>
</HEAD>
<BODY>
Mondo MIDI Catalog
Catalog
<BR CLEAR="all">
<P>

<TABLE WIDTH="100%" BORDER=1 CELLSPACING=0>
<TR>
   <TH ALIGN="left" BGCOLOR="#008484">Title</TH>
   <TH ALIGN="left" BGCOLOR="#008484">Description</TH>
   <TH ALIGN="left" BGCOLOR="#008484">Artist</TH>
   <TH ALIGN="left" BGCOLOR="#008484">Producer</TH>
</TR>
<CFOUTPUT QUERY ="GetCatalog2" GROUP="SortPosition">
<TR>
   <TH COLSPAN=4><FONT SIZE="+1">#Category#</FONT></TH>
</TR>
<CFOUTPUT>
<TR>
   <TD ALIGN="left">#Title#</TD>
   <TD ALIGN="left">#Description#</TD>
   <TD ALIGN="left">#GroupName#</TD>
   <TD ALIGN="left">
      #ProducerOrg#
      <CFIF ProducerFName NEQ "">
         <FONT SIZE="-2">(#ProducerFName# #ProducerLName#)</FONT>
      </CFIF>
   </TD>
</TR>
</CFOUTPUT>
</CFOUTPUT>
</TABLE>

</BODY>
</HTML>

create_collection.cfm


Create_collection.cfm

<!--- 
File Name: create_collection.cfm
Purpose:

Created by: Eron Cohen
On: Sunday, September 03, 2000

Comments: Make sure you have a directory on your server called c:\verity_collections Otherwise, change the path to something that does exist!
 --->
 
 <CFCOLLECTION ACTION="CREATE" COLLECTION="Customer_Database" Path="C:\VERITY_COLLECTIONS">

Index_query.cfm


Index_query.cfm

<!--- 
File Name: index_query.cfm
Purpose:

Created by: Eron Cohen
On: Sunday, September 03, 2000

Comments: For this to work, you need to make sure you have the database available! You can download the example database or create a table in your own datasource. ". It will need the following fields along with a few rows of example data: first_name, last_name, address1, address2, city, state, country, email.

This will index the entire database table.
 --->
 

<!--- First we need to query the database --->
<CFQUERY name="get_all_customers" datasource="my_database">
Select * 
From my_customers_table
Order by customer_last_name
</CFQUERY>

 
 
<!--- Now we can index the query results --->
<CFINDEX 
        COLLECTION="Customer_Database" 
        ACTION="UPDATE" 
        TYPE="CUSTOM" 
        BODY="first_name, last_name, address1, address2, city, state, country, email" 
        KEY="Customer_ID" 
        TITLE="last_name" 
        QUERY="get_all_customers">

Search_form.cfm


Search_form.cfm

<!--- 
File Name: search_form.cfm
Purpose: Gather input for search.

Created by: Eron Cohen
On: Sunday, September 03, 2000
Comments:

This was borrowed from the ColdFusion Studio Verity wizard. To access the wizard choose FILE>NEW and then click the CFML tab. It is mainly used to generate code for indexing websites not queries!


 --->
 
 
 <FORM action="search_collection.cfm" method="post">
	<INPUT type="hidden" name="StartRow" value="1">

	<TABLE>

		<TR>
			<TD>Keywords:</TD>
			<TD><INPUT type="text" name="Criteria" size="30"></TD>
		</TR>

		<TR>
			<TD>Max Rows:</TD>
			<TD><SELECT name="MaxRows"> <OPTION> 10 <OPTION> 25 <OPTION> 100 </SELECT></TD>
		</TR>

		<TR>
			<TD colspan=2><INPUT type="submit" value=" Search > > "></TD>
		</TR>

	</TABLE>

</FORM>

Search_collection.cfm


Search_collection.cfm

<!--- 
File Name: search_collection.cfm
Purpose: Gather input for search.

Created by: Eron Cohen
On: Sunday, September 03, 2000
Comments:

This was borrowed from the ColdFusion Studio Verity wizard. To access the wizard choose FILE>NEW and then click the CFML tab. It is mainly used to generate code for indexing websites not queries!


 --->
 
<!---
 Use CFSEARCH to get all "hits" on this search criteria. Up to the specified Max. number of rows. 
 --->

<CFSEARCH Name="this_search" 
		 Collection="Customer_Database" 
		 Type="Simple"
		 Criteria = "#Form.Criteria#"
		 MaxRows = "#Evaluate(Form.MaxRows + 1)#"
		 StartRow = "#Form.StartRow#">
		 

<!--- Now query the database to return those records, unless recordcount was 0!	 --->	 

<CFIF this_search.recordcount is not 0>
<CFQUERY name="get_search_results_records_query" datasource="#application.dsn#">

	Select *
	From From my_customers_table
	where customer_id in (#valuelist(this_search.key)#)

</CFQUERY>		

<!--- Now display the results to the searcher:  --->

Here are the records that were found:<p>

<CFOUTPUT query="get_search_results_records_query">
#currentrow#: #first_name#, #last_name#, #address1#, #address2#, #city#, #state#<br>
</CFOUTPUT>

<CFELSE>

Sorry, no records match your search criteria--please try <A HREF="javascript: history.go(-1);">again!</A>

</CFIF>

Furniture1.cfm


<!--- Cold Fusion Example --->

<CFQUERY DATASOURCE="HOUSE" NAME="GetData">
	SELECT * 
	FROM Furniture
</CFQUERY>

<html>
<head>
	<title>Furniture Table Maintenance</title>
</head>
<body>
Furniture Table - ColdFusion<BR>
<table border="1" width="30%">
	<tr>
		<th colspan="2">Furniture</th>
	</tr>
	<cfoutput query="GetData">
		<tr>
			<td>#Furniture#</td>
			<td><a href="furniture-d.cfm?PROCESS=M&Furniture=#Furniture#">Edit</a> <a href="furniture-p.cfm?PROCESS=D&Furniture=#Furniture#">Delete</a></td>
		</tr>
	</cfoutput>
		<tr>
			<td align="CENTER" colspan="2"><a href="furniture-d.cfm?PROCESS=A">New Record</a></td>
		</tr>
</table>
</body>
</html>

Furniture1.asp


<%@ Language = VBscript %>

<% Set conn = Server.CreateObject("ADODB.Connection")
   conn.Open "DSN=House"
   Set rs = conn.Execute("SELECT * FROM FURNITURE")
%>

<html>
<head>
	<title>Furniture Table Maintenance</title>
</head>
<body>
Furniture Table - Active Server Pages<BR>
<table border="1" width="30%">
	<tr>
		<th colspan="2">Furniture</th>
	</tr>
	<%while not rs.eof%>
		<tr>
			<td><%=rs("Furniture")%></td>
			<td><a href="furniture-d.asp?PROCESS=M&Furniture=<%=rs("Furniture")%>">Edit</a> <a href="furniture-p.asp?PROCESS=D&Furniture=<%=rs("Furniture")%>">Delete</a></td>
		</tr>
	<% rs.movenext%>
	<%wend %>
		<tr>
			<td align="CENTER" colspan="2"><a href="furniture-d.asp?PROCESS=A">New Record</a></td>
		</tr>
</table>
</body>
</html>
<%
rs.Close
Set rs = Nothing
conn.Close
Set conn = Nothing
%>

Furniture1.jsp


<%@ page language="java" import="java.sql.*" %> 



<html>
<head>
	<title>Furniture Table Maintenance</title>
</head>
<body>
Furniture Table - Java Server Pages<BR>
<table border="1" width="30%">
	<tr>
		<th colspan="2">Furniture</th>
	</tr>
	<% 
	try 
	{ 
		Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); 
		Connection mCon = DriverManager.getConnection ("jdbc:odbc:HOUSE"); 
		Statement stm = mCon.createStatement(); 
		ResultSet rst = stm.executeQuery("SELECT * FROM FURNITURE");
		while (rst.next()) 
		{ %>
		<tr>
			<td><% String s1 = rst.getString ("Furniture"); %><%= s1 %></td>
			<td><a href="furniture-d.jsp?PROCESS=M&Furniture=<%= s1 %>">Edit</a> <a href="furniture-p.jsp?PROCESS=D&Furniture=<%= s1 %>">Delete</a></td>
		</tr>
		<% 
		}
		stm.close(); 
		mCon.close(); 
	} 
	catch(Exception e) 
	{ 
	} 	
	%>
		<tr>
			<td align="CENTER" colspan="2"><a href="furniture-d.jsp?PROCESS=A">New Record</a></td>
		</tr>
</table>
</body>
</html> 

FurnitureD.cfm


<cfif PROCESS EQ "M">
	<CFQUERY DATASOURCE="HOUSE" NAME="GetData">
		SELECT * 
		FROM furniture
		WHERE furniture = '#furniture#'
	</CFQUERY>
</cfif>

<html>
<head>
	<title><cfif PROCESS eq "A">Adding<cfelse>Modifying</cfif> furniture</title>
</head>
<body>
<table border="1" width="50%">
	<tr>
		<td colspan="2" align="CENTER"><font size="3"><cfif PROCESS eq "A">Adding<cfelse>Modifying</cfif> Furniture</font></td>
  	</tr>
	<form ACTION="furniture-p.cfm">
	<cfif PROCESS EQ "A">
		<input type="hidden" name="PROCESS" value="A">
	<cfelse>
		<input type="hidden" name="PROCESS" value="M">
		<cfoutput query="GetData"><input type="hidden" name="KEY" value="#FURNITURE#"></cfoutput>
	</cfif>
	<tr>

		<td>Furniture:</td>
		<cfif PROCESS EQ "A">
			<td><input type="Text" name="FURNITURE" maxlength="20"></td>
		<cfelse>
			<td><cfoutput query="GetData"><input type="Text" name="FURNITURE" value="#FURNITURE#" maxlength="20"></cfoutput></td>
		</cfif>
	</tr>
	<tr>
		<td align="center" colspan="2"><input type="submit" value="Save"><input type="button" value="Cancel" onclick="history.back();"></td>
	</tr>
	</form>
</table>
</body>
</html>

FurnitureD.asp


<%@ Language = VBscript %>

<% Set conn = Server.CreateObject("ADODB.Connection")
   conn.Open "DSN=House"
   Set rs = conn.Execute("SELECT * FROM FURNITURE")
%>

<html>
<head>
	<title>Furniture Table Maintenance</title>
</head>
<body>
Furniture Table - Active Server Pages<BR>
<table border="1" width="30%">
	<tr>
		<th colspan="2">Furniture</th>
	</tr>
	<%while not rs.eof%>
		<tr>
			<td><%=rs("Furniture")%></td>
			<td><a href="furniture-d.asp?PROCESS=M&Furniture=<%=rs("Furniture")%>">Edit</a> <a href="furniture-p.asp?PROCESS=D&Furniture=<%=rs("Furniture")%>">Delete</a></td>
		</tr>
	<% rs.movenext%>
	<%wend %>
		<tr>
			<td align="CENTER" colspan="2"><a href="furniture-d.asp?PROCESS=A">New Record</a></td>
		</tr>
</table>
</body>
</html>
<%
rs.Close
Set rs = Nothing
conn.Close
Set conn = Nothing
%>

FurnitureD.jsp


<%@ page language="java" import="java.sql.*" %>
<% 
	String furniture = "";
	String sqlstr = "";
	String PROCESS = request.getParameter("PROCESS");
	if (PROCESS.equals("M"))
	{
		try 
		{ 
			Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); 
			Connection mCon = DriverManager.getConnection ("jdbc:odbc:HOUSE"); 		
			Statement stm = mCon.createStatement(); 
			sqlstr = "SELECT * FROM FURNITURE WHERE FURNITURE = '" + request.getParameter("Furniture") + "';";
			ResultSet rst = stm.executeQuery(sqlstr);
			while (rst.next())
			{
				furniture = rst.getString ("Furniture");
			}
			stm.close(); 
			mCon.close(); 
		} 
		catch(Exception e) 
		{ 
		}
	} 	
		
%>


<html>
<head>
	<title><%if (PROCESS.equals("A")) {%> Adding  <% } else { %> Modifying <% } %> Furniture</title>
</head>
<body>
<table border="1" width="50%">
	<tr>
		<td colspan="2" align="CENTER"><font size="3"><%if (PROCESS.equals("A")){%> Adding  <% } else { %> Modifying <% } %> Furniture</font></td>
  	</tr>
	<form action="furniture-p.jsp" method="post">	 
		<% if (PROCESS.equals("A")) { %> 
		      <input type="hidden" name="PROCESS" value="A">
	    <% } else { %>     
			  <input type="hidden" name="PROCESS" value="M">
			  <input type="hidden"  name="KEY" value="<%= furniture %>">
 	    <% } %> 
	<tr>

		<td>Furniture:</td>
		<% if (PROCESS.equals("A")) { %> 
			<td><input type="text" name="FURNITURE" value=""></td>
		<% } else { %>     
			<td><input type="text" name="FURNITURE" value="<%= furniture %>"></td>
		<% } %> 
	</tr>
	<tr>
		<td align="center" colspan="2"><input type="submit" value="Save"><input type="button" value="Cancel" onclick="history.back();"></td>
	</tr>
	</form>
</table>
</body>
</html>

FurnitureP.cfm


<cfswitch expression="#PROCESS#">
	<cfcase value="D">
		<CFQUERY DATASOURCE="HOUSE" NAME="GetData">
			DELETE FROM Furniture
			WHERE Furniture = '#Furniture#'
		</CFQUERY>
	</cfcase>

	<cfcase value="A">	
		<CFQUERY DATASOURCE="HOUSE" NAME="GetData">
			INSERT INTO Furniture
				(Furniture)
			VALUES
				('#Furniture#')
		</CFQUERY>
	</cfcase>

	<cfcase value="M">	
		<CFQUERY DATASOURCE="HOUSE" NAME="GetData">
			UPDATE Furniture
			SET Furniture = '#Furniture#'
			WHERE Furniture = '#KEY#'
		</CFQUERY>
	</cfcase>		

</cfswitch>

<cflocation url="furniture-l.cfm" addtoken="No">

FurnitureP.asp


<%@ Language = VBscript %>

<%

		Select Case Request.Form("PROCESS")
		Case "A"
			Set conn = Server.CreateObject("ADODB.Connection")
   			conn.Open "DSN=House"
   			conn.Execute("INSERT INTO FURNITURE (Furniture) VALUES ('" & Request.Form("FURNITURE") & "')")
		Case "M"
			Set conn = Server.CreateObject("ADODB.Connection")
   			conn.Open "DSN=House"
   			conn.Execute("UPDATE Furniture SET Furniture = '" & Request.Form("FURNITURE") & "' WHERE Furniture = '" & Request.Form("KEY") & "'")		
		End Select
		
		If Request.QueryString("PROCESS") = "D" Then
			Set conn = Server.CreateObject("ADODB.Connection")
   			conn.Open "DSN=House"			
   			Set rs = conn.Execute("DELETE * FROM FURNITURE WHERE FURNITURE = '" & Request.QueryString("FURNITURE") & "'")
		End if

%>


<% Response.Redirect "furniture-l.asp" %>

FurnitureP.jsp


<%@ page language="java" import="java.sql.*" %>
<% 
	String sqlstr = "";
	String PROCESS = request.getParameter("PROCESS");
	try 
	{ 
		Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); 
		Connection mCon = DriverManager.getConnection ("jdbc:odbc:HOUSE"); 		
		mCon.setAutoCommit(true);
		Statement stm = mCon.createStatement(); 			
		if (PROCESS.equals("A"))
			{
				stm.executeQuery("INSERT INTO FURNITURE (Furniture) VALUES ('" + request.getParameter("FURNITURE") + "')");
			}
		if (PROCESS.equals("M"))
			{
				stm.executeQuery("UPDATE Furniture SET Furniture = '" + request.getParameter("FURNITURE") + "' WHERE Furniture = '" + request.getParameter("KEY") + "'");
			}
		if (PROCESS.equals("D"))
			{
				stm.executeQuery("DELETE * FROM FURNITURE WHERE FURNITURE = '" + request.getParameter("Furniture") + "'");
			}
		stm.close(); 
		mCon.close(); 
	} 
	catch(Exception e) 
	{ 
	}
%>

<% response.sendRedirect("furniture-l.jsp"); %> 

Example.cfm


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
	<title>Untitled</title>
</head>

<body>


<CF_SVG>
</body>
</html>

svg_part1.cfm


<!--- Setting the graphic filepath --->

<cfset SVG_FilePath="e:\websites\CF_SVG\text.svg">
<cfif #FileExists(SVG_FilePath)# is "Yes">
	<CFFILE ACTION="DELETE" FILE=#SVG_FilePath#>
</cfif>

svg_part2.cfm


<!--- Creates new svg document with form data --->

<cfif isDefined("SVG_Text")>

<cfset SVG1='<svg>
	<defs>
		<filter id="Bumps1" filterUnits="objectBoundingBox" x="-10%" y="-10%" width="130%" height="140%">
			<feMorphology operator="dilate" radius="2" result="alpha"/>
			<feGaussianBlur id="blur" stdDeviation="2" result="blur0"/>
			<feOffset id="offset" dx="4" dy="4" result="offsetBlurredAlpha"/>
			<feFlood id="color" style="flood-color:#color2#; flood-opacity:0.5" result="color"/>
			<feComposite id="shadowColor" in="color" in2="offsetBlurredAlpha" operator="in" result="offsetBlurredAlpha"/>
			<feTurbulence type="turbulence" baseFrequency="0.17" numOctaves="1" result="turb1"/>
			<feTurbulence type="turbulence" baseFrequency="0.18" numOctaves="1" result="turb2"/>
			<feComposite in="turb1" in2="turb2" operator="arithmetic" k1="1" result="turb"/>
			<feComposite in="blur0" in2="turb" operator="arithmetic" k1="0" k2="0.6" k3="0.4" k4="0" result="blur"/>
			<feComposite in="blur" in2="blur0" operator="in" result="blur"/>
			<feDiffuseLighting id="diffuse" in="blur" resultScale="1" surfaceScale="3" diffuseConstant="1" lightColor="#color#" result="diffuse">
				<feDistantLight azimuth="135" elevation="60"/>
			</feDiffuseLighting>
			<feSpecularLighting in="blur" surfaceScale="6" specularConstant="1" specularExponent="6" lightColor="#color2#" result="specularOut">
				<feDistantLight id="light" azimuth="135" elevation="60"/>
			</feSpecularLighting>
			<feComposite in="specularOut" in2="alpha" operator="in" result="specularOut"/>
			<feComposite in="blur" in2="diffuse" operator="arithmetic" k1="1" k2="0" k3="0" k4="0" result="litPaint"/>
			<feComposite in="litPaint" in2="specularOut" operator="arithmetic" k1="0" k2="1" k3="1" k4="0" result="litPaint"/>
			<feMerge>
				<feMergeNode in="offsetBlurredAlpha"/>
				<feMergeNode in="litPaint"/>
			</feMerge>
		</filter>
		<filter id="Bumps2" filterUnits="objectBoundingBox" x="-10%" y="-10%" width="140%" height="130%">
			<feMorphology operator="dilate" radius="5" result="alpha"/>
			<feGaussianBlur id="blur" stdDeviation="4" result="blur0"/>
			<feOffset id="offset" dx="4" dy="4" result="offsetBlurredAlpha"/>
			<feFlood id="color" style="flood-color:#color#; flood-opacity:0.5" result="color"/>
			<feComposite id="shadowColor" in="color" in2="offsetBlurredAlpha" operator="in" result="offsetBlurredAlpha"/>
			<feTurbulence type="turbulence" baseFrequency="0.17" numOctaves="1" result="turb"/>
			<feComposite in="blur0" in2="turb" operator="arithmetic" k1="0" k2="0.6" k3="0.4" k4="0" result="blur"/>
			<feComposite in="blur" in2="blur0" operator="in" result="blur"/>
			<feDiffuseLighting id="diffuse" in="blur" resultScale="1" surfaceScale="6" diffuseConstant="1" lightColor="#color#" result="diffuse">
				<feDistantLight azimuth="135" elevation="60"/>
			</feDiffuseLighting>
			<feSpecularLighting in="blur" surfaceScale="6" specularConstant="1" specularExponent="6" lightColor="#color2#" result="specularOut">
				<feDistantLight id="light" azimuth="135" elevation="60"/>
			</feSpecularLighting>
			<feComposite in="specularOut" in2="alpha" operator="in" result="specularOut"/>
			<feComposite in="blur" in2="diffuse" operator="arithmetic" k1="1" k2="0" k3="0" k4="0" result="litPaint"/>
			<feComposite in="litPaint" in2="specularOut" operator="arithmetic" k1="0" k2="1" k3="1" k4="0" result="litPaint"/>
			<feMerge>
				<feMergeNode in="offsetBlurredAlpha"/>
				<feMergeNode in="litPaint"/>
			</feMerge>
		</filter>
		<filter id="Bumps3" filterUnits="objectBoundingBox" x="-10%" y="-10%" width="140%" height="130%">
			<feMorphology operator="dilate" radius="5" result="alpha"/>
			<feGaussianBlur id="blur" stdDeviation="4" result="blur0"/>
			<feOffset id="offset" dx="4" dy="4" result="offsetBlurredAlpha"/>
			<feFlood id="color" style="flood-color:#color#; flood-opacity:0.5" result="color"/>
			<feComposite id="shadowColor" in="color" in2="offsetBlurredAlpha" operator="in" result="offsetBlurredAlpha"/>
			<feTurbulence type="turbulence" baseFrequency="0.057" numOctaves="2" result="turb"/>
			<feComposite in="blur0" in2="turb" operator="arithmetic" k1="0" k2="0.6" k3="0.4" k4="0" result="blur"/>
			<feComposite in="blur" in2="blur0" operator="in" result="blur"/>
			<feDiffuseLighting id="diffuse" in="blur" resultScale="1" surfaceScale="6" diffuseConstant="1" lightColor="#color#" result="diffuse">
				<feDistantLight azimuth="135" elevation="60"/>
			</feDiffuseLighting>
			<feSpecularLighting in="blur" surfaceScale="6" specularConstant="1" specularExponent="6" lightColor="#color2#" result="specularOut">
				<feDistantLight id="light" azimuth="135" elevation="60"/>
			</feSpecularLighting>
			<feComposite in="specularOut" in2="alpha" operator="in" result="specularOut"/>
			<feComposite in="blur" in2="diffuse" operator="arithmetic" k1="1" k2="0" k3="0" k4="0" result="litPaint"/>
			<feComposite in="litPaint" in2="specularOut" operator="arithmetic" k1="0" k2="1" k3="1" k4="0" result="litPaint"/>
			<feMerge>
				<feMergeNode in="offsetBlurredAlpha"/>
				<feMergeNode in="litPaint"/>
			</feMerge>
		</filter>
	</defs>


<!-- Output using first Bumps filter. Feel free to play with the other filters and replace their attributes with form variables or output from a query -->

	<text style="font-size:#font#; fill:##FFFFFF; font-family: verdana">
		<tspan x="25" y="125" style="filter:url(###filter#)">#SVG_Text#</tspan></text>
</svg>'>

svg_part3.cfm


<!--- Write the .SVG File --->

<cffile action="WRITE"
        file=#SVG_FilePath#
        output="#SVG1#"
        addnewline="No">

svg_part4.cfm


<!--- Include the Embed Tag --->

<cfinclude template="SVG_Embed.html">

svg_part5.cfm


<!--- Displays initial form if no form variable sent --->

	<cfelse>

<cfform action = "SVG.cfm" method="post">
Enter text to display in SVG: 
    <cfinput type = "text" name="SVG_Text" value="ColdFusion and svg" required="yes">
    <br>
Enter a color name: 
    <cfinput type = "text" name="color" value="black" required="yes">
    <br>
Enter another color name: 
    <cfinput type = "text" name="color2" value="blue" required="yes">
    <br>
Enter a font size: 
    <cfinput type = "text" name="font" value="40" required="yes">
    <br>

<select name="filter">
	<option value="Bumps1" SELECTED>Filter1</option>
	<option value="Bumps2">Filter2</option>
	<option value="Bumps3">Filter3</option>
</select>	
	<br><br>
<input type="submit" value="submit">
	
</cfform>


</cfif>	

svg_all.cfm


<!--- CF_SVG copyright 2000 by John Fontana
	  contact john@websiteandsound.com
	  
	  Description: Allows user to control SVG graphics parameters by submitting
	  form data. Can also be modified to accept data from a query or applet.
	  
	  Doesn't score big as far as practical commerce functionality goes, but it is interesting
	  to see that interactive graphics can be generated on the fly...
	  
	  Requires SVG plug-in available from http://www.adobe.com --->

<!--- set directory path for SVG text file to be written. Note: if you want to use a name
	other than "text.svg" for your graphic, be sure to change it in the embed tag in 
	"SVG_Embed.html" as well --->
	
<cfset SVG_FilePath="e:\websites\CF_SVG\text.svg">

<cfif #FileExists(SVG_FilePath)# is "Yes">

	<CFFILE ACTION="DELETE" FILE=#SVG_FilePath#>

</cfif>

<!--- Creates new svg document with form data --->

<cfif isDefined("SVG_Text")>

<cfset SVG1='<svg>
	<defs>
		<filter id="Bumps1" filterUnits="objectBoundingBox" x="-10%" y="-10%" width="130%" height="140%">
			<feMorphology operator="dilate" radius="5" result="alpha"/>
			<feGaussianBlur id="blur" stdDeviation="4" result="blur0"/>
			<feOffset id="offset" dx="4" dy="4" result="offsetBlurredAlpha"/>
			<feFlood id="color" style="flood-color:#color2#; flood-opacity:0.5" result="color"/>
			<feComposite id="shadowColor" in="color" in2="offsetBlurredAlpha" operator="in" result="offsetBlurredAlpha"/>
			<feTurbulence type="turbulence" baseFrequency="0.17" numOctaves="1" result="turb1"/>
			<feTurbulence type="turbulence" baseFrequency="0.18" numOctaves="1" result="turb2"/>
			<feComposite in="turb1" in2="turb2" operator="arithmetic" k1="1" result="turb"/>
			<feComposite in="blur0" in2="turb" operator="arithmetic" k1="0" k2="0.6" k3="0.4" k4="0" result="blur"/>
			<feComposite in="blur" in2="blur0" operator="in" result="blur"/>
			<feDiffuseLighting id="diffuse" in="blur" resultScale="1" surfaceScale="3" diffuseConstant="1" lightColor="#color#" result="diffuse">
				<feDistantLight azimuth="135" elevation="60"/>
			</feDiffuseLighting>
			<feSpecularLighting in="blur" surfaceScale="6" specularConstant="1" specularExponent="6" lightColor="#color2#" result="specularOut">
				<feDistantLight id="light" azimuth="135" elevation="60"/>
			</feSpecularLighting>
			<feComposite in="specularOut" in2="alpha" operator="in" result="specularOut"/>
			<feComposite in="blur" in2="diffuse" operator="arithmetic" k1="1" k2="0" k3="0" k4="0" result="litPaint"/>
			<feComposite in="litPaint" in2="specularOut" operator="arithmetic" k1="0" k2="1" k3="1" k4="0" result="litPaint"/>
			<feMerge>
				<feMergeNode in="offsetBlurredAlpha"/>
				<feMergeNode in="litPaint"/>
			</feMerge>
		</filter>
		<filter id="Bumps2" filterUnits="objectBoundingBox" x="-10%" y="-10%" width="140%" height="130%">
			<feMorphology operator="dilate" radius="5" result="alpha"/>
			<feGaussianBlur id="blur" stdDeviation="4" result="blur0"/>
			<feOffset id="offset" dx="4" dy="4" result="offsetBlurredAlpha"/>
			<feFlood id="color" style="flood-color:#color#; flood-opacity:0.5" result="color"/>
			<feComposite id="shadowColor" in="color" in2="offsetBlurredAlpha" operator="in" result="offsetBlurredAlpha"/>
			<feTurbulence type="turbulence" baseFrequency="0.17" numOctaves="1" result="turb"/>
			<feComposite in="blur0" in2="turb" operator="arithmetic" k1="0" k2="0.6" k3="0.4" k4="0" result="blur"/>
			<feComposite in="blur" in2="blur0" operator="in" result="blur"/>
			<feDiffuseLighting id="diffuse" in="blur" resultScale="1" surfaceScale="6" diffuseConstant="1" lightColor="#color#" result="diffuse">
				<feDistantLight azimuth="135" elevation="60"/>
			</feDiffuseLighting>
			<feSpecularLighting in="blur" surfaceScale="6" specularConstant="1" specularExponent="6" lightColor="#color2#" result="specularOut">
				<feDistantLight id="light" azimuth="135" elevation="60"/>
			</feSpecularLighting>
			<feComposite in="specularOut" in2="alpha" operator="in" result="specularOut"/>
			<feComposite in="blur" in2="diffuse" operator="arithmetic" k1="1" k2="0" k3="0" k4="0" result="litPaint"/>
			<feComposite in="litPaint" in2="specularOut" operator="arithmetic" k1="0" k2="1" k3="1" k4="0" result="litPaint"/>
			<feMerge>
				<feMergeNode in="offsetBlurredAlpha"/>
				<feMergeNode in="litPaint"/>
			</feMerge>
		</filter>
		<filter id="Bumps3" filterUnits="objectBoundingBox" x="-10%" y="-10%" width="140%" height="130%">
			<feMorphology operator="dilate" radius="5" result="alpha"/>
			<feGaussianBlur id="blur" stdDeviation="4" result="blur0"/>
			<feOffset id="offset" dx="4" dy="4" result="offsetBlurredAlpha"/>
			<feFlood id="color" style="flood-color:#color#; flood-opacity:0.5" result="color"/>
			<feComposite id="shadowColor" in="color" in2="offsetBlurredAlpha" operator="in" result="offsetBlurredAlpha"/>
			<feTurbulence type="turbulence" baseFrequency="0.057" numOctaves="2" result="turb"/>
			<feComposite in="blur0" in2="turb" operator="arithmetic" k1="0" k2="0.6" k3="0.4" k4="0" result="blur"/>
			<feComposite in="blur" in2="blur0" operator="in" result="blur"/>
			<feDiffuseLighting id="diffuse" in="blur" resultScale="1" surfaceScale="6" diffuseConstant="1" lightColor="#color#" result="diffuse">
				<feDistantLight azimuth="135" elevation="60"/>
			</feDiffuseLighting>
			<feSpecularLighting in="blur" surfaceScale="6" specularConstant="1" specularExponent="6" lightColor="#color2#" result="specularOut">
				<feDistantLight id="light" azimuth="135" elevation="60"/>
			</feSpecularLighting>
			<feComposite in="specularOut" in2="alpha" operator="in" result="specularOut"/>
			<feComposite in="blur" in2="diffuse" operator="arithmetic" k1="1" k2="0" k3="0" k4="0" result="litPaint"/>
			<feComposite in="litPaint" in2="specularOut" operator="arithmetic" k1="0" k2="1" k3="1" k4="0" result="litPaint"/>
			<feMerge>
				<feMergeNode in="offsetBlurredAlpha"/>
				<feMergeNode in="litPaint"/>
			</feMerge>
		</filter>
	</defs>
	<!-- Output using first Bumps filter. Feel free to play with the other filters and replace their sttributes
	with form variables or output from a query-->
	<text style="font-size:#font#; fill:##FFFFFF">
		<tspan x="25" y="125" style="filter:url(###filter#)">#SVG_Text#</tspan></text>
</svg>'>

<cffile action="WRITE"
        file=#SVG_FilePath#
        output="#SVG1#"
        addnewline="No">
		
<cfinclude template="SVG_Embed.html">

<!--- Displays initial form if no form variable sent--->

	<cfelse>

<cfform action = "SVG.cfm" method="post">
Enter text to display in SVG: 
    <cfinput type = "text" name="SVG_Text" value="cold fusion and svg" required="yes">
    <br>
Enter a color name: 
    <cfinput type = "text" name="color" value="black" required="yes">
    <br>
Enter another color name: 
    <cfinput type = "text" name="color2" value="blue" required="yes">
    <br>
Enter a font size: 
    <cfinput type = "text" name="font" value="70" required="yes">
    <br>

<select name="filter">
	<option value="Bumps1" SELECTED>Filter1</option>
	<option value="Bumps2">Filter2</option>
	<option value="Bumps3">Filter3</option>
</select>	
	<br>
<input type="submit" value="submit">
	
</cfform>


</cfif>