Index: branches/RC/core/units/categories/categories_tag_processor.php =================================================================== diff -u -N -r11501 -r11504 --- branches/RC/core/units/categories/categories_tag_processor.php (.../categories_tag_processor.php) (revision 11501) +++ branches/RC/core/units/categories/categories_tag_processor.php (.../categories_tag_processor.php) (revision 11504) @@ -1016,13 +1016,13 @@ // different path in structure AND design template differes from requested template $structure_path_match = strtolower( $page->GetDBField('NamedParentPath') ) == strtolower('Content/' . $template); - $design_match = $page->GetDBField('Template') == $template; + $design_match = $page->GetDBField('CachedTemplate') == $template; if (!$structure_path_match && !$design_match) { // Same sql like in "c:getPassedID". Load, when current page object doesn't match requested page object $sql = 'SELECT ' . $page->IDField . ' FROM ' . $page->TableName . ' - WHERE (NamedParentPath = ' . $this->Conn->qstr('Content/' . $template) . ') OR (IsSystem = 1 AND Template = ' . $this->Conn->qstr($template) . ')'; + WHERE (NamedParentPath = ' . $this->Conn->qstr('Content/' . $template) . ') OR (IsSystem = 1 AND CachedTemplate = ' . $this->Conn->qstr($template) . ')'; $page_id = $this->Conn->GetOne($sql); $page->Load($page_id); @@ -1612,8 +1612,8 @@ $lang_part = ''; for ($i = 1; $i <= $languages_count; $i++) { - $lang_part .= 'c.l' . $i . '_Name AS l' . $i . '_ItemName,' . "\n"; - // $lang_part .= 'p.l' . $i . '_MenuTitle AS l' . $i . '_ItemName,' . "\n"; +// $lang_part .= 'c.l' . $i . '_Name AS l' . $i . '_ItemName,' . "\n"; + $lang_part .= 'c.l' . $i . '_MenuTitle AS l' . $i . '_ItemName,' . "\n"; } // Sub-categories from current category @@ -1750,7 +1750,7 @@ * * @param Array $params * @return string - * @todo Needs to be replaced with "m:GetConfig" tag + * @todo Needs to be replaced with "m:GetConfig" tag; Not used now (were used on structure_edit.tpl). */ function AllowManualFilenames($params) { Index: branches/RC/core/units/general/helpers/mod_rewrite_helper.php =================================================================== diff -u -N -r11501 -r11504 --- branches/RC/core/units/general/helpers/mod_rewrite_helper.php (.../mod_rewrite_helper.php) (revision 11501) +++ branches/RC/core/units/general/helpers/mod_rewrite_helper.php (.../mod_rewrite_helper.php) (revision 11504) @@ -171,7 +171,7 @@ } } - $sql = 'SELECT CachedCategoryTemplate + $sql = 'SELECT CachedTemplate FROM '.TABLE_PREFIX.'Category WHERE CategoryId = '.$vars['m_cat_id']; $vars['t'] = $this->Conn->GetOne($sql); Index: branches/RC/core/install/upgrades.sql =================================================================== diff -u -N -r11495 -r11504 --- branches/RC/core/install/upgrades.sql (.../upgrades.sql) (revision 11495) +++ branches/RC/core/install/upgrades.sql (.../upgrades.sql) (revision 11504) @@ -1013,6 +1013,8 @@ ALTER TABLE Language ADD UserDocsUrl VARCHAR(255) NOT NULL; +UPDATE Category SET Template = CategoryTemplate WHERE CategoryTemplate <> ''; + ALTER TABLE Category ADD ThemeId INT UNSIGNED NOT NULL, ADD INDEX (ThemeId), @@ -1021,8 +1023,16 @@ ADD COLUMN UseMenuIconUrl tinyint(3) unsigned NOT NULL default '0' AFTER ExternalUrl, ADD COLUMN MenuIconUrl varchar(255) NOT NULL default '' AFTER UseMenuIconUrl, CHANGE MetaKeywords MetaKeywords TEXT, - CHANGE MetaDescription MetaDescription TEXT; + CHANGE MetaDescription MetaDescription TEXT, + CHANGE CachedCategoryTemplate CachedTemplate VARCHAR(255) NOT NULL, + DROP CategoryTemplate; +UPDATE Category SET l1_MenuTitle = l1_Name WHERE l1_MenuTitle = '' OR l1_MenuTitle LIKE '_Auto: %'; +UPDATE Category SET l2_MenuTitle = l2_Name WHERE l2_MenuTitle = '' OR l2_MenuTitle LIKE '_Auto: %'; +UPDATE Category SET l3_MenuTitle = l3_Name WHERE l3_MenuTitle = '' OR l3_MenuTitle LIKE '_Auto: %'; +UPDATE Category SET l4_MenuTitle = l4_Name WHERE l4_MenuTitle = '' OR l4_MenuTitle LIKE '_Auto: %'; +UPDATE Category SET l5_MenuTitle = l5_Name WHERE l5_MenuTitle = '' OR l5_MenuTitle LIKE '_Auto: %'; + CREATE TABLE PageContent ( PageContentId int(11) NOT NULL auto_increment, ContentNum int(11) NOT NULL default '0', Index: branches/RC/core/units/categories/categories_config.php =================================================================== diff -u -N -r11501 -r11504 --- branches/RC/core/units/categories/categories_config.php (.../categories_config.php) (revision 11501) +++ branches/RC/core/units/categories/categories_config.php (.../categories_config.php) (revision 11504) @@ -291,8 +291,7 @@ '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), 'Modified' => Array ('type' => 'int', 'formatter' => 'kDateFormatter', 'not_null' => 1,'default' => '#NOW#'), 'ModifiedById' => 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), - 'CategoryTemplate' => Array ('type' => 'string', 'not_null' => 1, 'default' => ''), - 'CachedCategoryTemplate' => Array ('type' => 'string', 'not_null' => 1, 'default' => ''), + 'CachedTemplate' => Array ('type' => 'string', 'not_null' => 1, 'default' => ''), // fields from Pages @@ -304,7 +303,7 @@ LEFT JOIN ' . TABLE_PREFIX . 'Theme AS t ON t.ThemeId = tf.ThemeId WHERE (t.Enabled = 1) AND (tf.FileName NOT LIKE "%%.elm.tpl") AND (tf.FilePath = "/designs")', 'option_key_field' => 'Value', 'option_title_field' => 'Title', - 'required' => 1, 'default' => null + /*'required' => 1,*/ 'default' => null ), 'UseExternalUrl' => Array ( Index: branches/RC/core/admin_templates/img/itemicons/icon16_folder.gif =================================================================== diff -u -N Binary files differ Index: branches/RC/core/units/categories/categories_event_handler.php =================================================================== diff -u -N -r11501 -r11504 --- branches/RC/core/units/categories/categories_event_handler.php (.../categories_event_handler.php) (revision 11501) +++ branches/RC/core/units/categories/categories_event_handler.php (.../categories_event_handler.php) (revision 11504) @@ -441,7 +441,7 @@ WHERE (NamedParentPath = ' . $this->Conn->qstr($template) . ') OR (NamedParentPath = ' . $this->Conn->qstr('Content/' . $template) . ') OR - (IsSystem = 1 AND Template = ' . $this->Conn->qstr($template) . ')'; + (IsSystem = 1 AND CachedTemplate = ' . $this->Conn->qstr($template) . ')'; $page_id = $this->Conn->GetOne($sql); } else { @@ -561,7 +561,7 @@ $live_object =& $this->Application->recallObject($event->Prefix.'.-item', null, Array('live_table' => true, 'skip_autoload' => true)); $live_object->Load($id); - $cached_fields = Array('Name', 'Filename', 'CategoryTemplate', 'ParentId', 'Priority'); + $cached_fields = Array('Name', 'Filename', 'Template', 'ParentId', 'Priority'); foreach ($cached_fields as $cached_field) { if ($live_object->GetDBField($cached_field) != $temp_object->GetDBField($cached_field)) { @@ -599,7 +599,7 @@ $object =& $event->getObject(); // 2. preset template - $object->SetDBField('Template', $this->_getDefaultDesign()); +// $object->SetDBField('Template', $this->_getDefaultDesign()); $priority_helper =& $this->Application->recallObject('PriorityHelper'); /* @var $priority_helper kPriorityHelper */ @@ -1238,7 +1238,7 @@ $page =& $this->Application->recallObject($this->Prefix . '.-virtual', null, Array ('page' => $t)); if($page->isLoaded()) { - $real_t = $page->GetDBField('Template'); + $real_t = $page->GetDBField('CachedTemplate'); $this->Application->SetVar('m_cat_id', $page->GetDBField('CategoryId') ); if ($page->GetDBField('FormId')) { $this->Application->SetVar('form_id', $page->GetDBField('FormId')); @@ -1366,7 +1366,7 @@ $page_description = ''; if ($system) { - $design_template = strtolower($template); + $design_template = strtolower($template); // leading "/" not added ! $template_info = $this->_getTemplateInfo($design_template, $theme_id); if ($template_info) { if (array_key_exists('name', $template_info) && $template_info['name']) { @@ -1384,7 +1384,7 @@ } } else { - $design_template = $this->_getDefaultDesign(); + $design_template = $this->_getDefaultDesign(); // leading "/" added ! } // put all templates to then end of list (in their category) @@ -1411,7 +1411,8 @@ $object->SetDBField('IsMenu', 0); $object->SetDBField('ThemeId', $system ? $theme_id : 0); $object->SetDBField('Priority', $min_priority - 1); - $object->SetDBField('Template', $design_template); // bug: possible case, when leading "/" is missing + $object->SetDBField('Template', $design_template); + $object->SetDBField('CachedTemplate', $design_template); $primary_language = $this->Application->GetDefaultLanguageId(); $current_language = $this->Application->GetVar('m_lang'); Index: branches/RC/core/admin_templates/img/itemicons/icon16_folder-red.gif =================================================================== diff -u -N Binary files differ Index: branches/RC/core/admin_templates/categories/categories_edit.tpl =================================================================== diff -u -N -r11495 -r11504 --- branches/RC/core/admin_templates/categories/categories_edit.tpl (.../categories_edit.tpl) (revision 11495) +++ branches/RC/core/admin_templates/categories/categories_edit.tpl (.../categories_edit.tpl) (revision 11504) @@ -61,16 +61,8 @@ - - - +
@@ -79,20 +71,8 @@ - - - - - - - - - - - - - - + + @@ -187,10 +167,17 @@ } } } + + function reflectFilename() { + var $checked = getControl('AutomaticFilename', null, '_cb').checked; + getControl('Filename').readOnly = $checked; + } + $(document).ready( function() { reflectMenuIcon(); reflectExternalUrl(); + reflectFilename(); // OnSystemClick(); } ); Index: branches/RC/core/install/install_toolkit.php =================================================================== diff -u -N -r11495 -r11504 --- branches/RC/core/install/install_toolkit.php (.../install_toolkit.php) (revision 11495) +++ branches/RC/core/install/install_toolkit.php (.../install_toolkit.php) (revision 11504) @@ -551,12 +551,14 @@ $category_fields = Array ( $fields['name'] => $name, 'Filename' => $name, 'AutomaticFilename' => 1, - $fields['description'] => $description, 'Status' => $status, 'ParentId' => 0, + $fields['description'] => $description, 'Status' => $status, ); + $category_fields['ParentId'] = $this->Application->findModule('Name', 'Proj-CMS', 'RootCat'); + if (isset($category_template)) { - $category_fields['CategoryTemplate'] = $category_template; - $category_fields['CachedCategoryTemplate'] = $category_template; + $category_fields['Template'] = $category_template; + $category_fields['CachedTemplate'] = $category_template; } $category->Clear(); Index: branches/RC/core/admin_templates/img/icons/icon24_folder.gif =================================================================== diff -u -N Binary files differ Index: branches/RC/core/units/categories/cache_updater.php =================================================================== diff -u -N -r11501 -r11504 --- branches/RC/core/units/categories/cache_updater.php (.../cache_updater.php) (revision 11501) +++ branches/RC/core/units/categories/cache_updater.php (.../cache_updater.php) (revision 11504) @@ -331,7 +331,7 @@ $data['titles'] = Array(); $data['parent_path'] = Array(); $data['named_path'] = Array(); - $data['category_template'] = ''; + $data['template'] = ''; // design $data['item_template'] = ''; $data['children_count'] = 0; // $data['system'] = 0; @@ -372,7 +372,7 @@ $next_data['titles'] = $data['titles']; $next_data['parent_path'] = $data['parent_path']; $next_data['named_path'] = $data['named_path']; - $next_data['category_template'] = $data['category_template']; + $next_data['template'] = $data['template']; $next_data['item_template'] = $data['item_template']; $next_data['current_id'] = $data['children'][ $data['current_child'] ]; //next iteration should process child $next_data['perms'] = $data['perms']; //we should copy our permissions to child - inheritance @@ -405,13 +405,14 @@ function UpdateCachedPath(&$data) { $fields_hash = Array ( - 'ParentPath' => '|'.implode('|', $data['parent_path']).'|', - 'NamedParentPath' => /*$data['system'] ? $data['file_name'] :*/ implode('/', $data['named_path'] ), - 'CachedCategoryTemplate' => $data['category_template'], - 'CachedDescendantCatsQty' => $data['children_count'], - 'TreeLeft' => $data['left'], - 'TreeRight' => $data['right'], - ); + 'ParentPath' => '|'.implode('|', $data['parent_path']).'|', + // allow old fashion system templates to work + 'NamedParentPath' => strpos($data['file_name'], '/') !== false ? $data['file_name'] : implode('/', $data['named_path'] ), + 'CachedTemplate' => $data['template'], + 'CachedDescendantCatsQty' => $data['children_count'], + 'TreeLeft' => $data['left'], + 'TreeRight' => $data['right'], + ); $i = 1; while ($i <= $this->languageCount) { @@ -447,20 +448,20 @@ $data['file_name'] = $record['Filename']; // it is one of the modules root category - $root_prefix = isset($this->root_prefixes[$category_id]) ? $this->root_prefixes[$category_id] : false; + /*$root_prefix = isset($this->root_prefixes[$category_id]) ? $this->root_prefixes[$category_id] : false; if ($root_prefix) { $fields_hash = Array(); - if (!$record['CategoryTemplate']) { - $record['CategoryTemplate'] = $this->Application->ConfigValue($root_prefix.'_CategoryTemplate'); - $fields_hash['CategoryTemplate'] = $record['CategoryTemplate']; + if (!$record['Template']) { + $record['Template'] = $this->Application->ConfigValue($root_prefix.'_CategoryTemplate'); + $fields_hash['Template'] = $record['Template']; } $this->Conn->doUpdate($fields_hash, TABLE_PREFIX.'Category', 'CategoryId = '.$category_id); - } + }*/ // if explicitly set, then use it; use parent template otherwise - if ($record['CategoryTemplate']) { - $data['category_template'] = $record['CategoryTemplate']; + if ($record['Template']) { + $data['template'] = $record['Template']; } } Index: branches/RC/core/admin_templates/img/icons/icon24_folder-red.gif =================================================================== diff -u -N Binary files differ Index: branches/RC/core/kernel/application.php =================================================================== diff -u -N -r11501 -r11504 --- branches/RC/core/kernel/application.php (.../application.php) (revision 11501) +++ branches/RC/core/kernel/application.php (.../application.php) (revision 11504) @@ -668,12 +668,12 @@ } // this allows to save 2 sql queries for each category - $sql = 'SELECT NamedParentPath, CachedCategoryTemplate, TreeLeft, TreeRight + $sql = 'SELECT NamedParentPath, CachedTemplate, TreeLeft, TreeRight FROM '.$table.' WHERE '.$id_field.' = '.$this->Conn->qstr($id); $category_data = $this->Conn->GetRow($sql); $filename = $category_data['NamedParentPath']; - $this->setCache('category_templates', $id, $category_data['CachedCategoryTemplate']); + $this->setCache('category_templates', $id, $category_data['CachedTemplate']); $this->setCache('category_tree', $id, $category_data['TreeLeft'] . ';' . $category_data['TreeRight']); // $this->setCache('item_templates', $id, $category_data['CachedItemTemplate']);