3
* Copyright 2002-2013 Horde LLC (http://www.horde.org/)
5
* See the enclosed file COPYING for license information (GPL). If you
6
* did not receive this file, see http://www.horde.org/licenses/gpl.
9
require_once __DIR__ . '/../lib/Application.php';
10
Horde_Registry::appInit('nag');
12
// Exit if this isn't an authenticated user.
13
if (!$GLOBALS['registry']->getAuth()) {
14
Horde::url('list.php', true)->redirect();
17
$vars = Horde_Variables::getDefaultVariables();
19
$tasklist = $nag_shares->getShare($vars->get('t'));
20
} catch (Horde_Share_Exception $e) {
21
$notification->push($e);
22
Horde::url('list.php', true)->redirect();
24
$owner = $tasklist->get('owner') == $GLOBALS['registry']->getAuth() ||
25
(is_null($tasklist->get('owner')) && $GLOBALS['registry']->isAdmin());
27
!$tasklist->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::READ)) {
28
$notification->push(_("You are not allowed to see this task list."), 'horde.error');
29
Horde::url('list.php', true)->redirect();
31
$form = new Nag_Form_EditTaskList($vars, $tasklist);
33
// Execute if the form is valid.
34
if ($owner && $form->validate($vars)) {
35
$original_name = $tasklist->get('name');
38
if ($tasklist->get('name') != $original_name) {
39
$notification->push(sprintf(_("The task list \"%s\" has been renamed to \"%s\"."), $original_name, $tasklist->get('name')), 'horde.success');
41
$notification->push(sprintf(_("The task list \"%s\" has been saved."), $original_name), 'horde.success');
43
Horde::url('list.php', true)->redirect();
44
} catch (Exception $e) {
45
$notification->push($e);
49
$vars->set('name', $tasklist->get('name'));
50
$vars->set('color', $tasklist->get('color'));
51
$vars->set('system', is_null($tasklist->get('owner')));
52
$vars->set('description', $tasklist->get('desc'));
54
$page_output->header(array(
55
'title' => $form->getTitle()
59
echo $form->renderActive($form->getRenderer(), $vars,
60
Horde::url('tasklists/edit.php'), 'post');
62
echo $form->renderInactive($form->getRenderer(), $vars);
64
$page_output->footer();