aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2016-05-07 23:05:48 +0200
committerMario Vavti <mario@mariovavti.com>2016-05-07 23:05:48 +0200
commit75128e8f68e829ad9e3670dac82f075d9632dba4 (patch)
treed78696df4c56398ae0b3f2ca165b70e9d33211db
parentb08fc746d81e9e486988439ae9a51918e9f9ee37 (diff)
downloadvolse-hubzilla-75128e8f68e829ad9e3670dac82f075d9632dba4.tar.gz
volse-hubzilla-75128e8f68e829ad9e3670dac82f075d9632dba4.tar.bz2
volse-hubzilla-75128e8f68e829ad9e3670dac82f075d9632dba4.zip
make editblock use status_editor()
-rw-r--r--Zotlabs/Module/Blocks.php8
-rw-r--r--Zotlabs/Module/Editblock.php100
-rw-r--r--Zotlabs/Module/Editpost.php1
-rw-r--r--include/conversation.php25
4 files changed, 44 insertions, 90 deletions
diff --git a/Zotlabs/Module/Blocks.php b/Zotlabs/Module/Blocks.php
index 192a4aded..ed702befb 100644
--- a/Zotlabs/Module/Blocks.php
+++ b/Zotlabs/Module/Blocks.php
@@ -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,
diff --git a/Zotlabs/Module/Editblock.php b/Zotlabs/Module/Editblock.php
index 0204d0994..a79962033 100644
--- a/Zotlabs/Module/Editblock.php
+++ b/Zotlabs/Module/Editblock.php
@@ -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'),
diff --git a/Zotlabs/Module/Editpost.php b/Zotlabs/Module/Editpost.php
index 25ba1a39a..43edf2c00 100644
--- a/Zotlabs/Module/Editpost.php
+++ b/Zotlabs/Module/Editpost.php
@@ -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,
diff --git a/include/conversation.php b/include/conversation.php
index ea5be221f..32a613eab 100644
--- a/include/conversation.php
+++ b/include/conversation.php
@@ -1138,25 +1138,22 @@ function status_editor($a, $x, $popup = false) {
if(x($x, 'hide_location'))
$geotag = $setloc = $clearloc = '';
- $weblink = t('Insert web link');
+ $mimetype = ((x($x,'mimetype')) ? $x['mimetype'] : 'text/bbcode');
+
+ $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 = '';
+ $weblink = false;
- $writefiles = perm_is_allowed($x['profile_uid'], get_observer_hash(), 'write_storage');
+ $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') {