Index: branches/5.0.x/core/units/categories/cache_updater.php =================================================================== diff -u -r12117 -r12231 --- branches/5.0.x/core/units/categories/cache_updater.php (.../cache_updater.php) (revision 12117) +++ branches/5.0.x/core/units/categories/cache_updater.php (.../cache_updater.php) (revision 12231) @@ -1,6 +1,6 @@ getObject(); // 2. preset template -// $object->SetDBField('Template', $this->_getDefaultDesign()); + $category_id = $this->Application->GetVar('m_cat_id'); + $root_category = $this->Application->findModule('Name', 'Core', 'RootCat'); + if ($category_id == $root_category) { + $object->SetDBField('Template', $this->_getDefaultDesign()); + } $priority_helper =& $this->Application->recallObject('PriorityHelper'); /* @var $priority_helper kPriorityHelper */ // 3. prepare priorities dropdown - $category_id = $this->Application->GetVar('m_cat_id'); $priority_helper->preparePriorities($event, true, 'ParentId = ' . $category_id); } @@ -1348,7 +1351,7 @@ } $page =& $this->Application->recallObject($this->Prefix . '.-virtual', null, Array ('page' => $t)); - if($page->isLoaded()) { + if ($page->isLoaded()) { $real_t = $page->GetDBField('CachedTemplate'); $this->Application->SetVar('m_cat_id', $page->GetDBField('CategoryId') ); if ($page->GetDBField('FormId')) { @@ -1399,6 +1402,12 @@ $this->_saveTitleField($object, 'Title'); $this->_saveTitleField($object, 'MenuTitle'); + + $root_category = $this->Application->findModule('Name', 'Core', 'RootCat'); + + if (($object->GetDBField('ParentId') == $root_category) && ($object->GetDBField('Template') == CATEGORY_TEMPLATE_INHERIT)) { + $object->SetError('Template', 'no_inherit'); + } } /** @@ -1682,6 +1691,9 @@ $design_sql = str_replace('(tf.FilePath = "/designs")', '(' . implode(' OR ', $design_folders) . ')' . ' AND (t.ThemeId = ' . $theme_id . ')', $design_sql); $fields['Template']['options_sql'] = $design_sql; + // adds "Inherit From Parent" option to "Template" field + $fields['Template']['options'] = Array (CATEGORY_TEMPLATE_INHERIT => $this->Application->Phrase('la_opt_InheritFromParent')); + $this->Application->setUnitOption($event->Prefix, 'Fields', $fields); if ($this->Application->IsAdmin()) { Index: branches/5.0.x/core/kernel/constants.php =================================================================== diff -u -r12202 -r12231 --- branches/5.0.x/core/kernel/constants.php (.../constants.php) (revision 12202) +++ branches/5.0.x/core/kernel/constants.php (.../constants.php) (revision 12231) @@ -1,6 +1,6 @@ \ No newline at end of file + + /** + * Means, that actual category Template field value should inherited from parent category + * + */ + define('CATEGORY_TEMPLATE_INHERIT', '#inherit#'); \ No newline at end of file Index: branches/5.0.x/core/install/install_schema.sql =================================================================== diff -u -r12117 -r12231 --- branches/5.0.x/core/install/install_schema.sql (.../install_schema.sql) (revision 12117) +++ branches/5.0.x/core/install/install_schema.sql (.../install_schema.sql) (revision 12231) @@ -412,7 +412,7 @@ Modified int(11) NOT NULL default '0', ModifiedById int(11) NOT NULL default '0', CachedTemplate varchar(255) NOT NULL, - Template varchar(255) default NULL, + Template varchar(255) NOT NULL default '#inherit#', UseExternalUrl tinyint(3) unsigned NOT NULL default '0', ExternalUrl varchar(255) NOT NULL default '', UseMenuIconUrl tinyint(3) unsigned NOT NULL default '0', Index: branches/5.0.x/core/install/upgrades.sql =================================================================== diff -u -r12216 -r12231 --- branches/5.0.x/core/install/upgrades.sql (.../upgrades.sql) (revision 12216) +++ branches/5.0.x/core/install/upgrades.sql (.../upgrades.sql) (revision 12231) @@ -1395,4 +1395,15 @@ UPDATE ConfigurationAdmin SET ValueList = 'Name=la_opt_Title,Description=la_opt_Description,CreatedOn=la_opt_CreatedOn,EditorsPick=la_opt_EditorsPick,SELECT Prompt AS OptionName, CONCAT("cust_", FieldName) AS OptionValue FROM CustomField WHERE (Type = 1) AND (IsSystem = 0)' WHERE VariableName = 'Category_Sortfield2'; +UPDATE Category SET Template = '#inherit#' WHERE COALESCE(Template, '') = ''; +ALTER TABLE Category CHANGE Template Template VARCHAR(255) NOT NULL DEFAULT '#inherit#'; + +UPDATE Phrase SET Phrase = 'la_config_DefaultDesignTemplate' WHERE Phrase = 'la_prompt_DefaultDesignTemplate'; + +UPDATE ConfigurationAdmin SET heading = 'la_section_SettingsWebsite', prompt = 'la_config_DefaultDesignTemplate', DisplayOrder = 10.06 WHERE VariableName = 'cms_DefaultDesign'; +UPDATE ConfigurationValues SET Section = 'in-portal:configure_advanced' WHERE VariableName = 'cms_DefaultDesign'; +UPDATE ConfigurationAdmin SET DisplayOrder = DisplayOrder + 0.01 WHERE VariableName IN ('ErrorTemplate', 'NoPermissionTemplate'); + +UPDATE ConfigurationAdmin SET DisplayOrder = 10.15 WHERE VariableName = 'Search_MinKeyword_Length'; + UPDATE Modules SET Version = '5.0.1', Loaded = 1 WHERE Name = 'In-Portal'; \ No newline at end of file Index: branches/5.0.x/core/units/categories/categories_config.php =================================================================== diff -u -r12217 -r12231 --- branches/5.0.x/core/units/categories/categories_config.php (.../categories_config.php) (revision 12217) +++ branches/5.0.x/core/units/categories/categories_config.php (.../categories_config.php) (revision 12231) @@ -1,6 +1,6 @@ 'Value', 'option_title_field' => 'Title', - /*'required' => 1,*/ 'default' => null + 'error_msgs' => Array ( + 'no_inherit' => '!la_error_NoInheritancePossible!', + ), + 'required' => 1, 'not_null' => 1, 'default' => CATEGORY_TEMPLATE_INHERIT ), 'UseExternalUrl' => Array ( Index: branches/5.0.x/core/install/english.lang =================================================================== diff -u -r12228 -r12231 --- branches/5.0.x/core/install/english.lang (.../english.lang) (revision 12228) +++ branches/5.0.x/core/install/english.lang (.../english.lang) (revision 12231) @@ -171,6 +171,7 @@ RGVmYXVsdCBDU1YgRXhwb3J0IEVuY29kaW5n RGVmYXVsdCBDU1YgRXhwb3J0IE5ldyBMaW5lIFNlcGFyYXRvcg== U2hvdyAiRm9ybXMgRWRpdG9yIiBpbiBERUJVRyBtb2RlIG9ubHk= + RGVmYXVsdCBEZXNpZ24gVGVtcGxhdGU= RGVmYXVsdCBSZWdpc3RyYXRpb24gQ291bnRyeQ== VGVtcGxhdGUgZm9yICJGaWxlIG5vdCBmb3VuZCAoNDA0KSIgRXJyb3I= RmlsZW5hbWUgU3BlY2lhbCBDaGFyIFJlcGxhY2VtZW50 @@ -484,6 +485,7 @@ SW52YWxpZCBGaWxlIEZvcm1hdA== aW52YWxpZCBvcHRpb24= RXJyb3IgbW92aW5nIHN1YnNlY3Rpb24= + Q2FuJ3QgaW5oZXJpdCB0ZW1wbGF0ZSBmcm9tIHRvcCBjYXRlZ29yeQ== UGFzc3dvcmRzIGRvIG5vdCBtYXRjaCE= UmVxdWlyZWQgZmllbGQoLXMpIG5vdCBmaWxsZWQ= cmVxdWlyZWQgY29sdW1ucyBtaXNzaW5n @@ -876,6 +878,7 @@ RmFpbGVk Rmlyc3QgTmFtZQ== aG91cihzKQ== + SW5oZXJpdCBmcm9tIFBhcmVudA== SVAgQWRkcmVzcw== TGFzdCBOYW1l TG9nZ2VkIE91dA== @@ -955,7 +958,6 @@ Q3VycmVudCBTZXNzaW9ucw== VG90YWwgU2l6ZSBvZiB0aGUgRGF0YWJhc2U= RGVmYXVsdA== - RGVmYXVsdCAiU2VjdGlvbiBUZW1wbGF0ZSI= VXNlciBJRCBmb3IgRGVmYXVsdCBQZXJzaXN0ZW50IFNldHRpbmdz RGVmYXVsdCBWYWx1ZQ== RGlzYWJsZWQgU2VjdGlvbnM= Index: branches/5.0.x/core/admin_templates/categories/categories_edit.tpl =================================================================== diff -u -r12117 -r12231 --- branches/5.0.x/core/admin_templates/categories/categories_edit.tpl (.../categories_edit.tpl) (revision 12117) +++ branches/5.0.x/core/admin_templates/categories/categories_edit.tpl (.../categories_edit.tpl) (revision 12231) @@ -57,6 +57,10 @@ + + + +
@@ -81,7 +85,7 @@ - + Index: branches/5.0.x/core/install/install_data.sql =================================================================== diff -u -r12230 -r12231 --- branches/5.0.x/core/install/install_data.sql (.../install_data.sql) (revision 12230) +++ branches/5.0.x/core/install/install_data.sql (.../install_data.sql) (revision 12231) @@ -31,9 +31,7 @@ INSERT INTO ConfigurationValues VALUES (DEFAULT, 'FilenameSpecialCharReplacement', '-', 'In-Portal', 'in-portal:configure_categories'); INSERT INTO ConfigurationAdmin VALUES ('YahooApplicationId', 'la_title_General', 'la_config_YahooApplicationId', 'text', NULL, NULL, 10.14, 0, 0); INSERT INTO ConfigurationValues VALUES (DEFAULT, 'YahooApplicationId', '', 'In-Portal', 'in-portal:configure_categories'); -INSERT INTO ConfigurationAdmin VALUES ('cms_DefaultDesign', 'la_title_General', 'la_prompt_DefaultDesignTemplate', 'text', NULL, NULL, 10.15, 0, 0); -INSERT INTO ConfigurationValues VALUES (DEFAULT, 'cms_DefaultDesign', '/platform/designs/general', 'In-Portal', 'in-portal:configure_categories'); -INSERT INTO ConfigurationAdmin VALUES ('Search_MinKeyword_Length', 'la_title_General', 'la_config_Search_MinKeyword_Length', 'text', NULL, NULL, 10.19, 0, 0); +INSERT INTO ConfigurationAdmin VALUES ('Search_MinKeyword_Length', 'la_title_General', 'la_config_Search_MinKeyword_Length', 'text', NULL, NULL, 10.15, 0, 0); INSERT INTO ConfigurationValues VALUES (DEFAULT, 'Search_MinKeyword_Length', '3', 'In-Portal', 'in-portal:configure_categories'); INSERT INTO ConfigurationAdmin VALUES ('Category_MetaKey', 'la_Text_MetaInfo', 'la_category_metakey', 'textarea', '', '', 20.01, 0, 1); INSERT INTO ConfigurationValues VALUES (DEFAULT, 'Category_MetaKey', '', 'In-Portal', 'in-portal:configure_categories'); @@ -59,9 +57,11 @@ INSERT INTO ConfigurationValues VALUES (DEFAULT, 'Config_Server_Time', '14', 'In-Portal', 'in-portal:configure_advanced'); INSERT INTO ConfigurationAdmin VALUES ('Config_Site_Time', 'la_section_SettingsWebsite', 'la_config_site_zone', 'select', '', '1=la_m12,2=la_m11,3=la_m10,5=la_m9,6=la_m8,7=la_m7,8=la_m6,9=la_m5,10=la_m4,11=la_m3,12=la_m2,13=la_m1,14=la_m0,15=la_p1,16=la_p2,17=la_p3,18=la_p4,19=la_p5,20=la_p6,21=la_p7,22=la_p8,23=la_p9,24=la_p10,25=la_p11,26=la_p12,27=la_p13', 10.05, 0, 1); INSERT INTO ConfigurationValues VALUES (DEFAULT, 'Config_Site_Time', '14', 'In-Portal', 'in-portal:configure_advanced'); -INSERT INTO ConfigurationAdmin VALUES ('ErrorTemplate', 'la_section_SettingsWebsite', 'la_config_error_template', 'text', '', '', 10.06, 0, 0); +INSERT INTO ConfigurationAdmin VALUES ('cms_DefaultDesign', 'la_section_SettingsWebsite', 'la_config_DefaultDesignTemplate', 'text', NULL, NULL, 10.06, 0, 0); +INSERT INTO ConfigurationValues VALUES (DEFAULT, 'cms_DefaultDesign', '/platform/designs/general', 'In-Portal', 'in-portal:configure_advanced'); +INSERT INTO ConfigurationAdmin VALUES ('ErrorTemplate', 'la_section_SettingsWebsite', 'la_config_error_template', 'text', '', '', 10.07, 0, 0); INSERT INTO ConfigurationValues VALUES (DEFAULT, 'ErrorTemplate', 'error_notfound', 'In-Portal', 'in-portal:configure_advanced'); -INSERT INTO ConfigurationAdmin VALUES ('NoPermissionTemplate', 'la_section_SettingsWebsite', 'la_config_nopermission_template', 'text', '', '', 10.07, 0, 0); +INSERT INTO ConfigurationAdmin VALUES ('NoPermissionTemplate', 'la_section_SettingsWebsite', 'la_config_nopermission_template', 'text', '', '', 10.08, 0, 0); INSERT INTO ConfigurationValues VALUES (DEFAULT, 'NoPermissionTemplate', 'no_permission', 'In-Portal', 'in-portal:configure_advanced'); INSERT INTO ConfigurationAdmin VALUES ('UsePageHitCounter', 'la_section_SettingsWebsite', 'la_config_UsePageHitCounter', 'checkbox', '', '', 10.09, 0, 0); INSERT INTO ConfigurationValues VALUES (DEFAULT, 'UsePageHitCounter', 0, 'In-Portal', 'in-portal:configure_advanced');