//var podArray = ArrayNew(1); var userPodArray = ArrayNew(1); var defaultInstanceIDList = ""; //col_items[1].values.defaultinstanceidlist var instanceIDList = ""; var newpodid = ""; var saveuserdata = false; // Override so that a contributor that is logged in with a profile/userid can still manage default pods if ( arguments.csmode EQ "edit" OR arguments.csmode EQ "author" ) { WriteOutput('
- Default Pod Edit Mode -
'); } // If User is logged in, get a list of the users pods from the PortletPodUserData element (by portletid and userid) if ( LEN(TRIM(arguments.UserID)) ) { userPodArray = application.ptPortlet.ceData.getCEData("PortletPodUserData","","","multi","#arguments.portletID#,#TRIM(arguments.UserID)#","portletid,userid"); //Application.ADF.utils.dodump(userPodArray,"userPodArray",0); // After user loged in and if the "userPodArray" comes back with no records... // Copy the default instances as new podintances and assign them to the logged in user if ( ArrayLen(userPodArray) EQ 0 ) { defaultInstanceIDList = arguments.defaultIdList; //WriteOutput("Default User Pod List: " & variables.defaultIdList & "
"); // Copy the Default Pods and build a new list of Copied Pods in the same order for ( i=1;i LTE ListLen(defaultInstanceIDList); i=i+1 ) { newpodid = copyPod(ListGetAt(defaultInstanceIDList,i)); instanceIDList = ListAppend(instanceIDList,newpodid); } //WriteOutput("New User Pod List: " & instanceIDList & "
"); // Add the new Pod list to the User's Column info // saveColumnData(userid,portletpageid,portletid,podidlist,datapageid) if ( LEN(TRIM(instanceIDList)) ) { saveuserdata = saveColumnData(TRIM(arguments.UserID),TRIM(arguments.portletPageID),TRIM(arguments.portletID),instanceIDList,TRIM(arguments.datapageid)); } // Rebuild the userPodArray using the new Pods just created userPodArray = application.ptPortlet.ceData.getCEData("PortletPodUserData","","","multi","#arguments.portletID#,#arguments.UserID#","portletid,userid"); //Application.ADF.utils.dodump(userPodArray,"userPodArray",0); } }
var retStatus = false; var retSenderStruct = StructNew(); var retRecieverStruct = StructNew(); //var retStruct.errorFlag = false; //var retStruct.errorMsg = ""; if ( LEN(TRIM(arguments.senderid)) ) { retSenderStruct = saveColumnData(arguments.userid,arguments.portletpageid,arguments.senderid,arguments.senderidlist,arguments.sendererdatapageid); retStatus = true; } if ( LEN(TRIM(arguments.recieverid)) ) { retRecieverStruct = saveColumnData(arguments.userid,arguments.portletpageid,arguments.recieverid,arguments.recieveridlist,arguments.recieverdatapageid); retStatus = true; } //var userid = ""; var csContent = server.ADF.objectFactory.getBean("CSContent_1_0"); // If Profile Object is needed var profileObj = ""; var profileDataValues = ""; //var profileObj = server.ADF.objectFactory.getBean("profile").initProfile(arguments.userid); //var profileDataValues = profileObj.getDataValues(); var contentArray = application.ptPortlet.ceData.getCEData("PortletPodUserData","","","multi","#arguments.portletid#,#arguments.userid#","portletid,userid"); //var contentArray = application.ptPortlet.ceData.getCEData("PortletPodUserData","","","multi","#arguments.portletid#,#profileDataValues.uniqueID#","portletid,profileid"); var dataValues = StructNew(); var retStatusStruct = StructNew(); var retStatusString = ""; var saveStatus = false; // Update Sender Column if ( LEN(TRIM(arguments.portletid)) ) { // CCAPI CALL TO UPDATE THE USER CONTENT FOR THIS PORTLET COLUMN if ( ArrayLen(contentArray) ) { // Copy all values for an Update dataValues = contentArray[1].values; // Modify specific values for an Update dataValues.contentID = contentArray[1].values.contentID; dataValues.dataPageID = contentArray[1].PageID; // don't set for insert only if gt 0 update } else { // Set new values for an Insert dataValues.contentID = CreateUUID(); dataValues.UserID = TRIM(arguments.userid); dataValues.portletPageID = TRIM(arguments.portletpageid); dataValues.portletID = TRIM(arguments.portletid); // If Profile Object is needed //profileObj = server.ADF.objectFactory.getBean("profile").initProfile(arguments.userid); //Application.ADF.utils.dodump(profileArray,"profileArray",0); //profileDataValues = profileObj.getDataValues(); //dataValues.ProfileID = profileDataValues.uniqueID; dataValues.ProfileID = ""; } // Modify these values whether an insert or an update dataValues.podinstanceIDList = TRIM(arguments.podidlist); //Application.ADF.utils.dodump(dataValues,"dataValues",0); // Create the data record retStatusStruct = csContent.populateContent("PortletPodUserData", dataValues); //retStatusStruct RETURNS: //CONTENTUPDATED : true/false //CONTENTUPDATERESPONSE: Success:1 //Application.ADF.utils.dodump(retStatusStruct,"retStatusStruct",0); if ( retStatusStruct["CONTENTUPDATED"] IS true ) saveStatus = true; } var csContent = server.ADF.objectFactory.getBean("CSContent_1_0"); var podArray = application.ptPortlet.ceData.getCEData("PortletPodInstance", "podinstanceID", TRIM(arguments.podid)); var dataValues = StructNew(); var retStatusStruct = StructNew(); var retStatusString = ""; var updateStatus = false; if ( ArrayLen(podArray) ) { // CCAPI CALL TO UPDATE THE PROPERTY FOR THIS POD // Assign the data returned from the CE data call ton the dataValues Struct dataValues = podArray[1].values; dataValues.dataPageID = podArray[1].pageid; if ( LEN(TRIM(arguments.controlname)) AND structKeyExists(dataValues,"#arguments.controlname#") ) if ( IsBoolean(arguments.controlstate) AND arguments.controlstate EQ true ) dataValues["#arguments.controlname#"] = "Yes"; else dataValues["#arguments.controlname#"] = "No"; // Update the data record retStatusStruct = csContent.populateContent("PortletPodInstance", dataValues); //RETURNS: CONTENTUPDATED : true/false & CONTENTUPDATERESPONSE: Success:1 updateStatus = retStatusStruct["CONTENTUPDATED"]; } var csContent = server.ADF.objectFactory.getBean("CSContent_1_0"); var podArray = application.ptPortlet.ceData.getCEData("PortletPodInstance", "podinstanceID", TRIM(arguments.podid)); var dataValues = StructNew(); var retStatusStruct = StructNew(); var retStatusString = ""; var updateStatus = false; if ( ArrayLen(podArray) ) { // CCAPI CALL TO UPDATE THE STATE OF THIS POD // Assign the data returned from the CE data call ton the dataValues Struct dataValues = podArray[1].values; dataValues.dataPageID = podArray[1].pageid; if ( TRIM(arguments.controlname) IS "IsCollapsed" ) if ( TRIM(arguments.controlstate) IS false ) dataValues.IsCollapsed = 'Yes'; else dataValues.IsCollapsed = 'No'; // Update the data record retStatusStruct = csContent.populateContent("PortletPodInstance", dataValues); //RETURNS: CONTENTUPDATED : true/false & CONTENTUPDATERESPONSE: Success:1 updateStatus = retStatusStruct["CONTENTUPDATED"]; } var newPodID = ""; var upDatePodContent = false; var DataPageID = 0; //Application.ADF.utils.dodump(arguments,"arguments",1); // Copy Default Pod for this Type - Return the New Pod ID newPodID = copyPodByContentType(TRIM(arguments.contentType)); //Application.ADF.utils.dodump(newPodID,"newPodID",1); //pcArray = application.ptPortlet.ceData.getCEData("Simple_Content","podcontentID",TRIM(arguments.podcontentID)); //Application.ADF.utils.dodump(pcArray,"pcArray",1); //DataPageID = Application.ptPortlet.portletService.getDataPageIDByUniqueID("Simple_Content","podcontentID",TRIM(arguments.podcontentID)); //DataPageID = Application.ptPortlet.portletService.getDataPageIDByUniqueID(TRIM(arguments.contentType),"podcontentID",TRIM(arguments.podcontentID)); //WriteOutput("
DataPageID: "); //Application.ADF.utils.dodump(DataPageID,"DataPageID",1); //WriteOutput("
"); if ( LEN(TRIM(newPodID)) ) { // Update Pod Content with the Pod ID upDatePodContent = updatePodContentwithPodID(TRIM(arguments.contentType),TRIM(arguments.podcontentID),newPodID); //Application.ADF.utils.dodump(upDatePodContent,"upDatePodContent",1); } if ( upDatePodContent IS false ) { newPodID = ""; }
var csContent = server.ADF.objectFactory.getBean("CSContent_1_0"); var updateStatus = false; var pcArray = application.ptPortlet.ceData.getCEData(TRIM(arguments.contentType),"podcontentID",TRIM(arguments.podcontentID)); //var DataPageID = Application.ptPortlet.portletService.getDataPageIDByUniqueID(TRIM(arguments.contentType),"contentID",arguments.contentID); //Application.ADF.utils.dodump(pcArray,"pcArray",0); if ( ArrayLen(pcArray) ) { // Setup the data Struct to pass to the CCAPI // Copy the whole Values Struct so all current values will be saved dataValues = pcArray[1].values; // Pass the DataPageID so the record will update dataValues.dataPageID = pcArray[1].pageid; // reset PodInstanceID (data to be modified/updated) dataValues.podInstanceID = TRIM(arguments.podid); //Application.ADF.utils.dodump(dataValues,"dataValues",0); // CCAPI to update the data record retStatusStruct = csContent.populateContent(TRIM(arguments.contentType),dataValues); // retStatusStruct RETURNS: // CONTENTUPDATED : true/false // MSG: Success:1 */ updateStatus = retStatusStruct["CONTENTUPDATED"]; //Application.ADF.utils.dodump(retStatusStruct,"retStatusStruct",1); //pcArray = application.ptPortlet.ceData.getCEData(TRIM(arguments.contentType),"podcontentID",TRIM(arguments.contentID)); //Application.ADF.utils.dodump(pcArray,"pcArray",0); } var copiedpodid = ""; var copiedpodStatus = ""; //var newPodArray = ArrayNew(1); var pArray = application.ptPortlet.ceData.getCEData("PortletPodInstance","contentType",TRIM(arguments.contentType)); //Application.ADF.utils.dodump(pArray,"pArray",0); //Find the Default Pod for this Content Type for (i=1;i LTE ArrayLen(pArray); i=i+1) { if( LEN(TRIM(pArray[i].values.defaultInstanceID)) EQ 0 ) { //newPodArray[1] = pArray[i]; //Application.ADF.utils.dodump(pArray[i].values.podinstanceID,"pArray[i].values.podinstanceID",0); copiedpodid = copyPod(pArray[i].values.podinstanceID,false,false); //Application.ADF.utils.dodump(copiedpodid,"copiedpodid",0); break; } } if ( LEN(TRIM(copiedpodid)) EQ 0 ) { copiedpodStatus = "Pod Copy Failed"; } //Copy the Default Pod for the passed content type //if ( ArrayLen(newPodArray) ) { //copiedpodid = copyPod(newPodArray[1].values.podinstanceID,false,false); //} //Application.ADF.utils.dodump(copiedpodid,"copiedpodid",0); var csContent = server.ADF.objectFactory.getBean("CSContent_1_0"); var pArray = application.ptPortlet.ceData.getCEData("PortletPodInstance", "podinstanceID", TRIM(arguments.podid)); var newpodid = ""; var newcontentid = ""; var createsharedpod = false; var lockpod = ""; //Application.ADF.utils.dodump(pArray,"pArray",0); if ( (LEN(TRIM(arguments.podid))) AND (ArrayLen(pArray)) ) { // If Default Pod is set to isShared all users get the same instance (and content) // and the edit, delete and collapse property (maybe the move) should be disabled if ( structKeyExists(pArray[1].values,"isShared") AND pArray[1].values.isShared IS "Yes") { newpodid = TRIM(arguments.podid); createsharedpod = true; // If the Pod is set to isShared... // The code below relocks the user properties each time the pod is attempted to be copied. // This POD is NOT a copy.... It is shared by all users // It should already be locked by the admin that creatd a shared pod!! //newpodid = lockUserProperties(TRIM(arguments.podid)); lockpod = savePodPropertyByPodID(arguments.podid,"isDeletable","No"); lockpod = savePodPropertyByPodID(arguments.podid,"isEditable","No"); lockpod = savePodPropertyByPodID(arguments.podid,"isCollapsible","Yes"); lockpod = savePodPropertyByPodID(arguments.podid,"IsCollapsed","No"); } else { // Set up the data Struct to pass new data to the CCAPI // Copy Pod Values dataValues = pArray[1].values; // Creating a New Pod Instance // dataValues.DataPageID = 0; // Don't even send this variable or it will set the default values. // Set the pod ID dataValues.podinstanceID = CreateUUID(); // Set the Parent ID dataValues.defaultInstanceID = TRIM(arguments.podid); //dataValues.contentType = pArray[1].values.contentType; //dataValues.podinstanceName = pArray[1].values.podinstanceName; // & " COPY"; /* if ( arguments.doPodPropertiesCopy IS true ) { dataValues.isDraggable = pArray[1].values.isDraggable; dataValues.isCollapsible = pArray[1].values.isCollapsible; dataValues.isEditable = pArray[1].values.isEditable; dataValues.isDeletable = pArray[1].values.isDeletable; dataValues.IsCollapsed = pArray[1].values.IsCollapsed; dataValues.isReusable = pArray[1].values.isReusable; } else { */ if ( arguments.doPodPropertiesCopy IS false ) { // Set Pod Porperties for User Created Pod dataValues.isDraggable = "Yes"; dataValues.isCollapsible = "Yes"; dataValues.isEditable = "Yes"; dataValues.isDeletable = "Yes"; dataValues.IsCollapsed = "No"; dataValues.isReusable = "No"; } //Application.ADF.utils.dodump(dataValues,"dataValues",0); // CCAPI to create the data record retStatusStruct = csContent.populateContent("PortletPodInstance", dataValues); //Application.ADF.utils.dodump(retStatusStruct,"retStatusStruct",0); /* retStatusStruct RETURNS: CONTENTUPDATED : true/false CONTENTUPDATERESPONSE: Success:1 */ // If success set newpodid to the new dataValues.podinstanceID if ( retStatusStruct["CONTENTUPDATED"] IS true ) { newpodid = dataValues.podinstanceID; // Create Content for the new Pod based on the content of the Parent Pod if ( arguments.doPodContentCopy IS true ) { newcontentid = copyPodContent(dataValues.contentType,TRIM(arguments.podid),newpodid); //Application.ADF.utils.dodump(newcontentid,"newcontentid",0); } } } } var csContent = server.ADF.objectFactory.getBean("CSContent_1_0"); var pcArray = application.ptPortlet.ceData.getCEData(TRIM(arguments.contentType),"podinstanceID", TRIM(arguments.podid)); var dataValues = StructNew(); var newpodcontentid = ""; //Application.ADF.utils.dodump(TRIM(arguments.contentType),"contentType",0); //Application.ADF.utils.dodump(pcArray,"pcArray",0); if ( (LEN(TRIM(arguments.podid))) AND (ArrayLen(pcArray)) ) { // Copy the Struct to pass new data to the CCAPI dataValues = pcArray[1].values; // reset unique values for the copy dataValues.podContentID = CreateUUID(); if ( LEN(TRIM(copypodid)) ) { dataValues.podInstanceID = TRIM(arguments.copypodid); } else { dataValues.podInstanceID = TRIM(arguments.podid); } //Application.ADF.utils.dodump(dataValues,"dataValues",0); // CCAPI to create the data record retStatusStruct = csContent.populateContent(TRIM(arguments.contentType), dataValues); //Application.ADF.utils.dodump(retStatusStruct,"retStatusStruct",1); /* retStatusStruct RETURNS: CONTENTUPDATED : true/false CONTENTUPDATERESPONSE: Success:1 */ // If success set newpodid to the new dataValues.podinstanceID if ( retStatusStruct["CONTENTUPDATED"] IS true ) { newpodcontentid = dataValues.podContentID; } } var deleteStatus = false; // Save this users Column Data with the deleted Pod Removed var retStruct = saveColumnData(arguments.userid,arguments.portletpageid,arguments.portletid,arguments.podidlist,arguments.datapageid); // Delete this users pod content data from the Pod Type element (by podid) var deletePodContent = application.ptPortlet.managePodDAO.deletePodContentByPodID(TRIM(arguments.podid)); // Delete this users pod instance from the PortletPodInstance element (by datapageid) var deletePodInstance = application.ptPortlet.ceData.deleteCE(TRIM(arguments.poddatapageid)); var deletePodStatus = false; var deleteContnetStatus = false; var deleteStatusMsg = ""; var resultsData = ""; var pArray = application.ptPortlet.ceData.getCEData("PortletPodInstance","podinstanceID",TRIM(arguments.podid)); var retDataPageID = 0; var contentElementName = ""; var i = 1; var retHTML = ""; if ( ArrayLen(pArray) ) { // Loop in case more than on pod has the same PodInstanceID for (i=1;i LTE ArrayLen(pArray); i=i+1) { retDataPageID = pArray[i].PageID; contentElementName = TRIM(pArray[i].values.contentType); resultsData = "PODID: " & TRIM(arguments.podid); // Delete the Pod's Content from Content Element deleteContnetStatus = application.ptPortlet.managePodDAO.deletePodContentByPodID(TRIM(arguments.podid),contentElementName); resultsData = resultsData & " | Delete Content: " & deleteContnetStatus; // Delete the Pod from the PortletPodInstance element (by datapageid) if ( retDataPageID NEQ 0 ) { deletePod = application.ptPortlet.ceData.deleteCE(retDataPageID); deletePodStatus = true; resultsData = resultsData & " | Delete Pod: " & deletePodStatus; } else { deletePodStatus = false; resultsData = resultsData & " | Delete Pod: " & deletePodStatus; } resultsData = resultsData & "
"; } } else { deleteContnetStatus = false; deletePodStatus = false; resultsData = "PODID: " & TRIM(arguments.podid); resultsData = resultsData & " | NO POD DATA FOUND!"; } retHTML = resultsData;