applay path #298 from Jose Luis Gordo Romero: sitmgr, api tiny->fck

This commit is contained in:
Cornelius Weiß 2007-01-18 17:59:28 +00:00
parent c823cfa15c
commit 1eb9dbe961
6 changed files with 87 additions and 5 deletions

View File

@ -568,6 +568,66 @@ class html
.'</textarea>';
}
/**
* 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 "<textarea name=\"$_name\" style=\"width:".$_width."; height:".$_height."; border:0px;\">$_content</textarea>";
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
*

View File

@ -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

View File

@ -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).

View File

@ -31,7 +31,7 @@ function SetResourceType( type )
var aTypes = [
['File','File'],
['Image','Image'],
['images','Image'],
['Flash','Flash'],
['Media','Media']
] ;

View File

@ -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

View File

@ -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' ;