You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-user@portals.apache.org by Enrique Perez <pe...@dit.upm.es> on 2006/07/04 12:02:48 UTC

Menus and directory structure

Hi all,

I've been reviewing "menu" element and I think I don't fully understand
how this element works in J2 (especially, when used in combination with
specific directory structure) =/ 
So I have several questions:

1.- When a new user is registered, a new folder with its username is
created under "_user" directory. But I don't understand how
"breadcrumbs" menu knows that, when the user logs in, the new root
folder is "pages/_user/username/" instead of "pages/". And especially,
why the psml pages located under "pages/" are still displayed as if they
were located under "pages/_user/username/"? I've read something about
"invalid URI's", but I didn't get too much of it. Does it mean that any
psml located under any path containing a directory whose name starts
with "_" displays as if it were located under "root" (or a virtual root
specified by something -in this case the LoginPortlet-)?? Can anyone
explain this to me, please (with other words different from J2 docs if
possible)??

2.- Is it possible *not* to show an specific psml located in "pages/"
when I've logged in and my root is supposed to be
"pages/_user/username"??

3.- Supposed a menu defined, for example, this way:
<menu name="xxx">
	<separator>
		<text>yyy</text>
</separator>
<option regexp="true">/*/*.psml</option>
</menu>

this would create a menu:
-	identified in J2 context by "xxx"
-	labelled by "yyy"
-	containing all the psml pages of all subfolders of the directory
where this menu is defined.

Is that true?? Am I missing something??

4.- Supposed the menu defined above, if I want to include it in my left
navigation column, could I achieve this just by defining an <include>
tag in the "page-navigations" menu defined at the top level?
Similar to this:
<menu name="page-navigations">
	<include nested="true">xxx</include>
</menu>

This way, my left navigation column should show a navigation pane with:
-	folders available
-	all the psml pages that we wanted when we created the menu "xxx"

Am I wrong again??

5.- What if I want the menu "xxx" to be displayed in some tabs but not
in others of the same level?? Could it be done by defining the menu in
the psml code??

Thanks a lot in advance,
Enrique





RE: Menus and directory structure

Posted by Enrique Perez <pe...@dit.upm.es>.
Thanks Aaron,

I put a security constraint that grant access only to user whose
username is "guest" and it works as I expected.

Regards,
Enrique


> -----Mensaje original-----
> De: Aaron Evans [mailto:aaronmevans@gmail.com]
> Enviado el: jueves, 06 de julio de 2006 14:38
> Para: Jetspeed Users List
> Asunto: Re: Menus and directory structure
> 
> On 7/6/06, Enrique Perez <pe...@dit.upm.es> wrote:
> > Hi Randy!
> > ...
> > 2) Granting access to "page1.psml" only to "not-logged" users (by
> > defining a security constraint with the username of not-logged
user), no
> > matter how the pages are named.
> >
> > Personally, I'm keen on #2 but I don't know which username is
assigned
> > by J2 for "not-logged" users.
> >
> 
> Use WEB-INF/pages/_user/guest.  If you put page1.psml in there and put
> a page1.psml in WEB-INF/pages, then whenever a non-logged-in user
> accesses /page1.psml, then they will get the version under the guest
> directory. Otherwise, they will get the one under the pages root.  You
> can then have role or user specific ones by placing another version of
> page1.psml in the appropriate places in the directory structure.
> 



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


Re: Menus and directory structure

Posted by Aaron Evans <aa...@gmail.com>.
On 7/6/06, Enrique Perez <pe...@dit.upm.es> wrote:
> Hi Randy!
> ...
> 2) Granting access to "page1.psml" only to "not-logged" users (by
> defining a security constraint with the username of not-logged user), no
> matter how the pages are named.
>
> Personally, I'm keen on #2 but I don't know which username is assigned
> by J2 for "not-logged" users.
>

Use WEB-INF/pages/_user/guest.  If you put page1.psml in there and put
a page1.psml in WEB-INF/pages, then whenever a non-logged-in user
accesses /page1.psml, then they will get the version under the guest
directory. Otherwise, they will get the one under the pages root.  You
can then have role or user specific ones by placing another version of
page1.psml in the appropriate places in the directory structure.

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


RE: Menus and directory structure

Posted by Enrique Perez <pe...@dit.upm.es>.
Hi Randy!

Randy Watler escribió:
> Enrique,
>
> On Tue, 2006-07-04 at 12:02 +0200, Enrique Perez wrote:
>> Hi all,
>>
>> I've been reviewing "menu" element and I think I don't fully
understand
>> how this element works in J2 (especially, when used in combination
with
>> specific directory structure) =/ 
>> So I have several questions:
>>
>> 1.- When a new user is registered, a new folder with its username is
>> created under "_user" directory. But I don't understand how
>> "breadcrumbs" menu knows that, when the user logs in, the new root
>> folder is "pages/_user/username/" instead of "pages/". And
especially,
>> why the psml pages located under "pages/" are still displayed as if
they
>> were located under "pages/_user/username/"? I've read something about
>> "invalid URI's", but I didn't get too much of it. Does it mean that
any
>> psml located under any path containing a directory whose name starts
>> with "_" displays as if it were located under "root" (or a virtual
root
>> specified by something -in this case the LoginPortlet-)?? Can anyone
>> explain this to me, please (with other words different from J2 docs
if
>> possible)??
>
> Pages and folders are aggregated across the PSML directory structure
> according to the active Profiler rules. Any folders starting with '_'
> are hidden, (e.g. '_user', '_role', '_mediatype', '_country', ...,
> etc.), but subfolders within them are addressable via the active
> Profiler rule. There are plenty of old threads in the user list that
> discuss these topics. Search for articles in the archives with my name
> and Profiler and/or PortalSite. You also might want to consult the
> somewhat dated material in the J2 docs folder for the PortalSite,
> PageManager, and Profiler components.
>

First of all, thanks for your interest.
I've found the threads you mention (I must say that "searching option"
in OpenSubscriber come up very useful. If anyone else is interested:
http://www.opensubscriber.com/messages/jetspeed-user@portals.apache.org/
topic.html. It's very friendly user) and they pointed me to this
document:
https://svn.apache.org/repos/asf/portals/jetspeed-2/branches/JETSPEED-BR
ANCH-2.0.1/design-docs/src/profiler/
    · J2-page-manager-profiling

While I was reviewing it, I fall into new questions and doubts (probably
because of my poor level of English, as you can see from my mails ;) ),
but I will open a new topic in the list to ask that questions about
PageManager and Profiler.
Anyway, after studying it, I've realized (or I think I've realized) why
pages display the way they do =) Thanks for the help.


>> 2.- Is it possible *not* to show an specific psml located in "pages/"
>> when I've logged in and my root is supposed to be
>> "pages/_user/username"??
>
> You can do this with security constriants, security permissions, or
> profiling rules. Picling the best approach depends on your use case.
>
Gived this scenario:
    ~/myportal/WEB-INF/pages/
                |
                |-- page1.psml
                |-- page2.psml
                |-- page3.psml
                |
                |-- _user/username/
                             |
                             |-- page1u.psml

What I was trying to do was:
- displaying three tabs (page1,page2,page3) if user isn't logged.
- replacing "page1" with "page1u" if user logs.

If I've understood that "profiling document" properly, there are two
ways to accomplish that task:
1) Giving the same name to both pages: that is to say, there should be a
'tab1.psml' in "pages/_user/username/" if I want to replace the
'tab1.psml' located in "pages/".
2) Granting access to "page1.psml" only to "not-logged" users (by
defining a security constraint with the username of not-logged user), no
matter how the pages are named.

Personally, I'm keen on #2 but I don't know which username is assigned
by J2 for "not-logged" users.


>> 3.- Supposed a menu defined, for example, this way:
>> <menu name="xxx">
>> 	<separator>
>> 		<text>yyy</text>
>> </separator>
>> <option regexp="true">/*/*.psml</option>
>> </menu>
>>
>> this would create a menu:
>> -	identified in J2 context by "xxx"
>> -	labelled by "yyy"
>> -	containing all the psml pages of all subfolders of the directory
>> where this menu is defined.
>>
>> Is that true?? Am I missing something??
>
> You are correct. Keep in mind that the paths here are logical paths
that
> you would enter from the browser, not the physical paths within the
PSML
> directories. See #1 above.
>

Ok. I was missing that point =/ I was considering the physical paths
that I have on my machine.
I explain my use case at the end of this mail since it's also related to
points 4&5.

>> 4.- Supposed the menu defined above, if I want to include it in my
left
>> navigation column, could I achieve this just by defining an <include>
>> tag in the "page-navigations" menu defined at the top level?
>> Similar to this:
>> <menu name="page-navigations">
>> 	<include nested="true">xxx</include>
>> </menu>
>>
>> This way, my left navigation column should show a navigation pane
with:
>> -	folders available
>> -	all the psml pages that we wanted when we created the menu "xxx"
>>
>> Am I wrong again??
>
> Again, you are correct. See WEB-INF/pages/_user/user/folder.metadata.
> Login as user/user to see the effect. This same included menu approach
> is used to integrate the 'page-navigations' menu itself. See the
> definition of the standard 'navigations' menu:
>
> <!-- standard navigations panel menu -->
> <menu name="navigations">
>   <separator>Folders</separator>
>   <options regexp="true">./*/</options>
>   <include>page-navigations</include>
>   <separator>Additional Links</separator>
>   <options regexp="true">/*.link</options>
> </menu>
>

Yes, that's what i thought when I saw that definition for that default
menu.
But, although I looked into the folder.metadata files that come with the
default portal of J2, I'm not able to get what i want.

>> 5.- What if I want the menu "xxx" to be displayed in some tabs but
not
>> in others of the same level?? Could it be done by defining the menu
in
>> the psml code??
>
> I am not sure what you are asking for here, but defining the menu in
> different folder.metadata and *.psml files will yield different
results
> depending on where the user is. One can include missing, defined, or
> overridden folders. The technique can have limitations though. Please
> specify your use case in more detail if you'd like more concrete
advice.
>
Gived the following scenario:

   ~/myportal/WEB-INF/pages/
                |-- page1.psml
                |-- page2.psml
                |-- page3.psml
                |
                |-- _user/
                |      |-- username1/
                |      |-- username2/
                |           ...
                |
                |-- tree-project/
                       |-- folder.metadata
                       |
                       |-- project1/
                       |        |-- folder.metadata
                       |        |-- page11.psml
                       |        |-- page12.psml
                       |             ...
                       |-- project2/
                            ...

I was trying to create a menu labelled "Tree project" containing the
names of all the projects registered (name specified in the
"folder.metadata" or "page11.psml" of each project) and only available
from "page2.psml".
In order to do that I thought I could define the following menu in the
"folder.metadata" file of "tree-project":
    <menu name="project-tree-menu" regexp="true">
            <separator>
                <text>Project Tree</text>
                    <metadata name="text" xml:lang="es">Arbol de
proyectos</metadata>
                <title>All projects available at this site</title>
                    <metadata name="title" xml:lang="es">Todos los
proyectos disponibles en este portal</metadata>
            </separator>
            <options regexp="true">./*/</options>     <!-- or: <options
regexp="true">./*/page11.psml<options> -->
    </menu>

And then, a "page-navigations" should be defined in "page2.psml":
    <menu name="page-navigations">
        <include>project-tree-menu</include>
    </menu>

This didn't work, so i moved this "page-navigations" definition to the
"folder.metadata" in "pages/"... but still not working. I only have a
left navigation pane with a "Folders" label containing a link to the
folder "tree-project".

Regards,
Enrique

Re: Menus and directory structure

Posted by Randy Watler <wa...@wispertel.net>.
Enrique,

On Tue, 2006-07-04 at 12:02 +0200, Enrique Perez wrote:
> Hi all,
> 
> I've been reviewing "menu" element and I think I don't fully understand
> how this element works in J2 (especially, when used in combination with
> specific directory structure) =/ 
> So I have several questions:
> 
> 1.- When a new user is registered, a new folder with its username is
> created under "_user" directory. But I don't understand how
> "breadcrumbs" menu knows that, when the user logs in, the new root
> folder is "pages/_user/username/" instead of "pages/". And especially,
> why the psml pages located under "pages/" are still displayed as if they
> were located under "pages/_user/username/"? I've read something about
> "invalid URI's", but I didn't get too much of it. Does it mean that any
> psml located under any path containing a directory whose name starts
> with "_" displays as if it were located under "root" (or a virtual root
> specified by something -in this case the LoginPortlet-)?? Can anyone
> explain this to me, please (with other words different from J2 docs if
> possible)??

Pages and folders are aggregated across the PSML directory structure
according to the active Profiler rules. Any folders starting with '_'
are hidden, (e.g. '_user', '_role', '_mediatype', '_country', ...,
etc.), but subfolders within them are addressable via the active
Profiler rule. There are plenty of old threads in the user list that
discuss these topics. Search for articles in the archives with my name
and Profiler and/or PortalSite. You also might want to consult the
somewhat dated material in the J2 docs folder for the PortalSite,
PageManager, and Profiler components.

> 
> 2.- Is it possible *not* to show an specific psml located in "pages/"
> when I've logged in and my root is supposed to be
> "pages/_user/username"??

You can do this with security constriants, security permissions, or
profiling rules. Picling the best approach depends on your use case.

> 
> 3.- Supposed a menu defined, for example, this way:
> <menu name="xxx">
> 	<separator>
> 		<text>yyy</text>
> </separator>
> <option regexp="true">/*/*.psml</option>
> </menu>
> 
> this would create a menu:
> -	identified in J2 context by "xxx"
> -	labelled by "yyy"
> -	containing all the psml pages of all subfolders of the directory
> where this menu is defined.
> 
> Is that true?? Am I missing something??

You are correct. Keep in mind that the paths here are logical paths that
you would enter from the browser, not the physical paths within the PSML
directories. See #1 above.

> 
> 4.- Supposed the menu defined above, if I want to include it in my left
> navigation column, could I achieve this just by defining an <include>
> tag in the "page-navigations" menu defined at the top level?
> Similar to this:
> <menu name="page-navigations">
> 	<include nested="true">xxx</include>
> </menu>
> 
> This way, my left navigation column should show a navigation pane with:
> -	folders available
> -	all the psml pages that we wanted when we created the menu "xxx"
> 
> Am I wrong again??

Again, you are correct. See WEB-INF/pages/_user/user/folder.metadata.
Login as user/user to see the effect. This same included menu approach
is used to integrate the 'page-navigations' menu itself. See the
definition of the standard 'navigations' menu:

<!-- standard navigations panel menu -->
<menu name="navigations">
  <separator>Folders</separator>
  <options regexp="true">./*/</options>
  <include>page-navigations</include>
  <separator>Additional Links</separator>
  <options regexp="true">/*.link</options>
</menu>

> 
> 5.- What if I want the menu "xxx" to be displayed in some tabs but not
> in others of the same level?? Could it be done by defining the menu in
> the psml code??

I am not sure what you are asking for here, but defining the menu in
different folder.metadata and *.psml files will yield different results
depending on where the user is. One can include missing, defined, or
overridden folders. The technique can have limitations though. Please
specify your use case in more detail if you'd like more concrete advice.

HTH,

Randy


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