I am just starting to play around with Zope, and one thing that I would like to do it to provide custom editing interfaces for a page. What I am thinking is (as an example) an article or paper that has say, a title, an abstract, a body and a few other components. I am thinking that DTML Documents are the way to go for these components. What I would like to do it put next to each section, an "edit" button, the onclick handler will set the content-editable proprety of the associated text block to true, and will reveal save and undo buttons. This, I have no trouble with, but what I cannot see how to do in Zope, is to have the save button post the new content to the DTML document that it belongs in. Is there a good solution to this? Thanks in advance, Simon
Simon wrote:
I am just starting to play around with Zope, and one thing that I would like to do it to provide custom editing interfaces for a page.
What I am thinking is (as an example) an article or paper that has say, a title, an abstract, a body and a few other components. I am thinking that DTML Documents are the way to go for these components.
What I would like to do it put next to each section, an "edit" button, the onclick handler will set the content-editable proprety of the associated text block to true, and will reveal save and undo buttons. This, I have no trouble with, but what I cannot see how to do in Zope, is to have the save button post the new content to the DTML document that it belongs in.
Is there a good solution to this?
Do you have different <form> sections in your editform, i guess you have for each submit button on action to process. Does your form use a PageTemplate or is it DTML? If it's a PageTemplate have you read the Form Processing section in http://www.zope.org/Documentation/Books/ZopeBook/current/AdvZPT.stx ? And please explain: Do you use one DTML document for abstract, one for body etc., it sounds like that for me. Or is it just metadata of one doc? Why not just use CMF? Too heavy maybe(?) I hope i could help a bit, Florian -- Florian Konnertz --- http://www.florian-konnertz.de http://openspirit.homelinux.net/noowiki/FrontPage ZWiki about all topics, especially consciousness research and wisdom traditions
Simon wrote:
What I am thinking is (as an example) an article or paper that has say, a title, an abstract, a body and a few other components. I am thinking that DTML Documents are the way to go for these components.
What makes you think that?
What I would like to do it put next to each section, an "edit" button, the onclick handler will set the content-editable proprety of the associated text block to true, and will reveal save and undo buttons. This, I have no trouble with, but what I cannot see how to do in Zope, is to have the save button post the new content to the DTML document that it belongs in.
Have a hidden form field of the document you want to edit. Post the form to a python script, which can use the hidden field to find the correct document to edit. cheers, Chris
I am trying to create a ToolBar widget product that can be included in both pages, and other products. The ToolBar has some html associated with it, and html associated with the buttons that appear on it. The actual buttons are chosen when the ToolBar is instanciated. What I have created looks like this: ToolBar ToolBar (ZClass inheriting from ZObjectManager) index_html (providing the client side script/styles for the buttons) ToolBar_Button ZClass ToolBar_Button_Property property sheet definingparams for buttons index_html (to display a button) ToolBar_add_Button (DTML Method form to create buttons) I can create an instance of ToolBar and add some buttons to it and everything looks fine, when I try to view it I see what I expect, however when I try to reference the toolbar from another element ie: if I have a ToolBar tools and I write <dtml-var tools> I get <ToolBar at tools> in the output. Furthermore, I would like to be able to create products that have their own toolbars, say: AggregateWidget AggregateWidget (ZClass) index_html (to disply it's self) AgWToolBar (Instance of ToolBar with a defined set of ToolBar_Buttons) and then in the index_html, if I try to access AgWToolBar with something like <dtml-var AgWToolBar>, when I create an instance of AggreateWidget and then view it, I get and error: Error Type: Unauthorized Error Value: You are not allowed to access AgWToolBar in this context If how to solve my problems can be explained that would be great, if I am out to lunch on my approach to tackling this problem, I would definatly appreciate pointers in the right direction. This is mostly an excercise in teaching myself how to use Zope, so really any advice or suggestion is great. Simon Withers
On Monday 12 May 2003 07:07 pm, Simon wrote:
I am trying to create a ToolBar widget [....]
Frankly I didn't understand all of that, but your problem is that your method is not being "rendered" -- i.e. "called" It's the difference between: my_form <-- this is an object my_form() <-- this is the output from calling the object the latter is usually the actual string sent to the browser in Zope. This is complicated by the fact that DTML will try several (sensible) alternatives if "my_form" is not a callable object, such as calling the object's __repr__ or __str__ methods, etc. But the most import thing to know is the following: *These* are the same for a callable object, and should render: <dtml-var my_form> <dtml-var name="my_form"> <dtml-var expr="my_form(None, _)"> (note the "_"). while *these* should show the object itself (i.e. its __repr__ will be rendered): <dtml-var "my_form"> <dtml-var expr="my_form"> For a *non-callable* object the above two sets are probably equivalent, except for: <dtml-var expr="my_form(None, _)"> which will cause a traceback (can't call a non-callable object!). HTH, Terry -- Terry Hancock ( hancock at anansispaceworks.com ) Anansi Spaceworks http://www.anansispaceworks.com
Simon wrote at 2003-5-12 22:07 -0400:
... ZClass with "index_html" ... ... I can create an instance of ToolBar and add some buttons to it and everything looks fine, when I try to view it I see what I expect, however when I try to reference the toolbar from another element ie: if I have a ToolBar tools and I write <dtml-var tools> I get <ToolBar at tools> in the output.
Contrary to wide spread expectations "<dtml-var XXX>" does not call "XXX"s "index_html" (this is done only by ZPublisher during URL traversal). Instead, it calls "XXX", if it is callable. Try: <dtml-with expr="tools"> <dtml-var index_html> </dtml-with> instead. Read more about it in <http://www.dieter.handshake.de/pyprojects/zope/book/chap3.html>
Furthermore, I would like to be able to create products that have their own toolbars, say:
AggregateWidget AggregateWidget (ZClass) index_html (to disply it's self) AgWToolBar (Instance of ToolBar with a defined set of ToolBar_Buttons)
and then in the index_html, if I try to access AgWToolBar with something like <dtml-var AgWToolBar>, when I create an instance of AggreateWidget and then view it, I get and error: Error Type: Unauthorized Error Value: You are not allowed to access AgWToolBar in this context
The default permissions of ZClasses are extremely restricted. You must map permissions in the corresponding tab as appropriate. Dieter
participants (5)
-
Chris Withers -
Dieter Maurer -
Florian Konnertz -
Simon -
Terry Hancock