Index: trunk/kernel/units/categories/cache_updater.php =================================================================== diff -u -N -r5173 -r5176 --- trunk/kernel/units/categories/cache_updater.php (.../cache_updater.php) (revision 5173) +++ trunk/kernel/units/categories/cache_updater.php (.../cache_updater.php) (revision 5176) @@ -48,8 +48,8 @@ class clsCachedPermissions { - var $Allow; - var $Deny; + var $Allow = Array(); + var $Deny = Array(); var $CatId; function clsCachedPermissions($CatId) Index: trunk/kernel/units/categories/categories_event_handler.php =================================================================== diff -u -N -r5173 -r5176 --- trunk/kernel/units/categories/categories_event_handler.php (.../categories_event_handler.php) (revision 5173) +++ trunk/kernel/units/categories/categories_event_handler.php (.../categories_event_handler.php) (revision 5176) @@ -266,6 +266,22 @@ } } } + + /** + * Checks cache update mark and redirect to cache if needed + * + * @param kEvent $event + */ + function OnSave(&$event) + { + parent::OnSave($event); + if ($event->status == erSUCCESS && $this->Application->GetVar('require_cache_update')) { + // "catalog" should be in opener stack by now + $opener_stack = unserialize($this->Application->RecallVar('opener_stack')); + $opener_stack[0] = str_replace('catalog', 'categories/cache_updater', $opener_stack[0]); + $this->Application->StoreVar('opener_stack', serialize($opener_stack)); + } + } } ?> \ No newline at end of file Index: trunk/core/kernel/utility/temp_handler.php =================================================================== diff -u -N -r5174 -r5176 --- trunk/core/kernel/utility/temp_handler.php (.../temp_handler.php) (revision 5174) +++ trunk/core/kernel/utility/temp_handler.php (.../temp_handler.php) (revision 5176) @@ -453,15 +453,9 @@ // because items from Sub Tables get deteleted in CopySubTablesToLive !BY ForeignKey! if ($master['TableName'] == $this->MasterTable) { $this->RaiseEvent( 'OnBeforeDeleteFromLive', $master['Prefix'], '', $current_ids ); - - // Do not delete live items with 0 id - // otherwise home category permissions got deleted when creating new category - $del_ids = $current_ids; - array_splice($del_ids, array_search(0, $current_ids), 1); - if (count($del_ids) >= 1) { - $query = 'DELETE FROM '.$master['TableName'].' WHERE '.$master['IdField'].' IN ('.join(',', $del_ids).')'; - $this->Conn->Query($query); - } + + $query = 'DELETE FROM '.$master['TableName'].' WHERE '.$master['IdField'].' IN ('.join(',', $current_ids).')'; + $this->Conn->Query($query); } if ( getArrayValue($master, 'SubTables') ) { @@ -578,9 +572,15 @@ // delete records from live table by foreign key, so that records deleted from temp table // get deleted from live if (count($current_ids) > 0 && !in_array($table_sig, $this->CopiedTables) ) { - $foreign_key_field = is_array($sub_table['ForeignKey']) ? getArrayValue($sub_table, 'ForeignKey', $master['Prefix']) : $sub_table['ForeignKey']; + $foreign_key_field = is_array($sub_table['ForeignKey']) ? getArrayValue($sub_table, 'ForeignKey', $master['Prefix']) : $sub_table['ForeignKey']; if (!$foreign_key_field) continue; $foreign_keys = $this->GetForeignKeys($master, $sub_table, $current_ids); + // Do not delete live sub-items with 0 id + // otherwise home category permissions got deleted when creating new category + $zero_id = array_search(0, $foreign_keys); + if ($zero_id !== false) { + array_splice($foreign_keys, $zero_id, 1); + } if (count($foreign_keys) > 0) { $query = 'SELECT '.$sub_table['IdField'].' FROM '.$sub_table['TableName'].' WHERE '.$foreign_key_field.' IN ('.join(',', $foreign_keys).')'; Index: trunk/core/units/categories/categories_event_handler.php =================================================================== diff -u -N -r5173 -r5176 --- trunk/core/units/categories/categories_event_handler.php (.../categories_event_handler.php) (revision 5173) +++ trunk/core/units/categories/categories_event_handler.php (.../categories_event_handler.php) (revision 5176) @@ -266,6 +266,22 @@ } } } + + /** + * Checks cache update mark and redirect to cache if needed + * + * @param kEvent $event + */ + function OnSave(&$event) + { + parent::OnSave($event); + if ($event->status == erSUCCESS && $this->Application->GetVar('require_cache_update')) { + // "catalog" should be in opener stack by now + $opener_stack = unserialize($this->Application->RecallVar('opener_stack')); + $opener_stack[0] = str_replace('catalog', 'categories/cache_updater', $opener_stack[0]); + $this->Application->StoreVar('opener_stack', serialize($opener_stack)); + } + } } ?> \ No newline at end of file Index: trunk/kernel/admin_templates/xml/categories_list.tpl =================================================================== diff -u -N -r5171 -r5176 --- trunk/kernel/admin_templates/xml/categories_list.tpl (.../categories_list.tpl) (revision 5171) +++ trunk/kernel/admin_templates/xml/categories_list.tpl (.../categories_list.tpl) (revision 5176) @@ -51,8 +51,8 @@ " id=""> ">  );">: - Pick - New + + ( / )

Index: trunk/core/admin_templates/categories/xml/categories_list.tpl =================================================================== diff -u -N -r5171 -r5176 --- trunk/core/admin_templates/categories/xml/categories_list.tpl (.../categories_list.tpl) (revision 5171) +++ trunk/core/admin_templates/categories/xml/categories_list.tpl (.../categories_list.tpl) (revision 5176) @@ -51,8 +51,8 @@ " id=""> ">  );">: - Pick - New + + ( / )

Index: trunk/admin/category/permcacheupdate.php =================================================================== diff -u -N -r4614 -r5176 --- trunk/admin/category/permcacheupdate.php (.../permcacheupdate.php) (revision 4614) +++ trunk/admin/category/permcacheupdate.php (.../permcacheupdate.php) (revision 5176) @@ -48,8 +48,8 @@ class clsCachedPermissions { - var $Allow; - var $Deny; + var $Allow = Array(); + var $Deny = Array(); var $CatId; function clsCachedPermissions($CatId) Index: trunk/core/admin_templates/categories/cache_updater.tpl =================================================================== diff -u -N -r5165 -r5176 --- trunk/core/admin_templates/categories/cache_updater.tpl (.../cache_updater.tpl) (revision 5165) +++ trunk/core/admin_templates/categories/cache_updater.tpl (.../cache_updater.tpl) (revision 5176) @@ -1,14 +1,4 @@ - - - - Index: trunk/core/units/categories/cache_updater.php =================================================================== diff -u -N -r5173 -r5176 --- trunk/core/units/categories/cache_updater.php (.../cache_updater.php) (revision 5173) +++ trunk/core/units/categories/cache_updater.php (.../cache_updater.php) (revision 5176) @@ -48,8 +48,8 @@ class clsCachedPermissions { - var $Allow; - var $Deny; + var $Allow = Array(); + var $Deny = Array(); var $CatId; function clsCachedPermissions($CatId) Index: trunk/kernel/admin_templates/categories/cache_updater.tpl =================================================================== diff -u -N -r5165 -r5176 --- trunk/kernel/admin_templates/categories/cache_updater.tpl (.../cache_updater.tpl) (revision 5165) +++ trunk/kernel/admin_templates/categories/cache_updater.tpl (.../cache_updater.tpl) (revision 5176) @@ -1,14 +1,4 @@ - - - -