some work on making mod editpost use status_editor() - if you find anything related to jot broken please revert this commit

This commit is contained in:
Mario Vavti 2016-04-29 13:18:42 +02:00
parent e01b90c4c6
commit b797528b78
4 changed files with 60 additions and 109 deletions

View File

@ -5,7 +5,7 @@ require_once('include/acl_selectors.php');
require_once('include/crypto.php'); require_once('include/crypto.php');
require_once('include/items.php'); require_once('include/items.php');
require_once('include/taxonomy.php'); require_once('include/taxonomy.php');
require_once('include/conversation.php');
class Editpost extends \Zotlabs\Web\Controller { class Editpost extends \Zotlabs\Web\Controller {
@ -49,20 +49,7 @@ class Editpost extends \Zotlabs\Web\Controller {
// $plaintext = false; // $plaintext = false;
$channel = \App::get_channel(); $channel = \App::get_channel();
\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' => $geotag,
'$nickname' => $channel['channel_address'],
'$expireswhen' => t('Expires YYYY-MM-DD HH:MM'),
'$confirmdelete' => t('Delete item?'),
'$editor_autocomplete'=> true,
'$bbco_autocomplete'=> 'bbcode'
));
if(intval($itm[0]['item_obscured'])) { if(intval($itm[0]['item_obscured'])) {
$key = get_config('system','prvkey'); $key = get_config('system','prvkey');
if($itm[0]['title']) if($itm[0]['title'])
@ -71,18 +58,6 @@ class Editpost extends \Zotlabs\Web\Controller {
$itm[0]['body'] = crypto_unencapsulate(json_decode_plus($itm[0]['body']),$key); $itm[0]['body'] = crypto_unencapsulate(json_decode_plus($itm[0]['body']),$key);
} }
$tpl = get_markup_template("jot.tpl");
$jotplugins = '';
$jotnets = '';
call_hooks('jot_tool', $jotplugins);
call_hooks('jot_networks', $jotnets);
//$tpl = replace_macros($tpl,array('$jotplugins' => $jotplugins));
$voting = feature_enabled($owner_uid,'consensus_tools');
$category = ''; $category = '';
$catsenabled = ((feature_enabled($owner_uid,'categories')) ? 'categories' : ''); $catsenabled = ((feature_enabled($owner_uid,'categories')) ? 'categories' : '');
@ -106,66 +81,32 @@ class Editpost extends \Zotlabs\Web\Controller {
} }
} }
} }
$cipher = get_pconfig(\App::$profile['profile_uid'],'system','default_cipher'); $x = array(
if(! $cipher) 'ispublic' => '&nbsp;',
$cipher = 'aes256'; 'nickname' => $channel['channel_address'],
'editor_autocomplete'=> true,
'bbco_autocomplete'=> 'bbcode',
$editor = replace_macros($tpl,array( 'return_path' => $_SESSION['return_url'],
'$return_path' => $_SESSION['return_url'], 'button' => t('Edit'),
'$action' => 'item', 'hide_voting' => true,
'$share' => t('Edit'), 'hide_future' => true,
'$bold' => t('Bold'), 'hide_location' => true,
'$italic' => t('Italic'), 'ptyp' => $itm[0]['obj_type'],
'$underline' => t('Underline'), 'body' => undo_post_tagging($itm[0]['body']),
'$quote' => t('Quote'), 'post_id' => $post_id,
'$code' => t('Code'), 'defloc' => $channel['channel_location'],
'$upload' => t('Upload photo'), 'visitor' => true,
'$attach' => t('Attach file'), 'title' => htmlspecialchars($itm[0]['title'],ENT_COMPAT,'UTF-8'),
'$weblink' => t('Insert web link'), 'category' => $category,
'$youtube' => t('Insert YouTube video'), 'showacl' => false,
'$video' => t('Insert Vorbis [.ogg] video'), 'profile_uid' => $owner_uid,
'$audio' => t('Insert Vorbis [.ogg] audio'), 'catsenabled' => $catsenabled,
'$setloc' => t('Set your location'), 'hide_expire' => true,
'$noloc' => t('Clear browser location'), 'bbcode' => true
'$voting' => t('Toggle voting'), );
'$feature_voting' => $voting,
'$consensus' => intval($itm[0]['item_consensus']), $editor = status_editor($a, $x);
'$wait' => t('Please wait'),
'$permset' => t('Permission settings'),
'$ptyp' => $itm[0]['obj_type'],
'$content' => undo_post_tagging($itm[0]['body']),
'$post_id' => $post_id,
'$parent' => (($itm[0]['parent'] != $itm[0]['id']) ? $itm[0]['parent'] : ''),
'$baseurl' => z_root(),
'$defloc' => $channel['channel_location'],
'$visitor' => false,
'$public' => t('Public post'),
'$jotnets' => $jotnets,
'$title' => htmlspecialchars($itm[0]['title'],ENT_COMPAT,'UTF-8'),
'$placeholdertitle' => t('Title (optional)'),
'$category' => $category,
'$placeholdercategory' => t('Categories (optional, comma-separated list)'),
'$emtitle' => t('Example: bob@example.com, mary@example.com'),
'$lockstate' => $lockstate,
'$acl' => '',
'$bang' => '',
'$profile_uid' => $owner_uid,
'$preview' => t('Preview'),
'$jotplugins' => $jotplugins,
'$sourceapp' => t(\App::$sourcename),
'$catsenabled' => $catsenabled,
'$defexpire' => datetime_convert('UTC', date_default_timezone_get(),$itm[0]['expires']),
'$feature_expire' => ((feature_enabled(\App::$profile['profile_uid'],'content_expire') && (! $webpage)) ? true : false),
'$expires' => t('Set expiration date'),
'$feature_encrypt' => ((feature_enabled(\App::$profile['profile_uid'],'content_encrypt') && (! $webpage)) ? true : false),
'$encrypt' => t('Encrypt text'),
'$cipher' => $cipher,
'$expiryModalOK' => t('OK'),
'$expiryModalCANCEL' => t('Cancel'),
'$bbcode' => true
));
$o .= replace_macros(get_markup_template('edpost_head.tpl'), array( $o .= replace_macros(get_markup_template('edpost_head.tpl'), array(
'$title' => t('Edit post'), '$title' => t('Edit post'),

View File

@ -1115,16 +1115,28 @@ function status_editor($a, $x, $popup = false) {
if($c && $c['channel_moved']) if($c && $c['channel_moved'])
return $o; return $o;
$geotag = (($x['allow_location']) ? replace_macros(get_markup_template('jot_geotag.tpl'), array()) : '');
$plaintext = true; $plaintext = true;
// if(feature_enabled(local_channel(),'richtext')) // if(feature_enabled(local_channel(),'richtext'))
// $plaintext = false; // $plaintext = false;
$voting = feature_enabled(local_channel(), 'consensus_tools'); $feature_voting = feature_enabled($x['profile_uid'], 'consensus_tools');
if(x($x, 'novoting')) if(x($x, 'hide_voting'))
$voting = false; $feature_voting = false;
$feature_expire = ((feature_enabled($x['profile_uid'], 'content_expire') && (! $webpage)) ? true : false);
if(x($x, 'hide_expire'))
$feature_expire = false;
$feature_future = ((feature_enabled($x['profile_uid'], 'delayed_posting') && (! $webpage)) ? true : false);
if(x($x, 'hide_future'))
$feature_future = false;
$geotag = (($x['allow_location']) ? replace_macros(get_markup_template('jot_geotag.tpl'), array()) : '');
$setloc = t('Set your location');
$clearloc = ((get_pconfig($x['profile_uid'], 'system', 'use_browser_location')) ? t('Clear browser location') : '');
if(x($x, 'hide_location'))
$geotag = $setloc = $clearloc = '';
$mimeselect = ''; $mimeselect = '';
if(array_key_exists('mimetype', $x) && $x['mimetype']) { if(array_key_exists('mimetype', $x) && $x['mimetype']) {
@ -1146,7 +1158,6 @@ function status_editor($a, $x, $popup = false) {
$layoutselect = '<input type="hidden" name="layout_mid" value="' . $x['layout'] . '" />'; $layoutselect = '<input type="hidden" name="layout_mid" value="' . $x['layout'] . '" />';
} }
if(array_key_exists('channel_select',$x) && $x['channel_select']) { if(array_key_exists('channel_select',$x) && $x['channel_select']) {
require_once('include/identity.php'); require_once('include/identity.php');
$id_select = identity_selector(); $id_select = identity_selector();
@ -1154,7 +1165,6 @@ function status_editor($a, $x, $popup = false) {
else else
$id_select = ''; $id_select = '';
$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');
@ -1165,7 +1175,7 @@ function status_editor($a, $x, $popup = false) {
'$pretext' => ((x($x,'pretext')) ? $x['pretext'] : ''), '$pretext' => ((x($x,'pretext')) ? $x['pretext'] : ''),
'$geotag' => $geotag, '$geotag' => $geotag,
'$nickname' => $x['nickname'], '$nickname' => $x['nickname'],
'$ispublic' => t('Visible to <strong>everybody</strong>'), '$ispublic' => ((x($x,'ispublic')) ? $x['ispublic'] : t('Visible to <strong>everybody</strong>')),
'$linkurl' => t('Please enter a link URL:'), '$linkurl' => t('Please enter a link URL:'),
'$term' => t('Tag term:'), '$term' => t('Tag term:'),
'$whereareu' => t('Where are you right now?'), '$whereareu' => t('Where are you right now?'),
@ -1212,21 +1222,21 @@ function status_editor($a, $x, $popup = false) {
'$code' => t('Code'), '$code' => t('Code'),
'$attach' => t('Attach file'), '$attach' => t('Attach file'),
'$weblink' => t('Insert web link'), '$weblink' => t('Insert web link'),
'$setloc' => t('Set your location'), '$setloc' => $setloc,
'$voting' => t('Toggle voting'), '$voting' => t('Toggle voting'),
'$feature_voting' => $voting, '$feature_voting' => $feature_voting,
'$consensus' => 0, '$consensus' => 0,
'$noloc' => ((get_pconfig($x['profile_uid'], 'system', 'use_browser_location')) ? t('Clear browser location') : ''), '$clearloc' => $clearloc,
'$title' => ((x($x, 'title')) ? htmlspecialchars($x['title'], ENT_COMPAT,'UTF-8') : ''), '$title' => ((x($x, 'title')) ? htmlspecialchars($x['title'], ENT_COMPAT,'UTF-8') : ''),
'$placeholdertitle' => ((x($x, 'placeholdertitle')) ? $x['placeholdertitle'] : t('Title (optional)')), '$placeholdertitle' => ((x($x, 'placeholdertitle')) ? $x['placeholdertitle'] : t('Title (optional)')),
'$catsenabled' => ((feature_enabled($x['profile_uid'], 'categories') && (! $webpage)) ? 'categories' : ''), '$catsenabled' => ((feature_enabled($x['profile_uid'], 'categories') && (! $webpage)) ? 'categories' : ''),
'$category' => "", '$category' => ((x($x, 'category')) ? $x['category'] : ''),
'$placeholdercategory' => t('Categories (optional, comma-separated list)'), '$placeholdercategory' => t('Categories (optional, comma-separated list)'),
'$permset' => t('Permission settings'), '$permset' => t('Permission settings'),
'$ptyp' => '', '$ptyp' => ((x($x, 'ptyp')) ? $x['ptyp'] : ''),
'$content' => ((x($x,'body')) ? htmlspecialchars($x['body'], ENT_COMPAT,'UTF-8') : ''), '$content' => ((x($x,'body')) ? htmlspecialchars($x['body'], ENT_COMPAT,'UTF-8') : ''),
'$attachment' => ((x($x, 'attachment')) ? $x['attachment'] : ''), '$attachment' => ((x($x, 'attachment')) ? $x['attachment'] : ''),
'$post_id' => '', '$post_id' => ((x($x, 'post_id')) ? $x['post_id'] : ''),
'$defloc' => $x['default_location'], '$defloc' => $x['default_location'],
'$visitor' => $x['visitor'], '$visitor' => $x['visitor'],
'$lockstate' => $x['lockstate'], '$lockstate' => $x['lockstate'],
@ -1240,10 +1250,10 @@ function status_editor($a, $x, $popup = false) {
'$source' => ((x($x, 'source')) ? $x['source'] : ''), '$source' => ((x($x, 'source')) ? $x['source'] : ''),
'$jotplugins' => $jotplugins, '$jotplugins' => $jotplugins,
'$defexpire' => $defexpire, '$defexpire' => $defexpire,
'$feature_expire' => ((feature_enabled($x['profile_uid'], 'content_expire') && (! $webpage)) ? true : false), '$feature_expire' => $feature_expire,
'$expires' => t('Set expiration date'), '$expires' => t('Set expiration date'),
'$defpublish' => $defpublish, '$defpublish' => $defpublish,
'$feature_future' => ((feature_enabled($x['profile_uid'], 'delayed_posting') && (! $webpage)) ? true : false), '$feature_future' => $feature_future,
'$future_txt' => t('Set publish date'), '$future_txt' => t('Set publish date'),
'$feature_encrypt' => ((feature_enabled($x['profile_uid'], 'content_encrypt') && (! $webpage)) ? true : false), '$feature_encrypt' => ((feature_enabled($x['profile_uid'], 'content_encrypt') && (! $webpage)) ? true : false),
'$encrypt' => t('Encrypt text'), '$encrypt' => t('Encrypt text'),

View File

@ -127,4 +127,4 @@ function channel_privacy_macro(n) {
$('#id_profile_in_directory_onoff .off').addClass('hidden'); $('#id_profile_in_directory_onoff .off').addClass('hidden');
$('#id_profile_in_directory').val(1); $('#id_profile_in_directory').val(1);
} }
} }

View File

@ -86,8 +86,8 @@
<i id="profile-location" class="icon-globe jot-icons"></i> <i id="profile-location" class="icon-globe jot-icons"></i>
</button> </button>
{{/if}} {{/if}}
{{if $noloc}} {{if $clearloc}}
<button id="profile-nolocation-wrapper" class="btn btn-default btn-sm" title="{{$noloc}}" onclick="jotClearLocation();return false;" disabled="disabled"> <button id="profile-nolocation-wrapper" class="btn btn-default btn-sm" title="{{$clearloc}}" onclick="jotClearLocation();return false;" disabled="disabled">
<i id="profile-nolocation" class="icon-circle-blank jot-icons"></i> <i id="profile-nolocation" class="icon-circle-blank jot-icons"></i>
</button> </button>
{{/if}} {{/if}}
@ -115,7 +115,7 @@
</button> </button>
{{/if}} {{/if}}
</div> </div>
{{if $writefiles || $weblink || $setloc || $noloc || $feature_expire || $feature_encrypt || $feature_voting}} {{if $writefiles || $weblink || $setloc || $clearloc || $feature_expire || $feature_encrypt || $feature_voting}}
<div class="btn-group visible-xs visible-sm"> <div class="btn-group visible-xs visible-sm">
<button type="button" id="more-tools" class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown" aria-expanded="false"> <button type="button" id="more-tools" class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
<i id="more-tools-icon" class="icon-caret-down jot-icons"></i> <i id="more-tools-icon" class="icon-caret-down jot-icons"></i>
@ -131,8 +131,8 @@
i {{if $setloc}} i {{if $setloc}}
<li><a href="#" onclick="jotGetLocation(); return false;"><i class="icon-globe"></i>&nbsp;{{$setloc}}</a></li> <li><a href="#" onclick="jotGetLocation(); return false;"><i class="icon-globe"></i>&nbsp;{{$setloc}}</a></li>
{{/if}} {{/if}}
{{if $noloc}} {{if $clearloc}}
<li><a href="#" onclick="jotClearLocation(); return false;"><i class="icon-circle-blank"></i>&nbsp;{{$noloc}}</a></li> <li><a href="#" onclick="jotClearLocation(); return false;"><i class="icon-circle-blank"></i>&nbsp;{{$clearloc}}</a></li>
{{/if}} {{/if}}
{{/if}} {{/if}}
{{if $feature_expire}} {{if $feature_expire}}