From: Michael M Slusarz Date: Thu, 4 Jun 2009 19:16:43 +0000 (-0600) Subject: Improved notifications on rule actions X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=bce2d7695c161c6c57500c233553d5efbd62389e;p=horde.git Improved notifications on rule actions --- diff --git a/ingo/filters.php b/ingo/filters.php index d9deaca82..1f538c795 100644 --- a/ingo/filters.php +++ b/ingo/filters.php @@ -52,8 +52,10 @@ case 'rule_enable': header('Location: ' . Horde::applicationUrl('filters.php', true)); exit; } + + $tmp = $filters->getFilter($id); if ($filters->deleteRule($id)) { - $notification->push(_("Rule Deleted"), 'horde.success'); + $notification->push(sprintf(_("Rule \"%s\" deleted."), $tmp['name']), 'horde.success'); } break; @@ -73,8 +75,11 @@ case 'rule_enable': } $notification->push($message, 'horde.error', array('content.raw')); break 2; - } elseif ($filters->copyRule($id)) { - $notification->push(_("Rule Copied"), 'horde.success'); + } else { + $tmp = $filters->getFilter($id); + if ($filters->copyRule($id)) { + $notification->push(sprintf(_("Rule \"%s\" copied."), $tmp['name']), 'horde.success'); + } } break; @@ -89,13 +94,15 @@ case 'rule_enable': break; case 'rule_disable': + $tmp = $filters->getFilter($id); $filters->ruleDisable($id); - $notification->push(_("Rule Disabled"), 'horde.success'); + $notification->push(sprintf(_("Rule \"%s\" disabled."), $tmp['name']), 'horde.success'); break; case 'rule_enable': + $tmp = $filters->getFilter($id); $filters->ruleEnable($id); - $notification->push(_("Rule Enabled"), 'horde.success'); + $notification->push(sprintf(_("Rule \"%s\" enabled."), $tmp['name']), 'horde.success'); break; } diff --git a/ingo/lib/Storage.php b/ingo/lib/Storage.php index bb2f119a4..fd08681b3 100644 --- a/ingo/lib/Storage.php +++ b/ingo/lib/Storage.php @@ -822,6 +822,18 @@ class Ingo_Storage_filters } /** + * Return the filter entry for a given ID. + * + * @return mixed The rule hash entry, or false if not defined. + */ + public function getFilter($id) + { + return isset($this->_filters[$id]) + ? $this->_filters[$id] + : false; + } + + /** * Returns a single rule hash. * * @param integer $id A rule number.