Commit f2b53c41 authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Check valididty of the new UserData property.

parent 776a3955
......@@ -3,24 +3,26 @@
*
*/
Ext.define('MyApp.form.field.UserData', {
override : 'MyApp.form.field.UserData',
textAddMenu: 'ajouter',
textAddTitle: 'Entrer une nouvelle propriété',
textDefault: 'défault',
textDestroyMenu: 'Détruire',
textDestroyTitle: 'Etes vius sure de détruire la propriété',
textErrorTitle: 'Erreur ...',
textErrorMsg: 'La propriété existe !',
textProperty: 'propriété',
textUpdateMenu: 'Modifier',
textUpdateTitle: 'Modifier la propriété',
textType: 'type'
Ext.define('MyApp.locale.form.field.UserData', {
override : "MyApp.form.field.UserData",
textAddMenu: "ajouter",
textAddTitle: "Entrer une nouvelle propriété",
textDefault: "défault",
textDestroyMenu: "Détruire",
textDestroyTitle: "Etes vous certain de détruire la propriété",
textErrorTitle: "Erreur ...",
textErrorMsg: "La propriété existe !",
textProperty: "propriété",
textType: "type",
textReTitle: "La propriété est mal formée...",
textReMsg: "Le nom doit contenir les caractères [A-Za-z0-9_]",
textUpdateMenu: "Modifier",
textUpdateTitle: "Modifier la propriété"
});
Ext.define('MyApp.form.plugin.UserDataConsistency', {
override : 'MyApp.form.plugin.UserDataConsistency',
Ext.define('MyApp.locale.form.plugin.UserDataConsistency', {
override : "MyApp.form.plugin.UserDataConsistency",
textError : "Erreur en mettant à jour l'historique...",
textInfo : 'Information...',
textInfo : "Information...",
textUpdate: "Mise à jour de l'historique..."
});
......@@ -22,6 +22,9 @@ Ext.define('MyApp.form.field.UserData', {
menu: null,
store: null,
// regular expression to check that property name is well formed
reProperty: /^\w+$/,
// private properties for internationalization
textAddMenu: 'Add',
textAddTitle: 'Please enter the new property',
......@@ -31,9 +34,11 @@ Ext.define('MyApp.form.field.UserData', {
textErrorTitle: 'Error ...',
textErrorMsg: 'The property already exists!',
textProperty: 'property',
textReTitle: 'Property is not well formed...',
textReMsg: 'The property has to contains the characters [A-Za-z0-9_]',
textType: 'type',
textUpdateMenu: 'Update',
textUpdateTitle: 'Modify the property name',
textType: 'type',
// private method requests by the component model of ExtJS
initComponent: function () {
......@@ -189,6 +194,12 @@ Ext.define('MyApp.form.field.UserData', {
if (btn === 'ok') {
// check that the property is well formed
if (!me.reProperty.test(text)) {
Ext.Msg.alert(me.textReTitle, me.textReMsg);
return;
}
// check that the property is unique
if (store.find('property', text) !== -1) {
Ext.Msg.alert(me.textErrorTitle, me.textErrorMsg);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment