Ignore:
Timestamp:
02/20/12 16:27:19 (13 years ago)
Author:
hendrikvanantwerpen
Message:
  • [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.
Location:
Dev/branches/rest-dojo-ui/client/rft/ui
Files:
2 added
2 deleted
3 edited
1 copied

Legend:

Unmodified
Added
Removed
  • Dev/branches/rest-dojo-ui/client/rft/ui/LoginDialog.html

    r263 r274  
    99        <form data-dojo-type="dijit.form.Form" data-dojo-attach-point="loginForm">
    1010            <fieldset>
    11                 <label for="username" class="loginLabel">Email</label>
    12                 <input data-dojo-type="dijit.form.TextBox" name="username" type="text" class="loginInput" />
     11                <label for="email" class="loginLabel">Email</label>
     12                <input data-dojo-type="dijit.form.TextBox" name="email" type="text" class="loginInput" />
    1313                <label for="password" class="loginLabel">Password</label>
    1414                <input data-dojo-type="dijit.form.TextBox" name="password" type="password" class="loginInput" />
    1515            </fieldset>
    16             <button type="submit" data-dojo-type="dijit.form.Button" data-dojo-attach-event="onClick:onLogin">Login</button>
    17             <button type="button" data-dojo-type="dijit.form.Button" data-dojo-attach-event="onClick:onCancel">Cancel</button>
     16            <div style="float: right;">
     17                <button type="button" data-dojo-type="dijit.form.Button" data-dojo-attach-event="onClick:onRegister">Register</button>
     18                <button type="submit" data-dojo-type="dijit.form.Button" data-dojo-attach-event="onClick:onLogin">Login</button>
     19            </div>
    1820        </form>
    19         <div data-dojo-attach-point="loginErrors"></div>
     21        <div data-dojo-attach-point="loginErrors" style="clear: both; color: red;"></div>
    2022    </div>
    2123</div>
  • Dev/branches/rest-dojo-ui/client/rft/ui/LoginDialog.js

    r263 r274  
    66            templateString: template,
    77            widgetsInTemplate: true,
    8             title: "Login",
     8            title: "Login/Register",
    99            baseClass: "rftLoginDialog",
    1010            startup: function() {
     
    2020                this.loginErrors.innerHTML = '';
    2121                var data = this.loginForm.get('value');
    22                 auth.login(data.username,data.password)
     22                auth.login(data.email,data.password)
    2323                .then(lang.hitch(this,function() {
    2424                    this.hide();
     
    2929                event.stop(evt);
    3030                return false;
     31            },
     32            onRegister: function() {
     33                this.loginErrors.innerHTML = '';
     34                var data = this.loginForm.get('value');
     35                auth.register(data.email,data.password)
     36                .then(lang.hitch(this,function() {
     37                    this.hide();
     38                    content.initial();
     39                }),lang.hitch(this,function() {
     40                    this.loginErrors.innerHTML = 'Register failed.';
     41                }));
    3142            }
    3243        });
  • Dev/branches/rest-dojo-ui/client/rft/ui/MenuLink.js

    r270 r274  
    1 define(['dojo/_base/declare','dijit/MenuBarItem','../content'],
    2 function(declare,MenuBarItem,content){
    3     return declare('rft.ui.MenuBarLink',[MenuBarItem],{
     1define(['dojo/_base/declare','dijit/MenuItem','../content'],
     2function(declare,MenuItem,content){
     3    return declare('rft.ui.MenuLink',[MenuItem],{
    44        options:{
    55            pageId: null
  • Dev/branches/rest-dojo-ui/client/rft/ui/_Page.js

    r263 r274  
    1 define(['dojo/_base/declare','dojo/_base/lang','dojo/_base/array','dojo/parser','dojo/query','dojo/_base/Deferred',
    2     'dijit/_WidgetBase','dijit/_TemplatedMixin','dijit/_WidgetsInTemplateMixin','rft/ui/_PageController'],
    3     function(declare,lang,array,parser,query,Deferred,_WidgetBase,_TemplatedMixin,_WidgetsInTemplateMixin,_PageController){
    4         return declare('rft.ui._Page',[_WidgetBase,_TemplatedMixin,_WidgetsInTemplateMixin,_PageController],{
    5             _controllerLoaded: false,
    6             _hasStarted: false,
    7             _triggeredOnVisit: false,
    8             pageController: null, /* class derived from rft.ui._PageController, mixed in at creation */
    9             buildRendering: function() {
     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() {
    105                this.inherited(arguments);
    11                 var dfd = new Deferred();
    12                 var mixinType = this.domNode.getAttribute("data-rft-mixin");
    13                 if ( mixinType ) {
    14                     require([mixinType],lang.hitch(this,function(SomePageController){
    15                         declare.safeMixin(this,new SomePageController());
    16                         dfd.resolve();
    17                     }));
    18                 } else {
    19                     dfd.resolve();
    20                 }
    21                 dfd.then(lang.hitch(this,function(){
    22                     var methods = query('> script[type^="rft/method"]',this.domNode).orphan();
    23                     array.forEach(methods,lang.hitch(this,function(s){
    24                         var method = s.getAttribute("data-rft-method");
    25                         var func = parser._functionFromScript(s);
    26                         this[method] = func;
    27                     }));
    28                     this._controllerLoaded = true;
    29                     this._triggerOnVisit();
     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;
    3031                }));
    3132            },
    32             startup: function() {
    33                 this.inherited(arguments);
    34                 this._hasStarted = true;
    35                 this._triggerOnVisit();
    36             },
    37             _triggerOnVisit: function() {
    38                 if ( this._controllerLoaded && this._hasStarted && !this._triggeredOnVisit ) {
    39                     this._triggeredOnVisit = false;
    40                     this.onVisit();
    41                 }
    42             }
     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(){}
    4337        });
    4438    });
Note: See TracChangeset for help on using the changeset viewer.