extending dmProfile problem

4 views
Skip to first unread message

smika

unread,
Jul 1, 2009, 5:59:17 AM7/1/09
to farcry-dev
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

smika

unread,
Jul 1, 2009, 6:06:00 AM7/1/09
to farcry-dev
Just forget to add, that removing or adding properties reflects in
type admin, but never appears in webtop.

Tomek Kott

unread,
Jul 1, 2009, 1:00:36 PM7/1/09
to farcr...@googlegroups.com
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

smika

unread,
Jul 1, 2009, 3:41:38 PM7/1/09
to farcry-dev
Hi Tomek,

Thanks for response!

I've fixed that ftseq="27" issue. It doesnt help. Yes, code was
working in 5.1.0. When i am deleting extended properties (readding
them) through types menu under Admin tab, it shows them, deleting
them, deplying them. Even when i am try ing to scaffold them, they are
there. But even after scaffold, when i am trying to view or edit
specific item in Users section or scaffolded Profiles section it shows
everything except newly created properties.
Moreover now when i am logging in and viewing website in admin mode it
does not showing tray. I dont know what to do.

Thanks,
Mika

On Jul 1, 10:00 pm, Tomek Kott <tkott.s...@gmail.com> wrote:
> 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
>
> ...
>
> read more »

smika

unread,
Jul 1, 2009, 4:18:56 PM7/1/09
to farcry-dev
I've downgrade it to 5.1.0 custom type is working, but tray is not
loading :(...
> ...
>
> read more »

smika

unread,
Jul 2, 2009, 2:13:33 AM7/2/09
to farcry-dev
Also just mentioned that code:
<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="28" ftFieldset="State" name="state" type="string"
required="no" hint="State of location" ftLabel="State of location"
ftType="state" ftCountries="US,CA,AM" default="" />

produces no error in 5.1.6 and creates interdependant drop-downs,
while in 5.1.0 it gives stmetadata undefined error.
> ...
>
> read more »

Blair McKenzie

unread,
Jul 2, 2009, 2:33:35 AM7/2/09
to farcr...@googlegroups.com
That definitely sounds like a bug. Could you log a ticket for this?

Blair
Reply all
Reply to author
Forward
0 new messages