Last change
on this file since 256 was
256,
checked in by hendrikvanantwerpen, 13 years ago
|
Reworked project structure based on REST interaction and Dojo library. As
soon as this is stable, the old jQueryUI branch can be removed (it's
kept for reference).
|
File size:
1.1 KB
|
Line | |
---|
1 | define(["dojo/_base/declare", "dojox/data/JsonRestStore", "dojox/rpc/ProxiedPath"], |
---|
2 | function(declare, JsonRestStore, ProxiedPath) { |
---|
3 | |
---|
4 | // S3JsonRestStore is an extension of JsonRestStore to handle |
---|
5 | // Amazon's S3 service using JSON data |
---|
6 | /*===== var JsonRestStore = dojox.data.JsonRestStore =====*/ |
---|
7 | return declare("dojox.data.S3Store", JsonRestStore, |
---|
8 | { |
---|
9 | _processResults : function(results){ |
---|
10 | // unfortunately, S3 returns query results in XML form |
---|
11 | var keyElements = results.getElementsByTagName("Key"); |
---|
12 | var jsResults = []; |
---|
13 | var self = this; |
---|
14 | for(var i=0; i <keyElements.length;i++){ |
---|
15 | var keyElement = keyElements[i]; |
---|
16 | // manually create lazy loaded Deferred items for each item in the result array |
---|
17 | var val = { |
---|
18 | _loadObject: (function(key,val){ |
---|
19 | return function(callback){ |
---|
20 | // when a callback is added we will fetch it |
---|
21 | delete this._loadObject; |
---|
22 | self.service(key).addCallback(callback); |
---|
23 | }; |
---|
24 | })(keyElement.firstChild.nodeValue,val) |
---|
25 | }; |
---|
26 | jsResults.push(val); |
---|
27 | } |
---|
28 | |
---|
29 | return {totalCount:jsResults.length, items: jsResults}; |
---|
30 | } |
---|
31 | } |
---|
32 | ); |
---|
33 | |
---|
34 | }); |
---|
Note: See
TracBrowser
for help on using the repository browser.