You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@lenya.apache.org by Rolando Isidoro <rl...@uninova.pt> on 2005/06/07 14:25:27 UTC

New menu entry under some conditions...

Hi, I've created a new Custom Resource Type with no problems by 
following the instructions available in 
http://lenya.apache.org/1_2_x/how-to/custom_resourcetype.html. Now, I 
want that the menu entry for the creation of this new resource only 
becomes active given certain conditions; I've looked into 
/mypub/config/menus/generic.xsp /and couldn't figure out a way of 
performing it. This is my current condition for the menu entry (New 
Profile) to become active:

      <xsp:logic>
        {
        if (Publication.ARCHIVE_AREA.equals(area) || 
Publication.TRASH_AREA.equals(area)) {
          <item><i18n:text>New Document</i18n:text></item>
        }
        else {
          <item uc:usecase="create" uc:step="showscreen" 
href="?doctype=xhtml"><i18n:text>New Document</i18n:text></item>
         
          <!-- Menu entry for New Profile -->
          <item uc:usecase="create" uc:step="showscreen" 
href="?doctype=profile"><i18n:text>New Profile</i18n:text></item>
        }
        }
      </xsp:logic>

It's appearing in the same conditions as the New Document entry, but I 
wish for it to be available only in this conditions if the url contains 
the string "people_en.html" or "people_pt.html", which in practice is 
the same to say that I only want it to be active only when the current 
node has document id "people". From what I could make from it, I will 
only have to insert a new if statement using the parameter 
"currentDocumentId", but I don't know which method to use in order to 
see if the string contains "people_". Can someone give me a hint about this?

Thanks in advance, regards
Rolando

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org


Re[2]: New menu entry under some conditions...

Posted by qMax <qm...@mediasoft.ru>.
Tuesday, June 7, 2005, 8:23:24 PM, Michael Wohlfart wrote:
MW> In <pubid>/menus.xmap add an Entry for the Resource Type,
MW> it should look something like this:

MW>        <!-- menu for the people resource type -->
MW>        <map:match type="doctype" pattern="people">
MW>          <map:generate type="serverpages"
MW> src="config/menus/people.xsp"/>
MW>          <map:serialize type="xml"/>
MW>        </map:match>

IIRC, it is possible using url matcher as well, is it ?

MW> Then add your own menu as <pubid>/config/menus/people.xsp. You can start
MW> with a copy of generic.xsp and change it to fit your needs.

This is ever preferrable, because scarcely 'people' will have
children other then profile type (or other 'people' as in my case),
and editors possibility also restricted.

Just users may get confused if menu changes from node to node.

-- 
 qMax


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org


Re: New menu entry under some conditions...

Posted by Michael Wohlfart <mi...@zsw-bw.de>.
I also played around with Resource Types and Custom Menus,
my approach is like this:

In <pubid>/menus.xmap add an Entry for the Resource Type,
it should look something like this:

       <!-- menu for the people resource type -->
       <map:match type="doctype" pattern="people">
         <map:generate type="serverpages" src="config/menus/people.xsp"/>
         <map:serialize type="xml"/>
       </map:match>

Then add your own menu as <pubid>/config/menus/people.xsp. You can start
with a copy of generic.xsp and change it to fit your needs.

The new menu appears when the "Authoring" tab in Lenya is chosen and the
selected Resource Type is "people".

best regards

Michael




Rolando Isidoro wrote:
> Hi, I've created a new Custom Resource Type with no problems by 
> following the instructions available in 
> http://lenya.apache.org/1_2_x/how-to/custom_resourcetype.html. Now, I 
> want that the menu entry for the creation of this new resource only 
> becomes active given certain conditions; I've looked into 
> /mypub/config/menus/generic.xsp /and couldn't figure out a way of 
> performing it. This is my current condition for the menu entry (New 
> Profile) to become active:
> 
>      <xsp:logic>
>        {
>        if (Publication.ARCHIVE_AREA.equals(area) || 
> Publication.TRASH_AREA.equals(area)) {
>          <item><i18n:text>New Document</i18n:text></item>
>        }
>        else {
>          <item uc:usecase="create" uc:step="showscreen" 
> href="?doctype=xhtml"><i18n:text>New Document</i18n:text></item>
>                  <!-- Menu entry for New Profile -->
>          <item uc:usecase="create" uc:step="showscreen" 
> href="?doctype=profile"><i18n:text>New Profile</i18n:text></item>
>        }
>        }
>      </xsp:logic>
> 
> It's appearing in the same conditions as the New Document entry, but I 
> wish for it to be available only in this conditions if the url contains 
> the string "people_en.html" or "people_pt.html", which in practice is 
> the same to say that I only want it to be active only when the current 
> node has document id "people". From what I could make from it, I will 
> only have to insert a new if statement using the parameter 
> "currentDocumentId", but I don't know which method to use in order to 
> see if the string contains "people_". Can someone give me a hint about 
> this?
> 
> Thanks in advance, regards
> Rolando
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
> For additional commands, e-mail: user-help@lenya.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org


Re: New menu entry under some conditions...

Posted by qMax <qm...@mediasoft.ru>.
Tuesday, June 7, 2005, 7:25:27 PM, Rolando Isidoro wrote:

RI> It's appearing in the same conditions as the New Document entry, but I
RI> wish for it to be available only in this conditions if the url contains
RI> the string "people_en.html" or "people_pt.html", which in practice is
RI> the same to say that I only want it to be active only when the current
RI> node has document id "people". From what I could make from it, I will
RI> only have to insert a new if statement using the parameter 
RI> "currentDocumentId", but I don't know which method to use in order to
RI> see if the string contains "people_". Can someone give me a hint about this?

In outer logic block, take a clean local document id:

String localDocumentId = <input:get-attribute module="page-envelope" as="string" name="document-id"/>;

/* the already defined documentID is not actually documentID but
rather document url, it contains prefix, area, language, etc */

And in logic block that defines menu items:
          if ( localDocumentId.equals("/personal") ) {
            <item uc:usecase="create" uc:step="showscreen" href="?doctype=profile"><i18n:text>Create user profile</i18n:text
          }
          else {
            <item><i18n:text>Create user profile</i18n:text></item>
          }

If you want to create profiles not only under document /personal but
also under its children, that you should use localDocumentId.startsWith("/personal");

-- 
 qMax


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org