diff options
Diffstat (limited to 'sca-cpp/trunk/samples/store-cluster/domains/joe')
-rw-r--r-- | sca-cpp/trunk/samples/store-cluster/domains/joe/htdocs/index.html | 11 | ||||
-rw-r--r-- | sca-cpp/trunk/samples/store-cluster/domains/joe/shopping-cart.py | 12 |
2 files changed, 14 insertions, 9 deletions
diff --git a/sca-cpp/trunk/samples/store-cluster/domains/joe/htdocs/index.html b/sca-cpp/trunk/samples/store-cluster/domains/joe/htdocs/index.html index c32dcd9d53..4a25ff4afa 100644 --- a/sca-cpp/trunk/samples/store-cluster/domains/joe/htdocs/index.html +++ b/sca-cpp/trunk/samples/store-cluster/domains/joe/htdocs/index.html @@ -22,8 +22,12 @@ <meta name="apple-mobile-web-app-capable" content="yes"/>
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent"/>
<link rel="stylesheet" type="text/css" href="/ui.css"/>
-<title>Store</title>
+<title>Joe's Store</title>
+<script type="text/javascript" src="/util.js"></script>
+<script type="text/javascript" src="/elemutil.js"></script>
+<script type="text/javascript" src="/xmlutil.js"></script>
+<script type="text/javascript" src="/atomutil.js"></script>
<script type="text/javascript" src="/component.js"></script>
<script type="text/javascript">
@@ -50,8 +54,9 @@ function catalog_itemsResponse(items, exception) { }
-function shoppingCart_getResponse(feed) {
- if (feed != null) {
+function shoppingCart_getResponse(doc) {
+ if (doc != null) {
+ var feed = parseXML([doc]);
var entries = feed.getElementsByTagName("entry");
var list = "";
for (var i=0; i<entries.length; i++) {
diff --git a/sca-cpp/trunk/samples/store-cluster/domains/joe/shopping-cart.py b/sca-cpp/trunk/samples/store-cluster/domains/joe/shopping-cart.py index 44484ea5d2..b3818a6727 100644 --- a/sca-cpp/trunk/samples/store-cluster/domains/joe/shopping-cart.py +++ b/sca-cpp/trunk/samples/store-cluster/domains/joe/shopping-cart.py @@ -34,7 +34,7 @@ def getcart(id, cache): # Post a new item to the cart, create a new cart if necessary def post(collection, item, cache, host, email): id = str(uuid.uuid1()) - cart = ((item[0], id, item[2]),) + getcart(cartid(host, email), cache) + cart = (("'entry", item[0][1], ("'id", id), item[0][3]),) + getcart(cartid(host, email), cache) cache.put(cartid(host, email), cart) return (id,) @@ -42,16 +42,16 @@ def post(collection, item, cache, host, email): # Find an item in the cart def find(id, cart): if cart == (): - return ("Item", "0", ()) - elif id == cart[0][1]: - return cart[0] + return (("'entry", ("'title", "Item"), ("'id", 0)),) + elif id == cart[0][2][1]: + return (cart[0],) else: return find(id, cart[1:]) # Get items from the cart def get(id, cache, host, email): if id == (): - return ("Your Cart", email.eval()) + getcart(cartid(host, email), cache) + return ((("'feed", ("'title", "Your Cart"), ("'id", email.eval())) + getcart(cartid(host,email), cache)),) return find(id[0], getcart(cartid(host, email), cache)) # Delete items from the cart @@ -62,7 +62,7 @@ def delete(id, cache, host, email): # Return the price of an item def price(item): - return float(filter(lambda x: x[0] == "'price", item[2])[0][1]) + return float(filter(lambda x: x[0] == "'price", item[3][1][1:])[0][1]) # Sum the prices of a list of items def sum(items): |