aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/LocalFilesEditor/admin.tpl
diff options
context:
space:
mode:
authorpatdenice <patdenice@piwigo.org>2011-04-12 11:12:51 +0000
committerpatdenice <patdenice@piwigo.org>2011-04-12 11:12:51 +0000
commita740ef91e6689f86011b70c7bbe2589abf78ae6b (patch)
treebb4a6deb7395b0f545bb760cf34f093e910f1cff /plugins/LocalFilesEditor/admin.tpl
parentbb7c28f86febddd376ee0400807507991a2d7b48 (diff)
feature:2262
Replace editarea by Codemirror: http://codemirror.net git-svn-id: http://piwigo.org/svn/trunk@10307 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--plugins/LocalFilesEditor/admin.tpl50
1 files changed, 31 insertions, 19 deletions
diff --git a/plugins/LocalFilesEditor/admin.tpl b/plugins/LocalFilesEditor/admin.tpl
index 72880dd05..bffd2ef44 100644
--- a/plugins/LocalFilesEditor/admin.tpl
+++ b/plugins/LocalFilesEditor/admin.tpl
@@ -1,28 +1,37 @@
-{html_head}<script type="text/javascript" src="{$ROOT_URL}plugins/LocalFilesEditor/editarea/edit_area_full.js"></script>{/html_head}
+{combine_script id="codemirror" path="plugins/LocalFilesEditor/codemirror/lib/codemirror.js"}
+{combine_script id="codemirror.xml" require="codemirror" path="plugins/LocalFilesEditor/codemirror/mode/xml/xml.js"}
+{combine_script id="codemirror.javascript" require="codemirror" path="plugins/LocalFilesEditor/codemirror/mode/javascript/javascript.js"}
+{combine_script id="codemirror.css" require="codemirror" path="plugins/LocalFilesEditor/codemirror/mode/css/css.js"}
+{combine_script id="codemirror.clike" require="codemirror" path="plugins/LocalFilesEditor/codemirror/mode/clike/clike.js"}
+{combine_script id="codemirror.htmlmixed" require="codemirror.xml,codemirror.javascript,codemirror.css" path="plugins/LocalFilesEditor/codemirror/mode/htmlmixed/htmlmixed.js"}
+{combine_script id="codemirror.php" require="codemirror.xml,codemirror.javascript,codemirror.css,codemirror.clike" path="plugins/LocalFilesEditor/codemirror/mode/php/php.js"}
+
+{combine_css path="plugins/LocalFilesEditor/codemirror/lib/codemirror.css"}
+{combine_css path="plugins/LocalFilesEditor/codemirror/mode/xml/xml.css"}
+{combine_css path="plugins/LocalFilesEditor/codemirror/mode/javascript/javascript.css"}
+{combine_css path="plugins/LocalFilesEditor/codemirror/mode/css/css.css"}
+{combine_css path="plugins/LocalFilesEditor/codemirror/mode/clike/clike.css"}
{combine_css path="plugins/LocalFilesEditor/locfiledit.css"}
+
{footer_script}
-function loadEditarea() {ldelim}
- editAreaLoader.init({ldelim}
- id: "text"
- {foreach from=$EDITAREA_OPTIONS key=option item=value}
- , {$option}: {$value|editarea_quote}
- {/foreach}
+function loadCodemirror() {ldelim}
+ editor = CodeMirror.fromTextArea(document.getElementById("text"), {ldelim}
+ matchBrackets: true,
+ mode: "{$CODEMIRROR_MODE}",
+ tabMode: "shift"
});
- jQuery("#showedit").hide();
- jQuery("#hideedit").show();
+ jQuery("#showedit, #hideedit").toggle();
jQuery.post("plugins/LocalFilesEditor/update_config.php", {ldelim} editarea: "on"});
}
-function unloadEditarea() {ldelim}
- editAreaLoader.delete_instance("text");
- jQuery("#hideedit").hide();
- jQuery("#showedit").show();
+function unloadCodemirror() {ldelim}
+ editor.toTextArea();
+ jQuery("#showedit, #hideedit").toggle();
jQuery.post("plugins/LocalFilesEditor/update_config.php", {ldelim} editarea: "off"});
}
-jQuery("#editarea_buttons").show();
-{if $LOAD_EDITAREA == 'on'}
-if (document.getElementById("text") != null) loadEditarea();
+{if $LOAD_CODEMIRROR == 'on'}
+if (document.getElementById("text") != null) loadCodemirror();
{/if}
{/footer_script}
@@ -66,10 +75,11 @@ if (document.getElementById("text") != null) loadEditarea();
{/if}
{/if}
+<div style="overflow:auto;"> {* top bar buttons *}
{if !empty($show_default)}
{foreach from=$show_default item=file name=default_loop}
<span class="top_right">
-<a href="{$file.SHOW_DEFAULT}" onclick="window.open( this.href, 'local_file', 'location=no,toolbar=no,menubar=no,status=no,resizable=yes,scrollbars=yes,width=800,height=600' ); return false;">{'locfiledit_show_default'|@translate} "{$file.FILE}"</a>
+<a href="{$file.SHOW_DEFAULT}" onclick="window.open( this.href, 'local_file', 'location=no,toolbar=no,menubar=no,status=no,resizable=yes,scrollbars=yes,width=800,height=700' ); return false;">{'locfiledit_show_default'|@translate} "{$file.FILE}"</a>
</span>
{if !($smarty.foreach.default_loop.last)}<br>{/if}
{/foreach}
@@ -78,10 +88,12 @@ if (document.getElementById("text") != null) loadEditarea();
{if isset ($zone_edit)}
<b>{$zone_edit.FILE_NAME}</b>
+</div> {* top bar buttons *}
+
<textarea rows="30" cols="90" name="text" id="text">{$zone_edit.CONTENT_FILE}</textarea>
<div id="editarea_buttons">
-<a href="javascript:loadEditarea();" id="showedit">[{'locfiledit_enable_editarea'|@translate}]</a>
-<a href="javascript:unloadEditarea();" id="hideedit">[{'locfiledit_disable_editarea'|@translate}]</a>
+<a href="javascript:loadCodemirror();" id="showedit">[{'locfiledit_enable_codemirror'|@translate}]</a>
+<a href="javascript:unloadCodemirror();" id="hideedit">[{'locfiledit_disable_codemirror'|@translate}]</a>
</div>
<br>