Loading public/javascript/app/base/views/_SettingsHandler.js 0 → 100644 +78 −0 Original line number Diff line number Diff line define([ 'dojo/_base/declare' , 'dojo/_base/lang' , 'dojo/aspect' , 'redmic/modules/base/_ListenQueryParams' , 'redmic/modules/base/_Selection' ], function( declare , lang , aspect , _ListenQueryParams , _Selection ) { return declare([_Selection, _ListenQueryParams], { // summary: // Reconoce un identificador de settings para aplicarlos a la vista actual. constructor: function(args) { this.config = { settingsHandlerActions: { CLONE_SELECTION: 'cloneSelection' }, settingsHandlerEvents: { CLONE_SELECTION: 'cloneSelection' } }; lang.mixin(this, this.config, args); aspect.before(this, '_mixEventsAndActions', this._mixSettingsHandlerEventsAndActionsView); aspect.after(this, '_definePublications', this._defineSettingsHandlerPublications); }, _mixSettingsHandlerEventsAndActionsView: function() { lang.mixin(this.events, this.settingsHandlerEvents); lang.mixin(this.actions, this.settingsHandlerActions); delete this.settingsHandlerEvents; delete this.settingsHandlerActions; }, _defineSettingsHandlerPublications: function() { this.publicationsConfig.push({ event: 'CLONE_SELECTION', channel: this._buildChannel(this.selectorChannel, this.actions.CLONE_SELECTION) }); }, postCreate: function() { this.inherited(arguments); this._emitEvt('GET_QUERY_PARAMS'); }, _gotQueryParam: function(param, value) { if (param === 'settings-id') { this._onSettingsIdReceived(value); } }, _onSettingsIdReceived: function(settingsId) { this._emitEvt('CLEAR_SELECTION', { omitPersistence: true }); this._emitEvt('CLONE_SELECTION', { target: this.selectionTarget || this.target, id: settingsId }); } }); }); public/javascript/app/base/views/_View.js +12 −13 Original line number Diff line number Diff line Loading @@ -4,14 +4,17 @@ define([ , "dojo/aspect" , "app/base/views/_ListenRequestError" , "app/base/views/_ViewHandle" // QUITAR ,'./_SettingsHandler' ], function( declare , lang , aspect , _ListenRequestError , _ViewHandle // QUITAR , _SettingsHandler ) { return declare([_ListenRequestError, _ViewHandle], { return declare([_ListenRequestError, _ViewHandle, _SettingsHandler], { // summary: // Base común para todas los módulos usados como vistas. Loading @@ -23,32 +26,28 @@ define([ constructor: function(args) { this.config = { title: 'View', ownChannel: "view", region: "center", baseClass: "", viewActions: { PUT_META_TAGS: "putMetaTags" }, viewEvents: { PUT_META_TAGS: "putMetaTags" } }, title: 'View' }; lang.mixin(this, this.config, args); this._initializeView && aspect.before(this, "_initialize", this._initializeView); this._mixEventsAndActionsView && aspect.before(this, "_mixEventsAndActions", this._mixEventsAndActionsView); this._doEvtFacadeView && aspect.before(this, "_doEvtFacade", this._doEvtFacadeView); this._setOwnCallbacksForEventsView && aspect.before(this, "_setOwnCallbacksForEvents", this._setOwnCallbacksForEventsView); this._defineViewSubscriptions && aspect.after(this, "_defineSubscriptions", this._defineViewSubscriptions); this._defineViewPublications && aspect.after(this, "_definePublications", this._defineViewPublications); this._initializeView && aspect.before(this, "_initialize", this._initializeView); aspect.after(this, "_definePublications", this._defineViewPublications); aspect.before(this, "_beforeShow", this._beforeShowView); aspect.before(this, "_afterShow", this._afterShowView); }, Loading public/javascript/app/products/views/OpenMapView.js +1 −1 Original line number Diff line number Diff line Loading @@ -34,7 +34,7 @@ define([ this.config = { title: this.i18n.map, region: "center", selectionTarget: redmicConfig.services.atlasLayer selectionTarget: redmicConfig.services.atlasLayerSelection }; lang.mixin(this, this.config, args); Loading public/javascript/redmic/modules/selection/SelectionBox.js +28 −3 Original line number Diff line number Diff line define([ 'dojo/_base/declare' , 'dojo/_base/lang' , 'dojo/Deferred' , 'put-selector/put' , 'redmic/base/Credentials' , 'redmic/modules/base/_ListenQueryParams' , 'redmic/modules/base/_Module' , 'redmic/modules/base/_Show' , 'redmic/modules/base/_Selection' Loading @@ -13,8 +15,10 @@ define([ ], function( declare , lang , Deferred , put , Credentials , _ListenQueryParams , _Module , _Show , _Selection Loading @@ -24,7 +28,7 @@ define([ , SelectionManager ) { return declare([_Module, _Show, _Selection], { return declare([_Module, _Show, _Selection, _ListenQueryParams], { // summary: // Indicador del número de seleccionados con botones asociados. // description: Loading @@ -47,6 +51,9 @@ define([ }; lang.mixin(this, this.config, args); // TODO apaño temporal, hasta que se desvincule la petición de seleccionados de este módulo this._settingsIdDfd = new Deferred(); }, _setConfigurations: function() { Loading Loading @@ -123,6 +130,9 @@ define([ sourceNode: this.domNode }); // TODO apaño temporal, hasta que se desvincule la petición de seleccionados de este módulo this._emitEvt('GET_QUERY_PARAMS'); this.inherited(arguments); }, Loading @@ -135,6 +145,16 @@ define([ } }, // TODO apaño temporal, hasta que se desvincule la petición de seleccionados de este módulo _gotQueryParams: function(queryParams) { if (queryParams['settings-id']) { this._settingsIdDfd.cancel(); } else { this._settingsIdDfd.resolve(); } }, _subRefresh: function(req) { var selectionTarget = req.selectionTarget; Loading @@ -145,8 +165,13 @@ define([ selectionTarget: selectionTarget }); // TODO apaño temporal, hasta que se desvincule la petición de seleccionados de este módulo this._settingsIdDfd.then(lang.hitch(this, function() { // TODO esto no debería ser responsabilidad de SelectionBox, sería mejor que lo hiciera la vista, por ejemplo this._clearSelection(); this._emitEvt('GROUP_SELECTED'); })); }, _isRegisteredUser: function(item) { Loading Loading
public/javascript/app/base/views/_SettingsHandler.js 0 → 100644 +78 −0 Original line number Diff line number Diff line define([ 'dojo/_base/declare' , 'dojo/_base/lang' , 'dojo/aspect' , 'redmic/modules/base/_ListenQueryParams' , 'redmic/modules/base/_Selection' ], function( declare , lang , aspect , _ListenQueryParams , _Selection ) { return declare([_Selection, _ListenQueryParams], { // summary: // Reconoce un identificador de settings para aplicarlos a la vista actual. constructor: function(args) { this.config = { settingsHandlerActions: { CLONE_SELECTION: 'cloneSelection' }, settingsHandlerEvents: { CLONE_SELECTION: 'cloneSelection' } }; lang.mixin(this, this.config, args); aspect.before(this, '_mixEventsAndActions', this._mixSettingsHandlerEventsAndActionsView); aspect.after(this, '_definePublications', this._defineSettingsHandlerPublications); }, _mixSettingsHandlerEventsAndActionsView: function() { lang.mixin(this.events, this.settingsHandlerEvents); lang.mixin(this.actions, this.settingsHandlerActions); delete this.settingsHandlerEvents; delete this.settingsHandlerActions; }, _defineSettingsHandlerPublications: function() { this.publicationsConfig.push({ event: 'CLONE_SELECTION', channel: this._buildChannel(this.selectorChannel, this.actions.CLONE_SELECTION) }); }, postCreate: function() { this.inherited(arguments); this._emitEvt('GET_QUERY_PARAMS'); }, _gotQueryParam: function(param, value) { if (param === 'settings-id') { this._onSettingsIdReceived(value); } }, _onSettingsIdReceived: function(settingsId) { this._emitEvt('CLEAR_SELECTION', { omitPersistence: true }); this._emitEvt('CLONE_SELECTION', { target: this.selectionTarget || this.target, id: settingsId }); } }); });
public/javascript/app/base/views/_View.js +12 −13 Original line number Diff line number Diff line Loading @@ -4,14 +4,17 @@ define([ , "dojo/aspect" , "app/base/views/_ListenRequestError" , "app/base/views/_ViewHandle" // QUITAR ,'./_SettingsHandler' ], function( declare , lang , aspect , _ListenRequestError , _ViewHandle // QUITAR , _SettingsHandler ) { return declare([_ListenRequestError, _ViewHandle], { return declare([_ListenRequestError, _ViewHandle, _SettingsHandler], { // summary: // Base común para todas los módulos usados como vistas. Loading @@ -23,32 +26,28 @@ define([ constructor: function(args) { this.config = { title: 'View', ownChannel: "view", region: "center", baseClass: "", viewActions: { PUT_META_TAGS: "putMetaTags" }, viewEvents: { PUT_META_TAGS: "putMetaTags" } }, title: 'View' }; lang.mixin(this, this.config, args); this._initializeView && aspect.before(this, "_initialize", this._initializeView); this._mixEventsAndActionsView && aspect.before(this, "_mixEventsAndActions", this._mixEventsAndActionsView); this._doEvtFacadeView && aspect.before(this, "_doEvtFacade", this._doEvtFacadeView); this._setOwnCallbacksForEventsView && aspect.before(this, "_setOwnCallbacksForEvents", this._setOwnCallbacksForEventsView); this._defineViewSubscriptions && aspect.after(this, "_defineSubscriptions", this._defineViewSubscriptions); this._defineViewPublications && aspect.after(this, "_definePublications", this._defineViewPublications); this._initializeView && aspect.before(this, "_initialize", this._initializeView); aspect.after(this, "_definePublications", this._defineViewPublications); aspect.before(this, "_beforeShow", this._beforeShowView); aspect.before(this, "_afterShow", this._afterShowView); }, Loading
public/javascript/app/products/views/OpenMapView.js +1 −1 Original line number Diff line number Diff line Loading @@ -34,7 +34,7 @@ define([ this.config = { title: this.i18n.map, region: "center", selectionTarget: redmicConfig.services.atlasLayer selectionTarget: redmicConfig.services.atlasLayerSelection }; lang.mixin(this, this.config, args); Loading
public/javascript/redmic/modules/selection/SelectionBox.js +28 −3 Original line number Diff line number Diff line define([ 'dojo/_base/declare' , 'dojo/_base/lang' , 'dojo/Deferred' , 'put-selector/put' , 'redmic/base/Credentials' , 'redmic/modules/base/_ListenQueryParams' , 'redmic/modules/base/_Module' , 'redmic/modules/base/_Show' , 'redmic/modules/base/_Selection' Loading @@ -13,8 +15,10 @@ define([ ], function( declare , lang , Deferred , put , Credentials , _ListenQueryParams , _Module , _Show , _Selection Loading @@ -24,7 +28,7 @@ define([ , SelectionManager ) { return declare([_Module, _Show, _Selection], { return declare([_Module, _Show, _Selection, _ListenQueryParams], { // summary: // Indicador del número de seleccionados con botones asociados. // description: Loading @@ -47,6 +51,9 @@ define([ }; lang.mixin(this, this.config, args); // TODO apaño temporal, hasta que se desvincule la petición de seleccionados de este módulo this._settingsIdDfd = new Deferred(); }, _setConfigurations: function() { Loading Loading @@ -123,6 +130,9 @@ define([ sourceNode: this.domNode }); // TODO apaño temporal, hasta que se desvincule la petición de seleccionados de este módulo this._emitEvt('GET_QUERY_PARAMS'); this.inherited(arguments); }, Loading @@ -135,6 +145,16 @@ define([ } }, // TODO apaño temporal, hasta que se desvincule la petición de seleccionados de este módulo _gotQueryParams: function(queryParams) { if (queryParams['settings-id']) { this._settingsIdDfd.cancel(); } else { this._settingsIdDfd.resolve(); } }, _subRefresh: function(req) { var selectionTarget = req.selectionTarget; Loading @@ -145,8 +165,13 @@ define([ selectionTarget: selectionTarget }); // TODO apaño temporal, hasta que se desvincule la petición de seleccionados de este módulo this._settingsIdDfd.then(lang.hitch(this, function() { // TODO esto no debería ser responsabilidad de SelectionBox, sería mejor que lo hiciera la vista, por ejemplo this._clearSelection(); this._emitEvt('GROUP_SELECTED'); })); }, _isRegisteredUser: function(item) { Loading