Index: branches/unlabeled/unlabeled-1.64.2/kernel/units/general/cat_event_handler.php =================================================================== diff -u -N -r5609 -r5610 --- branches/unlabeled/unlabeled-1.64.2/kernel/units/general/cat_event_handler.php (.../cat_event_handler.php) (revision 5609) +++ branches/unlabeled/unlabeled-1.64.2/kernel/units/general/cat_event_handler.php (.../cat_event_handler.php) (revision 5610) @@ -77,74 +77,28 @@ */ function OnPaste(&$event) { - echo 'pasting categories'; - $event->redirect = false; // for debugging + $clipboard_data = $event->getEventParam('clipboard_data'); - /*$ids = $this->Application->RecallVar($event->getPrefixSpecial().'_clipboard'); - if ($ids == '') { - $event->redirect = false; - return; + if (!$clipboard_data['cut'] && !$clipboard_data['copy']) { + return false; } - $ids_arr = explode(',', $ids); - - if ($this->Application->RecallVar($event->getPrefixSpecial().'_clipboard_mode') == 'copy') { + if ($clipboard_data['copy']) { $temp =& $this->Application->recallObject($event->getPrefixSpecial().'_TempHandler', 'kTempTablesHandler'); - - if ($ids_arr) { - $temp->CloneItems($event->Prefix, $event->Special, $ids_arr); - } + $temp->CloneItems($event->Prefix, $event->Special, $clipboard_data['copy']); } - else { // mode == cut + + if ($clipboard_data['cut']) { $object =& $this->Application->recallObject($event->getPrefixSpecial().'.item', $event->Prefix, Array('skip_autoload' => true)); - foreach ($ids_arr as $id) { + foreach ($clipboard_data['cut'] as $id) { $object->Load($id); $object->MoveToCat(); } } - $event->status = erSUCCESS;*/ } /** - * Occurs when pasting category - * - * @param kEvent $event - */ - /*function OnCatPaste(&$event) - { - $inp_clipboard = $this->Application->RecallVar('ClipBoard'); - $inp_clipboard = explode('-', $inp_clipboard, 2); - - if($inp_clipboard[0] == 'COPY') - { - $saved_cat_id = $this->Application->GetVar('m_cat_id'); - $cat_ids = $event->getEventParam('cat_ids'); - - $id_field = $this->Application->getUnitOption($event->Prefix, 'IDField'); - $table = $this->Application->getUnitOption($event->Prefix, 'TableName'); - $ids_sql = 'SELECT '.$id_field.' FROM '.$table.' WHERE ResourceId IN (%s)'; - $resource_ids_sql = 'SELECT ItemResourceId FROM '.TABLE_PREFIX.'CategoryItems WHERE CategoryId = %s AND PrimaryCat = 1'; - - $object =& $this->Application->recallObject($event->Prefix.'.item', $event->Prefix, Array('skip_autoload' => true)); - - foreach($cat_ids as $source_cat => $dest_cat) - { - $item_resource_ids = $this->Conn->GetCol( sprintf($resource_ids_sql, $source_cat) ); - if(!$item_resource_ids) continue; - - $this->Application->SetVar('m_cat_id', $dest_cat); - $item_ids = $this->Conn->GetCol( sprintf($ids_sql, implode(',', $item_resource_ids) ) ); - - $temp =& $this->Application->recallObject($event->getPrefixSpecial().'_TempHandler', 'kTempTablesHandler'); - if($item_ids) $temp->CloneItems($event->Prefix, $event->Special, $item_ids); - } - - $this->Application->SetVar('m_cat_id', $saved_cat_id); - } - }*/ - - /** * Return type clauses for list bulding on front * * @param kEvent $event