Ignore:
Timestamp:
09/07/12 16:59:14 (13 years ago)
Author:
hendrikvanantwerpen
Message:

Next steps to actually make taking surveys possible.

Split Controller in Router and Content. Updated the view.html to work
with the new app/Content mechanism. Include view page in build profile.

Rearranged Couch design documents per type. Changed config tool so the
docs.js can be more readable, functions don't have to be on one line
anymore but are serialized later. Because the .htaccess proxy is limited
to the rft database for security reasons, the config tool has to be run
on Node.js, to be able to access the Couch port (which is limited by
cross domain security in the browser).

Added elastic search to .htaccess proxy as well. Seperated CouchStore?
from rft/store, which contains application specific data.

Removed some old API files that were hanging around still.

Introduced preview mode for viewSurvey page. Changed survey page to
only show published questions to be included. The surveys page has
three categories: drafts, published and runs. Creating survey runs is
not yet implemented.

Location:
Dev/branches/rest-dojo-ui/client/rft/ui
Files:
8 edited
1 copied

Legend:

Unmodified
Added
Removed
  • Dev/branches/rest-dojo-ui/client/rft/ui/Breadcrumbs.js

    r407 r410  
    66    'dojo/topic',
    77    'dijit/_WidgetBase',
    8     '../app/Controller'
    9 ], function(declare, baseArray, Button, domClass, topic, _WidgetBase,Controller){
     8    '../app/Router'
     9], function(declare, baseArray, Button, domClass, topic, _WidgetBase,Router){
    1010    return declare([_WidgetBase], {
    1111        _crumbs: [],
     
    6161                iconClass: "dijitNoIcon",
    6262                onClick: lang.hitch(this, function(){
    63                     Controller.go(path);  // TODO: fix this call!
     63                    Router.go(path);  // TODO: fix this call!
    6464                })
    6565            });
  • Dev/branches/rest-dojo-ui/client/rft/ui/LoginDialog.js

    r408 r410  
    11define(['dojo/_base/declare','dojo/_base/lang','dojo/_base/event','dijit/Dialog',
    22    'dijit/_WidgetsInTemplateMixin','../auth', 'dojo/text!./templates/LoginDialog.html',
    3     '../app/Controller','dijit/form/Form','dijit/form/Button','dijit/form/TextBox'],
     3    '../app/Router','dijit/form/Form','dijit/form/Button','dijit/form/TextBox'],
    44    function (declare, lang, event, Dialog, _WidgetsInTemplateMixin, auth, template, content) {
    55        return declare([Dialog,_WidgetsInTemplateMixin], {
  • Dev/branches/rest-dojo-ui/client/rft/ui/MenuBarLink.js

    r407 r410  
    1 define(['dojo/_base/declare','dijit/MenuBarItem','../app/Controller'],
    2 function(declare,MenuBarItem,Controller){
     1define(['dojo/_base/declare','dijit/MenuBarItem','../app/Router'],
     2function(declare,MenuBarItem,Router){
    33    return declare([MenuBarItem],{
    44        options:{
     
    66        },
    77        onClick: function(){
    8             this.path && Controller.go(this.path);
     8            this.path && Router.go(this.path);
    99        }
    1010    });
  • Dev/branches/rest-dojo-ui/client/rft/ui/MenuLink.js

    r407 r410  
    1 define(['dojo/_base/declare','dijit/MenuItem','../app/Controller'],
    2 function(declare,MenuItem,Controller){
     1define(['dojo/_base/declare','dijit/MenuItem','../app/Router'],
     2function(declare,MenuItem,Router){
    33    return declare([MenuItem],{
    44        options:{
     
    66        },
    77        onClick: function(){
    8             this.path && Controller.go(this.path);
     8            this.path && Router.go(this.path);
    99        }
    1010    });
  • Dev/branches/rest-dojo-ui/client/rft/ui/Notifications.js

    r407 r410  
    1 define(['dojo/_base/declare','dojo/_base/lang','dojo/_base/connect','dojox/widget/Toaster'],
    2     function(declare,lang,connect,Toaster){
    3         return declare([Toaster],{
    4             positionDirection: "br-up",
    5             duration: 1000,
    6             postCreate: function() {
    7                 this.inherited(arguments);
    8                 this.handle = connect.subscribe('/rft/notify',lang.hitch(this,function(notification){
    9                     this.setContent(notification.text,notification.type || 'message');
    10                 }));
    11             },
    12             destroy: function() {
    13                 connect.unsubscribe(this.handle);
    14                 this.inherited(arguments);
    15             }
    16         });
     1define(['dojo/_base/declare','dojo/_base/lang','dojox/widget/Toaster'],
     2function(declare,lang,Toaster){
     3    return declare([Toaster],{
     4        positionDirection: "br-up",
     5        duration: 1000
    176    });
     7});
  • Dev/branches/rest-dojo-ui/client/rft/ui/QuestionEditorToolkit.js

    r407 r410  
    129129            _setupCategories: function() {
    130130                this._categoryStore = new Memory({data: [] });
    131                 store.query("_design/default/_view/questions", {reduce:true, group:false, group_level:1})
     131                store.query("_design/questions/_view/all", {reduce:true, group:false, group_level:1})
    132132                .forPairs(lang.hitch(this, function(value, key) {
    133133                    this._categoryStore.put({ id: key[0] });
     
    143143            _setupTopic: function(topic) {
    144144                this._topicStore = new Memory( {data: [] });
    145                 store.query("_design/default/_view/topics", {reduce:true, group:true})
     145                store.query("_design/questions/_view/all_topics", {reduce:true, group:true})
    146146                .forPairs(lang.hitch(this, function(value, key) {
    147147                    this._topicStore.put({ id: key });
  • Dev/branches/rest-dojo-ui/client/rft/ui/Selector.js

    r407 r410  
    149149        },
    150150
    151         addItem: function(item) {
     151        addItem: function(item,displayTitle) {
    152152            var actions = {};
    153153            var action;
     
    156156                    action = this.itemActions[actionName];
    157157                    actions[actionName] = {
    158                         callback: function(){
    159                             action.callback && action.callback(item);
    160                         },
     158                        callback: action.callback && lang.partial(action.callback,item),
    161159                        properties: {
    162160                            blockButton: false,
     
    165163                            tooltip: action.description
    166164                        }
    167                     }
     165                    };
    168166                }
    169167            }
    170168            var w = new LineWithActionsWidget({
    171                 title: item.title,
     169                title: displayTitle || item.title,
    172170                actions: actions
    173171            }).placeAt(this.optionsNode);
  • Dev/branches/rest-dojo-ui/client/rft/ui/TabbedQuestionBrowser.js

    r407 r410  
    99    'rft/ui/Selector',
    1010    'dojo/domReady!'
    11     ],
    12     function(declare,lang,win,ContentPane,TabContainer,Standby,store,Selector){
    13         return declare([TabContainer],{
    14             tabPosition: 'left-h',
     11],function(declare,lang,win,ContentPane,TabContainer,Standby,store,Selector){
     12    return declare([TabContainer],{
     13        tabPosition: 'left-h',
     14        include: 'all',
    1515
    16             selectedActions: null,
    17             itemActions: null,
     16        selectedActions: null,
     17        itemActions: null,
    1818
    19             _dataMap: null,
    20             _busyCount: 0,
    21             constructor: function(){
    22                 this.inherited(arguments);
    23                 this._dataMap = {};
    24             },
    25             startup: function() {
    26                 if ( this._started ){ return; }
    27                 this.inherited(arguments);
    28                 this._busyWidget = new Standby({
    29                     target: this.domNode,
    30                     duration: 200
    31                 }).placeAt(win.body());
    32                 this._busyWidget.startup();
    33                 this.watch("selectedChildWidget",lang.hitch(this,function(name,oldTab,newTab){
    34                     this._fillCategoryTab(newTab.__category);
     19        _dataMap: null,
     20        _busyCount: 0,
     21        constructor: function(){
     22            this.inherited(arguments);
     23            this._dataMap = {};
     24        },
     25        postCreate: function() {
     26            this.inherited(arguments);
     27            this._query = '_design/questions/_view/'+this.include;
     28        },
     29        startup: function() {
     30            if ( this._started ){ return; }
     31            this.inherited(arguments);
     32            this._busyWidget = new Standby({
     33                target: this.domNode,
     34                duration: 200
     35            }).placeAt(win.body());
     36            this._busyWidget.startup();
     37            this.watch("selectedChildWidget",lang.hitch(this,function(name,oldTab,newTab){
     38                this._fillCategoryTab(newTab.__category);
     39            }));
     40            store.query(this._query, {reduce:true,group:true,group_level:1})
     41            .forPairs(lang.hitch(this,function(value,key){
     42                this._createCategoryTab(key[0],value);
     43            }));
     44        },
     45        _createCategoryTab: function(category,count) {
     46            if (this._dataMap[category] === undefined) {
     47                var categoryTab = new ContentPane({
     48                    __category: category,
     49                    title: (category || '[No category]')+" ("+count+")"
     50                });
     51                categoryTab.startup();
     52                this._dataMap[category] = {
     53                    _widget: categoryTab
     54                };
     55                this.addChild(categoryTab);
     56            }
     57        },
     58        _fillCategoryTab: function(category) {
     59            var categoryMap = this._dataMap[category];
     60            if (!categoryMap._filled) {
     61                this._busy();
     62                categoryMap._filled = true;
     63                store.query(this._query, {reduce:true,group:true,group_level:2,startkey:[category],endkey:[category,{}]})
     64                .forPairs(lang.hitch(this,function(value,key){
     65                    this._createTopicSelector(key[1],category,value);
     66                })).then(lang.hitch(this,function(){
     67                    this._done();
    3568                }));
    36                 store.query('_design/default/_view/questions', {reduce:true,group:true,group_level:1})
    37                 .forPairs(lang.hitch(this,function(value,key){
    38                     this._createCategoryTab(key[0],value);
     69            }
     70        },
     71        _createTopicSelector: function(topic,category,count){
     72            var categoryMap = this._dataMap[category];
     73            if (categoryMap[topic] === undefined) {
     74                var w = new Selector({
     75                    __category: category,
     76                    __topic: topic,
     77                    title: (topic || '[No topic]')+" ("+count+")",
     78                    selectedActions: this.selectedActions,
     79                    itemActions: this.itemActions
     80                }).placeAt(categoryMap._widget.containerNode);
     81                w.startup();
     82                categoryMap[topic] = {
     83                    _widget: w
     84                };
     85                this._fillTopicSelector(topic,category);
     86            }
     87        },
     88        _fillTopicSelector: function(topic,category) {
     89            var categoryMap = this._dataMap[category];
     90            var topicMap = categoryMap[topic];
     91            if (!topicMap._filled) {
     92                topicMap._filled = true;
     93                this._busy();
     94                store.query(this._query, {reduce:false,include_docs:true,key:[category,topic]})
     95                .forEach(lang.hitch(this,function(value){
     96                    var title;
     97                    if ( this.include === 'all' ) {
     98                        title = value.title+(value.publicationDate?' (published on '+value.publicationDate+')':' (unpublished)');
     99                    }
     100                    topicMap._widget.addItem(value,title);
     101                })).then(lang.hitch(this,function(){
     102                    this._done();
    39103                }));
    40             },
    41             _createCategoryTab: function(category,count) {
    42                 if (this._dataMap[category] === undefined) {
    43                     var categoryTab = new ContentPane({
    44                         __category: category,
    45                         title: (category || '[No category]')+" ("+count+")"
    46                     });
    47                     categoryTab.startup();
    48                     this._dataMap[category] = {
    49                         _widget: categoryTab
    50                     };
    51                     this.addChild(categoryTab);
     104            }
     105        },
     106        _busy: function() {
     107            if ( this._busyCount === 0 ) {
     108                this._busyWidget.show();
     109            }
     110            this._busyCount++;
     111        },
     112        _done: function() {
     113            if ( this._busyCount > 0 ) {
     114                this._busyCount--;
     115                if ( this._busyCount === 0 ) {
     116                    this._busyWidget.hide();
    52117                }
    53             },
    54             _fillCategoryTab: function(category) {
    55                 var categoryMap = this._dataMap[category];
    56                 if (!categoryMap._filled) {
    57                     this._busy();
    58                     categoryMap._filled = true;
    59                     store.query('_design/default/_view/questions', {reduce:true,group:true,group_level:2,startkey:[category],endkey:[category,{}]})
    60                     .forPairs(lang.hitch(this,function(value,key){
    61                         this._createTopicSelector(key[1],category,value);
    62                     })).then(lang.hitch(this,function(){
    63                         this._done();
    64                     }));
    65                 }
    66             },
    67             _createTopicSelector: function(topic,category,count){
    68                 var categoryMap = this._dataMap[category];
    69                 if (categoryMap[topic] === undefined) {
    70                     var w = new Selector({
    71                         __category: category,
    72                         __topic: topic,
    73                         title: (topic || '[No topic]')+" ("+count+")",
    74                         selectedActions: this.selectedActions,
    75                         itemActions: this.itemActions
    76                     }).placeAt(categoryMap._widget.containerNode);
    77                     w.startup();
    78                     categoryMap[topic] = {
    79                         _widget: w
    80                     };
    81                     this._fillTopicSelector(topic,category);
    82                 }
    83             },
    84             _fillTopicSelector: function(topic,category) {
    85                 var categoryMap = this._dataMap[category];
    86                 var topicMap = categoryMap[topic];
    87                 if (!topicMap._filled) {
    88                     topicMap._filled = true;
    89                     this._busy();
    90                     store.query('_design/default/_view/questions', {reduce:false,include_docs:true,key:[category,topic]})
    91                     .forEach(lang.hitch(this,function(value){
    92                         topicMap._widget.addItem(value);
    93                     })).then(lang.hitch(this,function(){
    94                         this._done();
    95                     }));
    96                 }
    97             },
    98             _busy: function() {
    99                 if ( this._busyCount === 0 ) {
    100                     this._busyWidget.show();
    101                 }
    102                 this._busyCount++;
    103             },
    104             _done: function() {
    105                 if ( this._busyCount > 0 ) {
    106                     this._busyCount--;
    107                     if ( this._busyCount === 0 ) {
    108                         this._busyWidget.hide();
    109                     }
    110                 } else {
    111                     console.warn('_done() was called more times than _busy().');
    112                 }
    113             },
    114             destroy: function() {
    115                 this._busyWidget.destroyRecursive();
    116                 this.inherited(arguments);
     118            } else {
     119                console.warn('_done() was called more times than _busy().');
    117120            }
    118         });
     121        },
     122        destroy: function() {
     123            this._busyWidget.destroyRecursive();
     124            this.inherited(arguments);
     125        }
    119126    });
     127});
  • Dev/branches/rest-dojo-ui/client/rft/ui/ThresholdFilteringSelect.js

    r407 r410  
    1616         }
    1717    });
    18 })
     18});
Note: See TracChangeset for help on using the changeset viewer.