Added rootmenu macro.
This commit is contained in:
parent
71a1e2eea0
commit
43d53997a5
1 changed files with 63 additions and 0 deletions
63
lib/WebGUI/Macro/rootmenuHorizontal.pm
Normal file
63
lib/WebGUI/Macro/rootmenuHorizontal.pm
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
package WebGUI::Macro::rootmenuHorizontal;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001-2002 Plain Black Software.
|
||||
#-------------------------------------------------------------------
|
||||
# Please read the legal notices (docs/legal.txt) and the license
|
||||
# (docs/license.txt) that came with this distribution before using
|
||||
# this software.
|
||||
#-------------------------------------------------------------------
|
||||
# http://www.plainblack.com info@plainblack.com
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
use strict;
|
||||
use WebGUI::Macro;
|
||||
use WebGUI::Macro::Shared;
|
||||
use WebGUI::Privilege;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::SQL;
|
||||
use WebGUI::URL;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub _replacement {
|
||||
my ($temp, @data, $pageTitle, $parentId, $sth, $first, @param, $delimeter);
|
||||
@param = WebGUI::Macro::getParams($_[0]);
|
||||
if ($param[0] eq "") {
|
||||
$delimeter = " · ";
|
||||
} else {
|
||||
$delimeter = " ".$param[0]." ";
|
||||
}
|
||||
$temp = '<span class="horizontalMenu">';
|
||||
$first = 1;
|
||||
$sth = WebGUI::SQL->read("select menuTitle,urlizedTitle,pageId from page where parentId=0 and (pageId=1 or pageId>25) order by sequenceNumber");
|
||||
while (@data = $sth->array) {
|
||||
if (WebGUI::Privilege::canViewPage($data[2])) {
|
||||
if ($first) {
|
||||
$first = 0;
|
||||
} else {
|
||||
$temp .= $delimeter;
|
||||
}
|
||||
$temp .= '<a class="horizontalMenu" href="'.WebGUI::URL::gateway($data[1]).'">';
|
||||
if ($session{page}{pageId} == $data[2]) {
|
||||
$temp .= '<span class="selectedMenuItem">'.$data[0].'</span>';
|
||||
} else {
|
||||
$temp .= $data[0];
|
||||
}
|
||||
$temp .= '</a>';
|
||||
}
|
||||
}
|
||||
$sth->finish;
|
||||
$temp .= '</span>';
|
||||
return $temp;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub process {
|
||||
my ($output);
|
||||
$output = $_[0];
|
||||
$output =~ s/\^rootmenu\((.*?)\)\;/_replacement($1)/ge;
|
||||
return $output;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue