diff --git a/include/class_msgPool.inc b/include/class_msgPool.inc index ce4d2ab05293a76b8f1c1ccb157977378b58cc17..1150be00615cb2dc56d6b851b1d18e2c0c57e04d 100644 --- a/include/class_msgPool.inc +++ b/include/class_msgPool.inc @@ -604,24 +604,14 @@ class msgPool { * * \param array $depends Contains all the settings disabled */ - public static function featuresDisabled($name, $depends = "") + public static function featuresDisabled($name, array $depends = array(), array $conflicts = array()) { - if (($depends == "") || (is_array($depends) && count($depends) == 0)) { - return sprintf(_("This account has %s settings disabled. You can enable them by clicking below."), $name); + if (empty($depends) && empty($conflicts)) { + return sprintf(_('This account has %s settings disabled. You can enable them by clicking below.'), $name); + } elseif (!empty($depends)) { + return sprintf(_('This account has %s settings disabled. To enable them, you\'ll need to add the %s settings first!'), $name, implode(' / ', $depends)); } else { - if (count($depends) == 1) { - if (is_array($depends)) { - $depends = $depends[0]; - } - return sprintf(_("This account has %s settings disabled. To enable them, you'll need to add the %s settings first!"), $name, $depends); - } else { - $deps = ""; - foreach ($depends as $dep) { - $deps .= "$dep / "; - } - $deps = preg_replace("/ \/ $/", "", $deps); - return sprintf(_("This account has %s settings disabled. To enable them, you'll need to add the %s settings first!"), $name, $deps); - } + return sprintf(_('This account has %s settings disabled. To enable them, you\'ll need to disable the %s settings first!'), $name, implode(' / ', $conflicts)); } } diff --git a/include/class_pluglist.inc b/include/class_pluglist.inc index 8cc9dcc5c83f3717ff1443940a3daaf924b49e38..ff2e569bc4a8a8c6843614d02e639b750276f0f8 100644 --- a/include/class_pluglist.inc +++ b/include/class_pluglist.inc @@ -64,8 +64,9 @@ class pluglist { $classes = get_declared_classes(); $index = 0; - $depends_infos = array(); - $foreign_refs = array(); + $depends_infos = array(); + $conflicts_infos = array(); + $foreign_refs = array(); foreach ($classes as $cname) { $cmethods = get_class_methods($cname); if (in_array_ics('plInfo', $cmethods)) { @@ -86,6 +87,9 @@ class pluglist { if (isset($infos['plDepends'])) { $depends_infos[] = $cname; } + if (isset($infos['plConflicts'])) { + $conflicts_infos[] = $cname; + } if (isset($infos['plForeignKeys'])) { foreach ($infos['plForeignKeys'] as $ofield => &$pfks) { if (!is_array($pfks)) { @@ -153,6 +157,19 @@ class pluglist { } } } + foreach ($conflicts_infos as $cname) { + foreach ($this->info[$cname]['plConflicts'] as $conflict) { + if (isset($this->info[$conflict])) { + if (isset($this->info[$conflict]['plConflicts'])) { + if (!in_array($cname, $this->info[$conflict]['plConflicts'])) { + $this->info[$conflict]['plConflicts'][] = $cname; + } + } else { + $this->info[$conflict]['plConflicts'] = array($cname); + } + } + } + } foreach ($foreign_refs as $cname => $refs) { $this->info[$cname]['plForeignRefs'] = $refs; } diff --git a/include/simpleplugin/class_simplePlugin.inc b/include/simpleplugin/class_simplePlugin.inc index 2653908ce08ba4ff8ee566ce8f201049ff2c2f21..7349af7d14bf0a96a001f4fadd9a7d75567f9e72 100644 --- a/include/simpleplugin/class_simplePlugin.inc +++ b/include/simpleplugin/class_simplePlugin.inc @@ -683,8 +683,9 @@ class simplePlugin /* Show tab dialog headers */ $plInfo = pluglist::pluginInfos(get_class($this)); if ($this->parent !== NULL) { - $disabled = $this->acl_skip_write(); - $depends = array(); + $disabled = $this->acl_skip_write(); + $depends = array(); + $conflicts = array(); if ($this->is_account) { if (isset($plInfo['plDepending'])) { foreach ($plInfo['plDepending'] as $plugin) { @@ -714,9 +715,19 @@ class simplePlugin } } } + if (isset($plInfo['plConflicts'])) { + foreach ($plInfo['plConflicts'] as $plugin) { + if (isset($this->parent->by_object[$plugin]) && + $this->parent->by_object[$plugin]->is_account) { + $disabled = TRUE; + $conflictPlInfos = pluglist::pluginInfos($plugin); + $conflicts[] = $conflictPlInfos['plShortName']; + } + } + } $this->header = $this->show_header( msgPool::addFeaturesButton($plInfo['plShortName']), - msgPool::featuresDisabled($plInfo['plShortName'], $depends), + msgPool::featuresDisabled($plInfo['plShortName'], $depends, $conflicts), $this->is_account, $disabled, get_class($this).'_modify_state'