diff --git a/src/files.js b/src/files.js index e048b67421e..50814c755b9 100755 --- a/src/files.js +++ b/src/files.js @@ -233,6 +233,7 @@ FOAM_FILES([ { name: "foam/dao/SQLStatement" }, { name: "foam/dao/CSVSink" }, { name: "foam/dao/LimitedDAO" }, + { name: "foam/dao/LockDAO" }, { name: "foam/dao/SkipDAO" }, { name: "foam/dao/OrderedDAO", flags: ['web'] }, { name: "foam/dao/InternalException" }, diff --git a/src/foam/comics/v2/DAOBrowseControllerView.js b/src/foam/comics/v2/DAOBrowseControllerView.js index 62e06016feb..43e27f9b4b9 100644 --- a/src/foam/comics/v2/DAOBrowseControllerView.js +++ b/src/foam/comics/v2/DAOBrowseControllerView.js @@ -22,7 +22,8 @@ foam.CLASS({ ], exports: [ - 'memento' + 'memento', + 'config' ], requires: [ @@ -125,12 +126,25 @@ foam.CLASS({ }, code: function() { if ( ! this.stack ) return; - this.stack.push({ - class: 'foam.comics.v2.DAOCreateView', - data: ((this.config.factory && this.config.factory$cls) || this.data.of).create({ mode: 'create'}, this), - config$: this.config$, - of: this.data.of - }, this.__subContext__); + + if ( this.config.DAOCreateView ){ + this.stack.push({ + class: 'foam.comics.v2.DAOCreateView', + data: ((this.config.factory && this.config.factory$cls) || this.data.of).create({ mode: 'create'}, this), + config$: this.config$, + of: this.data.of + }, this.__subContext__); + } else { + this.stack.push( + eval(this.config.wizardDetailView.class).create({ + model: this.data.of.id || this.config.of.id, + data: this.selection, + detailView: this.config.detailView.class, + menu: this.config.menu, + controllerMode: foam.u2.ControllerMode.CREATE, + isEdit: true + }, this.__subContext__)); + } } } ], @@ -142,7 +156,8 @@ foam.CLASS({ var self = this; var menuId = this.currentMenu ? this.currentMenu.id : this.config.of.id; this.addClass(this.myClass()) - .add(this.slot(function(data, config, config$of, config$browseBorder, config$browseViews, config$browseTitle, config$browseSubtitle, config$primaryAction) { + //.add(this.slot(function(data, config, config$of, config$browseBorder, config$browseViews, config$browseTitle, config$browseSubtitle, config$primaryAction) { + .add(this.slot(function(data, config, config$browseBorder, config$browseViews, config$browseTitle, config$browseSubtitle, config$primaryAction, config$createTitle, config$of) { return self.E() .start(self.Rows) .addClass(self.myClass('container')) @@ -153,7 +168,9 @@ foam.CLASS({ .addClass(self.myClass('browse-title')) .translate(menuId + ".browseTitle", config$browseTitle) .end() - .startContext({ data: self }).tag(self.CREATE).endContext() + // .startContext({ data: self }) + // .tag(self.CREATE, { label: config$createTitle }) + // .endContext() .callIf(config$primaryAction, function() { this.startContext({ data: self }).tag(config$primaryAction, { size: 'LARGE' }).endContext(); }) @@ -186,9 +203,12 @@ foam.CLASS({ .addClass(self.myClass('altview-container')) .end(); }) - .add(self.slot(function(browseView) { - return self.E().tag(browseView, { data: data, config: config }); - })) + .call(function(){ + var e = this; + this.add(self.slot(function(browseView) { + return self.E().tag(browseView, { config$: e.__subContext__.config$ }); + })) + }) .end() .end() .end(); diff --git a/src/foam/comics/v2/DAOControllerConfig.js b/src/foam/comics/v2/DAOControllerConfig.js index 7e842e1b950..4803f70cb50 100644 --- a/src/foam/comics/v2/DAOControllerConfig.js +++ b/src/foam/comics/v2/DAOControllerConfig.js @@ -113,6 +113,7 @@ foam.CLASS({ return { class: 'foam.u2.view.ScrollTableView', enableDynamicTableHeight: true, + editColumnsEnabled: false, columns: defaultColumns, css: { width: '100%', @@ -229,6 +230,26 @@ foam.CLASS({ { class: 'Boolean', name: 'hideQueryBar' + }, + { + class: 'Boolean', + name: 'DAOCreateView', + documentation: 'True to use the DAOCreateView else it will use the WizardController.' + }, + { + class: 'foam.u2.ViewSpec', + name: 'wizardDetailView', + documentation: 'class of WizardDetailView.' + }, + { + class: 'foam.u2.ViewSpec', + name: 'detailView', + documentation: 'class of detailView.' + }, + { + class: 'foam.u2.ViewSpec', + name: 'menu', + documentation: 'class of detailView.' } ] }); diff --git a/src/foam/core/AbstractFObjectPropertyInfo.java b/src/foam/core/AbstractFObjectPropertyInfo.java index 6c146eb421e..3be8f8dc6ab 100644 --- a/src/foam/core/AbstractFObjectPropertyInfo.java +++ b/src/foam/core/AbstractFObjectPropertyInfo.java @@ -119,7 +119,14 @@ public boolean hardDiff(FObject o1, FObject o2, FObject diff) { this.set(diff, d); return d != null; } - + + @Override + public void validateObj(X x, FObject obj) { + if ( isSet(obj) ) { + ((FObject) get(obj)).validate(x); + } + } + public String getSQLType() { return ""; } diff --git a/src/foam/nanos/auth/Address.js b/src/foam/nanos/auth/Address.js index 911118f00ec..141569f804d 100644 --- a/src/foam/nanos/auth/Address.js +++ b/src/foam/nanos/auth/Address.js @@ -240,6 +240,7 @@ foam.CLASS({ /^[ABCEGHJ-NPRSTVXY]\d[ABCEGHJ-NPRSTV-Z][ -]?\d[ABCEGHJ-NPRSTV-Z]\d$/i) ); }, + errorMessage: 'INVALID_POSTAL_CODE', jsErr: function(X) { let postalCodeError = X.translationService.getTranslation(foam.locale, `${X.countryId.toLowerCase()}.foam.nanos.auth.Address.POSTAL_CODE.error`); if ( ! postalCodeError ) { @@ -258,6 +259,7 @@ foam.CLASS({ /^\d{5}(?:[-\s]\d{4})?$/i) ); }, + errorMessage: 'INVALID_POSTAL_CODE', jsErr: function(X) { let postalCodeError = X.translationService.getTranslation(foam.locale, `${X.countryId.toLowerCase()}.foam.nanos.auth.Address.POSTAL_CODE.error`); if ( ! postalCodeError ) { @@ -278,6 +280,7 @@ foam.CLASS({ ) ); }, + errorMessage: 'INVALID_POSTAL_CODE', jsErr: function(X) { let postalCodeError = X.translationService.getTranslation(foam.locale, `${X.countryId.toLowerCase()}.foam.nanos.auth.Address.POSTAL_CODE.error`); if ( ! postalCodeError ) { @@ -298,6 +301,7 @@ foam.CLASS({ ) ); }, + errorMessage: 'INVALID_POSTAL_CODE', jsErr: function(X) { let postalCodeError = X.translationService.getTranslation(foam.locale, `${X.countryId.toLowerCase()}.foam.nanos.auth.Address.POSTAL_CODE.error`); if ( ! postalCodeError ) { @@ -318,6 +322,7 @@ foam.CLASS({ ) ); }, + errorMessage: 'INVALID_POSTAL_CODE', jsErr: function(X) { let postalCodeError = X.translationService.getTranslation(foam.locale, `${X.countryId.toLowerCase()}.foam.nanos.auth.Address.POSTAL_CODE.error`); if ( ! postalCodeError ) { @@ -340,6 +345,7 @@ foam.CLASS({ ) ); }, + errorMessage: 'INVALID_POSTAL_CODE', jsErr: function(X) { let postalCodeError = X.translationService.getTranslation(foam.locale, `${X.countryId.toLowerCase()}.foam.nanos.auth.Address.POSTAL_CODE.error`); if ( ! postalCodeError ) { @@ -360,6 +366,7 @@ foam.CLASS({ ) ); }, + errorMessage: 'INVALID_POSTAL_CODE', jsErr: function(X) { let postalCodeError = X.translationService.getTranslation(foam.locale, `${X.countryId.toLowerCase()}.foam.nanos.auth.Address.POSTAL_CODE.error`); if ( ! postalCodeError ) { @@ -380,6 +387,7 @@ foam.CLASS({ ) ); }, + errorMessage: 'INVALID_POSTAL_CODE', jsErr: function(X) { let postalCodeError = X.translationService.getTranslation(foam.locale, `${X.countryId.toLowerCase()}.foam.nanos.auth.Address.POSTAL_CODE.error`); if ( ! postalCodeError ) { @@ -400,6 +408,7 @@ foam.CLASS({ ) ); }, + errorMessage: 'INVALID_POSTAL_CODE', jsErr: function(X) { let postalCodeError = X.translationService.getTranslation(foam.locale, `${X.countryId.toLowerCase()}.foam.nanos.auth.Address.POSTAL_CODE.error`); if ( ! postalCodeError ) { @@ -420,6 +429,7 @@ foam.CLASS({ ) ); }, + errorMessage: 'INVALID_POSTAL_CODE', jsErr: function(X) { let postalCodeError = X.translationService.getTranslation(foam.locale, `${X.countryId.toLowerCase()}.foam.nanos.auth.Address.POSTAL_CODE.error`); if ( ! postalCodeError ) { @@ -440,6 +450,7 @@ foam.CLASS({ ) ); }, + errorMessage: 'INVALID_POSTAL_CODE', jsErr: function(X) { let postalCodeError = X.translationService.getTranslation(foam.locale, `${X.countryId.toLowerCase()}.foam.nanos.auth.Address.POSTAL_CODE.error`); if ( ! postalCodeError ) { @@ -460,6 +471,7 @@ foam.CLASS({ ) ); }, + errorMessage: 'INVALID_POSTAL_CODE', jsErr: function(X) { let postalCodeError = X.translationService.getTranslation(foam.locale, `${X.countryId.toLowerCase()}.foam.nanos.auth.Address.POSTAL_CODE.error`); if ( ! postalCodeError ) { @@ -480,6 +492,7 @@ foam.CLASS({ ) ); }, + errorMessage: 'INVALID_POSTAL_CODE', jsErr: function(X) { let postalCodeError = X.translationService.getTranslation(foam.locale, `${X.countryId.toLowerCase()}.foam.nanos.auth.Address.POSTAL_CODE.error`); if ( ! postalCodeError ) { @@ -500,6 +513,7 @@ foam.CLASS({ ) ); }, + errorMessage: 'INVALID_POSTAL_CODE', jsErr: function(X) { let postalCodeError = X.translationService.getTranslation(foam.locale, `${X.countryId.toLowerCase()}.foam.nanos.auth.Address.POSTAL_CODE.error`); if ( ! postalCodeError ) { @@ -520,6 +534,7 @@ foam.CLASS({ ) ); }, + errorMessage: 'INVALID_POSTAL_CODE', jsErr: function(X) { let postalCodeError = X.translationService.getTranslation(foam.locale, `${X.countryId.toLowerCase()}.foam.nanos.auth.Address.POSTAL_CODE.error`); if ( ! postalCodeError ) { @@ -540,6 +555,7 @@ foam.CLASS({ ) ); }, + errorMessage: 'INVALID_POSTAL_CODE', jsErr: function(X) { let postalCodeError = X.translationService.getTranslation(foam.locale, `${X.countryId.toLowerCase()}.foam.nanos.auth.Address.POSTAL_CODE.error`); if ( ! postalCodeError ) { @@ -560,6 +576,7 @@ foam.CLASS({ ) ); }, + errorMessage: 'INVALID_POSTAL_CODE', jsErr: function(X) { let postalCodeError = X.translationService.getTranslation(foam.locale, `${X.countryId.toLowerCase()}.foam.nanos.auth.Address.POSTAL_CODE.error`); if ( ! postalCodeError ) { @@ -580,6 +597,7 @@ foam.CLASS({ ) ); }, + errorMessage: 'INVALID_POSTAL_CODE', jsErr: function(X) { let postalCodeError = X.translationService.getTranslation(foam.locale, `${X.countryId.toLowerCase()}.foam.nanos.auth.Address.POSTAL_CODE.error`); if ( ! postalCodeError ) { @@ -600,6 +618,7 @@ foam.CLASS({ ) ); }, + errorMessage: 'INVALID_POSTAL_CODE', jsErr: function(X) { let postalCodeError = X.translationService.getTranslation(foam.locale, `${X.countryId.toLowerCase()}.foam.nanos.auth.Address.POSTAL_CODE.error`); if ( ! postalCodeError ) { @@ -620,6 +639,7 @@ foam.CLASS({ ) ); }, + errorMessage: 'INVALID_POSTAL_CODE', jsErr: function(X) { let postalCodeError = X.translationService.getTranslation(foam.locale, `${X.countryId.toLowerCase()}.foam.nanos.auth.Address.POSTAL_CODE.error`); if ( ! postalCodeError ) { @@ -640,6 +660,7 @@ foam.CLASS({ ) ); }, + errorMessage: 'INVALID_POSTAL_CODE', jsErr: function(X) { let postalCodeError = X.translationService.getTranslation(foam.locale, `${X.countryId.toLowerCase()}.foam.nanos.auth.Address.POSTAL_CODE.error`); if ( ! postalCodeError ) { @@ -660,6 +681,7 @@ foam.CLASS({ ) ); }, + errorMessage: 'INVALID_POSTAL_CODE', jsErr: function(X) { let postalCodeError = X.translationService.getTranslation(foam.locale, `${X.countryId.toLowerCase()}.foam.nanos.auth.Address.POSTAL_CODE.error`); if ( ! postalCodeError ) { @@ -680,6 +702,7 @@ foam.CLASS({ ) ); }, + errorMessage: 'INVALID_POSTAL_CODE', jsErr: function(X) { let postalCodeError = X.translationService.getTranslation(foam.locale, `${X.countryId.toLowerCase()}.foam.nanos.auth.Address.POSTAL_CODE.error`); if ( ! postalCodeError ) { @@ -700,6 +723,7 @@ foam.CLASS({ ) ); }, + errorMessage: 'INVALID_POSTAL_CODE', jsErr: function(X) { let postalCodeError = X.translationService.getTranslation(foam.locale, `${X.countryId.toLowerCase()}.foam.nanos.auth.Address.POSTAL_CODE.error`); if ( ! postalCodeError ) { @@ -720,6 +744,7 @@ foam.CLASS({ ) ); }, + errorMessage: 'INVALID_POSTAL_CODE', jsErr: function(X) { let postalCodeError = X.translationService.getTranslation(foam.locale, `${X.countryId.toLowerCase()}.foam.nanos.auth.Address.POSTAL_CODE.error`); if ( ! postalCodeError ) { @@ -740,6 +765,7 @@ foam.CLASS({ ) ); }, + errorMessage: 'INVALID_POSTAL_CODE', jsErr: function(X) { let postalCodeError = X.translationService.getTranslation(foam.locale, `${X.countryId.toLowerCase()}.foam.nanos.auth.Address.POSTAL_CODE.error`); if ( ! postalCodeError ) { @@ -760,6 +786,7 @@ foam.CLASS({ ) ); }, + errorMessage: 'INVALID_POSTAL_CODE', jsErr: function(X) { let postalCodeError = X.translationService.getTranslation(foam.locale, `${X.countryId.toLowerCase()}.foam.nanos.auth.Address.POSTAL_CODE.error`); if ( ! postalCodeError ) { @@ -780,6 +807,7 @@ foam.CLASS({ ) ); }, + errorMessage: 'INVALID_POSTAL_CODE', jsErr: function(X) { let postalCodeError = X.translationService.getTranslation(foam.locale, `${X.countryId.toLowerCase()}.foam.nanos.auth.Address.POSTAL_CODE.error`); if ( ! postalCodeError ) { @@ -800,6 +828,7 @@ foam.CLASS({ ) ); }, + errorMessage: 'INVALID_POSTAL_CODE', jsErr: function(X) { let postalCodeError = X.translationService.getTranslation(foam.locale, `${X.countryId.toLowerCase()}.foam.nanos.auth.Address.POSTAL_CODE.error`); if ( ! postalCodeError ) { @@ -820,6 +849,7 @@ foam.CLASS({ ) ); }, + errorMessage: 'INVALID_POSTAL_CODE', jsErr: function(X) { let postalCodeError = X.translationService.getTranslation(foam.locale, `${X.countryId.toLowerCase()}.foam.nanos.auth.Address.POSTAL_CODE.error`); if ( ! postalCodeError ) { @@ -840,6 +870,7 @@ foam.CLASS({ ) ); }, + errorMessage: 'INVALID_POSTAL_CODE', jsErr: function(X) { let postalCodeError = X.translationService.getTranslation(foam.locale, `${X.countryId.toLowerCase()}.foam.nanos.auth.Address.POSTAL_CODE.error`); if ( ! postalCodeError ) { @@ -860,6 +891,7 @@ foam.CLASS({ ) ); }, + errorMessage: 'INVALID_POSTAL_CODE', jsErr: function(X) { let postalCodeError = X.translationService.getTranslation(foam.locale, `${X.countryId.toLowerCase()}.foam.nanos.auth.Address.POSTAL_CODE.error`); if ( ! postalCodeError ) {