You are viewing a plain text version of this content. The canonical link for it is here.
Posted to docs@cocoon.apache.org by st...@outerthought.org on 2004/02/20 13:00:05 UTC
[WIKI-UPDATE] PortalEngine PortalEngineBookmarks Fri Feb 20 13:00:04 2004
Page: http://wiki.cocoondev.org/Wiki.jsp?page=PortalEngine , version: 12 on Fri Feb 20 11:15:31 2004 by JonEvans
- __Q:__ How does the bookmarks feature work?
-
- __A:__ You have a file, typically called bookmarks.xml, which contains definitions for a number of different portal events. When you use the portal-bookmark action, it decodes the parameters you have passed in for each event, and generates a URL which will create the events.
- An example: lets say you have two nested tab layouts, and you want to switch to the first tab on both of them and then pass a value to one of the coplets. You would create a bookmarks file like this:
-
- {{{
- <bookmarks>
- <events>
- <event type="jxpath" id="top">
- <targettype>layout</targettype>
- <targetid>maintab</targetid>
- <path>aspectDatas/tab</path>
- </event>
-
- <event type="jxpath" id="inner">
- <targettype>layout</targettype>
- <targetid>leftnav-home</targetid>
- <path>aspectDatas/tab</path>
- </event>
-
- <event type="jxpath" id="coplet1">
- <targettype>coplet</targettype>
- <targetid>Coplet-1</targetid>
- <path>attributes/appid</path>
- </event>
- </events>
- </bookmarks>
- }}}
-
- The significance of each part is:
- {{<event type="jxpath" id="top">}}: Create a jxpath event (the only type you can create at the moment) with an id of {{top}}.
- {{<targettype>layout</targettype>}}: The target for the event is a {{layout}} (the other alternative is a {{coplet}}.
- {{<targetid>maintab</targetid>}} The layout you are targeting is called {{maintab}}. This refers to an entry in your portal layout xml file:
-
- {{{
- <composite-layout name="toptab" id="maintab">
- <named-item name="navbar.home">
- <composite-layout name="leftnav" id="leftnav-home">
- [...]
- }}}
-
- {{<path>aspectDatas/tab</path>}}: set the value of the {{aspectDatas/tab}} property of the target layout (i.e. switch to that tab).
-
- (Tab indexes for layouts are 0-based).
-
- So you can use a URL like this:
-
- {{bookmark?top=0&inner=0&coplet1=123}}
-
- The bookmark matcher looks like this:
-
- {{{
- <map:match pattern="bookmark">
- <map:act type="auth-protect">
- <map:parameter name="handler" value="portalhandler"/>
- <map:parameter name="application" value="portal"/>
-
- <map:act type="portal-bookmark">
- <map:parameter name="portal-name" value="portal" />
-
- <map:redirect-to uri="portal?{uri}"/>
- </map:act>
- </map:act>
- </map:match>
- }}}
-
- The URL is inspected by the portal-bookmark action, which creates a set of events which are available in the sitemap with the {uri} placeholder. So the matcher ends by redirecting to that URL.
-
- ----
-
Page: http://wiki.cocoondev.org/Wiki.jsp?page=PortalEngineBookmarks , version: 2 on Fri Feb 20 11:22:56 2004 by JonEvans
+
- {{<event type="jxpath" id="top">}}: Create a jxpath event (the only type you can create at the moment) with an id of {{top}}.
? ^
+ __{{<event type="jxpath" id="top">}}__ Create a jxpath event (the only type you can create at the moment) with an id of {{top}}.
? ++ ^^
+
- {{<targettype>layout</targettype>}}: The target for the event is a {{layout}} (the other alternative is a {{coplet}}.
? ^ --
+ __{{<targettype>layout</targettype>}}__ The target for the event is a {{layout}} (the other alternative is {{coplet}}).
? ++ ^^ +
+
- {{<targetid>maintab</targetid>}} The layout you are targeting is called {{maintab}}. This refers to an entry in your portal layout xml file:
+ __{{<targetid>maintab</targetid>}}__: The layout you are targeting is called {{maintab}}. This refers to an entry in your portal layout xml file:
? ++ +++
- {{<path>aspectDatas/tab</path>}}: set the value of the {{aspectDatas/tab}} property of the target layout (i.e. switch to that tab).
? ^
+ __{{<path>aspectDatas/tab</path>}}__ set the value of the {{aspectDatas/tab}} property of the target layout (i.e. switch to that tab).
? ++ ^^
+ ----
+
+ __Q:__ Great, but the URLs I have to use are still pretty big. Can I make it so that a url like {{app?id=123}} will switch to the right page?
+
+ __A:__ Well, you could use a matcher.
+
+ {{{
+ <!-- Handle app?id=123 by redirecting to a
+ bookmark URL which does the right thing -->
+ <map:match pattern="app">
+ <map:redirect-to uri="bookmark?top=0&inner=0&coplet1={request-param:id}"/>
+ </map:match>
+ }}}
+
+ That does the trick, but of course your user then has to wait for the initial redirect to the {{bookmark}} url, then the redirect from that one to the {{portlet}} url.
+
+ ----
+
+ __Q:__ OK, so how do I make it so that {{app?id=123}} just returns the page without needing the two redirects?
+
+ __A:__ Still working on this one... I'll get back to you, OK?