Index: Dev/trunk/src/client/qed-client/index.js
===================================================================
--- Dev/trunk/src/client/qed-client/index.js	(revision 462)
+++ Dev/trunk/src/client/qed-client/index.js	(revision 463)
@@ -1,16 +1,20 @@
 define([
-    'dojo/_base/array',
-    'dojo/parser',
-    './app/Content',
-    './app/Page',
-    './app/Router',
-    './ui/MainMenu',
-    './routes',
-    './store',
-    'dojo/domReady!',
-    './stddeps'
-],function(array,parser,Content,Page,Router,MainMenu,routes,store) {
+    "./app/Content",
+    "./app/Page",
+    "./app/Router",
+    "./routes",
+    "./store",
+    "./store/request",
+    "./ui/MainMenu",
+    "dojo/_base/array",
+    "dojo/parser",
+    "dojo/request/registry",
+    "./stddeps",
+    "dojo/domReady!"
+], function(Content, Page, Router, routes, store, request, MainMenu, array, parser, registry) {
+
+    registry.register(/.*/,request);
+    
     parser.parse();
-
     store.info()
     .then(function(){
Index: Dev/trunk/src/client/qed-client/pages/surveyRun.js
===================================================================
--- Dev/trunk/src/client/qed-client/pages/surveyRun.js	(revision 462)
+++ Dev/trunk/src/client/qed-client/pages/surveyRun.js	(revision 463)
@@ -72,7 +72,9 @@
             var surveyRun = this.surveyRunWidget.get('value');
             if ( surveyRun.mode === "open" ) {
-                this.runURLNode.innerHTML = this._link(this._getGeneralURL(store.getIdentity(this.surveyRun)));
+                this.runURLNode.innerHTML =
+                    this._link(this._getGeneralURL(store.getIdentity(this.surveyRun)));
             } else {
-                this.runURLNode.innerHTML = "No general URL. Add individual respondents below.";
+                this.runURLNode.innerHTML =
+                    "No general URL. Add individual respondents below.";
             }
         },
@@ -102,9 +104,15 @@
                 });
             }
-            event.stop(evt);
+            if ( evt ) { event.stop(evt); }
             return false;
         },
         _onDiscard: function(evt) {
             Router.go('/surveys');
+            if ( evt ) { event.stop(evt); }
+            return false;
+        },
+        _onExport: function(evt) {
+            if ( evt ) { event.stop(evt); }
+            return false;
         }
     });
Index: Dev/trunk/src/client/qed-client/pages/templates/response.html
===================================================================
--- Dev/trunk/src/client/qed-client/pages/templates/response.html	(revision 462)
+++ Dev/trunk/src/client/qed-client/pages/templates/response.html	(revision 463)
@@ -1,5 +1,6 @@
 <div class="blue">
 
-    <div data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:'top'">
+    <div data-dojo-type="dijit/layout/ContentPane"
+         data-dojo-props="region:'top'">
         <h2>
             <span class="rftIcon rftIconSurvey"></span>
@@ -9,10 +10,14 @@
     </div>
     
-    <div data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:'center'" data-dojo-attach-point="content">
-        <div name="answers" data-dojo-type="../model/widgets/SurveyRenderWidget" data-dojo-attach-point="surveyWidget"></div>
+    <div data-dojo-type="dijit/layout/ContentPane"
+         data-dojo-props="region:'center'" data-dojo-attach-point="content">
+        <div name="answers"
+             data-dojo-type="../model/widgets/SurveyRenderWidget"
+             data-dojo-attach-point="surveyWidget"></div>
     </div>
     
 
-    <div data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:'bottom'">
+    <div data-dojo-type="dijit/layout/ContentPane"
+         data-dojo-props="region:'bottom'">
         <button data-dojo-type="dijit/form/Button"
                 type="submit"
Index: Dev/trunk/src/client/qed-client/pages/templates/surveyRun.html
===================================================================
--- Dev/trunk/src/client/qed-client/pages/templates/surveyRun.html	(revision 462)
+++ Dev/trunk/src/client/qed-client/pages/templates/surveyRun.html	(revision 463)
@@ -1,28 +1,58 @@
 <div class="blue">
 
-    <div data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:'top'">
+    <div data-dojo-type="dijit/layout/ContentPane"
+         data-dojo-props="region:'top'">
         <h2>
             <span class="rftIcon rftIconSurvey"></span>
-            <span class="headerText" data-dojo-attach-point="titleNode">SurveyRun Editor</span>
+            <span class="headerText"
+                  data-dojo-attach-point="titleNode">SurveyRun Editor</span>
         </h2>
     </div>
     
-    <div data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:'center'">
+    <div data-dojo-type="dijit/layout/ContentPane"
+         data-dojo-props="region:'center'">
         <fieldset class="qedFieldset">
             <legend>Survey</legend>
-            <div data-dojo-type="../model/widgets/SurveySummary" data-dojo-attach-point="surveySummaryWidget"></div>
+            <div data-dojo-type="../model/widgets/SurveySummary"
+                 data-dojo-attach-point="surveySummaryWidget"></div>
         </fieldset>
         <fieldset class="qedFieldset">
             <legend>Run Details</legend>
-            <div data-dojo-type="../model/widgets/SurveyRunWidget" data-dojo-attach-point="surveyRunWidget"></div>
+            <div data-dojo-type="../model/widgets/SurveyRunWidget"
+                 data-dojo-attach-point="surveyRunWidget"></div>
         </fieldset>
         <fieldset class="qedFieldset">
             <legend>Response Details</legend>
-            <div><div class="qedLabel">General URL</div><div class="qedField" data-dojo-attach-point="runURLNode" style="overflow: ellipsis"></div></div>
-            <div><div class="qedLabel">Responses <span data-dojo-attach-point="responsesCountNode"></span></div><div class="qedField qedFill" data-dojo-attach-point="responsesNode"></div></div>
+            <div>
+                <div class="qedLabel">General URL</div>
+                <div class="qedField"
+                     data-dojo-attach-point="runURLNode"
+                     style="overflow: ellipsis"></div>
+            </div>
+            <div>
+                <div class="qedLabel">Response count</div>
+                <div data-dojo-attach-point="responsesCountNode"></div>
+            </div>
+            <div>
+                <div class="qedLabel">In progress count</div>
+                <div data-dojo-attach-point="inprogressCountNode"></div>
+            </div>
+            <div>
+                <div class="qedLabel">Responses (including partial)</div>
+                <div class="qedField qedFill"
+                     data-dojo-attach-point="responsesNode"></div>
+            </div>
+            <div>
+                <div class="qedLabel">Export results</div>
+                <button data-dojo-type="dijit/form/Button"
+                        class="qedField blue"
+                        data-dojo-props="baseClass: 'rftBlockButton', iconClass: 'rftIcon rftIconSave'"
+                        data-dojo-attach-event="onClick:_onExport">To CSV</button>
+            </div>
         </fieldset>
     </div>
     
-    <div data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region: 'bottom'" style="height: 40px;">
+    <div data-dojo-type="dijit/layout/ContentPane"
+         data-dojo-props="region: 'bottom'" style="height: 40px;">
         <button data-dojo-type="dijit/form/Button"
                 class="blue"
Index: Dev/trunk/src/client/qed-client/store/CouchStore.js
===================================================================
--- Dev/trunk/src/client/qed-client/store/CouchStore.js	(revision 462)
+++ Dev/trunk/src/client/qed-client/store/CouchStore.js	(revision 463)
@@ -5,5 +5,5 @@
     "dojo/_base/json",
     "dojo/_base/lang",
-    "dojo/request",
+    "dojo/request/registry",
     "dojo/store/util/QueryResults"
 ], function(Deferred, array, declare, json, lang, request, QueryResults) {
Index: Dev/trunk/src/client/qed-client/store/request.js
===================================================================
--- Dev/trunk/src/client/qed-client/store/request.js	(revision 463)
+++ Dev/trunk/src/client/qed-client/store/request.js	(revision 463)
@@ -0,0 +1,36 @@
+define([
+    "dojo/Deferred",
+    "dojo/request"
+], function(Deferred, request) {
+
+    var authenticated = true;
+    var queue = [];
+    
+    var _request = function(url, options) {
+        var dfd = new Deferred();
+        if ( authenticated ) {
+            request(url,options).response.then(function(response){
+                console.log(response);
+            }, function(error){
+                if ( error.response.status === 401 ) {
+                    queue.push({
+                        url: url,
+                        options: options,
+                        dfd: dfd
+                    });
+                    console.log("Retry goes here :)");
+                } else {
+                    dfd.reject(error);
+                }
+            });
+        } else {
+            queue.push({
+                url: url,
+                options: options,
+                dfd: dfd
+            });
+        }
+        return dfd.promise;
+    };
+    return _request;
+});
Index: Dev/trunk/src/client/qed-client/widgets/_ComplexValueMixin.coffee
===================================================================
--- Dev/trunk/src/client/qed-client/widgets/_ComplexValueMixin.coffee	(revision 463)
+++ Dev/trunk/src/client/qed-client/widgets/_ComplexValueMixin.coffee	(revision 463)
@@ -0,0 +1,45 @@
+define [
+    "dijit/_Container",
+    "dijit/form/_FormMixin",
+    "dojo/_base/array",
+    "dojo/_base/declare",
+    "dojo/_base/event"
+], (_Container, _FormMixin, array, declare, event) ->
+    declare [_Container,_FormMixin],
+        name: ""
+        value: null
+        disabled: false
+        readOnly: false
+
+        postCreate: () ->
+            @inherited arguments
+            if @domNode.tagName.toLowerCase() isnt "form"
+                console.warn "Not scoping a _ComplexValueMixin in a form element can cause name clashes. E.g. radio buttons might stop working correctly. It is recommended to use <form> as the root element in your template for", @declaredClass
+
+        _setDisabledAttr: (value) ->
+            @_set "disabled", value
+            array.forEach @_getDescendantFormWidgets() (child) => 
+                child.set "disabled", value
+
+        _setReadOnlyAttr: (value) ->
+            @_set "readOnly", value
+            array.forEach @_getDescendantFormWidgets() (child) =>
+                child.set "readOnly", value
+
+        focus: () ->
+            children = @_getDescendantFormWidgets()
+            children[0].focus() if children.length > 0
+
+        onSubmit: (e) =>
+            # since this widget is used to create more complex
+            # widgets within other forms, the onSubmit must either be
+            # ignored or propagated, but not handled here.
+            event.stop e if e
+            false
+
+        _onSubmit: (e) =>
+            # since this widget is used to create more complex
+            # widgets within other forms, the onSubmit must either be
+            # ignored or propagated, but not handled here.
+            event.stop if e
+            false
Index: Dev/trunk/src/client/qed-client/widgets/_ComplexValueMixin.js
===================================================================
--- Dev/trunk/src/client/qed-client/widgets/_ComplexValueMixin.js	(revision 462)
+++ 	(revision )
@@ -1,52 +1,0 @@
-define([
-    "dijit/_Container",
-    "dijit/form/_FormMixin",
-    "dojo/_base/array",
-    "dojo/_base/declare",
-    "dojo/_base/event"
-], function(_Container, _FormMixin, array, declare, event) {
-    return declare([_Container,_FormMixin],{
-        name: "",
-        value: null,
-        disabled: false,
-        readOnly: false,
-        postCreate: function() {
-            this.inherited(arguments);
-            if ( this.domNode.tagName.toLowerCase() !== "form" ) {
-                console.warn("Not scoping a _ComplexValueMixin in a form element can cause name clashes. E.g. radio buttons might stop working correctly. It is recommended to use <form> as the root element in your template for "+this.declaredClass+".");
-            }
-        },
-        _setDisabledAttr: function(value) {
-            this._set("disabled", value);
-            array.forEach(this._getDescendantFormWidgets(), function(child){
-                child.set("disabled", value);
-            });
-        },
-        _setReadOnlyAttr: function(value) {
-            this._set("readOnly", value);
-            array.forEach(this._getDescendantFormWidgets(), function(child){
-                child.set("readOnly", value);
-            });
-        },
-        focus: function() {
-            var children = this._getDescendantFormWidgets();
-            if ( children.length > 0 ) {
-                children[0].focus();
-            }
-        },
-        onSubmit: function(e) {
-            // since this widget is used to create more complex
-            // widgets within other forms, the onSubmit must either be
-            // ignored or propagated, but not handled here.
-            if ( e ) { event.stop(e); }
-            return false;
-        },
-        _onSubmit: function(e) {
-            // since this widget is used to create more complex
-            // widgets within other forms, the onSubmit must either be
-            // ignored or propagated, but not handled here.
-            if ( e ) { event.stop(e); }
-            return false;
-        }
-    });
-});
