1
1
<!DOCTYPE html>
2
2
<html lang="en">
3
+ <?php
4
+ require_once "common.php " ;
5
+ ?>
3
6
4
7
<head>
5
- <?php
6
- include 'common/htmlMeta.inc ' ;
7
- require_once "common.php " ;
8
- include 'common/menuHead.inc ' ; ?>
9
-
8
+ <?php include 'common/menuHead.inc ' ; ?>
10
9
<script language="Javascript">
11
10
12
11
function outputOption(val, def) {
@@ -19,7 +18,7 @@ function outputOption(val, def) {
19
18
return html;
20
19
}
21
20
22
- function HTMLForOutputProcessorConfig(output) {
21
+ function HTMLForOutputProcessorConfig(output, models ) {
23
22
var html = "";
24
23
var type = output.type;
25
24
@@ -43,6 +42,15 @@ function HTMLForOutputProcessorConfig(output) {
43
42
html += ">RGBW Pixels</option>";
44
43
html += "</select>";
45
44
} else if (type == "Brightness") {
45
+ html += "Model: <select class='model'>";
46
+ models.forEach(function(model) {
47
+ html += "<option value='" + model + "'";
48
+ if (output.model === model) {
49
+ html += " selected";
50
+ }
51
+ html += ">" + model + "</option>";
52
+ });
53
+ html += "</select> ";
46
54
html += "Start Channel: <input class='start' type=text size='7' maxlength='7' value='" + output.start + "'/> "
47
55
+ "Channel Count: <input class='count' type=text size='7' maxlength='7' value='" + output.count + "'/> "
48
56
+ "Brightness: <input class='brightness' type=number value='" + output.brightness + "' min='0' max='100'/>"
@@ -100,7 +108,7 @@ function HTMLForOutputProcessorConfig(output) {
100
108
return html;
101
109
}
102
110
103
- function PopulateOutputProcessorTable(data) {
111
+ function PopulateOutputProcessorTable(data, models ) {
104
112
$('#outputProcessors tbody').html("");
105
113
106
114
for (var i = 0; i < data.outputProcessors.length; i++) {
@@ -119,16 +127,16 @@ function PopulateOutputProcessorTable(data) {
119
127
+ "<td>" + type + "</td>"
120
128
+ "<td><input class='description' type='text' size='32' maxlength='64' value='" + output.description + "'></td><td>";
121
129
122
- html += HTMLForOutputProcessorConfig(output);
130
+ html += HTMLForOutputProcessorConfig(output, models );
123
131
html += "</td></tr>";
124
132
125
133
$('#outputProcessors tbody').append(html);
126
134
}
127
135
}
128
136
129
- function GetOutputProcessors() {
137
+ function GetOutputProcessors(models ) {
130
138
$.getJSON("api/channel/output/processors", function (data) {
131
- PopulateOutputProcessorTable(data);
139
+ PopulateOutputProcessorTable(data, models );
132
140
}).fail(function () {
133
141
DialogError("Error", "Failed to load Output Processors");
134
142
});
@@ -178,6 +186,7 @@ function SetOutputProcessors() {
178
186
type: "Brightness",
179
187
active: $this.find("input.active").is(':checked') ? 1 : 0,
180
188
description: $this.find("input.description").val(),
189
+ model: $this.find("select.model").val(),
181
190
start: parseInt($this.find("input.start").val()),
182
191
count: parseInt($this.find("input.count").val()),
183
192
brightness: parseInt($this.find("input.brightness").val()),
@@ -188,7 +197,7 @@ function SetOutputProcessors() {
188
197
processors.push(b);
189
198
} else {
190
199
dataError = 1;
191
- alert("Brightness settings of row " + rowNumber + " is not valid.");
200
+ alert("Settings of row " + rowNumber + " is not valid.");
192
201
return;
193
202
}
194
203
} else if (type == "Set Value") {
@@ -205,7 +214,7 @@ function SetOutputProcessors() {
205
214
processors.push(b);
206
215
} else {
207
216
dataError = 1;
208
- alert("Set Value settings of row " + rowNumber + " is not valid.");
217
+ alert("Settings of row " + rowNumber + " is not valid.");
209
218
return;
210
219
}
211
220
} else if (type == "Hold Value") {
@@ -221,7 +230,7 @@ function SetOutputProcessors() {
221
230
processors.push(b);
222
231
} else {
223
232
dataError = 1;
224
- alert("Hold Value settings of row " + rowNumber + " is not valid.");
233
+ alert("Settings of row " + rowNumber + " is not valid.");
225
234
return;
226
235
}
227
236
} else if (type == "Reorder Colors") {
@@ -238,7 +247,7 @@ function SetOutputProcessors() {
238
247
processors.push(b);
239
248
} else {
240
249
dataError = 1;
241
- alert("Color Order settings of row " + rowNumber + " is not valid.");
250
+ alert("Settings of row " + rowNumber + " is not valid.");
242
251
return;
243
252
}
244
253
} else if (type == "Three to Four") {
@@ -256,7 +265,7 @@ function SetOutputProcessors() {
256
265
processors.push(b);
257
266
} else {
258
267
dataError = 1;
259
- alert("Three to Four settings of row " + rowNumber + " is not valid.");
268
+ alert("Settings of row " + rowNumber + " is not valid.");
260
269
return;
261
270
}
262
271
@@ -274,7 +283,7 @@ function SetOutputProcessors() {
274
283
processors.push(b);
275
284
} else {
276
285
dataError = 1;
277
- alert("Override Zero settings of row " + rowNumber + " is not valid.");
286
+ alert("Settings of row " + rowNumber + " is not valid.");
278
287
return;
279
288
}
280
289
} else if (type == "Fold") {
@@ -310,9 +319,9 @@ function SetOutputProcessors() {
310
319
}
311
320
).done(function (data) {
312
321
$.jGrowl("Output Processors Table saved", { themeState: 'success' });
313
- PopulateOutputProcessorTable(data);
314
322
SetRestartFlag(2);
315
323
common_ViewPortChange();
324
+ PopulateOutputProcessorTable(data,models);
316
325
}).fail(function () {
317
326
DialogError("Save Output Processors Table", "Save Failed");
318
327
});
@@ -330,7 +339,7 @@ function AddOtherTypeOptions(row, type) {
330
339
loops: 1,
331
340
reverse: 0
332
341
};
333
- config += HTMLForOutputProcessorConfig(b);
342
+ config += HTMLForOutputProcessorConfig(b, models );
334
343
} else if (type == "Brightness") {
335
344
var b = {
336
345
type: "Brightness",
@@ -339,30 +348,30 @@ function AddOtherTypeOptions(row, type) {
339
348
brightness: 100,
340
349
gamma: 1.0
341
350
};
342
- config += HTMLForOutputProcessorConfig(b);
351
+ config += HTMLForOutputProcessorConfig(b, models );
343
352
} else if (type == "Set Value") {
344
353
var b = {
345
354
type: "Set Value",
346
355
start: 1,
347
356
count: 1,
348
357
value: 255
349
358
};
350
- config += HTMLForOutputProcessorConfig(b);
359
+ config += HTMLForOutputProcessorConfig(b, models );
351
360
} else if (type == "Hold Value") {
352
361
var b = {
353
362
type: "Hold Value",
354
363
start: 1,
355
364
count: 1,
356
365
};
357
- config += HTMLForOutputProcessorConfig(b);
366
+ config += HTMLForOutputProcessorConfig(b, models );
358
367
} else if (type == "Reorder Colors") {
359
368
var b = {
360
369
type: "Reorder Colors",
361
370
start: 1,
362
371
count: 1,
363
372
colorOrder: 132
364
373
};
365
- config += HTMLForOutputProcessorConfig(b);
374
+ config += HTMLForOutputProcessorConfig(b, models );
366
375
} else if (type == "Three to Four") {
367
376
var b = {
368
377
type: "Three to Four",
@@ -371,7 +380,7 @@ function AddOtherTypeOptions(row, type) {
371
380
colorOrder: 1234,
372
381
algorithm: 1
373
382
};
374
- config += HTMLForOutputProcessorConfig(b);
383
+ config += HTMLForOutputProcessorConfig(b, models );
375
384
}
376
385
else if (type == "Override Zero") {
377
386
var b = {
@@ -380,15 +389,15 @@ function AddOtherTypeOptions(row, type) {
380
389
count: 1,
381
390
value: 255
382
391
};
383
- config += HTMLForOutputProcessorConfig(b);
392
+ config += HTMLForOutputProcessorConfig(b, models );
384
393
} else if (type == "Fold") {
385
394
var b = {
386
395
type: "Fold",
387
396
source: 1,
388
397
count: 1,
389
398
node: 0
390
399
};
391
- config += HTMLForOutputProcessorConfig(b);
400
+ config += HTMLForOutputProcessorConfig(b, models );
392
401
}
393
402
394
403
@@ -450,8 +459,20 @@ function DeleteSelectedProcessor() {
450
459
}
451
460
452
461
$(document).ready(function () {
462
+ $.ajax({
463
+ url: "api/models?simple=true",
464
+ method: "GET",
465
+ dataType: "json",
466
+ success: function(models) {
467
+ models.unshift("<Use Start Channel>");
453
468
SetupSelectableTableRow(tableInfo);
454
- GetOutputProcessors();
469
+ GetOutputProcessors(models);
470
+ },
471
+ error: function() {
472
+ console.error("Error fetching models");
473
+ }
474
+ });
475
+
455
476
456
477
if (window.innerWidth > 600) {
457
478
$('#outputProcessorsBody').sortable({
@@ -539,4 +560,4 @@ class='buttons btn-success ml-1'>
539
560
</div>
540
561
</body>
541
562
542
- </html>
563
+ </html>
0 commit comments