3ed9366cceacb69d6bd55337520796e3fff7cea3.svn-base 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  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>Inline Edit Box Test</title>
  6. <script type="text/javascript" src="../../../dojo/dojo.js"
  7. djConfig="isDebug: true, parseOnLoad: true"></script>
  8. <script type="text/javascript" src="../_testCommon.js"></script>
  9. <script type="text/javascript">
  10. dojo.require("dojo.data.ItemFileReadStore");
  11. dojo.require("dijit.form.InlineEditBox");
  12. dojo.require("dijit.form.Textarea");
  13. dojo.require("dijit.form.TextBox");
  14. dojo.require("dijit.form.DateTextBox");
  15. dojo.require("dijit.form.FilteringSelect");
  16. dojo.require("dijit.form.NumberSpinner");
  17. dojo.require("dijit.form.Slider");
  18. dojo.require("dojo.parser"); // scan page for widgets and instantiate them
  19. function myHandler(id,newValue){
  20. console.debug("onChange for id = " + id + ", value: " + newValue);
  21. };
  22. dojo.addOnLoad(function(){
  23. dojo.subscribe("widgetFocus", function(widget){
  24. console.log("focused on widget " + (widget?widget:"nothing"));
  25. });
  26. dojo.subscribe("widgetBlur", function(widget){
  27. console.log("blurred widget " + (widget?widget:"nothing"));
  28. });
  29. dojo.subscribe("focusNode", function(node){ console.log("focused on node " + (node?(node.id||node.tagName):"nothing"));});
  30. });
  31. </script>
  32. <style type="text/css">
  33. @import "../../../dojo/resources/dojo.css";
  34. @import "../css/dijitTests.css";
  35. .inlineEdit { background-color: #CCC76A; }
  36. /* some style rules on nodes just to test that style gets copied to the edit widget */
  37. p { font-family: cursive; }
  38. h3 { font-family: helvetica; font-style: italic; }
  39. </style>
  40. </head>
  41. <body>
  42. <h1 style="color: red; margin-bottom: 5em;">dijit.form.InlineEditBox is deprecated, use <a href="../test_InlineEditBox.html">dijit.InlineEditBox</a> instead</h1>
  43. <div>
  44. The following tests each show a plain element followed by an editable element.
  45. The plain element and editable element should look the same (font, font-size, block vs. inline) etc.,
  46. and clicking an editable element should bring up an editor with the same attributes
  47. (font, font-size, block vs. inline) as the editable element.
  48. </div>
  49. <hr>
  50. <h2>H3</h2>
  51. <div>
  52. The following two h3 tags should be look the same. They are display:block, and the editor should take up the entire
  53. width of the screen.
  54. </div>
  55. (before plain h3)
  56. <h3>this is a plain h3, cannot be edited</h3>
  57. (between plain and editable h3)
  58. <h3 id="editable" dojoType="dijit.form.InlineEditBox" onChange="myHandler(this.id,arguments[0])">
  59. <input dojoType="dijit.form.TextBox" value="this is an editable h3 - I trigger the onChange callback on save">
  60. </h3>
  61. (after editable h3)
  62. <hr style="width:100%;">
  63. <h2>Inline-block Text (of 400px width)</h2>
  64. <div>
  65. The following section uses inline block text of 400px.
  66. When clicking the editable text it should bring up an editor which is also 400px wide.
  67. </div>
  68. (before plain inline) <fieldset class="dijitInline"><div style="width: 400px;">hello ladies and gentlemen, now is the time for all good men to come to the aid of their country</div></fieldset> (after plain inline)
  69. <br>
  70. (before editable inline)
  71. <fieldset class="dijitInline"><div dojoType="dijit.form.InlineEditBox" onChange="myHandler(this.id,arguments[0])" style="width: 400px;">
  72. <span dojoType="dijit.form.TextBox" value="hello ladies and gentlemen, now is the time for all good men to come to aid of their country"></span>
  73. </div></fieldset>
  74. (after editable inline)
  75. <hr style="width:100%;">
  76. <h2>Pararagraph</h2>
  77. (before plain paragraph)
  78. <p>
  79. Aliquam vitae enim. Duis scelerisque metus auctor est venenatis
  80. imperdiet. Fusce dignissim porta augue. Nulla vestibulum. Integer lorem
  81. nunc, ullamcorper a, commodo ac, malesuada sed, dolor. Aenean id mi in
  82. massa bibendum suscipit. Integer eros. Nullam suscipit mauris. In
  83. pellentesque. Mauris ipsum est, pharetra semper, pharetra in, viverra
  84. quis, tellus. Etiam purus. Quisque egestas, tortor ac cursus lacinia,
  85. felis leo adipiscing nisi, et rhoncus elit dolor eget eros. Fusce ut
  86. quam. Suspendisse eleifend leo vitae ligula. Nulla facilisi. Nulla
  87. rutrum, erat vitae lacinia dictum, pede purus imperdiet lacus, ut
  88. semper velit ante id metus. Praesent massa dolor, porttitor sed,
  89. pulvinar in, consequat ut, leo. Nullam nec est. Aenean id risus blandit
  90. tortor pharetra congue. Suspendisse pulvinar.
  91. </p>
  92. (before editable paragraph. the editable paragraph has Save/Cancel buttons when open.)
  93. <p id="areaEditable" dojoType="dijit.form.InlineEditBox" autoSave="false">
  94. <textarea dojoType="dijit.form.Textarea">Aliquam vitae enim. Duis scelerisque metus auctor est venenatis
  95. imperdiet. Fusce dignissim porta augue. Nulla vestibulum. Integer lorem
  96. nunc, ullamcorper a, commodo ac, malesuada sed, dolor. Aenean id mi in
  97. massa bibendum suscipit. Integer eros. Nullam suscipit mauris. In
  98. pellentesque. Mauris ipsum est, pharetra semper, pharetra in, viverra
  99. quis, tellus. Etiam purus. Quisque egestas, tortor ac cursus lacinia,
  100. felis leo adipiscing nisi, et rhoncus elit dolor eget eros. Fusce ut
  101. quam. Suspendisse eleifend leo vitae ligula. Nulla facilisi. Nulla
  102. rutrum, erat vitae lacinia dictum, pede purus imperdiet lacus, ut
  103. semper velit ante id metus. Praesent massa dolor, porttitor sed,
  104. pulvinar in, consequat ut, leo. Nullam nec est. Aenean id risus blandit
  105. tortor pharetra congue. Suspendisse pulvinar.</textarea>
  106. </p>
  107. These links will
  108. <a href="javascript:;" onClick="dijit.byId('areaEditable').setDisabled(true)">disable</a> /
  109. <a href="javascript:;" onClick="dijit.byId('areaEditable').setDisabled(false)">enable</a>
  110. the InlineEditBox above.
  111. <br>
  112. (The following editable paragraph does not have Save/Cancel buttons when open)
  113. <p id="areaEditable_autosave" dojoType="dijit.form.InlineEditBox" autoSave="true">
  114. <textarea dojoType="dijit.form.Textarea">Aliquam vitae enim. Duis scelerisque metus auctor est venenatis
  115. imperdiet. Fusce dignissim porta augue. Nulla vestibulum. Integer lorem
  116. nunc, ullamcorper a, commodo ac, malesuada sed, dolor. Aenean id mi in
  117. massa bibendum suscipit. Integer eros. Nullam suscipit mauris. In
  118. pellentesque. Mauris ipsum est, pharetra semper, pharetra in, viverra
  119. quis, tellus. Etiam purus. Quisque egestas, tortor ac cursus lacinia,
  120. felis leo adipiscing nisi, et rhoncus elit dolor eget eros. Fusce ut
  121. quam. Suspendisse eleifend leo vitae ligula. Nulla facilisi. Nulla
  122. rutrum, erat vitae lacinia dictum, pede purus imperdiet lacus, ut
  123. semper velit ante id metus. Praesent massa dolor, porttitor sed,
  124. pulvinar in, consequat ut, leo. Nullam nec est. Aenean id risus blandit
  125. tortor pharetra congue. Suspendisse pulvinar.</textarea>
  126. </p>
  127. <hr style="width:100%;">
  128. <h2>Date text box:</h2>
  129. <span id="backgroundArea" dojoType="dijit.form.InlineEditBox">
  130. <input name="date" value="2005-12-30"
  131. dojoType="dijit.form.DateTextBox"
  132. constraints={datePattern:'MM/dd/yy'}
  133. lang="en-us"
  134. required="true"
  135. promptMessage="mm/dd/yy"
  136. invalidMessage="Invalid date. Use mm/dd/yy format.">
  137. </span>
  138. <hr style="width:100%;">
  139. <h2>FilteringSelect:</h2>
  140. <span dojoType="dojo.data.ItemFileReadStore" jsId="stateStore"
  141. url="../_data/states.json"></span>
  142. <span id="filteringSelect" dojoType="dijit.form.InlineEditBox" >
  143. <input searchAttr="name" keyAttr="abbreviation" id="setvaluetest" dojoType="dijit.form.FilteringSelect" value="IA"
  144. store="stateStore" name="state1" autoComplete="true" hasDownArrow="false">
  145. </span>
  146. <hr style="width:100%;">
  147. before block<div style="display:block;" id="programmatic"></div>after
  148. <script type="text/javascript">
  149. // See if we can make a widget in script
  150. // do it on load so Safari does not say display is none
  151. dojo.addOnLoad(function(){
  152. var inlineWidget = new dijit.form.InlineEditBox({renderAsHtml: true}, 'programmatic');
  153. var editorWidget = new dijit.form.TextBox({
  154. value:"Click here to edit a block programmatically created inline edit region"
  155. });
  156. editorWidget.domNode.style.width="100%";
  157. inlineWidget.addChild(editorWidget);
  158. inlineWidget.startup(); // scan for editWidget here, not on widget creation
  159. });
  160. </script>
  161. <hr style="width:100%;">
  162. <b>Spinner:</b>
  163. <span dojoType="dijit.form.InlineEditBox">
  164. <input dojoType="dijit.form.NumberSpinner"
  165. name="spinner"
  166. value="900"
  167. constraints="{places:0}">
  168. </span>
  169. <!-- InlineEditBox/Slider doesn't work on Firefox but does on IE and Safari
  170. <hr style="width:100%;">
  171. <b>Slider:</b>
  172. <p dojoType="dijit.form.InlineEditBox">
  173. <input dojoType="dijit.form.VerticalSlider"
  174. value="10"
  175. maximum="100"
  176. minimum="0"
  177. showButtons="false"
  178. style="height:100px;width:20px;">
  179. </p>
  180. -->
  181. </body>
  182. </html>