aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2016-04-29 13:18:42 +0200
committerMario Vavti <mario@mariovavti.com>2016-04-29 13:18:42 +0200
commitb797528b78107b707dc1c56d70e07136d7c31028 (patch)
tree4b8d99232b1549711bbbac77299cac166d012628
parente01b90c4c62d0ad7484c05c5d848e5749617e820 (diff)
downloadvolse-hubzilla-b797528b78107b707dc1c56d70e07136d7c31028.tar.gz
volse-hubzilla-b797528b78107b707dc1c56d70e07136d7c31028.tar.bz2
volse-hubzilla-b797528b78107b707dc1c56d70e07136d7c31028.zip
some work on making mod editpost use status_editor() - if you find anything related to jot broken please revert this commit
-rw-r--r--Zotlabs/Module/Editpost.php115
-rw-r--r--include/conversation.php42
-rw-r--r--view/js/mod_settings.js2
-rwxr-xr-xview/tpl/jot.tpl10
4 files changed, 60 insertions, 109 deletions
diff --git a/Zotlabs/Module/Editpost.php b/Zotlabs/Module/Editpost.php
index d8b971f6c..fd9912fe9 100644
--- a/Zotlabs/Module/Editpost.php
+++ b/Zotlabs/Module/Editpost.php
@@ -5,7 +5,7 @@ require_once('include/acl_selectors.php');
require_once('include/crypto.php');
require_once('include/items.php');
require_once('include/taxonomy.php');
-
+require_once('include/conversation.php');
class Editpost extends \Zotlabs\Web\Controller {
@@ -49,20 +49,7 @@ class Editpost extends \Zotlabs\Web\Controller {
// $plaintext = false;
$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'])) {
$key = get_config('system','prvkey');
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);
}
- $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 = '';
$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');
- if(! $cipher)
- $cipher = 'aes256';
-
-
- $editor = replace_macros($tpl,array(
- '$return_path' => $_SESSION['return_url'],
- '$action' => 'item',
- '$share' => t('Edit'),
- '$bold' => t('Bold'),
- '$italic' => t('Italic'),
- '$underline' => t('Underline'),
- '$quote' => t('Quote'),
- '$code' => t('Code'),
- '$upload' => t('Upload photo'),
- '$attach' => t('Attach file'),
- '$weblink' => t('Insert web link'),
- '$youtube' => t('Insert YouTube video'),
- '$video' => t('Insert Vorbis [.ogg] video'),
- '$audio' => t('Insert Vorbis [.ogg] audio'),
- '$setloc' => t('Set your location'),
- '$noloc' => t('Clear browser location'),
- '$voting' => t('Toggle voting'),
- '$feature_voting' => $voting,
- '$consensus' => intval($itm[0]['item_consensus']),
- '$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
- ));
+
+ $x = array(
+ 'ispublic' => '&nbsp;',
+ 'nickname' => $channel['channel_address'],
+ 'editor_autocomplete'=> true,
+ 'bbco_autocomplete'=> 'bbcode',
+ 'return_path' => $_SESSION['return_url'],
+ 'button' => t('Edit'),
+ 'hide_voting' => true,
+ 'hide_future' => true,
+ 'hide_location' => true,
+ 'ptyp' => $itm[0]['obj_type'],
+ 'body' => undo_post_tagging($itm[0]['body']),
+ 'post_id' => $post_id,
+ 'defloc' => $channel['channel_location'],
+ 'visitor' => true,
+ 'title' => htmlspecialchars($itm[0]['title'],ENT_COMPAT,'UTF-8'),
+ 'category' => $category,
+ 'showacl' => false,
+ 'profile_uid' => $owner_uid,
+ 'catsenabled' => $catsenabled,
+ 'hide_expire' => true,
+ 'bbcode' => true
+ );
+
+ $editor = status_editor($a, $x);
$o .= replace_macros(get_markup_template('edpost_head.tpl'), array(
'$title' => t('Edit post'),
diff --git a/include/conversation.php b/include/conversation.php
index 96207da8e..14fee19b2 100644
--- a/include/conversation.php
+++ b/include/conversation.php
@@ -1115,16 +1115,28 @@ function status_editor($a, $x, $popup = false) {
if($c && $c['channel_moved'])
return $o;
- $geotag = (($x['allow_location']) ? replace_macros(get_markup_template('jot_geotag.tpl'), array()) : '');
-
$plaintext = true;
// if(feature_enabled(local_channel(),'richtext'))
// $plaintext = false;
- $voting = feature_enabled(local_channel(), 'consensus_tools');
- if(x($x, 'novoting'))
- $voting = false;
+ $feature_voting = feature_enabled($x['profile_uid'], 'consensus_tools');
+ if(x($x, 'hide_voting'))
+ $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 = '';
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'] . '" />';
}
-
if(array_key_exists('channel_select',$x) && $x['channel_select']) {
require_once('include/identity.php');
$id_select = identity_selector();
@@ -1154,7 +1165,6 @@ function status_editor($a, $x, $popup = false) {
else
$id_select = '';
-
$webpage = ((x($x,'webpage')) ? $x['webpage'] : '');
$tpl = get_markup_template('jot-header.tpl');
@@ -1165,7 +1175,7 @@ function status_editor($a, $x, $popup = false) {
'$pretext' => ((x($x,'pretext')) ? $x['pretext'] : ''),
'$geotag' => $geotag,
'$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:'),
'$term' => t('Tag term:'),
'$whereareu' => t('Where are you right now?'),
@@ -1212,21 +1222,21 @@ function status_editor($a, $x, $popup = false) {
'$code' => t('Code'),
'$attach' => t('Attach file'),
'$weblink' => t('Insert web link'),
- '$setloc' => t('Set your location'),
+ '$setloc' => $setloc,
'$voting' => t('Toggle voting'),
- '$feature_voting' => $voting,
+ '$feature_voting' => $feature_voting,
'$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') : ''),
'$placeholdertitle' => ((x($x, 'placeholdertitle')) ? $x['placeholdertitle'] : t('Title (optional)')),
'$catsenabled' => ((feature_enabled($x['profile_uid'], 'categories') && (! $webpage)) ? 'categories' : ''),
- '$category' => "",
+ '$category' => ((x($x, 'category')) ? $x['category'] : ''),
'$placeholdercategory' => t('Categories (optional, comma-separated list)'),
'$permset' => t('Permission settings'),
- '$ptyp' => '',
+ '$ptyp' => ((x($x, 'ptyp')) ? $x['ptyp'] : ''),
'$content' => ((x($x,'body')) ? htmlspecialchars($x['body'], ENT_COMPAT,'UTF-8') : ''),
'$attachment' => ((x($x, 'attachment')) ? $x['attachment'] : ''),
- '$post_id' => '',
+ '$post_id' => ((x($x, 'post_id')) ? $x['post_id'] : ''),
'$defloc' => $x['default_location'],
'$visitor' => $x['visitor'],
'$lockstate' => $x['lockstate'],
@@ -1240,10 +1250,10 @@ function status_editor($a, $x, $popup = false) {
'$source' => ((x($x, 'source')) ? $x['source'] : ''),
'$jotplugins' => $jotplugins,
'$defexpire' => $defexpire,
- '$feature_expire' => ((feature_enabled($x['profile_uid'], 'content_expire') && (! $webpage)) ? true : false),
+ '$feature_expire' => $feature_expire,
'$expires' => t('Set expiration date'),
'$defpublish' => $defpublish,
- '$feature_future' => ((feature_enabled($x['profile_uid'], 'delayed_posting') && (! $webpage)) ? true : false),
+ '$feature_future' => $feature_future,
'$future_txt' => t('Set publish date'),
'$feature_encrypt' => ((feature_enabled($x['profile_uid'], 'content_encrypt') && (! $webpage)) ? true : false),
'$encrypt' => t('Encrypt text'),
diff --git a/view/js/mod_settings.js b/view/js/mod_settings.js
index e28a18b9f..3fd57995a 100644
--- a/view/js/mod_settings.js
+++ b/view/js/mod_settings.js
@@ -127,4 +127,4 @@ function channel_privacy_macro(n) {
$('#id_profile_in_directory_onoff .off').addClass('hidden');
$('#id_profile_in_directory').val(1);
}
-} \ No newline at end of file
+}
diff --git a/view/tpl/jot.tpl b/view/tpl/jot.tpl
index 9c5ddc620..34952596a 100755
--- a/view/tpl/jot.tpl
+++ b/view/tpl/jot.tpl
@@ -86,8 +86,8 @@
<i id="profile-location" class="icon-globe jot-icons"></i>
</button>
{{/if}}
- {{if $noloc}}
- <button id="profile-nolocation-wrapper" class="btn btn-default btn-sm" title="{{$noloc}}" onclick="jotClearLocation();return false;" disabled="disabled">
+ {{if $clearloc}}
+ <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>
</button>
{{/if}}
@@ -115,7 +115,7 @@
</button>
{{/if}}
</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">
<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>
@@ -131,8 +131,8 @@
i {{if $setloc}}
<li><a href="#" onclick="jotGetLocation(); return false;"><i class="icon-globe"></i>&nbsp;{{$setloc}}</a></li>
{{/if}}
- {{if $noloc}}
- <li><a href="#" onclick="jotClearLocation(); return false;"><i class="icon-circle-blank"></i>&nbsp;{{$noloc}}</a></li>
+ {{if $clearloc}}
+ <li><a href="#" onclick="jotClearLocation(); return false;"><i class="icon-circle-blank"></i>&nbsp;{{$clearloc}}</a></li>
{{/if}}
{{/if}}
{{if $feature_expire}}