From 0d2524928ef760c3c667c2cd00f63ea85a7f29be Mon Sep 17 00:00:00 2001 From: Jan Schneider Date: Thu, 24 Oct 2013 18:43:58 +0200 Subject: [PATCH] [jan] Don't show admin alarm form if alarms are disabled. --- horde/admin/alarms.php | 45 ++++++++++++++++++++++++------------------ horde/docs/CHANGES | 1 + horde/package.xml | 2 ++ 3 files changed, 29 insertions(+), 19 deletions(-) diff --git a/horde/admin/alarms.php b/horde/admin/alarms.php index 62e4794dad2..9f2158f064d 100644 --- a/horde/admin/alarms.php +++ b/horde/admin/alarms.php @@ -116,25 +116,30 @@ )); $view->addHelper('Text'); -try { - $alarms = $horde_alarm->globalAlarms(); - $url = Horde::url('admin/alarms.php'); - foreach ($alarms as &$alarm) { - $url->add('alarm', $alarm['id']); - $alarm['edit_link'] = $url->link() - . htmlspecialchars($alarm['title']) - . ''; - $alarm['delete_link'] = $url->copy() - ->add('delete', 1) - ->link(array('title' => sprintf(_("Delete \"%s\""), $alarm['title']), - 'onclick' => 'return confirm(\'' . addslashes(sprintf(_("Are you sure you want to delete '%s'?"), $alarm['title'])) . '\')')) - . Horde::img('delete.png') - . ''; - } - $view->alarms = $alarms; -} catch (Horde_Alarm_Exception $e) { +if ($horde_alarm instanceof Horde_Alarm_Null) { $view->alarms = array(); - $view->error = sprintf(_("Listing alarms failed: %s"), $e->getMessage()); + $view->error = _("Alarms have been disabled in the configuration"); +} else { + try { + $alarms = $horde_alarm->globalAlarms(); + $url = Horde::url('admin/alarms.php'); + foreach ($alarms as &$alarm) { + $url->add('alarm', $alarm['id']); + $alarm['edit_link'] = $url->link() + . htmlspecialchars($alarm['title']) + . ''; + $alarm['delete_link'] = $url->copy() + ->add('delete', 1) + ->link(array('title' => sprintf(_("Delete \"%s\""), $alarm['title']), + 'onclick' => 'return confirm(\'' . addslashes(sprintf(_("Are you sure you want to delete '%s'?"), $alarm['title'])) . '\')')) + . Horde::img('delete.png') + . ''; + } + $view->alarms = $alarms; + } catch (Horde_Alarm_Exception $e) { + $view->alarms = array(); + $view->error = sprintf(_("Listing alarms failed: %s"), $e->getMessage()); + } } $page_output->header(array( @@ -142,5 +147,7 @@ )); require HORDE_TEMPLATES . '/admin/menu.inc'; echo $view->render('list'); -$form->renderActive(); +if (!($horde_alarm instanceof Horde_Alarm_Null)) { + $form->renderActive(); +} $page_output->footer(); diff --git a/horde/docs/CHANGES b/horde/docs/CHANGES index fc7ee0dfaee..b96c36642f2 100644 --- a/horde/docs/CHANGES +++ b/horde/docs/CHANGES @@ -2,6 +2,7 @@ v5.1.5-git ---------- +[jan] Don't show admin alarm form if alarms are disabled. [mms] Add horde-remove-user-data command-line script. [mms] Add additional syntax checking for the configuration files in the test script. diff --git a/horde/package.xml b/horde/package.xml index ca522e1bb56..2201b407b3e 100644 --- a/horde/package.xml +++ b/horde/package.xml @@ -39,6 +39,7 @@ LGPL-2 +* [jan] Don't show admin alarm form if alarms are disabled. * [mms] Add horde-remove-user-data command-line script. * [mms] Add additional syntax checking for the configuration files in the test script. * [mms] Only update topbar if the underlying tree data has changed. @@ -3776,6 +3777,7 @@ 2013-10-19 LGPL-2 +* [jan] Don't show admin alarm form if alarms are disabled. * [mms] Add horde-remove-user-data command-line script. * [mms] Add additional syntax checking for the configuration files in the test script. * [mms] Only update topbar if the underlying tree data has changed.