PicasaView.js 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. if (!dojo._hasResource["dojox.data.demos.widgets.PicasaView"]) { // _hasResource
  2. // checks
  3. // added by
  4. // build. Do
  5. // not use
  6. // _hasResource
  7. // directly
  8. // in your
  9. // code.
  10. dojo._hasResource["dojox.data.demos.widgets.PicasaView"] = true;
  11. dojo.provide("dojox.data.demos.widgets.PicasaView");
  12. dojo.require("dijit._Templated");
  13. dojo.require("dijit._Widget");
  14. dojo.declare("dojox.data.demos.widgets.PicasaView", [dijit._Widget,
  15. dijit._Templated], {
  16. // Simple demo widget for representing a view of a Picasa Item.
  17. templateString : "<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",
  18. // Attach points for reference.
  19. titleNode : null,
  20. descriptionNode : null,
  21. imageNode : null,
  22. authorNode : null,
  23. title : "",
  24. author : "",
  25. imageUrl : "",
  26. iconUrl : "",
  27. postCreate : function() {
  28. this.titleNode.appendChild(document
  29. .createTextNode(this.title));
  30. this.authorNode.appendChild(document
  31. .createTextNode(this.author));
  32. this.descriptionNode.appendChild(document
  33. .createTextNode(this.description));
  34. var href = document.createElement("a");
  35. href.setAttribute("href", this.imageUrl);
  36. href.setAttribute("target", "_blank");
  37. var imageTag = document.createElement("img");
  38. imageTag.setAttribute("src", this.iconUrl);
  39. href.appendChild(imageTag);
  40. this.imageNode.appendChild(href);
  41. }
  42. });
  43. }