mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-22 14:41:29 +01:00
implement extra parameter to make use of the htmlarea plugins, olee
This commit is contained in:
parent
6c80ad8431
commit
91eb7ee636
@ -175,8 +175,10 @@
|
||||
@param $name string name and id of the input-field
|
||||
@param $content string of the htmlarea (will be run through htmlspecialchars !!!), default ''
|
||||
@param $style string inline styles, eg. dimension of textarea element
|
||||
@param $base_href string set a base href to get relative image-pathes working
|
||||
@param $plugins string plugins to load seperated by comma's, eg 'TableOperations,ContextMenu' (htmlarea breaks when a plugin calls a nonexisiting lang file)
|
||||
*/
|
||||
function htmlarea($name,$content='',$style='',$base_href='')
|
||||
function htmlarea($name,$content='',$style='',$base_href='',$plugins='')
|
||||
{
|
||||
if (!$style) $style = 'width:100%; min-width:500px; height:300px;';
|
||||
|
||||
@ -202,6 +204,7 @@
|
||||
$GLOBALS['phpgw_info']['flags']['java_script_thirst'] .=
|
||||
'<style type="text/css">@import url(/egroupware/phpgwapi/js/htmlarea/htmlarea.css);</style>
|
||||
<script type="text/javascript">
|
||||
|
||||
_editor_url = "'."$this->phpgwapi_js_url/htmlarea/".'";
|
||||
// var htmlareaConfig = new HTMLArea.Config();
|
||||
// htmlareaConfig.editorURL = '."'$this->phpgwapi_js_url/htmlarea/';
|
||||
@ -214,11 +217,45 @@
|
||||
($base_href[0] != '/' && substr($base_href,0,4) != 'http' ? $GLOBALS['phpgw_info']['server']['webserver_url'].'/' : '').
|
||||
$base_href.'" />'."\n";
|
||||
}
|
||||
|
||||
|
||||
if (isset($plugins))
|
||||
{
|
||||
$plg_arr = explode(',',$plugins);
|
||||
foreach($plg_arr as $plg_name)
|
||||
{
|
||||
$load_plugin_string .= 'HTMLArea.loadPlugin("'.trim($plg_name).'");'."\n";
|
||||
$register_plugin_string .= 'ret_editor = editor.registerPlugin("'.$plg_name.'");'."\n";
|
||||
}
|
||||
}
|
||||
|
||||
$GLOBALS['phpgw_info']['flags']['java_script'] .=
|
||||
'<script type="text/javascript">
|
||||
|
||||
/** Replacement for the replace-helperfunction to make it possible to include plugins. */
|
||||
HTMLArea.replace = function(id, config)
|
||||
{
|
||||
var ta = HTMLArea.getElementById("textarea", id);
|
||||
|
||||
if(ta)
|
||||
{
|
||||
editor = new HTMLArea(ta, config);
|
||||
'.$register_plugin_string.'
|
||||
ret_editor = editor.generate();
|
||||
return ret_editor;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
'.$load_plugin_string.'
|
||||
|
||||
var htmlareaConfig = new HTMLArea.Config();
|
||||
htmlareaConfig.editorURL = '."'$this->phpgwapi_js_url/htmlarea/';
|
||||
</script>\n";
|
||||
htmlareaConfig.editorURL = '."'$this->phpgwapi_js_url/htmlarea/';";
|
||||
|
||||
$GLOBALS['phpgw_info']['flags']['java_script'] .="</script>\n";
|
||||
}
|
||||
$id = str_replace(array('[',']'),array('_',''),$name); // no brakets in the id allowed by js
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user