Commit 371481e861db9ecf0f0eff13f37559f1f9da4e77
1 parent
d7a4690e
Merged in from DEV trunk...
KTS-2391 "When changing doc type the old associated fieldsets should be removed" Fixed. Incremented the metadata version and copied the metadata for the fieldsets that remain with the new doc type. Committed by: Megan Watson Reviewed by: Conrad Vermeulen KTS-3031 "Breadcrumb function in Document links displays incorrectly" Fixed. Added the root folder at the start of the breadcrumb trail. Refactored the function into ktutil. Committed by: Megan Watson Reviewed by: Conrad Vermeulen KTS-1489 "Unarchival action not recorded within document transaction history" Fixed. Added a transaction in. KTS-3029 "On restoring archived documents, all documents in the list are selected" Fixed. Removed the collection widget which only works properly for single selections. KTS-2891 "Search widget is too big as it is invisible when the screen resolution is low" Fixed. Committed By: Conrad Vermeulen Reviewed By: Megan Watson KTS-3024 "Search2: Searching using a quick search gives a warning" Updated. Changed the content of the message. Committed By: Conrad Vermeulen Reviewed By: Xolo Mashinini git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/STABLE/trunk@8052 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
9 changed files
with
221 additions
and
169 deletions
config/config.ini
| @@ -206,13 +206,31 @@ uiUrl = ${rootUrl}/presentation/lookAndFeel/knowledgeTree | @@ -206,13 +206,31 @@ uiUrl = ${rootUrl}/presentation/lookAndFeel/knowledgeTree | ||
| 206 | stopwordsFile = ${fileSystemRoot}/config/stopwords.txt | 206 | stopwordsFile = ${fileSystemRoot}/config/stopwords.txt |
| 207 | 207 | ||
| 208 | [webservice] | 208 | [webservice] |
| 209 | +; Directory to which all uploads via webservices are persisted before moving into the repository | ||
| 209 | uploadDirectory = ${varDirectory}/uploads | 210 | uploadDirectory = ${varDirectory}/uploads |
| 211 | + | ||
| 212 | +; Url which is sent to clients via web service calls so they can then download file via HTTP GET | ||
| 210 | downloadUrl = ${rootUrl}/ktwebservice/download.php | 213 | downloadUrl = ${rootUrl}/ktwebservice/download.php |
| 214 | + | ||
| 215 | +; Period indicating how long a file should be retained in the uploads directory. | ||
| 211 | uploadExpiry = 30 | 216 | uploadExpiry = 30 |
| 217 | + | ||
| 218 | +; Period indicating how long a download link will be available | ||
| 212 | downloadExpiry = 30 | 219 | downloadExpiry = 30 |
| 220 | + | ||
| 221 | +; Random text used to construct a hash. This can be customised on installations so there is less chance of overlap between installations. | ||
| 213 | randomKeyText = bkdfjhg23yskjdhf2iu | 222 | randomKeyText = bkdfjhg23yskjdhf2iu |
| 223 | + | ||
| 224 | +; Validating session counts can interfere with access. It is best to leave this disabled, unless very strict access is required. | ||
| 214 | validateSessionCount = false | 225 | validateSessionCount = false |
| 215 | 226 | ||
| 227 | +; If the document type is invalid when adding a document, we can be tollerant and just default to the Default document type. | ||
| 228 | +useDefaultDocumentTypeIfInvalid = true | ||
| 229 | + | ||
| 230 | +; The web service debugging if the logLevel is set to DEBUG. We can set the value to 4 or 5 to get more verbose web service logging. | ||
| 231 | +; Level 4 logs the name of functions being accessed. Level 5 logs the SOAP XML requests and responses. | ||
| 232 | +debug = false | ||
| 233 | + | ||
| 216 | [session] | 234 | [session] |
| 217 | ; session timeout (in seconds) | 235 | ; session timeout (in seconds) |
| 218 | sessionTimeout = 1200 | 236 | sessionTimeout = 1200 |
lib/util/ktutil.inc
| @@ -748,6 +748,7 @@ class KTUtil { | @@ -748,6 +748,7 @@ class KTUtil { | ||
| 748 | 748 | ||
| 749 | // {{{ isAbsolutePath | 749 | // {{{ isAbsolutePath |
| 750 | static function isAbsolutePath($sPath) { | 750 | static function isAbsolutePath($sPath) { |
| 751 | + | ||
| 751 | if (substr($sPath, 0, 1) == '/') { | 752 | if (substr($sPath, 0, 1) == '/') { |
| 752 | return true; | 753 | return true; |
| 753 | } | 754 | } |
| @@ -949,6 +950,79 @@ class KTUtil { | @@ -949,6 +950,79 @@ class KTUtil { | ||
| 949 | return $aRet; | 950 | return $aRet; |
| 950 | } | 951 | } |
| 951 | 952 | ||
| 953 | + | ||
| 954 | + /** | ||
| 955 | + * Generates breadcrumbs for a browsable collection | ||
| 956 | + * | ||
| 957 | + * @param object $oFolder The folder being browsed to | ||
| 958 | + * @param integer $iFolderId The id of the folder | ||
| 959 | + * @param array $aURLParams The url parameters for each folder/breadcrumb link | ||
| 960 | + * @return unknown | ||
| 961 | + */ | ||
| 962 | + function generate_breadcrumbs($oFolder, $iFolderId, $aURLParams) { | ||
| 963 | + static $aFolders = array(); | ||
| 964 | + static $aBreadcrumbs = array(); | ||
| 965 | + | ||
| 966 | + // Check if selected folder is a parent of the current folder | ||
| 967 | + if(in_array($iFolderId, $aFolders)){ | ||
| 968 | + $temp = array_flip($aFolders); | ||
| 969 | + $key = $temp[$iFolderId]; | ||
| 970 | + array_splice($aFolders, $key); | ||
| 971 | + array_splice($aBreadcrumbs, $key); | ||
| 972 | + return $aBreadcrumbs; | ||
| 973 | + } | ||
| 974 | + | ||
| 975 | + // Check for the parent of the selected folder unless its the root folder | ||
| 976 | + $iParentId = $oFolder->getParentID(); | ||
| 977 | + | ||
| 978 | + if(is_null($iParentId)){ | ||
| 979 | + // folder is root | ||
| 980 | + return ''; | ||
| 981 | + } | ||
| 982 | + | ||
| 983 | + if($iFolderId != 1 && in_array($iParentId, $aFolders)){ | ||
| 984 | + $temp = array_flip($aFolders); | ||
| 985 | + $key = $temp[$iParentId]; | ||
| 986 | + array_splice($aFolders, $key); | ||
| 987 | + array_splice($aBreadcrumbs, $key); | ||
| 988 | + array_push($aFolders, $iFolderId); | ||
| 989 | + | ||
| 990 | + $aParams = $aURLParams; | ||
| 991 | + $aParams['fFolderId'] = $iFolderId; | ||
| 992 | + $url = KTUtil::addQueryString($_SERVER['PHP_SELF'], $aParams); | ||
| 993 | + $aBreadcrumbs[] = array('url' => $url, 'name' => $oFolder->getName()); | ||
| 994 | + return $aBreadcrumbs; | ||
| 995 | + } | ||
| 996 | + | ||
| 997 | + // Get the root folder name | ||
| 998 | + $oRootFolder = Folder::get(1); | ||
| 999 | + $sRootFolder =$oRootFolder->getName(); | ||
| 1000 | + | ||
| 1001 | + // Create the breadcrumbs | ||
| 1002 | + $folder_path_names = $oFolder->getPathArray(); | ||
| 1003 | + array_unshift($folder_path_names, $sRootFolder); | ||
| 1004 | + $folder_path_ids = explode(',', $oFolder->getParentFolderIds()); | ||
| 1005 | + $folder_path_ids[] = $oFolder->getId(); | ||
| 1006 | + if ($folder_path_ids[0] == 0) { | ||
| 1007 | + array_shift($folder_path_ids); | ||
| 1008 | + array_shift($folder_path_names); | ||
| 1009 | + } | ||
| 1010 | + | ||
| 1011 | + $iCount = count($folder_path_ids); | ||
| 1012 | + $range = range(0, $iCount - 1); | ||
| 1013 | + foreach ($range as $index) { | ||
| 1014 | + $id = $folder_path_ids[$index]; | ||
| 1015 | + $name = $folder_path_names[$index]; | ||
| 1016 | + | ||
| 1017 | + $aParams = $aURLParams; | ||
| 1018 | + $aParams['fFolderId'] = $id; | ||
| 1019 | + $url = KTUtil::addQueryString($_SERVER['PHP_SELF'], $aParams); | ||
| 1020 | + $aBreadcrumbs[] = array('url' => $url, 'name' => $name); | ||
| 1021 | + } | ||
| 1022 | + $aFolders = $folder_path_ids; | ||
| 1023 | + return $aBreadcrumbs; | ||
| 1024 | + } | ||
| 1025 | + | ||
| 952 | } | 1026 | } |
| 953 | 1027 | ||
| 954 | /** | 1028 | /** |
plugins/ktcore/admin/archivedDocuments.php
| @@ -5,32 +5,32 @@ | @@ -5,32 +5,32 @@ | ||
| 5 | * KnowledgeTree Open Source Edition | 5 | * KnowledgeTree Open Source Edition |
| 6 | * Document Management Made Simple | 6 | * Document Management Made Simple |
| 7 | * Copyright (C) 2004 - 2008 The Jam Warehouse Software (Pty) Limited | 7 | * Copyright (C) 2004 - 2008 The Jam Warehouse Software (Pty) Limited |
| 8 | - * | 8 | + * |
| 9 | * This program is free software; you can redistribute it and/or modify it under | 9 | * This program is free software; you can redistribute it and/or modify it under |
| 10 | * the terms of the GNU General Public License version 3 as published by the | 10 | * the terms of the GNU General Public License version 3 as published by the |
| 11 | * Free Software Foundation. | 11 | * Free Software Foundation. |
| 12 | - * | 12 | + * |
| 13 | * This program is distributed in the hope that it will be useful, but WITHOUT | 13 | * This program is distributed in the hope that it will be useful, but WITHOUT |
| 14 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | 14 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
| 15 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | 15 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
| 16 | * details. | 16 | * details. |
| 17 | - * | 17 | + * |
| 18 | * You should have received a copy of the GNU General Public License | 18 | * You should have received a copy of the GNU General Public License |
| 19 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | 19 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 20 | - * | 20 | + * |
| 21 | * You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place, | 21 | * You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place, |
| 22 | * Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com. | 22 | * Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com. |
| 23 | - * | 23 | + * |
| 24 | * The interactive user interfaces in modified source and object code versions | 24 | * The interactive user interfaces in modified source and object code versions |
| 25 | * of this program must display Appropriate Legal Notices, as required under | 25 | * of this program must display Appropriate Legal Notices, as required under |
| 26 | * Section 5 of the GNU General Public License version 3. | 26 | * Section 5 of the GNU General Public License version 3. |
| 27 | - * | 27 | + * |
| 28 | * In accordance with Section 7(b) of the GNU General Public License version 3, | 28 | * In accordance with Section 7(b) of the GNU General Public License version 3, |
| 29 | * these Appropriate Legal Notices must retain the display of the "Powered by | 29 | * these Appropriate Legal Notices must retain the display of the "Powered by |
| 30 | - * KnowledgeTree" logo and retain the original copyright notice. If the display of the | 30 | + * KnowledgeTree" logo and retain the original copyright notice. If the display of the |
| 31 | * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices | 31 | * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices |
| 32 | - * must display the words "Powered by KnowledgeTree" and retain the original | ||
| 33 | - * copyright notice. | 32 | + * must display the words "Powered by KnowledgeTree" and retain the original |
| 33 | + * copyright notice. | ||
| 34 | * Contributor( s): ______________________________________ | 34 | * Contributor( s): ______________________________________ |
| 35 | * | 35 | * |
| 36 | */ | 36 | */ |
| @@ -53,12 +53,12 @@ require_once(KT_LIB_DIR . "/documentmanagement/PhysicalDocumentManager.inc"); | @@ -53,12 +53,12 @@ require_once(KT_LIB_DIR . "/documentmanagement/PhysicalDocumentManager.inc"); | ||
| 53 | 53 | ||
| 54 | // FIXME chain in a notification alert for un-archival requests. | 54 | // FIXME chain in a notification alert for un-archival requests. |
| 55 | class KTArchiveTitle extends TitleColumn { | 55 | class KTArchiveTitle extends TitleColumn { |
| 56 | - | 56 | + |
| 57 | function renderDocumentLink($aDataRow) { | 57 | function renderDocumentLink($aDataRow) { |
| 58 | $outStr .= $aDataRow["document"]->getName(); | 58 | $outStr .= $aDataRow["document"]->getName(); |
| 59 | return $outStr; | 59 | return $outStr; |
| 60 | - } | ||
| 61 | - | 60 | + } |
| 61 | + | ||
| 62 | function buildFolderLink($aDataRow) { | 62 | function buildFolderLink($aDataRow) { |
| 63 | return KTUtil::addQueryString($_SERVER['PHP_SELF'], sprintf('fFolderId=%d', $aDataRow["folder"]->getId())); | 63 | return KTUtil::addQueryString($_SERVER['PHP_SELF'], sprintf('fFolderId=%d', $aDataRow["folder"]->getId())); |
| 64 | } | 64 | } |
| @@ -68,94 +68,88 @@ class ArchivedDocumentsDispatcher extends KTAdminDispatcher { | @@ -68,94 +68,88 @@ class ArchivedDocumentsDispatcher extends KTAdminDispatcher { | ||
| 68 | var $sHelpPage = 'ktcore/admin/archived documents.html'; | 68 | var $sHelpPage = 'ktcore/admin/archived documents.html'; |
| 69 | function do_main () { | 69 | function do_main () { |
| 70 | $this->aBreadcrumbs[] = array('url' => $_SERVER['PHP_SELF'], 'name' => _kt('Archived Documents')); | 70 | $this->aBreadcrumbs[] = array('url' => $_SERVER['PHP_SELF'], 'name' => _kt('Archived Documents')); |
| 71 | - | 71 | + |
| 72 | $this->oPage->setBreadcrumbDetails(_kt('browse')); | 72 | $this->oPage->setBreadcrumbDetails(_kt('browse')); |
| 73 | - | 73 | + |
| 74 | $oFolder = Folder::get(KTUtil::arrayGet($_REQUEST, 'fFolderId', 1)); | 74 | $oFolder = Folder::get(KTUtil::arrayGet($_REQUEST, 'fFolderId', 1)); |
| 75 | - if (PEAR::isError($oFolder)) { | 75 | + if (PEAR::isError($oFolder)) { |
| 76 | $this->errorRedirectToMain(_kt('Invalid folder selected.')); | 76 | $this->errorRedirectToMain(_kt('Invalid folder selected.')); |
| 77 | exit(0); | 77 | exit(0); |
| 78 | } | 78 | } |
| 79 | - | ||
| 80 | - // Setup the collection for move display. | ||
| 81 | - | 79 | + |
| 80 | + // Setup the collection for restore display. | ||
| 82 | $aBaseParams = array(); | 81 | $aBaseParams = array(); |
| 83 | 82 | ||
| 84 | $collection = new AdvancedCollection(); | 83 | $collection = new AdvancedCollection(); |
| 85 | 84 | ||
| 86 | $oCR =& KTColumnRegistry::getSingleton(); | 85 | $oCR =& KTColumnRegistry::getSingleton(); |
| 87 | - | ||
| 88 | - // selection col | ||
| 89 | $col = $oCR->getColumn('ktcore.columns.selection'); | 86 | $col = $oCR->getColumn('ktcore.columns.selection'); |
| 90 | - $col->setOptions(array('show_folders' => false, 'rangename' => '_d[]')); | 87 | + $aColOptions = array(); |
| 88 | + //$aColOptions['qs_params'] = kt_array_merge($aBaseParams, array('fFolderId'=>$oFolder->getId())); | ||
| 89 | + $aColOptions['show_folders'] = false; | ||
| 90 | + $aColOptions['show_documents'] = true; | ||
| 91 | + $aColOptions['rangename'] = '_d[]'; | ||
| 92 | + $col->setOptions($aColOptions); | ||
| 91 | $collection->addColumn($col); | 93 | $collection->addColumn($col); |
| 92 | - | ||
| 93 | - // title col | 94 | + |
| 94 | $col = $oCR->getColumn('ktcore.columns.title'); | 95 | $col = $oCR->getColumn('ktcore.columns.title'); |
| 96 | + //$col->setOptions(array('qs_params'=>kt_array_merge($aBaseParams, array('action' => 'new', 'fFolderId'=>$oFolder->getId())))); | ||
| 95 | $col->setOptions(array('link_documents' => false)); | 97 | $col->setOptions(array('link_documents' => false)); |
| 96 | - | ||
| 97 | $collection->addColumn($col); | 98 | $collection->addColumn($col); |
| 98 | 99 | ||
| 100 | + //$qObj = new BrowseQuery($iFolderId); | ||
| 99 | $qObj = new ArchivedBrowseQuery($oFolder->getId()); | 101 | $qObj = new ArchivedBrowseQuery($oFolder->getId()); |
| 100 | $collection->setQueryObject($qObj); | 102 | $collection->setQueryObject($qObj); |
| 101 | 103 | ||
| 102 | $aOptions = $collection->getEnvironOptions(); | 104 | $aOptions = $collection->getEnvironOptions(); |
| 103 | - $aOptions['result_url'] = KTUtil::addQueryString($_SERVER['PHP_SELF'], | 105 | + $aOptions['result_url'] = KTUtil::addQueryString($_SERVER['PHP_SELF'], |
| 104 | array(kt_array_merge($aBaseParams, array('fFolderId' => $oFolder->getId())))); | 106 | array(kt_array_merge($aBaseParams, array('fFolderId' => $oFolder->getId())))); |
| 105 | 107 | ||
| 106 | $collection->setOptions($aOptions); | 108 | $collection->setOptions($aOptions); |
| 107 | 109 | ||
| 108 | - $oWF =& KTWidgetFactory::getSingleton(); | ||
| 109 | - $oWidget = $oWF->get('ktcore.widgets.collection', | ||
| 110 | - array('label' => _kt('Target Documents'), | ||
| 111 | - 'description' => _kt('Use the folder collection and path below to browse to the folder containing the documents you wish to restore.'), | ||
| 112 | - 'required' => true, | ||
| 113 | - 'name' => 'browse', | ||
| 114 | - 'folder_id' => $oFolder->getId(), | ||
| 115 | - 'bcurl_params' => $aBaseParams, | ||
| 116 | - 'collection' => $collection)); | 110 | + $aURLParams = $aBaseParams; |
| 111 | + $aURLParams['action'] = 'restore'; | ||
| 112 | + $aBreadcrumbs = KTUtil::generate_breadcrumbs($oFolder, $iFolderId, $aURLParams); | ||
| 117 | 113 | ||
| 118 | - | ||
| 119 | - $oTemplating =& KTTemplating::getSingleton(); | ||
| 120 | - $oTemplate = $oTemplating->loadTemplate("ktcore/document/admin/archivebrowse"); | ||
| 121 | $aTemplateData = array( | 114 | $aTemplateData = array( |
| 122 | - "context" => $this, | 115 | + 'context' => $this, |
| 123 | 'folder' => $oFolder, | 116 | 'folder' => $oFolder, |
| 124 | 'breadcrumbs' => $aBreadcrumbs, | 117 | 'breadcrumbs' => $aBreadcrumbs, |
| 125 | - 'collection' => $oWidget, | 118 | + 'collection' => $collection |
| 126 | ); | 119 | ); |
| 127 | - | ||
| 128 | - return $oTemplate->render($aTemplateData); | 120 | + |
| 121 | + $oTemplate =& $this->oValidator->validateTemplate('ktcore/document/admin/archivebrowse'); | ||
| 122 | + return $oTemplate->render($aTemplateData); | ||
| 129 | } | 123 | } |
| 130 | - | 124 | + |
| 131 | /* | 125 | /* |
| 132 | * Provide for "archived" browsing. | 126 | * Provide for "archived" browsing. |
| 133 | */ | 127 | */ |
| 134 | function do_browse() { | 128 | function do_browse() { |
| 135 | - | 129 | + |
| 136 | } | 130 | } |
| 137 | - | 131 | + |
| 138 | function do_confirm_restore() { | 132 | function do_confirm_restore() { |
| 139 | $this->aBreadcrumbs[] = array('url' => $_SERVER['PHP_SELF'], 'name' => _kt('Archived Documents')); | 133 | $this->aBreadcrumbs[] = array('url' => $_SERVER['PHP_SELF'], 'name' => _kt('Archived Documents')); |
| 140 | - | ||
| 141 | - $selected_docs = KTUtil::arrayGet($_REQUEST, '_d', array()); | ||
| 142 | - | 134 | + |
| 135 | + $selected_docs = KTUtil::arrayGet($_REQUEST, '_d', array()); | ||
| 136 | + | ||
| 143 | $this->oPage->setTitle(sprintf(_kt('Confirm Restore of %d documents'), count($selected_docs))); | 137 | $this->oPage->setTitle(sprintf(_kt('Confirm Restore of %d documents'), count($selected_docs))); |
| 144 | - | 138 | + |
| 145 | $this->oPage->setBreadcrumbDetails(sprintf(_kt('confirm restore of %d documents'), count($selected_docs))); | 139 | $this->oPage->setBreadcrumbDetails(sprintf(_kt('confirm restore of %d documents'), count($selected_docs))); |
| 146 | - | 140 | + |
| 147 | $aDocuments = array(); | 141 | $aDocuments = array(); |
| 148 | foreach ($selected_docs as $doc_id) { | 142 | foreach ($selected_docs as $doc_id) { |
| 149 | $oDoc =& Document::get($doc_id); | 143 | $oDoc =& Document::get($doc_id); |
| 150 | - if (PEAR::isError($oDoc) || ($oDoc === false)) { | 144 | + if (PEAR::isError($oDoc) || ($oDoc === false)) { |
| 151 | $this->errorRedirectToMain(_kt('Invalid document id specified. Aborting restore.')); | 145 | $this->errorRedirectToMain(_kt('Invalid document id specified. Aborting restore.')); |
| 152 | } else if ($oDoc->getStatusId() != ARCHIVED) { | 146 | } else if ($oDoc->getStatusId() != ARCHIVED) { |
| 153 | $this->errorRedirectToMain(sprintf(_kt('%s is not an archived document. Aborting restore.'), $oDoc->getName())); | 147 | $this->errorRedirectToMain(sprintf(_kt('%s is not an archived document. Aborting restore.'), $oDoc->getName())); |
| 154 | } | 148 | } |
| 155 | $aDocuments[] = $oDoc; | 149 | $aDocuments[] = $oDoc; |
| 156 | } | 150 | } |
| 157 | - | ||
| 158 | - | 151 | + |
| 152 | + | ||
| 159 | $oTemplating =& KTTemplating::getSingleton(); | 153 | $oTemplating =& KTTemplating::getSingleton(); |
| 160 | $oTemplate = $oTemplating->loadTemplate('ktcore/document/admin/dearchiveconfirmlist'); | 154 | $oTemplate = $oTemplating->loadTemplate('ktcore/document/admin/dearchiveconfirmlist'); |
| 161 | $oTemplate->setData(array( | 155 | $oTemplate->setData(array( |
| @@ -167,22 +161,22 @@ class ArchivedDocumentsDispatcher extends KTAdminDispatcher { | @@ -167,22 +161,22 @@ class ArchivedDocumentsDispatcher extends KTAdminDispatcher { | ||
| 167 | 161 | ||
| 168 | function do_finish_restore() { | 162 | function do_finish_restore() { |
| 169 | 163 | ||
| 170 | - | ||
| 171 | - $selected_docs = KTUtil::arrayGet($_REQUEST, 'selected_docs', array()); | ||
| 172 | - | 164 | + |
| 165 | + $selected_docs = KTUtil::arrayGet($_REQUEST, 'selected_docs', array()); | ||
| 166 | + | ||
| 173 | $aDocuments = array(); | 167 | $aDocuments = array(); |
| 174 | foreach ($selected_docs as $doc_id) { | 168 | foreach ($selected_docs as $doc_id) { |
| 175 | $oDoc =& Document::get($doc_id); | 169 | $oDoc =& Document::get($doc_id); |
| 176 | - if (PEAR::isError($oDoc) || ($oDoc === false)) { | 170 | + if (PEAR::isError($oDoc) || ($oDoc === false)) { |
| 177 | $this->errorRedirectToMain(_kt('Invalid document id specified. Aborting restore.')); | 171 | $this->errorRedirectToMain(_kt('Invalid document id specified. Aborting restore.')); |
| 178 | } else if ($oDoc->getStatusId() != ARCHIVED) { | 172 | } else if ($oDoc->getStatusId() != ARCHIVED) { |
| 179 | $this->errorRedirectToMain(sprintf(_kt('%s is not an archived document. Aborting restore.'), $oDoc->getName())); | 173 | $this->errorRedirectToMain(sprintf(_kt('%s is not an archived document. Aborting restore.'), $oDoc->getName())); |
| 180 | } | 174 | } |
| 181 | $aDocuments[] = $oDoc; | 175 | $aDocuments[] = $oDoc; |
| 182 | } | 176 | } |
| 183 | - | 177 | + |
| 184 | $this->startTransaction(); | 178 | $this->startTransaction(); |
| 185 | - | 179 | + |
| 186 | foreach ($aDocuments as $oDoc) { | 180 | foreach ($aDocuments as $oDoc) { |
| 187 | // FIXME find de-archival source. | 181 | // FIXME find de-archival source. |
| 188 | // FIXME purge old notifications. | 182 | // FIXME purge old notifications. |
| @@ -192,11 +186,15 @@ class ArchivedDocumentsDispatcher extends KTAdminDispatcher { | @@ -192,11 +186,15 @@ class ArchivedDocumentsDispatcher extends KTAdminDispatcher { | ||
| 192 | if (PEAR::isError($res) || ($res == false)) { | 186 | if (PEAR::isError($res) || ($res == false)) { |
| 193 | $this->errorRedirectToMain(sprintf(_kt('%s could not be made "live".'), $oDoc->getName)); | 187 | $this->errorRedirectToMain(sprintf(_kt('%s could not be made "live".'), $oDoc->getName)); |
| 194 | } | 188 | } |
| 189 | + $oDocumentTransaction = & new DocumentTransaction($oDoc, _kt('Document restored.'), 'ktcore.transactions.update'); | ||
| 190 | + $oDocumentTransaction->create(); | ||
| 195 | } | 191 | } |
| 192 | + | ||
| 196 | $this->commitTransaction(); | 193 | $this->commitTransaction(); |
| 197 | $msg = sprintf(_kt('%d documents made active.'), count($aDocuments)); | 194 | $msg = sprintf(_kt('%d documents made active.'), count($aDocuments)); |
| 198 | $this->successRedirectToMain($msg); | 195 | $this->successRedirectToMain($msg); |
| 199 | } | 196 | } |
| 197 | + | ||
| 200 | } | 198 | } |
| 201 | 199 | ||
| 202 | ?> | 200 | ?> |
plugins/ktcore/document/edit.php
| @@ -294,68 +294,76 @@ class KTDocumentEditAction extends KTDocumentAction { | @@ -294,68 +294,76 @@ class KTDocumentEditAction extends KTDocumentAction { | ||
| 294 | } | 294 | } |
| 295 | 295 | ||
| 296 | $document_type = $data['type']; | 296 | $document_type = $data['type']; |
| 297 | + $doctypeid = $document_type->getId(); | ||
| 297 | 298 | ||
| 299 | + // Get the current document type, fieldsets and metadata | ||
| 300 | + $iOldDocTypeID = $this->oDocument->getDocumentTypeID(); | ||
| 301 | + $fieldsets = KTMetadataUtil::fieldsetsForDocument($this->oDocument, $iOldDocTypeID); | ||
| 302 | + $mdlist = DocumentFieldLink::getByDocument($this->oDocument); | ||
| 298 | 303 | ||
| 299 | - $doctypeid = $document_type->getId(); | ||
| 300 | - | ||
| 301 | - | ||
| 302 | - DBUtil::startTransaction(); | ||
| 303 | - $this->oDocument->setDocumentTypeId($doctypeid); | ||
| 304 | - $res = $this->oDocument->update(); | 304 | + $field_values = array(); |
| 305 | + foreach ($mdlist as $oFieldLink) { | ||
| 306 | + $field_values[$oFieldLink->getDocumentFieldID()] = $oFieldLink->getValue(); | ||
| 307 | + } | ||
| 305 | 308 | ||
| 309 | + DBUtil::startTransaction(); | ||
| 306 | 310 | ||
| 307 | - if (PEAR::isError($res)) | ||
| 308 | - { | ||
| 309 | - DBUtil::rollback(); | ||
| 310 | - return $res; | ||
| 311 | - } | ||
| 312 | - DBUtil::commit(); | 311 | + // Update the document with the new document type id |
| 312 | + $this->oDocument->startNewMetadataVersion($this->oUser); | ||
| 313 | + $this->oDocument->setDocumentTypeId($doctypeid); | ||
| 314 | + $res = $this->oDocument->update(); | ||
| 313 | 315 | ||
| 314 | - $fieldsets = KTMetadataUtil::fieldsetsForDocument($this->oDocument, $doctypeid); | 316 | + if (PEAR::isError($res)) |
| 317 | + { | ||
| 318 | + DBUtil::rollback(); | ||
| 319 | + return $res; | ||
| 320 | + } | ||
| 315 | 321 | ||
| 316 | - $fs_ids = array(); | 322 | + // Ensure all values for fieldsets common to both document types are retained |
| 323 | + $fs_ids = array(); | ||
| 317 | 324 | ||
| 318 | - $doctype_fieldsets = KTFieldSet::getForDocumentType($doctypeid); | ||
| 319 | - foreach($doctype_fieldsets as $fieldset) | ||
| 320 | - { | ||
| 321 | - $fs_ids[] = $fieldset->getId(); | ||
| 322 | - } | ||
| 323 | - $MDPack = array(); | ||
| 324 | - foreach ($fieldsets as $oFieldset) | ||
| 325 | - { | ||
| 326 | - if ($oFieldset->getIsGeneric() || in_array($oFieldset->getId(),$fs_ids)) | ||
| 327 | - { | ||
| 328 | - //print $oFieldset->getName() . "<br>"; | ||
| 329 | - $fields = $oFieldset->getFields(); | ||
| 330 | - $values = (array) KTUtil::arrayGet($data, 'fieldset_' . $oFieldset->getId()); | ||
| 331 | - foreach ($fields as $oField) | ||
| 332 | - { | ||
| 333 | - $val = KTUtil::arrayGet($values, 'metadata_' . $oField->getId()); | 325 | + $doctype_fieldsets = KTFieldSet::getForDocumentType($doctypeid); |
| 326 | + foreach($doctype_fieldsets as $fieldset) | ||
| 327 | + { | ||
| 328 | + $fs_ids[] = $fieldset->getId(); | ||
| 329 | + } | ||
| 334 | 330 | ||
| 335 | - // FIXME "null" has strange meanings here. | ||
| 336 | - if (!is_null($val)) | ||
| 337 | - { | ||
| 338 | - $MDPack[] = array( | ||
| 339 | - $oField, | ||
| 340 | - $val | ||
| 341 | - ); | ||
| 342 | - } | ||
| 343 | - } | ||
| 344 | - } | 331 | + $MDPack = array(); |
| 332 | + foreach ($fieldsets as $oFieldset) | ||
| 333 | + { | ||
| 334 | + if ($oFieldset->getIsGeneric() || in_array($oFieldset->getId(), $fs_ids)) | ||
| 335 | + { | ||
| 336 | + $fields = $oFieldset->getFields(); | ||
| 337 | + | ||
| 338 | + foreach ($fields as $oField) | ||
| 339 | + { | ||
| 340 | + $val = isset($field_values[$oField->getId()]) ? $field_values[$oField->getId()] : ''; | ||
| 341 | + | ||
| 342 | + if (!empty($val)) | ||
| 343 | + { | ||
| 344 | + $MDPack[] = array($oField, $val); | ||
| 345 | + } | ||
| 346 | + } | ||
| 347 | + } | ||
| 348 | + } | ||
| 345 | 349 | ||
| 346 | - } | 350 | + $core_res = KTDocumentUtil::saveMetadata($this->oDocument, $MDPack, array('novalidate' => true)); |
| 347 | 351 | ||
| 348 | - $core_res = KTDocumentUtil::saveMetadata($this->oDocument, $MDPack); | 352 | + if (PEAR::isError($core_res)) { |
| 353 | + DBUtil::rollback(); | ||
| 354 | + return $core_res; | ||
| 355 | + } | ||
| 356 | + DBUtil::commit(); | ||
| 349 | 357 | ||
| 350 | - $oKTTriggerRegistry = KTTriggerRegistry::getSingleton(); | 358 | + $oKTTriggerRegistry = KTTriggerRegistry::getSingleton(); |
| 351 | $aTriggers = $oKTTriggerRegistry->getTriggers('edit', 'postValidate'); | 359 | $aTriggers = $oKTTriggerRegistry->getTriggers('edit', 'postValidate'); |
| 352 | 360 | ||
| 353 | foreach ($aTriggers as $aTrigger) { | 361 | foreach ($aTriggers as $aTrigger) { |
| 354 | $sTrigger = $aTrigger[0]; | 362 | $sTrigger = $aTrigger[0]; |
| 355 | $oTrigger = new $sTrigger; | 363 | $oTrigger = new $sTrigger; |
| 356 | $aInfo = array( | 364 | $aInfo = array( |
| 357 | - "document" => $this->oDocument, | ||
| 358 | - "aOptions" => $MDPack, | 365 | + "document" => $this->oDocument, |
| 366 | + "aOptions" => $MDPack, | ||
| 359 | ); | 367 | ); |
| 360 | $oTrigger->setInfo($aInfo); | 368 | $oTrigger->setInfo($aInfo); |
| 361 | $ret = $oTrigger->postValidate(); | 369 | $ret = $oTrigger->postValidate(); |
| @@ -366,4 +374,4 @@ class KTDocumentEditAction extends KTDocumentAction { | @@ -366,4 +374,4 @@ class KTDocumentEditAction extends KTDocumentAction { | ||
| 366 | } | 374 | } |
| 367 | // }}} | 375 | // }}} |
| 368 | 376 | ||
| 369 | -?> | 377 | -?> |
| 378 | +?> | ||
| 370 | \ No newline at end of file | 379 | \ No newline at end of file |
plugins/ktstandard/KTDocumentLinks.php
| @@ -247,7 +247,7 @@ class KTDocumentLinkAction extends KTDocumentAction { | @@ -247,7 +247,7 @@ class KTDocumentLinkAction extends KTDocumentAction { | ||
| 247 | 247 | ||
| 248 | $aURLParams = $aBaseParams; | 248 | $aURLParams = $aBaseParams; |
| 249 | $aURLParams['action'] = 'new'; | 249 | $aURLParams['action'] = 'new'; |
| 250 | - $aBreadcrumbs = $this->_generate_breadcrumbs($oFolder, $iFolderId, $aURLParams); | 250 | + $aBreadcrumbs = KTUtil::generate_breadcrumbs($oFolder, $iFolderId, $aURLParams); |
| 251 | 251 | ||
| 252 | $aTemplateData = array( | 252 | $aTemplateData = array( |
| 253 | 'context' => $this, | 253 | 'context' => $this, |
| @@ -438,59 +438,6 @@ class KTDocumentLinkAction extends KTDocumentAction { | @@ -438,59 +438,6 @@ class KTDocumentLinkAction extends KTDocumentAction { | ||
| 438 | $this->successRedirectToMain(_kt('Document link deleted'), sprintf('fDocumentId=%d', $oParentDocument->getId())); | 438 | $this->successRedirectToMain(_kt('Document link deleted'), sprintf('fDocumentId=%d', $oParentDocument->getId())); |
| 439 | exit(0); | 439 | exit(0); |
| 440 | } | 440 | } |
| 441 | - | ||
| 442 | - function _generate_breadcrumbs($oFolder, $iFolderId, $aURLParams) { | ||
| 443 | - static $aFolders = array(); | ||
| 444 | - static $aBreadcrumbs = array(); | ||
| 445 | - | ||
| 446 | - // Check if selected folder is a parent of the current folder | ||
| 447 | - if(in_array($iFolderId, $aFolders)){ | ||
| 448 | - $temp = array_flip($aFolders); | ||
| 449 | - $key = $temp[$iFolderId]; | ||
| 450 | - array_splice($aFolders, $key); | ||
| 451 | - array_splice($aBreadcrumbs, $key); | ||
| 452 | - return $aBreadcrumbs; | ||
| 453 | - } | ||
| 454 | - | ||
| 455 | - // Check for the parent of the selected folder unless its the root folder | ||
| 456 | - $iParentId = $oFolder->getParentID(); | ||
| 457 | - if($iFolderId != 1 && in_array($iParentId, $aFolders)){ | ||
| 458 | - $temp = array_flip($aFolders); | ||
| 459 | - $key = $temp[$iParentId]; | ||
| 460 | - array_splice($aFolders, $key); | ||
| 461 | - array_splice($aBreadcrumbs, $key); | ||
| 462 | - array_push($aFolders, $iFolderId); | ||
| 463 | - | ||
| 464 | - $aParams = $aURLParams; | ||
| 465 | - $aParams['fFolderId'] = $iFolderId; | ||
| 466 | - $url = KTUtil::addQueryString($_SERVER['PHP_SELF'], $aParams); | ||
| 467 | - $aBreadcrumbs[] = array('url' => $url, 'name' => $oFolder->getName()); | ||
| 468 | - return $aBreadcrumbs; | ||
| 469 | - } | ||
| 470 | - | ||
| 471 | - // Create the breadcrumbs | ||
| 472 | - $folder_path_names = $oFolder->getPathArray(); | ||
| 473 | - $folder_path_ids = explode(',', $oFolder->getParentFolderIds()); | ||
| 474 | - $folder_path_ids[] = $oFolder->getId(); | ||
| 475 | - if ($folder_path_ids[0] == 0) { | ||
| 476 | - array_shift($folder_path_ids); | ||
| 477 | - array_shift($folder_path_names); | ||
| 478 | - } | ||
| 479 | - | ||
| 480 | - $iCount = count($folder_path_ids); | ||
| 481 | - $range = range(0, $iCount - 1); | ||
| 482 | - foreach ($range as $index) { | ||
| 483 | - $id = $folder_path_ids[$index]; | ||
| 484 | - $name = $folder_path_names[$index]; | ||
| 485 | - | ||
| 486 | - $aParams = $aURLParams; | ||
| 487 | - $aParams['fFolderId'] = $id; | ||
| 488 | - $url = KTUtil::addQueryString($_SERVER['PHP_SELF'], $aParams); | ||
| 489 | - $aBreadcrumbs[] = array('url' => $url, 'name' => $name); | ||
| 490 | - } | ||
| 491 | - $aFolders = $folder_path_ids; | ||
| 492 | - return $aBreadcrumbs; | ||
| 493 | - } | ||
| 494 | } | 441 | } |
| 495 | 442 | ||
| 496 | class KTDocLinkAdminDispatcher extends KTAdminDispatcher { | 443 | class KTDocLinkAdminDispatcher extends KTAdminDispatcher { |
resources/js/search2widget.js
| @@ -176,7 +176,7 @@ function createSearchBar(div, suffix) | @@ -176,7 +176,7 @@ function createSearchBar(div, suffix) | ||
| 176 | value: quickQuery, | 176 | value: quickQuery, |
| 177 | selectOnFocus:true, | 177 | selectOnFocus:true, |
| 178 | id:'txtSearchBar' + suffix, | 178 | id:'txtSearchBar' + suffix, |
| 179 | - width: 110 | 179 | + width: (suffix == 1)?180:110 |
| 180 | }), button); | 180 | }), button); |
| 181 | 181 | ||
| 182 | var map = new Ext.KeyMap("txtSearchBar" + suffix, | 182 | var map = new Ext.KeyMap("txtSearchBar" + suffix, |
| @@ -190,7 +190,7 @@ function createSearchBar(div, suffix) | @@ -190,7 +190,7 @@ function createSearchBar(div, suffix) | ||
| 190 | var el = Ext.get(div); | 190 | var el = Ext.get(div); |
| 191 | if (suffix == 1) | 191 | if (suffix == 1) |
| 192 | { | 192 | { |
| 193 | - el.applyStyles('position:relative; top: -3px'); | 193 | + el.applyStyles('position:relative; top: -15px; margin-right: 15px'); |
| 194 | } | 194 | } |
| 195 | else | 195 | else |
| 196 | { | 196 | { |
search2/indexing/indexers/JavaXMLRPCLuceneIndexer.inc.php
| @@ -202,7 +202,7 @@ class JavaXMLRPCLuceneIndexer extends Indexer | @@ -202,7 +202,7 @@ class JavaXMLRPCLuceneIndexer extends Indexer | ||
| 202 | } | 202 | } |
| 203 | else | 203 | else |
| 204 | { | 204 | { |
| 205 | - $_SESSION['KTErrorMessage'][] = _kt('The XMLRPC Server did not respond correctly. Please notify the system administrator to investigate.'); | 205 | + $_SESSION['KTErrorMessage'][] = _kt('The Document Indexer did not respond correctly. Your search results will not include content results. Please notify the system administrator to investigate why the Document Indexer is not running.'); |
| 206 | } | 206 | } |
| 207 | return $results; | 207 | return $results; |
| 208 | } | 208 | } |
templates/kt3/standard_page.smarty
| @@ -158,7 +158,7 @@ | @@ -158,7 +158,7 @@ | ||
| 158 | <input type=hidden name="cbQuickGeneral" id="cbQuickGeneral" value="1"></form> | 158 | <input type=hidden name="cbQuickGeneral" id="cbQuickGeneral" value="1"></form> |
| 159 | </div> | 159 | </div> |
| 160 | 160 | ||
| 161 | - <div id="newSearchQuery"/> | 161 | + |
| 162 | 162 | ||
| 163 | 163 | ||
| 164 | 164 | ||
| @@ -198,6 +198,7 @@ | @@ -198,6 +198,7 @@ | ||
| 198 | {if ($page->breadcrumbDetails !== false)} | 198 | {if ($page->breadcrumbDetails !== false)} |
| 199 | <span class="additional">({$page->breadcrumbDetails|sanitize})</span> | 199 | <span class="additional">({$page->breadcrumbDetails|sanitize})</span> |
| 200 | {/if} | 200 | {/if} |
| 201 | + <div id="newSearchQuery" style="float: right; "/> | ||
| 201 | </div> | 202 | </div> |
| 202 | {/if} | 203 | {/if} |
| 203 | </div> | 204 | </div> |
templates/ktcore/document/admin/archivebrowse.smarty
| @@ -7,17 +7,23 @@ will typically be done within the system and will generate a | @@ -7,17 +7,23 @@ will typically be done within the system and will generate a | ||
| 7 | notification to you.{/i18n} | 7 | notification to you.{/i18n} |
| 8 | </p> | 8 | </p> |
| 9 | 9 | ||
| 10 | +<p>{i18n}Use the folder collection and path below to browse to the folder containing the documents you wish to restore.{/i18n} | ||
| 11 | +</p> | ||
| 12 | +<br /> | ||
| 13 | + | ||
| 14 | +{foreach from=$breadcrumbs item=breadcrumb name=bc} | ||
| 15 | + {if !$smarty.foreach.bc.last} | ||
| 16 | + <a href="{$breadcrumb.url}">{$breadcrumb.name|sanitize}</a> » | ||
| 17 | + {else} | ||
| 18 | + {$breadcrumb.name|sanitize} | ||
| 19 | + {/if} | ||
| 20 | +{/foreach} | ||
| 21 | + | ||
| 10 | <form method="POST" action="{$smarty.server.PHP_SELF}"> | 22 | <form method="POST" action="{$smarty.server.PHP_SELF}"> |
| 11 | <input type="hidden" name="action" value="confirm_restore" /> | 23 | <input type="hidden" name="action" value="confirm_restore" /> |
| 12 | <input type="hidden" name="fFolderId" value="{$folder->getId()}" /> | 24 | <input type="hidden" name="fFolderId" value="{$folder->getId()}" /> |
| 13 | -{foreach from=$collection_breadcrumbs item=breadcrumb name=bc} | ||
| 14 | -<a href="{$breadcrumb.url}">{$breadcrumb.name}</a> | ||
| 15 | -{if !$smarty.foreach.bc.last} | ||
| 16 | -» | ||
| 17 | -{/if} | ||
| 18 | -{/foreach} | ||
| 19 | -{$collection->render()} | ||
| 20 | 25 | ||
| 26 | +{$collection->render()} | ||
| 21 | 27 | ||
| 22 | <div class="form_actions"> | 28 | <div class="form_actions"> |
| 23 | <input type="submit" name="submit[move]" value="{i18n}Restore{/i18n}" /> | 29 | <input type="submit" name="submit[move]" value="{i18n}Restore{/i18n}" /> |