test_Lightbox.html 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
  2. "http://www.w3.org/TR/html4/strict.dtd">
  3. <html>
  4. <head>
  5. <title>Dojo Lightbox Tests</title>
  6. <script type="text/javascript" src="../../../dojo/dojo.js" djConfig="isDebug:true, parseOnLoad: true"></script>
  7. <script type="text/javascript" src="../../../dijit/tests/_testCommon.js"></script>
  8. <script type="text/javascript" src="../Lightbox.js"></script>
  9. <script type="text/javascript">
  10. // dojo.require("dojox.image.Lightbox"); // un-comment when not debugging
  11. dojo.require("dojo.parser"); // scan page for widgets and instantiate them
  12. dojo.require("dojox.data.FlickrStore");
  13. </script>
  14. <style type="text/css">
  15. @import "../../../dojo/resources/dojo.css";
  16. @import "../../../dijit/themes/dijit.css";
  17. @import "../../../dijit/tests/css/dijitTests.css";
  18. /* you need this file */
  19. @import "../resources/image.css";
  20. body, html { width:100%; height:100%; margin:0; padding:0; }
  21. </style>
  22. <script type="text/javascript">
  23. // programatic flickrstore implementation [basic]
  24. function onComplete(items,request){
  25. if (items.length>0){
  26. dojo.forEach(items,function(item){
  27. var part = {
  28. title: flickrStore.getValue(item,"title"),
  29. href: flickrStore.getValue(item,"imageUrl")
  30. };
  31. // FIXME: make addImage more accessible, or do this internally
  32. dijit.byId('fromStore')._attachedDialog.addImage(part,"flickrStore");
  33. });
  34. dojo.byId('flickrButton').disabled = false;
  35. }
  36. }
  37. function onError(error,request){
  38. console.warn(error,request);
  39. }
  40. function init(){
  41. var flickrRequest = {
  42. query: {},
  43. onComplete: onComplete,
  44. onError: onError,
  45. userid: "jetstreet",
  46. tags: "jetstreet",
  47. count: 10
  48. };
  49. flickrStore.fetch(flickrRequest);
  50. }
  51. dojo.addOnLoad(init);
  52. </script>
  53. </head>
  54. <body class="tundra">
  55. <div style="padding:20px;">
  56. <h1 class="testTitle">Dojo-base Lightbox implementation</h1>
  57. <h3>Individual</h3>
  58. <p>
  59. <a href="images/imageVert.jpg" dojoType="dojox.image.Lightbox" title="More Guatemala...">tall</a>
  60. <a href="images/imageHoriz.jpg" dojoType="dojox.image.Lightbox" title="Antigua, Guatemala">4:3 image</a>
  61. </p>
  62. <h3>Grouped:</h3>
  63. <p>
  64. <a href="images/imageHoriz2.jpg" dojoType="dojox.image.Lightbox" group="group1" title="Amterdamn Train Depot">wide image</a>
  65. <a href="images/square.jpg" dojoType="dojox.image.Lightbox" group="group1" title="1:1 aspect">square</a>
  66. <a href="images/extraWide.jpg" dojoType="dojox.image.Lightbox" group="group1" title="Greeneville, TN">wide image</a>
  67. </p>
  68. <h3>Alternate Group:</h3>
  69. <p>
  70. <a href="images/imageHoriz2.jpg" dojoType="dojox.image.Lightbox" group="group2" title="Amterdamn Train Depot">wide image</a>
  71. <a href="images/square.jpg" dojoType="dojox.image.Lightbox" group="group2" title="1:1 aspect">square</a>
  72. <a href="images/imageHoriz.jpg" dojoType="dojox.image.Lightbox" group="group2" title="Antigua, Guatemala">4:3 image</a>
  73. <a href="images/imageVert.jpg" dojoType="dojox.image.Lightbox" group="group2" title="More Guatemala...">tall</a>
  74. </p>
  75. <h3>From dojox.data.FlickrStore (?)</h3>
  76. <div dojoType="dojox.data.FlickrStore" jsId="flickrStore" label="title"></div>
  77. <div id="fromStore" dojoType="dojox.image.Lightbox" store="flickrStore" group="flickrStore"></div>
  78. <input id="flickrButton" type="button" onclick="dijit.byId('fromStore').show()" value="show flickr lightbox" disabled="disabled">
  79. </div>
  80. </body>
  81. </html>