summaryrefslogtreecommitdiffstats
path: root/LogReceiver/html/networkdiscovery.html
diff options
context:
space:
mode:
Diffstat (limited to 'LogReceiver/html/networkdiscovery.html')
-rw-r--r--LogReceiver/html/networkdiscovery.html130
1 files changed, 121 insertions, 9 deletions
diff --git a/LogReceiver/html/networkdiscovery.html b/LogReceiver/html/networkdiscovery.html
index c24c86b..1302071 100644
--- a/LogReceiver/html/networkdiscovery.html
+++ b/LogReceiver/html/networkdiscovery.html
@@ -8,10 +8,97 @@
<script type="text/javascript" src="qrc:/html/js/nd-functions.js"></script>
<script type="text/javascript">
+
+var updateTips = function ( t ) {
+ $( ".validateTips" )
+ .text( t )
+ .addClass( "ui-state-highlight" );
+ setTimeout(
+ function() {
+ $( ".validateTips" ).removeClass( "ui-state-highlight", 1500 );
+ },
+ 500 );
+};
+
+var checkLength = function ( o, n, min, max ) {
+ if ( o.val().length > max || o.val().length < min ) {
+ o.addClass( "ui-state-error" );
+ updateTips( "Length of " + n + " must be between " +
+ min + " and " + max + "." );
+ return false;
+ } else {
+ return true;
+ }
+};
+
+var checkRegexp = function ( o, regexp, n ) {
+ if ( !( regexp.test( o.val() ) ) ) {
+ o.addClass( "ui-state-error" );
+ updateTips( n );
+ return false;
+ } else {
+ return true;
+ }
+};
+
+var ip4_manualConfigurationDialog = function () {
+ var ifname = $("#ifname"),
+ ipaddr = $("#ipaddr"),
+ netmask = $("#netmask"),
+ broadcast = $("#broadcast"),
+ gateway = $("#gateway"),
+ dns = $("#dns"),
+ allFields = $([]).add(ifname).add(ipaddr).add(netmask).add(broadcast).add(gateway).add(dns);
+
+ $("#nd_manual_configuration_dialog").dialog(
+ { buttons: { "Cancel": function() {
+ $(this).dialog("close");},
+ "Ok": function() {
+ var bValid = true;
+ allFields.removeClass("ui-state-error");
+
+ //the interface name has to be choosen out of a dropdown menue
+ //bValid = bValid && checkLength(ifname, "Interface", 2, 15);
+ bValid = bValid && checkLength(ipaddr, "IP-Address", 7, 15);
+ bValid = bValid && checkLength(netmask, "Netmask Address", 7, 15);
+ bValid = bValid && checkLength(broadcast, "Broadcast Address", 7, 15);
+ bValid = bValid && checkLength(gateway, "Gateway Address", 7, 15);
+ bValid = bValid && checkLength(dns, "DNS Address", 7, 15);
+
+ bValid = bValid && checkRegexp(ipaddr, /\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b/, "Is not a valid IP-Address! Format has to be e.g.: 192.168.1.2 (max value is 255)");
+ bValid = bValid && checkRegexp(netmask, /\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b/, "Is not a valid IP-Address! Format has to be e.g.: 255.255.255.0 (max value is 255)");
+ bValid = bValid && checkRegexp(broadcast, /\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b/, "Is not a valid IP-Address! Format has to be e.g.: 192.168.1.255 (max value is 255)");
+ bValid = bValid && checkRegexp(gateway, /\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b/, "Is not a valid IP-Address! Format has to be e.g.: 192.168.1.254 (max value is 255)");
+ bValid = bValid && checkRegexp(dns, /\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b/, "Is not a valid IP-Address! Format has to be e.g.: 192.168.1.111 (max value is 255)");
+
+ if (bValid) {
+ // put variables into a json object
+ // send to qt networkdiscovery
+ var o = {"ifname" : ifname,
+ "ipaddr" : ipaddr,
+ "netmask" : netmask,
+ "broadcast" : broadcast,
+ "gateway" : gateway,
+ "dns" : dns }
+ fbgui.ip4_setManualConfiguraton(o);
+ $(this).dialog("close");
+ } }
+ } ,
+ //autoOpen: false,
+ minWidth: 450,
+ modal: true,
+ resizable: false,
+ draggable: false,
+ close: function() {allFields.val("").removeClass("ui-state-error");},
+ open: function(event, ui) { $(".ui-dialog-titlebar-close").hide();}
+ });
+};
+
var abortBootDialog = function (m) {
$("#nd_abort_boot_msg").html(m);
$("#nd_abort_boot_dialog").dialog(
- { buttons: { "Manual Configure": function() {
+ { buttons: { "Manual Configure": function() {
+ ip4_manualConfigurationDialog();
$(this).dialog("close");},
"Show Log": function() {fbgui.showLog();
$(this).dialog("close");},
@@ -30,11 +117,13 @@ var abortBootDialog = function (m) {
var chooseInterfaceDialog = function (i) {
var cb = "<label> Choose your interface: </label>"+
- "<select>"+
- " <option>eth0</option>"+ //should look like this: " <option>"+ +"</option>"+
- " <option>eth1</option>"+
- " <option>eth2</option>"+
- "</select>";
+ "<select id='nd_ifName_select'>";
+ jQuery.each(i, function() {
+ cb += " <option>"+ this +"</option>";
+ }
+ );
+ cb += "</select>";
+
$("#nd_choose_interface_msg").html(cb);
$("#nd_choose_interface_dialog").dialog(
{ buttons: { "Show Log": function() {fbgui.showLog();
@@ -43,8 +132,11 @@ var chooseInterfaceDialog = function (i) {
$(this).dialog("close"); },
"Shut Down": function() { fbgui.shutDownSystem();
$(this).dialog("close"); },
- "Continue": function() { fbgui.continueBoot();
- $(this).dialog("close"); }
+ "Continue": function() {
+ var ifName = $("#nd_ifName_select :selected").text();
+ fbgui.continueBoot(ifName,1);
+ $(this).dialog("close");
+ }
} ,
minWidth: 550,
modal: true,
@@ -81,7 +173,6 @@ var addInterface = function (i){
);
$("#"+i+"_progress").progressbar({ value: 33 });
};
-
</script>
@@ -111,6 +202,27 @@ var addInterface = function (i){
<div id="nd_choose_interface_dialog">
<p id="nd_choose_interface_msg"></p>
</div>
+ <!-- anchor for the manual configuration dialog -->
+ <div id="nd_manual_configuration_dialog">
+ <p id="nd_manual_configuration_msg"></p>
+ <p class="validateTips">All form fields are required.</p>
+ <form>
+ <fieldset>
+ <label for="ifname">Interface</label>
+ <input type="text" name="ifname" id="ifname" class="text ui-widget-content ui-corner-all"/>
+ <label for="ipaddr">IP-Address</label>
+ <input type="text" name="ipaddr" id="ipaddr" class="text ui-widget-content ui-corner-all"/>
+ <label for="netmask">Netmask</label>
+ <input type="text" name="netmask" id="netmask" class="text ui-widget-content ui-corner-all"/>
+ <label for="broadcast">Broadcast Address</label>
+ <input type="text" name="broadcast" id="broadcast" class="text ui-widget-content ui-corner-all"/>
+ <label for="gateway">Gateway Address</label>
+ <input type="text" name="gateway" id="gateway" class="text ui-widget-content ui-corner-all"/>
+ <label for="dns">DNS</label>
+ <input type="text" name="dns" id="dns" class="text ui-widget-content ui-corner-all"/>
+ </fieldset>
+ </form>
+ </div>
<!-- anchor for qt interface progress foo -->
<div id="nd_progress_container"></div>
</section>