Add a new parameter to title_box to enlarge the div, by default for

all input dialog box of ManageTable
This commit is contained in:
sparkyx 2021-03-09 13:02:44 +01:00
parent 8bac5ddfb8
commit 92f1140987
6 changed files with 83 additions and 8 deletions

View file

@ -88,7 +88,9 @@ class Manage_Table_SQL
private $icon_mod; //!< place of right or left the icon update or mod, default right, accepted value=left,right,first column for mod
private $icon_del; //!< place of right or left the icon update or mod, default right, accepted value=left,right
private $dialogbox_style;
private $dialogbox_style;
private $button_add_top; //!< place of the button add on the top, by default true
protected $title; //! < give the title of the diabox , default is Data
/**
* @brief Constructor : set the label to the column name,
* the order of the column , set the properties and the
@ -129,6 +131,20 @@ class Manage_Table_SQL
"max-width"=>"60%",
"margin-left"=> "20%");
$this->search_table=true;
$this->button_add_top=true;
$this->title=_("Donnée");
}
/**
* Set the title of the diabox , default is Donnée
* @param type $p_title
*/
function setTitle($p_title)
{
$this->title=$p_title;
}
function getTitle()
{
return $this->title;
}
/**
* Get if we can search in the table
@ -666,8 +682,18 @@ function check()
}
}
}
public function get_button_add_top()
{
return $this->button_add_top;
}
/**
public function set_button_add_top($button_add_top)
{
$this->button_add_top=$button_add_top;
return $this;
}
/**
* @brief display the data of the table
* @param $p_order is the cond or order of the rows,
* if empty the primary key will be used
@ -682,7 +708,7 @@ function check()
}
$ret=$this->table->seek($p_order, $p_array);
$nb=Database::num_row($ret);
if ($this->can_append_row()==TRUE)
if ($this->can_append_row()==TRUE && $this->button_add_top == true)
{
echo HtmlInput::button_action(" "._("Ajout"),
sprintf("%s.input('-1','%s')",
@ -952,7 +978,7 @@ function check()
/**
* @brief display into a dialog box the datarow in order
* to be appended or modified. Can be override if you need
* a more complex form
* a more complex form.
*/
function input()
{
@ -1132,7 +1158,7 @@ function check()
ob_start();
echo HtmlInput::title_box(_("Donnée"), $this->dialog_box,"close","","y");
echo HtmlInput::title_box($this->getTitle(), $this->dialog_box,"close","","y","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,
@ -1147,10 +1173,10 @@ function check()
$this->display_error();
echo '<ul class="aligned-block">',
'<li>',
HtmlInput::submit('update', _("OK")),
HtmlInput::submit('update', _("Sauver")),
'</li>',
'<li>',
HtmlInput::button_action(_("Cancel"), $close, "", "smallbutton"),
HtmlInput::button_action(_("Annuler"), $close, "", "smallbutton"),
'</li>',
'</ul>';
echo "</form>";