[Mydatabasepilot-cvs] MyDatabasePilot/dbProcessBody AddField.cfm,1.3,1.4
Status: Alpha
Brought to you by:
nanoface
From: <nan...@us...> - 2003-05-29 23:43:56
|
Update of /cvsroot/mydatabasepilot/MyDatabasePilot/dbProcessBody In directory sc8-pr-cvs1:/tmp/cvs-serv13725/dbProcessBody Modified Files: AddField.cfm Log Message: Functionality Added: [ 745828 ] Continued Development of dbProcessBody/AddField.cfm Added Statemanagement of check boxes to remember the last onChange state of each check box. Completed ENUM and SET Options Added Place Holder for SQL Preview Fixed a number of minor bugs, enhenced overall look and feel Index: AddField.cfm =================================================================== RCS file: /cvsroot/mydatabasepilot/MyDatabasePilot/dbProcessBody/AddField.cfm,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** AddField.cfm 29 May 2003 03:42:06 -0000 1.3 --- AddField.cfm 29 May 2003 23:41:51 -0000 1.4 *************** *** 1,352 **** ! <!---******************************************************************************************* ! * Copyright: MyDatabase Pilot is distributed under the terms of the GNU GPL license * ! * Template: dbProcessBody/AddField.cfm * ! * Purpose: Displays the Body Content for the AddField Database Process * ! * Requiremets: -fieldList Query must be run on same page prior to including this template * ! * -URL.table (table name) must have been passed from calling template * ! ********************************************************************************************---> ! ! <!---||| Set Default Values |||---> ! <cfparam name="FORM.numberOfFields" default="1" /> ! <cfparam name="FORM.locationOfFields" default="End" /> ! <cfdump var="number of fields: #FORM.numberOfFields# location of fields: #FORM.locationOfFields#"> ! ! <!---||| Initiate a Read Only lock to ensure the integrity of session variables |||---> ! <cflock timeout = "30" throwontimeout="no" type = "readonly" scope = "session"> ! <!---||| Create AddField FORM |||---> ! <cfform action="#currentPath#?#SESSION.URLToken#&dbProcess=AddField&table=#URL.table#" method="post" name="FORM_AddField" enablecab="yes" class="Fancy"> ! <!---||| General Settings (number of new fields, location of new fields) |||---> ! <fieldset class="Fancy"> ! <legend class="Fancy">Add New Field(s) to Table <cfoutput>#URL.table#</cfoutput></legend> ! ! <!---||| Allow User to Specify the Number of New Fields |||---> ! <!---||| Set the default value to the last requested value |||---> ! <label for="numberOfFields" class="Fancy">Number of New Fields:</label> ! <cfinput name="numberOfFields" type="text" value="#FORM.numberOfFields#" size="2" maxlength="2" range="1,99" required="yes" message="You must enter an interger between 1 and 99 for the number of records field." validate="integer" class="Fancy" onChange="this.form.submit()" /> ! <br /> ! ! <!---||| Allow User to Specify the Location for the New Fields |||---> ! <!---||| Set the selected option to the last requested value |||---> ! <label for="locationOfFields" class="Fancy">Location of New Fields:</label> ! <cfselect name="locationOfFields" size="1" required="yes" class="Fancy" onChange="this.form.submit()"> ! <!---||| Create options for adding the new field(s) at the beginning and at the end of the current table |||---> ! <cfif FORM.locationOfFields IS "End"> ! <option value="End" selected class="Fancy">At End of Table <cfoutput>#URL.table#</cfoutput></option> ! <cfelse> ! <option value="End" class="Fancy">At End of Table <cfoutput>#URL.table#</cfoutput></option> ! </cfif> ! <cfif FORM.locationOfFields IS "Beginning"> ! <option value="Beginning" selected class="Fancy">At Beginning of Table <cfoutput>#URL.table#</cfoutput></option> ! <cfelse> ! <option value="Beginning" class="Fancy">At Beginning of Table <cfoutput>#URL.table#</cfoutput></option> ! </cfif> ! ! <!---||| Create options for adding the new field(s) after each of the current fields |||---> ! <cfoutput query="fieldList"> ! <cfif FORM.locationOfFields IS fieldList.FIELD> ! <option value="#fieldList.FIELD#" selected class="Fancy">After #fieldList.FIELD#</option> ! <cfelse> ! <option value="#fieldList.FIELD#" class="Fancy">After #fieldList.FIELD#</option> ! </cfif> ! </cfoutput> ! </cfselect> ! </fieldset> ! ! <!---||| Field Definitions |||---> ! <fieldset class="Fancy"> ! <legend class="Fancy">Field Definitions</legend> ! <table width="100%" border="1" cellpadding="2" cellspacing="0"> ! <!---||| Create Header |||---> ! <tr> ! <td><label class="Fancy">Field No:</label></td> ! <td><label class="Fancy">Field Name:</label></td> ! <td><label class="Fancy">Field Type:</label></td> ! <td><label class="Fancy">Field Options:</label></td> ! <td><label class="Fancy">Default Value:</label></td> ! <td><label class="Fancy">Index:</label></td> ! </tr> ! ! <!---||| Set up a new table row for each field user needs to define |||---> ! <cfloop from="1" to="#FORM.numberOfFields#" index="i"> ! <cfoutput> ! <!--- Alternate the Row Colours from class style Odd to class style Even ---> ! <tr class="#IIF(i MOD 2, DE('Odd'), DE('Even'))#"> ! <!--- Print Row Number ---> ! <td><label class="Fancy">#i#</label></td> ! ! <!---||| Allow User to Specify the Fields Name |||---> ! <!--- Set a default value of empty string ---> ! <cfparam name="FORM.fieldName#i#" default="" /> ! <!--- If the form has been resubmitted by an onChange event than the original values for this form will be used ---> ! <!---***Add validate="regular_expression" to below, to ensure user entered a valid field name***---> ! <td><cfinput name="fieldName#i#" type="text" value="#Evaluate("FORM.fieldName#i#")#" size="20" maxlength="64" required="yes" message="You must enter a valid field name for New Field number #i#." class="Fancy" /></td> ! ! <!---||| Allow User to Select Field Type |||---> ! <!--- Set a default value of empty string ---> ! <cfparam name="FORM.fieldType#i#" default="" /> ! <td> ! <cfselect name="fieldType#i#" size="1" required="yes" class="Fancy" onChange="this.form.submit()"> ! <!--- Check to see if empty option was selected, and reselect it accordingly ---> ! <cfif Evaluate("FORM.fieldType#i#") IS ""> ! <option value="Empty" selected class="Fancy"></option> ! <cfelse> ! <option value="Empty" class="Fancy"></option> ! </cfif> ! <optgroup label="String" class="Fancy"> ! <!--- Check to see if VARCHAR option was selected, and reselect it accordingly ---> ! <cfif Evaluate("FORM.fieldType#i#") IS "VARCHAR"> ! <option value="VARCHAR" selected class="Fancy">VARCHAR(m)</option> ! <cfelse> ! <option value="VARCHAR" class="Fancy">VARCHAR(m)</option> ! </cfif> ! ! <!--- Check to see if CHAR option was selected, and reselect it accordingly ---> ! <cfif Evaluate("FORM.fieldType#i#") IS "CHAR"> ! <option value="CHAR" selected class="Fancy">CHAR(m)</option> ! <cfelse> ! <option value="CHAR" class="Fancy">CHAR(m)</option> ! </cfif> ! ! <!--- Check to see if TINYBLOB option was selected, and reselect it accordingly ---> ! <cfif Evaluate("FORM.fieldType#i#") IS "TINYBLOB"> ! <option value="TINYBLOB" selected class="Fancy">TINYBLOB</option> ! <cfelse> ! <option value="TINYBLOB" class="Fancy">TINYBLOB</option> ! </cfif> ! ! <!--- Check to see if BLOB option was selected, and reselect it accordingly ---> ! <cfif Evaluate("FORM.fieldType#i#") IS "BLOB"> ! <option value="BLOB" selected class="Fancy">BLOB</option> ! <cfelse> ! <option value="BLOB" class="Fancy">BLOB</option> ! </cfif> ! ! <!--- Check to see if MEDIUMBLOB option was selected, and reselect it accordingly ---> ! <cfif Evaluate("FORM.fieldType#i#") IS "MEDIUMBLOB"> ! <option value="MEDIUMBLOB" selected class="Fancy">MEDIUMBLOB</option> ! <cfelse> ! <option value="MEDIUMBLOB" class="Fancy">MEDIUMBLOB</option> ! </cfif> ! ! <!--- Check to see if LONGBLOB option was selected, and reselect it accordingly ---> ! <cfif Evaluate("FORM.fieldType#i#") IS "LONGBLOB"> ! <option value="LONGBLOB" selected class="Fancy">LONGBLOB</option> ! <cfelse> ! <option value="LONGBLOB" class="Fancy">LONGBLOB</option> ! </cfif> ! ! <!--- Check to see if TINYTEXT option was selected, and reselect it accordingly ---> ! <cfif Evaluate("FORM.fieldType#i#") IS "TINYTEXT"> ! <option value="TINYTEXT" selected class="Fancy">TINYTEXT</option> ! <cfelse> ! <option value="TINYTEXT" class="Fancy">TINYTEXT</option> ! </cfif> ! ! <!--- Check to see if TEXT option was selected, and reselect it accordingly ---> ! <cfif Evaluate("FORM.fieldType#i#") IS "TEXT"> ! <option value="TEXT" selected class="Fancy">TEXT</option> ! <cfelse> ! <option value="TEXT" class="Fancy">TEXT</option> ! </cfif> ! ! <!--- Check to see if MEDIUMTEXT option was selected, and reselect it accordingly ---> ! <cfif Evaluate("FORM.fieldType#i#") IS "MEDIUMTEXT"> ! <option value="MEDIUMTEXT" selected class="Fancy">MEDIUMTEXT</option> ! <cfelse> ! <option value="MEDIUMTEXT" class="Fancy">MEDIUMTEXT</option> ! </cfif> ! ! <!--- Check to see if LONGTEXT option was selected, and reselect it accordingly ---> ! <cfif Evaluate("FORM.fieldType#i#") IS "LONGTEXT"> ! <option value="LONGTEXT" selected class="Fancy">LONGTEXT</option> ! <cfelse> ! <option value="LONGTEXT" class="Fancy">LONGTEXT</option> ! </cfif> ! ! <!--- Check to see if ENUM option was selected, and reselect it accordingly ---> ! <cfif Evaluate("FORM.fieldType#i#") IS "ENUM"> ! <option value="ENUM" selected class="Fancy">ENUM(v1,v2,...)</option> ! <cfelse> ! <option value="ENUM" class="Fancy">ENUM(v1,v2,...)</option> ! </cfif> ! ! <!--- Check to see if SET option was selected, and reselect it accordingly ---> ! <cfif Evaluate("FORM.fieldType#i#") IS "SET"> ! <option value="SET" selected class="Fancy">SET(v1,v2,...)</option> ! <cfelse> ! <option value="SET" class="Fancy">SET(v1,v2,...)</option> ! </cfif> ! </optgroup> ! <optgroup label="Numeric" class="Fancy"> ! <!--- Check to see if TINYINT option was selected, and reselect it accordingly ---> ! <cfif Evaluate("FORM.fieldType#i#") IS "TINYINT"> ! <option value="TINYINT" selected class="Fancy">TINYINT(m)</option> ! <cfelse> ! <option value="TINYINT" class="Fancy">TINYINT(m)</option> ! </cfif> ! ! <!--- Check to see if SMALLINT option was selected, and reselect it accordingly ---> ! <cfif Evaluate("FORM.fieldType#i#") IS "SMALLINT"> ! <option value="SMALLINT" selected class="Fancy">SMALLINT(m)</option> ! <cfelse> ! <option value="SMALLINT" class="Fancy">SMALLINT(m)</option> ! </cfif> ! ! <!--- Check to see if MEDIUMINT option was selected, and reselect it accordingly ---> ! <cfif Evaluate("FORM.fieldType#i#") IS "MEDIUMINT"> ! <option value="MEDIUMINT" selected class="Fancy">MEDIUMINT(m)</option> ! <cfelse> ! <option value="MEDIUMINT" class="Fancy">MEDIUMINT(m)</option> ! </cfif> ! ! <!--- Check to see if INT option was selected, and reselect it accordingly ---> ! <cfif Evaluate("FORM.fieldType#i#") IS "INT"> ! <option value="INT" selected class="Fancy">INT(m)</option> ! <cfelse> ! <option value="INT" class="Fancy">INT(m)</option> ! </cfif> ! ! <!--- Check to see if BIGINT option was selected, and reselect it accordingly ---> ! <cfif Evaluate("FORM.fieldType#i#") IS "BIGINT"> ! <option value="BIGINT" selected class="Fancy">BIGINT(m)</option> ! <cfelse> ! <option value="BIGINT" class="Fancy">BIGINT(m)</option> ! </cfif> ! ! <!--- Check to see if FLOAT option was selected, and reselect it accordingly ---> ! <cfif Evaluate("FORM.fieldType#i#") IS "FLOAT"> ! <option value="FLOAT" selected class="Fancy">FLOAT(m,d)</option> ! <cfelse> ! <option value="FLOAT" class="Fancy">FLOAT(m,d)</option> ! </cfif> ! ! <!--- Check to see if DOUBLE option was selected, and reselect it accordingly ---> ! <cfif Evaluate("FORM.fieldType#i#") IS "DOUBLE"> ! <option value="DOUBLE" selected class="Fancy">DOUBLE(m,d)</option> ! <cfelse> ! <option value="DOUBLE" class="Fancy">DOUBLE(m,d)</option> ! </cfif> ! ! <!--- Check to see if DECIMAL option was selected, and reselect it accordingly ---> ! <cfif Evaluate("FORM.fieldType#i#") IS "DECIMAL"> ! <option value="DECIMAL" selected class="Fancy">DECIMAL(m,d)</option> ! <cfelse> ! <option value="DECIMAL" class="Fancy">DECIMAL(m,d)</option> ! </cfif> ! </optgroup> ! <optgroup label="Date Time" class="Fancy"> ! <!--- Check to see if DATE option was selected, and reselect it accordingly ---> ! <cfif Evaluate("FORM.fieldType#i#") IS "DATE"> ! <option value="DATE" selected class="Fancy">DATE</option> ! <cfelse> ! <option value="DATE" class="Fancy">DATE</option> ! </cfif> ! ! <!--- Check to see if TIME option was selected, and reselect it accordingly ---> ! <cfif Evaluate("FORM.fieldType#i#") IS "TIME"> ! <option value="TIME" selected class="Fancy">TIME</option> ! <cfelse> ! <option value="TIME" class="Fancy">TIME</option> ! </cfif> ! ! <!--- Check to see if DATETIME option was selected, and reselect it accordingly ---> ! <cfif Evaluate("FORM.fieldType#i#") IS "DATETIME"> ! <option value="DATETIME" selected class="Fancy">DATETIME</option> ! <cfelse> ! <option value="DATETIME" class="Fancy">DATETIME</option> ! </cfif> ! ! <!--- Check to see if YEAR option was selected, and reselect it accordingly ---> ! <cfif Evaluate("FORM.fieldType#i#") IS "YEAR"> ! <option value="YEAR" selected class="Fancy">YEAR</option> ! <cfelse> ! <option value="YEAR" class="Fancy">YEAR</option> ! </cfif> ! ! <!--- Check to see if TIMESTAMP option was selected, and reselect it accordingly ---> ! <cfif Evaluate("FORM.fieldType#i#") IS "TIMESTAMP"> ! <option value="TIMESTAMP" selected class="Fancy">TIMESTAMP(m)</option> ! <cfelse> ! <option value="TIMESTAMP" class="Fancy">TIMESTAMP(m)</option> ! </cfif> ! </optgroup> ! </cfselect> ! </td> ! ! <!---||| Allow User to Enter Field Options |||---> ! <!--- Set a default values of empty string ---> ! <cfparam name="FORM.length#i#" default="" /> ! <cfparam name="FORM.displayWidth#i#" default="" /> ! <cfparam name="FORM.autoIncrement#i#" default="" /> ! <cfparam name="FORM.unsigned#i#" default="" /> ! <cfparam name="FORM.zerofill#i#" default="" /> ! <cfparam name="FORM.notNull#i#" default="" /> ! <cfparam name="FORM.binary#i#" default="" /> ! <td valign="middle"> ! <!---||| Show Available Field Options Based on Selected Field Type |||---> ! <cfswitch expression="#Evaluate("FORM.fieldType#i#")#"> ! <cfcase value="VARCHAR,CHAR"> ! <nobr><label class="Fancy">Length(</label><cfinput name="length#i#" type="text" value="#Evaluate("FORM.length#i#")#" size="3" maxlength="3" range="0,255" required="yes" message="The legal range for length is 0-255. Please correct this field for row number #i#." validate="integer" class="Fancy" /><label class="Fancy">)</label></nobr><br /> ! <nobr><cfinput name="binary#i#" type="checkbox" /><label for="binary#i#" class="Fancy">BINARY</label></nobr><br /> ! <nobr><cfinput name="notNull#i#" type="checkbox" /><label for="notNull#i#" class="Fancy">NOT NULL</label></nobr> ! </cfcase> ! <cfcase value="TINYBLOB,BLOB,MEDIUMBLOB,LONGBLOB,TINYTEXT,TEXT,MEDIUMTEXT,LONGTEXT"> ! <nobr><cfinput name="notNull#i#" type="checkbox" /><label for="notNull#i#" class="Fancy">NOT NULL</label></nobr> ! </cfcase> ! <cfcase value="ENUM,SET"> ! Enum,Set: Needs to be developped<br /> ! <nobr><cfinput name="notNull#i#" type="checkbox" /><label for="notNull#i#" class="Fancy">NOT NULL</label></nobr> ! </cfcase> ! <cfcase value="TINYINT,SMALLINT,MEDIUMINT,INT,BIGINT"> ! <nobr><label class="Fancy">Display Width(</label><cfinput name="displayWidth#i#" type="text" value="#Evaluate("FORM.displayWidth#i#")#" size="2" maxlength="2" range="1,20" message="The legal range for Display Width is 1-20. Please correct this field for row number #i#." validate="integer" class="Fancy" /><label class="Fancy">)</label></nobr><br /> ! <nobr><cfinput name="autoIncrement#i#" type="checkbox" /><label for="autoIncrement#i#" class="Fancy">AUTO_INCREMENT</label></nobr><br /> ! <nobr><cfinput name="unsigned#i#" type="checkbox" /><label for="unsigned#i#" class="Fancy">UNSIGNED</label></nobr><br /> ! <nobr><cfinput name="zerofill#i#" type="checkbox" /><label for="zerofill#i#" class="Fancy">ZEROFILL</label></nobr><br /> ! <nobr><cfinput name="notNull#i#" type="checkbox" /><label for="notNull#i#" class="Fancy">NOT NULL</label></nobr> ! </cfcase> ! <cfcase value="FLOAT,DOUBLE,DECIMAL"> ! FLOAT,DOUBLE,DECIMAL: Needs to be developped<br /> ! <nobr><cfinput name="notNull#i#" type="checkbox" /><label for="notNull#i#" class="Fancy">NOT NULL</label></nobr> ! </cfcase> ! <cfcase value="DATE,TIME,DATETIME,YEAR,TIMESTAMP"> ! DATE,TIME,DATETIME,YEAR,TIMESTAMP: Needs to be developped<br /> ! <nobr><cfinput name="notNull#i#" type="checkbox" /><label for="notNull#i#" class="Fancy">NOT NULL</label></nobr> ! </cfcase> ! <cfdefaultcase><label class="Fancy">Select a Field Type to see Field Options</label></cfdefaultcase> ! </cfswitch> ! </td> ! ! <!---||| Allow User to Enter a Default Value for the Field Unless fieldType is BLOB or TEXT |||---> ! <td> ! <cfswitch expression="#Evaluate("FORM.fieldType#i#")#"> ! <cfcase value="TINYBLOB,BLOB,MEDIUMBLOB,LONGBLOB,TINYTEXT,TEXT,MEDIUMTEXT,LONGTEXT"> ! <label class="Fancy">BLOB and TEXT field types can not have default values.</label> ! </cfcase> ! <cfdefaultcase><cfinput name="default#i#" value="#Evaluate("FORM.default#i#")#" type="text" size="20" required="no" class="Fancy" /></cfdefaultcase> ! </cfswitch> ! ! ! </td> ! ! <!---||| Allow User to Specify a Single Column Index |||---> ! <td> ! Primary ! Index ! Unique ! None ! Fulltext ! </td> ! </tr> ! </cfoutput> ! </cfloop> ! </table> ! </fieldset> ! ! <!---||| Submit Request |||---> ! <fieldset class="Fancy"> ! <legend class="Fancy">Run Alter Table Query</legend> ! <!---***Insert a query box of the SQL that is about to be executed***---> ! <input name="AddFields" type="submit" value="Add Fields as Defined Above"> ! </fieldset> ! </cfform> </cflock> --- 1,508 ---- ! <!---******************************************************************************************* ! * Copyright: MyDatabase Pilot is distributed under the terms of the GNU GPL license * ! * Template: dbProcessBody/AddField.cfm * ! * Purpose: Displays the Body Content for the AddField Database Process * ! * Requiremets: -fieldList Query must be run on same page prior to including this template * ! * -URL.table (table name) must have been passed from calling template * ! ********************************************************************************************---> ! ! <!---||| Set Default Values |||---> ! <cfparam name="FORM.numberOfFields" default="1" /> ! <cfparam name="FORM.locationOfFields" default="End" /> ! <cfdump var="number of fields: #FORM.numberOfFields# location of fields: #FORM.locationOfFields#"> ! ! <!---||| Initiate a Read Only lock to ensure the integrity of session variables |||---> ! <cflock timeout = "30" throwontimeout="no" type = "readonly" scope = "session"> ! <!---||| Create AddField FORM |||---> ! <cfform action="#currentPath#?#SESSION.URLToken#&dbProcess=AddField&table=#URL.table#" method="post" name="FORM_AddField" enablecab="yes" class="Fancy"> ! <!---||| General Settings (number of new fields, location of new fields) |||---> ! <fieldset class="Fancy"> ! <legend class="Fancy">Add New Field(s) to Table <cfoutput>#URL.table#</cfoutput></legend> ! ! <!---||| Allow User to Specify the Number of New Fields |||---> ! <!---||| Set the default value to the last requested value |||---> ! <label for="numberOfFields" class="Fancy">Number of New Fields:</label> ! <cfinput name="numberOfFields" type="text" value="#FORM.numberOfFields#" size="2" maxlength="2" range="1,99" required="yes" message="You must enter an interger between 1 and 99 for the number of records field." validate="integer" class="Fancy" onChange="this.form.submit()" /> ! <br /> ! ! <!---||| Allow User to Specify the Location for the New Fields |||---> ! <!---||| Set the selected option to the last requested value |||---> ! <label for="locationOfFields" class="Fancy">Location of New Fields:</label> ! <cfselect name="locationOfFields" size="1" required="yes" class="Fancy" onChange="this.form.submit()"> ! <!---||| Create options for adding the new field(s) at the beginning and at the end of the current table |||---> ! <cfif FORM.locationOfFields IS "End"> ! <option value="End" selected class="Fancy">At End of Table <cfoutput>#URL.table#</cfoutput></option> ! <cfelse> ! <option value="End" class="Fancy">At End of Table <cfoutput>#URL.table#</cfoutput></option> ! </cfif> ! <cfif FORM.locationOfFields IS "Beginning"> ! <option value="Beginning" selected class="Fancy">At Beginning of Table <cfoutput>#URL.table#</cfoutput></option> ! <cfelse> ! <option value="Beginning" class="Fancy">At Beginning of Table <cfoutput>#URL.table#</cfoutput></option> ! </cfif> ! ! <!---||| Create options for adding the new field(s) after each of the current fields |||---> ! <cfoutput query="fieldList"> ! <cfif FORM.locationOfFields IS fieldList.FIELD> ! <option value="#fieldList.FIELD#" selected class="Fancy">After #fieldList.FIELD#</option> ! <cfelse> ! <option value="#fieldList.FIELD#" class="Fancy">After #fieldList.FIELD#</option> ! </cfif> ! </cfoutput> ! </cfselect> ! </fieldset> ! ! <!---||| Field Definitions |||---> ! <fieldset class="Fancy"> ! <legend class="Fancy">Field Definitions</legend> ! <table width="100%" border="1" cellpadding="2" cellspacing="0"> ! <!---||| Create Header |||---> ! <tr> ! <td><label class="Fancy">Field No:</label></td> ! <td><label class="Fancy">Field Name:</label></td> ! <td><label class="Fancy">Field Type:</label></td> ! <td><label class="Fancy">Field Options:</label></td> ! <td><label class="Fancy">Default Value:</label></td> ! <td><label class="Fancy">Index:</label></td> ! </tr> ! ! <!---||| Set up a new table row for each field user needs to define |||---> ! <cfloop from="1" to="#FORM.numberOfFields#" index="i"> ! <cfoutput> ! <!--- Alternate the Row Colours from class style Odd to class style Even ---> ! <tr class="#IIF(i MOD 2, DE('Odd'), DE('Even'))#"> ! <!--- Print Row Number ---> ! <td><label class="Fancy">#i#</label></td> ! ! <!---||| Allow User to Specify the Fields Name |||---> ! <!--- Set a default value of empty string ---> ! <cfparam name="FORM.fieldName#i#" default="" /> ! <!--- If the form has been resubmitted by an onChange event than the original values for this form will be used ---> ! <!---***Add validate="regular_expression" to below, to ensure user entered a valid field name***---> ! <td><cfinput name="fieldName#i#" type="text" value="#Evaluate("FORM.fieldName#i#")#" size="20" maxlength="64" required="yes" message="You must enter a valid field name for New Field number #i#." class="Fancy" /></td> ! ! <!---||| Allow User to Select Field Type |||---> ! <!--- Set a default value of empty string ---> ! <cfparam name="FORM.fieldType#i#" default="" /> ! <td> ! <cfselect name="fieldType#i#" size="1" required="yes" class="Fancy" onChange="this.form.submit()"> ! <!--- Check to see if empty option was selected, and reselect it accordingly ---> ! <cfif Evaluate("FORM.fieldType#i#") IS ""> ! <option value="Empty" selected class="Fancy"></option> ! <cfelse> ! <option value="Empty" class="Fancy"></option> ! </cfif> ! <optgroup label="String" class="Fancy"> ! <!--- Check to see if VARCHAR option was selected, and reselect it accordingly ---> ! <cfif Evaluate("FORM.fieldType#i#") IS "VARCHAR"> ! <option value="VARCHAR" selected class="Fancy">VARCHAR(m)</option> ! <cfelse> ! <option value="VARCHAR" class="Fancy">VARCHAR(m)</option> ! </cfif> ! ! <!--- Check to see if CHAR option was selected, and reselect it accordingly ---> ! <cfif Evaluate("FORM.fieldType#i#") IS "CHAR"> ! <option value="CHAR" selected class="Fancy">CHAR(m)</option> ! <cfelse> ! <option value="CHAR" class="Fancy">CHAR(m)</option> ! </cfif> ! ! <!--- Check to see if TINYBLOB option was selected, and reselect it accordingly ---> ! <cfif Evaluate("FORM.fieldType#i#") IS "TINYBLOB"> ! <option value="TINYBLOB" selected class="Fancy">TINYBLOB</option> ! <cfelse> ! <option value="TINYBLOB" class="Fancy">TINYBLOB</option> ! </cfif> ! ! <!--- Check to see if BLOB option was selected, and reselect it accordingly ---> ! <cfif Evaluate("FORM.fieldType#i#") IS "BLOB"> ! <option value="BLOB" selected class="Fancy">BLOB</option> ! <cfelse> ! <option value="BLOB" class="Fancy">BLOB</option> ! </cfif> ! ! <!--- Check to see if MEDIUMBLOB option was selected, and reselect it accordingly ---> ! <cfif Evaluate("FORM.fieldType#i#") IS "MEDIUMBLOB"> ! <option value="MEDIUMBLOB" selected class="Fancy">MEDIUMBLOB</option> ! <cfelse> ! <option value="MEDIUMBLOB" class="Fancy">MEDIUMBLOB</option> ! </cfif> ! ! <!--- Check to see if LONGBLOB option was selected, and reselect it accordingly ---> ! <cfif Evaluate("FORM.fieldType#i#") IS "LONGBLOB"> ! <option value="LONGBLOB" selected class="Fancy">LONGBLOB</option> ! <cfelse> ! <option value="LONGBLOB" class="Fancy">LONGBLOB</option> ! </cfif> ! ! <!--- Check to see if TINYTEXT option was selected, and reselect it accordingly ---> ! <cfif Evaluate("FORM.fieldType#i#") IS "TINYTEXT"> ! <option value="TINYTEXT" selected class="Fancy">TINYTEXT</option> ! <cfelse> ! <option value="TINYTEXT" class="Fancy">TINYTEXT</option> ! </cfif> ! ! <!--- Check to see if TEXT option was selected, and reselect it accordingly ---> ! <cfif Evaluate("FORM.fieldType#i#") IS "TEXT"> ! <option value="TEXT" selected class="Fancy">TEXT</option> ! <cfelse> ! <option value="TEXT" class="Fancy">TEXT</option> ! </cfif> ! ! <!--- Check to see if MEDIUMTEXT option was selected, and reselect it accordingly ---> ! <cfif Evaluate("FORM.fieldType#i#") IS "MEDIUMTEXT"> ! <option value="MEDIUMTEXT" selected class="Fancy">MEDIUMTEXT</option> ! <cfelse> ! <option value="MEDIUMTEXT" class="Fancy">MEDIUMTEXT</option> ! </cfif> ! ! <!--- Check to see if LONGTEXT option was selected, and reselect it accordingly ---> ! <cfif Evaluate("FORM.fieldType#i#") IS "LONGTEXT"> ! <option value="LONGTEXT" selected class="Fancy">LONGTEXT</option> ! <cfelse> ! <option value="LONGTEXT" class="Fancy">LONGTEXT</option> ! </cfif> ! ! <!--- Check to see if ENUM option was selected, and reselect it accordingly ---> ! <cfif Evaluate("FORM.fieldType#i#") IS "ENUM"> ! <option value="ENUM" selected class="Fancy">ENUM(v1,v2,...)</option> ! <cfelse> ! <option value="ENUM" class="Fancy">ENUM(v1,v2,...)</option> ! </cfif> ! ! <!--- Check to see if SET option was selected, and reselect it accordingly ---> ! <cfif Evaluate("FORM.fieldType#i#") IS "SET"> ! <option value="SET" selected class="Fancy">SET(v1,v2,...)</option> ! <cfelse> ! <option value="SET" class="Fancy">SET(v1,v2,...)</option> ! </cfif> ! </optgroup> ! <optgroup label="Numeric" class="Fancy"> ! <!--- Check to see if TINYINT option was selected, and reselect it accordingly ---> ! <cfif Evaluate("FORM.fieldType#i#") IS "TINYINT"> ! <option value="TINYINT" selected class="Fancy">TINYINT(m)</option> ! <cfelse> ! <option value="TINYINT" class="Fancy">TINYINT(m)</option> ! </cfif> ! ! <!--- Check to see if SMALLINT option was selected, and reselect it accordingly ---> ! <cfif Evaluate("FORM.fieldType#i#") IS "SMALLINT"> ! <option value="SMALLINT" selected class="Fancy">SMALLINT(m)</option> ! <cfelse> ! <option value="SMALLINT" class="Fancy">SMALLINT(m)</option> ! </cfif> ! ! <!--- Check to see if MEDIUMINT option was selected, and reselect it accordingly ---> ! <cfif Evaluate("FORM.fieldType#i#") IS "MEDIUMINT"> ! <option value="MEDIUMINT" selected class="Fancy">MEDIUMINT(m)</option> ! <cfelse> ! <option value="MEDIUMINT" class="Fancy">MEDIUMINT(m)</option> ! </cfif> ! ! <!--- Check to see if INT option was selected, and reselect it accordingly ---> ! <cfif Evaluate("FORM.fieldType#i#") IS "INT"> ! <option value="INT" selected class="Fancy">INT(m)</option> ! <cfelse> ! <option value="INT" class="Fancy">INT(m)</option> ! </cfif> ! ! <!--- Check to see if BIGINT option was selected, and reselect it accordingly ---> ! <cfif Evaluate("FORM.fieldType#i#") IS "BIGINT"> ! <option value="BIGINT" selected class="Fancy">BIGINT(m)</option> ! <cfelse> ! <option value="BIGINT" class="Fancy">BIGINT(m)</option> ! </cfif> ! ! <!--- Check to see if FLOAT option was selected, and reselect it accordingly ---> ! <cfif Evaluate("FORM.fieldType#i#") IS "FLOAT"> ! <option value="FLOAT" selected class="Fancy">FLOAT(m,d)</option> ! <cfelse> ! <option value="FLOAT" class="Fancy">FLOAT(m,d)</option> ! </cfif> ! ! <!--- Check to see if DOUBLE option was selected, and reselect it accordingly ---> ! <cfif Evaluate("FORM.fieldType#i#") IS "DOUBLE"> ! <option value="DOUBLE" selected class="Fancy">DOUBLE(m,d)</option> ! <cfelse> ! <option value="DOUBLE" class="Fancy">DOUBLE(m,d)</option> ! </cfif> ! ! <!--- Check to see if DECIMAL option was selected, and reselect it accordingly ---> ! <cfif Evaluate("FORM.fieldType#i#") IS "DECIMAL"> ! <option value="DECIMAL" selected class="Fancy">DECIMAL(m,d)</option> ! <cfelse> ! <option value="DECIMAL" class="Fancy">DECIMAL(m,d)</option> ! </cfif> ! </optgroup> ! <optgroup label="Date Time" class="Fancy"> ! <!--- Check to see if DATE option was selected, and reselect it accordingly ---> ! <cfif Evaluate("FORM.fieldType#i#") IS "DATE"> ! <option value="DATE" selected class="Fancy">DATE</option> ! <cfelse> ! <option value="DATE" class="Fancy">DATE</option> ! </cfif> ! ! <!--- Check to see if TIME option was selected, and reselect it accordingly ---> ! <cfif Evaluate("FORM.fieldType#i#") IS "TIME"> ! <option value="TIME" selected class="Fancy">TIME</option> ! <cfelse> ! <option value="TIME" class="Fancy">TIME</option> ! </cfif> ! ! <!--- Check to see if DATETIME option was selected, and reselect it accordingly ---> ! <cfif Evaluate("FORM.fieldType#i#") IS "DATETIME"> ! <option value="DATETIME" selected class="Fancy">DATETIME</option> ! <cfelse> ! <option value="DATETIME" class="Fancy">DATETIME</option> ! </cfif> ! ! <!--- Check to see if YEAR option was selected, and reselect it accordingly ---> ! <cfif Evaluate("FORM.fieldType#i#") IS "YEAR"> ! <option value="YEAR" selected class="Fancy">YEAR</option> ! <cfelse> ! <option value="YEAR" class="Fancy">YEAR</option> ! </cfif> ! ! <!--- Check to see if TIMESTAMP option was selected, and reselect it accordingly ---> ! <cfif Evaluate("FORM.fieldType#i#") IS "TIMESTAMP"> ! <option value="TIMESTAMP" selected class="Fancy">TIMESTAMP(m)</option> ! <cfelse> ! <option value="TIMESTAMP" class="Fancy">TIMESTAMP(m)</option> ! </cfif> ! </optgroup> ! </cfselect> ! </td> ! ! <!---||| Allow User to Enter Field Options |||---> ! <!--- Set default values of empty string for text fields ---> ! <cfparam name="FORM.length#i#" default="" /> ! <cfparam name="FORM.displayWidth#i#" default="" /> ! <cfparam name="FORM.valueList#i#" default="" /> ! <td valign="middle"> ! <!---||| Show Available Field Options Based on Selected Field Type |||---> ! <cfswitch expression="#Evaluate("FORM.fieldType#i#")#"> ! <!---||| VARCHAR and CHAR Options |||---> ! <cfcase value="VARCHAR,CHAR"> ! <!--- Show Lenght Option, set value to previous request if it exists ---> ! <!--- Make sure it is an interger between 0-255, set it to required ---> ! <nobr><label class="Fancy">Length(</label><cfinput name="length#i#" type="text" value="#Evaluate("FORM.length#i#")#" size="3" maxlength="3" range="0,255" required="yes" message="The legal range for length is 0-255. This is a required field. Please correct this field for row number #i#." validate="integer" class="Fancy" /><label class="Fancy">)</label></nobr><br /> ! <!--- Show BINARY Option, set it to checked if already set on a previous request ---> ! <nobr> ! <cfif IsDefined("FORM.binary#i#")> ! <cfinput name="binary#i#" type="checkbox" checked="yes" /> ! <cfelse> ! <cfinput name="binary#i#" type="checkbox" /> ! </cfif> ! <label for="binary#i#" class="Fancy">BINARY</label> ! </nobr><br /> ! <!--- Show NOT NULL Option, set it to checked if already set on a previous request ---> ! <nobr> ! <cfif IsDefined("FORM.notNull#i#")> ! <cfinput name="notNull#i#" type="checkbox" checked="yes" /> ! <cfelse> ! <cfinput name="notNull#i#" type="checkbox" /> ! </cfif> ! <label for="notNull#i#" class="Fancy">NOT NULL</label> ! </nobr> ! </cfcase> ! ! <!---||| BLOB and TEXT Options |||---> ! <cfcase value="TINYBLOB,BLOB,MEDIUMBLOB,LONGBLOB,TINYTEXT,TEXT,MEDIUMTEXT,LONGTEXT"> ! <!--- Show NOT NULL Option, set it to checked if already set on a previous request ---> ! <nobr> ! <cfif IsDefined("FORM.notNull#i#")> ! <cfinput name="notNull#i#" type="checkbox" checked="yes" /> ! <cfelse> ! <cfinput name="notNull#i#" type="checkbox" /> ! </cfif> ! <label for="notNull#i#" class="Fancy">NOT NULL</label> ! </nobr> ! </cfcase> ! ! <!---||| ENUM and SET Options |||---> ! <cfcase value="ENUM,SET"> ! <!--- Show "Value List" Option, set value to previous request if it exists ---> ! <label for="valueList#i#" class="Fancy">Value List:<br />Enter Each Value on a New Line</label><br /> ! <textarea name="valueList#i#" cols="20" rows="5" class="Fancy">#Evaluate("FORM.valueList#i#")#</textarea> ! <br /> ! ! <!--- Show NOT NULL Option, set it to checked if already set on a previous request ---> ! <nobr> ! <cfif IsDefined("FORM.notNull#i#")> ! <cfinput name="notNull#i#" type="checkbox" checked="yes" /> ! <cfelse> ! <cfinput name="notNull#i#" type="checkbox" /> ! </cfif> ! <label for="notNull#i#" class="Fancy">NOT NULL</label> ! </nobr> ! </cfcase> ! ! <!---||| INTEGER Options |||---> ! <cfcase value="TINYINT,SMALLINT,MEDIUMINT,INT,BIGINT"> ! <!--- Show "Display Width" Option, set value to previous request if it exists ---> ! <!--- Make sure it is an interger between 1-20, set it to not required ---> ! <nobr><label class="Fancy">Display Width(</label><cfinput name="displayWidth#i#" type="text" value="#Evaluate("FORM.displayWidth#i#")#" size="2" maxlength="2" range="1,20" required="no" message="The legal range for Display Width is 1-20. Please correct this field for row number #i#." validate="integer" class="Fancy" /><label class="Fancy">)</label></nobr><br /> ! <!--- Show AUTO_INCREMENT Option, set it to checked if already set on a previous request ---> ! <nobr> ! <cfif IsDefined("FORM.autoIncrement#i#")> ! <cfinput name="autoIncrement#i#" type="checkbox" checked="yes" /> ! <cfelse> ! <cfinput name="autoIncrement#i#" type="checkbox" /> ! </cfif> ! <label for="autoIncrement#i#" class="Fancy">AUTO_INCREMENT</label> ! </nobr><br /> ! <!--- Show UNSIGNED Option, set it to checked if already set on a previous request ---> ! <nobr> ! <cfif IsDefined("FORM.unsigned#i#")> ! <cfinput name="unsigned#i#" type="checkbox" checked="yes" /> ! <cfelse> ! <cfinput name="unsigned#i#" type="checkbox" /> ! </cfif> ! <label for="unsigned#i#" class="Fancy">UNSIGNED</label> ! </nobr><br /> ! <!--- Show ZEROFILL Option, set it to checked if already set on a previous request ---> ! <nobr> ! <cfif IsDefined("FORM.zerofill#i#")> ! <cfinput name="zerofill#i#" type="checkbox" checked="yes" /> ! <cfelse> ! <cfinput name="zerofill#i#" type="checkbox" /> ! </cfif> ! <label for="zerofill#i#" class="Fancy">ZEROFILL</label> ! </nobr><br /> ! <!--- Show NOT NULL Option, set it to checked if already set on a previous request ---> ! <nobr> ! <cfif IsDefined("FORM.notNull#i#")> ! <cfinput name="notNull#i#" type="checkbox" checked="yes" /> ! <cfelse> ! <cfinput name="notNull#i#" type="checkbox" /> ! </cfif> ! <label for="notNull#i#" class="Fancy">NOT NULL</label> ! </nobr> ! </cfcase> ! ! <!---||| FLOAT and DOUBLE Options |||---> ! <cfcase value="FLOAT,DOUBLE"> ! FLOAT, DOUBLE: Needs to be developped<br /> ! Add:[(m,D)] fields<br /> ! <!--- Show UNSIGNED Option, set it to checked if already set on a previous request ---> ! <nobr> ! <cfif IsDefined("FORM.unsigned#i#")> ! <cfinput name="unsigned#i#" type="checkbox" checked="yes" /> ! <cfelse> ! <cfinput name="unsigned#i#" type="checkbox" /> ! </cfif> ! <label for="unsigned#i#" class="Fancy">UNSIGNED</label> ! </nobr><br /> ! <!--- Show ZEROFILL Option, set it to checked if already set on a previous request ---> ! <nobr> ! <cfif IsDefined("FORM.zerofill#i#")> ! <cfinput name="zerofill#i#" type="checkbox" checked="yes" /> ! <cfelse> ! <cfinput name="zerofill#i#" type="checkbox" /> ! </cfif> ! <label for="zerofill#i#" class="Fancy">ZEROFILL</label> ! </nobr><br /> ! <!--- Show NOT NULL Option, set it to checked if already set on a previous request ---> ! <nobr> ! <cfif IsDefined("FORM.notNull#i#")> ! <cfinput name="notNull#i#" type="checkbox" checked="yes" /> ! <cfelse> ! <cfinput name="notNull#i#" type="checkbox" /> ! </cfif> ! <label for="notNull#i#" class="Fancy">NOT NULL</label> ! </nobr> ! </cfcase> ! ! <!---||| DECIMAL Options |||---> ! <cfcase value="DECIMAL"> ! DECIMAL: Needs to be developped<br /> ! Add:[(m[,D])] fields<br /> ! <!--- Show UNSIGNED Option, set it to checked if already set on a previous request ---> ! <nobr> ! <cfif IsDefined("FORM.unsigned#i#")> ! <cfinput name="unsigned#i#" type="checkbox" checked="yes" /> ! <cfelse> ! <cfinput name="unsigned#i#" type="checkbox" /> ! </cfif> ! <label for="unsigned#i#" class="Fancy">UNSIGNED</label> ! </nobr><br /> ! <!--- Show ZEROFILL Option, set it to checked if already set on a previous request ---> ! <nobr> ! <cfif IsDefined("FORM.zerofill#i#")> ! <cfinput name="zerofill#i#" type="checkbox" checked="yes" /> ! <cfelse> ! <cfinput name="zerofill#i#" type="checkbox" /> ! </cfif> ! <label for="zerofill#i#" class="Fancy">ZEROFILL</label> ! </nobr><br /> ! <!--- Show NOT NULL Option, set it to checked if already set on a previous request ---> ! <nobr> ! <cfif IsDefined("FORM.notNull#i#")> ! <cfinput name="notNull#i#" type="checkbox" checked="yes" /> ! <cfelse> ! <cfinput name="notNull#i#" type="checkbox" /> ! </cfif> ! <label for="notNull#i#" class="Fancy">NOT NULL</label> ! </nobr> ! </cfcase> ! ! <!---||| DATE and TIME Options |||---> ! <cfcase value="DATE,TIME,DATETIME,YEAR,TIMESTAMP"> ! DATE, TIME, DATETIME, YEAR, TIMESTAMP: Needs to be developped<br /> ! <!--- Show NOT NULL Option, set it to checked if already set on a previous request ---> ! <nobr> ! <cfif IsDefined("FORM.notNull#i#")> ! <cfinput name="notNull#i#" type="checkbox" checked="yes" /> ! <cfelse> ! <cfinput name="notNull#i#" type="checkbox" /> ! </cfif> ! <label for="notNull#i#" class="Fancy">NOT NULL</label> ! </nobr> ! </cfcase> ! ! <!---||| Datatype not selected default display |||---> ! <cfdefaultcase><label class="Fancy">Select a Field Type to see Field Options</label></cfdefaultcase> ! </cfswitch> ! </td> ! ! <!---||| Allow User to Enter a Default Value for the Field Unless fieldType is BLOB or TEXT |||---> ! <!--- Set default value of empty string ---> ! <cfparam name="FORM.default#i#" default="" /> ! <td> ! <cfswitch expression="#Evaluate("FORM.fieldType#i#")#"> ! <cfcase value="TINYBLOB,BLOB,MEDIUMBLOB,LONGBLOB,TINYTEXT,TEXT,MEDIUMTEXT,LONGTEXT"> ! <label class="Fancy">BLOB and TEXT field types can not have default values.</label> ! </cfcase> ! <cfdefaultcase><cfinput name="default#i#" value="#Evaluate("FORM.default#i#")#" type="text" size="20" required="no" class="Fancy" /></cfdefaultcase> ! </cfswitch> ! </td> ! ! <!---||| Allow User to Specify a Single Column Index |||---> ! <td> ! Primary ! Index ! Unique ! None ! Fulltext ! </td> ! </tr> ! </cfoutput> ! </cfloop> ! </table> ! </fieldset> ! ! <!---||| SQL Preview |||---> ! <fieldset class="Fancy"> ! <legend class="Fancy">SQL Preview</legend> ! Needs to be developed: Show Alter Table command that is about to be executed<br /> ! Create "Update SQL Preview" Button, to refresh Preview Box ! </fieldset> ! ! <!---||| Submit Request |||---> ! <fieldset class="Fancy"> ! <legend class="Fancy">Run Alter Table Query</legend> ! <!---***Insert a query box of the SQL that is about to be executed***---> ! <input name="AddFields" type="submit" value="Add Fields as Defined Above"> ! </fieldset> ! </cfform> </cflock> |