Commit 52557df937d5c6204ab5fcd8a01f475dcd9731dd
Merge branch 'edge' of git@github.com:ktgit/knowledgetree into edge
Showing
7 changed files
with
45 additions
and
27 deletions
lib/foldermanagement/compressionArchiveUtil.inc.php
| @@ -602,11 +602,11 @@ class DownloadQueue | @@ -602,11 +602,11 @@ class DownloadQueue | ||
| 602 | foreach ($download as $item){ | 602 | foreach ($download as $item){ |
| 603 | if($item['object_type'] == 'document'){ | 603 | if($item['object_type'] == 'document'){ |
| 604 | $docId = $item['object_id']; | 604 | $docId = $item['object_id']; |
| 605 | - $this->addDocument($zip, $docId); | 605 | + $this->addDocument($zip, $docId, false); |
| 606 | } | 606 | } |
| 607 | if($item['object_type'] == 'folder'){ | 607 | if($item['object_type'] == 'folder'){ |
| 608 | $folderId = $item['object_id']; | 608 | $folderId = $item['object_id']; |
| 609 | - $this->addFolder($zip, $folderId); | 609 | + $this->addFolder($zip, $folderId, false); |
| 610 | } | 610 | } |
| 611 | } | 611 | } |
| 612 | 612 | ||
| @@ -668,9 +668,10 @@ class DownloadQueue | @@ -668,9 +668,10 @@ class DownloadQueue | ||
| 668 | * | 668 | * |
| 669 | * @param unknown_type $zip | 669 | * @param unknown_type $zip |
| 670 | * @param unknown_type $docId | 670 | * @param unknown_type $docId |
| 671 | + * @param boolean $alerts | ||
| 671 | * @return unknown | 672 | * @return unknown |
| 672 | */ | 673 | */ |
| 673 | - public function addDocument(&$zip, $docId) | 674 | + public function addDocument(&$zip, $docId, $alerts = true) |
| 674 | { | 675 | { |
| 675 | 676 | ||
| 676 | $oDocument = Document::get($docId); | 677 | $oDocument = Document::get($docId); |
| @@ -685,7 +686,7 @@ class DownloadQueue | @@ -685,7 +686,7 @@ class DownloadQueue | ||
| 685 | } | 686 | } |
| 686 | 687 | ||
| 687 | // fire subscription alerts for the downloaded document - if global config is set | 688 | // fire subscription alerts for the downloaded document - if global config is set |
| 688 | - if($this->bNotifications){ | 689 | + if($this->bNotifications && $alerts){ |
| 689 | $oSubscriptionEvent = new SubscriptionEvent(); | 690 | $oSubscriptionEvent = new SubscriptionEvent(); |
| 690 | $oFolder = Folder::get($oDocument->getFolderID()); | 691 | $oFolder = Folder::get($oDocument->getFolderID()); |
| 691 | $oSubscriptionEvent->DownloadDocument($oDocument, $oFolder); | 692 | $oSubscriptionEvent->DownloadDocument($oDocument, $oFolder); |
| @@ -699,9 +700,10 @@ class DownloadQueue | @@ -699,9 +700,10 @@ class DownloadQueue | ||
| 699 | * | 700 | * |
| 700 | * @param unknown_type $zip | 701 | * @param unknown_type $zip |
| 701 | * @param unknown_type $folderId | 702 | * @param unknown_type $folderId |
| 703 | + * @param boolean $alerts | ||
| 702 | * @return unknown | 704 | * @return unknown |
| 703 | */ | 705 | */ |
| 704 | - public function addFolder(&$zip, $folderId) | 706 | + public function addFolder(&$zip, $folderId, $alerts = true) |
| 705 | { | 707 | { |
| 706 | $oFolder = Folder::get($folderId); | 708 | $oFolder = Folder::get($folderId); |
| 707 | 709 | ||
| @@ -781,7 +783,7 @@ class DownloadQueue | @@ -781,7 +783,7 @@ class DownloadQueue | ||
| 781 | } | 783 | } |
| 782 | 784 | ||
| 783 | // fire subscription alerts for the downloaded document | 785 | // fire subscription alerts for the downloaded document |
| 784 | - if($this->bNotifications){ | 786 | + if($this->bNotifications && $alerts) { |
| 785 | $oSubscriptionEvent = new SubscriptionEvent(); | 787 | $oSubscriptionEvent = new SubscriptionEvent(); |
| 786 | $oSubscriptionEvent->DownloadDocument($oDocument, $oFolder); | 788 | $oSubscriptionEvent->DownloadDocument($oDocument, $oFolder); |
| 787 | } | 789 | } |
plugins/ktcore/KTBulkActions.php
| @@ -1194,7 +1194,6 @@ class KTBrowseBulkExportAction extends KTBulkAction { | @@ -1194,7 +1194,6 @@ class KTBrowseBulkExportAction extends KTBulkAction { | ||
| 1194 | * | 1194 | * |
| 1195 | */ | 1195 | */ |
| 1196 | function perform_action($oEntity) { | 1196 | function perform_action($oEntity) { |
| 1197 | - // TODO find a way to do bulk email | ||
| 1198 | $exportCode = $_SESSION['exportcode']; | 1197 | $exportCode = $_SESSION['exportcode']; |
| 1199 | $this->oZip = ZipFolder::get($exportCode); | 1198 | $this->oZip = ZipFolder::get($exportCode); |
| 1200 | 1199 | ||
| @@ -1213,7 +1212,7 @@ class KTBrowseBulkExportAction extends KTBulkAction { | @@ -1213,7 +1212,7 @@ class KTBrowseBulkExportAction extends KTBulkAction { | ||
| 1213 | if($useQueue){ | 1212 | if($useQueue){ |
| 1214 | DownloadQueue::addItem($this->sExportCode, $this->oFolder->getId(), $oDocument->iId, 'document'); | 1213 | DownloadQueue::addItem($this->sExportCode, $this->oFolder->getId(), $oDocument->iId, 'document'); |
| 1215 | }else{ | 1214 | }else{ |
| 1216 | - $oQueue->addDocument($this->oZip, $oDocument->iId); | 1215 | + $oQueue->addDocument($this->oZip, $oDocument->iId, false); |
| 1217 | } | 1216 | } |
| 1218 | 1217 | ||
| 1219 | 1218 |
plugins/ktcore/admin/manageBranding.php
| @@ -96,10 +96,11 @@ class ManageBrandDispatcher extends KTAdminDispatcher { | @@ -96,10 +96,11 @@ class ManageBrandDispatcher extends KTAdminDispatcher { | ||
| 96 | 'encoding' => 'multipart/form-data', | 96 | 'encoding' => 'multipart/form-data', |
| 97 | 'context' => &$this, | 97 | 'context' => &$this, |
| 98 | 'extraargs' => $this->meldPersistQuery("","",true), | 98 | 'extraargs' => $this->meldPersistQuery("","",true), |
| 99 | - 'description' => _kt('You can set the branding details.') | 99 | + 'description' => _kt('You can set the branding details.') |
| 100 | )); | 100 | )); |
| 101 | 101 | ||
| 102 | $oWF =& KTWidgetFactory::getSingleton(); | 102 | $oWF =& KTWidgetFactory::getSingleton(); |
| 103 | + $oVF =& KTValidatorFactory::getSingleton(); | ||
| 103 | 104 | ||
| 104 | $widgets = array(); | 105 | $widgets = array(); |
| 105 | $validators = array(); | 106 | $validators = array(); |
| @@ -126,6 +127,13 @@ class ManageBrandDispatcher extends KTAdminDispatcher { | @@ -126,6 +127,13 @@ class ManageBrandDispatcher extends KTAdminDispatcher { | ||
| 126 | 'value' => $logoUrl, | 127 | 'value' => $logoUrl, |
| 127 | 'description' => _kt("This is the website address you will be redirected to after clicking the logo. The url should include the protocol e.g. http://www.knowledgetree.com . If no protocol is given the url is treated as a relative link."), | 128 | 'description' => _kt("This is the website address you will be redirected to after clicking the logo. The url should include the protocol e.g. http://www.knowledgetree.com . If no protocol is given the url is treated as a relative link."), |
| 128 | )); | 129 | )); |
| 130 | + | ||
| 131 | + | ||
| 132 | + // Adding the url widget | ||
| 133 | + $validators[] = $oVF->get('ktcore.widgets.string', array( | ||
| 134 | + 'test' => 'logo_url', | ||
| 135 | + 'output' => 'logo_url', | ||
| 136 | + )); | ||
| 129 | 137 | ||
| 130 | $oForm->setWidgets($widgets); | 138 | $oForm->setWidgets($widgets); |
| 131 | $oForm->setValidators($validators); | 139 | $oForm->setValidators($validators); |
| @@ -428,9 +436,6 @@ class ManageBrandDispatcher extends KTAdminDispatcher { | @@ -428,9 +436,6 @@ class ManageBrandDispatcher extends KTAdminDispatcher { | ||
| 428 | 436 | ||
| 429 | return $oForm; | 437 | return $oForm; |
| 430 | } | 438 | } |
| 431 | - | ||
| 432 | - | ||
| 433 | - | ||
| 434 | 439 | ||
| 435 | /* | 440 | /* |
| 436 | * Action responsible for setting the logo details | 441 | * Action responsible for setting the logo details |
| @@ -443,12 +448,12 @@ class ManageBrandDispatcher extends KTAdminDispatcher { | @@ -443,12 +448,12 @@ class ManageBrandDispatcher extends KTAdminDispatcher { | ||
| 443 | $config =& KTConfig::getSingleton(); | 448 | $config =& KTConfig::getSingleton(); |
| 444 | $logoUrl = $_REQUEST['data']['logo_url']; | 449 | $logoUrl = $_REQUEST['data']['logo_url']; |
| 445 | $logoTitle = $_REQUEST['data']['logo_title']; | 450 | $logoTitle = $_REQUEST['data']['logo_title']; |
| 451 | + | ||
| 452 | + $aOptions = array('redirect_to' => 'main'); | ||
| 446 | 453 | ||
| 447 | - if(!preg_match('/([a-z])|([A-Z])|([0-9])/', $logoTitle)){ | ||
| 448 | - $this->errorRedirectTo('main', _kt("You have entered an invalid character in the logo title. You may use only letters and numbers.")); | 454 | + if ($logoTitle != '') { |
| 455 | + $this->oValidator->validateIllegalCharacters($logoTitle, $aOptions); | ||
| 449 | } | 456 | } |
| 450 | - | ||
| 451 | - $logoTitle = addslashes(htmlentities($logoTitle)); | ||
| 452 | 457 | ||
| 453 | if ($config->set('ui/companyLogoUrl', $logoUrl) && $config->set('ui/companyLogoTitle', $logoTitle)) { | 458 | if ($config->set('ui/companyLogoUrl', $logoUrl) && $config->set('ui/companyLogoTitle', $logoTitle)) { |
| 454 | $this->successRedirectTo('main', _kt('Logo fields have been successfully updated.')); | 459 | $this->successRedirectTo('main', _kt('Logo fields have been successfully updated.')); |
| @@ -458,8 +463,6 @@ class ManageBrandDispatcher extends KTAdminDispatcher { | @@ -458,8 +463,6 @@ class ManageBrandDispatcher extends KTAdminDispatcher { | ||
| 458 | 463 | ||
| 459 | } | 464 | } |
| 460 | 465 | ||
| 461 | - | ||
| 462 | - | ||
| 463 | /* | 466 | /* |
| 464 | * Action responsible for uploading the logo | 467 | * Action responsible for uploading the logo |
| 465 | * | 468 | * |
plugins/ktstandard/KTBulkExportPlugin.php
| @@ -70,6 +70,16 @@ class KTBulkExportAction extends KTFolderAction { | @@ -70,6 +70,16 @@ class KTBulkExportAction extends KTFolderAction { | ||
| 70 | return _kt('Bulk Download'); | 70 | return _kt('Bulk Download'); |
| 71 | } | 71 | } |
| 72 | 72 | ||
| 73 | + /** | ||
| 74 | + * Deal with bulk actions | ||
| 75 | + */ | ||
| 76 | + function do_notification($objects, $eventAction, $targetFolder) { | ||
| 77 | + if ($targetFolder && count($objects) > 0 && $eventAction != '') { // Make sure there were documents/folders affected | ||
| 78 | + $oSubscriptionEvent = new SubscriptionEvent(); | ||
| 79 | + $oSubscriptionEvent->notifyBulkDocumentAction($objects, $eventAction, $targetFolder); | ||
| 80 | + } | ||
| 81 | + } | ||
| 82 | + | ||
| 73 | function do_main() { | 83 | function do_main() { |
| 74 | $config = KTConfig::getSingleton(); | 84 | $config = KTConfig::getSingleton(); |
| 75 | $useQueue = $config->get('export/useDownloadQueue', true); | 85 | $useQueue = $config->get('export/useDownloadQueue', true); |
| @@ -91,13 +101,22 @@ class KTBulkExportAction extends KTFolderAction { | @@ -91,13 +101,22 @@ class KTBulkExportAction extends KTFolderAction { | ||
| 91 | $folderurl = KTBrowseUtil::getUrlForFolder($this->oFolder); | 101 | $folderurl = KTBrowseUtil::getUrlForFolder($this->oFolder); |
| 92 | 102 | ||
| 93 | if($useQueue){ | 103 | if($useQueue){ |
| 104 | + $aDocList = array(); | ||
| 105 | + $originalFolder =& Folder::get($sCurrentFolderId); | ||
| 106 | + $docIds = $originalFolder->getDocumentIDs($sCurrentFolderId); | ||
| 107 | + $docIds = split(",", $docIds); | ||
| 108 | + foreach ($docIds as $dId) { | ||
| 109 | + $aDocList[] = & Document::get($dId); | ||
| 110 | + } | ||
| 111 | + $this->do_notification($aDocList, "DownloadDocument", $originalFolder); // Send off notifications about bulk action | ||
| 112 | + | ||
| 94 | DownloadQueue::addItem($exportCode, $sCurrentFolderId, $sCurrentFolderId, 'folder'); | 113 | DownloadQueue::addItem($exportCode, $sCurrentFolderId, $sCurrentFolderId, 'folder'); |
| 95 | 114 | ||
| 96 | $task_url = KTUtil::kt_url() . '/presentation/lookAndFeel/knowledgeTree/bulkdownload/downloadTask.php'; | 115 | $task_url = KTUtil::kt_url() . '/presentation/lookAndFeel/knowledgeTree/bulkdownload/downloadTask.php'; |
| 97 | - | ||
| 98 | $oTemplating =& KTTemplating::getSingleton(); | 116 | $oTemplating =& KTTemplating::getSingleton(); |
| 99 | $oTemplate = $oTemplating->loadTemplate('ktcore/action/bulk_download'); | 117 | $oTemplate = $oTemplating->loadTemplate('ktcore/action/bulk_download'); |
| 100 | 118 | ||
| 119 | + | ||
| 101 | $aParams = array( | 120 | $aParams = array( |
| 102 | 'folder_url' => $folderurl, | 121 | 'folder_url' => $folderurl, |
| 103 | 'url' => $task_url, | 122 | 'url' => $task_url, |
| @@ -176,12 +195,6 @@ class KTBulkExportAction extends KTFolderAction { | @@ -176,12 +195,6 @@ class KTBulkExportAction extends KTFolderAction { | ||
| 176 | $oDocumentTransaction->create(); | 195 | $oDocumentTransaction->create(); |
| 177 | } | 196 | } |
| 178 | 197 | ||
| 179 | - // fire subscription alerts for the downloaded document | ||
| 180 | - if($bNotifications){ | ||
| 181 | - //$oSubscriptionEvent = new SubscriptionEvent(); | ||
| 182 | - //$oSubscriptionEvent->DownloadDocument($oDocument, $oFolder); | ||
| 183 | - } | ||
| 184 | - | ||
| 185 | $this->oZip->addDocumentToZip($oDocument, $oFolder); | 198 | $this->oZip->addDocumentToZip($oDocument, $oFolder); |
| 186 | } | 199 | } |
| 187 | } | 200 | } |
plugins/multiselect/BulkImport.php
| @@ -71,7 +71,7 @@ class InetBulkImportFolderMultiSelectAction extends KTFolderAction { | @@ -71,7 +71,7 @@ class InetBulkImportFolderMultiSelectAction extends KTFolderAction { | ||
| 71 | if (method_exists($oPage, 'requireJSResources')) { | 71 | if (method_exists($oPage, 'requireJSResources')) { |
| 72 | $oPage->requireJSResources($aJavascript); | 72 | $oPage->requireJSResources($aJavascript); |
| 73 | } | 73 | } |
| 74 | - return $js._kt('Import from Server Location'); | 74 | + return _kt('Import from Server Location') . $js; |
| 75 | } | 75 | } |
| 76 | else | 76 | else |
| 77 | { | 77 | { |
plugins/multiselect/BulkUpload.php
| @@ -75,7 +75,7 @@ class InetBulkUploadFolderAction extends KTFolderAction { | @@ -75,7 +75,7 @@ class InetBulkUploadFolderAction extends KTFolderAction { | ||
| 75 | } | 75 | } |
| 76 | 76 | ||
| 77 | $js = "<script src='resources/js/kt_hidelink.js' type='text/javascript'></script>"; | 77 | $js = "<script src='resources/js/kt_hidelink.js' type='text/javascript'></script>"; |
| 78 | - return $js._kt('Bulk Upload'); | 78 | + return _kt('Bulk Upload') .$js; |
| 79 | } | 79 | } |
| 80 | else | 80 | else |
| 81 | { | 81 | { |
plugins/multiselect/MultiSelectPlugin.php
| @@ -126,6 +126,7 @@ class MultiSelectPlugin extends KTPlugin { | @@ -126,6 +126,7 @@ class MultiSelectPlugin extends KTPlugin { | ||
| 126 | 'InetdocumentFieldsv2.php', null); | 126 | 'InetdocumentFieldsv2.php', null); |
| 127 | } | 127 | } |
| 128 | } | 128 | } |
| 129 | + | ||
| 129 | $oPluginRegistry =& KTPluginRegistry::getSingleton(); | 130 | $oPluginRegistry =& KTPluginRegistry::getSingleton(); |
| 130 | $oPluginRegistry->registerPlugin('MultiSelectPlugin', 'inet.multiselect.lookupvalue.plugin', __FILE__); | 131 | $oPluginRegistry->registerPlugin('MultiSelectPlugin', 'inet.multiselect.lookupvalue.plugin', __FILE__); |
| 131 | ?> | 132 | ?> |
| 132 | \ No newline at end of file | 133 | \ No newline at end of file |