[freeside-commits] freeside/httemplate/config config-download.cgi,
NONE, 1.1 config-process.cgi, 1.10, 1.11 config-view.cgi, 1.15, 1.16
Jeff Finucane,420,,
jeff at wavetail.420.am
Mon Feb 26 17:48:09 PST 2007
Update of /home/cvs/cvsroot/freeside/httemplate/config
In directory wavetail:/tmp/cvs-serv2258/httemplate/config
Modified Files:
config-process.cgi config-view.cgi
Added Files:
config-download.cgi
Log Message:
config goes in database
Index: config-process.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/config/config-process.cgi,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- config-process.cgi 29 Jan 2007 23:16:18 -0000 1.10
+++ config-process.cgi 27 Feb 2007 01:48:07 -0000 1.11
@@ -1,5 +1,4 @@
<%init>
-
die "access denied\n"
unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
@@ -28,6 +27,16 @@
} else {
$conf->delete($i->key);
}
+ } elsif ( $type eq 'binary' ) {
+ if ( defined($cgi->param($i->key. $n)) && $cgi->param($i->key. $n) ) {
+ my $fh = $cgi->upload($i->key. $n);
+ if (defined($fh)) {
+ local $/;
+ $conf->set_binary($i->key, <$fh>);
+ }
+ }else{
+ warn "Condition failed for " . $i->key;
+ }
} elsif ( $type eq 'checkbox' ) {
# if ( defined($cgi->param($i->key. $n)) && $cgi->param($i->key. $n) ) {
if ( defined $cgi->param($i->key. $n) ) {
@@ -57,6 +66,5 @@
$conf->touch($_) foreach @touch;
$conf->delete($_) foreach @delete;
}
-
</%init>
<% $cgi->redirect("config-view.cgi") %>
Index: config-view.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/config/config-view.cgi,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- config-view.cgi 29 Jan 2007 23:16:18 -0000 1.15
+++ config-view.cgi 27 Feb 2007 01:48:07 -0000 1.16
@@ -42,6 +42,14 @@
<tr>
<td><font color="#ff0000">no type</font></td>
</tr>
+% } elsif ( $type eq 'binary' ) {
+
+ <tr>
+ <% $conf->exists($i->key)
+ ? qq!<a href="config-download.cgi?!. $i->key. qq!">download</a>!
+ : 'empty'
+ %>
+ </tr>
% } elsif ( $type eq 'textarea'
% || $type eq 'editlist'
% || $type eq 'selectmultiple' ) {
--- NEW FILE: config-download.cgi ---
%
%
%my $conf=new FS::Conf;
%
%http_header('Content-Type' => 'application/x-unknown' );
%
%die "No configuration variable specified (bad URL)!" # umm
% unless $cgi->keywords;
%my($query) = $cgi->keywords;
%$query =~ /^([\w -\)+-\/@;:?=[\]]+)$/;
%my $name = $1;
%
%http_header('Content-Disposition' => "attachment; filename=$name" );
% print $conf->config_binary($name);
More information about the freeside-commits
mailing list