diff options
Diffstat (limited to 'js/dojo/dojox/data/demos/widgets')
8 files changed, 275 insertions, 0 deletions
diff --git a/js/dojo/dojox/data/demos/widgets/FileView.js b/js/dojo/dojox/data/demos/widgets/FileView.js new file mode 100644 index 0000000..5fa9e46 --- /dev/null +++ b/js/dojo/dojox/data/demos/widgets/FileView.js @@ -0,0 +1,45 @@ +//>>built +// wrapped by build app +define("dojox/data/demos/widgets/FileView", ["dijit","dojo","dojox","dojo/require!dijit/_Templated,dijit/_Widget"], function(dijit,dojo,dojox){ +dojo.provide("dojox.data.demos.widgets.FileView"); +dojo.require("dijit._Templated"); +dojo.require("dijit._Widget"); + +dojo.declare("dojox.data.demos.widgets.FileView", [dijit._Widget, dijit._Templated], { + //Simple demo widget for representing a view of a Flickr Item. + + templateString: dojo.cache("dojox", "data/demos/widgets/templates/FileView.html", "<div class=\"fileView\">\n\t<div class=\"fileViewTitle\">File Details:</div>\n\t<table class=\"fileViewTable\">\n\t\t<tbody>\n\t\t\t<tr class=\"fileName\">\n\t\t\t\t<td>\n\t\t\t\t\t<b>\n\t\t\t\t\t\tName:\n\t\t\t\t\t</b>\n\t\t\t\t</td>\n\t\t\t\t<td dojoAttachPoint=\"nameNode\">\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td>\n\t\t\t\t\t<b>\n\t\t\t\t\t\tPath:\n\t\t\t\t\t</b>\n\t\t\t\t</td>\n\t\t\t\t<td dojoAttachPoint=\"pathNode\">\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td>\n\t\t\t\t\t<b>\n\t\t\t\t\t\tSize:\n\t\t\t\t\t</b>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<span dojoAttachPoint=\"sizeNode\"></span> bytes.\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td>\n\t\t\t\t\t<b>\n\t\t\t\t\t\tIs Directory:\n\t\t\t\t\t</b>\n\t\t\t\t</td>\n\t\t\t\t<td dojoAttachPoint=\"directoryNode\">\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td>\n\t\t\t\t\t<b>\n\t\t\t\t\t\tParent Directory:\n\t\t\t\t\t</b>\n\t\t\t\t</td>\n\t\t\t\t<td dojoAttachPoint=\"parentDirNode\">\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td>\n\t\t\t\t\t<b>\n\t\t\t\t\t\tChildren:\n\t\t\t\t\t</b>\n\t\t\t\t</td>\n\t\t\t\t<td dojoAttachPoint=\"childrenNode\">\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t</tbody>\n\t</table>\n</div>\n"), + + //Attach points for reference. + titleNode: null, + descriptionNode: null, + imageNode: null, + authorNode: null, + + name: "", + path: "", + size: 0, + directory: false, + parentDir: "", + children: [], + + postCreate: function(){ + this.nameNode.appendChild(document.createTextNode(this.name)); + this.pathNode.appendChild(document.createTextNode(this.path)); + this.sizeNode.appendChild(document.createTextNode(this.size)); + this.directoryNode.appendChild(document.createTextNode(this.directory)); + this.parentDirNode.appendChild(document.createTextNode(this.parentDir)); + if (this.children && this.children.length > 0) { + var i; + for (i = 0; i < this.children.length; i++) { + var tNode = document.createTextNode(this.children[i]); + this.childrenNode.appendChild(tNode); + if (i < (this.children.length - 1)) { + this.childrenNode.appendChild(document.createElement("br")); + } + } + } + } +}); + +}); diff --git a/js/dojo/dojox/data/demos/widgets/FlickrViewList.js b/js/dojo/dojox/data/demos/widgets/FlickrViewList.js new file mode 100644 index 0000000..294a7d6 --- /dev/null +++ b/js/dojo/dojox/data/demos/widgets/FlickrViewList.js @@ -0,0 +1,35 @@ +//>>built +// wrapped by build app +define("dojox/data/demos/widgets/FlickrViewList", ["dijit","dojo","dojox","dojo/require!dojox/dtl/_Templated,dijit/_Widget"], function(dijit,dojo,dojox){ +dojo.provide("dojox.data.demos.widgets.FlickrViewList"); +dojo.require("dojox.dtl._Templated"); +dojo.require("dijit._Widget"); + +dojo.declare("dojox.data.demos.widgets.FlickrViewList", + [ dijit._Widget, dojox.dtl._Templated ], + { + store: null, + items: null, + + templateString: dojo.cache("dojox", "data/demos/widgets/templates/FlickrViewList.html", "{% load dojox.dtl.contrib.data %}\n{% bind_data items to store as flickr %}\n<div dojoAttachPoint=\"list\">\n\t{% for item in flickr %}\n\t<div style=\"display: inline-block; align: top;\">\n\t\t<h5>{{ item.title }}</h5>\n\t\t<a href=\"{{ item.link }}\" style=\"border: none;\">\n\t\t\t<img src=\"{{ item.imageUrlMedium }}\">\n\t\t</a>\n\t\t<p>{{ item.author }}</p>\n\n\t\t<!--\n\t\t<img src=\"{{ item.imageUrl }}\">\n\t\t<p>{{ item.imageUrl }}</p>\n\t\t<img src=\"{{ item.imageUrlSmall }}\">\n\t\t-->\n\t</div>\n\t{% endfor %}\n</div>\n\n"), + + fetch: function(request){ + request.onComplete = dojo.hitch(this, "onComplete"); + request.onError = dojo.hitch(this, "onError"); + return this.store.fetch(request); + }, + + onError: function(){ + console.trace(); + this.items = []; + this.render(); + }, + + onComplete: function(items, request){ + this.items = items||[]; + this.render(); + } + } +); + +}); diff --git a/js/dojo/dojox/data/demos/widgets/PicasaView.js b/js/dojo/dojox/data/demos/widgets/PicasaView.js new file mode 100644 index 0000000..79b54bf --- /dev/null +++ b/js/dojo/dojox/data/demos/widgets/PicasaView.js @@ -0,0 +1,38 @@ +//>>built +// wrapped by build app +define("dojox/data/demos/widgets/PicasaView", ["dijit","dojo","dojox","dojo/require!dijit/_Templated,dijit/_Widget"], function(dijit,dojo,dojox){ +dojo.provide("dojox.data.demos.widgets.PicasaView"); +dojo.require("dijit._Templated"); +dojo.require("dijit._Widget"); + +dojo.declare("dojox.data.demos.widgets.PicasaView", [dijit._Widget, dijit._Templated], { + //Simple demo widget for representing a view of a Picasa Item. + + templateString: dojo.cache("dojox", "data/demos/widgets/templates/PicasaView.html", "<table class=\"picasaView\">\n\t<tbody>\n\t\t<tr class=\"picasaTitle\">\n\t\t\t<td>\n\t\t\t\t<b>\n\t\t\t\t\tTitle:\n\t\t\t\t</b>\n\t\t\t</td>\n\t\t\t<td dojoAttachPoint=\"titleNode\">\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td>\n\t\t\t\t<b>\n\t\t\t\t\tAuthor:\n\t\t\t\t</b>\n\t\t\t</td>\n\t\t\t<td dojoAttachPoint=\"authorNode\">\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td colspan=\"2\">\n\t\t\t\t<b>\n\t\t\t\t\tSummary:\n\t\t\t\t</b>\n\t\t\t\t<span class=\"picasaSummary\" dojoAttachPoint=\"descriptionNode\"></span>\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td dojoAttachPoint=\"imageNode\" colspan=\"2\">\n\t\t\t</td>\n\t\t</tr>\n\t</tbody>\n</table>\n\n"), + + //Attach points for reference. + titleNode: null, + descriptionNode: null, + imageNode: null, + authorNode: null, + + title: "", + author: "", + imageUrl: "", + iconUrl: "", + + postCreate: function(){ + this.titleNode.appendChild(document.createTextNode(this.title)); + this.authorNode.appendChild(document.createTextNode(this.author)); + this.descriptionNode.appendChild(document.createTextNode(this.description)); + var href = document.createElement("a"); + href.setAttribute("href", this.imageUrl); + href.setAttribute("target", "_blank"); + var imageTag = document.createElement("img"); + imageTag.setAttribute("src", this.iconUrl); + href.appendChild(imageTag); + this.imageNode.appendChild(href); + } +}); + +}); diff --git a/js/dojo/dojox/data/demos/widgets/PicasaViewList.js b/js/dojo/dojox/data/demos/widgets/PicasaViewList.js new file mode 100644 index 0000000..36b26dd --- /dev/null +++ b/js/dojo/dojox/data/demos/widgets/PicasaViewList.js @@ -0,0 +1,38 @@ +//>>built +// wrapped by build app +define("dojox/data/demos/widgets/PicasaViewList", ["dijit","dojo","dojox","dojo/require!dijit/_Templated,dijit/_Widget,dojox/data/demos/widgets/PicasaView"], function(dijit,dojo,dojox){ +dojo.provide("dojox.data.demos.widgets.PicasaViewList"); +dojo.require("dijit._Templated"); +dojo.require("dijit._Widget"); +dojo.require("dojox.data.demos.widgets.PicasaView"); + +dojo.declare("dojox.data.demos.widgets.PicasaViewList", [dijit._Widget, dijit._Templated], { + //Simple demo widget that is just a list of PicasaView Widgets. + + templateString: dojo.cache("dojox", "data/demos/widgets/templates/PicasaViewList.html", "<div dojoAttachPoint=\"list\"></div>\n\n"), + + //Attach points for reference. + listNode: null, + + postCreate: function(){ + this.fViewWidgets = []; + }, + + clearList: function(){ + while(this.list.firstChild){ + this.list.removeChild(this.list.firstChild); + } + for(var i = 0; i < this.fViewWidgets.length; i++){ + this.fViewWidgets[i].destroy(); + } + this.fViewWidgets = []; + }, + + addView: function(viewData){ + var newView = new dojox.data.demos.widgets.PicasaView(viewData); + this.fViewWidgets.push(newView); + this.list.appendChild(newView.domNode); + } +}); + +}); diff --git a/js/dojo/dojox/data/demos/widgets/templates/FileView.html b/js/dojo/dojox/data/demos/widgets/templates/FileView.html new file mode 100644 index 0000000..a83fd28 --- /dev/null +++ b/js/dojo/dojox/data/demos/widgets/templates/FileView.html @@ -0,0 +1,62 @@ +<div class="fileView"> + <div class="fileViewTitle">File Details:</div> + <table class="fileViewTable"> + <tbody> + <tr class="fileName"> + <td> + <b> + Name: + </b> + </td> + <td dojoAttachPoint="nameNode"> + </td> + </tr> + <tr> + <td> + <b> + Path: + </b> + </td> + <td dojoAttachPoint="pathNode"> + </td> + </tr> + <tr> + <td> + <b> + Size: + </b> + </td> + <td> + <span dojoAttachPoint="sizeNode"></span> bytes. + </td> + </tr> + <tr> + <td> + <b> + Is Directory: + </b> + </td> + <td dojoAttachPoint="directoryNode"> + </td> + </tr> + <tr> + <td> + <b> + Parent Directory: + </b> + </td> + <td dojoAttachPoint="parentDirNode"> + </td> + </tr> + <tr> + <td> + <b> + Children: + </b> + </td> + <td dojoAttachPoint="childrenNode"> + </td> + </tr> + </tbody> + </table> +</div> diff --git a/js/dojo/dojox/data/demos/widgets/templates/FlickrViewList.html b/js/dojo/dojox/data/demos/widgets/templates/FlickrViewList.html new file mode 100644 index 0000000..e9fe02f --- /dev/null +++ b/js/dojo/dojox/data/demos/widgets/templates/FlickrViewList.html @@ -0,0 +1,20 @@ +{% load dojox.dtl.contrib.data %} +{% bind_data items to store as flickr %} +<div dojoAttachPoint="list"> + {% for item in flickr %} + <div style="display: inline-block; align: top;"> + <h5>{{ item.title }}</h5> + <a href="{{ item.link }}" style="border: none;"> + <img src="{{ item.imageUrlMedium }}"> + </a> + <p>{{ item.author }}</p> + + <!-- + <img src="{{ item.imageUrl }}"> + <p>{{ item.imageUrl }}</p> + <img src="{{ item.imageUrlSmall }}"> + --> + </div> + {% endfor %} +</div> + diff --git a/js/dojo/dojox/data/demos/widgets/templates/PicasaView.html b/js/dojo/dojox/data/demos/widgets/templates/PicasaView.html new file mode 100644 index 0000000..88dbb31 --- /dev/null +++ b/js/dojo/dojox/data/demos/widgets/templates/PicasaView.html @@ -0,0 +1,35 @@ +<table class="picasaView"> + <tbody> + <tr class="picasaTitle"> + <td> + <b> + Title: + </b> + </td> + <td dojoAttachPoint="titleNode"> + </td> + </tr> + <tr> + <td> + <b> + Author: + </b> + </td> + <td dojoAttachPoint="authorNode"> + </td> + </tr> + <tr> + <td colspan="2"> + <b> + Summary: + </b> + <span class="picasaSummary" dojoAttachPoint="descriptionNode"></span> + </td> + </tr> + <tr> + <td dojoAttachPoint="imageNode" colspan="2"> + </td> + </tr> + </tbody> +</table> + diff --git a/js/dojo/dojox/data/demos/widgets/templates/PicasaViewList.html b/js/dojo/dojox/data/demos/widgets/templates/PicasaViewList.html new file mode 100644 index 0000000..3a9f565 --- /dev/null +++ b/js/dojo/dojox/data/demos/widgets/templates/PicasaViewList.html @@ -0,0 +1,2 @@ +<div dojoAttachPoint="list"></div> + |
