diff --git a/plugins/ktcore/KTCorePlugin.php b/plugins/ktcore/KTCorePlugin.php index 8c319af..52aeda3 100644 --- a/plugins/ktcore/KTCorePlugin.php +++ b/plugins/ktcore/KTCorePlugin.php @@ -6,31 +6,31 @@ * Document Management Made Simple * Copyright (C) 2008 KnowledgeTree Inc. * Portions copyright The Jam Warehouse Software (Pty) Limited - * + * * This program is free software; you can redistribute it and/or modify it under * the terms of the GNU General Public License version 3 as published by the * Free Software Foundation. - * + * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more * details. - * + * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * - * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco, + * + * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco, * California 94120-7775, or email info@knowledgetree.com. - * + * * The interactive user interfaces in modified source and object code versions * of this program must display Appropriate Legal Notices, as required under * Section 5 of the GNU General Public License version 3. - * + * * In accordance with Section 7(b) of the GNU General Public License version 3, * these Appropriate Legal Notices must retain the display of the "Powered by - * KnowledgeTree" logo and retain the original copyright notice. If the display of the + * KnowledgeTree" logo and retain the original copyright notice. If the display of the * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices - * must display the words "Powered by KnowledgeTree" and retain the original + * must display the words "Powered by KnowledgeTree" and retain the original * copyright notice. * Contributor( s): ______________________________________ * @@ -75,6 +75,7 @@ class KTCorePlugin extends KTPlugin { $this->registerAction('folderaction', 'KTFolderPermissionsAction', 'ktcore.actions.folder.permissions', 'folder/Permissions.php'); $this->registerAction('folderaction', 'KTBulkImportFolderAction', 'ktcore.actions.folder.bulkImport', 'folder/BulkImport.php'); $this->registerAction('folderaction', 'KTBulkUploadFolderAction', 'ktcore.actions.folder.bulkUpload', 'folder/BulkUpload.php'); + $this->registerAction('folderaction', 'FolderIndexAction', 'ktcore.search2.index.folder.action', KT_DIR . '/plugins/search2/FolderIndexAction.php'); $this->registerAction('folderinfo', 'KTFolderTransactionsAction', 'ktcore.actions.folder.transactions', 'folder/Transactions.php'); $this->registerAction('documentaction', 'KTDocumentAssistAction', 'ktcore.actions.document.assist', 'KTAssist.php'); @@ -238,7 +239,7 @@ class KTCorePlugin extends KTPlugin { $this->registerAdminCategory('search', _kt('Search and Indexing'), _kt('Search and Indexing Settings')); $this->registerAdminCategory('config', _kt('System Configuration'), - _kt('System Configuration Settings')); + _kt('System Configuration Settings')); $this->registerAdminCategory('misc', _kt('Miscellaneous'), _kt('Various settings which do not fit into the other categories, including managing help and saved searches.')); @@ -320,27 +321,27 @@ class KTCorePlugin extends KTPlugin { $this->registerAdminPage('emailconfigpage', 'EmailConfigPageDispatcher', 'config', _kt('Email Settings'), _kt('Manage Email Settings'), '/admin/configSettings.php', null); - + $this->registerAdminPage('uiconfigpage', 'UIConfigPageDispatcher', 'config', _kt('User Interface Settings'), _kt('Manage User Interface Settings'), '/admin/configSettings.php', null); - + $this->registerAdminPage('searchandindexingconfigpage', 'SearchAndIndexingConfigPageDispatcher', 'config', _kt('Search and Indexing Settings'), _kt('Manage Search and Indexing Settings'), '/admin/configSettings.php', null); - + $this->registerAdminPage('clientconfigpage', 'ClientSettingsConfigPageDispatcher', 'config', _kt('Client Tools Settings'), _kt('Manage Client Tools Settings'), '/admin/configSettings.php', null); - + $this->registerAdminPage('generalconfigpage', 'GeneralConfigPageDispatcher', 'config', _kt('General Settings'), _kt('Manage General Settings'), '/admin/configSettings.php', null); - + $this->registerAdminPage('i18nconfigpage', 'i18nConfigPageDispatcher', 'config', _kt('Internationalisation Settings'), _kt('Manage Internationalisation Settings'), '/admin/configSettings.php', null); - + // misc $this->registerAdminPage('helpmanagement', 'ManageHelpDispatcher', 'misc', _kt('Edit Help files'), _kt('Change the help files that are displayed to users.'), diff --git a/plugins/search2/DocumentIndexAction.php b/plugins/search2/DocumentIndexAction.php index d1ad7af..b4a349b 100755 --- a/plugins/search2/DocumentIndexAction.php +++ b/plugins/search2/DocumentIndexAction.php @@ -46,16 +46,20 @@ class DocumentIndexAction extends KTDocumentAction $docid=$doc->getId(); if (Permission::userIsSystemAdministrator()) { + $full_path = $doc->getFullPath(); if (Indexer::isDocumentScheduled($docid)) { Indexer::unqueueDocument($docid); + $this->addInfoMessage(sprintf(_kt("Document '%s' has been removed from the indexing queue."), $full_path)); } else { Indexer::index($doc, 'A'); + $this->addInfoMessage(sprintf(_kt("Document '%s' has been added from the indexing queue."), $full_path)); } } redirect("view.php?fDocumentId=$docid"); + exit; } } diff --git a/plugins/search2/FolderIndexAction.php b/plugins/search2/FolderIndexAction.php new file mode 100644 index 0000000..572a6bb --- /dev/null +++ b/plugins/search2/FolderIndexAction.php @@ -0,0 +1,59 @@ +sDisplayName=_kt('Schedule Indexing'); + } + + function getName() + { + return _kt('Document Indexer'); + } + + function getDisplayName() + { + if (Permission::userIsSystemAdministrator() && $_SESSION['adminmode']) + { + if(!is_object($this->oFolder)){ + return ''; + } + return _kt('Schedule Indexing'); + } + + return ''; + } + + function do_main() + { + $folder=$this->oFolder; + $folderid=$folder->getId(); + if (Permission::userIsSystemAdministrator()) + { + if ($folderid == 1) + { + Indexer::indexAll(); + } + else + { + Indexer::indexFolder($folder); + } + } + $full_path = $folder->getFullPath(); + $this->addInfoMessage(sprintf(_kt("All documents under the folder '%s' have been scheduled for indexing."), $full_path)); + + redirect("browse.php?fFolderId=$folderid"); + exit; + } +} + +?> \ No newline at end of file diff --git a/search2/indexing/indexerCore.inc.php b/search2/indexing/indexerCore.inc.php index b2ad8fa..c1583af 100755 --- a/search2/indexing/indexerCore.inc.php +++ b/search2/indexing/indexerCore.inc.php @@ -551,6 +551,22 @@ abstract class Indexer DBUtil::runQuery($sql); } + public static function indexFolder($folder) + { + $userid=$_SESSION['userID']; + if (empty($userid)) $userid=1; + + if (!$folder instanceof Folder && !$folder instanceof FolderProxy) + { + throw new Exception('Folder expected'); + } + + $full_path = $folder->getFullPath(); + + $sql = "INSERT INTO index_files(document_id, user_id, what) SELECT id, $userid, 'A' FROM documents WHERE full_path like '{$full_path}/%' AND status_id=1 and id not in (select document_id from index_files)"; + DBUtil::runQuery($sql); + } + /** * Clearout the scheduling of documents that no longer exist. * @@ -781,6 +797,8 @@ abstract class Indexer $default->log->info("checkForRegisteredTypes: disabled '$extractor'"); } + $this->loadExtractorStatus(); + if ($this->debug) $default->log->debug('checkForRegisteredTypes: done'); KTUtil::setSystemSetting('mimeTypesRegistered', true); }