|
|
|
|
Vijay Ramachandran
()
|
|
||||||||||||
|
Hello.
How do I write a custom edit template for my archetypes type? I followed the recipes in "Professional Plone Development" to create a custom type, and define a custom view for it (by defining a view template and registering a browser view for this template in the browser/configure.zcml package). This works fine. I now need to create a custom edit/create-new template. I read these articles: http://plone.org/documentation/how-to/how-to-customise-view-or-edit-on-archetypes-content-items and http://plone.org/documentation/how-to/how-to-customise-view-or-edit-on-archetypes-content-items but either I'm doing something wrong, or they don't work as advertised - I only seem to get the default create/edit form which is a linear listing of the widgets for that type. I'm not sure if I'm creating the "mytype_edit.pt" template in the right location - its in the same directory as the edit template. Besides the above two links, I've also tried registering a view for the "edit" function via configure.zcml: <browser:page for="..interfaces.IMyType" name="edit" class=".mytype.MyTypeEdit" permission="cmf.ModifyPortalContent" /> I'm utterly stumped. This is on Plone 3.2.2 on Zope 2.10.7. Please help! thanks, Vijay |
||||||||||||||
|
|
lucmult
()
|
|
||||||||||||
|
On Thu, Jul 2, 2009 at 6:29 AM, Vijay Ramachandran <[hidden email]> wrote: Try this. ;-) And report your evolution.
Here, you are telling that has a file mytype with a class MyTypeEdit inside, in the same directory of configure.zmcl. You can configure the template "mytype_edit.pt" via configure.zcml like that: <browser:page for="..interfaces.IMyType" name="edit" class=".mytype.MyTypeEdit" template="mytype_edit.pt" permission="cmf.ModifyPortalContent" /> ...Or your class MyTypeEdit you can use: from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile class TimesheetStructure(BrowserView): __call__ = ViewPageTemplateFile('mytype_edit.pt') [], -- Luciano Pacheco Simples Consultoria www.simplesconsultoria.com.br ------------------------------------------------------------------------------ _______________________________________________ Plone-Users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/plone-users |
||||||||||||||
|
|
Nathan Van Gheem
()
|
|
||||||||||||
|
In reply to this post
by Vijay Ramachandran
forgot to hit the reply all button
---------- Forwarded message ---------- From: Nathan Van Gheem <[hidden email]> Date: 2009/7/4 Subject: Re: [Plone-Users] custom edit template To: Vijay Ramachandran <[hidden email]> This is how I think I remember. Someone correct me if I'm wrong...
Your custom type most likely has a type profile entry. In there you'll see something registered like, <alias from="edit" to="atct_edit" /> That is why "edit" isn't actually going to your view because the edit is caught as an alias maybe and then sends it over to atct_edit. So first off, rename your edit template to something like "custom_edit" or whatever, then customize the previously stated declaration.
I think that might be your problem--just a guess though. Good luck, Nathan 2009/7/2 Vijay Ramachandran <[hidden email]>
------------------------------------------------------------------------------ _______________________________________________ Plone-Users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/plone-users |
||||||||||||||
|
|
Vijay Ramachandran
()
|
|
||||||||||||
|
In reply to this post
by Vijay Ramachandran
On Sun, Jul 5, 2009 at 5:43 AM, lucmult (via Nabble)
If I understand the ArcheTypes tutorial correctly, __call__ of MyTypeEdit can specify the template to use? I've already tried this.
Nope, didn't work :(. It still falls back to the default edit template. The only thing that works is if I create a page template object via the ZMI, under portal_skins/custom, and call it "mytype_edit", the correct template is shown. I don't like this though as I have to remember to update the ZMI if I change the template. thanks, Vijay ------------------------------------------------------------------------------ Enter the BlackBerry Developer Challenge This is your chance to win up to $100,000 in prizes! For a limited time, vendors submitting new applications to BlackBerry App World(TM) will have the opportunity to enter the BlackBerry Developer Challenge. See full prize details at: http://p.sf.net/sfu/blackberry _______________________________________________ Plone-Users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/plone-users |
||||||||||||||
|
|
lucmult
()
|
|
||||||||||||
|
2009/7/7 Vijay Ramachandran <[hidden email]>
Hi, the article that you saw in the first e-mail, was using portal skins templates, you are using browser views templates, that's the problem here. :-) I'm just learning this things too. I think you can setup yours templates in the mytype.xml, or in portal_types tool (ZMI). Find your "mytype" in portal_types, go to tab Actions, and config the edit action to "@@edit" (it's @@ + name of your browser view, from configure.zcml). The samething apply to view action. Try this, I'm learning this too, then I don't sure it'll work. :-) [], -- Luciano Pacheco Simples Consultoria www.simplesconsultoria.com.br ------------------------------------------------------------------------------ Enter the BlackBerry Developer Challenge This is your chance to win up to $100,000 in prizes! For a limited time, vendors submitting new applications to BlackBerry App World(TM) will have the opportunity to enter the BlackBerry Developer Challenge. See full prize details at: http://p.sf.net/sfu/blackberry _______________________________________________ Plone-Users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/plone-users |
||||||||||||||
|
|
Vijay Ramachandran
()
|
|
||||||||||||
|
On Tue, Jul 7, 2009 at 5:43 PM, Luciano Pacheco <[hidden email]> wrote: Hi, the article that you saw in the first e-mail, was using portal skins templates, you are using browser views templates, that's the problem here. :-) Hi. "mytype_edit" is apparently a special name for ArcheTypes, and creating a page template named thus via the ZMI works. However, I don't believe that this is maintainable, as you need to update the ZMI every time the template changes? This tutorial - http://plone.org/documentation/tutorial/customization-for-developers/tutorial-all-pages - talks about installing a custom skin template which lives on the file system, but I've not been able to get it to work to recognize mytpe_edit template.
View works perfectly as a zope3 browser view. This makes it all the more frustrating! Any other ideas? thanks, Vijay
-- http://www.wisdomtap.com/ http://services.wisdomtap.com/ ------------------------------------------------------------------------------ Enter the BlackBerry Developer Challenge This is your chance to win up to $100,000 in prizes! For a limited time, vendors submitting new applications to BlackBerry App World(TM) will have the opportunity to enter the BlackBerry Developer Challenge. See full prize details at: http://p.sf.net/sfu/blackberry _______________________________________________ Plone-Users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/plone-users |
||||||||||||||
|
|
athomerson
()
|
|
||||||||||||
|
In reply to this post
by Vijay Ramachandran
There should be a file called "MyType.xml" in the directory profiles/default/types. In that file you should see a line that reads something like "<alias from="edit" to="atct_edit" />". Change it to something like "<alias from="edit" to="@@mytypeedit"/> and then change the browser:page directive to "name="mytypeedit".
Allen
|
||||||||||||||
|
|
Nathan Van Gheem
()
|
|
||||||||||||
|
In reply to this post
by Vijay Ramachandran
Nope, didn't work :(. It still falls back to the default edit template. The only thing that works is if I create a page template object via the ZMI, under portal_skins/custom, and call it "mytype_edit", the correct template is shown. I don't like this though as I have to remember to update the ZMI if I change the template. Did you try following my recommendation because that is your obvious problem now. Customize you GS settings for the content type in this respect and you should be fine. 2009/7/7 Vijay Ramachandran <[hidden email]>
------------------------------------------------------------------------------ Enter the BlackBerry Developer Challenge This is your chance to win up to $100,000 in prizes! For a limited time, vendors submitting new applications to BlackBerry App World(TM) will have the opportunity to enter the BlackBerry Developer Challenge. See full prize details at: http://p.sf.net/sfu/blackberry _______________________________________________ Plone-Users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/plone-users |
||||||||||||||
|
|
Vijay Ramachandran
()
|
|
||||||||||||
|
On Tue, Jul 7, 2009 at 8:20 PM, Nathan Van Gheem <[hidden email]> wrote:
Hello. I did try what you suggested did respond to your mail, but that didn't seem to have come through to the list. If I understood you correctly, I need to change the "name" attribute in the zcml browser:page entry from "edit" to "atct_edit"? That too doesn't work, unfortunately. Is there some way to look at the ZMI to see which edit template is registered for this type? thanks! Vijay
-- http://www.wisdomtap.com/ http://services.wisdomtap.com/ ------------------------------------------------------------------------------ Enter the BlackBerry Developer Challenge This is your chance to win up to $100,000 in prizes! For a limited time, vendors submitting new applications to BlackBerry App World(TM) will have the opportunity to enter the BlackBerry Developer Challenge. See full prize details at: http://p.sf.net/sfu/blackberry _______________________________________________ Plone-Users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/plone-users |
||||||||||||||
|
|
Nathan Van Gheem
()
|
|
||||||||||||
There should be a file called "MyType.xml" in the directory profiles/default/types. In that file you should see a line that reads something like "<alias from="edit" to="atct_edit" />". Change it to something like "<alias from="edit" to="@@mytypeedit"/> and then change the browser:page directive to "name="mytypeedit". 2009/7/7 Vijay Ramachandran <[hidden email]>
------------------------------------------------------------------------------ Enter the BlackBerry Developer Challenge This is your chance to win up to $100,000 in prizes! For a limited time, vendors submitting new applications to BlackBerry App World(TM) will have the opportunity to enter the BlackBerry Developer Challenge. See full prize details at: http://p.sf.net/sfu/blackberry _______________________________________________ Plone-Users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/plone-users |
||||||||||||||
|
|
lucmult
()
|
|
||||||||||||
|
2009/7/7 Nathan Van Gheem <[hidden email]>
Add the MyType.xml and re-install your product, the .xml in profile is read on installation process. [], -- Luciano Pacheco Simples Consultoria www.simplesconsultoria.com.br ------------------------------------------------------------------------------ Enter the BlackBerry Developer Challenge This is your chance to win up to $100,000 in prizes! For a limited time, vendors submitting new applications to BlackBerry App World(TM) will have the opportunity to enter the BlackBerry Developer Challenge. See full prize details at: http://p.sf.net/sfu/Challenge _______________________________________________ Plone-Users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/plone-users |
||||||||||||||
|
|
Vijay Ramachandran
()
|
|
||||||||||||
|
In reply to this post
by Nathan Van Gheem
On Wed, Jul 8, 2009 at 1:59 AM, Nathan Van Gheem <[hidden email]> wrote:
Hello. Thanks for all your help. This change allows the edit view to find the page template. So one big obstacle overcome! However, the same page template which worked for atct_edit (when added as a PT via the ZMI) fails when shown by a zope3 style view. I'm following the recipe stated here - http://plone.org/documentation/how-to/how-to-customise-view-or-edit-on-archetypes-content-items. The error I get is this:
thanks again! Vijay
-- http://www.wisdomtap.com/ http://services.wisdomtap.com/ ------------------------------------------------------------------------------ Enter the BlackBerry Developer Challenge This is your chance to win up to $100,000 in prizes! For a limited time, vendors submitting new applications to BlackBerry App World(TM) will have the opportunity to enter the BlackBerry Developer Challenge. See full prize details at: http://p.sf.net/sfu/Challenge _______________________________________________ Plone-Users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/plone-users |
||||||||||||||
|
|
Yuri-11
()
|
|
||||||||||||
|
Vijay Ramachandran ha scritto:
> On Wed, Jul 8, 2009 at 1:59 AM, Nathan Van Gheem <[hidden email] > <mailto:[hidden email]>> wrote: > > There should be a file called "MyType.xml" in the directory > > profiles/default/types. In that file you should see a line > that reads > > something like "<alias from="edit" to="atct_edit" />". Change > it to > > something like "<alias from="edit" to="@@mytypeedit"/> and > then change the > > browser:page directive to "name="mytypeedit". > > The answer was stated correctly here just as I was saying. Give > it a try. > > > Hello. Thanks for all your help. This change allows the edit view to > find the page template. So one big obstacle overcome! > > However, the same page template which worked for atct_edit (when added > as a PT via the ZMI) fails when shown by a zope3 style view. I'm > following the recipe stated here - > http://plone.org/documentation/how-to/how-to-customise-view-or-edit-on-archetypes-content-items. > The error I get is this: > > * Module Products.PageTemplates.PageTemplate, line 98, in pt_render > * Module zope.pagetemplate.pagetemplate, line 117, in pt_render > *Warning: Macro expansion failed* > *Warning: exceptions.KeyError: 'edit_macros'* > * *...* > * Module zope.tal.talinterpreter, line 854, in do_condition > * Module Products.PageTemplates.Expressions, line 211, in > evaluateBoolean > * Module zope.tales.tales, line 696, in evaluate > *URL: > file:/home/vijayr/Plone/buildout-cache/eggs/Products.Archetypes-1.5.10-py2.4.egg/Products/Archetypes/skins/archetypes/edit_macros.pt > <http://edit_macros.pt>* > *Line 76, Column 4* > *Expression: <NotExpr u'isLocked'>* > You miss some defines. Include the global_defines call instead of recalculate them. Take a look on global_header template for example. ------------------------------------------------------------------------------ Enter the BlackBerry Developer Challenge This is your chance to win up to $100,000 in prizes! For a limited time, vendors submitting new applications to BlackBerry App World(TM) will have the opportunity to enter the BlackBerry Developer Challenge. See full prize details at: http://p.sf.net/sfu/Challenge _______________________________________________ Plone-Users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/plone-users |
||||||||||||||
| Free Embeddable Forum Powered by Nabble | Help |