";
retHTML = retHTML & "";
// does the logged in user match the profile page user
if ( (loggedInUserID eq arguments.currentPageUserID) AND (profileElementData.pageID GT 0) ) {
retHTML = retHTML & "
Edit Profile";
retHTML = retHTML & "|";
retHTML = retHTML & "
Profile Dashboard";
}
else if ( (loggedInUserID neq arguments.currentPageUserID) AND (profileElementData.pageID GT 0) ){
// Loop over the role struct
for ( i = 1; i LTE ListLen(roleKey); i = i + 1 ) {
// Check the role permissions
if ( profileRoles[ListGetAt(roleKey,i)].permission ){
// Check if any page has been created yet
if ( profileRoles[ListGetAt(roleKey,i)].pageID GT 0 ){
// Output a Page Link for each role
retHTML = retHTML & "
My Profile";
retHTML = retHTML & "|";
}
}
}
retHTML = retHTML & "
Profile Dashboard";
}
else {
// No profile so put the user at the dashboard to create
retHTML = retHTML & "
Profile Dashboard";
}
retHTML = retHTML & "|";
retHTML = retHTML & "
Logout";
retHTML = retHTML & "";
}
else {
retHTML = "";
}
return retHTML;
var retStatus = "false"; // Return variable
// Get the profile data from the data page id
var profileData = StructNew();
var pageDelStatus = "false";
// Valid the users security that they are a content contributor
if ( application.ptProfile.cssecurity.isValidContributor() )
{
formID = application.ptProfile.cedata.getFormIDFromPageID(arguments.dataPageID);
profileData = application.ptProfile.cedata.getElementInfoByPageID(arguments.dataPageID, formID);
// Call the delete profile page
pageDelStatus = verifyPageDelete(profileData.Values.userID);
// Set the status
if ( pageDelStatus EQ "true" )
{
// Call CEData to delete
application.ptProfile.cedata.deleteCE(arguments.dataPageID);
retStatus = "Success";
}
else
retStatus = pageDelStatus;
}
else
retStatus = "Logged in user does not have enough permissions to delete the profile.";
// Number of accounts to update on a pass through
var updatePassCount = arguments.passCount;
// Minutes to pause
var pauseMinutes = arguments.delayMinutes;
// Query user id field name
var qryFieldName = arguments.usernameFld;
// Log file name
var logFile = arguments.logFileName;
var i = 1;
var profileObj = StructNew();
var profileCEPageID = 0;
var profileUserID = "";
var profile = "";
var schedTaskURL = "";
// Set the schedule params
scheduleParams.delay = arguments.delayMinutes; //minutes till next schedule item
scheduleParams.tasksPerBatch = arguments.passCount; //how many tasks to do per iteration
// Build the command array
cmdArray = ArrayNew(1);
// Get all the external profile data
extProfileData = getExternalProfileData();
// Loop over the user ID fields
for ( i=1; i LTE extProfileData.recordCount; i++ ){
// Build the schedule task to call "populateProfileFromExternalData"
// Build the temp command to keep calling
tempCmd = StructNew();
tempCmd.bean = "profileService";
tempCmd.method = "populateProfileFromExternalData";
tempCmd.args = StructNew();
tempCmd.args.userid = extProfileData.userid[i];
tempCmd.args.dataPageID = 0;
// Add the temp call to the command
ArrayAppend(cmdArray, tempCmd);
}
//application.ADF.utils.dodump(cmdArray, "cmdArray", false);
// Load into the Scheduler
application.ADF.scheduler.scheduleProcess(scheduleName="Profile-Bulk-Import",
commands=cmdArray,
scheduleParams=scheduleParams,
startProcessNow=arguments.scheduleProcess);
/*
// check if app variable exists or we need to restart
if ( (NOT StructKeyExists(application.ptProfile, "profileBulkUpdate")) OR (arguments.restart) ){
// Reset the bulk update variable
application.ptProfile.profileBulkUpdate = StructNew();
// Get the Data
application.ptProfile.profileBulkUpdate.Query = getExternalProfileData();
// Store the current row
application.ptProfile.profileBulkUpdate.currRow = 0;
// Log that the application vars were updated
application.ptProfile.utils.logAppend("Profile Bulk Update - Application Vars Populated @ #now()#;",logFile);
}
// Check if we want to set the start at number
if ( arguments.startAt GT 0 ) {
// check if we want to set the start number in the url
application.ptProfile.profileBulkUpdate.currRow = arguments.startAt - 1;
}
//application.ptProfile.utils.doDump(application.ptProfile.profileBulkUpdate,"application.ptProfile.profileBulkUpdate",false);
// Log that we are starting the process
application.ptProfile.utils.logAppend("Profile Bulk Update - Start @ #now()#;",logFile);
// loop over the next updatePassCount of records
for (i = 1; i LTE updatePassCount; i++) {
// Increment the current row counter
application.ptProfile.profileBulkUpdate.currRow = application.ptProfile.profileBulkUpdate.currRow + 1;
if (application.ptProfile.profileBulkUpdate.currRow LTE application.ptProfile.profileBulkUpdate.Query.RecordCount) {
// check that we have an eaglenetid
if (LEN(application.ptProfile.profileBulkUpdate.Query[qryFieldName][application.ptProfile.profileBulkUpdate.currRow])) {
WriteOutput("application.ptProfile.profileBulkUpdate.Query[qryFieldName][#application.ptProfile.profileBulkUpdate.currRow#] = #application.ptProfile.profileBulkUpdate.Query[qryFieldName][application.ptProfile.profileBulkUpdate.currRow]#
");
profileObj = StructNew();
// create profile object
profileObj = server.ADF.objectFactory.getBean("profile").initProfile(application.ptProfile.profileBulkUpdate.Query[qryFieldName][application.ptProfile.profileBulkUpdate.currRow]);
profileCEPageID = profileObj.GetProfileCEDataPageID();
profileUserID = profileObj.getProfileUserID();
// Update/Create the profile element for the logged in user
profile = populateProfileFromExternalData(profileUserID, profileCEPageID);
application.ptProfile.utils.logAppend("Profile Created/Updated - Record Number: #application.ptProfile.profileBulkUpdate.currRow#; UserID: #profileUserID#; Completed @ #now()#;",logFile);
}
else {
WriteOutput("Blank EaglenetID - application.ptProfile.profileBulkUpdate.Query[qryFieldName][#application.ptProfile.profileBulkUpdate.currRow#] = #application.ptProfile.profileBulkUpdate.Query[qryFieldName][application.ptProfile.profileBulkUpdate.currRow]#
");
application.ptProfile.utils.logAppend("Profile Created/Updated - No User ID at Record Number: #application.ptProfile.profileBulkUpdate.currRow# - @ #now()#;",logFile);
}
}
else {
application.ptProfile.utils.logAppend("Profile Bulk Update - Completed @ #now()#;",logFile);
if ( arguments.scheduleProcess ) {
// Delete the scheduled task
application.ptProfile.utils.deleteScheduledTask("Profile_Bulk_Update_Process");
// Log that we are ending the process
application.ptProfile.utils.logAppend("Profile Bulk Update - Scheduled task deleted;", logFile);
}
break;
}
}
// Log that we are ending the process
application.ptProfile.utils.logAppend("Profile Bulk Update - End @ #now()#;",logFile);
if ( arguments.scheduleProcess ) {
if (application.ptProfile.profileBulkUpdate.currRow LTE application.ptProfile.profileBulkUpdate.Query.RecordCount) {
// set the scheduled task to start again
schedTaskURL = application.ptProfile.csdata.getFullCurrentPageURL() & "?action=process&count=#updatePassCount#&pause=#pauseMinutes#&cont=#arguments.scheduleProcess#&restart=false";
application.ptProfile.utils.setScheduledTask(schedTaskURL, "Profile_Bulk_Update_Process","Profile_Bulk_Update_Process.htm", pauseMinutes);
// Log that we are ending the process
application.ptProfile.utils.logAppend("Profile Bulk Update - Set scheduled task to start in #pauseMinutes# minutes from #now()#", logFile);
}
}
*/
var photoPageID = 0;
var photoImgURL = "";
// Check if the field is using the CS Image Gallery
if ( ListContains(arguments.photo,':') ) {
photoPageID = ListLast(arguments.photo,":");
if ( ListContains(photoPageID, "&") ) {
photoPageID = ListFirst(photoPageID, "&");
photoImgURL = application.ptProfile.csdata.getImagePageURL(photoPageID);
}
else if ( ListContains(photoPageID, "|") ) {
photoPageID = ListFirst(photoPageID, "|");
photoImgURL = application.ptProfile.csdata.getImagePageURL(photoPageID);
}
}
// Verify the roles against the creating pages
pageIDResult = application.ptProfile.profileService.verifyPageCreateRoles(arguments.userid);
var profileData = StructNew();
var currProfileObj = server.ADF.objectFactory.getBean("profile").initProfile(arguments.userid);
var currProfileRoles = currProfileObj.getRoles();
var cuurProfileData = currProfileObj.getElementData();
profileData.profileURL = "";
profileData.photoURL = "";
//profileData.photoURL = application.ptPhotoGallery.renderService.getCommunityPhotoURL('profiles', arguments.photoSize);
profileData.fullName = cuurProfileData.Values.firstname & " " & cuurProfileData.Values.lastname;
profileData.firstName = cuurProfileData.Values.firstname;
profileData.lastname = cuurProfileData.Values.lastname;
profileData.uniqueID = cuurProfileData.Values.uniqueID;
profileData.bio = cuurProfileData.Values.bio;
// Set the profile page URL
if ( currProfileRoles[arguments.profileRole].permission )
profileData.profileURL = currProfileRoles[arguments.profileRole].pageurl;
// Set the profile image
//if ( LEN(cuurProfileData.Values.photo) )
// profileData.photoURL = application.ptPhotoGallery.photoService.getPhotoURLbyPhotoID(cuurProfileData.Values.photo, 'profiles', arguments.photoSize);
// Get the profile data by the UID
var profileData = application.ptProfile.profileDAO.getProfileData(fieldName="uniqueID",fieldVal=arguments.profileUID);
// Pass the userID to the handleEdit function to create the pages
if ( ArrayLen(profileData) ){
handleEdit(profileData[1].values.userID);
afterProfileCreate(profileData[1].values.userID);
}
/*
* CUSTOMIZE AT THE SITE LEVEL
**/