diff --git a/lib/foldermanagement/compressionArchiveUtil.inc.php b/lib/foldermanagement/compressionArchiveUtil.inc.php index 5801826..5db6082 100644 --- a/lib/foldermanagement/compressionArchiveUtil.inc.php +++ b/lib/foldermanagement/compressionArchiveUtil.inc.php @@ -602,11 +602,11 @@ class DownloadQueue foreach ($download as $item){ if($item['object_type'] == 'document'){ $docId = $item['object_id']; - $this->addDocument($zip, $docId); + $this->addDocument($zip, $docId, false); } if($item['object_type'] == 'folder'){ $folderId = $item['object_id']; - $this->addFolder($zip, $folderId); + $this->addFolder($zip, $folderId, false); } } @@ -700,9 +700,10 @@ class DownloadQueue * * @param unknown_type $zip * @param unknown_type $folderId + * @param boolean $alerts * @return unknown */ - public function addFolder(&$zip, $folderId) + public function addFolder(&$zip, $folderId, $alerts = true) { $oFolder = Folder::get($folderId); @@ -782,7 +783,7 @@ class DownloadQueue } // fire subscription alerts for the downloaded document - if($this->bNotifications){ + if($this->bNotifications && $alerts) { $oSubscriptionEvent = new SubscriptionEvent(); $oSubscriptionEvent->DownloadDocument($oDocument, $oFolder); } diff --git a/plugins/ktstandard/KTBulkExportPlugin.php b/plugins/ktstandard/KTBulkExportPlugin.php index 7f78763..65c5aae 100644 --- a/plugins/ktstandard/KTBulkExportPlugin.php +++ b/plugins/ktstandard/KTBulkExportPlugin.php @@ -70,6 +70,16 @@ class KTBulkExportAction extends KTFolderAction { return _kt('Bulk Download'); } + /** + * Deal with bulk actions + */ + function do_notification($objects, $eventAction, $targetFolder) { + if ($targetFolder && count($objects) > 0 && $eventAction != '') { // Make sure there were documents/folders affected + $oSubscriptionEvent = new SubscriptionEvent(); + $oSubscriptionEvent->notifyBulkDocumentAction($objects, $eventAction, $targetFolder); + } + } + function do_main() { $config = KTConfig::getSingleton(); $useQueue = $config->get('export/useDownloadQueue', true); @@ -91,13 +101,22 @@ class KTBulkExportAction extends KTFolderAction { $folderurl = KTBrowseUtil::getUrlForFolder($this->oFolder); if($useQueue){ + $aDocList = array(); + $originalFolder =& Folder::get($sCurrentFolderId); + $docIds = $originalFolder->getDocumentIDs($sCurrentFolderId); + $docIds = split(",", $docIds); + foreach ($docIds as $dId) { + $aDocList[] = & Document::get($dId); + } + $this->do_notification($aDocList, "DownloadDocument", $originalFolder); // Send off notifications about bulk action + DownloadQueue::addItem($exportCode, $sCurrentFolderId, $sCurrentFolderId, 'folder'); $task_url = KTUtil::kt_url() . '/presentation/lookAndFeel/knowledgeTree/bulkdownload/downloadTask.php'; - $oTemplating =& KTTemplating::getSingleton(); $oTemplate = $oTemplating->loadTemplate('ktcore/action/bulk_download'); + $aParams = array( 'folder_url' => $folderurl, 'url' => $task_url, @@ -176,12 +195,6 @@ class KTBulkExportAction extends KTFolderAction { $oDocumentTransaction->create(); } - // fire subscription alerts for the downloaded document - if($bNotifications){ - //$oSubscriptionEvent = new SubscriptionEvent(); - //$oSubscriptionEvent->DownloadDocument($oDocument, $oFolder); - } - $this->oZip->addDocumentToZip($oDocument, $oFolder); } }