Ignore:
Timestamp:
03/12/14 15:16:54 (11 years ago)
Author:
hendrikvanantwerpen
Message:
  • Factored out general object mapping and iteration.
  • Split widgets for multiplechoice and singlechoice.
  • Restored readOnly/disabled setting for QuestionEditorPreviewItem? on innerWidget (since view innerWidget is not a form anymore, we cannot just set it on that, we iterate over all form children now).
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Dev/trunk/src/client/qed-client/model/classes/_Class.js

    r506 r510  
    11define([
     2    "../../lib/object",
    23    "./_View",
    34    "dojo/_base/array",
     
    56    "dojo/_base/lang",
    67    "dojo/date/stamp"
    7 ], function(_View, array, declare, lang, stamp) {
     8], function(objectFuns, _View, array, declare, lang, stamp) {
    89
    910    var _Class = declare([_View],{
     
    2425            obj = lang.clone(obj);
    2526            obj = this._serialize(obj) || obj;
    26             this._strip(obj);
     27            this._sanitize(obj);
    2728            return obj;
    2829        },
     
    6566            return stamp.toISOString(date,{zulu:true,milliseconds:false});
    6667        },
    67         _strip: function(obj) {
     68        _sanitize: function(obj) {
    6869            if ( lang.isArray(obj) ) {
    69                 array.forEach(obj,this._strip,this);
     70                array.forEach(obj,this._sanitize,this);
    7071            } else if ( lang.isObject(obj) ) {
    71                 for ( var prop in obj ) {
    72                     if ( obj.hasOwnProperty(prop) ) {
    73                         var v = obj[prop];
    74                         if ( v === null || v === "" || (typeof v === "number" && isNaN(v)) ) {
    75                             delete obj[prop];
    76                         } else {
    77                             this._strip(v);
    78                         }
     72                objectFuns.forEach(obj,function(v,prop){
     73                    if ( v === null ||
     74                         v === "" ||
     75                         (typeof v === "number" && isNaN(v)) ) {
     76                        delete obj[prop];
     77                    } else {
     78                        this._sanitize(v);
    7979                    }
    80                 }
     80
     81                },this);
    8182            }
    82 
    8383        }
    8484    });
Note: See TracChangeset for help on using the changeset viewer.