Commit cab7e39d8b2994f0a00bbc82b6048e2cd3cb3fff
1 parent
e80a349d
removed comments and formatted
git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@2433 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
73 additions
and
81 deletions
presentation/lookAndFeel/knowledgeTree/search/standardSearchBL.php
| ... | ... | @@ -21,90 +21,82 @@ if (checkSession()) { |
| 21 | 21 | require_once("$default->fileSystemRoot/presentation/Html.inc"); |
| 22 | 22 | require_once("standardSearchUI.inc"); |
| 23 | 23 | |
| 24 | - //echo $fSearchText . "<br>" . $fFolderID; | |
| 25 | - | |
| 26 | 24 | if (!isset($fStartIndex)) { |
| 27 | 25 | $fStartIndex = 0; |
| 28 | 26 | } |
| 29 | - //escape the search string | |
| 30 | - //$fStandardSearchString = addslashes($fStandardSearchString); | |
| 31 | - | |
| 32 | - | |
| 33 | - if (strlen($fBrowseType) > 0) { | |
| 34 | - //the user was browsing by a specific type | |
| 35 | - switch ($fBrowseType) { | |
| 36 | - case "folder" : | |
| 37 | - //echo "searching by folder browsetype"; | |
| 38 | - //user was browsing a specific folder - search that folder | |
| 39 | - if (!$fFolderID) { | |
| 40 | - //start at the root folder | |
| 41 | - $fFolderID = 1; | |
| 42 | - } | |
| 43 | - require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); | |
| 44 | - $oPatternCustom = & new PatternCustom(); | |
| 45 | - $oPatternCustom->setHtml(getSeachResultsByFolder($fFolderID, $fStartIndex, $fSearchText)); | |
| 46 | - $main->setCentralPayload($oPatternCustom); | |
| 47 | - $main->render(); | |
| 48 | - break; | |
| 49 | - case "category" : | |
| 50 | - //echo "searching by category browse type"; | |
| 51 | - //user was browsing by category - search all documents in that category | |
| 52 | - if (!$fCategoryName) { | |
| 53 | - //no category name specified, so just start at the root folder | |
| 54 | - $fFolderID = 1; | |
| 55 | - } | |
| 56 | - require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); | |
| 57 | - $oPatternCustom = & new PatternCustom(); | |
| 58 | - $oPatternCustom->setHtml(getSearchResultsByCategory($fFolderID, $fSearchText, $fStartIndex, $fCategoryName)); | |
| 59 | - $main->setCentralPayload($oPatternCustom); | |
| 60 | - $main->render(); | |
| 61 | - break; | |
| 62 | - case "documentType" : | |
| 63 | - //echo "searching by documentType browseType"; | |
| 64 | - //user was browsing by document type - search all documents in that doc type | |
| 65 | - if (!$fDocTypeID) { | |
| 66 | - //no document type specified, so just start at the root folder | |
| 67 | - $fFolderID = 1; | |
| 68 | - } | |
| 69 | - require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); | |
| 70 | - $oPatternCustom = & new PatternCustom(); | |
| 71 | - $oPatternCustom->setHtml(getSearchResultsByDocumentType($fFolderID, $fSearchText, $fStartIndex, $fDocTypeID)); | |
| 72 | - $main->setCentralPayload($oPatternCustom); | |
| 73 | - $main->render(); | |
| 74 | - break; | |
| 75 | - default: | |
| 76 | - //search from the root folder down i.e. all documents | |
| 77 | - //echo "unknown search type"; | |
| 78 | - break; | |
| 79 | - } | |
| 80 | - } else if (strlen($fFolderID) > 0) { | |
| 81 | - //the user was browsing a folder, search that folder | |
| 82 | - //echo "searching by folder id"; | |
| 83 | - require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); | |
| 84 | - $oPatternCustom = & new PatternCustom(); | |
| 85 | - $oPatternCustom->setHtml(getSeachResultsByFolder($fFolderID, $fStartIndex, $fSearchText)); | |
| 86 | - $main->setCentralPayload($oPatternCustom); | |
| 87 | - $main->render(); | |
| 88 | - | |
| 89 | - } else if (strlen($fDocumentID) > 0) { | |
| 90 | - //echo "searching by document id"; | |
| 91 | - //the user was viewing a document, search in that document's folder | |
| 92 | - $oDocument = Document::get($fDocumentID); | |
| 93 | - require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); | |
| 94 | - $oPatternCustom = & new PatternCustom(); | |
| 95 | - $oPatternCustom->setHtml(getSeachResultsByFolder($oDocument->getFolderID(), $fStartIndex, $fSearchText)); | |
| 96 | - $main->setCentralPayload($oPatternCustom); | |
| 97 | - $main->render(); | |
| 98 | - } else { | |
| 99 | - //echo "searching by folder"; | |
| 100 | - //search from the root folder down i.e. all documents | |
| 101 | - $fFolderID = 1; | |
| 102 | - require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); | |
| 103 | - $oPatternCustom = & new PatternCustom(); | |
| 104 | - $oPatternCustom->setHtml(getSeachResultsByFolder($fFolderID, $fStartIndex, $fSearchText)); | |
| 105 | - $main->setCentralPayload($oPatternCustom); | |
| 106 | - $main->render(); | |
| 107 | - } | |
| 27 | + | |
| 28 | + if (strlen($fBrowseType) > 0) { | |
| 29 | + //the user was browsing by a specific type | |
| 30 | + switch ($fBrowseType) { | |
| 31 | + case "folder" : | |
| 32 | + //user was browsing a specific folder - search that folder | |
| 33 | + if (!$fFolderID) { | |
| 34 | + //start at the root folder | |
| 35 | + $fFolderID = 1; | |
| 36 | + } | |
| 37 | + require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); | |
| 38 | + $oPatternCustom = & new PatternCustom(); | |
| 39 | + $oPatternCustom->setHtml(getSeachResultsByFolder($fFolderID, $fStartIndex, $fSearchText)); | |
| 40 | + $main->setCentralPayload($oPatternCustom); | |
| 41 | + $main->render(); | |
| 42 | + break; | |
| 43 | + case "category" : | |
| 44 | + //user was browsing by category - search all documents in that category | |
| 45 | + if (!$fCategoryName) { | |
| 46 | + //no category name specified, so just start at the root folder | |
| 47 | + $fFolderID = 1; | |
| 48 | + } | |
| 49 | + require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); | |
| 50 | + $oPatternCustom = & new PatternCustom(); | |
| 51 | + $oPatternCustom->setHtml(getSearchResultsByCategory($fFolderID, $fSearchText, $fStartIndex, $fCategoryName)); | |
| 52 | + $main->setCentralPayload($oPatternCustom); | |
| 53 | + $main->render(); | |
| 54 | + break; | |
| 55 | + case "documentType" : | |
| 56 | + //echo "searching by documentType browseType"; | |
| 57 | + //user was browsing by document type - search all documents in that doc type | |
| 58 | + if (!$fDocTypeID) { | |
| 59 | + //no document type specified, so just start at the root folder | |
| 60 | + $fFolderID = 1; | |
| 61 | + } | |
| 62 | + require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); | |
| 63 | + $oPatternCustom = & new PatternCustom(); | |
| 64 | + $oPatternCustom->setHtml(getSearchResultsByDocumentType($fFolderID, $fSearchText, $fStartIndex, $fDocTypeID)); | |
| 65 | + $main->setCentralPayload($oPatternCustom); | |
| 66 | + $main->render(); | |
| 67 | + break; | |
| 68 | + default: | |
| 69 | + //search from the root folder down i.e. all documents | |
| 70 | + break; | |
| 71 | + } | |
| 72 | + } else if (strlen($fFolderID) > 0) { | |
| 73 | + //the user was browsing a folder, search that folder | |
| 74 | + //echo "searching by folder id"; | |
| 75 | + require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); | |
| 76 | + $oPatternCustom = & new PatternCustom(); | |
| 77 | + $oPatternCustom->setHtml(getSeachResultsByFolder($fFolderID, $fStartIndex, $fSearchText)); | |
| 78 | + $main->setCentralPayload($oPatternCustom); | |
| 79 | + $main->render(); | |
| 80 | + | |
| 81 | + } else if (strlen($fDocumentID) > 0) { | |
| 82 | + //echo "searching by document id"; | |
| 83 | + //the user was viewing a document, search in that document's folder | |
| 84 | + $oDocument = Document::get($fDocumentID); | |
| 85 | + require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); | |
| 86 | + $oPatternCustom = & new PatternCustom(); | |
| 87 | + $oPatternCustom->setHtml(getSeachResultsByFolder($oDocument->getFolderID(), $fStartIndex, $fSearchText)); | |
| 88 | + $main->setCentralPayload($oPatternCustom); | |
| 89 | + $main->render(); | |
| 90 | + } else { | |
| 91 | + //echo "searching by folder"; | |
| 92 | + //search from the root folder down i.e. all documents | |
| 93 | + $fFolderID = 1; | |
| 94 | + require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); | |
| 95 | + $oPatternCustom = & new PatternCustom(); | |
| 96 | + $oPatternCustom->setHtml(getSeachResultsByFolder($fFolderID, $fStartIndex, $fSearchText)); | |
| 97 | + $main->setCentralPayload($oPatternCustom); | |
| 98 | + $main->render(); | |
| 99 | + } | |
| 108 | 100 | } |
| 109 | 101 | //echo "not searching" |
| 110 | 102 | ?> | ... | ... |