root/trunk/templates/edit_form.tt

Revision 1229, 12.5 kB (checked in by nick, 3 months ago)

Make a start on JS to help you pick locales and categories, but not quite finished yet

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1[% USE CGI %]
2[% INCLUDE header.tt page_title = "Edit $node_name - $site_name" %]
3<div id="content">
4
5  <h1 class="edit_form_title">Edit &quot;[% node_name %]&quot;</h1>
6
7  [% IF conflict %]
8    <div class="warning_text">
9      Someone has committed changes to this page since you began editing.
10      You will need to manually merge your changes into the new version.
11    </div>
12  [% END %]
13
14  [% IF validate_failed %]
15    <div class="warning_text">
16      <p>
17        Your input was invalid:
18      </p>
19      <ul>
20      [% FOREACH error = validate_failed %]
21        <li>[% error %]</li>
22      [% END %]
23      </ul>
24      <p>
25        Please correct your input data and try again.
26      </p>
27  [% END %]
28
29  [% IF preview_html AND preview_above_edit_box %]
30    <div id="maincontent">
31      <h2>Preview</h2>
32      [% IF summary %]
33        <div id="summary">[% summary %]</div>
34      [% END %]
35      [% INCLUDE display_metadata.tt %]
36      [% preview_html %]
37    </div>
38    <br clear="all" />
39  [% END %]
40
41  <form id="edit_page_form" action="[% cgi_url %]" method="post"
42   enctype="application/x-www-form-urlencoded">
43
44    <div class="licence_and_moderation_notes">
45      <div class="licence_notes">
46        [% TRY %]
47          [% INCLUDE custom_licence.tt %]
48        [% CATCH %]
49        [% END %]
50      </div>
51      [% IF moderate %]
52        <div class="moderation_warning">
53          Please note that this page is moderated so your changes will not
54          appear immediately. Please be patient.
55        </div>
56      [% END %]
57    </div>
58
59    [% INCLUDE edit_form_actions.tt %]
60
61    <fieldset id="main_information">
62      <legend>Main information</legend>
63
64      <div class="edit_form_group" id="content_group">
65        <label for="content_textarea">
66          [% IF conflict %]
67            Current content:
68          [% ELSE %]
69            Content:
70          [% END %]
71        </label>
72        <div class="edit_box">
73          <textarea name="content" id="content_textarea" rows="21"
74           cols="70" wrap="virtual">[% content %]</textarea>
75        </div>
76        [% IF conflict %]
77          <div class="conflict_group">
78            <label>Your content:</label>
79            <div class="conflict_box">
80              [% CGI.escapeHTML(new_content) %]
81            </div>
82          </div>
83        [% END %]
84      </div>
85
86      [%# NOTE: The whitespace in the next two textareas is deliberate, to
87          avoid getting bogus tabs and blank lines in the textarea content.
88          Please do not reintroduce this bug.  Test on more than one
89          browser. #%]
90
91      <div class="edit_form_group" id="locales_group">
92        <label for="locales">
93          [% IF conflict %]
94            Current locales:
95          [% ELSE %]
96            Locales (one per line):
97            <span id="pick_locale"></span>
98          [% END %]
99        </label>
100        <div class="edit_box">
101          <textarea name="locales" id="locales" rows="5" cols="70">[% FOREACH locale = locales %][% locale.name %]
102[% END %]</textarea>
103        </div>
104        [% IF conflict %]
105          <div class="conflict_group">
106            <label>Your locales:</label>
107            <div class="conflict_box">
108              [% FOREACH locale = new_locales %]
109                [% CGI.escapeHTML(locale) %]<br/>
110              [% END %]
111            </div>
112          </div>
113        [% END %]
114      </div>
115
116      <div class="edit_form_group" id="categories_group">
117        <label for="categories">
118          [% IF conflict %]
119            Current categories:
120          [% ELSE %]
121            Categories (one per line):
122            <span id="pick_category"></span>
123          [% END %]
124        </label>
125        <div class="edit_box">
126          <textarea name="categories" id="categories" rows="5" cols="70">[% FOREACH category = categories %][% category.name %]
127[% END %]</textarea>
128        </div>
129        [% IF conflict %]
130          <div class="conflict_group">
131            <label>Your categories:</label>
132            <div class="conflict_box">
133              [% FOREACH category = new_categories %]
134                [% CGI.escapeHTML(category) %]<br/>
135              [% END %]
136            </div>
137          </div>
138        [% END %]
139      </div>
140
141          <script type="text/javascript">
142             function pick(metadata_type, textbox_id) {
143                    var textbox = document.getElementById(textbox_id);
144
145                        // For adding the new metadata to the textarea
146                        var add_md = function(picked) {
147                           var last = textbox.value.substring(textbox.value.length - 1);
148                           if(last == "\r" || last == "\n") {
149                              // Already has new line
150                           } else {
151                              textbox.value = textbox.value + "\r\n";
152                           }
153
154                           textbox.value = textbox.value + picked;
155                        };
156
157                        // Fetch the data
158                        $.getJSON("[% cgi_url %]?action=metadata;format=json;type=" + metadata_type, function(data) {
159//                              alert(data[metadata_type][0]);
160//                              add_md(data[metadata_type][1]);
161                        });
162                 }
163
164             function pick_locale() {
165                    pick("locale", "locales");
166                 }
167             function pick_category() {
168                    pick("category", "categories");
169                 }
170
171             $(document).ready(function() {
172                    $("#pick_locale").html("<a href='javascript:pick_locale()'>pick Locale</a>");
173                    $("#pick_category").html("<a href='javascript:pick_category()'>pick Category</a>");
174                 });
175          </script>
176
177      <div class="edit_form_group" id="summary_group">
178        [% IF conflict %]
179          <label for="summary_input">Current summary:</label>
180        [% ELSE %]
181          <label for="summary_input">One-line summary of this page:</label>
182        [% END %]
183        <div class="edit_box">
184          <input type="text" size="50" id="summary_input" name="summary"
185           value="[% summary %]" />
186        </div>
187        [% IF conflict %]
188          <div class="conflict_group">
189            <label>Your summary:</label>
190            <div class="conflict_box">
191              [% new_summary %]
192            </div>
193          </div>
194        [% END %]
195      </div>
196    </fieldset>
197
198    <fieldset id="additional_information">
199      <legend>Additional information</legend>
200
201      <div class="edit_form_group" id="phone_group">
202        [% IF conflict %]
203          <label for="phone">Current phone:</label>
204        [% ELSE %]
205          <label for="phone">Phone:</label>
206        [% END %]
207        <div class="edit_box">
208          <input type="text" size="50" id="phone" name="phone"
209           value="[% phone %]" />
210        </div>
211        [% IF conflict %]
212          <div class="conflict_group">
213            <label>Your phone:</label>
214            <div class="conflict_box">
215              [% CGI.escapeHTML(new_phone) %]
216            </div>
217          </div>
218        [% END %]
219      </div>
220
221      <div class="edit_form_group" id="fax_group">
222        [% IF conflict %]
223          <label for="fax">Current fax:</label>
224        [% ELSE %]
225          <label for="fax">Fax:</label>
226        [% END %]
227        <div class="edit_box">
228          <input type="text" size="50" id="fax" name="fax"
229            value="[% fax %]" />
230        </div>
231        [% IF conflict %]
232          <div class="conflict_group">
233            <label>Your fax:</label>
234            <div class="conflict_box">
235              [% CGI.escapeHTML(new_fax) %]
236            </div>
237          </div>
238        [% END %]
239      </div>
240
241      <div class="edit_form_group" id="website_group">
242        [% IF conflict %]
243          <label for="website">Current website:</label>
244        [% ELSE %]
245          <label for="website">Website:</label>
246        [% END %]
247        <div class="edit_box">
248          <input type="text" size="50" id="website" name="website"
249           value="[% website %]" />
250        </div>
251        [% IF conflict %]
252          <div class="conflict_group">
253            <label>Your website:</label>
254            <div class="conflict_box">
255              [% CGI.escapeHTML(new_website) %]
256            </div>
257          </div>
258        [% END %]
259      </div>
260
261      <div class="edit_form_group" id="hours_group">
262        <label for="hours">
263          [% IF conflict %]
264            Current opening hours:
265          [% ELSE %]
266            Opening hours:
267          [% END %]
268        </label>
269        <div class="edit_box">
270          <input type="text" size="50" id="hours" name="hours_text"
271           value="[% hours_text %]" />
272        </div>
273        [% IF conflict %]
274          <div class="conflict_group">
275            <label>Your opening hours:</label>
276            <div class="conflict_box">
277              [% CGI.escapeHTML(new_hours_text) %]
278            </div>
279          </div>
280        [% END %]
281      </div>
282
283      <div class="edit_form_group" id="address_group">
284        <label for="address">
285          [% IF conflict %]
286            Current address:
287          [% ELSE %]
288            Address:
289          [% END %]
290        </label>
291        <div class="edit_box">
292          <input type="text" size="50" id="address" name="address"
293           value="[% address %]" />
294        </div>
295        [% IF conflict %]
296          <div class="conflict_group">
297            <label>Your address:</label>
298            <div class="conflict_box">
299              [% CGI.escapeHTML(new_address) %]
300            </div>
301          </div>
302        [% END %]
303      </div>
304
305      <div class="edit_form_group" id="postcode_group">
306        <label for="postcode">
307          [% IF conflict %]
308            Current postcode:
309          [% ELSE %]
310            Postcode:
311          [% END %]
312        </label>
313        <div class="edit_box">
314          <input type="text" size="50" id="postcode" name="postcode"
315           value="[% postcode %]" />
316        </div>
317        [% IF conflict %]
318          <div class="conflict_group">
319            <label>Your postcode:</label>
320            <div class="conflict_box">
321              [% CGI.escapeHTML(new_postcode) %]
322            </div>
323          </div>
324        [% END %]
325      </div>
326
327      <div id="coord_fields_group">
328
329        <div class="edit_form_group" id="coord_field_1_group">
330          <label for="[% coord_field_1 %]">
331            [% IF conflict %]
332              Current [% coord_field_1_name %]:
333            [% ELSE %]
334              [% coord_field_1_name %]:
335            [% END %]
336          </label>
337          <div class="edit_box">
338            <input type="text" size="50" id="[% coord_field_1 %]"
339             name="[% coord_field_1 %]" value="[% coord_field_1_value %]" />
340          </div>
341          [% IF conflict %]
342            <div class="conflict_group">
343              <label>Your [% coord_field_1_name %]:</label>
344              <div class="conflict_box">
345                [% CGI.escapeHTML(new_coord_field_1_value) %]
346              </div>
347            </div>
348          [% END %]
349        </div>
350
351        <div class="edit_form_group" id="coord_field_2_group">
352          <label for="[% coord_field_2 %]">
353            [% IF conflict %]
354              Current [% coord_field_2_name %]:
355            [% ELSE %]
356              [% coord_field_2_name %]:
357            [% END %]
358          </label>
359          <div class="edit_box">
360            <input type="text" size="50" id="[% coord_field_2 %]"
361             name="[% coord_field_2 %]" value="[% coord_field_2_value %]" />
362          </div>
363          [% IF conflict %]
364            <div class="conflict_group">
365              <label>Your [% coord_field_2_name %]:</label>
366              <div class="conflict_box">
367                [% CGI.escapeHTML(new_coord_field_2_value) %]
368              </div>
369            </div>
370          [% END %]
371        </div>
372
373      </div>
374
375      <div class="edit_form_group" id="map_link_group">
376        <label for="map_link">
377          [% IF conflict %]
378            Current map link:
379          [% ELSE %]
380            Map link:
381          [% END %]
382        </label>
383        <div class="edit_box">
384          <input type="text" size="70" id="map_link" name="map_link"
385           value="[% map_link %]" />
386        </div>
387        [% IF conflict %]
388          <div class="conflict_group">
389            <label>Your map link:</label>
390            <div class="conflict_box">
391              [% CGI.escapeHTML( new_map_link ) %]
392            </div>
393          </div>
394        [% END %]
395      </div>
396
397    </fieldset>
398
399    [% IF config.enable_node_image %]
400      [% INCLUDE node_image_fields.tt %]
401    [% END %]
402
403    [% INCLUDE openguides_information_boxes.tt %]
404
405    [% INCLUDE edit_form_actions.tt %]
406
407    <input type="hidden" name="title" value="[% node_name %]" />
408    <input type="hidden" name="checksum" value="[% checksum %]" />
409  </form>
410
411  [% IF preview_html AND NOT preview_above_edit_box %]
412    <div id="maincontent">
413      <h2>Preview</h2>
414      [% IF summary %]
415        <div id="summary">[% summary %]</div>
416      [% END %]
417      [% INCLUDE display_metadata.tt %]
418      [% preview_html %]
419    </div>
420    <br clear="all" />
421  [% END %]
422
423[% INCLUDE footer.tt omit_footer_search_form = 1 %]
Note: See TracBrowser for help on using the browser.