aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/LocalFilesEditor/show_default.tpl
diff options
context:
space:
mode:
authorpatdenice <patdenice@piwigo.org>2011-04-12 11:40:06 +0000
committerpatdenice <patdenice@piwigo.org>2011-04-12 11:40:06 +0000
commitcf4e2c81f948a1a9e54258d3ced978d1ad2ef234 (patch)
treef3fbaa43b7207e1f153a079ffb9c84dcf85c6c00 /plugins/LocalFilesEditor/show_default.tpl
parent28b9e115ee113b9510db949093c39a7743d8906f (diff)
merge r10307 from trunk to branch 2.2
feature:2262 Replace editarea by Codemirror: http://codemirror.net git-svn-id: http://piwigo.org/svn/branches/2.2@10310 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--plugins/LocalFilesEditor/show_default.tpl59
1 files changed, 36 insertions, 23 deletions
diff --git a/plugins/LocalFilesEditor/show_default.tpl b/plugins/LocalFilesEditor/show_default.tpl
index d5acfe438..bf35586d4 100644
--- a/plugins/LocalFilesEditor/show_default.tpl
+++ b/plugins/LocalFilesEditor/show_default.tpl
@@ -1,43 +1,56 @@
{html_head}
-<link rel="stylesheet" type="text/css" href="{$LOCALEDIT_PATH}locfiledit.css">
<style type="text/css">#headbranch, #theHeader, #copyright {ldelim} display: none; }</style>
{/html_head}
-{known_script id="jquery" src=$ROOT_URL|@cat:"template-common/lib/jquery.packed.js"}
-{known_script id="editarea" src=$LOCALEDIT_PATH|@cat:"editarea/edit_area_full.js"}
-<script type="text/javascript">
-var editarea = "{$LOAD_EDITAREA}";
-
-function loadEditarea() {ldelim}
- editAreaLoader.init({ldelim}
- id: "text"
- {foreach from=$EDITAREA_OPTIONS key=option item=value}
- , {$option}: {$value|editarea_quote}
- {/foreach}
+{combine_script id="jquery"}
+
+{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 loadCodemirror() {ldelim}
+ editor = CodeMirror.fromTextArea(document.getElementById("text"), {ldelim}
+ matchBrackets: true,
+ readOnly: true,
+ mode: "{$CODEMIRROR_MODE}",
+ tabMode: "shift"
});
jQuery("#showedit").hide();
jQuery("#hideedit").show();
+ jQuery.post("update_config.php", {ldelim} editarea: "on"});
}
-function unloadEditarea() {ldelim}
- editAreaLoader.delete_instance("text");
+function unloadCodemirror() {ldelim}
+ editor.toTextArea();
jQuery("#hideedit").hide();
jQuery("#showedit").show();
+ jQuery.post("update_config.php", {ldelim} editarea: "off"});
}
-</script>
+
+{if $LOAD_CODEMIRROR == 'on'}
+if (document.getElementById("text") != null) loadCodemirror();
+{/if}
+{/footer_script}
<div id="LocalFilesEditor">
-<h1>{$TITLE}</h1>
+<div style="overflow:auto;"><b>{$TITLE}</b></div>
<textarea id="text" rows="30" cols="90">{$DEFAULT_CONTENT}</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>
</div>
-
-<script type="text/javascript">
-jQuery("#editarea_buttons").show();
-if (editarea == "on") loadEditarea();
-</script>