|
View:
New views
3 Messages
—
Rating Filter:
Alert me
|
|
|
Custom edit handler for extended dmProfile - error. FC 5.1.5Hi. I have extended dmprofile (via a plugin) to accept some additional properties. in myplugin/packages/types/dmprofile.cfc I have... <cfcomponent extends="farcry.core.packages.types.dmProfile" displayName="User Profile" hint="Every user in the system has their own profile from staff to community members. You can create new users, edit existing ones or change the group they belong to."> ... my new properites... The dmprofile type has been deployed... In myplugin/customadmin/customlists/dmProfile.cfm I tweaked the ftt:objectadmin to include some additional fields for listing and sorting and filtering. I modified the customadmin.xml in the plugin to overridethe webtop in myplugin/webskin/dmprifole/edit.cfc I have copied it exactly from core, but edited the view to be: <ft:form> <ft:object objectid="#stObj.objectid#" typename="dmProfile" lfields="company,address1,address2,city,state,region,country,postalcode,firstname,lastname,emailaddress,breceiveemail,phone,phone2,fax,url,overviewHome" lhiddenFields="userdirectory,position,department,locale" legend="User details" /> <cfif stObj.userdirectory eq "CLIENTUD" or stObj.userdirectory eq ""> <cfset userID = application.factory.oUtils.listSlice(stObj.username, 1,-2,"_") /> <cfset stUser = oUser.getByUserID(userID) /> <cfif structIsEmpty(stUser)> <skin:view key="newprofileuser" typename="farUser" webskin="editProfileUser" /> <cfelse> <ft:object stObject="#stUser#" typename="farUser" lfields="userstatus,aGroups" legend="Security" /> </cfif> </cfif> <ft:object objectid="#stObj.objectid#" typename="dmProfile" lfields="publicnotes,onWeb,territories,productlines,pricelists" legend="Sales Rep details" /> <ft:farcryButtonPanel> <ft:button value="Save" color="orange" /> <ft:button value="Cancel" validate="false" /> </ft:farcryButtonPanel> </ft:form> At this pouint everything seems to work as expected, however, when I go to edit an existing user (clientud) and save, an error is thrown "username is undefined in stProperties" on line 31 of the extended edit handler (this is the "action" section. If I remove my custom handler it works fine (but ofcouse my fields are not there) <!----------------------------- ACTION ------------------------------> <ft:serverSideValidation /> <ft:processform action="Save" exit="true"> <ft:processformobjects typename="farUser" lArrayListGenerate="lgroups" /> <!--- track whether we have saved a farUser record---> <cfset savedUserID = lsavedobjectids /> <ft:processformobjects typename="dmProfile"> <!--- We only check the profile/faruser relationship if we saved a CLIENTUD user ---> <cfif len(savedUserID)> <cfset stUser = oUser.getData(objectid=savedUserID) /> <!--- If the current username is not the same one we saved (ie. new user) ---> <cfif stProperties.username NEQ "#stUser.userid#_CLIENTUD"><!--- New user ---> <cfset stProperties.username = "#stUser.userid#_CLIENTUD" /> <cfset stProperties.userdirectory = "CLIENTUD" /> </cfif> </cfif> </ft:processformobjects> </ft:processform> Ideas? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: Custom edit handler for extended dmProfile - error. FC 5.1.5It looks like the section where the username is edited for a new user isn't being included in the form. You should check the various parts of that logic to see if something is screwing it up. e.g. if stUser is somehow returning a non-empty struct.
Blair On Thu, Jun 25, 2009 at 2:29 AM, Chris Roth <chris.roth@...> wrote:
--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: Custom edit handler for extended dmProfile - error. FC 5.1.5Blair, THANKS!, that is exactly what I needed. I have just looked at it too much, and did not notice I forgot to include username in the lhiddenFields below; <ft:object objectid="#stObj.objectid#" typename="dmProfile" lfields="company,address1,address2,city,state,region,country,postalcode,fir stname,lastname,emailaddress,breceiveemail,phone,phone2,fax,url,overviewHom e" lhiddenFields="userdirectory,position,department,locale" legend="User details" /> Adding it in solved the problem naturally. On Jun 24, 4:17 pm, Blair McKenzie <shi...@...> wrote: > It looks like the section where the username is edited for a new user isn't > being included in the form. You should check the various parts of that logic > to see if something is screwing it up. e.g. if stUser is somehow returning a > non-empty struct. > > Blair > > > > On Thu, Jun 25, 2009 at 2:29 AM, Chris Roth <chris.r...@...> wrote: > > > Hi. > > > I have extended dmprofile (via a plugin) to accept some additional > > properties. > > > in myplugin/packages/types/dmprofile.cfc I have... > > > <cfcomponent extends="farcry.core.packages.types.dmProfile" > > displayName="User Profile" hint="Every user in the system has their > > own profile from staff to community members. You can create new users, > > edit existing ones or change the group they belong to."> > > > ... my new properites... > > > The dmprofile type has been deployed... > > > In myplugin/customadmin/customlists/dmProfile.cfm I tweaked the > > ftt:objectadmin to include some additional fields for listing and > > sorting and filtering. I modified the customadmin.xml in the plugin to > > overridethe webtop > > > in myplugin/webskin/dmprifole/edit.cfc > > > I have copied it exactly from core, but edited the view to be: > > > <ft:form> > > > <ft:object objectid="#stObj.objectid#" typename="dmProfile" > > > lfields="company,address1,address2,city,state,region,country,postalcode,firstname,lastname,emailaddress,breceiveemail,phone,phone2,fax,url,overviewHome" > > lhiddenFields="userdirectory,position,department,locale" legend="User > > details" /> > > > <cfif stObj.userdirectory eq "CLIENTUD" or stObj.userdirectory eq > > ""> > > > <cfset userID = > > application.factory.oUtils.listSlice(stObj.username, > > 1,-2,"_") /> > > <cfset stUser = oUser.getByUserID(userID) /> > > > <cfif structIsEmpty(stUser)> > > <skin:view key="newprofileuser" typename="farUser" > > webskin="editProfileUser" /> > > <cfelse> > > <ft:object stObject="#stUser#" typename="farUser" > > lfields="userstatus,aGroups" legend="Security" /> > > </cfif> > > > </cfif> > > > <ft:object objectid="#stObj.objectid#" typename="dmProfile" > > lfields="publicnotes,onWeb,territories,productlines,pricelists" > > legend="Sales Rep details" /> > > > <ft:farcryButtonPanel> > > <ft:button value="Save" color="orange" /> > > <ft:button value="Cancel" validate="false" /> > > </ft:farcryButtonPanel> > > </ft:form> > > At this pouint everything seems to work as expected, however, when I > > go to edit an existing user (clientud) and save, an error is thrown > > "username is undefined in stProperties" on line 31 of the extended > > edit handler (this is the "action" section. If I remove my custom > > handler it works fine (but ofcouse my fields are not there) > > > <!----------------------------- > > ACTION > > ------------------------------> > > <ft:serverSideValidation /> > > > <ft:processform action="Save" exit="true"> > > <ft:processformobjects typename="farUser" > > lArrayListGenerate="lgroups" /> > > > <!--- track whether we have saved a farUser record---> > > <cfset savedUserID = lsavedobjectids /> > > > <ft:processformobjects typename="dmProfile"> > > > <!--- We only check the profile/faruser relationship if we > > saved a > > CLIENTUD user ---> > > <cfif len(savedUserID)> > > <cfset stUser = oUser.getData(objectid=savedUserID) > > /> > > > <!--- If the current username is not the same one we > > saved (ie. new > > user) ---> > > <cfif stProperties.username NEQ > > "#stUser.userid#_CLIENTUD"><!--- > > New user ---> > > <cfset stProperties.username = > > "#stUser.userid#_CLIENTUD" /> > > <cfset stProperties.userdirectory = > > "CLIENTUD" /> > > </cfif> > > </cfif> > > > </ft:processformobjects> > > </ft:processform> > > > Ideas?- Hide quoted text - > > - Show quoted text - 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 -~----------~----~----~----~------~----~------~--~--- |
| Free embeddable forum powered by Nabble | Forum Help |