a:26:{s:9:"#provides";s:22:"dojox.data.FlickrStore";s:9:"#resource";s:19:"data/FlickrStore.js";s:9:"#requires";a:4:{i:0;a:3:{i:0;s:6:"common";i:1;s:26:"dojo.data.util.simpleFetch";i:2;s:4:"dojo";}i:1;a:3:{i:0;s:6:"common";i:1;s:14:"dojo.io.script";i:2;s:4:"dojo";}i:2;a:3:{i:0;s:6:"common";i:1;s:15:"dojo.date.stamp";i:2;s:4:"dojo";}i:3;a:3:{i:0;s:6:"common";i:1;s:20:"dojo.AdapterRegistry";i:2;s:4:"dojo";}}s:22:"dojox.data.FlickrStore";a:7:{s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:4:"args";a:1:{s:4:"type";s:6:"Object";}}s:6:"source";s:60:" if(args && args.label){ this.label = args.label; }";s:7:"summary";s:38:"Initializer for the FlickrStore store.";s:11:"description";s:274:"The FlickrStore is a Datastore interface to one of the basic services of the Flickr service, the public photo feed. This does not provide access to all the services of Flickr. This store cannot do * and ? filtering as the flickr service provides no interface for wildcards.";s:6:"mixins";a:1:{s:9:"prototype";a:1:{i:0;s:26:"dojo.data.util.simpleFetch";}}s:9:"classlike";b:1;}s:32:"dojox.data.FlickrStore._storeRef";a:3:{s:9:"prototype";s:22:"dojox.data.FlickrStore";s:7:"private";b:1;s:7:"summary";s:0:"";}s:28:"dojox.data.FlickrStore.label";a:3:{s:9:"prototype";s:22:"dojox.data.FlickrStore";s:8:"instance";s:22:"dojox.data.FlickrStore";s:7:"summary";s:0:"";}s:36:"dojox.data.FlickrStore._assertIsItem";a:6:{s:9:"prototype";s:22:"dojox.data.FlickrStore";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:140:" if(!this.isItem(item)){ throw new Error("dojox.data.FlickrStore: 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:41:"dojox.data.FlickrStore._assertIsAttribute";a:6:{s:9:"prototype";s:22:"dojox.data.FlickrStore";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:9:"attribute";a:2:{s:4:"type";s:21:"attribute-name-string";s:7:"summary";s:55:"The attribute to test for being contained by the store.";}}s:6:"source";s:173:" if(typeof attribute !== "string"){ throw new Error("dojox.data.FlickrStore: a function was passed an attribute argument that was not 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:34:"dojox.data.FlickrStore.getFeatures";a:4:{s:9:"prototype";s:22:"dojox.data.FlickrStore";s:4:"type";s:8:"Function";s:6:"source";s:48:" return { 'dojo.data.api.Read': true };";s:7:"summary";s:36:"See dojo.data.api.Read.getFeatures()";}s:31:"dojox.data.FlickrStore.getValue";a:5:{s:9:"prototype";s:22:"dojox.data.FlickrStore";s:4:"type";s:8:"Function";s:10:"parameters";a:3:{s:4:"item";a:1:{s:4:"type";s:0:"";}s:9:"attribute";a:1:{s:4:"type";s:0:"";}s:12:"defaultValue";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:135:" var values = this.getValues(item, attribute); if(values && values.length > 0){ return values[0]; } return defaultValue;";s:7:"summary";s:33:"See dojo.data.api.Read.getValue()";}s:36:"dojox.data.FlickrStore.getAttributes";a:5:{s:9:"prototype";s:22:"dojox.data.FlickrStore";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:4:"item";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:153:" return [ "title", "description", "author", "datePublished", "dateTaken", "imageUrl", "imageUrlSmall", "imageUrlMedium", "tags", "link" ]; ";s:7:"summary";s:38:"See dojo.data.api.Read.getAttributes()";}s:35:"dojox.data.FlickrStore.hasAttribute";a:5:{s:9:"prototype";s:22:"dojox.data.FlickrStore";s:4:"type";s:8:"Function";s:10:"parameters";a:2:{s:4:"item";a:1:{s:4:"type";s:0:"";}s:9:"attribute";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:76:" if(this.getValue(item,attribute)){ return true; } return false;";s:7:"summary";s:38:"See dojo.data.api.Read.hasAttributes()";}s:35:"dojox.data.FlickrStore.isItemLoaded";a:5:{s:9:"prototype";s:22:"dojox.data.FlickrStore";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:4:"item";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:29:" return this.isItem(item);";s:7:"summary";s:37:"See dojo.data.api.Read.isItemLoaded()";}s:31:"dojox.data.FlickrStore.loadItem";a:5:{s:9:"prototype";s:22:"dojox.data.FlickrStore";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:11:"keywordArgs";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:60:" // summary: // See dojo.data.api.Read.loadItem()";s:7:"summary";s:33:"See dojo.data.api.Read.loadItem()";}s:31:"dojox.data.FlickrStore.getLabel";a:5:{s:9:"prototype";s:22:"dojox.data.FlickrStore";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:4:"item";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:41:" return this.getValue(item,this.label);";s:7:"summary";s:33:"See dojo.data.api.Read.getLabel()";}s:41:"dojox.data.FlickrStore.getLabelAttributes";a:5:{s:9:"prototype";s:22:"dojox.data.FlickrStore";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:4:"item";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:23:" return [this.label];";s:7:"summary";s:43:"See dojo.data.api.Read.getLabelAttributes()";}s:36:"dojox.data.FlickrStore.containsValue";a:5:{s:9:"prototype";s:22:"dojox.data.FlickrStore";s:4:"type";s:8:"Function";s:10:"parameters";a:3:{s:4:"item";a:1:{s:4:"type";s:0:"";}s:9:"attribute";a:1:{s:4:"type";s:0:"";}s:5:"value";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:165:" var values = this.getValues(item,attribute); for(var i = 0; i < values.length; i++){ if(values[i] === value){ return true; } } return false;";s:7:"summary";s:38:"See dojo.data.api.Read.containsValue()";}s:32:"dojox.data.FlickrStore.getValues";a:5:{s:9:"prototype";s:22:"dojox.data.FlickrStore";s:4:"type";s:8:"Function";s:10:"parameters";a:2:{s:4:"item";a:1:{s:4:"type";s:0:"";}s:9:"attribute";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:800:" this._assertIsItem(item); this._assertIsAttribute(attribute); var u = d.hitch(this, "_unescapeHtml"); var s = d.hitch(d.date.stamp, "fromISOString"); switch(attribute){ case "title": return [ u(item.title) ]; case "author": return [ u(item.author) ]; case "datePublished": return [ s(item.published) ]; case "dateTaken": return [ s(item.date_taken) ]; case "imageUrlSmall": return [ item.media.m.replace(/_m\./, "_s.") ]; case "imageUrl": return [ item.media.m.replace(/_m\./, ".") ]; case "imageUrlMedium": return [ item.media.m ]; case "link": return [ item.link ]; case "tags": return item.tags.split(" "); case "description": return [ u(item.description) ]; default: return []; }";s:7:"summary";s:33:"See dojo.data.api.Read.getValue()";}s:29:"dojox.data.FlickrStore.isItem";a:5:{s:9:"prototype";s:22:"dojox.data.FlickrStore";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:4:"item";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:84:" if(item && item[this._storeRef] === this){ return true; } return false;";s:7:"summary";s:31:"See dojo.data.api.Read.isItem()";}s:28:"dojox.data.FlickrStore.close";a:5:{s:9:"prototype";s:22:"dojox.data.FlickrStore";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:7:"request";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:57:" // summary: // See dojo.data.api.Read.close()";s:7:"summary";s:30:"See dojo.data.api.Read.close()";}s:34:"dojox.data.FlickrStore._fetchItems";a:6:{s:9:"prototype";s:22:"dojox.data.FlickrStore";s:4:"type";s:8:"Function";s:10:"parameters";a:3:{s:7:"request";a:2:{s:4:"type";s:1:"A";s:7:"summary";s:14:"request object";}s:12:"fetchHandler";a:2:{s:4:"type";s:1:"A";s:7:"summary";s:34:"function to call for fetched items";}s:12:"errorHandler";a:2:{s:4:"type";s:1:"A";s:7:"summary";s:25:"function to call on error";}}s:6:"source";s:1136:" var rq = request.query = request.query||{}; //Build up the content to send the request for. var content = { format: "json", tagmode:"any" }; d.forEach( [ "tags", "tagmode", "lang", "id", "ids" ], function(i){ if(rq[i]){ content[i] = rq[i]; } } ); content.id = rq.id||rq.userid||rq.groupid; if(rq.userids){ content.ids = rq.userids; } //Linking this up to Flickr is a PAIN! var handle = null; var getArgs = { url: dojox.data.FlickrStore.urlRegistry.match(request), preventCache: true, content: content }; var myHandler = d.hitch(this, function(data){ if(!!handle){ d.disconnect(handle); } //Process the items... fetchHandler(this._processFlickrData(data), request); }); handle = d.connect("jsonFlickrFeed", myHandler); var deferred = d.io.script.get(getArgs); //We only set up the errback, because the callback isn't ever really used because we have //to link to the jsonFlickrFeed function.... deferred.addErrback(function(error){ d.disconnect(handle); errorHandler(error, request); });";s:7:"summary";s:40:"Fetch flickr items that match to a query";s:7:"private";b:1;}s:41:"dojox.data.FlickrStore._processFlickrData";a:6:{s:9:"prototype";s:22:"dojox.data.FlickrStore";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:4:"data";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:264:" var items = []; if(data.items){ items = data.items; //Add on the store ref so that isItem can work. for(var i = 0; i < data.items.length; i++){ var item = data.items[i]; item[this._storeRef] = this; } } return items;";s:7:"private";b:1;s:7:"summary";s:0:"";}s:36:"dojox.data.FlickrStore._unescapeHtml";a:6:{s:9:"prototype";s:22:"dojox.data.FlickrStore";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:3:"str";a:2:{s:4:"type";s:6:"String";s:7:"summary";s:31:"String. The string to un-escape";}}s:6:"source";s:6808:"dojo.provide("dojox.data.FlickrStore"); dojo.require("dojo.data.util.simpleFetch"); dojo.require("dojo.io.script"); dojo.require("dojo.date.stamp"); dojo.require("dojo.AdapterRegistry"); (function(){ var d = dojo; dojo.declare("dojox.data.FlickrStore", null, { constructor: function(/*Object*/args){ // summary: // Initializer for the FlickrStore store. // description: // The FlickrStore is a Datastore interface to one of the basic services // of the Flickr service, the public photo feed. This does not provide // access to all the services of Flickr. // This store cannot do * and ? filtering as the flickr service // provides no interface for wildcards. if(args && args.label){ this.label = args.label; } }, _storeRef: "_S", label: "title", _assertIsItem: function(/* item */ item){ // summary: // This function tests whether the item passed in is indeed an item in the store. // item: // The item to test for being contained by the store. if(!this.isItem(item)){ throw new Error("dojox.data.FlickrStore: a function was passed an item argument that was not an item"); } }, _assertIsAttribute: function(/* attribute-name-string */ attribute){ // summary: // This function tests whether the item passed in is indeed a valid 'attribute' like type for the store. // attribute: // The attribute to test for being contained by the store. if(typeof attribute !== "string"){ throw new Error("dojox.data.FlickrStore: a function was passed an attribute argument that was not an attribute name string"); } }, getFeatures: function(){ // summary: // See dojo.data.api.Read.getFeatures() return { 'dojo.data.api.Read': true }; }, getValue: function(item, attribute, defaultValue){ // summary: // See dojo.data.api.Read.getValue() var values = this.getValues(item, attribute); if(values && values.length > 0){ return values[0]; } return defaultValue; }, getAttributes: function(item){ // summary: // See dojo.data.api.Read.getAttributes() return [ "title", "description", "author", "datePublished", "dateTaken", "imageUrl", "imageUrlSmall", "imageUrlMedium", "tags", "link" ]; }, hasAttribute: function(item, attribute){ // summary: // See dojo.data.api.Read.hasAttributes() if(this.getValue(item,attribute)){ return true; } return false; }, isItemLoaded: function(item){ // summary: // See dojo.data.api.Read.isItemLoaded() return this.isItem(item); }, loadItem: function(keywordArgs){ // summary: // See dojo.data.api.Read.loadItem() }, getLabel: function(item){ // summary: // See dojo.data.api.Read.getLabel() return this.getValue(item,this.label); }, getLabelAttributes: function(item){ // summary: // See dojo.data.api.Read.getLabelAttributes() return [this.label]; }, containsValue: function(item, attribute, value){ // summary: // See dojo.data.api.Read.containsValue() var values = this.getValues(item,attribute); for(var i = 0; i < values.length; i++){ if(values[i] === value){ return true; } } return false; }, getValues: function(item, attribute){ // summary: // See dojo.data.api.Read.getValue() this._assertIsItem(item); this._assertIsAttribute(attribute); var u = d.hitch(this, "_unescapeHtml"); var s = d.hitch(d.date.stamp, "fromISOString"); switch(attribute){ case "title": return [ u(item.title) ]; case "author": return [ u(item.author) ]; case "datePublished": return [ s(item.published) ]; case "dateTaken": return [ s(item.date_taken) ]; case "imageUrlSmall": return [ item.media.m.replace(/_m\./, "_s.") ]; case "imageUrl": return [ item.media.m.replace(/_m\./, ".") ]; case "imageUrlMedium": return [ item.media.m ]; case "link": return [ item.link ]; case "tags": return item.tags.split(" "); case "description": return [ u(item.description) ]; default: return []; } }, isItem: function(item){ // summary: // See dojo.data.api.Read.isItem() if(item && item[this._storeRef] === this){ return true; } return false; }, close: function(request){ // summary: // See dojo.data.api.Read.close() }, _fetchItems: function(request, fetchHandler, errorHandler){ // summary: // Fetch flickr items that match to a query // request: // A request object // fetchHandler: // A function to call for fetched items // errorHandler: // A function to call on error var rq = request.query = request.query||{}; //Build up the content to send the request for. var content = { format: "json", tagmode:"any" }; d.forEach( [ "tags", "tagmode", "lang", "id", "ids" ], function(i){ if(rq[i]){ content[i] = rq[i]; } } ); content.id = rq.id||rq.userid||rq.groupid; if(rq.userids){ content.ids = rq.userids; } //Linking this up to Flickr is a PAIN! var handle = null; var getArgs = { url: dojox.data.FlickrStore.urlRegistry.match(request), preventCache: true, content: content }; var myHandler = d.hitch(this, function(data){ if(!!handle){ d.disconnect(handle); } //Process the items... fetchHandler(this._processFlickrData(data), request); }); handle = d.connect("jsonFlickrFeed", myHandler); var deferred = d.io.script.get(getArgs); //We only set up the errback, because the callback isn't ever really used because we have //to link to the jsonFlickrFeed function.... deferred.addErrback(function(error){ d.disconnect(handle); errorHandler(error, request); }); }, _processFlickrData: function(data){ var items = []; if(data.items){ items = data.items; //Add on the store ref so that isItem can work. for(var i = 0; i < data.items.length; i++){ var item = data.items[i]; item[this._storeRef] = this; } } return items; }, _unescapeHtml: function(/*String*/ str){ // summary: // Utility function to un-escape XML special characters in an // HTML string. // str: String. // The string to un-escape // returns: // HTML String converted back to the normal text (unescaped) // characters (<,>,&, ", etc,). //TODO: // Check to see if theres already compatible escape() in // dojo.string or dojo.html return str.replace(/&/gm, "&"). replace(/</gm, "<"). replace(/>/gm, ">"). replace(/"/gm, "\""). replace(/'/gm, "'"); ";s:7:"summary";s:71:"Utility function to un-escape XML special characters in an HTML string.";s:7:"private";b:1;}s:14:"jsonFlickrFeed";a:4:{s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:4:"data";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:3:"} ";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:"";}}