var deletedPodData = "";
var resultsData = "";
var retHTML = "";
var UserPodList = "";
var dUserData = application.ptPortlet.ceData.getCEData("PortletPodUserData","podinstanceIDList","");
var dPodData = application.ptPortlet.ceData.getCEData("PortletPodInstance","DEFAULTINSTANCEID","");
var pid = "";
var i = 1;
var p = 1;
var d = 1;
var x = 1;
var z = 1;
var items = ArrayNew(1);
for (i=1;i LTE ArrayLen(dUserData); i=i+1) {
for (p=1;p LTE ListLen(dUserData[i].values.podinstanceIDList); p=p+1) {
pid = ListGetAt(dUserData[i].values.podinstanceIDList,p);
if (ListFindNoCase(UserPodList,pid) EQ 0) {
UserPodList = ListAppend(UserPodList,pid);
}
}
}
//WriteOutput("UserPodList: " & ListLen(UserPodList) & " Records
");
//WriteOutput(UserPodList & "
");
for (d=1;d LTE ArrayLen(dPodData); d=d+1) {
// Only Add PodInstances that have parents (a DEFAULTINSTANCEID)
if ( LEN(TRIM(dPodData[d].values.DEFAULTINSTANCEID)) NEQ 0 ) {
// Only add to items Pods that are NOT assigned to users
if ( LEN(TRIM(UserPodList)) AND ListFindNoCase(UserPodList,dPodData[d].values.podinstanceID) EQ 0 ){
items[x] = dPodData[d];
//DELETE POD BY ID CODE HERE
deletedPodData = application.ptPortlet.portletController.deletePodByPodID(items[x].values.podinstanceID);
resultsData = resultsData & deletedPodData;
x = x + 1;
// If the Users Pod List is empty ... delete all child pods.
} else if ( LEN(TRIM(UserPodList)) EQ 0 AND Len(trim(dPodData[d].values.podinstanceID)) ) {
//DELETE POD BY ID CODE HERE
deletedPodData = deletePodByPodID(dPodData[d].values.podinstanceID);
resultsData = resultsData & deletedPodData;
}
}
}
//Application.ADF.utils.dodump(dPodData,"dPodData",0);
//Application.ADF.utils.dodump(items,"items",0);
retHTML = "Deleted Pod Info:
" & resultsData;
var deletedUserData = "";
var resultsData = "";
var retHTML = "";
var userData = application.ptPortlet.ceData.getCEData("PortletPodUserData","contentid","");
var userlist = "";
for (i=1;i LTE ArrayLen(userData); i=i+1) {
if (LEN(TRIM(userData[i].values.userid)) ) {
if ( ListFindNoCase(userlist,userData[i].values.userid) EQ 0 ) {
userlist = ListAppend(userlist,userData[i].values.userid);
deletedUserData = deleteUserPodContentByUser(userData[i].values.userid);
resultsData = resultsData & "
" & deletedUserData;
}
} else {
resultsData = resultsData & "
Invalid UserID!";
}
}
retHTML = resultsData;
var deletedUserData = "";
var resultsData = "";
var retHTML = "";
var i = 0;
// Get All User Pod Content By Page
var contentArray = application.ptPortlet.ceData.getCEData("PortletPodUserData","userid","#arguments.userID#");
//Application.ADF.utils.dodump(contentArray,"contentArray",0);
// Build List of Pod IDs from all Portlet Columns on Page
for (i=1;i LTE ArrayLen(contentArray); i=i+1) {
if ( IsNumeric(contentArray[i].values.portletPageID) ) {
deletedUserData = deleteUserPodContentByPage(arguments.userID,contentArray[i].values.portletPageID);
resultsData = resultsData & "
" & deletedUserData;
} else {
resultsData = resultsData & "
Invalid PortletPageID!";
}
}
retHTML = resultsData;
// Get All User Pod Content By Page
var contentArray = application.ptPortlet.ceData.getCEData("PortletPodUserData","","","multi","#arguments.portletpageid#,#arguments.userID#","portletpageid,userid");
var contentidlist = "";
var podinstancelist = "";
var podid = "";
var deletePodInstances = "";
var deleteUserContent = "";
var deletedPodIDList = "";
var skippedPodIDList = "";
var stringResult = "";
var i = 1;
var p = 1;
//Application.ADF.utils.dodump(contentArray,"contentArray",0);
//Application.ADF.utils.abort();
// Build List of Pod IDs from all Portlet Columns on Page
for (i=1;i LTE ArrayLen(contentArray); i=i+1) {
contentidlist = ListAppend(contentidlist, contentArray[i].values.contentid);
podinstancelist = contentArray[i].values.podinstanceIDList;
for (p=1;p LTE ListLen(podinstancelist); p=p+1) {
podid = ListGetAt(podinstancelist,p);
podArray = application.ptPortlet.ceData.getCEData("PortletPodInstance","podinstanceID",podid);
if ( ArrayLen(podArray) ) {
//Application.ADF.utils.dodump(podArray,"podArray",0);
// If Pod is set as Reusable eq "yes" do not delete
// Or if a Pod does not have a parent "defaultInstanceID" do not delete
//if ( LEN(TRIM(podArray[1].values.defaultInstanceID)) EQ 0 OR podArray[1].values.isReusable IS "Yes" ) {
//skippedPodIDList = ListAppend(skippedPodIDList,podid);
//} else {
// Delete the Pod's content
deletePodContent = application.ptPortlet.managePodDAO.deletePodContentByPodID(podid,podArray[1].values.contentType);
//Application.ADF.utils.dodump(deletePodContent,"deletePodContent",0);
// Delete the Pod Instances that are not Resuable and do have parents (by datapageid)
deletePodInstances = application.ptPortlet.ceData.deleteCE(podArray[1].pageid);
// Build a delete pod id list
deletedPodIDList = ListAppend(deletedPodIDList,podid);
//}
}
//WriteOutput("Deleted Pods: " & deletedPodIDList & "
");
//WriteOutput("Skipped Pods: " & skippedPodIDList & "
");
}
// Delete the UserContent Records (by datapageid)
deleteUserContent = application.ptPortlet.ceData.deleteCE(contentArray[i].pageid);
}
//WriteOutput("Deleted User ContentID List: " & contentidlist & "
");
// Build Results String
stringResult = "Deleted User ContentID List: " & contentidlist & "
" & "Deleted Pods: " & deletedPodIDList & "
" & "Skipped Pods: " & skippedPodIDList & "
";
var pArray = application.ptPortlet.ceData.getCEData("PortletPodInstance", "contentType", TRIM(arguments.contentType));
var deletePod = false;
var deletePodContent = false;
var podidlist = "";
for ( i=1;i LTE ArrayLen(pArray); i=i+1 ) {
if ( LEN(TRIM(pArray[i].values.DEFAULTINSTANCEID)) NEQ 0) {
podid = pArray[i].values.PODINSTANCEID;
podidlist = ListAppend(podidlist, podid);
// Kill the pods
deletePod = application.ptPortlet.ceData.deleteCE(pArray[i].pageid);
deletePodContent = application.ptPortlet.managePodDAO.deletePodContentByPodID(podid);
}
}
var retDataPageID = 0;
var deletePodContent = "";
var pArray = ArrayNew(1);
var contentElementName = TRIM(arguments.contentType);
var deleteStatus = false;
// If contentType is not Passed in get the contentType for the Pod
if ( LEN(TRIM(contentElementName)) EQ 0 ) {
// CEData the podinstance element to find the
pArray = application.ptPortlet.ceData.getCEData("PortletPodInstance","podinstanceID",TRIM(arguments.podid));
if ( ArrayLen(pArray) )
contentElementName = TRIM(pArray[1].values.contentType);
}
// Get the DataPageID if there is an element name
if ( LEN(TRIM(contentElementName)) NEQ 0 ) {
retDataPageID = application.ptPortlet.portletService.getDataPageIDByUniqueID(contentElementName,"podinstanceID",TRIM(arguments.podid));
}
// Delete from the Pod's content from the "Content" element (by datapageid)
if ( retDataPageID NEQ 0 ) {
deletePodContent = application.ptPortlet.ceData.deleteCE(retDataPageID);
deleteStatus = true;
}
var retStatusStruct = "failed";
// Create the CS Content CFC
var csContent = server.ADF.objectFactory.getBean("CSContent_1_0");
//application.ADF.utils.doDump(arguments.dataValues,"arguments.dataValues", false);
var CEName = REREPLACE(arguments.CustomElementName,"[[:SPACE:]]","_","all");
// Create the page
retStatusStruct = csContent.populateContent(CEName, arguments.dataValues);