$context = $_SESSION['shout']['context'];
$actions = Shout::getMenuActions();
$action = $actions[$action];
- $form = new Horde_Form($vars, $action['description']);
+ $form = new Horde_Form($vars, $action['description'], 'editActionForm');
foreach($action['args'] as $name => $info) {
$defaults = array(
'required' => true,
'description' => null,
'params' => array()
);
- //$info = array_merge($info, $defaults);
+ $info = array_merge($defaults, $info);
$form->addVariable($info['name'], $name, $info['type'],
$info['required'], $info['readonly'],
$info['description'], $info['params']);
}
$this->_responseType = 'html';
- $form->renderActive();
+ $form->renderActive(null, null, 'javascript:saveAction()');
$output = ob_get_clean();
return $output;
} catch (Exception $e) {
}
}
+ public function saveAction()
+ {
+ return null;
+ }
+
public function responseType()
{
return $this->_responseType;
var menu = '<?php echo $menu['name']; ?>';
var menuInfo = $H();
var menuActions = $H();
+var curDigit = null;
function editAction(digit)
{
if ($('selectActionForm') == null) {
+ curDigit = digit;
// Draw the selectActionForm
$('editAction').show();
while ((e = $('editAction').childNodes[0]) != null) {
});
form.appendChild(select);
$('editAction').appendChild(form);
+ var div = document.createElement('div');
+ div.id = 'editActionFormContainer';
+ $('editAction').appendChild(div);
} else {
var action = null;
// Draw the options for this action
});
var params = $H({'action': action});
var actionForm;
- var div = document.createElement('div');
- div.id = 'editActionForm';
- $('editAction').appendChild(div);
- new Ajax.Updater('editActionForm', ajax_url + 'getActionForm',
+ new Ajax.Updater('editActionFormContainer', ajax_url + 'getActionForm',
{
method: 'post',
parameters: params
function saveAction(digit)
{
- $('editAction').hide();
+ var params = $('editActionForm').serialize(true);
+ params.menu = menuInfo.get('meta').name;
+ params.digit = curDigit;
+ new Ajax.Request(ajax_url + 'saveAction',
+ {
+ method: 'post',
+ parameters: params,
+ onSuccess: function(r) {
+ alert('FIXME');
+ while ((e = $('editAction').childNodes[0]) != null) {
+ $('editAction').removeChild(e);
+ }
+ $('editAction').hide();
+ }
+ });
}
function changeSoundfile()