Index: Dev/branches/rest-dojo-ui/client/index.html
===================================================================
--- Dev/branches/rest-dojo-ui/client/index.html	(revision 273)
+++ Dev/branches/rest-dojo-ui/client/index.html	(revision 274)
@@ -13,17 +13,22 @@
     <body class="claro">
         <div id="header" class="mainHeader">
-            <div id="title" class="mainTitle">Research Facilitator Tool</div>
             <div id="menu" class="mainMenu"  data-dojo-type="dijit.MenuBar">
-                <span data-dojo-type="rft.ui.MenuBarLink" data-dojo-props="pageId:'sessions'">Sessions</span>
-                <span data-dojo-type="rft.ui.MenuBarLink" data-dojo-props="pageId:'surveys'">Surveys</span>
-                <span data-dojo-type="rft.ui.MenuBarLink" data-dojo-props="pageId:'results'">Results</span>
-                <span data-dojo-type="rft.ui.MenuBarLink" data-dojo-props="pageId:'test1'">Test 1</span>
-                <span data-dojo-type="rft.ui.MenuBarLink" data-dojo-props="pageId:'test2'">Test 2</span>
-                <span data-dojo-type="rft.ui.MenuBarLink" data-dojo-props="pageId:'test3'">Test 3</span>
+                <div data-dojo-type="dijit.MenuBarItem" data-dojo-props="disabled: true">Research Facilitator Tool</div>
+                <div data-dojo-type="rft.ui.MenuBarLink" data-dojo-props="pageId:'sessions'">Sessions</div>
+                <div data-dojo-type="dijit.PopupMenuBarItem">
+                    <span>Content</span>
+                    <div data-dojo-type="dijit.DropDownMenu">
+                        <div data-dojo-type="rft.ui.MenuLink" data-dojo-props="pageId:'surveys'">Surveys</div>
+                        <div data-dojo-type="rft.ui.MenuLink" data-dojo-props="pageId:'questions'">Questions</div>
+                        <div data-dojo-type="rft.ui.MenuLink" data-dojo-props="pageId:'applications'">Applications</div>
+                        <div data-dojo-type="rft.ui.MenuLink" data-dojo-props="pageId:'dashboards'">Dashboards</div>
+                    </div>
+                </div>
+                <div data-dojo-type="rft.ui.MenuBarLink" data-dojo-props="pageId:'results'">Results</div>
+                <div data-dojo-type="dijit.MenuBarItem" id="loginMenu" style="float:right;">Login/Register</div>
             </div>
-            <div id="userinfo" class="mainUserInfo">Login</div>
         </div>
 
-        <div id="content" data-dojo-type="dijit.layout.ContentPane">
+        <div id="content" data-dojo-type="dijit.layout.ContentPane" style="width: 100%; height: 100%;">
         </div>
 
Index: Dev/branches/rest-dojo-ui/client/rft/api.js
===================================================================
--- Dev/branches/rest-dojo-ui/client/rft/api.js	(revision 273)
+++ Dev/branches/rest-dojo-ui/client/rft/api.js	(revision 274)
@@ -10,52 +10,5 @@
                 rawBody: json.toJson(args)
             });
-        },
-        createObject: function(type, args) {
-            var d = new Deferred();
-            this.post("createObject",
-            {
-                type: type,
-                values: args
-            })
-            .then(function(data) {
-                d.resolve(data.uid);
-            },function(){
-                d.reject(); 
-            });
-            return d.promise;
-        },
-        getObject: function(type, uid) {
-            var d = new Deferred();
-            this.post("getObject",
-            {
-                type: type,
-                uid: uid
-            })
-            .then(function(data) {
-                d.resolve(data.object);
-            },function(){
-                d.reject(); 
-            });
-            return d.promise;
-        },
-        getObjects: function(type, predicates) {
-            var d = new Deferred();
-            this.post("getObjects",
-            {
-                type: type,
-                predicates: predicates
-            })
-            .then(function(data) {
-                d.resolve(data.objects);
-            },function(){
-                d.reject(); 
-            });
-            return d.promise;
-        },
-        deleteObject: function(type, uid) {
-            var d = new Deferred();
-            d.reject();
-            return d.promise;
         }
-    }
+    };
 });
Index: Dev/branches/rest-dojo-ui/client/rft/auth.js
===================================================================
--- Dev/branches/rest-dojo-ui/client/rft/auth.js	(revision 273)
+++ Dev/branches/rest-dojo-ui/client/rft/auth.js	(revision 274)
@@ -20,5 +20,5 @@
                 post("/login",
                 {
-                    username:username,
+                    email:username,
                     password:password
                 })
@@ -49,5 +49,5 @@
                 post("/register",
                 {
-                    username:username,
+                    email:username,
                     password:password
                 })
Index: Dev/branches/rest-dojo-ui/client/rft/content.js
===================================================================
--- Dev/branches/rest-dojo-ui/client/rft/content.js	(revision 273)
+++ Dev/branches/rest-dojo-ui/client/rft/content.js	(revision 274)
@@ -92,4 +92,5 @@
                         return dfd.promise;
                     }
+                    currentPage = null;
                 }
                 
@@ -99,5 +100,5 @@
                 
                 // load html
-                var pageUrl = 'pages'+hri.path()+'.html';
+                var pageUrl = 'rft/pages'+hri.path()+'.html';
                 xhr.get({
                     url: pageUrl,
@@ -107,15 +108,13 @@
                 // initialize page or create error message
                 .then(function(html){
-                    currentPage = new _Page({
-                        templateString: html,
-                        pageQuery: hri.args()
-                    });
-                    contentPane.set('content',currentPage);
+                    contentPane.set('content',html);
+                    var rootNode = contentPane.containerNode.firstChild;
+                    currentPage = dijit.byNode(rootNode);
+                    if ( !currentPage ) {
+                        currentPage = new _Page({},rootNode);
+                    }
                     dfd.resolve();
                 },function(){
-                    currentPage = new _Page({
-                        templateString: "<div>Page "+hri.path()+" not found.</div>"
-                    });
-                    contentPane.set('content',currentPage);
+                    contentPane.set('content',"<div>Page "+hri.path()+" not found.</div>");
                     dfd.reject();
                 });
Index: Dev/branches/rest-dojo-ui/client/rft/css/main.css
===================================================================
--- Dev/branches/rest-dojo-ui/client/rft/css/main.css	(revision 273)
+++ Dev/branches/rest-dojo-ui/client/rft/css/main.css	(revision 274)
@@ -5,23 +5,6 @@
 }
 
-.mainTitle {
-    display: block;
-    float: left;
-    border-right: 1px solid;
-    padding-right: 5px;
-    margin-right: 5px;
-}
-
 .mainMenu {
-    display: block;
-    float: left;
-}
-
-.mainUserInfo {
-    display: block;
-    float: right;
-    border-left: 1px solid;
-    padding-left: 5px;
-    margin-left: 5px;
+    width: 100%;
 }
 
Index: Dev/branches/rest-dojo-ui/client/rft/pages/index.html
===================================================================
--- Dev/branches/rest-dojo-ui/client/rft/pages/index.html	(revision 274)
+++ Dev/branches/rest-dojo-ui/client/rft/pages/index.html	(revision 274)
@@ -0,0 +1,3 @@
+<div>
+    <h1>Index pagina</h1>
+</div>
Index: Dev/branches/rest-dojo-ui/client/rft/pages/questions.html
===================================================================
--- Dev/branches/rest-dojo-ui/client/rft/pages/questions.html	(revision 274)
+++ Dev/branches/rest-dojo-ui/client/rft/pages/questions.html	(revision 274)
@@ -0,0 +1,25 @@
+<div data-dojo-type="rft.pages.questions">
+    <h1>Questions</h1>
+    <div data-dojo-type="dijit.form.Button" data-rft-attach-event="onClick:onNewQuestion">New question</div>
+    <div data-dojo-type="dijit.layout.AccordionContainer" data-dojo-props="doLayout: false" style="width: 100%; height: 100%;" data-rft-attach-point="accordion">
+    </div>
+    <div data-dojo-type="dijit.Dialog" title="Question" data-rft-attach-point="questionDialog" style="width: 400px; height: 300px;">
+        <form data-dojo-type="dijit.form.Form" data-rft-attach-point="questionForm" data-rft-attach-event="onSubmit:onSaveQuestion">
+            <fieldset>
+                <input data-dojo-type="dijit.form.TextBox" name="uid" type="text" class="dijitHidden" />
+                <label for="code" class="loginLabel">Code</label>
+                <input data-dojo-type="dijit.form.TextBox" name="code" type="text" class="loginInput" />
+                <label for="question" class="loginLabel">Title</label>
+                <input data-dojo-type="dijit.form.TextBox" name="title" type="text" class="loginInput" />
+                <label for="question" class="loginLabel">Description</label>
+                <input data-dojo-type="dijit.form.Textarea" name="description" type="text" class="loginInput"/>
+                <label for="category" class="loginLabel">Category</label>
+                <input data-dojo-type="dijit.form.TextBox" name="category" type="text" class="loginInput" />
+            </fieldset>
+            <div style="float: right;">
+                <button type="button" data-dojo-type="dijit.form.Button" data-rft-attach-event="onClick:onCancelQuestion">Cancel</button>
+                <button type="submit" data-dojo-type="dijit.form.Button">Save</button>
+            </div>
+        </form>
+    </div>
+</div>
Index: Dev/branches/rest-dojo-ui/client/rft/pages/questions.js
===================================================================
--- Dev/branches/rest-dojo-ui/client/rft/pages/questions.js	(revision 274)
+++ Dev/branches/rest-dojo-ui/client/rft/pages/questions.js	(revision 274)
@@ -0,0 +1,80 @@
+define(['dojo/_base/declare','dojo/_base/lang','dojo/_base/array','dojo/_base/event',
+    'dojo/_base/Deferred','dojo/store/JsonRest','dijit/layout/ContentPane',
+    'rft/ui/_Page','rft/ui/QuestionWidget'],
+    function(declare,lang,array,event,Deferred,JsonRest,ContentPane,_Page,QuestionWidget) {
+        return declare('rft.pages.questions',[_Page],{
+            constructor: function() {
+                this.inherited(arguments);
+                this.containers = {};
+                this.questions = {};
+            },
+            onVisit: function() {
+                this._store = new JsonRest({
+                    target:"../server/api.php/data/Question/",
+                    idProperty: 'uid'
+                });
+                this._refresh();
+            },
+            _refresh: function() {
+                Deferred.when( this._store.query() ).then(lang.hitch(this,function(results){
+                    array.forEach(results,lang.hitch(this,'_addQuestion'));
+                }));
+            },
+            _getContainerForQuestion: function(q) {
+                var category = q.category || 'Unsorted';
+                var categoryContainer = this.containers[category];
+                if ( !categoryContainer ) {
+                    var ac = new ContentPane({
+                        title:category
+                    });
+                    categoryContainer = this.containers[category] = {
+                        container: ac
+                    };
+                    ac.placeAt(this.accordion);
+                    ac.startup();
+                }
+                return categoryContainer.container;
+            },
+            _addQuestion: function(q) {
+                var uid = q.uid;
+                var question = this.questions[uid];
+                if ( !question ) {
+                    var qw = new QuestionWidget({
+                        question: q
+                    });
+                    qw.startup();
+                    question = this.questions[uid] = {
+                        question: q,
+                        widget: qw
+                    }
+                }
+                var container = this._getContainerForQuestion(q);
+                question.widget.placeAt(container.containerNode);
+                container.resize();
+            },
+            onNewQuestion: function() {
+                Deferred.when( this._store.add({}) )
+                .then(lang.hitch(this,function(question){
+                    this.questionForm.reset();
+                    this.questionForm.set('value',question);
+                    this.questionDialog.show();
+                }));
+            },
+            onSaveQuestion: function(evt) {
+                var value = this.questionForm.get('value');
+                Deferred.when( this._store.put(value) )
+                .then(lang.hitch(this,function(){
+                    this.questionDialog.hide();
+                    this.questionForm.reset();
+                    this._refresh();
+                }));
+                event.stop(evt);
+                return false;
+            },
+            onCancelQuestion: function() {
+                this.questionDialog.hide();
+                this.questionForm.reset();
+                this._refresh();
+            }
+        });
+    });
Index: Dev/branches/rest-dojo-ui/client/rft/pages/session.html
===================================================================
--- Dev/branches/rest-dojo-ui/client/rft/pages/session.html	(revision 274)
+++ Dev/branches/rest-dojo-ui/client/rft/pages/session.html	(revision 274)
@@ -0,0 +1,23 @@
+<div>
+    <script type="dojo/method" data-dojo-event="onVisit">
+        var that = this;
+        debugger;
+        require(['dojo/_base/json','dojo/dom','dojo/store/JsonRest','dojo/domReady!'],
+            function(json,dom,JsonRest){
+                var store = new JsonRest({
+                    target:"../server/api.php/data/Session/",
+                    idProperty: 'uid'
+                });
+                store.get(that.args.uid).then(function(obj){
+                    that.page_session_form.innerHTML = json.toJson(obj);
+                });
+            });
+    </script>
+    <div class="largeFrame" style="width: 400px;">
+        <div class="largeTitle">Session</div>
+        <div class="content">
+            <div data-rft-attach-point="page_session_form"></div>
+        </div>
+    </div>
+
+</div>
Index: Dev/branches/rest-dojo-ui/client/rft/pages/sessions.html
===================================================================
--- Dev/branches/rest-dojo-ui/client/rft/pages/sessions.html	(revision 274)
+++ Dev/branches/rest-dojo-ui/client/rft/pages/sessions.html	(revision 274)
@@ -0,0 +1,58 @@
+<div>
+    <script type="rft/method" data-rft-method="onVisit">
+        var that = this;
+        require(['dojo/_base/lang','dojo/_base/event','dojo/store/JsonRest','dojox/grid/DataGrid',
+        Â Â Â Â 'dojo/data/ObjectStore','rft/content','dojo/domReady!'],
+        function(lang,event,JsonRest,DataGrid,ObjectStore,content){
+            var store = new JsonRest({
+                target:"../server/api.php/data/Session/",
+                idProperty: 'uid'
+            });
+
+            that.grid.setStore(ObjectStore({objectStore: store}));
+        
+            that.grid.on('rowclick',lang.hitch(that,function(evt){
+                var obj = evt.grid.getItem(evt.rowIndex);
+                this.form.set('value', obj);
+            }));
+
+            that.grid.on('rowdblclick',lang.hitch(that,function(evt){
+                var obj = evt.grid.getItem(evt.rowIndex);
+                content.goTo('/session',{uid:obj.uid});
+            }));
+
+            var submitHandler = lang.hitch(that,function(evt){
+                var newObj = this.form.get('value');
+                debugger;
+                // mixin newObj in obj.
+                // store.put(newObj);
+                event.stop(evt);
+                return false;
+            });
+            that.btnSave.on('click',submitHandler);
+            that.form.on('submit',submitHandler);
+        
+        });
+    </script>
+    <div class="largeFrame" style="width: 400px;">
+        <div class="largeTitle">Sessions</div>
+        <div class="content">
+            <div data-dojo-type="dojox.grid.DataGrid" data-dojo-props="autoWidth:true,autoHeight:true,structure:[{name:'Title',field:'title'}]" data-dojo-attach-point="grid"></div>
+        </div>
+
+    </div>
+
+    <div class="largeFrame" style="width: 400px;">
+        <div class="largeTitle">Details</div>
+        <div>
+            <form data-dojo-type="dijit.form.Form" data-dojo-attach-point="form">
+                <fieldset>
+                    <label for="title" class="loginLabel">Title</label>
+                    <input data-dojo-type="dijit.form.TextBox" name="title" type="text" class="loginInput" />
+                </fieldset>
+                <button type="submit" data-dojo-type="dijit.form.Button" data-dojo-attach-point="btnSave">Save</button>
+            </form>
+        </div>
+    </div>
+
+</div>
Index: Dev/branches/rest-dojo-ui/client/rft/run.js
===================================================================
--- Dev/branches/rest-dojo-ui/client/rft/run.js	(revision 273)
+++ Dev/branches/rest-dojo-ui/client/rft/run.js	(revision 274)
@@ -1,4 +1,7 @@
 require([
     'dijit/form/Form',
+    'dijit/form/TextBox',
+    'dijit/form/Button',
+    'dijit/form/Textarea',
     'dojo/store/JsonRest',
     'dojo/data/ObjectStore',
@@ -6,12 +9,18 @@
     'dijit/layout/ContentPane',
     'dijit/layout/TabContainer',
+    'dijit/layout/AccordionContainer',
     'dijit/MenuBar',
     'dijit/MenuBarItem',
+    'dijit/PopupMenuBarItem',
+    'dijit/DropDownMenu',
     'rft/ui/MenuBarLink',
+    'rft/ui/MenuLink',
+    'rft/ui/QuestionWidget',
+    'rft/pages/questions' // could this be done dynamically?
 ]);
 
 require(['dojo/_base/window','dojo/parser', 'rft/ui/LoginDialog', 
     'dojo/dom', 'dojo/_base/connect', 'rft/auth', 'rft/content',
-    'dojo/domReady!', ],
+    'dojo/domReady!' ],
     function(win,parser,LoginDialog,dom,connect,auth,content) {
         parser.parse();
@@ -27,6 +36,7 @@
         });
 
-        connect.connect(dom.byId('userinfo'),'click',function(){
+        connect.connect(dom.byId('loginMenu'),'click',function(){
             login.show();
         });
+
     });
Index: Dev/branches/rest-dojo-ui/client/rft/ui/LoginDialog.html
===================================================================
--- Dev/branches/rest-dojo-ui/client/rft/ui/LoginDialog.html	(revision 273)
+++ Dev/branches/rest-dojo-ui/client/rft/ui/LoginDialog.html	(revision 274)
@@ -9,13 +9,15 @@
         <form data-dojo-type="dijit.form.Form" data-dojo-attach-point="loginForm">
             <fieldset>
-                <label for="username" class="loginLabel">Email</label>
-                <input data-dojo-type="dijit.form.TextBox" name="username" type="text" class="loginInput" />
+                <label for="email" class="loginLabel">Email</label>
+                <input data-dojo-type="dijit.form.TextBox" name="email" type="text" class="loginInput" />
                 <label for="password" class="loginLabel">Password</label>
                 <input data-dojo-type="dijit.form.TextBox" name="password" type="password" class="loginInput" />
             </fieldset>
-            <button type="submit" data-dojo-type="dijit.form.Button" data-dojo-attach-event="onClick:onLogin">Login</button>
-            <button type="button" data-dojo-type="dijit.form.Button" data-dojo-attach-event="onClick:onCancel">Cancel</button>
+            <div style="float: right;">
+                <button type="button" data-dojo-type="dijit.form.Button" data-dojo-attach-event="onClick:onRegister">Register</button>
+                <button type="submit" data-dojo-type="dijit.form.Button" data-dojo-attach-event="onClick:onLogin">Login</button>
+            </div>
         </form>
-        <div data-dojo-attach-point="loginErrors"></div>
+        <div data-dojo-attach-point="loginErrors" style="clear: both; color: red;"></div>
     </div>
 </div>
Index: Dev/branches/rest-dojo-ui/client/rft/ui/LoginDialog.js
===================================================================
--- Dev/branches/rest-dojo-ui/client/rft/ui/LoginDialog.js	(revision 273)
+++ Dev/branches/rest-dojo-ui/client/rft/ui/LoginDialog.js	(revision 274)
@@ -6,5 +6,5 @@
             templateString: template,
             widgetsInTemplate: true,
-            title: "Login",
+            title: "Login/Register",
             baseClass: "rftLoginDialog",
             startup: function() {
@@ -20,5 +20,5 @@
                 this.loginErrors.innerHTML = '';
                 var data = this.loginForm.get('value');
-                auth.login(data.username,data.password)
+                auth.login(data.email,data.password)
                 .then(lang.hitch(this,function() {
                     this.hide();
@@ -29,4 +29,15 @@
                 event.stop(evt);
                 return false;
+            },
+            onRegister: function() {
+                this.loginErrors.innerHTML = '';
+                var data = this.loginForm.get('value');
+                auth.register(data.email,data.password)
+                .then(lang.hitch(this,function() {
+                    this.hide();
+                    content.initial();
+                }),lang.hitch(this,function() {
+                    this.loginErrors.innerHTML = 'Register failed.';
+                }));
             }
         });
Index: Dev/branches/rest-dojo-ui/client/rft/ui/MenuLink.js
===================================================================
--- Dev/branches/rest-dojo-ui/client/rft/ui/MenuLink.js	(revision 274)
+++ Dev/branches/rest-dojo-ui/client/rft/ui/MenuLink.js	(revision 274)
@@ -0,0 +1,11 @@
+define(['dojo/_base/declare','dijit/MenuItem','../content'],
+function(declare,MenuItem,content){
+    return declare('rft.ui.MenuLink',[MenuItem],{
+        options:{
+            pageId: null
+        },
+        onClick: function(){
+            content.goTo(this.pageId);
+        }
+    });
+});
Index: Dev/branches/rest-dojo-ui/client/rft/ui/QuestionWidget.html
===================================================================
--- Dev/branches/rest-dojo-ui/client/rft/ui/QuestionWidget.html	(revision 274)
+++ Dev/branches/rest-dojo-ui/client/rft/ui/QuestionWidget.html	(revision 274)
@@ -0,0 +1,8 @@
+<div>
+    <h2>Question</h2>
+    <table>
+        <tr><td>Code</td><td data-dojo-attach-point="codeField"></td></tr>
+        <tr><td>Title</td><td data-dojo-attach-point="titleField"></td></tr>
+        <tr><td>Description</td><td data-dojo-attach-point="descriptionField"></td></tr>
+    </table>
+</div>
Index: Dev/branches/rest-dojo-ui/client/rft/ui/QuestionWidget.js
===================================================================
--- Dev/branches/rest-dojo-ui/client/rft/ui/QuestionWidget.js	(revision 274)
+++ Dev/branches/rest-dojo-ui/client/rft/ui/QuestionWidget.js	(revision 274)
@@ -0,0 +1,14 @@
+define(['dojo/_base/declare','dijit/_WidgetBase','dijit/_TemplatedMixin','dijit/_WidgetsInTemplateMixin','dojo/text!rft/ui/QuestionWidget.html'],
+    function(declare,_WidgetBase,_TemplatedMixin,_WidgetsInTemplateMixin,templateString){
+        return declare('rft.ui.QuestionWidget',[_WidgetBase,_TemplatedMixin,_WidgetsInTemplateMixin],{
+            templateString: templateString,
+            question: null,
+            startup: function() {
+                if ( this.question ) {
+                    this.codeField.innerHTML = this.question.code;
+                    this.titleField.innerHTML = this.question.title;
+                    this.descriptionField.innerHTML = this.question.description;
+                }
+            }
+        });
+    });
Index: Dev/branches/rest-dojo-ui/client/rft/ui/TestPageController.js
===================================================================
--- Dev/branches/rest-dojo-ui/client/rft/ui/TestPageController.js	(revision 273)
+++ 	(revision )
@@ -1,73 +1,0 @@
-define(['dojo/_base/declare','dojo/_base/lang','dojo/_base/event','rft/content',
-    'dojo/store/JsonRest','dojo/data/ObjectStore','rft/ui/_PageController','dijit/registry'],
-    function(declare,lang,event,content,JsonRest,ObjectStore,_PageController,registry) {
-        return declare([_PageController],{
-            onVisit: function() {
-                this._store = new JsonRest({
-                    target:"../server/api.php/data/Session/",
-                    idProperty: 'uid'
-                });
-
-                function setEnabledRecursive(node,value) {
-                    registry.findWidgets(node).forEach(function(w){
-                        w.set('disabled',!value);
-                        setEnabledRecursive(w.domNode,value);
-                    });
-                };
-
-                setEnabledRecursive(this.form.domNode,false);
-
-                var refreshGrid = lang.hitch(this,function(){
-                    this.grid.setStore(ObjectStore({
-                        objectStore: this._store
-                    }),'');
-                });
-                refreshGrid();
-                
-                var getSelectedItem = lang.hitch(this,function(evt){
-                    var items = this.grid.selection.getSelected();
-                    if (items.length)
-                        return items[0];
-                    return null;
-                });
-                
-                this.grid.on('rowclick',lang.hitch(this,function(evt){
-                    var obj = getSelectedItem();
-                    if ( obj) {
-                        this.form.set('value', obj);
-                        setEnabledRecursive(this.form.domNode, true);
-                    } else {
-                        setEnabledRecursive(this.form.domNode, false);
-                        this.form.reset();
-                    }
-                }));
-
-                this.grid.on('rowdblclick',lang.hitch(this,function(evt){
-                    var obj = getSelectedItem();
-                    content.goTo('/session',{
-                        uid:obj.uid
-                    });
-                }));
-
-                var submitHandler = lang.hitch(this,function(evt){
-                    this.errors.innerHTML = '';
-                    var newObj = this.form.get('value');
-                    var obj = getSelectedItem();
-                    obj = lang.mixin(obj,newObj);
-                    //this._store.put(newObj,{id:obj.uid})
-                    this._store.put(obj,{
-                        overwrite:true
-                    })
-                    .then(lang.hitch(this,function(){
-                        refreshGrid();
-                    }),lang.hitch(this,function(e){
-                        this.errors.innerHTML = e.toString();
-                    }));
-                    event.stop(evt);
-                    return false;
-                });
-                
-                this.form.on('submit',submitHandler);
-            }
-        });
-    });
Index: Dev/branches/rest-dojo-ui/client/rft/ui/_Page.js
===================================================================
--- Dev/branches/rest-dojo-ui/client/rft/ui/_Page.js	(revision 273)
+++ Dev/branches/rest-dojo-ui/client/rft/ui/_Page.js	(revision 274)
@@ -1,44 +1,38 @@
-define(['dojo/_base/declare','dojo/_base/lang','dojo/_base/array','dojo/parser','dojo/query','dojo/_base/Deferred',
-    'dijit/_WidgetBase','dijit/_TemplatedMixin','dijit/_WidgetsInTemplateMixin','rft/ui/_PageController'],
-    function(declare,lang,array,parser,query,Deferred,_WidgetBase,_TemplatedMixin,_WidgetsInTemplateMixin,_PageController){
-        return declare('rft.ui._Page',[_WidgetBase,_TemplatedMixin,_WidgetsInTemplateMixin,_PageController],{
-            _controllerLoaded: false,
-            _hasStarted: false,
-            _triggeredOnVisit: false,
-            pageController: null, /* class derived from rft.ui._PageController, mixed in at creation */
-            buildRendering: function() {
+define(['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'],
+    function(declare,lang,array,parser,query,attr,connect,dijit,_WidgetBase,_Container,_Contained){
+        return declare('rft.ui._Page',[_WidgetBase],{
+            startup: function() {
                 this.inherited(arguments);
-                var dfd = new Deferred();
-                var mixinType = this.domNode.getAttribute("data-rft-mixin");
-                if ( mixinType ) {
-                    require([mixinType],lang.hitch(this,function(SomePageController){
-                        declare.safeMixin(this,new SomePageController());
-                        dfd.resolve();
-                    }));
-                } else {
-                    dfd.resolve();
-                }
-                dfd.then(lang.hitch(this,function(){
-                    var methods = query('> script[type^="rft/method"]',this.domNode).orphan();
-                    array.forEach(methods,lang.hitch(this,function(s){
-                        var method = s.getAttribute("data-rft-method");
-                        var func = parser._functionFromScript(s);
-                        this[method] = func;
-                    }));
-                    this._controllerLoaded = true;
-                    this._triggerOnVisit();
+                this._attachPointsAndEvents();
+                this.onVisit();
+            },
+            _attachPointsAndEvents: function() {
+                query('*[data-rft-attach-point]'/*, this.domNode*/).forEach(lang.hitch(this,function(node){
+                    var point = attr.get(node,'data-rft-attach-point');
+                    var widget = dijit.byId(attr.get(node,'id'));
+                    this[point] = widget || node;
+                }));
+                query('*[data-rft-attach-event]'/*, this.domNode*/).forEach(lang.hitch(this,function(node){
+                    var event = attr.get(node,'data-rft-attach-event').split(':');
+                    var eventName = event[0];
+                    var eventHandler = event[1];
+                    var widget = dijit.byId(attr.get(node,'id'));
+                    if ( widget ) {
+                        this.connect(widget,eventName,lang.hitch(this,eventHandler));
+                    } else {
+                        this.connect(node,eventName,lang.hitch(this,eventHandler));
+                    }
+                }));
+                query('> script[type^="rft/method"]',this.domNode)
+                .orphan().forEach(lang.hitch(this,function(s){
+                    var methodName = s.getAttribute("data-rft-method");
+                    var func = parser._functionFromScript(s);
+                    this[methodName] = func;
                 }));
             },
-            startup: function() {
-                this.inherited(arguments);
-                this._hasStarted = true;
-                this._triggerOnVisit();
-            },
-            _triggerOnVisit: function() {
-                if ( this._controllerLoaded && this._hasStarted && !this._triggeredOnVisit ) {
-                    this._triggeredOnVisit = false;
-                    this.onVisit();
-                }
-            }
+            /** Event fired after startup of all widgets is complete */
+            onVisit: function(){},
+            /** Event fired before leaving the page. Return false to prevent */
+            onLeave: function(){}
         });
     });
Index: Dev/branches/rest-dojo-ui/client/rft/ui/_PageController.js
===================================================================
--- Dev/branches/rest-dojo-ui/client/rft/ui/_PageController.js	(revision 273)
+++ 	(revision )
@@ -1,10 +1,0 @@
-define(['dojo/_base/declare'],
-    function(declare) {
-        return declare('rft.ui._PageController',null,{
-            /** Event fired after startup of all widegts is complete */
-            onVisit: function(){},
-            /** Event fired before leaving the page. Return false to prevent */
-            onLeave: function(){}
-        });
-    });
-
Index: Dev/branches/rest-dojo-ui/log.txt
===================================================================
--- Dev/branches/rest-dojo-ui/log.txt	(revision 273)
+++ Dev/branches/rest-dojo-ui/log.txt	(revision 274)
@@ -1,6 +1,7 @@
-* Replaced jQuery with Dojo for more extensive widgets.
-* Removed some unused JS libraries (d3,RGraph).
-* Changed API to use REST conventions. It is able to login and access
-  database objects. I used the tonic library for that.
-* Login dialog and one page work. The page features a list which is
-  coupled to our REST store with sessions.
+* [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 wasn'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.
Index: Dev/branches/rest-dojo-ui/server/api.php
===================================================================
--- Dev/branches/rest-dojo-ui/server/api.php	(revision 273)
+++ Dev/branches/rest-dojo-ui/server/api.php	(revision 274)
@@ -46,12 +46,8 @@
 
         $user = null;
-        $data = null;
         if (!empty($request->data)) {
-            $data = json_decode($request->data, true);
-        }
-        if (!empty($data)) {
-            $user = Auth::login($data['username'], sha1($data['password']));
+            $user = Auth::login($request->data['email'], $request->data['password']);
             if (!$user) {
-                throw new ResponseException("Incorrect username and password", Response::UNAUTHORIZED);
+                throw new ResponseException("Incorrect email and password", Response::UNAUTHORIZED);
             }
             set_session_cookie($response, $user);
@@ -59,5 +55,26 @@
             $user = restore_session($response);
         }
-        $response->body = json_encode($user);
+        $response->body = $user;
+        return $response;
+    }
+
+}
+
+/**
+ *  @uri /register
+ */
+class RegisterResource extends Resource {
+
+    function post($request) {
+        $response = new Response($request);
+
+        $user = null;
+        if (!empty($request->data)) {
+            $user = Auth::register($request->data['email'], $request->data['password']);
+            set_session_cookie($response, $user);
+        } else {
+            throw new ResponseException("No email and password provided.",Response::BADREQUEST);
+        }
+        $response->body = $user;
         return $response;
     }
@@ -83,7 +100,6 @@
         $type = $this->getType($request);
         $objects = $type::get(array());
-        //$objects = array_map(function($val) { return array('uid' => $val->uid); }, $objects);
-
-        $response->body = json_encode($objects);
+
+        $response->body = $objects;
         return $response;
     }
@@ -94,11 +110,10 @@
 
         $type = $this->getType($request);
-        $data = json_decode($request->data);
         $onlyAdd = $request->ifNoneMatch('*');
         $onlyUpdate = $request->ifMatch('*');
 
         $object = FALSE;
-        if (isset($data->uid)) {
-            $objects = $type::get(array('uid' => $data->uid));
+        if (isset($request->data->uid)) {
+            $objects = $type::get(array('uid' => $request->data->uid));
             if (!empty($objects)) {
                 $object = $objects[0];
@@ -116,10 +131,12 @@
             $response->code = Response::OK;
         }
-        foreach ($data as $key => $val) {
+        foreach ($request->data as $key => $val) {
             $object->$key = $val;
         }
-        $object->save();
-
-        $response->body = json_encode($object);
+        if (!$object->save()) {
+            throw new ResponseException("Save failed", Response::INTERNALSERVERERROR);
+        }
+
+        $response->body = $object;
         return $response;
     }
@@ -150,5 +167,5 @@
         }
 
-        $response->body = json_encode($objects[0]);
+        $response->body = $objects[0];
         return $response;
     }
@@ -159,5 +176,4 @@
 
         $info = $this->getTypeAndUid($request);
-        $data = json_decode($request->data);
         $onlyAdd = $request->ifNoneMatch('*');
         $onlyUpdate = $request->ifMatch('*');
@@ -179,15 +195,17 @@
             $response->code = Response::OK;
         }
-        foreach ($data as $key => $val) {
+        foreach ($request->data as $key => $val) {
             $object->$key = $val;
         }
-        $object->save();
-
-        $response->body = json_encode($object);
+        if (!$object->save()) {
+            throw new ResponseException("Save failed", Response::INTERNALSERVERERROR);
+        }
+
+        $response->body = $object;
         return $response;
     }
 
     function delete($request) {
-        restore_session();
+        restore_session(new Response($request));
         throw new ReponseException("Delete not implemented", Response::METHODNOTALLOWED);
     }
@@ -202,5 +220,5 @@
     $request->baseUri = $baseUri;
 }
-
+$request->data = Marshaller::unmarshall(json_decode($request->data));
 try {
     $resource = $request->loadResource();
@@ -208,11 +226,13 @@
 } catch (ResponseException $e) {
     $response = $e->response($request);
-    $response->body = json_encode(array('errorMsg' => $response->body));
+    $response->body = array('errorMsg' => $response->body);
 } catch (Exception $e) {
     $response = new Response($request);
     $response->code = Response::INTERNALSERVERERROR;
-    $response->body = json_encode(array('errorMsg' => "Unhandled exception: " . $e));
+    $response->body = array('errorMsg' => "Unhandled exception: " . $e);
 }
 add_default_headers($response);
+$response->body = json_encode(Marshaller::marshall($response->body));
 $response->output();
+
 ?>
Index: Dev/branches/rest-dojo-ui/server/classes/Auth.php
===================================================================
--- Dev/branches/rest-dojo-ui/server/classes/Auth.php	(revision 273)
+++ Dev/branches/rest-dojo-ui/server/classes/Auth.php	(revision 274)
@@ -5,21 +5,33 @@
 class Auth {
 
-    public static function login($username, $password) {
-        $user_results = User::get(array("name" => $username));
-        if (!empty($user_results)) {
-            $user = $user_results[0];
-            if (sha1($password) == $user->password) {
-                return $user;
-            }
+    public static function register($email, $password) {
+        $user_results = User::get(array("email" => $email));
+        if ( !empty($user_results) ) {
+            throw new Exception("User with email $email already exists.");
         }
-        return false;
+        $salt = rand();
+        $user = new User(null,$email,sha1($password.$salt),$salt);
+        $user->save();
+        return $user;
+    }
+    
+    public static function login($email, $password) {
+        $user_results = User::get(array("email" => $email));
+        if (empty($user_results)) {
+            throw new Exception("User with email $email not found.");
+        }
+        $user = $user_results[0];
+        if (sha1($password.$user->passwordSalt) != $user->passwordHash) {
+            throw new Exception("Wrong password.");
+        }
+        return $user;
     }
 
     public static function restore($session) {
         $user_results = User::get(array("uid" => $session));
-        if (!empty($user_results)) {
-            return $user_results[0];
+        if (empty($user_results)) {
+            throw new Exception("Session with id $session not found.");
         }
-        return false;
+        return $user_results[0];
     }
     
Index: Dev/branches/rest-dojo-ui/server/classes/Marshaller.php
===================================================================
--- Dev/branches/rest-dojo-ui/server/classes/Marshaller.php	(revision 274)
+++ Dev/branches/rest-dojo-ui/server/classes/Marshaller.php	(revision 274)
@@ -0,0 +1,64 @@
+<?php
+
+class Marshaller {
+
+    const OBJ_TYPE = '__objectType';
+
+    private static function isWrappedObject($obj) {
+        return isset($obj[self::OBJ_TYPE]);
+    }
+
+    public static function marshall($obj) {
+        switch (gettype($obj)) {
+            case 'array':
+                return array_map(array('Marshaller','marshall'), $obj);
+            case 'object':
+                return static::wrapObject($obj);
+            default:
+                return $obj;
+        }
+    }
+
+    private static function wrapObject($obj) {
+        $objectType = get_class($obj);
+        if ($objectType == 'DateTime') {
+            return array(self::OBJ_TYPE => 'DateTime', 'timestamp' => $obj->getTimestamp());
+        } else {
+            $newObj = static::marshall((array) $obj);
+            $newObj[self::OBJ_TYPE] = get_class($obj);
+            return $newObj;
+        }
+    }
+
+    public static function unmarshall($obj) {
+        switch (gettype($obj)) {
+            case 'object':
+                $obj = (array) $obj;
+            case 'array':
+                if (static::isWrappedObject($obj)) {
+                    return static::unwrapObject($obj);
+                } else {
+                    return array_map(array('Marshaller','unmarshall'), $obj);
+                }
+            default:
+                return $obj;
+        }
+    }
+
+    private static function unwrapObject($obj) {
+        $objectType = $obj[self::OBJ_TYPE];
+        unset($obj[self::OBJ_TYPE]);
+        if ($objectType == 'DateTime') {
+            $date = new DateTime();
+            $date->setTimestamp($obj['timestamp']);
+            return $date;
+        } else if (is_subclass_of($objectType, 'ResearchToolObjectInterface')) {
+            return $objectType::create((object)static::unmarshall($obj));
+        } else {
+            return $obj;
+        }
+    }
+
+}
+
+?>
Index: Dev/branches/rest-dojo-ui/server/classes/models/Answer.php
===================================================================
--- Dev/branches/rest-dojo-ui/server/classes/models/Answer.php	(revision 273)
+++ Dev/branches/rest-dojo-ui/server/classes/models/Answer.php	(revision 274)
@@ -18,5 +18,5 @@
 	public static function create($obj)
 	{
-		return new Answer($obj->uid, $obj->question, $obj->values)
+		return new Answer($obj->uid, $obj->question, $obj->values);
 	}
 
Index: Dev/branches/rest-dojo-ui/server/classes/models/AnswerSet.php
===================================================================
--- Dev/branches/rest-dojo-ui/server/classes/models/AnswerSet.php	(revision 273)
+++ Dev/branches/rest-dojo-ui/server/classes/models/AnswerSet.php	(revision 274)
@@ -187,4 +187,9 @@
 		return $answers;
 	}
+
+    public static function create($obj) {
+        return new AnswerSet($obj->uid, $obj->survey, $obj->respondent, $obj->datetime, $obj->answers);
+    }
+    
 }
 
Index: Dev/branches/rest-dojo-ui/server/classes/models/Application.php
===================================================================
--- Dev/branches/rest-dojo-ui/server/classes/models/Application.php	(revision 273)
+++ Dev/branches/rest-dojo-ui/server/classes/models/Application.php	(revision 274)
@@ -113,4 +113,8 @@
         return $applications;
 	}
+
+    public static function create($obj) {
+        return new Application($obj->uid, $obj->title, $obj->description, $obj->style);
+    }
 }
 
Index: Dev/branches/rest-dojo-ui/server/classes/models/ApplicationInstance.php
===================================================================
--- Dev/branches/rest-dojo-ui/server/classes/models/ApplicationInstance.php	(revision 273)
+++ Dev/branches/rest-dojo-ui/server/classes/models/ApplicationInstance.php	(revision 274)
@@ -167,4 +167,10 @@
 
 	}
+
+    public static function create($obj) {
+        return new ApplicationInstance($obj->uid, $obj->application, 
+                $obj->starttime, $obj->endtime, $obj->open, $obj->playerresults,
+                $obj->groupresults, $obj->periodicresults);
+    }
 }
 ?>
Index: Dev/branches/rest-dojo-ui/server/classes/models/ResearchToolObject.php
===================================================================
--- Dev/branches/rest-dojo-ui/server/classes/models/ResearchToolObject.php	(revision 273)
+++ Dev/branches/rest-dojo-ui/server/classes/models/ResearchToolObject.php	(revision 274)
@@ -11,8 +11,12 @@
 
 
-abstract class ResearchToolObject {
+abstract class ResearchToolObject implements ResearchToolObjectInterface {
 
-	public $uid;
+	public $uid = null;
 
+    public function getUid() {
+        return $this->uid;
+    }
+    
 	public function evaluate()
 	{
@@ -79,3 +83,11 @@
 }
 
+interface ResearchToolObjectInterface {
+    function getUid();
+    static function get($arguments);
+    static function create($obj);
+    function evaluate();
+    function save();
+}
+
 ?>
Index: Dev/branches/rest-dojo-ui/server/classes/models/Respondent.php
===================================================================
--- Dev/branches/rest-dojo-ui/server/classes/models/Respondent.php	(revision 273)
+++ Dev/branches/rest-dojo-ui/server/classes/models/Respondent.php	(revision 274)
@@ -16,5 +16,6 @@
 
 	public $email;
-	public $password;
+	public $passwordHash;
+	public $passwordSalt;
 
 	/**
@@ -24,5 +25,5 @@
 	 * @param type password
 	 */
-	public function __construct($uid = null, $email = null, $password = null)
+	public function __construct($uid = null, $email = null, $passwordHash = null, $passwordSalt = null)
 	{
       	if(!isset($uid))
@@ -33,5 +34,6 @@
       	$this->uid = $uid;
      	$this->email = $email;
-      	$this->password = $password;
+      	$this->passwordHash = $passwordHash;
+      	$this->passwordSalt = $passwordSalt;
 	}
     /**
@@ -64,7 +66,12 @@
         $model->add(new Statement($resourceRespondent,$predicateName,$literalRespondentName));			
 
-        $literalPassword = new Literal($this->password);
-        $predicatePassword = new Resource(PASSWORD);
-        $model->add(new Statement($resourceRespondent,$predicatePassword,$literalPassword));
+        $literalPasswordHash = new Literal($this->passwordHash);
+        $predicatePasswordHash = new Resource(PASSWORDHASH);
+        $model->add(new Statement($resourceRespondent,$predicatePasswordHash,$literalPasswordHash));
+        
+        $literalPasswordSalt = new Literal($this->passwordSalt);
+        $predicatePasswordSalt = new Resource(PASSWORDSALT);
+        $model->add(new Statement($resourceRespondent,$predicatePasswordSalt,$literalPasswordSalt));
+        
 		$model->saveAs(Respondent::$filename, 'rdf');
 		return true;
@@ -85,5 +92,5 @@
             PREFIX  predicates: <' . SURVEYTOOL_PREDICATES_NAMESPACE . '>
             PREFIX  resources: <' . SURVEYTOOL_RESOURCES_NAMESPACE . '>
-            SELECT ?uid, ?email, ?password
+            SELECT ?uid, ?email, ?passwordHash, ?passwordSalt
             WHERE 	
             {
@@ -91,5 +98,6 @@
 					predicates:uid ?uid ;
 					predicates:email ?email ;
-					predicates:password ?password ;
+					predicates:passwordHash ?passwordHash ;
+					predicates:passwordSalt ?passwordSalt ;
 					' . ResearchToolObject::createArguments($arguments) .  '
             }';
@@ -102,13 +110,15 @@
             foreach($results as $result)
             { 
-                    $respondents[] = new Respondent($result['?uid']->label, $result['?email']->label, $result['?password']->label);
+                    $respondents[] = new Respondent($result['?uid']->label, $result['?email']->label, $result['?passwordHash']->label, $result['?passwordSalt']->label);
             }
         }
         return $respondents;
 	}
+
+    public static function create($obj) {
+        return new Respondent($obj->uid, $obj->email, $obj->passwordHash, $obj->passwordSalt);
+    }
+
 }
 
-	
-
-
-
+?>
Index: Dev/branches/rest-dojo-ui/server/classes/models/ResultSet.php
===================================================================
--- Dev/branches/rest-dojo-ui/server/classes/models/ResultSet.php	(revision 273)
+++ Dev/branches/rest-dojo-ui/server/classes/models/ResultSet.php	(revision 274)
@@ -158,3 +158,8 @@
 		return $answersets;
 	}
+
+    public static function create($obj) {
+        return new ResultSet($obj->uid, $obj->answersets, $obj->playerresults, 
+                $obj->groupresults, $obj->periodicresults);
+    }
 }
Index: Dev/branches/rest-dojo-ui/server/classes/models/Session.php
===================================================================
--- Dev/branches/rest-dojo-ui/server/classes/models/Session.php	(revision 273)
+++ Dev/branches/rest-dojo-ui/server/classes/models/Session.php	(revision 274)
@@ -24,8 +24,8 @@
 	 * @param type $title
 	 * @param type $creator
-	 * @param type $datetime
+	 * @param type $creationdate
 	 * @param type $pipeline
 	 */
-	public function __construct($uid = null, $title = null, $creator = null, $datetime = null, $pipeline = null)
+	public function __construct($uid = null, $title = null, $creator = null, $creationdate = null, $pipeline = null)
 	{
 		if(!isset($uid))
@@ -36,5 +36,5 @@
 		$this->title = $title;
 		$this->creator = $creator;
-		$this->creationdate = $datetime;
+		$this->creationdate = $creationdate;
 		$this->pipeline = $pipeline;
 	}
@@ -141,7 +141,6 @@
 			}
 		}
-
-		$model->saveAs(Session::$filename, 'rdf');
-		return true;
+		
+		return $model->saveAs(Session::$filename, 'rdf');
 	}
 
@@ -320,6 +319,10 @@
 	}
 
+    public static function create($obj) {
+        return new Session($obj->uid, $obj->title, $obj->creator,
+                $obj->creationdate, $obj->pipeline);
+    }
+
 }	
 
-
 ?>
Index: Dev/branches/rest-dojo-ui/server/classes/models/SessionInstance.php
===================================================================
--- Dev/branches/rest-dojo-ui/server/classes/models/SessionInstance.php	(revision 273)
+++ Dev/branches/rest-dojo-ui/server/classes/models/SessionInstance.php	(revision 274)
@@ -235,4 +235,11 @@
 	}
 
+    public static function create($obj) {
+        return new SessionInstance($obj->uid, $obj->title, $obj->location,
+                $obj->facilitator, $obj->starttime, $obj->endtime, $obj->notes,
+                $obj->session, $obj->resultset);
+    }
 
 }
+
+?>
Index: Dev/branches/rest-dojo-ui/server/classes/models/Survey.php
===================================================================
--- Dev/branches/rest-dojo-ui/server/classes/models/Survey.php	(revision 273)
+++ Dev/branches/rest-dojo-ui/server/classes/models/Survey.php	(revision 274)
@@ -169,4 +169,8 @@
     }
 
+    public static function create($obj) {
+        return new Survey($obj->uid, $obj->title, $obj->description,
+                $obj->creator, $obj->questions);
+    }
 
 }
Index: Dev/branches/rest-dojo-ui/server/classes/models/SurveyInstance.php
===================================================================
--- Dev/branches/rest-dojo-ui/server/classes/models/SurveyInstance.php	(revision 273)
+++ Dev/branches/rest-dojo-ui/server/classes/models/SurveyInstance.php	(revision 274)
@@ -242,4 +242,10 @@
 	}
 
+    public static function create($obj) {
+        return new SurveyInstance($obj->uid, $obj->survey, $obj->starttime,
+                $obj->endtime, $obj->open, $obj->presetanswers,
+                $obj->answersets);
+    }
+
 }
 
Index: Dev/branches/rest-dojo-ui/server/classes/models/User.php
===================================================================
--- Dev/branches/rest-dojo-ui/server/classes/models/User.php	(revision 273)
+++ Dev/branches/rest-dojo-ui/server/classes/models/User.php	(revision 274)
@@ -17,5 +17,6 @@
     
     public $email;
-    public $password;
+    public $passwordHash;
+    public $passwordSalt;
     
     /**
@@ -23,5 +24,5 @@
      * If the user does not yet exist in the database, call with null as first parameter
      */
-    public function __construct($uid = null, $email = null, $password = null) {
+    public function __construct($uid = null, $email = null, $passwordHash = null, $passwordSalt = null) {
         if(!isset($uid))
         {
@@ -30,5 +31,6 @@
         $this->uid = $uid;
 		$this->email = $email;
-        $this->password = sha1($password);
+        $this->passwordHash = $passwordHash;
+        $this->passwordSalt = $passwordSalt;
 	}
 
@@ -60,7 +62,11 @@
         $model->add(new Statement($resourceUser,$predicateName,$literalUserName));			
 
-        $literalPassword = new Literal($this->password);
-        $predicatePassword = new Resource(PASSWORD);
-		$model->add(new Statement($resourceUser,$predicatePassword,$literalPassword));
+        $literalPasswordHash = new Literal($this->passwordHash);
+        $predicatePasswordHash = new Resource(PASSWORDHASH);
+		$model->add(new Statement($resourceUser,$predicatePasswordHash,$literalPasswordHash));
+
+        $literalPasswordSalt = new Literal($this->passwordSalt);
+        $predicatePasswordSalt = new Resource(PASSWORDSALT);
+		$model->add(new Statement($resourceUser,$predicatePasswordSalt,$literalPasswordSalt));
 
 		$model->saveAs(User::$filename, 'rdf');
@@ -82,5 +88,5 @@
             PREFIX  predicates: <' . SURVEYTOOL_PREDICATES_NAMESPACE . '>
             PREFIX  resources: <' . SURVEYTOOL_RESOURCES_NAMESPACE . '>
-            SELECT ?uid, ?email, ?password
+            SELECT ?uid, ?email, ?passwordHash, ?passwordSalt
             WHERE 	
             {
@@ -88,5 +94,6 @@
 					predicates:uid ?uid ;
 					predicates:email ?email ;
-					predicates:password ?password ;
+					predicates:passwordHash ?passwordHash ;
+					predicates:passwordSalt ?passwordSalt ;
 					' . ResearchToolObject::createArguments($arguments) . '
             }';
@@ -99,9 +106,14 @@
             foreach($results as $result)
             { 
-				$users[] = new User($result['?uid']->label, $result['?email']->label, $result['?password']->label);
+				$users[] = new User($result['?uid']->label, $result['?email']->label, $result['?passwordHash']->label, $result['?passwordSalt']->label);
             }
         }
         return $users;
 	}
+
+    public static function create($obj) {
+        return new User($obj->uid, $obj->email,$obj->passwordHash,$obj->passwordSalt);
+    }
+
 }
 
Index: Dev/branches/rest-dojo-ui/server/rdfConstants.php
===================================================================
--- Dev/branches/rest-dojo-ui/server/rdfConstants.php	(revision 273)
+++ Dev/branches/rest-dojo-ui/server/rdfConstants.php	(revision 274)
@@ -30,5 +30,6 @@
 define('UID',SURVEYTOOL_PREDICATES_NAMESPACE . 'uid');
 define('EMAIL',SURVEYTOOL_PREDICATES_NAMESPACE . 'email');
-define('PASSWORD',SURVEYTOOL_PREDICATES_NAMESPACE . 'password');
+define('PASSWORDHASH',SURVEYTOOL_PREDICATES_NAMESPACE . 'passwordHash');
+define('PASSWORDSALT',SURVEYTOOL_PREDICATES_NAMESPACE . 'passwordSalt');
 define('CREATOR',SURVEYTOOL_PREDICATES_NAMESPACE . 'creator');
 define('TITLE',SURVEYTOOL_PREDICATES_NAMESPACE . 'title');
