Ignore:
Timestamp:
03/04/12 15:48:42 (13 years ago)
Author:
hendrikvanantwerpen
Message:

[Server] Refactored model classes with some meta-programming. Specific classes only define their fields and inherit from class RdfObject?. Changes to handle the new model objects correctly.
[Client] Added rft/store module for uniform resource access. Removed dependencies on 'uid' field name. Added support for references without loading full object nor exposing uri.
[Client] Added reset() to QuestionWidget?.
[RDFAPI] Fixed PHP warning.

Location:
Dev/branches/rest-dojo-ui/client/rft/ui
Files:
2 edited

Legend:

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

    r288 r303  
    1 define(['dojo/_base/declare','dojo/dom-construct','dijit/_WidgetBase',
     1define(['dojo/_base/declare','dojo/_base/lang','dojo/dom-construct','dijit/_WidgetBase',
    22    'dijit/_TemplatedMixin','dijit/_WidgetsInTemplateMixin',
    33    'dojo/text!./templates/QuestionWidget.html','dijit/form/TextBox',
    44    'dijit/form/Textarea','./MultipleChoiceWidget'],
    5     function(declare,domConstruct,_WidgetBase,_TemplatedMixin,_WidgetsInTemplateMixin,templateString,TextBox,Textarea,MultipleChoiceWidget){
     5    function(declare,lang,domConstruct,_WidgetBase,_TemplatedMixin,_WidgetsInTemplateMixin,templateString,TextBox,Textarea,MultipleChoiceWidget){
    66        return declare('rft.ui.QuestionWidget',[_WidgetBase,_TemplatedMixin,_WidgetsInTemplateMixin],{
    77            templateString: templateString,
    88            mode: 'view', // view || edit
    99            name: '',
     10            value: null,
    1011            _type: null,
    1112            _widgetCache: null,
    1213            constructor: function() {
    1314                this.inherited(arguments);
     15                this.value = {};
    1416                this._widgetCache = {};
    1517            },
    1618            postCreate: function() {
     19                this._resetValue = this.value;
    1720                this.typeSelector.set('disabled', this.mode == 'edit');
    1821            },
    1922            _setValueAttr: function(value) {
    20                 value.type && this._onTypeChange(value.type);
     23                this.value = value;
     24                this._onTypeChange(value.type || 'string');
    2125                this.ourForm.set('value',value);
    2226            },
    2327            _getValueAttr: function() {
    24                 return this.ourForm.get('value');
     28                var value = this.ourForm.get('value');
     29                lang.mixin(this.value,value);
     30                return this._question;
    2531            },
    2632            _onTypeChange: function(type) {
     
    6066                }
    6167                return widget;
     68            },
     69            reset: function() {
     70                this.ourForm.reset();
     71                this._setValueAttr(this._resetValue);
    6272            }
    6373        });
  • Dev/branches/rest-dojo-ui/client/rft/ui/templates/QuestionWidget.html

    r288 r303  
    22    <form data-dojo-type="dijit.form.Form" data-dojo-attach-point="ourForm">
    33        <fieldset>
    4             <input data-dojo-type="dijit.form.TextBox" name="uid" type="text" class="dijitHidden" />
    54            <label for="code" class="loginLabel">Code</label>
    65            <input data-dojo-type="dijit.form.TextBox" name="code" type="text" class="loginInput" />
Note: See TracChangeset for help on using the changeset viewer.