« Return to Thread: extending dmProfile problem

Re: extending dmProfile problem

by Tomek Kott :: Rate this Message:

Reply to Author | View in Thread

Couple questions to track things down:

1) This exact code worked in 5.1.0, correct?
2) I wonder if the ftSeq="27" which happens for two properties, is messing things up
3) Do any of the functions work separately (e.g., if you only put one in?)
4) When you say it doesn't appear in the webtop, do you mean in the object admin list view? Or when viewing a specific object?

My first inclination would be to fix the ftSeq, that could be messing things up especially with those being ajaxed views.

Tomek

On Wed, Jul 1, 2009 at 6:06 AM, smika <shahinyan@...> wrote:

Just forget to add, that removing or adding properties reflects in
type admin, but never appears in webtop.


On Jul 1, 2:59 pm, smika <shahin...@...> wrote:
> I've upgrade core from 5.1.0 to 5.1.6. I had there piece of code which
> was working fine under 5.1.0:
>
> <cfcomponent displayName="Profile"
> extends="farcry.core.packages.types.dmProfile" hint="FarCry User
> Profile for managing persons (user, staff member, authors, etc)"
> bfriendly="1">
>
> <cfproperty ftSeq="5"  ftFieldSet="Staff member" name="title"
> required="true" hint="Title of employee" ftLabel="Title"
> type="nstring" />
> <cfproperty ftSeq="6"  ftFieldset="Bio" name="bio" type="longchar"
> hint="Person bio" required="no" default="" ftLabel="Bio"
> ftType="richtext">
> <cfproperty ftSeq="7"  ftFieldset="Portrait" name="image" type="uuid"
> hint="UUID of image to display in bio" required="no" default=""
> ftJoin="dmImage" ftLibraryData="getTeaserImageLibraryData"
> ftLibraryDataTypename="dmHTML" ftlabel="Person image"/>
>
> <cfproperty ftSeq="27" ftFieldset="Country" name="country"
> type="string" required="no" hint="Country of location"
> ftLabel="Country" ftType="country" ftCommon="Armenia, United States of
> America"/>
>
> <cfproperty ftSeq="27"  ftFieldset="State" name="state" type="string"
> required="no" hint="State of location" ftLabel="State of location"
> ftType="state" ftCountries="US,CA,AM" default="" />
>
> <cfproperty ftSeq="28" name="zipcode" type="string" hint="Zip code."
> required="no" default="" ftLabel="Zip" ftFieldset="Zip code"/>
>
> <cfproperty ftSeq="29" ftFieldSet="Display" name="displayMethod"
> type="nstring" required="false" hint="Display method template"
> ftLabel="Display Method" ftType="webskin" ftprefix="displayPage" />
>
> <cfproperty ftSeq="90" name="fu" type="string" hint="Friendly URL for
> this node." required="no" default="" ftLabel="Friendly URL"
> ftFieldset="Friendly URL"/>
>  <cffunction name="createProfile" access="PUBLIC" hint="Create new
> profile object using existing dmSec information. Returns newly created
> profile as a struct." returntype="struct" output="true">
>         <cfargument name="stProperties" type="struct" required="yes" /
>
>
>
>                 <cfset var stProfile=duplicate(arguments.stProperties) />
>                 <cfset var stResult=structNew() />
>                 <cfset var stobj=structNew() />
>
>         <!--- if userlogin missing use user name (bwd compatability
> hack) --->
>                 <cfif not structkeyexists(stProfile,"username")>
>                         <cfset stProfile.username = stProfile.userlogin />
>                 </cfif>
>                 <cfif not structkeyexists(stProfile, "userdirectory") and find
> ("_",stProfile.username)>
>                         <cfset stProfile.userdirectory = listlast(stProfile.username,"_") /
>
>                 <cfelseif not structkeyexists(stProfile,"userdirectory")>
>                         <cfset stProfile.userdirectory = "CLIENTUD" />
>                 </cfif>
>                 <cfif not structkeyexists(stProfile,"userlogin")>
>                         <cfset stProfile.userlogin = stProfile.username />
>                 </cfif>
>
>                 <cfparam name="stProfile.objectID" default="#createUUID()#" />
>                 <cfparam name="stProfile.label" default="#stProfile.userLogin#" />
>
>                 <cfif structkeyexists(stProfile,"userlogin") and not refind
> (stProfile.userDirectory,stProfile.userlogin)>
>                         <cfset stProfile.userName = stProfile.userLogin & "_" &
> stProfile.userDirectory />
>                 <cfelseif structkeyexists(stProfile,"userlogin")>
>                         <cfset stProfile.userName = stProfile.userLogin />
>                 </cfif>
>
>                 <cfparam name="stProfile.emailAddress" default="" />
>                 <cfparam name="stProfile.bReceiveEmail" default="1" />
>                 <cfparam name="stProfile.bActive" default="1" />
>
>                 <cfparam name="stProfile.title" default="" />
>                 <cfparam name="stProfile.bio" default="" />
>                 <cfparam name="stProfile.image" default="" />
>         <cfparam name="displayMethod" default="" />
>
>                 <cfset stProfile.lastupdatedby = stProfile.userLogin />
>                 <cfset stProfile.datetimelastupdated = now() />
>                 <cfset stProfile.createdby = stProfile.userLogin />
>                 <cfset stProfile.datetimecreated = now() />
>
>                 <cfparam name="stProfile.locked" default="0" />
>                 <cfparam name="stProfile.lockedBy" default="" />
>
>                 <cfset stResult = createData(stProperties=stProfile,
> User=stProfile.username) />
>
>                 <cfif stResult.bSuccess>
>                         <cfreturn getProfile(userName=stProfile.username) />
>                 <cfelse>
>                         <cfreturn structnew() />
>                 </cfif>
>     </cffunction>
>
>     <cffunction name="edit" access="PUBLIC" hint="dmProifle edit
> handler">
>         <cfargument name="objectID" type="UUID" required="yes">
>         <cfscript>
>         // getData for object edit
>         stObj = this.getData(arguments.objectID);
>         </cfscript>
>         <cfinclude template="/farcry/projects/
> #application.applicationname#/webskin/dmProfile/editProfile.cfm" />
>     </cffunction>
>
>     <cffunction name="getProfile" access="PUBLIC" hint="Retrieve
> profile data for given username">
>         <cfargument name="userName" type="string" required="yes"
> hint="The username unique for the user directory.">
>         <cfargument name="ud" type="string" required="no"
> default="clientUD" hint="The user directory to search for the
> profile.">
>
>                 <cfset var stobj = structNew() />
>                 <cfset var combinedUsername = "#arguments.username#_#arguments.ud#" /
>
>
>
>                 <!--- Use the  --->
>                 <cfquery name="qProfile" datasource="#application.dsn#">
>                 SELECT objectID FROM #application.dbowner#dmProfile
>                 WHERE UPPER(userName) = '#UCase(combinedUsername)#'
>                 </cfquery>
>
>                 <cfif not qProfile.recordCount>
>                         <cfquery name="qProfile" datasource="#application.dsn#">
>                         SELECT objectID FROM #application.dbowner#dmProfile
>                         WHERE UPPER(userName) = '#UCase(arguments.userName)#'
>                         </cfquery>
>                 </cfif>
>
>                 <cfif qProfile.recordCount>
>                     <cfset stObj = this.getData(qProfile.objectID)>
>                     <cfset stObj.bInDB = "true">
>                 <cfelse>
>                     <cfscript>
>                     stObj = structNew();
>                     stObj.emailAddress = '';
>                     stObj.bReceiveEmail = 0;
>                     stObj.bActive = 0;
>                     stObj.locale = 'en_AU';
>                     stObj.bInDB = 'false';
>                     stObj.userName = arguments.userName;
>                     </cfscript>
>                 </cfif>
>
>         <cfreturn stObj>
>     </cffunction>
>
>     <cffunction name="getProfileData" access="public" output="false"
> hint="Return a query of all Profile instances for generic library
> interface.">
>                 <cfset var ProfileList="" />
>                 <cfquery datasource="#application.dsn#" name="qProfile">
>                 SELECT  firstName + ' '+ lastName as FullName, ObjectID,lastName
>                 FROM dmProfile
>         WHERE userDirectory = 'ClientUD'
>                 </cfquery>
>                 <cfset ProfileList = ValueList(qProfile.FullName, ",")>
>         <cfset ProfileList=ListInsertAt(ProfileList,"1","none")>
>                 <cfreturn ProfileList />
>         </cffunction>
>
>     <cffunction name="fListProfileByPermission" hint="returns a query
> of users" access="public" output="false" returntype="struct">
>                 <cfargument name="permissionName" required="false" default=""
> type="string">
>                 <cfargument name="permissionID" required="false" default=""
> type="string" hint="Deprecated">
>
>                 <cfset var stLocal = StructNew()>
>                 <cfset var stReturn = StructNew()>
>                 <cfset var lProfiles = "" />
>
>                 <!--- Get profiles --->
>                 <cfif len(arguments.permissionID)>
>                         <cfset arguments.permissionanme = arguments.permissionid />
>                 </cfif>
>                 <cfset lProfiles =
> application.security.factory.role.getAuthenticatedProfiles
> (roles=application.security.factory.role.getRolesWithPermission
> (permission=arguments.permissionname)) />
>
>                 <cfset stReturn.bSuccess = true>
>                 <cfset stReturn.message = "">
>
>                 <cfif len(lProfiles)>
>                         <cfquery datasource="#application.dsn#"
> name="stReturn.queryObject">
>                                 select          *
>                                 from            #application.dbowner#dmProfile
>                                 where           objectid in (<cfqueryparam cfsqltype="cf_sql_varchar"
> list="true" value="#lProfiles#" />)
>                         </cfquery>
>                 <cfelse>
>                         <cfset stResult.bSuccess = false />
>                 </cfif>
>
>                 <cfreturn stReturn>
>         </cffunction>
> </cfcomponent>
>
> What i am doing wrong?
>
> Thanks,
> Mika



--~--~---------~--~----~------------~-------~--~----~
You received this message cos you are subscribed to "farcry-dev" Google group.
To post, email: farcry-dev@...
To unsubscribe, email: farcry-dev+unsubscribe@...
For more options: http://groups.google.com/group/farcry-dev
--------------------------------
Follow us on Twitter: http://twitter.com/farcry
-~----------~----~----~----~------~----~------~--~---

 « Return to Thread: extending dmProfile problem