aboutsummaryrefslogtreecommitdiff
path: root/includes/js/dojox/rpc/demos
diff options
context:
space:
mode:
Diffstat (limited to 'includes/js/dojox/rpc/demos')
-rw-r--r--includes/js/dojox/rpc/demos/demo_JsonRestStore_CouchDB.html125
-rw-r--r--includes/js/dojox/rpc/demos/demo_JsonRestStore_Persevere.html65
-rw-r--r--includes/js/dojox/rpc/demos/documentation.html33
-rw-r--r--includes/js/dojox/rpc/demos/templates/documentation.html8
-rw-r--r--includes/js/dojox/rpc/demos/templates/yahoo.html31
-rw-r--r--includes/js/dojox/rpc/demos/yahoo.html39
6 files changed, 301 insertions, 0 deletions
diff --git a/includes/js/dojox/rpc/demos/demo_JsonRestStore_CouchDB.html b/includes/js/dojox/rpc/demos/demo_JsonRestStore_CouchDB.html
new file mode 100644
index 0000000..f5fc26c
--- /dev/null
+++ b/includes/js/dojox/rpc/demos/demo_JsonRestStore_CouchDB.html
@@ -0,0 +1,125 @@
+<!--
+
+ This file is a demo of the JsonRestStore connected to CouchDB.
+
+-->
+
+<html>
+
+<head>
+
+ <title>Demo of JsonRestStore</title>
+
+ <style type="text/css">
+
+
+
+ @import "../../../dijit/themes/tundra/tundra.css";
+
+ @import "../../../dojo/resources/dojo.css";
+
+ </style>
+
+
+
+ <script type="text/javascript" src="../../../dojo/dojo.js" djConfig="isDebug: true, parseOnLoad: true"></script>
+
+ <script type="text/javascript">
+
+ dojo.require("dojox.rpc.Service");
+ dojo.require("dojox.data.CouchDBRestStore");
+ function init(){
+ var couchSMD = dojox.data.CouchDBRestStore.generateSMD("/couchDB/");
+ var couchServices = new dojox.rpc.Service(couchSMD); // just connect to the auto-generated SMD from persevere
+ friendStore = new dojox.data.CouchDBRestStore({service:couchServices.friends}); // and create a store for it
+ }
+
+ dojo.addOnLoad(init);
+
+ function invokeSearch() {
+ friendStore.fetch({count:3,onComplete:function(friends) {
+ var firstFriend = friendStore.getValue(friends.rows,0);
+ var name = friendStore.getValue(firstFriend,"name");
+ alert("old name " + name);
+ friendStore.setValue(firstFriend,"name","new name" + Math.random());
+ var newItem = {"name":"Another friend",age:31};
+ friendStore.newItem(newItem);
+ friendStore.onSave= function() {
+ delete friendStore.onSave;
+ friendStore.setValue(newItem,"name","change after creating");
+ friendStore.save();
+ }
+ friendStore.save();
+
+ }});
+
+ }
+
+ </script>
+
+</head>
+
+
+
+<body class="tundra">
+
+ <h1>
+
+ DEMO: JsonRestStore Search
+
+ </h1>
+
+ <hr>
+
+ <h3>
+
+ Description:
+
+ </h3>
+
+ <p>
+
+ This simple demo shows how JsonRestStore can be used with Persevere.
+
+ </p>
+
+ <p>
+
+ </p>
+
+
+
+ <blockquote>
+
+
+
+ <!--
+
+ The store instance used by this demo.
+
+ -->
+
+ <table>
+
+ <tbody>
+
+ <tr>
+
+ <td>
+
+ <button name="search" id="searchButton" onclick="invokeSearch()">Search</button>
+
+ </td>
+
+ </tr>
+
+ </tbody>
+
+ </table>
+
+ <hr/>
+
+</body>
+
+</html>
+
diff --git a/includes/js/dojox/rpc/demos/demo_JsonRestStore_Persevere.html b/includes/js/dojox/rpc/demos/demo_JsonRestStore_Persevere.html
new file mode 100644
index 0000000..40c6bac
--- /dev/null
+++ b/includes/js/dojox/rpc/demos/demo_JsonRestStore_Persevere.html
@@ -0,0 +1,65 @@
+<!--
+This file is a demo of the JsonRestStore connected to Persevere
+-->
+<html>
+<head>
+ <title>Demo of JsonRestStore</title>
+ <style type="text/css">
+
+ @import "../../../dijit/themes/tundra/tundra.css";
+ @import "../../../dojo/resources/dojo.css";
+ </style>
+
+ <script type="text/javascript" src="../../../dojo/dojo.js" djConfig="isDebug: true, parseOnLoad: true"></script>
+ <script type="text/javascript">
+ dojo.require("dojox.rpc.Service");
+ dojo.require("dojox.data.JsonRestStore");
+
+ function init(){
+ var persevereServices = new dojox.rpc.Service("/persevere/SMD"); // just connect to the auto-generated SMD from persevere
+ dynaStore = new dojox.data.JsonRestStore({service:persevereServices.dyna}); // and create a store for it
+
+ }
+ dojo.addOnLoad(init);
+ function invokeSearch() {
+ dynaStore.fetch({query:"0",onComplete:function(root) {
+ var name = dynaStore.getValue(root,"name");
+ alert("old name " + name);
+ dynaStore.setValue(root,"name","new name" + Math.random());
+ dynaStore.save();
+ }});
+ }
+ </script>
+</head>
+
+<body class="tundra">
+ <h1>
+ DEMO: JsonRestStore Search
+ </h1>
+ <hr>
+ <h3>
+ Description:
+ </h3>
+ <p>
+ This simple demo shows how JsonRestStore can be used with Persevere.
+ </p>
+ <p>
+ </p>
+
+ <blockquote>
+
+ <!--
+ The store instance used by this demo.
+ -->
+ <table>
+ <tbody>
+ <tr>
+ <td>
+ <button name="search" id="searchButton" onclick="invokeSearch()">Search</button>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ <hr/>
+</body>
+</html>
diff --git a/includes/js/dojox/rpc/demos/documentation.html b/includes/js/dojox/rpc/demos/documentation.html
new file mode 100644
index 0000000..4c28103
--- /dev/null
+++ b/includes/js/dojox/rpc/demos/documentation.html
@@ -0,0 +1,33 @@
+<html>
+ <head>
+ <script src="../../../dojo/dojo.js" djConfig="parseOnLoad: true"></script>
+ <script>
+ dojo.require("dojo.io.script")
+ dojo.require("dojox.rpc.Service");
+ dojo.require("dijit._Widget");
+ dojo.require("dojox.dtl._Templated");
+ dojo.require("dojo.parser");
+
+ dojo.declare("API", [dijit._Widget, dojox.dtl._Templated], {
+ constructor: function(params, node){
+ this.jsonp = new dojox.rpc.Service(dojo.moduleUrl("dojox.rpc", "documentation.smd"));
+ },
+ onSearch: function(e){
+ if(e.keyCode == dojo.keys.ENTER){
+ this.jsonp.get({
+ name: e.target.value
+ }).addCallback(this, function(results){
+ console.debug(results);
+ this.results = results;
+ this.render();
+ });
+ }
+ },
+ templatePath: dojo.moduleUrl("dojox.rpc.demos.templates", "documentation.html")
+ });
+ </script>
+ </head>
+ <body>
+ <div dojoType="API"></div>
+ </body>
+</html> \ No newline at end of file
diff --git a/includes/js/dojox/rpc/demos/templates/documentation.html b/includes/js/dojox/rpc/demos/templates/documentation.html
new file mode 100644
index 0000000..d14cf16
--- /dev/null
+++ b/includes/js/dojox/rpc/demos/templates/documentation.html
@@ -0,0 +1,8 @@
+<div>
+ <input dojotAttachPoint="search" dojoAttachEvent="onkeyup: onSearch">
+ <ul>
+ {% for result in results %}
+ <li>{% if result.type %}<i>{{ result.type }}</i> {% endif %}{% ifequal result.type "Function" %}{% if not result.resources %}function {% endif %}{% endifequal %}{{ result.name }}{% ifequal result.type "Function" %}{% if not result.resources %}({% for parameter in result.parameters %}{% if not forloop.first %}, {% endif %}{% if parameter.types %}<i>{% for type in parameter.types %}{% if not forloop.first %}|{% endif %}{{ type.title }}{% endfor %}{% if parameter.optional %}?{% endif %}{% if parameter.repeating %}...{% endif %}</i> {% endif %}{{ parameter.name }}{% endfor %}{% endif %}{% endifequal %}{% ifequal result.type "Function" %}{% if not result.resources %}){% endif %}{% endifequal %}</li>
+ {% endfor %}
+ </ul>
+</div> \ No newline at end of file
diff --git a/includes/js/dojox/rpc/demos/templates/yahoo.html b/includes/js/dojox/rpc/demos/templates/yahoo.html
new file mode 100644
index 0000000..04339d2
--- /dev/null
+++ b/includes/js/dojox/rpc/demos/templates/yahoo.html
@@ -0,0 +1,31 @@
+<div>
+ <input dojotAttachPoint="search" dojoAttachEvent="onkeyup: onSearch">
+ <ul>
+ {% for result in results.Result %}
+ <li><a href="{{ result.Url }}">{{ result.Title }}</a><br/>{{ result.Summary }}</li>
+ {% endfor %}
+ </ul>
+ <table>
+ {% if results.firstResultPosition %}
+ <tr>
+ <th align="left">First Result</th>
+ <td>{{ results.firstResultPosition }}</td>
+ </tr>
+ {% endif %}{% if results.totalResultsAvailable %}
+ <tr>
+ <th align="left">Total Results Available</th>
+ <td>{{ results.totalResultsAvailable }}</td>
+ </tr>
+ {% endif %}{% if results.totalResultsReturned %}
+ <tr>
+ <th align="left">Results Returned</th>
+ <td>{{ results.totalResultsReturned }}</td>
+ </tr>
+ {% endif %}{% if results.type %}
+ <tr>
+ <th align="left">Type</th>
+ <td>{{ results.type }}</td>
+ </tr>
+ {% endif %}
+ </table>
+</div>
diff --git a/includes/js/dojox/rpc/demos/yahoo.html b/includes/js/dojox/rpc/demos/yahoo.html
new file mode 100644
index 0000000..39cee00
--- /dev/null
+++ b/includes/js/dojox/rpc/demos/yahoo.html
@@ -0,0 +1,39 @@
+<html>
+ <head>
+ <title>
+ Yahoo Search Demo
+ </title>
+ <script src="../../../dojo/dojo.js" type="text/javascript"
+ djConfig="parseOnLoad: true, isDebug: true"></script>
+ <script type="text/javascript">
+ dojo.require("dojo.io.script")
+ dojo.require("dojox.rpc.Service");
+ dojo.require("dijit._Widget");
+ dojo.require("dojox.dtl._Templated");
+ dojo.require("dojo.parser");
+
+ dojo.declare("YahooWebSearchApiWidget", [dijit._Widget, dojox.dtl._Templated], {
+ constructor: function(params, node){
+ var mu = dojo.moduleUrl("dojox.rpc.SMDLibrary", "yahoo.smd");
+ this.yahoo = new dojox.rpc.Service(mu);
+ },
+ onSearch: function(e){
+ if(e.keyCode == dojo.keys.ENTER){
+ this.yahoo.webSearch({
+ query: e.target.value
+ }).addCallback(this, function(results){
+ console.debug(results.ResultSet);
+ this.results = results.ResultSet;
+ this.render();
+ });
+ }
+ },
+ templatePath: dojo.moduleUrl("dojox.rpc.demos.templates", "yahoo.html")
+ });
+ </script>
+ </head>
+ <body>
+ <h1>Yahoo Web Search</h1>
+ <div dojoType="YahooWebSearchApiWidget"></div>
+ </body>
+</html>