adding documented, but never implemented $append parameter to Framework::includeJS

This commit is contained in:
Ralf Becker 2016-08-15 18:35:26 +02:00
parent a8e1980a15
commit c3a8012408
2 changed files with 18 additions and 6 deletions

View File

@ -1240,9 +1240,9 @@ abstract class Framework extends Framework\Extra
* @param string $app ='phpgwapi' application directory to search - default = phpgwapi * @param string $app ='phpgwapi' application directory to search - default = phpgwapi
* @param boolean $append =true should the file be added * @param boolean $append =true should the file be added
*/ */
static function includeJS($package, $file=null, $app='phpgwapi') static function includeJS($package, $file=null, $app='phpgwapi', $append=true)
{ {
self::$js_include_mgr->include_js_file($package, $file, $app); self::$js_include_mgr->include_js_file($package, $file, $app, $append);
} }
/** /**

View File

@ -252,14 +252,25 @@ class IncludeMgr
/** /**
* Includes the given module files - this function will have the task to * Includes the given module files - this function will have the task to
* cache/shrink/concatenate the files in the future. * cache/shrink/concatenate the files in the future.
*
* @param array $modules pathes to include
* @param boolean $append =true false: prepend modules before already included ones, keeping their order
*/ */
private function include_module(array $module) private function include_module(array $modules, $append=true)
{ {
if (self::$DEBUG_MODE) if (self::$DEBUG_MODE)
{ {
foreach ($module as $path) if ($append)
{ {
$this->included_files[$path] = true; foreach ($modules as $path)
{
$this->included_files[$path] = true;
}
}
else
{
$this->included_files = array_merge(array_combine($modules, array_fill(0, count($modules), true)),
$this->included_files);
} }
} }
else else
@ -346,8 +357,9 @@ class IncludeMgr
* @param string $package package or complete path (relative to EGW_SERVER_ROOT) to be included * @param string $package package or complete path (relative to EGW_SERVER_ROOT) to be included
* @param string|array $file =null file to be included - no ".js" on the end or array with get params * @param string|array $file =null file to be included - no ".js" on the end or array with get params
* @param string $app ='phpgwapi' application directory to search - default = phpgwapi * @param string $app ='phpgwapi' application directory to search - default = phpgwapi
* @param boolean $append =true true append file, false prepend (add as first) file used eg. for template itself
*/ */
public function include_js_file($package, $file = null, $app = 'phpgwapi') public function include_js_file($package, $file = null, $app = 'phpgwapi', $append=true)
{ {
// Translate the given parameters into a valid path - false is returned // Translate the given parameters into a valid path - false is returned
// if the file is not found or the file is already included/has already // if the file is not found or the file is already included/has already