NEW The module selection uses a KanBan view by default.

This commit is contained in:
Laurent Destailleur 2020-04-08 17:04:23 +02:00
parent fe614658c8
commit 02436c1e84
6 changed files with 75 additions and 23 deletions

View File

@ -38,7 +38,7 @@ require_once DOL_DOCUMENT_ROOT.'/admin/dolistore/class/dolistore.class.php';
// Load translation files required by the page
$langs->loadLangs(array("errors", "admin", "modulebuilder"));
$mode = GETPOST('mode', 'alpha');
$mode = GETPOSTISSET('mode') ? GETPOST('mode', 'alpha') : 'commonkanban';
if (empty($mode)) $mode = 'common';
$action = GETPOST('action', 'alpha');
//var_dump($_POST);exit;
@ -508,7 +508,7 @@ if ($mode == 'common' || $mode == 'commonkanban')
print '<input type="hidden" name="mode" value="'.$mode.'">';
$newmode = $mode;
if ($newmode == 'commonkanban') $newmode = 'common';
if ($newmode == 'common') $newmode = 'commonkanban';
dol_fiche_head($head, $newmode, '', -1);
@ -708,7 +708,7 @@ if ($mode == 'common' || $mode == 'commonkanban')
{
if (method_exists($objMod, 'alreadyUsed') && $objMod->alreadyUsed()) $codeenabledisable .= $langs->trans("Used");
else {
$codeenabledisable .= img_picto($langs->trans("Required"), 'switch_on', '', false, 0, 0, '', 'opacitymedium');
$codeenabledisable .= img_picto($langs->trans("Required"), 'switch_on', '', false, 0, 0, '', 'opacitymedium valignmiddle');
//print $langs->trans("Required");
}
if (!empty($conf->multicompany->enabled) && $user->entity) $disableSetup++;
@ -716,12 +716,12 @@ if ($mode == 'common' || $mode == 'commonkanban')
else
{
if (!empty($objMod->warnings_unactivation[$mysoc->country_code]) && method_exists($objMod, 'alreadyUsed') && $objMod->alreadyUsed()) {
$codeenabledisable .= '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$objMod->numero.'&amp;module_position='.$module_position.'&amp;action=reset_confirm&amp;confirm_message_code='.$objMod->warnings_unactivation[$mysoc->country_code].'&amp;value='.$modName.'&amp;mode='.$mode.$param.'">';
$codeenabledisable .= '<a class="reposition valignmiddle" href="'.$_SERVER["PHP_SELF"].'?id='.$objMod->numero.'&amp;module_position='.$module_position.'&amp;action=reset_confirm&amp;confirm_message_code='.$objMod->warnings_unactivation[$mysoc->country_code].'&amp;value='.$modName.'&amp;mode='.$mode.$param.'">';
$codeenabledisable .= img_picto($langs->trans("Activated"), 'switch_on');
$codeenabledisable .= '</a>';
}
else {
$codeenabledisable .= '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$objMod->numero.'&amp;module_position='.$module_position.'&amp;action=reset&amp;value='.$modName.'&amp;mode='.$mode.'&amp;confirm=yes'.$param.'">';
$codeenabledisable .= '<a class="reposition valignmiddle" href="'.$_SERVER["PHP_SELF"].'?id='.$objMod->numero.'&amp;module_position='.$module_position.'&amp;action=reset&amp;value='.$modName.'&amp;mode='.$mode.'&amp;confirm=yes'.$param.'">';
$codeenabledisable .= img_picto($langs->trans("Activated"), 'switch_on');
$codeenabledisable .= '</a>';
}
@ -754,28 +754,28 @@ if ($mode == 'common' || $mode == 'commonkanban')
if (preg_match('/^([^@]+)@([^@]+)$/i', $urlpage, $regs))
{
$urltouse = dol_buildpath('/'.$regs[2].'/admin/'.$regs[1], 1);
$codetoconfig .= '<a href="'.$urltouse.(preg_match('/\?/', $urltouse) ? '&' : '?').'save_lastsearch_values=1&backtopage='.urlencode($backtourl).'" title="'.$langs->trans("Setup").'">'.img_picto($langs->trans("Setup"), "setup", 'style="padding-right: 6px"').'</a>';
$codetoconfig .= '<a href="'.$urltouse.(preg_match('/\?/', $urltouse) ? '&' : '?').'save_lastsearch_values=1&backtopage='.urlencode($backtourl).'" title="'.$langs->trans("Setup").'">'.img_picto($langs->trans("Setup"), "setup", 'style="padding-right: 6px"', false, 0, 0, '', 'fa-15').'</a>';
}
else
{
$urltouse = $urlpage;
$codetoconfig .= '<a href="'.$urltouse.(preg_match('/\?/', $urltouse) ? '&' : '?').'save_lastsearch_values=1&backtopage='.urlencode($backtourl).'" title="'.$langs->trans("Setup").'">'.img_picto($langs->trans("Setup"), "setup", 'style="padding-right: 6px"').'</a>';
$codetoconfig .= '<a href="'.$urltouse.(preg_match('/\?/', $urltouse) ? '&' : '?').'save_lastsearch_values=1&backtopage='.urlencode($backtourl).'" title="'.$langs->trans("Setup").'">'.img_picto($langs->trans("Setup"), "setup", 'style="padding-right: 6px"', false, 0, 0, '', 'fa-15').'</a>';
}
}
}
}
elseif (preg_match('/^([^@]+)@([^@]+)$/i', $objMod->config_page_url, $regs))
{
$codetoconfig .= '<a href="'.dol_buildpath('/'.$regs[2].'/admin/'.$regs[1], 1).'?save_lastsearch_values=1&backtopage='.urlencode($backtourl).'" title="'.$langs->trans("Setup").'">'.img_picto($langs->trans("Setup"), "setup", 'style="padding-right: 6px"').'</a>';
$codetoconfig .= '<a class="valignmiddle" href="'.dol_buildpath('/'.$regs[2].'/admin/'.$regs[1], 1).'?save_lastsearch_values=1&backtopage='.urlencode($backtourl).'" title="'.$langs->trans("Setup").'">'.img_picto($langs->trans("Setup"), "setup", 'style="padding-right: 6px"', false, 0, 0, '', 'fa-15').'</a>';
}
else
{
$codetoconfig .= '<a href="'.$objMod->config_page_url.'?save_lastsearch_values=1&backtopage='.urlencode($backtourl).'" title="'.$langs->trans("Setup").'">'.img_picto($langs->trans("Setup"), "setup", 'style="padding-right: 6px"').'</a>';
$codetoconfig .= '<a class="valignmiddle" href="'.$objMod->config_page_url.'?save_lastsearch_values=1&backtopage='.urlencode($backtourl).'" title="'.$langs->trans("Setup").'">'.img_picto($langs->trans("Setup"), "setup", 'style="padding-right: 6px"', false, 0, 0, '', 'fa-15').'</a>';
}
}
else
{
$codetoconfig .= img_picto($langs->trans("NothingToSetup"), "setup", 'class="opacitytransp" style="padding-right: 6px"');
$codetoconfig .= img_picto($langs->trans("NothingToSetup"), "setup", 'class="opacitytransp" style="padding-right: 6px"', false, 0, 0, '', 'fa-15');
}
}
else // Module not yet activated
@ -961,26 +961,24 @@ if ($mode == 'marketplace')
$previouslink = $dolistore->get_previous_link();
$nextlink = $dolistore->get_next_link();
print '<div class="liste_titre liste_titre_bydiv centpercent"><div class="divsearchfield">'
print '<div class="liste_titre liste_titre_bydiv centpercent"><div class="divsearchfield">';
print '<form method="POST" class="centpercent" id="searchFormList" action="'.$dolistore->url.'">';
?>
<form method="POST" class="centpercent" id="searchFormList" action="<?php echo $dolistore->url ?>">
<input type="hidden" name="token" value="<?php echo newToken(); ?>">
<input type="hidden" name="mode" value="marketplace">
<div class="divsearchfield"><?php echo $langs->trans('Keyword') ?>:
<input name="search_keyword" placeholder="<?php echo $langs->trans('Chercher un module') ?>" id="search_keyword" type="text" size="50" value="<?php echo $options['search'] ?>"><br>
</div>
<div class="divsearchfield">
<input class="button" value="<?php echo $langs->trans('Rechercher') ?>" type="submit">
<a class="button" href="<?php echo $dolistore->url ?>"><?php echo $langs->trans('Reset') ?></a>
<input class="button buttongen" value="<?php echo $langs->trans('Rechercher') ?>" type="submit">
<a class="buttonreset" href="<?php echo $dolistore->url ?>"><?php echo $langs->trans('Reset') ?></a>
&nbsp;
</div>
<div class="divsearchfield right">
<?php
print $previouslink;
print $nextlink;
print '</div>';
print '</form>';

View File

@ -577,9 +577,9 @@ function modules_prepare_head()
$h = 0;
$head = array();
$head[$h][0] = DOL_URL_ROOT."/admin/modules.php?mode=common";
$head[$h][0] = DOL_URL_ROOT."/admin/modules.php?mode=commonkanban";
$head[$h][1] = $langs->trans("AvailableModules");
$head[$h][2] = 'common';
$head[$h][2] = 'commonkanban';
$h++;
$head[$h][0] = DOL_URL_ROOT."/admin/modules.php?mode=marketplace";

View File

@ -2261,9 +2261,11 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
/**
* Return Kanban view of a module
*
* @return string HTML code of Kanban view
* @param string $codeenabledisable HTML code for button to enable/disable module
* @param string $codetoconfig HTML code to go to config page
* @return string HTML code of Kanban view
*/
public function getKanbanView()
public function getKanbanView($codeenabledisable = '', $codetoconfig = '')
{
global $conf, $langs;
@ -2301,15 +2303,44 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
{
print img_object($alttext, 'generic', 'class="inline-block valignmiddle"');
}
print '<span class="info-box-icon-version" title="'.$langs->trans("Version").' '.$this->getVersion(1).'">'.$this->getVersion(1).'</span>';
print '<span class="info-box-icon-version" title="'.$langs->trans("Version").' '.$this->getVersion(1).'">';
print $this->getVersion(1);
print '</span>';
/*print '<span class="info-box-icon-action">';
print '<div class="valignmiddle inline-block">';
print '<div class="valignmiddle inline-block">';
print $codeenabledisable;
print '</div>';
print '<div class="valignmiddle inline-block marginleftonly">';
print $codetoconfig;
print '</div>';
print '</div>';
print '</span>';
*/
print '</div>
<div class="info-box-content info-box-text-module">
<span class="info-box-title">'.$this->getName().'</span>
<span class="info-box-desc twolinesmax" title="'.dol_escape_htmltag($this->getDesc()).'">'.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="info-box-icon-version" title="'.$langs->trans("Version").' '.$this->getVersion(1).'">';
print $this->getVersion(1);
print '</span>'; */
print '<div class="valignmiddle inline-block">';
print '<a class="valignmiddle inline-block" 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 '</div><br>';
print '<div class="valignmiddle inline-block info-box-actions">';
print '<div class="valignmiddle inline-block">';
print $codeenabledisable;
print '</div>';
print '<div class="valignmiddle inline-block marginleftonly">';
print $codetoconfig;
print '</div>';
print '</div>';
//print '<span class="progress-version"><span class="opacitymedium">'.$this->getVersion(1).'</span></span>';
print '
</div><!-- /.info-box-content -->
</div><!-- /.info-box -->

Binary file not shown.

Before

Width:  |  Height:  |  Size: 556 B

After

Width:  |  Height:  |  Size: 4.5 KiB

View File

@ -118,6 +118,29 @@ if (!defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?>
transition: opacity 0.5s, visibility 0s 0.5s;
}
.info-box-icon-action {
box-sizing: border-box;
display: block;
position: absolute;
width: 90px;
bottom: 0px;
color: #ffffff;
background-color: rgba(0,0,0,0.1);
cursor: default;
font-size: 0.5em;
line-height: 22px;
padding: 0px 3px;
text-align: center;
opacity: 1;
-webkit-transition: opacity 0.5s, visibility 0s 0.5s;
transition: opacity 0.5s, visibility 0s 0.5s;
}
.info-box-actions {
position: absolute;
right: 0;
bottom: 0;
}
<?php if (empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS) && !empty($conf->global->MAIN_INCLUDE_GLOBAL_STATS_IN_OPENED_DASHBOARD)) { ?>
.info-box-icon-text{

Binary file not shown.

Before

Width:  |  Height:  |  Size: 556 B

After

Width:  |  Height:  |  Size: 4.5 KiB