Transit translation system (#309)

* update schemas

* update schemas

* update schemas

* schema update

* update translation

* upd
This commit is contained in:
brindosch
2016-12-04 19:32:23 +01:00
committed by redPanther
parent 3124bb8bf1
commit 8d55154164
82 changed files with 3120 additions and 1850 deletions

View File

@@ -1,9 +1,14 @@
JSONEditor.defaults.editors.colorPicker = JSONEditor.defaults.editors.string.extend({
getValue: function() {
var color = $(this.input).data('colorpicker').color.toRGB();
return [color.r, color.g, color.b];
},
getValue: function() {
if ($(this.input).data("colorpicker") !== undefined) {
var color = $(this.input).data('colorpicker').color.toRGB();
return [color.r,color.g, color.b];
}
else {
return [0,0,0];
}
},
setValue: function(val) {
function rgb2hex(rgb)
@@ -66,15 +71,16 @@
}
$("#effectsdellist").html(EffectHtml);
oldDelList = newDelList;
$('#effectsdellist').trigger('change');
}
}
$(hyperion).one("cmd-config-getschema", function(event) {
effects = parsedConfSchemaJSON.properties.effectSchemas.internal
EffectsHtml = "";
for(var idx=0; idx<effects.length; idx++)
{
EffectsHtml += '<option value="'+effects[idx].schemaContent.script+'">'+effects[idx].schemaContent.title+'</option>';
EffectsHtml += '<option value="'+effects[idx].schemaContent.script+'">'+$.i18n(effects[idx].schemaContent.title)+'</option>';
}
$("#effectslist").html(EffectsHtml);
$("#effectslist").trigger("change");
@@ -83,26 +89,10 @@ $(hyperion).one("cmd-config-getschema", function(event) {
function validateEditor() {
if(effects_editor.validate().length)
{
showInfoDialog('error','INVALID VALUES','Please check for red marked inputs and try again.');
showInfoDialog('error', $.i18n('infoDialog_effconf_invalidvalue_title'), $.i18n('infoDialog_effconf_invalidvalue_text'));
return false;
}
else
{
return true;
}
};
function validateName() {
effectName = $('#name-input').val();
if (effectName == "")
{
showInfoDialog('error','INVALID NAME FIELD','Effect name is empty! Please fill in a name and try again.');
return false;
}
else
{
return true;
}
return true;
};
function triggerTestEffect() {
@@ -123,25 +113,37 @@ $(hyperion).one("cmd-config-getschema", function(event) {
effectPy = ':';
effectPy += effects[idx].schemaContent.script;
}
$("#name-input").trigger("change");
}
effects_editor.on('change',function() {
if ($("#btn_cont_test").hasClass("btn-success") && validateName() && validateEditor())
if ($("#btn_cont_test").hasClass("btn-success") && validateEditor())
{
triggerTestEffect();
}
});
});
$("#name-input").on('change keydown click', function(event) {
effectName = $(this).val();
if ($(this).val() == '') {
effects_editor.disable();
$("#eff_footer").children().attr('disabled',true);
} else {
effects_editor.enable();
$("#eff_footer").children().attr('disabled',false);
}
});
$('#btn_write').off().on('click',function() {
if(validateEditor() && validateName())
if(validateEditor())
{
requestWriteEffect(effectName,effectPy,JSON.stringify(effects_editor.getValue()));
showInfoDialog('success','SUCCESS!','Your effect "'+effectName+'" has been created successfully!');
showInfoDialog('success', $.i18n('infoDialog_effconf_created_title'), $.i18n('infoDialog_effconf_created_text', effectName));
}
});
$('#btn_start_test').off().on('click',function() {
if(validateEditor() && validateName())
if(validateEditor())
{
triggerTestEffect();
}
@@ -158,10 +160,19 @@ $(hyperion).one("cmd-config-getschema", function(event) {
$('#btn_delete').off().on('click',function() {
var name = $("#effectsdellist").val();
requestDeleteEffect(name);
showInfoDialog('success','Effect deleted!', 'The effect "'+name+'" has been deleted successfully!');
showInfoDialog('success', $.i18n('infoDialog_effconf_deleted_title'), $.i18n('infoDialog_effconf_deleted_text', name));
});
$('#effectsdellist').off().on('change', function(){
if ($(this).val() == null) {
$('#btn_delete').prop('disabled',true);
} else {
$('#btn_delete').prop('disabled',false);
}
});
$(document).ready( function() {
performTranslation();
requestServerConfigSchema();
$(hyperion).on("cmd-serverinfo",updateDelEffectlist);
});