This commit is contained in:
Andrew Manning 2017-08-05 11:24:03 +00:00
commit 03ca0bfa69
20 changed files with 81 additions and 52 deletions

View File

@ -407,6 +407,7 @@ class ThreadItem {
'showdislike' => $showdislike,
'comment' => $this->get_comment_box($indent),
'previewing' => ($conv->is_preview() ? true : false ),
'preview_lbl' => t('This is an unsaved preview'),
'wait' => t('Please wait'),
'submid' => str_replace(['+','='], ['',''], base64_encode(substr($item['mid'],0,32))),
'thread_level' => $thread_level

View File

@ -30,7 +30,7 @@ class Ap_probe extends \Zotlabs\Web\Controller {
$redirects = 0;
$x = z_fetch_url($addr,true,$redirects, [ 'headers' => [ $headers ]]);
if($x['success'])
$o .= '<pre>' . str_replace('\\','',jindent($x['body'])) . '</pre>';
$o .= '<pre>' . str_replace(['\\n','\\'],["\n",''],jindent($x['body'])) . '</pre>';
}
return $o;
}

View File

@ -358,9 +358,13 @@ class Channel extends \Zotlabs\Web\Controller {
}
if($is_owner && $update_unseen) {
$r = q("UPDATE item SET item_unseen = 0 where item_unseen = 1 and item_wall = 1 AND uid = %d $update_unseen",
intval(local_channel())
);
$x = [ 'channel_id' => local_channel(), 'update' => 'unset' ];
call_hooks('update_unseen',$x);
if($x['update'] === 'unset' || intval($x['update'])) {
$r = q("UPDATE item SET item_unseen = 0 where item_unseen = 1 and item_wall = 1 AND uid = %d $update_unseen",
intval(local_channel())
);
}
}

View File

@ -634,7 +634,7 @@ class Item extends \Zotlabs\Web\Controller {
$attach_link = '';
$hash = substr($mtch,0,strpos($mtch,','));
$rev = intval(substr($mtch,strpos($mtch,',')));
$r = attach_by_hash_nodata($hash,$rev);
$r = attach_by_hash_nodata($hash, $observer['xchan_hash'], $rev);
if($r['success']) {
$attachments[] = array(
'href' => z_root() . '/attach/' . $r['data']['hash'],

View File

@ -53,8 +53,8 @@ class Mail extends \Zotlabs\Web\Controller {
}
$body = trim(str_replace($match[1],'',$body));
}
echo json_encode(['preview' => zidify_links(smilies(bbcode($body)))]);
}
echo json_encode(['preview' => zidify_links(smilies(bbcode($body)))]);
}
killme();
}

View File

@ -545,10 +545,15 @@ class Network extends \Zotlabs\Web\Controller {
}
}
if(($update_unseen) && (! $firehose))
$r = q("UPDATE item SET item_unseen = 0 WHERE item_unseen = 1 AND uid = %d $update_unseen ",
intval(local_channel())
);
if(($update_unseen) && (! $firehose)) {
$x = [ 'channel_id' => local_channel(), 'update' => 'unset' ];
call_hooks('update_unseen',$x);
if($x['update'] === 'unset' || intval($x['update'])) {
$r = q("UPDATE item SET item_unseen = 0 WHERE item_unseen = 1 AND uid = %d $update_unseen ",
intval(local_channel())
);
}
}
$mode = (($nouveau) ? 'network-new' : 'network');

View File

@ -15,12 +15,16 @@ class Notify extends \Zotlabs\Web\Controller {
intval(local_channel())
);
if($r) {
q("update notify set seen = 1 where (( parent != '' and parent = '%s' and otype = '%s' ) or link = '%s' ) and uid = %d",
dbesc($r[0]['parent']),
dbesc($r[0]['otype']),
dbesc($r[0]['link']),
intval(local_channel())
);
$x = [ 'channel_id' => local_channel(), 'update' => 'unset' ];
call_hooks('update_unseen',$x);
if($x['update'] === 'unset' || intval($x['update'])) {
q("update notify set seen = 1 where (( parent != '' and parent = '%s' and otype = '%s' ) or link = '%s' ) and uid = %d",
dbesc($r[0]['parent']),
dbesc($r[0]['otype']),
dbesc($r[0]['link']),
intval(local_channel())
);
}
goaway($r[0]['link']);
}
goaway(z_root());

View File

@ -0,0 +1,9 @@
[h3]update_unseen[/h3]
Called prior to automatically marking items 'seen'; allowing a plugin the choice to not perform this action.
hook data
[ 'channel_id' => local_channel(), 'update' => 'unset' ];
If 'update' is set to 0 or false on return, the update operation is not performed.

View File

@ -572,6 +572,9 @@ Hooks allow plugins/addons to "hook into" the code at many points and alter the
[zrl=[baseurl]/help/hook/tagged]tagged[/zrl]
Called when a delivery is processed which results in you being tagged
[zrl=[baseurl]/help/hook/update_unseen]update_unseen[/zrl]
Called prior to automatically marking items seen which were loaded in the browser
[zrl=[baseurl]/help/hook/validate_channelname]validate_channelname[/zrl]
Used to validate the names used by a channel

View File

@ -7,7 +7,7 @@
require_once('include/oembed.php');
require_once('include/event.php');
require_once('include/zot.php');
require_once('include/html2plain.php');
function get_bb_tag_pos($s, $name, $occurance = 1) {

View File

@ -467,6 +467,7 @@ function conversation($items, $mode, $update, $page_mode = 'traditional', $prepa
$preview = (($page_mode === 'preview') ? true : false);
$previewing = (($preview) ? ' preview ' : '');
$preview_lbl = t('This is an unsaved preview');
if ($mode === 'network') {
@ -684,6 +685,7 @@ function conversation($items, $mode, $update, $page_mode = 'traditional', $prepa
'mode' => $mode,
'approve' => t('Approve'),
'delete' => t('Delete'),
'preview_lbl' => $preview_lbl,
'id' => (($preview) ? 'P0' : $item['item_id']),
'linktitle' => sprintf( t('View %s\'s profile @ %s'), $profile_name, $profile_url),
'profile_url' => $profile_link,

View File

@ -157,11 +157,11 @@ function bb_to_markdown($Text, $options = []) {
* Transform #tags, strip off the [url] and replace spaces with underscore
*/
$Text = preg_replace_callback('/#\[([zu])rl\=(\w+.*?)\](\w+.*?)\[\/[(zu)]rl\]/i',
$Text = preg_replace_callback('/#\[([zu])rl\=(.*?)\](.*?)\[\/[(zu)]rl\]/i',
create_function('$match', 'return \'#\'. str_replace(\' \', \'_\', $match[3]);'), $Text);
$Text = preg_replace('/#\^\[([zu])rl\=(\w+.*?)\](\w+.*?)\[\/([zu])rl\]/i', '[$1rl=$2]$3[/$4rl]', $Text);
$Text = preg_replace('/#\^\[([zu])rl\=(.*?)\](.*?)\[\/([zu])rl\]/i', '[$1rl=$2]$3[/$4rl]', $Text);
// Converting images with size parameters to simple images. Markdown doesn't know it.
$Text = preg_replace("/\[img\=([0-9]*)x([0-9]*)\](.*?)\[\/img\]/ism", '[img]$3[/img]', $Text);
@ -197,9 +197,6 @@ function bb_to_markdown($Text, $options = []) {
// Remove empty zrl links
$Text = preg_replace("/\[zrl\=\].*?\[\/zrl\]/is", "", $Text);
// escape all unconverted tags
$Text = escape_tags($Text);
$Text = trim($Text);
call_hooks('bb_to_markdown', $Text);

View File

@ -149,6 +149,7 @@ function insertCommentURL(comment, id) {
textarea = document.getElementById("comment-edit-text-" +id);
textarea.value = textarea.value + data;
preview_comment(id);
$('body').css('cursor', 'auto');
});
}

View File

@ -251,8 +251,7 @@ footer {
margin-top: 15px;
}
.preview {
background: url('../img/gray_and_white_diagonal_stripes_background_seamless.gif');
.preview-indicator {
}
#theme-preview {

View File

@ -47,6 +47,7 @@
</li>
<div id="upload-form" class="sub-menu-wrapper">
<div class="sub-menu">
<form enctype="multipart/form-data" method="post" action="">
<div class="form-group">
<select id="import" name="target" class="form-control">
<option value="">{{$import_placeholder}}</option>

View File

@ -39,6 +39,7 @@
</div>
{{/if}}
<div class="wall-item-author">
{{if $item.previewing}}<span class="preview-indicator"><i class="fa fa-eye" title="{{$item.preview_lbl}}"></i></span>&nbsp;{{/if}}
<a href="{{$item.profile_url}}" title="{{$item.linktitle}}" class="wall-item-name-link"><span class="wall-item-name{{$item.sparkle}}" id="wall-item-name-{{$item.id}}" >{{$item.name}}</span></a>{{if $item.owner_url}}&nbsp;{{$item.via}}&nbsp;<a href="{{$item.owner_url}}" title="{{$item.olinktitle}}" class="wall-item-name-link"><span class="wall-item-name{{$item.osparkle}}" id="wall-item-ownername-{{$item.id}}">{{$item.owner_name}}</span></a>{{/if}}
</div>
<div class="wall-item-ago" id="wall-item-ago-{{$item.id}}">

View File

@ -126,6 +126,7 @@ function enableOnUser(){
$('#jot-media').val($('#jot-media').val() + data.result.message);
},
stop: function(e,data) {
preview_post();
$('#profile-rotator').spin(false);
},
});
@ -175,6 +176,7 @@ function enableOnUser(){
$('#profile-rotator').spin('tiny');
$.get('{{$baseurl}}/linkinfo?f=&binurl=' + reply, function(data) {
addeditortext(data);
preview_post();
$('#profile-rotator').spin(false);
});
}
@ -421,6 +423,7 @@ function enableOnUser(){
function(ddata) {
if (ddata['status']) {
addeditortext(ddata['photolink']);
preview_post();
} else {
window.console.log("{{$modalerrorlink}}" + ':' + ddata['errormsg']);
}

View File

@ -1,34 +1,31 @@
<script type="text/javascript" src="view/js/ajaxupload.js" ></script>
<script language="javascript" type="text/javascript">
$("#prvmail-text").editor_autocomplete(baseurl+"/acl");
<script src="library/blueimp_upload/js/vendor/jquery.ui.widget.js"></script>
<script src="library/blueimp_upload/js/jquery.iframe-transport.js"></script>
<script src="library/blueimp_upload/js/jquery.fileupload.js"></script>
<script>
$(document).ready(function() {
var file_uploader = new window.AjaxUpload(
'prvmail-attach-wrapper',
{ action: 'wall_attach/{{$nickname}}',
name: 'userfile',
onSubmit: function(file,ext) { $('#prvmail-rotator').spin('tiny'); },
onComplete: function(file,response) {
addmailtext(response);
$('#prvmail-rotator').spin(false);
}
}
);
$("#prvmail-text").editor_autocomplete(baseurl+"/acl");
var file_uploader_sub = new window.AjaxUpload(
'prvmail-attach-sub',
{ action: 'wall_attach/{{$nickname}}',
name: 'userfile',
onSubmit: function(file,ext) { $('#prvmail-rotator').spin('tiny'); },
onComplete: function(file,response) {
addmailtext(response);
$('#prvmail-rotator').spin(false);
}
}
);
$('#invisible-wall-file-upload').fileupload({
url: 'wall_attach/{{$nickname}}',
dataType: 'json',
dropZone: $('#prvmail-text'),
maxChunkSize: 4 * 1024 * 1024,
add: function(e,data) {
$('#prvmail-rotator').spin('tiny');
data.submit();
},
done: function(e,data) {
addmailtext(data.result.message);
$('#jot-media').val($('#jot-media').val() + data.result.message);
},
stop: function(e,data) {
$('#prvmail-rotator').spin(false);
},
});
$('#prvmail-attach-wrapper').click(function(event) { event.preventDefault(); $('#invisible-wall-file-upload').trigger('click'); return false;});
$('#prvmail-attach-wrapper-sub').click(function(event) { event.preventDefault(); $('#invisible-wall-file-upload').trigger('click'); return false;});
});

View File

@ -6,6 +6,7 @@
<div class="section-content-wrapper">
{{/if}}
<div id="prvmail-wrapper" >
<input id="invisible-wall-file-upload" type="file" name="files" style="visibility:hidden;position:absolute;top:-50;left:-50;width:0;height:0;" multiple>
<form id="prvmail-form" action="mail" method="post" >
<input type="hidden" id="inp-prvmail-expires" name="expires" value="{{$defexpire}}" />
<input type="hidden" name="media_str" id="jot-media" value="" />

View File

@ -32,6 +32,7 @@
</div>
{{/if}}
<div class="wall-item-author">
{{if $item.previewing}}<span class="preview-indicator"><i class="fa fa-eye" title="{{$item.preview_lbl}}"></i></span>&nbsp;{{/if}}
<a href="{{$item.profile_url}}" title="{{$item.linktitle}}" class="wall-item-name-link"><span class="wall-item-name{{$item.sparkle}}" id="wall-item-name-{{$item.id}}" >{{$item.name}}</span></a>{{if $item.owner_url}}&nbsp;{{$item.via}}&nbsp;<a href="{{$item.owner_url}}" title="{{$item.olinktitle}}" class="wall-item-name-link"><span class="wall-item-name{{$item.osparkle}}" id="wall-item-ownername-{{$item.id}}">{{$item.owner_name}}</span></a>{{/if}}
</div>
<div class="wall-item-ago" id="wall-item-ago-{{$item.id}}">