From: firefields Date: Mon, 21 Oct 2013 06:48:50 +0000 (+0800) Subject: Added new GUI with refreshing interface. X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=4a7e2a370cfc471bb80266a3b04b612a88509638;p=matches%2FMCTX3420.git Added new GUI with refreshing interface. --- diff --git a/testing/CansWebInterface/To Be Ammended/UWA_generic3.jpg b/testing/CansWebInterface/To Be Ammended/UWA_generic3.jpg new file mode 100644 index 0000000..4d45bb9 Binary files /dev/null and b/testing/CansWebInterface/To Be Ammended/UWA_generic3.jpg differ diff --git a/testing/CansWebInterface/To Be Ammended/mctx.gui2.js b/testing/CansWebInterface/To Be Ammended/mctx.gui2.js new file mode 100644 index 0000000..f779232 --- /dev/null +++ b/testing/CansWebInterface/To Be Ammended/mctx.gui2.js @@ -0,0 +1,199 @@ +/** + * MCTX3420 2013 GUI stuff. + */ + +mctx = {}; +mctx.api = location.protocol + "//" + location.host + "/api/"; +mctx.expected_api_version = 0; +mctx.key = undefined; +mctx.has_control = false; + +mctx.return_codes = { + "1" : "Ok", + "-1" : "General error", + "-2" : "Unauthorized", + "-3" : "Not running", + "-4" : "Already exists" +}; + +mctx.sensors = { + 0 : {name : "Strain gauge 1"}, + 1 : {name : "Strain gauge 2"}, + 2 : {name : "Strain gauge 3"}, + 3 : {name : "Strain gauge 4"}, + 4 : {name : "Pressure sensor 1"}, + 5 : {name : "Pressure sensor 2"} +}; + +mctx.actuators = { + 0 : {name : "Solenoid 1"}, + 1 : {name : "Solenoid 2"}, + 2 : {name : "Solenoid 3"}, + 3 : {name : "Pressure regulator"} +}; + +mctx.strain_gauges = {}; +mctx.strain_gauges.ids = [0, 1, 2, 3]; +mctx.strain_gauges.time_limit = 20; + +/** + * Writes the current date to wherever it's called. + */ +function getDate(){ + document.write((new Date()).toDateString()); +} + +/** + * Populates a submenu of the navigation bar + * @param {string} header The header + * @param {object} items An object representing the submenu items + * @param {function} translator A function that translates an object item + * into a text and href. + * @returns {$.fn} Itself + */ +$.fn.populateSubmenu = function(header, items, translator) { + var submenuHeader = $("
  • ").append($("", {text : header, href : "#"})); + var submenu = $("