Index: Dev/trunk/src/client/qed-client/app/Page.js
===================================================================
--- Dev/trunk/src/client/qed-client/app/Page.js	(revision 490)
+++ Dev/trunk/src/client/qed-client/app/Page.js	(revision 491)
@@ -1,12 +1,11 @@
 define([
     "./Content",
-    "./Path",
+    "./Router",
     "dijit/_TemplatedMixin",
     "dijit/_WidgetsInTemplateMixin",
     "dijit/layout/BorderContainer",
     "dojo/_base/declare",
-    "dojo/_base/lang",
-    "dojo/hash"
-], function(Content, Path, _TemplatedMixin, _WidgetsInTemplateMixin, BorderContainer, declare, lang, hash) {
+    "dojo/_base/lang"
+], function(Content, Router, _TemplatedMixin, _WidgetsInTemplateMixin, BorderContainer, declare, lang) {
     var Page = declare([BorderContainer,_TemplatedMixin,_WidgetsInTemplateMixin],{
         templateString: '<div>Empty page.</div>',
@@ -14,8 +13,6 @@
             Content.set(new Page({templateString:'<div>Error: '+msg+'</div>'}));
         },
+        go: lang.hitch(Router,'go'),
         notify: lang.hitch(Content,'notify'),
-        setURL: function(url,opts,addToHistory) {
-            hash(Path.format(url,opts),addToHistory !== true);
-        },
         markDirty: lang.hitch(Content,'markDirty'),
         markClean: lang.hitch(Content,'markClean')
Index: Dev/trunk/src/client/qed-client/app/Router.js
===================================================================
--- Dev/trunk/src/client/qed-client/app/Router.js	(revision 490)
+++ Dev/trunk/src/client/qed-client/app/Router.js	(revision 491)
@@ -1,5 +1,4 @@
 define([
     "./Content",
-    "./Page",
     "./Path",
     "dojo/_base/declare",
@@ -9,6 +8,7 @@
     "dojo/hash",
     "dojo/on",
-    "dojo/topic"
-], function(Content, Page, Path, declare, event, lang, window, hash, on, topic) {
+    "dojo/topic",
+    "require"
+], function(Content, Path, declare, event, lang, window, hash, on, topic, require) {
 
     var Router = declare(null,{
@@ -108,13 +108,19 @@
             return true;
         },
-        go: function(path,args) {
+        go: function(path,args,replace) {
             if ( !this._started ) { return; }
             var newHash = Path.format(path,args);
-            hash(newHash);
+            if ( replace === true ) {
+                this._beforePreviousHash = this._previousHash;
+                this._previousHash = newHash;
+            }
+            hash(newHash,replace);
         },
         _defaultCallback: function() {
-            Content.set(new Page({
-                templateString: "<div>Requested page not found. Go <a href=\"#"+Path.getDefault()+"\">home</a>.</div>"
-            }));
+            require("./Page",function(Page){
+                Content.set(new Page({
+                    templateString: "<div>Requested page not found. Go <a href=\"#"+Path.getDefault()+"\">home</a>.</div>"
+                }));
+            });
         }
     });
Index: Dev/trunk/src/client/qed-client/pages/_ObjectPage.js
===================================================================
--- Dev/trunk/src/client/qed-client/pages/_ObjectPage.js	(revision 491)
+++ Dev/trunk/src/client/qed-client/pages/_ObjectPage.js	(revision 491)
@@ -0,0 +1,52 @@
+define([
+    "../app/Page",
+    "dojo/_base/declare",
+    "dojo/_base/event",
+    "dojo/_base/lang",
+    "require"
+], function(Page, declare, event, lang, require) {
+    return declare([Page],{
+        objectId: null,
+        object: null,
+        classStore: null,
+        constructor: function() {
+            if ( !this.classStore ) { throw new Error("Subclasses must specify a classStore."); }
+        },
+        _load: function() {
+            if ( this.object ) {
+                this._refresh();
+            } else if ( this.objectId ) {
+                if ( this.objectId === "new" ) {
+                    this.object = this.classStore.create();
+                    this._refresh();
+                } else {
+                    this.classStore.load(this.objectId)
+                    .then(lang.hitch(this,'_setObject'),
+                          lang.hitch(this,function(err){
+                                this.die(err.error);
+                            }));
+                }
+            } else {
+                this.die("No valid uid or object passed!");
+            }
+        },
+        _setObject: function(object) {
+            this.object = object;
+            if ( this.objectId === "new" ) {
+                this.go(this.classStore.getObjectPath(this.object),{},true);
+            }
+            this._refresh();
+        },
+        _refresh: function() {},
+        _save: function() {
+            return this.classStore.save(this.object)
+            .then(lang.hitch(this,function(object){
+                this.markClean();
+                this._setObject(object);
+                this.notify(this.classStore.getName()+" successfully saved.");
+            }),lang.hitch(this,function(e){
+                this.notify(e.error,'error');
+            }));
+        }
+    });
+});
Index: Dev/trunk/src/client/qed-client/pages/survey.js
===================================================================
--- Dev/trunk/src/client/qed-client/pages/survey.js	(revision 490)
+++ Dev/trunk/src/client/qed-client/pages/survey.js	(revision 491)
@@ -58,5 +58,5 @@
         _refresh: function() {
             this.titleNode.innerHTML = this.object.title || "(set title in properties)";
-            this.propertiesDialog.set('value',this.object);
+            this.propertiesDialog.set('value',{survey:this.object});
             this.questionList.set('value',
                                   this.object.questions);
@@ -76,5 +76,5 @@
         _onPropertiesOk: function(evt) {
             this.propertiesDialog.hide();
-            lang.mixin(this.object, this.propertiesDialog.get('value'));
+            lang.mixin(this.object, this.propertiesDialog.get('value').survey);
             this.markDirty();
             this._refresh();
@@ -84,5 +84,5 @@
         _onPropertiesCancel: function(evt) {
             this.propertiesDialog.hide();
-            this.propertiesDialog.set('value',this.object);
+            this.propertiesDialog.set('value',{survey:this.object});
             if ( evt ) { event.stop(evt); }
             return false;
Index: Dev/trunk/src/client/qed-client/pages/templates/survey.html
===================================================================
--- Dev/trunk/src/client/qed-client/pages/templates/survey.html	(revision 490)
+++ Dev/trunk/src/client/qed-client/pages/templates/survey.html	(revision 491)
@@ -45,5 +45,5 @@
          data-dojo-attach-event="onSubmit:_onPropertiesOk">
         <fieldset class="qedFieldset">
-            <div data-dojo-type="../model/widgets/SurveyWidget"></div>
+            <div data-dojo-type="../model/widgets/SurveyWidget" data-dojo-props="name:'survey'"></div>
         </fieldset>
         <button data-dojo-type="dijit/form/Button"
