Index: Dev/branches/rest-dojo-ui/client/rft/content.js
===================================================================
--- Dev/branches/rest-dojo-ui/client/rft/content.js	(revision 288)
+++ Dev/branches/rest-dojo-ui/client/rft/content.js	(revision 292)
@@ -19,13 +19,11 @@
  * this e.g. to ask confirmation of changed values are not saved.
  */
-define(['dojo/_base/declare','dojo/_base/connect','dojo/_base/xhr',
-    'dojo/_base/lang','dojo/_base/Deferred','dojo/hash',
+define(['dojo/_base/declare','dojo/_base/connect','dojo/_base/xhr','dojo/_base/json',
+    'dojo/_base/lang','dojo/_base/Deferred','dojo/hash','dojo/dom-attr','dojo/dom-construct',
     'dojo/io-query','dijit','rft/util','rft/ui/_Page'],
-    function(declare,connect,xhr,lang,Deferred,hash,uriQuery,dijit,util,_Page){
+    function(declare,connect,xhr,json,lang,Deferred,hash,attr,domConstruct,uriQuery,dijit,util,_Page){
         return new (function() {
             var self = this;
-            var currentHash = "";
-            var currentPage = null;
-            
+
             var HRI = declare(null,{
                 constructor: function() {
@@ -73,11 +71,13 @@
             });
 
+            var currentHri = null;
+            var currentPage = null;
+            
             function _goTo(hri,replace) {
                 var contentPane = dijit.byId('content');
                 var dfd = new Deferred();
-                var newHash = hri.hash();
                 
                 // if already there, return
-                if ( currentHash === newHash ) {
+                if ( currentHri && currentHri.hash() === hri.hash() ) {
                     dfd.resolve();
                     return dfd.promise;
@@ -88,5 +88,5 @@
                     if ( currentPage.onLeave() === false ) {
                         // restore hash if changed by hand or back button
-                        hash(currentHash);
+                        hash(currentHri.hash());
                         dfd.reject();
                         return dfd.promise;
@@ -95,7 +95,17 @@
                 }
                 
+                function mixinArgs(node) {
+                    var props = {};
+                    if ( attr.has(node,'data-dojo-props') ) {
+                        props = json.fromJson(attr.get(node,'data-dojo-props'));
+                    }
+                    lang.mixin(props,{pageArgs:hri.args()});
+                    var jsonStr = json.toJson(props);
+                    attr.set(node,'data-dojo-props',jsonStr.slice(1,jsonStr.length-1));
+                }
+                
                 // update hash
-                currentHash = newHash;
-                hash(newHash,replace);
+                currentHri = hri;
+                hash(hri.hash(),replace);
                 
                 // load html
@@ -108,6 +118,7 @@
                 // initialize page or create error message
                 .then(function(html){
-                    contentPane.set('content',html);
-                    var rootNode = contentPane.containerNode.firstChild;
+                    var rootNode = domConstruct.toDom(html);
+                    mixinArgs(rootNode);
+                    contentPane.set('content',rootNode);
                     currentPage = dijit.byNode(rootNode);
                     if ( !currentPage ) {
@@ -123,5 +134,5 @@
 
             self.initial = function(path,args) {
-                if ( currentHash ) {
+                if ( currentHri ) {
                     var dfd = new Deferred();
                     dfd.resolve();
@@ -140,4 +151,12 @@
             }
 
+            self.getArgs = function() {
+                if ( currentHri ) {
+                    return currentHri.args();
+                } else {
+                    return {};
+                }
+            }
+
             connect.subscribe('/dojo/hashchange', function(){
                 _goTo(new HRI(hash()));
Index: Dev/branches/rest-dojo-ui/client/rft/pages/survey.html
===================================================================
--- Dev/branches/rest-dojo-ui/client/rft/pages/survey.html	(revision 292)
+++ Dev/branches/rest-dojo-ui/client/rft/pages/survey.html	(revision 292)
@@ -0,0 +1,13 @@
+<div data-dojo-type="rft.pages.survey">
+    <h1 data-rft-attach-point="header">(default)</h1>
+    <form data-dojo-type="dijit.form.Form" data-rft-attach-point="form" data-rft-attach-event="onSubmit:onSave">
+        <div style="display: block; clear: both;">
+            <button type="submit" data-dojo-type="dijit.form.Button">Save</button>
+            <button type="button" data-dojo-type="dijit.form.Button" data-rft-attach-event="onClick:onReset">Reset</button>
+        </div>
+        <label for="title" class="loginLabel">Title</label>
+        <input type="text" name="title" data-dojo-type="dijit.form.TextBox" class="loginInput"/>
+        <label for="description" class="loginLabel">Description</label>
+        <textarea name="description" data-dojo-type="dijit.form.SimpleTextarea" class="loginInput"></textarea>
+    </form>
+</div>
Index: Dev/branches/rest-dojo-ui/client/rft/pages/survey.js
===================================================================
--- Dev/branches/rest-dojo-ui/client/rft/pages/survey.js	(revision 292)
+++ Dev/branches/rest-dojo-ui/client/rft/pages/survey.js	(revision 292)
@@ -0,0 +1,43 @@
+define(['dojo/_base/declare','dojo/_base/lang','dojo/_base/event','dojo/_base/Deferred','dojo/store/JsonRest','rft/ui/_Page'],
+    function(declare,lang,event,Deferred,JsonRest,_Page){
+        return declare('rft.pages.survey',[_Page],{
+            object: null,
+            postCreate: function() {
+                this.inherited(arguments);
+                this._store = new JsonRest({
+                    target:"../server/api.php/data/Survey/",
+                    idProperty: 'uid'
+                });
+            },
+            onVisit: function() {
+                if ( this.pageArgs.uid ) {
+                    Deferred.when(this._store.get(this.pageArgs.uid))
+                    .then(lang.hitch(this,function(obj){
+                        this.object = obj;
+                        this.setFields(obj);
+                    }));
+                } else {
+                    this.header.innerHTML = "Error: no uid for survey!"
+                }
+            },
+            onReset: function() {
+                this.setFields(this.object);
+            },
+            onSave: function(evt) {
+                lang.mixin(this.object,this.form.get('value'));
+                Deferred.when( this._store.put(this.object) )
+                .then(lang.hitch(this,function(obj){
+                    this.object = obj;
+                    this.setFields(obj);
+                }));
+                event.stop(evt);
+                return false;
+            },
+            setFields: function(obj) {
+                this.form.reset();
+                this.header.innerHTML = "Edit survey '"+(obj.title || '(undefined)')+"'";
+                obj && this.form.set('value',obj);
+            }
+        });
+    });
+
Index: Dev/branches/rest-dojo-ui/client/rft/pages/surveys.html
===================================================================
--- Dev/branches/rest-dojo-ui/client/rft/pages/surveys.html	(revision 292)
+++ Dev/branches/rest-dojo-ui/client/rft/pages/surveys.html	(revision 292)
@@ -0,0 +1,6 @@
+<div data-dojo-type="rft.pages.surveys">
+    <button data-dojo-type="dijit.form.Button" data-dojo-props="disabled: true" data-rft-attach-point="btnEdit">Edit</button>
+    <button data-dojo-type="dijit.form.Button" data-rft-attach-point="btnNew">New</button>
+    <div data-dojo-type="dojox.grid.DataGrid" data-dojo-props="autoWidth:true,autoHeight:true,structure:[{name:'Title',field:'title'}]"
+         data-rft-attach-point="grid"></div>
+</div>
Index: Dev/branches/rest-dojo-ui/client/rft/pages/surveys.js
===================================================================
--- Dev/branches/rest-dojo-ui/client/rft/pages/surveys.js	(revision 292)
+++ Dev/branches/rest-dojo-ui/client/rft/pages/surveys.js	(revision 292)
@@ -0,0 +1,39 @@
+define(['dojo/_base/declare','dojo/_base/lang','dojo/store/JsonRest','dojo/data/ObjectStore','rft/content','rft/ui/_Page'],
+    function(declare,lang,JsonRest,ObjectStore,content,_Page){
+        return declare('rft.pages.surveys',[_Page],{
+            selectedObject: null,
+            postCreate: function() {
+                this._store = new JsonRest({
+                    target:"../server/api.php/data/Survey/",
+                    idProperty: 'uid'
+                });
+            },
+            onVisit: function() {
+                this.grid.setStore(ObjectStore({objectStore: this._store}));
+                
+                this.grid.on('rowclick',lang.hitch(this,function(evt){
+                    this.selectedObject = evt.grid.getItem(evt.rowIndex);
+                    this.btnEdit.set('disabled',!!this.selectedObject);
+                }));
+
+                this.grid.on('rowdblclick',lang.hitch(this,function(evt){
+                    var obj = evt.grid.getItem(evt.rowIndex);
+                    content.goTo('/survey',{uid:obj.uid});
+                }));
+                
+                this.btnNew.on('click',lang.hitch(this,function(){
+                    this._store.add({},function(obj) {
+                        content.goTo('/survey',{uid:this.selectedObject.uid});
+                    });
+                }));
+
+                this.btnEdit.on('click',lang.hitch(this,function(){
+                    if ( this.selectedObject ) {
+                        content.goTo('/survey',{uid:this.selectedObject.uid});
+                    }
+                    
+                }));
+            }
+        });
+    });
+
Index: Dev/branches/rest-dojo-ui/client/rft/run.js
===================================================================
--- Dev/branches/rest-dojo-ui/client/rft/run.js	(revision 288)
+++ Dev/branches/rest-dojo-ui/client/rft/run.js	(revision 292)
@@ -20,4 +20,5 @@
     'dijit/form/Button',
     'dijit/form/Textarea',
+    'dijit/form/SimpleTextarea',
     'dijit/form/ComboBox',
     'dijit/form/Select',
@@ -31,5 +32,8 @@
     
     // pages -> load dynamically?
-    'rft/pages/questions'],
+    'rft/pages/questions',
+    'rft/pages/surveys',
+    'rft/pages/survey',
+    ],
     function(win,parser,LoginDialog,dom,connect,auth,content) {
         parser.parse();
Index: Dev/branches/rest-dojo-ui/client/rft/ui/_Page.js
===================================================================
--- Dev/branches/rest-dojo-ui/client/rft/ui/_Page.js	(revision 288)
+++ Dev/branches/rest-dojo-ui/client/rft/ui/_Page.js	(revision 292)
@@ -1,6 +1,5 @@
-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){
+define(['dojo/_base/declare','dojo/_base/lang','dojo/parser','dojo/query',
+    'dojo/dom-attr','dijit','dijit/_WidgetBase'],
+    function(declare,lang,parser,query,attr,dijit,_WidgetBase){
         return declare('rft.ui._Page',[_WidgetBase],{
             startup: function() {
