mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-02-06 07:04:57 +00:00
check for decorators in extensions, new way to add views
read the comments in the file
This commit is contained in:
parent
89e526a5e2
commit
a6e4202132
|
@ -52,27 +52,49 @@ class UI extends UI_Default {
|
|||
} else {
|
||||
$classname = "SeedDMS_View_".$class;
|
||||
}
|
||||
/* Collect all decorators */
|
||||
$decorators = array();
|
||||
foreach($EXT_CONF as $extname=>$extconf) {
|
||||
if(!isset($extconf['disable']) || $extconf['disable'] == false) {
|
||||
if(isset($extconf['decorators'][$class])) {
|
||||
$filename = $settings->_rootDir.'ext/'.$extname.'/decorators/'.$theme."/".$extconf['decorators'][$class]['file'];
|
||||
if(file_exists($filename)) {
|
||||
$classname = $extconf['decorators'][$class]['name'];
|
||||
$decorators[$extname] = $extconf['decorators'][$class];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/* Do not check for class file anymore but include it relative
|
||||
* to rootDir or an extension dir if it has set the include path
|
||||
* to rootDir or an extension dir if it has been set the include path
|
||||
*/
|
||||
$filename = '';
|
||||
$httpbasedir = '';
|
||||
foreach($EXT_CONF as $extname=>$extconf) {
|
||||
if(!isset($extconf['disable']) || $extconf['disable'] == false) {
|
||||
/* Setting the 'views' element in the configuration can be used to
|
||||
* replace an existing view in views/bootstrap/, e.g. class.ViewFolder.php
|
||||
* without providing an out/out.ViewFolder.php. In that case $httpbasedir
|
||||
* will not be set because out/out.xxx.php is still used.
|
||||
*/
|
||||
if(isset($extconf['views'][$class])) {
|
||||
$filename = $settings->_rootDir.'ext/'.$extname.'/views/'.$theme."/".$extconf['views'][$class]['file'];
|
||||
if(file_exists($filename)) {
|
||||
// $httpbasedir = 'ext/'.$extname.'/';
|
||||
$classname = $extconf['views'][$class]['name'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
/* New views are added by creating a file out/out.xx.php and
|
||||
* views/bootstrap/class.xx.php, without setting the 'views' element
|
||||
* in the configuration
|
||||
*/
|
||||
$filename = $settings->_rootDir.'ext/'.$extname.'/views/'.$theme."/class.".$class.".php";
|
||||
if(file_exists($filename)) {
|
||||
$httpbasedir = 'ext/'.$extname.'/';
|
||||
break;
|
||||
}
|
||||
$filename = '';
|
||||
if(isset($extconf['views'][$class])) {
|
||||
$filename = $settings->_rootDir.'ext/'.$extname.'/views/'.$theme."/".$extconf['views'][$class]['file'];
|
||||
if(file_exists($filename)) {
|
||||
$httpbasedir = 'ext/'.$extname.'/';
|
||||
$classname = $extconf['views'][$class]['name'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!$filename)
|
||||
|
@ -114,6 +136,11 @@ class UI extends UI_Default {
|
|||
$view->setParam('showmissingtranslations', $settings->_showMissingTranslations);
|
||||
$view->setParam('defaultsearchmethod', $settings->_defaultSearchMethod);
|
||||
$view->setParam('cachedir', $settings->_cacheDir);
|
||||
foreach($decorators as $extname=>$decorator) {
|
||||
$filename = $settings->_rootDir.'ext/'.$extname.'/decorators/'.$theme."/".$decorator['file'];
|
||||
require($filename);
|
||||
$view = new $decorator['name']($view);
|
||||
}
|
||||
return $view;
|
||||
}
|
||||
return null;
|
||||
|
|
Loading…
Reference in New Issue
Block a user