a:46:{s:9:"#provides";s:19:"dojox.data.CsvStore";s:9:"#resource";s:16:"data/CsvStore.js";s:9:"#requires";a:2:{i:0;a:3:{i:0;s:6:"common";i:1;s:21:"dojo.data.util.filter";i:2;s:4:"dojo";}i:1;a:3:{i:0;s:6:"common";i:1;s:26:"dojo.data.util.simpleFetch";i:2;s:4:"dojo";}}s:19:"dojox.data.CsvStore";a:6:{s:4:"type";s:8:"Function";s:7:"summary";s:11:"initializer";s:10:"parameters";a:1:{s:17:"keywordParameters";a:2:{s:4:"type";s:6:"Object";s:7:"summary";s:132:"identifier: String} The column label for the column to use for the identity. Optional. If not set, the identity is the row number.";}}s:6:"source";s:1088:" this._attributes = []; // e.g. ["Title", "Year", "Producer"] this._attributeIndexes = {}; // e.g. {Title: 0, Year: 1, Producer: 2} this._dataArray = []; // e.g. [[],[],[]] this._arrayOfAllItems = []; // e.g. [{_csvId:0,_csvStore:store},...] this._loadFinished = false; if(keywordParameters.url){ this.url = keywordParameters.url; } this._csvData = keywordParameters.data; if(keywordParameters.label){ this.label = keywordParameters.label; }else if(this.label === ""){ this.label = undefined; } this._storeProp = "_csvStore"; // Property name for the store reference on every item. this._idProp = "_csvId"; // Property name for the Item Id on every item. this._features = { 'dojo.data.api.Read': true, 'dojo.data.api.Identity': true }; this._loadInProgress = false; //Got to track the initial load to prevent duelling loads of the dataset. this._queuedFetches = []; this.identifier = keywordParameters.identifier; if (this.identifier === "") { delete this.identifier; }else{ this._idMap = {}; }";s:6:"mixins";a:1:{s:9:"prototype";a:1:{i:0;s:26:"dojo.data.util.simpleFetch";}}s:9:"classlike";b:1;}s:23:"dojox.data.CsvStore.url";a:3:{s:9:"prototype";s:19:"dojox.data.CsvStore";s:8:"instance";s:19:"dojox.data.CsvStore";s:7:"summary";s:0:"";}s:25:"dojox.data.CsvStore.label";a:3:{s:9:"prototype";s:19:"dojox.data.CsvStore";s:8:"instance";s:19:"dojox.data.CsvStore";s:7:"summary";s:0:"";}s:30:"dojox.data.CsvStore.identifier";a:3:{s:9:"prototype";s:19:"dojox.data.CsvStore";s:8:"instance";s:19:"dojox.data.CsvStore";s:7:"summary";s:0:"";}s:33:"dojox.data.CsvStore._assertIsItem";a:6:{s:9:"prototype";s:19:"dojox.data.CsvStore";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:4:"item";a:2:{s:4:"type";s:4:"item";s:7:"summary";s:50:"The item to test for being contained by the store.";}}s:6:"source";s:136:" if(!this.isItem(item)){ throw new Error(this.declaredClass + ": a function was passed an item argument that was not an item"); }";s:7:"summary";s:78:"This function tests whether the item passed in is indeed an item in the store.";s:7:"private";b:1;}s:38:"dojox.data.CsvStore._assertIsAttribute";a:6:{s:9:"prototype";s:19:"dojox.data.CsvStore";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:9:"attribute";a:2:{s:4:"type";s:14:"item || String";s:7:"summary";s:55:"The attribute to test for being contained by the store.";}}s:6:"source";s:189:" if(!dojo.isString(attribute)){ throw new Error(this.declaredClass + ": a function was passed an attribute argument that was not an attribute object nor an attribute name string"); }";s:7:"summary";s:101:"This function tests whether the item passed in is indeed a valid 'attribute' like type for the store.";s:7:"private";b:1;}s:29:"dojox.data.CsvStore._getIndex";a:6:{s:9:"prototype";s:19:"dojox.data.CsvStore";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:4:"item";a:2:{s:4:"type";s:3:"The";s:7:"summary";s:33:"idem handle to get the index for.";}}s:6:"source";s:103:" var idx = this.getIdentity(item); if(this.identifier){ idx = this._idMap[idx]; } return idx;";s:7:"summary";s:81:"Internal function to get the internal index to the item data from the item handle";s:7:"private";b:1;}s:28:"dojox.data.CsvStore.getValue";a:6:{s:9:"prototype";s:19:"dojox.data.CsvStore";s:4:"type";s:8:"Function";s:10:"parameters";a:3:{s:4:"item";a:1:{s:4:"type";s:4:"item";}s:9:"attribute";a:1:{s:4:"type";s:34:"attribute || attribute-name-string";}s:12:"defaultValue";a:2:{s:8:"optional";b:1;s:4:"type";s:5:"value";}}s:6:"source";s:289:" this._assertIsItem(item); this._assertIsAttribute(attribute); var itemValue = defaultValue; if(this.hasAttribute(item, attribute)){ var itemData = this._dataArray[this._getIndex(item)]; itemValue = itemData[this._attributeIndexes[attribute]]; } return itemValue; //String";s:7:"summary";s:174:"See dojo.data.api.Read.getValue() Note that for the CsvStore, an empty string value is the same as no value, so the defaultValue would be returned instead of an empty string.";s:7:"returns";s:6:"String";}s:29:"dojox.data.CsvStore.getValues";a:6:{s:9:"prototype";s:19:"dojox.data.CsvStore";s:4:"type";s:8:"Function";s:10:"parameters";a:2:{s:4:"item";a:1:{s:4:"type";s:4:"item";}s:9:"attribute";a:1:{s:4:"type";s:34:"attribute || attribute-name-string";}}s:6:"source";s:86:" var value = this.getValue(item, attribute); return (value ? [value] : []); //Array";s:7:"summary";s:138:"See dojo.data.api.Read.getValues() CSV syntax does not support multi-valued attributes, so this is just a wrapper function for getValue().";s:7:"returns";s:5:"Array";}s:33:"dojox.data.CsvStore.getAttributes";a:6:{s:9:"prototype";s:19:"dojox.data.CsvStore";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:4:"item";a:1:{s:4:"type";s:4:"item";}}s:6:"source";s:333:" this._assertIsItem(item); var attributes = []; var itemData = this._dataArray[this._getIndex(item)]; for(var i=0; i= 0 && identity < this._dataArray.length){ return true; //Boolean } } } return false; //Boolean";s:7:"summary";s:31:"See dojo.data.api.Read.isItem()";s:7:"returns";s:7:"Boolean";}s:32:"dojox.data.CsvStore.isItemLoaded";a:6:{s:9:"prototype";s:19:"dojox.data.CsvStore";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:9:"something";a:1:{s:4:"type";s:8:"anything";}}s:6:"source";s:42:" return this.isItem(something); //Boolean";s:7:"summary";s:112:"See dojo.data.api.Read.isItemLoaded() The CsvStore always loads all items, so if it's an item, then it's loaded.";s:7:"returns";s:7:"Boolean";}s:28:"dojox.data.CsvStore.loadItem";a:6:{s:9:"prototype";s:19:"dojox.data.CsvStore";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:4:"item";a:1:{s:4:"type";s:4:"item";}}s:6:"source";s:390:" // summary: // See dojo.data.api.Read.loadItem() // description: // The CsvStore always loads all items, so if it's an item, then it's loaded. // From the dojo.data.api.Read.loadItem docs: // If a call to isItemLoaded() returns true before loadItem() is even called, // then loadItem() need not do any work at all and will not even invoke // the callback handlers.";s:7:"summary";s:33:"See dojo.data.api.Read.loadItem()";s:11:"description";s:284:"The CsvStore always loads all items, so if it's an item, then it's loaded. From the dojo.data.api.Read.loadItem docs: If a call to isItemLoaded() returns true before loadItem() is even called, then loadItem() need not do any work at all and will not even invoke the callback handlers.";}s:31:"dojox.data.CsvStore.getFeatures";a:5:{s:9:"prototype";s:19:"dojox.data.CsvStore";s:4:"type";s:8:"Function";s:6:"source";s:33:" return this._features; //Object";s:7:"summary";s:36:"See dojo.data.api.Read.getFeatures()";s:7:"returns";s:6:"Object";}s:28:"dojox.data.CsvStore.getLabel";a:6:{s:9:"prototype";s:19:"dojox.data.CsvStore";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:4:"item";a:1:{s:4:"type";s:4:"item";}}s:6:"source";s:125:" if(this.label && this.isItem(item)){ return this.getValue(item,this.label); //String } return undefined; //undefined";s:7:"summary";s:33:"See dojo.data.api.Read.getLabel()";s:7:"returns";s:16:"String|undefined";}s:38:"dojox.data.CsvStore.getLabelAttributes";a:6:{s:9:"prototype";s:19:"dojox.data.CsvStore";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:4:"item";a:1:{s:4:"type";s:4:"item";}}s:6:"source";s:75:" if(this.label){ return [this.label]; //array } return null; //null";s:7:"summary";s:43:"See dojo.data.api.Read.getLabelAttributes()";s:7:"returns";s:10:"array|null";}s:31:"dojox.data.CsvStore._fetchItems";a:6:{s:9:"prototype";s:19:"dojox.data.CsvStore";s:4:"type";s:8:"Function";s:10:"parameters";a:3:{s:11:"keywordArgs";a:1:{s:4:"type";s:6:"Object";}s:12:"findCallback";a:1:{s:4:"type";s:8:"Function";}s:13:"errorCallback";a:1:{s:4:"type";s:8:"Function";}}s:6:"source";s:2835:" var self = this; var filter = function(requestArgs, arrayOfAllItems){ var items = null; if(requestArgs.query){ var key, value; items = []; var ignoreCase = requestArgs.queryOptions ? requestArgs.queryOptions.ignoreCase : false; //See if there are any string values that can be regexp parsed first to avoid multiple regexp gens on the //same value for each item examined. Much more efficient. var regexpList = {}; for(key in requestArgs.query){ value = requestArgs.query[key]; if(typeof value === "string"){ regexpList[key] = dojo.data.util.filter.patternToRegExp(value, ignoreCase); } } for(var i = 0; i < arrayOfAllItems.length; ++i){ var match = true; var candidateItem = arrayOfAllItems[i]; for(key in requestArgs.query){ value = requestArgs.query[key]; if(!self._containsValue(candidateItem, key, value, regexpList[key])){ match = false; } } if(match){ items.push(candidateItem); } } }else{ // We want a copy to pass back in case the parent wishes to sort the array. We shouldn't allow resort // of the internal list so that multiple callers can get lists and sort without affecting each other. if(arrayOfAllItems.length> 0){ items = arrayOfAllItems.slice(0,arrayOfAllItems.length); } } findCallback(items, requestArgs); }; if(this._loadFinished){ filter(keywordArgs, this._arrayOfAllItems); }else{ if(this.url !== ""){ //If fetches come in before the loading has finished, but while //a load is in progress, we have to defer the fetching to be //invoked in the callback. if(this._loadInProgress){ this._queuedFetches.push({args: keywordArgs, filter: filter}); }else{ this._loadInProgress = true; var getArgs = { url: self.url, handleAs: "text" }; var getHandler = dojo.xhrGet(getArgs); getHandler.addCallback(function(data){ try{ self._processData(data); filter(keywordArgs, self._arrayOfAllItems); self._handleQueuedFetches(); }catch(e){ errorCallback(e, keywordArgs); } }); getHandler.addErrback(function(error){ self._loadInProgress = false; if(errorCallback){ errorCallback(error, keywordArgs); }else{ throw error; } }); } }else if(this._csvData){ try{ this._processData(this._csvData); this._csvData = null; filter(keywordArgs, this._arrayOfAllItems); }catch(e){ errorCallback(e, keywordArgs); } }else{ var error = new Error(this.declaredClass + ": No CSV source data was provided as either URL or String data input."); if(errorCallback){ errorCallback(error, keywordArgs); }else{ throw error; } } }";s:7:"summary";s:38:"See dojo.data.util.simpleFetch.fetch()";s:7:"private";b:1;}s:25:"dojox.data.CsvStore.close";a:5:{s:9:"prototype";s:19:"dojox.data.CsvStore";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:7:"request";a:1:{s:4:"type";s:44:"dojo.data.api.Request || keywordArgs || null";}}s:6:"source";s:53:" // summary: // See dojo.data.api.Read.close()";s:7:"summary";s:30:"See dojo.data.api.Read.close()";}s:56:"dojox.data.CsvStore._getArrayOfArraysFromCsvFileContents";a:8:{s:9:"prototype";s:19:"dojox.data.CsvStore";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:15:"csvFileContents";a:1:{s:4:"type";s:6:"string";}}s:6:"source";s:2364:" if(dojo.isString(csvFileContents)){ var lineEndingCharacters = new RegExp("\r\n|\n|\r"); var leadingWhiteSpaceCharacters = new RegExp("^\\s+",'g'); var trailingWhiteSpaceCharacters = new RegExp("\\s+$",'g'); var doubleQuotes = new RegExp('""','g'); var arrayOfOutputRecords = []; var i; var arrayOfInputLines = this._splitLines(csvFileContents); for(i = 0; i < arrayOfInputLines.length; ++i){ var singleLine = arrayOfInputLines[i]; if(singleLine.length > 0){ var listOfFields = singleLine.split(','); var j = 0; while(j < listOfFields.length){ var space_field_space = listOfFields[j]; var field_space = space_field_space.replace(leadingWhiteSpaceCharacters, ''); // trim leading whitespace var field = field_space.replace(trailingWhiteSpaceCharacters, ''); // trim trailing whitespace var firstChar = field.charAt(0); var lastChar = field.charAt(field.length - 1); var secondToLastChar = field.charAt(field.length - 2); var thirdToLastChar = field.charAt(field.length - 3); if(field.length === 2 && field == "\"\""){ listOfFields[j] = ""; //Special case empty string field. }else if((firstChar == '"') && ((lastChar != '"') || ((lastChar == '"') && (secondToLastChar == '"') && (thirdToLastChar != '"')))){ if(j+1 === listOfFields.length){ // alert("The last field in record " + i + " is corrupted:\n" + field); return null; //null } var nextField = listOfFields[j+1]; listOfFields[j] = field_space + ',' + nextField; listOfFields.splice(j+1, 1); // delete element [j+1] from the list }else{ if((firstChar == '"') && (lastChar == '"')){ field = field.slice(1, (field.length - 1)); // trim the " characters off the ends field = field.replace(doubleQuotes, '"'); // replace "" with " } listOfFields[j] = field; j += 1; } } arrayOfOutputRecords.push(listOfFields); } } // The first item of the array must be the header row with attribute names. this._attributes = arrayOfOutputRecords.shift(); for(i = 0; i 0) { for(var i = 0; i < this._queuedFetches.length; i++){ var fData = this._queuedFetches[i]; var delayedFilter = fData.filter; var delayedQuery = fData.args; if(delayedFilter){ delayedFilter(delayedQuery, this._arrayOfAllItems); }else{ this.fetchItemByIdentity(fData.args); } } this._queuedFetches = []; }";s:7:"summary";s:92:"Internal function to execute delayed request in the store. Execute any deferred fetches now.";s:7:"private";b:1;}s:35:"dojox.data.CsvStore._loadInProgress";a:3:{s:8:"instance";s:19:"dojox.data.CsvStore";s:7:"private";b:1;s:7:"summary";s:0:"";}s:28:"dojox.data.CsvStore._csvData";a:3:{s:8:"instance";s:19:"dojox.data.CsvStore";s:7:"private";b:1;s:7:"summary";s:0:"";}s:31:"dojox.data.CsvStore._attributes";a:3:{s:8:"instance";s:19:"dojox.data.CsvStore";s:7:"private";b:1;s:7:"summary";s:0:"";}s:30:"dojox.data.CsvStore._dataArray";a:3:{s:8:"instance";s:19:"dojox.data.CsvStore";s:7:"private";b:1;s:7:"summary";s:0:"";}s:36:"dojox.data.CsvStore._arrayOfAllItems";a:3:{s:8:"instance";s:19:"dojox.data.CsvStore";s:7:"private";b:1;s:7:"summary";s:0:"";}s:33:"dojox.data.CsvStore._loadFinished";a:3:{s:8:"instance";s:19:"dojox.data.CsvStore";s:7:"private";b:1;s:7:"summary";s:0:"";}s:34:"dojox.data.CsvStore._queuedFetches";a:3:{s:8:"instance";s:19:"dojox.data.CsvStore";s:7:"private";b:1;s:7:"summary";s:0:"";}s:37:"dojox.data.CsvStore._attributeIndexes";a:3:{s:8:"instance";s:19:"dojox.data.CsvStore";s:7:"private";b:1;s:7:"summary";s:0:"";}s:30:"dojox.data.CsvStore._storeProp";a:3:{s:8:"instance";s:19:"dojox.data.CsvStore";s:7:"private";b:1;s:7:"summary";s:0:"";}s:27:"dojox.data.CsvStore._idProp";a:3:{s:8:"instance";s:19:"dojox.data.CsvStore";s:7:"private";b:1;s:7:"summary";s:0:"";}s:29:"dojox.data.CsvStore._features";a:3:{s:8:"instance";s:19:"dojox.data.CsvStore";s:7:"private";b:1;s:7:"summary";s:0:"";}s:26:"dojox.data.CsvStore._idMap";a:3:{s:8:"instance";s:19:"dojox.data.CsvStore";s:7:"private";b:1;s:7:"summary";s:0:"";}s:10:"dojox.data";a:2:{s:4:"type";s:6:"Object";s:7:"summary";s:0:"";}s:5:"dojox";a:2:{s:4:"type";s:6:"Object";s:7:"summary";s:0:"";}}