//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);
}
}