summaryrefslogtreecommitdiffstats
path: root/sca-cpp/trunk/samples/store-nosql
diff options
context:
space:
mode:
Diffstat (limited to 'sca-cpp/trunk/samples/store-nosql')
-rw-r--r--sca-cpp/trunk/samples/store-nosql/htdocs/index.html9
-rw-r--r--sca-cpp/trunk/samples/store-nosql/shopping-cart.scm12
2 files changed, 13 insertions, 8 deletions
diff --git a/sca-cpp/trunk/samples/store-nosql/htdocs/index.html b/sca-cpp/trunk/samples/store-nosql/htdocs/index.html
index 79996c6853..83b1e16df4 100644
--- a/sca-cpp/trunk/samples/store-nosql/htdocs/index.html
+++ b/sca-cpp/trunk/samples/store-nosql/htdocs/index.html
@@ -24,6 +24,10 @@
<link rel="stylesheet" type="text/css" href="/ui.css"/>
<title>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-nosql/shopping-cart.scm b/sca-cpp/trunk/samples/store-nosql/shopping-cart.scm
index 61b169426f..e653f1e33c 100644
--- a/sca-cpp/trunk/samples/store-nosql/shopping-cart.scm
+++ b/sca-cpp/trunk/samples/store-nosql/shopping-cart.scm
@@ -31,7 +31,7 @@
; Post a new item to the cart, create a new cart if necessary
(define (post collection item cache)
(define id (uuid))
- (define newItem (list (car item) id (caddr item)))
+ (define newItem (list 'entry (cadr (car item)) (list 'id id) (cadddr (car item))))
(define cart (cons newItem (getcart cartId cache)))
(cache "put" (list cartId) cart)
(list id)
@@ -40,16 +40,16 @@
; Find an item in the cart
(define (find id cart)
(if (nul cart)
- (cons "Item" (list "0" (list)))
- (if (= id (cadr (car cart)))
- (car cart)
+ (list (list 'entry (list 'title "Item") (list 'id "0")))
+ (if (= id (cadr (caddr (car cart))))
+ (list (car cart))
(find id (cdr cart))))
)
; Get items from the cart
(define (get id cache)
(if (nul id)
- (cons "Your Cart" (cons cartId (getcart cartId cache)))
+ (list (append (list 'feed (list 'title "Your Cart") (list 'id cartId)) (getcart cartId cache)))
(find (car id) (getcart cartId cache))
)
)
@@ -64,7 +64,7 @@
; Return the price of an item
(define (price item)
- (cadr (assoc 'price (caddr item)))
+ (cadr (assoc 'price (cadr (cadddr item))))
)
; Sum the prices of a list of items