FlickrView.js 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. if (!dojo._hasResource["dojox.data.demos.widgets.FlickrView"]) { // _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.FlickrView"] = true;
  11. dojo.provide("dojox.data.demos.widgets.FlickrView");
  12. dojo.require("dijit._Templated");
  13. dojo.require("dijit._Widget");
  14. dojo.declare("dojox.data.demos.widgets.FlickrView", [dijit._Widget,
  15. dijit._Templated], {
  16. // Simple demo widget for representing a view of a Flickr Item.
  17. templateString : "<table class=\"flickrView\">\n\t<tbody>\n\t\t<tr class=\"flickrTitle\">\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\tImage:\n\t\t\t\t</b>\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. var href = document.createElement("a");
  33. href.setAttribute("href", this.imageUrl);
  34. href.setAttribute("target", "_blank");
  35. var imageTag = document.createElement("img");
  36. imageTag.setAttribute("src", this.iconUrl);
  37. href.appendChild(imageTag);
  38. this.imageNode.appendChild(href);
  39. }
  40. });
  41. }