var verify = StructNew(); var pageName = ""; var pageTitle = ""; var pageDesc = ""; var templateID = 0; var subsiteID = 0; var pageCreateRes = StructNew(); var pageCreateID = 0; var profileObj = server.ADF.objectFactory.getBean("profile").initProfile(arguments.userid); var profileRoles = profileObj.getRoles(); var profileSiteVars = profileObj.getSiteVars(); var profileDataValues = profileObj.getDataValues(); var profileUserID = profileObj.getProfileUserID(); // Rip out any unfriendly strings var regEx = "[^a-zA-Z0-9 ]"; // Create only the single role profile page // Verify that the role argument exists and user has permissions verify = verifyRoleData(arguments.profileType, profileSiteVars, profileRoles); if ( verify.errorFlag EQ false ) { // Make the page name safe for CS pageName = application.ptProfile.csData.buildCSPageName(contentTitle=profileUserID); if ( LEN(profileDataValues.firstName) OR LEN(profileDataValues.lastName) ) pageTitle = "Profile " & profileDataValues.firstName & " " & profileDataValues.lastName; else pageTitle = "Profile " & arguments.userid; // Replacement of other bad strings from the page title pageTitle = REReplaceNoCase(pageTitle, regEx, "", "all"); pageDesc = arguments.profileType & " Profile Page"; subsiteID = server.ADF.environment[request.site.id].ptProfile.roles["#UCASE(arguments.profileType)#"].SUBSITE_ID; templateID = server.ADF.environment[request.site.id].ptProfile.roles["#UCASE(arguments.profileType)#"].TEMPLATE_ID; pageCreateRes = handlePageCreate(pageName, templateID, subsiteID, pageTitle, pageDesc, arguments.profileType, profileDataValues.uniqueID); // verify we get the pageid back if ( pageCreateRes.pageCreated ) pageCreateID = pageCreateRes.newpageid; } var retStruct = StructNew(); retStruct.errorFlag = false; retStruct.errorMsg = ""; // Verify that the role argument exists and user has permissions if ( NOT StructKeyExists(arguments.profileRoles,"#UCASE(arguments.profileType)#") ) { // Handle error for profile type not exists retStruct.errorFlag = true; retStruct.errorMsg = "Profile Page Creation Error: Profile type does not exist."; return retStruct; } else if ( arguments.profileRoles["#UCASE(arguments.profileType)#"].permission NEQ true ) { // Handle error for profile user doesn't have permissions. retStruct.errorFlag = true; retStruct.errorMsg = "Profile Page Creation Error: Profile user does not have permissions."; return retStruct; } // Verify the subsite has been defined for the role if ( NOT StructKeyExists(arguments.profileSiteVars.roles[arguments.profileType], "SUBSITE_ID") ) { // Handle error for profile role subsite id is not defined in the site config. retStruct.errorFlag = true; retStruct.errorMsg = "Profile Page Creation Error: Profile role subsite id is not defined in the site config."; return retStruct; } else if ( arguments.profileSiteVars.roles[arguments.profileType].SUBSITE_ID LTE 0 ) { // Handle error for profile role subsite id is not valid. retStruct.errorFlag = true; retStruct.errorMsg = "Profile Page Creation Error: Profile role subsite id is not valid in site config."; return retStruct; } // Verify the template id has been defined for the role if ( NOT StructKeyExists(arguments.profileSiteVars.roles[arguments.profileType], "TEMPLATE_ID") ) { // Handle error for profile role template id is not defined in the site config. retStruct.errorFlag = true; retStruct.errorMsg = "Profile Page Creation Error: Profile role template id is not defined in the site config."; return retStruct; } else if ( arguments.profileSiteVars.roles[arguments.profileType].TEMPLATE_ID LTE 0 ) { // Handle error for profile role subsite id is not valid. retStruct.errorFlag = true; retStruct.errorMsg = "Profile Page Creation Error: Profile role template id is not valid in site config."; return retStruct; } return retStruct; var csPage = ""; var stdMetadata = structNew(); var custMetadata = structNew(); var pageResult = StructNew(); var defaultCat = 0; select ID from generalCategories where categoryTypeID = 1 and isActive=1 and isDefault=1 // build metadata stdMetadata.name = arguments.pageName; stdMetadata.title = arguments.pageTitle; stdMetadata.description = arguments.pageDesc; stdMetadata.templateID = arguments.templateID; stdMetadata.subsiteID = arguments.subsiteID; stdMetadata.includeInIndex = "1,8"; stdMetadata.caption = arguments.pageTitle; stdMetadata.publicationDate = dateformat(now(), "yyyy-mm-dd") & " " & timeformat(now(),"HH:mm:ss"); stdMetadata.categoryid = defaultCat; // Get the custom metadata from the template (fix for CS CCAPI custom metadata inheritance issue) custMetadata = application.ptProfile.csData.getCustomMetadata(pageid=stdMetadata.templateID,convertTaxonomyTermsToIDs=1); /* Build the Custom Metadata the CS version*/ custMetadata['Profiles'] = structNew(); custMetadata['Profiles']['type'] = arguments.profileType; custMetadata['Profiles']['userid'] = arguments.pageName; custMetadata['Profiles']['uniqueID'] = arguments.profileUUID; // Call the CCAPI to build the page pageResult = application.ptProfile.profileDAO.profilePageCreateCCAPI(stdMetadata, custMetadata); // Create the page var pageResult = application.ptProfile.csContent.populateContent("profile", arguments.dataValues); // Get the profile object var profileObj = server.ADF.objectFactory.getBean("profile").initProfile(arguments.userid); var profileRoles = profileObj.getRoles(); var roleKey = StructKeyList(profileRoles); var i = 1; var retProfCreated = "false"; // Return variable // 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 LTE 0 ){ // Call the page creation function pageID = createProfilePage(arguments.userid, ListGetAt(roleKey,i)); // Store this back in the return variable retProfCreated = "true"; } } } var retStatus = "true"; // Return variable var ccapiResult = StructNew(); // Get the profile object var profileObj = server.ADF.objectFactory.getBean("profile").initProfile(arguments.userid); var profileRoles = profileObj.getRoles(); var roleKey = StructKeyList(profileRoles); var itmKey = ""; var sparams = StructNew(); var i = 1; var siteVars = server.ADF.environment[request.site.id].ptProfile; // Loop over the role struct for ( i = 1; i LTE ListLen(roleKey); i = i + 1 ) { // Continue if we have not had an error if ( retStatus EQ "true" ) { itmKey = ListGetAt(roleKey, i); // Check the role permissions if ( profileRoles[itmKey].permission ) { // Check if any page has been created yet if ( profileRoles[itmKey].pageID GT 0 ) { // Load the sparams sparams.pageid = profileRoles[itmKey].pageID; sparams.subsiteid = siteVars.roles[itmKey].SUBSITE_ID; // Call the page deletion function ccapiResult = application.ptProfile.profileDAO.profilePageDeleteCCAPI(sparams); // Set the status from the delete page if ( ccapiResult.pageDeleted ) retStatus = "true"; else retStatus = "false"; } } } } return retStatus; var retStatus = ""; var profStatus = StructNew(); var pageStatus = ""; // Get the profile obj var profileObj = server.ADF.objectFactory.getBean("profile").initProfile(arguments.dataValues.userid); var profileCEPageID = profileObj.GetProfileCEDataPageID(); // Check if a profile record page id already exists if ( profileCEPageID GT 0 ) arguments.dataValues.dataPageID = profileCEPageID; // Create the profile record profStatus = handleProfileRecordCreate(arguments.dataValues); retStatus = profStatus.contentUpdated; // Create the profile pages pageStatus = verifyPageCreateRoles(arguments.dataValues.userid); SELECT * FROM profile_import WHERE userid = ORDER BY userid var sParams = StructNew(); var retStruct = structNew(); var profileData = ""; var logFile = ""; // check that we got a valid userid if (LEN(arguments.userid)) { // if dataPageID is NOT defined then check if the record exists by "userid" if (arguments.dataPageID LTE 0){ // Check with CEData if we just didn't pass in the datapageid profileData = application.ptProfile.profileDAO.getProfileData(fieldName="userid", fieldVal=arguments.userid); // Check the return if ( arrayLen(profileData) ) arguments.dataPageID = profileData[1].pageID; } // build the ccapi param struct sParams = buildCCAPIParams(arguments.userid, arguments.dataPageID); // Set a flag for if the content was updated retStruct.profileUpdated = sParams.tempUpdateReq; //if (sParams.error eq false) if ( LEN(sParams.userid) ) { // if dataPageID is defined then we are doing an update if (arguments.dataPageID GT 0) sParams["dataPageID"] = arguments.dataPageID; //application.ADF.utils.dodump(sParams, "sParams", false); // Check the return "tempUpdateReq" exists and is T/F if ( structKeyExists(sParams, "tempUpdateReq") AND sParams.tempUpdateReq ) { // Call the Auto Create Profile function to handle all the CCAPI work pageID = autoCreateProfile(sParams); } else { sParams['tempUpdateReq'] = false; } retStruct.error = false; // Check if the struct fields exist for lastname if ( (StructKeyExists(sParams, "lastname")) ) retStruct.lastname = sParams["lastname"]; else retStruct.lastname = ""; // Check if the struct fields exist for firstname if ( (StructKeyExists(sParams, "firstname")) ) retStruct.firstname = sParams["firstname"]; else retStruct.firstname = ""; logFile = "#DateFormat(now(),'YYYYMMDD')#.Profiles.log"; application.ptProfile.utils.logAppend("Profile Utils - Method: populateProfileFromExternalData - UserID: #arguments.userid# - PageID: #arguments.dataPageID# - ProfileUpdated: #sParams.tempUpdateReq# - @ #now()#",logFile); return retStruct; } else { // Set the return struct retStruct.error = true; retStruct.errorMsg = "No userid record in external datasource."; return retStruct; } } else { logFile = "#DateFormat(now(),'YYYYMMDD')#.Profiles.log"; application.ptProfile.utils.logAppend("Profile Utils - Method: populateProfileFromExternalData - Error: UserID argument is blank - UserID: #arguments.userid# - PageID: #arguments.dataPageID# - LoggedInUser: #session.user.userid# - @ #now()#",logFile); // Set the return struct retStruct.error = true; retStruct.errorMsg = "UserID argument is blank."; return retStruct; } var ccData = StructNew(); var extData = QueryNew("temp"); var erpError = false; var erpErrorMsg = ""; var updateReq = false; // get the profile object for the user profileObj = server.ADF.objectFactory.getBean('profile').initProfile(arguments.userid); // load the current profile data into the ccdata struct ccData = profileObj.getDataValues(); // Get the external data for the userid extData = getExternalProfileData(arguments.userid); // Get the keylist if ( isQuery(extData) ){ //extElementFields = arrayToList(extData.getMetaData().getColumnLabels()); // 2012-11-21 - Fix for RAILO to get the nquery column names. extElementFields = arrayToList(extData.GetColumnNames()); } // Loop over the external data and load into ccData for (i=1; i LTE ListLen(extElementFields); i=i+1) { currKey = ListGetAt(extElementFields,i); if ( StructKeyExists(ccData, "#currKey#") ) { // Check if any difference in the fields // 2012-12-18 - MFC - Updated to TRIM the values if ( TRIM(extData[currKey][1]) NEQ TRIM(ccData[currKey]) ) updateReq = true; // Set the field into the main data struct // 2012-11-21 - Added TRIM to prevent whitespace from the external data values. ccData[currKey] = TRIM(extData[currKey][1]); } } // Set the update required into the element data as a temp variable ccData['tempUpdateReq'] = updateReq; // check that a profile uuid exists, if not we are creating the element instance if ( (NOT StructKeyExists(ccData, "uniqueID")) OR (LEN(ccData["uniqueID"]) LTE 0) ) ccData["uniqueID"] = createUUID(); // set the error flags into the return struct //ccData.error = erpError; //ccData.errorMsg = erpErrorMsg; return ccData; var retHTML = ""; var userIDVal = URLDecode(arguments.userID); var roleVal = URLDecode(arguments.Role); var lbActionVal = URLDecode(arguments.lbAction);

Create Profile Pages

application.ptProfile.scripts.loadJQuery(); // Create the page pageIDResult = createProfilePage(userIDVal, roleVal);
Page Created Successfully!

Click Here to close this window.
Page Creation Failed!

Click Here to close this window.

Please login to manage your profile.


Problem occurred with the Profile Application.

Please contact your administrator.
var retHtml = ""; var loggedInUserID = request.user.userid; var profileObj = ""; var profileRoles = StructNew(); var profileElementData = StructNew(); var profileSiteVars = StructNew(); var roleKey = ""; var i = 1; // Check if the User is Logged In if ( loggedInUserID NEQ "anonymous" ){ // load the logged in users profile obj profileObj = server.ADF.objectFactory.getBean("profile").initProfile(loggedInUserID); profileRoles = profileObj.getRoles(); roleKey = StructKeyList(profileRoles); profileSiteVars = profileObj.getSiteVars(); profileElementData = profileObj.getElementData(); configStruct = application.ptProfile.getAppConfig(); // Check that name is valid in the profile retHTML = ""; retHTML = retHTML & "
"; 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 = "
Login to Edit Your Profile
"; } 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 **/