summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/plugins/extension/admin.php49
-rw-r--r--lib/plugins/extension/helper/gui.php71
-rw-r--r--lib/plugins/extension/helper/list.php35
-rw-r--r--lib/plugins/extension/lang/en/lang.php6
4 files changed, 126 insertions, 35 deletions
diff --git a/lib/plugins/extension/admin.php b/lib/plugins/extension/admin.php
index 6cad58595..4faafedb2 100644
--- a/lib/plugins/extension/admin.php
+++ b/lib/plugins/extension/admin.php
@@ -14,6 +14,17 @@ if(!defined('DOKU_INC')) die();
*/
class admin_plugin_extension extends DokuWiki_Admin_Plugin {
protected $infoFor = null;
+ /** @var helper_plugin_extension_gui */
+ protected $gui;
+
+ /**
+ * Constructor
+ *
+ * loads additional helpers
+ */
+ public function __construct(){
+ $this->gui = plugin_load('helper', 'extension_gui');
+ }
/**
* @return int sort number in admin menu
@@ -40,7 +51,7 @@ class admin_plugin_extension extends DokuWiki_Admin_Plugin {
$repository->init();
if(!$repository->hasAccess()){
- $url = helper_plugin_extension_list::tabURL('', array('purge'=>1));
+ $url = $this->gui->tabURL('', array('purge'=>1));
msg('The DokuWiki extension repository can not be reached currently.
Online Features are not available. [<a href="'.$url.'">retry</a>]', -1);
@@ -109,21 +120,35 @@ class admin_plugin_extension extends DokuWiki_Admin_Plugin {
public function html() {
/* @var Doku_Plugin_Controller $plugin_controller */
global $plugin_controller;
+ global $INPUT;
ptln('<h1>'.$this->getLang('menu').'</h1>');
ptln('<div id="extension__manager">');
- $pluginlist = $plugin_controller->getList('', true);
- /* @var helper_plugin_extension_extension $extension */
- $extension = $this->loadHelper('extension_extension');
- /* @var helper_plugin_extension_list $list */
- $list = $this->loadHelper('extension_list');
- $list->start_form();
- foreach ($pluginlist as $name) {
- $extension->setExtension($name, false);
- $list->add_row($extension, $name == $this->infoFor);
+ $this->gui->tabNavigation();
+
+ switch($INPUT->str('tab','plugins')){
+ case 'search':
+ echo 'search interface';
+ break;
+ case 'plugins':
+ default:
+ // FIXME move to function?
+
+ $pluginlist = $plugin_controller->getList('', true);
+ /* @var helper_plugin_extension_extension $extension */
+ $extension = $this->loadHelper('extension_extension');
+ /* @var helper_plugin_extension_list $list */
+ $list = $this->loadHelper('extension_list');
+ $list->start_form();
+ foreach ($pluginlist as $name) {
+ $extension->setExtension($name, false);
+ $list->add_row($extension, $name == $this->infoFor);
+ }
+ $list->end_form();
+ $list->render();
}
- $list->end_form();
- $list->render();
+
+
ptln('</div>');
}
}
diff --git a/lib/plugins/extension/helper/gui.php b/lib/plugins/extension/helper/gui.php
new file mode 100644
index 000000000..eba5fbc7f
--- /dev/null
+++ b/lib/plugins/extension/helper/gui.php
@@ -0,0 +1,71 @@
+<?php
+/**
+ * DokuWiki Plugin extension (Helper 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 helper_plugin_extension_list takes care of the overall GUI
+ */
+class helper_plugin_extension_gui extends DokuWiki_Plugin {
+
+ protected $tabs = array('plugins', 'templates', 'search');
+
+ /**
+ * Print the tab navigation
+ *
+ * @fixme style active one
+ */
+ public function tabNavigation() {
+ echo '<ul class="tabs">';
+ foreach(array('plugins', 'templates', 'search') as $tab) {
+ $url = $this->tabURL($tab);
+ if($this->currentTab() == $tab) {
+ $class = 'class="active"';
+ } else {
+ $class = '';
+ }
+ echo '<li '.$class.'><a href="'.$url.'">'.$this->getLang('tab_'.$tab).'</a></li>';
+ }
+ echo '</ul>';
+ }
+
+ /**
+ * Return the currently selected tab
+ *
+ * @return string
+ */
+ public function currentTab() {
+ global $INPUT;
+
+ $tab = $INPUT->str('tab', 'plugins', true);
+ if(!in_array($tab, $this->tabs)) $tab = 'plugins';
+ return $tab;
+ }
+
+ /**
+ * Create an URL inside the extension manager
+ *
+ * @param string $tab tab to load, empty for current tab
+ * @param array $params associative array of parameter to set
+ *
+ * @return string
+ */
+ public function tabURL($tab = '', $params = array()) {
+ global $ID;
+
+ if(!$tab) $tab = $this->currentTab();
+ $defaults = array(
+ 'do' => 'admin',
+ 'page' => 'extension',
+ 'tab' => $tab,
+ );
+ return wl($ID, array_merge($defaults, $params));
+ }
+
+}
diff --git a/lib/plugins/extension/helper/list.php b/lib/plugins/extension/helper/list.php
index 816d4a444..1c337176d 100644
--- a/lib/plugins/extension/helper/list.php
+++ b/lib/plugins/extension/helper/list.php
@@ -14,6 +14,17 @@ if(!defined('DOKU_INC')) die();
*/
class helper_plugin_extension_list extends DokuWiki_Plugin {
protected $form = '';
+ /** @var helper_plugin_extension_gui */
+ protected $gui;
+
+ /**
+ * Constructor
+ *
+ * loads additional helpers
+ */
+ public function __construct(){
+ $this->gui = plugin_load('helper', 'extension_gui');
+ }
function start_form() {
$this->form .= '<form id="extension__list" accept-charset="utf-8" method="post" action="">';
@@ -152,7 +163,7 @@ class helper_plugin_extension_list extends DokuWiki_Plugin {
$mailid = $extension->getEmailID();
if($mailid){
- $url = $this->tabURL('search', array('q' => 'mailid:'.$mailid));
+ $url = $this->gui->tabURL('search', array('q' => 'mailid:'.$mailid));
return '<a href="'.$url.'" class="author" title="'.$this->getLang('author_hint').'" >'.hsc($extension->getAuthor()).'</a>';
}else{
return '<span class="author">'.hsc($extension->getAuthor()).'</span>';
@@ -239,7 +250,7 @@ class helper_plugin_extension_list extends DokuWiki_Plugin {
}else{
$first = false;
}
- $url = $this->tabURL('search', array('q' => 'tag:'.$tag));
+ $url = $this->gui->tabURL('search', array('q' => 'tag:'.$tag));
$return .= '<a href="'.$url.'">'.hsc($tag).'</a>';
}
echo '</span>';
@@ -484,24 +495,4 @@ class helper_plugin_extension_list extends DokuWiki_Plugin {
return '<input class="'.$classes.'" name="'.$name.'" type="submit" value="'.$this->getLang('btn_'.$action).'" '.$title.' />';
}
-
- /**
- * Create an URL inside the extension manager
- *
- * @param string tab tb to load, empty for current tab
- * @param array $params associative array of parameter to set
- * @return string
- */
- static public function tabURL($tab='', $params=array()){
- global $ID;
- global $INPUT;
-
- if(!$tab) $tab = $INPUT->str('tab', 'installed', true);
- $defaults = array(
- 'do' => 'admin',
- 'page' => 'extension',
- 'tab' => $tab,
- );
- return wl($ID, array_merge($defaults, $params));
- }
}
diff --git a/lib/plugins/extension/lang/en/lang.php b/lib/plugins/extension/lang/en/lang.php
index b3a451ecc..4439db879 100644
--- a/lib/plugins/extension/lang/en/lang.php
+++ b/lib/plugins/extension/lang/en/lang.php
@@ -7,7 +7,11 @@
*/
// menu entry for admin plugins
-$lang['menu'] = 'Extension manager';
+$lang['menu'] = 'Extension Manager';
+
+$lang['tab_plugins'] = 'Installed Plugins';
+$lang['tab_templates'] = 'Installed Templates';
+$lang['tab_search'] = 'Search and Install';
// custom language strings for the plugin
$lang['notimplemented'] = 'This feature hasn\'t been implemented yet';