add design tool menu to appropriate pages

This commit is contained in:
friendica 2013-09-03 19:55:26 -07:00
parent 50d4206e9f
commit ab1c9dc9c9
7 changed files with 63 additions and 2 deletions

View File

@ -1827,3 +1827,19 @@ function json_decode_plus($s) {
return $x; return $x;
} }
function design_tools() {
// FIXME - this should be a template
$o = '<div class="widget design-tools">';
$o .= '<h3>' . t('Design') . '</h3>';
$o .= '<a href="blocks">' . t('Blocks') . '</a>' . EOL;
$o .= '<a href="menu">' . t('Menus') . '</a>' . EOL;
$o .= '<a href="layout">' . t('Layouts') . '</a>' . EOL;
$o .= '<a href="webpages">' . t('Pages') . '</a>' . EOL;
$o .= '</div>';
return $o;
}

View File

@ -2,6 +2,8 @@
function blocks_content(&$a) { function blocks_content(&$a) {
if(argc() > 1) if(argc() > 1)
$which = argv(1); $which = argv(1);
else { else {
@ -21,6 +23,16 @@ function blocks_content(&$a) {
$owner = intval($r[0]['channel_id']); $owner = intval($r[0]['channel_id']);
} }
// Block design features from visitors
if((! local_user()) || (local_user() != $owner)) {
notice( t('Permission denied.') . EOL);
return;
}
// Get the observer, check their permissions // Get the observer, check their permissions
$observer = $a->get_observer(); $observer = $a->get_observer();
@ -33,6 +45,12 @@ function blocks_content(&$a) {
return; return;
} }
if(local_user() && local_user() == $owner) {
$a->set_widget('design',design_tools());
}
// 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');
@ -43,6 +61,7 @@ require_once ('include/conversation.php');
'lockstate' => (($group || $cid || $channel['channel_allow_cid'] || $channel['channel_allow_gid'] || $channel['channel_deny_cid'] || $channel['channel_deny_gid']) ? 'lock' : 'unlock'), 'lockstate' => (($group || $cid || $channel['channel_allow_cid'] || $channel['channel_allow_gid'] || $channel['channel_deny_cid'] || $channel['channel_deny_gid']) ? 'lock' : 'unlock'),
'bang' => (($group || $cid) ? '!' : ''), 'bang' => (($group || $cid) ? '!' : ''),
'visitor' => 'block', 'visitor' => 'block',
'mimetype' => 'choose',
'profile_uid' => intval($owner), 'profile_uid' => intval($owner),
); );

View File

@ -78,7 +78,7 @@ function editwebpage_content(&$a) {
if($layout) if($layout)
$layoutselect = '<input type="hidden" name="layout_mid" value="' . $layout . '" />'; $layoutselect = '<input type="hidden" name="layout_mid" value="' . $layout . '" />';
else else
$layoutselect = layout_select($x['profile_uid']); $layoutselect = layout_select($itm[0]['uid']);
$o .= replace_macros(get_markup_template('edpost_head.tpl'), array( $o .= replace_macros(get_markup_template('edpost_head.tpl'), array(

View File

@ -21,6 +21,16 @@ function layouts_content(&$a) {
$owner = intval($r[0]['channel_id']); $owner = intval($r[0]['channel_id']);
} }
// Block design features from visitors
if((! local_user()) || (local_user() != $owner)) {
notice( t('Permission denied.') . EOL);
return;
}
// Get the observer, check their permissions // Get the observer, check their permissions
$observer = $a->get_observer(); $observer = $a->get_observer();
@ -33,6 +43,12 @@ function layouts_content(&$a) {
return; return;
} }
if(local_user() && local_user() == $owner) {
$a->set_widget('design',design_tools());
}
// 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');

View File

@ -42,6 +42,9 @@ function menu_content(&$a) {
} }
$a->set_widget('design',design_tools());
if(argc() == 1) { if(argc() == 1) {
// list menus // list menus
$x = menu_list(local_user()); $x = menu_list(local_user());

View File

@ -98,6 +98,8 @@ function mitem_content(&$a) {
return ''; return '';
} }
$a->set_widget('design',design_tools());
$m = menu_fetch($a->data['menu']['menu_name'],local_user(), get_observer_hash()); $m = menu_fetch($a->data['menu']['menu_name'],local_user(), get_observer_hash());
$a->set_widget('menu_preview',menu_render($m)); $a->set_widget('menu_preview',menu_render($m));

View File

@ -41,6 +41,11 @@ function webpages_content(&$a) {
return; return;
} }
if(local_user() && local_user() == $owner) {
$a->set_widget('design',design_tools());
}
$mimetype = get_config('system','page_mimetype'); $mimetype = get_config('system','page_mimetype');
if(! $mimetype) if(! $mimetype)
$mimetype = 'choose'; $mimetype = 'choose';