Commit 49f8d085329f245d16c1bb3b00c2f04c6b087325
1 parent
b3ae3965
*** empty log message ***
git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@2243 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
2 changed files
with
21 additions
and
16 deletions
presentation/lookAndFeel/knowledgeTree/search/standardSearchBL.php
| @@ -19,13 +19,16 @@ if (checkSession()) { | @@ -19,13 +19,16 @@ if (checkSession()) { | ||
| 19 | require_once("$default->fileSystemRoot/lib/foldermanagement/Folder.inc"); | 19 | require_once("$default->fileSystemRoot/lib/foldermanagement/Folder.inc"); |
| 20 | require_once("$default->fileSystemRoot/lib/documentmanagement/Document.inc"); | 20 | require_once("$default->fileSystemRoot/lib/documentmanagement/Document.inc"); |
| 21 | require_once("$default->fileSystemRoot/presentation/Html.inc"); | 21 | require_once("$default->fileSystemRoot/presentation/Html.inc"); |
| 22 | - require_once("standardSearchUI.inc"); | 22 | + require_once("standardSearchUI.inc"); |
| 23 | + | ||
| 24 | + //echo $fSearchText . "<br>" . $fFolderID; | ||
| 23 | 25 | ||
| 24 | if (!isset($fStartIndex)) { | 26 | if (!isset($fStartIndex)) { |
| 25 | $fStartIndex = 0; | 27 | $fStartIndex = 0; |
| 26 | } | 28 | } |
| 27 | //escape the search string | 29 | //escape the search string |
| 28 | - $fStandardSearchString = addslashes($fStandardSearchString); | 30 | + //$fStandardSearchString = addslashes($fStandardSearchString); |
| 31 | + | ||
| 29 | 32 | ||
| 30 | if (strlen($fBrowseType) > 0) { | 33 | if (strlen($fBrowseType) > 0) { |
| 31 | //the user was browsing by a specific type | 34 | //the user was browsing by a specific type |
| @@ -34,11 +37,11 @@ if (checkSession()) { | @@ -34,11 +37,11 @@ if (checkSession()) { | ||
| 34 | //user was browsing a specific folder - search that folder | 37 | //user was browsing a specific folder - search that folder |
| 35 | if (!$fFolderID) { | 38 | if (!$fFolderID) { |
| 36 | //start at the root folder | 39 | //start at the root folder |
| 37 | - $fFolderID = 0; | 40 | + $fFolderID = 1; |
| 38 | } | 41 | } |
| 39 | require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); | 42 | require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); |
| 40 | $oPatternCustom = & new PatternCustom(); | 43 | $oPatternCustom = & new PatternCustom(); |
| 41 | - $oPatternCustom->setHtml(getSeachResultsByFolder($fFolderID, $fStartIndex, $fStandardSearchString)); | 44 | + $oPatternCustom->setHtml(getSeachResultsByFolder($fFolderID, $fStartIndex, $fSearchText)); |
| 42 | $main->setCentralPayload($oPatternCustom); | 45 | $main->setCentralPayload($oPatternCustom); |
| 43 | $main->render(); | 46 | $main->render(); |
| 44 | break; | 47 | break; |
| @@ -46,11 +49,11 @@ if (checkSession()) { | @@ -46,11 +49,11 @@ if (checkSession()) { | ||
| 46 | //user was browsing by category - search all documents in that category | 49 | //user was browsing by category - search all documents in that category |
| 47 | if (!$fCategoryName) { | 50 | if (!$fCategoryName) { |
| 48 | //no category name specified, so just start at the root folder | 51 | //no category name specified, so just start at the root folder |
| 49 | - $fFolderID = 0; | 52 | + $fFolderID = 1; |
| 50 | } | 53 | } |
| 51 | require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); | 54 | require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); |
| 52 | $oPatternCustom = & new PatternCustom(); | 55 | $oPatternCustom = & new PatternCustom(); |
| 53 | - $oPatternCustom->setHtml(getSearchResultsByCategory($fFolderID, $fStandardSearchString, $fStartIndex, $fCategoryName)); | 56 | + $oPatternCustom->setHtml(getSearchResultsByCategory($fFolderID, $fSearchText, $fStartIndex, $fCategoryName)); |
| 54 | $main->setCentralPayload($oPatternCustom); | 57 | $main->setCentralPayload($oPatternCustom); |
| 55 | $main->render(); | 58 | $main->render(); |
| 56 | break; | 59 | break; |
| @@ -58,23 +61,24 @@ if (checkSession()) { | @@ -58,23 +61,24 @@ if (checkSession()) { | ||
| 58 | //user was browsing by document type - search all documents in that doc type | 61 | //user was browsing by document type - search all documents in that doc type |
| 59 | if (!$fDocTypeID) { | 62 | if (!$fDocTypeID) { |
| 60 | //no document type specified, so just start at the root folder | 63 | //no document type specified, so just start at the root folder |
| 61 | - $fFolderID = 0; | 64 | + $fFolderID = 1; |
| 62 | } | 65 | } |
| 63 | require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); | 66 | require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); |
| 64 | $oPatternCustom = & new PatternCustom(); | 67 | $oPatternCustom = & new PatternCustom(); |
| 65 | - $oPatternCustom->setHtml(getSearchResultsByDocumentType($fFolderID, $fStandardSearchString, $fStartIndex, $fDocTypeID)); | 68 | + $oPatternCustom->setHtml(getSearchResultsByDocumentType($fFolderID, $fSearchText, $fStartIndex, $fDocTypeID)); |
| 66 | $main->setCentralPayload($oPatternCustom); | 69 | $main->setCentralPayload($oPatternCustom); |
| 67 | $main->render(); | 70 | $main->render(); |
| 68 | break; | 71 | break; |
| 69 | default: | 72 | default: |
| 70 | //search from the root folder down i.e. all documents | 73 | //search from the root folder down i.e. all documents |
| 74 | + echo "unknown search type"; | ||
| 71 | break; | 75 | break; |
| 72 | } | 76 | } |
| 73 | } else if (strlen($fFolderID) > 0) { | 77 | } else if (strlen($fFolderID) > 0) { |
| 74 | //the user was browsing a folder, search that folder | 78 | //the user was browsing a folder, search that folder |
| 75 | require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); | 79 | require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); |
| 76 | $oPatternCustom = & new PatternCustom(); | 80 | $oPatternCustom = & new PatternCustom(); |
| 77 | - $oPatternCustom->setHtml(getSeachResultsByFolder($fFolderID, $fStartIndex, $fStandardSearchString)); | 81 | + $oPatternCustom->setHtml(getSeachResultsByFolder($fFolderID, $fStartIndex, $fSearchText)); |
| 78 | $main->setCentralPayload($oPatternCustom); | 82 | $main->setCentralPayload($oPatternCustom); |
| 79 | $main->render(); | 83 | $main->render(); |
| 80 | 84 | ||
| @@ -83,15 +87,16 @@ if (checkSession()) { | @@ -83,15 +87,16 @@ if (checkSession()) { | ||
| 83 | $oDocument = Document::get($fDocumentID); | 87 | $oDocument = Document::get($fDocumentID); |
| 84 | require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); | 88 | require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); |
| 85 | $oPatternCustom = & new PatternCustom(); | 89 | $oPatternCustom = & new PatternCustom(); |
| 86 | - $oPatternCustom->setHtml(getSeachResultsByFolder($oDocument->getFolderID(), $fStartIndex, $fStandardSearchString)); | 90 | + $oPatternCustom->setHtml(getSeachResultsByFolder($oDocument->getFolderID(), $fStartIndex, $fSearchText)); |
| 87 | $main->setCentralPayload($oPatternCustom); | 91 | $main->setCentralPayload($oPatternCustom); |
| 88 | $main->render(); | 92 | $main->render(); |
| 89 | } else { | 93 | } else { |
| 94 | + echo "still searching by folder"; | ||
| 90 | //search from the root folder down i.e. all documents | 95 | //search from the root folder down i.e. all documents |
| 91 | - $fFolderID = 0; | 96 | + $fFolderID = 1; |
| 92 | require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); | 97 | require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); |
| 93 | $oPatternCustom = & new PatternCustom(); | 98 | $oPatternCustom = & new PatternCustom(); |
| 94 | - $oPatternCustom->setHtml(getSeachResultsByFolder($fFolderID, $fStartIndex, $fStandardSearchString)); | 99 | + $oPatternCustom->setHtml(getSeachResultsByFolder($fFolderID, $fStartIndex, $fSearchText)); |
| 95 | $main->setCentralPayload($oPatternCustom); | 100 | $main->setCentralPayload($oPatternCustom); |
| 96 | $main->render(); | 101 | $main->render(); |
| 97 | } | 102 | } |
presentation/lookAndFeel/knowledgeTree/search/standardSearchUI.inc
| @@ -30,7 +30,7 @@ function getSearchResultsByCategory($iFolderID, $sKeywords, $iStartIndex, $sCate | @@ -30,7 +30,7 @@ function getSearchResultsByCategory($iFolderID, $sKeywords, $iStartIndex, $sCate | ||
| 30 | "AND SL.name='Live' "; | 30 | "AND SL.name='Live' "; |
| 31 | //only check in the parent_folder_ids if we're not searching from the | 31 | //only check in the parent_folder_ids if we're not searching from the |
| 32 | //root folder down | 32 | //root folder down |
| 33 | - if ($iFolderID != 0) { | 33 | + if ($iFolderID != 1) { |
| 34 | $sQuery .= "AND (F.parent_folder_ids LIKE '%,$iFolderID,%' OR F.id = $iFolderID) "; | 34 | $sQuery .= "AND (F.parent_folder_ids LIKE '%,$iFolderID,%' OR F.id = $iFolderID) "; |
| 35 | } | 35 | } |
| 36 | $sQuery .= "AND DF.name LIKE 'Category' "; | 36 | $sQuery .= "AND DF.name LIKE 'Category' "; |
| @@ -69,7 +69,7 @@ function getSearchResultsByDocumentType($iFolderID, $sKeywords, $iStartIndex, $i | @@ -69,7 +69,7 @@ function getSearchResultsByDocumentType($iFolderID, $sKeywords, $iStartIndex, $i | ||
| 69 | $sQuery .= "AND SL.name='Live' "; | 69 | $sQuery .= "AND SL.name='Live' "; |
| 70 | //only check in the parent_folder_ids if we're not searching from the | 70 | //only check in the parent_folder_ids if we're not searching from the |
| 71 | //root folder down | 71 | //root folder down |
| 72 | - if ($iFolderID != 0) { | 72 | + if ($iFolderID != 1) { |
| 73 | $sQuery .= "AND (F.parent_folder_ids LIKE '%,$iFolderID,%' OR F.id = $iFolderID) "; | 73 | $sQuery .= "AND (F.parent_folder_ids LIKE '%,$iFolderID,%' OR F.id = $iFolderID) "; |
| 74 | } | 74 | } |
| 75 | $sQuery .= "ORDER BY score DESC"; | 75 | $sQuery .= "ORDER BY score DESC"; |
| @@ -101,11 +101,11 @@ function getSeachResultsByFolder($iFolderID, $iStartIndex, $sKeywords) { | @@ -101,11 +101,11 @@ function getSeachResultsByFolder($iFolderID, $iStartIndex, $sKeywords) { | ||
| 101 | "AND SL.name='Live' "; | 101 | "AND SL.name='Live' "; |
| 102 | //only check in the parent_folder_ids if we're not searching from the | 102 | //only check in the parent_folder_ids if we're not searching from the |
| 103 | //root folder down | 103 | //root folder down |
| 104 | - if ($iFolderID != 0) { | 104 | + if ($iFolderID != 1) { |
| 105 | $sQuery .= "AND (F.parent_folder_ids LIKE '%,$iFolderID,%' OR F.id = $iFolderID) "; | 105 | $sQuery .= "AND (F.parent_folder_ids LIKE '%,$iFolderID,%' OR F.id = $iFolderID) "; |
| 106 | } | 106 | } |
| 107 | $sQuery .= "ORDER BY score DESC"; | 107 | $sQuery .= "ORDER BY score DESC"; |
| 108 | - | 108 | + |
| 109 | //var_dump($sQuery); | 109 | //var_dump($sQuery); |
| 110 | 110 | ||
| 111 | $aColumns = array("folder_image_url", "document_name","score"); | 111 | $aColumns = array("folder_image_url", "document_name","score"); |