...and while we're at it, optimize away one unnecessary AJAX call.
{
$vars = $this->_vars;
$shout = Horde_Registry::appInit('shout');
- $account = $_SESSION['shout']['account'];
+ $account = $_SESSION['shout']['curaccount'];
try {
$shout = $GLOBALS['registry']->getApiInstance('shout', 'application');
$shout->extensions->addDestination($account, $vars->extension, $vars->type, $vars->destination);
{
$vars = $this->_vars;
$shout = Horde_Registry::appInit('shout');
- $account = $_SESSION['shout']['account'];
+ $account = $_SESSION['shout']['curaccount'];
try {
// FIXME: Use Form?
$shout = $GLOBALS['registry']->getApiInstance('shout', 'application');
try {
$vars = $this->_vars;
$shout = Horde_Registry::appInit('shout');
- $account = $_SESSION['shout']['account'];
+ $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.", __FILE__, __LINE__, PEAR_LOG_ERR);
- $notification->push(_("That menu does not exist."), 'horde.error');
- $action = 'list';
+ //$GLOBALS['notification']->push(_("That menu does not exist."), 'horde.error');
// FIXME notifications
return false;
}
+
$data['meta'] = $menus[$menu];
$data['actions'] = $shout->dialplan->getMenuActions($account, $menu);
return $data;
} catch (Exception $e) {
//FIXME: Create a way to notify the user of the failure.
+ die(var_dump($e));
Horde::logMessage($e->getMessage(), __FILE__, __LINE__, PEAR_LOG_ERR);
return false;
}
}
+
/**
* TODO
*/
try {
$vars = $this->_vars;
$GLOBALS['shout'] = Horde_Registry::appInit('shout');
- $account = $_SESSION['shout']['account'];
+ $account = $_SESSION['shout']['curaccount'];
$actions = Shout::getMenuActions($contex, $menu);
return $actions;
} catch (Exception $e) {
throw new Shout_Exception("Invalid action requested.");
}
$GLOBALS['shout'] = Horde_Registry::appInit('shout');
- $account = $_SESSION['shout']['account'];
+ $account = $_SESSION['shout']['curaccount'];
$actions = Shout::getMenuActions();
$action = $actions[$action];
$form = new Horde_Form($vars, $action['description'], 'editActionForm');
$menus[$account] = array();
while ($row && !($row instanceof PEAR_Error)) {
- $menu = $row['menu_name'];
+ $menu = $row['name'];
$menus[$account][$menu] = array(
'name' => $menu,
- 'description' => $row['menu_description'],
- 'soundfile' => $row['menu_soundfile']
+ 'description' => $row['description'],
+ 'soundfile' => $row['soundfile']
);
$row = $result->fetchRow(DB_FETCHMODE_ASSOC);
}
return $menuActions[$menu];
}
- $sql = "SELECT accounts.accountcode AS account, menus.name AS description, " .
+ $sql = "SELECT accounts.code AS account, menus.name AS description, " .
"actions.name AS action, menu_entries.digit AS digit, " .
"menu_entries.args AS args FROM menu_entries " .
"INNER JOIN menus ON menu_entries.menu_id = menus.id " .
"INNER JOIN actions ON menu_entries.action_id = actions.id " .
"INNER JOIN accounts ON menus.account_id = accounts.id " .
- "WHERE accounts.accountcode = ? AND menus.name = ?";
- $values = array($account, $menuid);
+ "WHERE accounts.code = ? AND menus.name = ?";
+ $values = array($account, $menu);
$msg = 'SQL query in Shout_Driver_Sql#getMenuActions(): ' . $sql;
Horde::logMessage($msg, __FILE__, __LINE__, PEAR_LOG_DEBUG);
- $result = $this->_db->query($sql, $vars);
+ $result = $this->_db->query($sql, $values);
if ($result instanceof PEAR_Error) {
throw new Shout_Exception($result);
}
$row = $result->fetchRow(DB_FETCHMODE_ASSOC);
}
$result->free();
- return $menus[$menu];
+
+ return $menuActions[$menu];
}
/**
var ajax_url = '<?php echo Horde::getServiceLink('ajax', 'shout') ?>';
var menu = '<?php echo $menu['name']; ?>';
var menuInfo = $H();
-var menuActions = $H();
+var menuActions = $H(<?php echo Horde_Serialize::serialize(Shout::getMenuActions(), Horde_Serialize::JSON, Horde_Nls::getCharset()); ?>);
var curDigit = null;
function editAction(digit)
refreshMenu();
}
});
-new Ajax.Request(ajax_url + 'getMenuActions',
-{
- method: 'post',
- onSuccess: function(r) {
- menuActions = $H(r.responseJSON.response);
- refreshMenu();
- }
-});
// -->
</script>
\ No newline at end of file