Shout: Enable saving menu info
authorBen Klang <ben@alkaloid.net>
Mon, 29 Mar 2010 20:47:24 +0000 (16:47 -0400)
committerBen Klang <ben@alkaloid.net>
Mon, 29 Mar 2010 20:48:40 +0000 (16:48 -0400)
shout/lib/Ajax/Application.php
shout/lib/Driver/Sql.php
shout/lib/Shout.php
shout/recordings.php
shout/templates/dialplan/edit.inc

index f8d762d..df15b8e 100644 (file)
@@ -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()
index 59c60bf..bf23fe4 100644 (file)
@@ -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'])) {
index 6d1e363..0356461 100644 (file)
@@ -207,7 +207,7 @@ class Shout
                 'description' => _("Restart menu"),
                 'args' => array()
             ),
-            'adminlogin' => array(
+            'admin_login' => array(
                 'description' => _("Login to Admin Functions"),
                 'args' => array()
             ),
index c7eb520..5607e4b 100644 (file)
@@ -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';
index 346d872..e0b916b 100644 (file)
@@ -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,