summaryrefslogtreecommitdiff
path: root/templates/mod/config-editor-php.html
diff options
context:
space:
mode:
authorczaks <marcin@6irc.net>2013-08-01 23:43:20 -0400
committerczaks <marcin@6irc.net>2013-08-01 23:43:20 -0400
commit1ed45ebe9e39724ec70098abfcd267d8ac478511 (patch)
treeda133b7426dedaf0785f64be752aa0437de7e80a /templates/mod/config-editor-php.html
parentdc84ccc6a8e0b6fd3fc626eb1f321e4cf2d05511 (diff)
parent40ab2e0c1728fab613bc16a19ab8fcb3fa78c1d4 (diff)
Merge branch 'master' of https://github.com/savetheinternet/Tinyboard
Conflicts: stylesheets/dark.css stylesheets/futaba+vichan.css stylesheets/miku.css stylesheets/stripes.css stylesheets/testorange.css stylesheets/wasabi.css
Diffstat (limited to 'templates/mod/config-editor-php.html')
-rw-r--r--templates/mod/config-editor-php.html45
1 files changed, 45 insertions, 0 deletions
diff --git a/templates/mod/config-editor-php.html b/templates/mod/config-editor-php.html
new file mode 100644
index 00000000..54c398e4
--- /dev/null
+++ b/templates/mod/config-editor-php.html
@@ -0,0 +1,45 @@
+{% if readonly %}
+ <p style="text-align:center;max-width:800px;margin:20px auto">Tinyboard does not have the required permissions to edit <strong>inc/instance-config.php</strong>. To make changes, you will need to change the file's permissions first or manually edit the code.</p>
+{% endif %}
+
+
+{% if not readonly %}<form method="post" action="">{% endif %}
+ <textarea name="code" id="code" style="display:block; margin:auto;width:100%;max-width:800px;height:500px{% if readonly %};background:#eee" readonly{% else %}"{% endif %}>
+ {{ php }}
+ </textarea>
+
+ <ul style="padding:0;text-align:center;list-style:none">
+ <li><input name="save" type="submit" value="{% trans 'Save changes' %}"{% if readonly %} disabled{% endif %}></li>
+ </ul>
+{% if not readonly %}</form>{% endif %}
+
+<script type="text/javascript">
+var observe;
+if (window.attachEvent) {
+ observe = function (element, event, handler) {
+ element.attachEvent('on'+event, handler);
+ };
+}
+else {
+ observe = function (element, event, handler) {
+ element.addEventListener(event, handler, false);
+ };
+}
+
+var text = document.getElementById('code');
+function resize () {
+ text.style.height = 'auto';
+ text.style.height = text.scrollHeight+'px';
+}
+/* 0-timeout to get the already changed text */
+function delayedResize () {
+ window.setTimeout(resize, 0);
+}
+observe(text, 'change', resize);
+observe(text, 'cut', delayedResize);
+observe(text, 'paste', delayedResize);
+observe(text, 'drop', delayedResize);
+observe(text, 'keydown', delayedResize);
+
+resize();
+</script> \ No newline at end of file