[freeside-commits] freeside/httemplate/config config-view.cgi, 1.19, 1.20 config.cgi, 1.23, 1.24
Ivan,,,
ivan at wavetail.420.am
Sat Sep 22 14:31:15 PDT 2007
Update of /home/cvs/cvsroot/freeside/httemplate/config
In directory wavetail:/tmp/cvs-serv29955
Modified Files:
config-view.cgi config.cgi
Log Message:
improve config UI, especially for textareas
Index: config.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/config/config.cgi,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- config.cgi 1 Aug 2007 22:25:00 -0000 1.23
+++ config.cgi 22 Sep 2007 21:31:13 -0000 1.24
@@ -29,12 +29,20 @@
<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;
-% 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>
@@ -45,7 +53,7 @@
% } 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' ) {
@@ -260,7 +268,12 @@
% $n++;
% }
- </td><td><% $description %></td></tr></table>
+ </td>
+% unless ( $description_printed ) {
+ <td><% $description %></td>
+% }
+</tr>
+</table>
<INPUT TYPE="submit" VALUE="<% $title %>">
</FORM>
@@ -279,15 +292,15 @@
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;
}
+my $agent = '';
+my $title;
if ($agentnum) {
$agent = qsearchs('agent', { 'agentnum' => $1 } );
die "Agent $agentnum not found!" unless $agent;
@@ -298,11 +311,12 @@
}
$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>
Index: config-view.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/config/config-view.cgi,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- config-view.cgi 1 Aug 2007 22:25:00 -0000 1.19
+++ config-view.cgi 22 Sep 2007 21:31:13 -0000 1.20
@@ -1,12 +1,14 @@
<% include("/elements/header.html",
$title,
menubar(
- 'Main Menu' => $p,
'View all agents' => $p.'browse/agent.cgi',
)
)
%>
+Click on a configuration value to change it.
+<BR><BR>
+
<SCRIPT TYPE="text/javascript" SRC="<%$fsurl%>elements/overlibmws.js"></SCRIPT>
<SCRIPT TYPE="text/javascript" SRC="<%$fsurl%>elements/overlibmws_iframe.js"></SCRIPT>
<SCRIPT TYPE="text/javascript" SRC="<%$fsurl%>elements/overlibmws_draggable.js"></SCRIPT>
@@ -38,20 +40,31 @@
% }
</FONT><BR>
- <% include('/elements/table.html', '#cccccc' ) %>
+ <TABLE BGCOLOR="#cccccc" BORDER=1 CELLSPACING=0 CELLPADDING=0 BORDERCOLOR="#999999">
<tr>
<th colspan="2" bgcolor="#dcdcdc">
<% ucfirst($section || 'unclassified') %> configuration options
</th>
</tr>
% foreach my $i (grep $_->section eq $section, @config_items) {
+% my @types = ref($i->type) ? @{$i->type} : ($i->type);
+% my( $width, $height ) = ( 522, 336 );
+% if ( grep $_ eq 'textarea', @types ) {
+% #800x600
+% $width = 763;
+% $height = 408;
+% #1024x768
+% #$width =
+% #$height =
+% }
<tr>
- <td><a href="javascript:void(0);" onClick="overlib( OLiframeContent('config.cgi?key=<% $i->key %>;agentnum=<% $agentnum %>', 522, 336, 'config_popup' ), CAPTION, 'Enter configuration value', STICKY, AUTOSTATUSCAP, MIDX, 0, MIDY, 0, DRAGGABLE, CLOSECLICK ); return false;" name="<% $i->key %>">
- <b><% $i->key %></b></a> - <% $i->description %>
+ <td><a href="javascript:void(0);" onClick="overlib( OLiframeContent('config.cgi?key=<% $i->key %>;agentnum=<% $agentnum %>', <% $width %>, <% $height %>, 'config_popup' ), CAPTION, 'Enter configuration value', STICKY, AUTOSTATUSCAP, MIDX, 0, MIDY, 0, DRAGGABLE, CLOSECLICK ); return false;" name="<% $i->key %>">
+%# <b><% $i->key %></b></a> - <% $i->description %>
+ <b><% $i->key %></b></a>: <% $i->description %>
</td>
<td><table border=0>
-% foreach my $type ( ref($i->type) ? @{$i->type} : $i->type ) {
+% foreach my $type (@types) {
% my $n = 0;
% if ( $type eq '' ) {
@@ -72,9 +85,13 @@
<tr>
<td bgcolor="#ffffff">
-<pre>
-<% encode_entities(join("\n", $conf->config($i->key, $agentnum) ) ) %>
-</pre>
+<font size="-2"><pre>
+<% encode_entities(join("\n",
+ map { length($_) > 88 ? substr($_,0,88).'...' : $_ }
+ $conf->config($i->key, $agentnum)
+ ) )
+%>
+</pre></font>
</td>
</tr>
% } elsif ( $type eq 'checkbox' ) {
More information about the freeside-commits
mailing list