Commit 5203ecb0933922e5428e6fb20fbefbf8cb736539

Authored by Brad Shuttleworth
1 parent 8000e8d1

remainder of folder-search.


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@5414 c91229c3-7414-0410-bfa2-8a42b809f60b
HISTORY.txt
@@ -2,6 +2,19 @@ @@ -2,6 +2,19 @@
2 What's new in this release 2 What's new in this release
3 ========================== 3 ==========================
4 4
  5 +3.0.3
  6 +
  7 +Features:
  8 +
  9 +
  10 +
  11 +Fixes:
  12 +
  13 + - KTS-972 Owner, Everyone and Authenticated weren't being respected by browse
  14 + and search
  15 + - KTS-959 Documents weren't properly purged from the cache on change.
  16 +
  17 +
5 3.0.2 18 3.0.2
6 ----- 19 -----
7 20
lib/foldermanagement/folderutil.inc.php
@@ -72,6 +72,9 @@ class KTFolderUtil { @@ -72,6 +72,9 @@ class KTFolderUtil {
72 // fire subscription alerts for the new folder 72 // fire subscription alerts for the new folder
73 $oSubscriptionEvent = new SubscriptionEvent(); 73 $oSubscriptionEvent = new SubscriptionEvent();
74 $oSubscriptionEvent->AddFolder($oFolder, $oParentFolder); 74 $oSubscriptionEvent->AddFolder($oFolder, $oParentFolder);
  75 +
  76 + KTFolderUtil::updateSearchableText($oFolder);
  77 +
75 return $oFolder; 78 return $oFolder;
76 } 79 }
77 80
@@ -208,6 +211,8 @@ class KTFolderUtil { @@ -208,6 +211,8 @@ class KTFolderUtil {
208 $oFolder->setName($sNewName); 211 $oFolder->setName($sNewName);
209 $res = $oFolder->update(); 212 $res = $oFolder->update();
210 213
  214 + KTFolderUtil::updateSearchableText($oFolder);
  215 +
211 Document::clearAllCaches(); 216 Document::clearAllCaches();
212 Folder::clearAllCaches(); 217 Folder::clearAllCaches();
213 218
@@ -218,6 +223,8 @@ class KTFolderUtil { @@ -218,6 +223,8 @@ class KTFolderUtil {
218 return Folder::folderExistsName($sName, $oParentFolder->getID()); 223 return Folder::folderExistsName($sName, $oParentFolder->getID());
219 } 224 }
220 225
  226 +
  227 +
221 /* folderUtil::delete 228 /* folderUtil::delete
222 * 229 *
223 * this function is _much_ more complex than it might seem. 230 * this function is _much_ more complex than it might seem.
@@ -469,6 +476,30 @@ class KTFolderUtil { @@ -469,6 +476,30 @@ class KTFolderUtil {
469 476
470 return true; 477 return true;
471 } 478 }
  479 +
  480 + function updateSearchableText($oFolder) {
  481 + // very simple function to rebuild the searchable text for this
  482 + // folder.
  483 +
  484 + // MyISAM table for fulltext index - no transactions.
  485 +
  486 + // get the folder text
  487 + // XXX replace this with a trigger / producer set.
  488 + $sSearchableText = $oFolder->getName();
  489 +
  490 + // do the update.
  491 + $iFolderId = KTUtil::getId($oFolder);
  492 + $sTable = KTUtil::getTableName('folder_searchable_text');
  493 + $aDelete = array(
  494 + "folder_id" => $iFolderId,
  495 + );
  496 + DBUtil::whereDelete($sTable, $aDelete);
  497 + $aInsert = array(
  498 + "folder_id" => $iFolderId,
  499 + "folder_text" => $sSearchableText,
  500 + );
  501 + return DBUtil::autoInsert($sTable, $aInsert, array('noid' => true));
  502 + }
472 } 503 }
473 504
474 ?> 505 ?>
search/simpleSearch.php
@@ -150,7 +150,7 @@ class SimpleSearchDispatcher extends KTStandardDispatcher { @@ -150,7 +150,7 @@ class SimpleSearchDispatcher extends KTStandardDispatcher {
150 $t->setSearch($searchable_text); 150 $t->setSearch($searchable_text);
151 */ 151 */
152 $t =& new TitleColumn("Test 1 (title)","title"); 152 $t =& new TitleColumn("Test 1 (title)","title");
153 - $t->setOptions(array('documenturl' => $GLOBALS['KTRootUrl'] . '/view.php')); 153 + $t->setOptions(array('documenturl' => $GLOBALS['KTRootUrl'] . '/view.php', 'direct_folder' => true));
154 $collection->addColumn($t); 154 $collection->addColumn($t);
155 $collection->addColumn(new DownloadColumn('','download')); 155 $collection->addColumn(new DownloadColumn('','download'));
156 $collection->addColumn(new DateColumn(_kt("Created"),"created", "getCreatedDateTime")); 156 $collection->addColumn(new DateColumn(_kt("Created"),"created", "getCreatedDateTime"));