Author: jmorliaguet Date: Mon Feb 27 16:17:33 2006 New Revision: 2491 Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js Log:
- fix: a same controller may control several views. - PerspectiveSelector: we register which views are visible for each perspective. Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js ============================================================================== --- cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js Mon Feb 27 16:17:33 2006 @@ -285,7 +285,7 @@ var evt_id = "registered controller " + c; CPSSkins.registerEventHandler(evt_id, view, function(event) { var controller = event.publisher; - controller.view = view; + controller.views.push(view); controller.register(view); CPSSkins.unsubscribe(evt_id); }); @@ -399,6 +399,7 @@ initialize: function(node, def) { this.node = this.node; this.def = def; + this.views = []; }, setup: function() { @@ -511,16 +512,17 @@ }, submitEvent: function(e) { - var view = this.view; - var model = this.view.model; - var widget = this.view.widget; + $A(this.views).each(function(view) { + var model = this.view.model; + var widget = this.view.widget; + + var form_data = {}; + $A(Form.getInputs(widget)).each(function(i) { + form_data[i.name] = Form.Element.getValue(i); + }); - var form_data = {}; - $A(Form.getInputs(widget)).each(function(i) { - form_data[i.name] = Form.Element.getValue(i); + model.setData(form_data); }); - - model.setData(form_data); return false; } @@ -618,9 +620,17 @@ new CPSSkins.Controller(), { setup: function() { + this._perspectives = {}; }, register: function(view) { + var perspectives = this._perspectives; + $A(view.def.perspectives).each(function(p) { + if (!(p in perspectives)) { + perspectives[p] = []; + } + perspectives[p].push(view); + }); } }); -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins