diff options
author | Andreas Gohr <andi@splitbrain.org> | 2013-08-11 11:19:34 +0200 |
---|---|---|
committer | Andreas Gohr <andi@splitbrain.org> | 2013-08-11 11:19:34 +0200 |
commit | e445eeb3b675b350b4cebeeea610d4f7cd2e8f19 (patch) | |
tree | 6cc295f40be60a5f41c8e74e359633b4c036735b /lib/plugins/extension/helper | |
parent | 347e1146ca6a08dc90247a3f7da31cbc3a409aa0 (diff) | |
download | rpg-e445eeb3b675b350b4cebeeea610d4f7cd2e8f19.tar.gz rpg-e445eeb3b675b350b4cebeeea610d4f7cd2e8f19.tar.bz2 |
fixed button logic
Diffstat (limited to 'lib/plugins/extension/helper')
-rw-r--r-- | lib/plugins/extension/helper/extension.php | 19 | ||||
-rw-r--r-- | lib/plugins/extension/helper/list.php | 26 |
2 files changed, 30 insertions, 15 deletions
diff --git a/lib/plugins/extension/helper/extension.php b/lib/plugins/extension/helper/extension.php index d912a44c0..6136c3c9a 100644 --- a/lib/plugins/extension/helper/extension.php +++ b/lib/plugins/extension/helper/extension.php @@ -107,7 +107,7 @@ class helper_plugin_extension_extension extends DokuWiki_Plugin { * @return bool if the extension is protected */ public function isProtected() { - return in_array($this->base, array('acl', 'config', 'info', 'plugin', 'revert', 'usermanager')); + return in_array($this->id, array('acl', 'config', 'info', 'plugin', 'revert', 'usermanager', 'template:dokuwiki')); } /** @@ -513,20 +513,21 @@ class helper_plugin_extension_extension extends DokuWiki_Plugin { /** * If the extension can probably be installed/updated or uninstalled * - * @return bool|string True or one of "nourl", "noparentperms" (template/plugin install path not writable), "noperms" (extension itself not writable) + * @return bool|string True or error string */ public function canModify() { - if ($this->isInstalled()) { - if (!is_writable($this->getInstallDir())) { + if($this->isInstalled()) { + if(!is_writable($this->getInstallDir())) { return 'noperms'; } } - $parent_path = ($this->isTemplate() ? DOKU_TPLLIB : DOKU_PLUGIN); - if (!is_writable($parent_path)) { - return 'noparentperms'; - } - if (!$this->getDownloadURL()) return 'nourl'; + if($this->isTemplate() && !is_writable(DOKU_TPLLIB)) { + return 'notplperms'; + + } elseif(!is_writable(DOKU_PLUGIN)) { + return 'nopluginperms'; + } return true; } diff --git a/lib/plugins/extension/helper/list.php b/lib/plugins/extension/helper/list.php index 16ef71569..7ecd5b267 100644 --- a/lib/plugins/extension/helper/list.php +++ b/lib/plugins/extension/helper/list.php @@ -444,11 +444,13 @@ class helper_plugin_extension_list extends DokuWiki_Plugin { */ function make_actions(helper_plugin_extension_extension $extension) { $return = ''; - if (!$extension->isInstalled() && $extension->canModify() === true) { - $return .= $this->make_action('install', $extension); - } elseif ($extension->canModify() === true) { - if (!$extension->isBundled()) { - $return .= $this->make_action('uninstall', $extension); + $errors = ''; + + if ($extension->isInstalled()) { + if (($canmod = $extension->canModify()) === true) { + if (!$extension->isProtected()) { + $return .= $this->make_action('uninstall', $extension); + } if ($extension->getDownloadURL()) { if ($extension->updateAvailable()) { $return .= $this->make_action('update', $extension); @@ -456,7 +458,10 @@ class helper_plugin_extension_list extends DokuWiki_Plugin { $return .= $this->make_action('reinstall', $extension); } } + }else{ + $errors .= '<p class="permerror">'.$this->getLang($canmod).'</p>'; } + if (!$extension->isProtected()) { if ($extension->isEnabled()) { if(!$extension->isTemplate()){ // templates can't be disabled, only another can be enabled @@ -466,6 +471,15 @@ class helper_plugin_extension_list extends DokuWiki_Plugin { $return .= $this->make_action('enable', $extension); } } + + }else{ + if (($canmod = $extension->canModify()) === true) { + if ($extension->getDownloadURL()) { + $return .= $this->make_action('install', $extension); + } + }else{ + $errors .= '<div class="permerror">'.$this->getLang($canmod).'</div>'; + } } if (!$extension->isInstalled()) { @@ -473,7 +487,7 @@ class helper_plugin_extension_list extends DokuWiki_Plugin { $return .= ($extension->getLastUpdate() ? hsc($extension->getLastUpdate()) : $this->getLang('unknown')).'</span>'; } - return $return; + return $return.' '.$errors; } /** |