Changeset 2106
- Timestamp:
- 03/25/09 23:18:25 (4 years ago)
- Location:
- codedepot/trunk/projects
- Files:
-
- 10 added
- 6 removed
- 10 modified
- 3 copied
- 2 moved
-
LookupManager/config/StandAloneSettings.xml (modified) (3 diffs)
-
LookupManager/config/coldbox.xml.cfm (modified) (7 diffs)
-
LookupManager/config/definitions/security.Permission$EC197E05D68FF981DBE896D6BBB42380.transfer (deleted)
-
LookupManager/config/definitions/security.Permission@EC197E05D68FF981DBE896D6BBB42380.transfer (deleted)
-
LookupManager/config/definitions/security.Role$BE4EF24A52A3A2EB0609DA271AEE0B1F.transfer (deleted)
-
LookupManager/config/definitions/security.User$2E03AEE10B577B4992CD1FE8DAEF5B53.transfer (deleted)
-
LookupManager/config/definitions/security.User@2E03AEE10B577B4992CD1FE8DAEF5B53.transfer (deleted)
-
LookupManager/config/transfer.xml.cfm (modified) (1 diff)
-
LookupManager/handlers/lookups.cfc (modified) (4 diffs)
-
LookupManager/includes/lookups/styles/lookups.css (modified) (5 diffs)
-
LookupManager/model/lookups/DecoratorTemplate.cfm (added)
-
LookupManager/model/lookups/LookupService.cfc (modified) (11 diffs)
-
LookupManager/model/lookups/xmlFormatter.xsl (added)
-
LookupManager/model/security (deleted)
-
LookupManager/readme.txt (added)
-
LookupManager/views/lookups/Add.cfm (modified) (1 diff)
-
LookupManager/views/lookups/Edit.cfm (modified) (1 diff)
-
LookupManager/views/lookups/Listing.cfm (modified) (2 diffs)
-
LookupManager/views/lookups/addLookup.cfm (modified) (3 diffs)
-
LookupManager/views/lookups/addLookupColumns.cfm (added)
-
LookupManager/views/lookups/addLookupColumnsHelper.cfm (added)
-
LookupManager/views/lookups/addLookupHelper.cfm (added)
-
LookupManager/views/lookups/createConfirmation.cfm (added)
-
coldbox-security (added)
-
coldbox-security/model (added)
-
coldbox-security/model/security (added)
-
coldbox-security/model/security-mssql.sql (moved) (moved from codedepot/trunk/projects/LookupManager/model/security-mssql.sql)
-
coldbox-security/model/security-mysql.sql (moved) (moved from codedepot/trunk/projects/LookupManager/model/security-mysql.sql)
-
coldbox-security/model/security/Permission.cfc (copied) (copied from codedepot/trunk/projects/LookupManager/model/security/Permission.cfc)
-
coldbox-security/model/security/Role.cfc (copied) (copied from codedepot/trunk/projects/LookupManager/model/security/Role.cfc)
-
coldbox-security/model/security/User.cfc (copied) (copied from codedepot/trunk/projects/LookupManager/model/security/User.cfc)
Legend:
- Unmodified
- Added
- Removed
-
codedepot/trunk/projects/LookupManager/config/StandAloneSettings.xml
r2104 r2106 1 <!-- Use the Elements below to merge them into your coldbox.xml --> 2 1 3 <YourSettings> 2 4 <!-- Lookups Settings --> 3 <Setting name="lookups_tables" value="{'Roles':'security.Role', 5 <!-- 6 Sample 7 <Setting name="lookups_tables" value="{'Roles':'security.Role', 4 8 'Users':'security.User', 5 'Permissions':'security.Permission'}" /> 9 'Permissions':'security.Permission'}" /> 10 --> 11 <Setting name="lookups_tables" value="" /> 6 12 <Setting name="lookups_imgPath" value="includes/lookups/images" /> 7 13 <Setting name="lookups_cssPath" value="includes/lookups/styles" /> … … 10 16 <Setting name="lookups_dsn" value="lookups" /> 11 17 <!-- Leave empty if handlers and views not in a package --> 12 <Setting name="lookups_packagePath" value="" /> 18 <Setting name="lookups_packagePath" value="" /> 13 19 </YourSettings> 14 20 … … 21 27 22 28 <Datasources> 23 24 29 <!-- This is just to load the ORM with the right DSN, retouch as needed --> 25 30 <Datasource alias="lookups" name="lookups" dbtype="mysql" username="" password="" /> -
codedepot/trunk/projects/LookupManager/config/coldbox.xml.cfm
r2104 r2106 1 1 <?xml version="1.0" encoding="UTF-8"?> 2 <Config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 3 xsi:noNamespaceSchemaLocation="http://www.coldboxframework.com/schema/config_2.6.0.xsd"> 2 <Config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.coldboxframework.com/schema/config_2.6.0.xsd"> 4 3 <Settings> 5 4 <!-- Application Setup--> 6 <Setting name="AppName" value="LookupManager"/>5 <Setting name="AppName" value="LookupManager"/> 7 6 <!-- <Setting name="AppMapping" value=""/> --> 8 <Setting name="OwnerEmail" value=""/>9 <Setting name="EventName" value="event"/>7 <Setting name="OwnerEmail" value=""/> 8 <Setting name="EventName" value="event"/> 10 9 11 10 <!-- Security & Dev Modes --> 12 <Setting name="DebugMode" value="false"/>13 <Setting name="DebugPassword" value=""/>14 <Setting name="ReinitPassword" value=""/>15 <Setting name="EnableDumpVar" value="false"/>16 <Setting name="HandlersIndexAutoReload" value="true"/>17 <Setting name="ConfigAutoReload" value="false"/>11 <Setting name="DebugMode" value="false"/> 12 <Setting name="DebugPassword" value=""/> 13 <Setting name="ReinitPassword" value=""/> 14 <Setting name="EnableDumpVar" value="false"/> 15 <Setting name="HandlersIndexAutoReload" value="true"/> 16 <Setting name="ConfigAutoReload" value="false"/> 18 17 19 18 <!--Default event name variable to use in URL/FORM etc. --> 20 <Setting name="EnableColdfusionLogging" value="false"/>21 <Setting name="EnableColdboxLogging" value="false"/>22 <Setting name="ColdboxLogsLocation" value=""/>23 <Setting name="DefaultLogLevel" value="4"/>19 <Setting name="EnableColdfusionLogging" value="false"/> 20 <Setting name="EnableColdboxLogging" value="false"/> 21 <Setting name="ColdboxLogsLocation" value=""/> 22 <Setting name="DefaultLogLevel" value="4"/> 24 23 25 24 <!-- Implicit Events --> 26 <Setting name="DefaultEvent" value="lookups.display"/>27 <Setting name="RequestStartHandler" value=""/>28 <Setting name="RequestEndHandler" value=""/>29 <Setting name="ApplicationStartHandler" value=""/>30 <Setting name="SessionStartHandler" value=""/>31 <Setting name="SessionEndHandler" value=""/>32 <Setting name="ExceptionHandler" value=""/>33 <Setting name="onInvalidEvent" value=""/>25 <Setting name="DefaultEvent" value="lookups.display"/> 26 <Setting name="RequestStartHandler" value=""/> 27 <Setting name="RequestEndHandler" value=""/> 28 <Setting name="ApplicationStartHandler" value=""/> 29 <Setting name="SessionStartHandler" value=""/> 30 <Setting name="SessionEndHandler" value=""/> 31 <Setting name="ExceptionHandler" value=""/> 32 <Setting name="onInvalidEvent" value=""/> 34 33 35 34 <!-- Application Aspects --> 36 <Setting name="EnableBugReports" value="false"/>37 <Setting name="MessageboxStyleOverride" value="false"/>38 <Setting name="ProxyReturnCollection" value="false"/>39 <Setting name="FlashURLPersistScope" value="session"/>35 <Setting name="EnableBugReports" value="false"/> 36 <Setting name="MessageboxStyleOverride" value="false"/> 37 <Setting name="ProxyReturnCollection" value="false"/> 38 <Setting name="FlashURLPersistScope" value="session"/> 40 39 41 40 <!-- Extension Points --> 42 <Setting name="CustomErrorTemplate" value=""/>43 <Setting name="UDFLibraryFile" value=""/>44 <Setting name="MyPluginsLocation" value=""/>45 <Setting name="HandlersExternalLocation" value=""/>46 <Setting name="ViewsExternalLocation" value=""/>47 <Setting name="RequestContextDecorator" value=""/>41 <Setting name="CustomErrorTemplate" value=""/> 42 <Setting name="UDFLibraryFile" value=""/> 43 <Setting name="MyPluginsLocation" value=""/> 44 <Setting name="HandlersExternalLocation" value=""/> 45 <Setting name="ViewsExternalLocation" value=""/> 46 <Setting name="RequestContextDecorator" value=""/> 48 47 49 48 <!-- Caching Directives --> 50 <Setting name="HandlerCaching" value="false"/>51 <Setting name="EventCaching" value="false"/>49 <Setting name="HandlerCaching" value="false"/> 50 <Setting name="EventCaching" value="false"/> 52 51 53 52 <!-- Model Integration --> 54 <Setting name="ModelsExternalLocation" value=""/>55 <Setting name="ModelsObjectCaching" value="false"/>56 <Setting name="ModelsStopRecursion" value="transfer.com.TransferDecorator"/>53 <Setting name="ModelsExternalLocation" value=""/> 54 <Setting name="ModelsObjectCaching" value="true"/> 55 <Setting name="ModelsStopRecursion" value="transfer.com.TransferDecorator"/> 57 56 <!-- Uncomment More Model Integration Settings: 58 57 <Setting name="ModelsSetterInjection" value="false" /> … … 62 61 63 62 <!-- IOC Integration --> 64 <Setting name="IOCFramework" value=""/>65 <Setting name="IOCFrameworkReload" value="false"/>66 <Setting name="IOCDefinitionFile" value=""/>67 <Setting name="IOCObjectCaching" value="false"/>63 <Setting name="IOCFramework" value=""/> 64 <Setting name="IOCFrameworkReload" value="false"/> 65 <Setting name="IOCDefinitionFile" value=""/> 66 <Setting name="IOCObjectCaching" value="false"/> 68 67 </Settings> 69 68 70 69 <YourSettings> 71 70 <!-- Lookups Settings --> 72 <Setting name="lookups_tables" value="{'Roles':'security.Role', 73 'Users':'security.User', 74 'Permissions':'security.Permission'}" /> 75 <Setting name="lookups_imgPath" value="includes/lookups/images" /> 76 <Setting name="lookups_cssPath" value="includes/lookups/styles" /> 77 <Setting name="lookups_jsPath" value="includes/lookups/js" /> 78 <Setting name="lookups_dsn" value="lookups" /> 71 <Setting name="lookups_tables" value=""/> 72 <Setting name="lookups_imgPath" value="includes/lookups/images"/> 73 <Setting name="lookups_cssPath" value="includes/lookups/styles"/> 74 <Setting name="lookups_jsPath" value="includes/lookups/js"/> 75 <Setting name="lookups_dsn" value="lookups"/> 79 76 <!-- Leave empty if handlers and views not in a package --> 80 <Setting name="lookups_packagePath" value=""/>77 <Setting name="lookups_packagePath" value=""/> 81 78 </YourSettings> 82 79 … … 84 81 <DefaultLayout>Layout.Lookups.cfm</DefaultLayout> 85 82 <!-- Lookups Layout --> 86 <Layout name="Lookups" file="Layout.Lookups.cfm">83 <Layout file="Layout.Lookups.cfm" name="Lookups"> 87 84 <Folder>lookups</Folder> 88 85 </Layout> … … 90 87 91 88 <Datasources> 92 <Datasource alias="lookups" name="lookups" dbtype="mysql" username="" password=""/>89 <Datasource alias="lookups" dbtype="mysql" name="lookups" password="" username=""/> 93 90 </Datasources> 94 91 … … 96 93 <!-- USE AUTOWIRING --> 97 94 <Interceptor class="coldbox.system.interceptors.autowire"> 98 <Property name= 'enableSetterInjection'>true</Property>95 <Property name="enableSetterInjection">true</Property> 99 96 </Interceptor> 100 97 <!-- USE SES --> … … 102 99 <Property name="configFile">config/routes.cfm</Property> 103 100 </Interceptor> 104 <!-- Transfer Loader -->101 <!-- Transfer Loader : ColdBox 2.6.3 < 105 102 <Interceptor class="coldbox.system.extras.transfer.TransferLoader"> 106 103 <Property name="ConfigPath">/${AppMapping}/config/transfer.xml.cfm</Property> … … 110 107 <Property name="BeanInjectorProperties">{'useSetterInjection':'false','stopRecursion':'${ModelsStopRecursion}'}</Property> 111 108 </Interceptor> 112 109 --> 110 <!-- Transfer Loader : ColdBox 3.0.0 > --> 111 <Interceptor class="coldbox.system.orm.transfer.TransferLoader"> 112 <Property name="ConfigPath">/${AppMapping}/config/transfer.xml.cfm</Property> 113 <Property name="definitionPath">/${AppMapping}/config/definitions</Property> 114 <Property name="datasourceAlias">${Datasources.lookups.name}</Property> 115 <Property name="LoadBeanInjector">true</Property> 116 <Property name="BeanInjectorProperties">{'useSetterInjection':'false','stopRecursion':'${ModelsStopRecursion}'}</Property> 117 </Interceptor> 113 118 </Interceptors> 114 119 115 120 </Config> 116 -
codedepot/trunk/projects/LookupManager/config/transfer.xml.cfm
r2089 r2106 1 <?xml version="1.0" encoding="UTF-8"?> 2 <transfer xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="transfer.xsd"> 3 <objectCache> 4 <defaultcache> 5 <!-- put this in, so it's not so greedy memory wise --> 6 <maxminutespersisted value="30"/> 7 </defaultcache> 8 </objectCache> 9 <objectDefinitions> 10 <!--Security Package --> 11 <package name="security"> 1 <?xml version="1.0" encoding="UTF-8"?><transfer xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 2 <objectCache> 3 <defaultcache> 4 <!-- put this in, so it's not so greedy memory wise --> 12 5 13 <object name="Permission" table="permissions" decorator="lookups.model.security.Permission"> 14 <id name="permissionID" column="permission_id" type="UUID" generate="true"/> 15 <property name="permission" type="string" column="permission"/> 16 <property name="description" type="string" column="description"/> 17 </object> 6 <maxminutespersisted value="30"/> 7 </defaultcache> 8 </objectCache> 18 9 19 <object name="Role" table="roles" decorator="lookups.model.security.Role"> 20 <id name="roleID" column="role_id" type="UUID" generate="true"/> 21 <property name="role" type="string" column="role"/> 22 <property name="description" type="string" column="description"/> 23 <manytomany name="Permission" table="roles_permissions" lazy="true"> 24 <link column="FKrole_id" to="security.Role"/> 25 <link column="FKpermission_id" to="security.Permission"/> 26 <collection type="array" /> 27 </manytomany> 28 </object> 29 30 <object name="User" table="users" decorator="lookups.model.security.User"> 31 <id name="userID" column="user_id" type="UUID" generate="true"/> 32 <property name="fname" type="string" column="fname"/> 33 <property name="lname" type="string" column="lname"/> 34 <property name="email" type="string" column="email"/> 35 <property name="username" type="string" column="username"/> 36 <property name="password" type="string" column="password"/> 37 <property name="isActive" type="boolean" column="isActive"/> 38 <property name="createDate" type="date" column="create_date" ignore-update="true" refresh-insert="true"/> 39 <property name="modifyDate" type="date" column="modify_date" refresh-update="true"/> 40 <manytoone name="Role"> 41 <link column="FKrole_id" to="security.Role"/> 42 </manytoone> 43 <manytomany name="Permission" table="user_permissions" lazy="true"> 44 <link column="FKuser_id" to="security.User"/> 45 <link column="FKpermission_id" to="security.Permission"/> 46 <collection type="array" /> 47 </manytomany> 48 </object> 49 50 </package> 51 52 </objectDefinitions> 10 <objectDefinitions> 11 12 </objectDefinitions> 53 13 </transfer> -
codedepot/trunk/projects/LookupManager/handlers/lookups.cfc
r2104 r2106 84 84 </cfscript> 85 85 </cffunction> 86 87 <!--- index ---> 88 <cffunction name="index" access="public" returntype="void" output="false" hint="Index"> 89 <cfargument name="Event" type="any" required="yes"> 90 <cfset display(event)> 91 </cffunction> 86 92 87 93 <!------------------------------------------- PUBLIC EVENTS -------------------------------------------> 88 94 89 95 <!--- addLookup ---> 90 <cffunction name="add " access="public" returntype="void" output="false" hint="">96 <cffunction name="addLookup" access="public" returntype="void" output="false" hint="Show the add lookups screen"> 91 97 <cfargument name="Event" type="any" required="yes"> 92 98 <cfset var rc = event.getCollection()> 93 <!--- Get Tables ---> 94 <cfdbinfo datasource="#instance.dsn#" name="rc.qTables" type="tables" /> 95 96 <cfscript> 97 /* Lookups */ 99 <cfscript> 100 /* Get All DB Tables */ 101 rc.qTables = getLookupService().getDBTables(); 102 /* XEH */ 103 rc.xehAddColumns = "#instance.handlerPackage#lookups/addLookupColumns"; 104 /* Lookup Variables */ 98 105 rc.systemLookups = getSetting("lookups_tables"); 99 106 rc.systemLookupsKeys = getSortedLookupKeys(); … … 103 110 </cffunction> 104 111 112 <!--- addColumns ---> 113 <cffunction name="addLookupColumns" access="public" returntype="void" output="false" hint="Process and show the addition of columns"> 114 <cfargument name="Event" type="any" required="yes"> 115 <cfset var rc = event.getCollection()> 116 <cfscript> 117 /* Selection Validation */ 118 if( listlen(event.getTrimValue("tables","")) eq 0 ){ 119 getPlugin("messagebox").setMessage(type="warning", message="No tables selected, please select one."); 120 setNextRoute("#instance.handlerPackage#lookups/add"); 121 } 122 /* Get DB Config Data */ 123 rc.lookupConfig = getLookupService().getDBTableConfigurations(rc.tables,rc); 124 /* Setup some list types */ 125 rc.propertyTypes = "binary,boolean,date,numeric,UUID,GUID,string"; 126 rc.pktypes = "UUID,GUID,string"; 127 rc.lookupBooleanTypes = "radio,select"; 128 rc.lookupHTMLTypes = "password,richttext,text,textarea"; 129 /* XEH */ 130 rc.xehcreateLookups = "#instance.handlerPackage#lookups/createLookups"; 131 rc.xehAdd = "#instance.handlerPackage#lookups/addLookup"; 132 /* Set View */ 133 event.setView('#instance.viewPackage#lookups/addLookupColumns'); 134 </cfscript> 135 </cffunction> 136 137 <!--- createLookups ---> 138 <cffunction name="createLookups" access="public" returntype="void" output="false" hint="Create the lookups"> 139 <cfargument name="Event" type="any" required="yes"> 140 <cfset var rc = event.getCollection()> 141 <cfscript> 142 /* Setup Config File Locations */ 143 rc.ConfigFileLocation = getSetting('configFileLocation',true); 144 rc.transferConfigPath = locateFilePath(rc.transferConfigPath); 145 rc.modelsPath = getSetting("ModelsPath"); 146 rc.AppMapping = replace(getSetting("AppMapping"),"/",".","all"); 147 148 /* Create Lookups */ 149 getLookupService().createLookups(rc.tables,rc); 150 151 /* Show Results */ 152 getPlugin("messagebox").setMessage(type="info", message="Lookups created successfully"); 153 setNextRoute(route="#instance.viewPackage#lookups/createConfirmation"); 154 </cfscript> 155 </cffunction> 156 157 <!--- createLookupsConfirmation ---> 158 <cffunction name="createConfirmation" access="public" returntype="void" output="false" hint="Confirmation"> 159 <cfargument name="Event" type="any" required="yes"> 160 <cfset var rc = event.getCollection()> 161 <cfscript> 162 /* Set Restart Bit */ 163 getController().setColdboxInitiated(false); 164 event.setView("#instance.viewPackage#lookups/createConfirmation"); 165 </cfscript> 166 </cffunction> 167 168 <!--- Display ---> 105 169 <cffunction name="display" output="false" access="public" returntype="void" hint="Display System Lookups"> 106 170 <cfargument name="Event" type="any"> … … 115 179 rc.xehLookupEdit = "#instance.handlerPackage#lookups/dspEdit"; 116 180 rc.xehLookupClean = "#instance.handlerPackage#lookups/cleanDictionary"; 117 181 rc.xehLookupsAdd = "#instance.handlerPackage#lookups/addLookup"; 118 182 //Get System Lookups 119 183 rc.systemLookups = getSetting("lookups_tables"); 120 184 rc.systemLookupsKeys = getSortedLookupKeys(); 121 122 //Param Choosen Lookup 123 event.paramValue("lookupClass", rc.systemLookups[ rc.systemLookupsKeys[1] ]); 124 125 //Prepare Lookup's Meta Data Dictionary 126 rc.mdDictionary = getLookupService().prepareDictionary(rc.lookupClass); 127 128 //Get Lookup Listing 129 rc.qListing = getLookupService().getListing(rc.lookupClass); 130 185 186 /* Validate we have lookups */ 187 if( ArrayLen(rc.systemLookupsKeys) ){ 188 //Param Choosen Lookup 189 event.paramValue("lookupClass", rc.systemLookups[ rc.systemLookupsKeys[1] ]); 190 //Prepare Lookup's Meta Data Dictionary 191 rc.mdDictionary = getLookupService().prepareDictionary(rc.lookupClass); 192 //Get Lookup Listing 193 rc.qListing = getLookupService().getListing(rc.lookupClass); 194 } 195 else{ 196 event.paramValue("lookupClass",""); 197 rc.qListing = Querynew(""); 198 getPlugin("messagebox").setMessage(type="warning", message="No lookups declared, please declare some first."); 199 } 131 200 //Set view to render 132 201 event.setView("#instance.viewPackage#lookups/Listing"); … … 436 505 <cfscript> 437 506 var systemLookups = getSetting("lookups_tables"); 438 systemLookupsKeys = structKeyArray(systemLookups); 439 ArraySort(systemLookupsKeys,"text"); 507 var systemLookupsKeys = ArrayNew(1); 508 509 if( not isSimpleValue(systemLookups) ){ 510 systemLookupsKeys = structKeyArray(systemLookups); 511 ArraySort(systemLookupsKeys,"text"); 512 } 513 440 514 return systemLookupsKeys; 441 515 </cfscript> -
codedepot/trunk/projects/LookupManager/includes/lookups/styles/lookups.css
r2090 r2106 77 77 font-weight: normal; 78 78 } 79 /* I Nputs */79 /* Inputs */ 80 80 input { 81 81 padding: 2px; … … 106 106 color: #999; 107 107 } 108 input[disabled]:hover{109 background: #f6f6f6;110 color: #999;111 }112 108 fieldset{ 113 109 background-color: #f5f5f5; … … 127 123 } 128 124 input[type=text], input[type=password], input[type=checkbox], select { 129 font : normal12px;125 font-size: 12px; 130 126 color:#333; 131 127 border: 1px solid #d7d7d7; … … 133 129 background: #FFFFFF url(../images/topfade.gif) repeat-x scroll center top; 134 130 } 135 input[type=text], input[type=password], input[type=checkbox], select { padding: .4em }131 input[type=text],input[type=password], input[type=checkbox], select { padding: .4em } 136 132 input[type=text]:focus, input[type=password]:focus, textarea:focus, input[type=checkbox]:focus, select:focus { 137 133 border: 1px solid #886; … … 144 140 border: 1px dotted #F00000; 145 141 background:#FFECE6 url(../images/topfade.gif) repeat-x scroll center top; 142 } 143 input[disabled], select[disabled]{ 144 background: #f6f6f6; 145 color: #999; 146 } 147 input[disabled]:hover{ 148 background: #f6f6f6; 149 color: #999; 146 150 } 147 151 /* button stuff */ -
codedepot/trunk/projects/LookupManager/model/lookups/LookupService.cfc
r2089 r2106 10 10 The lookups service layer 11 11 -----------------------------------------------------------------------> 12 <cfcomponent hint="This is the lookup manager using Transfer" output="false">12 <cfcomponent name="LookupService" hint="This is the lookup service." output="false"> 13 13 14 14 <!----------------------------------- CONSTRUCTOR ------------------------------> … … 18 18 <cfargument name="transfer" type="any" _wireme="ocm:Transfer"> 19 19 <cfargument name="transaction" type="any" _wireme="ocm:TransferTransaction"> 20 <!--- ************************************************************* ---> 21 <cfscript> 22 instance = StructNew(); 23 24 setTransfer(arguments.transfer); 25 20 <cfargument name="lookupsDSN" type="any" _wireme="coldbox:setting:lookups_dsn"> 21 <cfargument name="json" type="any" _wireme="coldbox:plugin:json"> 22 <!--- ************************************************************* ---> 23 <cfscript> 24 variables.instance = StructNew(); 25 26 /* Setup Transactions */ 26 27 arguments.transaction.advise(this, "^save"); 27 28 arguments.transaction.advise(this, "^delete"); 28 29 29 /* Metadata Cache */ 30 setMDDictionary( structnew() ); 31 30 /* Properties */ 31 instance.mdDictionary = structnew(); 32 instance.transfer = arguments.transfer; 33 instance.lookupsDSN = arguments.lookupsDSN; 34 instance.JSON = arguments.json; 35 32 36 return this; 33 37 </cfscript> … … 43 47 <cfscript> 44 48 //get lookup listing 45 return getTransfer().list(arguments.lookupClass, getDictionary(arguments.lookupClass).sortBy);49 return instance.transfer.list(arguments.lookupClass, getDictionary(arguments.lookupClass).sortBy); 46 50 </cfscript> 47 51 </cffunction> … … 54 58 <cfscript> 55 59 //get lookup listing 56 return getTransfer().getTransferMetaData(arguments.lookupClass);60 return instance.transfer.getTransferMetaData(arguments.lookupClass); 57 61 </cfscript> 58 62 </cffunction> … … 69 73 //Get by ID or new 70 74 if ( len(trim(arguments.lookupID)) eq 0){ 71 oLookup = getTransfer().new(arguments.lookupClass);75 oLookup = instance.transfer.new(arguments.lookupClass); 72 76 } 73 77 else{ 74 oLookup = getTransfer().get(arguments.lookupClass, arguments.lookupID);78 oLookup = instance.transfer.get(arguments.lookupClass, arguments.lookupID); 75 79 } 76 80 /* return lookup object */ … … 89 93 90 94 //Get by Property Struct 91 oLookup = getTransfer().readByPropertyMap(arguments.lookupClass, arguments.propertyStruct);95 oLookup = instance.transfer.readByPropertyMap(arguments.lookupClass, arguments.propertyStruct); 92 96 93 97 return oLookup; … … 110 114 } 111 115 else{ 112 oLookup = getTransfer().get(arguments.lookupClass,arguments.id);116 oLookup = instance.transfer.get(arguments.lookupClass,arguments.id); 113 117 } 114 118 //Remove Entry 115 getTransfer().delete(oLookup);119 instance.transfer.delete(oLookup); 116 120 </cfscript> 117 121 </cffunction> … … 123 127 <!--- ************************************************************* ---> 124 128 <cfscript> 125 getTransfer().save(arguments.LookupObject);129 instance.transfer.save(arguments.LookupObject); 126 130 </cfscript> 127 131 </cffunction> … … 135 139 var lookupDictionary = structnew(); 136 140 137 if ( not structKeyExists( getmdDictionary(), arguments.lookupClass) ){141 if ( not structKeyExists( instance.mdDictionary , arguments.lookupClass) ){ 138 142 //dictionary not found, prepare it 139 143 lookupDictionary = prepareDictionary(arguments.lookupClass); 140 144 } 141 145 else 142 lookupDictionary = structFind( getmdDictionary(), arguments.lookupClass );146 lookupDictionary = structFind(instance.mdDictionary, arguments.lookupClass ); 143 147 144 148 return lookupDictionary; … … 319 323 else{ 320 324 /* Else just get the dictionary locally. */ 321 mdStruct = structFind( getmdDictionary(), arguments.lookupClass );325 mdStruct = structFind(instance.mdDictionary, arguments.lookupClass ); 322 326 } 323 327 return mdStruct; … … 327 331 <!--- Clean Dictionary ---> 328 332 <cffunction name="cleanDictionary" access="public" returntype="void" output="false" hint="Clean the Metadata Dictionary"> 329 <cfset setmdDictionary(structnew())> 330 </cffunction> 331 333 <cfset instance.mdDictionary = structnew()> 334 </cffunction> 335 336 <!--- getDBTables ---> 337 <cffunction name="getDBTables" output="false" access="public" returntype="any" hint="Get a datasources DB tables"> 338 <cfset var qTables = 0> 339 340 <cfdbinfo datasource="#instance.lookupsDSN#" name="qTables" type="tables" /> 341 342 <cfreturn qTables> 343 </cffunction> 344 345 <!--- getDBTableConfigurations ---> 346 <cffunction name="getDBTableConfigurations" output="false" access="public" returntype="any" hint="Returns a struct of table configurations according to passed in tables and collected data from the lookup views"> 347 <!--- ************************************************************* ---> 348 <cfargument name="tables" type="string" required="true" hint="A comma delimmited list of tables to create configurations for"/> 349 <cfargument name="collection" type="struct" required="true" hint="A collection of data to process"/> 350 <!--- ************************************************************* ---> 351 <cfset var lookupConfig = structnew()> 352 <cfset var table = 0> 353 <cfset var tableConfig = 0> 354 355 <cfloop list="#arguments.tables#" index="table"> 356 <!--- Prepare table config ---> 357 <cfset tableConfig = structnew()> 358 <cfset tableConfig.alias = arguments.collection["#table#_alias"]> 359 <cfset tableConfig.class = arguments.collection["#table#_class"]> 360 <cfset tableConfig.decorator = arguments.collection["#table#_decorator"]> 361 362 <!--- Get Column Info ---> 363 <cfdbinfo datasource="#instance.lookupsDSN#" name="tableConfig.columns" table="#table#" type="columns" /> 364 365 <!--- Save it in return configuration ---> 366 <cfset lookupConfig[table] = tableConfig> 367 </cfloop> 368 369 <cfreturn lookupConfig> 370 </cffunction> 371 372 <!--- createLookups ---> 373 <cffunction name="createLookups" output="false" access="public" returntype="any" hint="Create Lookups"> 374 <!--- ************************************************************* ---> 375 <cfargument name="tables" type="string" required="true" hint="The tables to create lookup config for"/> 376 <cfargument name="collection" type="struct" required="true" default="" hint="The data collection to use to build the lookups"/> 377 <!--- ************************************************************* ---> 378 <cfscript> 379 var x = 0; 380 var y = 0; 381 var rc = arguments.collection; 382 var lookupsPath = getDirectoryFromPath(getMetadata(this).path); 383 /* Read IN ColdBox File */ 384 var coldboxXMLDoc = xmlParse(rc.ConfigFileLocation); 385 var lookupsSetting = xmlSearch(coldboxXMLDoc,"//YourSettings/Setting[@name='lookups_tables']"); 386 /* Transfer XML */ 387 var transferXMLDoc = xmlParse(rc.transferConfigPath); 388 var definitionsArray = xmlSearch(transferXMLDoc,"//objectDefinitions"); 389 var objDefinitions = definitionsArray[1].xmlChildren; 390 var defIndex = 0; 391 /* Common Vars */ 392 var thisTable = ""; 393 var thisColumns = ""; 394 var thisCol = ""; 395 var thisColAlias = ""; 396 var objIndex = 1; 397 var thisM2One = ""; 398 var thisRel = ""; 399 var thisRelAlias = ""; 400 var lookupsTables = {}; 401 var thisbuffer = 0; 402 var tabAlign = "#chr(9)##chr(9)##chr(9)#"; 403 var cr = chr(13); 404 var sortBy = ""; 405 var decoratorTemplate = ""; 406 407 /* Create Table JSON */ 408 for(x=1;x lte listLen(arguments.tables); x++){ 409 lookupsTables[rc["#listGetAt(arguments.tables,x)#_alias"]] = rc["#listGetAt(arguments.tables,x)#_class"]; 410 } 411 lookupsTables = replace(instance.json.encode(lookupsTables),'"',"'","all"); 412 /* Set it back in the lookupXML */ 413 lookupsSetting[1].xmlAttributes.value = lookupsTables; 414 /* Write it out */ 415 FileWrite(rc.ConfigFileLocation,toString(coldboxXMLDoc)); 416 417 418 /* Cleanup of transfer.xml */ 419 defIndex = arrayLen(objDefinitions); 420 for(x=1;x lte defIndex; x++){ 421 if( listFindNoCase(arguments.tables,objDefinitions[x].XMLAttributes.table) ){ 422 /* Remove it */ 423 ArrayDeleteAt(objDefinitions,x); 424 } 425 } 426 /* Set new Index */ 427 defIndex = ArrayLen(objDefinitions) + 1; 428 429 /* Loop over tables To add Transfer Stuff*/ 430 for(x=1;x lte listLen(arguments.tables); x++){ 431 /* Setup Loopers & Vars */ 432 objIndex = 1; 433 thisTable = listGetAt(arguments.tables,x); 434 thisColumns = rc["#thisTable#_cols"]; 435 thisM2One = ""; 436 /* Init M2One List */ 437 if( structKeyExists(rc,"#thisTable#_m2o") ){ 438 thisM2One = rc["#thisTable#_m2o"]; 439 } 440 thisBuffer = createObject("java","java.lang.StringBuffer").init(''); 441 sortBy = rc["#thisTable#_sortby"]; 442 443 /* Create new Object */ 444 objDefinitions[defIndex] = xmlElemNew(transferXMLDoc,"object"); 445 /* Add attributes to new Object Definition */ 446 objDefinitions[defIndex].xmlAttributes["name"] = rc["#thisTable#_class"]; 447 objDefinitions[defIndex].xmlAttributes["table"] = thisTable; 448 objDefinitions[defIndex].xmlAttributes["decorator"] = rc.AppMapping & ".model." & rc["#thisTable#_decorator"]; 449 /* Create Decorator Sort By */ 450 thisBuffer.append('tc.SortBy = "'&rc["#thisTable#_col_#sortBy#_alias"]&'";#cr#'); 451 452 /* Create PK Entry */ 453 objDefinitions[defIndex].xmlChildren[objIndex] = xmlElemNew(transferXMLDoc,"id"); 454 objDefinitions[defIndex].xmlChildren[objIndex].XMLAttributes["name"] = rc["#thisTable#_pkalias"]; 455 objDefinitions[defIndex].xmlChildren[objIndex].XMLAttributes["column"] = rc["#thisTable#_pkcolumn"]; 456 objDefinitions[defIndex].xmlChildren[objIndex].XMLAttributes["type"] = rc["#thisTable#_pktype"]; 457 objDefinitions[defIndex].xmlChildren[objIndex].XMLAttributes["generate"] = rc["#thisTable#_pkgenerate"]; 458 459 /* Create Columns */ 460 for(y=1; y lte listLen(thisColumns); y++){ 461 /* Setup Column and Looper */ 462 thisCol = listGetAt(thisColumns,y); 463 if( thisCol neq rc["#thisTable#_pkcolumn"] and listFindNoCase(thisM2One,thisCol) eq 0 ){ 464 objIndex++; 465 thisColAlias = rc["#thisTable#_col_#thisCol#_alias"]; 466 /* Create Column Definition */ 467 objDefinitions[defIndex].xmlChildren[objIndex] = xmlElemNew(transferXMLDoc,"property"); 468 objDefinitions[defIndex].xmlChildren[objIndex].XMLAttributes["name"] = rc["#thisTable#_col_#thisCol#_alias"]; 469 objDefinitions[defIndex].xmlChildren[objIndex].XMLAttributes["column"] = thisCol; 470 objDefinitions[defIndex].xmlChildren[objIndex].XMLAttributes["type"] = rc["#thisTable#_col_#thisCol#_type"]; 471 /* Null Check */ 472 if( structKeyExists(rc,"#thisTable#_col_#thisCol#_nullable") ){ 473 objDefinitions[defIndex].xmlChildren[objIndex].XMLAttributes["nullable"] = "true"; 474 } 475 /* ignores */ 476 if( structKeyExists(rc,"#thisTable#_col_#thisCol#_ignoreinsert") ){ 477 objDefinitions[defIndex].xmlChildren[objIndex].XMLAttributes["ignore-insert"] = "true"; 478 } 479 if( structKeyExists(rc,"#thisTable#_col_#thisCol#_ignoreupdate") ){ 480 objDefinitions[defIndex].xmlChildren[objIndex].XMLAttributes["ignore-update"] = "true"; 481 } 482 /* refreshes */ 483 if( structKeyExists(rc,"#thisTable#_col_#thisCol#_refreshinsert") ){ 484 objDefinitions[defIndex].xmlChildren[objIndex].XMLAttributes["refresh-insert"] = "true"; 485 } 486 if( structKeyExists(rc,"#thisTable#_col_#thisCol#_refreshupdate") ){ 487 objDefinitions[defIndex].xmlChildren[objIndex].XMLAttributes["refresh-update"] = "true"; 488 } 489 /* Decorator Writes */ 490 thisBuffer.append('#tabAlign#tc.#thisColAlias#.helptext = "' & rc["#thisTable#_col_#thisCol#_helptext"] & '";#cr#'); 491 if( structKeyExists(rc,"#thisTable#_col_#thisColAlias#_maxlen") and rc["#thisTable#_col_#thisCol#_maxlen"] neq 0 ){ 492 thisBuffer.append('#tabAlign#tc.#thisColAlias#.maxlength = "' & rc["#thisTable#_col_#thisCol#_maxlen"] & '";#cr#'); 493 } 494 if( not structKeyExists(rc,"#thisTable#_col_#thisCol#_display") ){ 495 thisBuffer.append('#tabAlign#tc.#thisColAlias#.display = false;#cr#'); 496 } 497 if( structKeyExists(rc,"#thisTable#_col_#thisCol#_html") ){ 498 thisBuffer.append('#tabAlign#tc.#thisColAlias#.html = "' & rc["#thisTable#_col_#thisCol#_html"] & '";#cr#'); 499 } 500 }//if not pK column 501 } 502 /* Create Many To One Relationships */ 503 for(y=1; y lte listLen(thisM2One); y++){ 504 thisRel = listGetAt(thisM2One,y); 505 objIndex++; 506 /* Create ManyToOne Definition */ 507 objDefinitions[defIndex].xmlChildren[objIndex] = xmlElemNew(transferXMLDoc,"manytoone"); 508 objDefinitions[defIndex].xmlChildren[objIndex].XMLAttributes["name"] = rc["#thisTable#_m2o_#thisRel#_linkName"]; 509 /* Create Lazy */ 510 if( structKeyExists(rc,"#thisTable#_m2o_#thisRel#_lazy") ){ 511 objDefinitions[defIndex].xmlChildren[objIndex].XMLAttributes["lazy"] = "true"; 512 } 513 /* Create Proxied */ 514 if( structKeyExists(rc,"#thisTable#_m2o_#thisRel#_proxied") ){ 515 objDefinitions[defIndex].xmlChildren[objIndex].XMLAttributes["proxied"] = "true"; 516 } 517 /* Create Link Object */ 518 objDefinitions[defIndex].xmlChildren[objIndex].XMLChildren[1] = xmlElemNew(transferXMLDoc,"link"); 519 objDefinitions[defIndex].xmlChildren[objIndex].XMLChildren[1].XMLAttributes["column"] = rc["#thisTable#_m2o_#thisRel#_linkToColumn"]; 520 objDefinitions[defIndex].xmlChildren[objIndex].XMLChildren[1].XMLAttributes["to"] = rc["#thisTable#_m2o_#thisRel#_linkToClass"]; 521 /* Create Decorator Writes */ 522 thisRelAlias = rc["#thisTable#_m2o_#thisRel#_linkName"]; 523 thisBuffer.append('#tabAlign#tc.#thisRelAlias#.displayColumn = "' & rc["#thisTable#_m2o_#thisRel#_displayColumn"] & '";#cr#'); 524 } 525 526 /* Create Decorator */ 527 decoratorTemplate = FileRead(lookupsPath & "DecoratorTemplate.cfm"); 528 /* Replace TC Setup */ 529 decoratorTemplate = replacenocase(decoratorTemplate,"@tcreplace@",thisBuffer.toString()); 530 FileWrite(rc.modelsPath & "/" & replace(rc["#thisTable#_decorator"],".","/","all") & ".cfc", decoratorTemplate); 531 /* Continue to new definition */ 532 defIndex++; 533 }//end looping of table definitions 534 /* Write the transfer.xml out */ 535 FileWrite(rc.transferConfigPath,xmlTransform(toString(transferXMLDoc),FileRead(lookupsPath & "xmlFormatter.xsl"))); 536 </cfscript> 537 </cffunction> 332 538 333 539 <!----------------------------------- PRIVATE ------------------------------> 334 335 <!--- getter and setter for mdDictionary --->336 <cffunction name="getmdDictionary" access="private" returntype="struct" output="false">337 <cfreturn instance.mdDictionary>338 </cffunction>339 <cffunction name="setmdDictionary" access="private" returntype="void" output="false">340 <cfargument name="mdDictionary" type="struct" required="true">341 <cfset instance.mdDictionary = arguments.mdDictionary>342 </cffunction>343 344 <!--- Get Set Transfer --->345 <cffunction name="getTransfer" access="private" returntype="any" output="false">346 <cfreturn instance.transfer />347 </cffunction>348 <cffunction name="setTransfer" access="private" returntype="void" output="false">349 <cfargument name="transfer" type="any" required="true">350 <cfset instance.transfer = arguments.transfer />351 </cffunction>352 540 353 541 <!--- Throw Facade ---> -
codedepot/trunk/projects/LookupManager/views/lookups/Add.cfm
r2104 r2106 34 34 35 35 <!--- Title ---> 36 <h2><img src="#rc.imgPath#/cog.png" align="absmiddle"> Lookup Manager > Add Record</h2>36 <h2><img src="#rc.imgPath#/cog.png" align="absmiddle"> ColdBox Lookup Manager > Add Record</h2> 37 37 <!--- BACK ---> 38 38 <div class="backbutton"> -
codedepot/trunk/projects/LookupManager/views/lookups/Edit.cfm
r2104 r2106 44 44 45 45 <!--- Title ---> 46 <h2><img src="#rc.imgPath#/cog.png" align="absmiddle"> Lookup Manager > Edit Record</h2>46 <h2><img src="#rc.imgPath#/cog.png" align="absmiddle"> ColdBox Lookup Manager > Edit Record</h2> 47 47 <!--- BACK ---> 48 48 <div class="backbutton"> -
codedepot/trunk/projects/LookupManager/views/lookups/Listing.cfm
r2104 r2106 40 40 <div id="content"> 41 41 <!--- Title ---> 42 <h2><img src="#rc.imgPath#/cog.png" align="absmiddle"> Lookup Manager</h2>42 <h2><img src="#rc.imgPath#/cog.png" align="absmiddle"> ColdBox Lookup Manager</h2> 43 43 <p>From here you can manage all the lookup tables in the system as defined in your coldbox.xml (lookups_tables)</p> 44 44 … … 78 78 <img src="#rc.imgPath#/book_open.png" border="0" align="absmiddle" alt="Reload" /> 79 79 Reload Dictionary 80 </span> 81 </a> 82 83 <a href="#event.buildLink(rc.xehLookupsAdd)#" class="buttonLinks"> 84 <span> 85 <img src="#rc.imgPath#/add.png" border="0" align="absmiddle" alt="Add" /> 86 Declare Lookups 80 87 </span> 81 88 </a> -
codedepot/trunk/projects/LookupManager/views/lookups/addLookup.cfm
r2104 r2106 5 5 <script type="text/javascript"> 6 6 $(document).ready(function() { 7 /* Form Validation */ 8 $('##manageForm').formValidation({ 9 err_class : "invalidLookupInput", 10 err_list : true, 11 callback : 'prepareSubmit' 12 }); 7 13 }); 14 function submitForm(){ 15 $('##manageForm').submit(); 16 } 17 function prepareSubmit(){ 18 $('##_buttonbar').slideUp("fast"); 19 $('##_loader').fadeIn("slow"); 20 return true; 21 } 8 22 </script> 9 23 </cfoutput> … … 18 32 #getPlugin("messagebox").renderit()# 19 33 34 <!--- Configured Lookups ---> 20 35 <form> 21 36 <fieldset> 22 37 <legend>Configured Lookups:</legend> 38 <div>Connected to the <strong>#getSetting('lookups_dsn')#</strong> datasource</div> 23 39 <table class="tablesorter" width="100%" id="setlookupsTable" cellspacing="1" cellpadding="0" border="0"> 24 40 <thead> 25 41 <tr> 26 <th> Alias</th>27 <th> Class</th>42 <th>Lookup Alias</th> 43 <th>Transfer Class</th> 28 44 </tr> 29 45 </thead> … … 40 56 </form> 41 57 42 <form> 58 <!--- New Lokups To Configure ---> 59 <form name="manageForm" id="manageForm" action="#event.buildLink(rc.xehAddColumns)#" method="post"> 43 60 <fieldset> 44 <legend>Choose Tables To Manage</legend> 45 <p>Please select only the tables you wish to manage that are <strong>NOT</strong> already configured</p> 61 <legend>Choose Tables To Manage:</legend> 62 <p>Please select only the tables you wish to manage that are <strong>NOT</strong> already configured as seen above. 63 Please also enter the extra metadata necessary to create the lookup associations. All decorators created will be 64 placed in this applications model folder. 65 </p> 46 66 67 <p> 68 <label for="transferConfigPath">Transfer Config Path:</label> 69 This will be the relative location of the transfer config file to modify with new looup information.<br /> 70 <strong>#getSetting("AppMapping")#/</strong><input type="text" size="80" value="config/transfer.xml.cfm" name="transferConfigPath" id="transferConfigPath"> 71 </p> 72 73 <table class="tablesorter" width="100%" id="setlookupsTable" cellspacing="1" cellpadding="0" border="0"> 74 <thead> 75 <tr> 76 <th>Table</th> 77 <th title="The alias used by the lookups manager">Lookup Alias</th> 78 <th title="The transfer package-object name">Transfer Class</th> 79 <th title="The decorator dot path">Decorator Path</th> 80 </tr> 81 </thead> 82 <tbody> 83 <cfloop query="rc.qTables"> 84 <tr> 85 <td><label><input type="checkbox" name="tables" id="tables" value="#table_name#"> #table_name#</label></td> 86 <td><input required="true" type="text" size="25" name="#table_name#_alias" id="#table_name#_alias" value="#capCase(table_name)#"></td> 87 <td><input required="true" type="text" size="25" name="#table_name#_class" id="#table_name#_class" value="#Singularize(capCase(table_name))#"></td> 88 <td><strong>model.</strong><input required="true" type="text" size="35" name="#table_name#_decorator" id="#table_name#_decorator" value="#Singularize(capCase(table_name))#"></td> 89 </tr> 90 </cfloop> 91 </tbody> 92 </table> 93 94 <!--- Hidden Loader ---> 95 <div id="_loader" class="formloader"> 96 <p> 97 Submitting...<br /> 98 <img src="#rc.imgPath#/ajax-loader-horizontal.gif" align="absmiddle"> 99 <img src="#rc.imgPath#/ajax-loader-horizontal.gif" align="absmiddle"> 100 </p> 101 </div> 102 103 <!--- Create / Cancel ---> 104 <div id="_buttonbar"> 105 <a href="#event.buildLink(rc.xehLookupList,0)#" class="buttonLinks"> 106 <span> 107 <img src="#rc.imgPath#/cancel.png" border="0" align="absmiddle" alt="Cancel" /> 108 Cancel 109 </span> 110 </a> 111 112 <a href="javascript:submitForm()" class="buttonLinks"> 113 <span> 114 <img src="#rc.imgPath#/add.png" border="0" align="absmiddle" alt="Add" /> 115 Next Step 116 </span> 117 </a> 118 </div> 47 119 </fieldset> 48 120 </form>
