summaryrefslogtreecommitdiff
path: root/lib/plugins/styler/admin.php
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2015-05-16 18:40:21 +0200
committerAndreas Gohr <andi@splitbrain.org>2015-05-16 18:40:21 +0200
commit6ea007c9f8c6830ea4f21ad880e91279e2f4bf10 (patch)
tree8d769608fe260066773457feccb987730459a73e /lib/plugins/styler/admin.php
parent4d6524b8916955bf5fa9086042917244751dc03d (diff)
downloadrpg-6ea007c9f8c6830ea4f21ad880e91279e2f4bf10.tar.gz
rpg-6ea007c9f8c6830ea4f21ad880e91279e2f4bf10.tar.bz2
a first very basic implementation of the preview mechanism
Diffstat (limited to 'lib/plugins/styler/admin.php')
-rw-r--r--lib/plugins/styler/admin.php74
1 files changed, 74 insertions, 0 deletions
diff --git a/lib/plugins/styler/admin.php b/lib/plugins/styler/admin.php
new file mode 100644
index 000000000..8ecbd22a0
--- /dev/null
+++ b/lib/plugins/styler/admin.php
@@ -0,0 +1,74 @@
+<?php
+/**
+ * DokuWiki Plugin styler (Admin Component)
+ *
+ * @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html
+ * @author Andreas Gohr <andi@splitbrain.org>
+ */
+
+// must be run within Dokuwiki
+if(!defined('DOKU_INC')) die();
+
+class admin_plugin_styler extends DokuWiki_Admin_Plugin {
+
+ /**
+ * @return int sort number in admin menu
+ */
+ public function getMenuSort() {
+ return 1000;
+ }
+
+ /**
+ * @return bool true if only access for superuser, false is for superusers and moderators
+ */
+ public function forAdminOnly() {
+ return true;
+ }
+
+ /**
+ * Should carry out any processing required by the plugin.
+ */
+ public function handle() {
+ set_doku_pref('styler_plugin', 1);
+ }
+
+ /**
+ * Render HTML output, e.g. helpful text and a form
+ */
+ public function html() {
+ global $conf;
+ $tpl = $conf['template'];
+ define('SIMPLE_TEST',1); // hack, ideally certain functions should be moved out of css.php
+ require_once(DOKU_INC.'lib/exe/css.php');
+ $styleini = css_styleini($conf['template'], true);
+ $replacements = $styleini['replacements'];
+
+ ptln('<h1>'.$this->getLang('menu').'</h1>');
+
+ if (empty($replacements)) {
+ echo '<p class="error">Sorry, this template does not support this functionality.</p>';
+ } else {
+ echo '<p>Intro blah... for the currently active template ("'.$tpl.'")... not all variables preview...</p>';
+
+ echo '<form class="styler" id="plugin__styler" method="post">';
+ echo '<h2>Template variables</h2>';
+ echo '<table>';
+ foreach($replacements as $key => $value){
+ echo '<tr>';
+ echo '<td>'.$key.'</td>';
+ echo '<td><input name="tpl['.hsc($key).']" value="'.hsc($value).'" />';
+ echo '</tr>';
+ }
+ echo '</table>';
+ echo '<input type="submit" name="do[styler_plugin_preview]" value="preview">';
+ echo '</form>';
+ }
+
+
+
+ }
+
+
+}
+
+// vim:ts=4:sw=4:et: \ No newline at end of file