From b0b7c4af26722ec557dd160f38c393656b36b5e9 Mon Sep 17 00:00:00 2001 From: Ben Klang Date: Thu, 25 Mar 2010 19:26:23 -0400 Subject: [PATCH] Shout: improve menu selection UI --- shout/dialplan.php | 13 ++---- shout/lib/Ajax/Application.php | 19 +++----- shout/templates/dialplan/edit.inc | 96 ++++++++++++++++++++------------------- shout/templates/dialplan/list.inc | 34 -------------- 4 files changed, 59 insertions(+), 103 deletions(-) delete mode 100644 shout/templates/dialplan/list.inc diff --git a/shout/dialplan.php b/shout/dialplan.php index de4134dfb..f4b8c063e 100644 --- a/shout/dialplan.php +++ b/shout/dialplan.php @@ -49,21 +49,14 @@ case 'add': break; case 'edit': - if (!isset($menus[$menu])) { - $notification->push(_("That menu does not exist."), 'horde.error'); - $action = 'list'; - break; - } - $menu = $menus[$menu]; +default: + $action = 'edit'; try { $destinations = $shout->extensions->getExtensions($curaccount); } catch (Exception $e) { $notification->push(_("Problem getting destination information.")); } - break; -case 'list': -default: - $action = 'list'; + break; } diff --git a/shout/lib/Ajax/Application.php b/shout/lib/Ajax/Application.php index df8eba9c3..34161634c 100644 --- a/shout/lib/Ajax/Application.php +++ b/shout/lib/Ajax/Application.php @@ -102,24 +102,17 @@ class Shout_Ajax_Application extends Horde_Ajax_Application_Base /** * TODO */ - public function getMenuInfo() + public function getMenus() { try { - $vars = $this->_vars; $shout = $GLOBALS['registry']->getApiInstance('shout', 'application'); $account = $_SESSION['shout']['curaccount']; $menus = $shout->storage->getMenus($account); - $menu = $vars->menu; - if (!isset($menus[$menu])) { - Horde::logMessage("User requested a menu that does not exist.", 'ERR'); - //$GLOBALS['notification']->push(_("That menu does not exist."), 'horde.error'); - // FIXME notifications - return false; + foreach ($menus as $menu => $info) { + // Fill in the actions for each menu + $menus[$menu]['actions'] = $shout->dialplan->getMenuActions($account, $menu); } - - $data['meta'] = $menus[$menu]; - $data['actions'] = $shout->dialplan->getMenuActions($account, $menu); - return $data; + return $menus; } catch (Exception $e) { //FIXME: Create a way to notify the user of the failure. die(var_dump($e)); @@ -142,7 +135,7 @@ class Shout_Ajax_Application extends Horde_Ajax_Application_Base $vars = $this->_vars; $shout = $GLOBALS['registry']->getApiInstance('shout', 'application'); $account = $_SESSION['shout']['curaccount']; - $actions = Shout::getMenuActions($contex, $menu); + $actions = Shout::getMenuActions(); return $actions; } catch (Exception $e) { //FIXME: Create a way to notify the user of the failure. diff --git a/shout/templates/dialplan/edit.inc b/shout/templates/dialplan/edit.inc index fb491fdc7..1296c74ad 100644 --- a/shout/templates/dialplan/edit.inc +++ b/shout/templates/dialplan/edit.inc @@ -1,6 +1,32 @@
- - +
@@ -31,7 +57,7 @@