some fixes to make menu sharing work and expose it in the ui.
This commit is contained in:
parent
5f1ae2930b
commit
b8d3280763
@ -193,6 +193,9 @@ function translate_design_element($type) {
|
||||
case 'block':
|
||||
$ret = t('block');
|
||||
break;
|
||||
case 'menu':
|
||||
$ret = t('menu');
|
||||
break;
|
||||
}
|
||||
|
||||
return $ret;
|
||||
|
@ -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']);
|
||||
|
@ -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())
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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>
|
||||
|
Reference in New Issue
Block a user