diff options
Diffstat (limited to 'examples/filebrowser/templates')
| -rw-r--r-- | examples/filebrowser/templates/edit_html.pt | 27 | ||||
| -rw-r--r-- | examples/filebrowser/templates/edit_text.pt | 62 | ||||
| -rw-r--r-- | examples/filebrowser/templates/view_file.pt | 15 | ||||
| -rw-r--r-- | examples/filebrowser/templates/view_html.pt | 9 | ||||
| -rw-r--r-- | examples/filebrowser/templates/view_image.pt | 6 | ||||
| -rw-r--r-- | examples/filebrowser/templates/view_text.pt | 7 |
6 files changed, 114 insertions, 12 deletions
diff --git a/examples/filebrowser/templates/edit_html.pt b/examples/filebrowser/templates/edit_html.pt new file mode 100644 index 0000000..10abb71 --- /dev/null +++ b/examples/filebrowser/templates/edit_html.pt @@ -0,0 +1,27 @@ +<html metal:use-macro="here/standard_template.pt/macros/page"> + +<metal:head fill-slot="extra_head"> +<span tal:replace="structure servlet/setup_xinha"/> +<script type="text/javascript"> +xinha_editors = ['txt-content']; + +</script> +</metal:head> + +<metal:body fill-slot="body"> + +<form tal:attributes="action options/action" method="POST"> +<input type="hidden" name="action" value="save"> +Edit:<br> +<textarea name="content" id="txt-content" cols=60 style="width: 100%" + tal:attributes="rows options/ta_height" + tal:content="options/content"></textarea> +<br> +<input type="submit" value="Save"> +<button tal:attributes="onclick + servlet/pathurl/action=view/js_set_location">Cancel</button> + +</form> + +</metal:body> +</html>
\ No newline at end of file diff --git a/examples/filebrowser/templates/edit_text.pt b/examples/filebrowser/templates/edit_text.pt index e2d7ba7..26ab12d 100644 --- a/examples/filebrowser/templates/edit_text.pt +++ b/examples/filebrowser/templates/edit_text.pt @@ -1,14 +1,72 @@ <html metal:use-macro="here/standard_template.pt/macros/page"> + +<metal:head fill-slot="extra_head"> +<script type="text/javascript"> + +function adjust_textarea(id, adjustment) { + var el = $(id); + current = parseInt(el.getAttribute('rows')); + current += adjustment; + if (current < 2) { + current = 2; + } + el.setAttribute('rows', current); + createCookie('default_ta_height', current, 365*2); + return false; +} + +function find_text(txt_id, input_id) { + var textarea = $(txt_id); + var txt = textarea.value.toLowerCase(); + var input = $(input_id); + input.style.backgroundColor = '#fff'; + var search_term = input.value.toLowerCase(); + if (! search_term) { + return false; + } + var search_txt = txt; + var offset = 0; + if (textarea.selectionEnd - textarea.selectionStart) { + search_txt = txt.substring(textarea.selectionEnd); + offset = textarea.selectionEnd; + } + var pos = search_txt.indexOf(search_term); + if (pos == -1) { + input.style.backgroundColor = '#fdd'; + textarea.selectionStart = textarea.selectionEnd = 0; + return false; + } + textarea.selectionStart = pos + offset; + textarea.selectionEnd = pos + offset + search_term.length; + return false; +} + +</script> +</metal:head> + <metal:body fill-slot="body"> <form tal:attributes="action options/action" method="POST"> <input type="hidden" name="action" value="save"> Edit:<br> -<textarea name="content" rows=10 cols=60 style="width: 100%" +<textarea name="content" id="txt-content" cols=60 style="width: 100%" + tal:attributes="rows options/ta_height" tal:content="options/content"></textarea> <br> <input type="submit" value="Save"> -<button tal:attributes="onclick servlet/pathurl/js_set_location">Cancel</button> +<button tal:attributes="onclick + servlet/pathurl/action=view/js_set_location">Cancel</button> +<button onclick="return adjust_textarea('txt-content', 1)">+</button> +<button onclick="return adjust_textarea('txt-content', -1)">-</button> +<a href="#" onclick="toggle('find-txt', {link: this}); return false" + shownhtml="&lt;&lt;&lt;" + style="text-decoration: none; color: #226">find...</a> +<span id="find-txt" style="display: none"> +<input type="text" id="find-input" style="width: 5em"> +<button onclick="return find_text('txt-content', + 'find-input')">find</button> +</span> + </form> </metal:body> diff --git a/examples/filebrowser/templates/view_file.pt b/examples/filebrowser/templates/view_file.pt index d6ad93a..6872ffa 100644 --- a/examples/filebrowser/templates/view_file.pt +++ b/examples/filebrowser/templates/view_file.pt @@ -1,3 +1,4 @@ +<metal:tpl define-macro="view"> <html metal:use-macro="here/standard_template.pt/macros/page"> <metal:body fill-slot="body"> @@ -15,15 +16,9 @@ Mimetype: <span tal:replace="servlet/mimetype"/><br> </p> -<pre tal:condition="python: options['content'] and not options['use_iframe']" - tal:content="options/content">content</pre> - -<img tal:condition="options/is_image" - tal:attributes="src servlet/pathurl/action=download"> - -<iframe tal:condition="options/use_iframe" - tal:attributes="src servlet/pathurl/action=download/html=clean" - width="100%" height="200" name="test"></iframe> +<metal:slot define-slot="view_inline"> +</metal:slot> </metal:body> -</html>
\ No newline at end of file +</html> +</metal:tpl>
\ No newline at end of file diff --git a/examples/filebrowser/templates/view_html.pt b/examples/filebrowser/templates/view_html.pt new file mode 100644 index 0000000..b467426 --- /dev/null +++ b/examples/filebrowser/templates/view_html.pt @@ -0,0 +1,9 @@ +<html metal:use-macro="here/view_file.pt/macros/view"> +<metal:slot fill-slot="view_inline"> +<iframe width="100%" height="200" name="test" + tal:attributes="src + servlet/pathurl/action=download/html=clean"></iframe> + +</metal:slot> +</html> + diff --git a/examples/filebrowser/templates/view_image.pt b/examples/filebrowser/templates/view_image.pt new file mode 100644 index 0000000..193be66 --- /dev/null +++ b/examples/filebrowser/templates/view_image.pt @@ -0,0 +1,6 @@ +<html metal:use-macro="here/view_file.pt/macros/view"> +<metal:slot fill-slot="view_inline"> +<img tal:attributes="src servlet/pathurl/action=download"> +</metal:slot> +</html> + diff --git a/examples/filebrowser/templates/view_text.pt b/examples/filebrowser/templates/view_text.pt new file mode 100644 index 0000000..7606d4f --- /dev/null +++ b/examples/filebrowser/templates/view_text.pt @@ -0,0 +1,7 @@ +<html metal:use-macro="here/view_file.pt/macros/view"> +<metal:slot fill-slot="view_inline"> +<pre style="overflow: auto" + tal:content="options/content">content</pre> +</metal:slot> +</html> + |
