You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@lenya.apache.org by Jonathan Linczak <li...@hiram.edu> on 2005/02/02 16:27:23 UTC

Adding redirects to navigation items

Hi all,

Question for you:  when people want to add an item in the navigation of 
their Publication, they have to come to me so that I can add a pipeline 
to match the page's document ID and do the redirect there.  With a 
large institution, this can get kinda frustrating.  So, has anyone ever 
put something together (or know how to put something together) that 
allows the user through the GUI interface to make this happen?

Jon


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


Re: Adding redirects to navigation items

Posted by Jonathan Linczak <li...@hiram.edu>.
On Feb 2, 2005, at 10:27 AM, Jonathan Linczak wrote:

> Hi all,
>
> Question for you:  when people want to add an item in the navigation 
> of their Publication, they have to come to me so that I can add a 
> pipeline to match the page's document ID and do the redirect there.  
> With a large institution, this can get kinda frustrating.  So, has 
> anyone ever put something together (or know how to put something 
> together) that allows the user through the GUI interface to make this 
> happen?

Sorry, I should mention that the item they want to add to their 
navigation will redirect to another page, whether it be another web 
address, or another page internal to the Publication.

Jon


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


Re: Adding redirects to navigation items

Posted by Doug Chestnut <dh...@virginia.edu>.
I should also note, my solution fails under these situations:
-if the redirect points to internal lenya page, and that page is 
deactivated, the redirect is not deactivated as well
-export makes a static file that contains the redirect destinations content.

--Doug

Doug Chestnut wrote:
> I made a redirect doctype to handle this.
> I had to add some stuff to the pipeline to handle the redirect.
> 
> The user just clicks on "new redirect" (in the file menu, under the new 
> document link).  My impl requires them to use the one form editor to 
> make the change to their redirect.
> 
> I would like to have the redirect url just be a field in the create 
> form, and then have a menu item (kind of like the "edit navigation 
> title" form) that lets them change it, haven't gotten to that yet.
> 
> Let me know if you want me to send you the changes I made.  My solution 
> isn't the most elegant, but seems to work.
> 
> --Doug
> 
> Jonathan Linczak wrote:
> 
>> Hi all,
>>
>> Question for you:  when people want to add an item in the navigation 
>> of their Publication, they have to come to me so that I can add a 
>> pipeline to match the page's document ID and do the redirect there.  
>> With a large institution, this can get kinda frustrating.  So, has 
>> anyone ever put something together (or know how to put something 
>> together) that allows the user through the GUI interface to make this 
>> happen?
>>
>> Jon
>>
>>
>> ---------------------------------------------------------------------
>> 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
> 
> 

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


Re: Adding redirects to navigation items

Posted by "Gregor J. Rothfuss" <gr...@apache.org>.
Jonathan Linczak wrote:

> Yeah, I'd be interested in seeing how you got to do this.  It sounds 
> like a lot of people are taking advantage of creating different doctypes 
> and allowing people to make changes based on that doctype.  I didn't 
> even see this document until I actually looked: 
> http://wiki.apache.org/lenya/AddingCustomDocType.  Seems very 
> interesting... I have another issue where people are creating their own 
> photo galleries, and I made them to the point where they can now do all 
> of the work themselves easily, except I still have to add a pipeline 
> that tells Lenya that it uses a different XSLT file.  Sounds like I can 
> add a doctype for this as well?

yep. that is pretty much the point :)


-- 
Gregor J. Rothfuss
COO, Wyona       Content Management Solutions    http://wyona.com
Apache Lenya                              http://lenya.apache.org
gregor.rothfuss@wyona.com                       gregor@apache.org

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


Re: Adding redirects to navigation items

Posted by Jonathan Linczak <li...@hiram.edu>.
On Feb 3, 2005, at 9:58 AM, Doug Chestnut wrote:

> Hi Jon,
>
> I first made a refresh doctype using  
> http://wiki.apache.org/lenya/AddingCustomDocType
> and made the page2xhtml-redirect.xsl add a <meta http-equiv="refresh"  
> content="0;url=http://..."/>.  This was very simple and effective, but  
> I noticed that the redirect page flickered in the browser before  
> redirecting to the destination.
>
> I then used flow to return a redirect header to the browser instead.  
> Probably much better ways to go about this but here is my hack:
>
> function redirect() {
>   var model = { redirect: "", };
>   var source = cocoon.parameters["source"];
>   var pipelineUtil =  
> cocoon.createObject(Packages.org.apache.cocoon.components.flow.util.Pip 
> elineUtil);
>   var dom = pipelineUtil.processToDOM(source, {});
>   model.redirect = dom;
>   var context = new  
> org.apache.commons.jxpath.JXPathContext.newContext(model);
>   var dest = context.getValue("/redirect//url/@href");
>   cocoon.redirectTo(dest);
> }
>
> The source parameter that I pass is the url to the redirect page with  
> .html replaced with .redirect .  I have a matcher in my  
> publication-sitemap.xmap that matches on odd extensions, uses the  
> sourcetype action to see if the document type name matches the  
> extension, and then returns the raw content (I also use this for rss  
> doctypes).
>
> Here is my match in my publication-sitemap.xmap file:
>
>       <map:match pattern="**.html">
>         <map:act type="sourcetype" src="content/{1}/index_en.xml">
>           <map:select type="parameter">
>             <map:parameter name="parameter-selector-test"  
> value="{sourcetype}"/>
>             <map:when test="redirect">
>               <map:select type="parameter">
>                 <map:parameter name="parameter-selector-test"  
> value="{page-envelope:area}"/>
>                 <map:when test="live">
>                   <map:call function="redirect">
>                     <map:parameter name="source"  
> value="{../1}.redirect"/>
>                   </map:call>
>                 </map:when>
>               </map:select>
>             </map:when>
>           </map:select>
>         </map:act>
>       </map:match>
>
> --Doug

Hey Doug,

Thanks for sending this info out, it looks really interesting.  But as  
always, I have questions!  :)

1.  The flow stuff - where did you find out about this and can you  
point me to some references on what you are doing here?  I keep hearing  
about FlowScript, but I haven't really found anything that I can use to  
try out some tests.

2.  How do you know what page to redirect to?  Not really understanding  
the flow you have there, do you somehow prompt the user for the  
redirect URL?

Jon


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


Re: Adding redirects to navigation items

Posted by Doug Chestnut <dh...@virginia.edu>.
Hi Jon,

I first made a refresh doctype using 
http://wiki.apache.org/lenya/AddingCustomDocType
and made the page2xhtml-redirect.xsl add a <meta http-equiv="refresh" 
content="0;url=http://..."/>.  This was very simple and effective, but I 
noticed that the redirect page flickered in the browser before 
redirecting to the destination.

I then used flow to return a redirect header to the browser instead. 
Probably much better ways to go about this but here is my hack:

function redirect() {
   var model = { redirect: "", };
   var source = cocoon.parameters["source"];
   var pipelineUtil = 
cocoon.createObject(Packages.org.apache.cocoon.components.flow.util.PipelineUtil);
   var dom = pipelineUtil.processToDOM(source, {});
   model.redirect = dom;
   var context = new 
org.apache.commons.jxpath.JXPathContext.newContext(model);
   var dest = context.getValue("/redirect//url/@href");
   cocoon.redirectTo(dest);
}

The source parameter that I pass is the url to the redirect page with 
.html replaced with .redirect .  I have a matcher in my 
publication-sitemap.xmap that matches on odd extensions, uses the 
sourcetype action to see if the document type name matches the 
extension, and then returns the raw content (I also use this for rss 
doctypes).

Here is my match in my publication-sitemap.xmap file:

       <map:match pattern="**.html">
         <map:act type="sourcetype" src="content/{1}/index_en.xml">
           <map:select type="parameter">
             <map:parameter name="parameter-selector-test" 
value="{sourcetype}"/>
             <map:when test="redirect">
               <map:select type="parameter">
                 <map:parameter name="parameter-selector-test" 
value="{page-envelope:area}"/>
                 <map:when test="live">
                   <map:call function="redirect">
                     <map:parameter name="source" value="{../1}.redirect"/>
                   </map:call>
                 </map:when>
               </map:select>
             </map:when>
           </map:select>
         </map:act>
       </map:match>

--Doug

Jonathan Linczak wrote:
> On Feb 2, 2005, at 10:52 AM, Doug Chestnut wrote:
> 
>> I made a redirect doctype to handle this.
>> I had to add some stuff to the pipeline to handle the redirect.
>>
>> The user just clicks on "new redirect" (in the file menu, under the 
>> new document link).  My impl requires them to use the one form editor 
>> to make the change to their redirect.
>>
>> I would like to have the redirect url just be a field in the create 
>> form, and then have a menu item (kind of like the "edit navigation 
>> title" form) that lets them change it, haven't gotten to that yet.
>>
>> Let me know if you want me to send you the changes I made.  My 
>> solution isn't the most elegant, but seems to work.
>>
>> --Doug
> 
> 
> Yeah, I'd be interested in seeing how you got to do this.  It sounds 
> like a lot of people are taking advantage of creating different doctypes 
> and allowing people to make changes based on that doctype.  I didn't 
> even see this document until I actually looked: 
> http://wiki.apache.org/lenya/AddingCustomDocType.  Seems very 
> interesting... I have another issue where people are creating their own 
> photo galleries, and I made them to the point where they can now do all 
> of the work themselves easily, except I still have to add a pipeline 
> that tells Lenya that it uses a different XSLT file.  Sounds like I can 
> add a doctype for this as well?
> 
> Jon
> 
> 
> ---------------------------------------------------------------------
> 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: Adding redirects to navigation items

Posted by Jonathan Linczak <li...@hiram.edu>.
On Feb 2, 2005, at 10:52 AM, Doug Chestnut wrote:

> I made a redirect doctype to handle this.
> I had to add some stuff to the pipeline to handle the redirect.
>
> The user just clicks on "new redirect" (in the file menu, under the 
> new document link).  My impl requires them to use the one form editor 
> to make the change to their redirect.
>
> I would like to have the redirect url just be a field in the create 
> form, and then have a menu item (kind of like the "edit navigation 
> title" form) that lets them change it, haven't gotten to that yet.
>
> Let me know if you want me to send you the changes I made.  My 
> solution isn't the most elegant, but seems to work.
>
> --Doug

Yeah, I'd be interested in seeing how you got to do this.  It sounds 
like a lot of people are taking advantage of creating different 
doctypes and allowing people to make changes based on that doctype.  I 
didn't even see this document until I actually looked: 
http://wiki.apache.org/lenya/AddingCustomDocType.  Seems very 
interesting... I have another issue where people are creating their own 
photo galleries, and I made them to the point where they can now do all 
of the work themselves easily, except I still have to add a pipeline 
that tells Lenya that it uses a different XSLT file.  Sounds like I can 
add a doctype for this as well?

Jon


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


Re: Adding redirects to navigation items

Posted by Doug Chestnut <dh...@virginia.edu>.
I made a redirect doctype to handle this.
I had to add some stuff to the pipeline to handle the redirect.

The user just clicks on "new redirect" (in the file menu, under the new 
document link).  My impl requires them to use the one form editor to 
make the change to their redirect.

I would like to have the redirect url just be a field in the create 
form, and then have a menu item (kind of like the "edit navigation 
title" form) that lets them change it, haven't gotten to that yet.

Let me know if you want me to send you the changes I made.  My solution 
isn't the most elegant, but seems to work.

--Doug

Jonathan Linczak wrote:
> Hi all,
> 
> Question for you:  when people want to add an item in the navigation of 
> their Publication, they have to come to me so that I can add a pipeline 
> to match the page's document ID and do the redirect there.  With a large 
> institution, this can get kinda frustrating.  So, has anyone ever put 
> something together (or know how to put something together) that allows 
> the user through the GUI interface to make this happen?
> 
> Jon
> 
> 
> ---------------------------------------------------------------------
> 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