$digit = $vars->get('digit');
$menu = $vars->get('menu');
$action = $vars->get('action');
+
+ if ($action == 'none') {
+ // Remove the menu action and return
+ $shout->dialplan->deleteMenuAction($account, $menu, $digit);
+ return true;
+ }
+
$actions = Shout::getMenuActions();
if (!isset($actions[$action])) {
throw new Shout_Exception('Invalid action requested.');
$args[$name] = $vars->get($name);
}
$shout->dialplan->saveMenuAction($account, $menu, $digit, $action, $args);
+ return true;
} catch (Exception $e) {
//FIXME: Create a way to notify the user of the failure.
Horde::logMessage($e, 'ERR');
return $menuActions[$menu];
}
- public function saveMenuAction($account, $menu, $digit, $action, $args)
+ public function deleteMenuAction($account, $menu, $digit)
{
// Remove any existing action
$sql = 'DELETE FROM menu_entries WHERE menu_id = ' .
if ($result instanceof PEAR_Error) {
throw new Shout_Exception($result);
}
+ }
+
+ public function saveMenuAction($account, $menu, $digit, $action, $args)
+ {
+ $this->deleteMenuAction($account, $menu, $digit);
$sql = 'INSERT INTO menu_entries (menu_id, digit, action_id, args) ' .
'VALUES((SELECT id FROM menus WHERE account_id = ' .
'description' => _("Restart menu"),
'args' => array()
),
- // TODO: Actions to implement: Queue
+ 'none' => array(
+ 'description' => _("No action"),
+ 'args' => array()
+ )
+
+ // TODO: Actions to implement: Queue, VoicemailLogin
);
}
if (menuInfo.get(curmenu).actions[digit] != null) {
select.value = menuInfo.get(curmenu).actions[digit].action
}
- var option = document.createElement('option');
- option.value = 'none';
- var text = document.createTextNode('<?php echo _("No action"); ?>');
- option.appendChild(text);
- select.appendChild(option);
$('selectAction').appendChild(select);
// Cancel button
div.appendChild(img);
break;
+ case 'directory':
case 'rewind':
case 'none':
break;