It will be that somebody knows with I obtains to capture the last register registered in cadastre in some 0 variable.
Hi, What I'd really like to do is have inline content-management. I don't know if I'm completely up the wrong tree, and some advice would be much appreciated. My reason: Correct me if I'm wrong, but the zope security model does not allow me exclude an authenticated user from knowing that an application-logic object (e.g. 'view_status') exists, when she's in the 'manage' interface. This means she gets to see lots of horrible things which it would be better to hide from her. Apart from that, the whole interface-skinning project doesn't seem to have happened yet, and I think the present interface is a bit ugly. My strategy: Each element that I want the user to be able to edit is a ZClass with a manage_content method. This provides the custom management view (e.g. combines properties and title/data into a single form). Now I want a way to give the user access to this screen. I could do a new version of the folders tree view (manage_menu), but what I'd really like to do is have a button next to each of these elements ("edit this") which calls its manage_content method. The button would only appear when the user was authenticated / authorised. My problem: The only place I can think of doing this is in each object's __str__ method. But AFAIK there's no convenient way of overriding its default behaviour. What I'd like to do is override it in the ZClass views interface. I can override the 'View' method (from the ZClass 'views' tab), but that doesn't get called in the course of rendering a component in a page. The problem would seem to be that there's no equivalent of the __str__ method available to override... Or is there? Otherwise, I suppose I'd have to edit each object type's __str__ method directly. Or patch the publishing mechanism, but I've not had the guts to look at that yet. yuk. I'd rather not. Can anyone shed any light? Cheers, seb
Seb Bacon wrote:
My strategy: Each element that I want the user to be able to edit is a ZClass with a manage_content method. This provides the custom management view (e.g. combines properties and title/data into a single form). Now I want a way to give the user access to this screen. I could do a new version of the folders tree view (manage_menu), but what I'd really like to do is have a button next to each of these elements ("edit this") which calls its manage_content method. The button would only appear when the user was authenticated / authorised.
My problem: The only place I can think of doing this is in each object's __str__ method. But AFAIK there's no convenient way of overriding its default behaviour. What I'd like to do is override it in the ZClass views interface. I can override the 'View' method (from the ZClass 'views' tab), but that doesn't get called in the course of rendering a component in a page. The problem would seem to be that there's no equivalent of the __str__ method available to override... Or is there?
Either I don't understand the problem or you're making it too complicated. <g> You have a form to edit the properties. ... <input type="text" name="last_name" value="&dtml-last_name;"> ... The action method of this form sets the REQUEST variables to the property names: ... <dtml-call "REQUEST.set('last_name', REQUEST['last_name'])"> ... (I generally use the same names for form vars and property names to avoid confusing myself) then: <dtml-call "manage_changeProperties(REQUEST)"> Does this help? -- Tim Cook -- Cook Information Systems | Office: (901) 884-4126 8am-5pm CDT * It's easy to stop making mistakes. Just stop having ideas. * FreePM Project Coordinator http://www.freepm.org OSHCA Founding Supporter http://www.oshca.org
Thanks for the reply,
Either I don't understand the problem or you're making it too complicated. <g>
I think both, but mostly the latter ;) Explanation MK II: I know how to create a form that does what I want (update properties, whatever). What I don't know is how to include it as part of the rendered content programmatically. At the moment users have to go to www.widgets.com/manage_content, log in, and see a set of forms loosely based on the Zope manage interface. Instead, I'd like them to go to the same url, and see exactly the same website as someone who's not logged in, except they have these lovely little "edit this" buttons next to each editable content element (by which I mean image, text snippet, etc). Now I *could* do a <dtml-if "AUTHENTICATED_USER.has_role('content manager')"> <a href="edit_this">edit this</a> </dtml-if> in each content element. But I'd much rather be able to subclass or mixin an 'editable' class for each content element in question. The question is, what methods should I be providing to manipulate how the content is rendered? For example, I can provide a new 'view' method in the 'views' tab for a ZClass, but this does not get called when an object is rendered as part of another document. The reason I was going on about __str__ is because that seems to be the only place that you can interfere with how the content is rendered inline? Hope that's clearer, seb.
You have a form to edit the properties. ... <input type="text" name="last_name" value="&dtml-last_name;"> ...
The action method of this form sets the REQUEST variables to the property names: ... <dtml-call "REQUEST.set('last_name', REQUEST['last_name'])"> ... (I generally use the same names for form vars and property names to avoid confusing myself)
then: <dtml-call "manage_changeProperties(REQUEST)">
Does this help?
Seb Bacon wrote:
My strategy: Each element that I want the user to be able to edit is a ZClass with a manage_content method. This provides the custom management view (e.g. combines properties and title/data into a single form). Now I want a way to give the user access to this screen. I could do a new version of the folders tree view (manage_menu), but what I'd really like to do is have a button next to each of these elements ("edit this") which calls its manage_content method. The button would only appear when the user was authenticated / authorised.
My problem: The only place I can think of doing this is in each object's __str__ method. But AFAIK there's no convenient way of overriding its default behaviour. What I'd like to do is override it in the ZClass views interface. I can override the 'View' method (from the ZClass 'views' tab), but that doesn't get called in the course of rendering a component in a page. The problem would seem to be that there's no equivalent of the __str__ method available to override... Or is there?
so if i'm not mistaken you want to be able to include an object instance with say <dtml-var myinstance> and, depending on the user being authenticated, have that object render with "edit this" button or without? overriding the __str__ method can afaik only be done inside a python product (read the python product tutorial) you could use lalo's "Renderable Base ZClass" product or call your instance like so: <dtml-with myinstance> <dtml-var method_that_renders_myinstance> </dtml-with> (or call it <dtml-var "myinstance.method_that_renders_myinstance(_.None,_)">) and in the "method_that_renders_myinstance" you'd render those "edit" buttons only if theres the correct role in AUTHENTICATED_USER hth peter sabaini. On Mon, 9 Oct 2000, Seb Bacon wrote: :Thanks for the reply, : :> Either I don't understand the problem or you're making it too :> complicated. <g> : :I think both, but mostly the latter ;) : :Explanation MK II: : :I know how to create a form that does what I want (update properties, :whatever). What I don't know is how to include it as part of the rendered :content programmatically. At the moment users have to go to :www.widgets.com/manage_content, log in, and see a set of forms loosely based :on the Zope manage interface. Instead, I'd like them to go to the same url, :and see exactly the same website as someone who's not logged in, except they :have these lovely little "edit this" buttons next to each editable content :element (by which I mean image, text snippet, etc). : :Now I *could* do a : : <dtml-if "AUTHENTICATED_USER.has_role('content manager')"> : <a href="edit_this">edit this</a> : </dtml-if> : :in each content element. But I'd much rather be able to subclass or mixin an :'editable' class for each content element in question. The question is, :what methods should I be providing to manipulate how the content is :rendered? For example, I can provide a new 'view' method in the 'views' tab :for a ZClass, but this does not get called when an object is rendered as :part of another document. The reason I was going on about __str__ is :because that seems to be the only place that you can interfere with how the :content is rendered inline? : :Hope that's clearer, : :seb. : : : : : :> :> You have a form to edit the properties. :> ... :> <input type="text" name="last_name" value="&dtml-last_name;"> :> ... :> :> The action method of this form sets the REQUEST variables to the :> property names: :> ... :> <dtml-call "REQUEST.set('last_name', REQUEST['last_name'])"> :> ... :> (I generally use the same names for form vars and property names :> to avoid confusing myself) :> :> then: :> <dtml-call "manage_changeProperties(REQUEST)"> :> :> Does this help? :> > :> :> Seb Bacon wrote: :> :> > My strategy: :> > Each element that I want the user to be able to edit is a ZClass with a :> > manage_content method. This provides the custom management view (e.g. :> > combines properties and title/data into a single form). :> > Now I want a way to give the user access to this screen. I :> could do a new :> > version of the folders tree view (manage_menu), but what I'd :> really like to :> > do is have a button next to each of these elements ("edit :> this") which calls :> > its manage_content method. The button would only appear when :> the user was :> > authenticated / authorised. :> > :> > My problem: :> > The only place I can think of doing this is in each object's :> __str__ method. :> > But AFAIK there's no convenient way of overriding its default behaviour. :> > What I'd like to do is override it in the ZClass views interface. I can :> > override the 'View' method (from the ZClass 'views' tab), but :> that doesn't :> > get called in the course of rendering a component in a page. :> The problem :> > would seem to be that there's no equivalent of the __str__ :> method available :> > to override... Or is there? : : :_______________________________________________ :Zope maillist - Zope@zope.org :http://lists.zope.org/mailman/listinfo/zope :** No cross posts or HTML encoding! ** :(Related lists - : http://lists.zope.org/mailman/listinfo/zope-announce : http://lists.zope.org/mailman/listinfo/zope-dev ) : -- _________________________________________________ peter sabaini, mailto: sabaini@niil.at -------------------------------------------------
participants (4)
-
Joaldo Junior -
Peter Sabaini -
Seb Bacon -
Tim Cook