Skip to content
Snippets Groups Projects
Commit c0913acf authored by Regis Houssin's avatar Regis Houssin
Browse files

New: add directory for external module and other customization

parent a46baf8c
No related branches found
No related tags found
No related merge requests found
......@@ -369,7 +369,14 @@ if ($mode != 4)
{
if (preg_match('/^([^@]+)@([^@]+)$/i',$urlpage,$regs))
{
print '<a href="'.DOL_URL_ROOT.'/'.$regs[2].'/admin/'.$regs[1].'" title="'.$langs->trans("Setup").'">'.img_picto($langs->trans("Setup"),"setup").'</a>&nbsp;';
if (file_exists(DOL_URL_ROOT.'/'.$regs[2].'/admin/'.$regs[1]))
{
print '<a href="'.DOL_URL_ROOT.'/'.$regs[2].'/admin/'.$regs[1].'" title="'.$langs->trans("Setup").'">'.img_picto($langs->trans("Setup"),"setup").'</a>&nbsp;';
}
else
{
print '<a href="'.DOL_URL_ROOT.'/custom/modules/'.$regs[2].'/admin/'.$regs[1].'" title="'.$langs->trans("Setup").'">'.img_picto($langs->trans("Setup"),"setup").'</a>&nbsp;';
}
}
else
{
......@@ -381,7 +388,14 @@ if ($mode != 4)
}
else if (preg_match('/^([^@]+)@([^@]+)$/i',$objMod->config_page_url,$regs))
{
print '<td align="right" valign="top"><a href="'.DOL_URL_ROOT.'/'.$regs[2].'/admin/'.$regs[1].'" title="'.$langs->trans("Setup").'">'.img_picto($langs->trans("Setup"),"setup").'</a></td>';
if (file_exists(DOL_URL_ROOT.'/'.$regs[2].'/admin/'.$regs[1]))
{
print '<td align="right" valign="top"><a href="'.DOL_URL_ROOT.'/'.$regs[2].'/admin/'.$regs[1].'" title="'.$langs->trans("Setup").'">'.img_picto($langs->trans("Setup"),"setup").'</a></td>';
}
else
{
print '<td align="right" valign="top"><a href="'.DOL_URL_ROOT.'/custom/modules/'.$regs[2].'/admin/'.$regs[1].'" title="'.$langs->trans("Setup").'">'.img_picto($langs->trans("Setup"),"setup").'</a></td>';
}
}
else
{
......
......@@ -179,8 +179,11 @@ class Translate {
foreach($this->dir as $searchdir)
{
// If $domain is "file@module" instead of "file" then we look for module lang file htdocs/module/langs/code_CODE/file.lang
// If $domain is "file@module" instead of "file" then we look for module lang file
// in htdocs/custom/modules/mymodule/langs/code_CODE/file.lang
// and in htdocs/mymodule/langs/code_CODE/file.lang for backward compatibility
// instead of file htdocs/langs/code_CODE/filelang
if (preg_match('/custom$/i',$searchdir)) $searchdir = $searchdir . "/modules";
if (preg_match('/@/',$domain)) $searchdir = $searchdir."/".(!empty($modulename)?$modulename:$newdomain)."/langs";
else $searchdir=$searchdir."/langs";
......
......@@ -1137,7 +1137,14 @@ function img_object($alt, $object, $cssclass='')
if (preg_match('/^([^@]+)@([^@]+)$/i',$object,$regs))
{
return '<img src="'.DOL_URL_ROOT.'/'.$regs[2].'/img/object_'.$regs[1].'.png" border="0" alt="'.dol_escape_htmltag($alt).'" title="'.dol_escape_htmltag($alt).'" '.$cssclass.'>';
if (file_exists(DOL_URL_ROOT.'/'.$regs[2].'/img/object_'.$regs[1]))
{
return '<img src="'.DOL_URL_ROOT.'/'.$regs[2].'/img/object_'.$regs[1].'.png" border="0" alt="'.dol_escape_htmltag($alt).'" title="'.dol_escape_htmltag($alt).'" '.$cssclass.'>';
}
else
{
return '<img src="'.DOL_URL_ROOT.'/custom/modules/'.$regs[2].'/img/object_'.$regs[1].'.png" border="0" alt="'.dol_escape_htmltag($alt).'" title="'.dol_escape_htmltag($alt).'" '.$cssclass.'>';
}
}
return '<img src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/object_'.$object.'.png" border="0" alt="'.dol_escape_htmltag($alt).'" title="'.dol_escape_htmltag($alt).'" '.$cssclass.'>';
......
......@@ -104,7 +104,8 @@ if (empty($dolibarr_main_data_root))
define('DOL_DOCUMENT_ROOT', $dolibarr_main_document_root); // Filesystem core php (htdocs)
define('DOL_DATA_ROOT', $dolibarr_main_data_root); // Filesystem data (documents)
define('DOL_CLASS_PATH', 'class/'); // Filesystem path to class dir
define('DOL_CUSTOM_PATH', $dolibarr_main_document_root.'/custom'); // Filesystem path to custom dir
define('DOL_CUSTOM_PATH', DOL_DOCUMENT_ROOT . '/custom'); // Filesystem path to custom dir
define('DOL_EXTMODULE_ROOT', DOL_CUSTOM_PATH . '/modules'); // Filesystem path to external modules dir
// If dolibarr_main_url_root = auto (Hidden feature for developers only), we try to forge it.
if ($dolibarr_main_url_root == 'auto' && ! empty($_SERVER["SCRIPT_URL"]) && ! empty($_SERVER["SCRIPT_URI"]))
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment