From 89525f062092c185344ec7318406b1c9086d1eda Mon Sep 17 00:00:00 2001 From: Jonathan Prykop Date: Mon, 17 Aug 2015 23:01:31 -0500 Subject: RT#18830: Upload file to message template --- httemplate/elements/template_image-dialog.html | 279 +++++++++++++++++++++++++ 1 file changed, 279 insertions(+) create mode 100644 httemplate/elements/template_image-dialog.html (limited to 'httemplate/elements/template_image-dialog.html') diff --git a/httemplate/elements/template_image-dialog.html b/httemplate/elements/template_image-dialog.html new file mode 100644 index 000000000..5691d52b5 --- /dev/null +++ b/httemplate/elements/template_image-dialog.html @@ -0,0 +1,279 @@ +<%doc> + +Creates a jquery dialog box that opens when javascript function insertImageDialog +is called, allows user to select an image and specify attributes for it, then passes +img tag with base64 encoded data url to a callback javascript function. + +Accepts the following options: + +callback - pass the html for the selected img to this javascript function; +if omitted, will only include fields for viewing/uploading image + +url - to redirect to after upload, otherwise just refreshes dialog window + + + +<% include('/elements/xmlhttp.html', + 'url' => $p.'misc/xmlhttp-template_image.cgi', + 'subs' => [ 'get_template_image' ], + ) %> + +
+ + + + + +% if ($opt{'callback'}) { + + + + + + + + + + + + + + + + + + + +% } # if $opt{'callback'} + +
+ +
+ +<% &ntable("#cccccc", 2) %> + +
Image + +
Width
Height
Align + +
Alt Text
+ +
+ + + +% if ($canedit) { + +

<% emt('Upload New Image') %>

+ +<% include('/elements/form-file_upload.html', + 'name' => 'TemplateImageUploadForm', + 'id' => 'TemplateImageUploadForm', + 'action' => $p.'misc/process/template_image-upload.cgi', + 'num_files' => 1, + 'fields' => [ 'name', 'agentnum' ], + 'url' => $opt{'url'} || 'javascript:refreshImageList(1)', + ) + %> + + <% &ntable("#cccccc", 2) %> + + <% include( '/elements/tr-input-text.html', + 'field' => 'name', + 'label' => 'Name', + 'required' => 1, + 'id' => 'upload_form_name', + ) + %> + + <% include( '/elements/tr-select-agent.html', + 'label' => "Agent", + 'empty_label' => 'Select agent', + 'agent_virt' => 1, + 'agent_null_right' => 'Edit global templates', + ) + %> + + <% include( '/elements/tr-file-upload.html', + 'field' => 'file', + 'label' => 'File', + ) + %> + + + + + + + + + + + +% } #if canedit + + + +
+

<% emt('Image Preview') %>

+ (<% emt('Loading image...') %>) + +
+ + +
+ + + +<%init> +my %opt = @_; + +my $curuser = $FS::CurrentUser::CurrentUser; + +die "access denied" + unless $curuser->access_right([ 'View templates', 'View global templates', + 'Edit templates', 'Edit global templates', ]); + +my $canedit = $curuser->access_right([ 'Edit templates', 'Edit global templates' ]); + + -- cgit v1.2.1 From ed673c4be67ad4d3b549df3b5f20fe5d76d6e944 Mon Sep 17 00:00:00 2001 From: Jonathan Prykop Date: Mon, 24 Aug 2015 19:28:54 -0500 Subject: RT#18361: Delay package from billing until services are provisioned [text change] --- httemplate/elements/template_image-dialog.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate/elements/template_image-dialog.html') diff --git a/httemplate/elements/template_image-dialog.html b/httemplate/elements/template_image-dialog.html index 5691d52b5..f7fb0c291 100644 --- a/httemplate/elements/template_image-dialog.html +++ b/httemplate/elements/template_image-dialog.html @@ -94,7 +94,7 @@ url - to redirect to after upload, otherwise just refreshes dialog window <% include( '/elements/tr-select-agent.html', 'label' => "Agent", - 'empty_label' => 'Select agent', + 'empty_label' => '(global)', 'agent_virt' => 1, 'agent_null_right' => 'Edit global templates', ) -- cgit v1.2.1 From 1f343115f761ab39020a6aa76d3698fe4c8f2d61 Mon Sep 17 00:00:00 2001 From: Mark Wells Date: Sat, 29 Aug 2015 21:27:39 -0700 Subject: fix improper relative paths, incidental to #21564 --- httemplate/elements/template_image-dialog.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'httemplate/elements/template_image-dialog.html') diff --git a/httemplate/elements/template_image-dialog.html b/httemplate/elements/template_image-dialog.html index f7fb0c291..b471d28da 100644 --- a/httemplate/elements/template_image-dialog.html +++ b/httemplate/elements/template_image-dialog.html @@ -14,7 +14,7 @@ url - to redirect to after upload, otherwise just refreshes dialog window <% include('/elements/xmlhttp.html', - 'url' => $p.'misc/xmlhttp-template_image.cgi', + 'url' => $fsurl.'misc/xmlhttp-template_image.cgi', 'subs' => [ 'get_template_image' ], ) %> @@ -75,7 +75,7 @@ url - to redirect to after upload, otherwise just refreshes dialog window <% include('/elements/form-file_upload.html', 'name' => 'TemplateImageUploadForm', 'id' => 'TemplateImageUploadForm', - 'action' => $p.'misc/process/template_image-upload.cgi', + 'action' => $fsurl.'misc/process/template_image-upload.cgi', 'num_files' => 1, 'fields' => [ 'name', 'agentnum' ], 'url' => $opt{'url'} || 'javascript:refreshImageList(1)', -- cgit v1.2.1