1 | <html>
|
2 |
|
3 |
|
4 | <link rel="stylesheet" type="text/css" href="../../lib/css/themes/jquery-ui/redmond/jquery-ui.min.css"/>
|
5 | <script type="text/javascript" src="../../lib/js/jquery-1.11.1.min.js"></script>
|
6 | <script type="text/javascript" src="../../socket.io/socket.io.js"></script>
|
7 | <script type="text/javascript" src="../../lib/js/jquery-ui-1.10.3.full.min.js"></script>
|
8 |
|
9 |
|
10 | <link rel="stylesheet" type="text/css" href="../../css/adapter.css"/>
|
11 | <script type="text/javascript" src="../../js/translate.js"></script>
|
12 | <script type="text/javascript" src="../../js/adapter-settings.js"></script>
|
13 |
|
14 | <style>
|
15 | .table_header {
|
16 | background-color: blue;
|
17 | color: white;
|
18 | }
|
19 | .ip {
|
20 | width: 150px;
|
21 | text-align: right;
|
22 | }
|
23 | </style>
|
24 |
|
25 | <script type="text/javascript">
|
26 | var devices = [];
|
27 |
|
28 | systemDictionary = {
|
29 | "node-red settings": {
|
30 | "en": "node-red settings",
|
31 | "de": "node-red Einstellungen",
|
32 | "ru": "node-red Настройки"
|
33 | },
|
34 | "Web server port:": {
|
35 | "en": "Web server port:",
|
36 | "de": "Web-Server-Port:",
|
37 | "ru": "Порт веб сервера:"
|
38 | },
|
39 | "node-red update select dialog": {
|
40 | "en": "node-red update select dialog",
|
41 | "de": "node-red SelectID Dialog aktualisieren",
|
42 | "ru": "Обновить переменные в диалоге node-red"
|
43 | },
|
44 | "Update select dialog": {
|
45 | "en": "Update select dialog",
|
46 | "de": "Update Dialog um ID zu selektieren",
|
47 | "ru": "Обновить переменные в диалоге выбора объектов"
|
48 | },
|
49 | "Divided by comma": {
|
50 | "en": "Divided by comma",
|
51 | "de": "Getrennt mit Komma",
|
52 | "ru": "Через запятую"
|
53 | },
|
54 | "Additional npm modules:": {
|
55 | "en": "Additional npm modules:",
|
56 | "de": "Zusätzliche NPM-Module",
|
57 | "ru": "Дополнительные NPM Модули:"
|
58 | },
|
59 | "http root directory:": {
|
60 | "en": "http root directory:",
|
61 | "de": "http Stammpfad:",
|
62 | "ru": "http root directory:"
|
63 | },
|
64 | "Convert values to string:":{
|
65 | "en": "Convert ioBroker values to string:",
|
66 | "de": "ioBroker-Werte in String konvertieren:",
|
67 | "ru": "Конвертировать значения из ioBroker в строки:"
|
68 | }
|
69 | };
|
70 |
|
71 | function setValue(id, value, onChange) {
|
72 |
|
73 | if ($('#' + id + '.value').attr('type') == 'checkbox') {
|
74 | $('#' + id + '.value').prop('checked', value).change(function() {
|
75 | onChange();
|
76 | });
|
77 | } else {
|
78 | $('#' + id + '.value').val(value).change(function() {
|
79 | onChange();
|
80 | }).keyup(function() {
|
81 |
|
82 | if ($(this).hasClass('number')) {
|
83 | var val = $(this).val();
|
84 | if (val) {
|
85 | var newVal = '';
|
86 | for (var i = 0; i < val.length; i++) {
|
87 | if (val[i] >= '0' && val[i] <= '9') {
|
88 | newVal += val[i];
|
89 | }
|
90 | }
|
91 |
|
92 | if (val != newVal) $(this).val(newVal);
|
93 | }
|
94 | }
|
95 |
|
96 | onChange();
|
97 | });
|
98 | }
|
99 | }
|
100 |
|
101 |
|
102 | function load(settings, onChange) {
|
103 | if (!settings) return;
|
104 |
|
105 | devices = settings.devices || [];
|
106 |
|
107 | for (var key in settings) {
|
108 | setValue(key, settings[key], onChange);
|
109 | }
|
110 | $('#update').button().click(function () {
|
111 | sendTo(null, 'update', null, function (error) {
|
112 | if (!error) {
|
113 | showMessage(_('Successfully updated'))
|
114 | } else {
|
115 | showMessage(_('Cannot update:') + _(error))
|
116 | }
|
117 | });
|
118 | });
|
119 |
|
120 | if (common.npmLibs){
|
121 | $('#libraries').val(common.npmLibs.join(', '));
|
122 | }
|
123 |
|
124 | $('#libraries').change(function () {
|
125 | onChange();
|
126 | }).keyup(function () {
|
127 | $(this).trigger('change');
|
128 | });
|
129 |
|
130 | getIsAdapterAlive(function (isAlive) {
|
131 | if (!isAlive) $('#update').button("disable");
|
132 | });
|
133 | onChange(false);
|
134 | }
|
135 |
|
136 |
|
137 |
|
138 | function save(callback) {
|
139 |
|
140 | var obj = {};
|
141 | $('.value').each(function () {
|
142 | var $this = $(this);
|
143 | if ($this.attr('type') == 'checkbox') {
|
144 | obj[$this.attr('id')] = $this.prop('checked');
|
145 | } else {
|
146 | obj[$this.attr('id')] = $this.val();
|
147 | }
|
148 | });
|
149 |
|
150 | var libs = $('#libraries').val().split(',');
|
151 | var common = {npmLibs: []};
|
152 | for (var l = 0; l < libs.length; l++) {
|
153 | common.npmLibs.push(libs[l].trim());
|
154 | }
|
155 |
|
156 | callback(obj, {localLink: 'http://%ip%:' + obj.port, npmLibs: common.npmLibs});
|
157 | }
|
158 | </script>
|
159 |
|
160 |
|
161 | <div id="adapter-container">
|
162 |
|
163 | <table><tr>
|
164 | <td><img src="node-red.png" width="64" height="64"></td>
|
165 | <td style="padding-top: 20px;padding-left: 10px"><h3 class="translate">node-red adapter settings</h3></td>
|
166 | </tr></table>
|
167 |
|
168 | <h4 class="translate">node-red settings</h4>
|
169 | <table>
|
170 | <tr><td class="translate">Web server port:</td><td colspan="2"><input class="value number" id="port" type="input" size="5"/></td></tr>
|
171 | <tr>
|
172 | <td class="translate">Additional npm modules:</td><td><input id="libraries" class="value" style="width: 100%"/></td><td class="translate">Divided by comma</td>
|
173 | </tr>
|
174 | <tr>
|
175 | <td class="translate">http root directory:</td><td><input id="httpRoot" class="value" style="width: 100%"/></td>
|
176 | </tr>
|
177 | <tr>
|
178 | <td class="translate">Convert values to string:</td><td> <input class="value" id="valueConvert" type="checkbox" /></td>
|
179 | </tr>
|
180 | </table>
|
181 | <h4 class="translate">node-red update select dialog</h4>
|
182 | <button id="update" class="translateB">Update select dialog</button>
|
183 |
|
184 | </div>
|
185 | </html>
|