aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/comanche.php15
-rw-r--r--include/menu.php7
-rw-r--r--view/tpl/usermenu.tpl6
3 files changed, 23 insertions, 5 deletions
diff --git a/include/comanche.php b/include/comanche.php
index 630c4f655..f385f3c5a 100644
--- a/include/comanche.php
+++ b/include/comanche.php
@@ -101,11 +101,22 @@ function comanche_parser(&$a, $s, $pass = 0) {
}
-function comanche_menu($name, $class = '') {
+function comanche_menu($s, $class = '') {
+
$channel_id = comanche_get_channel_id();
+ $name = $s;
+
+ $cnt = preg_match_all("/\[var=(.*?)\](.*?)\[\/var\]/ism", $s, $matches, PREG_SET_ORDER);
+ if($cnt) {
+ foreach($matches as $mtch) {
+ $var[$mtch[1]] = $mtch[2];
+ $name = str_replace($mtch[0], '', $name);
+ }
+ }
+
if($channel_id) {
$m = menu_fetch($name,$channel_id, get_observer_hash());
- return menu_render($m, $class);
+ return menu_render($m, $class, $edit = false, $var);
}
}
diff --git a/include/menu.php b/include/menu.php
index b4f4555a5..a2e91f7ed 100644
--- a/include/menu.php
+++ b/include/menu.php
@@ -24,7 +24,7 @@ function menu_fetch($name,$uid,$observer_xchan) {
return null;
}
-function menu_render($menu, $class='', $edit = false) {
+function menu_render($menu, $class='', $edit = false, $var = '') {
if(! $menu)
return '';
@@ -37,12 +37,15 @@ function menu_render($menu, $class='', $edit = false) {
$menu['items'][$x]['mitem_desc'] = bbcode($menu['items'][$x]['mitem_desc']);
}
+ $wrap = (($var['wrap'] === 'none') ? false : true);
+
return replace_macros(get_markup_template('usermenu.tpl'),array(
'$menu' => $menu['menu'],
'$class' => $class,
'$edit' => (($edit) ? t("Edit") : ''),
'$id' => $menu['menu']['menu_id'],
- '$items' => $menu['items']
+ '$items' => $menu['items'],
+ '$wrap' => $wrap
));
}
diff --git a/view/tpl/usermenu.tpl b/view/tpl/usermenu.tpl
index 57caf25fc..7284826a2 100644
--- a/view/tpl/usermenu.tpl
+++ b/view/tpl/usermenu.tpl
@@ -1,13 +1,17 @@
+{{if $wrap}}
<div id="pmenu-{{$id}}" class="pmenu{{if !$class}} widget{{else}} {{$class}}{{/if}}">
+{{/if}}
{{if $menu.menu_desc}}
<h3 class="pmenu-title">{{$menu.menu_desc}}{{if $edit}} <a href="mitem/{{$menu.menu_id}}" title="{{$edit}}"><i class="icon-pencil fakelink" title="{{$edit}}"></i></a>{{/if}}</h3>
{{/if}}
{{if $items }}
- <ul class="pmenu-body{{if !$class}} nav nav-pills nav-stacked{{/if}}">
+ <ul class="pmenu-body{{if $wrap && !$class}} nav nav-pills nav-stacked{{elseif !$wrap && $class}} {{$class}}{{/if}}">
{{foreach $items as $mitem }}
<li id="pmenu-item-{{$mitem.mitem_id}}" class="pmenu-item"><a href="{{$mitem.mitem_link}}" {{if $mitem.newwin}}target="_blank"{{/if}}>{{$mitem.mitem_desc}}</a></li>
{{/foreach }}
</ul>
{{/if}}
+{{if $wrap}}
<div class="pmenu-end"></div>
</div>
+{{/if}}