Index: branches/unlabeled/unlabeled-1.64.2/kernel/units/general/cat_event_handler.php
===================================================================
diff -u -r5602 -r5609
--- branches/unlabeled/unlabeled-1.64.2/kernel/units/general/cat_event_handler.php (.../cat_event_handler.php) (revision 5602)
+++ branches/unlabeled/unlabeled-1.64.2/kernel/units/general/cat_event_handler.php (.../cat_event_handler.php) (revision 5609)
@@ -48,32 +48,39 @@
return parent::CheckPermission($event);
}
+ /**
+ * Add selected items to clipboard with mode = COPY (CLONE)
+ *
+ * @param kEvent $event
+ */
function OnCopy(&$event)
{
- $object = $event->getObject();
- $this->StoreSelectedIDs($event);
- $ids = $this->getSelectedIDs($event);
- $this->Application->StoreVar($event->getPrefixSpecial().'_clipboard', implode(',', $ids));
- $this->Application->StoreVar($event->getPrefixSpecial().'_clipboard_mode', 'copy');
-
-// $this->Application->StoreVar('ClipBoard', 'COPY-0.'.$object->TableName.'.ResourceId=0');
- $event->redirect_params = Array('opener' => 's', 'pass_events'=>true); //do not go up - STAY
+ $clipboard_helper =& $this->Application->recallObject('ClipboardHelper');
+ $clipboard_helper->setClipboard($event, 'copy', $this->StoreSelectedIDs($event));
}
+ /**
+ * Add selected items to clipboard with mode = CUT
+ *
+ * @param kEvent $event
+ */
function OnCut(&$event)
{
- $object = $event->getObject();
- $ids = $this->StoreSelectedIDs($event);
- $this->Application->StoreVar($event->getPrefixSpecial().'_clipboard', implode(',', $ids));
- $this->Application->StoreVar($event->getPrefixSpecial().'_clipboard_mode', 'cut');
-
-// $this->Application->StoreVar('ClipBoard', 'CUT-0.'.$object->TableName.'.ResourceId=0');
- $event->redirect_params = Array('opener' => 's', 'pass_events'=>true); //do not go up - STAY
+ $clipboard_helper =& $this->Application->recallObject('ClipboardHelper');
+ $clipboard_helper->setClipboard($event, 'cut', $this->StoreSelectedIDs($event));
}
+ /**
+ * Performs category item paste
+ *
+ * @param kEvent $event
+ */
function OnPaste(&$event)
{
- $ids = $this->Application->RecallVar($event->getPrefixSpecial().'_clipboard');
+ echo 'pasting categories';
+ $event->redirect = false; // for debugging
+
+ /*$ids = $this->Application->RecallVar($event->getPrefixSpecial().'_clipboard');
if ($ids == '') {
$event->redirect = false;
return;
@@ -96,15 +103,15 @@
$object->MoveToCat();
}
}
- $event->status = erSUCCESS;
+ $event->status = erSUCCESS;*/
}
/**
* Occurs when pasting category
*
* @param kEvent $event
*/
- function OnCatPaste(&$event)
+ /*function OnCatPaste(&$event)
{
$inp_clipboard = $this->Application->RecallVar('ClipBoard');
$inp_clipboard = explode('-', $inp_clipboard, 2);
@@ -135,7 +142,7 @@
$this->Application->SetVar('m_cat_id', $saved_cat_id);
}
- }
+ }*/
/**
* Return type clauses for list bulding on front
Index: branches/unlabeled/unlabeled-1.15.2/kernel/admin_templates/xml/categories_list.tpl
===================================================================
diff -u -r5602 -r5609
--- branches/unlabeled/unlabeled-1.15.2/kernel/admin_templates/xml/categories_list.tpl (.../categories_list.tpl) (revision 5602)
+++ branches/unlabeled/unlabeled-1.15.2/kernel/admin_templates/xml/categories_list.tpl (.../categories_list.tpl) (revision 5609)
@@ -41,7 +41,7 @@
a_toolbar.EnableButton('upcat');
a_toolbar.EnableButton('homecat');
-$Catalog.reflectPasteButton();
+$Catalog.reflectPasteButton();
#separator#
Index: branches/unlabeled/unlabeled-1.28.2/kernel/units/categories/categories_tag_processor.php
===================================================================
diff -u -r5602 -r5609
--- branches/unlabeled/unlabeled-1.28.2/kernel/units/categories/categories_tag_processor.php (.../categories_tag_processor.php) (revision 5602)
+++ branches/unlabeled/unlabeled-1.28.2/kernel/units/categories/categories_tag_processor.php (.../categories_tag_processor.php) (revision 5609)
@@ -417,9 +417,18 @@
* @param Array $params
* @return bool
*/
- function PasteEnabled($params)
+ function HasClipboard($params)
{
- return $this->Application->RecallVar($this->getPrefixSpecial().'_clipboard') ? 1 : 0;
+ $clipboard = $this->Application->RecallVar('clipboard');
+ if ($clipboard) {
+ $clipboard = unserialize($clipboard);
+ foreach ($clipboard as $prefix => $clipboard_data) {
+ foreach ($clipboard_data as $mode => $ids) {
+ if (count($ids)) return 1;
+ }
+ }
+ }
+ return 0;
}
}
Index: branches/unlabeled/unlabeled-1.22.2/core/units/categories/categories_event_handler.php
===================================================================
diff -u -r5517 -r5609
--- branches/unlabeled/unlabeled-1.22.2/core/units/categories/categories_event_handler.php (.../categories_event_handler.php) (revision 5517)
+++ branches/unlabeled/unlabeled-1.22.2/core/units/categories/categories_event_handler.php (.../categories_event_handler.php) (revision 5609)
@@ -317,6 +317,78 @@
}
$this->clearSelectedIDs($event);
}
+
+ /**
+ * Add selected items to clipboard with mode = COPY (CLONE)
+ *
+ * @param kEvent $event
+ */
+ function OnCopy(&$event)
+ {
+ $clipboard_helper =& $this->Application->recallObject('ClipboardHelper');
+ $clipboard_helper->setClipboard($event, 'copy', $this->StoreSelectedIDs($event));
+ }
+
+ /**
+ * Add selected items to clipboard with mode = CUT
+ *
+ * @param kEvent $event
+ */
+ function OnCut(&$event)
+ {
+ $clipboard_helper =& $this->Application->recallObject('ClipboardHelper');
+ $clipboard_helper->setClipboard($event, 'cut', $this->StoreSelectedIDs($event));
+ }
+
+ /**
+ * Paste categories with subitems from clipboard
+ *
+ * @param kEvent $event
+ */
+ function OnPaste(&$event)
+ {
+ echo 'performs category paste';
+ $event->redirect = false;
+
+
+// $clipboard_prefix = $this->Application->RecallVar('clipboard_prefix');
+
+
+ /*$ids = $this->Application->RecallVar($event->getPrefixSpecial().'_clipboard');
+ if ($ids == '') {
+ $event->redirect = false;
+ return;
+ }
+
+ $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);
+ }
+ }
+ 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();
+ }
+ }
+ $event->status = erSUCCESS;*/
+ }
+
+ /**
+ * Cleares clipboard content
+ *
+ * @param kEvent $event
+ */
+ function OnClearClipboard(&$event)
+ {
+ $this->Application->RemoveVar('clipboard');
+ }
}
?>
\ No newline at end of file
Index: branches/unlabeled/unlabeled-1.15.2/core/admin_templates/categories/xml/categories_list.tpl
===================================================================
diff -u -r5602 -r5609
--- branches/unlabeled/unlabeled-1.15.2/core/admin_templates/categories/xml/categories_list.tpl (.../categories_list.tpl) (revision 5602)
+++ branches/unlabeled/unlabeled-1.15.2/core/admin_templates/categories/xml/categories_list.tpl (.../categories_list.tpl) (revision 5609)
@@ -41,7 +41,7 @@
a_toolbar.EnableButton('upcat');
a_toolbar.EnableButton('homecat');
-$Catalog.reflectPasteButton();
+$Catalog.reflectPasteButton();
#separator#
Index: branches/unlabeled/unlabeled-1.64.2/core/units/general/cat_event_handler.php
===================================================================
diff -u -r5602 -r5609
--- branches/unlabeled/unlabeled-1.64.2/core/units/general/cat_event_handler.php (.../cat_event_handler.php) (revision 5602)
+++ branches/unlabeled/unlabeled-1.64.2/core/units/general/cat_event_handler.php (.../cat_event_handler.php) (revision 5609)
@@ -48,32 +48,39 @@
return parent::CheckPermission($event);
}
+ /**
+ * Add selected items to clipboard with mode = COPY (CLONE)
+ *
+ * @param kEvent $event
+ */
function OnCopy(&$event)
{
- $object = $event->getObject();
- $this->StoreSelectedIDs($event);
- $ids = $this->getSelectedIDs($event);
- $this->Application->StoreVar($event->getPrefixSpecial().'_clipboard', implode(',', $ids));
- $this->Application->StoreVar($event->getPrefixSpecial().'_clipboard_mode', 'copy');
-
-// $this->Application->StoreVar('ClipBoard', 'COPY-0.'.$object->TableName.'.ResourceId=0');
- $event->redirect_params = Array('opener' => 's', 'pass_events'=>true); //do not go up - STAY
+ $clipboard_helper =& $this->Application->recallObject('ClipboardHelper');
+ $clipboard_helper->setClipboard($event, 'copy', $this->StoreSelectedIDs($event));
}
+ /**
+ * Add selected items to clipboard with mode = CUT
+ *
+ * @param kEvent $event
+ */
function OnCut(&$event)
{
- $object = $event->getObject();
- $ids = $this->StoreSelectedIDs($event);
- $this->Application->StoreVar($event->getPrefixSpecial().'_clipboard', implode(',', $ids));
- $this->Application->StoreVar($event->getPrefixSpecial().'_clipboard_mode', 'cut');
-
-// $this->Application->StoreVar('ClipBoard', 'CUT-0.'.$object->TableName.'.ResourceId=0');
- $event->redirect_params = Array('opener' => 's', 'pass_events'=>true); //do not go up - STAY
+ $clipboard_helper =& $this->Application->recallObject('ClipboardHelper');
+ $clipboard_helper->setClipboard($event, 'cut', $this->StoreSelectedIDs($event));
}
+ /**
+ * Performs category item paste
+ *
+ * @param kEvent $event
+ */
function OnPaste(&$event)
{
- $ids = $this->Application->RecallVar($event->getPrefixSpecial().'_clipboard');
+ echo 'pasting categories';
+ $event->redirect = false; // for debugging
+
+ /*$ids = $this->Application->RecallVar($event->getPrefixSpecial().'_clipboard');
if ($ids == '') {
$event->redirect = false;
return;
@@ -96,15 +103,15 @@
$object->MoveToCat();
}
}
- $event->status = erSUCCESS;
+ $event->status = erSUCCESS;*/
}
/**
* Occurs when pasting category
*
* @param kEvent $event
*/
- function OnCatPaste(&$event)
+ /*function OnCatPaste(&$event)
{
$inp_clipboard = $this->Application->RecallVar('ClipBoard');
$inp_clipboard = explode('-', $inp_clipboard, 2);
@@ -135,7 +142,7 @@
$this->Application->SetVar('m_cat_id', $saved_cat_id);
}
- }
+ }*/
/**
* Return type clauses for list bulding on front
Index: branches/unlabeled/unlabeled-1.28.2/core/units/categories/categories_tag_processor.php
===================================================================
diff -u -r5602 -r5609
--- branches/unlabeled/unlabeled-1.28.2/core/units/categories/categories_tag_processor.php (.../categories_tag_processor.php) (revision 5602)
+++ branches/unlabeled/unlabeled-1.28.2/core/units/categories/categories_tag_processor.php (.../categories_tag_processor.php) (revision 5609)
@@ -417,9 +417,18 @@
* @param Array $params
* @return bool
*/
- function PasteEnabled($params)
+ function HasClipboard($params)
{
- return $this->Application->RecallVar($this->getPrefixSpecial().'_clipboard') ? 1 : 0;
+ $clipboard = $this->Application->RecallVar('clipboard');
+ if ($clipboard) {
+ $clipboard = unserialize($clipboard);
+ foreach ($clipboard as $prefix => $clipboard_data) {
+ foreach ($clipboard_data as $mode => $ids) {
+ if (count($ids)) return 1;
+ }
+ }
+ }
+ return 0;
}
}
Index: branches/unlabeled/unlabeled-1.11.2/kernel/units/general/cat_tag_processor.php
===================================================================
diff -u -r5602 -r5609
--- branches/unlabeled/unlabeled-1.11.2/kernel/units/general/cat_tag_processor.php (.../cat_tag_processor.php) (revision 5602)
+++ branches/unlabeled/unlabeled-1.11.2/kernel/units/general/cat_tag_processor.php (.../cat_tag_processor.php) (revision 5609)
@@ -148,18 +148,6 @@
$review_tag_processor =& $this->Application->recallObject('rev.item_TagProcessor');
return $review_tag_processor->TotalRecords($params);
}
-
- /**
- * Allows to detect if this prefix has something in clipboard
- *
- * @param Array $params
- * @return bool
- */
- function PasteEnabled($params)
- {
- return $this->Application->RecallVar($this->getPrefixSpecial().'_clipboard') ? 1 : 0;
- }
-
}
?>
\ No newline at end of file
Index: branches/unlabeled/unlabeled-1.11.2/core/units/general/cat_tag_processor.php
===================================================================
diff -u -r5602 -r5609
--- branches/unlabeled/unlabeled-1.11.2/core/units/general/cat_tag_processor.php (.../cat_tag_processor.php) (revision 5602)
+++ branches/unlabeled/unlabeled-1.11.2/core/units/general/cat_tag_processor.php (.../cat_tag_processor.php) (revision 5609)
@@ -148,18 +148,6 @@
$review_tag_processor =& $this->Application->recallObject('rev.item_TagProcessor');
return $review_tag_processor->TotalRecords($params);
}
-
- /**
- * Allows to detect if this prefix has something in clipboard
- *
- * @param Array $params
- * @return bool
- */
- function PasteEnabled($params)
- {
- return $this->Application->RecallVar($this->getPrefixSpecial().'_clipboard') ? 1 : 0;
- }
-
}
?>
\ No newline at end of file
Index: branches/unlabeled/unlabeled-1.27.2/kernel/admin_templates/incs/catalog.js
===================================================================
diff -u -r5602 -r5609
--- branches/unlabeled/unlabeled-1.27.2/kernel/admin_templates/incs/catalog.js (.../catalog.js) (revision 5602)
+++ branches/unlabeled/unlabeled-1.27.2/kernel/admin_templates/incs/catalog.js (.../catalog.js) (revision 5609)
@@ -6,7 +6,6 @@
this.URLMask = $url_mask;
this.Separator = '#separator#';
this.ParentCategoryID = 0;
- this.EnablePaste = false;
this.TabRegistry = new Array();
this.ActivePrefix = getCookie(this.CookiePrefix + 'active_prefix');
@@ -264,7 +263,6 @@
$ViewMenus = isset($item_prefix) ? new Array('c', $item_prefix) : new Array('c');
}
-Catalog.prototype.reflectPasteButton = function($clipboard_status) {
- this.PasteEnabled = this.PasteEnabled || $clipboard_status;
- a_toolbar.SetEnabled('paste', this.PasteEnabled);
+Catalog.prototype.reflectPasteButton = function($status) {
+ a_toolbar.SetEnabled('paste', $status);
}
\ No newline at end of file
Index: branches/unlabeled/unlabeled-1.1.2/core/units/general/helpers/clipboard_helper.php
===================================================================
diff -u
--- branches/unlabeled/unlabeled-1.1.2/core/units/general/helpers/clipboard_helper.php (revision 0)
+++ branches/unlabeled/unlabeled-1.1.2/core/units/general/helpers/clipboard_helper.php (revision 5609)
@@ -0,0 +1,48 @@
+getObject();
+
+ $clipboard = $this->Application->RecallVar('clipboard');
+ $clipboard = $clipboard ? unserialize($clipboard) : Array();
+
+ $prefix = $event->getPrefixSpecial();
+
+ // 1. add $ids to mode key for prefix (make sure the unique)
+ $this_mode_ids =& $clipboard[$prefix][$mode];
+ if (!is_array($this_mode_ids)) {
+ $this_mode_ids = $ids;
+ }
+ else {
+ $this_mode_ids = array_unique( array_merge($this_mode_ids, $ids) );
+ }
+
+ // 2. remove that ids from all other modes
+ $other_mode_ids =& $clipboard[$prefix][$mode == 'cut' ? 'copy' : 'cut'];
+ if (!is_array($other_mode_ids)) {
+ $other_mode_ids = Array();
+ }
+ else {
+ $other_mode_ids = array_diff($other_mode_ids, $this_mode_ids);
+ }
+
+ $this->Application->StoreVar('clipboard', serialize($clipboard));
+
+ /*// do not go up - STAY
+ $event->SetRedirectParam('opener', 's');
+ $event->SetRedirectParam('pass_events', true);*/
+ }
+ }
+
+
+?>
\ No newline at end of file
Index: branches/unlabeled/unlabeled-1.1.2/kernel/units/general/helpers/clipboard_helper.php
===================================================================
diff -u
--- branches/unlabeled/unlabeled-1.1.2/kernel/units/general/helpers/clipboard_helper.php (revision 0)
+++ branches/unlabeled/unlabeled-1.1.2/kernel/units/general/helpers/clipboard_helper.php (revision 5609)
@@ -0,0 +1,48 @@
+getObject();
+
+ $clipboard = $this->Application->RecallVar('clipboard');
+ $clipboard = $clipboard ? unserialize($clipboard) : Array();
+
+ $prefix = $event->getPrefixSpecial();
+
+ // 1. add $ids to mode key for prefix (make sure the unique)
+ $this_mode_ids =& $clipboard[$prefix][$mode];
+ if (!is_array($this_mode_ids)) {
+ $this_mode_ids = $ids;
+ }
+ else {
+ $this_mode_ids = array_unique( array_merge($this_mode_ids, $ids) );
+ }
+
+ // 2. remove that ids from all other modes
+ $other_mode_ids =& $clipboard[$prefix][$mode == 'cut' ? 'copy' : 'cut'];
+ if (!is_array($other_mode_ids)) {
+ $other_mode_ids = Array();
+ }
+ else {
+ $other_mode_ids = array_diff($other_mode_ids, $this_mode_ids);
+ }
+
+ $this->Application->StoreVar('clipboard', serialize($clipboard));
+
+ /*// do not go up - STAY
+ $event->SetRedirectParam('opener', 's');
+ $event->SetRedirectParam('pass_events', true);*/
+ }
+ }
+
+
+?>
\ No newline at end of file
Index: branches/unlabeled/unlabeled-1.23.2/kernel/admin_templates/catalog.tpl
===================================================================
diff -u -r5573 -r5609
--- branches/unlabeled/unlabeled-1.23.2/kernel/admin_templates/catalog.tpl (.../catalog.tpl) (revision 5573)
+++ branches/unlabeled/unlabeled-1.23.2/kernel/admin_templates/catalog.tpl (.../catalog.tpl) (revision 5609)
@@ -104,9 +104,14 @@
a_toolbar.AddButton( new ToolBarButton('paste', '', function() {
- $Catalog.submit_event(null, 'OnCatPaste');
+ $Catalog.submit_event('c', 'OnPaste');
}
) );
+
+ a_toolbar.AddButton( new ToolBarButton('clear', '', function() {
+ $Catalog.submit_event('c', 'OnClearClipboard');
+ }
+ ) );
a_toolbar.AddButton( new ToolBarSeparator('sep5') );
Index: branches/unlabeled/unlabeled-1.2.2/core/units/general/helpers/helpers_config.php
===================================================================
diff -u -r5551 -r5609
--- branches/unlabeled/unlabeled-1.2.2/core/units/general/helpers/helpers_config.php (.../helpers_config.php) (revision 5551)
+++ branches/unlabeled/unlabeled-1.2.2/core/units/general/helpers/helpers_config.php (.../helpers_config.php) (revision 5609)
@@ -13,5 +13,6 @@
Array('pseudo'=>'ModRewriteHelper','class'=>'kModRewriteHelper','file'=>'mod_rewrite_helper.php','build_event'=>'','require_classes'=>'kHelper'),
Array('pseudo'=>'RecursiveHelper','class'=>'kRecursiveHelper','file'=>'recursive_helper.php','build_event'=>'','require_classes'=>'kHelper'),
Array('pseudo'=>'FilenamesHelper','class'=>'kFilenamesHelper','file'=>'filenames_helper.php','build_event'=>'','require_classes'=>'kHelper'),
+ Array('pseudo'=>'ClipboardHelper','class'=>'kClipboardHelper','file'=>'clipboard_helper.php','build_event'=>'','require_classes'=>'kHelper'),
),
);
\ No newline at end of file
Index: branches/unlabeled/unlabeled-1.2.2/kernel/units/general/helpers/helpers_config.php
===================================================================
diff -u -r5551 -r5609
--- branches/unlabeled/unlabeled-1.2.2/kernel/units/general/helpers/helpers_config.php (.../helpers_config.php) (revision 5551)
+++ branches/unlabeled/unlabeled-1.2.2/kernel/units/general/helpers/helpers_config.php (.../helpers_config.php) (revision 5609)
@@ -13,5 +13,6 @@
Array('pseudo'=>'ModRewriteHelper','class'=>'kModRewriteHelper','file'=>'mod_rewrite_helper.php','build_event'=>'','require_classes'=>'kHelper'),
Array('pseudo'=>'RecursiveHelper','class'=>'kRecursiveHelper','file'=>'recursive_helper.php','build_event'=>'','require_classes'=>'kHelper'),
Array('pseudo'=>'FilenamesHelper','class'=>'kFilenamesHelper','file'=>'filenames_helper.php','build_event'=>'','require_classes'=>'kHelper'),
+ Array('pseudo'=>'ClipboardHelper','class'=>'kClipboardHelper','file'=>'clipboard_helper.php','build_event'=>'','require_classes'=>'kHelper'),
),
);
\ No newline at end of file
Index: branches/unlabeled/unlabeled-1.27.2/core/admin_templates/js/catalog.js
===================================================================
diff -u -r5602 -r5609
--- branches/unlabeled/unlabeled-1.27.2/core/admin_templates/js/catalog.js (.../catalog.js) (revision 5602)
+++ branches/unlabeled/unlabeled-1.27.2/core/admin_templates/js/catalog.js (.../catalog.js) (revision 5609)
@@ -6,7 +6,6 @@
this.URLMask = $url_mask;
this.Separator = '#separator#';
this.ParentCategoryID = 0;
- this.EnablePaste = false;
this.TabRegistry = new Array();
this.ActivePrefix = getCookie(this.CookiePrefix + 'active_prefix');
@@ -264,7 +263,6 @@
$ViewMenus = isset($item_prefix) ? new Array('c', $item_prefix) : new Array('c');
}
-Catalog.prototype.reflectPasteButton = function($clipboard_status) {
- this.PasteEnabled = this.PasteEnabled || $clipboard_status;
- a_toolbar.SetEnabled('paste', this.PasteEnabled);
+Catalog.prototype.reflectPasteButton = function($status) {
+ a_toolbar.SetEnabled('paste', $status);
}
\ No newline at end of file
Index: branches/unlabeled/unlabeled-1.22.2/kernel/units/categories/categories_event_handler.php
===================================================================
diff -u -r5517 -r5609
--- branches/unlabeled/unlabeled-1.22.2/kernel/units/categories/categories_event_handler.php (.../categories_event_handler.php) (revision 5517)
+++ branches/unlabeled/unlabeled-1.22.2/kernel/units/categories/categories_event_handler.php (.../categories_event_handler.php) (revision 5609)
@@ -317,6 +317,78 @@
}
$this->clearSelectedIDs($event);
}
+
+ /**
+ * Add selected items to clipboard with mode = COPY (CLONE)
+ *
+ * @param kEvent $event
+ */
+ function OnCopy(&$event)
+ {
+ $clipboard_helper =& $this->Application->recallObject('ClipboardHelper');
+ $clipboard_helper->setClipboard($event, 'copy', $this->StoreSelectedIDs($event));
+ }
+
+ /**
+ * Add selected items to clipboard with mode = CUT
+ *
+ * @param kEvent $event
+ */
+ function OnCut(&$event)
+ {
+ $clipboard_helper =& $this->Application->recallObject('ClipboardHelper');
+ $clipboard_helper->setClipboard($event, 'cut', $this->StoreSelectedIDs($event));
+ }
+
+ /**
+ * Paste categories with subitems from clipboard
+ *
+ * @param kEvent $event
+ */
+ function OnPaste(&$event)
+ {
+ echo 'performs category paste';
+ $event->redirect = false;
+
+
+// $clipboard_prefix = $this->Application->RecallVar('clipboard_prefix');
+
+
+ /*$ids = $this->Application->RecallVar($event->getPrefixSpecial().'_clipboard');
+ if ($ids == '') {
+ $event->redirect = false;
+ return;
+ }
+
+ $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);
+ }
+ }
+ 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();
+ }
+ }
+ $event->status = erSUCCESS;*/
+ }
+
+ /**
+ * Cleares clipboard content
+ *
+ * @param kEvent $event
+ */
+ function OnClearClipboard(&$event)
+ {
+ $this->Application->RemoveVar('clipboard');
+ }
}
?>
\ No newline at end of file
Index: branches/unlabeled/unlabeled-1.23.2/core/admin_templates/catalog/catalog.tpl
===================================================================
diff -u -r5573 -r5609
--- branches/unlabeled/unlabeled-1.23.2/core/admin_templates/catalog/catalog.tpl (.../catalog.tpl) (revision 5573)
+++ branches/unlabeled/unlabeled-1.23.2/core/admin_templates/catalog/catalog.tpl (.../catalog.tpl) (revision 5609)
@@ -104,9 +104,14 @@
a_toolbar.AddButton( new ToolBarButton('paste', '', function() {
- $Catalog.submit_event(null, 'OnCatPaste');
+ $Catalog.submit_event('c', 'OnPaste');
}
) );
+
+ a_toolbar.AddButton( new ToolBarButton('clear', '', function() {
+ $Catalog.submit_event('c', 'OnClearClipboard');
+ }
+ ) );
a_toolbar.AddButton( new ToolBarSeparator('sep5') );