Changeset 414
- Timestamp:
- 11/24/12 18:13:18 (12 years ago)
- Location:
- Dev/branches/rest-dojo-ui
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
Dev/branches/rest-dojo-ui/client/config/config.sh
r410 r414 1 1 #!/bin/sh 2 node ../dojo/dojo.js load=config/db2 nodejs ../dojo/dojo.js load=config/db -
Dev/branches/rest-dojo-ui/client/config/db.js
r410 r414 91 91 }); 92 92 },function(){ 93 console.log("Checking database 'rft'"); 94 return req('get','rft') 95 .then(function(){ 96 console.log("Database 'rft' found."); 97 },function(){ 98 console.log("Creating database 'rft'"); 99 return req('put','/rft'); 93 console.log("Checking database 'qed'"); 94 return req('get','qed') 95 .then(function(res){ 96 if (res.error) { 97 console.log("Creating database 'qed'"); 98 return req('put','/qed'); 99 } else { 100 console.log("Database 'qed' found."); 101 } 102 },function(res){ 103 console.log("Creating database 'qed'"); 104 return req('put','/qed'); 100 105 }); 101 106 },function(){ -
Dev/branches/rest-dojo-ui/client/config/docs.js
r410 r414 1 1 define([],function(){ 2 2 return { 3 "_users/ rft_admin": {3 "_users/qed_admin": { 4 4 __configAction: "ignore", 5 _id: "org.couchdb.user: rft_admin",6 name: " rft_admin",5 _id: "org.couchdb.user:qed_admin", 6 name: "qed_admin", 7 7 password: "Welkom01", 8 roles: [ " rft_admin" ],8 roles: [ "qed_admin" ], 9 9 type: "user" 10 10 }, 11 " rft/_security": {11 "qed/_security": { 12 12 __configAction: "ignore", 13 13 admins: { 14 14 names: [], 15 roles: [" rft_admin"]15 roles: ["qed_admin"] 16 16 }, 17 17 readers: { 18 18 names: [], 19 roles: [" rft_user"]19 roles: ["qed_user"] 20 20 } 21 21 }, 22 " rft/_design/default": {22 "qed/_design/default": { 23 23 __configAction: "replace", 24 24 _id: "_design/default", … … 36 36 } 37 37 }, 38 " rft/_design/questions": {38 "qed/_design/questions": { 39 39 __configAction: "replace", 40 40 _id: "_design/questions", … … 75 75 if( doc.type !== 'Question' ){ return; } 76 76 emit(doc.topic); 77 } 77 }, 78 reduce: function(key, values, rereduce) { return null; } 78 79 }, 79 80 published_topics: { … … 81 82 if ( doc.type !== 'Question' || !doc.publicationDate ) { return; } 82 83 emit(doc.topic); 83 } 84 }, 85 reduce: function(key, values, rereduce) { return null; } 84 86 } 85 87 } 86 88 }, 87 " rft/_design/surveys": {89 "qed/_design/surveys": { 88 90 __configAction: "replace", 89 91 _id: "_design/surveys", -
Dev/branches/rest-dojo-ui/client/data/.htaccess
r410 r414 1 1 RewriteEngine on 2 RewriteRule couch/(.*) http://localhost:5984/ rft/$1 [P,QSA]3 RewriteRule elastic http://localhost:9200/ rft/_search [P,QSA]2 RewriteRule couch/(.*) http://localhost:5984/qed/$1 [P,QSA] 3 RewriteRule elastic http://localhost:9200/qed/_search [P,QSA] -
Dev/branches/rest-dojo-ui/client/index.html
r411 r414 12 12 <div class="topbar" data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:'top'"> 13 13 <a href="#!/"><h1>QED</h1></a> 14 <div data-dojo-type="rft/ui/MainMenu"></div>14 <div id="menu"></div> 15 15 </div> 16 16 </div> -
Dev/branches/rest-dojo-ui/client/rft/pages/questions.js
r411 r414 20 20 'class': 'orange', 21 21 itemActions: { 22 Delete: { 23 callback: lang.hitch(this,"onDeleteQuestion"), 24 icon: 'Delete', 25 description: 'Delete question' 26 }, 22 27 Edit: { 23 28 callback: lang.hitch(this,"onEditQuestion"), … … 40 45 })); 41 46 }, 47 onDeleteQuestion: function(question) { 48 store.remove(store.getIdentity(question),store.getRevision(question)) 49 .then(function(){ 50 Content.notify("Question deleted."); 51 },function(err){ 52 Content.notify(err.reason,'error'); 53 }); 54 }, 42 55 onEditQuestion: function(question) { 43 56 Router.go("/question/"+question._id); … … 47 60 store.put(question) 48 61 .then(function(){ 49 Content.notify("Question pu plished.");62 Content.notify("Question published."); 50 63 },function(err){ 51 64 Content.notify(err.reason,'error'); -
Dev/branches/rest-dojo-ui/client/rft/pages/surveys.html
r410 r414 14 14 </div> 15 15 <div data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region: 'bottom'" style="height: 40px;"> 16 <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>17 16 </div> 18 17 </div> … … 33 32 </div> 34 33 34 <div data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region: 'bottom'" style="height: 40px;"> 35 <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> 36 </div> 37 35 38 </div> -
Dev/branches/rest-dojo-ui/client/rft/pages/surveys.js
r410 r414 22 22 .then(function(survey) { 23 23 Router.go('/survey/'+store.getIdentity(survey)); 24 },function(err){ 25 Content.notify(err.reason,'error'); 24 26 }); 25 27 }, -
Dev/branches/rest-dojo-ui/client/rft/run.js
r410 r414 2 2 'dojo/_base/array', 3 3 'dojo/parser', 4 'rft/app/Content', 5 'rft/app/Page', 4 6 'rft/app/Router', 7 'rft/ui/MainMenu', 5 8 'rft/routes', 9 'rft/store', 6 10 'rft/stddeps', 7 11 'dojo/domReady!' 8 ],function(array,parser, router,routes) {12 ],function(array,parser,Content,Page,Router,MainMenu,routes,store) { 9 13 parser.parse(); 10 array.forEach(routes,function(route){ 11 router.register(route); 14 15 store.info() 16 .then(function(){ 17 new MainMenu({},"menu").startup(); 18 array.forEach(routes,function(route){ 19 Router.register(route); 20 }); 21 Router.startup(); 22 },function(){ 23 Content.startup(); 24 Content.set(new Page({ 25 templateString: "<div>Application database is not properly configured. Contact your system administrator.</div>" 26 })); 12 27 }); 13 router.startup();14 28 }); -
Dev/branches/rest-dojo-ui/client/rft/store/CouchStore.js
r410 r414 35 35 getRevision: function(object){ 36 36 return object[this.revProperty]; 37 }, 38 info: function(){ 39 var dfd = new Deferred(); 40 xhr("GET", { 41 url: this.target, 42 handleAs: "json", 43 headers: { 44 Accept: this.accepts 45 } 46 }).then(function(result){ 47 if ( result.error ) { 48 dfd.reject(result.reason); 49 } else { 50 dfd.resolve(result); 51 } 52 }, function(err){ 53 dfd.reject(getCouchError(err)); 54 }); 55 return dfd.promise; 37 56 }, 38 57 get: function(id){ -
Dev/branches/rest-dojo-ui/client/rft/ui/MainMenu.js
r407 r414 1 define(['dojo/_base/declare','dijit/_WidgetBase', 2 'dijit/_TemplatedMixin','dijit/_WidgetsInTemplateMixin','dojo/text!./templates/MainMenu.html'], 3 function(declare,_WidgetBase,_TemplatedMixin,_WidgetsInTemplateMixin,template){ 4 return declare([_WidgetBase,_TemplatedMixin,_WidgetsInTemplateMixin],{ 5 templateString: template 6 }); 1 define([ 2 'dojo/_base/declare', 3 'dijit/_WidgetBase', 4 'dijit/_TemplatedMixin', 5 'dijit/_WidgetsInTemplateMixin', 6 'dojo/text!./templates/MainMenu.html' 7 ],function(declare,_WidgetBase,_TemplatedMixin,_WidgetsInTemplateMixin,template){ 8 return declare([_WidgetBase,_TemplatedMixin,_WidgetsInTemplateMixin],{ 9 templateString: template 7 10 }); 11 }); -
Dev/branches/rest-dojo-ui/client/rft/ui/QuestionEditorPreview.js
r407 r414 1 1 define([ 2 'dojo/_base/array', 2 3 'dojo/_base/declare', 3 4 'dojo/_base/lang', … … 6 7 './QuestionEditorPreviewItem', 7 8 './lists/OrderedList' 8 ], function( declare, lang, domConstruct, registry, QuestionEditorPreviewItem, OrderedList) {9 ], function(array, declare, lang, domConstruct, registry, QuestionEditorPreviewItem, OrderedList) { 9 10 return declare([OrderedList], { 10 11 baseClass: 'surveyEditorPreview', … … 26 27 }, 27 28 getItems: function() { 28 return this.source.getAllNodes() 29 .map(function(node){ 30 return registry.byNode(node).get('value'); 31 },this); 29 return array.map( 30 this.source.getAllNodes(), 31 function(node){ 32 return registry.byNode(node).get('value'); 33 },this); 32 34 } 33 35 }); -
Dev/branches/rest-dojo-ui/client/rft/ui/QuestionEditorPreviewItem.js
r407 r414 62 62 this.innerWidget.set('readOnly',true); 63 63 } 64 this.titleNode.innerHTML = (this.item.code||"(no code)")+" : "+this.item.type+" [preview]";64 this.titleNode.innerHTML = this.item.type+" [preview]"; 65 65 }, 66 66 _showEditWidget: function() { … … 71 71 this.innerWidget.startup(); 72 72 } 73 this.titleNode.innerHTML = (this.item.code||"(no code)")+" : "+this.item.type+" [editing]";73 this.titleNode.innerHTML = this.item.type+" [editing]"; 74 74 }, 75 75 onClose: function() {}, -
Dev/branches/rest-dojo-ui/client/rft/ui/content/ContentWidgetFactory.js
r407 r414 9 9 'dijit/form/Button', 10 10 'dijit/form/CheckBox', 11 'dijit/form/Form', 11 12 'dijit/form/NumberSpinner', 12 13 'dijit/form/RadioButton', … … 16 17 './../lists/_EditableListMixin', 17 18 './../lists/OrderedList' 18 ],function(array, declare, lang, domConstruct, _TemplatedMixin, _WidgetBase, _Container, Button, CheckBox, NumberSpinner, RadioButton, Textarea, TextBox, TableContainer, _EditableListMixin, OrderedList) {19 ],function(array, declare, lang, domConstruct, _TemplatedMixin, _WidgetBase, _Container, Button, CheckBox, Form, NumberSpinner, RadioButton, Textarea, TextBox, TableContainer, _EditableListMixin, OrderedList) { 19 20 var factory = declare(null, { 20 21 createViewWidget: function(/*Object*/options) { … … 95 96 }); 96 97 98 var DefaultEdit = declare([Form,_Container],{ 99 type: null, 100 addChild: function(widget) { 101 domConstruct.create("label",{ 102 innerHTML: widget.title || '' 103 },this.containerNode,'last'); 104 this.inherited(arguments,[widget]); 105 }, 106 _getValueAttr: function() { 107 var val = this.inherited(arguments); 108 val.type = this.type; 109 return val; 110 } 111 }); 112 97 113 var HeaderView = declare([_WidgetBase], { 98 114 postCreate: function() { … … 101 117 }); 102 118 103 var HeaderEdit = declare([_WidgetBase, _Container], { 119 var HeaderEdit = declare([DefaultEdit], { 120 type: 'Header', 121 postCreate: function() { 122 this.inherited(arguments); 123 this.addChild(new TextBox({ 124 title: 'Content', 125 name: 'content' 126 })); 127 } 128 }); 129 130 var TextView = declare([_WidgetBase], { 131 postCreate: function() { 132 this.domNode.innerHTML = "<p>"+this.options.content+"</p>"; 133 } 134 }); 135 136 var TextEdit = declare([DefaultEdit], { 137 type: 'Text', 138 postCreate: function() { 139 this.inherited(arguments); 140 this.addChild(new Textarea({ 141 title: 'Content', 142 name: 'content' 143 })); 144 } 145 }); 146 147 var DividerView = declare([_WidgetBase], { 148 postCreate: function() { 149 this.domNode.innerHTML = "<hr>"; 150 } 151 }); 152 153 var DefaultInputEdit = declare([DefaultEdit],{ 154 postCreate: function() { 155 this.inherited(arguments); 156 this.addChild(new TextBox({ 157 title: 'Text', 158 name: 'text' 159 })); 160 } 161 }); 162 163 var StringInputView = declare([_WidgetBase, _Container],{ 104 164 _textBox: null, 105 165 postCreate: function() { 106 this._textBox = new TextBox(); 166 this._textBox = new TextBox({ 167 name: this.options.code || '' 168 }); 107 169 this.addChild(this._textBox); 108 170 this._textBox.startup(); 109 171 }, 110 _setValueAttr: function(value) {111 this._textBox.set('value', value.content || "");112 },113 _getValueAttr: function() {114 return { type: 'Header',115 content: this._textBox.get('displayedValue')116 };117 }118 });119 120 var TextView = declare([_WidgetBase], {121 postCreate: function() {122 this.domNode.innerHTML = "<p>"+this.options.content+"</p>";123 }124 });125 126 var TextEdit = declare([_WidgetBase, _Container], {127 _textArea: null,128 postCreate: function() {129 this._textArea = new Textarea();130 this.addChild(this._textArea);131 this._textArea.startup();132 },133 _setValueAttr: function(value) {134 this._textArea.set('value', value.content || "");135 },136 _getValueAttr: function() {137 return { type: 'Text',138 content: this._textArea.get('displayedValue')139 };140 }141 })142 143 var DividerView = declare([_WidgetBase], {144 postCreate: function() {145 this.domNode.innerHTML = "<hr>";146 }147 });148 149 var StringInputView = declare([_WidgetBase, _Container],{150 _textBox: null,151 postCreate: function() {152 this._textBox = new TextBox({153 name: this.options.code || ''154 });155 this.addChild(this._textBox);156 this._textBox.startup();157 },158 172 _setReadOnlyAttr: function(value) { 159 173 this._textBox.set('readOnly', value); … … 170 184 }); 171 185 172 var StringInputEdit = declare([_WidgetBase, _Container],{ 173 _codeInput: null, 174 postCreate: function() { 175 var table = new TableContainer({ cols: 1, customClass: "labelsAndValues"} ); 176 177 this._codeInput = new TextBox({ 178 title: "Code" 179 }); 180 table.addChild(this._codeInput); 181 this._codeInput.startup(); 182 183 this.addChild(table); 184 table.startup(); 185 }, 186 _getValueAttr: function() { 187 return { 188 type: "StringInput", 189 code: this._codeInput.get('value') || "" 190 }; 191 }, 192 _setValueAttr: function(value) { 193 this._codeInput.set('value', value.code || ""); 194 } 186 var StringInputEdit = declare([DefaultInputEdit],{ 187 type: 'StringInput' 195 188 }); 196 189 … … 217 210 }); 218 211 219 var TextInputEdit = declare([_WidgetBase, _Container], { 220 _codeInput: null, 221 _maxLengthInput: null, 222 postCreate: function() { 223 var table = new TableContainer({ cols: 1, customClass: "labelsAndValues"} ); 224 225 this._codeInput = new TextBox({ 226 title: "Code" 227 }); 228 table.addChild(this._codeInput); 229 this._codeInput.startup(); 230 231 this._maxLengthInput = new NumberSpinner({ 212 var TextInputEdit = declare([DefaultInputEdit], { 213 type: 'TextInput', 214 postCreate: function() { 215 this.inherited(arguments); 216 this.addChild(new NumberSpinner({ 217 name: 'maxLength', 232 218 title: "Maximum length", 233 219 constraints: { 234 220 min: 0 235 221 } 236 }); 237 table.addChild(this._maxLengthInput); 238 this._maxLengthInput.startup(); 239 240 this.addChild(table); 241 table.startup(); 242 }, 243 244 _setValueAttr: function(value) { 245 this._codeInput.set('value', value.code || ""); 246 this._maxLengthInput.set('value', value.maxLength); 247 }, 248 _getValueAttr: function() { 249 return { 250 type: "TextInput", 251 code: this._codeInput.get('value') || "", 252 maxLength: this._maxLengthInput.get('value') 253 }; 222 })); 254 223 } 255 224 }); … … 280 249 }); 281 250 282 var IntegerInputEdit = declare([_WidgetBase, _Container], { 283 _codeInput: null, 284 _minInput: null, 285 _maxInput: null, 286 postCreate: function() { 287 var table = new TableContainer({ cols: 1, customClass: "labelsAndValues"} ); 288 289 this._codeInput = new TextBox({ 290 title: "Code" 291 }); 292 table.addChild(this._codeInput); 293 this._codeInput.startup(); 294 295 this._minInput = new NumberSpinner({ 296 title: "Minimum" 297 }); 298 table.addChild(this._minInput); 299 this._minInput.startup(); 300 301 this._maxInput = new NumberSpinner({ 302 title: "Maximum" 303 }); 304 table.addChild(this._maxInput); 305 this._maxInput.startup(); 306 307 this._stepInput = new NumberSpinner({ 308 title: "Step" 309 }); 310 table.addChild(this._stepInput); 311 this._stepInput.startup(); 312 313 this.addChild(table); 314 table.startup(); 315 }, 316 317 _setValueAttr: function(value) { 318 this._codeInput.set('value', value.code || ""); 319 this._minInput.set('value', value.min); 320 this._maxInput.set('value', value.max); 321 this._stepInput.set('value', value.step); 322 }, 323 _getValueAttr: function() { 324 return { 325 type: "IntegerInput", 326 code: this._codeInput.get('value') || "", 327 min: this._minInput.get('value'), 328 max: this._maxInput.get('value'), 329 step: this._stepInput.get('value') 330 }; 251 var IntegerInputEdit = declare([DefaultInputEdit], { 252 type: 'IntegerInput', 253 postCreate: function() { 254 this.inherited(arguments); 255 this.addChild(new NumberSpinner({ 256 title: "Minimum", 257 name: 'min' 258 })); 259 this.addChild(new NumberSpinner({ 260 title: "Maximum", 261 name: 'max' 262 })); 263 this.addChild(new NumberSpinner({ 264 title: "Step", 265 name: 'step' 266 })); 331 267 } 332 268 }); -
Dev/branches/rest-dojo-ui/client/rft/ui/templates/MainMenu.html
r407 r414 12 12 </div> 13 13 <div class="rftMainMenuButton" data-dojo-type="rft/ui/MenuBarLink" data-dojo-props="path:'/results'">Results</div> 14 <div class="rftMainMenuButton" data-dojo-type="rft/ui/MenuBarLink" id="loginMenu">Logout</div>14 <div class="rftMainMenuButton" data-dojo-type="rft/ui/MenuBarLink">Logout</div> 15 15 </div> 16 16 </div> -
Dev/branches/rest-dojo-ui/docs/jsonformat.txt
r410 r414 1 Document types 2 ============== 3 4 5 Question types 6 ============== 7 8 9 1 10 sessions 2 11 ======== … … 43 52 topic: '' 44 53 categories: [] 45 content: [{ type:'contentTypeId', /* custom content element fields */ } /*and more ... */]54 content: [{ type:'contentTypeId', text: '' || ['' ...], /* custom content element fields */ } /*, and more ... */] 46 55 }
Note: See TracChangeset
for help on using the changeset viewer.