diff options
author | mark <mark> | 2009-11-17 00:06:25 +0000 |
---|---|---|
committer | mark <mark> | 2009-11-17 00:06:25 +0000 |
commit | e5e706ef5cebf3db8754801a9bedf90e9a796ef9 (patch) | |
tree | c6245285f11fd1ac275eac5a1eca726acdceb5bc /httemplate | |
parent | d99758f77f8d2f839934498af839109596e216b8 (diff) |
cust_attachment improvement, RT#4964 and #6225
Diffstat (limited to 'httemplate')
-rwxr-xr-x | httemplate/edit/cust_main_attach.cgi | 42 | ||||
-rw-r--r-- | httemplate/edit/process/cust_main_attach.cgi | 2 | ||||
-rw-r--r-- | httemplate/elements/menu.html | 2 | ||||
-rw-r--r-- | httemplate/search/elements/search-html.html | 4 | ||||
-rwxr-xr-x | httemplate/view/cust_main.cgi | 4 | ||||
-rwxr-xr-x | httemplate/view/cust_main/attachments.html | 19 |
6 files changed, 47 insertions, 26 deletions
diff --git a/httemplate/edit/cust_main_attach.cgi b/httemplate/edit/cust_main_attach.cgi index 43d2e2928..5e9b16c99 100755 --- a/httemplate/edit/cust_main_attach.cgi +++ b/httemplate/edit/cust_main_attach.cgi @@ -2,31 +2,39 @@ <% include('/elements/error.html') %> -<FORM ACTION="<% popurl(1) %>process/cust_main_attach.cgi" METHOD=POST ENCTYPE="multipart/form-data"> +<FORM NAME="attach_edit" ACTION="<% popurl(1) %>process/cust_main_attach.cgi" METHOD=POST ENCTYPE="multipart/form-data"> <INPUT TYPE="hidden" NAME="custnum" VALUE="<% $custnum %>"> <INPUT TYPE="hidden" NAME="attachnum" VALUE="<% $attachnum %>"> <BR><BR> +<% include('/elements/table.html') %> % if(defined $attach) { -Filename <INPUT TYPE="text" NAME="filename" VALUE="<% $attach->filename %>"><BR> -MIME type <INPUT TYPE="text" NAME="mime_type" VALUE="<% $attach->mime_type %>"<BR> -Size: <% $attach->size %><BR> - +% if($curuser->access_right("Download attachment")) { +<A HREF="<% $p.'view/attachment.html?'.$attachnum %>">Download this file</A><BR> +% } +<TR><TD> Filename </TD> +<TD><INPUT TYPE="text" NAME="filename" SIZE=32 MAXLENGTH=32 VALUE="<% $attach->filename %>"<% $disabled %>></TD></TR> +<TR><TD> Description </TD> +<TD><INPUT TYPE="text" NAME="title" SIZE=32 MAXLENGTH=32 VALUE="<% $attach->title %>"<% $disabled %></TD></TR> +<TR><TD> MIME type </TD> +<TD><INPUT TYPE="text" NAME="mime_type" VALUE="<% $attach->mime_type %>"<% $disabled %></TD></TR> +<TR><TD> Size </TD><TD><% $attach->size %></TD></TR> % } % else { # !defined $attach - -Filename <INPUT TYPE="file" NAME="file"><BR> - +<TR><TD> Filename </TD><TD><INPUT TYPE="file" SIZE=32 NAME="file"></TD></TR> +<TR><TD> Description </TD><TD><INPUT TYPE="text" NAME="title" SIZE=32 MAXLENGTH=32></TD></TR> % } - +</TABLE> <BR> +% if(! $disabled) { <INPUT TYPE="submit" NAME="submit" VALUE="<% $attachnum ? "Apply Changes" : "Upload File" %>"> - +% } % if(defined $attach and $curuser->access_right('Delete attachment')) { <BR> -<INPUT TYPE="submit" NAME="delete" value="Delete File"> +<INPUT TYPE="submit" NAME="delete" value="Delete File" +onclick="return(confirm('Delete this file?'));"> % } </FORM> @@ -47,13 +55,15 @@ if ( $cgi->param('error') ) { die "no such attachment: ". $attachnum unless $attach; } -$cgi->param('custnum') =~ /^(\d+)$/ or die "illegal custnum"; -my $custnum = $1; - my $action = $attachnum ? 'Edit' : 'Add'; -die "access denied" - unless $curuser->access_right("$action attachment"); +my $disabled=''; +if(! $curuser->access_right("$action attachment")) { + $disabled = ' disabled="disabled"'; +} + +$cgi->param('custnum') =~ /^(\d+)$/ or die "illegal custnum"; +my $custnum = $1; </%init> diff --git a/httemplate/edit/process/cust_main_attach.cgi b/httemplate/edit/process/cust_main_attach.cgi index 98f4d0912..092714122 100644 --- a/httemplate/edit/process/cust_main_attach.cgi +++ b/httemplate/edit/process/cust_main_attach.cgi @@ -53,6 +53,7 @@ if($attachnum) { ('_date', 'otaker', 'body', 'disabled'); $new->filename($cgi->param('filename') || $old->filename); $new->mime_type($cgi->param('mime_type') || $old->mime_type); + $new->title($cgi->param('title')); if($delete and not $old->disabled) { $new->disabled(time); } @@ -67,6 +68,7 @@ else { # This is a new attachment, so require a file. if($filename) { $new->filename($filename); $new->mime_type($cgi->uploadInfo($filename)->{'Content-Type'}); + $new->title($cgi->param('title')); local $/; my $fh = $cgi->upload('file'); diff --git a/httemplate/elements/menu.html b/httemplate/elements/menu.html index cd546618b..5329350dc 100644 --- a/httemplate/elements/menu.html +++ b/httemplate/elements/menu.html @@ -321,6 +321,8 @@ $tools_menu{'Ticketing'} = [ \%tools_ticketing, 'Ticketing tools' ] if $conf->config('ticket_system'); $tools_menu{'Time Queue'} = [ $fsurl.'search/timeworked.html', 'View pending support time' ] if $curuser->access_right('Time queue'); +$tools_menu{'Attachments'} = [ $fsurl.'browse/cust_attachment.html', 'View customer attachments' ] + if !$conf->config('disable_cust_attachment'); $tools_menu{'Importing'} = [ \%tools_importing, 'Import tools' ] if $curuser->access_right('Import'); $tools_menu{'Exporting'} = [ \%tools_exporting, 'Export tools' ] diff --git a/httemplate/search/elements/search-html.html b/httemplate/search/elements/search-html.html index 297774dfd..c0bb721f7 100644 --- a/httemplate/search/elements/search-html.html +++ b/httemplate/search/elements/search-html.html @@ -346,7 +346,9 @@ % } % $a = qq(<A HREF="$a"$onclick>); % } -% +% elsif ( $onclick ) { +% $a = qq(<A HREF="javascript:void(0);"$onclick>); +% } % } % % } diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index 314207bb0..08d99d8e8 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -148,8 +148,8 @@ Comments 'action' => $p.'edit/cust_main_attach.cgi', 'actionlabel' => 'Upload file', 'cust_main' => $cust_main, - 'width' => 616, - 'height' => 408, + 'width' => 480, + 'height' => 296, ) %> % } diff --git a/httemplate/view/cust_main/attachments.html b/httemplate/view/cust_main/attachments.html index 53635fd62..dbb29a7c0 100755 --- a/httemplate/view/cust_main/attachments.html +++ b/httemplate/view/cust_main/attachments.html @@ -11,6 +11,7 @@ % } <TH CLASS="grid" BGCOLOR="#cccccc">Person</TH> <TH CLASS="grid" BGCOLOR="#cccccc">Filename</TH> + <TH CLASS="grid" BGCOLOR="#cccccc">Description</TH> <TH CLASS="grid" BGCOLOR="#cccccc">Type</TH> <TH CLASS="grid" BGCOLOR="#cccccc">Size</TH> <TH CLASS="grid" BGCOLOR="#cccccc"></TH> @@ -54,7 +55,8 @@ % my $clickjs = popup('edit/process/cust_main_attach.cgi?'. % "custnum=$custnum;attachnum=$attachnum;". % "purge=1", -% 'Purge attachment'); +% 'Purge attachment', +% 'Permanently remove this file?'); % $edit .= qq! <A HREF="javascript:void(0);" $clickjs>(purge)</A>!; % } % } @@ -67,9 +69,9 @@ % } % if($curuser->access_right('Delete attachment') ) { % my $clickjs = popup('edit/process/cust_main_attach.cgi?'. -% "custnum=$custnum;attachnum=$attachnum;". -% "delete=1", -% 'Delete attachment'); +% "custnum=$custnum;attachnum=$attachnum;delete=1", +% 'Delete attachment', +% 'Delete this file?'); % $edit .= qq! <A HREF="javascript:void(0);" $clickjs>(delete)</A>!; % } % if ($curuser->access_right('Download attachment') ) { @@ -86,6 +88,8 @@ <% $attach->filename %> </TD> <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"> + <% $attach->title %> + <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"> <% $attach->mime_type %> </TD> <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"> @@ -135,15 +139,16 @@ sub size_units { } sub popup { - my ($url, $label) = @_; + my ($url, $label, $confirm) = @_; my $onclick = include('/elements/popup_link_onclick.html', 'action' => popurl(2).$url, 'actionlabel' => $label, - 'width' => 616, - 'height' => 408, + 'width' => 510, + 'height' => 315, 'frame' => 'top', ); + $onclick = qq!if(confirm('$confirm')) { $onclick }! if $confirm; return qq!onclick="$onclick"!; } |