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