Index: trunk/kernel/frontaction.php =================================================================== diff -u -N -r4120 -r4126 --- trunk/kernel/frontaction.php (.../frontaction.php) (revision 4120) +++ trunk/kernel/frontaction.php (.../frontaction.php) (revision 4126) @@ -746,14 +746,26 @@ } if($MissingCount==0) { - $CreatedOn = adodb_date("U"); - $_POST=inp_striptags($_POST); - $name = $_POST["name"]; - $desc = $_POST["description"]; - $metadesc = $_POST["meta_description"]; - $keywords = $_POST["meta_keywords"]; - $parent = $objCatList->CurrentCategoryID(); - $cat =& $objCatList->Add($parent, $name, $desc, $CreatedOn, 0, $perm, 2, 2, 2, 0, $keywords,$metadesc); + $_POST = inp_striptags($_POST); + $fields_hash = Array( 'ParentId' => $objCatList->CurrentCategoryID(), + 'Name' => $_POST['name'], + 'Description' => $_POST['description'], + 'CreatedOn' => adodb_date('U'), + 'EditorsPick' => 0, + 'Status' => $perm, + 'HotItem' => 2, + 'NewItem' => 2, + 'PopItem' => 2, + 'Priority' => 0, + 'MetaKeywords' => $_POST['meta_keywords'], + 'MetaDescription' => $_POST['meta_description'], + 'AutomaticFilename' => 1, + 'Filename' => '', + 'CategoryTemplate' => '', + 'ItemTemplate' => '', + ); + + $cat =& $objCatList->Add_NEW($fields_hash); saveCustomFields('c', $cat->Get('ResourceId'), $cat->type); $cat->UpdateCachedPath(); Index: trunk/kernel/include/category.php =================================================================== diff -u -N -r4121 -r4126 --- trunk/kernel/include/category.php (.../category.php) (revision 4121) +++ trunk/kernel/include/category.php (.../category.php) (revision 4126) @@ -314,28 +314,37 @@ $path_parts = Array(); $nav_parts = Array(); $named_parts = Array(); + $cateogry_template = ''; + $item_template = ''; - do - { - $rs = $this->adodbConnection->Execute('SELECT ParentId, Name, Filename FROM '.$this->tablename.' WHERE CategoryId = '.$Id2); + do { + $rs = $this->adodbConnection->Execute('SELECT ParentId, Name, Filename, CachedCategoryTemplate, CachedItemTemplate FROM '.$this->tablename.' WHERE CategoryId = '.$Id2); $path_parts[] = $Id2; $nav_parts[] = $rs->fields['Name']; $named_parts[] = $rs->fields['Filename']; + if (!$cateogry_template && $rs->fields['CachedCategoryTemplate']) { + $cateogry_template = $rs->fields['CachedCategoryTemplate']; + } + + if (!$item_template && $rs->fields['CachedItemTemplate']) { + $item_template = $rs->fields['CachedItemTemplate']; + } + $Id2 = ($rs && !$rs->EOF) ? $rs->fields['ParentId'] : '0'; - }while ($Id2 != '0'); + } while ($Id2 != '0'); $parent_path = '|'.implode('|', array_reverse($path_parts) ).'|'; $nav_bar = implode('>', array_reverse($nav_parts) ); $named_path = implode('/', array_reverse($named_parts) ); - if($this->Get('ParentPath') != $parent_path || $this->Get('CachedNavbar') != $nav_bar || $this->Get('NamedParentPath') != $named_path ) - { - $this->Set('ParentPath', $parent_path); - $this->Set('CachedNavbar', $nav_bar); - $this->Set('NamedParentPath', $named_path); - $this->Update(); - } + $this->Set('ParentPath', $parent_path); + $this->Set('CachedNavbar', $nav_bar); + $this->Set('NamedParentPath', $named_path); + $this->Set('CachedCategoryTemplate', $cateogry_template); + $this->Set('CachedItemTemplate', $item_template); + $this->Update(); + } function GetCachedNavBar()