Ignore:
Timestamp:
07/11/12 18:45:51 (13 years ago)
Author:
tjcschipper
Message:
  • surveyEditor more or less works! Only needed change is addition of "topic" property in question objects (database-side), and the change from "category"(string) to "categories"(string[]).
  • surveyEditor still needs removal function and infofunction to be written properly!
  • Added all files belonging to SurveyAdvanced?. Most do not work properly yet, but at least there will not be a 404 page when you click btnPreview on survey.html.
File:
1 edited

Legend:

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

    r350 r355  
    1 define(['dojo/_base/declare','dojo/_base/lang','dojo/on','dojo/dom', 'dojo/dom-class', 'dijit/form/Button',
    2     'dijit/_WidgetBase','dijit/_TemplatedMixin','dijit/_WidgetsInTemplateMixin',
    3     'dojo/text!./templates/LineWithActionsWidget.html'
    4     ],
    5     function(declare,lang,on,dom,domClass,Button,_WidgetBase,_TemplatedMixin,_WidgetsInTemplateMixin,templateString){
    6         return declare('rft.ui.LineWithActionsWidget',[_WidgetBase,_TemplatedMixin,_WidgetsInTemplateMixin],{
    7             templateString: templateString,
    8             baseClass: 'rftLineWithButtons',
    9             title: '',
    10             modifiers: "blue",
    11             userObject: null,
    12             actions: {},
    13             postCreate: function() {
    14                 dom.setSelectable(this.domNode, false);
    15                 on(this.titleNode,'click',lang.hitch(this,'_onClick'));
    16             },
    17             startup: function() {
    18                 this.inherited(arguments);
    19                 this._setupActions();
    20                 domClass.add(this.domNode, this.modifiers);
    21                 this.refresh();
    22             },
    23             _setupActions: function() {
    24                 for (var action in this.actions) {
    25                     var properties;
    26                     if (this.actions[action].properties.blockButton == true) {  // BlockButton
    27                         properties = lang.mixin({
    28                             baseClass: 'rftBlockButton',
    29                             modifiers: this.modifiers,
    30                             label: "Default",
    31                             iconClass: 'rftIcon rftIcon'+this.actions[action].properties.icon,
    32                             title: action,
    33                             onClick: lang.hitch(this, this.actions[action].callback)
    34                         }, this.actions[action].properties);
    35                         properties["class"] = properties.modifiers;
    36                         new Button(properties).placeAt(this.buttonsNode);
    37                     } else {    //InlineButton
    38                         properties = lang.mixin({
    39                             baseClass: 'rftInlineButton',
    40                             modifiers: 'black',
    41                             label: "Default",
    42                             showLabel: false,
    43                             iconClass: 'rftIcon rftIcon'+this.actions[action].properties.icon,
    44                             title: action,
    45                             onClick: lang.hitch(this, this.actions[action].callback)
    46                         }, this.actions[action].properties);
    47                         properties["class"] = properties.modifiers;
    48                         new Button(properties).placeAt(this.buttonsNode);
    49                     }
    50                 }
    51             },
    52             refresh: function() {
    53                 this.titleNode.innerHTML = this.title;
    54             },
    55             _onClick: function(e){
    56                 var preventDefault = this.onClick(e) === false;
    57                 if(preventDefault){
    58                     e.preventDefault();
    59                 }
    60                 return !preventDefault;
    61             },
    62             onClick: function(e) {},
    63             _setTitleAttr: function(value){
    64                 this.title = value;
    65                 this.refresh();
    66             }
    67         });
    68     });
     1define(['dojo/_base/declare',
     2        'dojo/_base/lang',
     3        'dojo/on',
     4        'dojo/dom',
     5        'dojo/_base/event',
     6        'dojo/dom-class',
     7        'dijit/form/Button',
     8        'dijit/_WidgetBase',
     9        'dijit/_TemplatedMixin',
     10        'dijit/_WidgetsInTemplateMixin',
     11        'dojo/text!./templates/LineWithActionsWidget.html'
     12        ],
     13        function(declare,lang,on,dom,event,domClass,Button,_WidgetBase,_TemplatedMixin,_WidgetsInTemplateMixin,templateString){
     14                return declare('rft.ui.LineWithActionsWidget',[_WidgetBase,_TemplatedMixin,_WidgetsInTemplateMixin],{
     15                        templateString: templateString,
     16                        baseClass: 'rftLineWithButtons',
     17                        title: '',
     18                        modifiers: "blue",
     19                        selectable: false,
     20                        userObject: null,
     21
     22                        actions: {},
     23                        postCreate: function() {
     24                                dom.setSelectable(this.domNode, false); // Text selection, has nothing to do with object selection!
     25                                on(this.domNode,'click',lang.hitch(this,'_onClick'));
     26                        },
     27                        startup: function() {
     28                                this.inherited(arguments);
     29                                this._setupActions();
     30                                domClass.add(this.domNode, this.modifiers);
     31                                this.refresh();
     32                        },
     33                        _setupActions: function() {
     34                                for (var action in this.actions) {
     35                                        var properties;
     36                                        if (this.actions[action].properties.blockButton == true) {
     37                                                properties = lang.mixin({
     38                                                        baseClass: 'rftBlockButton',
     39                                                        modifiers: this.modifiers,
     40                                                        label: "Default",
     41                                                        iconClass: 'rftIcon rftIcon'+this.actions[action].properties.icon,
     42                                                        title: action,
     43                                                        onClick: lang.hitch(this, function(e){
     44                                                                lang.hitch(this, this.actions[action].callback )(e);
     45                                                                event.stop(e);
     46                                                                return false;
     47                                                        })
     48                                                }, this.actions[action].properties);
     49                                                properties["class"] = properties.modifiers;
     50                                                new Button(properties).placeAt(this.buttonsNode);
     51                                        } else {
     52                                                properties = lang.mixin({
     53                                                        baseClass: 'rftInlineButton',
     54                                                        modifiers: 'black',
     55                                                        label: "Default",
     56                                                        showLabel: false,
     57                                                        iconClass: 'rftIcon rftIcon'+this.actions[action].properties.icon,
     58                                                        title: action,
     59                                                        onClick: lang.hitch(this, function(e){
     60                                                                lang.hitch(this, this.actions[action].callback)(e);
     61                                                                event.stop(e);
     62                                                                return false;
     63                                                        })
     64                                                }, this.actions[action].properties);
     65                                                properties["class"] = properties.modifiers;
     66                                                new Button(properties).placeAt(this.buttonsNode);
     67                                        }
     68                                }
     69                        },
     70                        refresh: function() {
     71                                this.titleNode.innerHTML = this.title;
     72                        },
     73                        _onClick: function(e){
     74                                var preventDefault = this.onClick(e) === false;
     75                                if (preventDefault) {
     76                                        event.stop(e);
     77                                }
     78                                return !preventDefault;
     79                        },
     80                        onClick: function(e) {
     81                        },
     82                        _setTitleAttr: function(value){
     83                                this.title = value;
     84                                this.refresh();
     85                        }
     86                });
     87});
Note: See TracChangeset for help on using the changeset viewer.