2
0
forked from Wavyzz/dolibarr

Work on Kanban view for modules

This commit is contained in:
Laurent Destailleur
2020-03-27 01:59:17 +01:00
parent a02e3e1e61
commit 354cb8c1b0
4 changed files with 279 additions and 197 deletions

View File

@@ -290,7 +290,7 @@ $text='';
if ($mode == 'desc') if ($mode == 'desc')
{ {
if ($moduledesc) $text.=$moduledesc.'<br><br>'; if ($moduledesc) $text .= '<br>'.$moduledesc.'<br><br><br>';
$text.='<strong>'.$langs->trans("Version").':</strong> '.$version; $text.='<strong>'.$langs->trans("Version").':</strong> '.$version;

View File

@@ -552,7 +552,7 @@ if ($mode == 'common')
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
// Show list of modules // Show list of modules
//$conf->global->MAIN_USE_KANBAN_FOR_MODULES=1;
$oldfamily = ''; $oldfamily = '';
foreach ($orders as $key => $value) foreach ($orders as $key => $value)
@@ -637,8 +637,12 @@ if ($mode == 'common')
$familytext = empty($familyinfo[$familykey]['label']) ? $familykey : $familyinfo[$familykey]['label']; $familytext = empty($familyinfo[$familykey]['label']) ? $familykey : $familyinfo[$familykey]['label'];
print load_fiche_titre($familytext, '', ''); print load_fiche_titre($familytext, '', '');
if (! empty($conf->global->MAIN_USE_KANBAN_FOR_MODULES)) {
print '<div class="box-flex-container">';
} else {
print '<div class="div-table-responsive">'; print '<div class="div-table-responsive">';
print '<table class="tagtable liste" summary="list_of_modules">'."\n"; print '<table class="tagtable liste" summary="list_of_modules">'."\n";
}
$atleastoneforfamily = 0; $atleastoneforfamily = 0;
} }
@@ -651,9 +655,6 @@ if ($mode == 'common')
$oldfamily = $familykey; $oldfamily = $familykey;
} }
// Version (with picto warning or not) // Version (with picto warning or not)
$version = $objMod->getVersion(0); $version = $objMod->getVersion(0);
$versiontrans = ''; $versiontrans = '';
@@ -669,6 +670,10 @@ if ($mode == 'common')
$imginfo = "info_black"; $imginfo = "info_black";
} }
if (! empty($conf->global->MAIN_USE_KANBAN_FOR_MODULES)) {
// Output Kanban
print $objMod->getKanbanView();
} else {
print '<tr class="oddeven">'."\n"; print '<tr class="oddeven">'."\n";
if (!empty($conf->global->MAIN_MODULES_SHOW_LINENUMBERS)) print '<td width="20px">'.++$linenum.'</td>'; if (!empty($conf->global->MAIN_MODULES_SHOW_LINENUMBERS)) print '<td width="20px">'.++$linenum.'</td>';
@@ -870,12 +875,17 @@ if ($mode == 'common')
print "</tr>\n"; print "</tr>\n";
} }
}
if ($oldfamily) if ($oldfamily)
{ {
if (! empty($conf->global->MAIN_USE_KANBAN_FOR_MODULES)) {
print '</div>';
} else {
print "</table>\n"; print "</table>\n";
print '</div>'; print '</div>';
} }
}
dol_fiche_end(); dol_fiche_end();

View File

@@ -2256,4 +2256,65 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
{ {
return $this->_remove(array(), $options); 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 '
<div class="box-flex-item info-box-module">
<div class="info-box info-box-sm info-box-weather info-box-weather-level4">
<span class="info-box-icon">';
$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 '<img src="/dolibarr_dev/htdocs/theme/eldy/img/weather/weather-storm.png" alt="" class="inline-block valignmiddle width50"></span>
<div class="info-box-content info-box-text-module">
<span class="info-box-title">'.$this->getName().'</span>
<span class="info-box-desc twolinesmax">'.nl2br($this->getDesc()).'</span>';
print '<a href="javascript:document_preview(\''.DOL_URL_ROOT.'/admin/modulehelp.php?id='.$this->numero.'\',\'text/html\',\''.dol_escape_js($langs->trans("Module")).'\')">'.img_picto($langs->trans("ClickToShowDescription"), $imginfo).'</a>';
print '
<span class="progress-description"><span class="opacitymedium">'.$this->getVersion(1).'</span></span>
</div><!-- /.info-box-content -->
</div><!-- /.info-box -->
</div>';
}
} }

View File

@@ -316,6 +316,13 @@ if (GETPOSTISSET('THEME_AGRESSIVENESS_RATIO')) $conf->global->THEME_AGRESSIVENES
height: 0; 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 /* Disabled. This break the responsive on smartphone
.box{ .box{
overflow: visible; overflow: visible;
@@ -327,4 +334,8 @@ if (GETPOSTISSET('THEME_AGRESSIVENESS_RATIO')) $conf->global->THEME_AGRESSIVENES
.box-flex-container { .box-flex-container {
margin: 0 0 0 0 !important; margin: 0 0 0 0 !important;
} }
.info-box-module {
width: 280px;
}
} }