summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2013-08-11 11:19:34 +0200
committerAndreas Gohr <andi@splitbrain.org>2013-08-11 11:19:34 +0200
commite445eeb3b675b350b4cebeeea610d4f7cd2e8f19 (patch)
tree6cc295f40be60a5f41c8e74e359633b4c036735b /lib
parent347e1146ca6a08dc90247a3f7da31cbc3a409aa0 (diff)
downloadrpg-e445eeb3b675b350b4cebeeea610d4f7cd2e8f19.tar.gz
rpg-e445eeb3b675b350b4cebeeea610d4f7cd2e8f19.tar.bz2
fixed button logic
Diffstat (limited to 'lib')
-rw-r--r--lib/plugins/extension/helper/extension.php19
-rw-r--r--lib/plugins/extension/helper/list.php26
-rw-r--r--lib/plugins/extension/images/warning.pngbin0 -> 613 bytes
-rw-r--r--lib/plugins/extension/lang/en/lang.php4
-rw-r--r--lib/plugins/extension/style.less9
5 files changed, 43 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;
}
/**
diff --git a/lib/plugins/extension/images/warning.png b/lib/plugins/extension/images/warning.png
new file mode 100644
index 000000000..c5e482f84
--- /dev/null
+++ b/lib/plugins/extension/images/warning.png
Binary files differ
diff --git a/lib/plugins/extension/lang/en/lang.php b/lib/plugins/extension/lang/en/lang.php
index 11c5caa2b..53ce597dd 100644
--- a/lib/plugins/extension/lang/en/lang.php
+++ b/lib/plugins/extension/lang/en/lang.php
@@ -74,3 +74,7 @@ $lang['error_download'] = 'Unable to download the file: %s';
$lang['error_decompress'] = 'Unable to decompress the downloaded file. This maybe as a result of a bad download, in which case you should try again; or the compression format may be unknown, in which case you will need to download and install manually.';
$lang['error_findfolder'] = 'Unable to identify extension directory, you need to download and install manually';
$lang['error_copy'] = 'There was a file copy error while attempting to install files for directory <em>%s</em>: the disk could be full or file access permissions may be incorrect. This may have resulted in a partially installed plugin and leave your wiki installation unstable';
+
+$lang['noperms'] = 'Extension directory is not writable';
+$lang['notplperms'] = 'Template directory is not writable';
+$lang['nopluginperms'] = 'Plugin directory is not writable'; \ No newline at end of file
diff --git a/lib/plugins/extension/style.less b/lib/plugins/extension/style.less
index e1a7a1d7b..762968611 100644
--- a/lib/plugins/extension/style.less
+++ b/lib/plugins/extension/style.less
@@ -258,6 +258,15 @@
margin: 0.2em 0;
text-align: center;
}
+
+ p.permerror {
+ margin-left: 0.4em;
+ text-align: left;
+ padding-left: 19px;
+ background: transparent url(images/warning.png) center left no-repeat;
+ line-height: 18px;
+ font-size: 12px;
+ }
}
/**