mirror of
https://github.com/YunoHost-Apps/ttrss_ynh.git
synced 2024-10-01 13:34:46 +02:00
8 lines
13 KiB
JavaScript
8 lines
13 KiB
JavaScript
|
/*
|
||
|
Copyright (c) 2004-2012, The Dojo Foundation All Rights Reserved.
|
||
|
Available via Academic Free License >= 2.1 OR the modified BSD license.
|
||
|
see: http://dojotoolkit.org/license for details
|
||
|
*/
|
||
|
|
||
|
//>>built
|
||
|
define("dojo/data/ItemFileReadStore",["../_base/kernel","../_base/lang","../_base/declare","../_base/array","../_base/xhr","../Evented","./util/filter","./util/simpleFetch","../date/stamp"],function(_1,_2,_3,_4,_5,_6,_7,_8,_9){var _a=_3("dojo.data.ItemFileReadStore",[_6],{constructor:function(_b){this._arrayOfAllItems=[];this._arrayOfTopLevelItems=[];this._loadFinished=false;this._jsonFileUrl=_b.url;this._ccUrl=_b.url;this.url=_b.url;this._jsonData=_b.data;this.data=null;this._datatypeMap=_b.typeMap||{};if(!this._datatypeMap["Date"]){this._datatypeMap["Date"]={type:Date,deserialize:function(_c){return _9.fromISOString(_c);}};}this._features={"dojo.data.api.Read":true,"dojo.data.api.Identity":true};this._itemsByIdentity=null;this._storeRefPropName="_S";this._itemNumPropName="_0";this._rootItemPropName="_RI";this._reverseRefMap="_RRM";this._loadInProgress=false;this._queuedFetches=[];if(_b.urlPreventCache!==undefined){this.urlPreventCache=_b.urlPreventCache?true:false;}if(_b.hierarchical!==undefined){this.hierarchical=_b.hierarchical?true:false;}if(_b.clearOnClose){this.clearOnClose=true;}if("failOk" in _b){this.failOk=_b.failOk?true:false;}},url:"",_ccUrl:"",data:null,typeMap:null,clearOnClose:false,urlPreventCache:false,failOk:false,hierarchical:true,_assertIsItem:function(_d){if(!this.isItem(_d)){throw new Error(this.declaredClass+": Invalid item argument.");}},_assertIsAttribute:function(_e){if(typeof _e!=="string"){throw new Error(this.declaredClass+": Invalid attribute argument.");}},getValue:function(_f,_10,_11){var _12=this.getValues(_f,_10);return (_12.length>0)?_12[0]:_11;},getValues:function(_13,_14){this._assertIsItem(_13);this._assertIsAttribute(_14);return (_13[_14]||[]).slice(0);},getAttributes:function(_15){this._assertIsItem(_15);var _16=[];for(var key in _15){if((key!==this._storeRefPropName)&&(key!==this._itemNumPropName)&&(key!==this._rootItemPropName)&&(key!==this._reverseRefMap)){_16.push(key);}}return _16;},hasAttribute:function(_17,_18){this._assertIsItem(_17);this._assertIsAttribute(_18);return (_18 in _17);},containsValue:function(_19,_1a,_1b){var _1c=undefined;if(typeof _1b==="string"){_1c=_7.patternToRegExp(_1b,false);}return this._containsValue(_19,_1a,_1b,_1c);},_containsValue:function(_1d,_1e,_1f,_20){return _4.some(this.getValues(_1d,_1e),function(_21){if(_21!==null&&!_2.isObject(_21)&&_20){if(_21.toString().match(_20)){return true;}}else{if(_1f===_21){return true;}}});},isItem:function(_22){if(_22&&_22[this._storeRefPropName]===this){if(this._arrayOfAllItems[_22[this._itemNumPropName]]===_22){return true;}}return false;},isItemLoaded:function(_23){return this.isItem(_23);},loadItem:function(_24){this._assertIsItem(_24.item);},getFeatures:function(){return this._features;},getLabel:function(_25){if(this._labelAttr&&this.isItem(_25)){return this.getValue(_25,this._labelAttr);}return undefined;},getLabelAttributes:function(_26){if(this._labelAttr){return [this._labelAttr];}return null;},filter:function(_27,_28,_29){var _2a=[],i,key;if(_27.query){var _2b,_2c=_27.queryOptions?_27.queryOptions.ignoreCase:false;var _2d={};for(key in _27.query){_2b=_27.query[key];if(typeof _2b==="string"){_2d[key]=_7.patternToRegExp(_2b,_2c);}else{if(_2b instanceof RegExp){_2d[key]=_2b;}}}for(i=0;i<_28.length;++i){var _2e=true;var _2f=_28[i];if(_2f===null){_2e=false;}else{for(key in _27.query){_2b=_27.query[key];if(!this._containsValue(_2f,key,_2b,_2d[key])){_2e=false;}}}if(_2e){_2a.push(_2f);}}_29(_2a,_27);}else{for(i=0;i<_28.length;++i){var _30=_28[i];if(_30!==null){_2a.push(_30);}}_29(_2a,_27);}},_fetchItems:function(_31,_32,_33){var _34=this;if(this._loadFinished){this.filter(_31,this._getItemsArray(_31.queryOptions),_32);}else{if(this._jsonFileUrl!==this._ccUrl){_1.deprecated(this.declaredClass+": ","To change the url, set the url property of the store,"+" not _jsonFileUrl. _jsonFileUrl support will be removed in 2.0");this._ccUrl=this._jsonFileUrl;this.url=this._jsonFileUrl;}else{if(this.url!==this._ccUrl){this._jsonFileUrl=this.url;this._ccUrl=this.url;}}if(this.data!=null){this._jsonData=this.data;this.da
|