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,