|
| 1 | +<?lua |
| 2 | + require("client_list") |
| 3 | + local client_list_array = get_client_list() |
| 4 | +?> |
| 5 | + |
| 6 | +<!doctype html> |
| 7 | +<!--[if lt IE 7]><html class="no-js lt-ie9 lt-ie8 lt-ie7 ie6" lang="en"><![endif]--> |
| 8 | +<!--[if IE 7]><html class="no-js lt-ie9 lt-ie8 ie7" lang="en"><![endif]--> |
| 9 | +<!--[if IE 8]><html class="no-js lt-ie9 ie8" lang="en"><![endif]--> |
| 10 | +<!--[if IE 9]><html class="no-js ie9" lang="en"><![endif]--> |
| 11 | +<!--[if gt IE 9]><!--><html class="no-js" lang="en"><!--<![endif]--> |
| 12 | +<head> |
| 13 | + <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> |
| 14 | + <meta charset="utf-8"> |
| 15 | + <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| 16 | + <meta http-equiv='cache-control' content='no-cache'> |
| 17 | + <meta http-equiv='expires' content='0'> |
| 18 | + <meta http-equiv='pragma' content='no-cache'> |
| 19 | + <title><%= STR_HOME_PAGE_TITLE %></title> |
| 20 | + <link href="/css/style.css" rel="stylesheet"> |
| 21 | + <link rel="shortcut icon" href="/favicon.ico"> |
| 22 | + <script>var a=document.getElementsByTagName("html")[0];a.className&&(a.className=a.className.replace(/no-js\s?/, ''));</script> |
| 23 | +</head> |
| 24 | +<body id="home"> |
| 25 | + <div id="header"> |
| 26 | + <div class="container"> |
| 27 | + <div class="c-logo c-ate-logo"></div> |
| 28 | + <div class="c-cloud-illustration"></div> |
| 29 | + </div> |
| 30 | + </div> |
| 31 | + <div class="container"> |
| 32 | + <noscript class="no-js-message"> |
| 33 | + <div> |
| 34 | + <p><%= STR_JAVASCRIPT_MSG_3 %></p> |
| 35 | + <p><%= STR_JAVASCRIPT_MSG_2 %></p> |
| 36 | + </div> |
| 37 | + </noscript> |
| 38 | + <div id="config" class="page-container"> |
| 39 | + <div id="message" class="message-container"></div> |
| 40 | + <div class="c-cloud-logo"></div> |
| 41 | + <div> |
| 42 | + <h2 class="c-title-c"><span class="c-checkbox-success"></span><%= STR_GATEWAY_NAME_PLACEHOLDER %></h2> |
| 43 | + </div> |
| 44 | + <div> |
| 45 | + <p class="c-description-c"><%= STR_GATEWAY_DESCRIPTION_PLACEHOLDER %></p> |
| 46 | + </div> |
| 47 | + <div> |
| 48 | + <h2 class="c-title">Connected Devices</h2> |
| 49 | + </div> |
| 50 | + <div class="c-devices-column-container span span-1"> |
| 51 | + <form method="post" target="message" id="form-provision-constrained"> |
| 52 | + <div class="c-devices-column span span-1-2"> |
| 53 | + <div class="c-dc-title"><%= STR_PENDING_REGISTRATION %></div> |
| 54 | + <?lua |
| 55 | + for i=1, #client_list_array do |
| 56 | + local device = client_list_array[i] |
| 57 | + local device_id = device["clientId"] |
| 58 | + local is_provisioned = device["is_device_provisioned"] |
| 59 | + if not is_provisioned then |
| 60 | + print ("<div class='c-device'>" .. |
| 61 | + "<div class='c-device-checkbox'><input class='pending_checkbox' type='checkbox' name='' value=''></div>".. |
| 62 | + "<div class='c-device-details'>" .. |
| 63 | + "<input class='form-name-input' type='hidden' value='"..device_id.."' name='' />".. |
| 64 | + "<div class='c-device-name'>"..device_id.."</div>".. |
| 65 | + "<div class='c-device-description'></div>".. |
| 66 | + "</div>".. |
| 67 | + "</div>") |
| 68 | + end |
| 69 | + end |
| 70 | + ?> |
| 71 | + <button type="submit" class="c-device-register-button c-device-form-button" disabled="disabled"><%= STR_REGISTER_DEVICE_BUTTON %></button> |
| 72 | + </div> |
| 73 | + <input type="hidden" id="config_action" name="config_action" value="register"/> |
| 74 | + </form> |
| 75 | + <form method="post" target="message" id="form-delete-constrained"> |
| 76 | + <div class="c-devices-column span span-1-2"> |
| 77 | + <div class="c-dc-title"><%= STR_REGISTERED_TO_FM2M %></div> |
| 78 | + <?lua |
| 79 | + for i=1, #client_list_array do |
| 80 | + local device = client_list_array[i] |
| 81 | + local device_id = device["clientId"] |
| 82 | + local is_provisioned = device["is_device_provisioned"] |
| 83 | + if is_provisioned then |
| 84 | + print ("<div class='c-device'>" .. |
| 85 | + "<div class='c-device-checkbox'><input class='pending_checkbox' type='checkbox' name='' value=''></div>".. |
| 86 | + "<div class='c-device-details'>" .. |
| 87 | + "<input class='form-name-input' type='hidden' value='"..device_id.."' name='' />".. |
| 88 | + "<div class='c-device-name'>"..device_id.."</div>".. |
| 89 | + "<div class='c-device-description'></div>".. |
| 90 | + "</div>".. |
| 91 | + "</div>") |
| 92 | + end |
| 93 | + end |
| 94 | + ?> |
| 95 | + <button type="submit" class="c-device-delete-button c-device-form-button" disabled="disabled"><%= STR_DELETE_DEVICE_BUTTON %></button> |
| 96 | + </div> |
| 97 | + <input type="hidden" id="config_action" name="config_action" value="delete"/> |
| 98 | + </form> |
| 99 | + </div> |
| 100 | + </div> |
| 101 | + </div> |
| 102 | + <script id="STR_INVALID_DEVICE_NAME_MSG" type="text/template"><%= STR_INVALID_DEVICE_NAME_MSG %></script> |
| 103 | + <script id="STR_INVALID_DEVICE_NAME_MSG_2" type="text/template"><%= STR_INVALID_DEVICE_NAME_MSG_2 %></script> |
| 104 | + <script id="STR_INVALID_DEVICE_REG_CODE_MSG" type="text/template"><%= STR_INVALID_DEVICE_REG_CODE_MSG %></script> |
| 105 | + <script id="STR_NONE" type="text/template"><%= STR_NONE %></script> |
| 106 | + <script src="/javascript/jquery.js"></script> |
| 107 | + <script src="/javascript/jquery.validate.min.js"></script> |
| 108 | + <script src="/javascript/client_side_script.js"></script> |
| 109 | + <script> |
| 110 | + var element = document.getElementById("message"); |
| 111 | + |
| 112 | + var msg = getCookie("message"); |
| 113 | + if (msg) { |
| 114 | + if (msg == 0) { |
| 115 | + element.innerHTML = "<%= STR_PROVISION_SUCCESS %>"; |
| 116 | + element.className += ' success'; |
| 117 | + } else if(msg == 1) { |
| 118 | + element.innerHTML = "<%= STR_PROVISION_FAIL %>"; |
| 119 | + element.className += ' error'; |
| 120 | + } else if(msg == 2) { |
| 121 | + element.innerHTML = "<%= STR_ALREADY_PROVISIONED %>"; |
| 122 | + element.className += ' error'; |
| 123 | + } else if(msg == 254) { |
| 124 | + element.innerHTML = "<%= STR_UBUS_CONNECTION_FAIL %>"; |
| 125 | + element.className += ' error'; |
| 126 | + } else if(msg == 255) { |
| 127 | + element.innerHTML = "<%= STR_UBUS_TIMEOUT %>"; |
| 128 | + element.className += ' error'; |
| 129 | + } |
| 130 | + document.cookie = 'message=null; expires=0; path=/'; |
| 131 | + } |
| 132 | + </script> |
| 133 | +</body> |
| 134 | +</html> |
0 commit comments