diff options
Diffstat (limited to 'httemplate')
-rw-r--r-- | httemplate/edit/elements/part_export/broadband_snmp.html | 11 | ||||
-rw-r--r-- | httemplate/elements/auto-table.html | 1 | ||||
-rw-r--r-- | httemplate/elements/select-mib-popup.html | 26 |
3 files changed, 27 insertions, 11 deletions
diff --git a/httemplate/edit/elements/part_export/broadband_snmp.html b/httemplate/edit/elements/part_export/broadband_snmp.html index 8df0b8e02..4c0367c5a 100644 --- a/httemplate/edit/elements/part_export/broadband_snmp.html +++ b/httemplate/edit/elements/part_export/broadband_snmp.html @@ -46,7 +46,7 @@ function receive_mib(obj, rownum) { //console.log(JSON.stringify(obj)); // we don't really need the numeric OID or any of the other properties document.getElementById('oid'+rownum).value = obj.fullname; - document.getElementById('datatype'+rownum).innerHTML = obj.type; + document.getElementById('datatype'+rownum).value = obj.type; } </script> @@ -69,7 +69,7 @@ function receive_mib(obj, rownum) { <INPUT NAME="oid" ID="oid" SIZE="60" onclick="open_select_mib(this)"> </TD> <TD> - <SPAN ID="datatype"></SPAN> + <INPUT TYPE="text" NAME="datatype" ID="datatype" READONLY=1> </TD> <TD> <INPUT NAME="value" ID="value"> @@ -77,10 +77,10 @@ function receive_mib(obj, rownum) { </TR> <& /elements/auto-table.html, template_row => 'mytemplate', - fieldorder => ['action', 'oid', 'value'], + fieldorder => ['action', 'oid', 'datatype', 'value'], data => \@data, &> -<INPUT TYPE="hidden" NAME="multi_options" VALUE="action,oid,value"> +<INPUT TYPE="hidden" NAME="multi_options" VALUE="action,oid,datatype,value"> <& foot.html, %opt &> <%init> my %opt = @_; @@ -88,11 +88,12 @@ my $part_export = $opt{part_export} || FS::part_export->new; my @actions = split("\n", $part_export->option('action')); my @oids = split("\n", $part_export->option('oid')); +my @types = split("\n", $part_export->option('datatype')); my @values = split("\n", $part_export->option('value')); my @data; while (@actions or @oids or @values) { - my @thisrow = (shift(@actions), shift(@oids), shift(@values)); + my @thisrow = (shift(@actions), shift(@oids), shift(@types), shift(@values)); push @data, \@thisrow if grep length($_), @thisrow; } diff --git a/httemplate/elements/auto-table.html b/httemplate/elements/auto-table.html index ed011097e..9aff94e67 100644 --- a/httemplate/elements/auto-table.html +++ b/httemplate/elements/auto-table.html @@ -168,7 +168,6 @@ $pre = $opt{'table'} . '_' if $opt{'table'}; my $template_row = $opt{'template_row'} or die "auto-table requires template_row\n"; # a DOM id -my %vars = $cgi->Vars; # rows that we will preload, as hashrefs of name => value my @rows = @{ $opt{'data'} || [] }; foreach (@rows) { diff --git a/httemplate/elements/select-mib-popup.html b/httemplate/elements/select-mib-popup.html index f8e3ae3da..bd485ef65 100644 --- a/httemplate/elements/select-mib-popup.html +++ b/httemplate/elements/select-mib-popup.html @@ -1,12 +1,13 @@ <& /elements/header-popup.html &> +<DIV STYLE="visibility: hidden; position: absolute" ID="measurebox"></DIV> <TABLE WIDTH="100%"> <TR> - <TD ALIGN="right">Module:</TD> + <TD WIDTH="30%" ALIGN="right">Module:</TD> <TD><SELECT ID="select_module"></SELECT></TD> </TR> <TR> <TD ALIGN="right">Object:</TD> - <TD><INPUT TYPE="text" NAME="path" ID="input_path"></TD> + <TD><INPUT TYPE="text" NAME="path" ID="input_path" WIDTH="100%"></TD> </TR> <TR> <TD COLSPAN=2> @@ -14,7 +15,7 @@ </TD> </TR> <TR> - <TH COLSPAN=2 ID="mib_objectID"></TH> + <TH ALIGN="center" COLSPAN=2 ID="mib_objectID"></TH> </TR> <TR> <TD ALIGN="right">Module: </TD><TD ID="mib_moduleID"></TD> @@ -40,7 +41,7 @@ function show_info(state) { document.getElementById('mib_objectID').style.display = document.getElementById('mib_moduleID').style.display = document.getElementById('mib_type').style.display = - state ? 'block' : 'none'; + state ? '' : 'none'; } function clear_list() { @@ -48,6 +49,7 @@ function clear_list() { select_path.options.length = 0; } +var measurebox = document.getElementById('measurebox'); function add_item(value) { var select_path = document.getElementById('select_path'); var input_path = document.getElementById('input_path'); @@ -57,7 +59,21 @@ function add_item(value) { opt.className = 'leaf'; v = v.substring(0, v.length - 1); } - opt.value = opt.text = v; + var optvalue = v; // may not be the name we display + // shorten these if they don't fit in the box + if ( v.length > 30 ) { // unless they're already really short + measurebox.innerHTML = v; + while ( measurebox.clientWidth > select_path.clientWidth - 10 + && v.match(/^\..*\./) ) { + v = v.replace(/^\.[^\.]+/, ''); + measurebox.innerHTML = v; + } + if ( optvalue != v ) { + v = '...' + v; + } + } + opt.value = optvalue; + opt.text = v; opt.selected = (input_path.value == v); select_path.add(opt, null); } |