2

What is the simplest way to do this? I added it in the portlets.xml file in profiles/default. It is now available in the "Add portlet" dropdown when I go to @@manage-portlets. But I need it automatically created.

Is it possible to explicitly specify the set of portlets I want on the right and left columns inside my profiles/default?

3 Answers 3

4

The portlets.xml file does a few different things and there's a difference between registering a kind of portlet that can be added and actually adding a portlet, both of which can be done in portlets.xml. You need to use an "assignment" element to add a portlet:

<assignment
   manager="plone.rightcolumn"
   category="context"
   key="/plone"
   type="plone.portlet.static.Static"
   name="foo-portlet">
  <property name="header">Foo Portlet Title</property>
  <property name="text">Foo portlet contents...</property>
</assignment>
1
  • sounds good. can this be done for classic portlets? can't seem to grep it in the source.
    – sureshvv
    Apr 13, 2011 at 17:56
3

You can register your classic portlet trough the portlets.Classic portlet, configured with a template and macro name, using an assignment element in your portlets.xml file:

<assignment
    manager="plone.rightcolumn"
    category="context"
    key="/"
    type="portlets.Classic"
    name="my-classic-portlet"
    visible="1">
  <property name="template">templatename</property>
  <property name="macro">macroname-found-in-template</property>
</assignment>

See the Portlets section of the GenericSetup manual on Plone.org or the original PLIP for details on Portlet assignments and GenericSetup.

The properties match the portlet dataprovider interface, see the Classic Portlet source code for the interface definition for the Classic Portlet.

2

For a not experienced product developer (even the others too) the easiest way to achieve this kind of automation is:

  1. do manual configuration o assignment like a any other common plone user/administrator, going in the portal's root and adding the portlets you want.
  2. go in zmi -> portal_setup -> export tab
  3. select portlet step and export it
  4. use portlets.xml in the tar.gz just got.

this xml contains all what you need: registrations and assignments... actually, even a little more stuff so may be a good thing to make a clean of what unneeded in it.

6
  • Yes. I made exactly this recommendation the last time I saw a GenericSetup question.
    – Auspex
    Apr 13, 2011 at 20:57
  • Funny, for me it's often step 3.5: find the relevant data is not exported. (Possibly not in this case, though.) Apr 14, 2011 at 12:51
  • it also generates loads of stuff depending on how people have been playing with their dashboard. Can be a pain to filter out the junk.
    – sureshvv
    Apr 15, 2011 at 17:00
  • Yes, indeed! I said "the easiest" not "the better" ;)
    – sauzher
    Apr 18, 2011 at 8:00
  • Plus it doesn't seem to work. For eg. I don't want the login portlet. Export seems to give me the correct file. But when I install my product, the login portlet still remains. How do I get it explicitly removed?
    – sureshvv
    May 5, 2011 at 7:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.