summaryrefslogtreecommitdiff
path: root/httemplate/elements
diff options
context:
space:
mode:
authorRob Van Dam <rvandam00@gmail.com>2013-11-07 15:27:24 -0700
committerRob Van Dam <rvandam00@gmail.com>2013-11-07 15:27:24 -0700
commitdf1ebf662a9fc3f89503036e0dbf6833c1b95f9e (patch)
treef62eafd9d77427277e6aaa4353fb3bf8567926fd /httemplate/elements
parent45cd27b19e8ad50f835915746fb89e486cbb69c0 (diff)
parenta180208786cccb72ab017e39fff0cb128aa6ba01 (diff)
Merge remote-tracking branch 'upstream/master'
Conflicts: FS/FS/cust_pkg.pm
Diffstat (limited to 'httemplate/elements')
-rw-r--r--httemplate/elements/contact.html2
-rw-r--r--httemplate/elements/input-text.html1
-rw-r--r--httemplate/elements/menu.html1
-rw-r--r--httemplate/elements/select-discount_class.html18
-rw-r--r--httemplate/elements/standardize_locations.js39
-rw-r--r--httemplate/elements/tower_sector.html5
-rw-r--r--httemplate/elements/tr-input-beginning_ending.html4
-rw-r--r--httemplate/elements/tr-input-mask.html37
-rw-r--r--httemplate/elements/tr-password.html3
-rw-r--r--httemplate/elements/tr-select-discount_class.html27
10 files changed, 121 insertions, 16 deletions
diff --git a/httemplate/elements/contact.html b/httemplate/elements/contact.html
index 3d5177612..8abce058e 100644
--- a/httemplate/elements/contact.html
+++ b/httemplate/elements/contact.html
@@ -31,7 +31,7 @@
% 'phonetypenum' => $1,
% });
% if ( $contact_phone ) {
-% $value = $contact_phone->phonenum;
+% $value = $contact_phone->phonenum_pretty;
% $value .= 'x'.$contact_phone->extension
% if $contact_phone->extension;
% $value = '+'. $contact_phone->countrycode. " $value"
diff --git a/httemplate/elements/input-text.html b/httemplate/elements/input-text.html
index 827941501..18272ebe2 100644
--- a/httemplate/elements/input-text.html
+++ b/httemplate/elements/input-text.html
@@ -5,6 +5,7 @@
<% $size %>
<% $maxlength %>
<% $style %>
+ <% $opt{autocomplete} ? 'autocomplete="off"' : '' %>
<% $opt{disabled} %>
<% $onchange %>
><% $opt{'postfix'} %>
diff --git a/httemplate/elements/menu.html b/httemplate/elements/menu.html
index 8cb967518..b8575238d 100644
--- a/httemplate/elements/menu.html
+++ b/httemplate/elements/menu.html
@@ -564,6 +564,7 @@ if ( $curuser->access_right('Configuration') ) {
#eo package grouping sub-menu
$config_pkg{'Discounts'} = [ $fsurl.'browse/discount.html', '' ];
+ $config_pkg{'Discount classes'} = [ $fsurl.'browse/discount_class.html', '' ];
$config_pkg{'Cancel/Suspend Reasons'} = [ \%config_pkg_reason, '' ];
}
diff --git a/httemplate/elements/select-discount_class.html b/httemplate/elements/select-discount_class.html
new file mode 100644
index 000000000..41a27c53a
--- /dev/null
+++ b/httemplate/elements/select-discount_class.html
@@ -0,0 +1,18 @@
+<% include( '/elements/select-table.html',
+ 'table' => 'discount_class',
+ 'name_col' => 'classname',
+ 'value' => $classnum,
+ 'empty_label' => '(none)',
+ 'hashref' => { 'disabled' => '' },
+ %opt,
+ )
+%>
+<%init>
+
+my %opt = @_;
+my $classnum = $opt{'curr_value'} || $opt{'value'};
+
+$opt{'records'} = delete $opt{'discount_class'}
+ if $opt{'discount_class'};
+
+</%init>
diff --git a/httemplate/elements/standardize_locations.js b/httemplate/elements/standardize_locations.js
index ad774d897..debd9e7c4 100644
--- a/httemplate/elements/standardize_locations.js
+++ b/httemplate/elements/standardize_locations.js
@@ -202,23 +202,32 @@ function post_standardization() {
var cf = document.<% $formname %>;
- if ( new String(cf.elements['<% $taxpre %>zip'].value).length < 10 )
+ var prefix = '<% $taxpre %>';
+ // fix edge case with cust_main
+ if ( cf.elements['same']
+ && cf.elements['same'].checked
+ && prefix == 'ship_' ) {
+
+ prefix = 'bill_';
+ }
+
+ if ( new String(cf.elements[prefix + 'zip'].value).length < 10 )
{
- var country_el = cf.elements['<% $taxpre %>country'];
+ var country_el = cf.elements[prefix + 'country'];
var country = country_el.options[ country_el.selectedIndex ].value;
- var geocode = cf.elements['<% $taxpre %>geocode'].value;
+ var geocode = cf.elements[prefix + 'geocode'].value;
if ( country == 'CA' || country == 'US' ) {
- var state_el = cf.elements['<% $taxpre %>state'];
+ var state_el = cf.elements[prefix + 'state'];
var state = state_el.options[ state_el.selectedIndex ].value;
var url = "<% $p %>/misc/choose_tax_location.html" +
"?data_vendor=cch-zip" +
- ";city=" + cf.elements['<% $taxpre %>city'].value +
+ ";city=" + cf.elements[prefix + 'city'].value +
";state=" + state +
- ";zip=" + cf.elements['<% $taxpre %>zip'].value +
+ ";zip=" + cf.elements[prefix + 'zip'].value +
";country=" + country +
";geocode=" + geocode +
";formname=" + '<% $formname %>' +
@@ -229,14 +238,14 @@ function post_standardization() {
} else {
- cf.elements['<% $taxpre %>geocode'].value = 'DEFAULT';
+ cf.elements[prefix + 'geocode'].value = 'DEFAULT';
<% $post_geocode %>;
}
} else {
- cf.elements['<% $taxpre %>geocode'].value = '';
+ cf.elements[prefix + 'geocode'].value = '';
<% $post_geocode %>;
}
@@ -255,13 +264,19 @@ function update_geocode() {
set_geocode = function (what) {
var cf = document.<% $formname %>;
+ var prefix = '<% $taxpre %>';
+ if ( cf.elements['same']
+ && cf.elements['same'].checked
+ && prefix == 'ship_' ) {
+ prefix = 'bill_';
+ }
//alert(what.options[what.selectedIndex].value);
var argsHash = eval('(' + what.options[what.selectedIndex].value + ')');
- cf.elements['<% $taxpre %>city'].value = argsHash['city'];
- setselect(cf.elements['<% $taxpre %>state'], argsHash['state']);
- cf.elements['<% $taxpre %>zip'].value = argsHash['zip'];
- cf.elements['<% $taxpre %>geocode'].value = argsHash['geocode'];
+ cf.elements[prefix + 'city'].value = argsHash['city'];
+ setselect(cf.elements[prefix + 'state'], argsHash['state']);
+ cf.elements[prefix + 'zip'].value = argsHash['zip'];
+ cf.elements[prefix + 'geocode'].value = argsHash['geocode'];
<% $post_geocode %>;
}
diff --git a/httemplate/elements/tower_sector.html b/httemplate/elements/tower_sector.html
index a8bbbc5d1..406895ed9 100644
--- a/httemplate/elements/tower_sector.html
+++ b/httemplate/elements/tower_sector.html
@@ -53,6 +53,11 @@ my %size = ( 'title' => 12 );
tie my %label, 'Tie::IxHash',
'sectorname' => 'Name',
'ip_addr' => 'IP Address',
+ 'height' => 'Height',
+ 'freq_mhz' => 'Freq. (MHz)',
+ 'direction' => 'Direction', # or a button to set these to 0 for omni
+ 'width' => 'Width', #
+ 'range' => 'Range',
;
my @fields = keys %label;
diff --git a/httemplate/elements/tr-input-beginning_ending.html b/httemplate/elements/tr-input-beginning_ending.html
index ffc903875..be6e03c6f 100644
--- a/httemplate/elements/tr-input-beginning_ending.html
+++ b/httemplate/elements/tr-input-beginning_ending.html
@@ -7,7 +7,7 @@
<TR>
<TD ALIGN="right">From date: </TD>
- <TD><INPUT TYPE="text" NAME="<% $opt{prefix} %>beginning" ID="<% $opt{prefix} %>beginning_text" VALUE="<% $from %>" SIZE=<%$size%> MAXLENGTH=<%$maxlength%>> <IMG SRC="<%$fsurl%>images/calendar.png" ID="<% $opt{prefix} %>beginning_button" STYLE="cursor: pointer" TITLE="Select date"><IMG SRC="<%$fsurl%>images/calendar-disabled.png" ID="<% $opt{prefix} %>beginning_disabled" STYLE="display:none"><BR><i>m/d/y<% $time_hint %></i></TD>
+ <TD><INPUT TYPE="text" NAME="<% $opt{prefix} %>beginning" ID="<% $opt{prefix} %>beginning_text" VALUE="<% $from ? time2str($date_format, $from) : '' %>" SIZE=<%$size%> MAXLENGTH=<%$maxlength%>> <IMG SRC="<%$fsurl%>images/calendar.png" ID="<% $opt{prefix} %>beginning_button" STYLE="cursor: pointer" TITLE="Select date"><IMG SRC="<%$fsurl%>images/calendar-disabled.png" ID="<% $opt{prefix} %>beginning_disabled" STYLE="display:none"><BR><i>m/d/y<% $time_hint %></i></TD>
<SCRIPT TYPE="text/javascript">
Calendar.setup({
inputField: "<% $opt{prefix} %>beginning_text",
@@ -26,7 +26,7 @@
% }
<TD ALIGN="right">To date: </TD>
- <TD><INPUT TYPE="text" NAME="<% $opt{prefix} %>ending" ID="<% $opt{prefix} %>ending_text" VALUE="<% $to %>" SIZE=<%$size%> MAXLENGTH=<%$maxlength%>> <IMG SRC="<%$fsurl%>images/calendar.png" ID="<% $opt{prefix} %>ending_button" STYLE="cursor: pointer" TITLE="Select date"><IMG SRC="<%$fsurl%>images/calendar-disabled.png" ID="<% $opt{prefix} %>ending_disabled" STYLE="display:none"><BR><i>m/d/y<% $time_hint %></i></TD>
+ <TD><INPUT TYPE="text" NAME="<% $opt{prefix} %>ending" ID="<% $opt{prefix} %>ending_text" VALUE="<% $to ? time2str($date_format, $to) : '' %>" SIZE=<%$size%> MAXLENGTH=<%$maxlength%>> <IMG SRC="<%$fsurl%>images/calendar.png" ID="<% $opt{prefix} %>ending_button" STYLE="cursor: pointer" TITLE="Select date"><IMG SRC="<%$fsurl%>images/calendar-disabled.png" ID="<% $opt{prefix} %>ending_disabled" STYLE="display:none"><BR><i>m/d/y<% $time_hint %></i></TD>
<SCRIPT TYPE="text/javascript">
Calendar.setup({
inputField: "<% $opt{prefix} %>ending_text",
diff --git a/httemplate/elements/tr-input-mask.html b/httemplate/elements/tr-input-mask.html
index 33725b9a5..922f22f4b 100644
--- a/httemplate/elements/tr-input-mask.html
+++ b/httemplate/elements/tr-input-mask.html
@@ -5,6 +5,7 @@
% }
<& /elements/tr-input-text.html, id => $id, @_ &>
<script type="text/javascript">
+<&| /elements/onload.js &>
MaskedInput({
elm: document.getElementById('<%$id%>'),
format: '<% $opt{format} %>',
@@ -12,7 +13,41 @@ MaskedInput({
<% $opt{typeon} ? "typeon: '$opt{typeon}'," : '' %>
});
document.getElementById('<%$id%>').value = <% $value |js_string %>;
+% if ( $clipboard_hack ) {
+var t = document.getElementById('<% $id %>');
+var container = document.getElementById('<%$id%>_clipboard');
+var KeyHandlerDown = t.onkeydown
+t.onkeydown = function(e) {
+ // intercept ctrl-c and ctrl-x
+ // and cmd-c and cmd-x on mac
+ // when text is selected
+ if ( ( e.ctrlKey || e.metaKey ) ) {
+ // do the dance
+ var separators = /[\\/:-]/g;
+ var s = t.value.substr(t.selectionStart, t.selectionEnd);
+ if ( s ) {
+ container.value = s.replace(separators, '');
+ container.previous = t;
+ container.focus();
+ container.select();
+ return true;
+ }
+ }
+ return KeyHandlerDown.call(t, e);
+};
+container.onkeyup = function(e) {
+ if ( container.previous ) {
+ setTimeout(function() {
+ container.previous.value = container.value;
+ container.previous.focus();
+ }, 10);
+ }
+ return true;
+}
+% } # clipboard hack
+</&>
</script>
+<textarea id="<%$id%>_clipboard" style="opacity:0"></textarea>
<%shared>
my $init = 0;
</%shared>
@@ -21,6 +56,8 @@ my %opt = @_;
# must have a DOM id
my $id = $opt{id} || sprintf('input%04d',int(rand(10000)));
my $value = length($opt{curr_value}) ? $opt{curr_value} : $opt{value} || '';
+
+my $clipboard_hack = $FS::CurrentUser::CurrentUser->option('enable_mask_clipboard_hack');
</%init>
<%doc>
Set up a text input field with input masking.
diff --git a/httemplate/elements/tr-password.html b/httemplate/elements/tr-password.html
index d19c4ed0e..8ad303c67 100644
--- a/httemplate/elements/tr-password.html
+++ b/httemplate/elements/tr-password.html
@@ -1,3 +1,4 @@
<& tr-input-text.html, @_,
- 'type' => 'password',
+ 'type' => 'password',
+ 'autocomplete' => 1,
&>
diff --git a/httemplate/elements/tr-select-discount_class.html b/httemplate/elements/tr-select-discount_class.html
new file mode 100644
index 000000000..5489fe6e8
--- /dev/null
+++ b/httemplate/elements/tr-select-discount_class.html
@@ -0,0 +1,27 @@
+% if ( scalar(@{ $opt{'discount_class'} }) == 0 ) {
+
+ <INPUT TYPE="hidden" NAME="<% $opt{'element_name'} || $opt{'field'} || 'classnum' %>" VALUE="">
+
+% } else {
+
+ <TR>
+ <TD ALIGN="right"><% $opt{'label'} || 'Discount class' %></TD>
+ <TD>
+ <% include( '/elements/select-discount_class.html',
+ 'curr_value' => $classnum,
+ %opt
+ )
+ %>
+ </TD>
+ </TR>
+
+% }
+
+<%init>
+
+my %opt = @_;
+my $classnum = $opt{'curr_value'} || $opt{'value'};
+
+$opt{'discount_class'} ||= [ qsearch( 'discount_class', { disabled=>'' } ) ];
+
+</%init>