make editblock use status_editor()

This commit is contained in:
Mario Vavti 2016-05-07 23:05:48 +02:00
parent b08fc746d8
commit 75128e8f68
4 changed files with 45 additions and 91 deletions

View file

@ -82,11 +82,7 @@ class Blocks extends \Zotlabs\Web\Controller {
}
$mimetype = (($_REQUEST['mimetype']) ? $_REQUEST['mimetype'] : get_pconfig($owner,'system','page_mimetype'));
if(! $mimetype) {
$mimetype = 'choose';
}
$x = array(
'webpage' => ITEM_TYPE_BLOCK,
'is_owner' => true,
@ -96,6 +92,8 @@ class Blocks extends \Zotlabs\Web\Controller {
'showacl' => false,
'visitor' => true,
'mimetype' => $mimetype,
'mimeselect' => true,
'hide_location' => true,
'ptlabel' => t('Block Name'),
'profile_uid' => intval($owner),
'expanded' => true,

View file

@ -3,6 +3,7 @@ namespace Zotlabs\Module;
require_once('include/identity.php');
require_once('include/acl_selectors.php');
require_once('include/conversation.php');
class Editblock extends \Zotlabs\Web\Controller {
@ -95,81 +96,38 @@ class Editblock extends \Zotlabs\Web\Controller {
return;
}
$plaintext = true;
$mimeselect = '';
$mimetype = $itm[0]['mimetype'];
if($mimetype != 'text/bbcode')
$plaintext = true;
if(get_config('system','page_mimetype'))
$mimeselect = '<input type="hidden" name="mimetype" value="' . $mimetype . '" />';
else
$mimeselect = mimetype_select($itm[0]['uid'],$mimetype);
\App::$page['htmlhead'] .= replace_macros(get_markup_template('jot-header.tpl'), array(
'$baseurl' => z_root(),
'$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'),
'$pretext' => '',
'$ispublic' => '&nbsp;', // t('Visible to <strong>everybody</strong>'),
'$geotag' => '',
'$nickname' => $channel['channel_address'],
'$confirmdelete' => t('Delete block?'),
'$bbco_autocomplete'=> (($mimetype == 'text/bbcode') ? 'bbcode' : 'comanche-block')
));
$tpl = get_markup_template("jot.tpl");
$jotplugins = '';
$jotnets = '';
call_hooks('jot_tool', $jotplugins);
call_hooks('jot_networks', $jotnets);
$rp = 'blocks/' . $channel['channel_address'];
$editor = replace_macros($tpl,array(
'$return_path' => $rp,
'$action' => 'item',
'$webpage' => ITEM_TYPE_BLOCK,
'$share' => t('Edit'),
'$bold' => t('Bold'),
'$italic' => t('Italic'),
'$underline' => t('Underline'),
'$quote' => t('Quote'),
'$code' => t('Code'),
'$writefiles' => (($mimetype == 'text/bbcode') ? perm_is_allowed($owner, get_observer_hash(), 'write_storage') : false),
'$attach' => t('Attach file'),
'$weblink' => (($mimetype == 'text/bbcode') ? t('Insert web link') : false),
'$setloc' => false,
'$noloc' => false,
'$permset' => t('Permission settings'),
'$ptyp' => $itm[0]['type'],
'$mimeselect' => $mimeselect,
'$content' => undo_post_tagging($itm[0]['body']),
'$post_id' => $post_id,
'$baseurl' => z_root(),
'$defloc' => $channel['channel_location'],
'$visitor' => true,
'$public' => t('Public post'),
'$jotnets' => $jotnets,
'$title' => htmlspecialchars($itm[0]['title'],ENT_COMPAT,'UTF-8'),
'$placeholdertitle' => t('Title (optional)'),
'$pagetitle' => $block_title,
'$category' => '',
'$placeholdercategory' => t('Categories (optional, comma-separated list)'),
'$emtitle' => t('Example: bob@example.com, mary@example.com'),
'$lockstate' => $lockstate,
'$acl' => '',
'$bang' => '',
'$profile_uid' => (intval($channel['channel_id'])),
'$preview' => t('Preview'),
'$jotplugins' => $jotplugins,
'$sourceapp' => $itm[0]['app'],
'$defexpire' => '',
'$bbcode' => (($mimetype == 'text/bbcode') ? true : false)
));
$x = array(
'nickname' => $channel['channel_address'],
'bbco_autocomplete'=> (($mimetype == 'text/bbcode') ? 'bbcode' : 'comanche-block'),
'return_path' => $rp,
'webpage' => ITEM_TYPE_BLOCK,
'ptlabel' => t('Block Name'),
'button' => t('Edit'),
'writefiles' => (($mimetype == 'text/bbcode') ? perm_is_allowed($owner, get_observer_hash(), 'write_storage') : false),
'weblink' => (($mimetype == 'text/bbcode') ? t('Insert web link') : false),
'hide_voting' => true,
'hide_future' => true,
'hide_location' => true,
'hide_expire' => true,
'showacl' => false,
'ptyp' => $itm[0]['type'],
'mimeselect' => true,
'mimetype' => $itm[0]['mimetype'],
'body' => undo_post_tagging($itm[0]['body']),
'post_id' => $post_id,
'visitor' => true,
'title' => htmlspecialchars($itm[0]['title'],ENT_COMPAT,'UTF-8'),
'placeholdertitle' => t('Title (optional)'),
'pagetitle' => $block_title,
'profile_uid' => (intval($channel['channel_id'])),
'bbcode' => (($mimetype == 'text/bbcode') ? true : false)
);
$editor = status_editor($a, $x);
$o .= replace_macros(get_markup_template('edpost_head.tpl'), array(
'$title' => t('Edit Block'),

View file

@ -85,6 +85,7 @@ class Editpost extends \Zotlabs\Web\Controller {
'hide_voting' => true,
'hide_future' => true,
'hide_location' => true,
'mimetype' => $itm[0]['mimetype'],
'ptyp' => $itm[0]['obj_type'],
'body' => undo_post_tagging($itm[0]['body']),
'post_id' => $post_id,

View file

@ -1138,25 +1138,22 @@ function status_editor($a, $x, $popup = false) {
if(x($x, 'hide_location'))
$geotag = $setloc = $clearloc = '';
$weblink = t('Insert web link');
if(x($x, 'hide_weblink'))
$weblink = '';
$mimetype = ((x($x,'mimetype')) ? $x['mimetype'] : 'text/bbcode');
$writefiles = perm_is_allowed($x['profile_uid'], get_observer_hash(), 'write_storage');
$mimeselect = ((x($x,'mimeselect')) ? $x['mimeselect'] : false);
if($mimeselect)
$mimeselect = mimetype_select($x['profile_uid'], $mimetype);
else
$mimeselect = '<input type="hidden" name="mimetype" value="' . $x['mimetype'] . '" />';
$weblink = (($mimetype === 'text/bbcode') ? t('Insert web link') : false);
if(x($x, 'hide_weblink'))
$weblink = false;
$writefiles = (($mimetype === 'text/bbcode') ? perm_is_allowed($x['profile_uid'], get_observer_hash(), 'write_storage') : false);
if(x($x, 'hide_attach'))
$writefiles = false;
$mimeselect = '';
if(array_key_exists('mimetype', $x) && $x['mimetype']) {
if($x['mimetype'] != 'text/bbcode')
$plaintext = true;
if($x['mimetype'] === 'choose') {
$mimeselect = mimetype_select($x['profile_uid']);
}
else
$mimeselect = '<input type="hidden" name="mimetype" value="' . $x['mimetype'] . '" />';
}
$layoutselect = '';
if(array_key_exists('layout', $x) && $x['layout']) {
if($x['layout'] === 'choose') {