mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-26 18:03:39 +01:00
fixed problem when loading an extension from an other app-dir
This commit is contained in:
parent
569a3672b0
commit
a995cf89ef
@ -310,8 +310,8 @@
|
||||
@syntax loadExtension( $name,$ui='' )
|
||||
@author ralfbecker
|
||||
@abstact trys to load the Extension / Widget-class from the app or etemplate
|
||||
@param $name name of the extension the classname should be class.${name}_widget.inc.php
|
||||
@discussion the $name might be "$name.$app" to give a app-name (default is the current app)
|
||||
@param $name name of the extension, the classname should be class.${name}_widget.inc.php
|
||||
@discussion the $name might be "$name.$app" to give a app-name (default is the current app,or template-name)
|
||||
*/
|
||||
function loadExtension($name,&$parent,$ui='html')
|
||||
{
|
||||
@ -323,6 +323,10 @@
|
||||
$app = $GLOBALS['phpgw_info']['flags']['current_app'];
|
||||
}
|
||||
if (!file_exists(PHPGW_SERVER_ROOT."/$app/inc/class.$class.inc.php"))
|
||||
{
|
||||
list($app) = explode('.',$this->name);
|
||||
}
|
||||
if (!file_exists(PHPGW_SERVER_ROOT."/$app/inc/class.$class.inc.php"))
|
||||
{
|
||||
$app = 'etemplate';
|
||||
}
|
||||
|
@ -66,11 +66,13 @@
|
||||
if ($this->extensions == '')
|
||||
{
|
||||
$this->extensions = $this->scan_for_extensions();
|
||||
list($app) = explode('.',$this->name);
|
||||
if ($app != '' && $app != 'etemplate')
|
||||
{
|
||||
$this->extensions += $this->scan_for_extensions($app);
|
||||
}
|
||||
}
|
||||
list($app) = explode('.',$this->etemplate->name);
|
||||
if ($app && $app != 'etemplate' && is_array($this->extensions) &&
|
||||
(!is_array($this->extensions['**loaded**']) || !$this->extensions['**loaded**'][$app]))
|
||||
{
|
||||
$this->extensions += $this->scan_for_extensions($app);
|
||||
$this->extensions['**loaded**'][$app] = True;
|
||||
}
|
||||
$content = $this->etemplate->as_array() + array(
|
||||
'cols' => $this->etemplate->cols,
|
||||
@ -136,9 +138,11 @@
|
||||
{
|
||||
echo 'editor.edit: content ='; _debug_array($content);
|
||||
}
|
||||
$types = array_merge($this->etemplate->types,$this->extensions);
|
||||
unset($types['**loaded**']);
|
||||
$this->editor->exec('etemplate.editor.process_edit',$content,
|
||||
array(
|
||||
'type' => array_merge($this->etemplate->types,$this->extensions),
|
||||
'type' => $types,
|
||||
'align' => $this->aligns
|
||||
),
|
||||
$no_button,$cols_spanned + array('**extensions**' => $this->extensions));
|
||||
@ -435,7 +439,7 @@
|
||||
|
||||
/*!
|
||||
@function scan_for_extensions
|
||||
@syntax scan_for_extensions( )
|
||||
@syntax scan_for_extensions( $app )
|
||||
@author ralfbecker
|
||||
@abstract search the inc-dirs of etemplate and the app whichs template is edited for extensions / custom widgets
|
||||
@discussion extensions are class-files in $app/inc/class.${name}_widget.inc.php
|
||||
@ -447,14 +451,17 @@
|
||||
|
||||
$dir = @opendir(PHPGW_SERVER_ROOT.'/'.$app.'/inc');
|
||||
|
||||
echo "<p>loading extenstions for '$app': ";
|
||||
while ($dir && ($file = readdir($dir)))
|
||||
{
|
||||
if (ereg('class\\.([a-zA-Z0-9_]*)_widget.inc.php',$file,$regs) &&
|
||||
($ext = $this->etemplate->loadExtension($regs[1].'.'.$app,$this->etemplate)))
|
||||
{
|
||||
echo "$regs[1], ";
|
||||
$extensions[$regs[1]] = $ext->human_name;
|
||||
}
|
||||
}
|
||||
echo "</p>\n";
|
||||
return $extensions;
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user