Index: branches/unlabeled/unlabeled-1.22.2/core/units/categories/categories_event_handler.php =================================================================== diff -u -N -r5620 -r5625 --- branches/unlabeled/unlabeled-1.22.2/core/units/categories/categories_event_handler.php (.../categories_event_handler.php) (revision 5620) +++ branches/unlabeled/unlabeled-1.22.2/core/units/categories/categories_event_handler.php (.../categories_event_handler.php) (revision 5625) @@ -295,6 +295,16 @@ } parent::OnSave($event); + $this->UpdateCategoryCache($event); + } + + /** + * Redirects to Category Cache Updater + * + * @param kEvent $event + */ + function UpdateCategoryCache(&$event) + { if ($event->status == erSUCCESS && $this->Application->RecallVar('PermCache_UpdateRequired')) { // "catalog" should be in opener stack by now $opener_stack = unserialize($this->Application->RecallVar('opener_stack')); @@ -376,40 +386,26 @@ return; } + $clipboard_data = $event->getEventParam('clipboard_data'); - - if ($ids) { - $recursive_helper =& $this->Application->recallObject('RecursiveHelper'); - foreach ($ids as $id) { - $recursive_helper->DeleteCategory($id); - } + if (!$clipboard_data['cut'] && !$clipboard_data['copy']) { + return false; } - $this->clearSelectedIDs($event); - /*$ids = $this->Application->RecallVar($event->getPrefixSpecial().'_clipboard'); - if ($ids == '') { - $event->redirect = false; - return; + $recursive_helper =& $this->Application->recallObject('RecursiveHelper'); + if ($clipboard_data['cut']) { + $recursive_helper->MoveCategories($clipboard_data['cut']); } - - $ids_arr = explode(',', $ids); - - if ($this->Application->RecallVar($event->getPrefixSpecial().'_clipboard_mode') == 'copy') { - $temp =& $this->Application->recallObject($event->getPrefixSpecial().'_TempHandler', 'kTempTablesHandler'); - - if ($ids_arr) { - $temp->CloneItems($event->Prefix, $event->Special, $ids_arr); + + if ($clipboard_data['copy']) { + foreach ($clipboard_data['copy'] as $id) { + $recursive_helper->PasteCategory($id); } } - else { // mode == cut - $object =& $this->Application->recallObject($event->getPrefixSpecial().'.item', $event->Prefix, Array('skip_autoload' => true)); - - foreach ($ids_arr as $id) { - $object->Load($id); - $object->MoveToCat(); - } + + if ($clipboard_data['cut'] || $clipboard_data['copy']) { + $this->UpdateCategoryCache($event); } - $event->status = erSUCCESS;*/ } /** Index: branches/unlabeled/unlabeled-1.2.2/core/units/general/helpers/recursive_helper.php =================================================================== diff -u -N -r5620 -r5625 --- branches/unlabeled/unlabeled-1.2.2/core/units/general/helpers/recursive_helper.php (.../recursive_helper.php) (revision 5620) +++ branches/unlabeled/unlabeled-1.2.2/core/units/general/helpers/recursive_helper.php (.../recursive_helper.php) (revision 5625) @@ -75,7 +75,7 @@ } // moves selected categories to destination category - function MoveCategory($category_ids, $dest_category_id) + function MoveCategories($category_ids, $dest_category_id) { if (!$category_ids) return ; @@ -92,7 +92,10 @@ function PasteCategory($category_id) { - // mode == cut -> just update ParentId of category, items aren't changed, because category_id stays the same + // mode == copy - complete recusive clone with subitems for all items in clipboard + +// $temp =& $this->Application->recallObject($event->getPrefixSpecial().'_TempHandler', 'kTempTablesHandler'); +// $temp->CloneItems($event->Prefix, $event->Special, $ids_arr); } } Index: branches/unlabeled/unlabeled-1.2.2/kernel/units/general/helpers/recursive_helper.php =================================================================== diff -u -N -r5620 -r5625 --- branches/unlabeled/unlabeled-1.2.2/kernel/units/general/helpers/recursive_helper.php (.../recursive_helper.php) (revision 5620) +++ branches/unlabeled/unlabeled-1.2.2/kernel/units/general/helpers/recursive_helper.php (.../recursive_helper.php) (revision 5625) @@ -75,7 +75,7 @@ } // moves selected categories to destination category - function MoveCategory($category_ids, $dest_category_id) + function MoveCategories($category_ids, $dest_category_id) { if (!$category_ids) return ; @@ -92,7 +92,10 @@ function PasteCategory($category_id) { - // mode == cut -> just update ParentId of category, items aren't changed, because category_id stays the same + // mode == copy - complete recusive clone with subitems for all items in clipboard + +// $temp =& $this->Application->recallObject($event->getPrefixSpecial().'_TempHandler', 'kTempTablesHandler'); +// $temp->CloneItems($event->Prefix, $event->Special, $ids_arr); } } Index: branches/unlabeled/unlabeled-1.22.2/kernel/units/categories/categories_event_handler.php =================================================================== diff -u -N -r5620 -r5625 --- branches/unlabeled/unlabeled-1.22.2/kernel/units/categories/categories_event_handler.php (.../categories_event_handler.php) (revision 5620) +++ branches/unlabeled/unlabeled-1.22.2/kernel/units/categories/categories_event_handler.php (.../categories_event_handler.php) (revision 5625) @@ -295,6 +295,16 @@ } parent::OnSave($event); + $this->UpdateCategoryCache($event); + } + + /** + * Redirects to Category Cache Updater + * + * @param kEvent $event + */ + function UpdateCategoryCache(&$event) + { if ($event->status == erSUCCESS && $this->Application->RecallVar('PermCache_UpdateRequired')) { // "catalog" should be in opener stack by now $opener_stack = unserialize($this->Application->RecallVar('opener_stack')); @@ -376,40 +386,26 @@ return; } + $clipboard_data = $event->getEventParam('clipboard_data'); - - if ($ids) { - $recursive_helper =& $this->Application->recallObject('RecursiveHelper'); - foreach ($ids as $id) { - $recursive_helper->DeleteCategory($id); - } + if (!$clipboard_data['cut'] && !$clipboard_data['copy']) { + return false; } - $this->clearSelectedIDs($event); - /*$ids = $this->Application->RecallVar($event->getPrefixSpecial().'_clipboard'); - if ($ids == '') { - $event->redirect = false; - return; + $recursive_helper =& $this->Application->recallObject('RecursiveHelper'); + if ($clipboard_data['cut']) { + $recursive_helper->MoveCategories($clipboard_data['cut']); } - - $ids_arr = explode(',', $ids); - - if ($this->Application->RecallVar($event->getPrefixSpecial().'_clipboard_mode') == 'copy') { - $temp =& $this->Application->recallObject($event->getPrefixSpecial().'_TempHandler', 'kTempTablesHandler'); - - if ($ids_arr) { - $temp->CloneItems($event->Prefix, $event->Special, $ids_arr); + + if ($clipboard_data['copy']) { + foreach ($clipboard_data['copy'] as $id) { + $recursive_helper->PasteCategory($id); } } - else { // mode == cut - $object =& $this->Application->recallObject($event->getPrefixSpecial().'.item', $event->Prefix, Array('skip_autoload' => true)); - - foreach ($ids_arr as $id) { - $object->Load($id); - $object->MoveToCat(); - } + + if ($clipboard_data['cut'] || $clipboard_data['copy']) { + $this->UpdateCategoryCache($event); } - $event->status = erSUCCESS;*/ } /**