Question
convert Application.cfm
I am working on a project that uses both Application.cfm and
Application.cfc(CF6.1) and I think it is time to convert
Application.cfm to Application.cfc, however I really don't know
where to start from so please help.
Application.cfm
<cfprocessingdirective pageencoding="ISO-8859-15" />
<meta http-equiv="description" content="Copyright Saragon 1993 - 2000"></meta>
<cfsetting enablecfoutputonly="YES">
<cfsetting showdebugoutput="YES">
<!--- OVERRIDE SERVER TEXT ENCODING TYPE --->
<cfcontent type="text/html; charset=ISO-8859-1">
<cfscript>
setEncoding("form","iso-8859-1");
setEncoding("url","iso-8859-1");
</cfscript>
<cfapplication name="ODYSSEYDEV_CUTS"
sessionmanagement="YES"
sessiontimeout="#CreateTimeSpan(0,0,20,0)#"
applicationtimeout="#CreateTimeSpan(2,0,0,0)#"
clientmanagement="NO"
setclientcookies="YES">
<!--- cause session vars to expire after the browser closes --->
<cfif isDefined("Cookie.CFID") and isDefined("Cookie.CFTOKEN")>
<cfset cfid_local = cookie.cfid>
<cfset cftoken_local = cookie.cftoken>
<cfcookie name="CFID" value="#cfid_local#">
<cfcookie name="CFTOKEN" value="#cftoken_local#">
</cfif>
<cfset request.cv_directory = "cv_eps/src">
<!--- get application wide settings -------------- --->
<cfinvoke component="#request.cv_directory#.Application"
method="getSettings"
returnVariable="variables.settings">
<cfscript>
s_dbt = variables.settings.dbt;
s_dsn = variables.settings.dsn;
s_dsn2 = variables.settings.dsn2;
s_dsn3 = variables.settings.dsn3;
s_interfacedsn = variables.settings.interfacedsn;
s_readdsn = variables.settings.readdsn;
s_host_token = variables.settings.program_id;
</cfscript>
<!---
TO CHANGE THE DNS CHANGE IT IN THE 'Application.cfc' PAGE WHICH IS IN THE SAME DIRECTORY AS 'Application.cfm'.
CHANGES MADE TO THE CFC WILL UPDATE THE DSN FOR ALL THE SOFTWARE
--->
<cfset dbt = "#s_dbt#">
<cfset dsn = "#s_dsn#">
<cfset dsn2 = "#s_dsn2#">
<cfset dsn3 = "#s_dsn3#">
<cfset interfacedsn = "#s_interfacedsn#"><!--- shared database user for insert/reading interface requests --->
<cfset request.readdsn = "#s_readdsn#"><!--- Datasource for READ codes --->
<cfset back_ground_color = "##E8EBF0">
<!--- <table bgcolor="#5C4D77" --->
<cfset demo=false><!--- global switch between demo mode. --->
<cfset debug=false> <!--- turn debugging statments on/off --->
<cfset request.debug=false><!--- turn debugging statments on/off (GLOBAL - TO WORK IN TAGS) --->
<cfset redirectUsers="tr_user"><!--- nessex,diab_admin,shaw,admin,consultant,sara_admin,gp --->
<cflock scope="SESSION" type="READONLY" timeout="10">
<cfif isDefined("session.userid") AND (ListFind(redirectUsers,session.userid))>
<cfset dsn = "cmedgar_at_coldman">
<cfset dsn2 = "pmi">
<cfset dsn3 = "pmi">
<cfset dbt = "Oracle80">
</cfif>
</cflock>
<!--- End database global variables --->
<cfif NOT IsDefined("session.demoMode")> <!--- only set once --->
<cfif IsDefined("session.userid")> <!--- only set if user has logged in --->
<cflock scope="SESSION" type="READONLY" timeout="10">
<cfset user_id = session.userid>
</cflock>
<cfif user_id NEQ "">
<cfif NOT isDefined("demoUserList")>
<!--- ** START OF DEMO MODE CODE ** --->
<!--- add username names to this list for users wanting to use the demo mode --->
<cfset demoUserList = "ifenton,samichie,agthorne,consultant,clerk"><!--- create list of users which will use the demo --->
<cfif listFind(demoUserList,"#user_id#")><!--- if the user logged in is found in the list switch demo mode on --->
<cflock scope="SESSION" type="EXCLUSIVE" timeout="10">
<cfset session.demoMode = true>
</cflock>
<cfelse>
<cflock scope="SESSION" type="EXCLUSIVE" timeout="10">
<cfset session.demoMode = false>
</cflock>
</cfif>
<!--- ** END OF DEMO MODE CODE ** --->
<!--- ** START OF DEMO APPSMODE CODE ** --->
<!--- add names to this list which will use the apps demo version --->
<cfset appsDemoUserList = "ifenton,samichie,agthorne,consultant,clerk">
<cfif listFind(appsDemoUserList,"#user_id#")>
<cflock scope="SESSION" type="EXCLUSIVE" timeout="10">
<cfset session.appsDemo = true>
</cflock>
<cfelse>
<cflock scope="SESSION" type="EXCLUSIVE" timeout="10">
<cfset session.appsDemo = false>
</cflock>
</cfif>
<!--- ** END OF DEMO APPSMODE CODE ** --->
</cfif>
</cfif>
</cfif>
</cfif>
<cflock scope="SESSION" type="READONLY" timeout="10">
<cfif isDefined("session.appsDemo") AND session.appsDemo>
<cfset del_file=false> <!--- turn delete file off if user in apps demo mode--->
<cfelse>
<cfset del_file=true> <!--- turn delete file on --->
</cfif>
</cflock>
<!--- next if statment checks what OS platform CFusion server is running on a converts the paths accordingly --->
<cflock scope="SERVER" timeout="10" type="READONLY">
<cfif server.os.name IS "UNIX">
<cfset app_path="">
<cfset to_directory="/opt/ebiz/saragon/to/">
<cfset from_directory="/opt/ebiz/saragon/from/">
<cfset slash="/"> <!--- set the path separator '\' Win or '/' Unix --->
<cfelse>
<cfset slash="\"> <!--- set the path separator '\' Win or '/' Unix --->
<cfset app_path="C:\"> <!--- Path to the TOPAS directory --->
<cfset to_directory="opt\ebiz\saragon\to\"> <!--- directory used for writing files to topas --->
<cfset from_directory="opt\ebiz\saragon\from\"> <!--- directory used for reading files from topas --->
</cfif>
</cflock>
Application.cfc
<cfcomponent displayname= "Application Settings" hint = "Stores all the settings for the application.">
<cfprocessingdirective pageencoding="iso-8859-15" />
<!--- set properties ------------------------------ --->
<cfscript>
this.settings = StructNew();
this.settings.dbt = "Oracle80";
this.settings.dsn = "tayside10gcluster";
this.settings.dsn2 = "NLG_PMI_at_coldman";
this.settings.dsn3 = "NLG_PMI_at_coldman";
this.settings.readdsn = "read_codes_at_testmx";
this.settings.interfacedsn = "cmedgar_at_coldman";
this.settings.program_id = "CF1";
</cfscript>
<cffunction name="getSettings" access="public" returntype="struct">
<cfset st_return_value= this.settings>
<cfreturn st_return_value>
</cffunction>
</cfcomponent>
Application.cfm
<cfprocessingdirective pageencoding="ISO-8859-15" />
<meta http-equiv="description" content="Copyright Saragon 1993 - 2000"></meta>
<cfsetting enablecfoutputonly="YES">
<cfsetting showdebugoutput="YES">
<!--- OVERRIDE SERVER TEXT ENCODING TYPE --->
<cfcontent type="text/html; charset=ISO-8859-1">
<cfscript>
setEncoding("form","iso-8859-1");
setEncoding("url","iso-8859-1");
</cfscript>
<cfapplication name="ODYSSEYDEV_CUTS"
sessionmanagement="YES"
sessiontimeout="#CreateTimeSpan(0,0,20,0)#"
applicationtimeout="#CreateTimeSpan(2,0,0,0)#"
clientmanagement="NO"
setclientcookies="YES">
<!--- cause session vars to expire after the browser closes --->
<cfif isDefined("Cookie.CFID") and isDefined("Cookie.CFTOKEN")>
<cfset cfid_local = cookie.cfid>
<cfset cftoken_local = cookie.cftoken>
<cfcookie name="CFID" value="#cfid_local#">
<cfcookie name="CFTOKEN" value="#cftoken_local#">
</cfif>
<cfset request.cv_directory = "cv_eps/src">
<!--- get application wide settings -------------- --->
<cfinvoke component="#request.cv_directory#.Application"
method="getSettings"
returnVariable="variables.settings">
<cfscript>
s_dbt = variables.settings.dbt;
s_dsn = variables.settings.dsn;
s_dsn2 = variables.settings.dsn2;
s_dsn3 = variables.settings.dsn3;
s_interfacedsn = variables.settings.interfacedsn;
s_readdsn = variables.settings.readdsn;
s_host_token = variables.settings.program_id;
</cfscript>
<!---
TO CHANGE THE DNS CHANGE IT IN THE 'Application.cfc' PAGE WHICH IS IN THE SAME DIRECTORY AS 'Application.cfm'.
CHANGES MADE TO THE CFC WILL UPDATE THE DSN FOR ALL THE SOFTWARE
--->
<cfset dbt = "#s_dbt#">
<cfset dsn = "#s_dsn#">
<cfset dsn2 = "#s_dsn2#">
<cfset dsn3 = "#s_dsn3#">
<cfset interfacedsn = "#s_interfacedsn#"><!--- shared database user for insert/reading interface requests --->
<cfset request.readdsn = "#s_readdsn#"><!--- Datasource for READ codes --->
<cfset back_ground_color = "##E8EBF0">
<!--- <table bgcolor="#5C4D77" --->
<cfset demo=false><!--- global switch between demo mode. --->
<cfset debug=false> <!--- turn debugging statments on/off --->
<cfset request.debug=false><!--- turn debugging statments on/off (GLOBAL - TO WORK IN TAGS) --->
<cfset redirectUsers="tr_user"><!--- nessex,diab_admin,shaw,admin,consultant,sara_admin,gp --->
<cflock scope="SESSION" type="READONLY" timeout="10">
<cfif isDefined("session.userid") AND (ListFind(redirectUsers,session.userid))>
<cfset dsn = "cmedgar_at_coldman">
<cfset dsn2 = "pmi">
<cfset dsn3 = "pmi">
<cfset dbt = "Oracle80">
</cfif>
</cflock>
<!--- End database global variables --->
<cfif NOT IsDefined("session.demoMode")> <!--- only set once --->
<cfif IsDefined("session.userid")> <!--- only set if user has logged in --->
<cflock scope="SESSION" type="READONLY" timeout="10">
<cfset user_id = session.userid>
</cflock>
<cfif user_id NEQ "">
<cfif NOT isDefined("demoUserList")>
<!--- ** START OF DEMO MODE CODE ** --->
<!--- add username names to this list for users wanting to use the demo mode --->
<cfset demoUserList = "ifenton,samichie,agthorne,consultant,clerk"><!--- create list of users which will use the demo --->
<cfif listFind(demoUserList,"#user_id#")><!--- if the user logged in is found in the list switch demo mode on --->
<cflock scope="SESSION" type="EXCLUSIVE" timeout="10">
<cfset session.demoMode = true>
</cflock>
<cfelse>
<cflock scope="SESSION" type="EXCLUSIVE" timeout="10">
<cfset session.demoMode = false>
</cflock>
</cfif>
<!--- ** END OF DEMO MODE CODE ** --->
<!--- ** START OF DEMO APPSMODE CODE ** --->
<!--- add names to this list which will use the apps demo version --->
<cfset appsDemoUserList = "ifenton,samichie,agthorne,consultant,clerk">
<cfif listFind(appsDemoUserList,"#user_id#")>
<cflock scope="SESSION" type="EXCLUSIVE" timeout="10">
<cfset session.appsDemo = true>
</cflock>
<cfelse>
<cflock scope="SESSION" type="EXCLUSIVE" timeout="10">
<cfset session.appsDemo = false>
</cflock>
</cfif>
<!--- ** END OF DEMO APPSMODE CODE ** --->
</cfif>
</cfif>
</cfif>
</cfif>
<cflock scope="SESSION" type="READONLY" timeout="10">
<cfif isDefined("session.appsDemo") AND session.appsDemo>
<cfset del_file=false> <!--- turn delete file off if user in apps demo mode--->
<cfelse>
<cfset del_file=true> <!--- turn delete file on --->
</cfif>
</cflock>
<!--- next if statment checks what OS platform CFusion server is running on a converts the paths accordingly --->
<cflock scope="SERVER" timeout="10" type="READONLY">
<cfif server.os.name IS "UNIX">
<cfset app_path="">
<cfset to_directory="/opt/ebiz/saragon/to/">
<cfset from_directory="/opt/ebiz/saragon/from/">
<cfset slash="/"> <!--- set the path separator '\' Win or '/' Unix --->
<cfelse>
<cfset slash="\"> <!--- set the path separator '\' Win or '/' Unix --->
<cfset app_path="C:\"> <!--- Path to the TOPAS directory --->
<cfset to_directory="opt\ebiz\saragon\to\"> <!--- directory used for writing files to topas --->
<cfset from_directory="opt\ebiz\saragon\from\"> <!--- directory used for reading files from topas --->
</cfif>
</cflock>
Application.cfc
<cfcomponent displayname= "Application Settings" hint = "Stores all the settings for the application.">
<cfprocessingdirective pageencoding="iso-8859-15" />
<!--- set properties ------------------------------ --->
<cfscript>
this.settings = StructNew();
this.settings.dbt = "Oracle80";
this.settings.dsn = "tayside10gcluster";
this.settings.dsn2 = "NLG_PMI_at_coldman";
this.settings.dsn3 = "NLG_PMI_at_coldman";
this.settings.readdsn = "read_codes_at_testmx";
this.settings.interfacedsn = "cmedgar_at_coldman";
this.settings.program_id = "CF1";
</cfscript>
<cffunction name="getSettings" access="public" returntype="struct">
<cfset st_return_value= this.settings>
<cfreturn st_return_value>
</cffunction>
</cfcomponent>
