Index: /Dev/branches/rest-dojo-ui/client/rft/css/layout.css
===================================================================
--- /Dev/branches/rest-dojo-ui/client/rft/css/layout.css	(revision 373)
+++ /Dev/branches/rest-dojo-ui/client/rft/css/layout.css	(revision 374)
@@ -288,4 +288,5 @@
 }
 .claro .dijitAccordionContainer {
+    height: 600;
     /* No styling for now, use this for margins and other layout-related business. This class does not affect the look of the AccordionContainer currently! */
 }
@@ -480,11 +481,16 @@
 }
 
+/* AccountListView */
+.claro .rftAccountListView .rftLineWithButtons .rftLineWithButtonsTitle {
+    max-width: 400px;
+    overflow: auto;
+}
 /* Generic list with lines */
 .claro .rftLineListView {
-    width: 400px;
+    max-width: 200px;
     max-height: 500px;
 }
 .claro .rftLineListView .rftLineListViewContent {
-    max-width: 400px;
+    max-width: 200px;
     overflow: auto;
 }
Index: /Dev/branches/rest-dojo-ui/client/rft/pages/question.js
===================================================================
--- /Dev/branches/rest-dojo-ui/client/rft/pages/question.js	(revision 373)
+++ /Dev/branches/rest-dojo-ui/client/rft/pages/question.js	(revision 374)
@@ -1,4 +1,5 @@
 define(['dojo/_base/declare',
     'dojo/_base/lang',
+    'dojo/_base/event',
     'dojo/_base/Deferred',
     'rft/ui/LineWithActionsWidget',
@@ -14,5 +15,5 @@
     'rft/ui/QuestionEditorToolkit',
     'dijit/form/FilteringSelect'],
-    function(declare, lang, Deferred, LineWithActionsWidget, store, _Page, api, content, registry, on, behavior, query){
+    function(declare, lang, event, Deferred, LineWithActionsWidget, store, _Page, api, content, registry, on, behavior, query){
         return declare('rft.pages.question', [_Page], {
             question: null,
@@ -37,5 +38,19 @@
             },
             _refresh: function () {
-                this._toolkit.propertiesForm.set('value', this.question);
+                this._toolkit.loadQuestion(this.question);
+            },
+            _onSave: function() {
+                lang.mixin(this.question, this._toolkit.propertiesForm.get('value'));
+                this.question.categories = this._toolkit._categories; 
+                store.put(this.question)
+                .then(function() {
+                    content.goTo('questions');
+                });
+                return false;
+            },
+            _onDiscard: function() {
+                this._toolkit.propertiesForm.reset();
+                content.goTo('questions');
+                return false;
             },
             _setupButtons: function() {
@@ -43,10 +58,10 @@
                     "#btnSave": {
                         onclick: lang.hitch(this, function(){
-                            this._saveSurvey();
+                            this._onSave();
                         })
                     },
                     "#btnDiscard": {
                         onclick: lang.hitch(this, function(){
-                            this._restartEditor();
+                            this._onDiscard();
                         })
                     }
Index: /Dev/branches/rest-dojo-ui/client/rft/pages/session.html
===================================================================
--- /Dev/branches/rest-dojo-ui/client/rft/pages/session.html	(revision 373)
+++ /Dev/branches/rest-dojo-ui/client/rft/pages/session.html	(revision 374)
@@ -31,5 +31,5 @@
                             <br/><br/>
                             
-                            <div data-rft-attach-point="listViewNode" class="rftLineListView">
+                            <div data-rft-attach-point="listViewNode" class="rftAccountListView">
                             </div>
                         </fieldset>
Index: /Dev/branches/rest-dojo-ui/client/rft/pages/session.js
===================================================================
--- /Dev/branches/rest-dojo-ui/client/rft/pages/session.js	(revision 373)
+++ /Dev/branches/rest-dojo-ui/client/rft/pages/session.js	(revision 374)
@@ -55,4 +55,6 @@
             },
             _addAccount: function(item) {
+                if (!this.session.accounts) 
+                    this.session.accounts = [];
                 this.session.accounts.push(item);
                 this._listView.insertItem(item);
Index: /Dev/branches/rest-dojo-ui/client/rft/run.js
===================================================================
--- /Dev/branches/rest-dojo-ui/client/rft/run.js	(revision 373)
+++ /Dev/branches/rest-dojo-ui/client/rft/run.js	(revision 374)
@@ -30,5 +30,6 @@
     'dojox/data/QueryReadStore',
     'rft/elastic/ElasticReadStore',
-    'rft/ui/ListView',
+    'rft/ui/List',
+    'rft/ui/OrderedList',
     'rft/ui/AccountListView',
     'rft/ui/MainMenu',
Index: /Dev/branches/rest-dojo-ui/client/rft/ui/AccountListView.js
===================================================================
--- /Dev/branches/rest-dojo-ui/client/rft/ui/AccountListView.js	(revision 373)
+++ /Dev/branches/rest-dojo-ui/client/rft/ui/AccountListView.js	(revision 374)
@@ -7,5 +7,5 @@
     'dijit/_Container',
     'rft/ui/LineWithActionsWidget',
-    'rft/ui/ListView',
+    'rft/ui/OrderedList',
     'dojo/text!./templates/AccountListView.html'
 	],function(
@@ -22,5 +22,5 @@
         return declare('rft.ui.AccountListView',[OrderedList,_WidgetBase,_TemplatedMixin,_WidgetsInTemplateMixin,_Container],{
             templateString: templateString,
-            baseClass: 'rftLineListView',
+            baseClass: 'rftAccountListView',
             region: 'center',
 
@@ -58,5 +58,5 @@
             	};
             	return fullItem;
-        	},
+        	}
 
            
Index: /Dev/branches/rest-dojo-ui/client/rft/ui/CategoryListView.js
===================================================================
--- /Dev/branches/rest-dojo-ui/client/rft/ui/CategoryListView.js	(revision 374)
+++ /Dev/branches/rest-dojo-ui/client/rft/ui/CategoryListView.js	(revision 374)
@@ -0,0 +1,62 @@
+define([
+    'dojo/_base/declare',
+    'dojo/_base/lang',
+    'dijit/_WidgetBase',
+    'dijit/_TemplatedMixin',
+    'dijit/_WidgetsInTemplateMixin',
+    'dijit/_Container',
+    'rft/ui/LineWithActionsWidget',
+    'rft/ui/List',
+    'dojo/text!./templates/List.html'
+    ],function(
+        declare,
+        lang,
+        _WidgetBase,
+        _TemplatedMixin,
+        _WidgetsInTemplateMixin,
+        _Container,
+        LineWithActionsWidget,
+        List,
+        templateString
+        ) {
+        return declare('rft.ui.CategoryListView',[List,_WidgetBase,_TemplatedMixin,_WidgetsInTemplateMixin,_Container],{
+            templateString: templateString,
+            baseClass: 'rftLineListView',
+            region: 'center',
+
+            creatorMethod: function(item, hint) {
+                var node;
+
+                if (hint == "avatar") {
+                    node = document.createElement("div");
+                    node.className = "dragAvatar";
+                    node.innerHTML = item.title;
+                } else {
+                    var w = new LineWithActionsWidget({
+                        title: item,
+                        'class': "orange",
+                        actions: {
+                            "Remove" : {
+                                callback: lang.hitch(this, function() {
+                                    this.removeItem(item, w);
+                                }),
+                                properties: {
+                                    blockButton: false,
+                                    icon: "Delete",
+                                    modifiers: "white"
+                                }
+                            }
+                        }
+                    });
+                    w.startup();
+                    node = w.domNode;
+                }
+                var fullItem = {
+                    node: node,
+                    data: item,
+                    type: "ListViewItem"
+                };
+                return fullItem;
+            }
+        });
+});
Index: /Dev/branches/rest-dojo-ui/client/rft/ui/List.js
===================================================================
--- /Dev/branches/rest-dojo-ui/client/rft/ui/List.js	(revision 373)
+++ /Dev/branches/rest-dojo-ui/client/rft/ui/List.js	(revision 374)
@@ -1,20 +1,61 @@
 define([
     'dojo/_base/declare',
+    'dojo/_base/lang',
     'dijit/_WidgetBase',
     'dijit/_TemplatedMixin',
     'dijit/_WidgetsInTemplateMixin',
     'dijit/_Container',
+    'rft/ui/LineWithActionsWidget',
     'dojo/text!./templates/List.html'
     ],function(
         declare,
+        lang,
         _WidgetBase,
         _TemplatedMixin,
         _WidgetsInTemplateMixin,
         _Container,
+        LineWithActionsWidget,
         templateString
         ){
         return declare('rft.ui.List',[_WidgetBase,_TemplatedMixin,_WidgetsInTemplateMixin,_Container],{
             templateString: templateString,
-            baseClass: 'rftList'
+            baseClass: 'rftList',
+            removeCallback: null,
+            creator: null,
+
+            constructor: function() {
+                lang.mixin(this, arguments);
+            },
+
+            postCreate: function() {
+                if (this.title) {
+                    this.titleNode.innerHTML = this.title;
+                } else {
+                    this.domNode.removeChild(this.titleNode);
+                }
+
+                this.source = new dojo.dnd.Source(this.sourceNode, {
+                    isSource: false,
+                    accept: ["LineListViewItem"],
+                    horizontal: false,
+                    withHandles: false,
+                    selfCopy: false,
+                    selfAccept: true,
+                    delay: 0,
+                    singular: true,
+                    creator: lang.hitch(this, this.creatorMethod)
+                })
+            },
+
+            removeItem: function(item, widget) {
+                widget.destroy();
+                if(this.removeCallback)
+                    this.removeCallback(item);
+            },
+
+            insertItem: function(item) {
+                this.source.insertNodes(false, [item]);
+            }
+
         });
     });
Index: /Dev/branches/rest-dojo-ui/client/rft/ui/OrderedList.js
===================================================================
--- /Dev/branches/rest-dojo-ui/client/rft/ui/OrderedList.js	(revision 373)
+++ /Dev/branches/rest-dojo-ui/client/rft/ui/OrderedList.js	(revision 374)
@@ -6,5 +6,6 @@
     'dijit/_WidgetsInTemplateMixin',
     'dijit/_Container',
-    'dojo/text!./templates/List.html'
+    'rft/ui/List',
+    'dojo/text!./templates/OrderedList.html'
     ],function(
         declare,
@@ -14,15 +15,10 @@
         _WidgetsInTemplateMixin,
         _Container,
+        List,
         templateString
         ){
-        return declare('rft.ui.List',[_WidgetBase,_TemplatedMixin,_WidgetsInTemplateMixin,_Container],{
+        return declare('rft.ui.OrderedList',[_WidgetBase,_TemplatedMixin,_WidgetsInTemplateMixin,_Container,List],{
             templateString: templateString,
-            baseClass: 'rftList',
-
-            removeCallback: null,
-
-            constructor: function() {
-                lang.mixin(this, arguments);
-            },
+            baseClass: 'rftLineListView',
 
             postCreate: function() {
@@ -100,10 +96,6 @@
                     this.source.insertNodes(false, [item]);
                 }
-            },
-            removeItem: function(item, widget) {
-                widget.destroy();
-                if(this.removeCallback)
-                    this.removeCallback(item);
             }
+
         });
     });
Index: /Dev/branches/rest-dojo-ui/client/rft/ui/QuestionEditorToolkit.js
===================================================================
--- /Dev/branches/rest-dojo-ui/client/rft/ui/QuestionEditorToolkit.js	(revision 373)
+++ /Dev/branches/rest-dojo-ui/client/rft/ui/QuestionEditorToolkit.js	(revision 374)
@@ -6,13 +6,23 @@
 	'dijit/_Container',
 	'dojo/dom-construct',
+	'rft/store',
 	'rft/ui/QuestionEditorPreviewItem',
+	'rft/ui/CategoryListView',
 	'dijit/_TemplatedMixin',
 	'dijit/_WidgetsInTemplateMixin',
+	'dijit/form/ComboBox',
 	'dojo/text!./templates/QuestionEditorToolkit.html'
-	], function(declare, lang, baseArray, _WidgetBase, _Container, domConstruct, QuestionEditorPreviewItem, _TemplatedMixin, _WidgetsInTemplateMixin, template) {
+	], function(declare, lang, baseArray, _WidgetBase, _Container, domConstruct, store, QuestionEditorPreviewItem, CategoryListView, _TemplatedMixin, _WidgetsInTemplateMixin, ComboBox, template) {
 		return declare("rft.ui.QuestionEditorToolkit", [_WidgetBase, _TemplatedMixin, _WidgetsInTemplateMixin, _Container], {
 
 			templateString: template,
-			question: null,
+			_list: null,
+			_categorySelect: null,
+			_categoryStore: null,
+			_categories : null,
+
+//			constructor: function() {
+//				lang.mixin(this, arguments);
+//			},
 
 			postCreate: function(){
@@ -42,4 +52,14 @@
 				this.inputsSource.insertNodes(false, inputsItems);
 			},
+			loadQuestion: function(question) {
+				this.propertiesForm.set('value', question);
+				this._categories = question.categories;
+				this._setupListView();
+				this._setupAutoComplete();
+			},
+			onCategoryAdd: function() {
+				this._addCategory(this._categorySelect.get('displayedValue')); 
+				this._categorySelect.reset();
+			},
 			_creator: function(item, hint) {
 				var node;
@@ -47,5 +67,4 @@
 					node = document.createElement("span");
 					node.innerHTML = item.widgetType;
-					// debugger;
 					return {node: node, data: item, type: "ToolkitItem"};
 				} else {
@@ -60,4 +79,46 @@
 				}
 			},
+			_setupListView: function() {
+				this._list = new CategoryListView( {
+					controller: this,
+					removeCallback: lang.hitch(this, this._removeCategory),
+				}).placeAt(this.listNode);
+				for (category in this._categories) {
+					this._list.insertItem(this._categories[category]);
+				}	
+				this._list.startup();
+			},
+			_setupAutoComplete: function() {
+				this._categoryStore = new dojo.store.Memory({data: [] });
+				store.query("_design/default/_view/questions", {reduce:true, group:false, group_level:1})
+					.forPairs(lang.hitch(this, function(value, key) {
+						this._categoryStore.put({ category: key[0] });
+					}));
+				this._categorySelect = new ComboBox( {
+					id: "categoriesBox",
+					name: "categories",
+					store: this._categoryStore,
+					searchAttr: "category"
+				}, "categoriesBox");
+
+				this._topicStore = new dojo.store.Memory( {data: [] });
+				store.query("_design/default/_view/questions", {reduce:true, group:true, group_level:2})
+					.forPairs(lang.hitch(this, function(value, key) {
+						this._topicStore.put({ topic: key[1]});
+					}));
+				this._topicSelect = new ComboBox( {
+					id: "topicBox",
+					name: "topic",
+					store: this._topicStore,
+					searchAttr: "topic"
+				}, "topicBox");
+            },
+			_addCategory: function(item) {
+				this._categories.push(item);
+				this._list.insertItem(item);
+			},
+			_removeCategory: function(item) {
+				this._categories.splice(this._categories.indexOf(item), 1);
+			},
 			_contentItems: function() {
 				// Returns an array of objects, from which to generate buttons to populate the ToolkitContentSource list.
Index: /Dev/branches/rest-dojo-ui/client/rft/ui/templates/List.html
===================================================================
--- /Dev/branches/rest-dojo-ui/client/rft/ui/templates/List.html	(revision 373)
+++ /Dev/branches/rest-dojo-ui/client/rft/ui/templates/List.html	(revision 374)
@@ -1,8 +1,4 @@
 <div>
-    <div data-dojo-attach-point="containerNode"></div>
-    <div style="float: right;">
-        <span>Move selected: </span>
-        <button data-dojo-type="dijit.form.Button" data-dojo-props="baseClass: 'rftBlockButton', iconClass:'rftIcon rftIconFullArrowUp'" class="trans"></button>
-        <button data-dojo-type="dijit.form.Button" data-dojo-props="baseClass: 'rftBlockButton', iconClass:'rftIcon rftIconFullArrowDown'" class="trans"></button>
-    </div>
+	<h3 data-dojo-attach-point="titleNode"></h3>
+    <div data-dojo-attach-point="sourceNode" id="source" class="${baseClass}Content"></div>
 </div>
Index: /Dev/branches/rest-dojo-ui/client/rft/ui/templates/QuestionEditorToolkit.html
===================================================================
--- /Dev/branches/rest-dojo-ui/client/rft/ui/templates/QuestionEditorToolkit.html	(revision 373)
+++ /Dev/branches/rest-dojo-ui/client/rft/ui/templates/QuestionEditorToolkit.html	(revision 374)
@@ -5,8 +5,12 @@
 				<fieldset class="align">
 					<label for="propertiesTitle">Title:</label><input data-dojo-type="dijit.form.TextBox" id="propertiesTitle" name="title"/>
-					<label for="propertiesCode">Code:</label><input data-dojo-type="dijit.form.TextBox" id="propertiesCode" name= "code"/>
-					<label for="propertiesCategories">Categories:</label><input data-dojo-type="dijit.form.FilteringSelect" id="propertiesCategories" name="categories"/>
-					<label for="propertiesTopic">Topic:</label><input data-dojo-type="dijit.form.FilteringSelect" id="propertiesTopic" name="topic"/>
-					<label for="propertiesDescription">Description:</label><textarea data-dojo-type="dijit.form.Textarea" id="propertiesDescription" name="description"></textarea>
+					<label for="propertiesCode">Code:</label><input data-dojo-type="dijit.form.TextBox" id="propertiesCode" name= "_id"/>
+					<label for="propertiesCategories">Categories:</label>
+					<div data-dojo-attach-point="listNode" class="rftLineListView"></div> 
+					<select id="categoriesBox"></select>
+					<button data-rft-attach-point="btnCategory" data-dojo-type="dijit.form.Button" data-dojo-attach-event="onClick:onCategoryAdd" data-dojo-props="baseClass:'rftBlockButton', class:'orange', iconClass: 'rftIcon rftIconPlus'">Add</button><br>
+					<label for="propertiesTopic">Topic:</label>
+					<select id="topicBox"></select>
+					<label for="propertiesDescription">Description:</label><textarea data-dojo-type="dijit.form.TextBox" id="propertiesDescription" name="description"></textarea>
 				</fieldset>
 			</div>
