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();