mirror of
https://codeberg.org/streams/streams.git
synced 2024-09-20 06:15:11 +00:00
Merge branch 'master' of https://github.com/redmatrix/redmatrix
This commit is contained in:
commit
6916c1076c
6 changed files with 30 additions and 11 deletions
|
@ -331,6 +331,24 @@ function channel_remove($channel_id, $local = true, $unset_session=true) {
|
|||
dbesc(datetime_convert()),
|
||||
intval($channel_id)
|
||||
);
|
||||
// if this was the default channel, set another one as default
|
||||
if($a->account['account_default_channel'] == $channel_id) {
|
||||
$r = q("select channel_id from channel where channel_account_id = %d and not ( channel_pageflags & %d)>0 limit 1",
|
||||
intval($a->account['account_id']),
|
||||
intval(PAGE_REMOVED));
|
||||
if ($r) {
|
||||
$rr = q("update account set account_default_channel = %d where account_id = %d",
|
||||
intval($r[0]['channel_id']),
|
||||
intval($a->account['account_id']));
|
||||
logger("Default channel deleted, changing default to channel_id " . $r[0]['channel_id']);
|
||||
}
|
||||
else {
|
||||
$rr = q("update account set account_default_channel = 0 where account_id = %d",
|
||||
intval($r[0]['channel_id']),
|
||||
intval($a->account['account_id']));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$r = q("update hubloc set hubloc_deleted = 1 where hubloc_hash = '%s' and hubloc_url = '%s' ",
|
||||
dbesc($channel['channel_hash']),
|
||||
|
|
|
@ -174,10 +174,14 @@ function bb_parse_app($match) {
|
|||
function bb_parse_element($match) {
|
||||
$j = json_decode(base64url_decode($match[1]),true);
|
||||
|
||||
if ($j) {
|
||||
if ($j && local_channel()) {
|
||||
$text = sprintf( t('Install %s element: '), translate_design_element($j['type'])) . $j['pagetitle'];
|
||||
$o = EOL . '<a href="#" onclick="importElement(\'' . $match[1] . '\'); return false;" >' . $text . '</a>' . EOL;
|
||||
}
|
||||
else {
|
||||
$text = sprintf( t('This post contains an installable %s element, however you lack permissions to install it on this site.' ), translate_design_element($j['type'])) . $j['pagetitle'];
|
||||
$o = EOL . $text . EOL;
|
||||
}
|
||||
|
||||
return $o;
|
||||
}
|
||||
|
|
|
@ -137,7 +137,9 @@ function menu_content(&$a) {
|
|||
|
||||
$o = replace_macros(get_markup_template('menuedit.tpl'), array(
|
||||
'$header' => t('Edit Menu'),
|
||||
'$sys' => $a->is_sys,
|
||||
'$menu_id' => intval(argv(1)),
|
||||
'$menu_edit_link' => 'mitem/' . intval(argv(1)) . (($a->is_sys) ? '?f=&sys=1' : ''),
|
||||
'$hintedit' => t('Add or remove entries to this menu'),
|
||||
'$editcontents' => t('Edit menu contents'),
|
||||
'$menu_name' => array('menu_name', t('Menu name'), $m['menu_name'], t('Must be unique, only seen by you'), '*'),
|
||||
|
|
|
@ -44,9 +44,6 @@ function mitem_post(&$a) {
|
|||
if(! $a->data['menu'])
|
||||
return;
|
||||
|
||||
|
||||
$channel = $a->get_channel();
|
||||
|
||||
if(!$_REQUEST['mitem_desc'] || !$_REQUEST['mitem_link']) {
|
||||
notice( t('Unable to create element.') . EOL);
|
||||
return;
|
||||
|
@ -90,9 +87,6 @@ function mitem_post(&$a) {
|
|||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -167,7 +161,8 @@ function mitem_content(&$a) {
|
|||
'$submit_more' => t('Submit and continue'),
|
||||
'$display' => $display,
|
||||
'$lockstate' => $lockstate,
|
||||
'$menu_names' => $menu_names
|
||||
'$menu_names' => $menu_names,
|
||||
'$sys' => $a->is_sys
|
||||
));
|
||||
|
||||
$o .= replace_macros(get_markup_template('mitemlist.tpl'),array(
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
{{if $header}}
|
||||
<div class="generic-content-wrapper">
|
||||
<div class="section-title-wrapper">
|
||||
{{if $menu_id}}
|
||||
{{if $menu_edit_link}}
|
||||
<div class="pull-right">
|
||||
<a href="mitem/{{$menu_id}}" title="{{$hintedit}}" class="btn btn-xs btn-success"><i class="icon-edit"></i> {{$editcontents}}</a>
|
||||
<a href="{{$menu_edit_link}}" title="{{$hintedit}}" class="btn btn-xs btn-success"><i class="icon-edit"></i> {{$editcontents}}</a>
|
||||
</div>
|
||||
{{/if}}
|
||||
<h2>{{$header}}</h2>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
</div>
|
||||
{{/if}}
|
||||
<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}}{{if $sys}}?f=&sys=1{{/if}}" method="post" >
|
||||
<input type="hidden" name="menu_id" value="{{$menu_id}}" />
|
||||
{{if $mitem_id}}
|
||||
<input type="hidden" name="mitem_id" value="{{$mitem_id}}" />
|
||||
|
|
Loading…
Reference in a new issue