Index: branches/5.3.x/core/admin_templates/categories/edit_content.tpl
===================================================================
diff -u -N -r15908 -r15946
--- branches/5.3.x/core/admin_templates/categories/edit_content.tpl (.../edit_content.tpl) (revision 15908)
+++ branches/5.3.x/core/admin_templates/categories/edit_content.tpl (.../edit_content.tpl) (revision 15946)
@@ -1,7 +1,6 @@
-
Index: branches/5.3.x/core/units/helpers/fck_helper.php
===================================================================
diff -u -N -r15677 -r15946
--- branches/5.3.x/core/units/helpers/fck_helper.php (.../fck_helper.php) (revision 15677)
+++ branches/5.3.x/core/units/helpers/fck_helper.php (.../fck_helper.php) (revision 15946)
@@ -1,6 +1,6 @@
prepareConfig($this->getEditor(), $params);
+
+ $width = $this->normalizeDimension($params['width']);
+ $height = $this->normalizeDimension($params['height']);
+
+ $editor->textareaAttributes = Array (
+ 'style' => 'width: ' . $width . '; height: ' . $height . ';'
+ );
+
+ $editor->config['height'] = $height; // editor area height
+
+ $events = Array (
+ 'configLoaded' => 'function(ev) { CKEDITOR.addCss(ev.editor.config.extraCss); }',
+ );
+
+ return $editor->editor($editor_name, $editor_value, Array (), $events);
+ }
+
+ public function CKEditorInlineTag($editor_name, $params)
+ {
+ $editor = $this->prepareConfig($this->getEditor(), $params);
+
+ $events = Array (
+ 'configLoaded' => 'function(ev) { CKEDITOR.addCss(ev.editor.config.extraCss); }',
+ 'focus' => 'function(ev) { $("body").trigger("InlineEditor.Focus", [ev]); }',
+ 'blur' => 'function(ev) { $("body").trigger("InlineEditor.Blur", [ev]); }',
+ );
+
+ return $editor->inline($editor_name, Array (), $events);
+ }
+
/**
+ * Adds measurement units to editor dimensions.
+ *
+ * @param string $dimension Dimension.
+ *
+ * @return string
+ */
+ protected function normalizeDimension($dimension)
+ {
+ if ( preg_match('/^[\d]+$/', $dimension) ) {
+ $dimension .= 'px';
+ }
+
+ return $dimension;
+ }
+
+ /**
+ * Returns editor instance.
+ *
+ * @return CKEditor
+ */
+ protected function getEditor()
+ {
+ include_once(FULL_PATH . EDITOR_PATH . 'ckeditor.php');
+ $editor = new CKeditor(BASE_PATH . EDITOR_PATH);
+ $editor->returnOutput = true;
+
+ return $editor;
+ }
+
+ /**
+ * Prepares editor config.
+ *
+ * @param CKEditor $editor Editor.
+ * @param array $tag_params Tag params.
+ *
+ * @return CKEditor
+ */
+ protected function prepareConfig(CKEditor $editor, array $tag_params)
+ {
+ $editor->lateLoad = array_key_exists('late_load', $tag_params) && $tag_params['late_load'];
+
+ list($styles_css, $styles_js) = $this->getStyles();
+
+ if ( isset($tag_params['toolbar']) ) {
+ $toolbar = $tag_params['toolbar'];
+ }
+ elseif ( isset($tag_params['mode']) && $tag_params['mode'] == 'inline' ) {
+ $toolbar = 'Inline';
+ }
+ else {
+ $toolbar = $this->Application->isDebugMode() ? 'DebugMode' : 'Default';
+ }
+
+ $editor->config = Array (
+ 'toolbar' => $toolbar,
+ 'baseHref' => $this->Application->BaseURL( rtrim(EDITOR_PATH, '/') ),
+ 'customConfig' => $this->getJavaScriptConfig(),
+ 'stylesSet' => 'portal:' . $styles_js,
+ 'contentsCss' => $styles_css,
+ 'Admin' => 1, // for custom file browser to work
+ 'K4' => 1, // for custom file browser to work
+ 'language' => $this->getLanguage(),
+ );
+
+ $this->injectTransitParams($editor, $this->getTransitParams($tag_params));
+
+ return $editor;
+ }
+
+ /**
+ * Transforms transit params into editor config.
+ *
+ * @param CKEditor $editor Editor.
+ * @param array $transit_params Transit params.
+ *
+ * @return void
+ */
+ protected function injectTransitParams(CKEditor $editor, array $transit_params)
+ {
+ if ( isset($transit_params['bgcolor']) && $transit_params['bgcolor'] ) {
+ $editor->config['extraCss'] = 'body { background-color: ' . $transit_params['bgcolor'] . '; }';
+ }
+
+ foreach ($transit_params as $param_name => $param_value) {
+ if ( !$param_value ) {
+ continue;
+ }
+
+ $param_key = str_replace(' ', '', ucwords(str_replace('_', ' ', $param_name)));
+ $param_key[0] = strtolower($param_key[0]);
+
+ $editor->config[$param_key] = $param_value;
+ }
+ }
+
+ /**
+ * Returns url to CSS and JS style configuration.
+ *
+ * @return array
+ */
+ protected function getStyles()
+ {
+ $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_js = $this->Application->BaseURL($theme_path) . 'styles.js';
+
+ return array($styles_css, $styles_js);
+ }
+
+ /**
+ * Returns url to JavaScript configuration file.
+ *
+ * @return string
+ */
+ protected function getJavaScriptConfig()
+ {
+ if ( file_exists(SYSTEM_PRESET_PATH . DIRECTORY_SEPARATOR . 'inp_ckconfig.js') ) {
+ $file_helper = $this->Application->recallObject('FileHelper');
+ /* @var $file_helper FileHelper */
+
+ return $file_helper->pathToUrl(SYSTEM_PRESET_PATH . DIRECTORY_SEPARATOR . 'inp_ckconfig.js');
+ }
+
+ return $this->Application->BaseURL() . 'core/admin_templates/js/inp_ckconfig.js';
+ }
+
+ /**
+ * Returns CKEditor locale, that matches default site language.
+ *
+ * @return string
+ */
+ protected function getLanguage()
+ {
+ static $language_code = null;
+
+ if ( !isset($language_code) ) {
+ $language_code = 'en'; // default value
+
+ if ( $this->Application->isAdmin ) {
+ $language_id = $this->Application->Phrases->LanguageId;
+ }
+ else {
+ $language_id = $this->Application->GetDefaultLanguageId(); // $this->Application->GetVar('m_lang');
+ }
+
+ $sql = 'SELECT Locale
+ FROM ' . $this->Application->getUnitConfig('lang')->getTableName() . '
+ WHERE LanguageId = ' . $language_id;
+ $locale = strtolower($this->Conn->GetOne($sql));
+
+ if ( file_exists(FULL_PATH . EDITOR_PATH . 'editor/lang/' . $locale . '.js') ) {
+ // found language file, that exactly matches locale name (e.g. "en")
+ $language_code = $locale;
+ }
+ else {
+ $locale = explode('-', $locale);
+
+ if ( file_exists(FULL_PATH . EDITOR_PATH . 'editor/lang/' . $locale[0] . '.js') ) {
+ // language file matches first part of locale (e.g. "ru-RU")
+ $language_code = $locale[0];
+ }
+ }
+ }
+
+ return $language_code;
+ }
+
+ /**
* Returns transit parameters, that should be passed to every used CKEditor instance
*
* @param Array $tag_params
Index: branches/5.3.x/core/admin_templates/img/top_frame/icons/saving_indicator.gif
===================================================================
diff -u -N
--- branches/5.3.x/core/admin_templates/img/top_frame/icons/saving_indicator.gif (revision 0)
+++ branches/5.3.x/core/admin_templates/img/top_frame/icons/saving_indicator.gif (revision 15946)
@@ -0,0 +1,22 @@
+GIF89a � �����������Ž�����������rrrcccRRRBBB111!!! ��� !�NETSCAPE2.0 !� , v $B�(�BB#�#��(