Index: branches/RC/core/kernel/db/db_tag_processor.php =================================================================== diff -u -N -r10911 -r10974 --- branches/RC/core/kernel/db/db_tag_processor.php (.../db_tag_processor.php) (revision 10911) +++ branches/RC/core/kernel/db/db_tag_processor.php (.../db_tag_processor.php) (revision 10974) @@ -2030,50 +2030,70 @@ return $list->GetFormattedTotal($this->SelectParam($params, 'field,name'), $params['function']); } - function FCKEditor($params) + function SetFCKDefaultLanguage() { - if (file_exists(FULL_PATH.'/core/cmseditor/fckeditor.php')) { - $editor_path = 'core/cmseditor/'; - } - else { - $editor_path = 'admin/editor/cmseditor/'; - } - + $lang_id = $this->Application->GetDefaultLanguageId(); + $sql="SELECT Locale FROM ".TABLE_PREFIX."Language WHERE LanguageId = ".$lang_id; + $lang_prefix = strtolower($this->Conn->GetOne($sql)); + $lang_file=strtolower($this->Conn->GetOne($sql)).'.js'; + if (file_exists(FULL_PATH.'/core/fckeditor/editor/lang/'.$lang_file)) + { + return $lang_prefix; + } + $aLangPrefix = explode("-",$lang_prefix); + if (file_exists(FULL_PATH.'/core/fckeditor/editor/lang/'.$aLangPrefix[0].'.js')) + { + return $aLangPrefix[0]; + } + return 'en'; + } + + + function FCKEditor($params) { $params['no_special'] = 1; $value = $this->Field($params); - $name = $this->InputName($params); + $name = isset($params['name']) ? $params['name'] : $this->InputName($params); - $theme_path = $this->Application->BaseURL().mb_substr($this->Application->GetFrontThemePath(), 1); + $theme_path = substr($this->Application->GetFrontThemePath(), 1).'/inc/'; + if (!file_exists(FULL_PATH.'/'.$theme_path.'style.css')) { + $theme_path = EDITOR_PATH; + } + $styles_xml = $this->Application->BaseURL().$theme_path.'styles.xml'; + $styles_css = $this->Application->BaseURL().$theme_path.'style.css'; $bgcolor = isset($params['bgcolor']) ? $params['bgcolor'] : $this->Application->GetVar('bgcolor'); if (!$bgcolor) $bgcolor = '#ffffff'; - - include_once(FULL_PATH.'/'.$editor_path.'/fckeditor.php'); + $st_id = $this->Application->GetVar('st_id'); + if ($st_id) { + $tpl = $this->Conn->GetRow('SELECT NamedParentPath, CategoryId FROM '.TABLE_PREFIX.'Category WHERE CategoryId = '.$st_id); + $url = $this->Application->HREF($tpl['NamedParentPath'], '_FRONT_END_', array('pass'=>'m', 'm_cat_id' => $st_id, 'index_file' => 'index.php')); + } + include_once(FULL_PATH.EDITOR_PATH.'fckeditor.php'); $oFCKeditor = new FCKeditor($name); - $oFCKeditor->BasePath = BASE_PATH.'/'.$editor_path; + $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 = 'Advanced' ; - $oFCKeditor->Value = $value ; - - if ($this->Application->isModuleEnabled('In-Portal')) { - $config_path = $this->Application->BaseURL().'kernel/admin_templates/incs/inp_fckconfig.js'; - } - else { - $config_path = $this->Application->BaseURL().'core/admin_templates/js/inp_fckconfig.js'; - } - + $oFCKeditor->ToolbarSet = $st_id ? 'Advanced' : 'Default' ; + $oFCKeditor->Value = $value; + $oFCKeditor->PreviewUrl = $url; + $oFCKeditor->DefaultLanguage = $this->SetFCKDefaultLanguage(); + $oFCKeditor->LateLoad = isset($params['late_load']) && $params['late_load']; $oFCKeditor->Config = Array( -// 'UserFilesPath' => (defined('WRITEABLE') ? WRITEABLE : FULL_PATH.'/kernel') . '/user_files/', + //'UserFilesPath' => $pathtoroot.'kernel/user_files', 'ProjectPath' => BASE_PATH.'/', - 'CustomConfigurationsPath' => $config_path, - 'StylesXmlPath' => $theme_path.'/inc/styles.xml', - 'EditorAreaCSS' => $theme_path.'/inc/style.css', - 'DefaultClass' => 'Default Text', + '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, 'newBgColor' => $bgcolor, + 'PreviewUrl' => $url, + 'BaseUrl' => BASE_PATH.'/', + 'DefaultLanguage' => $this->SetFCKDefaultLanguage(), ); return $oFCKeditor->CreateHtml(); }