source: Dev/branches/rest-dojo-ui/client/rft/ui/_Page.js @ 280

Last change on this file since 280 was 274, checked in by hendrikvanantwerpen, 13 years ago
  • [Client] Moved pages in subtree of rft/, allowing controllers next to them.
  • [Client] Created questions page, gives overview and allows adding.
  • [Client] Page controllers inherit from _Page, because the previous mechanism w

asn't working.

  • [Client] Added new user registration.
  • [Server] Changed user passwords to passwordHash/passwordSalt combination.
  • [Server] Added simple object marshalling and unmarshalling to preserve types.
  • [Server] Added ResearchToolObjectInterface? with static create() method. Implemented for all model classes.
File size: 2.1 KB
Line 
1define(['dojo/_base/declare','dojo/_base/lang','dojo/_base/array','dojo/parser','dojo/query','dojo/dom-attr','dojo/_base/connect','dijit','dijit/_WidgetBase','dijit/_Container','dijit/_Contained'],
2    function(declare,lang,array,parser,query,attr,connect,dijit,_WidgetBase,_Container,_Contained){
3        return declare('rft.ui._Page',[_WidgetBase],{
4            startup: function() {
5                this.inherited(arguments);
6                this._attachPointsAndEvents();
7                this.onVisit();
8            },
9            _attachPointsAndEvents: function() {
10                query('*[data-rft-attach-point]'/*, this.domNode*/).forEach(lang.hitch(this,function(node){
11                    var point = attr.get(node,'data-rft-attach-point');
12                    var widget = dijit.byId(attr.get(node,'id'));
13                    this[point] = widget || node;
14                }));
15                query('*[data-rft-attach-event]'/*, this.domNode*/).forEach(lang.hitch(this,function(node){
16                    var event = attr.get(node,'data-rft-attach-event').split(':');
17                    var eventName = event[0];
18                    var eventHandler = event[1];
19                    var widget = dijit.byId(attr.get(node,'id'));
20                    if ( widget ) {
21                        this.connect(widget,eventName,lang.hitch(this,eventHandler));
22                    } else {
23                        this.connect(node,eventName,lang.hitch(this,eventHandler));
24                    }
25                }));
26                query('> script[type^="rft/method"]',this.domNode)
27                .orphan().forEach(lang.hitch(this,function(s){
28                    var methodName = s.getAttribute("data-rft-method");
29                    var func = parser._functionFromScript(s);
30                    this[methodName] = func;
31                }));
32            },
33            /** Event fired after startup of all widgets is complete */
34            onVisit: function(){},
35            /** Event fired before leaving the page. Return false to prevent */
36            onLeave: function(){}
37        });
38    });
Note: See TracBrowser for help on using the repository browser.