summaryrefslogtreecommitdiff
path: root/httemplate/misc
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2016-03-11 18:56:59 -0800
committerIvan Kohler <ivan@freeside.biz>2016-03-11 18:57:32 -0800
commit7b8c690b5f4a7b071d4592e133575c88f7027497 (patch)
tree86c3582e404455fa3c9c646636f769ce2b8a365c /httemplate/misc
parentb85f59f20ab425b072fe1739945cce361c72004d (diff)
move misc/cust_pkg_usageprice.html to elements/table-cust_pkg_usageprice.html, RT#33410
Diffstat (limited to 'httemplate/misc')
-rwxr-xr-xhttemplate/misc/change_pkg.cgi5
-rw-r--r--httemplate/misc/cust_pkg_usageprice.html121
-rw-r--r--httemplate/misc/order_pkg.html4
3 files changed, 3 insertions, 127 deletions
diff --git a/httemplate/misc/change_pkg.cgi b/httemplate/misc/change_pkg.cgi
index b562d24cd..e3ef4b7a8 100755
--- a/httemplate/misc/change_pkg.cgi
+++ b/httemplate/misc/change_pkg.cgi
@@ -39,11 +39,10 @@
</TABLE>
<BR>
-<% include('/misc/cust_pkg_usageprice.html',
+<& /elements/table-cust_pkg_usageprice.html,
'pkgpart' => (scalar($cgi->param('pkgpart')) || $cust_pkg->pkgpart),
'pkgnum' => ($cust_pkg->change_to_pkgnum || $pkgnum),
- ) %>
-<BR>
+&>
<FONT CLASS="fsinnerbox-title"><% mt('Change') |h %></FONT>
<% ntable('#cccccc') %>
diff --git a/httemplate/misc/cust_pkg_usageprice.html b/httemplate/misc/cust_pkg_usageprice.html
deleted file mode 100644
index f2e0f57e6..000000000
--- a/httemplate/misc/cust_pkg_usageprice.html
+++ /dev/null
@@ -1,121 +0,0 @@
-<%doc>
-Sets up the xmlhttp, javascript and initial (empty) table for selecting cust_pkg_usageprice.
-Available values are based on pkgpart, and can be updated when changing pkgpart
-by passing the new pkgpart to the following javascript:
-
- usageprice_pkg_changed( pkgpart, pkgnum )
-
-The pkgnum input is optional, and will be used to set initial selected values.
-
-If pkgpart is passed as an option to this element, will run usageprice_pkg_changed
-once to initialize table; pkgnum can be passed as an option along with this.
-
-You can disable usageprice selection temporarily (remove the fields from the form)
-with the javascript usageprice_disable(1), and restore it with usageprice_disable(0,pkgnum).
-While disabled, calling usageprice_pkg_changed will have no effect.
-</%doc>
-
-<& /elements/xmlhttp.html,
- 'url' => $p.'misc/xmlhttp-part_pkg_usageprice.html',
- 'subs' => [ 'get_part_pkg_usageprice' ],
-&>
-
-<FONT CLASS = "fsinnerbox-title"
- ID = "cust_pkg_usageprice_title"
- STYLE = "display:none"
-><% mt('Usage add-ons') |h %></FONT>
-<TABLE BGCOLOR="#cccccc" BORDER=0 CELLSPACING=0 ID="cust_pkg_usageprice_table">
-
-</TABLE>
-
-<SCRIPT>
-
-var usagepriceCache = {};
-var usagepriceDisabled = 0;
-
-function usageprice_disable (disabled, pkgpart) {
- if (disabled) {
- usageprice_pkg_changed(0);
- usagepriceDisabled = 1;
- } else {
- usagepriceDisabled = 0;
- usageprice_pkg_changed(pkgpart);
- }
-}
-
-// main function to invoke when pkgpart changes
-function usageprice_pkg_changed (pkgpart, pkgnum) {
- if (usagepriceDisabled) return;
- clear_part_pkg_usageprice();
-
- if (pkgpart) {
- if (usagepriceCache[pkgpart]) {
- update_part_pkg_usageprice(pkgpart);
- } else {
- get_part_pkg_usageprice( pkgpart || 0, pkgnum || 0, download_part_pkg_usageprice );
- }
- }
-}
-
-// removes table rows & hides table title
-function clear_part_pkg_usageprice () {
- var table = document.getElementById('cust_pkg_usageprice_table');
- for ( var r = table.rows.length - 1; r >= 0; r-- ) {
- table.deleteRow(r);
- }
- document.getElementById('cust_pkg_usageprice_title').style.display = 'none';
-}
-
-// catches response from xmlhttp request, updates cache & calls update function
-function download_part_pkg_usageprice (part_pkg_usageprice) {
- var usagepriceArray = JSON.parse(part_pkg_usageprice);
- var pkgpart = usagepriceArray[0];
- usagepriceCache[pkgpart] = usagepriceArray;
- update_part_pkg_usageprice(pkgpart);
-}
-
-// updates from cache
-function update_part_pkg_usageprice (pkgpart) {
- if (usagepriceDisabled) return;
- clear_part_pkg_usageprice();
-
- var usagepriceArray = usagepriceCache[pkgpart];
- var table = document.getElementById('cust_pkg_usageprice_table');
-
- // add the new usage price rows
- var rownum = 0;
- for ( var s = 1; s < usagepriceArray.length; s=s+2 ) {
- var html = usagepriceArray[s];
- var javascript = usagepriceArray[s+1];
-
- var row = table.insertRow(rownum++);
-
- var widget_cell = document.createElement('TD');
- widget_cell.style.paddingTop = "3px";
- widget_cell.colSpan = "2";
- widget_cell.innerHTML = html;
- row.appendChild(widget_cell);
-
- }
-
- if ( rownum > 0 ) {
- document.getElementById('cust_pkg_usageprice_title').style.display = '';
- } else {
- document.getElementById('cust_pkg_usageprice_title').style.display = 'none';
- }
-
-}
-
-% if ($opt{'pkgpart'}) {
-<&| /elements/onload.js &>
-usageprice_pkg_changed(<% $opt{'pkgpart'} %>, <% $opt{'pkgnum'} %>);
-</&>
-% }
-
-</SCRIPT>
-
-<%init>
-my %opt = @_;
-</%init>
-
-
diff --git a/httemplate/misc/order_pkg.html b/httemplate/misc/order_pkg.html
index f3a573c56..a08cb4bf1 100644
--- a/httemplate/misc/order_pkg.html
+++ b/httemplate/misc/order_pkg.html
@@ -136,12 +136,10 @@
</TABLE><BR>
-<& /misc/cust_pkg_usageprice.html,
+<& /elements/table-cust_pkg_usageprice.html,
'pkgpart' => $pkgpart
&>
-<BR>
-
% my $discount_cust_pkg = $curuser->access_right('Discount customer package');
% my $waive_setup_fee = $curuser->access_right('Waive setup fee');
%