2007-07-19 12:40:28 +02:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Action button with Ajax/JavaScript overloading.
|
2008-01-09 05:18:36 +01:00
|
|
|
* @package forms
|
|
|
|
* @subpackage actions
|
2007-07-19 12:40:28 +02:00
|
|
|
*/
|
|
|
|
class AjaxFormAction extends FormAction {
|
|
|
|
protected $ajaxAction;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Create a new action button.
|
|
|
|
* @param action The method to call when the button is clicked
|
|
|
|
* @param title The label on the button
|
|
|
|
* @param confirmation The message to display in the confirmation box?
|
|
|
|
* @param form The parent form, auto-set when the field is placed inside a form
|
|
|
|
*/
|
|
|
|
function __construct($action, $title = "", $ajaxAction = null, $form = null) {
|
|
|
|
$this->ajaxAction = $ajaxAction ? $ajaxAction : $action;
|
|
|
|
parent::__construct($action, $title, $form);
|
|
|
|
}
|
|
|
|
function Field() {
|
2008-04-06 06:08:45 +02:00
|
|
|
return $this->createTag('input', array(
|
|
|
|
'class' => "ajaxAction-$this->ajaxAction action",
|
|
|
|
'id' => $this->id(),
|
|
|
|
'type' => 'submit',
|
|
|
|
'value' => $this->title,
|
|
|
|
'tabindex' => $this->getTabIndexHTML()
|
|
|
|
));
|
2007-07-19 12:40:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function Title() {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|