projects
/
freeside.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
ho ho ho, merry XSSmas
[freeside.git]
/
httemplate
/
config
/
config.cgi
diff --git
a/httemplate/config/config.cgi
b/httemplate/config/config.cgi
index
10bbada
..
d58c2f8
100644
(file)
--- a/
httemplate/config/config.cgi
+++ b/
httemplate/config/config.cgi
@@
-20,21
+20,26
@@
function SafeOnsubmit() {
}
</SCRIPT>
}
</SCRIPT>
-% if ( $cgi->param('error') ) {
- <FONT SIZE="+1" COLOR="#ff0000">Error: <% $cgi->param('error') %></FONT>
- <BR><BR>
-% }
+<% include('/elements/error.html') %>
<FORM NAME="OneTrueForm" ACTION="config-process.cgi" METHOD="POST" enctype="multipart/form-data" onSubmit="SafeOnsubmit()">
<INPUT TYPE="hidden" NAME="agentnum" VALUE="<% $agentnum %>">
<INPUT TYPE="hidden" NAME="key" VALUE="<% $key %>">
<FORM NAME="OneTrueForm" ACTION="config-process.cgi" METHOD="POST" enctype="multipart/form-data" onSubmit="SafeOnsubmit()">
<INPUT TYPE="hidden" NAME="agentnum" VALUE="<% $agentnum %>">
<INPUT TYPE="hidden" NAME="key" VALUE="<% $key %>">
-Setting <% $key %>
+Setting <b><% $key %></b>
+
+% my $description_printed = 0;
+% if ( grep $_ eq 'textarea', @types ) {
+% $description_printed = 1;
+
+ - <% $description %>
+
+% }
<table><tr><td>
% my $n = 0;
<table><tr><td>
% my $n = 0;
-% foreach my $type (
ref($config_item->type) ? @{$config_item->type} : $config_item->type
) {
+% foreach my $type (
@types
) {
% if ( $type eq '' ) {
<font color="#ff0000">no type</font>
% if ( $type eq '' ) {
<font color="#ff0000">no type</font>
@@
-45,7
+50,7
@@
Setting <% $key %>
% } elsif ( $type eq 'textarea' ) {
% } elsif ( $type eq 'textarea' ) {
- <textarea name="<% "$key$n" %>" rows=
5
><% join("\n", $conf->config($key, $agentnum)) %></textarea>
+ <textarea name="<% "$key$n" %>" rows=
18 cols=88 wrap="off"
><% join("\n", $conf->config($key, $agentnum)) %></textarea>
% } elsif ( $type eq 'checkbox' ) {
% } elsif ( $type eq 'checkbox' ) {
@@
-260,30
+265,39
@@
Setting <% $key %>
% $n++;
% }
% $n++;
% }
- </td><td><% $description %></td></tr></table>
+ </td>
+% unless ( $description_printed ) {
+ <td><% $description %></td>
+% }
+</tr>
+</table>
<INPUT TYPE="submit" VALUE="<% $title %>">
</FORM>
</BODY>
</HTML>
<%once>
<INPUT TYPE="submit" VALUE="<% $title %>">
</FORM>
</BODY>
</HTML>
<%once>
+
my $conf = new FS::Conf;
my $conf = new FS::Conf;
-my %confitems = map { $_->key => $_ } $conf->config_items;
-</%once>
+my @config_items = grep { $_->key != ~/^invoice_(html|latex|template)/ }
+ $conf->config_items;
+my %confitems = map { $_->key => $_ } @config_items;
+</%once>
<%init>
<%init>
+
die "access denied"
unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
die "access denied"
unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
-my($agentnum, $agent, $title, $action, $key, $value, $config_item,
- $description, $type);
-
-$action = 'Set';
+my $action = 'Set';
+my $agentnum = '';
if ($cgi->param('agentnum') =~ /(\d+)$/) {
$agentnum=$1;
}
if ($cgi->param('agentnum') =~ /(\d+)$/) {
$agentnum=$1;
}
+my $agent = '';
+my $title;
if ($agentnum) {
$agent = qsearchs('agent', { 'agentnum' => $1 } );
die "Agent $agentnum not found!" unless $agent;
if ($agentnum) {
$agent = qsearchs('agent', { 'agentnum' => $1 } );
die "Agent $agentnum not found!" unless $agent;
@@
-294,11
+308,12
@@
if ($agentnum) {
}
$cgi->param('key') =~ /^([-.\w]+)$/ or die "illegal configuration item";
}
$cgi->param('key') =~ /^([-.\w]+)$/ or die "illegal configuration item";
-
$key=
$1;
-$value = $conf->config($key);
-$config_item = $confitems{$key};
+
my $key =
$1;
+
my
$value = $conf->config($key);
+
my
$config_item = $confitems{$key};
-$description = $config_item->description;
-$type = $config_item->type;
+my $description = $config_item->description;
+my $config_type = $config_item->type;
+my @types = ref($config_type) ? @$config_type : ($config_type);
</%init>
</%init>