Page 2 of 2
Re: Excluding sections & subsections from collapso menu
Posted: Sat Dec 18, 2010 4:06 pm
by norman
Grrr... Another change in Actinic behaviour.
PHP isn't being executed within blocks of JavaScript if Actinic sees valid JavaScript comments that are designed to hide the JavaScript from very old browsers.
We can delete these comments as it's unlikely anyone will be using such an ancient browser.
I've amended my ReadMe for Collapso V1.19 to reflect this.
Look in the modified Collapso-5 Menu layout (around line 142) for the block of code:
Code: Select all
<script type="text/javascript">
<!-- V1.19
collclks('<actinic:block php="true">echo $firstid;</actinic:block>');
<actinic:block if="%3cactinic%3avariable%20name%3d%22CollapsoShowTree%22%20%2f%3e" >
var strail = new Array();
<actinic:block type="ParentSectionList">
strail.push('<actinic:block php="true">
echo str_replace("'", "\'", htmlspecialchars('<actinic:variable name="SectionName" encoding="perl" selectable="false" />'));
</actinic:block>');
</actinic:block>
walktree('<actinic:block php="true">echo $firstid;</actinic:block>',0);
</actinic:block>
// -->
</script>
Delete the lines
<!-- V1.19
and
// -->
Re: Excluding sections & subsections from collapso menu
Posted: Mon Dec 20, 2010 12:35 pm
by Artisan
Excellent, errors gone, many thanks.
Malcolm
Re: Excluding sections & subsections from collapso menu
Posted: Thu Dec 22, 2011 4:42 pm
by Artisan
Will that work on Collapso-5-V120-ActinicV10 or have things moved on since then?
Malcolm
Re: Excluding sections & subsections from collapso menu
Posted: Thu Dec 22, 2011 6:03 pm
by norman
That post was about a year ago for Actinic 10.0.2.
There seems to be no problem leaving the code as-is (with the comments) in 10.0.4.
However it won't hurt to delete the to lines if you want.
Re: Excluding sections & subsections from collapso menu
Posted: Sat Dec 24, 2011 12:42 pm
by Artisan
That works fine, Norman, many thanks!
Malcolm
Re: Excluding sections & subsections from collapso menu
Posted: Thu Jan 19, 2012 2:45 pm
by Artisan
Hi again Norman
I need to apply the same patch to Collapso V1.22 in a v11 site, I did give it a try but, not surprisingly, I'm getting a Javascript error. Is this patch now available for Coillapso V1.22 in Actinic v11?
Malcolm
Re: Excluding sections & subsections from collapso menu
Posted: Thu Jan 19, 2012 2:59 pm
by norman
Collapso V1.22 for Actinic V11 is OK as-is.
However, you cannot us V10 or earlier Collapso on a site that's been upgraded to V11. If this is the case you'll need an upgraded V11 version which costs £15 +VAT.
Re: Excluding sections & subsections from collapso menu
Posted: Thu Jan 19, 2012 3:09 pm
by Artisan
Hi Norman
That's the v1.22 that I purchased from you on 14th December 2011 (full version, I didn't know there was an upgrade price!), it's the "Hide From Collapso" patch that I was asking about.
Malcolm
Re: Excluding sections & subsections from collapso menu
Posted: Thu Jan 19, 2012 4:03 pm
by norman
Here's the Instructions for Actinic V11 Collapso V1.22.
I now have a general purpose sulution that will work with the current V11 Collapso (V1.22). It uses a new section-level variable Hide From Collapso that, if set true, hides that section and it's children. This is for use on top-level sections only. It should not be used on lower level sections.
Patch for Actinic V11 Collapso V1.22 ONLY is:
INSTALLATION
Go to Design / Library / Variables / Section. Right-click Section and choose New Variable.
Make the following settings
Code: Select all
Name: Hide From Collapso
Description: Whether to hide the Section in the Collapso Menu.
Defaults to false for all Sections.
Prompt: Hide From Collapso
Group: Section
Place Of Setting: Section
Tab Name: Properties
Allow <Use Parent>.. Checked
Type: True/False
Searchable: Unchecked
Upload: Unchecked
Initial Value: Use Parent ()
Top Level Value: False
Replace (in Site1) the file collapso-5.js with the following
Code: Select all
// Collapso-5 support V1.22 with Hide Top Level Section From Collapso
var parentlist = new Array();
var levellist = new Array();
var imagelist = new Array();
function shM(obj){ // [+] or [-] image has been clicked
var result = obj.id.match(/_(.*)_(.*)/);
if (result == null) return false;
var level = result[1] - 0;
var index = result[2] - 0;
var subid = 'ul_' + (level + 1) + '_' + (index + 1);
// first close any open menus at this level
if ( levellist[level] != null )
{
// swap back to [+] and deal with brochure home page
var oldimg = document.getElementById(imagelist[level]).src;
var newimg = oldimg.replace(/(.*\/).*/, '$1c-p' + '.gif');
document.getElementById(imagelist[level]).src = newimg;
// hide the sub-level
document.getElementById(levellist[level]).className = 'hOb';
}
// if we're clicking an already open menu just close it
if ( levellist[level] == subid )
{
levellist[level] = null;
return false;
}
// now open any sub-menu if it exists
if ( document.getElementById(subid) )
{
// swap back to [-] and deal with brochure home page
var imgid = 'im_' + (level) + '_' + (index);
var oldimg = document.getElementById(imgid).src;
var newimg = oldimg.replace(/(.*\/).*/, '$1c-m' + '.gif');
document.getElementById(imgid).src = newimg;
// show the sub-level
document.getElementById(subid).className = 'sOb';
// remember where we've opened sub-sections
levellist[level] = subid;
imagelist[level] = imgid;
}
return false;
}
function collclks(rootid){ // set an onclick event for our [+] images
var divs = document.getElementById(rootid).getElementsByTagName('div');
for(i = 0; i < divs.length; i++)
{
var imgs = divs[i].getElementsByTagName('img');
if ( imgs[0].id ) imgs[0].onclick = function(){shM(this);};
var ancs = divs[i].getElementsByTagName('a');
// if we're using OnlyFinalLinks turn intermediate links into [+] image onclicks.
if ( ancs[0].href.indexOf('#') > -1 ) ancs[0].href="javascript:document.getElementById('" + imgs[0].id + "').onclick();";
}
}
function walktree(list, level){ // traverse list and open up sections that match breadcrumb trail
if ( strail.length == 0 ) return; // not on a Section page
var list = document.getElementById(list);
var cnodes = list.childNodes;
var thistrail = "" + strail[level]; // extract current levels name
thistrail = thistrail.replace(/\s+/g,''); // despace (IE despaces innerHTML)
for ( var i = 0; i < cnodes.length; i++ )
{
var thisnode = cnodes[i];
if ( thisnode.nodeType != 1 ) continue; // skip non element type nodes
var links = thisnode.getElementsByTagName('a'); // get all anchor tags (we want 1st one)
var images = thisnode.getElementsByTagName('img'); // and all img tags (we want 1st one)
if ( links[0].innerHTML.replace(/\s+/g,'') == thistrail ) // if section name matches breadcrumb
{
// first and only image is the [+] icon if it has an id tag (no id tag if null icon)
if ( images[0].id ) document.getElementById(images[0].id).onclick(); // found it so fire onclick
var sublist = thisnode.getElementsByTagName('ul'); // see if any sub-lists
if ( sublist.length > 0 ) walktree(sublist[0].id, level + 1); // if so recurse and look for next breadcrumb
return; // all done so exit early
}
}
}
Go to Design / Library / Layouts / Collapso-5 Dynamic Menu / Collapso-5 Menu and replace
all code with the following
Code: Select all
<actinic:block php="true">
// V1.22 - HIDE TOP LEVEL SECTION MOD
$firstid = '';
</actinic:block>
<actinic:block if="%3cactinic%3avariable%20name%3d%22CollapsoDiagnostics%22%20%2f%3e%20%3d%3d%20true" >
<actinic:block php="true">
list($startusec, $startsec) = explode(" ", microtime());
</actinic:block>
</actinic:block>
<actinic:block php="true">
// V1.22 (also in code at bottom)
$maxdepth = <actinic:variable name="CollapsoMaxDepth" encoding="perl" selectable="false" />;
$iconafter = <actinic:variable name="CollapsoIconAfter" encoding="perl" selectable="false" />;
$iconspacer = '<actinic:variable name="CollapsoSeparator" encoding="perl" selectable="false" />';
$lastlevel = 0;
$inlist=false;
$onlyfinallinks = <actinic:variable name="CollapsoOnlyFinalLinks" selectable="false" selectable="false" />;
$thispage = '';
$classadjust = '';
$charcount = 0;
$linkhref = '#';
</actinic:block>
<actinic:block if="%28%3cactinic%3avariable%20name%3d%22PageType%22%20%2f%3e%20%3d%3d%20%22Section%22%29%20%7c%7c%20%28%3cactinic%3avariable%20name%3d%22PageType%22%20%2f%3e%20%3d%3d%20%22Product%20Page%22%29" >
<actinic:block php="true">
$thispage = '<actinic:variable name="SectionPageName" encoding="perl" selectable="false" />';
</actinic:block>
</actinic:block>
<div id="collapso5">
<actinic:block if="%3cactinic%3avariable%20name%3d%22CollapsoShowBrochure%22%20%2f%3e" >
<ul class="sOb">
<actinic:block type="BrochurePagesList">
<li class="nsc"><div><img class="nsi" src="c-n.gif"/> <a class="nsa" href="<actinic:variable name="BrochurePageURL" />"><actinic:variable name="BrochureName" /></a></div></li>
</actinic:block>
</ul>
</actinic:block>
<actinic:block type="EntireSectionList">
<actinic:block if="%3cactinic%3avariable%20name%3d%22SectionLevel%22%20%2f%3e%20%21%3d%200">
<actinic:block php="true">
/*
Menu needs unordered list of format
<div id="collapso5">
<ul class="sOb">
<li class="nsc"><div><img class="nsi" src="c-n.gif"/><a class="nsa" ... ">Top Section 1</a></div></li>
<li class="nsc"><div><img class="nsi" src="c-n.gif"/><a class="nsa" ... ">Top Section 2</a></div></li>
<li class="hsc"><div><img class="hsi" src="c-p.gif"/><a class="hsa" ... ">Top Section 3 with sub-section</a></div>
<ul class="hOb">
<li class="nsc"><div><img class="nsi" src="c-n.gif"/><a class="nsa" ... ">Sub Section A</a></div></li>
<li class="hsc"><div><img class="hsi" src="c-p.gif"/><a class="hsa" ... ">Sub Section B with sub-sub-section</a></div>
<ul class="hOb">
<li class="nsc"><div><img class="nsi" src="c-n.gif"/><a class="nsa" ... ">Sub-sub Section X</a></div></li>
</ul>
</li>
</ul>
</li>
<li class="nsc"><div><img class="nsi" src="c-n.gif"/><a class="nsa" ... ">Top Section 4</a></div></li>
</ul>
</div>
Each call of this code is for a Section line.
We can't generate the code right away as we need to wait to see if the next section is
at the same level.
So we save the link and name and output it at the next iteration.
*/
$thislevel = <actinic:variable name="SectionLevel" encoding="perl" selectable="false" />;
$index = <actinic:variable name="ListIndex" encoding="perl" selectable="false" /> - 1;
$hidefromcollapso = <actinic:variable name="Hide From Collapso" encoding="perl" selectable="false" />;
$currentid = 'ul_' . $thislevel . '_' . $index;
if ( (($maxdepth == 0) || ($thislevel <= $maxdepth)) && (! $hidefromcollapso) )
{
if ( $firstid == '' ) $firstid = $currentid;
if ( $thislevel > $lastlevel ) // Start a new list (also done for first item)
{
// no LI if very first call - we just need to start an UL
if ( $inlist )
{
// show that previous item has sub-section
if ( $onlyfinallinks ) $linkhref = '#';
$bits[0] = "<img class=\"hsi\" id=\"im_$linklevel" . "_$linkindex\" src=\"c-p.gif\"/>";
$bits[1] = "<a class=\"hsa$classadjust\" href=\"$linkhref\">$linkname</a>";
if ( $iconafter ) $bits = array_reverse($bits);
$html = "<li class=\"hsc\"><div>$bits[0]$iconspacer$bits[1]</div>";
echo $html;
$charcount += strlen($html);
}
// now start sub-section list
while ( $lastlevel < $thislevel )
{
$nmclass = ( $thislevel == 1 ) ? 'class="sOb"' : 'class="hOb"'; // show only 1st level lists
$html = "<ul id=\"$currentid\" $nmclass >";
echo $html;
$charcount += strlen($html);
$lastlevel++;
}
}
else if ( $thislevel < $lastlevel ) // Returning from a sub-section
{
$bits[0] = "<img class=\"nsi\" src=\"c-n.gif\" />";
$bits[1] = "<a class=\"nsa$classadjust\" href=\"$linkhref\">$linkname</a>";
if ( $iconafter ) $bits = array_reverse($bits);
$html = "<li class=\"nsc\"><div>$bits[0]$iconspacer$bits[1]</div></li>";
echo $html;
$charcount += strlen($html);
while ( $lastlevel > $thislevel )
{
echo '</ul></li>';
$charcount += 10;
$lastlevel--;
}
}
else // same level as previous item
{
$bits[0] = "<img class=\"nsi\" src=\"c-n.gif\" />";
$bits[1] = "<a class=\"nsa$classadjust\" href=\"$linkhref\">$linkname</a>";
if ( $iconafter ) $bits = array_reverse($bits);
$html = "<li class=\"nsc\"><div>$bits[0]$iconspacer$bits[1]</div></li>";
echo $html;
$charcount += strlen($html);
}
$inlist = true;
// store LI code for next iteration
$linkhref = '<actinic:block if="%3cactinic%3avariable%20name%3d%22IsLoginPageSuppressed%22%20%2f%3e%20AND%0d%3cactinic%3avariable%20name%3d%22UnregCustomersAreNotAllowed%22%20%2f%3e" ><actinic:variable name="SectionPageName" encoding="perl" selectable="false" /></actinic:block><actinic:block if="%28%3cactinic%3avariable%20name%3d%22IsLoginPageSuppressed%22%20%2f%3e%20%3d%3d%20false%29%20OR%0d%28%3cactinic%3avariable%20name%3d%22UnregCustomersAreNotAllowed%22%20%2f%3e%20%3d%3d%20false%29" ><actinic:variable name="SectionURL" encoding="perl" selectable="false"/></actinic:block>';
$linkname = htmlspecialchars('<Actinic:Variable Name="SectionName" php="true" encoding="perl" selectable="false" />');
$linklevel = $thislevel;
$linkindex = $index;
$currentsection = '<actinic:variable name="SectionPageName" encoding="perl" selectable="false" />';
$classadjust = ( $currentsection == $thispage ) ? '_c' : '';
}
</actinic:block>
</actinic:block></actinic:block>
<actinic:block php="true">
$bits[0] = "<img class=\"nsi\" src=\"c-n.gif\" />";
$bits[1] = "<a class=\"nsa$classadjust\" href=\"$linkhref\">$linkname</a>";
if ( $iconafter ) $bits = array_reverse($bits);
echo "<li class=\"nsc\"><div>$bits[0]$iconspacer$bits[1]</div></li>";
while ( $thislevel-- > 1 )
{
echo '</ul></li>';
$charcount += 10;
}
</actinic:block></ul>
</div>
<script type="text/javascript">
<!-- V1.22
collclks('<actinic:block php="true">echo $firstid;</actinic:block>');
<actinic:block if="%3cactinic%3avariable%20name%3d%22CollapsoShowTree%22%20%2f%3e" >
var strail = new Array();
<actinic:block type="ParentSectionList">
strail.push('<actinic:block php="true">
echo str_replace("'", "\'", htmlspecialchars('<actinic:variable name="SectionName" encoding="perl" selectable="false" />'));
</actinic:block>');
</actinic:block>
walktree('<actinic:block php="true">echo $firstid;</actinic:block>',0);
</actinic:block>
// -->
</script>
<actinic:block if="%3cactinic%3avariable%20name%3d%22CollapsoDiagnostics%22%20%2f%3e%20%3d%3d%20true" >
<actinic:block php="true">
list($endusec, $endsec) = explode(" ", microtime());
$duration = ((float)$endusec + (float)$endsec) - ((float)$startusec + (float)$startsec);
echo "<br><b>Duration: $duration <br>Bytes: $charcount </b>";
</actinic:block>
</actinic:block>
That's installation finished
OPERATION
In a top-level Section Details / Properties, set Hide From Collapso to true for those Sections
that you want to hide. Do not use on sub-sections and make sure that all sub-sections
have Use Parent set for this variable.
NOTES
This is supplied without any guarantees that it will work in all cases.
Re: Excluding sections & subsections from collapso menu
Posted: Fri Jan 20, 2012 10:42 am
by Artisan
Excellent - many thanks Norman!
Malcolm
Re: Excluding sections & subsections from collapso menu
Posted: Sun May 12, 2013 6:20 pm
by norman
Here's the ReadMe for Collapso V1.25 for SellerDeck V12.
I now have a general purpose sulution that will work with the current Collapso (V1.25 SellerDeck V12). It uses a new section-level variable Hide From Collapso that, if set true, hides that section and it's children. This is for use on top-level sections only. It should not be used on lower level sections.
Patch for Collapso V1.19 ONLY is:
Collapso modification to allow hiding of certain top-level sections.
FOR Collapso V1.25 / SellerDeck V12 ONLY
INSTALLATION
Go to Design / Library / Variables / Section. Right-click Section and choose New Variable.
Make the following settings
Code: Select all
Name: Hide From Collapso
Description: Whether to hide the Section in the Collapso Menu.
Defaults to false for all Sections.
Prompt: Hide From Collapso
Group: Section
Place Of Setting: Section
Tab Name: Properties
Allow <Use Parent>.. Checked
Type: True/False
Searchable: Unchecked
Upload: Unchecked
Initial Value: Use Parent ()
Top Level Value: False
Replace (in Site1) the file collapso-5.js with the following
Code: Select all
// Collapso-5 support SDV12-V1.23 - HIDE TOP LEVEL SECTION MOD
var parentlist = new Array();
var levellist = new Array();
var imagelist = new Array();
function shM(obj){ // [+] or [-] image has been clicked
var result = obj.id.match(/_(.*)_(.*)/);
if (result == null) return false;
var level = result[1] - 0;
var index = result[2] - 0;
var subid = 'ul_' + (level + 1) + '_' + (index + 1);
// first close any open menus at this level
if ( levellist[level] != null )
{
// swap back to [+] and deal with brochure home page
var oldimg = document.getElementById(imagelist[level]).src;
var newimg = oldimg.replace(/(.*\/).*/, '$1c-p' + '.gif');
document.getElementById(imagelist[level]).src = newimg;
// hide the sub-level
document.getElementById(levellist[level]).className = 'hOb';
}
// if we're clicking an already open menu just close it
if ( levellist[level] == subid )
{
levellist[level] = null;
return false;
}
// now open any sub-menu if it exists
if ( document.getElementById(subid) )
{
// swap back to [-] and deal with brochure home page
var imgid = 'im_' + (level) + '_' + (index);
var oldimg = document.getElementById(imgid).src;
var newimg = oldimg.replace(/(.*\/).*/, '$1c-m' + '.gif');
document.getElementById(imgid).src = newimg;
// show the sub-level
document.getElementById(subid).className = 'sOb';
// remember where we've opened sub-sections
levellist[level] = subid;
imagelist[level] = imgid;
}
return false;
}
function collclks(rootid){ // set an onclick event for our [+] images
var divs = document.getElementById(rootid).getElementsByTagName('div');
for(i = 0; i < divs.length; i++)
{
var imgs = divs[i].getElementsByTagName('img');
if ( imgs[0].id ) imgs[0].onclick = function(){shM(this);};
var ancs = divs[i].getElementsByTagName('a');
// if we're using OnlyFinalLinks turn intermediate links into [+] image onclicks.
if ( ancs[0].href.indexOf('#') > -1 ) ancs[0].href="javascript:document.getElementById('" + imgs[0].id + "').onclick();";
}
}
function walktree(list, level){ // traverse list and open up sections that match breadcrumb trail
if ( strail.length == 0 ) return; // not on a Section page
var list = document.getElementById(list);
var cnodes = list.childNodes;
var thistrail = "" + strail[level]; // extract current levels name
thistrail = thistrail.replace(/\s+/g,''); // despace (IE despaces innerHTML)
for ( var i = 0; i < cnodes.length; i++ )
{
var thisnode = cnodes[i];
if ( thisnode.nodeType != 1 ) continue; // skip non element type nodes
var links = thisnode.getElementsByTagName('a'); // get all anchor tags (we want 1st one)
var images = thisnode.getElementsByTagName('img'); // and all img tags (we want 1st one)
if ( links[0].innerHTML.replace(/\s+/g,'') == thistrail ) // if section name matches breadcrumb
{
// first and only image is the [+] icon if it has an id tag (no id tag if null icon)
if ( images[0].id ) document.getElementById(images[0].id).onclick(); // found it so fire onclick
var sublist = thisnode.getElementsByTagName('ul'); // see if any sub-lists
if ( sublist.length > 0 ) walktree(sublist[0].id, level + 1); // if so recurse and look for next breadcrumb
return; // all done so exit early
}
}
}
Go to Design / Library / Layouts / Collapso-5 Dynamic Menu / Collapso-5 Menu and replace
all code with the following
Code: Select all
<actinic:block php="true">
// V1.25 - HIDE TOP LEVEL SECTION MOD
$firstid = '';
</actinic:block>
<actinic:block if="%3cactinic%3avariable%20name%3d%22CollapsoDiagnostics%22%20%2f%3e%20%3d%3d%20true" >
<actinic:block php="true">
list($startusec, $startsec) = explode(" ", microtime());
</actinic:block>
</actinic:block>
<actinic:block php="true">
// V1.24 (also in code at bottom)
$maxdepth = <actinic:variable name="CollapsoMaxDepth" encoding="perl" selectable="false" />;
$iconafter = <actinic:variable name="CollapsoIconAfter" encoding="perl" selectable="false" />;
$iconspacer = '<actinic:variable name="CollapsoSeparator" encoding="perl" selectable="false" />';
$lastlevel = 0;
$inlist=false;
$onlyfinallinks = <actinic:variable name="CollapsoOnlyFinalLinks" selectable="false" selectable="false" />;
$thispage = '';
$classadjust = '';
$charcount = 0;
$linkhref = '#';
</actinic:block>
<actinic:block if="%28%3cactinic%3avariable%20name%3d%22PageType%22%20%2f%3e%20%3d%3d%20%22Section%22%29%20%7c%7c%20%28%3cactinic%3avariable%20name%3d%22PageType%22%20%2f%3e%20%3d%3d%20%22Product%20Page%22%29" >
<actinic:block php="true">
$thispage = '<actinic:variable name="SectionPageName" encoding="perl" selectable="false" />';
</actinic:block>
</actinic:block>
<div id="collapso5">
<actinic:block if="%3cactinic%3avariable%20name%3d%22CollapsoShowBrochure%22%20%2f%3e" >
<ul class="sOb">
<actinic:block type="BrochurePagesList">
<li class="nsc"><div><img class="nsi" src="c-n.gif"/> <a class="nsa" href="<actinic:variable name="BrochurePageURL" />"><actinic:variable name="BrochureName" /></a></div></li>
</actinic:block>
</ul>
</actinic:block>
<actinic:block type="EntireSectionList"><actinic:block if="%3cactinic%3avariable%20name%3d%22SectionLevel%22%20%2f%3e%20%21%3d%200"><actinic:block php="true">
/*
Menu needs unordered list of format
<div id="collapso5">
<ul class="sOb">
<li class="nsc"><div><img class="nsi" src="c-n.gif"/><a class="nsa" ... ">Top Section 1</a></div></li>
<li class="nsc"><div><img class="nsi" src="c-n.gif"/><a class="nsa" ... ">Top Section 2</a></div></li>
<li class="hsc"><div><img class="hsi" src="c-p.gif"/><a class="hsa" ... ">Top Section 3 with sub-section</a></div>
<ul class="hOb">
<li class="nsc"><div><img class="nsi" src="c-n.gif"/><a class="nsa" ... ">Sub Section A</a></div></li>
<li class="hsc"><div><img class="hsi" src="c-p.gif"/><a class="hsa" ... ">Sub Section B with sub-sub-section</a></div>
<ul class="hOb">
<li class="nsc"><div><img class="nsi" src="c-n.gif"/><a class="nsa" ... ">Sub-sub Section X</a></div></li>
</ul>
</li>
</ul>
</li>
<li class="nsc"><div><img class="nsi" src="c-n.gif"/><a class="nsa" ... ">Top Section 4</a></div></li>
</ul>
</div>
Each call of this code is for a Section line.
We can't generate the code right away as we need to wait to see if the next section is
at the same level.
So we save the link and name and output it at the next iteration.
*/
$thislevel = <actinic:variable name="SectionLevel" encoding="perl" selectable="false" />;
$index = <actinic:variable name="ListIndex" encoding="perl" selectable="false" />;
$hidefromcollapso = <actinic:variable name="Hide From Collapso" encoding="perl" selectable="false" />;
$currentid = 'ul_' . $thislevel . '_' . $index;
if ( (($maxdepth == 0) || ($thislevel <= $maxdepth)) && (! $hidefromcollapso) )
{
if ( $firstid == '' ) $firstid = $currentid;
if ( $thislevel > $lastlevel ) // Start a new list (also done for first item)
{
// no LI if very first call - we just need to start an UL
if ( $inlist )
{
// show that previous item has sub-section
if ( $onlyfinallinks ) $linkhref = '#';
$bits[0] = "<img class=\"hsi\" id=\"im_$linklevel" . "_$linkindex\" src=\"c-p.gif\"/>";
$bits[1] = "<a class=\"hsa$classadjust\" href=\"$linkhref\">$linkname</a>";
if ( $iconafter ) $bits = array_reverse($bits);
$html = "<li class=\"hsc\"><div>$bits[0]$iconspacer$bits[1]</div>";
echo $html;
$charcount += strlen($html);
}
// now start sub-section list
while ( $lastlevel < $thislevel )
{
$nmclass = ( $thislevel == 1 ) ? 'class="sOb"' : 'class="hOb"'; // show only 1st level lists
$html = "<ul id=\"$currentid\" $nmclass >";
echo $html;
$charcount += strlen($html);
$lastlevel++;
}
}
else if ( $thislevel < $lastlevel ) // Returning from a sub-section
{
$bits[0] = "<img class=\"nsi\" src=\"c-n.gif\" />";
$bits[1] = "<a class=\"nsa$classadjust\" href=\"$linkhref\">$linkname</a>";
if ( $iconafter ) $bits = array_reverse($bits);
$html = "<li class=\"nsc\"><div>$bits[0]$iconspacer$bits[1]</div></li>";
echo $html;
$charcount += strlen($html);
while ( $lastlevel > $thislevel )
{
echo '</ul></li>';
$charcount += 10;
$lastlevel--;
}
}
else // same level as previous item
{
$bits[0] = "<img class=\"nsi\" src=\"c-n.gif\" />";
$bits[1] = "<a class=\"nsa$classadjust\" href=\"$linkhref\">$linkname</a>";
if ( $iconafter ) $bits = array_reverse($bits);
$html = "<li class=\"nsc\"><div>$bits[0]$iconspacer$bits[1]</div></li>";
echo $html;
$charcount += strlen($html);
}
$inlist = true;
// store LI code for next iteration
$linkhref = '<actinic:block if="%3cactinic%3avariable%20name%3d%22IsLoginPageSuppressed%22%20%2f%3e%20AND%0d%3cactinic%3avariable%20name%3d%22UnregCustomersAreNotAllowed%22%20%2f%3e" ><actinic:variable name="SectionPageName" encoding="perl" selectable="false" /></actinic:block><actinic:block if="%28%3cactinic%3avariable%20name%3d%22IsLoginPageSuppressed%22%20%2f%3e%20%3d%3d%20false%29%20OR%0d%28%3cactinic%3avariable%20name%3d%22UnregCustomersAreNotAllowed%22%20%2f%3e%20%3d%3d%20false%29" ><actinic:variable name="SectionURL" encoding="perl" selectable="false"/></actinic:block>';
$linkname = htmlspecialchars('<Actinic:Variable Name="SectionName" php="true" encoding="perl" selectable="false" />');
$linklevel = $thislevel;
$linkindex = $index;
$currentsection = '<actinic:variable name="SectionPageName" encoding="perl" selectable="false" />';
$classadjust = ( $currentsection == $thispage ) ? '_c' : '';
}
</actinic:block></actinic:block></actinic:block>
<actinic:block php="true">
$bits[0] = "<img class=\"nsi\" src=\"c-n.gif\" />";
$bits[1] = "<a class=\"nsa$classadjust\" href=\"$linkhref\">$linkname</a>";
if ( $iconafter ) $bits = array_reverse($bits);
echo "<li class=\"nsc\"><div>$bits[0]$iconspacer$bits[1]</div></li>";
while ( $thislevel-- > 1 )
{
echo '</ul></li>';
$charcount += 10;
}
</actinic:block></ul>
</div>
<script type="text/javascript">
<!-- V1.24
collclks('<actinic:block php="true">echo $firstid;</actinic:block>');
<actinic:block if="%3cactinic%3avariable%20name%3d%22CollapsoShowTree%22%20%2f%3e" >
var strail = new Array();
<actinic:block type="ParentSectionList">
strail.push('<actinic:block php="true">
echo str_replace("'", "\'", htmlspecialchars('<actinic:variable name="SectionName" encoding="perl" selectable="false" />'));
</actinic:block>');
</actinic:block>
walktree('<actinic:block php="true">echo $firstid;</actinic:block>',0);
</actinic:block>
// -->
</script>
<actinic:block if="%3cactinic%3avariable%20name%3d%22CollapsoDiagnostics%22%20%2f%3e%20%3d%3d%20true" >
<actinic:block php="true">
list($endusec, $endsec) = explode(" ", microtime());
$duration = ((float)$endusec + (float)$endsec) - ((float)$startusec + (float)$startsec);
echo "<br><b>Duration: $duration <br>Bytes: $charcount </b>";
</actinic:block>
</actinic:block>
That's installation finished
OPERATION
In a top-level Section Details / Properties, set Hide From Collapso to true for those Sections
that you want to hide. Do not use on sub-sections and make sure that all sub-sections
have Use Parent set for this variable.
NOTES
This is supplied without any guarantees that it will work in all cases.