Work on website templates from external modules

This commit is contained in:
Laurent Destailleur 2024-02-09 17:54:57 +01:00
parent b0ccf87b43
commit d4296c2ffd
7 changed files with 10 additions and 7 deletions

View File

@ -206,7 +206,8 @@ class Conf extends stdClass
'member' => array(),
'hooks' => array(),
'dir' => array(),
'syslog' => array()
'syslog' => array(),
'websitetemplates' => array()
);
// First level object that are modules.
@ -316,6 +317,7 @@ class Conf extends stdClass
'hooks' => array(),
'dir' => array(),
'syslog' => array(),
'websitetemplates' => array(),
);
if (!is_null($db) && is_object($db)) {
@ -375,7 +377,7 @@ class Conf extends stdClass
$newvalue = $arrValue;
} elseif (in_array($partname, array('login', 'menus', 'substitutions', 'triggers', 'tpl'))) {
$newvalue = '/'.$modulename.'/core/'.$partname.'/';
} elseif (in_array($partname, array('models', 'theme'))) {
} elseif (in_array($partname, array('models', 'theme', 'websitetemplates'))) {
$newvalue = '/'.$modulename.'/';
} elseif ($value == 1) {
$newvalue = '/'.$modulename.'/core/modules/'.$partname.'/'; // ex: partname = societe

View File

@ -540,7 +540,7 @@ function dolSaveLicense($file, $content)
*/
function showWebsiteTemplates(Website $website)
{
global $conf, $langs, $db, $form, $user;
global $conf, $langs, $form, $user;
$dirthemes = array('/doctemplates/websites');
if (!empty($conf->modules_parts['websitetemplates'])) { // Using this feature slow down application

View File

@ -290,8 +290,6 @@ class modWebhook extends DolibarrModules
*/
public function init($options = '')
{
global $conf, $langs;
$result = $this->_load_tables('/install/mysql/tables/', 'webhook');
//$result = $this->_load_tables('/webhook/sql/');
if ($result < 0) {

View File

@ -664,7 +664,7 @@ if (GETPOSTISSET('disablemodules')) {
$_SESSION["disablemodules"] = GETPOST('disablemodules', 'alpha');
}
if (!empty($_SESSION["disablemodules"])) {
$modulepartkeys = array('css', 'js', 'tabs', 'triggers', 'login', 'substitutions', 'menus', 'theme', 'sms', 'tpl', 'barcode', 'models', 'societe', 'hooks', 'dir', 'syslog', 'tpllinkable', 'contactelement', 'moduleforexternal');
$modulepartkeys = array('css', 'js', 'tabs', 'triggers', 'login', 'substitutions', 'menus', 'theme', 'sms', 'tpl', 'barcode', 'models', 'societe', 'hooks', 'dir', 'syslog', 'tpllinkable', 'contactelement', 'moduleforexternal', 'websitetemplates');
$disabled_modules = explode(',', $_SESSION["disablemodules"]);
foreach ($disabled_modules as $module) {

View File

@ -247,7 +247,7 @@ class MyObject extends CommonObject
*/
public function __construct(DoliDB $db)
{
global $conf, $langs;
global $langs;
$this->db = $db;

View File

@ -123,6 +123,8 @@ class modMyModule extends DolibarrModules
),
// Set this to 1 if features of module are opened to external users
'moduleforexternal' => 0,
// Set this to 1 if the module provides a website template into doctemplates/websites/website_template-mytemplate
'websitetemplates' => 0
);
// Data directories to create when module is enabled.

View File

@ -4036,6 +4036,7 @@ if ($action == 'createsite') {
}
if ($action == 'importsite') {
print '<!-- action=importsite -->';
print '<div class="fiche">';
print '<br>';