> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of 
> Dennis Dam
> Sent: dinsdag 16 september 2008 12:27
> To: Hippo CMS development public mailinglist
> Subject: Re: [HippoCMS-dev] problem with pickers in BE templates
> 
> Petar Becic wrote:
> > Hi all,
> >
> > A have a question regarding pickers in BE templates.
> > We have 2 different sites ('xxxx' and 'yyyy') which are in the same 
> > Hippo repository.
> >
> > root
> >       xxxx
> >                news
> >       yyyy
> >                news
> >
> > Both sites should share BE templates. I'm wondering how to define 
> > pickers.
> > For example, news picker in the 'xxxx' site should pick 
> news documents 
> > from the path: /root/xxxx/news, and picker in 'yyyy' site from the
> > path: /root/yyyy/news.
> >
> > In the 'pickers.xml', I defined:
> >
> > <pickers>
> >    <picker id="xxxx_news" class="ResourcePopup2">
> >      
> > 
> <arg><![CDATA['/explorer/resource-picker/content/xxxx/news/?mode=html'
> > ]]></arg>
> >
> >    </picker>
> >
> >    <picker id="yyyy_news" class="ResourcePopup2">
> >      
> > 
> <arg><![CDATA['/explorer/resource-picker/content/yyyy/news/?mode=html'
> > ]]></arg>
> >
> >    </picker>
> >
> > ...
> > <pickers>
> >
> > Is it possible to select picker dynamically in 
> 'business_logic.xml' ?
> > Something like:
> >    <rule for="...">
> >       if(site = xxxx)
> >        <picker id="xxxx_news"/>
> >       else if(site = yyyy)
> >        <picker id="yyyy_news"/>
> >    </rule>
> 
> no that's not possible. The way to do it is making a custom 
> picker (based on ResourcePopup2, see [1]), which creates the 
> url to the browser html (e.g.  
> '/explorer/resource-picker/content/yyyy/news/?mode=html)
> dynamically.  In the javascript of the custom picker you 
> could extract the path to the current document by parsing the 
> current url (window.location), which should be something like 
> "/editing/cf2/<backend template name>/path/to/document, and 
> use that to generate the url.
> 
> hope that helps,
> Dennis
> 
> [1]
> http://svn.hippocms.org/repos/hippo/hippo-cms/trunk/editor/src
> /site/cforms/resources/mattkruse-lib/ResourcePopup2.js
> > Thanks in advance.

You can get the current location from the request parameter document (it
was added to GenericPicker.js since version 6.05.04)

Jasha
********************************************
Hippocms-dev: Hippo CMS development public mailinglist

Searchable archives can be found at:
MarkMail: http://hippocms-dev.markmail.org
Nabble: http://www.nabble.com/Hippo-CMS-f26633.html

Reply via email to