summaryrefslogtreecommitdiff
path: root/httemplate/elements
diff options
context:
space:
mode:
authorMark Wells <mark@freeside.biz>2012-04-14 15:36:20 -0700
committerMark Wells <mark@freeside.biz>2012-04-14 15:36:20 -0700
commit5371ad9dd6bf63e29ffc85c8381f1ea2630b1749 (patch)
tree0109d86cf93a84697fe84fc29927a9f058cf3d93 /httemplate/elements
parent5abe1300f16cf01a6311203deee29373162491c7 (diff)
parent401ba3ab0637de1bc460370949b75dca092375d8 (diff)
merge master
Diffstat (limited to 'httemplate/elements')
-rw-r--r--httemplate/elements/customer-table.html298
-rw-r--r--httemplate/elements/freeside.css28
-rw-r--r--httemplate/elements/menu.html27
-rw-r--r--httemplate/elements/select-rt-customfield.html34
-rw-r--r--httemplate/elements/table-grid.html13
-rw-r--r--httemplate/elements/tr-select-from_to.html2
-rw-r--r--httemplate/elements/tr-select-router_block_ip.html33
7 files changed, 255 insertions, 180 deletions
diff --git a/httemplate/elements/customer-table.html b/httemplate/elements/customer-table.html
index aa085c41a..a517ece2a 100644
--- a/httemplate/elements/customer-table.html
+++ b/httemplate/elements/customer-table.html
@@ -67,7 +67,45 @@ Example:
this.value = '';
}
-
+
+ function update_customer(searchrow, customerArray) {
+
+ var custnum_obj = document.getElementById('custnum'+searchrow);
+ var customer = document.getElementById('customer'+searchrow);
+ var customer_select = document.getElementById('cust_select'+searchrow);
+
+ custnum_obj.disabled = false;
+ custnum_obj.style.backgroundColor = '#ffffff';
+ customer.disabled = false;
+ customer.style.backgroundColor = '#ffffff';
+
+ if ( customerArray.length == 0 ) {
+
+ custnum_obj.value = 'Not found';
+ customer.value = 'Not found';
+ custnum_obj.style.color = '#ff0000';
+ customer.style.color = '#ff0000';
+
+ customer.style.display = '';
+ customer_select.style.display = 'none';
+ return false;
+
+ } else if ( customerArray.length == 5 ) {
+
+ custnum_obj.value = customerArray[0];
+ custnum_obj.style.color = '#000000';
+ customer.value = customerArray[1];
+
+ update_balance_text(searchrow, customerArray[2]);
+ update_status_text( searchrow, customerArray[3]);
+ update_status_color(searchrow, '#'+customerArray[4]);
+
+ customer.style.display = '';
+ customer_select.style.display = 'none';
+ return true;
+ }
+ }
+
function <% $opt{prefix} %>search_invnum() {
this.style.color = '#000000'
@@ -99,55 +137,25 @@ Example:
customer_select.style.display = 'none';
var custnum_obj = document.getElementById('custnum'+searchrow);
- var balance = document.getElementById('balance'+searchrow);
- var status = document.getElementById('status'+searchrow);
- balance.innerHTML = '';
- status.innerHTML = '';
+ update_balance_text(searchrow, '');
+ update_status_text(searchrow, '');
+ update_status_color(searchrow, '#000000');
function search_invnum_update(customers) {
var customerArray = eval('(' + customers + ')');
-
- custnum_obj.disabled = false;
- custnum_obj.style.backgroundColor = '#ffffff';
- customer.disabled = false;
- customer.style.backgroundColor = '#ffffff';
-
- if ( customerArray.length == 0 ) {
-
- custnum_obj.value = 'Not found';
- customer.value = 'Not found';
- custnum_obj.style.color = '#ff0000';
- customer.style.color = '#ff0000';
-
- customer.style.display = '';
- customer_select.style.display = 'none';
-
- } else if ( customerArray.length == 5 ) {
-
- custnum_obj.value = customerArray[0];
- custnum_obj.style.color = '#000000';
- customer.value = customerArray[1];
- balance.innerHTML = '<% $money_char %>' + customerArray[2] + ' &nbsp; ';
- status.innerHTML = customerArray[3];
- status.style.color = '#'+customerArray[4];
-
- customer.style.display = '';
- customer_select.style.display = 'none';
+ update_customer(searchrow, customerArray);
% if ( $opt{invnum_update_callback} ) {
<% $opt{invnum_update_callback} %>(searchrow, '<% $opt{prefix} %>')
% }
- }
-
}
invnum_search( invnum, search_invnum_update );
}
-
function <% $opt{prefix} %>search_custnum() {
this.style.color = '#000000'
@@ -180,42 +188,19 @@ Example:
var invnum = document.getElementById('invnum'+searchrow);
invnum.value = '';
-
- var balance = document.getElementById('balance'+searchrow);
- balance.innerHTML = '';
-
- var status = document.getElementById('status'+searchrow);
- status.innerHTML = '';
- function search_custnum_update(customers) {
-
- var customerArray = eval('(' + customers + ')');
+ update_balance_text(searchrow, '');
+ update_status_text( searchrow, '');
+ update_status_color(searchrow, '#000000');
- customer.disabled = false;
- customer.style.backgroundColor = '#ffffff';
-
- if ( customerArray.length == 0 ) {
-
- customer.value = 'Not found';
- customer.style.color = '#ff0000';
- custnum_obj.style.color = '#ff0000';
-
- } else if ( customerArray.length == 5 ) {
-
- custnum_obj.value = customerArray[0];
- custnum_obj.style.color = '#000000';
- customer.value = customerArray[1];
- balance.innerHTML = '<% $money_char %>' + customerArray[2] + ' &nbsp; ';
- status.innerHTML = customerArray[3];
- status.style.color = '#'+customerArray[4];
+ function search_custnum_update(customers) {
- customer.style.display = '';
- customer_select.style.display = 'none';
+ var customerArray = eval('(' + customers + ')') || [];
+ update_customer(searchrow, customerArray);
% if ( $opt{custnum_update_callback} ) {
<% $opt{custnum_update_callback} %>(searchrow, '<% $opt{prefix} %>')
% }
- }
}
custnum_search(custnum, search_custnum_update );
@@ -251,39 +236,16 @@ Example:
var customer_select = document.getElementById('cust_select'+searchrow);
- var balance = document.getElementById('balance'+searchrow);
- balance.innerHTML = '';
-
- var status = document.getElementById('status'+searchrow);
- status.innerHTML = '';
-
function search_customer_update(customers) {
- var customerArray = eval('(' + customers + ')');
+ var customerArrayArray = eval('(' + customers + ')') || [ [] ];
custnum_obj.disabled = false;
custnum_obj.style.backgroundColor = '#ffffff';
- if ( customerArray.length == 0 ) {
-
- custnum_obj.value = 'Not found';
- custnum_obj.style.color = '#ff0000';
- customer_obj.style.color = '#ff0000';
-
- customer_obj.style.display = '';
- customer_select.style.display = 'none';
-
- } else if ( customerArray.length == 1 ) {
-
- custnum_obj.value = customerArray[0][0];
- customer_obj.value = customerArray[0][1];
- balance.innerHTML = '<% $money_char %>' + customerArray[0][2] + ' &nbsp; ';
- status.innerHTML = customerArray[0][3];
- status.style.color = '#'+customerArray[0][4];
-
- customer_obj.style.display = '';
- customer_select.style.display = 'none';
+ if ( customerArrayArray.length == 1 ) {
+ update_customer(customerArrayArray[1]);
% if ( $opt{custnum_update_callback} ) {
<% $opt{custnum_update_callback} %>(searchrow, '<% $opt{prefix} %>')
% }
@@ -294,14 +256,16 @@ Example:
custnum_obj.style.color = '#ff0000';
//blank the current list
- for ( var i = customer_select.length; i >= 0; i-- )
- customer_select.options[i] = null;
+ customer_select.options.length = 0;
opt(customer_select, '', 'Multiple customers match "' + customer + '" - select one', '#ff0000');
-
//add the multiple customers
- for ( var s = 0; s < customerArray.length; s++ )
- opt(customer_select, customerArray[s][0] + '_' + customerArray[s][2] + '_' + customerArray[s][3] + '_' + customerArray[s][4], customerArray[s][1], '#000000');
+ for ( var s = 0; s < customerArrayArray.length; s++ ) {
+ opt(customer_select,
+ JSON.stringify(customerArrayArray[s]),
+ customerArrayArray[s][1],
+ '#000000');
+ }
opt(customer_select, 'cancel', '(Edit search string)', '#000000');
@@ -341,27 +305,7 @@ Example:
} else {
- var pos_underscore1 = custnum_balance_status.indexOf('_');
- var pos_underscore2 = custnum_balance_status.indexOf('_',pos_underscore1+1);
- var pos_underscore3 = custnum_balance_status.indexOf('_',pos_underscore2+1);
- var custnum = custnum_balance_status.substring(0,pos_underscore1);
- var balance = custnum_balance_status.substring(pos_underscore1+1,pos_underscore2) + ' &nbsp; ';
- var status = custnum_balance_status.substring(pos_underscore2+1,pos_underscore3);
- var color = custnum_balance_status.substring(pos_underscore3+1);
-
- custnum_obj.value = custnum;
- custnum_obj.style.color = '#000000';
-
- customer_obj.value = customer;
- customer_obj.style.color = '#000000';
-
- balance_obj.innerHTML = '<% $money_char %>' + balance;
-
- status_obj.innerHTML = status;
- status_obj.style.color = '#'+color;
-
- this.style.display = 'none';
- customer_obj.style.display = '';
+ update_customer(searchrow, JSON.parse(custnum_balance_status));
% if ( $opt{custnum_update_callback} ) {
<% $opt{custnum_update_callback} %>(searchrow, '<% $opt{prefix} %>')
@@ -378,6 +322,23 @@ Example:
what.options[length] = optionName;
}
+ function update_status_text(rownum, newval) {
+ document.getElementById('status'+rownum).value = newval;
+ document.getElementById('status'+rownum+'_text').innerHTML = newval;
+ }
+
+ function update_status_color(rownum, newval) {
+ document.getElementById('statuscolor'+rownum).value = newval;
+ document.getElementById('status'+rownum+'_text').style.color = newval;
+ }
+
+ function update_balance_text(rownum, newval) {
+ document.getElementById('balance'+rownum).value = newval;
+ document.getElementById('balance'+rownum+'_text').innerHTML = newval;
+ }
+
+
+
</SCRIPT>
<TABLE ID="<% $opt{prefix} %>OneTrueTable" BGCOLOR="#cccccc" BORDER=0 CELLSPACING=0>
@@ -430,14 +391,26 @@ Example:
</SCRIPT>
</TD>
- <TD>
- <SPAN
+ <TD STYLE="text-align: center">
+ <SPAN
+ ID = "status<% $row %>_text"
+ rownum = "<% $row %>"
+ STYLE = "font-weight: bold;
+ color: <%$param->{"statuscolor$row"} || '#000000'%>"
+
+ ><% $param->{"status$row"} %></SPAN>
+ <INPUT TYPE = "hidden"
NAME = "status<% $row %>"
ID = "status<% $row %>"
+ VALUE = "<% $param->{"status$row"} %>"
+ rownum = "<% $row %>"
+ >
+ <INPUT TYPE = "hidden"
+ NAME = "statuscolor<% $row %>"
+ ID = "statuscolor<% $row %>"
+ VALUE = "<% $param->{"statuscolor$row"} %>"
rownum = "<% $row %>"
- STYLE = "text-align:center; font-weight: bold"
>
- </SPAN>
</TD>
<TD>
@@ -456,6 +429,21 @@ Example:
</SCRIPT>
</TD>
+ <TD STYLE="text-align:right">
+ <% $money_char %>
+ <SPAN
+ ID = "balance<% $row %>_text"
+ rownum = "<% $row %>"
+ ><% $param->{"balance$row"} %></SPAN>
+ &nbsp;
+ <INPUT TYPE = "hidden"
+ NAME = "balance<% $row %>"
+ ID = "balance<% $row %>"
+ VALUE = "<% $param->{"balance$row"} %>"
+ rownum = "<% $row %>"
+ >
+ </TD>
+
% my $col = 0;
% foreach my $field ( @{$opt{fields}} ) {
% my $value;
@@ -494,15 +482,6 @@ Example:
</TD>
% $col++;
% }
- <TD STYLE="text-align:right;">
- <SPAN
- NAME = "balance<% $row %>"
- ID = "balance<% $row %>"
- rownum = "<% $row %>"
- >
- </SPAN>
- &nbsp;
- </TD>
</TR>
% }
@@ -613,15 +592,28 @@ Example:
row.appendChild(custnum_cell);
var status_cell = document.createElement('TD');
+ status_cell.style.textAlign = 'center';
- var status_span = document.createElement('SPAN');
- status_span.setAttribute('name', 'status'+<% $opt{prefix} %>rownum);
- status_span.setAttribute('id', 'status'+<% $opt{prefix} %>rownum);
- status_span.style.textAlign = 'center';
- status_span.style.fontWeight = 'bold';
- status_span.setAttribute('rownum', <% $opt{prefix} %>rownum);
- status_cell.appendChild(status_span);
+ var status_span = document.createElement('SPAN');
+ status_span.setAttribute('id', 'status'+<% $opt{prefix} %>rownum+'_text');
+ status_span.style.fontWeight = 'bold';
+ status_span.setAttribute('rownum', <% $opt{prefix} %>rownum);
+ status_cell.appendChild(status_span);
+ var status_input = document.createElement('INPUT');
+ status_input.setAttribute('type', 'hidden');
+ status_input.setAttribute('name', 'status'+<% $opt{prefix} %>rownum);
+ status_input.setAttribute('id', 'status'+<% $opt{prefix} %>rownum);
+ status_input.setAttribute('rownum', <% $opt{prefix} %>rownum);
+ status_cell.appendChild(status_input);
+
+ var statuscolor_input = document.createElement('INPUT');
+ statuscolor_input.setAttribute('type', 'hidden');
+ statuscolor_input.setAttribute('name', 'statuscolor'+<% $opt{prefix} %>rownum);
+ statuscolor_input.setAttribute('id', 'statuscolor'+<% $opt{prefix} %>rownum);
+ statuscolor_input.setAttribute('rownum', <% $opt{prefix} %>rownum);
+ status_cell.appendChild(statuscolor_input);
+
row.appendChild(status_cell);
var customer_cell = document.createElement('TD');
@@ -649,13 +641,25 @@ Example:
row.appendChild(customer_cell);
var balance_cell = document.createElement('TD');
- balance_cell.style.textAlign = 'right';
-
- var balance_span = document.createElement('SPAN');
- balance_span.setAttribute('name', 'balance'+<% $opt{prefix} %>rownum);
- balance_span.setAttribute('id', 'balance'+<% $opt{prefix} %>rownum);
- balance_span.setAttribute('rownum', <% $opt{prefix} %>rownum);
- balance_cell.appendChild(balance_span);
+
+ balance_cell.style.textAlign = 'right';
+ balance_cell.appendChild(document.createTextNode('<%$money_char%>'));
+
+ var balance_span = document.createElement('SPAN');
+ balance_span.setAttribute('id', 'balance'+<% $opt{prefix} %>rownum+'_text');
+ balance_span.setAttribute('rownum', <% $opt{prefix} %>rownum);
+ balance_cell.appendChild(balance_span);
+
+ balance_cell.appendChild(
+ document.createTextNode(String.fromCharCode(160)) //&nbsp;
+ );
+
+ var balance_input = document.createElement('INPUT');
+ balance_input.setAttribute('type', 'hidden');
+ balance_input.setAttribute('name', 'balance'+<% $opt{prefix} %>rownum);
+ balance_input.setAttribute('id', 'balance'+<% $opt{prefix} %>rownum);
+ balance_input.setAttribute('rownum', <% $opt{prefix} %>rownum);
+ balance_cell.appendChild(balance_input);
row.appendChild(balance_cell);
@@ -676,9 +680,10 @@ Example:
my_cell.appendChild(my_text);
% }
+% my $name = (ref($field) eq 'CODE') ? "column${col}_" : $field;
var my_input = document.createElement('INPUT');
- my_input.setAttribute('name', '<% $field %>'+<% $opt{prefix} %>rownum);
- my_input.setAttribute('id', '<% $field %>'+<% $opt{prefix} %>rownum);
+ my_input.setAttribute('name', '<% $name %>'+<% $opt{prefix} %>rownum);
+ my_input.setAttribute('id', '<% $name %>'+<% $opt{prefix} %>rownum);
my_input.style.textAlign = '<% $align{ $opt{align}->[$col] || 'l' } %>';
my_input.setAttribute('size', <% $sizes->[$col] || 10 %>);
% if ($types->[$col] eq 'immutable') {
@@ -725,7 +730,7 @@ my $conf = new FS::Conf;
$opt{prefix} = '' unless defined $opt{prefix};
$opt{prefix} .= '_' if $opt{prefix};
-my $types = $opt{'types'} ? [ @{$opt{'types'}} ] : [];
+my $types = $opt{'type'} ? [ @{$opt{'type'}} ] : [];
my $sizes = $opt{'size'} ? [ @{$opt{'size'}} ] : [];
my $param = $opt{param};
@@ -742,5 +747,4 @@ my %align = (
);
my $money_char = $conf->config('money_char') || '$';
-
</%init>
diff --git a/httemplate/elements/freeside.css b/httemplate/elements/freeside.css
index 44a4a3ca2..c291e1e33 100644
--- a/httemplate/elements/freeside.css
+++ b/httemplate/elements/freeside.css
@@ -250,3 +250,31 @@ div.fstabcontainer {
background-color:#f8f8f8;
}
+table.grid {
+ border: 1px solid #cccccc;
+ -moz-box-shadow: 1px 1px 2px #666666;
+ -webkit-box-shadow: 1px 1px 2px #666666;
+ box-shadow: 1px 1px 2px #666666;
+ filter: progid:DXImageTransform.Microsoft.Shadow(color='#666666', Direction=135, Strength=2);
+}
+
+th.grid {
+ padding-left: 3px;
+ padding-right: 3px;
+ padding-bottom: 2px;
+ border: none;
+ empty-cells: show;
+}
+
+td.grid {
+ padding-left: 3px;
+ padding-right: 3px;
+ padding-bottom: 2px;
+ border: none;
+ empty-cells: show;
+}
+
+table.inv { border: none }
+th.inv { border: none }
+td.inv { border: none }
+
diff --git a/httemplate/elements/menu.html b/httemplate/elements/menu.html
index 3b0969f5c..b1cbebf34 100644
--- a/httemplate/elements/menu.html
+++ b/httemplate/elements/menu.html
@@ -28,7 +28,7 @@
% 'width' => 300,
% 'height' => 375,
% 'color' => '#7e0079',
-% 'scrolling' => 'no',
+% #'scrolling' => 'no',
% );
% $fs_popup =~ s/return false;//;
function about_freeside() {
@@ -106,7 +106,7 @@ $report_customers_lists{'with USPS-unvalidated addresses'} = [ $fsurl. 'search/c
tie my %report_customers, 'Tie::IxHash';
$report_customers{'List customers'} = [ \%report_customers_lists, 'List customers' ]
- if $curuser->access_right('List customers');
+ if $curuser->access_right('List all customers');
$report_customers{'Zip code distribution'} = [ $fsurl. 'search/report_cust_main-zip.html', 'Zip codes by number of customers' ];
$report_customers{'Customer signup report'} = [ $fsurl. 'graph/report_cust_signup.html', 'New customer signups by date' ],
$report_customers{'Advanced customer reports'} = [ $fsurl. 'search/report_cust_main.html', 'by status, signup date, agent, etc.' ]
@@ -238,9 +238,11 @@ if ( $curuser->access_right('Financial reports') ) {
$report_packages{'separator2'} = '';
}
$report_packages{'All customer packages'} = [ $fsurl.'search/cust_pkg.cgi?pkgnum', 'List all customer packages', ];
-$report_packages{'Package summary'} = [ $fsurl.'search/cust_pkg_summary.html', 'Show package sales summary', ];
+$report_packages{'Package summary'} = [ $fsurl.'search/cust_pkg_summary.html', 'Show package sales summary', ]
+ if $curuser->access_right('Summarize packages');
$report_packages{'Suspended customer packages'} = [ $fsurl.'search/cust_pkg.cgi?magic=suspended', 'List suspended packages' ];
-$report_packages{'Suspension summary'} = [ $fsurl.'search/cust_pkg_susp.html', 'Show suspension activity', ];
+$report_packages{'Suspension summary'} = [ $fsurl.'search/cust_pkg_susp.html', 'Show suspension activity', ]
+ if $curuser->access_right('Summarize packages');
$report_packages{'Customer packages with unconfigured services'} = [ $fsurl.'search/cust_pkg.cgi?APKG_pkgnum', 'List packages which have provisionable services' ];
$report_packages{'FCC Form 477 packages'} = [ $fsurl.'search/report_477.html', 'Summarize packages by census tract for particular types' ]
if $conf->exists('cust_main-require_censustract');
@@ -626,11 +628,18 @@ $help_menu{'Ticketing documentation'} = [ 'http://wiki.bestpractical.com/', 'Req
$help_menu{'Networking monitoring documentation'} = [ 'http://torrus.org/userguide.pod.html', 'Torrus User Guide' ]
if $conf->config('network_monitoring_system') eq 'Torrus_Internal';
$help_menu{'separator'} = '';
-$help_menu{"About Freeside v$FS::VERSION"} = [ "javascript:about_freeside()", '' ];
-$help_menu{"About RT v$RT::VERSION"} = [ 'http://www.bestpractical.com/rt', 'Request Tracker Homepage' ]
- if $conf->config('ticket_system') eq 'RT_Internal';
-$help_menu{"About Torrus v1.0.9"} = [ 'http://www.torrus.org/', 'Torrus Homepage' ] #XXX manual version
- if $conf->config('network_monitoring_system') eq 'Torrus_Internal';
+
+my $agentnum = $conf->config('brand-agent');
+if ( $agentnum ) {
+ my $company_name = $conf->config('company_name', $agentnum);
+ $help_menu{"About $company_name"} = [ "javascript:about_freeside()", '' ];
+} else {
+ $help_menu{"About Freeside v$FS::VERSION"} = [ "javascript:about_freeside()", '' ];
+ $help_menu{"About RT v$RT::VERSION"} = [ 'http://www.bestpractical.com/rt', 'Request Tracker Homepage' ]
+ if $conf->config('ticket_system') eq 'RT_Internal';
+ $help_menu{"About Torrus v1.0.9"} = [ 'http://www.torrus.org/', 'Torrus Homepage' ] #XXX manual version
+ if $conf->config('network_monitoring_system') eq 'Torrus_Internal';
+}
tie my %menu, 'Tie::IxHash';
diff --git a/httemplate/elements/select-rt-customfield.html b/httemplate/elements/select-rt-customfield.html
new file mode 100644
index 000000000..7a45bb14b
--- /dev/null
+++ b/httemplate/elements/select-rt-customfield.html
@@ -0,0 +1,34 @@
+<SELECT NAME="<% $opt{name} %>">
+% while ( @fields ) {
+<OPTION VALUE="<% shift @fields %>"><% shift @fields %></OPTION>
+% }
+</SELECT>
+<%once>
+RT::Init();
+</%once>
+<%init>
+my %opt = @_;
+my $lookuptype = $opt{lookuptype};
+my $valuetype = $opt{valuetype};
+# get a list of TimeValue-type custom fields
+my $CurrentUser = RT::CurrentUser->new();
+$CurrentUser->LoadByName($FS::CurrentUser::CurrentUser->username);
+die "RT not configured" unless $CurrentUser->id;
+my $CFs = RT::CustomFields->new($CurrentUser);
+
+$CFs->Limit(FIELD => 'LookupType',
+ OPERATOR => 'ENDSWITH',
+ VALUE => $lookuptype)
+ if $lookuptype;
+
+$CFs->Limit(FIELD => 'Type',
+ VALUE => $valuetype)
+ if $valuetype;
+
+my @fields;
+push @fields, '', $opt{empty_label} if exists($opt{empty_label});
+
+while (my $CF = $CFs->Next) {
+ push @fields, $CF->Name, ($CF->Description || $CF->Name);
+}
+</%init>
diff --git a/httemplate/elements/table-grid.html b/httemplate/elements/table-grid.html
index 4d7deeaa4..4f4200570 100644
--- a/httemplate/elements/table-grid.html
+++ b/httemplate/elements/table-grid.html
@@ -1,15 +1,4 @@
-<STYLE TYPE="text/css">
-
-.grid TH { padding-left: 3px; padding-right: 3px; padding-bottom: 2px; border: none; empty-cells: show }
-.grid TD { padding-left: 3px; padding-right: 3px; padding-bottom: 2px; border: none; empty-cells: show }
-
-.inv table { border: none }
-.inv TH { border: none }
-.inv TD { border: none }
-
-</STYLE>
-
-<TABLE CLASS="grid" CELLSPACING=<% $opt{cellspacing} %> CELLPADDING=<% $opt{cellpadding} %> <% $opt{bgcolor} %> STYLE="border: 1px solid #cccccc;">
+<TABLE CLASS="grid" CELLSPACING=<% $opt{cellspacing} %> CELLPADDING=<% $opt{cellpadding} %> <% $opt{bgcolor} %>>
<%init>
diff --git a/httemplate/elements/tr-select-from_to.html b/httemplate/elements/tr-select-from_to.html
index 100381234..a27412f99 100644
--- a/httemplate/elements/tr-select-from_to.html
+++ b/httemplate/elements/tr-select-from_to.html
@@ -39,7 +39,7 @@
my %hash = (
'show_month_abbr' => 1,
'start_year' => '1999',
- 'end_year' => '2012', #haha, well...
+ 'end_year' => '2013', #haha, well...
@_,
);
</%init>
diff --git a/httemplate/elements/tr-select-router_block_ip.html b/httemplate/elements/tr-select-router_block_ip.html
index ed8fe810f..95d1787b8 100644
--- a/httemplate/elements/tr-select-router_block_ip.html
+++ b/httemplate/elements/tr-select-router_block_ip.html
@@ -1,23 +1,34 @@
<script type="text/javascript">
var manual_addr_routernum = <% encode_json(\%manual_addr_routernum) %>;
var ip_addr_curr_value = <% $opt{'ip_addr'} |js_string %>;
-function lock_ip_addr(obj, i) {
- var routernum = obj.value;
- var select_blocknum = document.getElementsByName('blocknum')[0];
+var blocknum_curr_value = <% $opt{'blocknum'} |js_string %>;
+function update_ip_addr(obj, i) {
+ var routernum = document.getElementById('router_select_0').value;
+ var select_blocknum = document.getElementById('router_select_1');
+ var blocknum = select_blocknum.value;
var input_ip_addr = document.getElementById('input_ip_addr');
if ( manual_addr_routernum[routernum] == 'Y' ) {
-%# enable ip_addr, default it to its previous value, and hide block selection
+%# hide block selection and default ip address to its previous value
select_blocknum.style.display = 'none';
input_ip_addr.value = ip_addr_curr_value;
- input_ip_addr.disabled = false;
}
else {
%# the reverse
select_blocknum.style.display = '';
- input_ip_addr.disabled = true;
- input_ip_addr.value = '(automatic)';
+%# default ip address to null, unless the router/block are set to the
+%# previous value, in which case default it to current value
+ if ( routernum == router_curr_values[0] &&
+ blocknum == router_curr_values[1] ) {
+ input_ip_addr.value = ip_addr_curr_value;
+ } else {
+ input_ip_addr.value = <% mt('(automatic)') |js_string %>;
+ }
}
}
+function clearhint_ip_addr (what) {
+ if ( what.value == <% mt('(automatic)') |js_string %> )
+ what.value = '';
+}
</script>
<& /elements/tr-td-label.html, label => ($opt{'label'} || 'Router') &>
<td>
@@ -27,7 +38,7 @@ function lock_ip_addr(obj, i) {
records => \@routers,
name_col => 'routername',
value_col => 'routernum',
- onchange => 'lock_ip_addr',
+ onchange => 'update_ip_addr',
curr_value=> $opt{'routernum'},
},
{
@@ -39,6 +50,7 @@ function lock_ip_addr(obj, i) {
name_col => 'cidr',
link_col => 'routernum',
empty_label => '(any)',
+ onchange => 'update_ip_addr',
curr_value => $opt{'blocknum'},
},
]
@@ -52,12 +64,11 @@ function lock_ip_addr(obj, i) {
% }
% else {
<input type="text" id="input_ip_addr" name="ip_addr"
- value="<% $opt{'ip_addr'} |h%>">
+ value="<% $opt{'ip_addr'} |h%>" onfocus="clearhint_ip_addr(this)">
% }
</td> </tr>
-<input type="hidden" name="prev_ip_addr" value="<% $opt{'ip_addr'} |h%>">
<script type="text/javascript">
-lock_ip_addr(document.getElementsByName('routernum')[0],0);
+update_ip_addr();
</script>
<%init>