home *** CD-ROM | disk | FTP | other *** search
- <CFPARAM NAME="Session.AddContent.ObjectID" DEFAULT="">
-
- <CFTRANSACTION ISOLATION="READ_COMMITTED">
-
- <CFIF Session.AddContent.ObjectID IS "">
-
- <CFSET CurrentDateTime = Now()>
-
- <CFQUERY DATASOURCE="CFexamples" NAME="GetTopObjID">
- SELECT Max(ObjectID) AS MaxID FROM PubObjects
- </CFQUERY>
-
- <CFIF GetTopObjID.MaxID IS "">
- <CFSET NewObjectID = 1>
- <CFELSE>
- <CFSET NewObjectID = GetTopObjID.MaxID + 1>
- </CFIF>
-
- <CFQUERY DATASOURCE="CFexamples" NAME="CreateNewObject">
- INSERT INTO PubObjects (ObjectID, ClassID, DateCreated, DateUpdated)
- VALUES (#NewObjectID#, #Session.AddContent.ClassID#, #CurrentDateTime#, #CurrentDateTime#)
- </CFQUERY>
-
- <CFQUERY DATASOURCE="CFexamples" NAME="GetNewObjectID">
- SELECT ObjectID FROM PubObjects
- WHERE ClassID = #Session.AddContent.ClassID#
- AND DateCreated = #CurrentDateTime#
- </CFQUERY>
-
- <CFSET ObjectID = GetNewObjectID.ObjectID>
-
- <CFELSE>
-
- <CFSET ObjectID = Session.AddContent.ObjectID>
-
- </CFIF>
-
- <CFLOOP LIST="#Session.AddContent.ReqContentTypes#" INDEX="CurrType">
-
- <CFQUERY DATASOURCE="CFexamples" NAME="KillExisting">
- DELETE FROM PubContent
- WHERE ObjectID = #ObjectID#
- AND TypeID = #CurrType#
- </CFQUERY>
-
- <CFQUERY DATASOURCE="CFexamples" NAME="GetTopContentID">
- SELECT Max(ContentID) AS MaxID FROM PubContent
- </CFQUERY>
-
- <CFIF GetTopContentID.MaxID IS "">
- <CFSET NewContentID = 1>
- <CFELSE>
- <CFSET NewContentID = GetTopContentID.MaxID + 1>
- </CFIF>
-
- <!--- "Pay no attention to the man behind the curtain." --->
- <CFSET DataVar = evaluate("Session.AddContent.Content.Type" & CurrType)>
-
- <CFQUERY DATASOURCE="CFexamples" NAME="InsertNew">
- INSERT INTO PubContent (ContentID, ObjectID, TypeID, Data)
- VALUES (#NewContentID#, #ObjectID#, #CurrType#, '#DataVar#')
- </CFQUERY>
-
- <CFSET "Session.AddContent.Content.Type#CurrType#" = "">
-
- </CFLOOP>
-
- <CFLOOP LIST="#Session.AddContent.OptContentTypes#" INDEX="CurrType">
-
- <CFQUERY DATASOURCE="CFexamples" NAME="KillExisting">
- DELETE FROM PubContent
- WHERE ObjectID = #ObjectID#
- AND TypeID = #CurrType#
- </CFQUERY>
-
- <CFQUERY DATASOURCE="CFexamples" NAME="GetTopContentID">
- SELECT Max(ContentID) AS MaxID FROM PubContent
- </CFQUERY>
-
- <CFIF GetTopContentID.MaxID IS "">
- <CFSET NewContentID = 1>
- <CFELSE>
- <CFSET NewContentID = GetTopContentID.MaxID + 1>
- </CFIF>
-
- <CFQUERY DATASOURCE="CFexamples" NAME="InsertNew">
- INSERT INTO PubContent (ContentID, ObjectID, TypeID, Data)
- VALUES (#NewContentID#, #ObjectID#, #CurrType#, '#evaluate("Session.AddContent.Content.Type" & CurrType)#')
- </CFQUERY>
-
- <CFSET "Session.AddContent.Content.Type#CurrType#" = "">
-
- </CFLOOP>
-
- </CFTRANSACTION>
-
- <CFLOCATION URL="properties.cfm?ObjectID=#ObjectID#" ADDTOKEN="NO">