[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 09/13: New Icon_Action for hidding or showing
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 09/13: New Icon_Action for hidding or showing a DIV |
Date: |
Sun, 16 Oct 2022 17:26:14 -0400 (EDT) |
sparkyx pushed a commit to branch master
in repository noalyss.
commit b382455dd0a1dc59f2d2885ff69dc049ff91972f
Author: sparkyx <danydb@noalyss.eu>
AuthorDate: Sun Oct 16 23:10:31 2022 +0200
New Icon_Action for hidding or showing a DIV
---
html/js/noalyss_script.js | 20 ++++++++++++++++----
include/lib/icon_action.class.php | 15 +++++++++++++++
scenario/icon_actionTest.php | 8 +++++++-
3 files changed, 38 insertions(+), 5 deletions(-)
diff --git a/html/js/noalyss_script.js b/html/js/noalyss_script.js
index 60b186f52..8840550ab 100644
--- a/html/js/noalyss_script.js
+++ b/html/js/noalyss_script.js
@@ -369,22 +369,34 @@ function format_date(p_object)
*@brief check if the object is hidden or show and perform the opposite,
* show the hidden obj or hide the shown one
*@param name of the object
+ * @param button id of the button
+ * @param rotate : if true with rotate the object of p_button otherwise
*/
-function toggleHideShow(p_obj, p_button)
+function toggleHideShow(p_obj, p_button,rotate)
{
var stat = g(p_obj).style.display;
- var str = g(p_button).value;
+ var str = g(p_button).value??"";
if (stat === 'none')
{
- show(p_obj);
+ $(p_obj).show()
str = str.replace(/Afficher/, content[62]);
g(p_button).value = str;
} else
{
- hide(p_obj);
+ $(p_obj).hide();
str = str.replace(/Cacher/, content[63]);
g(p_button).value = str;
}
+ if ( ! rotate ) return;
+ if ( stat == "none") {
+ g(p_button).addClassName ("icon-up-open-1")
+ g(p_button).removeClassName(" icon-down-open-2")
+ } else {
+ g(p_button).removeClassName("icon-up-open-1")
+ g(p_button).addClassName(" icon-down-open-2")
+
+ }
+
}
/**
*@brief open popup with the search windows
diff --git a/include/lib/icon_action.class.php
b/include/lib/icon_action.class.php
index 65a3485ee..ef6d0d7c0 100644
--- a/include/lib/icon_action.class.php
+++ b/include/lib/icon_action.class.php
@@ -471,4 +471,19 @@ class Icon_Action
$r='<span id="'.uniqid().'" class="smallicon icon"
style="background-color:yellow"
onclick="document.getElementById(\''.$p_domid.'\').show()"></span>';
return $r;
}
+
+ /**
+ * @brief hide or display an element, to be used for an accordon
+ * @param $p_id ip of the icon
+ * @param $p_id_to_hide element to hide or show
+ * @return HTML string
+ */
+ static function toggle_hide($p_id,$p_id_to_hide)
+ {
+
$javascript=sprintf("toggleHideShow('%s','%s',true)",$p_id_to_hide,$p_id);
+ $r=sprintf('<i id="%s" onclick="%s" class="smallicon icon
icon-down-open-2" style="margin-left:5px"></i>',
+ $p_id,$javascript
+ );
+ return $r;
+ }
}
diff --git a/scenario/icon_actionTest.php b/scenario/icon_actionTest.php
index f35ea25a9..551f5d590 100644
--- a/scenario/icon_actionTest.php
+++ b/scenario/icon_actionTest.php
@@ -111,4 +111,10 @@ include_once NOALYSS_INCLUDE."/lib/icon_action.class.php";
<p>
Increase INPUT TEXT Element
<input type="text" id="text_element" size="20"><?php echo
Icon_Action::longer("text_element",50)?>
-</p>
\ No newline at end of file
+</p>
+<p>
+ <?php echo \Icon_Action::toggle_hide(uniqid(),"example_div")?>
+ <div id="example_div" style="display:none">
+ Ceci est caché
+</div>
+</div>
- [Noalyss-commit] [noalyss] branch master updated (e133e0ca8 -> 75d59f1b5), Dany De Bontridder, 2022/10/16
- [Noalyss-commit] [noalyss] 02/13: Cosmetic, Dany De Bontridder, 2022/10/16
- [Noalyss-commit] [noalyss] 11/13: - Override the function __toString to comply with xdebug - function Card_Property::input ; the build of the HtmlInput is done is a separated function Card_Property::build_input to ease the override of the input function, Dany De Bontridder, 2022/10/16
- [Noalyss-commit] [noalyss] 09/13: New Icon_Action for hidding or showing a DIV,
Dany De Bontridder <=
- [Noalyss-commit] [noalyss] 12/13: Development : tools for debugging, add button for the $_REQUEST and correct a bug in dbg.php, Dany De Bontridder, 2022/10/16
- [Noalyss-commit] [noalyss] 13/13: merge, Dany De Bontridder, 2022/10/16
- [Noalyss-commit] [noalyss] 01/13: Improve DEBUG, Dany De Bontridder, 2022/10/16
- [Noalyss-commit] [noalyss] 05/13: add magic function toString, Dany De Bontridder, 2022/10/16
- [Noalyss-commit] [noalyss] 06/13: typo, Dany De Bontridder, 2022/10/16
- [Noalyss-commit] [noalyss] 08/13: Development : new tools for debugging in the new class \Noalyss\Dbg (dbg.php);, Dany De Bontridder, 2022/10/16
- [Noalyss-commit] [noalyss] 10/13: - Override the function __toString to comply with xdebug - Correct bug in input_switch.class.php when there is several input_switch - FicheDef the insertAttribut can have an order, usefull when installing new category + attribute, Dany De Bontridder, 2022/10/16
- [Noalyss-commit] [noalyss] 04/13: Cosmetic : warning, Dany De Bontridder, 2022/10/16
- [Noalyss-commit] [noalyss] 07/13: Task #0001755: Dans Administration - dossier - «Sauvegarde» et non «Backup», Dany De Bontridder, 2022/10/16
- [Noalyss-commit] [noalyss] 03/13: Code cleaning pg_fetch_array, Dany De Bontridder, 2022/10/16