2150 |
mathias |
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 |
|
|
|
7 |
<script type="text/javascript" src="../../dojo/dojo.js"
|
|
|
8 |
djConfig="isDebug: true, parseOnLoad: true"></script>
|
|
|
9 |
<script type="text/javascript" src="_testCommon.js"></script>
|
|
|
10 |
|
|
|
11 |
<script type="text/javascript">
|
|
|
12 |
dojo.require("dojo.data.ItemFileReadStore");
|
|
|
13 |
dojo.require("dijit.InlineEditBox");
|
|
|
14 |
dojo.require("dijit.form.Textarea");
|
|
|
15 |
dojo.require("dijit.form.TextBox");
|
|
|
16 |
dojo.require("dijit.form.DateTextBox");
|
|
|
17 |
dojo.require("dijit.form.CurrencyTextBox");
|
|
|
18 |
dojo.require("dojo.currency");
|
|
|
19 |
dojo.require("dijit.form.ComboBox");
|
|
|
20 |
dojo.require("dijit.form.FilteringSelect");
|
|
|
21 |
dojo.require("dijit.form.NumberSpinner");
|
|
|
22 |
dojo.require("dijit.form.Slider");
|
|
|
23 |
dojo.require("dojo.parser"); // scan page for widgets and instantiate them
|
|
|
24 |
|
|
|
25 |
function myHandler(id,newValue){
|
|
|
26 |
console.debug("onChange for id = " + id + ", value: " + newValue);
|
|
|
27 |
};
|
|
|
28 |
/*
|
|
|
29 |
dojo.addOnLoad(function(){
|
|
|
30 |
dojo.subscribe("widgetFocus", function(widget){
|
|
|
31 |
console.log("focused on widget " + (widget?widget:"nothing"));
|
|
|
32 |
});
|
|
|
33 |
dojo.subscribe("widgetBlur", function(widget){
|
|
|
34 |
console.log("blurred widget " + (widget?widget:"nothing"));
|
|
|
35 |
});
|
|
|
36 |
dojo.subscribe("focusNode", function(node){ console.log("focused on node " + (node?(node.id||node.tagName):"nothing"));});
|
|
|
37 |
});
|
|
|
38 |
*/
|
|
|
39 |
</script>
|
|
|
40 |
<style type="text/css">
|
|
|
41 |
@import "../../dojo/resources/dojo.css";
|
|
|
42 |
@import "css/dijitTests.css";
|
|
|
43 |
|
|
|
44 |
.inlineEdit { background-color: #CCC76A; }
|
|
|
45 |
|
|
|
46 |
/* some style rules on nodes just to test that style gets copied to the edit widget */
|
|
|
47 |
p { font-family: cursive; }
|
|
|
48 |
.letter p { font-family: monospace; }
|
|
|
49 |
h3 { font-family: helvetica; font-style: italic; }
|
|
|
50 |
</style>
|
|
|
51 |
</head>
|
|
|
52 |
<body>
|
|
|
53 |
<h1 class="testTitle">Dijit InlineEditBox Test</h1>
|
|
|
54 |
|
|
|
55 |
<span dojoType="dojo.data.ItemFileReadStore" jsId="stateStore"
|
|
|
56 |
url="_data/states.json"></span>
|
|
|
57 |
<span dojoType="dojo.data.ItemFileReadStore" jsId="productStore">
|
|
|
58 |
<script type="dojo/method">
|
|
|
59 |
console.log("doing preamble");
|
|
|
60 |
this._jsonData =
|
|
|
61 |
{ identifier: 'name',
|
|
|
62 |
label: 'name',
|
|
|
63 |
items: [
|
|
|
64 |
{ name: "refrigerator" },
|
|
|
65 |
{ name: "freezer" },
|
|
|
66 |
{ name: "stove" },
|
|
|
67 |
{ name: "heater" },
|
|
|
68 |
]};
|
|
|
69 |
</script>
|
|
|
70 |
</span>
|
|
|
71 |
|
|
|
72 |
<h2>Form Letter with blanks</h2>
|
|
|
73 |
<div class="letter">
|
|
|
74 |
<h3 id="editable" dojoType="dijit.InlineEditBox" onChange="myHandler(this.id,arguments[0])" autoSave="true" title="company name"></h3>
|
|
|
75 |
<p>
|
|
|
76 |
Dear <span dojoType="dijit.InlineEditBox" width="200px" title="recipient name"></span>,
|
|
|
77 |
</p>
|
|
|
78 |
<p class="letter">
|
|
|
79 |
Thank you for your recent order.
|
|
|
80 |
Please remit
|
|
|
81 |
<span dojoType="dijit.InlineEditBox" editor="dijit.form.CurrencyTextBox" editorParams="{currency: 'USD'}" width="100px" title="dollar amount"></span>
|
|
|
82 |
for your purchase of
|
|
|
83 |
<span dojoType="dijit.InlineEditBox" editor="dijit.form.NumberSpinner" editorParams="{constraints: {places:0} }" width="70px" title="quantity"></span>
|
|
|
84 |
deluxe
|
|
|
85 |
<span dojoType="dijit.InlineEditBox" editor="dijit.form.ComboBox" title="item name"
|
|
|
86 |
editorParams="{searchAttr: 'name', store: productStore, autocomplete: false, hasDownArrow: false}"
|
|
|
87 |
width="200px"></span>
|
|
|
88 |
on
|
|
|
89 |
<span dojoType="dijit.InlineEditBox" editor="dijit.form.DateTextBox" width="200px" title="purchase date as mm/dd/yy"></span>
|
|
|
90 |
in
|
|
|
91 |
<span dojoType="dijit.InlineEditBox" editor="dijit.form.FilteringSelect"
|
|
|
92 |
editorParams="{searchAttr: 'name', keyAttr: 'abbreviation', store: stateStore, autocomplete: true, hasDownArrow: true}"
|
|
|
93 |
width="200px" title="state of purchase"></span>.
|
|
|
94 |
</p>
|
|
|
95 |
<p dojoType="dijit.InlineEditBox" autoSave="false" editor="dijit.form.Textarea" title="additional details"></p>
|
|
|
96 |
<p>
|
|
|
97 |
Sincerely,
|
|
|
98 |
</p>
|
|
|
99 |
<span style="margin-left: 2em; font-family: cursive;" dojoType="dijit.InlineEditBox" width="400px" title="sender name" ></span>
|
|
|
100 |
</div>
|
|
|
101 |
<hr style="margin-bottom: 1em;">
|
|
|
102 |
|
|
|
103 |
<h2>Form Letter with predefined values, and no auto-save</h2>
|
|
|
104 |
<div class="letter">
|
|
|
105 |
<h3 id="editable2" dojoType="dijit.InlineEditBox" onChange="myHandler(this.id,arguments[0])" autoSave="false" title="company name">
|
|
|
106 |
Bob Vance Refrigeration
|
|
|
107 |
</h3>
|
|
|
108 |
<p>
|
|
|
109 |
Dear <span dojoType="dijit.InlineEditBox" width="200px" autoSave="false" title="recipient name">John</span>,
|
|
|
110 |
</p>
|
|
|
111 |
<p class="letter">
|
|
|
112 |
Thank you for your recent order.
|
|
|
113 |
Please remit
|
|
|
114 |
<span dojoType="dijit.InlineEditBox" editor="dijit.form.CurrencyTextBox" editorParams="{currency: 'USD'}" width="100px" autoSave="false" title="dollar amount">$2,000</span>
|
|
|
115 |
for your purchase of
|
|
|
116 |
<span dojoType="dijit.InlineEditBox" editor="dijit.form.NumberSpinner" editorParams="{constraints: {places:0} }" width="70px" autoSave="false" title="quantity">3</span>
|
|
|
117 |
deluxe
|
|
|
118 |
<span dojoType="dijit.InlineEditBox" editor="dijit.form.ComboBox"
|
|
|
119 |
editorParams="{searchAttr: 'name', store: productStore, autocomplete: false, hasDownArrow: false}"
|
|
|
120 |
width="200px" autoSave="false" title="item name">refrigerators</span>
|
|
|
121 |
on
|
|
|
122 |
<span dojoType="dijit.InlineEditBox" editor="dijit.form.DateTextBox" width="200px" autoSave="false" title="purchase date as mm/dd/yy">01/01/2007</span>
|
|
|
123 |
in
|
|
|
124 |
<span dojoType="dijit.InlineEditBox" editor="dijit.form.FilteringSelect"
|
|
|
125 |
editorParams="{searchAttr: 'name', keyAttr: 'abbreviation', store: stateStore, autocomplete: true, hasDownArrow: false}"
|
|
|
126 |
width="200px" autoSave="false" title="state of purchase">
|
|
|
127 |
Pennsylvania
|
|
|
128 |
</span>.
|
|
|
129 |
</p>
|
|
|
130 |
<p dojoType="dijit.InlineEditBox" autoSave="false" editor="dijit.form.Textarea" title="additional details">
|
|
|
131 |
We sincerely appreciate your business and hope we can do business again.
|
|
|
132 |
</p>
|
|
|
133 |
<p>
|
|
|
134 |
Sincerely,
|
|
|
135 |
</p>
|
|
|
136 |
<span style="margin-left: 2em; font-family: cursive;" dojoType="dijit.InlineEditBox" width="400px" autoSave="false" title="sender name">Bob Vance</span>
|
|
|
137 |
</div>
|
|
|
138 |
<hr style="margin-bottom: 1em;">
|
|
|
139 |
|
|
|
140 |
|
|
|
141 |
<h2>Inline-block Text (of 400px width)</h2>
|
|
|
142 |
<div>
|
|
|
143 |
The following section uses inline block text of 400px.
|
|
|
144 |
When clicking the editable text it should bring up an editor which is also 400px wide.
|
|
|
145 |
</div>
|
|
|
146 |
(before plain inline) <fieldset class="dijitInline"><div style="width: 400px;">hello world</div></fieldset> (after plain inline)
|
|
|
147 |
<br>
|
|
|
148 |
(before editable inline)
|
|
|
149 |
<fieldset class="dijitInline"><div dojoType="dijit.InlineEditBox" onChange="myHandler(this.id,arguments[0])" width="400px" style="width: 400px;">
|
|
|
150 |
hello world
|
|
|
151 |
</div></fieldset>
|
|
|
152 |
(after editable inline)
|
|
|
153 |
<hr style="width:100%;">
|
|
|
154 |
|
|
|
155 |
<h2>Pararagraph</h2>
|
|
|
156 |
(before plain paragraph)
|
|
|
157 |
<p>
|
|
|
158 |
Aliquam vitae enim. Duis scelerisque metus auctor est venenatis
|
|
|
159 |
imperdiet. Fusce dignissim porta augue. Nulla vestibulum. Integer lorem
|
|
|
160 |
nunc, ullamcorper a, commodo ac, malesuada sed, dolor. Aenean id mi in
|
|
|
161 |
massa bibendum suscipit. Integer eros. Nullam suscipit mauris. In
|
|
|
162 |
pellentesque. Mauris ipsum est, pharetra semper, pharetra in, viverra
|
|
|
163 |
quis, tellus. Etiam purus. Quisque egestas, tortor ac cursus lacinia,
|
|
|
164 |
felis leo adipiscing nisi, et rhoncus elit dolor eget eros. Fusce ut
|
|
|
165 |
quam. Suspendisse eleifend leo vitae ligula. Nulla facilisi. Nulla
|
|
|
166 |
rutrum, erat vitae lacinia dictum, pede purus imperdiet lacus, ut
|
|
|
167 |
semper velit ante id metus. Praesent massa dolor, porttitor sed,
|
|
|
168 |
pulvinar in, consequat ut, leo. Nullam nec est. Aenean id risus blandit
|
|
|
169 |
tortor pharetra congue. Suspendisse pulvinar.
|
|
|
170 |
</p>
|
|
|
171 |
(before editable paragraph. the editable paragraph has Save/Cancel buttons when open.)
|
|
|
172 |
<p id="areaEditable" dojoType="dijit.InlineEditBox" autoSave="false" editor="dijit.form.Textarea">
|
|
|
173 |
Aliquam vitae enim. Duis scelerisque metus auctor est venenatis
|
|
|
174 |
imperdiet. Fusce dignissim porta augue. Nulla vestibulum. Integer lorem
|
|
|
175 |
nunc, ullamcorper a, commodo ac, malesuada sed, dolor. Aenean id mi in
|
|
|
176 |
massa bibendum suscipit. Integer eros. Nullam suscipit mauris. In
|
|
|
177 |
pellentesque. Mauris ipsum est, pharetra semper, pharetra in, viverra
|
|
|
178 |
quis, tellus. Etiam purus. Quisque egestas, tortor ac cursus lacinia,
|
|
|
179 |
felis leo adipiscing nisi, et rhoncus elit dolor eget eros. Fusce ut
|
|
|
180 |
quam. Suspendisse eleifend leo vitae ligula. Nulla facilisi. Nulla
|
|
|
181 |
rutrum, erat vitae lacinia dictum, pede purus imperdiet lacus, ut
|
|
|
182 |
semper velit ante id metus. Praesent massa dolor, porttitor sed,
|
|
|
183 |
pulvinar in, consequat ut, leo. Nullam nec est. Aenean id risus blandit
|
|
|
184 |
tortor pharetra congue. Suspendisse pulvinar.
|
|
|
185 |
</p>
|
|
|
186 |
These links will
|
|
|
187 |
<a href="#" onClick="dijit.byId('areaEditable').setDisabled(true)">disable</a> /
|
|
|
188 |
<a href="#" onClick="dijit.byId('areaEditable').setDisabled(false)">enable</a>
|
|
|
189 |
the InlineEditBox above.
|
|
|
190 |
<hr style="width:100%;">
|
|
|
191 |
|
|
|
192 |
<h2>FilteringSelect (no down arrow, and save/cancel buttons):</h2>
|
|
|
193 |
before
|
|
|
194 |
<span id="filteringSelect2" dojoType="dijit.InlineEditBox" editor="dijit.form.FilteringSelect"
|
|
|
195 |
editorParams="{searchAttr: 'name', keyAttr: 'abbreviation', store: stateStore, autocomplete: true, hasDownArrow: false}"
|
|
|
196 |
width="200px" autoSave="false">
|
|
|
197 |
Indiana
|
|
|
198 |
</span>
|
|
|
199 |
after
|
|
|
200 |
<hr style="width:100%;">
|
|
|
201 |
|
|
|
202 |
<h2>Programmatically created:</h2>
|
|
|
203 |
before block<div style="display:block;" id="programmatic">Click here to edit a block programmatically created inline edit region</div>after
|
|
|
204 |
<script type="text/javascript">
|
|
|
205 |
// See if we can make a widget in script
|
|
|
206 |
dojo.addOnLoad(function(){
|
|
|
207 |
var inlineWidget = new dijit.InlineEditBox({renderAsHtml: true}, 'programmatic');
|
|
|
208 |
});
|
|
|
209 |
</script>
|
|
|
210 |
<hr style="width:100%;">
|
|
|
211 |
</body>
|
|
|
212 |
</html>
|