Shout: Fix small errors in writing dialplan changes
authorBen Klang <ben@alkaloid.net>
Mon, 15 Mar 2010 03:28:30 +0000 (23:28 -0400)
committerBen Klang <ben@alkaloid.net>
Mon, 15 Mar 2010 03:28:30 +0000 (23:28 -0400)
shout/lib/Ajax/Application.php
shout/lib/Driver/Sql.php
shout/templates/dialplan/edit.inc

index 3ba94eb..8a05290 100644 (file)
@@ -176,7 +176,7 @@ class Shout_Ajax_Application extends Horde_Ajax_Application_Base
     public function saveAction()
     {
         try {
-            $shout = $_GLOBALS['shout'] = Horde_Registry::appInit('shout');
+            $shout = $GLOBALS['shout'] = Horde_Registry::appInit('shout');
             $vars = $this->_vars;
             if (!($action = $vars->get('action'))) {
                 throw new Shout_Exception("Invalid action requested.");
@@ -190,10 +190,10 @@ class Shout_Ajax_Application extends Horde_Ajax_Application_Base
                 throw new Shout_Exception('Invalid action requested.');
             }
             $args = array();
-            foreach ($action[$action]['args'] as $name => $info) {
+            foreach ($actions[$action]['args'] as $name => $info) {
                 $args[$name] = $vars->get($name);
             }
-            $shout->dialplan->saveMenuAction($account, $menu, $action, $args);
+            $shout->dialplan->saveMenuAction($account, $menu, $digit, $action, $args);
         } catch (Exception $e) {
             //FIXME: Create a way to notify the user of the failure.
             Horde::logMessage($e->getMessage(), __FILE__, __LINE__, PEAR_LOG_ERR);
index 7a40b05..d44a984 100644 (file)
@@ -200,6 +200,7 @@ class Shout_Driver_Sql extends Shout_Driver
                '(SELECT id FROM actions WHERE name = ?), ?)';
         $yamlargs = Horde_Yaml::dump($args);
         $values = array($account, $menu, $digit, $action, $yamlargs);
+        Horde::logMessage("Data: ".print_r($values, true), __FILE__, __LINE__, PEAR_LOG_ERR);
         $msg = 'SQL query in Shout_Driver_Sql#saveMenuAction(): ' . $sql;
         Horde::logMessage($msg, __FILE__, __LINE__, PEAR_LOG_DEBUG);
         $result = $this->_write_db->query($sql, $values);
index 3914d44..da962bc 100644 (file)
@@ -111,6 +111,7 @@ function saveAction(digit)
 {
     var params = $('editActionForm').serialize(true);
     params.menu = menuInfo.get('meta').name;
+    params.action = $('selectActionForm').getElements().first().getValue();
     new Ajax.Request(ajax_url + 'saveAction',
     {
         method: 'post',