diff options
author | git-marijus <mario@mariovavti.com> | 2017-08-03 21:59:46 +0200 |
---|---|---|
committer | git-marijus <mario@mariovavti.com> | 2017-08-03 21:59:46 +0200 |
commit | a618f70f56efdcaaf9da6dcfcab9cce6a933303b (patch) | |
tree | d363935c303b53f4b82a15b523259c53bb3cd2a6 | |
parent | 9566eab934f0a13a892af7b70a79429949a01c3f (diff) | |
parent | d06ce6294d8bbf6bed668e7f0f363fcad63f4e05 (diff) | |
download | volse-hubzilla-a618f70f56efdcaaf9da6dcfcab9cce6a933303b.tar.gz volse-hubzilla-a618f70f56efdcaaf9da6dcfcab9cce6a933303b.tar.bz2 volse-hubzilla-a618f70f56efdcaaf9da6dcfcab9cce6a933303b.zip |
Merge remote-tracking branch 'mike/master' into dev
-rw-r--r-- | Zotlabs/Lib/ThreadItem.php | 1 | ||||
-rw-r--r-- | Zotlabs/Module/Ap_probe.php | 2 | ||||
-rw-r--r-- | Zotlabs/Module/Channel.php | 10 | ||||
-rw-r--r-- | Zotlabs/Module/Network.php | 13 | ||||
-rw-r--r-- | Zotlabs/Module/Notify.php | 16 | ||||
-rw-r--r-- | doc/hook/update_unseen.bb | 9 | ||||
-rw-r--r-- | doc/hooklist.bb | 3 | ||||
-rw-r--r-- | include/bbcode.php | 2 | ||||
-rw-r--r-- | include/conversation.php | 2 | ||||
-rw-r--r-- | include/markdown.php | 7 | ||||
-rw-r--r-- | view/js/main.js | 1 | ||||
-rw-r--r-- | view/theme/redbasic/css/style.css | 3 | ||||
-rwxr-xr-x | view/tpl/conv_item.tpl | 1 | ||||
-rwxr-xr-x | view/tpl/jot-header.tpl | 3 | ||||
-rwxr-xr-x | view/tpl/search_item.tpl | 1 |
15 files changed, 52 insertions, 22 deletions
diff --git a/Zotlabs/Lib/ThreadItem.php b/Zotlabs/Lib/ThreadItem.php index 72d8af4dd..9ee16480a 100644 --- a/Zotlabs/Lib/ThreadItem.php +++ b/Zotlabs/Lib/ThreadItem.php @@ -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 diff --git a/Zotlabs/Module/Ap_probe.php b/Zotlabs/Module/Ap_probe.php index f788fa73a..769cd4c4e 100644 --- a/Zotlabs/Module/Ap_probe.php +++ b/Zotlabs/Module/Ap_probe.php @@ -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; } diff --git a/Zotlabs/Module/Channel.php b/Zotlabs/Module/Channel.php index a44984c97..c006d65d4 100644 --- a/Zotlabs/Module/Channel.php +++ b/Zotlabs/Module/Channel.php @@ -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()) + ); + } } diff --git a/Zotlabs/Module/Network.php b/Zotlabs/Module/Network.php index 597ba084b..1954df549 100644 --- a/Zotlabs/Module/Network.php +++ b/Zotlabs/Module/Network.php @@ -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'); diff --git a/Zotlabs/Module/Notify.php b/Zotlabs/Module/Notify.php index f592f6f37..3d6e1c2e7 100644 --- a/Zotlabs/Module/Notify.php +++ b/Zotlabs/Module/Notify.php @@ -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()); diff --git a/doc/hook/update_unseen.bb b/doc/hook/update_unseen.bb new file mode 100644 index 000000000..8fb02c239 --- /dev/null +++ b/doc/hook/update_unseen.bb @@ -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.
\ No newline at end of file diff --git a/doc/hooklist.bb b/doc/hooklist.bb index da4d9596b..9a17fdb91 100644 --- a/doc/hooklist.bb +++ b/doc/hooklist.bb @@ -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 diff --git a/include/bbcode.php b/include/bbcode.php index c408af35d..9f9b5c5e1 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -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) { diff --git a/include/conversation.php b/include/conversation.php index 1c1a4479d..460c97efb 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -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, diff --git a/include/markdown.php b/include/markdown.php index 530af57a0..0cd9ab237 100644 --- a/include/markdown.php +++ b/include/markdown.php @@ -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); diff --git a/view/js/main.js b/view/js/main.js index 54450858a..aaadff99b 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -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'); }); } diff --git a/view/theme/redbasic/css/style.css b/view/theme/redbasic/css/style.css index fd2ceb2c9..37277b612 100644 --- a/view/theme/redbasic/css/style.css +++ b/view/theme/redbasic/css/style.css @@ -251,8 +251,7 @@ footer { margin-top: 15px; } -.preview { - background: url('../img/gray_and_white_diagonal_stripes_background_seamless.gif'); +.preview-indicator { } #theme-preview { diff --git a/view/tpl/conv_item.tpl b/view/tpl/conv_item.tpl index 36cb4cc83..663b02890 100755 --- a/view/tpl/conv_item.tpl +++ b/view/tpl/conv_item.tpl @@ -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> {{/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}} {{$item.via}} <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}}"> diff --git a/view/tpl/jot-header.tpl b/view/tpl/jot-header.tpl index d8f296aa4..815d17c3c 100755 --- a/view/tpl/jot-header.tpl +++ b/view/tpl/jot-header.tpl @@ -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']); } diff --git a/view/tpl/search_item.tpl b/view/tpl/search_item.tpl index 4ca6378b8..28667eb58 100755 --- a/view/tpl/search_item.tpl +++ b/view/tpl/search_item.tpl @@ -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> {{/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}} {{$item.via}} <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}}"> |