From 0da4360b9fb77db7130aa514077aa8aac8025ec5 Mon Sep 17 00:00:00 2001 From: Quatadah Nasdami Date: Mon, 11 Jul 2022 17:30:11 +0200 Subject: [PATCH 1/5] almost done --- htdocs/core/lib/functions.lib.php | 17 +++++++++------ htdocs/projet/card.php | 36 +++++++++++++++---------------- 2 files changed, 29 insertions(+), 24 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index bf41b5a624a..e7c0244387f 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -10343,6 +10343,7 @@ function dolGetStatus($statusLabel = '', $statusLabelShort = '', $html = '', $st * @param string $actionType default, delete, danger * @param string $url the url for link * @param string $id attribute id of button + * @param bboolean $isDropdown is dropdown button * @param int $userRight user action right * // phpcs:disable * @param array $params = [ // Various params for future : recommended rather than adding more function arguments @@ -10363,16 +10364,20 @@ function dolGetStatus($statusLabel = '', $statusLabelShort = '', $html = '', $st * // phpcs:enable * @return string html button */ -function dolGetButtonAction($label, $html = '', $actionType = 'default', $url = '', $id = '', $userRight = 1, $params = array()) +function dolGetButtonAction($label, $html = '', $actionType = 'default', $url = '', $id = '', $isDropdown = false, $userRight = 1, $params = array()) { global $hookmanager, $action, $object, $langs; - $class = 'butAction'; - if ($actionType == 'danger' || $actionType == 'delete') { - $class = 'butActionDelete'; - if (!empty($url) && strpos($url, 'token=') === false) $url .= '&token='.newToken(); + //var_dump($isDropdown); + if ($isDropdown) + $class = "dropdown-item"; + else { + $class = 'butAction'; + if ($actionType == 'danger' || $actionType == 'delete') { + $class = 'butActionDelete'; + if (!empty($url) && strpos($url, 'token=') === false) $url .= '&token='.newToken(); + } } - $attr = array( 'class' => $class, 'href' => empty($url) ? '' : $url, diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 3193c410679..0864a5b53f6 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -1316,56 +1316,56 @@ if ($action == 'create' && $user->rights->projet->creer) { } } - // Add button to create objects from project + if (!empty($conf->global->PROJECT_SHOW_CREATE_OBJECT_BUTTON)) { - print'"; + print ""; } - // Clone if ($user->rights->projet->creer) { if ($userWrite > 0) { From 873745a178ab3bdca28cff576ea4e998d25f53be Mon Sep 17 00:00:00 2001 From: Quatadah Nasdami Date: Mon, 25 Jul 2022 20:13:54 +0200 Subject: [PATCH 2/5] I included the boolean in the `$params` and resolved the margin issue. --- htdocs/core/lib/functions.lib.php | 8 ++++---- htdocs/projet/card.php | 22 +++++++++++----------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index e7c0244387f..3df96d4e057 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -10343,7 +10343,6 @@ function dolGetStatus($statusLabel = '', $statusLabelShort = '', $html = '', $st * @param string $actionType default, delete, danger * @param string $url the url for link * @param string $id attribute id of button - * @param bboolean $isDropdown is dropdown button * @param int $userRight user action right * // phpcs:disable * @param array $params = [ // Various params for future : recommended rather than adding more function arguments @@ -10359,17 +10358,18 @@ function dolGetStatus($statusLabel = '', $statusLabelShort = '', $html = '', $st * 'cancel-btn-label' => '', // Overide label of cancel button, if empty default label use "CloseDialog" lang key * 'content' => '', // Overide text of content, if empty default content use "ConfirmBtnCommonContent" lang key * 'modal' => true, // true|false to display dialog as a modal (with dark background) + * 'isDropDrown' => false, // true|false to display dialog as a dropdown (with dark background) * ], * ] * // phpcs:enable * @return string html button */ -function dolGetButtonAction($label, $html = '', $actionType = 'default', $url = '', $id = '', $isDropdown = false, $userRight = 1, $params = array()) +function dolGetButtonAction($label, $html = '', $actionType = 'default', $url = '', $id = '', $userRight = 1, $params = array()) { global $hookmanager, $action, $object, $langs; - //var_dump($isDropdown); - if ($isDropdown) + //var_dump($params); + if ($params['isDropdown']) $class = "dropdown-item"; else { $class = 'butAction'; diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 0864a5b53f6..7353323b60d 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -1319,48 +1319,48 @@ if ($action == 'create' && $user->rights->projet->creer) { if (!empty($conf->global->PROJECT_SHOW_CREATE_OBJECT_BUTTON)) { print'