Re: Custom Component Problems
Re: Custom Component Problems
- Subject: Re: Custom Component Problems
- From: "Jorge Ramirez" <email@hidden>
- Date: Mon, 19 Mar 2007 16:07:33 -0400
Sure, i have an example below:
I have an editUser page. That page has a spot for editing the user's first name, last name, etc...
Each of the textfields for editing the user's attributes (first name, last name, etc..) are wrapped in a PermissionComponent (the component mentioned before). The bindings are listed below for the firstNamePermissionComponent, which wraps the firstNameTextField.
firstNamePermissionComponent : PermissionComponent
{
readPermissionName = "User.readFirstName";
writePermissionName = "User.readWriteName";
record = user;
value = user.firstName
;
}
firstNameTextField : WOTextField
{
value = user.firstName;
}
Then the PermssionComponent calls the PermissionManager, determines weather the currently logged in user has the given permissions, and then determines weather to show a permissioned denied string, a string with the value of the 'value' binding, or a component content (in this case the content would be the textfield). The component is currently synchronizing right now. I wasn't sure if it should be or not.
On 3/19/07, Chuck Hill <email@hidden> wrote:
On Mar 19, 2007, at 12:10 PM, Jorge Ramirez wrote:
> Hello, i am having a problem creating a custom re-usable
> component. I am fairly new to WebObjects, so forgive me if i am
> going about this all wrong. The problem is as follows:
>
> I have groups, users and permissions in my application. The users
> are members of groups and the groups get assigned permissions.
>
> I want to be able to, based on weather the user has read/read and
> write/no permission on an object's attributes, display one of the
> following:
> a string (if the user has read only access)
> a textfield/popupmenu/etc... (if the user has read and write access)
> a permission denied string (if the user does not have permission)
>
> I have created a component with the following bindings:
> readPermissionName (the name of the permission required to have
> read access for the attribute on the given object)
> writePermissionName (the name of the permission required to have
> write access for the attribute on the given object)
> record (the record in question)
> value (the string value of the attribute)
Can you give an example of this binding?
> the component then either displays:
> a permission denied string if the user does not have permission
> a string with the string value of the attribute if the user has
> read only access
> or a component content if the user has read and write access (in
> the component that would use this component, i would put a
> textfield, or popup menu in the component content area)
>
> It appears to work in the way that it displays either a string, a
> permission denied string, or whatever i put in the componentcontent
> area. The problem i am having is when i want to save the value of
> lets say a textfield in the read/write component content area. The
> value is not getting pushed back to the object when i call
> saveChanges();
>
> I think it might have something to do with the caret symbol, but i
> have never been too clear on when to use that and when not to use
> that. Does anyone have any ideas?
Is the component non-synchronizing (with its bindings) or stateless?
Chuck
--
Practical WebObjects - for developers who want to increase their
overall knowledge of WebObjects or who are trying to solve specific
problems.
http://www.global-village.net/products/practical_webobjects
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden