[Hippo-cms7-user] Read-only fields in templates

nvankampenhout nvankampenhout at yahoo.co.uk
Wed Nov 25 15:31:20 CET 2009



Frank van Lankvelt wrote:
> 
> Hmm, interesting.  Actually, there shouldn't be a checkbox at all, right?
>  You're already telling the repository that there is a derived data
> function
> that computes the value.  So, there should be no need to tell it again in
> the template builder.
> 
> I think that I would implement it as a isDerived() method on the
> IFieldDescriptor.  Behind the scenes, it should look at the applicable
> derived data definitions, either by asking the derived data engine
> directly
> (this would imply a change in the repository API) or by traversing the
> list
> of derived data definitions directly.  (probably extracting this
> functionality to a separate service to keep the field descriptor
> implementations clean)
> 
> The field plugin that instantiates the template that displays the value
> can
> then use the isDerived() to decide whether the template should be
> read-only
> or read/write.
> 

I went with a very simple "ReadOnlyPlugin" that just adds a label, like
other plugins do in non-edit mode, only this one does it regardless of edit
or non-edit mode.

Only took 5 minutes and works like a charm :-)

Niels
-- 
View this message in context: http://n2.nabble.com/Read-only-fields-in-templates-tp4063923p4065256.html
Sent from the Document Types mailing list archive at Nabble.com.



More information about the Hippo-cms7-user mailing list