mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-06-24 20:01:36 +02: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='' )
|
@syntax loadExtension( $name,$ui='' )
|
||||||
@author ralfbecker
|
@author ralfbecker
|
||||||
@abstact trys to load the Extension / Widget-class from the app or etemplate
|
@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
|
@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)
|
@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')
|
function loadExtension($name,&$parent,$ui='html')
|
||||||
{
|
{
|
||||||
@ -323,6 +323,10 @@
|
|||||||
$app = $GLOBALS['phpgw_info']['flags']['current_app'];
|
$app = $GLOBALS['phpgw_info']['flags']['current_app'];
|
||||||
}
|
}
|
||||||
if (!file_exists(PHPGW_SERVER_ROOT."/$app/inc/class.$class.inc.php"))
|
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';
|
$app = 'etemplate';
|
||||||
}
|
}
|
||||||
|
@ -66,11 +66,13 @@
|
|||||||
if ($this->extensions == '')
|
if ($this->extensions == '')
|
||||||
{
|
{
|
||||||
$this->extensions = $this->scan_for_extensions();
|
$this->extensions = $this->scan_for_extensions();
|
||||||
list($app) = explode('.',$this->name);
|
}
|
||||||
if ($app != '' && $app != 'etemplate')
|
list($app) = explode('.',$this->etemplate->name);
|
||||||
{
|
if ($app && $app != 'etemplate' && is_array($this->extensions) &&
|
||||||
$this->extensions += $this->scan_for_extensions($app);
|
(!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(
|
$content = $this->etemplate->as_array() + array(
|
||||||
'cols' => $this->etemplate->cols,
|
'cols' => $this->etemplate->cols,
|
||||||
@ -136,9 +138,11 @@
|
|||||||
{
|
{
|
||||||
echo 'editor.edit: content ='; _debug_array($content);
|
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,
|
$this->editor->exec('etemplate.editor.process_edit',$content,
|
||||||
array(
|
array(
|
||||||
'type' => array_merge($this->etemplate->types,$this->extensions),
|
'type' => $types,
|
||||||
'align' => $this->aligns
|
'align' => $this->aligns
|
||||||
),
|
),
|
||||||
$no_button,$cols_spanned + array('**extensions**' => $this->extensions));
|
$no_button,$cols_spanned + array('**extensions**' => $this->extensions));
|
||||||
@ -435,7 +439,7 @@
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
@function scan_for_extensions
|
@function scan_for_extensions
|
||||||
@syntax scan_for_extensions( )
|
@syntax scan_for_extensions( $app )
|
||||||
@author ralfbecker
|
@author ralfbecker
|
||||||
@abstract search the inc-dirs of etemplate and the app whichs template is edited for extensions / custom widgets
|
@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
|
@discussion extensions are class-files in $app/inc/class.${name}_widget.inc.php
|
||||||
@ -447,14 +451,17 @@
|
|||||||
|
|
||||||
$dir = @opendir(PHPGW_SERVER_ROOT.'/'.$app.'/inc');
|
$dir = @opendir(PHPGW_SERVER_ROOT.'/'.$app.'/inc');
|
||||||
|
|
||||||
|
echo "<p>loading extenstions for '$app': ";
|
||||||
while ($dir && ($file = readdir($dir)))
|
while ($dir && ($file = readdir($dir)))
|
||||||
{
|
{
|
||||||
if (ereg('class\\.([a-zA-Z0-9_]*)_widget.inc.php',$file,$regs) &&
|
if (ereg('class\\.([a-zA-Z0-9_]*)_widget.inc.php',$file,$regs) &&
|
||||||
($ext = $this->etemplate->loadExtension($regs[1].'.'.$app,$this->etemplate)))
|
($ext = $this->etemplate->loadExtension($regs[1].'.'.$app,$this->etemplate)))
|
||||||
{
|
{
|
||||||
|
echo "$regs[1], ";
|
||||||
$extensions[$regs[1]] = $ext->human_name;
|
$extensions[$regs[1]] = $ext->human_name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
echo "</p>\n";
|
||||||
return $extensions;
|
return $extensions;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user