diff --git a/htdocs/admin/modulehelp.php b/htdocs/admin/modulehelp.php index 531e53ac459..08ddbd4ad6a 100644 --- a/htdocs/admin/modulehelp.php +++ b/htdocs/admin/modulehelp.php @@ -290,7 +290,7 @@ $text=''; if ($mode == 'desc') { - if ($moduledesc) $text.=$moduledesc.'

'; + if ($moduledesc) $text .= '
'.$moduledesc.'


'; $text.=''.$langs->trans("Version").': '.$version; diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index 72eb8240c10..4056bca0ee3 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -552,7 +552,7 @@ if ($mode == 'common') if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); // Show list of modules - + //$conf->global->MAIN_USE_KANBAN_FOR_MODULES=1; $oldfamily = ''; foreach ($orders as $key => $value) @@ -637,8 +637,12 @@ if ($mode == 'common') $familytext = empty($familyinfo[$familykey]['label']) ? $familykey : $familyinfo[$familykey]['label']; print load_fiche_titre($familytext, '', ''); - print '
'; - print ''."\n"; + if (! empty($conf->global->MAIN_USE_KANBAN_FOR_MODULES)) { + print '
'; + } else { + print '
'; + print '
'."\n"; + } $atleastoneforfamily = 0; } @@ -651,9 +655,6 @@ if ($mode == 'common') $oldfamily = $familykey; } - - - // Version (with picto warning or not) $version = $objMod->getVersion(0); $versiontrans = ''; @@ -669,212 +670,221 @@ if ($mode == 'common') $imginfo = "info_black"; } - print ''."\n"; - if (!empty($conf->global->MAIN_MODULES_SHOW_LINENUMBERS)) print ''; + if (! empty($conf->global->MAIN_USE_KANBAN_FOR_MODULES)) { + // Output Kanban + print $objMod->getKanbanView(); + } else { + print ''."\n"; + if (!empty($conf->global->MAIN_MODULES_SHOW_LINENUMBERS)) print ''; - // Picto + Name of module - print ' \n"; - - // Desc - print '\n"; - - // Help - print ''; - - // Version - print '\n"; - - // Activate/Disable and Setup (2 columns) - if (!empty($conf->global->$const_name)) // If module is already activated - { - $disableSetup = 0; - - // Link enable/disabme - print ''."\n"; + else + { + print img_object($alttext, 'generic', 'class="valignmiddle"'); + } + print ' '.$objMod->getName().''; + print "\n"; - // Link config - if (!empty($objMod->config_page_url) && !$disableSetup) - { - $backtourlparam = ''; - if ($search_keyword != '') $backtourlparam .= ($backtourlparam ? '&' : '?').'search_keyword='.$search_keyword; // No urlencode here, done later - if ($search_nature > -1) $backtourlparam .= ($backtourlparam ? '&' : '?').'search_nature='.$search_nature; - if ($search_version > -1) $backtourlparam .= ($backtourlparam ? '&' : '?').'search_version='.$search_version; - if ($search_status > -1) $backtourlparam .= ($backtourlparam ? '&' : '?').'search_status='.$search_status; - $backtourl = $_SERVER["PHP_SELF"].$backtourlparam; + // Desc + print '\n"; - if (is_array($objMod->config_page_url)) - { - print '\n"; - } - elseif (preg_match('/^([^@]+)@([^@]+)$/i', $objMod->config_page_url, $regs)) - { - print ''; - } - else - { - print ''; - } - } - else - { - print ''; - } - } - else // Module not yet activated - { - // Link enable/disable - print ''; + + // Version + print '\n"; + + // Activate/Disable and Setup (2 columns) + if (!empty($conf->global->$const_name)) // If module is already activated + { + $disableSetup = 0; + + // Link enable/disabme + print '\n"; + else + { + if (!empty($objMod->warnings_unactivation[$mysoc->country_code]) && method_exists($objMod, 'alreadyUsed') && $objMod->alreadyUsed()) { + print 'warnings_unactivation[$mysoc->country_code].'&value='.$modName.'&mode='.$mode.$param.'">'; + print img_picto($langs->trans("Activated"), 'switch_on'); + print ''; + } + else { + print ''; + print img_picto($langs->trans("Activated"), 'switch_on'); + print ''; + } + } + print ''."\n"; - // Link config - print ''; + // Link config + if (!empty($objMod->config_page_url) && !$disableSetup) + { + $backtourlparam = ''; + if ($search_keyword != '') $backtourlparam .= ($backtourlparam ? '&' : '?').'search_keyword='.$search_keyword; // No urlencode here, done later + if ($search_nature > -1) $backtourlparam .= ($backtourlparam ? '&' : '?').'search_nature='.$search_nature; + if ($search_version > -1) $backtourlparam .= ($backtourlparam ? '&' : '?').'search_version='.$search_version; + if ($search_status > -1) $backtourlparam .= ($backtourlparam ? '&' : '?').'search_status='.$search_status; + $backtourl = $_SERVER["PHP_SELF"].$backtourlparam; + + if (is_array($objMod->config_page_url)) + { + print '\n"; + } + elseif (preg_match('/^([^@]+)@([^@]+)$/i', $objMod->config_page_url, $regs)) + { + print ''; + } + else + { + print ''; + } + } + else + { + print ''; + } + } + else // Module not yet activated + { + // Link enable/disable + print '\n"; + + // Link config + print ''; + } + + print "\n"; } - - print "\n"; } if ($oldfamily) { - print "
'.++$linenum.'
'.++$linenum.''; - $alttext = ''; - //if (is_array($objMod->need_dolibarr_version)) $alttext.=($alttext?' - ':'').'Dolibarr >= '.join('.',$objMod->need_dolibarr_version); - //if (is_array($objMod->phpmin)) $alttext.=($alttext?' - ':'').'PHP >= '.join('.',$objMod->phpmin); - if (!empty($objMod->picto)) - { - if (preg_match('/^\//i', $objMod->picto)) print img_picto($alttext, $objMod->picto, 'class="valignmiddle pictomodule"', 1); - else print img_object($alttext, $objMod->picto, 'class="valignmiddle pictomodule"'); - } - else - { - print img_object($alttext, 'generic', 'class="valignmiddle"'); - } - print ' '.$objMod->getName().''; - print "'; - print nl2br($objMod->getDesc()); - print "'; - //print $form->textwithpicto('', $text, 1, $imginfo, 'minheight20', 0, 2, 1); - print ''.img_picto($langs->trans("ClickToShowDescription"), $imginfo).''; - print ''; - print $versiontrans; - if (!empty($conf->global->CHECKLASTVERSION_EXTERNALMODULE)) { - require_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php'; - if (!empty($objMod->url_last_version)) { - $newversion = getURLContent($objMod->url_last_version); - if (isset($newversion['content'])) { - if (version_compare($newversion['content'], $versiontrans) > 0) { - print " ".$newversion['content'].""; - } - } - } - } - print "'; - if (!empty($arrayofwarnings[$modName])) + // Picto + Name of module + print ' '; + $alttext = ''; + //if (is_array($objMod->need_dolibarr_version)) $alttext.=($alttext?' - ':'').'Dolibarr >= '.join('.',$objMod->need_dolibarr_version); + //if (is_array($objMod->phpmin)) $alttext.=($alttext?' - ':'').'PHP >= '.join('.',$objMod->phpmin); + if (!empty($objMod->picto)) { - print ''."\n"; + if (preg_match('/^\//i', $objMod->picto)) print img_picto($alttext, $objMod->picto, 'class="valignmiddle pictomodule"', 1); + else print img_object($alttext, $objMod->picto, 'class="valignmiddle pictomodule"'); } - if (!empty($objMod->disabled)) - { - print $langs->trans("Disabled"); - } - elseif (!empty($objMod->always_enabled) || ((!empty($conf->multicompany->enabled) && $objMod->core_enabled) && ($user->entity || $conf->entity != 1))) - { - if (method_exists($objMod, 'alreadyUsed') && $objMod->alreadyUsed()) print $langs->trans("Used"); - else { - print img_picto($langs->trans("Required"), 'switch_on', '', false, 0, 0, '', 'opacitymedium'); - //print $langs->trans("Required"); - } - if (!empty($conf->multicompany->enabled) && $user->entity) $disableSetup++; - } - else - { - if (!empty($objMod->warnings_unactivation[$mysoc->country_code]) && method_exists($objMod, 'alreadyUsed') && $objMod->alreadyUsed()) { - print 'warnings_unactivation[$mysoc->country_code].'&value='.$modName.'&mode='.$mode.$param.'">'; - print img_picto($langs->trans("Activated"), 'switch_on'); - print ''; - } - else { - print ''; - print img_picto($langs->trans("Activated"), 'switch_on'); - print ''; - } - } - print ''; + print nl2br($objMod->getDesc()); + print "'; - $i = 0; - foreach ($objMod->config_page_url as $page) - { - $urlpage = $page; - if ($i++) - { - print ''.img_picto(ucfirst($page), "setup").''; - // print ''.ucfirst($page).' '; - } - else - { - if (preg_match('/^([^@]+)@([^@]+)$/i', $urlpage, $regs)) - { - $urltouse = dol_buildpath('/'.$regs[2].'/admin/'.$regs[1], 1); - print ''.img_picto($langs->trans("Setup"), "setup", 'style="padding-right: 6px"').''; - } - else - { - $urltouse = $urlpage; - print ''.img_picto($langs->trans("Setup"), "setup", 'style="padding-right: 6px"').''; - } - } - } - print "'.img_picto($langs->trans("Setup"), "setup", 'style="padding-right: 6px"').''.img_picto($langs->trans("Setup"), "setup", 'style="padding-right: 6px"').''.img_picto($langs->trans("NothingToSetup"), "setup", 'class="opacitytransp" style="padding-right: 6px"').''; - if (!empty($objMod->always_enabled)) - { - // Should never happened - } - elseif (!empty($objMod->disabled)) - { - print $langs->trans("Disabled"); - } - else - { - // Module qualified for activation - $warningmessage = ''; + // Help + print ''; + //print $form->textwithpicto('', $text, 1, $imginfo, 'minheight20', 0, 2, 1); + print ''.img_picto($langs->trans("ClickToShowDescription"), $imginfo).''; + print ''; + print $versiontrans; + if (!empty($conf->global->CHECKLASTVERSION_EXTERNALMODULE)) { + require_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php'; + if (!empty($objMod->url_last_version)) { + $newversion = getURLContent($objMod->url_last_version); + if (isset($newversion['content'])) { + if (version_compare($newversion['content'], $versiontrans) > 0) { + print " ".$newversion['content'].""; + } + } + } + } + print "'; if (!empty($arrayofwarnings[$modName])) + { + print ''."\n"; + } + if (!empty($objMod->disabled)) { - print ''."\n"; - foreach ($arrayofwarnings[$modName] as $keycountry => $cursorwarningmessage) - { - if (preg_match('/^always/', $keycountry) || ($mysoc->country_code && preg_match('/^'.$mysoc->country_code.'/', $keycountry))) - { - $warningmessage .= ($warningmessage ? "\n" : "").$langs->trans($cursorwarningmessage, $objMod->getName(), $mysoc->country_code); - } - } + print $langs->trans("Disabled"); } - if ($objMod->isCoreOrExternalModule() == 'external' && !empty($arrayofwarningsext)) + elseif (!empty($objMod->always_enabled) || ((!empty($conf->multicompany->enabled) && $objMod->core_enabled) && ($user->entity || $conf->entity != 1))) { - print ''."\n"; - foreach ($arrayofwarningsext as $keymodule => $arrayofwarningsextbycountry) - { - $keymodulelowercase = strtolower(preg_replace('/^mod/', '', $keymodule)); - if (in_array($keymodulelowercase, $conf->modules)) // If module that request warning is on - { - foreach ($arrayofwarningsextbycountry as $keycountry => $cursorwarningmessage) - { - if (preg_match('/^always/', $keycountry) || ($mysoc->country_code && preg_match('/^'.$mysoc->country_code.'/', $keycountry))) - { - $warningmessage .= ($warningmessage ? "\n" : "").$langs->trans($cursorwarningmessage, $objMod->getName(), $mysoc->country_code, $modules[$keymodule]->getName()); - $warningmessage .= ($warningmessage ? "\n" : "").($warningmessage ? "\n" : "").$langs->trans("Module").' : '.$objMod->getName(); - if (!empty($objMod->editor_name)) $warningmessage .= ($warningmessage ? "\n" : "").$langs->trans("Publisher").' : '.$objMod->editor_name; - if (!empty($objMod->editor_name)) $warningmessage .= ($warningmessage ? "\n" : "").$langs->trans("ModuleTriggeringThisWarning").' : '.$modules[$keymodule]->getName(); - } - } - } - } + if (method_exists($objMod, 'alreadyUsed') && $objMod->alreadyUsed()) print $langs->trans("Used"); + else { + print img_picto($langs->trans("Required"), 'switch_on', '', false, 0, 0, '', 'opacitymedium'); + //print $langs->trans("Required"); + } + if (!empty($conf->multicompany->enabled) && $user->entity) $disableSetup++; } - print ''."\n"; - print ''; - print img_picto($langs->trans("Disabled"), 'switch_off'); - print "\n"; - } - print "'.img_picto($langs->trans("NothingToSetup"), "setup", 'class="opacitytransp" style="padding-right: 6px"').''; + $i = 0; + foreach ($objMod->config_page_url as $page) + { + $urlpage = $page; + if ($i++) + { + print ''.img_picto(ucfirst($page), "setup").''; + // print ''.ucfirst($page).' '; + } + else + { + if (preg_match('/^([^@]+)@([^@]+)$/i', $urlpage, $regs)) + { + $urltouse = dol_buildpath('/'.$regs[2].'/admin/'.$regs[1], 1); + print ''.img_picto($langs->trans("Setup"), "setup", 'style="padding-right: 6px"').''; + } + else + { + $urltouse = $urlpage; + print ''.img_picto($langs->trans("Setup"), "setup", 'style="padding-right: 6px"').''; + } + } + } + print "'.img_picto($langs->trans("Setup"), "setup", 'style="padding-right: 6px"').''.img_picto($langs->trans("Setup"), "setup", 'style="padding-right: 6px"').''.img_picto($langs->trans("NothingToSetup"), "setup", 'class="opacitytransp" style="padding-right: 6px"').''; + if (!empty($objMod->always_enabled)) + { + // Should never happened + } + elseif (!empty($objMod->disabled)) + { + print $langs->trans("Disabled"); + } + else + { + // Module qualified for activation + $warningmessage = ''; + if (!empty($arrayofwarnings[$modName])) + { + print ''."\n"; + foreach ($arrayofwarnings[$modName] as $keycountry => $cursorwarningmessage) + { + if (preg_match('/^always/', $keycountry) || ($mysoc->country_code && preg_match('/^'.$mysoc->country_code.'/', $keycountry))) + { + $warningmessage .= ($warningmessage ? "\n" : "").$langs->trans($cursorwarningmessage, $objMod->getName(), $mysoc->country_code); + } + } + } + if ($objMod->isCoreOrExternalModule() == 'external' && !empty($arrayofwarningsext)) + { + print ''."\n"; + foreach ($arrayofwarningsext as $keymodule => $arrayofwarningsextbycountry) + { + $keymodulelowercase = strtolower(preg_replace('/^mod/', '', $keymodule)); + if (in_array($keymodulelowercase, $conf->modules)) // If module that request warning is on + { + foreach ($arrayofwarningsextbycountry as $keycountry => $cursorwarningmessage) + { + if (preg_match('/^always/', $keycountry) || ($mysoc->country_code && preg_match('/^'.$mysoc->country_code.'/', $keycountry))) + { + $warningmessage .= ($warningmessage ? "\n" : "").$langs->trans($cursorwarningmessage, $objMod->getName(), $mysoc->country_code, $modules[$keymodule]->getName()); + $warningmessage .= ($warningmessage ? "\n" : "").($warningmessage ? "\n" : "").$langs->trans("Module").' : '.$objMod->getName(); + if (!empty($objMod->editor_name)) $warningmessage .= ($warningmessage ? "\n" : "").$langs->trans("Publisher").' : '.$objMod->editor_name; + if (!empty($objMod->editor_name)) $warningmessage .= ($warningmessage ? "\n" : "").$langs->trans("ModuleTriggeringThisWarning").' : '.$modules[$keymodule]->getName(); + } + } + } + } + } + print ''."\n"; + print ''; + print img_picto($langs->trans("Disabled"), 'switch_off'); + print "\n"; + } + print "'.img_picto($langs->trans("NothingToSetup"), "setup", 'class="opacitytransp" style="padding-right: 6px"').'
\n"; - print '
'; + if (! empty($conf->global->MAIN_USE_KANBAN_FOR_MODULES)) { + print ''; + } else { + print "\n"; + print ''; + } } dol_fiche_end(); diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index 278e53eef6e..c14a789d3c5 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -2256,4 +2256,65 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it { return $this->_remove(array(), $options); } + + + /** + * Return Kanban view of a module + * + * @return string HTML code of Kanban view + */ + public function getKanbanView() + { + global $conf, $langs; + + // Define imginfo + $imginfo = "info"; + if ($this->isCoreOrExternalModule() == 'external') + { + $imginfo = "info_black"; + } + + $const_name = 'MAIN_MODULE_'.strtoupper(preg_replace('/^mod/i', '', get_class($this))); + + // Activate/Disable and Setup (2 columns) + if (!empty($conf->global->$const_name)) // If module is already activated + { + $disableSetup = 0; + + } else { + + + } + + print ' +
+
+ '; + + $alttext = ''; + //if (is_array($objMod->need_dolibarr_version)) $alttext.=($alttext?' - ':'').'Dolibarr >= '.join('.',$objMod->need_dolibarr_version); + //if (is_array($objMod->phpmin)) $alttext.=($alttext?' - ':'').'PHP >= '.join('.',$objMod->phpmin); + if (!empty($this->picto)) + { + if (preg_match('/^\//i', $this->picto)) print img_picto($alttext, $this->picto, 'class="inline-block valignmiddle width50"', 1); + else print img_object($alttext, $this->picto, 'class="inline-block valignmiddle width50"'); + } + else + { + print img_object($alttext, 'generic', 'class="inline-block valignmiddle width50"'); + } + + print ' +
+ '.$this->getName().' + '.nl2br($this->getDesc()).''; + + print ''.img_picto($langs->trans("ClickToShowDescription"), $imginfo).''; + + print ' + '.$this->getVersion(1).' +
+
+
'; + } } diff --git a/htdocs/theme/eldy/info-box.inc.php b/htdocs/theme/eldy/info-box.inc.php index 033637759c9..88357f02404 100644 --- a/htdocs/theme/eldy/info-box.inc.php +++ b/htdocs/theme/eldy/info-box.inc.php @@ -316,6 +316,13 @@ if (GETPOSTISSET('THEME_AGRESSIVENESS_RATIO')) $conf->global->THEME_AGRESSIVENES height: 0; } +.info-box-module { + min-width: 350px; + max-width: 350px; +} +.info-box-module .info-box-content { + height: 7em; +} /* Disabled. This break the responsive on smartphone .box{ overflow: visible; @@ -327,4 +334,8 @@ if (GETPOSTISSET('THEME_AGRESSIVENESS_RATIO')) $conf->global->THEME_AGRESSIVENES .box-flex-container { margin: 0 0 0 0 !important; } + + .info-box-module { + width: 280px; + } }