Nicer combo of companies for external modules

This commit is contained in:
Laurent Destailleur
2024-04-03 13:20:26 +02:00
parent 5acdcac75d
commit f03eb260de
5 changed files with 41 additions and 13 deletions

View File

@@ -361,13 +361,17 @@ llxHeader('', $langs->trans("Setup"), $help_url, '', '', '', $morejs, $morecss,
// Search modules dirs
$modulesdir = dolGetModulesDirs();
$arrayofnatures = array('core' => $langs->transnoentitiesnoconv("NativeModules"), 'external' => $langs->transnoentitiesnoconv("External").' - ['.$langs->trans("AllPublishers").']');
$arrayofnatures = array(
'core' => array('label' => $langs->transnoentitiesnoconv("NativeModules")),
'external' => array('label' => $langs->transnoentitiesnoconv("External").' - ['.$langs->trans("AllPublishers").']')
);
$arrayofwarnings = array(); // Array of warning each module want to show when activated
$arrayofwarningsext = array(); // Array of warning each module want to show when we activate an external module
$filename = array();
$modules = array();
$orders = array();
$categ = array();
$publisherlogoarray = array();
$i = 0; // is a sequencer of modules found
$j = 0; // j is module number. Automatically affected if module number not defined.
@@ -427,9 +431,16 @@ foreach ($modulesdir as $dir) {
$external = ($objMod->isCoreOrExternalModule() == 'external');
if ($external) {
if ($publisher) {
$arrayofnatures['external_'.$publisher] = $langs->trans("External").' - '.$publisher;
// Check if there is a logo forpublisher
/* Do not show the company logo in combo. Make combo list dirty.
if (!empty($objMod->editor_squarred_logo)) {
$publisherlogoarray['external_'.$publisher] = img_picto('', $objMod->editor_squarred_logo, 'class="publisherlogoinline"');
}
$publisherlogo = empty($publisherlogoarray['external_'.$publisher]) ? '' : $publisherlogoarray['external_'.$publisher];
*/
$arrayofnatures['external_'.$publisher] = array('label' => $langs->trans("External").' - '.$publisher, 'data-html' => $langs->trans("External").' - <span class="opacitymedium inine-block valignmiddle">'.$publisher.'</span>');
} else {
$arrayofnatures['external_'] = $langs->trans("External").' - '.$langs->trans("UnknownPublishers");
$arrayofnatures['external_'] = array('label' => $langs->trans("External").' - ['.$langs->trans("UnknownPublishers").']');
}
}
ksort($arrayofnatures);

View File

@@ -50,16 +50,19 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
/**
* @var string Publisher name
* @since 4.0.0
*/
public $editor_name;
/**
* @var string URL of module at publisher site
* @since 4.0.0
*/
public $editor_url;
/**
* @var string URL of logo of the publisher. Must be image filename into the module/img directory followed with @modulename. Example: 'myimage.png@mymodule'.
*/
public $editor_squarred_logo;
/**
* @var string Family
* @see $familyinfo

View File

@@ -42,6 +42,7 @@ class modMyModule extends DolibarrModules
public function __construct($db)
{
global $langs, $conf;
$this->db = $db;
// Id for module (must be unique).
@@ -70,7 +71,8 @@ class modMyModule extends DolibarrModules
// Author
$this->editor_name = 'Editor name';
$this->editor_url = 'https://www.example.com';
$this->editor_url = 'https://www.example.com'; // Must be an external online web site
$this->editor_squarred_logo = ''; // Must be image filename into the module/img directory followed with @modulename. Example: 'myimage.png@mymodule'
// Possible values for version are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated', 'experimental_deprecated' or a version string like 'x.y.z'
$this->version = '1.0';

View File

@@ -1095,6 +1095,12 @@ i.fa-mars::before, i.fa-venus::before, i.fa-genderless::before, i.fa-transgender
.stockmovement {
font-size: 1.4em;
}
.publisherlogoinline {
vertical-align: middle;
height: 14px;
width: 14px;
margin-left: 5px;
}
body[class*="colorblind-"] .text-warning{
color : <?php print $colorblind_deuteranopes_textWarning; ?>

View File

@@ -1273,6 +1273,12 @@ i.fa-mars::before, i.fa-venus::before, i.fa-genderless::before, i.fa-transgender
.stockmovement {
font-size: 1.4em;
}
.publisherlogoinline {
vertical-align: middle;
height: 14px;
width: 14px;
margin-left: 5px;
}
.text-warning{
color : <?php print $textWarning; ?>