Mercurial Hosting > nabble
comparison src/nabble/view/naml/macro_viewer.naml @ 0:7ecd1a4ef557
add content
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Thu, 21 Mar 2019 19:15:52 -0600 |
parents | |
children | 62faaba01dd2 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:7ecd1a4ef557 |
---|---|
1 <namespace name="naml_tools"/> | |
2 | |
3 <macro name="current_macro_source" dot_parameter="do" requires="naml_tools"> | |
4 <n.if.command_exists id="[n.current_command_id/]"> | |
5 <then> | |
6 <n.macro_source. | |
7 id="[n.current_command_id/]" | |
8 base="[n.current_base_classes/]" | |
9 breadcrumbs="[n.current_breadcrumbs/]" | |
10 > | |
11 <n.do/> | |
12 </n.macro_source.> | |
13 </then> | |
14 <else> | |
15 <n.invalid_command_html/> | |
16 </else> | |
17 </n.if.command_exists> | |
18 </macro> | |
19 | |
20 <macro name="macro_viewer_header" dot_parameter="text"> | |
21 <n.put_in_head.> | |
22 <script type="text/javascript"> | |
23 function openVideo() { | |
24 $('#demo-video').slideDown(); | |
25 }; | |
26 function closeVideo() { | |
27 $('#demo-video').slideUp(); | |
28 }; | |
29 </script> | |
30 </n.put_in_head.> | |
31 | |
32 <div style="clear:both;padding-top:1em"> | |
33 <div style="float:left;margin-top:1.1em"> | |
34 <n.macro_options_dropdown/> | |
35 </div> | |
36 <h1 style="margin:.5em 0 1em"><n.text/></h1> | |
37 </div> | |
38 | |
39 <div class="second-font" style="font-size:80%;float:right;margin-top:-4.3em;padding:.3em 0"> | |
40 <a href="http://naml.nabble.com/" target="_top">NAML documentation</a> | |
41 | |
42 <n.naml_video_link/> | |
43 </div> | |
44 </macro> | |
45 | |
46 <macro name="naml_video_link"> | |
47 <a href="#" onclick="openVideo()">Watch a video</a> | |
48 <div id="demo-video" style="display:none;text-align:center;position:fixed;z-index:1001;width:100%;top:3em"> | |
49 <div class="shaded-bg-color rounded drop-shadow" style="width:450px;height:400px;margin:0 auto;text-align:center"> | |
50 <div style="text-align:right;padding:.3em .9em"> | |
51 <a href="#" onclick="closeVideo()"><t>Close</t></a> | |
52 </div> | |
53 <iframe width="425" height="349" src="http://www.youtube.com/embed/06hd0keRN80" frameborder="0" allowfullscreen="true"></iframe> | |
54 </div> | |
55 </div> | |
56 </macro> | |
57 | |
58 <macro name="macro_viewer" requires="servlet"> | |
59 <n.naml_tools.> | |
60 <n.current_macro_source.> | |
61 <n.html> | |
62 <head> | |
63 <meta name="robots" content="noindex,nofollow"/> | |
64 <n.title.><n.name/></n.title.> | |
65 <n.macro_viewer_stylesheet/> | |
66 <n.redirect_if_overridden/> | |
67 <n.codemirror_shared_head/> | |
68 <n.macro_viewer_js/> | |
69 </head> | |
70 <body> | |
71 <n.macro_viewer_header.> | |
72 <n.name/> | |
73 </n.macro_viewer_header.> | |
74 | |
75 <n.important_notices/> | |
76 <n.source_panel/> | |
77 </body> | |
78 </n.html> | |
79 </n.current_macro_source.> | |
80 </n.naml_tools.> | |
81 </macro> | |
82 | |
83 <macro name="title" dot_parameter="text" requires="macro_source"> | |
84 <title><n.root_node.subject/> | NAML - <n.text/></title> | |
85 </macro> | |
86 | |
87 <macro name="breadcrumbs_content" requires="macro_source, naml_tools"> | |
88 <n.root_node.node_breadcrumbs /> | |
89 | NAML<sup class="important">alpha</sup> | |
90 | <n.naml_breadcrumbs/> | |
91 </macro> | |
92 | |
93 <macro name="breadcrumbs_content" requires="naml_tools"> | |
94 <n.root_node.node_breadcrumbs /> | |
95 | NAML<sup class="important">alpha</sup> | |
96 </macro> | |
97 | |
98 <macro name="naml_breadcrumbs"> | |
99 <n.navigation_breadcrumbs.loop.parts.> | |
100 <n.if.has_more_elements> | |
101 <then> | |
102 <a href="[n.part_path/]"><n.name/></a> | |
103 <span class="weak-color breadcrumbs-arrow" style="padding:0 .25em"> | |
104 › | |
105 </span> | |
106 </then> | |
107 <else.name/> | |
108 </n.if.has_more_elements> | |
109 </n.navigation_breadcrumbs.loop.parts.> | |
110 </macro> | |
111 | |
112 <macro name="codemirror_shared_head"> | |
113 <style type="text/css"> | |
114 .CodeMirror-line-numbers { | |
115 font-family: verdana, arial, sans-serif; | |
116 font-size: 11pt; | |
117 width: 2.2em; | |
118 text-align: right; | |
119 padding-right: .3em; | |
120 line-height: normal; | |
121 border-right-width:2px; | |
122 border-right-style:solid; | |
123 } | |
124 #resizebar { | |
125 height:8px; | |
126 background:url('/images/grip.png') #d8d8d8 repeat; | |
127 border:1px solid #aaa; | |
128 cursor:n-resize; | |
129 } | |
130 </style> | |
131 <script src="/util/codemirror/js/codemirror.js"></script> | |
132 <script src="/util/codemirror/js/highlight.js"></script> | |
133 <script src="/util/codemirror/js/stringstream.js"></script> | |
134 <script src="/util/codemirror/js/tokenize.js"></script> | |
135 <script src="/util/codemirror/js/parsexml.js"></script> | |
136 <script type="text/javascript"> | |
137 <![CDATA[ | |
138 function newEditor(height) { | |
139 var e = CodeMirror.fromTextArea('txt_basic', { | |
140 parserfile: "parsexml.js", | |
141 stylesheet: "/util/codemirror/css/xmlcolors.css", | |
142 path: "/util/codemirror/js/", | |
143 lineNumbers: true, | |
144 height: height, | |
145 indentUnit: 4, | |
146 }); | |
147 var $wrapping = $('#txt_basic').next(); | |
148 $wrapping.attr('id', 'wrapping_basic'); | |
149 $wrapping.css('margin-top', '.4em'); | |
150 $wrapping.addClass('medium-border-color border1'); | |
151 addResizeBar($wrapping); | |
152 $('div.CodeMirror-line-numbers', $wrapping).addClass('shaded-bg-color medium-border-color'); | |
153 return e; | |
154 }; | |
155 | |
156 function addResizeBar($wrapping) { | |
157 $wrapping.after('<div id="resizebar"></div>'); | |
158 | |
159 var dragging = false; | |
160 function startDrag(e) { | |
161 if ($(e.target).attr('id') == 'resizebar') | |
162 dragging = true; | |
163 if (dragging && typeof e.preventDefault != 'undefined') | |
164 e.preventDefault(); | |
165 }; | |
166 function endDrag(e) { | |
167 dragging = false; | |
168 }; | |
169 function drag(e, x, y) { | |
170 e.stopPropagation(); | |
171 if (dragging) { | |
172 var h = y - $wrapping.offset().top - 5; | |
173 $wrapping.height(h < 100? 100 : h); | |
174 } | |
175 }; | |
176 function onSelectStart() { | |
177 if (dragging) return false; | |
178 }; | |
179 | |
180 function isCorrectFrame(f) { | |
181 try { | |
182 frame.document.location.href; | |
183 return true; | |
184 } catch(err) { | |
185 return false; | |
186 } | |
187 } | |
188 var index = 0; | |
189 var frame = window.frames[index++]; | |
190 while (!isCorrectFrame(frame)) { | |
191 frame = window.frames[index++]; | |
192 } | |
193 $(frame.document) | |
194 .mousemove(function(e) { | |
195 var x = e.pageX + $wrapping.offset().left; | |
196 var y = e.pageY + $wrapping.offset().top; | |
197 drag(e, x, y); | |
198 }) | |
199 .mouseup(function(e) { endDrag(e); }) | |
200 .select(onSelectStart); | |
201 | |
202 $(document) | |
203 .mousemove(function(e) { drag(e, e.pageX, e.pageY); }) | |
204 .mousedown(function(e) { startDrag(e); }) | |
205 .mouseup(function(e) { endDrag(e); }) | |
206 .select(onSelectStart); | |
207 }; | |
208 var basicEditor; | |
209 function inlineEditor(height, line, col) { | |
210 if (!basicEditor) | |
211 basicEditor = newEditor(height); | |
212 function showCaret() { | |
213 var $lines = $('#wrapping_basic div.CodeMirror-line-numbers').children(); | |
214 if (basicEditor.editor && $lines.size() > 5) { | |
215 if (line) { | |
216 if (col) { | |
217 var ln = basicEditor.nthLine(line); | |
218 basicEditor.selectLines(ln, col); | |
219 } else | |
220 basicEditor.jumpToLine(line); | |
221 } else | |
222 basicEditor.jumpToLine(1); | |
223 } else | |
224 setTimeout(showCaret, 200); | |
225 }; | |
226 showCaret(); | |
227 }; | |
228 function getLineNumber(s, token) { | |
229 var line = 1; | |
230 var pos = s.indexOf(token); | |
231 for (var i=0; i < pos; i++) { | |
232 if (s.charAt(i) == '\n') | |
233 line++; | |
234 } | |
235 return line; | |
236 }; | |
237 function formatError(msg) { | |
238 var h = msg.replace(/</g, "<"); | |
239 h = h.replace(/>/g, ">"); | |
240 h = h.replace(/\n/g, "<br/>"); | |
241 h = h.replace(/(\t)|([ ]{6})/g, "<span style='padding:0 2em'> </span>"); | |
242 h = '<img src="/images/icon_alert_sm.png" class="image16"/> ' + h; | |
243 return h; | |
244 }; | |
245 ]]> | |
246 </script> | |
247 </macro> | |
248 | |
249 <macro name="macro_viewer_js"> | |
250 <script type="text/javascript"> | |
251 var isCustomTweak = <n.is_custom_tweak/>; | |
252 var pBase = '&base=<n.hide_null.current_base_classes/>'; | |
253 var pBreadcrumbs = '<n.hide_null.current_breadcrumbs/>'; | |
254 pBreadcrumbs = pBreadcrumbs == ''? '' : '&breadcrumbs=' + pBreadcrumbs; | |
255 var isSiteAdmin = <n.visitor.is_site_admin/>; | |
256 | |
257 var tweakFileContents = "<n.javascript_string_encode.hide_null.tweak_file_contents/>"; | |
258 var macroOpeningTag = "<n.javascript_string_encode.hide_null.macro_opening_tag/>"; | |
259 $(document).ready(function() { | |
260 function lineSelector(e) { | |
261 return 'div.line'+e.id.substring(8); | |
262 }; | |
263 var $lineDivs = $('table.code div.line-contents'); | |
264 $lineDivs.hover( | |
265 function() { $(lineSelector(this), $(this).parent().prev()).css('font-weight','bold').addClass('dark-bg-color'); }, | |
266 function() { $(lineSelector(this), $(this).parent().prev()).css('font-weight','normal').removeClass('dark-bg-color'); } | |
267 ); | |
268 function fixHeights() { | |
269 $lineDivs.each(function() { | |
270 var h = $(this).outerHeight(); | |
271 var $table = $(this).parents('table'); | |
272 $(lineSelector(this), $table).height(h); | |
273 }); | |
274 } | |
275 $(window).resize(fixHeights); | |
276 fixHeights(); | |
277 | |
278 var $textarea = $('#txt_basic'); | |
279 var textareaValue = $textarea.val().replace(/\s*/g, ''); | |
280 var originalFileContents = tweakFileContents.replace(/\s*/g, ''); | |
281 if (textareaValue != originalFileContents) { | |
282 showEditor(); | |
283 } | |
284 window.onbeforeunload = function() { | |
285 $textarea.val(basicEditor.getCode()); | |
286 }; | |
287 }); | |
288 | |
289 function openNamlLogin() { | |
290 $('#naml-login').slideDown(); | |
291 }; | |
292 | |
293 function showEditor() { | |
294 if (!isSiteAdmin) { | |
295 openNamlLogin(); | |
296 return; | |
297 } | |
298 $('#saveButton,#cancelButton,#wrapping_basic,#resizebar').show(); | |
299 $('#editButton,#removeButton').hide(); | |
300 if (isCustomTweak) | |
301 $('#current-source').hide(); | |
302 else | |
303 $('#overrides-arrow').show(); | |
304 var line = getLineNumber(tweakFileContents, macroOpeningTag); | |
305 inlineEditor('20em', line); | |
306 }; | |
307 function saveChanges() { | |
308 notice('Saving... Please wait'); | |
309 var call = '/template/NamlServlet.jtp?macro=save_tweak&id=<n.id/>' + pBase + pBreadcrumbs; | |
310 var code = basicEditor.getCode(); | |
311 if (code.match(/^\s*$/) != null) { | |
312 notice('Error Found', 3000, 1500); | |
313 var msg = "Error: invalid macro code."; | |
314 $('#error-box').html(msg).show(); | |
315 return; | |
316 } | |
317 var params = { contents: code }; | |
318 $.post(call, params, | |
319 function(data) { | |
320 var result = eval('(' + data + ')'); | |
321 if (result.error != null) { | |
322 notice('Error Found', 3000, 1500); | |
323 var $errorBox = $('#error-box'); | |
324 $errorBox.html(formatError(result.error)).show(); | |
325 if ($errorBox.height() > 150) { | |
326 $errorBox.css('overflow-y','scroll').height(150); | |
327 } | |
328 } else { | |
329 pBase = result.base == null? pBase : '&base=' + result.base; | |
330 pBreadcrumbs = result.breadcrumbs == null? pBreadcrumbs : '&breadcrumbs=' + result.breadcrumbs; | |
331 var url = '/template/NamlServlet.jtp?macro=macro_viewer&id=' + result.macroId + pBase + pBreadcrumbs; | |
332 window.location = url; | |
333 } | |
334 } | |
335 ); | |
336 }; | |
337 function cancelChanges() { | |
338 $('#saveButton,#cancelButton,#wrapping_basic,#resizebar,#error-box').hide(); | |
339 $('#editButton,#removeButton').show(); | |
340 if (isCustomTweak) | |
341 $('#current-source').show(); | |
342 else | |
343 $('#overrides-arrow').hide(); | |
344 basicEditor.setCode(tweakFileContents); | |
345 }; | |
346 function removeOverride() { | |
347 if (!isSiteAdmin) { | |
348 openNamlLogin(); | |
349 return; | |
350 } | |
351 <n.if.is_override> | |
352 <then> | |
353 var confirmQuestion = "Do you really want to remove this override?"; | |
354 var nextUrl = "<n.use_text_encoder.path_to_overridden_macro/>"; | |
355 </then> | |
356 <else> | |
357 var confirmQuestion = "Do you really want to remove this macro?"; | |
358 var nextUrl = "<n.use_text_encoder.macro_deleted_path/>"; | |
359 </else> | |
360 </n.if.is_override> | |
361 if( !confirm(confirmQuestion) ) | |
362 return; | |
363 var call = '/template/NamlServlet.jtp?macro=revert_tweak&id=<n.id/>' + pBase + pBreadcrumbs; | |
364 $.get(call, function(data) { | |
365 if (Nabble.trim(data) == 'ok') | |
366 window.location = nextUrl; | |
367 }); | |
368 }; | |
369 </script> | |
370 </macro> | |
371 | |
372 <macro name="macro_viewer_stylesheet"> | |
373 <style type="text/css"> | |
374 table.code { | |
375 width: 100%; | |
376 font-family: verdana, arial, sans-serif; | |
377 font-size: 11pt; | |
378 border-collapse:collapse; | |
379 margin:.35em 0; | |
380 } | |
381 table.code tr { | |
382 vertical-align:top; | |
383 } | |
384 table.code td { | |
385 padding: 0; | |
386 } | |
387 table.code td.line-number { | |
388 width: 2em; | |
389 text-align:right; | |
390 padding-right:.3em; | |
391 border-right-width:2px; | |
392 border-right-style:solid; | |
393 } | |
394 table.code td.line-contents { | |
395 padding-left: .5em; | |
396 } | |
397 table.code a { | |
398 text-decoration:none; | |
399 } | |
400 table.code a:hover { | |
401 text-decoration:underline; | |
402 } | |
403 </style> | |
404 </macro> | |
405 | |
406 <macro name="source_panel" requires="macro_source"> | |
407 <n.editor_left_controls/> | |
408 | |
409 <n.documentation/> | |
410 <div style="clear:both"> | |
411 <n.source_contents/> | |
412 <n.overridden_macro_source/> | |
413 </div> | |
414 </macro> | |
415 | |
416 <macro name="source_contents"> | |
417 <n.if.not.is_binary> | |
418 <then> | |
419 <div id="error-box" class="error-message" style="padding:.5em;display:none"></div> | |
420 <textarea id="txt_basic" style="display:none"><n.encode.tweak_file_contents/></textarea> | |
421 <div id="current-source"> | |
422 <div id="overrides-arrow" style="display:none"> | |
423 <n.overrides_arrow/> | |
424 </div> | |
425 <n.show_notice_if_not_compiled/> | |
426 <table class="code"> | |
427 <n.source_row/> | |
428 <tr> | |
429 <n.line_numbers_column/> | |
430 <n.line_contents_column/> | |
431 </tr> | |
432 </table> | |
433 </div> | |
434 </then> | |
435 </n.if.not.is_binary> | |
436 </macro> | |
437 | |
438 <macro name="show_notice_if_not_compiled"> | |
439 <n.if.not.is_compiled> | |
440 <then> | |
441 <div class="info-message rounded" style="padding:.4em; margin:.2em 0"> | |
442 The source code below doesn't have navigation links because no usage has been compiled yet. | |
443 Navigation links depend on how and where the macro is used, so first you may | |
444 <a id="find-usages" href="#">try finding all usages of "<n.name/>"</a>. | |
445 <n.current_find_usages_path element_name="find-usages"/> | |
446 </div> | |
447 </then> | |
448 </n.if.not.is_compiled> | |
449 </macro> | |
450 | |
451 <macro name="line_numbers_column"> | |
452 <td class="line-number weak-color medium-border-color shaded-bg-color"> | |
453 <n.rows.loop.> | |
454 <div class="line[n.file_line_number/]"><n.file_line_number/></div> | |
455 </n.rows.loop.> | |
456 </td> | |
457 </macro> | |
458 | |
459 <macro name="line_contents_column"> | |
460 <td class="line-contents"> | |
461 <n.rows.loop.> | |
462 <div id="contents[n.file_line_number/]" class="line-contents"> | |
463 <n.current_row_contents/> | |
464 </div> | |
465 </n.rows.loop.> | |
466 </td> | |
467 </macro> | |
468 | |
469 <macro name="current_row_contents" requires="macro_row_list"> | |
470 <n.current_row.> | |
471 <n.if.is_blank> | |
472 <then> </then> | |
473 <else> | |
474 <n.loop.parts.> | |
475 <n.if.not.is_null.id> | |
476 <then> | |
477 <n.remove_spaces_between_tags.> | |
478 <a href="[n.part_path/]"><n.tag/></a> | |
479 <n.part_tooltip/> | |
480 </n.remove_spaces_between_tags.> | |
481 </then> | |
482 <else.name/> | |
483 </n.if.not.is_null.id> | |
484 </n.loop.parts.> | |
485 </else> | |
486 </n.if.is_blank> | |
487 </n.current_row.> | |
488 </macro> | |
489 | |
490 <macro name="part_tooltip" requires="command_info"> | |
491 <n.tooltip.> | |
492 <n.if.is_binary> | |
493 <then> | |
494 <div class="bold">Binary</div> | |
495 <n.tooltip_small_row.><b>Namespace:</b> <n.namespace_class/></n.tooltip_small_row.> | |
496 <n.tooltip_parameters/> | |
497 </then> | |
498 <else> | |
499 <div class="bold">Macro</div> | |
500 <n.if.not.is_empty.required_namespaces> | |
501 <then> | |
502 <n.tooltip_small_row.><b>Requires:</b> <n.required_namespaces/></n.tooltip_small_row.> | |
503 </then> | |
504 </n.if.not.is_empty.required_namespaces> | |
505 <n.tooltip_parameters/> | |
506 </else> | |
507 </n.if.is_binary> | |
508 </n.tooltip.> | |
509 </macro> | |
510 | |
511 <macro name="tooltip_parameters"> | |
512 <n.if.has_parameters> | |
513 <then> | |
514 <n.tooltip_small_row.> | |
515 <b>Parameters:</b> | |
516 <n.remove_spaces.parameter_names.loop.> | |
517 <n.current_string/> | |
518 <n.if.has_more_strings> | |
519 <then>, </then> | |
520 </n.if.has_more_strings> | |
521 </n.remove_spaces.parameter_names.loop.> | |
522 </n.tooltip_small_row.> | |
523 </then> | |
524 </n.if.has_parameters> | |
525 </macro> | |
526 | |
527 <macro name="important_notices"> | |
528 <n.if.has_tweak_exception> | |
529 <then> | |
530 <div class="weak-color info-message rounded" style="margin:.3em 0;padding:.3em .2em"> | |
531 <table style="width:100%;table-layout:fixed"> | |
532 <tr style="vertical-align:top"> | |
533 <td style="width:32px"><img src="/images/icon_alert.png" style="width:32px;height:32px"/></td> | |
534 <td> | |
535 <b>Error Found</b><br/> | |
536 An error was found in the NAML code of this application – | |
537 <span class="view-exception-details"> | |
538 <a href="#" onclick="showExceptionDetails(true)">View Details</a> | |
539 </span> | |
540 <span class="hide-exception-details invisible"> | |
541 <a href="#" onclick="showExceptionDetails(false)">Hide Details</a> | |
542 </span> | |
543 | <n.advanced_editor_link text="[t]Go to NAML Editor[/t]"/> | |
544 | |
545 <n.put_in_head.> | |
546 <style type="text/css"> | |
547 div.stacktrace { | |
548 width:100%; | |
549 overflow:auto; | |
550 white-space:nowrap; | |
551 display:none; | |
552 margin-top:.5em; | |
553 font-size:80%; | |
554 } | |
555 </style> | |
556 <script type="text/javascript"> | |
557 function showExceptionDetails(show) { | |
558 if (show) { | |
559 $('div.stacktrace').slideDown(function() { $(this).show() }); | |
560 $('span.view-exception-details').hide(); | |
561 $('span.hide-exception-details').show(); | |
562 } else { | |
563 $('div.stacktrace').hide(); | |
564 $('span.view-exception-details').show(); | |
565 $('span.hide-exception-details').hide(); | |
566 } | |
567 }; | |
568 </script> | |
569 </n.put_in_head.> | |
570 <div class="stacktrace"> | |
571 <n.regex_replace_all. pattern="\t+" replacement=" "> | |
572 <n.regex_replace_all. pattern="\n+" replacement="[br/]"> | |
573 <n.use_html_encoder.encode.tweak_exception_message/> | |
574 </n.regex_replace_all.> | |
575 </n.regex_replace_all.> | |
576 </div> | |
577 </td> | |
578 </tr> | |
579 </table> | |
580 </div> | |
581 </then> | |
582 </n.if.has_tweak_exception> | |
583 </macro> | |
584 | |
585 <macro name="path_to_overridden_macro"> | |
586 <n.macro_viewer_path id="[n.macro_overridden_id/]" base="[n.current_base_classes/]" breadcrumbs="[n.current_breadcrumbs/]"/> | |
587 </macro> | |
588 | |
589 <macro name="path_to_macro_which_overrides"> | |
590 <n.macro_viewer_path id="[n.macro_which_overrides_id/]" base="[n.current_base_classes/]" breadcrumbs="[n.current_breadcrumbs/]"/> | |
591 </macro> | |
592 | |
593 <macro name="save_button" requires="macro_source"> | |
594 <button id="saveButton" class="toolbar" style="font-weight:bold;display:none" onclick="saveChanges()"> | |
595 Save Changes | |
596 </button> | |
597 </macro> | |
598 | |
599 <macro name="cancel_button" requires="macro_source"> | |
600 <button id="cancelButton" class="toolbar" style="font-weight:bold;display:none" onclick="cancelChanges()"> | |
601 Cancel | |
602 </button> | |
603 </macro> | |
604 | |
605 <macro name="edit_button" requires="macro_source"> | |
606 <button id="editButton" class="toolbar" style="font-weight:bold" onclick="showEditor()"> | |
607 <img src="/images/tool.png" style="width:16px;height:17px;vertical-align:-25%"/> | |
608 <n.if.is_custom_tweak> | |
609 <then> | |
610 <n.if.is_override> | |
611 <then>Edit this override</then> | |
612 <else>Edit this macro</else> | |
613 </n.if.is_override> | |
614 </then> | |
615 <else>Override this macro</else> | |
616 </n.if.is_custom_tweak> | |
617 </button> | |
618 </macro> | |
619 | |
620 <macro name="remove_button" requires="macro_source"> | |
621 <n.if.is_custom_tweak> | |
622 <then> | |
623 <button id="removeButton" class="toolbar" style="font-weight:bold" onclick="removeOverride()"> | |
624 <img src="/images/remove_sm.png" style="width:15px;height:15px;vertical-align:-25%"/> | |
625 <n.if.is_override> | |
626 <then>Remove override</then> | |
627 <else>Remove macro</else> | |
628 </n.if.is_override> | |
629 </button> | |
630 </then> | |
631 </n.if.is_custom_tweak> | |
632 </macro> | |
633 | |
634 <macro name="editor_left_controls"> | |
635 <div style="margin:.5em 0"> | |
636 <n.if.not.is_binary> | |
637 <then> | |
638 <n.save_button/> | |
639 <n.cancel_button/> | |
640 <n.edit_button/> | |
641 <n.remove_button/> | |
642 | |
643 <n.usages_link/> | |
644 </then> | |
645 </n.if.not.is_binary> | |
646 </div> | |
647 | |
648 <n.if.not.visitor.is_site_admin> | |
649 <then> | |
650 <div id="naml-login" class="border1 medium-border-color" style="padding:1em; display:none"> | |
651 <div class="bold">You must login as an administrator of <n.root_node.subject/>.</div> | |
652 <div class="weak-color" style="margin-bottom:1em"> | |
653 If you are not the administrator, | |
654 you can <n.nabble_homepage_link.>create your own Nabble app</n.nabble_homepage_link.> and customize its NAML code! | |
655 </div> | |
656 | |
657 <n.nextUrl_field.set_value value="[n.use_text_encoder.current_url/]"/> | |
658 <n.login_form/> | |
659 </div> | |
660 </then> | |
661 </n.if.not.visitor.is_site_admin> | |
662 </macro> | |
663 | |
664 <macro name="usages_link" requires="macro_source"> | |
665 <a id="usages-link" href="#">Usages of this macro</a> | |
666 <n.current_find_usages_path element_name="usages-link"/> | |
667 </macro> | |
668 | |
669 <macro name="macro_options_dropdown"> | |
670 <n.dropdown. | |
671 id="macrodropdown" | |
672 element="[n.options_button/]" | |
673 loadOnClick="/template/NamlServlet.jtp?macro=macro_dropdown_later" | |
674 > | |
675 <n.menu_custom_macros/> | |
676 <n.menu_configuration_macros/> | |
677 <n.menu_new_macro/> | |
678 <n.menu_macro_search/> | |
679 <n.menu_view_logs/> | |
680 <n.menu_separator/> | |
681 <n.menu_open_advanced_editor/> | |
682 </n.dropdown.> | |
683 | |
684 <n.custom_macros_contents/> | |
685 <n.configuration_macros_contents/> | |
686 </macro> | |
687 | |
688 <macro name="options_button"> | |
689 <button class="toolbar" style="font-weight:bold" title="[t]Click for more options[/t]"> | |
690 <img src="/images/gear.png" class="image16"/> | |
691 <img src="/images/more.png" width="10" height="10"/> | |
692 </button> | |
693 </macro> | |
694 | |
695 <macro name="macro_dropdown_later" requires="servlet"> | |
696 <n.javascript_response/> | |
697 <n.menu_new_macro/> | |
698 <n.menu_open_advanced_editor/> | |
699 </macro> | |
700 | |
701 <macro name="menu_custom_macros"> | |
702 dropdown.addCustomSubmenu('Customized macros', 'custom-macros-box'); | |
703 </macro> | |
704 | |
705 <macro name="menu_configuration_macros"> | |
706 <n.if.has_configuration_macros> | |
707 <then>dropdown.addCustomSubmenu('Macros overridden by configurations', 'configuration-macros-box');</then> | |
708 </n.if.has_configuration_macros> | |
709 </macro> | |
710 | |
711 <macro name="custom_macros_contents"> | |
712 <n.custom_macros.list_macros_available id="custom-macros-box"/> | |
713 </macro> | |
714 | |
715 <macro name="configuration_macros_contents"> | |
716 <n.if.has_configuration_macros> | |
717 <then.configuration_macros.list_macros_available id="configuration-macros-box"/> | |
718 </n.if.has_configuration_macros> | |
719 </macro> | |
720 | |
721 <macro name="list_macros_available" parameters="id" requires="command_list"> | |
722 <n.put_in_head.> | |
723 <style type="text/css"> | |
724 ul.dropdown-submenu { | |
725 max-height:20em; | |
726 overflow-y:auto; | |
727 } | |
728 ul.dropdown-submenu li { | |
729 padding-right:1em; | |
730 } | |
731 </style> | |
732 </n.put_in_head.> | |
733 <ul id="[n.id/]" class="dropdown-submenu light-bg-color medium-border-color drop-shadow"> | |
734 <n.if.has_more_elements> | |
735 <then> | |
736 <n.loop.current_command.> | |
737 <li class="nowrap"> | |
738 <a href="[n.command_path/]"><n.name/></a> | |
739 <n.if.not.is_empty.required_namespaces> | |
740 <then> | |
741 <n.tooltip. delay="50" position="right">Requires <n.required_namespaces/></n.tooltip.> | |
742 </then> | |
743 </n.if.not.is_empty.required_namespaces> | |
744 </li> | |
745 </n.loop.current_command.> | |
746 </then> | |
747 <else> | |
748 <li class="weak-color" style="padding:.4em .8em">None</li> | |
749 </else> | |
750 </n.if.has_more_elements> | |
751 </ul> | |
752 </macro> | |
753 | |
754 <macro name="menu_macro_search"> | |
755 dropdown.add('searchMacros', '<n.javascript_string_encode.macro_search_link/>'); | |
756 </macro> | |
757 | |
758 <macro name="macro_search_link"> | |
759 <a href="[n.macro_search_path/]">Search macros</a> | |
760 </macro> | |
761 | |
762 <macro name="macro_search_path"> | |
763 <n.encode_url.> | |
764 /template/NamlServlet.jtp?macro=macro_search_page | |
765 </n.encode_url.> | |
766 </macro> | |
767 | |
768 <macro name="menu_view_logs"> | |
769 dropdown.add('viewLogs', '<n.javascript_string_encode.root_node.view_logs_link/>'); | |
770 </macro> | |
771 | |
772 <macro name="menu_new_macro"> | |
773 <n.if.is_in_command name="dropdown"> | |
774 <then> | |
775 dropdown.add('newMacro', '<n.javascript_string_encode.new_macro_link/>', 'display:none'); | |
776 </then> | |
777 <else> | |
778 <n.if.visitor.is_site_admin> | |
779 <then> | |
780 NabbleDropdown.show('newMacro'); | |
781 </then> | |
782 </n.if.visitor.is_site_admin> | |
783 </else> | |
784 </n.if.is_in_command> | |
785 </macro> | |
786 | |
787 <macro name="menu_open_advanced_editor"> | |
788 <n.if.is_in_command name="dropdown"> | |
789 <then> | |
790 dropdown.add('openAdvEditor', '<n.javascript_string_encode.advanced_editor_link/>', 'display:none'); | |
791 </then> | |
792 <else> | |
793 <n.if.visitor.is_site_admin> | |
794 <then> | |
795 NabbleDropdown.show('openAdvEditor'); | |
796 </then> | |
797 </n.if.visitor.is_site_admin> | |
798 </else> | |
799 </n.if.is_in_command> | |
800 </macro> | |
801 | |
802 <macro name="advanced_editor_link" dot_parameter="text" parameters="title, class"> | |
803 <a href="[n.current_advanced_editor_path/]" class="[n.class/]" rel="nofollow" title="[n.title/]" target="_top"> | |
804 <n.default. to="[t]Go to Advanced Editor[/t]"><n.text/></n.default.> | |
805 </a> | |
806 </macro> | |
807 | |
808 <macro name="current_advanced_editor_path"> | |
809 <n.advanced_editor_path prev_url="[n.current_url/]"/> | |
810 </macro> | |
811 | |
812 <macro name="new_macro_link"> | |
813 <a href="[n.new_macro_path/]">New macro</a> | |
814 </macro> | |
815 | |
816 <macro name="macro_viewer_path" parameters="id,base,breadcrumbs"> | |
817 <n.encode_url.remove_spaces.> | |
818 /template/NamlServlet.jtp?macro=macro_viewer | |
819 &id=<n.encode_text.id/> | |
820 <n.add_to_path name="base" value="[n.base/]" /> | |
821 <n.add_to_path name="breadcrumbs" value="[n.breadcrumbs/]" /> | |
822 </n.encode_url.remove_spaces.> | |
823 </macro> | |
824 | |
825 <macro name="part_path" requires="command_info"> | |
826 <n.macro_viewer_path> | |
827 <id><n.id/></id> | |
828 <base><n.base/></base> | |
829 <breadcrumbs><n.naml_breadcrumbs/></breadcrumbs> | |
830 </n.macro_viewer_path> | |
831 </macro> | |
832 | |
833 <macro name="macro_viewer_page_link"> | |
834 <a href="[n.macro_viewer_page_path/]" rel="nofollow">Edit this page</a> | |
835 </macro> | |
836 | |
837 <macro name="macro_viewer_page_path"> | |
838 <n.macro_viewer_path> | |
839 <id><n.page_template_command_id/></id> | |
840 <base><n.page_base_classes/></base> | |
841 </n.macro_viewer_path> | |
842 </macro> | |
843 | |
844 <macro name="find_usages_path" parameters="id,base,breadcrumbs"> | |
845 <n.encode_url.remove_spaces.> | |
846 /template/NamlServlet.jtp?macro=find_usages_page | |
847 &id=<n.encode_text.id/> | |
848 <n.add_to_path name="base" value="[n.base/]" /> | |
849 <n.add_to_path name="breadcrumbs" value="[n.breadcrumbs/]" /> | |
850 </n.encode_url.remove_spaces.> | |
851 </macro> | |
852 | |
853 <macro name="current_find_usages_path" parameters="element_name"> | |
854 <script type="text/javascript"> | |
855 <n.compress.> | |
856 var _path = '/template/NamlServlet.jtp?'; | |
857 var _p1 = 'macro=find_usages_page'; | |
858 var _p2 = '&id=<n.current_command_id/>'; | |
859 | |
860 <n.if.not.is_null.current_base_classes> | |
861 <then>var _p3 = '&base=<n.current_base_classes/>';</then> | |
862 <else> var _p3 = '';</else> | |
863 </n.if.not.is_null.current_base_classes> | |
864 | |
865 <n.if.not.is_null.current_breadcrumbs> | |
866 <then>var _p4 = '&breadcrumbs=<n.current_breadcrumbs/>';</then> | |
867 <else> var _p4 = '';</else> | |
868 </n.if.not.is_null.current_breadcrumbs> | |
869 | |
870 var _link = document.getElementById('<n.element_name/>'); | |
871 $(document).ready(function() { | |
872 $(_link).click(function() { | |
873 notice('Finding Usages... Please wait'); | |
874 window.location = _path+_p1+_p2+_p3+_p4+'&js='+Math.random(); | |
875 }); | |
876 }); | |
877 </n.compress.> | |
878 </script> | |
879 </macro> | |
880 | |
881 <macro name="find_usages_page" requires="servlet"> | |
882 <n.if.not.is_null.get_parameter name="js"> | |
883 <then> | |
884 <n.if.command_exists id="[n.current_command_id/]"> | |
885 <then> | |
886 <n.macro_source. | |
887 id="[n.current_command_id/]" | |
888 base="[n.current_base_classes/]" | |
889 breadcrumbs="[n.current_breadcrumbs/]" | |
890 > | |
891 <n.find_usages_html/> | |
892 </n.macro_source.> | |
893 </then> | |
894 <else> | |
895 <n.invalid_command_html/> | |
896 </else> | |
897 </n.if.command_exists> | |
898 </then> | |
899 </n.if.not.is_null.get_parameter> | |
900 </macro> | |
901 | |
902 <macro name="find_usages_html" requires="macro_source"> | |
903 <n.compile_if_needed/> | |
904 <n.naml_tools.> | |
905 <n.html> | |
906 <head> | |
907 <meta name="robots" content="noindex,nofollow"/> | |
908 <n.title.>Usages of <n.name/></n.title.> | |
909 <style type="text/css"> | |
910 div.usage-path { padding: .5em; } | |
911 </style> | |
912 </head> | |
913 <body> | |
914 <n.macro_viewer_header.> | |
915 Usages of <n.name/> | |
916 </n.macro_viewer_header.> | |
917 | |
918 <n.macro_usages.> | |
919 <n.if.not.has_more_elements> | |
920 <then> | |
921 <p><b>No usages found.</b> Some possible reasons are:</p> | |
922 <ul> | |
923 <li>This macro is called directly from the URL or from the java code;</li> | |
924 <li>This macro is not used at all;</li> | |
925 </ul> | |
926 <p>« <a href="javascript:void history.back()">Go Back</a></p> | |
927 </then> | |
928 </n.if.not.has_more_elements> | |
929 | |
930 <n.loop.> | |
931 <div class="[n.alternate var='usages' first_value='usage-path' second_value='usage-path light-bg-color'/]"> | |
932 <n.remove_spaces_between_tags.> | |
933 <n.current_usage.loop.> | |
934 <a href="[n.current_command.command_path/]"><n.current_command.name/></a> | |
935 <n.if.has_more_elements> | |
936 <then><span style="padding:0 .5em">›</span></then> | |
937 </n.if.has_more_elements> | |
938 </n.current_usage.loop.> | |
939 </n.remove_spaces_between_tags.> | |
940 </div> | |
941 </n.loop.> | |
942 </n.macro_usages.> | |
943 </body> | |
944 </n.html> | |
945 </n.naml_tools.> | |
946 </macro> | |
947 | |
948 <macro name="redirect_if_overridden" requires="macro_source"> | |
949 <n.if.has_macro_which_overrides> | |
950 <then> | |
951 <script type="text/javascript"> | |
952 location = '<n.use_text_encoder.path_to_macro_which_overrides/>'; | |
953 </script> | |
954 </then> | |
955 </n.if.has_macro_which_overrides> | |
956 </macro> | |
957 | |
958 <subroutine name="overridden_macro_source" requires="basic,nabble,servlet,html,macro_source"> | |
959 <n.if.has_macro_overridden> | |
960 <then> | |
961 <n.macro_source. id="[n.macro_overridden_id/]" base="[n.current_base_classes/]" breadcrumbs="[n.current_breadcrumbs/]"> | |
962 <n.overrides_arrow/> | |
963 <table class="code"> | |
964 <n.source_row/> | |
965 <tr> | |
966 <n.line_numbers_column/> | |
967 <n.line_contents_column/> | |
968 </tr> | |
969 </table> | |
970 <n.overridden_macro_source/> | |
971 </n.macro_source.> | |
972 </then> | |
973 </n.if.has_macro_overridden> | |
974 </subroutine> | |
975 | |
976 <macro name="overrides_arrow" requires="macro_source"> | |
977 <div style="font-weight:bold;margin:.5em"> | |
978 <span style="font-size:300%;font-family:Arial,Sans-serif;line-height:.9em;vertical-align:-15%">↓</span> | |
979 <n.if.is_custom_tweak> | |
980 <then>Overrides administrator change</then> | |
981 <else> | |
982 <n.if.is_configuration_tweak> | |
983 <then>Overrides configuration</then> | |
984 <else>Overrides default macro</else> | |
985 </n.if.is_configuration_tweak> | |
986 </else> | |
987 </n.if.is_custom_tweak> | |
988 </div> | |
989 </macro> | |
990 | |
991 <macro name="source_row" requires="macro_source"> | |
992 <tr> | |
993 <td class="line-number weak-color medium-border-color shaded-bg-color" style="font-size:75%;padding-bottom:.4em">...</td> | |
994 <td class="line-contents weak-color" style="font-size:75%;padding-bottom:.4em"> | |
995 in <a href="[n.source_path/]"><n.clean_source_name.source/></a> | |
996 </td> | |
997 </tr> | |
998 </macro> | |
999 | |
1000 <macro name="clean_source_name" dot_parameter="source"> | |
1001 <n.regex_replace_all. pattern="^.+:" replacement=""> | |
1002 <n.source/> | |
1003 </n.regex_replace_all.> | |
1004 </macro> | |
1005 | |
1006 <macro name="revert_tweak" requires="servlet"> | |
1007 <n.if.visitor.is_site_admin> | |
1008 <then.macro_editor. id="[n.current_command_id/]" base="[n.current_base_classes/]" breadcrumbs="[n.current_breadcrumbs/]"> | |
1009 <n.revert/> | |
1010 ok | |
1011 </then.macro_editor.> | |
1012 </n.if.visitor.is_site_admin> | |
1013 </macro> | |
1014 | |
1015 <macro name="save_tweak" requires="servlet"> | |
1016 <n.if.visitor.is_site_admin> | |
1017 <then.macro_editor. id="[n.current_command_id/]" base="[n.current_base_classes/]" breadcrumbs="[n.current_breadcrumbs/]"> | |
1018 <n.save contents="[n.get_parameter name='contents'/]"/> | |
1019 </then.macro_editor.> | |
1020 </n.if.visitor.is_site_admin> | |
1021 </macro> | |
1022 | |
1023 <macro name="command_path" requires="command_info"> | |
1024 <n.macro_viewer_path> | |
1025 <id><n.use_text_encoder.id/></id> | |
1026 <base><n.base/></base> | |
1027 <breadcrumbs><n.naml_breadcrumbs/></breadcrumbs> | |
1028 </n.macro_viewer_path> | |
1029 </macro> | |
1030 | |
1031 <macro name="invalid_command_html"> | |
1032 <n.naml_tools.> | |
1033 <n.html> | |
1034 <head> | |
1035 <meta name="robots" content="noindex,nofollow"/> | |
1036 <n.title.>Invalid Command</n.title.> | |
1037 </head> | |
1038 <body> | |
1039 <n.macro_viewer_header.> | |
1040 Invalid Command | |
1041 </n.macro_viewer_header.> | |
1042 | |
1043 <n.if.command_is_binary id="[n.current_command_id/]"> | |
1044 <then> | |
1045 <h2>Command Not Found</h2> | |
1046 Meaning ID: <n.current_command_id/> | |
1047 </then> | |
1048 <else> | |
1049 <n.set_var. name="macro_name"> | |
1050 <n.command_name id="[n.current_command_id/]"/> | |
1051 </n.set_var.> | |
1052 | |
1053 The macro you are looking for could not be found (it may have been modified recently): | |
1054 <div style="font-size:120%;margin:.6em"> | |
1055 <n.bold.var name="macro_name"/> in <i><n.command_source_name id="[n.current_command_id/]"/></i> | |
1056 </div> | |
1057 | |
1058 <n.macro_search. query="[n.var name='macro_name'/]" search_by="name"> | |
1059 <n.if.has_more_elements> | |
1060 <then> | |
1061 <div style="margin:1.5em 0 0"> | |
1062 Here you can find other related macros: | |
1063 </div> | |
1064 <n.macro_results_table/> | |
1065 </then> | |
1066 </n.if.has_more_elements> | |
1067 </n.macro_search.> | |
1068 </else> | |
1069 </n.if.command_is_binary> | |
1070 </body> | |
1071 </n.html> | |
1072 </n.naml_tools.> | |
1073 </macro> | |
1074 | |
1075 <macro name="macro_search_page" requires="servlet"> | |
1076 <n.naml_tools.> | |
1077 <n.html> | |
1078 <head> | |
1079 <meta name="robots" content="noindex,follow"/> | |
1080 <n.title.>Search Macros</n.title.> | |
1081 <script type="text/javascript"> | |
1082 $(document).ready(function() { | |
1083 var $input = $('#search_field'); | |
1084 $input.keydown(function(event) { | |
1085 if (event.keyCode == 13) { | |
1086 event.preventDefault(); | |
1087 $('form').submit(); | |
1088 } | |
1089 }); | |
1090 $input.focus(); | |
1091 }); | |
1092 </script> | |
1093 </head> | |
1094 <body> | |
1095 <n.macro_viewer_header.> | |
1096 Macro Search | |
1097 </n.macro_viewer_header.> | |
1098 | |
1099 <n.if.is_empty.search_by_field.value> | |
1100 <then.search_by_field.set_value value="name"/> | |
1101 </n.if.is_empty.search_by_field.value> | |
1102 | |
1103 <n.form. macro="macro_search_page" method="GET"> | |
1104 <img src="/images/search.png" class="image16"/> | |
1105 <input id="search_field" type="text" size="25" name="query" value="[n.hide_null.macro_search_query/]"/> | |
1106 <input class="toolbar action-button" type="submit" value="[t]Search[/t]"/> | |
1107 <div style="clear:both;padding:.3em 0 0 1em"> | |
1108 <n.search_by_field.radio id="by_name" option_value="name"/> | |
1109 <label for="by_name">Macro by name</label><br/> | |
1110 <n.search_by_field.radio id="by_text" option_value="text"/> | |
1111 <label for="by_text">Macro source contains</label><br/> | |
1112 </div> | |
1113 </n.form.> | |
1114 | |
1115 <div style="margin-top:1em"> | |
1116 <n.macro_search_results query="[n.macro_search_query/]" search_by="[n.search_by_field.value/]"/> | |
1117 </div> | |
1118 </body> | |
1119 </n.html> | |
1120 </n.naml_tools.> | |
1121 </macro> | |
1122 | |
1123 <macro name="macro_search_results" parameters="query, search_by"> | |
1124 <n.macro_search. query="[n.query/]" search_by="[n.search_by/]"> | |
1125 <n.if.not.has_more_elements> | |
1126 <then> | |
1127 <n.if.not.is_null.macro_search_query> | |
1128 <then> | |
1129 <div class="big-title second-font">No macros found.</div> | |
1130 </then> | |
1131 </n.if.not.is_null.macro_search_query> | |
1132 </then> | |
1133 <else> | |
1134 <div class="big-title second-font"> | |
1135 <n.element_count/> macro(s) found. | |
1136 </div> | |
1137 <n.macro_results_table/> | |
1138 </else> | |
1139 </n.if.not.has_more_elements> | |
1140 </n.macro_search.> | |
1141 </macro> | |
1142 | |
1143 <macro name="macro_results_table" requires="command_list"> | |
1144 <n.put_in_head.> | |
1145 <style type="text/css"> | |
1146 table.macro-results { | |
1147 margin-top:.5em; | |
1148 border-spacing: 0; | |
1149 } | |
1150 table.macro-results td { | |
1151 padding: .4em 1.2em; | |
1152 } | |
1153 </style> | |
1154 </n.put_in_head.> | |
1155 <n.zebra_table_javascript table_selector="#macro-results"/> | |
1156 <table id="macro-results" class="macro-results weak-color"> | |
1157 <tr class="shaded-bg-color bold"> | |
1158 <td>Macro Name</td> | |
1159 <td>Requires</td> | |
1160 <td>Source File</td> | |
1161 </tr> | |
1162 <n.loop.current_command.> | |
1163 <tr style="[n.if.is_custom_tweak][then]font-weight:bold[/then][/n.if.is_custom_tweak]"> | |
1164 <td><a href="[n.command_path/]"><n.name/></a></td> | |
1165 <td><em><n.hide_null.required_namespaces/></em></td> | |
1166 <td><n.clean_source_name.source/></td> | |
1167 </tr> | |
1168 </n.loop.current_command.> | |
1169 </table> | |
1170 </macro> | |
1171 | |
1172 <macro name="macro_search_query"> | |
1173 <n.get_parameter name="query"/> | |
1174 </macro> | |
1175 | |
1176 <macro name="current_command_id"> | |
1177 <n.get_parameter name="id"/> | |
1178 </macro> | |
1179 | |
1180 <macro name="current_base_classes"> | |
1181 <n.get_parameter name="base"/> | |
1182 </macro> | |
1183 | |
1184 <macro name="current_breadcrumbs"> | |
1185 <n.get_parameter name="breadcrumbs"/> | |
1186 </macro> | |
1187 | |
1188 <macro name="search_by_field" dot_parameter="do"> | |
1189 <n.field. name="search_by"><n.do/></n.field.> | |
1190 </macro> | |
1191 | |
1192 <macro name="compile_if_needed"> | |
1193 <n.if.not.is_compiled_all> | |
1194 <then.run_compile_all/> | |
1195 </n.if.not.is_compiled_all> | |
1196 </macro> | |
1197 | |
1198 <macro name="new_macro_page" requires="servlet"> | |
1199 <n.naml_tools.> | |
1200 <n.html> | |
1201 <head> | |
1202 <meta name="robots" content="noindex,nofollow"/> | |
1203 <n.title.>New Macro</n.title.> | |
1204 <n.codemirror_shared_head/> | |
1205 <script type="text/javascript"> | |
1206 <![CDATA[ | |
1207 var defaultMacroBody = '<macro name="">\n\n</'+'macro>'; | |
1208 $(document).ready(function() { | |
1209 var $textarea = $('#txt_basic'); | |
1210 if ($textarea.val() == '') | |
1211 $textarea.val(defaultMacroBody); | |
1212 var canGoBack = history.length > 1; | |
1213 if (canGoBack) | |
1214 $('#go-back').show().before('<t>or</t> '); | |
1215 inlineEditor('27em', 1, 13); | |
1216 | |
1217 window.onbeforeunload = function() { | |
1218 $textarea.val(basicEditor.getCode()); | |
1219 }; | |
1220 }); | |
1221 | |
1222 function saveChanges() { | |
1223 notice('Saving... Please wait'); | |
1224 var call = '/template/NamlServlet.jtp?macro=save_tweak'; | |
1225 var code = basicEditor.getCode(); | |
1226 if (code.match(/^\s*$/) != null) { | |
1227 notice('Error Found', 3000, 1500); | |
1228 var msg = "Error: invalid macro code."; | |
1229 var $errorBox = $('#error-box'); | |
1230 $errorBox.html(formatError(msg)).show(); | |
1231 if ($errorBox.height() > 150) { | |
1232 $errorBox.css('overflow-y','scroll').height(150); | |
1233 } | |
1234 return; | |
1235 } | |
1236 var params = { contents: code }; | |
1237 $.post(call, params, | |
1238 function(data) { | |
1239 var result = eval('(' + data + ')'); | |
1240 if (result.error != null) { | |
1241 notice('Error Found', 3000, 1500); | |
1242 $('#error-box').html(formatError(result.error)).show(); | |
1243 } else { | |
1244 var url = '/template/NamlServlet.jtp?macro=macro_viewer&id=' + result.macroId; | |
1245 window.location = url; | |
1246 } | |
1247 } | |
1248 ); | |
1249 }; | |
1250 ]]> | |
1251 </script> | |
1252 </head> | |
1253 <body> | |
1254 <n.macro_viewer_header.> | |
1255 New Macro | |
1256 </n.macro_viewer_header.> | |
1257 | |
1258 <n.important_notices/> | |
1259 | |
1260 <div style="clear:both"> | |
1261 <n.macro_options_dropdown/> | |
1262 <button id="saveButton" class="toolbar" style="font-weight:bold" onclick="saveChanges()"> | |
1263 Save Changes | |
1264 </button> | |
1265 <a id="go-back" href="javascript: void history.back()" style="display:none"><t>Go back</t></a> | |
1266 | |
1267 <div style="clear:both"> | |
1268 <div id="error-box" class="error-message" style="padding:.5em;display:none"></div> | |
1269 <textarea id="txt_basic" style="display:none"></textarea> | |
1270 </div> | |
1271 </div> | |
1272 </body> | |
1273 </n.html> | |
1274 </n.naml_tools.> | |
1275 </macro> | |
1276 | |
1277 <macro name="macro_deleted_page" requires="servlet"> | |
1278 <n.naml_tools.> | |
1279 <n.html> | |
1280 <head> | |
1281 <meta name="robots" content="noindex,nofollow"/> | |
1282 <n.title.>Macro Deleted</n.title.> | |
1283 </head> | |
1284 <body> | |
1285 <n.macro_viewer_header.> | |
1286 Macro Deleted | |
1287 </n.macro_viewer_header.> | |
1288 | |
1289 <n.important_notices/> | |
1290 | |
1291 <div style="clear:both"> | |
1292 <h2 style="padding-bottom:1em"> | |
1293 <img src="/images/success.png" class="image16"/> | |
1294 Macro successfully deleted. | |
1295 </h2> | |
1296 <n.macro_options_dropdown/> | |
1297 </div> | |
1298 | |
1299 <br/> | |
1300 <br/> | |
1301 </body> | |
1302 </n.html> | |
1303 </n.naml_tools.> | |
1304 </macro> | |
1305 | |
1306 <macro name="new_macro_path"> | |
1307 <n.encode_url.> | |
1308 /template/NamlServlet.jtp?macro=new_macro_page | |
1309 </n.encode_url.> | |
1310 </macro> | |
1311 | |
1312 <macro name="macro_deleted_path"> | |
1313 <n.encode_url.> | |
1314 /template/NamlServlet.jtp?macro=macro_deleted_page | |
1315 </n.encode_url.> | |
1316 </macro> |