mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-23 07:09:20 +01:00
- Now class.javascript.inc.php automatically loads the specific browser JS,
which is located at the same hierarchy, but inside a folder with the name of the browser. For example: Usual folder => contactcenter/js/ccQuickAdd/ccQuickAdd.js Specific Folder => contactcenter/js/ccQuickAdd/mozilla/ccQuickAdd.js It falls back to the usual folder if there is no specific code.
This commit is contained in:
parent
2fc017bf88
commit
2a09fe8f3e
@ -130,11 +130,12 @@
|
||||
{
|
||||
if(!empty($files) && is_array($files))
|
||||
{
|
||||
foreach($files as $file => $ignored)
|
||||
print_r($files);
|
||||
foreach($files as $file => $browser)
|
||||
{
|
||||
$links .= '<script type="text/javascript" src="'
|
||||
. $GLOBALS['phpgw_info']['server']['webserver_url']
|
||||
. "/$app/js/$pkg/$file" . '.js">'
|
||||
. "/$app/js/$pkg/$browser/$file" . '.js">'
|
||||
. "</script>\n";
|
||||
}
|
||||
}
|
||||
@ -203,20 +204,44 @@
|
||||
* @param string $package package to be included
|
||||
* @param string $file file to be included - no ".js" on the end
|
||||
* @param string $app application directory to search - default = phpgwapi
|
||||
* @param bool $browser insert specific browser javascript.
|
||||
*
|
||||
* @discuss The browser specific option loads the file which is in the correct
|
||||
* browser folder. Supported folder are those supported by class.browser.inc.php
|
||||
*
|
||||
* @returns bool was the file found?
|
||||
*/
|
||||
function validate_file($package, $file, $app='phpgwapi')
|
||||
function validate_file($package, $file, $app='phpgwapi', $browser=true)
|
||||
{
|
||||
if(is_readable(PHPGW_INCLUDE_ROOT .SEP .$app .SEP .'js' .SEP . $package .SEP. $file . '.js'))
|
||||
if ($browser)
|
||||
{
|
||||
$this->files[$app][$package][$file] = $file;
|
||||
$browser_folder = strtolower(ExecMethod('phpgwapi.browser.get_agent'));
|
||||
}
|
||||
else
|
||||
{
|
||||
$browser_folder = '.';
|
||||
}
|
||||
|
||||
if(is_readable(PHPGW_INCLUDE_ROOT .SEP .$app .SEP .'js' .SEP . $package . SEP . $browser_folder . SEP . $file . '.js'))
|
||||
{
|
||||
$this->files[$app][$package][$file] = $browser_folder;
|
||||
return True;
|
||||
}
|
||||
elseif (is_readable(PHPGW_INCLUDE_ROOT .SEP .$app .SEP .'js' .SEP . $package . SEP . $file . '.js'))
|
||||
{
|
||||
$this->files[$app][$package][$file] = '.';
|
||||
return True;
|
||||
}
|
||||
elseif($app != 'phpgwapi')
|
||||
{
|
||||
if(is_readable(PHPGW_INCLUDE_ROOT .SEP .'phpgwapi' .SEP .'js' .SEP . $package .SEP . $file . '.js'))
|
||||
if(is_readable(PHPGW_INCLUDE_ROOT .SEP .'phpgwapi' .SEP .'js' .SEP . $package .SEP . $browser_folder . SEP . $file . '.js'))
|
||||
{
|
||||
$this->files['phpgwapi'][$package][$file] = $file;
|
||||
$this->files['phpgwapi'][$package][$file] = $browser_folder;
|
||||
return True;
|
||||
}
|
||||
elseif(is_readable(PHPGW_INCLUDE_ROOT .SEP .'phpgwapi' .SEP .'js' .SEP . $package .SEP . $file . '.js'))
|
||||
{
|
||||
$this->files['phpgwapi'][$package][$file] = '.';
|
||||
return True;
|
||||
}
|
||||
return False;
|
||||
|
Loading…
Reference in New Issue
Block a user