src/js/model.js
changeset 986 f9d51dd4a3fe
parent 983 97fef7a4b189
child 987 7b65bf78873a
equal deleted inserted replaced
985:9859c4bae904 986:f9d51dd4a3fe
   239 
   239 
   240 Model.List.prototype.searchByTextFields = function(_text, _iexact) {
   240 Model.List.prototype.searchByTextFields = function(_text, _iexact) {
   241     var _iexact = _iexact || false,
   241     var _iexact = _iexact || false,
   242         _rgxp =  Model.regexpFromTextOrArray(_text, true);
   242         _rgxp =  Model.regexpFromTextOrArray(_text, true);
   243     return this.filter(function(_element) {
   243     return this.filter(function(_element) {
   244         return _rgxp.test(_element.description) || _rgxp.test(_element.title);
   244         var keywords = (_element.keywords || _element.getTagTexts() || []).join(", ");
       
   245         return _rgxp.test(_element.description) || _rgxp.test(_element.title) || _rgxp.test(keywords);
   245     });
   246     });
   246 }
   247 }
   247 
   248 
   248 Model.List.prototype.search = function(_text) {
   249 Model.List.prototype.search = function(_text) {
   249     if (!_text) {
   250     if (!_text) {
   424     if (_hms.hours) {
   425     if (_hms.hours) {
   425         _res += _hms.hours + ':'
   426         _res += _hms.hours + ':'
   426     }
   427     }
   427     _res += pad(2, _hms.minutes) + ':' + pad(2, _hms.seconds);
   428     _res += pad(2, _hms.minutes) + ':' + pad(2, _hms.seconds);
   428     if (showCs) {
   429     if (showCs) {
   429         _res += "." + Math.round(_hms.milliseconds / 100)
   430         _res += "." + Math.floor(_hms.milliseconds / 100)
   430     }
   431     }
   431     return _res;
   432     return _res;
   432 }
   433 }
   433 
   434 
   434 /* Model.Reference handles references between elements
   435 /* Model.Reference handles references between elements
  1000     this.contents[_listId].addElements(_contents);
  1001     this.contents[_listId].addElements(_contents);
  1001 }
  1002 }
  1002 
  1003 
  1003 Model.Source.prototype.getList = function(_listId, _global) {
  1004 Model.Source.prototype.getList = function(_listId, _global) {
  1004     _global = (typeof _global !== "undefined" && _global);
  1005     _global = (typeof _global !== "undefined" && _global);
  1005     if (_global || typeof this.contents[_listId] === "undefined") {
  1006     if (_global) {
  1006         return this.directory.getGlobalList().filter(function(_e) {
  1007         return this.directory.getGlobalList().filter(function(_e) {
  1007             return (_e.elementType === _listId);
  1008             return (_e.elementType === _listId);
  1008         });
  1009         });
  1009     } else {
  1010     } else {
  1010         return this.contents[_listId];
  1011         return this.contents[_listId] || new IriSP.Model.List(this.directory);
  1011     }
  1012     }
  1012 }
  1013 }
  1013 
  1014 
  1014 Model.Source.prototype.forEach = function(_callback) {
  1015 Model.Source.prototype.forEach = function(_callback) {
  1015     var _this = this;
  1016     var _this = this;
  1139     urlparams.format = dataType;
  1140     urlparams.format = dataType;
  1140     ns.jQuery.ajax({
  1141     ns.jQuery.ajax({
  1141         url: this.url,
  1142         url: this.url,
  1142         dataType: dataType,
  1143         dataType: dataType,
  1143         data: urlparams,
  1144         data: urlparams,
       
  1145         traditional: true,
  1144         success: function(_result) {
  1146         success: function(_result) {
  1145             _this.deSerialize(_result);
  1147             _this.deSerialize(_result);
  1146             _this.handleCallbacks();
  1148             _this.handleCallbacks();
  1147         }
  1149         }
  1148     });
  1150     });