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

@ -4009,4 +4009,18 @@ function check_receipt_size(p_max_size,p_info)
document.getElementById("receipt_info_id").innerHTML=""; document.getElementById("receipt_info_id").innerHTML="";
document.getElementById("form_file").submit(); document.getElementById("form_file").submit();
return true; return true;
}
/**
* @brief toggle size of a div : fullsize or normal
*
*/
function full_size(p_div) {
div_dom=document.getElementById(p_div);
if ( ! div_dom ) return;
if ( div_dom.hasClassName('fullsize')) {
div_dom.removeClassName('fullsize');$('size_'+p_div).innerHTML='';
} else {
div_dom.addClassName('fullsize');$('size_'+p_div).innerHTML='';
}
} }

View file

@ -2667,3 +2667,23 @@ span.tagcell {
padding: 0.25em 1em 0.25em 1em; padding: 0.25em 1em 0.25em 1em;
font-family: bold; font-family: bold;
} }
/**
* set a element full size
*/
.fullsize {
width:100% !important;
height: 100% !important;
overflow:auto !important;
top:0px !important;
position:fixed !important;
left:0px !important;
}
/*********************************************
* If a input is incorrect
*/
.input-error {
border:1px dotted red !important;
color:darkred !important;
}

View file

@ -837,7 +837,7 @@ class HtmlInput
* @return type * @return type
*/ */
static function title_box($p_name, $p_div, $p_mod="close", $p_js="", static function title_box($p_name, $p_div, $p_mod="close", $p_js="",
$p_draggable="n") $p_draggable="n",$p_enlarge='n')
{ {
$p_div=strip_tags($p_div); $p_div=strip_tags($p_div);
$r='<div class="bxbutton">'; $r='<div class="bxbutton">';
@ -847,6 +847,9 @@ class HtmlInput
{ {
$r.=Icon_Action::draggable($p_div); $r.=Icon_Action::draggable($p_div);
} }
if ( $p_enlarge=='y') {
$r.=Icon_Action::full_size($p_div);
}
if ($p_mod=='close') if ($p_mod=='close')
{ {
$r.=Icon_Action::close($p_div, $p_js); $r.=Icon_Action::close($p_div, $p_js);

View file

@ -390,4 +390,11 @@ class Icon_Action
if ( $p_value == 0 ) { return \Icon_Action::checked($p_id, $p_javascript); } if ( $p_value == 0 ) { return \Icon_Action::checked($p_id, $p_javascript); }
if ( $p_value == 1 ) { return \Icon_Action::unchecked($p_id, $p_javascript);} if ( $p_value == 1 ) { return \Icon_Action::unchecked($p_id, $p_javascript);}
} }
static function full_size($p_div) {
$js=sprintf("full_size('%s')",$p_div);
$icon="&#xe82a;";
$r=sprintf('<span id="size_%s" onclick="%s" class="icon smallicon">%s</span>',
$p_div,$js,$icon);
return $r;
}
} }

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_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 $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, * @brief Constructor : set the label to the column name,
* the order of the column , set the properties and the * the order of the column , set the properties and the
@ -129,6 +131,20 @@ class Manage_Table_SQL
"max-width"=>"60%", "max-width"=>"60%",
"margin-left"=> "20%"); "margin-left"=> "20%");
$this->search_table=true; $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 * 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 * @brief display the data of the table
* @param $p_order is the cond or order of the rows, * @param $p_order is the cond or order of the rows,
* if empty the primary key will be used * if empty the primary key will be used
@ -682,7 +708,7 @@ function check()
} }
$ret=$this->table->seek($p_order, $p_array); $ret=$this->table->seek($p_order, $p_array);
$nb=Database::num_row($ret); $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"), echo HtmlInput::button_action(" "._("Ajout"),
sprintf("%s.input('-1','%s')", sprintf("%s.input('-1','%s')",
@ -952,7 +978,7 @@ function check()
/** /**
* @brief display into a dialog box the datarow in order * @brief display into a dialog box the datarow in order
* to be appended or modified. Can be override if you need * to be appended or modified. Can be override if you need
* a more complex form * a more complex form.
*/ */
function input() function input()
{ {
@ -1132,7 +1158,7 @@ function check()
ob_start(); 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;">', 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->table->get_pk_value(),
$this->object_name, $this->object_name, $this->object_name, $this->object_name,
@ -1147,10 +1173,10 @@ function check()
$this->display_error(); $this->display_error();
echo '<ul class="aligned-block">', echo '<ul class="aligned-block">',
'<li>', '<li>',
HtmlInput::submit('update', _("OK")), HtmlInput::submit('update', _("Sauver")),
'</li>', '</li>',
'<li>', '<li>',
HtmlInput::button_action(_("Cancel"), $close, "", "smallbutton"), HtmlInput::button_action(_("Annuler"), $close, "", "smallbutton"),
'</li>', '</li>',
'</ul>'; '</ul>';
echo "</form>"; echo "</form>";

View file

@ -83,4 +83,9 @@ include_once NOALYSS_INCLUDE."/lib/icon_action.class.php";
</p> </p>
<p> <p>
Comment<?php echo Icon_Action::comment("Allo ? l'heure d'été ?")?> Comment<?php echo Icon_Action::comment("Allo ? l'heure d'été ?")?>
</p>
<p>
<div id="enlarge_it" class="inner_box">
enlarge <?php echo Icon_Action::full_size("enlarge_it")?>
</div>
</p> </p>