diff --git a/presentation/lookAndFeel/knowledgeTree/search/standardSearchBL.php b/presentation/lookAndFeel/knowledgeTree/search/standardSearchBL.php index a21d43d..8f2122d 100644 --- a/presentation/lookAndFeel/knowledgeTree/search/standardSearchBL.php +++ b/presentation/lookAndFeel/knowledgeTree/search/standardSearchBL.php @@ -19,13 +19,16 @@ if (checkSession()) { require_once("$default->fileSystemRoot/lib/foldermanagement/Folder.inc"); require_once("$default->fileSystemRoot/lib/documentmanagement/Document.inc"); require_once("$default->fileSystemRoot/presentation/Html.inc"); - require_once("standardSearchUI.inc"); + require_once("standardSearchUI.inc"); + + //echo $fSearchText . "
" . $fFolderID; if (!isset($fStartIndex)) { $fStartIndex = 0; } //escape the search string - $fStandardSearchString = addslashes($fStandardSearchString); + //$fStandardSearchString = addslashes($fStandardSearchString); + if (strlen($fBrowseType) > 0) { //the user was browsing by a specific type @@ -34,11 +37,11 @@ if (checkSession()) { //user was browsing a specific folder - search that folder if (!$fFolderID) { //start at the root folder - $fFolderID = 0; + $fFolderID = 1; } require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); $oPatternCustom = & new PatternCustom(); - $oPatternCustom->setHtml(getSeachResultsByFolder($fFolderID, $fStartIndex, $fStandardSearchString)); + $oPatternCustom->setHtml(getSeachResultsByFolder($fFolderID, $fStartIndex, $fSearchText)); $main->setCentralPayload($oPatternCustom); $main->render(); break; @@ -46,11 +49,11 @@ if (checkSession()) { //user was browsing by category - search all documents in that category if (!$fCategoryName) { //no category name specified, so just start at the root folder - $fFolderID = 0; + $fFolderID = 1; } require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); $oPatternCustom = & new PatternCustom(); - $oPatternCustom->setHtml(getSearchResultsByCategory($fFolderID, $fStandardSearchString, $fStartIndex, $fCategoryName)); + $oPatternCustom->setHtml(getSearchResultsByCategory($fFolderID, $fSearchText, $fStartIndex, $fCategoryName)); $main->setCentralPayload($oPatternCustom); $main->render(); break; @@ -58,23 +61,24 @@ if (checkSession()) { //user was browsing by document type - search all documents in that doc type if (!$fDocTypeID) { //no document type specified, so just start at the root folder - $fFolderID = 0; + $fFolderID = 1; } require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); $oPatternCustom = & new PatternCustom(); - $oPatternCustom->setHtml(getSearchResultsByDocumentType($fFolderID, $fStandardSearchString, $fStartIndex, $fDocTypeID)); + $oPatternCustom->setHtml(getSearchResultsByDocumentType($fFolderID, $fSearchText, $fStartIndex, $fDocTypeID)); $main->setCentralPayload($oPatternCustom); $main->render(); break; default: //search from the root folder down i.e. all documents + echo "unknown search type"; break; } } else if (strlen($fFolderID) > 0) { //the user was browsing a folder, search that folder require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); $oPatternCustom = & new PatternCustom(); - $oPatternCustom->setHtml(getSeachResultsByFolder($fFolderID, $fStartIndex, $fStandardSearchString)); + $oPatternCustom->setHtml(getSeachResultsByFolder($fFolderID, $fStartIndex, $fSearchText)); $main->setCentralPayload($oPatternCustom); $main->render(); @@ -83,15 +87,16 @@ if (checkSession()) { $oDocument = Document::get($fDocumentID); require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); $oPatternCustom = & new PatternCustom(); - $oPatternCustom->setHtml(getSeachResultsByFolder($oDocument->getFolderID(), $fStartIndex, $fStandardSearchString)); + $oPatternCustom->setHtml(getSeachResultsByFolder($oDocument->getFolderID(), $fStartIndex, $fSearchText)); $main->setCentralPayload($oPatternCustom); $main->render(); } else { + echo "still searching by folder"; //search from the root folder down i.e. all documents - $fFolderID = 0; + $fFolderID = 1; require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); $oPatternCustom = & new PatternCustom(); - $oPatternCustom->setHtml(getSeachResultsByFolder($fFolderID, $fStartIndex, $fStandardSearchString)); + $oPatternCustom->setHtml(getSeachResultsByFolder($fFolderID, $fStartIndex, $fSearchText)); $main->setCentralPayload($oPatternCustom); $main->render(); } diff --git a/presentation/lookAndFeel/knowledgeTree/search/standardSearchUI.inc b/presentation/lookAndFeel/knowledgeTree/search/standardSearchUI.inc index a5086da..bda5214 100644 --- a/presentation/lookAndFeel/knowledgeTree/search/standardSearchUI.inc +++ b/presentation/lookAndFeel/knowledgeTree/search/standardSearchUI.inc @@ -30,7 +30,7 @@ function getSearchResultsByCategory($iFolderID, $sKeywords, $iStartIndex, $sCate "AND SL.name='Live' "; //only check in the parent_folder_ids if we're not searching from the //root folder down - if ($iFolderID != 0) { + if ($iFolderID != 1) { $sQuery .= "AND (F.parent_folder_ids LIKE '%,$iFolderID,%' OR F.id = $iFolderID) "; } $sQuery .= "AND DF.name LIKE 'Category' "; @@ -69,7 +69,7 @@ function getSearchResultsByDocumentType($iFolderID, $sKeywords, $iStartIndex, $i $sQuery .= "AND SL.name='Live' "; //only check in the parent_folder_ids if we're not searching from the //root folder down - if ($iFolderID != 0) { + if ($iFolderID != 1) { $sQuery .= "AND (F.parent_folder_ids LIKE '%,$iFolderID,%' OR F.id = $iFolderID) "; } $sQuery .= "ORDER BY score DESC"; @@ -101,11 +101,11 @@ function getSeachResultsByFolder($iFolderID, $iStartIndex, $sKeywords) { "AND SL.name='Live' "; //only check in the parent_folder_ids if we're not searching from the //root folder down - if ($iFolderID != 0) { + if ($iFolderID != 1) { $sQuery .= "AND (F.parent_folder_ids LIKE '%,$iFolderID,%' OR F.id = $iFolderID) "; } $sQuery .= "ORDER BY score DESC"; - + //var_dump($sQuery); $aColumns = array("folder_image_url", "document_name","score");