1 <% include('/elements/header-popup.html', 'Override taxes', '', 'onload="resizeFrames()"') %>
3 <TABLE WIDTH="100%" HEIGHT="100%">
5 <iframe name="selected" src="<% $p %>browse/tax_class.html?_type=select;magic=select;maxrecords=15;offset=<% $selected_offset %>;selected=<% $selected %>;" width="100%" frameborder="0" border="0" id="selectorSelected" scrolling="no">
13 <INPUT type="submit" value="Finish" onclick="s=fetchSelected(); s.shift(); parent.document.getElementById('<% $element_name || "tax_override" %>').value=s.toString(); parent.<% $onclick %>();">
14 <INPUT type="reset" value="Cancel" onclick="parent.<% $onclick %>();">
20 <iframe name="unselected" src="<% $p %>browse/tax_class.html?_type=select;magic=omit;maxrecords=15;offset=<% $unselected_offset %>;omit=<% $selected %>;" width="100%" frameborder="0" border="0" id="selectorUnselected" scrolling="no">
28 function resizeFrames() {
29 //frames['selected'].style.height =
30 // frames['selected'].contentWindow.document.body.scrollHeight + "px";
31 //frames['unselected'].style.height =
32 // frames['unselected'].contentWindow.document.body.scrollHeight + "px";
33 var f = document.getElementById('selectorSelected');
34 f.style.height = f.contentWindow.document.body.scrollHeight + "px";
35 var f = document.getElementById('selectorUnselected');
36 f.style.height = f.contentWindow.document.body.scrollHeight + "px";
39 function fetchOffset(search) {
41 if (search.length > 1) {
42 var params = search.split(';');
43 for (i=0; i<params.length; i++) {
44 if (params[i].substr(0,7) == 'offset=') {
45 value = params[i].substr(7);
52 function fetchOffsetStrings() {
53 return 'selected_offset=' +
54 fetchOffset(frames['selected'].location.search) + ';' +
55 'unselected_offset=' +
56 fetchOffset(frames['unselected'].location.search) + ';';
59 function fetchSelected() {
61 var selected = new Array;
63 if (window.location.search.length > 1) {
64 var search = window.location.search.substr(1).split(';');
65 for (i=0; i<search.length; i++) {
66 if (search[i].substr(0,9) == 'selected=') {
67 selected = search[i].substr(9).split(',')
68 }else if (search[i].substr(0,16) == 'selected_offset=') {
69 }else if (search[i].substr(0,18) == 'unselected_offset=') {
70 }else if (search[i].length) {
71 replace += search[i] + ';';
75 selected.unshift(replace);
78 function doUnselect(classnum) {
79 var selected = fetchSelected();
80 var search = selected.shift();
81 //alert("discovered: "+selected.toString());
82 var i=-1, j=-1, k=selected.length;
84 if (!(selected[j]==classnum)) {
85 selected[++i]=selected[j];
88 selected.length = ++i;
89 //alert("finished: "+selected.toString());
91 search += "selected=" + selected.toString() + ';';
92 window.location.search = search + fetchOffsetStrings();
94 function doSelect(classnum) {
95 var selected = fetchSelected();
96 var search = selected.shift();
97 selected.push(classnum);
98 search += "selected=" + selected.toString() + ';';
99 window.location.search = search + fetchOffsetStrings();
103 <% include('/elements/footer.html') %>
106 my $conf = new FS::Conf;
112 unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
115 my $selected_offset = $1
116 if $cgi->param('selected_offset') =~/^(\d+)$/;
118 my $unselected_offset = $1
119 if $cgi->param('unselected_offset') =~/^(\d+)$/;
122 if $cgi->param('selected') =~/^([,\d]+)$/;
124 my $element_name = $1
125 if $cgi->param('element_name') =~/^(\w+)$/;
128 if $cgi->param('onclick') =~/^(\w+)$/;
130 $onclick = 'cClick' unless $onclick;