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(){}
-        });
-    });
-
