[Rt-commit] rt branch 4.4/self-service-download-ocfv created. rt-4.4.6-6-gb9cbb41ea5
BPS Git Server
git at git.bestpractical.com
Thu Jul 14 21:02:38 UTC 2022
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "rt".
The branch, 4.4/self-service-download-ocfv has been created
at b9cbb41ea5d43072e25d6c81e90655a0baa4ff10 (commit)
- Log -----------------------------------------------------------------
commit b9cbb41ea5d43072e25d6c81e90655a0baa4ff10
Author: sunnavy <sunnavy at bestpractical.com>
Date: Tue May 24 21:33:55 2022 +0800
Support to download custom field attachments from SelfService
This is initially for file/image custom fields in articles.
diff --git a/share/html/Elements/ShowCustomFieldBinary b/share/html/Elements/ShowCustomFieldBinary
index 178c290a1c..07ee823093 100644
--- a/share/html/Elements/ShowCustomFieldBinary
+++ b/share/html/Elements/ShowCustomFieldBinary
@@ -48,7 +48,8 @@
% if (my $url = RT->System->ExternalStorageURLFor($Object)) {
<a href="<%$url%>">
% } else {
-<a href="<%RT->Config->Get('WebPath')%>/Download/CustomFieldValue/<% $Object->Id %>/<% $Object->Content |un %>">
+% my $home_path = RT->Config->Get('WebPath') . ( !$session{CurrentUser}->Privileged ? '/SelfService' : '' );
+<a href="<% $home_path %>/Download/CustomFieldValue/<% $Object->Id %>/<% $Object->Content |un %>">
% }
<% $Object->Content %>
diff --git a/share/html/Elements/ShowCustomFieldImage b/share/html/Elements/ShowCustomFieldImage
index ccb1f970c8..194644295e 100644
--- a/share/html/Elements/ShowCustomFieldImage
+++ b/share/html/Elements/ShowCustomFieldImage
@@ -51,6 +51,15 @@
$Object
</%ARGS>
<%INIT>
-my $url = RT->System->ExternalStorageURLFor($Object)
- || RT->Config->Get('WebPath') . "/Download/CustomFieldValue/".$Object->Id.'/'.$m->interp->apply_escapes($Object->Content, 'u');
+my $url = RT->System->ExternalStorageURLFor($Object);
+if ( !$url ) {
+ my $home_path = RT->Config->Get('WebPath') . ( !$session{CurrentUser}->Privileged ? '/SelfService' : '' );
+ $url
+ = $home_path
+ . "/Download/CustomFieldValue/"
+ . $Object->Id . '/'
+ . $m->interp->apply_escapes( $Object->Content, 'u' );
+
+}
+
</%INIT>
diff --git a/share/html/Elements/ShowCustomFieldBinary b/share/html/SelfService/Download/CustomFieldValue/dhandler
similarity index 88%
copy from share/html/Elements/ShowCustomFieldBinary
copy to share/html/SelfService/Download/CustomFieldValue/dhandler
index 178c290a1c..48fad7987f 100644
--- a/share/html/Elements/ShowCustomFieldBinary
+++ b/share/html/SelfService/Download/CustomFieldValue/dhandler
@@ -45,14 +45,7 @@
%# those contributions and any derivatives thereof.
%#
%# END BPS TAGGED BLOCK }}}
-% if (my $url = RT->System->ExternalStorageURLFor($Object)) {
-<a href="<%$url%>">
-% } else {
-<a href="<%RT->Config->Get('WebPath')%>/Download/CustomFieldValue/<% $Object->Id %>/<% $Object->Content |un %>">
-% }
-
-<% $Object->Content %>
-</a>
-<%ARGS>
-$Object => undef
-</%ARGS>
+<%init>
+$m->comp('/Download/CustomFieldValue/dhandler', %ARGS);
+$m->abort;
+</%init>
-----------------------------------------------------------------------
hooks/post-receive
--
rt
More information about the rt-commit
mailing list