Changeset 2820


Ignore:
Timestamp:
09/09/10 20:44:10 (17 months ago)
Author:
mattlevine
Message:
  1. Adding syncDefinitions() to sync extensions from one site to another.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/5.2.1/www/requirements/mura/extend/extendManager.cfc

    r2717 r2820  
    10731073</cffunction> 
    10741074 
     1075<cffunction name="syncDefinitions" output="false"> 
     1076<cfargument name="fromSiteID" default=""> 
     1077<cfargument name="toSiteID" default=""> 
     1078<cfargument name="type" default=""> 
     1079<cfargument name="subType" default="">   
     1080 
     1081<cfset var rsSubTypes=getSubTypes(arguments.fromSiteID)> 
     1082<cfset var extendSets=""> 
     1083<cfset var sttributes=""> 
     1084<cfset var sourceSubType=""> 
     1085<cfset var destSubType=""> 
     1086<cfset var sourceExtendSet=""> 
     1087<cfset var destExtendSet=""> 
     1088<cfset var sourceAttribute=""> 
     1089<cfset var destAttribute=""> 
     1090<cfset var s=""> 
     1091<cfset var a=""> 
     1092 
     1093<cfif len(arguments.type)> 
     1094        <cfquery name="rsSubTypes" dbtype="query">       
     1095                select * from where type=<cfqueryparam cfsqltype="cf_sql_varchar" value="#arguments.type#"> 
     1096                <cfif len(argument.subType)> 
     1097                and subtype=<cfqueryparam cfsqltype="cf_sql_varchar" value="#arguments.subtype#"> 
     1098                </cfif>  
     1099        </cfquery> 
     1100</cfif> 
     1101 
     1102<cfloop query="rsSubTypes"> 
     1103        <cfset sourceSubType=getSubTypeByID(rsSubTypes.subTypeID)> 
     1104        <cfset destSubType=getSubTypeByName(rsSubTypes.type,rsSubTypes.subType,arguments.toSiteID)> 
     1105         
     1106        <cfset destSubType.setDataTable(sourceSubType.getDataTable())> 
     1107        <cfset destSubType.setBaseTable(sourceSubType.getBaseTable())> 
     1108        <cfset destSubType.setBaseKeyField(sourceSubType.getBaseKeyField())> 
     1109        <cfset destSubType.setIsActive(sourceSubType.getIsActive())> 
     1110         
     1111        <cfset destSubType.save()> 
     1112         
     1113        <cfset extendSets=sourceSubType.getExtendSets()> 
     1114         
     1115        <cfif arrayLen(extendSets)> 
     1116                <cfloop from="1" to="#arrayLen(extendSets)#" index="s"> 
     1117                        <cfset sourceExtendSet=extendSets[s]> 
     1118                        <cfset destExtendSet=destSubType.getExtendSetByName(sourceExtendSet.getName())> 
     1119                        <cfset destExtendSet.setContainer(sourceExtendSet.getContainer())> 
     1120                        <cfset destExtendSet.setIsActive(sourceExtendSet.getIsActive())> 
     1121                        <cfset destExtendSet.setOrderNo(sourceExtendSet.getOrderNo())> 
     1122                        <cfset destExtendSet.save()> 
     1123                         
     1124                        <cfset attributes=sourceExtendSet.getAttributes()> 
     1125                         
     1126                        <cfif arrayLen(attributes)> 
     1127                                <cfloop from="1" to="#arrayLen(attributes)#" index="a"> 
     1128                                        <cfset sourceAttribute=attributes[a]> 
     1129                                        <cfset destAttribute=destExtendSet.getAttributeByName(sourceAttribute.getName())> 
     1130                                         
     1131                                        <cfset destAttribute.setName(sourceAttribute.getName())> 
     1132                                        <cfset destAttribute.setHint(sourceAttribute.getHint())> 
     1133                                        <cfset destAttribute.setType(sourceAttribute.getType())> 
     1134                                        <cfset destAttribute.setOrderNo(sourceAttribute.getOrderNo())> 
     1135                                        <cfset destAttribute.setIsActive(sourceAttribute.getIsActive())> 
     1136                                        <cfset destAttribute.setRequired(sourceAttribute.getRequired())> 
     1137                                        <cfset destAttribute.setValidation(sourceAttribute.getValidation())> 
     1138                                        <cfset destAttribute.setRegex(sourceAttribute.getRegex())> 
     1139                                        <cfset destAttribute.setMessage(sourceAttribute.getMessage())> 
     1140                                        <cfset destAttribute.setLabel(sourceAttribute.getLabel())> 
     1141                                        <cfset destAttribute.setDefaultValue(sourceAttribute.getDefaultValue())> 
     1142                                        <cfset destAttribute.setOptionList(sourceAttribute.getOptionList())> 
     1143                                        <cfset destAttribute.setOptionLabelList(sourceAttribute.getOptionLabelList())> 
     1144                                        <cfset destAttribute.save()> 
     1145                                </cfloop> 
     1146                        </cfif> 
     1147                         
     1148                </cfloop> 
     1149        </cfif> 
     1150</cfloop> 
     1151</cffunction> 
     1152 
    10751153</cfcomponent> 
Note: See TracChangeset for help on using the changeset viewer.