Index: branches/5.2.x/core/kernel/db/db_tag_processor.php =================================================================== diff -u -N -r15014 -r15042 --- branches/5.2.x/core/kernel/db/db_tag_processor.php (.../db_tag_processor.php) (revision 15014) +++ branches/5.2.x/core/kernel/db/db_tag_processor.php (.../db_tag_processor.php) (revision 15042) @@ -1,6 +1,6 @@ Field($params); $name = array_key_exists('name', $params) ? $params['name'] : $this->InputName($params); - $theme_path = substr($this->Application->GetFrontThemePath(), 1) . '/inc/'; - if (!file_exists(FULL_PATH . '/' . $theme_path . 'style.css')) { - $theme_path = EDITOR_PATH; + $theme_path = $this->Application->GetFrontThemePath() . '/inc'; + + if ( file_exists(FULL_PATH . $theme_path . '/style.css') ) { + $url_params = Array ( + 'events[fck]' => 'OnGetsEditorStyles', + 'no_pass_through' => 1, 'pass' => 'm', 'no_amp' => 1 + ); + + $styles_css = $this->Application->HREF('index', '_FRONT_END_', $url_params, 'index.php'); } + else { + $theme_path = rtrim(EDITOR_PATH, '/'); + $styles_css = $this->Application->BaseURL($theme_path) . 'style.css'; + } - $styles_xml = $this->Application->BaseURL() . $theme_path . 'styles.xml'; - $styles_css = $this->Application->BaseURL() . $theme_path . 'style.css'; + $styles_js = $this->Application->BaseURL($theme_path) . 'styles.js'; + $bgcolor = isset($params['bgcolor']) ? $params['bgcolor'] : $this->Application->GetVar('bgcolor'); - $bgcolor = array_key_exists('bgcolor', $params) ? $params['bgcolor'] : $this->Application->GetVar('bgcolor'); - if (!$bgcolor) { + if ( !$bgcolor ) { $bgcolor = '#ffffff'; } - $preview_url = ''; $page_id = $this->Application->GetVar('c_id'); $content_id = $this->Application->GetVar('content_id'); + + /*$preview_url = ''; if ($page_id && $content_id) { // editing content block from Front-End, not category in admin $sql = 'SELECT NamedParentPath @@ -2574,39 +2584,69 @@ $url_params = Array ('m_cat_id' => $page_id, 'no_amp' => 1, 'editing_mode' => EDITING_MODE_CONTENT, 'pass' => 'm'); $preview_url = $this->Application->HREF($template, '_FRONT_END_', $url_params, 'index.php'); $preview_url = preg_replace('/&(admin|editing_mode)=[\d]/', '', $preview_url); + }*/ + + include_once(FULL_PATH . EDITOR_PATH . 'ckeditor.php'); + + $oCKeditor = new CKeditor(BASE_PATH . EDITOR_PATH); + +// $oFCKeditor->FullUrl = $this->Application->BaseURL(); +// $oFCKeditor->BaseUrl = BASE_PATH . '/'; // used by custom document plugin +// $oFCKeditor->PreviewUrl = $preview_url; // used by custom MyPreview plugin + + $oCKeditor->lateLoad = array_key_exists('late_load', $params) && $params['late_load']; + + $width = $params['width']; + $height = $params['height']; + + if ( preg_match('/^[\d]+$/', $width) ) { + $width .= 'px'; } - include_once(FULL_PATH . EDITOR_PATH . 'fckeditor.php'); + if ( preg_match('/^[\d]+$/', $height) ) { + $height .= 'px'; + } - $oFCKeditor = new FCKeditor($name); - $oFCKeditor->FullUrl = $this->Application->BaseURL(); - $oFCKeditor->BaseUrl = BASE_PATH . '/'; - $oFCKeditor->BasePath = BASE_PATH . EDITOR_PATH; - $oFCKeditor->Width = $params['width'] ; - $oFCKeditor->Height = $params['height'] ; - $oFCKeditor->ToolbarSet = $page_id && $content_id ? 'Advanced' : 'Default'; - $oFCKeditor->Value = $value; - $oFCKeditor->PreviewUrl = $preview_url; - $oFCKeditor->DefaultLanguage = $this->_getFCKLanguage(); - $oFCKeditor->LateLoad = array_key_exists('late_load', $params) && $params['late_load']; - $oFCKeditor->Config = Array ( - //'UserFilesPath' => $pathtoroot.'kernel/user_files', - 'ProjectPath' => BASE_PATH . '/', - 'CustomConfigurationsPath' => $this->Application->BaseURL() . 'core/admin_templates/js/inp_fckconfig.js', - 'StylesXmlPath' => $styles_xml, - 'EditorAreaCSS' => $styles_css, - 'DefaultStyleLabel' => $this->Application->Phrase('la_editor_default_style'), -// 'Debug' => 1, - 'Admin' => 1, - 'K4' => 1, + $oCKeditor->textareaAttributes = Array ( + 'style' => 'width: ' . $width . '; height: ' . $height . ';' + ); + + if ( file_exists(SYSTEM_PRESET_PATH . DIRECTORY_SEPARATOR . 'inp_ckconfig.js') ) { + $file_helper =& $this->Application->recallObject('FileHelper'); + /* @var $file_helper FileHelper */ + + $config_js = $file_helper->pathToUrl(SYSTEM_PRESET_PATH . DIRECTORY_SEPARATOR . 'inp_ckconfig.js'); + } + else { + $config_js = $this->Application->BaseURL() . 'core/admin_templates/js/inp_ckconfig.js'; + } + + $oCKeditor->config = Array ( + 'toolbar' => $this->Application->isDebugMode() ? 'DebugMode' : 'Default', // $page_id && $content_id ? 'Advanced' : 'Default', + + 'baseHref' => $this->Application->BaseURL( trim(EDITOR_PATH, '/') ), + +// 'ProjectPath' => BASE_PATH . '/', // used by custom MyPreview plugin + + 'customConfig' => $config_js, + 'stylesSet' => 'portal:' . $styles_js, + 'contentsCss' => $styles_css, +// 'DefaultStyleLabel' => $this->Application->Phrase('la_editor_default_style'), // not ported to ckeditor + 'Admin' => 1, // for custom file browser to work + 'K4' => 1, // for custom file browser to work 'newBgColor' => $bgcolor, - 'PreviewUrl' => $preview_url, - 'BaseUrl' => BASE_PATH . '/', - 'DefaultLanguage' => $this->_getFCKLanguage(), - 'EditorAreaStyles' => 'body { background-color: '.$bgcolor.' }', +// 'PreviewUrl' => $preview_url, +// 'BaseUrl' => BASE_PATH . '/', // used by custom document plugin & by file browser + 'language' => $this->_getFCKLanguage(), + +// 'EditorAreaStyles' => 'body { background-color: '.$bgcolor.' }', // TODO + + 'height' => $height, // editor area height ); - return $oFCKeditor->CreateHtml(); + $oCKeditor->returnOutput = true; + + return $oCKeditor->editor($name, $value); } function IsNewItem($params)