From: Ben Klang Date: Mon, 29 Mar 2010 20:47:24 +0000 (-0400) Subject: Shout: Enable saving menu info X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=3bd481bb7a8224de00f71c40b7cca397d2d2d421;p=horde.git Shout: Enable saving menu info --- diff --git a/shout/lib/Ajax/Application.php b/shout/lib/Ajax/Application.php index f8d762dfd..df15b8e7f 100644 --- a/shout/lib/Ajax/Application.php +++ b/shout/lib/Ajax/Application.php @@ -156,8 +156,22 @@ class Shout_Ajax_Application extends Horde_Ajax_Application_Base public function saveMenuInfo() { - // FIXME - return true; + try { + $shout = $GLOBALS['registry']->getApiInstance('shout', 'application'); + $account = $_SESSION['shout']['curaccount']; + $vars = &$this->_vars; + $info = array( + 'name' => $vars->get('name'), + 'oldname' => $vars->get('oldname'), + 'description' => $vars->get('description'), + 'recording_id' => $vars->get('recording_id') + ); + return $shout->storage->saveMenuInfo($account, $info); + } catch (Exception $e) { + //FIXME: Create a way to notify the user of the failure. + Horde::logMessage($e, 'ERR'); + return false; + } } public function saveAction() diff --git a/shout/lib/Driver/Sql.php b/shout/lib/Driver/Sql.php index 59c60bf9b..bf23fe4ef 100644 --- a/shout/lib/Driver/Sql.php +++ b/shout/lib/Driver/Sql.php @@ -134,7 +134,7 @@ class Shout_Driver_Sql extends Shout_Driver return $menus; } - public function saveMenu($account, $details) + public function saveMenuInfo($account, $details) { $menus = $this->getMenus($account); if (isset($details['oldname'])) { diff --git a/shout/lib/Shout.php b/shout/lib/Shout.php index 6d1e363e9..03564617c 100644 --- a/shout/lib/Shout.php +++ b/shout/lib/Shout.php @@ -207,7 +207,7 @@ class Shout 'description' => _("Restart menu"), 'args' => array() ), - 'adminlogin' => array( + 'admin_login' => array( 'description' => _("Login to Admin Functions"), 'args' => array() ), diff --git a/shout/recordings.php b/shout/recordings.php index c7eb52002..5607e4b0c 100644 --- a/shout/recordings.php +++ b/shout/recordings.php @@ -43,22 +43,8 @@ case 'add': // Create a new add form $vars = new Horde_Variables(); $vars->set('action', $action); - //$Form = new MenuForm($vars); - - break; -case 'edit': - if (!isset($menus[$menu])) { - $notification->push(_("That menu does not exist."), 'horde.error'); - $action = 'list'; - break; - } - $menu = $menus[$menu]; - try { - $destinations = $shout->extensions->getExtensions($curaccount); - } catch (Exception $e) { - $notification->push(_("Problem getting destination information.")); - } break; + case 'list': default: $action = 'list'; diff --git a/shout/templates/dialplan/edit.inc b/shout/templates/dialplan/edit.inc index 346d87297..e0b916b1a 100644 --- a/shout/templates/dialplan/edit.inc +++ b/shout/templates/dialplan/edit.inc @@ -498,12 +498,12 @@ function deleteMenu() } } -function saveMenu() +function saveMenuInfo() { $('menuWorking').show(); var params = $('editMenu').serialize(true); params.oldname = curmenu; - new Ajax.Request(ajax_url + 'saveAction', + new Ajax.Request(ajax_url + 'saveMenuInfo', { method: 'post', parameters: params,