aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorM. Dent <dentm42@gmail.com>2018-12-10 21:49:12 +0100
committerM. Dent <dentm42@gmail.com>2018-12-10 21:49:12 +0100
commit4cb4f175004fe28cfec449932b7f3fe1a36ab8a7 (patch)
treed533bd88c7572a720c1151b3e245fd3069350a62
parent15a689c6f549e25a1301a8cb8ba92c4cd4f90300 (diff)
parent7894fed7413ab3bd782bf939b17ca70bf0196d28 (diff)
downloadvolse-hubzilla-4cb4f175004fe28cfec449932b7f3fe1a36ab8a7.tar.gz
volse-hubzilla-4cb4f175004fe28cfec449932b7f3fe1a36ab8a7.tar.bz2
volse-hubzilla-4cb4f175004fe28cfec449932b7f3fe1a36ab8a7.zip
Merge branch 'photo-hook' into 'dev'
add photo_view_filter hook and fix minor issue with unset auto_save_draft… See merge request hubzilla/core!1425
-rw-r--r--Zotlabs/Module/Photos.php13
-rw-r--r--doc/hook/photo_view_filter.bb1
-rw-r--r--doc/hooklist.bb3
-rwxr-xr-xview/tpl/photo_view.tpl2
4 files changed, 16 insertions, 3 deletions
diff --git a/Zotlabs/Module/Photos.php b/Zotlabs/Module/Photos.php
index 21f6293ef..b87c586da 100644
--- a/Zotlabs/Module/Photos.php
+++ b/Zotlabs/Module/Photos.php
@@ -1122,6 +1122,7 @@ class Photos extends \Zotlabs\Web\Controller {
$comments = '';
if(! $r) {
if($observer && ($can_post || $can_comment)) {
+ $feature_auto_save_draft = ((feature_enabled($owner_uid, 'auto_save_draft')) ? "true" : "false");
$commentbox = replace_macros($cmnt_tpl,array(
'$return_path' => '',
'$mode' => 'photos',
@@ -1137,7 +1138,8 @@ class Photos extends \Zotlabs\Web\Controller {
'$submit' => t('Submit'),
'$preview' => t('Preview'),
'$ww' => '',
- '$feature_encrypt' => false
+ '$feature_encrypt' => false,
+ '$auto_save_draft' => $feature_auto_save_draft
));
}
}
@@ -1270,8 +1272,14 @@ class Photos extends \Zotlabs\Web\Controller {
if(feature_enabled($owner_uid,'dislike'))
$response_verbs[] = 'dislike';
-
$responses = get_responses($conv_responses,$response_verbs,'',$link_item);
+
+ $hookdata = [
+ 'onclick' => '$.colorbox({href: \'' . $photo['href'] . '\'}); return false;',
+ 'raw_photo' => $ph[0],
+ 'nickname' => \App::$data['channel']['channel_address']
+ ];
+ call_hooks('photo_view_filter', $hookdata);
$photo_tpl = get_markup_template('photo_view.tpl');
$o .= replace_macros($photo_tpl, array(
@@ -1309,6 +1317,7 @@ class Photos extends \Zotlabs\Web\Controller {
'$comments' => $comments,
'$commentbox' => $commentbox,
'$paginate' => $paginate,
+ '$onclick' => $hookdata['onclick']
));
\App::$data['photo_html'] = $o;
diff --git a/doc/hook/photo_view_filter.bb b/doc/hook/photo_view_filter.bb
new file mode 100644
index 000000000..0780c1edc
--- /dev/null
+++ b/doc/hook/photo_view_filter.bb
@@ -0,0 +1 @@
+[h2]photo_view_filter[/h2]
diff --git a/doc/hooklist.bb b/doc/hooklist.bb
index d104df380..5d12a139e 100644
--- a/doc/hooklist.bb
+++ b/doc/hooklist.bb
@@ -502,6 +502,9 @@ Hooks allow plugins/addons to "hook into" the code at many points and alter the
[zrl=[baseurl]/help/hook/photo_upload_form]photo_upload_form[/zrl]
Called when generating a photo upload form
+[zrl=[baseurl]/help/hook/photo_view_filter]photo_view_filter[/zrl]
+ Called before the data is handed over to the photo_view template
+
[zrl=[baseurl]/help/hook/poke_verbs]poke_verbs[/zrl]
Called when generating the list of actions for "poke" module
diff --git a/view/tpl/photo_view.tpl b/view/tpl/photo_view.tpl
index 105cf0ac8..6d566cab9 100755
--- a/view/tpl/photo_view.tpl
+++ b/view/tpl/photo_view.tpl
@@ -99,7 +99,7 @@
<div id="photo-edit-end" class="clear"></div>
</div>
<div id="photo-view-wrapper">
- <div id="photo-photo"><a href="{{$photo.href}}" title="{{$photo.title}}" onclick="$.colorbox({href: '{{$photo.href}}'}); return false;"><img style="width: 100%;" src="{{$photo.src}}"></a></div>
+ <div id="photo-photo"><a href="{{$photo.href}}" title="{{$photo.title}}" onclick="{{$onclick}}"><img style="width: 100%;" src="{{$photo.src}}"></a></div>
<div id="photo-photo-end" class="clear"></div>
{{if $tags}}
<div class="photo-item-tools-left" id="in-this-photo">