Index: branches/5.0.x/core/install/upgrades.php =================================================================== diff -u -N -r12808 -r12809 --- branches/5.0.x/core/install/upgrades.php (.../upgrades.php) (revision 12808) +++ branches/5.0.x/core/install/upgrades.php (.../upgrades.php) (revision 12809) @@ -1,6 +1,6 @@ -1, // root + 'CreatedOn' => time(), + 'ResourceId' => $this->Application->NextResourceId(), + ); + + $category_id = $this->Application->findModule('Name', 'Core', 'RootCat'); + + $this->Conn->doUpdate($fields_hash, TABLE_PREFIX . 'Category', 'CategoryId = ' . $category_id); + } + if ($mode == 'after') { // scan theme to fill Theme.TemplateAliases and ThemeFiles.TemplateAlias fields $this->_toolkit->rebuildThemes(); @@ -1278,7 +1290,6 @@ $this->Conn->Query($sql); } } - } } } \ No newline at end of file Index: branches/5.0.x/core/admin_templates/catalog/catalog.tpl =================================================================== diff -u -N -r12495 -r12809 --- branches/5.0.x/core/admin_templates/catalog/catalog.tpl (.../catalog.tpl) (revision 12495) +++ branches/5.0.x/core/admin_templates/catalog/catalog.tpl (.../catalog.tpl) (revision 12809) @@ -221,7 +221,7 @@ var $edit_url = ''; var $category_id = get_hidden_field('m_cat_id'); var $redirect_url = $edit_url.replace('#CATEGORY_ID#', $category_id); - $redirect_url = $redirect_url.replace('#TEMPLATE#', $category_id > 0 ? 'categories/categories_edit' : 'categories/categories_edit_permissions'); + $redirect_url = $redirect_url.replace('#TEMPLATE#', $category_id == 0 || $category_id == ? 'categories/categories_edit_permissions' : 'categories/categories_edit'); direct_edit('c', $redirect_url); break; Index: branches/5.0.x/core/units/categories/categories_event_handler.php =================================================================== diff -u -N -r12808 -r12809 --- branches/5.0.x/core/units/categories/categories_event_handler.php (.../categories_event_handler.php) (revision 12808) +++ branches/5.0.x/core/units/categories/categories_event_handler.php (.../categories_event_handler.php) (revision 12809) @@ -1,6 +1,6 @@ Application->GetVar($event->getPrefixSpecial().'_id'); - $this->Application->StoreVar('IsRootCategory_'.$this->Application->GetVar('m_wid'), $category_id === '0'); + $category_id = $this->Application->GetVar($event->getPrefixSpecial() . '_id'); + $home_category = $this->Application->findModule('Name', 'Core', 'RootCat'); + $this->Application->StoreVar('IsRootCategory_'.$this->Application->GetVar('m_wid'), ($category_id === '0') || ($category_id == $home_category)); + parent::OnEdit($event); } Index: branches/5.0.x/core/install.php =================================================================== diff -u -N -r12808 -r12809 --- branches/5.0.x/core/install.php (.../install.php) (revision 12808) +++ branches/5.0.x/core/install.php (.../install.php) (revision 12809) @@ -1,6 +1,6 @@ toolkit->RunSQL('/core/install/install_data.sql'); // create category using sql, because Application is not available here + $table_name = $this->toolkit->getSystemConfig('Database', 'TablePrefix') . 'IdGenerator'; + $this->Conn->Query('UPDATE ' . $table_name . ' SET lastid = lastid + 1'); + $resource_id = $this->Conn->GetOne('SELECT lastid FROM ' . $table_name); + if ($resource_id === false) { + $this->Conn->Query('INSERT INTO '.$table_name.' (lastid) VALUES (2)'); + $resource_id = 2; + } + $fields_hash = Array ( 'l1_Name' => 'Content', 'Filename' => 'Content', 'AutomaticFilename' => 0, + 'CreatedById' => -1, 'CreatedOn' => time(), 'ResourceId' => $resource_id - 1, 'l1_Description' => 'Content', 'Status' => 4, );