* Updated the jquery to read in translated strings and to display the link speed.

Signed-off-by: Digimer <digimer@alteeve.ca>
main
Digimer 8 years ago
parent 8c42b78e63
commit a8a98b431d
  1. 4
      cgi-bin/words.xml
  2. 5
      html/skins/alteeve/main.html
  3. 7
      html/skins/alteeve/main.js
  4. 2
      tools/scancore-update-states

@ -25,6 +25,10 @@ This is the AN::Tools master 'words' file.
<key name="header_0004">Link State</key> <key name="header_0004">Link State</key>
<key name="header_0005">Link Speed (Mbps)</key> <key name="header_0005">Link Speed (Mbps)</key>
<!-- These are works and strings used by javascript/jqery -->
<key name="js_0001">Up</key>
<key name="js_0002">Down</key>
<key name="js_0003">Mbps</key>
</language> </language>
<!-- 日本語 --> <!-- 日本語 -->

@ -71,7 +71,10 @@
<!-- end master --> <!-- end master -->
<!-- start network_footer --> <!-- start network_footer -->
<input type="hidden" name="interface_list" id="interface_list" value="#!variable!interface_list!#"> <input type="hidden" name="interface_list" id="interface_list" value="#!variable!interface_list!#" />
<div id="say_up">#!string!js_0001!#</div>
<div id="say_down">#!string!js_0002!#</div>
<div id="say_speed_suffix">#!string!js_0003!#</div>
</table> </table>
<!-- end network_footer --> <!-- end network_footer -->

@ -1,6 +1,8 @@
$(function() { $(function() {
var say_up = "Up"; var say_up = $("#say_up").text();
var say_down = "Down"; var say_down = $("#say_down").text();
var say_speed_suffix = $("#say_speed_suffix").text();
console.log('say_up: ['+say_up+'], say_down: ['+say_down+'], say_speed_suffix: ['+say_speed_suffix+']');
if($("#network_status").length) { if($("#network_status").length) {
//alert('network status exists.'); //alert('network status exists.');
$.getJSON('/status/network.json', { get_param: 'value' }, function(data) { $.getJSON('/status/network.json', { get_param: 'value' }, function(data) {
@ -12,6 +14,7 @@ $(function() {
} }
$("#"+element.name+"_mac").text(element.mac); $("#"+element.name+"_mac").text(element.mac);
$("#"+element.name+"_link").text(link); $("#"+element.name+"_link").text(link);
$("#"+element.name+"_speed").text(element.speed+' '+say_speed_suffix);
}); });
}); });
} }

@ -84,7 +84,7 @@ sub report_network
### TODO: Set the 'status/network.xml' and 'status/network.json' names into 'striker.conf' ### TODO: Set the 'status/network.xml' and 'status/network.json' names into 'striker.conf'
# Write the JSON file. # Write the JSON file.
my $output_json = $an->data->{path}{directories}{html}."/status/network.json"; my $output_json = $an->data->{path}{directories}{html}."/status/network.json";
$an->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { output_xml => $output_json }}); $an->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { output_xml => $output_json }});
$an->Storage->write_file({ $an->Storage->write_file({
file => $output_json, file => $output_json,
body => $network_json, body => $network_json,

Loading…
Cancel
Save