Commit 52557df937d5c6204ab5fcd8a01f475dcd9731dd

Authored by Megan Watson
2 parents bb343012 83c73f0c

Merge branch 'edge' of git@github.com:ktgit/knowledgetree into edge

lib/foldermanagement/compressionArchiveUtil.inc.php
... ... @@ -602,11 +602,11 @@ class DownloadQueue
602 602 foreach ($download as $item){
603 603 if($item['object_type'] == 'document'){
604 604 $docId = $item['object_id'];
605   - $this->addDocument($zip, $docId);
  605 + $this->addDocument($zip, $docId, false);
606 606 }
607 607 if($item['object_type'] == 'folder'){
608 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 668 *
669 669 * @param unknown_type $zip
670 670 * @param unknown_type $docId
  671 + * @param boolean $alerts
671 672 * @return unknown
672 673 */
673   - public function addDocument(&$zip, $docId)
  674 + public function addDocument(&$zip, $docId, $alerts = true)
674 675 {
675 676  
676 677 $oDocument = Document::get($docId);
... ... @@ -685,7 +686,7 @@ class DownloadQueue
685 686 }
686 687  
687 688 // fire subscription alerts for the downloaded document - if global config is set
688   - if($this->bNotifications){
  689 + if($this->bNotifications && $alerts){
689 690 $oSubscriptionEvent = new SubscriptionEvent();
690 691 $oFolder = Folder::get($oDocument->getFolderID());
691 692 $oSubscriptionEvent->DownloadDocument($oDocument, $oFolder);
... ... @@ -699,9 +700,10 @@ class DownloadQueue
699 700 *
700 701 * @param unknown_type $zip
701 702 * @param unknown_type $folderId
  703 + * @param boolean $alerts
702 704 * @return unknown
703 705 */
704   - public function addFolder(&$zip, $folderId)
  706 + public function addFolder(&$zip, $folderId, $alerts = true)
705 707 {
706 708 $oFolder = Folder::get($folderId);
707 709  
... ... @@ -781,7 +783,7 @@ class DownloadQueue
781 783 }
782 784  
783 785 // fire subscription alerts for the downloaded document
784   - if($this->bNotifications){
  786 + if($this->bNotifications && $alerts) {
785 787 $oSubscriptionEvent = new SubscriptionEvent();
786 788 $oSubscriptionEvent->DownloadDocument($oDocument, $oFolder);
787 789 }
... ...
plugins/ktcore/KTBulkActions.php
... ... @@ -1194,7 +1194,6 @@ class KTBrowseBulkExportAction extends KTBulkAction {
1194 1194 *
1195 1195 */
1196 1196 function perform_action($oEntity) {
1197   - // TODO find a way to do bulk email
1198 1197 $exportCode = $_SESSION['exportcode'];
1199 1198 $this->oZip = ZipFolder::get($exportCode);
1200 1199  
... ... @@ -1213,7 +1212,7 @@ class KTBrowseBulkExportAction extends KTBulkAction {
1213 1212 if($useQueue){
1214 1213 DownloadQueue::addItem($this->sExportCode, $this->oFolder->getId(), $oDocument->iId, 'document');
1215 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 96 'encoding' => 'multipart/form-data',
97 97 'context' => &$this,
98 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 102 $oWF =& KTWidgetFactory::getSingleton();
  103 + $oVF =& KTValidatorFactory::getSingleton();
103 104  
104 105 $widgets = array();
105 106 $validators = array();
... ... @@ -126,6 +127,13 @@ class ManageBrandDispatcher extends KTAdminDispatcher {
126 127 'value' => $logoUrl,
127 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 138 $oForm->setWidgets($widgets);
131 139 $oForm->setValidators($validators);
... ... @@ -428,9 +436,6 @@ class ManageBrandDispatcher extends KTAdminDispatcher {
428 436  
429 437 return $oForm;
430 438 }
431   -
432   -
433   -
434 439  
435 440 /*
436 441 * Action responsible for setting the logo details
... ... @@ -443,12 +448,12 @@ class ManageBrandDispatcher extends KTAdminDispatcher {
443 448 $config =& KTConfig::getSingleton();
444 449 $logoUrl = $_REQUEST['data']['logo_url'];
445 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 458 if ($config->set('ui/companyLogoUrl', $logoUrl) && $config->set('ui/companyLogoTitle', $logoTitle)) {
454 459 $this->successRedirectTo('main', _kt('Logo fields have been successfully updated.'));
... ... @@ -458,8 +463,6 @@ class ManageBrandDispatcher extends KTAdminDispatcher {
458 463  
459 464 }
460 465  
461   -
462   -
463 466 /*
464 467 * Action responsible for uploading the logo
465 468 *
... ...
plugins/ktstandard/KTBulkExportPlugin.php
... ... @@ -70,6 +70,16 @@ class KTBulkExportAction extends KTFolderAction {
70 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 83 function do_main() {
74 84 $config = KTConfig::getSingleton();
75 85 $useQueue = $config->get('export/useDownloadQueue', true);
... ... @@ -91,13 +101,22 @@ class KTBulkExportAction extends KTFolderAction {
91 101 $folderurl = KTBrowseUtil::getUrlForFolder($this->oFolder);
92 102  
93 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 113 DownloadQueue::addItem($exportCode, $sCurrentFolderId, $sCurrentFolderId, 'folder');
95 114  
96 115 $task_url = KTUtil::kt_url() . '/presentation/lookAndFeel/knowledgeTree/bulkdownload/downloadTask.php';
97   -
98 116 $oTemplating =& KTTemplating::getSingleton();
99 117 $oTemplate = $oTemplating->loadTemplate('ktcore/action/bulk_download');
100 118  
  119 +
101 120 $aParams = array(
102 121 'folder_url' => $folderurl,
103 122 'url' => $task_url,
... ... @@ -176,12 +195,6 @@ class KTBulkExportAction extends KTFolderAction {
176 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 198 $this->oZip->addDocumentToZip($oDocument, $oFolder);
186 199 }
187 200 }
... ...
plugins/multiselect/BulkImport.php
... ... @@ -71,7 +71,7 @@ class InetBulkImportFolderMultiSelectAction extends KTFolderAction {
71 71 if (method_exists($oPage, 'requireJSResources')) {
72 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 76 else
77 77 {
... ...
plugins/multiselect/BulkUpload.php
... ... @@ -75,7 +75,7 @@ class InetBulkUploadFolderAction extends KTFolderAction {
75 75 }
76 76  
77 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 80 else
81 81 {
... ...
plugins/multiselect/MultiSelectPlugin.php
... ... @@ -126,6 +126,7 @@ class MultiSelectPlugin extends KTPlugin {
126 126 'InetdocumentFieldsv2.php', null);
127 127 }
128 128 }
  129 +
129 130 $oPluginRegistry =& KTPluginRegistry::getSingleton();
130 131 $oPluginRegistry->registerPlugin('MultiSelectPlugin', 'inet.multiselect.lookupvalue.plugin', __FILE__);
131 132 ?>
132 133 \ No newline at end of file
... ...