[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 03/04: Add a new parameter to title_box to en
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 03/04: Add a new parameter to title_box to enlarge the div, by default for all input dialog box of ManageTable |
Date: |
Tue, 9 Mar 2021 16:47:52 -0500 (EST) |
sparkyx pushed a commit to branch master
in repository noalyss.
commit 92f1140987d88739cba200b8b41576c355cd41d0
Author: sparkyx <danydb@noalyss.eu>
AuthorDate: Tue Mar 9 13:02:44 2021 +0100
Add a new parameter to title_box to enlarge the div, by default for
all input dialog box of ManageTable
---
html/js/scripts.js | 14 ++++++++++++
html/style-classic7.css | 20 +++++++++++++++++
include/lib/html_input.class.php | 5 ++++-
include/lib/icon_action.class.php | 7 ++++++
include/lib/manage_table_sql.class.php | 40 ++++++++++++++++++++++++++++------
scenario/icon_actionTest.php | 5 +++++
6 files changed, 83 insertions(+), 8 deletions(-)
diff --git a/html/js/scripts.js b/html/js/scripts.js
index 5fce465..8218c27 100644
--- a/html/js/scripts.js
+++ b/html/js/scripts.js
@@ -4009,4 +4009,18 @@ function check_receipt_size(p_max_size,p_info)
document.getElementById("receipt_info_id").innerHTML="";
document.getElementById("form_file").submit();
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='';
+ }
+
}
\ No newline at end of file
diff --git a/html/style-classic7.css b/html/style-classic7.css
index 2206679..0ceb33a 100644
--- a/html/style-classic7.css
+++ b/html/style-classic7.css
@@ -2667,3 +2667,23 @@ span.tagcell {
padding: 0.25em 1em 0.25em 1em;
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;
+
+ }
\ No newline at end of file
diff --git a/include/lib/html_input.class.php b/include/lib/html_input.class.php
index e43c0ff..3ed7595 100755
--- a/include/lib/html_input.class.php
+++ b/include/lib/html_input.class.php
@@ -837,7 +837,7 @@ class HtmlInput
* @return type
*/
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);
$r='<div class="bxbutton">';
@@ -847,6 +847,9 @@ class HtmlInput
{
$r.=Icon_Action::draggable($p_div);
}
+ if ( $p_enlarge=='y') {
+ $r.=Icon_Action::full_size($p_div);
+ }
if ($p_mod=='close')
{
$r.=Icon_Action::close($p_div, $p_js);
diff --git a/include/lib/icon_action.class.php
b/include/lib/icon_action.class.php
index eef3a58..e983712 100644
--- a/include/lib/icon_action.class.php
+++ b/include/lib/icon_action.class.php
@@ -390,4 +390,11 @@ class Icon_Action
if ( $p_value == 0 ) { return \Icon_Action::checked($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="";
+ $r=sprintf('<span id="size_%s" onclick="%s" class="icon
smallicon">%s</span>',
+ $p_div,$js,$icon);
+ return $r;
+ }
}
diff --git a/include/lib/manage_table_sql.class.php
b/include/lib/manage_table_sql.class.php
index ff50a7b..2b56a3e 100644
--- a/include/lib/manage_table_sql.class.php
+++ b/include/lib/manage_table_sql.class.php
@@ -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>";
diff --git a/scenario/icon_actionTest.php b/scenario/icon_actionTest.php
index 35c33a9..c9037a1 100644
--- a/scenario/icon_actionTest.php
+++ b/scenario/icon_actionTest.php
@@ -83,4 +83,9 @@ include_once NOALYSS_INCLUDE."/lib/icon_action.class.php";
</p>
<p>
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>
\ No newline at end of file
- [Noalyss-commit] [noalyss] branch master updated (faaeb16 -> f92a724), Dany De Bontridder, 2021/03/09
- [Noalyss-commit] [noalyss] 03/04: Add a new parameter to title_box to enlarge the div, by default for all input dialog box of ManageTable,
Dany De Bontridder <=
- [Noalyss-commit] [noalyss] 02/04: Bug limit card, Dany De Bontridder, 2021/03/09
- [Noalyss-commit] [noalyss] 04/04: Fix special char with input-select, Dany De Bontridder, 2021/03/09
- [Noalyss-commit] [noalyss] 01/04: Bug : Bank , no warning if balance incorrect when the first amount is 0 Protect $_REQUEST , do no replace the first amount when it is corrected, Dany De Bontridder, 2021/03/09