forrest-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ferdinand Soethe <>
Subject Additional features in scales-skin
Date Fri, 25 Nov 2005 07:34:04 GMT

A few clients asked for a change in the functionality of Forrest
menus. They'd like a menu selection not only to open that menu, but to
select an index page at the same time.

And while this contradicts the no-reload concept of Forrest menues, it
makes a lot of sense in some use cases.

So I've added two new features to the scales skin that could check in
rather soon:


By adding the attribute type='openFirstChild' to a menu element (that
is an element that has children) in site.xml, Forrest will now open
the page referenced in the first child element when you select the

new attribute: 'openURL'

To have more flexibilty, you can add the new attribute 'openURL' to
the menuelement and specify any URI to open when the menu is clicked.
(Drawback here is that this reference can only be a valid URL since
this attribute is not yet adjusted like the content of href.)

Below I have added that changes required in scales.


Ferdinand Soethe

changes to 'book2menu.xsl'

 <xsl:template match="menu">
                    <xsl:when test="@openURL">
                        <xsl:copy-of select="@openURL"/>   
                        <xsl:if test="@type='openFirstChild' and (menu-item[1]/@href !=
                            <xsl:attribute name="openURL">/<xsl:value-of select="menu-item[1]/@href"/></xsl:attribute>
                <xsl:value-of select="@label" />                
                <xsl:apply-templates />

changes to 'getMenu.js'

function SwitchMenu(obj, thePath)
var open = 'url("'+thePath + 'images/chapter_open.gif")';
var close = 'url("'+thePath + 'images/chapter.gif")';
  if(document.getElementById)  {
    var el = document.getElementById(obj);
    var el2 = document.getElementById(obj+'Title');
    var title = document.getElementById(obj+'Title');
    var openURL = el2.getAttribute('openURL','false');
    if (openURL != '') {
       // prompt(openURL);
        window.location = openURL;
        if( != "block"){ 
 = open;
 = "block";
 = close;
 = "none";
  }// end -  if(document.getElementById) 
}//end - function SwitchMenu(obj)

View raw message