Can use javascript files with full http link

This commit is contained in:
Laurent Destailleur 2011-03-28 20:29:14 +00:00
parent 887020e4bd
commit fcf4bcdc1d
2 changed files with 14 additions and 5 deletions

View File

@ -154,7 +154,9 @@ define('DOL_URL_ROOT', $suburi); // URL relative root ('', '/dolibarr'
if (! empty($dolibarr_main_url_root_alt)) if (! empty($dolibarr_main_url_root_alt))
{ {
$altpart=str_replace($dolibarr_main_url_root,'',$dolibarr_main_url_root_alt); $altpart=str_replace($dolibarr_main_url_root,'',$dolibarr_main_url_root_alt);
$tmp_alt=$tmp.(preg_match('/^\//',$altpart)?'':'/').$altpart; if (! preg_match('/^\//',$altpart) && ! empty($altpart)) { $tmp_alt=$dolibarr_main_url_root_alt; } // Manage case url=http://localhost/aaa and url_alt=http://localhost/aaabbb
else $tmp_alt=$tmp.((preg_match('/\/$/',$tmp)||preg_match('/^\//',$altpart))?'':'/').$altpart;
//$tmp_alt=$dolibarr_main_url_root_alt;
define('DOL_MAIN_URL_ROOT_ALT', $tmp_alt); // URL absolute root (https://sss/dolibarr/custom, ...) define('DOL_MAIN_URL_ROOT_ALT', $tmp_alt); // URL absolute root (https://sss/dolibarr/custom, ...)
$uri=preg_replace('/^http(s?):\/\//i','',constant('DOL_MAIN_URL_ROOT_ALT')); // $uri contains url without http* $uri=preg_replace('/^http(s?):\/\//i','',constant('DOL_MAIN_URL_ROOT_ALT')); // $uri contains url without http*
$suburi = strstr($uri, '/'); // $suburi contains url without domain $suburi = strstr($uri, '/'); // $suburi contains url without domain
@ -163,7 +165,7 @@ if (! empty($dolibarr_main_url_root_alt))
} }
// Define prefix // Define prefix
define('MAIN_DB_PREFIX',$dolibarr_main_db_prefix); define('MAIN_DB_PREFIX',$dolibarr_main_db_prefix);
//print DOL_URL_ROOT.'-'.DOL_URL_ROOT_ALT;
/* /*
* Include functions * Include functions

View File

@ -931,11 +931,18 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs
{ {
print '<!-- Includes JS specific to page -->'."\n"; print '<!-- Includes JS specific to page -->'."\n";
foreach($arrayofjs as $jsfile) foreach($arrayofjs as $jsfile)
{
if (preg_match('/^http/i',$jsfile))
{
print '<script type="text/javascript" src="'.$jsfile.'"></script>'."\n";
}
else
{ {
if (! preg_match('/^\//',$jsfile)) $jsfile='/'.$jsfile; // For backward compatibility if (! preg_match('/^\//',$jsfile)) $jsfile='/'.$jsfile; // For backward compatibility
print '<script type="text/javascript" src="'.dol_buildpath($jsfile,1).'"></script>'."\n"; print '<script type="text/javascript" src="'.dol_buildpath($jsfile,1).'"></script>'."\n";
} }
} }
}
// Define tradMonths javascript array (we define this in datapicker AND in parent page to avoid errors with IE8) // Define tradMonths javascript array (we define this in datapicker AND in parent page to avoid errors with IE8)
$tradTemp=array($langs->trans("January"), $tradTemp=array($langs->trans("January"),