[wellwell-devel] [SCM] Interchange wellwell catalog branch, master, updated. 5298e89b2edb88fc0422ff6e8d7d8c56d2e10f00
Stefan Hornburg
racke at rt.icdevgroup.org
Sun May 31 11:15:48 UTC 2009
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Interchange wellwell catalog".
The branch, master has been updated
via 5298e89b2edb88fc0422ff6e8d7d8c56d2e10f00 (commit)
from 42dbdf74e03ae9fc44e40d2a31d266f623ffdd20 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 5298e89b2edb88fc0422ff6e8d7d8c56d2e10f00
Author: Stefan Hornburg (Racke) <racke at linuxia.de>
Date: Sun May 31 13:15:21 2009 +0200
replace embedded perl in menu component with new [menu-display] tag
-----------------------------------------------------------------------
Summary of changes and diff:
code/menu_display.tag | 42 ++++++++++++++++++++++++++++++++++++++++++
components/menu | 23 +----------------------
2 files changed, 43 insertions(+), 22 deletions(-)
create mode 100644 code/menu_display.tag
diff --git a/code/menu_display.tag b/code/menu_display.tag
new file mode 100644
index 0000000..fa1a63f
--- /dev/null
+++ b/code/menu_display.tag
@@ -0,0 +1,42 @@
+UserTag menu_display Order name
+UserTag menu_display AddAttr
+UserTag menu_display Routine <<EOR
+sub {
+ my ($name, $opt) = @_;
+ my ($set, $uri, @entries, $name_qtd, @fields, $fstr, $base_url, $selected);
+
+ $Tag->perl({tables => 'menus'});
+
+ $name_qtd = $Db{menus}->quote($name);
+
+ @fields = qw/code name url parent permission/;
+
+ $fstr = join(',', @fields);
+
+ $set = $Db{menus}->query({sql => qq{select $fstr from menus where menu_name = $name_qtd order by parent asc, weight desc, code}, hashref => 1});
+
+ if ($opt->{selected}) {
+ $base_url = $Session->{last_url};
+ $base_url =~ s%^/%%;
+ }
+
+ for (@$set) {
+ next unless $Tag->acl('check', $_->{permission});
+
+ if ($opt->{selected}) {
+ if (index($base_url, $_->{url}) == 0) {
+ $selected = qq{ class="$opt->{selected}"};
+ }
+ else {
+ $selected = '';
+ }
+ }
+
+ $uri = $Tag->area($_->{url});
+
+ push(@entries, qq{<li$selected><a href="$uri">$_->{name}</a></li>});
+ }
+
+ return q{<ul>} . join('', @entries) . q{</ul>};
+}
+EOR
\ No newline at end of file
diff --git a/components/menu b/components/menu
index bdbc785..f5c5044 100644
--- a/components/menu
+++ b/components/menu
@@ -1,22 +1 @@
-[perl tables="menus users roles user_roles permissions"]
-my ($menu_name, $joiner, @entries);
-
-$menu_name = $Variable->{NAME} || 'main';
-$joiner = exists $Variable->{JOINER} ? $Variable->{JOINER} : ' | ';
-$style = $Variable->{STYLE};
-
-my ($set, $url);
-$set = $Db{menus}->query(q{select name,url,permission from menus where menu_name = '%s' order by weight desc,name}, $menu_name);
-
-for (@$set) {
- next unless $Tag->acl('check', $_->[2]);
- $url = $Tag->area({href => $_->[1]});
-
- push (@entries, qq{<a href="$url"><span>$_->[0]</span></a>});
-}
-
-if (@entries && $style eq 'list') {
- return '<ul>' . join('', map {"<li>$_</li>"} @entries) . '</ul>';
-}
-return join($joiner, @entries);
-[/perl]
+[menu-display __NAME__]
\ No newline at end of file
hooks/post-receive
--
Interchange wellwell catalog
More information about the wellwell-devel
mailing list