diff --git a/phpgwapi/inc/class.html.inc.php b/phpgwapi/inc/class.html.inc.php index 504da5d49b..319287f7e8 100644 --- a/phpgwapi/inc/class.html.inc.php +++ b/phpgwapi/inc/class.html.inc.php @@ -568,6 +568,66 @@ class html .''; } + /** + * this function is a wrapper for fckEditor to create some reuseable layouts + * + * @param string $_name name and id of the input-field + * @param string $_content='' of the tinymce (will be run through htmlspecialchars !!!), default '' + * @param string $_mode display mode of the tinymce editor can be: simple, extended or advanced + * @param array $_options (toolbar_expanded true/false) + * @param string $_height='400px' + * @param string $_width='100%' + * @param string $base_href='' if passed activates the browser for image at absolute path passed + * @return string the necessary html for the textarea + */ + function fckEditor($_name, $_content='', $_mode, $_options=array('toolbar_expanded' =>'true'), $_height='400px', $_width='100%',$_base_href) { + include_once(EGW_INCLUDE_ROOT."/phpgwapi/js/fckeditor/fckeditor.php"); + + $oFCKeditor = new FCKeditor($_name) ; + $oFCKeditor->BasePath = $GLOBALS['egw_info']['server']['webserver_url'].'/phpgwapi/js/fckeditor/' ; + $oFCKeditor->Value = $_content; + $oFCKeditor->Width = $_width ; + $oFCKeditor->Height = $_height ; + $oFCKeditor->Config['LinkBrowser'] = 'false'; + $oFCKeditor->Config['FlashBrowser'] = 'false'; + $oFCKeditor->Config['LinkUpload'] = 'false'; + + // Activate the browser and config upload pathimage dir ($_base_href/images) if passed (absolute path) + if ($_base_href) + { + // Only images for now + $oFCKeditor->Config['ImageBrowserURL'] = $oFCKeditor->BasePath.'editor/filemanager/browser/default/browser.html?ServerPath='.$_base_href.'&Type=images&Connector=connectors/php/connector.php'; + } + else + { + $oFCKeditor->Config['ImageBrowser'] = 'false'; + } + // By default the editor start expanded + if ($_options['toolbar_expanded'] == 'false') + { + $oFCKeditor->Config['ToolbarStartExpanded'] = $_options['toolbar_expanded']; + } + + switch($_mode) { + case 'ascii': + return ""; + break; + case 'simple': + $oFCKeditor->ToolbarSet = 'egw_simple'; + return $oFCKeditor->CreateHTML() ; + break; + case 'extended': + $oFCKeditor->ToolbarSet = 'egw_extended'; + return $oFCKeditor->CreateHTML() ; + break; + case 'advanced': + $oFCKeditor->ToolbarSet = 'egw_advanced'; + return $oFCKeditor->CreateHTML() ; + break; + } + + } + /** * this function is a wrapper for tinymce to create some reuseable layouts * diff --git a/phpgwapi/js/fckeditor/editor/filemanager/browser/default/connectors/php/config.php b/phpgwapi/js/fckeditor/editor/filemanager/browser/default/connectors/php/config.php index 74d231fd18..d59e905965 100644 --- a/phpgwapi/js/fckeditor/editor/filemanager/browser/default/connectors/php/config.php +++ b/phpgwapi/js/fckeditor/editor/filemanager/browser/default/connectors/php/config.php @@ -21,10 +21,10 @@ global $Config ; // SECURITY: You must explicitelly enable this "connector". (Set it to "true"). -$Config['Enabled'] = false ; +$Config['Enabled'] = true ; // Path to user files relative to the document root. -$Config['UserFilesPath'] = '/UserFiles/' ; +//$Config['UserFilesPath'] = '/UserFiles/' ; // Fill the following value it you prefer to specify the absolute path for the // user files directory. Usefull if you are using a virtual directory, symbolic diff --git a/phpgwapi/js/fckeditor/editor/filemanager/browser/default/connectors/php/connector.php b/phpgwapi/js/fckeditor/editor/filemanager/browser/default/connectors/php/connector.php index a2f5cc1031..af3dbd54c6 100644 --- a/phpgwapi/js/fckeditor/editor/filemanager/browser/default/connectors/php/connector.php +++ b/phpgwapi/js/fckeditor/editor/filemanager/browser/default/connectors/php/connector.php @@ -68,7 +68,7 @@ function DoResponse() $sCurrentFolder = $_GET['CurrentFolder'] ; // Check if it is an allowed type. - if ( !in_array( $sResourceType, array('File','Image','Flash','Media') ) ) + if ( !in_array( $sResourceType, array('File','images','Flash','Media') ) ) return ; // Check the current folder syntax (must begin and start with a slash). diff --git a/phpgwapi/js/fckeditor/editor/filemanager/browser/default/frmresourcetype.html b/phpgwapi/js/fckeditor/editor/filemanager/browser/default/frmresourcetype.html index 8eb2270de0..c2a067ce0f 100644 --- a/phpgwapi/js/fckeditor/editor/filemanager/browser/default/frmresourcetype.html +++ b/phpgwapi/js/fckeditor/editor/filemanager/browser/default/frmresourcetype.html @@ -31,7 +31,7 @@ function SetResourceType( type ) var aTypes = [ ['File','File'], - ['Image','Image'], + ['images','Image'], ['Flash','Flash'], ['Media','Media'] ] ; diff --git a/phpgwapi/js/fckeditor/editor/filemanager/upload/php/config.php b/phpgwapi/js/fckeditor/editor/filemanager/upload/php/config.php index 9faa39a112..d92a919a5c 100644 --- a/phpgwapi/js/fckeditor/editor/filemanager/upload/php/config.php +++ b/phpgwapi/js/fckeditor/editor/filemanager/upload/php/config.php @@ -28,7 +28,7 @@ $Config['Enabled'] = false ; $Config['UseFileType'] = false ; // Path to uploaded files relative to the document root. -$Config['UserFilesPath'] = '/UserFiles/' ; +//$Config['UserFilesPath'] = '/UserFiles/' ; // Fill the following value it you prefer to specify the absolute path for the // user files directory. Usefull if you are using a virtual directory, symbolic diff --git a/phpgwapi/js/fckeditor/fckconfig.js b/phpgwapi/js/fckeditor/fckconfig.js index 7553d76e8a..ce36a2e5c5 100644 --- a/phpgwapi/js/fckeditor/fckconfig.js +++ b/phpgwapi/js/fckeditor/fckconfig.js @@ -113,6 +113,28 @@ FCKConfig.ToolbarSets["egw_simple"] = [ ['TextColor','BGColor'] ] ; +FCKConfig.ToolbarSets["egw_extended"] = [ + ['Bold','Italic','Underline','-','JustifyLeft','JustifyCenter','JustifyRight','JustifyFull','-','UnorderedList','OrderedList','Outdent','Indent','Undo','Redo'], + '/', + ['FontFormat','FontName','FontSize'], + ['FitWindow','TextColor','BGColor'] +] ; + +FCKConfig.ToolbarSets["egw_advanced"] = [ + ['Source','DocProps','-','Save','NewPage','Preview','-','Templates'], + ['Cut','Copy','Paste','PasteText','PasteWord','-','Print','SpellCheck'], + ['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'], + '/', + ['Bold','Italic','Underline','StrikeThrough','-','Subscript','Superscript'], + ['OrderedList','UnorderedList','-','Outdent','Indent'], + ['JustifyLeft','JustifyCenter','JustifyRight','JustifyFull'], + ['Link','Unlink','Anchor'], + ['TextColor','BGColor','About'], + ['Image','Flash','Table','Rule','Smiley','SpecialChar','PageBreak','UniversalKey'], + '/', + ['FitWindow','Style','FontFormat','FontName','FontSize'] +] ; + FCKConfig.ContextMenu = ['Generic','Link','Anchor','Image','Flash','Select','Textarea','Checkbox','Radio','TextField','HiddenField','ImageButton','Button','BulletedList','NumberedList','Table','Form'] ; FCKConfig.FontColors = '000000,993300,333300,003300,003366,000080,333399,333333,800000,FF6600,808000,808080,008080,0000FF,666699,808080,FF0000,FF9900,99CC00,339966,33CCCC,3366FF,800080,999999,FF00FF,FFCC00,FFFF00,00FF00,00FFFF,00CCFF,993366,C0C0C0,FF99CC,FFCC99,FFFF99,CCFFCC,CCFFFF,99CCFF,CC99FF,FFFFFF' ;