Minahito
minah****@users*****
2006年 9月 1日 (金) 12:12:26 JST
Index: xoops2jp/html/modules/base/actions/SearchShowallbyuserAction.class.php diff -u xoops2jp/html/modules/base/actions/SearchShowallbyuserAction.class.php:1.1.2.3 xoops2jp/html/modules/base/actions/SearchShowallbyuserAction.class.php:1.1.2.4 --- xoops2jp/html/modules/base/actions/SearchShowallbyuserAction.class.php:1.1.2.3 Thu Jul 27 18:32:46 2006 +++ xoops2jp/html/modules/base/actions/SearchShowallbyuserAction.class.php Fri Sep 1 12:12:26 2006 @@ -29,7 +29,17 @@ return $ret; } + + function _doSearch(&$client, &$xoopsUser, &$params) + { + return $client->call('searchItemsOfUser', $params); + } + function _getMaxHit() + { + return LEGACY_SEARCH_SHOWALL_MAXHIT; + } + function executeViewIndex(&$controller, &$xoopsUser, &$render) { parent::executeViewIndex($controller, $xoopsUser, $render); Index: xoops2jp/html/modules/base/actions/SearchShowallAction.class.php diff -u xoops2jp/html/modules/base/actions/SearchShowallAction.class.php:1.1.2.3 xoops2jp/html/modules/base/actions/SearchShowallAction.class.php:1.1.2.4 --- xoops2jp/html/modules/base/actions/SearchShowallAction.class.php:1.1.2.3 Thu Jul 27 18:31:51 2006 +++ xoops2jp/html/modules/base/actions/SearchShowallAction.class.php Fri Sep 1 12:12:26 2006 @@ -30,17 +30,22 @@ return $ret; } + function _getMaxHit() + { + return LEGACY_SEARCH_SHOWALL_MAXHIT; + } + function executeViewIndex(&$controller, &$xoopsUser, &$render) { parent::executeViewIndex($controller, $xoopsUser, $render); - $prevStart = $this->mActionForm->get('start') - LEGACY_SEARCH_DEFAULT_OFFSET; + $prevStart = $this->mActionForm->get('start') - LEGACY_SEARCH_SHOWALL_MAXHIT; if ($prevStart < 0) { $prevStart = 0; } $render->setAttribute('prevStart', $prevStart); - $render->setAttribute('nextStart', $this->mActionForm->get('start') + LEGACY_SEARCH_DEFAULT_OFFSET); + $render->setAttribute('nextStart', $this->mActionForm->get('start') + LEGACY_SEARCH_SHOWALL_MAXHIT); } } Index: xoops2jp/html/modules/base/actions/SearchResultsAction.class.php diff -u xoops2jp/html/modules/base/actions/SearchResultsAction.class.php:1.1.2.7 xoops2jp/html/modules/base/actions/SearchResultsAction.class.php:1.1.2.8 --- xoops2jp/html/modules/base/actions/SearchResultsAction.class.php:1.1.2.7 Thu Aug 24 01:08:17 2006 +++ xoops2jp/html/modules/base/actions/SearchResultsAction.class.php Fri Sep 1 12:12:26 2006 @@ -4,7 +4,8 @@ require_once XOOPS_MODULE_PATH . "/base/forms/SearchResultsForm.class.php"; -define('LEGACY_SEARCH_DEFAULT_OFFSET', 20); +define('LEGACY_SEARCH_RESULT_MAXHIT', 5); +define('LEGACY_SEARCH_SHOWALL_MAXHIT', 20); class Legacy_SearchResultsAction extends Legacy_Action { @@ -41,13 +42,16 @@ return true; } + function _getMaxHit() + { + return LEGACY_SEARCH_RESULT_MAXHIT; + } + function getDefaultView(&$controller, &$xoopsUser) { $this->mActionForm->fetch(); $this->mActionForm->validate(); - $this->_makeModuleList($xoopsUser); - if ($this->mActionForm->hasError()) { return LEGACY_FRAME_VIEW_INDEX; } @@ -60,11 +64,28 @@ if (is_object($service)) { $client =& $root->mServiceManager->createClient($service); - $params['current_uid'] = is_object($xoopsUser) ? $xoopsUser->get('uid') : 0; + $this->mModules =& $client->call('getActiveModules', array()); $this->mActionForm->update($params); - $this->mSearchResults = $client->call('GetItems', $params['uid'], $params['current_uid'], $params['queries'], $params['andor'], $params['max_hit'], $params['offset'], $params['mids']); + $handler =& xoops_gethandler('module'); + foreach ($this->_getSelectedMids() as $mid) { + $t_module =& $handler->get($mid); + if (is_object($t_module)) { + $module = array(); + + $module['mid'] = $mid; + $module['name'] = $t_module->get('name'); + + $params['mid'] = $mid; + $module['results'] = $this->_doSearch($client, $xoopsUser, $params); + + if (count($module['results']) > 0) { + $module['has_more'] = (count($module['results']) >= $this->_getMaxHit()) ? true : false; + $this->mSearchResults[] = $module; + } + } + } } else { return LEGACY_FRAME_VIEW_ERROR; @@ -73,23 +94,9 @@ return LEGACY_FRAME_VIEW_INDEX; } - function _makeModuleList(&$xoopsUser) + function _doSearch(&$client, &$xoopsUser, &$params) { - // - // Make the module list for search form. - // - $groups = is_object($xoopsUser) ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS; - $handler = & xoops_gethandler( 'groupperm' ); - $mids = $handler->getItemIds('module_read', $groups); - - $handler =& xoops_gethandler('module'); - foreach ($mids as $mid) { - $module =& $handler->get($mid); - if ($module->get('isactive') && $module->get('hassearch')) { - $this->mModules[] =& $module; - } - unset($module); - } + return $client->call('searchItems', $params); } function execute(&$controller, &$xoopsUser) Index: xoops2jp/html/modules/base/actions/SearchAction.class.php diff -u xoops2jp/html/modules/base/actions/SearchAction.class.php:1.1.2.2 xoops2jp/html/modules/base/actions/SearchAction.class.php:1.1.2.3 --- xoops2jp/html/modules/base/actions/SearchAction.class.php:1.1.2.2 Thu Jul 27 18:32:51 2006 +++ xoops2jp/html/modules/base/actions/SearchAction.class.php Fri Sep 1 12:12:26 2006 @@ -1,7 +1,7 @@ <?php /** * @package Legacy - * @version $Id: SearchAction.class.php,v 1.1.2.2 2006/07/27 09:32:51 minahito Exp $ + * @version $Id: SearchAction.class.php,v 1.1.2.3 2006/09/01 03:12:26 minahito Exp $ */ if (!defined('XOOPS_ROOT_PATH')) exit(); @@ -13,7 +13,13 @@ { function getDefaultView(&$controller, &$xoopsUser) { - $this->_makeModuleList($xoopsUser); + $root =& $controller->mRoot; + $service =& $root->mServiceManager->getService("LegacySearch"); + if (is_object($service)) { + $client =& $root->mServiceManager->createClient($service); + + $this->mModules =& $client->call('getActiveModules', array()); + } return LEGACY_FRAME_VIEW_INDEX; } @@ -22,7 +28,7 @@ { $ret = array(); foreach(array_keys($this->mModules) as $key) { - $ret[] = $this->mModules[$key]->get('mid'); + $ret[] = $this->mModules[$key]['mid']; } return $ret;