";
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
var profileData = StructNew();
var pageDelStatus = "false";
var postDelStatus = false;
// Valid the users security that they are a content contributor
if ( application.ptProfile.cssecurity.isValidContributor() )
{
formID = application.ptProfile.cedata.getFormIDFromPageID(arguments.dataPageID);
// Get the profile data from the data page id
profileData = application.ptProfile.cedata.getElementInfoByPageID(arguments.dataPageID, formID);
// Call the delete profile page
if ( StructKeyExists(profileData,"values")
AND StructKeyExists(profileData.values,"userID")
AND LEN(TRIM(profileData.values.userID)) )
{
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 = "No profile record was found for the provided userid.";
}
}
else
{
retStatus = "Logged in user does not have enough permissions to delete the profile.";
}
return retStatus;
// 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 d = 1;
var profileObj = StructNew();
var profileCEPageID = 0;
var profileUserID = "";
var profile = "";
var schedTaskURL = "";
var syncProfileQry = QueryNew('tmp');
var enableOneWaySync = application.ptProfile.getOneWaySyncStatus(); // true = removes profiles from CS - "one-way sync" (not just an "import" of the external data)
// 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();
if ( arguments.scanForChangesOnSchedule )
extProfileData = scanProfileDataForChanges(qry=extProfileData);
// 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.app = "ptprofile";
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);
}
if ( enableOneWaySync )
{
// Get all the sync profile records
syncProfileQry = afterImportCleanUpProfileQry();
// Loop over the user ID fields
for ( d=1; d LTE syncProfileQry.recordCount; d++ ) {
// Build the schedule tasks for "removeProfileMissingFromExternalData" to cleanup removed profiles
tempCmd = StructNew();
tempCmd.app = "ptprofile";
tempCmd.bean = "profileService";
tempCmd.method = "removeProfileMissingFromExternalData";
tempCmd.args = StructNew();
tempCmd.args.userid = syncProfileQry.userid[d];
tempCmd.args.external_id = syncProfileQry.external_id[d];
tempCmd.args.dataPageID = syncProfileQry.datapageid[d];
// Add the temp call to the command
ArrayAppend(cmdArray, tempCmd);
}
}
// Load into the Scheduler
application.ptProfile.scheduler.scheduleProcess(scheduleName="Profile-Bulk-Import",
commands=cmdArray,
scheduleParams=scheduleParams,
startProcessNow=false);
// Pause the scheduler
sleep(2000);
application.ptProfile.scheduler.pauseSchedule(scheduleName="Profile-Bulk-Import");
// Wait 2 more seconds and resume the scheduler
sleep(2000);
application.ptProfile.scheduler.resumeSchedule(scheduleName="Profile-Bulk-Import");
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);
}
}
return photoImgURL;
var logMethod = 'handleEdit';
var logMethodAlt = '';
var logMsg = '';
var logData = StructNew();
// Verify the roles against the creating pages
pageIDResult = verifyPageCreateRoles(arguments.userid);
if ( variables.enableDebugLogging )
{
logMsg = 'userID: #arguments.userid#';
logData = pageIDResult;
application.ptprofile.log.doTextLogging(variables.logComponent,logMethod,variables.logApp,logMsg,logData);
}
return true;
var profileData = StructNew();
var currProfileObj = server.ADF.objectFactory.getBean("profile").initProfile(arguments.userid);
var currProfileRoles = currProfileObj.getRoles();
var currProfileData = currProfileObj.getElementData();
profileData.profileURL = "";
profileData.photoURL = "";
//profileData.photoURL = application.ptPhotoGallery.renderService.getCommunityPhotoURL('profiles', arguments.photoSize);
profileData.fullName = currProfileData.Values.firstname & " " & currProfileData.Values.lastname;
profileData.firstName = currProfileData.Values.firstname;
profileData.lastname = currProfileData.Values.lastname;
profileData.uniqueID = currProfileData.Values.uniqueID;
profileData.bio = currProfileData.Values.bio;
// Set the profile page URL
if ( currProfileRoles[arguments.profileRole].permission )
profileData.profileURL = currProfileRoles[arguments.profileRole].pageurl;
// Set the profile image
//if ( LEN(currProfileData.Values.photo) )
// profileData.photoURL = application.ptPhotoGallery.photoService.getPhotoURLbyPhotoID(currProfileData.Values.photo, 'profiles', arguments.photoSize);
return profileData;
// Get the profile data by the UID
var profileData = application.ptProfile.profileDAO.getProfileData(fieldName="uniqueID",fieldVal=arguments.profileUID);
var logMethod = 'handleCreate';
var logMethodAlt = '';
var logMsg = '';
var logData = StructNew();
// Pass the userID to the handleEdit function to create the pages
if ( ArrayLen(profileData) )
{
if ( variables.enableDebugLogging )
{
logMsg = 'profileData[1].values.userID';
logData = profileData[1].values.userID;
application.ptprofile.log.doTextLogging(variables.logComponent,logMethod,variables.logApp,logMsg,logData);
}
handleEdit(profileData[1].values.userID);
afterProfileCreate(profileData[1].values.userID);
}
return true;
var delStatus = false;
var logFile = "Profiles.log";
var logErrorFile = "Profiles-Error.html";
var postDelStatus = StructNew();
var logMethod = 'removeProfileMissingFromExternalData';
var logMethodAlt = '';
var logMsg = '';
var logData = StructNew();
var dropType = getOneSyncDropType();
if ( dropType EQ 'deactivate' )
{
postDelStatus.status = false;
delStatus = verifyPageDeactivate(userid=arguments.userID);
if ( variables.enableDebugLogging )
{
logMsg = 'verifyPageDeactivate: ';
logData = delStatus;
application.ptprofile.log.doTextLogging(variables.logComponent,logMethod,variables.logApp,logMsg,logData);
}
}
else if ( dropType EQ 'delete' )
{
try
{
postDelStatus.status = false;
// Make sure we are logged in
if ( application.ADF.ccapi.loggedIn() EQ 'false' )
{
// construct the CCAPI object
application.ADF.ccapi.initCCAPI();
application.ADF.ccapi.login();
}
delStatus = handleProfileDelete(dataPageID=arguments.dataPageID);
if ( variables.enableDebugLogging )
{
logMsg = 'handleProfileDelete: ';
logData = delStatus;
application.ptprofile.log.doTextLogging(variables.logComponent,logMethod,variables.logApp,logMsg,logData);
logMsg = 'request.user: ';
logData = request.user;
application.ptprofile.log.doTextLogging(variables.logComponent,logMethod,variables.logApp,logMsg,logData);
}
// Add results to Profiles.log
logMethodAlt = logMethod & ': handleProfileDelete';
application.ptProfile.utils.logAppend("#variables.logComponent# - Method: #logMethodAlt# - UserID: #arguments.userid# - DataPageID: #arguments.dataPageID# - Profile Removed: #delStatus# - @ #now()#",logFile);
// Logout (not used... logs out everybody)
// application.ADF.ccapi.logout();
}
catch (any expt)
{
if ( NOT StructKeyExists(request,"removeProfileError") )
{
application.ptProfile.utils.logAppend("#variables.logComponent# - Method: #logMethod# - UserID: #arguments.userid# - DataPageID: #arguments.dataPageID# - Error: Profile Remove Failed - @ #now()#",logErrorFile);
application.ptProfile.utils.logAppend(cfcatch,logErrorFile);
request.removeProfileError = true;
}
}
}
if ( delStatus EQ true OR FindNoCase('success',delStatus) OR FindNoCase('No profile record was found',delStatus) )
{
// If handleProfileDelete() is successful, run the afterHandleProfileDelete()
postDelStatus = afterHandleProfileDelete(userID=arguments.userID,status=true);
if ( variables.enableDebugLogging )
{
logMsg = 'afterHandleProfileDelete: ';
logData = postDelStatus;
application.ptprofile.log.doTextLogging(variables.logComponent,logMethod,variables.logApp,logMsg,logData);
}
logMethodAlt = logMethod & ': afterHandleProfileDelete';
application.ptProfile.utils.logAppend("#variables.logComponent# - Method: #logMethodAlt# - UserID: #arguments.userid# - DataPageID: #arguments.dataPageID# - Profile Sync Record Removed: #postDelStatus.status# - @ #now()#",logFile);
}
var retQry = QueryNew('userid,datapageid');
var enableOneWaySync = getOneWaySyncStatus(); // true = removes profiles from CS - "one-way sync" (not just an "import" of the external data)
if ( enableOneWaySync )
{
// Get Sync Records to drop
retQry = application.ptProfile.profileSync.getSyncProfileQryForDrop();
}
return retQry;
var retData = StructNew();
var enableOneWaySync = getOneWaySyncStatus(); // true = removes profiles from CS - "one-way sync" (not just an "import" of the external data)
// Do Not delete Sync record unless the specified profile page was successfully deleted
if ( arguments.status EQ true )
{
if ( enableOneWaySync )
{
// Delete the Sync Table Records(s) for the specific page
retData = application.ptProfile.profileSync.deleteSyncRecordByPageID(pageid=arguments.pageid);
}
// TODO: Add Page Delete / Sync Record Success Logging
}
return retData;
var retData = StructNew();
var enableOneWaySync = getOneWaySyncStatus(); // true = removes profiles from CS - "one-way sync" (not just an "import" of the external data)
// Do Not delete Sync record unless the Profile was successfully deleted
if ( arguments.status EQ true )
{
if ( enableOneWaySync )
{
// Delete the Sync Table Records(s) for the specific user
retData = application.ptProfile.profileSync.deleteSyncRecordByUserID(userid=arguments.userid);
// TODO: Add Profile Delete / Sync Record(s) Success Logging
}
}
return retData;
var retData = StructNew();
/*
* CUSTOMIZE AT THE SITE LEVEL
*/
return retData;
/*
* CUSTOMIZE AT THE SITE LEVEL
*/
var retStr = '';
var profileCE = getProfileCEName();
var profileIDField = getProfileIdField();
var pageNameField = getPageNameField();
var profileData = '';
var profileDataValues = StructNew();
// check if we are using the DEFAULT field
if ( pageNameField EQ "userid" )
retStr = arguments.userid;
else
{
profileData = application.ptProfile.profileDAO.getDataValues(profileCE, profileIDField, arguments.userid, "");
profileDataValues = profileData.values;
if ( StructKeyExists(profileDataValues,pageNameField) )
retStr = profileDataValues[pageNameField];
// Special Exception for the Email field
if ( FindNoCase("email",pageNameField) )
retStr = ListFirst(retStr,"@");
}
retStr = application.ptProfile.csData.buildCSPageName(contentTitle=retStr);
return TRIM(retStr);
var retStr = '';
var profileCE = getProfileCEName();
var profileIDField = getProfileIdField();
var profileData = '';
var profileDataValues = StructNew();
profileData = application.ptProfile.profileDAO.getDataValues(profileCE, profileIDField, arguments.userid, "");
profileDataValues = profileData.values;
if ( LEN(profileDataValues.firstName) OR LEN(profileDataValues.lastName) )
{
retStr = profileDataValues.firstName & " " & profileDataValues.lastName;
retStr = "Profile " & TRIM(retStr);
}
else
retStr = "Profile " & arguments.userid;
return TRIM(retStr);;
var retStr = '';
var profileCE = getProfileCEName();
var profileIDField = getProfileIdField();
var profileData = '';
var profileDataValues = StructNew();
// IF CUSTOMIZING AT THE SITE LEVEL -- Uncomment to use info from the Profile data to build the description
//profileData = application.ptProfile.profileDAO.getDataValues(profileCE, profileIDField, arguments.userid, "");
//profileDataValues = profileData.values;
retStr = arguments.profileType & " Profile Page";
return TRIM(retStr);