Index: branches/RC/core/units/categories/categories_tag_processor.php
===================================================================
diff -u -r11711 -r11760
--- branches/RC/core/units/categories/categories_tag_processor.php (.../categories_tag_processor.php) (revision 11711)
+++ branches/RC/core/units/categories/categories_tag_processor.php (.../categories_tag_processor.php) (revision 11760)
@@ -1183,9 +1183,7 @@
$data = $content->GetField('Content');
}
- $data = $this->_transformContentBlockData($data, $params);
-
- return $edit_code_before . $this->_replacePageIds($data) . $edit_code_after;
+ return $edit_code_before . $this->_transformContentBlockData($data, $params) . $edit_code_after;
}
/**
@@ -1200,38 +1198,6 @@
}
/**
- * Replace links like "@@ID@@" to actual template names in given text
- *
- * @param string $text
- * @return string
- */
- function _replacePageIds($text)
- {
- if (!preg_match_all('/@@(\\d+)@@/', $text, $regs)) {
- return $text;
- }
-
- $page_ids = $regs[1];
-
- $sql = 'SELECT NamedParentPath, CategoryId
- FROM ' . TABLE_PREFIX . 'Category
- WHERE CategoryId IN (' . implode(',', $page_ids) . ')';
-
- $templates = $this->Conn->GetCol($sql, 'CategoryId');
-
- foreach ($page_ids as $page_id) {
- if (!array_key_exists($page_id, $templates)) {
- // internal page was deleted, but link to it was found in given content block data
- continue;
- }
-
- $text = preg_replace('/@@' . $page_id . '@@/', $this->Application->HREF(strtolower($templates[$page_id]), '', Array ('pass' => 'm')), $text);
- }
-
- return $text;
- }
-
- /**
* Returns current page name or page based on page/page_id parameters
*
* @param Array $params
Index: branches/RC/core/units/general/helpers/category_helper.php
===================================================================
diff -u -r11724 -r11760
--- branches/RC/core/units/general/helpers/category_helper.php (.../category_helper.php) (revision 11724)
+++ branches/RC/core/units/general/helpers/category_helper.php (.../category_helper.php) (revision 11760)
@@ -423,7 +423,40 @@
return $this->_structureTree;
}
- }
+ /**
+ * Replace links like "@@ID@@" to actual template names in given text
+ *
+ * @param string $text
+ * @return string
+ */
+ function replacePageIds($text)
+ {
+ if (!preg_match_all('/@@(\\d+)@@/', $text, $regs)) {
+ return $text;
+ }
-?>
\ No newline at end of file
+ $page_ids = $regs[1];
+
+ $sql = 'SELECT NamedParentPath, CategoryId
+ FROM ' . TABLE_PREFIX . 'Category
+ WHERE CategoryId IN (' . implode(',', $page_ids) . ')';
+ $templates = $this->Conn->GetCol($sql, 'CategoryId');
+
+ foreach ($page_ids as $page_id) {
+ if (!array_key_exists($page_id, $templates)) {
+ // internal page was deleted, but link to it was found in given content block data
+ continue;
+ }
+
+ $url_params = Array ('m_cat_id' => $page_id, 'pass' => 'm');
+ $page_url = $this->Application->HREF(strtolower($templates[$page_id]), '', $url_params);
+ /*if ($this->Application->IsAdmin()) {
+ $page_url = preg_replace('/&(admin|editing_mode)=[\d]/', '', $page_url);
+ }*/
+ $text = preg_replace('/@@' . $page_id . '@@/', $page_url, $text);
+ }
+
+ return $text;
+ }
+ }
\ No newline at end of file
Index: branches/RC/core/units/groups/groups_config.php
===================================================================
diff -u -r11546 -r11760
--- branches/RC/core/units/groups/groups_config.php (.../groups_config.php) (revision 11546)
+++ branches/RC/core/units/groups/groups_config.php (.../groups_config.php) (revision 11760)
@@ -69,7 +69,7 @@
'Fields' => Array (
'GroupId' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0),
'Name' => Array ('type' => 'string', 'not_null' => 1, 'required' => 1, 'default' => ''),
- 'Description' => Array ('type' => 'string', 'default' => null),
+ 'Description' => Array ('type' => 'string', 'formatter' => 'kFormatter', 'using_fck' => 1, 'default' => null),
'CreatedOn' => Array ('type' => 'int', 'formatter' => 'kDateFormatter', 'default' => '#NOW#'),
'System' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0),
'Personal' => Array ('type' => 'int','not_null' => 1, 'default' => 0),
Index: branches/RC/core/units/themes/themes_config.php
===================================================================
diff -u -r11661 -r11760
--- branches/RC/core/units/themes/themes_config.php (.../themes_config.php) (revision 11661)
+++ branches/RC/core/units/themes/themes_config.php (.../themes_config.php) (revision 11760)
@@ -104,7 +104,7 @@
'ThemeId' => Array('type' => 'int', 'not_null' => 1, 'default' => 0),
'Name' => Array('type' => 'string','not_null' => 1, 'required' => 1, 'default' => ''),
'Enabled' => Array('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array(1=>'la_Enabled', 0=>'la_Disabled'), 'use_phrases'=>1, 'not_null' => 1, 'default' => 1),
- 'Description' => Array('type' => 'string','default' => null),
+ 'Description' => Array('type' => 'string', 'formatter' => 'kFormatter', 'using_fck' => 1, 'default' => null),
'PrimaryTheme' => Array('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'la_Yes', 0 => 'la_No'), 'use_phrases' => 1, 'not_null' => 1, 'default' => 0),
'CacheTimeout' => Array('type' => 'int', 'not_null' => 1, 'default' => 0),
'StylesheetId' => Array('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options_sql' => 'SELECT %s FROM '.TABLE_PREFIX.'Stylesheets', 'option_key_field' => 'StylesheetId', 'option_title_field' => 'Name', 'not_null' => 1, 'default' => 0),
Index: branches/RC/core/units/categories/categories_config.php
===================================================================
diff -u -r11724 -r11760
--- branches/RC/core/units/categories/categories_config.php (.../categories_config.php) (revision 11724)
+++ branches/RC/core/units/categories/categories_config.php (.../categories_config.php) (revision 11760)
@@ -248,12 +248,12 @@
'Name' => Array ('type' => 'string', 'formatter' => 'kMultiLanguage', 'format'=>'no_default', 'not_null' => 1, 'required' => 1, 'default' => ''),
'Filename' => Array ('type' => 'string', 'not_null' => 1, 'default' => ''),
'AutomaticFilename' => Array ('type' => 'int', 'not_null' => 1, 'default' => 1),
- 'Description' => Array ('type' => 'string', 'formatter' => 'kMultiLanguage', 'format'=>'no_default', 'default' => null),
+ 'Description' => Array ('type' => 'string', 'formatter' => 'kMultiLanguage', 'format' => 'no_default', 'using_fck' => 1, 'default' => null),
'CreatedOn' => Array ('type' => 'int', 'formatter' => 'kDateFormatter', 'default'=>'#NOW#', 'required' => 1, 'not_null' => 1),
'EditorsPick' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0),
'Status' => Array ('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'la_Active', 2 => 'la_Pending', 0 => 'la_Disabled' ), 'use_phrases' => 1, 'not_null' => 1,'default' => 1),
'Priority' => Array ('type' => 'int', 'not_null' => 1, 'formatter' => 'kOptionsFormatter', 'options' => Array (), 'default' => 0),
- 'MetaKeywords' => Array ('type' => 'string', 'default' => null),
+ 'MetaKeywords' => Array ('type' => 'string', 'formatter' => 'kFormatter', 'using_fck' => 1, 'default' => null),
'CachedDescendantCatsQty' => Array ('type' => 'int', 'default' => 0),
'CachedNavbar' => Array ('type' => 'string', 'formatter' => 'kMultiLanguage', 'default' => null),
'CreatedById' => Array ('type' => 'int', 'formatter' => 'kLEFTFormatter', 'error_msgs' => Array ('invalid_option' => '!la_error_UserNotFound!'), 'options' => Array (-1 => 'root', -2 => 'Guest'),'left_sql'=>'SELECT %s FROM '.TABLE_PREFIX.'PortalUser WHERE `%s` = \'%s\'', 'left_key_field' => 'PortalUserId', 'left_title_field' => 'Login', 'not_null' => 1,'default' => 0),
@@ -262,7 +262,7 @@
'TreeLeft' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0),
'TreeRight' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0),
'NamedParentPath' => Array ('type' => 'string', 'default' => null),
- 'MetaDescription' => Array ('type' => 'string', 'default' => null),
+ 'MetaDescription' => Array ('type' => 'string', 'formatter' => 'kFormatter', 'using_fck' => 1, 'default' => null),
'HotItem' => Array ('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (2 => 'la_Auto', 1 => 'la_Always', 0 => 'la_Never'), 'use_phrases' => 1, 'not_null' => 1, 'default' => 2),
'NewItem' => Array ('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (2 => 'la_Auto', 1 => 'la_Always', 0 => 'la_Never'), 'use_phrases' => 1, 'not_null' => 1, 'default' => 2),
'PopItem' => Array ('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (2 => 'la_Auto', 1 => 'la_Always', 0 => 'la_Never'), 'use_phrases' => 1, 'not_null' => 1, 'default' => 2),
@@ -300,7 +300,7 @@
'Title' => Array ('type' => 'string', 'formatter' => 'kMultiLanguage', 'format'=>'no_default', 'default' => '', 'not_null'=>1),
'MenuTitle' => Array ('type' => 'string', 'formatter' => 'kMultiLanguage', 'format'=>'no_default', 'not_null' => 1, 'default' => ''),
'MetaTitle' => Array ('type' => 'string', 'default' => null),
- 'IndexTools' => Array ('type' => 'string', 'default' => null),
+ 'IndexTools' => Array ('type' => 'string', 'formatter' => 'kFormatter', 'using_fck' => 1, 'default' => null),
'IsIndex' =>
Array (
'type' => 'int', 'not_null' => 1, 'default' => 0,
Index: branches/RC/core/units/forms/forms_config.php
===================================================================
diff -u -r11623 -r11760
--- branches/RC/core/units/forms/forms_config.php (.../forms_config.php) (revision 11623)
+++ branches/RC/core/units/forms/forms_config.php (.../forms_config.php) (revision 11760)
@@ -95,7 +95,7 @@
'Fields' => Array(
'FormId' => Array('type' => 'int', 'not_null' => 1, 'default' => 0, 'filter_type' => 'equals'),
'Title' => Array('type' => 'string','not_null' => 1, 'default' => '','required' => 1),
- 'Description' => Array('type' => 'string', 'default' => null,),
+ 'Description' => Array('type' => 'string', 'formatter' => 'kFormatter', 'using_fck' => 1, 'default' => null),
),
'Grids' => Array(
'Default' => Array(
Index: branches/RC/core/units/translator/translator_config.php
===================================================================
diff -u -r10779 -r11760
--- branches/RC/core/units/translator/translator_config.php (.../translator_config.php) (revision 10779)
+++ branches/RC/core/units/translator/translator_config.php (.../translator_config.php) (revision 11760)
@@ -38,7 +38,7 @@
'Original' => Array(),
'Language' => Array(),
'SwitchLanguage' => Array('formatter' => 'kOptionsFormatter', 'options_sql' => 'SELECT %s FROM '.TABLE_PREFIX.'Language', 'option_key_field' => 'LanguageId','option_title_field' => 'PackName'),
- 'Translation' => Array(),
+ 'Translation' => Array('type' => 'string', 'formatter' => 'kFormatter', 'using_fck' => 1, 'default' => ''),
),
'Grids' => Array(),
);
Index: branches/RC/core/units/email_messages/email_messages_config.php
===================================================================
diff -u -r11711 -r11760
--- branches/RC/core/units/email_messages/email_messages_config.php (.../email_messages_config.php) (revision 11711)
+++ branches/RC/core/units/email_messages/email_messages_config.php (.../email_messages_config.php) (revision 11760)
@@ -83,8 +83,8 @@
),
'VirtualFields' => Array (
- 'Headers' => Array('type'=>'string'),
- 'Body' => Array('type'=>'string'),
+ 'Headers' => Array('type' => 'string', 'default' => ''),
+ 'Body' => Array('type' => 'string', 'formatter' => 'kFormatter', 'using_fck' => 1, 'default' => ''),
'ReplacementTags' => Array ('type' => 'string', 'default' => null),
'Description' => Array('type'=>'string', 'sql_filter_type'=>'having'),
'Module' => Array('type' => 'string','not_null' => '1','default' => ''),
@@ -93,8 +93,8 @@
// for mass mail sending
'MassSubject' => Array ('type' => 'string', 'default' => ''),
'MassAttachment' => Array ('type' => 'string', 'formatter' => 'kUploadFormatter', 'upload_dir' => ITEM_FILES_PATH, 'max_size' => 50000000, 'default' => ''),
- 'MassHtmlMessage' => Array ('type' => 'string', 'default' => 'Type your Message Here'),
- 'MassTextMessage' => Array ('type' => 'string', 'default' => 'Type your Message Here'),
+ 'MassHtmlMessage' => Array ('type' => 'string', 'formatter' => 'kFormatter', 'using_fck' => 1, 'default' => 'Type your Message Here'),
+ 'MassTextMessage' => Array ('type' => 'string', 'formatter' => 'kFormatter', 'using_fck' => 1, 'default' => 'Type your Message Here'),
),
'Grids' => Array(
Index: branches/RC/core/kernel/utility/formatters/multilang_formatter.php
===================================================================
diff -u -r11291 -r11760
--- branches/RC/core/kernel/utility/formatters/multilang_formatter.php (.../multilang_formatter.php) (revision 11291)
+++ branches/RC/core/kernel/utility/formatters/multilang_formatter.php (.../multilang_formatter.php) (revision 11760)
@@ -136,12 +136,17 @@
$options = $object->GetFieldOptions($field_name);
$format = isset($format) ? $format : ( isset($options['format']) ? $options['format'] : null);
- if ( $value == '' && $format != 'no_default') { // try to get default language value
+ // use strpos, becase 2 comma-separated formats could be specified
+ if ($value == '' && strpos($format, 'no_default') === false) { // try to get default language value
$def_lang_value = $object->GetDBField('l'.$this->Application->GetDefaultLanguageId().'_'.$master_field);
- if ($def_lang_value == '') return NULL;
- return $def_lang_value; //return value from default language
+ if ($def_lang_value == '') {
+ return NULL;
+ }
+
+ return $this->_replaceFCKLinks($def_lang_value, $options, $format); //return value from default language
}
- return $value;
+
+ return $this->_replaceFCKLinks($value, $options, $format);
}
/**
Index: branches/RC/core/install/install_toolkit.php
===================================================================
diff -u -r11711 -r11760
--- branches/RC/core/install/install_toolkit.php (.../install_toolkit.php) (revision 11711)
+++ branches/RC/core/install/install_toolkit.php (.../install_toolkit.php) (revision 11760)
@@ -559,7 +559,7 @@
$category_fields = Array (
$fields['name'] => $name, 'Filename' => $name, 'AutomaticFilename' => 1,
- $fields['description'] => $description, 'Status' => $status,
+ $fields['description'] => $description, 'Status' => $status, 'Priority' => -9999,
);
$category_fields['ParentId'] = $this->Application->findModule('Name', 'Core', 'RootCat');
@@ -582,6 +582,13 @@
// ensure, that newly created category has proper value in Priority field
$priority_helper->recalculatePriorities($event, 'ParentId = ' . $category_fields['ParentId']);
+ // update Priority field in object, becase "CategoriesItem::Update" method will be called
+ // from "kInstallToolkit::setModuleItemTemplate" and otherwise will set 0 to Priority field
+ $sql = 'SELECT Priority
+ FROM ' . $category->TableName . '
+ WHERE ' . $category->IDField . ' = ' . $category->GetID();
+ $category->SetDBField('Priority', $this->Conn->GetOne($sql));
+
return $category;
}
Index: branches/RC/core/units/reviews/reviews_config.php
===================================================================
diff -u -r11538 -r11760
--- branches/RC/core/units/reviews/reviews_config.php (.../reviews_config.php) (revision 11538)
+++ branches/RC/core/units/reviews/reviews_config.php (.../reviews_config.php) (revision 11760)
@@ -147,7 +147,7 @@
'Fields' => Array (
'ReviewId' => Array('type' => 'int', 'not_null' => 1, 'default' => 0),
'CreatedOn' => Array('type' => 'int', 'formatter'=>'kDateFormatter', 'default'=>'#NOW#'),
- 'ReviewText' => Array('type'=>'string','required'=>1,'not_null'=>1,'default'=>''),
+ 'ReviewText' => Array('type' => 'string', 'formatter' => 'kFormatter', 'required' => 1, 'not_null' => 1, 'using_fck' => 1, 'default' => ''),
'Rating' => Array ('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (0 => 'lu_None', 1 => 'lu_Rating_1', 2 => 'lu_Rating_2', 3 => 'lu_Rating_3', 4 => 'lu_Rating_4', 5 => 'lu_Rating_5'), 'use_phrases' => 1, 'min_value_inc' => 0, 'max_value_inc' => 5, 'default' => 0),
'IPAddress' => Array('type'=>'string','max_value_inc'=>15,'not_null'=>1,'default'=>''),
'ItemId' => Array('type'=>'int','not_null'=>1,'default'=>0),
Index: branches/RC/core/units/phrases/phrases_config.php
===================================================================
diff -u -r11685 -r11760
--- branches/RC/core/units/phrases/phrases_config.php (.../phrases_config.php) (revision 11685)
+++ branches/RC/core/units/phrases/phrases_config.php (.../phrases_config.php) (revision 11760)
@@ -136,7 +136,7 @@
'not_null' => 1, 'default' => ''
),
- 'Translation' => Array ('type' => 'string', 'required'=>1,'not_null' => '1', 'default' => ''),
+ 'Translation' => Array ('type' => 'string', 'formatter' => 'kFormatter', 'required' => 1, 'not_null' => 1, 'using_fck' => 1, 'default' => ''),
'PhraseType' => Array ('type' => 'int', 'required'=>1,'formatter' => 'kOptionsFormatter', 'options'=>Array (0=>'la_PhraseType_Front',1=>'la_PhraseType_Admin',2=>'la_PhraseType_Both'), 'use_phrases' => 1, 'not_null' => 1, 'default' => 0),
'PhraseId' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0),
Index: branches/RC/core/units/content/content_config.php
===================================================================
diff -u -r11610 -r11760
--- branches/RC/core/units/content/content_config.php (.../content_config.php) (revision 11610)
+++ branches/RC/core/units/content/content_config.php (.../content_config.php) (revision 11760)
@@ -1,58 +1,53 @@
'content',
- 'ItemClass' => Array('class'=>'kDBItem','file'=>'','build_event'=>'OnItemBuild'),
- 'ListClass' => Array('class'=>'kDBList','file'=>'','build_event'=>'OnListBuild'),
- 'EventHandlerClass' => Array('class'=>'kDBEventHandler','file'=>'','build_event'=>'OnBuild'),
- 'TagProcessorClass' => Array('class'=>'kDBTagProcessor','file'=>'','build_event'=>'OnBuild'),
- 'AutoLoad' => true,
- 'QueryString' => Array(
- 1 => 'id',
- 2 => 'Page',
- 3 => 'event',
- 4 => 'mode',
- ),
- 'IDField' => 'PageContentId',
- 'ParentTableKey'=> 'CategoryId', // linked field in master table
- 'ForeignKey' => 'PageId', // linked field in subtable
- 'ParentPrefix' => 'c',
- 'AutoDelete' => true,
- 'AutoClone' => true,
+ $config = Array (
+ 'Prefix' => 'content',
+ 'ItemClass' => Array ('class' => 'kDBItem', 'file' => '', 'build_event' => 'OnItemBuild'),
+ 'ListClass' => Array ('class' => 'kDBList', 'file' => '', 'build_event' => 'OnListBuild'),
+ 'EventHandlerClass' => Array ('class' => 'ContentEventHandler', 'file' => 'content_eh.php', 'build_event' => 'OnBuild'),
+ 'TagProcessorClass' => Array ('class' => 'kDBTagProcessor', 'file' => '', 'build_event' => 'OnBuild'),
+ 'AutoLoad' => true,
+ 'QueryString' => Array (
+ 1 => 'id',
+ 2 => 'Page',
+ 3 => 'event',
+ 4 => 'mode',
+ ),
- 'TitleField' => 'ContentNum', // field, used in bluebar when editing existing item
+ 'IDField' => 'PageContentId',
+ 'ParentTableKey' => 'CategoryId', // linked field in master table
+ 'ForeignKey' => 'PageId', // linked field in subtable
+ 'ParentPrefix' => 'c',
+ 'AutoDelete' => true,
+ 'AutoClone' => true,
- 'ViewMenuPhrase' => 'la_text_Pages',
+ 'TitleField' => 'ContentNum', // field, used in bluebar when editing existing item
+ 'ViewMenuPhrase' => 'la_text_Pages',
+ 'TitlePhrase' => 'la_text_PageContent',
- 'TitlePhrase' => 'la_text_PageContent',
+ 'TitlePresets' => Array (
+ 'default' => Array (
+ 'new_status_labels' => Array ('content' => '!la_title_Adding_Content!'),
+ 'edit_status_labels' => Array ('content' => '!la_title_Editing_Content!'),
+ ),
+ 'content_edit' => Array ('prefixes' => Array ('content'), 'format' => '#content_status# - !la_title_General!'),
+ ),
- 'TitlePresets' => Array(
- 'default' => Array( 'new_status_labels' => Array('content'=>'!la_title_Adding_Content!'),
- 'edit_status_labels' => Array('content'=>'!la_title_Editing_Content!'),
- 'new_titlefield' => Array('content'=>''),
- ),
- 'content_edit' => Array('prefixes' => Array('content'), 'format' => '#content_status# - !la_title_General!'),
- ),
+ 'TableName' => TABLE_PREFIX . 'PageContent',
- 'TableName' => TABLE_PREFIX.'PageContent',
+ 'ListSQLs' => Array ('' => 'SELECT * FROM %s'),
+ 'ListSortings' => Array (
+ '' => Array (
+ 'Sorting' => Array ('ContentNum' => 'asc'),
+ )
+ ),
-// 'PermSection' => Array('main' => 'CATEGORY:in-portal:structure', ),
+ 'Fields' => Array (
+ 'PageContentId' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0),
+ 'ContentNum' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0),
+ 'PageId' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0),
+ 'Content' => Array ('type' => 'string', 'formatter' => 'kMultiLanguage', 'format' => 'no_default', 'using_fck' => 1, 'default' => ''),
+ 'Translated' => Array ('type' => 'int', 'formatter' => 'kMultiLanguage', 'not_null' => 1, 'default' => 0, 'db_type' => 'tinyint', 'index_type' => 'int'),
+ ),
- 'ListSQLs' => Array('' => 'SELECT * FROM %s'), // key - special, value - list select sql
- 'ListSortings' => Array(
- '' => Array(
- 'Sorting' => Array('ContentNum' => 'asc'),
- )
- ),
- 'ItemSQLs' => Array('' => 'SELECT * FROM %s'),
-
- 'Fields' => Array (
- 'PageContentId' => Array('type' => 'int', 'not_null' => 1, 'default' => 0),
- 'ContentNum' => Array('type' => 'int','not_null' => 1, 'default' => 0),
- 'PageId' => Array('type' => 'int','not_null' => 1, 'default' => 0),
- 'Content' => Array('type' => 'string','formatter'=>'kMultiLanguage', 'format'=>'no_default', 'default' => ''),
- 'Translated' => Array ('type' => 'int', 'formatter' => 'kMultiLanguage', 'not_null' => 1, 'default' => 0, 'db_type' => 'tinyint', 'index_type' => 'int'),
- ),
-
);
-?>
\ No newline at end of file
Index: branches/RC/core/units/content/content_eh.php
===================================================================
diff -u
--- branches/RC/core/units/content/content_eh.php (revision 0)
+++ branches/RC/core/units/content/content_eh.php (revision 11760)
@@ -0,0 +1,23 @@
+Application->recallObject('PermissionsHelper');
+ /* @var $perm_helper kPermissionsHelper */
+
+ $user_id = $this->Application->RecallVar('user_id');
+
+ // user can change top category
+ $perm_status = $perm_helper->CheckUserPermission($user_id, 'CATEGORY.MODIFY', 0, 0);
+
+ return $perm_helper->finalizePermissionCheck($event, $perm_status);
+ }
+
+ }
\ No newline at end of file
Index: branches/RC/core/admin_templates/regional/languages_edit.tpl
===================================================================
diff -u -r11698 -r11760
--- branches/RC/core/admin_templates/regional/languages_edit.tpl (.../languages_edit.tpl) (revision 11698)
+++ branches/RC/core/admin_templates/regional/languages_edit.tpl (.../languages_edit.tpl) (revision 11760)
@@ -77,7 +77,7 @@
-
+
Index: branches/RC/core/admin_templates/incs/form_blocks.tpl
===================================================================
diff -u -r11724 -r11760
--- branches/RC/core/admin_templates/incs/form_blocks.tpl (.../form_blocks.tpl) (revision 11724)
+++ branches/RC/core/admin_templates/incs/form_blocks.tpl (.../form_blocks.tpl) (revision 11760)
@@ -433,7 +433,7 @@
*:
-
+
@@ -447,7 +447,7 @@
fields[''][''] = ''
-
+
@@ -525,7 +525,7 @@
|
|
-
+
|
Index: branches/RC/core/units/stylesheets/stylesheets_config.php
===================================================================
diff -u -r11612 -r11760
--- branches/RC/core/units/stylesheets/stylesheets_config.php (.../stylesheets_config.php) (revision 11612)
+++ branches/RC/core/units/stylesheets/stylesheets_config.php (.../stylesheets_config.php) (revision 11760)
@@ -111,8 +111,8 @@
'Fields' => Array(
'StylesheetId' => Array('type' => 'int', 'not_null' => 1, 'default' => 0),
'Name' => Array('type' => 'string','not_null' => '1','default' => '','required'=>1),
- 'Description' => Array('type' => 'string','not_null' => '1','default' => ''),
- 'AdvancedCSS' => Array('type' => 'string','not_null' => '1','default' => ''),
+ 'Description' => Array('type' => 'string', 'formatter' => 'kFormatter', 'not_null' => 1, 'using_fck' => 1, 'default' => ''),
+ 'AdvancedCSS' => Array('type' => 'string', 'formatter' => 'kFormatter', 'not_null' => 1, 'using_fck' => 1, 'default' => ''),
'LastCompiled' => Array('type' => 'int', 'formatter' => 'kDateFormatter', 'not_null' => 1, 'default' => 0),
'Enabled' => Array('type' => 'int', 'formatter'=>'kOptionsFormatter', 'options'=>Array(0 => 'la_Disabled', 1 => 'la_Enabled'), 'use_phrases' => 1, 'not_null' => '1','default' => 0),
),
Index: branches/RC/core/units/categories/categories_event_handler.php
===================================================================
diff -u -r11750 -r11760
--- branches/RC/core/units/categories/categories_event_handler.php (.../categories_event_handler.php) (revision 11750)
+++ branches/RC/core/units/categories/categories_event_handler.php (.../categories_event_handler.php) (revision 11760)
@@ -1811,6 +1811,11 @@
$event->status = erSTOP;
$string = unhtmlentities($this->Application->GetVar('preview_content'));
+ $category_helper =& $this->Application->recallObject('CategoryHelper');
+ /* @var $category_helper CategoryHelper */
+
+ $string = $category_helper->replacePageIds($string);
+
$this->Application->StoreVar('_editor_preview_content_', $string);
}
}
Index: branches/RC/core/units/selectors/selectors_config.php
===================================================================
diff -u -r11538 -r11760
--- branches/RC/core/units/selectors/selectors_config.php (.../selectors_config.php) (revision 11538)
+++ branches/RC/core/units/selectors/selectors_config.php (.../selectors_config.php) (revision 11760)
@@ -92,9 +92,9 @@
'Name' => Array('type' => 'string','not_null' => '1','default' => '','required'=>1),
'SelectorName' => Array('type' => 'string', 'unique'=>Array('StylesheetId'), 'current_table_only' => 1, 'not_null' => '1','default' => '','required'=>1),
'SelectorData' => Array('type' => 'string', 'not_null' => '1','default' => ''),
- 'Description' => Array('type' => 'string','not_null' => '1','default' => ''),
+ 'Description' => Array('type' => 'string', 'formatter' => 'kFormatter', 'not_null' => 1, 'using_fck' => 1, 'default' => ''),
'Type' => Array('type' => 'int', 'formatter'=>'kOptionsFormatter', 'options'=>Array( 1 => 'la_BaseSelectors', 2 => 'la_BlockSelectors'), 'use_phrases' => 1, 'not_null' => 1, 'default' => 0),
- 'AdvancedCSS' => Array('type' => 'string','not_null' => '1','default' => ''),
+ 'AdvancedCSS' => Array('type' => 'string', 'formatter' => 'kFormatter', 'not_null' => 1, 'using_fck' => 1, 'default' => ''),
'ParentId' => Array('type' => 'int', 'formatter'=>'kOptionsFormatter', 'required' => 1, 'not_null' => 1, 'default' => 0),
),
Index: branches/RC/core/admin_templates/regional/email_messages_edit.tpl
===================================================================
diff -u -r11623 -r11760
--- branches/RC/core/admin_templates/regional/email_messages_edit.tpl (.../email_messages_edit.tpl) (revision 11623)
+++ branches/RC/core/admin_templates/regional/email_messages_edit.tpl (.../email_messages_edit.tpl) (revision 11760)
@@ -39,7 +39,7 @@
-
+
Index: branches/RC/core/kernel/db/db_tag_processor.php
===================================================================
diff -u -r11758 -r11760
--- branches/RC/core/kernel/db/db_tag_processor.php (.../db_tag_processor.php) (revision 11758)
+++ branches/RC/core/kernel/db/db_tag_processor.php (.../db_tag_processor.php) (revision 11760)
@@ -2135,6 +2135,7 @@
function FCKEditor($params)
{
$params['no_special'] = 1;
+ $params['format'] = array_key_exists('format', $params) ? $params['format'] . ';fck_ready' : 'fck_ready';
$value = $this->Field($params);
$name = array_key_exists('name', $params) ? $params['name'] : $this->InputName($params);
@@ -2151,16 +2152,19 @@
$bgcolor = '#ffffff';
}
- $url = '';
- $st_id = $this->Application->GetVar('st_id');
- if ($st_id) {
+ $preview_url = '';
+ $page_id = $this->Application->GetVar('c_id');
+ $content_id = $this->Application->GetVar('content_id');
+ if ($page_id && $content_id) {
+ // editing content block from Front-End, not category in admin
$sql = 'SELECT NamedParentPath
- FROM ' . $this->Application->getUnitOption('st', 'TableName') . '
- WHERE ' . $this->Application->getUnitOption('st', 'IDField') . ' = ' . $st_id;
- $tpl = $this->Conn->GetOne($sql);
+ FROM ' . $this->Application->getUnitOption('c', 'TableName') . '
+ WHERE ' . $this->Application->getUnitOption('c', 'IDField') . ' = ' . $page_id;
+ $template = strtolower( $this->Conn->GetOne($sql) );
- $url_params = Array ('pass' => 'm', 'm_cat_id' => $st_id, 'index_file' => 'index.php');
- $url = $this->Application->HREF($tpl, '_FRONT_END_', $url_params);
+ $url_params = Array ('m_cat_id' => $page_id, 'no_amp' => 1, 'editing_mode' => EDITING_MODE_CMS, '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 . 'fckeditor.php');
@@ -2171,9 +2175,9 @@
$oFCKeditor->BasePath = BASE_PATH . EDITOR_PATH;
$oFCKeditor->Width = $params['width'] ;
$oFCKeditor->Height = $params['height'] ;
- $oFCKeditor->ToolbarSet = $st_id ? 'Advanced' : 'Default';
+ $oFCKeditor->ToolbarSet = $page_id && $content_id ? 'Advanced' : 'Default';
$oFCKeditor->Value = $value;
- $oFCKeditor->PreviewUrl = $url;
+ $oFCKeditor->PreviewUrl = $preview_url;
$oFCKeditor->DefaultLanguage = $this->SetFCKDefaultLanguage();
$oFCKeditor->LateLoad = array_key_exists('late_load', $params) && $params['late_load'];
$oFCKeditor->Config = Array (
@@ -2187,7 +2191,7 @@
'Admin' => 1,
'K4' => 1,
'newBgColor' => $bgcolor,
- 'PreviewUrl' => $url,
+ 'PreviewUrl' => $preview_url,
'BaseUrl' => BASE_PATH . '/',
'DefaultLanguage' => $this->SetFCKDefaultLanguage(),
'EditorAreaStyles' => 'body { background-color: '.$bgcolor.' }',
Index: branches/RC/core/kernel/utility/formatters/formatter.php
===================================================================
diff -u -r10832 -r11760
--- branches/RC/core/kernel/utility/formatters/formatter.php (.../formatter.php) (revision 10832)
+++ branches/RC/core/kernel/utility/formatters/formatter.php (.../formatter.php) (revision 11760)
@@ -2,8 +2,39 @@
class kFormatter extends kBase {
+ /**
+ * Reference to category helper
+ *
+ * @var CategoryHelper
+ */
+ var $_categoryHelper = null;
+ function kFormatter()
+ {
+ parent::kBase();
+
+ $this->_categoryHelper =& $this->Application->recallObject('CategoryHelper');
+ }
+
/**
+ * Replace FCK links like "@@ID@@" to real page urls, when "using_fck" option is set.
+ *
+ * @param string $text
+ * @param Array $options
+ * @param string $format
+ * @return string
+ */
+ function _replaceFCKLinks(&$value, $options, $format = null)
+ {
+ if ((isset($format) && strpos($format, 'fck_ready') !== false) || (!array_key_exists('using_fck', $options) || !$options['using_fck'])) {
+ // in textarea, where fck will be used OR not using fck
+ return $value;
+ }
+
+ return $this->_categoryHelper->replacePageIds($value);
+ }
+
+ /**
* Convert's value to match type from config
*
* @param mixed $value
@@ -70,25 +101,42 @@
}
//function Format($value, $options, &$errors)
- function Format($value, $field_name, &$object, $format=null)
+ function Format($value, $field_name, &$object, $format = null)
{
- if ( is_null($value) ) return '';
+ if ( is_null($value) ) {
+ return '';
+ }
$options = $object->GetFieldOptions($field_name);
- if ( isset($format) ) $options['format'] = $format;
- $tc_value = $value; // $this->TypeCast($value,$options);
- if( ($tc_value === false) || ("$tc_value" != "$value") ) return $value; // for leaving badly formatted date on the form
+ if (!isset($format) && array_key_exists('format', $options)) {
+ $format = $options['format'];
+ }
- if (isset($options['format'])) {
- $tc_value = sprintf($options['format'], $tc_value);
+ if ($value === false) {
+ // used ?
+ return $value; // for leaving badly formatted date on the form
}
+ $original_format = $format;
+ if (isset($format)) {
+ if (strpos($format, 'fck_ready') !== false) {
+ $format = trim(str_replace('fck_ready', '', $format), ';');
+ }
+ }
+
+ if (isset($format) && $format) {
+ $value = sprintf($format, $value);
+ }
+
if (preg_match('#int|integer|double|float|real|numeric#', $options['type'])) {
$lang =& $this->Application->recallObject('lang.current');
- return $lang->formatNumber($tc_value);
+ return $lang->formatNumber($value);
}
+ elseif ($options['type'] == 'string') {
+ $value = $this->_replaceFCKLinks($value, $options, $original_format);
+ }
- return $tc_value;
+ return $value;
}
/**
@@ -101,11 +149,15 @@
*/
function Parse($value, $field_name, &$object)
{
- if ($value == '') return NULL;
+ if ($value == '') {
+ return NULL;
+ }
$options = $object->GetFieldOptions($field_name);
$tc_value = $this->TypeCast($value,$options);
- if($tc_value === false) return $value; // for leaving badly formatted date on the form
+ if ($tc_value === false) {
+ return $value; // for leaving badly formatted date on the form
+ }
if(isset($options['type'])) {
if (preg_match('#double|float|real|numeric#', $options['type'])) {
Index: branches/RC/core/editor/editor/plugins/MyPreview/fckplugin.js
===================================================================
diff -u -r10974 -r11760
--- branches/RC/core/editor/editor/plugins/MyPreview/fckplugin.js (.../fckplugin.js) (revision 10974)
+++ branches/RC/core/editor/editor/plugins/MyPreview/fckplugin.js (.../fckplugin.js) (revision 11760)
@@ -7,18 +7,18 @@
{
initXmlHTTP();
xmlHTTP.onreadystatechange = OnGetAnswerPost;
-
+
// the path is NOT /admin, otherwise content will be stored in admin session !
- xmlHTTP.open("POST", FCKConfig.ProjectPath+'index.php?env=-dummy:st--OnUpdatePreviewBlock---&admin=1&ajax=yes', true);
- xmlHTTP.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
- xmlHTTP.send("&preview_content="+escape( FCK.GetXHTML() )+"&st_event=OnUpdatePreviewBlock");
-}
+ xmlHTTP.open('POST', FCKConfig.ProjectPath+'index.php?t=dummy&events[c]=OnUpdatePreviewBlock&ajax=yes', true);
+ xmlHTTP.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
+ xmlHTTP.send('&preview_content=' + encodeURIComponent(FCK.GetXHTML()));
+}
MyPreviewCommand.prototype.GetState = function()
{
return FCK_TRISTATE_OFF;
}
-
+
function initXmlHTTP(){
//if (xmlHTTP) return;
try {
Index: branches/RC/core/admin_templates/forms/form_field_edit.tpl
===================================================================
diff -u -r11623 -r11760
--- branches/RC/core/admin_templates/forms/form_field_edit.tpl (.../form_field_edit.tpl) (revision 11623)
+++ branches/RC/core/admin_templates/forms/form_field_edit.tpl (.../form_field_edit.tpl) (revision 11760)
@@ -42,7 +42,7 @@
-
+
Index: branches/RC/core/units/mailing_lists/mailing_lists_config.php
===================================================================
diff -u -r11612 -r11760
--- branches/RC/core/units/mailing_lists/mailing_lists_config.php (.../mailing_lists_config.php) (revision 11612)
+++ branches/RC/core/units/mailing_lists/mailing_lists_config.php (.../mailing_lists_config.php) (revision 11760)
@@ -90,8 +90,8 @@
),
'Subject' => Array ('type' => 'string', 'max_len' => 255, 'not_null' => 1, 'required' => 1, 'default' => ''),
- 'MessageText' => Array ('type' => 'string', 'default' => NULL),
- 'MessageHtml' => Array ('type' => 'string', 'default' => NULL),
+ 'MessageText' => Array ('type' => 'string', 'formatter' => 'kFormatter', 'using_fck' => 1, 'default' => NULL),
+ 'MessageHtml' => Array ('type' => 'string', 'formatter' => 'kFormatter', 'using_fck' => 1, 'default' => NULL),
'Status' => Array (
'type' => 'int',