summaryrefslogtreecommitdiffstats
path: root/sca-cpp/trunk/samples/store-cluster/domains/jane
diff options
context:
space:
mode:
authorjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2011-03-08 08:18:07 +0000
committerjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2011-03-08 08:18:07 +0000
commit49b878b1b0f2e52bbd5282c22ac32a68e1e8736c (patch)
tree1eb26926f9d703c61b329a0f07178090b57cd55d /sca-cpp/trunk/samples/store-cluster/domains/jane
parent5b33dc5c5a87fff146951ca0543bf558454c331d (diff)
Change ATOM and RSS feed representations to use name value pairs instead of just strings, to allow support for all ATOM and RSS attributes and avoid confusion with non-feed string results.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1079292 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-cpp/trunk/samples/store-cluster/domains/jane')
-rw-r--r--sca-cpp/trunk/samples/store-cluster/domains/jane/htdocs/index.html11
-rw-r--r--sca-cpp/trunk/samples/store-cluster/domains/jane/shopping-cart.py12
2 files changed, 14 insertions, 9 deletions
diff --git a/sca-cpp/trunk/samples/store-cluster/domains/jane/htdocs/index.html b/sca-cpp/trunk/samples/store-cluster/domains/jane/htdocs/index.html
index 4cd219bc9c..09e2c4ab83 100644
--- a/sca-cpp/trunk/samples/store-cluster/domains/jane/htdocs/index.html
+++ b/sca-cpp/trunk/samples/store-cluster/domains/jane/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>Jane'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/jane/shopping-cart.py b/sca-cpp/trunk/samples/store-cluster/domains/jane/shopping-cart.py
index 44484ea5d2..b3818a6727 100644
--- a/sca-cpp/trunk/samples/store-cluster/domains/jane/shopping-cart.py
+++ b/sca-cpp/trunk/samples/store-cluster/domains/jane/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):