Changeset 399


Ignore:
Timestamp:
08/15/12 18:30:58 (13 years ago)
Author:
hendrikvanantwerpen
Message:

Added survey viewer page.

Added view.html page to view surveys. Widgets from the questions are
displayed, no answers are saved yet.

The content module is split for index.html and view.html, so viewers
cannot navigate to other pages. Widgets to pre-load are now seperated
in stddeps.js module and shared between run.js & view.js.

Location:
Dev/branches/rest-dojo-ui
Files:
2 added
6 edited
5 copied

Legend:

Unmodified
Added
Removed
  • Dev/branches/rest-dojo-ui

    • Property svn:ignore
      •  

        old new  
        11nbproject
         2.project
  • Dev/branches/rest-dojo-ui/client/rft/content.js

    r347 r399  
    1919 * this e.g. to ask confirmation if changed values are not saved.
    2020 */
    21 define(['dojo/_base/declare','dojo/_base/connect','dojo/_base/xhr','dojo/_base/json',
    22     'dojo/_base/lang','dojo/_base/Deferred','dojo/hash','dojo/dom-attr','dojo/dom-construct',
    23     'dojo/io-query','dijit','./util','./ui/_Page'],
    24     function(declare,connect,xhr,json,lang,Deferred,hash,attr,domConstruct,uriQuery,dijit,util,_Page){
    25         return new (function() {
    26             var self = this;
     21define([
     22    'dojo/_base/Deferred',
     23    'dojo/_base/json',
     24    'dojo/_base/lang',
     25    'dojo/_base/xhr',
     26    'dojo/dom-attr',
     27    'dojo/dom-construct',
     28    'dijit/registry',
     29    './ui/_Page',
     30    'dojo/domReady!'
     31],function(Deferred,json,lang,xhr,attr,domConstruct,registry,_Page){
     32    return new (function(){
     33        var self = this;
     34        var inited = false;
    2735
    28             var HRI = declare(null,{
    29                 constructor: function() {
    30                     this._path = this._fixPath('/');
    31                     this._args = {};
    32                     if ( arguments.length == 1 ) {
    33                         this.hash(arguments[0]);
    34                     } else if ( arguments.length == 2 ) {
    35                         this.path(arguments[0]);
    36                         this.args(arguments[1]);
     36        var okay = new Deferred();
     37        okay.resolve();
     38        okay = okay.promise;
     39
     40        var fail = new Deferred();
     41        fail.reject();
     42        fail = fail.promise;
     43
     44        var contentPane = null;
     45        self.goToImpl = null;
     46        self.initialImpl = null;
     47
     48        self.init = function() {
     49            contentPane = registry.byId('content');
     50            inited = true;
     51        };
     52
     53        self.goTo = function(path,args) {
     54            if ( !inited ) { return fail; }
     55            if ( self.goToImpl !== null ) {
     56                return self.goToImpl(path,args);
     57            } else {
     58                return fail;
     59            }
     60        };
     61
     62        self.initial = function(path,args) {
     63            if ( !inited ) { return fail; }
     64            if ( self.initialImpl !== null ) {
     65                return self.initialImpl(path,args);
     66            } else {
     67                return fail;
     68            }
     69        };
     70
     71        self._loadPage = function(path,args) {
     72            if ( !inited ) { return fail; }
     73            var dfd = new Deferred();
     74
     75            function getFirstNode(html) {
     76                var nodeOrFragment = domConstruct.toDom(html);
     77                if (nodeOrFragment instanceof Element) {
     78                    return nodeOrFragment;
     79                }
     80                if (nodeOrFragment instanceof DocumentFragment) {
     81                    console.warn("Fragment found, will only use first Element");
     82                    for (var i in nodeOrFragment.childNodes) {
     83                        var node = nodeOrFragment.childNodes[i];
     84                        if (node instanceof Element) {
     85                            return node;
     86                        }
    3787                    }
    38                 },
    39                 path: function(path) {
    40                     if ( path )
    41                         this._path = this._fixPath(path);
    42                     return this._path;
    43                 },
    44                 args: function(args) {
    45                     if ( args && lang.isObject(args) )
    46                         this._args = args;
    47                     return this._args;
    48                 },
    49                 hash: function(hash) {
    50                     if ( hash && lang.isString(hash) ) {
    51                         var parts = hash.split('!');
    52                         if ( parts[1] )
    53                             this._path = this._fixPath(parts[1]);
    54                         if ( parts[2] )
    55                             this._args = uriQuery.queryToObject(parts[2]);
    56                     }
    57                     return '!'+this._path+'!'+uriQuery.objectToQuery(this._args);
    58                 },
    59                 _fixPath: function(path) {
    60                     if ( !lang.isString(path) || util.isEmptyString(path) ) {
    61                         path = "/";
    62                     }
    63                     if ( path[0] != '/' ) {
    64                         path = '/'+path;
    65                     }
    66                     if ( path[path.length-1] == '/' ) {
    67                         path = path + "index";
    68                     }
    69                     return path;
    7088                }
     89                return domConstruct.toDom('<div>No Element found in template.</div>');
     90            }
     91
     92            function mixinArgs(node) {
     93                var props = {};
     94                if ( attr.has(node,'data-dojo-props') ) {
     95                    props = json.fromJson(attr.get(node,'data-dojo-props'));
     96                }
     97                lang.mixin(props,{pageArgs:args});
     98                var jsonStr = json.toJson(props);
     99                attr.set(node,'data-dojo-props',jsonStr.slice(1,jsonStr.length-1));
     100            }
     101               
     102            // load html
     103            var pageUrl = 'rft/pages'+path+'.html';
     104            xhr.get({
     105                url: pageUrl,
     106                failOk: true
     107            })
     108            // initialize page or create error message
     109            .then(function(html){
     110                var rootNode = getFirstNode(html);
     111                mixinArgs(rootNode);
     112                contentPane.set('content',rootNode);
     113                var page = registry.byNode(rootNode);
     114                if ( !page ) {
     115                    page = new _Page({},rootNode);
     116                }
     117                dfd.resolve(page);
     118            },function(){
     119                contentPane.set('content',"<div>Page "+path+" not found.</div>");
     120                dfd.reject();
    71121            });
    72122
    73             var currentHri = null;
    74             var currentPage = null;
    75            
    76             function _goTo(hri,replace) {
    77                 var contentPane = dijit.byId('content');
    78                 var dfd = new Deferred();
    79                
    80                 // if already there, return
    81                 if ( currentHri && currentHri.hash() === hri.hash() ) {
    82                     dfd.resolve();
    83                     return dfd.promise;
    84                 }
    85                
    86                 // check if we can leave current page
    87                 if ( currentPage ) {
    88                     if ( currentPage.onLeave() === false ) {
    89                         // restore hash if changed by hand or back button
    90                         hash(currentHri.hash());
    91                         dfd.reject();
    92                         return dfd.promise;
    93                     }
    94                     currentPage = null;
    95                 }
    96                
    97                 function getFirstNode(html) {
    98                     var nodeOrFragment = domConstruct.toDom(html);
    99                     if (nodeOrFragment instanceof Element) {
    100                         return nodeOrFragment;
    101                     }
    102                     if (nodeOrFragment instanceof DocumentFragment) {
    103                         console.warn("Fragment found, will only use first Element");
    104                         for (i in nodeOrFragment.childNodes) {
    105                             var node = nodeOrFragment.childNodes[i];
    106                             if (node instanceof Element) {
    107                                 return node;
    108                             }
    109                         }
    110                     }
    111                     return domConstruct.toDom('<div>No Element found in template.</div>');
    112                 }
     123            return dfd.promise;
     124        };
    113125
    114                 function mixinArgs(node) {
    115                     var props = {};
    116                     if ( attr.has(node,'data-dojo-props') ) {
    117                         props = json.fromJson(attr.get(node,'data-dojo-props'));
    118                     }
    119                     lang.mixin(props,{pageArgs:hri.args()});
    120                     var jsonStr = json.toJson(props);
    121                     attr.set(node,'data-dojo-props',jsonStr.slice(1,jsonStr.length-1));
    122                 }
    123                
    124                 // update hash
    125                 currentHri = hri;
    126                 hash(hri.hash(),replace);
    127                
    128                 // load html
    129                 var pageUrl = 'rft/pages'+hri.path()+'.html';
    130                 xhr.get({
    131                     url: pageUrl,
    132                     failOk: true
    133                 })
    134                
    135                 // initialize page or create error message
    136                 .then(function(html){
    137                     var rootNode = getFirstNode(html);
    138                     mixinArgs(rootNode);
    139                     contentPane.set('content',rootNode);
    140                     currentPage = dijit.byNode(rootNode);
    141                     if ( !currentPage ) {
    142                         currentPage = new _Page({},rootNode);
    143                     }
    144                     dfd.resolve();
    145                 },function(){
    146                     contentPane.set('content',"<div>Page "+hri.path()+" not found.</div>");
    147                     dfd.reject();
    148                 });
    149                 return dfd.promise;
    150             }
    151 
    152             self.initial = function(path,args) {
    153                 if ( currentHri ) {
    154                     var dfd = new Deferred();
    155                     dfd.resolve();
    156                     return dfd.promise;
    157                 }
    158                 if ( hash() ) {
    159                     var hri = new HRI(hash());
    160                     return _goTo(hri, true);
    161                 } else {
    162                     return _goTo(new HRI(path,args));
    163                 }
    164             };
    165 
    166             self.goTo = function(path,args) {
    167                 return _goTo(new HRI(path,args));
    168             }
    169 
    170             self.getArgs = function() {
    171                 if ( currentHri ) {
    172                     return currentHri.args();
    173                 } else {
    174                     return {};
    175                 }
    176             };
    177 
    178             connect.subscribe('/dojo/hashchange', function(){
    179                 _goTo(new HRI(hash()));
    180             });
    181 
    182         })();
    183     });
     126    })();
     127});
  • Dev/branches/rest-dojo-ui/client/rft/pages/survey.js

    r392 r399  
    9999            },
    100100            _onShowPreview: function() {
    101                 content.goTo('surveyAdvanced', {uid: store.getIdentity(this.survey)});
     101                content.goTo('previewSurvey', {uid: store.getIdentity(this.survey)});
    102102            }
    103103        });
  • Dev/branches/rest-dojo-ui/client/rft/pages/viewSurvey.html

    r398 r399  
    1 <div data-dojo-type="rft.pages.survey" class="blue">
     1<div data-dojo-type="rft.pages.viewSurvey" class="blue">
    22    <div data-dojo-type="dijit.layout.BorderContainer" data-dojo-props="region:'center'" style="height: 500px;">
    33
     
    55            <h2>
    66                <span class="rftIcon rftIconSurvey"></span>
    7                 <span class="headerText" data-rft-attach-point="titleNode">Survey Editor</span>
     7                <span class="headerText" data-rft-attach-point="titleNode">Survey</span>
    88            </h2>
    99        </div>
    1010       
    11         <div data-dojo-type="dijit.layout.BorderContainer" data-dojo-props="region:'center'">
    12             <div data-rft-attach-point="questionBrowser"></div>
     11        <div data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region:'center'" data-rft-attach-point="questionsPane">
    1312        </div>
    1413       
    15         <div data-dojo-type="dijit.layout.BorderContainer" data-dojo-props="region:'right'" style="width: 300px">
    16             <div data-rft-attach-point="surveyListViewNode" class="rftSurveyListView">
    17             </div>
    18 
    19             <div data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region: 'bottom'">
    20                 <button data-dojo-type="dijit.form.Button"
    21                         data-rft-attach-event="onClick:_onShowProperties"
    22                         data-dojo-props="baseClass: 'rftLargeButton', iconClass: 'rftIcon rftIconProperties'">
    23                     Properties</button>
    24                 <button data-dojo-type="dijit.form.Button"
    25                         data-rft-attach-event="onClick:_onSave"
    26                         data-dojo-props="baseClass: 'rftLargeButton', iconClass: 'rftIcon rftIconAccept'">
    27                     Save Changes</button>
    28                 <button data-dojo-type="dijit.form.Button"
    29                         data-rft-attach-event="onClick:_onDiscard"
    30                         data-dojo-props="baseClass: 'rftLargeButton', iconClass: 'rftIcon rftIconCancel'">
    31                     Discard changes</button>
    32                 <button data-dojo-type="dijit.form.Button"
    33                         data-rft-attach-event="onClick:_onShowPreview"
    34                         data-dojo-props="baseClass: 'rftLargeButton', iconClass: 'rftIcon rftIconPreview'">
    35                     Preview</button>
    36             </div>
    37         </div>
    38     </div>
    39 
    40     <div data-dojo-type="dijit.Dialog"
    41          title="Survey properties"
    42          data-rft-attach-point="propertiesDialog"
    43          data-rft-attach-event="onSubmit:_onPropertiesOk">
    44 
    45         <form data-dojo-type="dijit.form.Form"
    46               data-rft-attach-point="propertiesForm">
    47             <label for="title">Title</label>
    48             <input data-dojo-type="dijit.form.TextBox" name="title"/><br/>
    49             <label for="description">Description</label>
    50             <input data-dojo-type="dijit.form.Textarea" name="description"/><br/>
    51         </form>
    52            
    53         <div>
     14        <div data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region:'bottom'">
    5415            <button data-dojo-type="dijit.form.Button"
    5516                    type="submit"
    56                     data-rft-attach-event="onClick:_onPropertiesOk">
    57                 OK</button>
     17                    data-rft-attach-event="onClick:_onSubmit">
     18                Submit</button>
    5819            <button data-dojo-type="dijit.form.Button"
    5920                    type="button"
    60                     data-rft-attach-event="onClick:_onPropertiesCancel">
     21                    data-rft-attach-event="onClick:_onCancel">
    6122                Cancel</button>
    6223        </div>
     24
    6325    </div>
    64 
    6526</div>
  • Dev/branches/rest-dojo-ui/client/rft/pages/viewSurvey.js

    r398 r399  
    55    'dojo/_base/event',
    66    'dojo/_base/lang',
    7     '../content',
    87    '../store',
    98    '../ui/_Page',
    10     '../ui/lists/QuestionListView',
    11     '../ui/TabbedQuestionBrowser'
     9    '../ui/content/ContentWidgetFactory'
    1210    ],
    13     function(array,declare,Deferred,event,lang,content,store,_Page,
    14              QuestionListView,TabbedQuestionBrowser){
    15         return declare('rft.pages.survey',[_Page],{
     11    function(array,declare,Deferred,event,lang,store,_Page,ContentWidgetFactory){
     12        return declare('rft.pages.viewSurvey',[_Page],{
    1613            survey: null,
    17             questionList: null,
    18             _dataMap: null,
    1914            constructor: function(){
    2015                this._dataMap = {};
     
    2217            onVisit: function() {
    2318                if ( this.pageArgs.uid ) {
    24                     this._setupQuestionBrowser();
    25                     this._setupListView();
    2619                    Deferred.when(store.get(this.pageArgs.uid))
    2720                    .then(lang.hitch(this,function(obj){
     21                        var f = new ContentWidgetFactory();
    2822                        this.survey = obj;
    2923                        store.query(null,{keys:this.survey.questions,include_docs:true})
    30                         .forEach(lang.hitch(this.questionList,'appendItem'));
    31                         this.refresh();
     24                        .forEach(function(question){
     25                            array.forEach(question.content,function(item){
     26                                var w = f.createViewWidget(item);
     27                                if ( w !== null ) {
     28                                    w.placeAt(this.questionsPane.containerNode,'last');
     29                                    w.startup();
     30                                }
     31                            },this);
     32                        },this);
    3233                    }));
    3334                } else {
     
    3536                }
    3637            },
    37             _setupQuestionBrowser: function() {
    38                 this.questionBrowser = new TabbedQuestionBrowser({
    39                     region: 'center',
    40                     'class': 'blue',
    41                     selectedActions: {
    42                         "Include": {
    43                             callback: lang.hitch(this,this._includeQuestion),
    44                             icon: "Accept",
    45                             description: "Include in survey"
    46                         }
    47                     },
    48                     itemActions: {
    49                         "Info": {
    50                             callback: function(item){ item.description && alert(item.description); },
    51                             icon: "Inspect",
    52                             description: "Show item description"
    53                         }
    54                     }
    55                 },this.questionBrowser);
    56                 this.questionBrowser.startup();
    57             },
    58             _includeQuestion: function(question) {
    59                 this.questionList.insertItem(question);
    60             },
    61             _setupListView: function() {
    62                 this.questionList = new QuestionListView({
    63                     region: 'center'
    64                 },this.surveyListViewNode);
    65                 this.questionList.startup();
    66             },
    67             refresh: function() {
    68                 this.titleNode.innerHTML = this.survey.title || "(set title in properties)";
    69                 this.propertiesForm.set('value',this.survey);
    70             },
    71             _onShowProperties: function(evt) {
    72                 this.propertiesDialog.show();
    73             },
    74             _onPropertiesOk: function(evt) {
    75                 this.propertiesDialog.hide();
    76                 lang.mixin(this.survey, this.propertiesForm.get('value'));
    77                 this.refresh();
     38            _onSubmit: function(evt) {
    7839                event.stop(evt);
    7940                return false;
    8041            },
    81             _onPropertiesCancel: function(evt) {
    82                 this.propertiesDialog.hide();
    83                 this.propertiesForm.set('value',this.survey);
     42            _onCancel: function(evt) {
    8443                event.stop(evt);
    8544                return false;
    86             },
    87             _onSave: function(evt) {
    88                 this.survey.questions = array.map(this.questionList.getItems(),function(item){
    89                     return store.getIdentity(item);
    90                 });
    91                 store.put(this.survey)
    92                 .then(function() {
    93                     content.goTo('surveys');
    94                 });
    95                 event.stop(evt);
    96                 return false;
    97             },
    98             _onDiscard: function(evt) {
    99             },
    100             _onShowPreview: function() {
    101                 content.goTo('surveyAdvanced', {uid: store.getIdentity(this.survey)});
    10245            }
    10346        });
  • Dev/branches/rest-dojo-ui/client/rft/run.js

    r389 r399  
    11require([
    2     // functions required for run
    32    'dojo/_base/connect',
    43    'dojo/_base/window',
     
    87    'rft/content',
    98    'rft/ui/LoginDialog',
    10     'dojo/domReady!',
    11    
    12     // dijit & rft widgets used declaratively in templates and pages
    13     'dijit/Dialog',
    14     'dijit/DropDownMenu',
    15     'dijit/InlineEditBox',
    16     'dijit/MenuBar',
    17     'dijit/MenuBarItem',
    18     'dijit/PopupMenuBarItem',
    19     'dijit/TitlePane',
    20     'dijit/layout/AccordionContainer',
    21     'dijit/layout/BorderContainer',
    22     'dijit/layout/ContentPane',
    23     'dijit/layout/TabContainer',
    24     'dijit/form/Button',
    25     'dijit/form/ComboBox',
    26     'dijit/form/DateTextBox',
    27     'dijit/form/Form',
    28     'dijit/form/NumberSpinner',
    29     'dijit/form/Select',
    30     'dijit/form/SimpleTextarea',
    31     'dijit/form/Textarea',
    32     'dijit/form/TextBox',
     9    'rft/indexContent',
     10    'rft/stddeps',
     11    'dojo/domReady!'
     12],function(connect,win,dom,parser,auth,content,LoginDialog) {
     13    parser.parse();
     14    content.init();
    3315
    34     'dojox/grid/DataGrid',
     16    var login = new LoginDialog().placeAt(win.body());
     17    login.startup();
    3518
    36     'rft/ui/LineWithActionsWidget',
    37     'rft/ui/MainMenu',
    38     'rft/ui/MenuBarLink',
    39     'rft/ui/MenuLink',
    40     'rft/ui/Notifications',
    41     'rft/ui/ObjectBox',
    42     'rft/ui/QuestionWidget',
    43     'rft/ui/Selector',
    44     'rft/ui/TitleGroup',
    45     'rft/ui/lists/AccountListView',
    46     'rft/ui/lists/List',
    47     'rft/ui/lists/OrderedList',
    48 
    49     // pages -> load dynamically?
    50     'rft/pages/index',
    51     'rft/pages/questions',
    52     'rft/pages/question',
    53     'rft/pages/session',
    54     'rft/pages/sessions',
    55     'rft/pages/surveys',
    56     'rft/pages/survey'
    57     ],
    58     function(connect,win,dom,parser,auth,content,LoginDialog) {
    59         parser.parse();
    60 
    61         var login = new LoginDialog().placeAt(win.body());
    62         login.startup();
    63 
    64         auth.restore()
    65         .then(function(){
    66             content.initial();
    67         },function(){
    68             login.show();
    69         });
    70 
    71         connect.connect(dom.byId('loginMenu'),'click',function(){
    72             login.show();
    73         });
    74 
     19    auth.restore()
     20    .then(function(){
     21        content.initial();
     22    },function(){
     23        login.show();
    7524    });
    7625
    77 function goToPage(page) {
    78     throw "Obsolete navigation to "+page;
    79 }
     26    connect.connect(dom.byId('loginMenu'),'click',function(){
     27        login.show();
     28    });
     29
     30});
  • Dev/branches/rest-dojo-ui/client/rft/stddeps.js

    r398 r399  
    1 require([
    2     // functions required for run
    3     'dojo/_base/connect',
    4     'dojo/_base/window',
    5     'dojo/dom',
    6     'dojo/parser',
    7     'rft/auth',
    8     'rft/content',
    9     'rft/ui/LoginDialog',
    10     'dojo/domReady!',
    11    
     1define([
    122    // dijit & rft widgets used declaratively in templates and pages
    133    'dijit/Dialog',
     
    5444    'rft/pages/sessions',
    5545    'rft/pages/surveys',
    56     'rft/pages/survey'
    57     ],
    58     function(connect,win,dom,parser,auth,content,LoginDialog) {
    59         parser.parse();
    60 
    61         var login = new LoginDialog().placeAt(win.body());
    62         login.startup();
    63 
    64         auth.restore()
    65         .then(function(){
    66             content.initial();
    67         },function(){
    68             login.show();
    69         });
    70 
    71         connect.connect(dom.byId('loginMenu'),'click',function(){
    72             login.show();
    73         });
    74 
    75     });
    76 
    77 function goToPage(page) {
    78     throw "Obsolete navigation to "+page;
    79 }
     46    'rft/pages/survey',
     47    'rft/pages/viewSurvey'
     48],function(){});
  • Dev/branches/rest-dojo-ui/client/rft/ui/QuestionEditorPreviewItem.js

    r392 r399  
    4545                    this.innerWidget.placeAt(this.containerNode);
    4646                    this.innerWidget.startup();
     47                    this.innerWidget.set('readOnly',true);
    4748                }
    4849                this.titleNode.innerHTML = this.item.type+" [preview]";
  • Dev/branches/rest-dojo-ui/client/rft/ui/content/ContentWidgetFactory.js

    r394 r399  
    8686                this._textBox = new TextBox();
    8787                this._textBox.set('value', this.options.contents);
    88                 this._textBox.set('readOnly', true);
    8988                this.addChild(this._textBox);
    9089            },
    9190            _getValueAttr: function() {
    9291                return {    type: 'Header',
    93                             contents: this._textBox.get('displayedValue'),
    94                 };
     92                            contents: this._textBox.get('displayedValue')
     93                };
     94            },
     95            _setReadOnlyAttr: function(value) {
     96                this._textBox.set('readOnly', value);
    9597            }
    9698        });
     
    107109            _getValueAttr: function() {
    108110                return { type: 'Header',
    109                          contents: this._textBox.get('displayedValue'),
     111                         contents: this._textBox.get('displayedValue')
    110112                };
    111113            }
     
    117119                this._textArea = new Textarea();
    118120                this._textArea.set('value', this.options.contents);
    119                 this._textArea.set('readOnly', true);
    120121                this.addChild(this._textArea);
    121122            },
    122123            _getValueAttr: function() {
    123124                return { type: 'Text',
    124                          contents: this._textArea.get('displayedValue'),
    125                 };
    126             },
     125                         contents: this._textArea.get('displayedValue')
     126                };
     127            },
     128            _setReadOnlyAttr: function(value) {
     129                this._textBox.set('readOnly', value);
     130            }
    127131        });
    128132
     
    149153                this._textArea = new Textarea();
    150154                this._textArea.set('maxLength', this.options.maxLength || 1000);
    151                 this._textArea.set('readOnly', this.options.readOnly || false);
    152155                this._textArea.set('value', this.options.defaultValue || "");
    153156                this.addChild(this._textArea);
     
    156159                return { type: "FreeTextInput",
    157160                         defaultValue: this.options.defaultValue,
    158                          readOnly: this.options.readOnly,
    159161                         maxLength: this.options.maxLength
    160162                };
     163            },
     164            _setReadOnlyAttr: function(value) {
     165                this._textArea.set('readOnly', value);
    161166            }
    162167        });
  • Dev/branches/rest-dojo-ui/client/rft/view.js

    r398 r399  
    11require([
    2     // functions required for run
    3     'dojo/_base/connect',
    4     'dojo/_base/window',
    5     'dojo/dom',
    62    'dojo/parser',
    73    'rft/auth',
    84    'rft/content',
    9     'rft/ui/LoginDialog',
    10     'dojo/domReady!',
    11    
    12     // dijit & rft widgets used declaratively in templates and pages
    13     'dijit/Dialog',
    14     'dijit/DropDownMenu',
    15     'dijit/InlineEditBox',
    16     'dijit/MenuBar',
    17     'dijit/MenuBarItem',
    18     'dijit/PopupMenuBarItem',
    19     'dijit/TitlePane',
    20     'dijit/layout/AccordionContainer',
    21     'dijit/layout/BorderContainer',
    22     'dijit/layout/ContentPane',
    23     'dijit/layout/TabContainer',
    24     'dijit/form/Button',
    25     'dijit/form/ComboBox',
    26     'dijit/form/DateTextBox',
    27     'dijit/form/Form',
    28     'dijit/form/NumberSpinner',
    29     'dijit/form/Select',
    30     'dijit/form/SimpleTextarea',
    31     'dijit/form/Textarea',
    32     'dijit/form/TextBox',
     5    'rft/stddeps',
     6    'rft/viewContent',
     7    'dojo/domReady!'
     8],function(parser,auth,content) {
     9    parser.parse();
     10    content.init();
    3311
    34     'dojox/grid/DataGrid',
    35 
    36     'rft/ui/LineWithActionsWidget',
    37     'rft/ui/MainMenu',
    38     'rft/ui/MenuBarLink',
    39     'rft/ui/MenuLink',
    40     'rft/ui/Notifications',
    41     'rft/ui/ObjectBox',
    42     'rft/ui/QuestionWidget',
    43     'rft/ui/Selector',
    44     'rft/ui/TitleGroup',
    45     'rft/ui/lists/AccountListView',
    46     'rft/ui/lists/List',
    47     'rft/ui/lists/OrderedList',
    48 
    49     // pages -> load dynamically?
    50     'rft/pages/index',
    51     'rft/pages/questions',
    52     'rft/pages/question',
    53     'rft/pages/session',
    54     'rft/pages/sessions',
    55     'rft/pages/surveys',
    56     'rft/pages/survey'
    57     ],
    58     function(connect,win,dom,parser,auth,content,LoginDialog) {
    59         parser.parse();
    60 
    61         var login = new LoginDialog().placeAt(win.body());
    62         login.startup();
    63 
    64         auth.restore()
    65         .then(function(){
    66             content.initial();
    67         },function(){
    68             login.show();
    69         });
    70 
    71         connect.connect(dom.byId('loginMenu'),'click',function(){
    72             login.show();
    73         });
    74 
     12    auth.restore()
     13    .then(function(){
     14        content.initial();
     15    },function(){
    7516    });
    7617
    77 function goToPage(page) {
    78     throw "Obsolete navigation to "+page;
    79 }
     18});
  • Dev/branches/rest-dojo-ui/client/view.html

    r398 r399  
    33    <head>
    44        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    5         <title>Research Facilitator Tool</title>
     5        <title>Survey</title>
    66        <link rel="stylesheet" type="text/css" href="dojotoolkit/dijit/themes/claro/claro.css" />
    77        <link rel="stylesheet" type="text/css" href="dojotoolkit/dojox/grid/resources/Grid.css" />
     
    1010        <link rel="stylesheet" type="text/css" href="rft/css/main.css" />
    1111        <script type="text/javascript" src="dojotoolkit/dojo/dojo.js" data-dojo-config="async: true, parseOnLoad: false, tlmSiblingOfDojo: false, isDebug: true, baseUrl: '', packagePaths: {'dojotoolkit':['dojo','dijit', 'dojox'], '.':['rft']}"></script>
    12         <script type="text/javascript" src="rft/run.js"></script>
     12        <script type="text/javascript" src="rft/view.js"></script>
    1313    </head>
    1414    <body class="dijitReset claro">
    1515        <div class="page" data-dojo-type="dijit.layout.BorderContainer" data-dojo-props="region:'center'" style="width: 100%; height: 100%;">
    1616            <div class="topbar" data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region:'top'">
    17                 <a href="#!/index"><h1>ResearchTool</h1></a>
    18                 <div data-dojo-type="rft.ui.MainMenu"></div>
    19                 <div class="breadcrumbs">
    20                     <span class="breadcrumb">Some</span> &gt; <span class="breadcrumb">Sample</span> &gt; <span class="breadcrumbCurrent">Breadcrumb [visiting]</span>
    21                 </div>
     17                <h1>Survey</h1>
    2218            </div>
    2319            <div id="content" class="content" data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region:'center'">
Note: See TracChangeset for help on using the changeset viewer.