[freeside-commits] freeside/httemplate/edit cust_main_attach.cgi, 1.3, 1.4

Mark Wells mark at wavetail.420.am
Mon Nov 16 16:06:26 PST 2009


Update of /home/cvs/cvsroot/freeside/httemplate/edit
In directory wavetail.420.am:/tmp/cvs-serv32088/httemplate/edit

Modified Files:
	cust_main_attach.cgi 
Log Message:
cust_attachment improvement, RT#4964 and #6225

Index: cust_main_attach.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/edit/cust_main_attach.cgi,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- cust_main_attach.cgi	14 Aug 2009 17:26:32 -0000	1.3
+++ cust_main_attach.cgi	17 Nov 2009 00:06:24 -0000	1.4
@@ -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 @@
   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>
 



More information about the freeside-commits mailing list