aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2015-05-29 13:08:01 +0200
committerMario Vavti <mario@mariovavti.com>2015-05-29 13:08:01 +0200
commitb8d328076384ff48be47f59366aea8b1e1cc04a1 (patch)
tree81f0c9ac22a7ca48bf6aa6ccde8c738d5620caa3
parent5f1ae2930b5ae69e142aed84f70afe5cde8cc38f (diff)
downloadvolse-hubzilla-b8d328076384ff48be47f59366aea8b1e1cc04a1.tar.gz
volse-hubzilla-b8d328076384ff48be47f59366aea8b1e1cc04a1.tar.bz2
volse-hubzilla-b8d328076384ff48be47f59366aea8b1e1cc04a1.zip
some fixes to make menu sharing work and expose it in the ui.
-rw-r--r--include/bbcode.php3
-rw-r--r--include/menu.php10
-rw-r--r--mod/impel.php14
-rw-r--r--view/css/mod_menu.css8
-rw-r--r--view/tpl/menulist.tpl18
5 files changed, 30 insertions, 23 deletions
diff --git a/include/bbcode.php b/include/bbcode.php
index 1f5a65399..a766b6aea 100644
--- a/include/bbcode.php
+++ b/include/bbcode.php
@@ -193,6 +193,9 @@ function translate_design_element($type) {
case 'block':
$ret = t('block');
break;
+ case 'menu':
+ $ret = t('menu');
+ break;
}
return $ret;
diff --git a/include/menu.php b/include/menu.php
index 5c078c189..ae53945ef 100644
--- a/include/menu.php
+++ b/include/menu.php
@@ -28,10 +28,10 @@ function menu_element($menu) {
$arr = array();
$arr['type'] = 'menu';
- $arr['name'] = $menu['menu_name'];
- $arr['desc'] = $menu['menu_desc'];
- $arr['created'] = $menu['menu_created'];
- $arr['edited'] = $menu['menu_edited'];
+ $arr['pagetitle'] = $menu['menu']['menu_name'];
+ $arr['desc'] = $menu['menu']['menu_desc'];
+ $arr['created'] = $menu['menu']['menu_created'];
+ $arr['edited'] = $menu['menu']['menu_edited'];
$arr['baseurl'] = z_root();
if($menu['menu_flags']) {
@@ -124,7 +124,6 @@ function menu_fetch_id($menu_id,$channel_id) {
function menu_create($arr) {
-
$menu_name = trim(escape_tags($arr['menu_name']));
$menu_desc = trim(escape_tags($arr['menu_desc']));
$menu_flags = intval($arr['menu_flags']);
@@ -287,7 +286,6 @@ function menu_delete_id($menu_id, $uid) {
function menu_add_item($menu_id, $uid, $arr) {
-
$mitem_link = escape_tags($arr['mitem_link']);
$mitem_desc = escape_tags($arr['mitem_desc']);
$mitem_order = intval($arr['mitem_order']);
diff --git a/mod/impel.php b/mod/impel.php
index 5bc850562..813990a7d 100644
--- a/mod/impel.php
+++ b/mod/impel.php
@@ -2,6 +2,7 @@
// import page design element
+require_once('include/menu.php');
function impel_init(&$a) {
@@ -21,7 +22,6 @@ function impel_init(&$a) {
if(! $j)
json_return_and_die($ret);
-
$channel = $a->get_channel();
$arr = array();
@@ -57,10 +57,11 @@ function impel_init(&$a) {
logger('mod_impel: unrecognised element type' . print_r($j,true));
break;
}
+
if($is_menu) {
$m = array();
$m['menu_channel_id'] = local_channel();
- $m['menu_name'] = $j['name'];
+ $m['menu_name'] = $j['pagetitle'];
$m['menu_desc'] = $j['desc'];
if($j['created'])
$m['menu_created'] = datetime_convert($j['created']);
@@ -75,13 +76,16 @@ function impel_init(&$a) {
$m['menu_flags'] |= MENU_SYSTEM;
}
- $menu_id = $menu_create($m);
+
+ $menu_id = menu_create($m);
+
if($menu_id) {
if(is_array($j['items'])) {
foreach($j['items'] as $it) {
$mitem = array();
+
$mitem['mitem_link'] = str_replace('[baseurl]',z_root(),$it['link']);
- $mitem['mitem_desc'] = escapetags($it['link']);
+ $mitem['mitem_desc'] = escape_tags($it['desc']);
$mitem['mitem_order'] = intval($it['order']);
if(is_array($it['flags'])) {
$mitem['mitem_flags'] = 0;
@@ -98,7 +102,7 @@ function impel_init(&$a) {
$x = q("update menu set menu_edited = '%s' where menu_id = %d and menu_channel_id = %d",
dbesc(datetime_convert('UTC','UTC',$j['edited'])),
intval($menu_id),
- intval(channel_id())
+ intval(local_channel())
);
}
}
diff --git a/view/css/mod_menu.css b/view/css/mod_menu.css
index c3edec9fe..7f0f40246 100644
--- a/view/css/mod_menu.css
+++ b/view/css/mod_menu.css
@@ -7,14 +7,14 @@
white-space: nowrap;
}
-#menu-list-table th:nth-child(6),
-#menu-list-table td:nth-child(6) {
+#menu-list-table th:nth-child(7),
+#menu-list-table td:nth-child(7) {
padding: 7px 3px;
white-space: nowrap;
}
-#menu-list-table th:nth-child(7),
-#menu-list-table td:nth-child(7) {
+#menu-list-table th:nth-child(8),
+#menu-list-table td:nth-child(8) {
padding: 7px 10px 7px 7px;
white-space: nowrap;
}
diff --git a/view/tpl/menulist.tpl b/view/tpl/menulist.tpl
index 71c2a89fb..888dc6e6d 100644
--- a/view/tpl/menulist.tpl
+++ b/view/tpl/menulist.tpl
@@ -14,7 +14,8 @@
<tr>
<th width="1%"></th>
<th width="1%">{{$nametitle}}</th>
- <th width="94%">{{$desctitle}}</th>
+ <th width="93%">{{$desctitle}}</th>
+ <th width="1%"></th>
<th width="1%"></th>
<th width="1%"></th>
<th width="1%" class="hidden-xs">{{$created}}</th>
@@ -22,13 +23,14 @@
</tr>
{{foreach $menus as $m }}
<tr id="menu-list-item-{{$m.menu_id}}">
- <td width="1%">{{if $m.bookmark}}<i class="icon-bookmark menu-list-tool" title="{{$bmark}}" ></i>{{/if}}</td>
- <td width="1%"><a href="mitem/{{$m.menu_id}}{{if $sys}}?f=&sys=1{{/if}}" title="{{$hintcontent}}">{{$m.menu_name}}</a></td>
- <td width="94%">{{$m.menu_desc}}</td>
- <td width="1%" class="menu-list-tool"><a href="menu/{{$m.menu_id}}{{if $sys}}?f=&sys=1{{/if}}" title="{{$hintedit}}"><i class="icon-pencil"></i></a></td>
- <td width="1%" class="menu-list-tool"><a href="#" title="{{$hintdrop}}" onclick="dropItem('menu/{{$m.menu_id}}/drop{{if $sys}}?f=&sys=1{{/if}}', '#menu-list-item-{{$m.menu_id}}'); return false;"><i class="icon-trash drop-icons"></i></a></td>
- <td width="1%" class="hidden-xs">{{$m.menu_created}}</td>
- <td width="1%" class="hidden-xs">{{$m.menu_edited}}</td>
+ <td>{{if $m.bookmark}}<i class="icon-bookmark menu-list-tool" title="{{$bmark}}" ></i>{{/if}}</td>
+ <td><a href="mitem/{{$m.menu_id}}{{if $sys}}?f=&sys=1{{/if}}" title="{{$hintcontent}}">{{$m.menu_name}}</a></td>
+ <td>{{$m.menu_desc}}</td>
+ <td class="menu-list-tool"><a href="menu/{{$m.menu_id}}{{if $sys}}?f=&sys=1{{/if}}" title="{{$hintedit}}"><i class="icon-pencil"></i></a></td>
+ <td class="menu-list-tool"><a href="rpost?attachment={{$m.element}}" title="{{$share}}"><i class="icon-share"></i></a></td>
+ <td class="menu-list-tool"><a href="#" title="{{$hintdrop}}" onclick="dropItem('menu/{{$m.menu_id}}/drop{{if $sys}}?f=&sys=1{{/if}}', '#menu-list-item-{{$m.menu_id}}'); return false;"><i class="icon-trash drop-icons"></i></a></td>
+ <td class="hidden-xs">{{$m.menu_created}}</td>
+ <td class="hidden-xs">{{$m.menu_edited}}</td>
</tr>
{{/foreach}}
</table>