[freeside-commits] branch master updated. 6db14d0fe65daec3d136edaa33a32a1fb24ba06a
Mark Wells
mark at 420.am
Tue Aug 20 16:28:45 PDT 2013
The branch, master has been updated
via 6db14d0fe65daec3d136edaa33a32a1fb24ba06a (commit)
from 00d8adfeadef4eae18cc37b0b72dae4d14859b47 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 6db14d0fe65daec3d136edaa33a32a1fb24ba06a
Author: Mark Wells <mark at freeside.biz>
Date: Tue Aug 20 16:27:54 2013 -0700
future package change: adjust behavior of date field, #20687
diff --git a/httemplate/elements/onload.js b/httemplate/elements/onload.js
new file mode 100644
index 0000000..bfa7eef
--- /dev/null
+++ b/httemplate/elements/onload.js
@@ -0,0 +1,22 @@
+<%doc>
+Filter component to attach a window.onload handler.
+
+Usage:
+ <script>
+ <&| elements/onload.js &>
+ if ( the_stars_are_right ) {
+ run_this_function();
+ }
+ </&>
+ </script>
+
+</%doc>
+(function() {
+ var tmp = window.onload;
+ window.onload = function() {
+ if (typeof(tmp)== 'function') {
+ tmp();
+ }
+<% $m->content %>
+ };
+})();
diff --git a/httemplate/elements/order_pkg.js b/httemplate/elements/order_pkg.js
index 762b2dd..4e41fd6 100644
--- a/httemplate/elements/order_pkg.js
+++ b/httemplate/elements/order_pkg.js
@@ -21,6 +21,11 @@ function pkg_changed () {
}
}
+// if this form element exists, then the start date is a future
+// package change date; don't replace it
+ if ( form.delay ) {
+ return;
+ }
form.start_date_text.value = opt.getAttribute('data-start_date');
if ( opt.getAttribute('data-can_start_date') == 1 ) {
date_text.style.backgroundColor = '#ffffff';
diff --git a/httemplate/elements/tr-select-cust-part_pkg.html b/httemplate/elements/tr-select-cust-part_pkg.html
index 488f04a..8431beb 100644
--- a/httemplate/elements/tr-select-cust-part_pkg.html
+++ b/httemplate/elements/tr-select-cust-part_pkg.html
@@ -64,9 +64,9 @@
);
}
- window.onload = function() {
+ <&| /elements/onload.js &>
classnum_changed(document.getElementById('classnum'));
- }
+ </&>
</SCRIPT>
diff --git a/httemplate/misc/change_pkg.cgi b/httemplate/misc/change_pkg.cgi
index 887fa01..ce83480 100755
--- a/httemplate/misc/change_pkg.cgi
+++ b/httemplate/misc/change_pkg.cgi
@@ -35,16 +35,32 @@
<FONT CLASS="fsinnerbox-title"><% mt('Change') |h %></FONT>
<% ntable('#cccccc') %>
+ <SCRIPT TYPE="text/javascript">
+ function delay_changed() {
+ var enable = document.OrderPkgForm.delay[1].checked;
+ document.getElementById('start_date_text').disabled = !enable;
+ document.getElementById('start_date_button').style.display =
+ (enable ? '' : 'none');
+ document.getElementById('start_date_button_disabled').style.display =
+ (enable ? 'none' : '');
+ }
+ <&| /elements/onload.js &>
+ delay_changed();
+ </&>
+ </SCRIPT>
<TR>
-<!-- <TD> Apply this change: </TD> -->
<TD> <INPUT TYPE="radio" NAME="delay" VALUE="0" \
- <% !$cgi->param('delay') ? 'CHECKED' : '' %>> Now </TD>
+ <% !$cgi->param('delay') ? 'CHECKED' : '' %> \
+ onclick="delay_changed()"> Now </TD>
<TD> <INPUT TYPE="radio" NAME="delay" VALUE="1" \
- <% $cgi->param('delay') ? 'CHECKED' : '' %>> In the future
+ <% $cgi->param('delay') ? 'CHECKED' : '' %> \
+ onclick="delay_changed()"> In the future
<& /elements/input-date-field.html, {
'name' => 'start_date',
'value' => ($cgi->param('start_date') || $cust_main->next_bill_date),
} &>
+ <IMG SRC="<%$fsurl%>images/calendar-disabled.png" \
+ ID="start_date_button_disabled" STYLE="display:none">
</TD>
</TR>
</TABLE>
-----------------------------------------------------------------------
Summary of changes:
httemplate/elements/onload.js | 22 ++++++++++++++++++++++
httemplate/elements/order_pkg.js | 5 +++++
httemplate/elements/tr-select-cust-part_pkg.html | 4 ++--
httemplate/misc/change_pkg.cgi | 22 +++++++++++++++++++---
4 files changed, 48 insertions(+), 5 deletions(-)
create mode 100644 httemplate/elements/onload.js
More information about the freeside-commits
mailing list