* upd

* upd

* typo

* update ieff

* typo

* ..

* try

* ..

* rm enum

* .

* .

* split initialeff

* upd schema

* ..

* upd

* .

* .

* .

* update

* update
This commit is contained in:
brindosch
2017-01-04 10:55:10 +01:00
committed by redPanther
parent 2906ec041a
commit c433504b81
37 changed files with 884 additions and 257 deletions

View File

@@ -1,17 +1,114 @@
var conf_editor = null;
var olddEffects = [];
var editorReady = false;
var effects_editor = null;
var confFgEff = parsedConfJSON.foregroundEffect.effect;
var confBgEff = parsedConfJSON.backgroundEffect.effect;
var foregroundEffect_editor = null;
var backgroundEffect_editor = null;
$(hyperion).one("cmd-config-getschema", function(event) {
schema = parsedConfSchemaJSON.properties;
conf_editor = createJsonEditor('editor_container', {
effects : schema.effects,
initialEffect : schema.initialEffect
}, true);
effects_editor = createJsonEditor('editor_container_effects', {
effects : schema.effects
}, true, true);
$('#btn_submit').off().on('click',function() {
requestWriteConfig(conf_editor.getValue());
foregroundEffect_editor = createJsonEditor('editor_container_foregroundEffect', {
foregroundEffect : schema.foregroundEffect
}, true, true);
backgroundEffect_editor = createJsonEditor('editor_container_backgroundEffect', {
backgroundEffect : schema.backgroundEffect
}, true, true);
effects_editor.on('ready',function() {
editorReady = true;
});
foregroundEffect_editor.on('change',function() {
var type = foregroundEffect_editor.getEditor('root.foregroundEffect.type');
if(type.value == "color")
{
foregroundEffect_editor.getEditor('root.foregroundEffect.effect').disable();
foregroundEffect_editor.getEditor('root.foregroundEffect.color').enable();
}
else
{
foregroundEffect_editor.getEditor('root.foregroundEffect.effect').enable();
foregroundEffect_editor.getEditor('root.foregroundEffect.color').disable();
}
});
backgroundEffect_editor.on('change',function() {
var type = backgroundEffect_editor.getEditor('root.backgroundEffect.type');
if(type.value == "color")
{
backgroundEffect_editor.getEditor('root.backgroundEffect.effect').disable();
backgroundEffect_editor.getEditor('root.backgroundEffect.color').enable();
}
else
{
backgroundEffect_editor.getEditor('root.backgroundEffect.effect').enable();
backgroundEffect_editor.getEditor('root.backgroundEffect.color').disable();
}
});
$('#btn_submit_effects').off().on('click',function() {
requestWriteConfig(effects_editor.getValue());
});
$('#btn_submit_foregroundEffect').off().on('click',function() {
//requestWriteConfig(foregroundEffect_editor.getValue());
console.log(foregroundEffect_editor.getValue());
});
$('#btn_submit_backgroundEffect').off().on('click',function() {
//requestWriteConfig(backgroundEffect_editor.getValue());
console.log(backgroundEffect_editor.getValue());
});
if(showOptHelp)
{
$('#opt_expl_effects').html(createHelpTable(schema.effects.properties, '<i class="fa fa-info-circle fa-fw"></i>'+$.i18n("edt_conf_effp_heading_title")+' '+$.i18n("conf_helptable_expl")));
$('#opt_expl_foregroundEffect').html(createHelpTable(schema.foregroundEffect.properties, '<i class="fa fa-info-circle fa-fw"></i>'+$.i18n("edt_conf_fge_heading_title")+' '+$.i18n("conf_helptable_expl")));
$('#opt_expl_backgroundEffect').html(createHelpTable(schema.backgroundEffect.properties, '<i class="fa fa-info-circle fa-fw"></i>'+$.i18n("edt_conf_bge_heading_title")+' '+$.i18n("conf_helptable_expl")));
}
});
function updateEffectlist(event){
if(editorReady)
{
var newEffects = event.response.info.effects;
if (newEffects.length != olddEffects.length)
{
$('#root_foregroundEffect_effect').html('');
var usrEffArr = [];
var sysEffArr = [];
for(i = 0; i < newEffects.length; i++)
{
var effectName = newEffects[i].name;
if(!/^\:/.test(newEffects[i].file))
usrEffArr.push(effectName);
else
sysEffArr.push(effectName);
}
$('#root_foregroundEffect_effect').append(createSel(usrEffArr, $.i18n('remote_optgroup_usreffets')));
$('#root_foregroundEffect_effect').append(createSel(sysEffArr, $.i18n('remote_optgroup_syseffets')));
$('#root_backgroundEffect_effect').html($('#root_foregroundEffect_effect').html());
olddEffects = newEffects;
$('#root_foregroundEffect_effect').val(confFgEff);
$('#root_foregroundEffect_effect').trigger('change');
$('#root_backgroundEffect_effect').val(confBgEff);
$('#root_backgroundEffect_effect').trigger('change');
}
}
}
$(document).ready( function() {
performTranslation();
requestServerConfigSchema();
$(hyperion).on("cmd-serverinfo",updateEffectlist);
});

View File

@@ -4,13 +4,14 @@ $(hyperion).one("cmd-config-getschema", function(event) {
schema = parsedConfSchemaJSON.properties;
conf_editor = createJsonEditor('editor_container', {
general: schema.general
}, true);
$('#editor_container h3').remove();
}, true, true);
$('#btn_submit').off().on('click',function() {
requestWriteConfig(conf_editor.getValue());
});
if(showOptHelp)
$('#opt_expl').html(createHelpTable(schema.general.properties, '<i class="fa fa-info-circle fa-fw"></i>'+$.i18n("edt_conf_gen_heading_title")+' '+$.i18n("conf_helptable_expl")));
});

View File

@@ -19,8 +19,11 @@ $(hyperion).one("cmd-config-getschema", function(event) {
requestWriteConfig(conf_editor_v4l2.getValue());
});
$('#opt_expl_fg').html(createHelpTable(schema.framegrabber.properties, '<i class="fa fa-camera fa-fw"></i>'+$.i18n("edt_conf_fg_heading_title")));
$('#opt_expl_v4l2').html(createHelpTable(schema.grabberV4L2.items.properties, '<i class="fa fa-camera fa-fw"></i>'+$.i18n("edt_conf_v4l2_heading_title")));
if(showOptHelp)
{
$('#opt_expl_fg').html(createHelpTable(schema.framegrabber.properties, '<i class="fa fa-info-circle fa-fw"></i>'+$.i18n("edt_conf_fg_heading_title")+' '+$.i18n("conf_helptable_expl")));
$('#opt_expl_v4l2').html(createHelpTable(schema.grabberV4L2.items.properties, '<i class="fa fa-info-circle fa-fw"></i>'+$.i18n("edt_conf_v4l2_heading_title")+' '+$.i18n("conf_helptable_expl")));
}
});

View File

@@ -2,7 +2,6 @@ $(document).ready( function() {
var uiLock = false;
$("#main-nav").hide();
$("#loading_overlay").addClass("overlay");
loadContentTo("#container_connection_lost","connection_lost");
initWebSocket();
bindNavToContent("#load_dashboard","dashboard",true);
@@ -22,6 +21,7 @@ $(document).ready( function() {
bindNavToContent("#load_webconfig","webconfig",false);
$(hyperion).on("cmd-serverinfo",function(event){
showOptHelp = parsedConfJSON.general.showOptHelp;
parsedServerInfoJSON = event.response;
currentVersion = parsedServerInfoJSON.info.hyperion[0].version;
cleanCurrentVersion = currentVersion.replace(/\./g, '');

View File

@@ -10,7 +10,8 @@ $(hyperion).one("cmd-config-getschema", function(event) {
requestWriteConfig(conf_editor.getValue());
});
$('#opt_expl').html(createHelpTable(schema.kodiVideoChecker.properties, '<i class="fa fa-play-circle-o fa-fw"></i>'+$.i18n("conf_kodi_label_title")));
if(showOptHelp)
$('#opt_expl').html(createHelpTable(schema.kodiVideoChecker.properties, '<i class="fa fa-info-circle fa-fw"></i>'+$.i18n("conf_kodi_label_title")+' '+$.i18n("conf_helptable_expl")));
});

View File

@@ -49,11 +49,14 @@ $(hyperion).one("cmd-config-getschema", function(event) {
requestWriteConfig(conf_editor_forw.getValue());
});
$('#opt_expl_jsonserver').html(createHelpTable(schema.jsonServer.properties, '<i class="fa fa-sitemap fa-fw"></i>'+$.i18n("edt_conf_js_heading_title")));
$('#opt_expl_protoserver').html(createHelpTable(schema.protoServer.properties, '<i class="fa fa-sitemap fa-fw"></i>'+$.i18n("edt_conf_ps_heading_title")));
$('#opt_expl_boblightserver').html(createHelpTable(schema.boblightServer.properties, '<i class="fa fa-sitemap fa-fw"></i>'+$.i18n("edt_conf_bobls_heading_title")));
$('#opt_expl_udplistener').html(createHelpTable(schema.udpListener.properties, '<i class="fa fa-sitemap fa-fw"></i>'+$.i18n("edt_conf_udpl_heading_title")));
$('#opt_expl_forwarder').html(createHelpTable(schema.forwarder.properties, '<i class="fa fa-sitemap fa-fw"></i>'+$.i18n("edt_conf_fw_heading_title")));
if(showOptHelp)
{
$('#opt_expl_jsonserver').html(createHelpTable(schema.jsonServer.properties, '<i class="fa fa-info-circle fa-fw"></i>'+$.i18n("edt_conf_js_heading_title")+' '+$.i18n("conf_helptable_expl")));
$('#opt_expl_protoserver').html(createHelpTable(schema.protoServer.properties, '<i class="fa fa-info-circle fa-fw"></i>'+$.i18n("edt_conf_ps_heading_title")));
$('#opt_expl_boblightserver').html(createHelpTable(schema.boblightServer.properties, '<i class="fa fa-info-circle fa-fw"></i>'+$.i18n("edt_conf_bobls_heading_title")+' '+$.i18n("conf_helptable_expl")));
$('#opt_expl_udplistener').html(createHelpTable(schema.udpListener.properties, '<i class="fa fa-info-circle fa-fw"></i>'+$.i18n("edt_conf_udpl_heading_title")+' '+$.i18n("conf_helptable_expl")));
$('#opt_expl_forwarder').html(createHelpTable(schema.forwarder.properties, '<i class="fa fa-info-circle fa-fw"></i>'+$.i18n("edt_conf_fw_heading_title")+' '+$.i18n("conf_helptable_expl")));
}
});

View File

@@ -4,11 +4,14 @@ $(hyperion).one("cmd-config-getschema", function(event) {
schema = parsedConfSchemaJSON.properties;
conf_editor = createJsonEditor('editor_container', {
webConfig : schema.webConfig
}, true);
}, true, true);
$('#btn_submit').off().on('click',function() {
requestWriteConfig(conf_editor.getValue());
});
if(showOptHelp)
$('#opt_expl_webconfig').html(createHelpTable(schema.webConfig.properties, '<i class="fa fa-info-circle fa-fw"></i>'+$.i18n("edt_conf_webc_heading_title")+' '+$.i18n("conf_helptable_expl")));
});

View File

@@ -1,5 +1,6 @@
// global vars
var showOptHelp = true;
var currentVersion;
var cleanCurrentVersion;
var latestVersion;
@@ -24,7 +25,7 @@ function initRestart()
{
$(hyperion).off();
requestServerConfigReload();
watchdog = 1;
watchdog = 2;
$("#wrapper").fadeOut("slow");
cron();
}
@@ -229,8 +230,6 @@ function requestWriteConfig(config)
});
var config_str = JSON.stringify(complete_config);
console.log("save");
console.log(config_str);
sendToHyperion("config","setconfig", '"config":'+config_str);
}

View File

@@ -4859,7 +4859,7 @@ JSONEditor.defaults.editors["enum"] = JSONEditor.AbstractEditor.extend({
JSONEditor.defaults.editors.select = JSONEditor.AbstractEditor.extend({
setValue: function(value,initial) {
value = this.typecast(value||'');
value = this.typecast(value||'');
// Sanitize value before setting it
var sanitized = value;
@@ -5008,7 +5008,7 @@ JSONEditor.defaults.editors.select = JSONEditor.AbstractEditor.extend({
}
// Other, not supported
else {
throw "'select' editor requires the enum property to be set.";
//throw "'select' editor requires the enum property to be set.";
}
},
build: function() {
@@ -5041,23 +5041,11 @@ JSONEditor.defaults.editors.select = JSONEditor.AbstractEditor.extend({
this.value = this.enum_values[0];
},
onInputChange: function() {
var val = this.input.value;
var new_val;
// Invalid option, use first option instead
if(this.enum_options.indexOf(val) === -1) {
new_val = this.enum_values[0];
}
else {
new_val = this.enum_values[this.enum_options.indexOf(val)];
}
// If valid hasn't changed
if(new_val === this.value) return;
var val = this.input.value;
// Store new value and propogate change event
this.value = new_val;
this.onChange(true);
this.value = val;
this.onChange(true);
},
setupSelect2: function() {
// If the Select2 library is loaded use it when we have lots of items
@@ -6358,14 +6346,20 @@ JSONEditor.AbstractTheme = Class.extend({
this.setSelectOptions(switcher, options, titles);
},
setSelectOptions: function(select, options, titles) {
titles = titles || [];
select.innerHTML = '';
for(var i=0; i<options.length; i++) {
var option = document.createElement('option');
option.setAttribute('value',options[i]);
option.textContent = titles[i] || options[i];
select.appendChild(option);
}
if (typeof options != "undefined")
{
titles = titles || [];
select.innerHTML = '';
for(var i=0; i<options.length; i++) {
var option = document.createElement('option');
option.setAttribute('value',options[i]);
if (typeof titles[i] != 'undefined' && titles[i].startsWith('edt_'))
option.textContent = $.i18n(titles[i]);
else
option.textContent = titles[i] || options[i];
select.appendChild(option);
}
}
},
getTextareaInput: function() {
var el = document.createElement('textarea');
@@ -7056,6 +7050,11 @@ JSONEditor.defaults.resolvers.unshift(function(schema) {
}
}
});
// Use the `select` editor if a string has format "select"
JSONEditor.defaults.resolvers.unshift(function(schema) {
if(schema.type === "string" && schema.format === "select")
return "select";
});
// Specialized editors for arrays of strings
JSONEditor.defaults.resolvers.unshift(function(schema) {
if(schema.type === "array" && schema.items && !(Array.isArray(schema.items)) && schema.uniqueItems && ['string','number','integer'].indexOf(schema.items.type) >= 0) {

View File

@@ -47,10 +47,11 @@
}
else
{
showInfoDialog('warning', "Can't store settings", "Your browser doesn't support localStorage. You can't save a specific language setting (fallback to 'auto detection') and access level (fallback to 'default'). You could still use the webinterface without further issues");
showInfoDialog('warning', "Can't store settings", "Your browser doesn't support localStorage. You can't save a specific language setting (fallback to 'auto detection') and access level (fallback to 'default'). Some wizards may be hidden. You could still use the webinterface without further issues");
initTrans('auto');
$('#btn_setlang').toggle();
$('#btn_setaccess').toggle();
$('#btn_wizard_byteorder').toggle();
}
$('#btn_setlang').off().on('click',function() {

View File

@@ -80,7 +80,7 @@ function showInfoDialog(type,header,message,btnid)
else if (type == "select"){
$('#modal_dialog .modal-bodyicon').html('<img src="img/hyperion/hyperionlogo.png" alt="Redefine ambient light!">');
$('#modal_dialog .modal-footer-button').html('<button type="button" id="'+btnid+'" class="btn btn-success" data-dismiss="modal">'+$.i18n('general_btn_save')+'</button>');
$('#modal_dialog .modal-footer-button').append('<button type="button" class="btn btn-danger" data-dismiss="modal">'+$.i18n('general_btn_abort')+'</button>');
$('#modal_dialog .modal-footer-button').append('<button type="button" class="btn btn-danger" data-dismiss="modal">'+$.i18n('general_btn_cancel')+'</button>');
}
else if (type == "uilock"){
$('#modal_dialog .modal-bodyicon').html('<img src="img/hyperion/hyperionlogo.png" alt="Redefine ambient light!">');
@@ -182,8 +182,10 @@ function createHelpTable(list, phead){
thead.appendChild(createTableTh($.i18n('conf_helptable_option'), $.i18n('conf_helptable_expl')));
for (key in list){
text = list[key].title.replace('title', 'expl');
tbody.appendChild(createTableTd($.i18n(list[key].title), $.i18n(text)));
if(list[key].access != 'system'){
text = list[key].title.replace('title', 'expl');
tbody.appendChild(createTableTd($.i18n(list[key].title), $.i18n(text)));
}
}
table.appendChild(thead);
table.appendChild(tbody);

View File

@@ -0,0 +1,142 @@
$(document).ready( function() {
//clear priority if people reload the page or lost connection while a wizard was active
var wizardStatus = localStorage.getItem("wizardactive");
$(hyperion).one("cmd-config-getschema", function(event) {
if(wizardStatus)
requestPriorityClear();
});
//rgb byte order wizard
var colorIntveralId;
var new_rgb_order;
function changeColor()
{
var color = $("#wiz_canv_color").css('background-color');
if (color == 'rgb(255, 0, 0)')
{
$("#wiz_canv_color").css('background-color','rgb(0, 255, 0)');
requestSetColor('0','255','0');
}
else
{
$("#wiz_canv_color").css('background-color','rgb(255, 0, 0)');
requestSetColor('255','0','0');
}
}
function startWizardRGB()
{
$("#wizard_modal").modal({
backdrop : "static",
keyboard: false,
show: true
});
}
function beginWizardRGB()
{
$("#wiz_switchtime_select").off().on('change',function() {
clearInterval(colorIntveralId);
var time = $("#wiz_switchtime_select").val();
colorIntveralId = setInterval(function() { changeColor(); }, time*1000);
});
$('.wselect').change(function () {
var rgb_order = order = parsedConfJSON.device.colorOrder.split("");
var redS = $("#wiz_r_select").val();
var greenS = $("#wiz_g_select").val();
for (var i = 0; i<order.length; i++)
{
if (redS == order[i])
$('#wiz_g_select option[value='+order[i]+']').attr('disabled',true);
else
$('#wiz_g_select option[value='+order[i]+']').attr('disabled',false);
if (greenS == order[i])
$('#wiz_r_select option[value='+order[i]+']').attr('disabled',true);
else
$('#wiz_r_select option[value='+order[i]+']').attr('disabled',false);
}
if(redS != 'null' && greenS != 'null')
{
$('#btn_wiz_save').attr('disabled',false);
var blueS = parsedConfJSON.device.colorOrder.replace(redS, "").replace(greenS, "");
rgb_order[0] = redS;
rgb_order[1] = greenS;
rgb_order[2] = blueS;
rgb_order = rgb_order.toString().replace(/,/g,"");
var old_rgb_order = parsedConfJSON.device.colorOrder;
if(old_rgb_order == rgb_order)
{
$('#btn_wiz_save').toggle(false);
$('#btn_wiz_checkok').toggle(true);
}
else
{
$('#btn_wiz_save').toggle(true);
$('#btn_wiz_checkok').toggle(false);
}
new_rgb_order = rgb_order
}
else
$('#btn_wiz_save').attr('disabled',true);
});
$("#wiz_switchtime_select").html('');
$("#wiz_switchtime_select").append(createSelOpt('5','5'),createSelOpt('10','10'),createSelOpt('15','15'),createSelOpt('30','30'));
$("#wiz_switchtime_select").trigger('change');
$("#wiz_r_select").html('');
$("#wiz_r_select").append(createSelOpt("null", ""),createSelOpt('r', $.i18n('general_col_red')),createSelOpt('g', $.i18n('general_col_green')),createSelOpt('b', $.i18n('general_col_blue')));
$("#wiz_g_select").html($("#wiz_r_select").html());
$("#wiz_r_select").trigger('change');
requestSetColor('255','0','0');
localStorage.wizardactive = true;
}
$('#btn_wizard_byteorder').off().on('click',function() {
startWizardRGB();
});
$('#btn_wiz_cont').off().on('click',function() {
beginWizardRGB();
$('#wizp1').toggle(false);
$('#wizp2').toggle(true);
});
$('#btn_wiz_abort').off().on('click',function() {
$("#wizard_modal").modal('hide');
$("#wiz_canv_color").css('background-color','rgb(255, 0, 0)');
clearInterval(colorIntveralId);
requestPriorityClear();
localStorage.wizardactive = false;
$('#wizp1').toggle(true);
$('#wizp2').toggle(false);
$('#btn_wiz_save').toggle(true);
$('#btn_wiz_checkok').toggle(false);
});
$('#btn_wiz_cancel').off().on('click',function() {
$("#wizard_modal").modal('hide');
});
$('#btn_wiz_checkok').off().on('click',function() {
showInfoDialog('success', $.i18n('infoDialog_wizrgb_title'), $.i18n('infoDialog_wizrgb_text'));
});
$('#btn_wiz_save').off().on('click',function() {
var devConf = parsedConfJSON.device;
devConf.colorOrder = new_rgb_order;
requestWriteConfig(devConf);
initRestart();
});
});