javascript: remove hardcoding of dialog box for
manage_table
This commit is contained in:
parent
0982ee1c4a
commit
232fd902fe
4 changed files with 42 additions and 9 deletions
|
|
@ -71,15 +71,16 @@ class Manage_Table_SQL
|
|||
protected $a_prop; //!< property for each col.
|
||||
protected $a_type; //!< Type of the column : date , select ... Only in input
|
||||
protected $a_select; //!< Possible value if a_type is a SELECT
|
||||
protected $object_name; //!< Object_name is used for the javascript
|
||||
protected $object_name; //!< Object_name is used for the javascript , it is the row id to update or delete
|
||||
protected $row_delete; //!< Flag to indicate if rows can be deleted
|
||||
protected $row_update; //!< Flag to indicate if rows can be updated
|
||||
protected $row_append; //!< Flag to indicate if rows can be added
|
||||
protected $json_parameter; //!< Default parameter to add (gDossier...)
|
||||
protected $json_parameter; //!< Default parameter to add (gDossier...), sent to the ajax callback
|
||||
protected $aerror; //!< Array containing the error of the input data
|
||||
protected $col_sort; //!< when inserting, it is the column to sort,-1 to disable it and append only
|
||||
protected $a_info; //!< Array with the infotip
|
||||
protected $sort_column; //!< javascript sort , if empty there is no js sort
|
||||
protected $dialog_box; //!< ID of the dialog box which display the result of the ajax calls
|
||||
const UPDATABLE=1;
|
||||
const VISIBLE=2;
|
||||
|
||||
|
|
@ -121,6 +122,7 @@ class Manage_Table_SQL
|
|||
$this->col_sort=0;
|
||||
// By default no js sort
|
||||
$this->sort_column="";
|
||||
$this->dialog_box="dtr";
|
||||
}
|
||||
/**
|
||||
* send the XML headers for the ajax call
|
||||
|
|
@ -129,6 +131,25 @@ class Manage_Table_SQL
|
|||
{
|
||||
header('Content-type:text/xml;charset="UTF-8"');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function get_dialog_box()
|
||||
{
|
||||
return $this->dialog_box;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $dialog_box
|
||||
*/
|
||||
public function set_dialog_box($dialog_box)
|
||||
{
|
||||
$this->dialog_box = $dialog_box;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* When adding an element , it is column we checked to insert before,
|
||||
* @return none
|
||||
|
|
@ -363,6 +384,7 @@ function check()
|
|||
{$this->object_name}.set_callback(\"{$this->callback}\");
|
||||
{$this->object_name}.param_add({$this->json_parameter});
|
||||
{$this->object_name}.set_sort({$this->get_col_sort()});
|
||||
{$this->object_name}.set_control(\"{$this->get_dialog_box()}\");
|
||||
</script>
|
||||
|
||||
";
|
||||
|
|
@ -1046,9 +1068,10 @@ function check()
|
|||
try
|
||||
{
|
||||
$status=$p_status;
|
||||
|
||||
ob_start();
|
||||
|
||||
echo HtmlInput::title_box("Donnée", "dtr","close","","y");
|
||||
echo HtmlInput::title_box("Donnée", $this->dialog_box,"close","","y");
|
||||
printf('<form id="frm%s_%s" method="POST" onsubmit="%s.save(\'frm%s_%s\');return false;">',
|
||||
$this->object_name, $this->table->get_pk_value(),
|
||||
$this->object_name, $this->object_name,
|
||||
|
|
@ -1058,7 +1081,7 @@ function check()
|
|||
echo HtmlInput::json_to_hidden($this->json_parameter);
|
||||
echo HtmlInput::hidden("p_id", $this->table->get_pk_value());
|
||||
// button Submit and cancel
|
||||
$close=sprintf("\$('%s').remove()", "dtr");
|
||||
$close=sprintf("\$('%s').remove()", $this->dialog_box);
|
||||
// display error if any
|
||||
$this->display_error();
|
||||
echo '<ul class="aligned-block">',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue