bring lockview to menu items, slightly change the way /lockview is called
This commit is contained in:
parent
0bd9fe0b11
commit
21704ecb93
@ -14,10 +14,13 @@ function lockview_content(&$a) {
|
|||||||
if(! $item_id)
|
if(! $item_id)
|
||||||
killme();
|
killme();
|
||||||
|
|
||||||
if (!in_array($type, array('item','photo','event')))
|
if (!in_array($type, array('item','photo','event', 'menu_item')))
|
||||||
killme();
|
killme();
|
||||||
|
|
||||||
$r = q("SELECT * FROM %s WHERE id = %d LIMIT 1",
|
//we have different naming in in menu_item table
|
||||||
|
$id = (($type == 'menu_item') ? 'mitem_id' : 'id');
|
||||||
|
|
||||||
|
$r = q("SELECT * FROM %s WHERE $id = %d LIMIT 1",
|
||||||
dbesc($type),
|
dbesc($type),
|
||||||
intval($item_id)
|
intval($item_id)
|
||||||
);
|
);
|
||||||
@ -27,7 +30,10 @@ function lockview_content(&$a) {
|
|||||||
|
|
||||||
$item = $r[0];
|
$item = $r[0];
|
||||||
|
|
||||||
if($item['uid'] != local_channel()) {
|
//we have different naming in in menu_item table
|
||||||
|
$uid = (($type == 'menu_item') ? $item['mitem_channel_id'] : $item['uid']);
|
||||||
|
|
||||||
|
if($uid != local_channel()) {
|
||||||
echo '<li>' . t('Remote privacy information not available.') . '</li>';
|
echo '<li>' . t('Remote privacy information not available.') . '</li>';
|
||||||
killme();
|
killme();
|
||||||
}
|
}
|
||||||
|
@ -124,19 +124,21 @@ function mitem_content(&$a) {
|
|||||||
$m = menu_fetch($a->data['menu']['menu_name'],$uid,$ob_hash);
|
$m = menu_fetch($a->data['menu']['menu_name'],$uid,$ob_hash);
|
||||||
$a->data['menu_item'] = $m;
|
$a->data['menu_item'] = $m;
|
||||||
|
|
||||||
|
$perm_defaults = array(
|
||||||
|
'allow_cid' => $channel['channel_allow_cid'],
|
||||||
|
'allow_gid' => $channel['channel_allow_gid'],
|
||||||
|
'deny_cid' => $channel['channel_deny_cid'],
|
||||||
|
'deny_gid' => $channel['channel_deny_gid']
|
||||||
|
);
|
||||||
|
|
||||||
|
$lockstate = (($channel['channel_allow_cid'] || $channel['channel_allow_gid'] || $channel['channel_deny_cid'] || $channel['channel_deny_gid']) ? 'lock' : 'unlock');
|
||||||
|
|
||||||
if(argc() == 2) {
|
if(argc() == 2) {
|
||||||
$r = q("select * from menu_item where mitem_menu_id = %d and mitem_channel_id = %d order by mitem_order asc, mitem_desc asc",
|
$r = q("select * from menu_item where mitem_menu_id = %d and mitem_channel_id = %d order by mitem_order asc, mitem_desc asc",
|
||||||
intval($a->data['menu']['menu_id']),
|
intval($a->data['menu']['menu_id']),
|
||||||
intval($uid)
|
intval($uid)
|
||||||
);
|
);
|
||||||
|
|
||||||
$perm_defaults = array(
|
|
||||||
'allow_cid' => $channel['channel_allow_cid'],
|
|
||||||
'allow_gid' => $channel['channel_allow_gid'],
|
|
||||||
'deny_cid' => $channel['channel_deny_cid'],
|
|
||||||
'deny_gid' => $channel['channel_deny_gid']
|
|
||||||
);
|
|
||||||
|
|
||||||
if($_GET['display']) {
|
if($_GET['display']) {
|
||||||
$display = $_GET['display'];
|
$display = $_GET['display'];
|
||||||
}
|
}
|
||||||
@ -156,7 +158,8 @@ function mitem_content(&$a) {
|
|||||||
'$mitem_order' => array('mitem_order', t('Order in list'),'0',t('Higher numbers will sink to bottom of listing')),
|
'$mitem_order' => array('mitem_order', t('Order in list'),'0',t('Higher numbers will sink to bottom of listing')),
|
||||||
'$submit' => t('Submit and finish'),
|
'$submit' => t('Submit and finish'),
|
||||||
'$submit_more' => t('Submit and continue'),
|
'$submit_more' => t('Submit and continue'),
|
||||||
'$display' => $display
|
'$display' => $display,
|
||||||
|
'$lockstate' => $lockstate
|
||||||
));
|
));
|
||||||
|
|
||||||
$o .= replace_macros(get_markup_template('mitemlist.tpl'),array(
|
$o .= replace_macros(get_markup_template('mitemlist.tpl'),array(
|
||||||
@ -175,7 +178,7 @@ function mitem_content(&$a) {
|
|||||||
'$hintmenu' => t('Edit this menu container'),
|
'$hintmenu' => t('Edit this menu container'),
|
||||||
'$hintnew' => t('Add menu element'),
|
'$hintnew' => t('Add menu element'),
|
||||||
'$hintdrop' => t('Delete this menu item'),
|
'$hintdrop' => t('Delete this menu item'),
|
||||||
'$hintedit' => t('Edit this menu item')
|
'$hintedit' => t('Edit this menu item'),
|
||||||
));
|
));
|
||||||
|
|
||||||
return $o;
|
return $o;
|
||||||
@ -198,6 +201,8 @@ function mitem_content(&$a) {
|
|||||||
|
|
||||||
$mitem = $m[0];
|
$mitem = $m[0];
|
||||||
|
|
||||||
|
$lockstate = (($mitem['allow_cid'] || $mitem['allow_gid'] || $mitem['deny_cid'] || $mitem['deny_gid']) ? 'lock' : 'unlock');
|
||||||
|
|
||||||
if(argc() == 4 && argv(3) == 'drop') {
|
if(argc() == 4 && argv(3) == 'drop') {
|
||||||
$r = menu_del_item($mitem['mitem_menu_id'], $uid, intval(argv(2)));
|
$r = menu_del_item($mitem['mitem_menu_id'], $uid, intval(argv(2)));
|
||||||
if($r)
|
if($r)
|
||||||
@ -221,7 +226,8 @@ function mitem_content(&$a) {
|
|||||||
'$usezid' => array('usezid', t('Use RedMatrix magic-auth if available'), (($mitem['mitem_flags'] & MENU_ITEM_ZID) ? 1 : 0), ''),
|
'$usezid' => array('usezid', t('Use RedMatrix magic-auth if available'), (($mitem['mitem_flags'] & MENU_ITEM_ZID) ? 1 : 0), ''),
|
||||||
'$newwin' => array('newwin', t('Open link in new window'), (($mitem['mitem_flags'] & MENU_ITEM_NEWWIN) ? 1 : 0),''),
|
'$newwin' => array('newwin', t('Open link in new window'), (($mitem['mitem_flags'] & MENU_ITEM_NEWWIN) ? 1 : 0),''),
|
||||||
'$mitem_order' => array('mitem_order', t('Order in list'),$mitem['mitem_order'],t('Higher numbers will sink to bottom of listing')),
|
'$mitem_order' => array('mitem_order', t('Order in list'),$mitem['mitem_order'],t('Higher numbers will sink to bottom of listing')),
|
||||||
'$submit' => t('Submit')
|
'$submit' => t('Submit'),
|
||||||
|
'$lockstate' => $lockstate
|
||||||
));
|
));
|
||||||
|
|
||||||
return $o;
|
return $o;
|
||||||
|
@ -884,8 +884,8 @@ function getPosition(e) {
|
|||||||
return cursor;
|
return cursor;
|
||||||
}
|
}
|
||||||
|
|
||||||
function lockview(event, id) {
|
function lockview(type, id) {
|
||||||
$.get('lockview/' + id, function(data) {
|
$.get('lockview/' + type + '/' + id, function(data) {
|
||||||
$('#panel-' + id).html(data);
|
$('#panel-' + id).html(data);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
{{/if}}
|
{{/if}}
|
||||||
{{if $item.lock}}
|
{{if $item.lock}}
|
||||||
<div class="wall-item-lock dropdown">
|
<div class="wall-item-lock dropdown">
|
||||||
<i class="icon-lock lockview dropdown-toggle" data-toggle="dropdown" title="{{$item.lock}}" onclick="lockview(event,{{$item.id}});" ></i><ul id="panel-{{$item.id}}" class="lockview-panel dropdown-menu"></ul>
|
<i class="icon-lock lockview dropdown-toggle" data-toggle="dropdown" title="{{$item.lock}}" onclick="lockview('item',{{$item.id}});" ></i><ul id="panel-{{$item.id}}" class="lockview-panel dropdown-menu"></ul>
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
<div class="wall-item-author">
|
<div class="wall-item-author">
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
{{/if}}
|
{{/if}}
|
||||||
{{if $item.lock}}
|
{{if $item.lock}}
|
||||||
<div class="wall-item-lock dropdown">
|
<div class="wall-item-lock dropdown">
|
||||||
<i class="icon-lock lockview dropdown-toggle" data-toggle="dropdown" title="{{$item.lock}}" onclick="lockview(event,{{$item.id}});" ></i><ul id="panel-{{$item.id}}" class="lockview-panel dropdown-menu"></ul>
|
<i class="icon-lock lockview dropdown-toggle" data-toggle="dropdown" title="{{$item.lock}}" onclick="lockview('item',{{$item.id}});" ></i><ul id="panel-{{$item.id}}" class="lockview-panel dropdown-menu"></ul>
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
<div class="wall-item-author">
|
<div class="wall-item-author">
|
||||||
|
@ -5,29 +5,26 @@
|
|||||||
{{/if}}
|
{{/if}}
|
||||||
<div id="menu-element-creator" class="section-content-tools-wrapper" style="display: {{$display}};">
|
<div id="menu-element-creator" class="section-content-tools-wrapper" style="display: {{$display}};">
|
||||||
<form id="mitemedit" action="mitem/{{$menu_id}}{{if $mitem_id}}/{{$mitem_id}}{{/if}}" method="post" >
|
<form id="mitemedit" action="mitem/{{$menu_id}}{{if $mitem_id}}/{{$mitem_id}}{{/if}}" method="post" >
|
||||||
|
|
||||||
<input type="hidden" name="menu_id" value="{{$menu_id}}" />
|
<input type="hidden" name="menu_id" value="{{$menu_id}}" />
|
||||||
|
|
||||||
{{if $mitem_id}}
|
{{if $mitem_id}}
|
||||||
<input type="hidden" name="mitem_id" value="{{$mitem_id}}" />
|
<input type="hidden" name="mitem_id" value="{{$mitem_id}}" />
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{include file="field_input.tpl" field=$mitem_desc}}
|
{{include file="field_input.tpl" field=$mitem_desc}}
|
||||||
{{include file="field_input.tpl" field=$mitem_link}}
|
{{include file="field_input.tpl" field=$mitem_link}}
|
||||||
{{include file="field_input.tpl" field=$mitem_order}}
|
{{include file="field_input.tpl" field=$mitem_order}}
|
||||||
{{include file="field_checkbox.tpl" field=$usezid}}
|
{{include file="field_checkbox.tpl" field=$usezid}}
|
||||||
{{include file="field_checkbox.tpl" field=$newwin}}
|
{{include file="field_checkbox.tpl" field=$newwin}}
|
||||||
|
<div class="pull-right btn-group form-group">
|
||||||
<div id="settings-default-perms" class="settings-default-perms form-group">
|
<div class="btn-group">
|
||||||
<button class="btn btn-default btn-xs" data-toggle="modal" data-target="#aclModal" onclick="return false;">{{$permissions}}</button>
|
<button id="dbtn-acl" class="btn btn-default btn-sm" data-toggle="modal" data-target="#aclModal" onclick="return false;">
|
||||||
|
<i id="jot-perms-icon" class="icon-{{$lockstate}}"></i>
|
||||||
|
</button>
|
||||||
|
{{if $submit_more}}
|
||||||
|
<button class="btn btn-primary btn-sm" type="submit" name="submit-more" value="{{$submit_more}}">{{$submit_more}} <i id="jot-perms-icon" class="icon-caret-right"></i></button>
|
||||||
|
{{/if}}
|
||||||
|
<button class="btn btn-primary btn-sm" type="submit" name="submit" value="{{$submit}}">{{$submit}}</button>
|
||||||
|
</div>
|
||||||
{{$aclselect}}
|
{{$aclselect}}
|
||||||
</div>
|
</div>
|
||||||
<div class="mitemedit-submit-wrapper" >
|
|
||||||
{{if $submit_more}}
|
|
||||||
<input type="submit" name="submit-more" class="mitemedit-submit" value="{{$submit_more}}" />
|
|
||||||
{{/if}}
|
|
||||||
<input type="submit" name="submit" class="mitemedit-submit" value="{{$submit}}" />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
@ -13,14 +13,16 @@
|
|||||||
<table id="mitem-list-table">
|
<table id="mitem-list-table">
|
||||||
<tr>
|
<tr>
|
||||||
<th width="1%">{{$nametitle}}</th>
|
<th width="1%">{{$nametitle}}</th>
|
||||||
<th width="97%">{{$targettitle}}</th>
|
<th width="96%">{{$targettitle}}</th>
|
||||||
|
<th width="1%"></th>
|
||||||
<th width="1%"></th>
|
<th width="1%"></th>
|
||||||
<th width="1%"></th>
|
<th width="1%"></th>
|
||||||
</tr>
|
</tr>
|
||||||
{{foreach $mlist as $m }}
|
{{foreach $mlist as $m }}
|
||||||
<tr id="mitem-list-item-{{$m.mitem_id}}">
|
<tr id="mitem-list-item-{{$m.mitem_id}}">
|
||||||
<td width="1%">{{$m.mitem_desc}}</td>
|
<td width="1%">{{$m.mitem_desc}}</td>
|
||||||
<td width="97%"><a href="{{$m.mitem_link}}">{{$m.mitem_link}}</a></td>
|
<td width="96%"><a href="{{$m.mitem_link}}">{{$m.mitem_link}}</a></td>
|
||||||
|
<td width="1%" class="dropdown">{{if $m.allow_cid || $m.allow_gid || $m.deny_cid || $m.deny_gid}}<i class="icon-lock dropdown-toggle lockview" data-toggle="dropdown" onclick="lockview('menu_item',{{$m.mitem_id}});" ></i><ul id="panel-{{$m.mitem_id}}" class="lockview-panel dropdown-menu"></ul>{{/if}}</td>
|
||||||
<td width="1%" class="mitem-list-tool"><a href="mitem/{{$menu_id}}/{{$m.mitem_id}}" title="{{$hintedit}}"><i class="icon-pencil"></i></a></td>
|
<td width="1%" class="mitem-list-tool"><a href="mitem/{{$menu_id}}/{{$m.mitem_id}}" title="{{$hintedit}}"><i class="icon-pencil"></i></a></td>
|
||||||
<td width="1%" class="mitem-list-tool"><a href="#" title="{{$hintdrop}}" onclick="dropItem('mitem/{{$menu_id}}/{{$m.mitem_id}}/drop', '#mitem-list-item-{{$m.mitem_id}}, #pmenu-item-{{$m.mitem_id}}'); return false;"><i class="icon-trash drop-icons"></i></a></td>
|
<td width="1%" class="mitem-list-tool"><a href="#" title="{{$hintdrop}}" onclick="dropItem('mitem/{{$menu_id}}/{{$m.mitem_id}}/drop', '#mitem-list-item-{{$m.mitem_id}}, #pmenu-item-{{$m.mitem_id}}'); return false;"><i class="icon-trash drop-icons"></i></a></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
<i class="icon-pencil btn btn-default btn-xs" title="{{$edit.edit}}" onclick="openClose('photo-edit');"></i>
|
<i class="icon-pencil btn btn-default btn-xs" title="{{$edit.edit}}" onclick="openClose('photo-edit');"></i>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{if $lock}}
|
{{if $lock}}
|
||||||
<i id="lockview" class="icon-lock btn btn-default btn-xs dropdown-toggle" data-toggle="dropdown" title="{{$lock}}" onclick="lockview(event,{{$id}});" ></i><ul id="panel-{{$id}}" class="lockview-panel dropdown-menu"></ul>
|
<i id="lockview" class="icon-lock btn btn-default btn-xs dropdown-toggle" data-toggle="dropdown" title="{{$lock}}" onclick="lockview('item',{{$id}});" ></i><ul id="panel-{{$id}}" class="lockview-panel dropdown-menu"></ul>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
<div class="btn-group btn-group">
|
<div class="btn-group btn-group">
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
{{/if}}
|
{{/if}}
|
||||||
{{if $item.lock}}
|
{{if $item.lock}}
|
||||||
<div class="wall-item-lock dropdown">
|
<div class="wall-item-lock dropdown">
|
||||||
<i class="icon-lock lockview dropdown-toggle" data-toggle="dropdown" title="{{$item.lock}}" onclick="lockview(event,{{$item.id}});" ></i><ul id="panel-{{$item.id}}" class="lockview-panel dropdown-menu"></ul>
|
<i class="icon-lock lockview dropdown-toggle" data-toggle="dropdown" title="{{$item.lock}}" onclick="lockview('item',{{$item.id}});" ></i><ul id="panel-{{$item.id}}" class="lockview-panel dropdown-menu"></ul>
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
<div class="wall-item-author">
|
<div class="wall-item-author">
|
||||||
|
Reference in New Issue
Block a user