Skip to content

Commit

Permalink
Item1845: add default menu for MenuListPlugin
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.foswiki.org/trunk/MenuListPlugin@4537 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
SvenDowideit authored and SvenDowideit committed Jul 23, 2009
1 parent b7e7ddb commit 0c7d48c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
9 changes: 9 additions & 0 deletions data/System/MenuListDefault.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

---++ default menu definition used by %SYSTEMWEB%.MenuListPlugin
* %SYSTEMWEB%.UserRegistration
%WEBLIST{
" * [[$name.%HOMETOPIC%][$name]]
* [[$name.WebChanges][Changes]]
* [[$name.WebSearch][Search]]
* [[$name.WebNotify][Subscribe]]"
}%
7 changes: 6 additions & 1 deletion lib/Foswiki/Plugins/MenuListPlugin.pm
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ our $VERSION = '$Rev: 3193 $';
our $RELEASE = '$Date: 2009-03-20 03:32:09 +1100 (Fri, 20 Mar 2009) $';
our $SHORTDESCRIPTION = 'dynamic Folding menu list';
our $NO_PREFS_IN_TOPIC = 1;
our $baseWeb;
our $baseTopic;

sub initPlugin {
Expand All @@ -39,6 +40,7 @@ sub initPlugin {
}

$baseTopic = $topic;
$baseWeb = $web;

Foswiki::Func::registerTagHandler( 'MENULIST', \&MENULIST );

Expand Down Expand Up @@ -78,7 +80,10 @@ sub MENULIST {
foreach my $line (split(/[\n\r]+/, $string)) {
if ($line =~ /^(\t+)\*\s+(.*)$/) {
push(@list, {tabs=>$1, length=>length($1), string=>$2});
if (($currentTopicIndex < 0) and ($list[$#list]{string} =~ /.*$baseTopic.*/)) {
# my ($w, $t) = Foswiki::Func::normalizeWebTopicName($baseWeb, $list[$#list]{string});
if (($currentTopicIndex < 0) and
($list[$#list]{string} =~ /.*$baseWeb\.$baseTopic.*/)
) {
$currentTopicIndex = $#list;
}
} else {
Expand Down
1 change: 1 addition & 0 deletions lib/Foswiki/Plugins/MenuListPlugin/MANIFEST
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Release manifest for MenuListPlugin
data/System/MenuListPlugin.txt 0644 Documentation
lib/Foswiki/Plugins/MenuListPlugin.pm 0644 Perl module
data/System/MenuListDefault.txt

0 comments on commit 0c7d48c

Please sign in to comment.