Add an error message if plugin option is not valid

This commit is contained in:
Emmanuel Papin 2015-05-16 06:12:38 +02:00
parent 0241f844d2
commit 2b770b2f58
22 changed files with 76 additions and 22 deletions

View File

@ -227,6 +227,7 @@ $SLANG = array(
'Command' => 'Command',
'Component' => 'Component', // Added - 2011-06-16
'Config' => 'Config',
'ConfigError' => 'Config Error', // Added - 2015-05-16
'ConfiguredFor' => '配置為',
'ConfirmDeleteEvents' => 'Are you sure you wish to delete the selected events?',
'ConfirmPassword' => '確認密碼',
@ -390,6 +391,7 @@ $SLANG = array(
'IncludeNatDet' => 'Include Native Detection', // Added - 2015-05-06
'Inverted' => '反轉',
'Iris' => 'Iris',
'IsNotAValidOption' => 'is not a valid option', // Added - 2015-05-16
'KeyString' => 'Key String',
'Label' => 'Label',
'Language' => '語言',

View File

@ -223,6 +223,7 @@ $SLANG = array(
'Command' => '命令',
'Component' => 'Component', // Added - 2011-06-16
'Config' => '配置',
'ConfigError' => 'Config Error', // Added - 2015-05-16
'ConfiguredFor' => '配置标的',
'ConfirmDeleteEvents' => '确认希望删除所选事件?',
'ConfirmPassword' => '密码确认',
@ -386,6 +387,7 @@ $SLANG = array(
'IncludeNatDet' => 'Include Native Detection', // Added - 2015-05-06
'Inverted' => '反向',
'Iris' => '光圈',
'IsNotAValidOption' => 'is not a valid option', // Added - 2015-05-16
'KeyString' => '密钥字符',
'Label' => '标签',
'Language' => '语言',

View File

@ -223,6 +223,7 @@ $SLANG = array(
'Command' => 'Pøíkaz',
'Component' => 'Component', // Added - 2011-06-16
'Config' => 'Nastavení',
'ConfigError' => 'Config Error', // Added - 2015-05-16
'ConfiguredFor' => 'Nastaveno pro',
'ConfirmDeleteEvents' => 'Are you sure you wish to delete the selected events?',
'ConfirmPassword' => 'Potvrdit heslo',
@ -386,6 +387,7 @@ $SLANG = array(
'IncludeNatDet' => 'Include Native Detection', // Added - 2015-05-06
'Inverted' => 'Pøevrácenì',
'Iris' => 'Iris',
'IsNotAValidOption' => 'is not a valid option', // Added - 2015-05-16
'KeyString' => 'Key String',
'Label' => 'Label',
'Language' => 'Jazyk',

View File

@ -223,6 +223,7 @@ $SLANG = array(
'Command' => 'Kommando',
'Component' => 'Component', // Added - 2011-06-16
'Config' => 'Konfig.',
'ConfigError' => 'Config Error', // Added - 2015-05-16
'ConfiguredFor' => 'Konfiguriert für',
'ConfirmDeleteEvents' => 'Sind Sie sicher, dass Sie die ausgewählten Ereignisse löschen wollen?',
'ConfirmPassword' => 'Passwortbestätigung',
@ -386,6 +387,7 @@ $SLANG = array(
'IncludeNatDet' => 'Include Native Detection', // Added - 2015-05-06
'Inverted' => 'Invertiert',
'Iris' => 'Iris',
'IsNotAValidOption' => 'is not a valid option', // Added - 2015-05-16
'KeyString' => 'Schlüsselwort',
'Label' => 'Bezeichnung',
'Language' => 'Sprache',

View File

@ -224,6 +224,7 @@ $SLANG = array(
'Command' => 'Kommando',
'Component' => 'Component', // Added - 2011-06-16
'Config' => 'konfig',
'ConfigError' => 'Config Error', // Added - 2015-05-16
'ConfiguredFor' => 'Konfigureret for',
'ConfirmDeleteEvents' => 'Are you sure you wish to delete the selected events?',
'ConfirmPassword' => 'Verifiser Password',
@ -387,6 +388,7 @@ $SLANG = array(
'IncludeNatDet' => 'Include Native Detection', // Added - 2015-05-06
'Inverted' => 'Inverteret',
'Iris' => 'Iris',
'IsNotAValidOption' => 'is not a valid option', // Added - 2015-05-16
'KeyString' => 'Key String',
'Label' => 'Label',
'Language' => 'Sprog',

View File

@ -230,6 +230,7 @@ $SLANG = array(
'Colour' => 'Colour',
'Command' => 'Command',
'Config' => 'Config',
'ConfigError' => 'Config Error',
'ConfiguredFor' => 'Configured for',
'ConfirmDeleteEvents' => 'Are you sure you wish to delete the selected events?',
'ConfirmPassword' => 'Confirm Password',
@ -393,6 +394,7 @@ $SLANG = array(
'In' => 'In',
'Inverted' => 'Inverted',
'Iris' => 'Iris',
'IsNotAValidOption' => 'is not a valid option',
'KeyString' => 'Key String',
'Label' => 'Label',
'Language' => 'Language',

View File

@ -174,6 +174,7 @@ $SLANG = array(
'Command' => 'Command',
'Component' => 'Component', // Added - 2011-06-16
'Config' => 'Config.',
'ConfigError' => 'Config Error', // Added - 2015-05-16
'ConfiguredFor' => 'Configurado Para',
'ConfirmDeleteEvents' => 'Are you sure you wish to delete the selected events?',
'ConfirmPassword' => 'Confirmar Contraseña',
@ -337,6 +338,7 @@ $SLANG = array(
'IncludeNatDet' => 'Include Native Detection', // Added - 2015-05-06
'Inverted' => 'Invertido',
'Iris' => 'Iris',
'IsNotAValidOption' => 'is not a valid option', // Added - 2015-05-16
'KeyString' => 'Key String',
'Label' => 'Label',
'Language' => 'Lenguaje',

View File

@ -223,6 +223,7 @@ $SLANG = array(
'Command' => 'Comando',
'Component' => 'Componente',
'Config' => 'Config',
'ConfigError' => 'Config Error', // Added - 2015-05-16
'ConfiguredFor' => 'Configurado para',
'ConfirmDeleteEvents' => '¿Seguro que desea borrar los eventos seleccionados?',
'ConfirmPassword' => 'Confirmar contraseña',
@ -386,6 +387,7 @@ $SLANG = array(
'IncludeNatDet' => 'Include Native Detection', // Added - 2015-05-06
'Inverted' => 'Invertido',
'Iris' => 'Iris',
'IsNotAValidOption' => 'is not a valid option', // Added - 2015-05-16
'KeyString' => 'Cadena clave',
'Label' => 'Etiqueta',
'Language' => 'Idioma',

View File

@ -224,6 +224,7 @@ $SLANG = array(
'Command' => 'Käsk',
'Component' => 'Komponent', // Added - 2011-06-16
'Config' => 'Seadistus',
'ConfigError' => 'Config Error', // Added - 2015-05-16
'ConfiguredFor' => 'Seadistatud',
'ConfirmDeleteEvents' => 'Oled sa kindel kustamaks valitud sündmused?',
'ConfirmPassword' => 'Kinnita salasõna',
@ -387,6 +388,7 @@ $SLANG = array(
'IncludeNatDet' => 'Include Native Detection', // Added - 2015-05-06
'Inverted' => 'Inverted',
'Iris' => 'Iris',
'IsNotAValidOption' => 'is not a valid option', // Added - 2015-05-16
'KeyString' => 'Key String',
'Label' => 'Label',
'Language' => 'Keel',

View File

@ -229,6 +229,7 @@ $SLANG = array(
'Command' => 'Commande',
'Component' => 'Composant', // Added - 2011-06-16
'Config' => 'Config',
'ConfigError' => 'Erreur de configuration', // Added - 2015-05-16
'ConfiguredFor' => 'Configuré pour',
'ConfirmDeleteEvents' => 'Etes-vous sûr de vouloir effacer le(s) événement(s) sélectionné(s)?',
'ConfirmPassword' => 'Répéter mot de passe',
@ -392,6 +393,7 @@ $SLANG = array(
'IncludeNatDet' => 'Inclure détection native', // Added - 2015-05-06
'Inverted' => 'Inversé',
'Iris' => 'Iris',
'IsNotAValidOption' => 'n\'est pas une option valide', // Added - 2015-05-16
'KeyString' => 'Chaîne clé',
'Label' => 'Etiquette',
'Language' => 'Langue',

View File

@ -223,6 +223,7 @@ $SLANG = array(
'Command' => 'ô÷åãä',
'Component' => 'Component', // Added - 2011-06-16
'Config' => 'úöåøä',
'ConfigError' => 'Config Error', // Added - 2015-05-16
'ConfiguredFor' => 'úöåøä òáåø',
'ConfirmDeleteEvents' => 'Are you sure you wish to delete the selected events?',
'ConfirmPassword' => 'àùø ñéñîà',
@ -386,6 +387,7 @@ $SLANG = array(
'IncludeNatDet' => 'Include Native Detection', // Added - 2015-05-06
'Inverted' => 'äôåê',
'Iris' => 'Iris',
'IsNotAValidOption' => 'is not a valid option', // Added - 2015-05-16
'KeyString' => 'îçøåæú úåéí',
'Label' => 'úååéú',
'Language' => 'ùôä',

View File

@ -266,6 +266,7 @@ $SLANG = array(
'Command' => 'Parancs',
'Component' => 'Komponens',
'Config' => 'Beállítás',
'ConfigError' => 'Config Error', // Added - 2015-05-16
'ConfiguredFor' => 'Beállítva',
'ConfirmDeleteEvents' => 'Biztos benne, hogy törli a kiválasztott eseményeket?',
'ConfirmPassword' => 'Jelszó megerősítés',
@ -429,6 +430,7 @@ $SLANG = array(
'IncludeNatDet' => 'Include Native Detection', // Added - 2015-05-06
'Inverted' => 'Invertálva',
'Iris' => 'Írisz',
'IsNotAValidOption' => 'is not a valid option', // Added - 2015-05-16
'KeyString' => 'Kulcs karaktersor',
'Label' => 'Cimke',
'Language' => 'Nyelv',

View File

@ -228,6 +228,7 @@ $SLANG = array(
'Command' => 'Comando',
'Component' => 'Component', // Added - 2011-06-16
'Config' => 'Configura',
'ConfigError' => 'Config Error', // Added - 2015-05-16
'ConfiguredFor' => 'Configurato per',
'ConfirmDeleteEvents' => 'Sei sicuro di voler cancellare gli eventi selezionati',
'ConfirmPassword' => 'Conferma Password',
@ -391,6 +392,7 @@ $SLANG = array(
'IncludeNatDet' => 'Include Native Detection', // Added - 2015-05-06
'Inverted' => 'Invertito',
'Iris' => 'Iris',
'IsNotAValidOption' => 'is not a valid option', // Added - 2015-05-16
'KeyString' => 'Stringa Chiave',
'Label' => 'Etichetta',
'Language' => 'Linguaggio',

View File

@ -223,6 +223,7 @@ $SLANG = array(
'Command' => 'Command',
'Component' => 'Component', // Added - 2011-06-16
'Config' => 'Config',
'ConfigError' => 'Config Error', // Added - 2015-05-16
'ConfiguredFor' => '<27>Ýè:',
'ConfirmDeleteEvents' => 'Are you sure you wish to delete the selected events?',
'ConfirmPassword' => 'Ê߽ܰÄÞÌŠm”F',
@ -386,6 +387,7 @@ $SLANG = array(
'IncludeNatDet' => 'Include Native Detection', // Added - 2015-05-06
'Inverted' => '”½“]',
'Iris' => 'Iris',
'IsNotAValidOption' => 'is not a valid option', // Added - 2015-05-16
'KeyString' => 'Key String',
'Label' => 'Label',
'Language' => 'Œ¾Œê',

View File

@ -223,6 +223,7 @@ $SLANG = array(
'Command' => 'Commando',
'Component' => 'Component', // Added - 2011-06-16
'Config' => 'Configuratie',
'ConfigError' => 'Config Error', // Added - 2015-05-16
'ConfiguredFor' => 'Geconfigureerd voor',
'ConfirmDeleteEvents' => 'Weet uw zeker dat uw deze gebeurtenissen wil verwijderen?',
'ConfirmPassword' => 'Bevestig wachtwoord',
@ -386,6 +387,7 @@ $SLANG = array(
'IncludeNatDet' => 'Include Native Detection', // Added - 2015-05-06
'Inverted' => 'Omgedraaid',
'Iris' => 'Iris',
'IsNotAValidOption' => 'is not a valid option', // Added - 2015-05-16
'KeyString' => 'Sleutel waarde',
'Label' => 'Label',
'Language' => 'Taal',

View File

@ -223,6 +223,7 @@ $SLANG = array(
'Command' => 'Command',
'Component' => 'Component', // Added - 2011-06-16
'Config' => 'Konfiguracja',
'ConfigError' => 'Config Error', // Added - 2015-05-16
'ConfiguredFor' => 'Ustawiona',
'ConfirmDeleteEvents' => 'Are you sure you wish to delete the selected events?',
'ConfirmPassword' => 'Potwierd¼ has³o',
@ -386,6 +387,7 @@ $SLANG = array(
'IncludeNatDet' => 'Include Native Detection', // Added - 2015-05-06
'Inverted' => 'Odwrócony',
'Iris' => 'Iris',
'IsNotAValidOption' => 'is not a valid option', // Added - 2015-05-16
'KeyString' => 'Key String',
'Label' => 'Label',
'Language' => 'Jêzyk',

View File

@ -163,6 +163,7 @@ $SLANG = array(
'Command' => 'Command',
'Component' => 'Component', // Added - 2011-06-16
'Config' => 'Config',
'ConfigError' => 'Config Error', // Added - 2015-05-16
'ConfiguredFor' => 'Configurado para',
'ConfirmDeleteEvents' => 'Are you sure you wish to delete the selected events?',
'ConfirmPassword' => 'Confirmar Senha',
@ -326,6 +327,7 @@ $SLANG = array(
'IncludeNatDet' => 'Include Native Detection', // Added - 2015-05-06
'Inverted' => 'Invertido',
'Iris' => 'Iris',
'IsNotAValidOption' => 'is not a valid option', // Added - 2015-05-16
'KeyString' => 'Key String',
'Label' => 'Label',
'Language' => 'Linguagem',

View File

@ -194,6 +194,7 @@ $SLANG = array(
'Command' => 'Comanda',
'Component' => 'Component', // Added - 2011-06-16
'Config' => 'Config',
'ConfigError' => 'Config Error', // Added - 2015-05-16
'ConfiguredFor' => 'Configurat pentru',
'ConfirmDeleteEvents' => 'Are you sure you wish to delete the selected events?',
'ConfirmPassword' => 'Confirm parola',
@ -357,6 +358,7 @@ $SLANG = array(
'IncludeNatDet' => 'Include Native Detection', // Added - 2015-05-06
'Inverted' => 'Invers&#259;',
'Iris' => 'Iris',
'IsNotAValidOption' => 'is not a valid option', // Added - 2015-05-16
'KeyString' => 'Key String',
'Label' => 'Label',
'Language' => 'Limb&#259;',

View File

@ -223,6 +223,7 @@ $SLANG = array(
'Command' => 'Command',
'Component' => 'Component', // Added - 2011-06-16
'Config' => 'Config',
'ConfigError' => 'Config Error', // Added - 2015-05-16
'ConfiguredFor' => 'îÁÓÔÒÏÅÎ ÎÁ',
'ConfirmDeleteEvents' => 'Are you sure you wish to delete the selected events?',
'ConfirmPassword' => 'ðÏÄÔ×ÅÒÄÉÔÅ ÐÁÒÏÌØ',
@ -386,6 +387,7 @@ $SLANG = array(
'IncludeNatDet' => 'Include Native Detection', // Added - 2015-05-06
'Inverted' => 'éÎ×ÅÒÔÉÒÏ×ÁÔØ',
'Iris' => 'Iris',
'IsNotAValidOption' => 'is not a valid option', // Added - 2015-05-16
'KeyString' => 'Key String',
'Label' => 'Label',
'Language' => 'ñÚÙË',

View File

@ -224,6 +224,7 @@ $SLANG = array(
'Command' => 'Kommando',
'Component' => 'Component', // Added - 2011-06-16
'Config' => 'Konfigurera',
'ConfigError' => 'Config Error', // Added - 2015-05-16
'ConfiguredFor' => 'Konfigurerad för',
'ConfirmDeleteEvents' => 'Är du säker på att du vill ta bort dom valda händelserna?',
'ConfirmPassword' => 'Bekräfta lösenord',
@ -387,6 +388,7 @@ $SLANG = array(
'IncludeNatDet' => 'Include Native Detection', // Added - 2015-05-06
'Inverted' => 'Inverterad',
'Iris' => 'Iris',
'IsNotAValidOption' => 'is not a valid option', // Added - 2015-05-16
'KeyString' => 'Nyckelsträng',
'Label' => 'Etikett',
'Language' => 'Språk',

View File

@ -9,9 +9,9 @@ function addOption( name )
return;
}
// Raise an error and exit of non alphanumeric characters in string
if ( !str.match(/^[0-9a-zA-Z]+$/) )
if ( !str.match( /^[0-9a-zA-Z]+$/ ) )
{
alert(onlyAlphaCharString);
alert( onlyAlphaCharString );
return;
}
var hidden = form.elements['pluginOpt[' + name + ']'];
@ -19,11 +19,11 @@ function addOption( name )
var list = hidden.value.split( "," );
if ( list.indexOf( str ) != -1 )
{
alert(alreadyInList);
alert( alreadyInList );
return;
}
// Add option to the list
select.options[select.options.length] = new Option(str, str);
select.options[select.options.length] = new Option( str, str );
// Synchronize hidden field
if ( hidden.value.length > 0 )
{
@ -43,7 +43,7 @@ function removeOptionSelected( name )
{
if ( select.options[i].selected )
{
select.remove(i);
select.remove( i );
}
}
// Synchronize hidden field
@ -68,7 +68,7 @@ function updateAddBtn( name )
{
var form = document.pluginForm;
// Disable add button if the text input is empty
if ( form.elements['dsp_input_pluginOpt[' + name + ']'].value === "")
if ( form.elements['dsp_input_pluginOpt[' + name + ']'].value === "" )
{
form.elements['addBtn[' + name + ']'].disabled = true;
}
@ -102,6 +102,7 @@ function saveChanges( element )
function applyChanges()
{
var form = document.pluginForm;
var errorMsg = "";
// Synchronize hidden fields
for ( var option in pluginOptionList )
{
@ -131,23 +132,30 @@ function applyChanges()
for ( var name in pluginOptionList[option] )
{
//console.log("form.elements['pluginOpt[" + name + "]'].value=" + form.elements['pluginOpt[' + name + ']'].value + " pluginOptionList[" + option + "][" + name + "]=" + pluginOptionList[option][name]);
if (form.elements['pluginOpt[' + name + ']'].value != pluginOptionList[option][name])
if ( typeof form.elements['pluginOpt[' + name + ']'] !== "undefined" )
{
form.elements['dsp_pluginOpt[' + option + ']'].disabled = true;
// Handle additionnal controls for list option
if ( typeof form.elements['dsp_input_pluginOpt[' + option + ']'] !== "undefined" )
if ( form.elements['pluginOpt[' + name + ']'].value != pluginOptionList[option][name] )
{
form.elements['dsp_input_pluginOpt[' + option + ']'].disabled = true;
form.elements['dsp_input_pluginOpt[' + option + ']'].value = "";
form.elements['addBtn[' + option + ']'].disabled = true;
form.elements['removeBtn[' + option + ']'].disabled = true;
form.elements['dsp_pluginOpt[' + option + ']'].disabled = true;
// Handle additionnal controls for list option
if ( typeof form.elements['dsp_input_pluginOpt[' + option + ']'] !== "undefined" )
{
form.elements['dsp_input_pluginOpt[' + option + ']'].disabled = true;
form.elements['dsp_input_pluginOpt[' + option + ']'].value = "";
form.elements['addBtn[' + option + ']'].disabled = true;
form.elements['removeBtn[' + option + ']'].disabled = true;
}
enabled = false;
break;
}
enabled = false;
break;
}
else
{
errorMsg += "'" + name + "' " + isNotAValidOption + "\n";
}
}
// Enable visible field if all dependencies are ok
if (enabled)
if ( enabled )
{
form.elements['dsp_pluginOpt[' + option + ']'].disabled = false;
// Handle additionnal controls for list option
@ -161,26 +169,30 @@ function applyChanges()
}
}
}
if ( errorMsg.length !== 0 )
{
alert( configError + "\n" + errorMsg );
}
}
function limitRange( field, minValue, maxValue )
{
var intval;
if ( +field.value === parseInt(field.value) )
if ( +field.value === parseInt( field.value ) )
{
intval = parseInt(field.value);
intval = parseInt( field.value );
}
else
{
alert(onlyIntegerString);
alert( onlyIntegerString );
field.value = field.defaultValue;
return;
}
if ( intval < parseInt(minValue) )
if ( intval < parseInt( minValue ) )
{
field.value = minValue;
}
else if ( intval > parseInt(maxValue) )
else if ( intval > parseInt( maxValue ) )
{
field.value = maxValue;
}

View File

@ -18,4 +18,6 @@ pluginOptionList['<?php echo $key; ?>']['<?php echo $req_couple['Name']; ?>'] =
var onlyAlphaCharString = '<?php echo addslashes($SLANG['OnlyAlphaChars']) ?>';
var alreadyInList = '<?php echo addslashes($SLANG['AlreadyInList']) ?>';
var configError = '<?php echo addslashes($SLANG['ConfigError']) ?>';
var isNotAValidOption = '<?php echo addslashes($SLANG['IsNotAValidOption']) ?>';
var onlyIntegerString = '<?php echo addslashes($SLANG['OnlyIntegers']) ?>';