From 4709a51c8464a44efa79b6d7d354eeb4bb87c252 Mon Sep 17 00:00:00 2001 From: BENKE Charlie Date: Wed, 5 Aug 2015 15:19:00 +0200 Subject: [PATCH 1/8] Add number of collected tabs and hook/trigger Add number of collected tabs Add trigger based on tabs name add hook at end of tabs and at the footer of page --- htdocs/core/lib/functions.lib.php | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 6074f6fe841..8a2ac9d8dd0 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -702,8 +702,9 @@ function dol_fiche_head($links=array(), $active='0', $title='', $notab=0, $picto */ function dol_get_fiche_head($links=array(), $active='0', $title='', $notab=0, $picto='', $pictoisfullpath=0) { - global $conf,$langs; - + global $conf,$langs, $hookmanager;; + + $tabsname=str_replace ("@","",$picto); $out="\n".'
'."\n"; // Show title @@ -731,7 +732,8 @@ function dol_get_fiche_head($links=array(), $active='0', $title='', $notab=0, $p // if =0 we don't use the feature $limittoshow=(empty($conf->global->MAIN_MAXTABS_IN_CARD)?99:$conf->global->MAIN_MAXTABS_IN_CARD); $displaytab=0; - + $nbintab=0; + for ($i = 0 ; $i <= $maxkey ; $i++) { if ((is_numeric($active) && $i == $active) || (! empty($links[$i][2]) && ! is_numeric($active) && $active == $links[$i][2])) @@ -746,6 +748,8 @@ function dol_get_fiche_head($links=array(), $active='0', $title='', $notab=0, $p if ($i <= $limittoshow || $isactive ) { + if ($isactive) $hookmanager->initHooks(array($tabsname."-".$links[$i][2]. '-tabs')); + $out.='
'; if (isset($links[$i][2]) && $links[$i][2] == 'image') { @@ -787,6 +791,7 @@ function dol_get_fiche_head($links=array(), $active='0', $title='', $notab=0, $p $outmore.=''.$links[$i][1].''."\n"; $outmore.='
'; + $nbintab++; } $displaytab=$i; } @@ -795,7 +800,7 @@ function dol_get_fiche_head($links=array(), $active='0', $title='', $notab=0, $p { $tabsname=str_replace("@", "", $picto); $out.='
'; - $out.=''.$langs->trans("More").'...'; + $out.=''.$langs->trans("More").' '.$nbintab.'.''; $out.='
'.$outmore.'
'; $out.="
\n"; @@ -809,6 +814,9 @@ function dol_get_fiche_head($links=array(), $active='0', $title='', $notab=0, $p if (! $notab) $out.="\n".'
'."\n"; + $parameters=array(); + $reshook=$hookmanager->executeHooks('printTabsHead',$parameters); // Note that $action and $object may have been modified by some hooks + return $out; } @@ -4898,7 +4906,7 @@ function complete_head_from_modules($conf,$langs,$object,&$head,&$h,$type,$mode= */ function printCommonFooter($zone='private') { - global $conf; + global $conf, $hookmanager; global $micro_start_time; if ($zone == 'private') print "\n".''."\n"; @@ -4976,6 +4984,9 @@ function printCommonFooter($zone='private') print "End of log output -->\n"; } + $parameters=array(); + $reshook=$hookmanager->executeHooks('printCommonFooter',$parameters); // Note that $action and $object may have been modified by some hooks + } /** From f5d4cc5f898cfef7cb157261b4af082301faa931 Mon Sep 17 00:00:00 2001 From: BENKE Charlie Date: Thu, 6 Aug 2015 16:23:34 +0200 Subject: [PATCH 2/8] Update functions.lib.php --- htdocs/core/lib/functions.lib.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 8a2ac9d8dd0..da2a301fa59 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -4986,7 +4986,6 @@ function printCommonFooter($zone='private') $parameters=array(); $reshook=$hookmanager->executeHooks('printCommonFooter',$parameters); // Note that $action and $object may have been modified by some hooks - } /** From 187c40aca9b77b1371a815251efa36bf6588f88b Mon Sep 17 00:00:00 2001 From: BENKE Charlie Date: Thu, 6 Aug 2015 18:20:09 +0200 Subject: [PATCH 3/8] Update functions.lib.php --- htdocs/core/lib/functions.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index da2a301fa59..bf05f53f897 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -702,7 +702,7 @@ function dol_fiche_head($links=array(), $active='0', $title='', $notab=0, $picto */ function dol_get_fiche_head($links=array(), $active='0', $title='', $notab=0, $picto='', $pictoisfullpath=0) { - global $conf,$langs, $hookmanager;; + global $conf,$langs, $hookmanager; $tabsname=str_replace ("@","",$picto); $out="\n".'
'."\n"; From 049805e926fae964631a6a9eb307a10a2c567742 Mon Sep 17 00:00:00 2001 From: BENKE Charlie Date: Mon, 10 Aug 2015 19:47:12 +0200 Subject: [PATCH 4/8] Update functions.lib.php Div enough on sub-menu case (project/task) --- htdocs/core/lib/functions.lib.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index bf05f53f897..28bf2e67e45 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -810,8 +810,6 @@ function dol_get_fiche_head($links=array(), $active='0', $title='', $notab=0, $p $out.=""; } - $out.="
\n"; - if (! $notab) $out.="\n".'
'."\n"; $parameters=array(); From 6801504755f691f23559e15ce5a11af6d9a339ec Mon Sep 17 00:00:00 2001 From: BENKE Charlie Date: Tue, 11 Aug 2015 23:51:02 +0200 Subject: [PATCH 5/8] Update functions.lib.php some bugs sorry --- htdocs/core/lib/functions.lib.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 28bf2e67e45..9c071b80798 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -800,13 +800,13 @@ function dol_get_fiche_head($links=array(), $active='0', $title='', $notab=0, $p { $tabsname=str_replace("@", "", $picto); $out.='
'; - $out.=''.$langs->trans("More").' '.$nbintab.'.''; + $out.=''.$langs->trans("More").' '.$nbintab.''; $out.='
'.$outmore.'
'; $out.="
\n"; $out.=""; } From a3db26adfd335a166d97bc4a7b2b85c0d694599c Mon Sep 17 00:00:00 2001 From: BENKE Charlie Date: Fri, 14 Aug 2015 19:13:13 +0200 Subject: [PATCH 6/8] Update functions.lib.php change context init method --- htdocs/core/lib/functions.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 9c071b80798..48271de3717 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -748,7 +748,7 @@ function dol_get_fiche_head($links=array(), $active='0', $title='', $notab=0, $p if ($i <= $limittoshow || $isactive ) { - if ($isactive) $hookmanager->initHooks(array($tabsname."-".$links[$i][2]. '-tabs')); + if ($isactive) $hookparameter = $tabsname."-".$links[$i][2]. '-tabs'; $out.='
'; if (isset($links[$i][2]) && $links[$i][2] == 'image') @@ -812,7 +812,7 @@ function dol_get_fiche_head($links=array(), $active='0', $title='', $notab=0, $p if (! $notab) $out.="\n".'
'."\n"; - $parameters=array(); + $parameters=array('context'=>$hookparameter); $reshook=$hookmanager->executeHooks('printTabsHead',$parameters); // Note that $action and $object may have been modified by some hooks return $out; From daa68efdd3e7aa7e185713f29d37c8606d0d6c27 Mon Sep 17 00:00:00 2001 From: BENKE Charlie Date: Fri, 14 Aug 2015 23:23:44 +0200 Subject: [PATCH 7/8] Update functions.lib.php better context change --- htdocs/core/lib/functions.lib.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 48271de3717..65659a1dce4 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -812,7 +812,8 @@ function dol_get_fiche_head($links=array(), $active='0', $title='', $notab=0, $p if (! $notab) $out.="\n".'
'."\n"; - $parameters=array('context'=>$hookparameter); + array_push($hookmanager->contextarray,$hookparameter); + $parameters=array(); $reshook=$hookmanager->executeHooks('printTabsHead',$parameters); // Note that $action and $object may have been modified by some hooks return $out; From 5ee00cf97bbec07b76f9f4e5f33f70355545b515 Mon Sep 17 00:00:00 2001 From: BENKE Charlie Date: Mon, 31 Aug 2015 05:09:21 +0200 Subject: [PATCH 8/8] change made --- htdocs/core/lib/functions.lib.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 65659a1dce4..37bdcfc419c 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -812,8 +812,7 @@ function dol_get_fiche_head($links=array(), $active='0', $title='', $notab=0, $p if (! $notab) $out.="\n".'
'."\n"; - array_push($hookmanager->contextarray,$hookparameter); - $parameters=array(); + $parameters=array( 'tabname' => $hookparameter); $reshook=$hookmanager->executeHooks('printTabsHead',$parameters); // Note that $action and $object may have been modified by some hooks return $out;