Index: Dev/branches/rest-dojo-ui/client/config/config.sh
===================================================================
--- Dev/branches/rest-dojo-ui/client/config/config.sh	(revision 413)
+++ Dev/branches/rest-dojo-ui/client/config/config.sh	(revision 414)
@@ -1,2 +1,2 @@
 #!/bin/sh
-node ../dojo/dojo.js load=config/db
+nodejs ../dojo/dojo.js load=config/db
Index: Dev/branches/rest-dojo-ui/client/config/db.js
===================================================================
--- Dev/branches/rest-dojo-ui/client/config/db.js	(revision 413)
+++ Dev/branches/rest-dojo-ui/client/config/db.js	(revision 414)
@@ -91,11 +91,16 @@
             });
         },function(){
-            console.log("Checking database 'rft'");
-            return req('get','rft')
-            .then(function(){
-                console.log("Database 'rft' found.");
-            },function(){
-                console.log("Creating database 'rft'");
-                return req('put','/rft');
+            console.log("Checking database 'qed'");
+            return req('get','qed')
+            .then(function(res){
+                if (res.error) {
+                    console.log("Creating database 'qed'");
+                    return req('put','/qed');
+                } else {
+                    console.log("Database 'qed' found.");
+                }
+            },function(res){
+                console.log("Creating database 'qed'");
+                return req('put','/qed');
             });
         },function(){
Index: Dev/branches/rest-dojo-ui/client/config/docs.js
===================================================================
--- Dev/branches/rest-dojo-ui/client/config/docs.js	(revision 413)
+++ Dev/branches/rest-dojo-ui/client/config/docs.js	(revision 414)
@@ -1,24 +1,24 @@
 define([],function(){
     return {
-        "_users/rft_admin": {
+        "_users/qed_admin": {
             __configAction: "ignore",
-            _id: "org.couchdb.user:rft_admin",
-            name: "rft_admin",
+            _id: "org.couchdb.user:qed_admin",
+            name: "qed_admin",
             password: "Welkom01",
-            roles: [ "rft_admin" ],
+            roles: [ "qed_admin" ],
             type: "user"
         },
-        "rft/_security": {
+        "qed/_security": {
             __configAction: "ignore",
             admins: {
                 names: [],
-                roles: ["rft_admin"]
+                roles: ["qed_admin"]
             },
             readers: {
                 names: [],
-                roles: ["rft_user"]
+                roles: ["qed_user"]
             }
         },
-        "rft/_design/default": {
+        "qed/_design/default": {
             __configAction: "replace",
             _id: "_design/default",
@@ -36,5 +36,5 @@
             }
         },
-        "rft/_design/questions": {
+        "qed/_design/questions": {
             __configAction: "replace",
             _id: "_design/questions",
@@ -75,5 +75,6 @@
                         if( doc.type !== 'Question' ){ return; }
                         emit(doc.topic);
-                    }
+                    },
+                    reduce: function(key, values, rereduce) { return null; }
                 },
                 published_topics: {
@@ -81,9 +82,10 @@
                         if ( doc.type !== 'Question' || !doc.publicationDate ) { return; }
                         emit(doc.topic);
-                    }
+                    },
+                    reduce: function(key, values, rereduce) { return null; }
                 }
             }
         },
-        "rft/_design/surveys": {
+        "qed/_design/surveys": {
             __configAction: "replace",
             _id: "_design/surveys",
Index: Dev/branches/rest-dojo-ui/client/data/.htaccess
===================================================================
--- Dev/branches/rest-dojo-ui/client/data/.htaccess	(revision 413)
+++ Dev/branches/rest-dojo-ui/client/data/.htaccess	(revision 414)
@@ -1,3 +1,3 @@
 RewriteEngine on
-RewriteRule couch/(.*) http://localhost:5984/rft/$1 [P,QSA]
-RewriteRule elastic http://localhost:9200/rft/_search [P,QSA]
+RewriteRule couch/(.*) http://localhost:5984/qed/$1 [P,QSA]
+RewriteRule elastic http://localhost:9200/qed/_search [P,QSA]
Index: Dev/branches/rest-dojo-ui/client/index.html
===================================================================
--- Dev/branches/rest-dojo-ui/client/index.html	(revision 413)
+++ Dev/branches/rest-dojo-ui/client/index.html	(revision 414)
@@ -12,5 +12,5 @@
             <div class="topbar" data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:'top'">
                 <a href="#!/"><h1>QED</h1></a>
-                <div data-dojo-type="rft/ui/MainMenu"></div>
+                <div id="menu"></div>
             </div>
         </div>
Index: Dev/branches/rest-dojo-ui/client/rft/pages/questions.js
===================================================================
--- Dev/branches/rest-dojo-ui/client/rft/pages/questions.js	(revision 413)
+++ Dev/branches/rest-dojo-ui/client/rft/pages/questions.js	(revision 414)
@@ -20,4 +20,9 @@
                 'class': 'orange',
                 itemActions: {
+                    Delete: {
+                        callback: lang.hitch(this,"onDeleteQuestion"),
+                        icon: 'Delete',
+                        description: 'Delete question'
+                    },
                     Edit: {
                         callback: lang.hitch(this,"onEditQuestion"),
@@ -40,4 +45,12 @@
             }));
         },
+        onDeleteQuestion: function(question) {
+            store.remove(store.getIdentity(question),store.getRevision(question))
+            .then(function(){
+                Content.notify("Question deleted.");
+            },function(err){
+                Content.notify(err.reason,'error');
+            });
+        },
         onEditQuestion: function(question) {
             Router.go("/question/"+question._id);
@@ -47,5 +60,5 @@
             store.put(question)
             .then(function(){
-                Content.notify("Question puplished.");
+                Content.notify("Question published.");
             },function(err){
                 Content.notify(err.reason,'error');
Index: Dev/branches/rest-dojo-ui/client/rft/pages/surveys.html
===================================================================
--- Dev/branches/rest-dojo-ui/client/rft/pages/surveys.html	(revision 413)
+++ Dev/branches/rest-dojo-ui/client/rft/pages/surveys.html	(revision 414)
@@ -14,5 +14,4 @@
             </div>
             <div data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region: 'bottom'" style="height: 40px;">
-                <button data-dojo-type="dijit/form/Button" class="blue" data-dojo-props="baseClass: 'rftBlockButton', iconClass: 'rftIcon rftIconNew'" data-dojo-attach-event="onClick:_onNewSurvey">New survey</button>
             </div>
         </div>
@@ -33,3 +32,7 @@
     </div>
 
+    <div data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region: 'bottom'" style="height: 40px;">
+        <button data-dojo-type="dijit/form/Button" class="blue" data-dojo-props="baseClass: 'rftBlockButton', iconClass: 'rftIcon rftIconNew'" data-dojo-attach-event="onClick:_onNewSurvey">New survey</button>
+    </div>
+
 </div>
Index: Dev/branches/rest-dojo-ui/client/rft/pages/surveys.js
===================================================================
--- Dev/branches/rest-dojo-ui/client/rft/pages/surveys.js	(revision 413)
+++ Dev/branches/rest-dojo-ui/client/rft/pages/surveys.js	(revision 414)
@@ -22,4 +22,6 @@
             .then(function(survey) {
                 Router.go('/survey/'+store.getIdentity(survey));
+            },function(err){
+                Content.notify(err.reason,'error');
             });
         },
Index: Dev/branches/rest-dojo-ui/client/rft/run.js
===================================================================
--- Dev/branches/rest-dojo-ui/client/rft/run.js	(revision 413)
+++ Dev/branches/rest-dojo-ui/client/rft/run.js	(revision 414)
@@ -2,13 +2,27 @@
     'dojo/_base/array',
     'dojo/parser',
+    'rft/app/Content',
+    'rft/app/Page',
     'rft/app/Router',
+    'rft/ui/MainMenu',
     'rft/routes',
+    'rft/store',
     'rft/stddeps',
     'dojo/domReady!'
-],function(array,parser,router,routes) {
+],function(array,parser,Content,Page,Router,MainMenu,routes,store) {
     parser.parse();
-    array.forEach(routes,function(route){
-        router.register(route);
+
+    store.info()
+    .then(function(){
+        new MainMenu({},"menu").startup();
+        array.forEach(routes,function(route){
+            Router.register(route);
+        });
+        Router.startup();
+    },function(){
+        Content.startup();
+        Content.set(new Page({
+            templateString: "<div>Application database is not properly configured. Contact your system administrator.</div>"
+        }));
     });
-    router.startup();
 });
Index: Dev/branches/rest-dojo-ui/client/rft/store/CouchStore.js
===================================================================
--- Dev/branches/rest-dojo-ui/client/rft/store/CouchStore.js	(revision 413)
+++ Dev/branches/rest-dojo-ui/client/rft/store/CouchStore.js	(revision 414)
@@ -35,4 +35,23 @@
         getRevision: function(object){
             return object[this.revProperty];
+        },
+        info: function(){
+            var dfd = new Deferred();
+            xhr("GET", {
+                url: this.target,
+                handleAs: "json",
+                headers: {
+                    Accept: this.accepts
+                }
+            }).then(function(result){
+                if ( result.error ) {
+                    dfd.reject(result.reason);
+                } else {
+                    dfd.resolve(result);
+                }
+            }, function(err){
+                dfd.reject(getCouchError(err));
+            });
+            return dfd.promise;
         },
         get: function(id){
Index: Dev/branches/rest-dojo-ui/client/rft/ui/MainMenu.js
===================================================================
--- Dev/branches/rest-dojo-ui/client/rft/ui/MainMenu.js	(revision 413)
+++ Dev/branches/rest-dojo-ui/client/rft/ui/MainMenu.js	(revision 414)
@@ -1,7 +1,11 @@
-define(['dojo/_base/declare','dijit/_WidgetBase',
-    'dijit/_TemplatedMixin','dijit/_WidgetsInTemplateMixin','dojo/text!./templates/MainMenu.html'],
-    function(declare,_WidgetBase,_TemplatedMixin,_WidgetsInTemplateMixin,template){
-        return declare([_WidgetBase,_TemplatedMixin,_WidgetsInTemplateMixin],{
-            templateString: template
-        });
+define([
+    'dojo/_base/declare',
+    'dijit/_WidgetBase',
+    'dijit/_TemplatedMixin',
+    'dijit/_WidgetsInTemplateMixin',
+    'dojo/text!./templates/MainMenu.html'
+],function(declare,_WidgetBase,_TemplatedMixin,_WidgetsInTemplateMixin,template){
+    return declare([_WidgetBase,_TemplatedMixin,_WidgetsInTemplateMixin],{
+        templateString: template
     });
+});
Index: Dev/branches/rest-dojo-ui/client/rft/ui/QuestionEditorPreview.js
===================================================================
--- Dev/branches/rest-dojo-ui/client/rft/ui/QuestionEditorPreview.js	(revision 413)
+++ Dev/branches/rest-dojo-ui/client/rft/ui/QuestionEditorPreview.js	(revision 414)
@@ -1,3 +1,4 @@
 define([
+    'dojo/_base/array',
     'dojo/_base/declare',
     'dojo/_base/lang',
@@ -6,5 +7,5 @@
     './QuestionEditorPreviewItem',
     './lists/OrderedList'
-], function(declare, lang, domConstruct, registry, QuestionEditorPreviewItem, OrderedList) {
+], function(array, declare, lang, domConstruct, registry, QuestionEditorPreviewItem, OrderedList) {
     return declare([OrderedList], {
         baseClass: 'surveyEditorPreview',
@@ -26,8 +27,9 @@
         },
         getItems: function() {
-            return this.source.getAllNodes()
-            .map(function(node){
-                return registry.byNode(node).get('value');
-            },this);
+            return array.map(
+                this.source.getAllNodes(),
+                function(node){
+                    return registry.byNode(node).get('value');
+                },this);
         }
     });
Index: Dev/branches/rest-dojo-ui/client/rft/ui/QuestionEditorPreviewItem.js
===================================================================
--- Dev/branches/rest-dojo-ui/client/rft/ui/QuestionEditorPreviewItem.js	(revision 413)
+++ Dev/branches/rest-dojo-ui/client/rft/ui/QuestionEditorPreviewItem.js	(revision 414)
@@ -62,5 +62,5 @@
                 this.innerWidget.set('readOnly',true);
             }
-            this.titleNode.innerHTML = (this.item.code||"(no code)")+" : "+this.item.type+" [preview]";
+            this.titleNode.innerHTML = this.item.type+" [preview]";
         },
         _showEditWidget: function() {
@@ -71,5 +71,5 @@
                 this.innerWidget.startup();
             }
-            this.titleNode.innerHTML = (this.item.code||"(no code)")+" : "+this.item.type+" [editing]";
+            this.titleNode.innerHTML = this.item.type+" [editing]";
         },
         onClose: function() {},
Index: Dev/branches/rest-dojo-ui/client/rft/ui/content/ContentWidgetFactory.js
===================================================================
--- Dev/branches/rest-dojo-ui/client/rft/ui/content/ContentWidgetFactory.js	(revision 413)
+++ Dev/branches/rest-dojo-ui/client/rft/ui/content/ContentWidgetFactory.js	(revision 414)
@@ -9,4 +9,5 @@
     'dijit/form/Button',
     'dijit/form/CheckBox',
+    'dijit/form/Form',
     'dijit/form/NumberSpinner',
     'dijit/form/RadioButton',
@@ -16,5 +17,5 @@
     './../lists/_EditableListMixin',
     './../lists/OrderedList'
-],function(array, declare, lang, domConstruct, _TemplatedMixin, _WidgetBase, _Container, Button, CheckBox, NumberSpinner, RadioButton, Textarea, TextBox, TableContainer, _EditableListMixin, OrderedList) {
+],function(array, declare, lang, domConstruct, _TemplatedMixin, _WidgetBase, _Container, Button, CheckBox, Form, NumberSpinner, RadioButton, Textarea, TextBox, TableContainer, _EditableListMixin, OrderedList) {
     var factory = declare(null, {
         createViewWidget: function(/*Object*/options) {
@@ -95,4 +96,19 @@
     });
 
+    var DefaultEdit = declare([Form,_Container],{
+        type: null,
+        addChild: function(widget) {
+            domConstruct.create("label",{
+                innerHTML: widget.title || ''
+            },this.containerNode,'last');
+            this.inherited(arguments,[widget]);
+        },
+        _getValueAttr: function() {
+            var val = this.inherited(arguments);
+            val.type = this.type;
+            return val;
+        }
+    });
+
     var HeaderView = declare([_WidgetBase], {
         postCreate: function() {
@@ -101,59 +117,57 @@
     });
 
-    var HeaderEdit = declare([_WidgetBase, _Container], {
+    var HeaderEdit = declare([DefaultEdit], {
+        type: 'Header',
+        postCreate: function() {
+            this.inherited(arguments);
+            this.addChild(new TextBox({
+                title: 'Content',
+                name: 'content'
+            }));
+        }
+    });
+
+    var TextView = declare([_WidgetBase], {
+        postCreate: function() {
+            this.domNode.innerHTML = "<p>"+this.options.content+"</p>";
+        }
+    });
+
+    var TextEdit = declare([DefaultEdit], {
+        type: 'Text',
+        postCreate: function() {
+            this.inherited(arguments);
+            this.addChild(new Textarea({
+                title: 'Content',
+                name: 'content'
+            }));
+        }
+    });
+
+    var DividerView = declare([_WidgetBase], {
+        postCreate: function() {
+            this.domNode.innerHTML = "<hr>";
+        }
+    });
+
+    var DefaultInputEdit = declare([DefaultEdit],{
+        postCreate: function() {
+            this.inherited(arguments);
+            this.addChild(new TextBox({
+                title: 'Text',
+                name: 'text'
+            }));
+        }
+    });
+
+    var StringInputView = declare([_WidgetBase, _Container],{
         _textBox: null,
         postCreate: function() {
-            this._textBox = new TextBox();
+            this._textBox = new TextBox({
+                name: this.options.code || ''
+            });
             this.addChild(this._textBox);
             this._textBox.startup();
         },
-        _setValueAttr: function(value) {
-            this._textBox.set('value', value.content || "");
-        },
-        _getValueAttr: function() {
-            return { type: 'Header',
-                 content: this._textBox.get('displayedValue')
-            };
-        }
-    });
-
-    var TextView = declare([_WidgetBase], {
-        postCreate: function() {
-            this.domNode.innerHTML = "<p>"+this.options.content+"</p>";
-        }
-    });
-
-    var TextEdit = declare([_WidgetBase, _Container], {
-        _textArea: null,
-        postCreate: function() {
-            this._textArea = new Textarea();
-            this.addChild(this._textArea);
-            this._textArea.startup();
-        },
-        _setValueAttr: function(value) {
-            this._textArea.set('value', value.content || "");
-        },
-        _getValueAttr: function() {
-            return { type: 'Text',
-                 content: this._textArea.get('displayedValue')
-            };
-        }
-    })
-
-    var DividerView = declare([_WidgetBase], {
-        postCreate: function() {
-            this.domNode.innerHTML = "<hr>";
-        }
-    });
-
-    var StringInputView = declare([_WidgetBase, _Container],{
-        _textBox: null,
-        postCreate: function() {
-            this._textBox = new TextBox({
-                name: this.options.code || ''
-            });
-            this.addChild(this._textBox);
-            this._textBox.startup();
-        },
         _setReadOnlyAttr: function(value) {
             this._textBox.set('readOnly', value);
@@ -170,27 +184,6 @@
     });
 
-    var StringInputEdit = declare([_WidgetBase, _Container],{
-        _codeInput: null,
-        postCreate: function() {
-            var table = new TableContainer({ cols: 1, customClass: "labelsAndValues"} );
-
-            this._codeInput = new TextBox({
-                title: "Code"
-            });
-            table.addChild(this._codeInput);
-            this._codeInput.startup();
-
-            this.addChild(table);
-            table.startup();
-        },
-        _getValueAttr: function() {
-            return {
-                type: "StringInput",
-                code: this._codeInput.get('value') || ""
-            };
-        },
-        _setValueAttr: function(value) {
-            this._codeInput.set('value', value.code || "");
-        }
+    var StringInputEdit = declare([DefaultInputEdit],{
+        type: 'StringInput'
     });
 
@@ -217,39 +210,15 @@
     });
 
-    var TextInputEdit = declare([_WidgetBase, _Container], {
-        _codeInput: null,
-        _maxLengthInput: null,
-        postCreate: function() {
-            var table = new TableContainer({ cols: 1, customClass: "labelsAndValues"} );
-
-            this._codeInput = new TextBox({
-                title: "Code"
-            });
-            table.addChild(this._codeInput);
-            this._codeInput.startup();
-
-            this._maxLengthInput = new NumberSpinner({
+    var TextInputEdit = declare([DefaultInputEdit], {
+        type: 'TextInput',
+        postCreate: function() {
+            this.inherited(arguments);
+            this.addChild(new NumberSpinner({
+                name: 'maxLength',
                 title: "Maximum length",
                 constraints: {
                     min: 0
                 }
-            });
-            table.addChild(this._maxLengthInput);
-            this._maxLengthInput.startup();
-
-            this.addChild(table);
-            table.startup();
-        },
-
-        _setValueAttr: function(value) {
-            this._codeInput.set('value', value.code || "");
-            this._maxLengthInput.set('value', value.maxLength);
-        },
-        _getValueAttr: function() {
-            return {
-                type: "TextInput", 
-                code: this._codeInput.get('value') || "",
-                maxLength: this._maxLengthInput.get('value')
-            };
+            }));
         }
     });
@@ -280,53 +249,20 @@
     });
 
-    var IntegerInputEdit = declare([_WidgetBase, _Container], {
-        _codeInput: null,
-        _minInput: null,
-        _maxInput: null,
-        postCreate: function() {
-            var table = new TableContainer({ cols: 1, customClass: "labelsAndValues"} );
-
-            this._codeInput = new TextBox({
-                title: "Code"
-            });
-            table.addChild(this._codeInput);
-            this._codeInput.startup();
-
-            this._minInput = new NumberSpinner({
-                title: "Minimum"
-            });
-            table.addChild(this._minInput);
-            this._minInput.startup();
-
-            this._maxInput = new NumberSpinner({
-                title: "Maximum"
-            });
-            table.addChild(this._maxInput);
-            this._maxInput.startup();
-
-            this._stepInput = new NumberSpinner({
-                title: "Step"
-            });
-            table.addChild(this._stepInput);
-            this._stepInput.startup();
-
-            this.addChild(table);
-            table.startup();
-        },
-
-        _setValueAttr: function(value) {
-            this._codeInput.set('value', value.code || "");
-            this._minInput.set('value', value.min);
-            this._maxInput.set('value', value.max);
-            this._stepInput.set('value', value.step);
-        },
-        _getValueAttr: function() {
-            return {
-                type: "IntegerInput",
-                code: this._codeInput.get('value') || "",
-                min: this._minInput.get('value'),
-                max: this._maxInput.get('value'),
-                step: this._stepInput.get('value')
-            };
+    var IntegerInputEdit = declare([DefaultInputEdit], {
+        type: 'IntegerInput',
+        postCreate: function() {
+            this.inherited(arguments);
+            this.addChild(new NumberSpinner({
+                title: "Minimum",
+                name: 'min'
+            }));
+            this.addChild(new NumberSpinner({
+                title: "Maximum",
+                name: 'max'
+            }));
+            this.addChild(new NumberSpinner({
+                title: "Step",
+                name: 'step'
+            }));
         }
     });
Index: Dev/branches/rest-dojo-ui/client/rft/ui/templates/MainMenu.html
===================================================================
--- Dev/branches/rest-dojo-ui/client/rft/ui/templates/MainMenu.html	(revision 413)
+++ Dev/branches/rest-dojo-ui/client/rft/ui/templates/MainMenu.html	(revision 414)
@@ -12,5 +12,5 @@
         </div>
         <div class="rftMainMenuButton" data-dojo-type="rft/ui/MenuBarLink" data-dojo-props="path:'/results'">Results</div>
-        <div class="rftMainMenuButton" data-dojo-type="rft/ui/MenuBarLink" id="loginMenu">Logout</div>
+        <div class="rftMainMenuButton" data-dojo-type="rft/ui/MenuBarLink">Logout</div>
     </div>
 </div>
Index: Dev/branches/rest-dojo-ui/docs/jsonformat.txt
===================================================================
--- Dev/branches/rest-dojo-ui/docs/jsonformat.txt	(revision 413)
+++ Dev/branches/rest-dojo-ui/docs/jsonformat.txt	(revision 414)
@@ -1,2 +1,11 @@
+Document types
+==============
+
+
+Question types
+==============
+
+
+
 sessions
 ========
@@ -43,4 +52,4 @@
     topic: ''
     categories: []
-    content: [{ type:'contentTypeId', /* custom content element fields */ } /* and more ... */]
+    content: [{ type:'contentTypeId', text: '' || ['' ...], /* custom content element fields */ } /*, and more ... */]
 }
