From 20b3857b605e9696abdab419e316768ee27f93c4 Mon Sep 17 00:00:00 2001 From: Jan Schneider Date: Thu, 9 Dec 2010 16:02:41 +0100 Subject: [PATCH] Improve quick task adding. --- nag/quick.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/nag/quick.php b/nag/quick.php index 03c6a5c69..d7fd15b8d 100644 --- a/nag/quick.php +++ b/nag/quick.php @@ -4,10 +4,15 @@ require_once dirname(__FILE__) . '/lib/Application.php'; Horde_Registry::appInit('nag'); if ($quickText = Horde_Util::getPost('quickText')) { - $result = $registry->tasks->quickAdd($quickText); - if (!$result) { - throw new Nag_Exception($result); + $result = Nag::createTasksFromText($quickText, Nag::getDefaultTasklist(Horde_Perms::EDIT)); + if (is_a($result, 'PEAR_Error')) { + $notification->push($result); + } elseif ($result) { + $notification->push(sprintf(ngettext("Added %d task", "Added %d tasks", count($result)), count($result)), 'horde.success'); + } else { + $notification->push(_("No tasks have been added."), 'horde.warning'); } - $notification->push(sprintf(ngettext("Added %d task", "Added %d tasks", count($result)), count($result)), 'horde.success'); - Horde::url('list.php', true)->redirect(); +} else { + $notification->push(_("No tasks have been added."), 'horde.warning'); } +Horde::url('list.php', true)->redirect(); -- 2.11.0