summaryrefslogtreecommitdiffstats
path: root/NetworkDiscovery/html/networkdiscovery.html
diff options
context:
space:
mode:
Diffstat (limited to 'NetworkDiscovery/html/networkdiscovery.html')
-rw-r--r--NetworkDiscovery/html/networkdiscovery.html276
1 files changed, 276 insertions, 0 deletions
diff --git a/NetworkDiscovery/html/networkdiscovery.html b/NetworkDiscovery/html/networkdiscovery.html
new file mode 100644
index 0000000..6d370d1
--- /dev/null
+++ b/NetworkDiscovery/html/networkdiscovery.html
@@ -0,0 +1,276 @@
+<html>
+<head>
+<!--qrc:/html/ is needed. otherwise qt won't find the files-->
+<link rel="stylesheet" type="text/css" href="qrc:/html/networkdiscovery.css">
+<link rel="stylesheet" type="text/css" href="qrc:/html/css/jquery-ui-1.8.16.css">
+<script type="text/javascript" src="qrc:/html/js/jquery-1.6.4.min.js"></script>
+<script type="text/javascript" src="qrc:/html/js/jquery-ui-1.8.16.min.js"></script>
+<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 showLog = function (t) {
+ $("#nd_show_log_msg").val(t);
+ $("#nd_show_log_msg").attr('readonly','readonly');
+ $("#nd_show_log_dialog").dialog(
+ { minWidth: 450,
+ modal: true,
+ resizable: false,
+ draggable: false
+ });
+};
+
+var ip4_manualConfigurationDialog = function () {
+ var jsonArr = fbgui.getManualConfInterfaces();
+ //jsonArr = eval('(' + jsonArr + ')');
+ var c = "<select name='nd_mc_ifname_select' id='nd_mc_ifname_select'>";
+ if(jsonArr == "") {
+ c += "<option>NO INTERFACE</option>";
+ } else {
+ jQuery.each(jsonArr, function() {
+ c += " <option>"+ this +"</option>";
+ }
+ );
+ }
+ c += "</select>";
+ $("#nd_mc_ifname").html(c);
+
+ var ifname = $("#nd_mc_ifname_select :selected").text(),
+ ipaddr = $("#ipaddr"),
+ netmask = $("#netmask"),
+ broadcast = $("#broadcast"),
+ gateway = $("#gateway"),
+ dns = $("#dns"),
+ allFields = $([]).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");
+
+ 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.val(),
+ "netmask" : netmask.val(),
+ "broadcast" : broadcast.val(),
+ "gateway" : gateway.val(),
+ "dns" : dns.val() }
+ try {
+ fbgui.ip4_setManualConfiguration(o);
+ } catch (e) {
+ fbgui.notifyCall(e);
+ }
+ $(this).dialog("close");
+ } }
+ } ,
+ 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) {
+ fbgui.notifyCall("abortBootDialog");
+ $("#nd_abort_boot_msg").html(m);
+ $("#nd_abort_boot_dialog").dialog(
+ { buttons: { "Manual Configure": function() {
+ ip4_manualConfigurationDialog();},
+ "Show Log": function() {
+ var text = fbgui.readLogFile();
+ showLog(text);
+ $(this).dialog("close");},
+ "Restart": function() {fbgui.restartSystem();
+ $(this).dialog("close"); },
+ "Shut Down": function() { fbgui.shutDownSystem();
+ $(this).dialog("close"); }
+ } ,
+ minWidth: 450,
+ modal: true,
+ resizable: false,
+ draggable: false,
+ open: function(event, ui) { $(".ui-dialog-titlebar-close").hide();}
+ });
+};
+
+var chooseInterfaceDialog = function (i) {
+ var cb = "<label> Choose your interface: </label>"+
+ "<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: { "Manual Configure": function() {
+ ip4_manualConfigurationDialog();},
+ "Show Log": function() {
+ var text = fbgui.readLogFile();
+ showLog(text);},
+ "Restart": function() {fbgui.restartSystem();
+ $(this).dialog("close"); },
+ "Shut Down": function() { fbgui.shutDownSystem();
+ $(this).dialog("close"); },
+ "Continue": function() {
+ var ifName = $("#nd_ifName_select :selected").text();
+ fbgui.continueBoot(ifName,1);
+ $(this).dialog("close");
+ }
+ } ,
+ minWidth: 550,
+ modal: true,
+ resizable: false,
+ draggable: false,
+ open: function(event, ui) { $(".ui-dialog-titlebar-close").hide();}
+ });
+}
+
+var updateStatus = function (s){
+
+};
+
+var updateIfProgressBar = function (i, p){
+ if (p >= 0 && p <= 100){
+ $("#"+i+"_progress").progressbar({ value: p });
+ }else{
+ $("#"+i+"_progress").progressbar({ value: 0 });
+ }
+};
+
+var updateIfStatus = function(i, s){
+ $("#"+i+"_status").html(s);
+};
+
+var addInterface = function (i){
+ $("#nd_progress_container").append(
+ "<div class='interface'>"+
+ " Interface: " +i+
+ " <span id='"+i+"_status'>Start DHCP </span>" +
+ " <div id='"+i+"_progress' class='progressbar' "+
+ " style='height: 10px;'></div>"+
+ "</div>"
+ );
+ $("#"+i+"_progress").progressbar({ value: 33 });
+};
+
+ </script>
+
+</head>
+<body>
+ <header>
+ <h1>Network Discovery</h1>
+ </header>
+ <section id="intro">
+ <p>Welcome to the Network Discovery. We are now looking for usable interfaces and will go on as soon as we found one. This may take a few seconds.</p>
+ </section>
+ <div id="content">
+ <div id="left_spacer">
+ <aside>
+ <!-- free space -->
+ </aside>
+ </div>
+ <div id="mainContent">
+ <section>
+ <!-- Main content area -->
+ <p>test</p>
+ <!-- anchor for the show log dialog -->
+ <div id="nd_show_log_dialog" title="Log File">
+ <textarea id="nd_show_log_msg"></textarea>
+ </div>
+ <!-- anchor for the abort boot dialog -->
+ <div id="nd_abort_boot_dialog" title="Abort Boot">
+ <p id="nd_abort_boot_msg"> <p>
+ </div>
+ <!-- anchor for the choose interface dialog -->
+ <div id="nd_choose_interface_dialog" title="Choose your Interface">
+ <p id="nd_choose_interface_msg"></p>
+ </div>
+ <!-- anchor for the manual configuration dialog -->
+ <div id="nd_manual_configuration_dialog" title="Manual Configuration">
+ <p id="nd_manual_configuration_msg"></p>
+ <p class="validateTips">All form fields are required.</p>
+ <form>
+ <fieldset>
+ <label for="nd_mc_ifname">Interface</label>
+ <span id="nd_mc_ifname"></span>
+ <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>
+ </div>
+ <div id="right_spacer">
+ <aside>
+ <!-- free space -->
+ </aside>
+ </div>
+ </div>
+ <footer>
+ <p>RZ Uni Freiburg, 2011</p>
+ </footer>
+</body>
+</html>