add a layout selector

This commit is contained in:
friendica 2013-09-02 20:25:33 -07:00
parent 1a7bb1fb75
commit 615bf23733
4 changed files with 42 additions and 0 deletions

View File

@ -1023,7 +1023,18 @@ function status_editor($a,$x,$popup=false) {
else else
$mimeselect = '<input type="hidden" name="mimetype" value="' . $x['mimetype'] . '" />'; $mimeselect = '<input type="hidden" name="mimetype" value="' . $x['mimetype'] . '" />';
} }
$layoutselect = '';
if(array_key_exists('layout',$x) && $x['layout']) {
if($x['layout'] === 'choose') {
$layoutselect = layout_select($x['profile_uid']);
}
else
$layoutselect = '<input type="hidden" name="layout_mid" value="' . $x['layout'] . '" />';
}
$webpage = ((x($x,'webpage')) ? $x['webpage'] : ''); $webpage = ((x($x,'webpage')) ? $x['webpage'] : '');
$tpl = get_markup_template('jot-header.tpl'); $tpl = get_markup_template('jot-header.tpl');
@ -1094,6 +1105,7 @@ function status_editor($a,$x,$popup=false) {
'$lockstate' => $x['lockstate'], '$lockstate' => $x['lockstate'],
'$acl' => $x['acl'], '$acl' => $x['acl'],
'$mimeselect' => $mimeselect, '$mimeselect' => $mimeselect,
'$layoutselect' => $layoutselect,
'$showacl' => ((array_key_exists('showacl',$x)) ? $x['showacl'] : 'yes'), '$showacl' => ((array_key_exists('showacl',$x)) ? $x['showacl'] : 'yes'),
'$bang' => $x['bang'], '$bang' => $x['bang'],
'$profile_uid' => $x['profile_uid'], '$profile_uid' => $x['profile_uid'],

View File

@ -1321,6 +1321,29 @@ function unamp($s) {
return str_replace('&amp;', '&', $s); return str_replace('&amp;', '&', $s);
} }
function layout_select($channel_id, $current = '') {
$r = q("select mid,sid from item left join item_id on iid = item.id where service = 'PDL' and item.uid = item_id.uid and item_id.uid = %d and (item_restrict & %d)",
intval($channel_id),
intval(ITEM_PDL)
);
if($r) {
$o = t('Select a page layout: ');
$o .= '<select name="layout_mid" id="select-layout_mid" >';
$empty_selected = (($current === '') ? ' selected="selected" ' : '');
$o .= '<option value="" ' . $empty_selected . '>' . t('default') . '</option>';
foreach($r as $rr) {
$selected = (($rr['mid'] == $current) ? ' selected="selected" ' : '');
$o .= '<option value="' . $rr['mid'] . '"' . $selected . '>' . $rr['sid'] . '</option>';
}
$o .= '</select>';
}
return $o;
}
function mimetype_select($channel_id, $current = 'text/bbcode') { function mimetype_select($channel_id, $current = 'text/bbcode') {

View File

@ -45,6 +45,11 @@ function webpages_content(&$a) {
if(! $mimetype) if(! $mimetype)
$mimetype = 'choose'; $mimetype = 'choose';
$layout = get_config('system','page_layout');
if(! $layout)
$layout = 'choose';
// Create a status editor (for now - we'll need a WYSIWYG eventually) to create pages // Create a status editor (for now - we'll need a WYSIWYG eventually) to create pages
// Nickname is set to the observers xchan, and profile_uid to the owners. This lets you post pages at other people's channels. // Nickname is set to the observers xchan, and profile_uid to the owners. This lets you post pages at other people's channels.
require_once ('include/conversation.php'); require_once ('include/conversation.php');
@ -57,6 +62,7 @@ require_once ('include/conversation.php');
'visitor' => 'block', 'visitor' => 'block',
'profile_uid' => intval($owner), 'profile_uid' => intval($owner),
'mimetype' => $mimetype, 'mimetype' => $mimetype,
'layout' => $layout,
); );
$o .= status_editor($a,$x); $o .= status_editor($a,$x);

View File

@ -11,6 +11,7 @@
<input type="hidden" name="preview" id="jot-preview" value="0" /> <input type="hidden" name="preview" id="jot-preview" value="0" />
{{$mimeselect}} {{$mimeselect}}
{{$layoutselect}}
<div id="jot-title-wrap"><input name="title" id="jot-title" type="text" placeholder="{{$placeholdertitle}}" value="{{$title}}" class="jothidden" style="display:none"></div> <div id="jot-title-wrap"><input name="title" id="jot-title" type="text" placeholder="{{$placeholdertitle}}" value="{{$title}}" class="jothidden" style="display:none"></div>
{{if $catsenabled}} {{if $catsenabled}}