diff options
Diffstat (limited to 'html_server/templates')
-rw-r--r-- | html_server/templates/base.html | 194 | ||||
-rw-r--r-- | html_server/templates/property_info.html | 91 | ||||
-rw-r--r-- | html_server/templates/register_info.html | 9 | ||||
-rw-r--r-- | html_server/templates/registers/table_cell.html | 100 | ||||
-rw-r--r-- | html_server/templates/registers/table_header.html | 10 | ||||
-rw-r--r-- | html_server/templates/registers/table_scripts.html | 42 | ||||
-rw-r--r-- | html_server/templates/registers_list.html | 12 |
7 files changed, 0 insertions, 458 deletions
diff --git a/html_server/templates/base.html b/html_server/templates/base.html deleted file mode 100644 index a2df1e9..0000000 --- a/html_server/templates/base.html +++ /dev/null @@ -1,194 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <title>{% block title %}Device {{ device }}{% endblock %}</title> - <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> - <meta http-equiv="X-UA-Compatible" content="IE=edge"/> - <link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='codebase/dhtmlx.css') }}"/> - <link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='base.css') }}"/> - <script type=text/javascript src="{{ url_for('static', filename='jquery-2.2.1.js') }}"></script> - <script src="{{ url_for('static', filename='codebase/dhtmlx.js') }}"></script> - <script src="{{ url_for('static', filename='check_err.js') }}"></script> - <script> - var propsTree - function createPropertyTree(branch, id) { - - function getPropertyItemsOnLevel(branch, id) { - var pathToProperties = "{{ url_for('process_json_command', command = 'get_property_list') }}" - var completePath = pathToProperties + '?branch=' + branch - - $.getJSON(completePath, - function(json) { - checkError(json) - parsePropertyItems(json, branch, id) - }); - } - - function parsePropertyItems(json, branch, id) { - - checkError(json) - json = json.properties - - function loadPropertyInfo(branch) { - - var pathToProperties = "{{ url_for('get_property_list') }}" - var completePath = pathToProperties + '?branch=' + branch - - $("#prop_info_place").load(completePath) - } - - - function setPropertyField(id, name, branch) { - - var func = function(){loadPropertyInfo(branch)} - propsTree.insertNewItem(id, branch, - name, - func); - propsTree.closeAllItems() - } - - for(var i = 0; i < json.length; i++) { - - setPropertyField(id, json[i].name, json[i].path) - if(json[i].flags.indexOf("childs") != -1) - getPropertyItemsOnLevel(json[i].path, json[i].path) - } - } - - getPropertyItemsOnLevel(branch, id) - } - - var regTree - function createRegistersList() { - function parseJsonRegisterList(json) { - checkError(json) - json = json.registers - - function loadRegistersList(bank) { - var pathToGetRegisterList = "{{ url_for('get_registers_list') }}" - var completePath = pathToGetRegisterList + '?bank=' + bank - - $("#reg_info_place").load(completePath) - } - - function loadRegisterInfo(bank, name) { - var pathToGetRegister = "{{ url_for('get_register_info') }}" - var completePath = pathToGetRegister + '?bank=' + bank + - '&name=' + name - - $("#reg_info_place").load(completePath) - } - - function setRegisterField(id, bank, name) { - - var itemId = bank + "_" + name - var func = function(){loadRegisterInfo(bank, name)} - - regTree.insertNewItem(id, itemId, name, func) - regTree.closeAllItems() - } - - function setbankField(bank) { - - var func = function(){loadRegistersList(bank)} - regTree.insertNewItem(0, bank, bank, func); - regTree.closeAllItems() - } - - checkError(json) - if(json.lenght <= 0) - return - - //sort registers by bank - function compareRegistersByBank(a,b) { - if (a.bank < b.bank) - return -1; - else if (a.bank > b.bank) - return 1; - else - return 0; - } - json.sort(compareRegistersByBank) - - - //create bank dirs - var curBankName = json[0].bank - var created = 0 - for(var i = 0; i < json.length; i++) { - - //create new bank tab if it has not created already - if(json[i].bank != curBankName) { - curBankName = json[i].bank - created = 0 - } - - if(!created) { - setbankField(json[i].bank ) - created = 1 - } - - - //insert register info to bank - - setRegisterField(json[i].bank, json[i].bank, json[i].name) - } - } - - //get registers json list - var getRegistersListPath = "{{ url_for('process_json_command', command = 'get_registers_list') }}" - $.getJSON(getRegistersListPath, parseJsonRegisterList); - } - - function doOnLoad() - { - propsTree = new dhtmlXTreeObject("treeboxbox_tree","100%","100%",0); - propsTree.setImagePath("{{ url_for('static', filename='codebase/imgs/dhxtree_skyblue/') }}"); - //generating properties list - createPropertyTree('', 0) - - regTree = new dhtmlXTreeObject("treeboxbox_tree2","100%","100%",0,0,0,0,'SELECT') - regTree.setImagePath("{{ url_for('static', filename='codebase/imgs/dhxtree_skyblue/') }}"); - createRegistersList() - } - </script> -</head> -<body onload="doOnLoad()"> - {% block info %} - <div class="block1" > - <h2>Device {{ device }} model={{ model }} control page </h2> - </div> - {% endblock %} - - <div class="tabs"> - <input type="radio" name="current" checked="checked" id="props_id"/> - <label for="props_id">Properties</label> - <input type="radio" name="current" id="labels_id"/> - <label for="labels_id">Registers</label> - <div> - <table> - <tr> - <td valign="top"> - <div id="treeboxbox_tree" class = "tree"></div> - </td> - <td valign="top" id="prop_info_place" /> - </tr> - </table> - </div> - <div> - <table> - <tr> - <td valign="top"> - <div id="treeboxbox_tree2" class="tree"></div> - </td> - <td valign="top" id="reg_info_place" /> - </tr> - </table> - </div> - </div> - {% block content %} - {% endblock %} - <div class="block1" > - <a href="{{ url_for('process_json_command', command='help') }}">Json API usage</a> - </div> -</body> -</html> diff --git a/html_server/templates/property_info.html b/html_server/templates/property_info.html deleted file mode 100644 index 62ea1ba..0000000 --- a/html_server/templates/property_info.html +++ /dev/null @@ -1,91 +0,0 @@ -{% block content %} - -{% if standalone %} -<script src="{{ url_for('static', filename='codebase/dhtmlx.js') }}"></script> -<script src="{{ url_for('static', filename='check_err.js') }}"></script> -{% endif %} - -<script> - function updateProperty(prop) { - var pathToGetProperty = "{{ url_for('process_json_command', command = 'get_property') }}" - var completePath = pathToGetProperty + '?prop=' + prop - - $.getJSON(completePath, function(json){ - checkError(json) - var valFieldId = "#set_val_" + prop.split('/').join("_") - $(valFieldId).val(json.value) - }) - } - - function setProperty(prop) - { - var value = document.getElementById("set_val_" + prop.split('/').join("_")).value; - if(value == "") - return - - var pathToGetProperty = "{{ url_for('process_json_command', command = 'set_property') }}" - var completePath = pathToGetProperty + '?prop=' + prop + - '&value=' + value; - - $.getJSON(completePath, - function(json) { - checkError(json) - updateProperty(prop) - }) - }; -</script> - -<table class="infoTable"> - <tr class="infoTable"> - <td class="infoTable">Name</td> - <td class="infoTable">Description</td> - <td class="infoTable">Value</td> - <td class="infoTable">Mode</td> - <td class="infoTable">Type</td> - <td class="infoTable">Unit</td> - <td class="infoTable">Path</td> - </tr> - {% for property in properties %} - <tr class="infoTable"> - <td class="infoTable">{{ property.name }}</td> - <td class="infoTable"> - {% if 'description' in property %} - {{ property.description }} - {% endif %} - </td> - <td class="infoTable"> - <table> - {% if 'R' in property.mode %} - <tr> - <td> - <input type="text" - name="set_val_{{ property.path.replace('/', '_') }}" - id="set_val_{{ property.path.replace('/', '_') }}" - value="{{ value[property.path] }}" /> - </td> - {% if 'W' in property.mode %} - <td> - <input type="button" value="set" style="width:100%;height:100%" onclick="setProperty('{{ property.path }}')"> - </td> - {% endif %} - <td> - <input type="button" value="update" style="width:100%;height:100%" onclick="updateProperty('{{ property.path }}')"> - </td> - </tr> - {% endif %} - </table> - </td> - <td class="infoTable"> - <ul> - {% for m in property.mode %} - {{ m + '; '}} - {% endfor %} - </ul> - </td> - <td class="infoTable"> {{ property.type }} </td> - <td class="infoTable"> {{ property.unit }} </td> - <td class="infoTable"> {{ property.path }} </td> - </tr> - {% endfor %} -</table> -{% endblock %} diff --git a/html_server/templates/register_info.html b/html_server/templates/register_info.html deleted file mode 100644 index 3efebd7..0000000 --- a/html_server/templates/register_info.html +++ /dev/null @@ -1,9 +0,0 @@ -{% block content %} - -{% include 'registers/table_scripts.html' %} - -<table class="infoTable"> - {% include 'registers/table_header.html' %} - {% include 'registers/table_cell.html' %} -</table> -{% endblock %} diff --git a/html_server/templates/registers/table_cell.html b/html_server/templates/registers/table_cell.html deleted file mode 100644 index d394d42..0000000 --- a/html_server/templates/registers/table_cell.html +++ /dev/null @@ -1,100 +0,0 @@ -<tr class="infoTable"> - <td class="infoTable"> {{ register.name }} </td> - {% if 'description' in register %} - <td class="infoTable"> {{ register.description }} </td> - {% else %} - <td class="infoTable"> </td> - {% endif %} - <td class="infoTable"> - <table> - {% if 'R' in register.mode %} - <tr class="infoTable"> - <td> - <input type="text" - name="set_val_box_{{ register.bank }}_{{ register.name }}" - id="set_val_box_{{ register.bank }}_{{ register.name }}" - value="{{ value[register.name] }}" /> - </td> - {% if 'W' in register.mode %} - <td> - <input type="button" value="set" - style="width:100%;height:100%" - onclick="writeRegister('{{ register.bank }}', '{{ register.name }}')"> - </td> - {% endif %} - <td> - <input type="button" value="update" - style="width:100%;height:100%" - onclick="updateRegister('{{ register.bank }}', '{{ register.name }}')"> - </td> - </tr> - {% endif %} - </table> - </td> - <td class="infoTable">{{ register.defvalue }}</td> - <td class="infoTable">{{ register.bank }}</td> - <td class="infoTable"> - <ul> - {% for m in register.mode %} - {{ m + '; '}} - {% endfor %} - </ul> - </td> - {% if 'range' in register %} - <td class="infoTable"> - <table> - <tr class="infoTable"> - <td class="infoTable"> min </td> - <td class="infoTable"> max </td> - </tr> - <tr class="infoTable"> - <td class="infoTable"> {{ register.range.min }} </td> - <td class="infoTable"> {{ register.range.max }} </td> - </tr> - </table> - </td> - {% else %} - <td class="infoTable"> </td> - {% endif %} - {% if 'values' in register %} - <td class="infoTable"> - <table> - <tr> - {% for v in register['values'] %} - <td> - <table> - {% if 'name' in v %} - <tr class="infoTable"> - <td class="infoTable"> Name </td> - <td class="infoTable"> {{v.name}} </td> - </tr> - {% endif %} - {% if 'description' in v %} - <tr class="infoTable"> - <td class="infoTable"> Description </td> - <td class="infoTable"> {{ v.description }} </td> - </tr> - {% endif %} - <tr class="infoTable"> - <td class="infoTable"> Min </td> - <td class="infoTable"> {{ v.min }} </td> - </tr> - <tr class="infoTable"> - <td class="infoTable"> Max </td> - <td class="infoTable"> {{ v.max }} </td> - </tr> - <tr class="infoTable"> - <td class="infoTable"> Value </td> - <td class="infoTable"> {{ v.value }} </td> - </tr> - </table> - </td> - {% endfor %} - </tr> - </table> - </td> - {% else %} - <td class="infoTable"> </td> - {% endif %} -</tr> - diff --git a/html_server/templates/registers/table_header.html b/html_server/templates/registers/table_header.html deleted file mode 100644 index 4c46713..0000000 --- a/html_server/templates/registers/table_header.html +++ /dev/null @@ -1,10 +0,0 @@ -<tr class="infoTable"> - <td class="infoTable"> Name </td> - <td class="infoTable"> Description </td> - <td class="infoTable"> Value </td> - <td class="infoTable">Default value</td> - <td class="infoTable">Bank</td> - <td class="infoTable">Mode</td> - <td class="infoTable">Range</td> - <td class="infoTable">Values</td> -</tr> diff --git a/html_server/templates/registers/table_scripts.html b/html_server/templates/registers/table_scripts.html deleted file mode 100644 index a772b9f..0000000 --- a/html_server/templates/registers/table_scripts.html +++ /dev/null @@ -1,42 +0,0 @@ -{% if standalone %} -<script src="{{ url_for('static', filename='codebase/dhtmlx.js') }}"></script> -<script src="{{ url_for('static', filename='check_err.js') }}"></script> -{% endif %} - -<script> - /* - $("#set_val_box").keyup(function(event){ - if(event.keyCode == 13){ - $("#set_val_button").click(); - } - }); - */ - - function updateRegister(bank, name) { - var pathToReadRegister = "{{ url_for('process_json_command', command = 'read_register') }}" - var completePath = pathToReadRegister + '?bank=' + bank + - '®=' + name - - $.getJSON(completePath, function(json){ - checkError(json) - $("#set_val_box_" + bank + "_" + name).val(json.value) - }) - } - - function writeRegister(bank, name) - { - var value = document.getElementById("set_val_box_" + bank + "_" + name).value; - if(value == "") - return - - var pathToReadRegister = "{{ url_for('process_json_command', command = 'write_register') }}" - var completePath = pathToReadRegister + '?bank=' + bank + - '®=' + name + '&value=' + value; - - $.getJSON(completePath, - function(json) { - checkError(json) - updateRegister(bank, name) - }) - }; -</script> diff --git a/html_server/templates/registers_list.html b/html_server/templates/registers_list.html deleted file mode 100644 index 26a6721..0000000 --- a/html_server/templates/registers_list.html +++ /dev/null @@ -1,12 +0,0 @@ -{% block content %} -{% include 'registers/table_scripts.html' %} - -<table class="infoTable"> -{% include 'registers/table_header.html' %} -{% for register in registers %} - {% include 'registers/table_cell.html' %} -{% endfor %} -</table> -{% endblock %} - - |