And the manual one....

<cfsetting enablecfoutputonly="Yes">
<!---
Copyright 2001 Freeserve.com , PLC

Purpose :To fix bug in Spectra where new properties are synced accross
Created On      : 02/04/2001
Original Developer      :  Russell Brown

--->

<cfa_userGet
        userDirectory = "userDirectory"
        userName = "#request.cfa.activeuser#"
        r_stUser = "stUser"
        r_stGroups = "stGroups">

<cfset lGroups = StructKeyList(stGroups)>
<cfif ListContainsNoCase(lGroups, "administrator")>
        <cfset bIsAdmin = TRUE>
<cfelse>
        <cfset bIsAdmin = FALSE>
</cfif>

<CFIF request.cfa.freeserve.mode NEQ "design" OR NOT variables.bIsAdmin>
        <cflocation url="/" addtoken="No">
<cfelse>

<cfif IsDefined("form.typeid")>

<cfset versionerror = "Success Type #form.typeid#  Updated in version DB">

<!--- Get all the properties in the object store for type --->
<cftry>
<cfa_objectTypeGetPropertyDefinitions
    dataSource="#request.cfa.objectstore.dsn#"
    typeID="#form.typeid#"
    r_stTypePropertyDefinitions="stType">
        <cfcatch type="Any">
                <cfset versionError = "Failed
:<br>#cfcatch.message#<p>#cfcatch.detail#</p>">
                <cfexit>
        </cfcatch>
</cftry>

<!--- Get All the Properties for the type in version Datastore --->
<cftry>
<cfa_objectTypeGetPropertyDefinitions
    dataSource="#request.cfa.freeserve.versiondatasource#"
    typeID="#form.typeid#"
    r_stTypePropertyDefinitions="stVType">
        <cfcatch type="Any">
                <cfset versionError = "Failed 
:#cfcatch.message#<p>#cfcatch.detail#</p>">
                <cfexit>
        </cfcatch>
</cftry>
<!--- Compare the structures , add the missing ones form current datasource
to history db
                And delete ones missing form current from History DB
 ---->
<!--- ADD --->
<cfloop collection="#stType#" item="i">
        <cfif NOT StructKeyExists(stVType, i)>

        <cftry>
                <cfa_objectTypeProperty
        action="UPDATE"
                dataSource="#request.cfa.freeserve.versiondatasource#"
        typeID="#form.typeid#"
        propertyName="#i#"
        alias = "#stType[i].Alias#"
                propertyDefinitionID = "#stType[i].propertyDefinitionID#"
        defaultValue="#stType[i].defaultValue#"
        bSearchable="#stType[i].bSearchable#"
                bRequired="#stType[i].bRequired#"
                bIndexed="#stType[i].bIndexed#"
        bArray="#stType[i].bArray#"
        bSystemEnabled="FALSE">
                <cfcatch type="Any">
                        <cfset versionError = "Failed 
:#cfcatch.message#<p>#cfcatch.detail#</p>">
        </cfcatch>
        </cftry>
        </cfif>
</cfloop>
<!--- REMOVE --->
<cfloop collection="#stVType#" item="i">
        <cfif NOT StructKeyExists(stType, i)>
        <cftry>
                <cfa_objectTypeProperty
        action="DELETE"
                dataSource="#request.cfa.freeserve.versiondatasource#"
        typeID="#form.typeid#"
        propertyName="#i#"
                propertyDefinitionID = "#stType[i].propertyDefinitionID#">
                <cfcatch type="Any">
                        <cfset versionError = "Failed 
:#cfcatch.message#<p>#cfcatch.detail#</p>">
        </cfcatch>
        </cftry>
        </cfif>
</cfloop>
<cfoutput>
#Versionerror#<br>
</cfoutput>
</cfif>
<cfoutput>
<h1>Acme Version Synchroniser</h1></cfoutput>
<cfa_objecttypegetmultiple dataSource="#request.cfa.objectstore.dsn#"
r_stTypes="stTypes">
<cfoutput><form action="#cgi.script_name#?#cgi.query_string#"
method="post"></cfoutput>
        <cfloop collection=#sttypes# item="ID">
                <cfset label = stTypes[ID].label>
                <cfset handlerroot = stTypes[ID].handlerroot>
                <cfset typeid = stTypes[ID].typeid>
                <cfif stTypes[ID].NSYSATTRIBUTES IS 0 AND
NOT(ListContainsNoCase(stTypes[ID].METADATA,"hidden"))>
                        <cfoutput><input type="Radio" name="typeid" value="#Typeid#">
#Label#:#handlerroot#:#Typeid#<br></cfoutput>
                </cfif>
        </cfloop>
        <cfoutput><input type="submit" Value="Synch Types!">
        </form></cfoutput>
</cfif>
<cfsetting enablecfoutputonly="No">

-----Original Message-----
From: Steven Harper [mailto:[EMAIL PROTECTED]]
Sent: 12 September 2001 13:47
To: Spectra-Talk
Subject: RE: updating versions


Here you go...

Credit goes to Russell Brown, the owner of this nice chunk of code....

Steven Harper
Senior Applications Developer
Freeserve.com

-----Original Message-----
From: Aden, David [mailto:[EMAIL PROTECTED]]
Sent: 11 September 2001 13:43
To: Spectra-Talk
Subject: updating versions


By any chance, has anyone written a 'cf_contentObjectVersionUpdate' (or
perhaps it should be 'cf_contentObjectVersionData') tag that they are
willing to share?

I'm looking for something that takes the object data (using the
original's UUID), the name (or number) of the version and updates the
version in the Version DB.

Shouldn't be tough to build, but figured I'd check if it had already
been done.

Thanks!

David
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm
------------------------------------------------------------------------------
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/spectra_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to