aboutsummaryrefslogtreecommitdiff
path: root/includes/js/dojox/data/demos/demo_PicasaStore.html
diff options
context:
space:
mode:
authormensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f>2008-11-13 09:49:11 +0000
committermensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f>2008-11-13 09:49:11 +0000
commite44a7e37b6c7b5961adaffc62b9042b8d442938e (patch)
tree95b67c356e93163467db2451f2b8cce84ed5d582 /includes/js/dojox/data/demos/demo_PicasaStore.html
parenta62b9742ee5e28bcec6872d88f50f25b820914f6 (diff)
downloadsemanticscuttle-e44a7e37b6c7b5961adaffc62b9042b8d442938e.tar.gz
semanticscuttle-e44a7e37b6c7b5961adaffc62b9042b8d442938e.tar.bz2
New feature: basic Ajax suggestion for tags and implementation of Dojo toolkit
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@151 b3834d28-1941-0410-a4f8-b48e95affb8f
Diffstat (limited to 'includes/js/dojox/data/demos/demo_PicasaStore.html')
-rw-r--r--includes/js/dojox/data/demos/demo_PicasaStore.html188
1 files changed, 188 insertions, 0 deletions
diff --git a/includes/js/dojox/data/demos/demo_PicasaStore.html b/includes/js/dojox/data/demos/demo_PicasaStore.html
new file mode 100644
index 0000000..78bc961
--- /dev/null
+++ b/includes/js/dojox/data/demos/demo_PicasaStore.html
@@ -0,0 +1,188 @@
+<!--
+ This file is a demo of the PicasaStore, a simple wrapper to the public feed service
+ of Picasa. This just does very basic queries against Picasa and loads the results
+ into a list viewing widget.
+-->
+<html>
+<head>
+ <title>Demo of PicasaStore</title>
+ <style type="text/css">
+
+ @import "../../../dijit/themes/tundra/tundra.css";
+ @import "../../../dojo/resources/dojo.css";
+ @import "../../../dijit/tests/css/dijitTests.css";
+ @import "./picasaDemo.css";
+ </style>
+
+ <script type="text/javascript" src="../../../dojo/dojo.js" djConfig="isDebug: true, parseOnLoad: true"></script>
+ <script type="text/javascript">
+ dojo.require("dojo.parser");
+ dojo.require("dijit.form.TextBox");
+ dojo.require("dijit.form.Button");
+ dojo.require("dijit.form.ComboBox");
+ dojo.require("dijit.form.NumberSpinner");
+ dojo.require("dijit.Tree");
+ dojo.require("dojox.data.PicasaStore");
+ dojo.require("dojox.data.demos.widgets.PicasaViewList");
+ dojo.require("dojox.data.demos.widgets.PicasaView");
+
+ function init(){
+ var fViewWidgets = [];
+
+ //Set up an onComplete handler for flickrData
+ function onComplete(items, request){
+ flickrViewsWidget.clearList();
+ if(items.length > 0){
+ for(var i = 0; i < items.length; i++){
+ var flickrData = {
+ title: flickrStore.getValue(items[i],"title"),
+ author: flickrStore.getValue(items[i],"author"),
+ description: flickrStore.getValue(items[i],"description"),
+ iconUrl: flickrStore.getValue(items[i],"imageUrlSmall"),
+ imageUrl: flickrStore.getValue(items[i],"imageUrl")
+ }
+ flickrViewsWidget.addView(flickrData);
+ }
+ }
+ statusWidget.setValue("PROCESSING COMPLETE.");
+
+ }
+ //What to do if a search fails...
+ function onError(error, request){
+ flickrViewsWidget.clearList();
+ statusWidget.setValue("PROCESSING ERROR.");
+ }
+
+ //Function to invoke the search of the FlickrStore
+ function invokeSearch(){
+ var request = {
+ query: {},
+ onComplete: onComplete,
+ onError: onError
+ };
+
+ if(idWidget){
+ var userid = idWidget.getValue();
+ if(userid && userid !== ""){
+ request.query.userid = userid;
+ }
+ }
+ if(tagsWidget){
+ var tags = tagsWidget.getValue();
+ if(tags && tags !== ""){
+ var tagsArray = tags.split(" ");
+ tags = "";
+ for(var i = 0; i < tagsArray.length; i++){
+ tags = tags + tagsArray[i];
+ if(i < (tagsArray.length - 1)){
+ tags += ","
+ }
+ }
+ request.query.tags = tags;
+ }
+ }
+ if(countWidget){
+ request.count = countWidget.getValue();
+ }
+
+ if(startWidget){
+ request.query.start = startWidget.getValue();
+ }
+
+ if(statusWidget){
+ statusWidget.setValue("PROCESSING REQUEST");
+ }
+
+ flickrStore.fetch(request);
+ }
+
+ //Lastly, link up the search event.
+ var button = dijit.byId("searchButton");
+ dojo.connect(button, "onClick", invokeSearch);
+ }
+ dojo.addOnLoad(init);
+ </script>
+</head>
+
+<body class="tundra">
+ <h1>
+ DEMO: PicasaStore Search
+ </h1>
+ <hr>
+ <h3>
+ Description:
+ </h3>
+ <p>
+ This simple demo shows how services, such as Flickr, can be wrapped by the datastore API. In this demo, you can search public Flickr images through a simple FlickrStore by specifying a series of tags (separated by spaces) to search on. The results will be displayed below the search box.
+ </p>
+ <p>
+ For fun, search on the 3dny tag!
+ </p>
+
+ <blockquote>
+
+ <!--
+ The store instance used by this demo.
+ -->
+ <table>
+ <tbody>
+ <tr>
+ <td>
+ <b>Status:</b>
+ </td>
+ <td>
+ <div dojoType="dijit.form.TextBox" size="50" id="status" jsId="statusWidget" disabled="true"></div>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <b>ID:</b>
+ </td>
+ <td>
+ <div dojoType="dijit.form.TextBox" size="50" id="userid" jsId="idWidget"></div>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <b>Query:</b>
+ </td>
+ <td>
+ <div dojoType="dijit.form.TextBox" size="50" id="tags" jsId="tagsWidget" value="flower"></div>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <b>Number of Pictures:</b>
+ </td>
+ <td>
+ <div
+ id="start"
+ jsId="startWidget"
+ dojoType="dijit.form.NumberSpinner"
+ value="1"
+ constraints="{min:1,places:0}"
+ ></div>
+ <div
+ id="count"
+ jsId="countWidget"
+ dojoType="dijit.form.NumberSpinner"
+ value="20"
+ constraints="{min:1,max:100,places:0}"
+ ></div>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ </td>
+ <td>
+ <div dojoType="dijit.form.Button" label="Search" id="searchButton" jsId="searchButtonWidget"></div>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ <hr/>
+ <div dojoType="dojox.data.PicasaStore" jsId="flickrStore" label="title"></div>
+ <div dojoType="dojox.data.demos.widgets.PicasaViewList" id="flickrViews" jsId="flickrViewsWidget"></div>
+
+</body>
+</html>