mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-04 01:01:41 +09:00
Fix #2235 allow selecting searchable types in integration search module
This commit is contained in:
parent
9fae527d3f
commit
12a4f5ed77
7 changed files with 170 additions and 56 deletions
|
|
@ -31,9 +31,18 @@ class integration_searchAdminController extends integration_search
|
|||
$config->skin = Context::get('skin');
|
||||
$config->mskin = Context::get('mskin');
|
||||
$config->block_robots = Context::get('block_robots') === 'N' ? false : true;
|
||||
$config->target_types = [];
|
||||
$target_types = Context::get('target_types') ?? [];
|
||||
foreach (['document', 'comment', 'multimedia', 'file'] as $type)
|
||||
{
|
||||
$config->target_types[$type] = in_array($type, $target_types);
|
||||
}
|
||||
$config->target = Context::get('target');
|
||||
$config->target_module_srl = Context::get('target_module_srl');
|
||||
if(!$config->target_module_srl) $config->target_module_srl = '';
|
||||
if (!$config->target_module_srl)
|
||||
{
|
||||
$config->target_module_srl = '';
|
||||
}
|
||||
|
||||
$oModuleController = getController('module');
|
||||
$output = $oModuleController->insertModuleConfig('integration_search', $config);
|
||||
|
|
@ -56,13 +65,13 @@ class integration_searchAdminController extends integration_search
|
|||
|
||||
// Get skin information (to check extra_vars)
|
||||
$skin_info = $oModuleModel->loadSkinInfo($this->module_path, $config->skin);
|
||||
|
||||
|
||||
// Check received variables (delete the basic variables such as mo, act, module_srl, page)
|
||||
$obj = Context::getRequestVars();
|
||||
unset($obj->act);
|
||||
unset($obj->module_srl);
|
||||
unset($obj->page);
|
||||
|
||||
|
||||
// Separately handle if the extra_vars is an image type in the original skin_info
|
||||
if($skin_info->extra_vars)
|
||||
{
|
||||
|
|
@ -114,8 +123,8 @@ class integration_searchAdminController extends integration_search
|
|||
$obj->{$vars->name} = $filename;
|
||||
}
|
||||
}
|
||||
|
||||
// Serialize and save
|
||||
|
||||
// Serialize and save
|
||||
$config->skin_vars = serialize($obj);
|
||||
|
||||
$oModuleController = getController('module');
|
||||
|
|
|
|||
|
|
@ -146,6 +146,8 @@ class integration_searchView extends integration_search
|
|||
// Search by search tab
|
||||
$where = Context::get('where');
|
||||
Context::set('where', $where);
|
||||
$target_types = $config->target_types ?? ['document' => true, 'comment' => true, 'multimedia' => true, 'file' => true];
|
||||
Context::set('target_types', $target_types);
|
||||
|
||||
// Create integration search model object
|
||||
if($is_keyword)
|
||||
|
|
@ -159,31 +161,86 @@ class integration_searchView extends integration_search
|
|||
$search_target = Context::get('search_target');
|
||||
if(!in_array($search_target, array('title','content','title_content','tag'))) $search_target = 'title_content';
|
||||
Context::set('search_target', $search_target);
|
||||
|
||||
$output = $oIS->getDocuments($target, $module_srl_list, $search_target, $is_keyword, $page, 10);
|
||||
if ($target_types['document'])
|
||||
{
|
||||
$output = $oIS->getDocuments($target, $module_srl_list, $search_target, $is_keyword, $page, 10);
|
||||
}
|
||||
else
|
||||
{
|
||||
$output = new BaseObject;
|
||||
}
|
||||
Context::set('output', $output);
|
||||
$this->setTemplateFile("document", $page);
|
||||
break;
|
||||
case 'comment' :
|
||||
$output = $oIS->getComments($target, $module_srl_list, $is_keyword, $page, 10);
|
||||
if ($target_types['comment'])
|
||||
{
|
||||
$output = $oIS->getComments($target, $module_srl_list, $is_keyword, $page, 10);
|
||||
}
|
||||
else
|
||||
{
|
||||
$output = new BaseObject;
|
||||
}
|
||||
Context::set('output', $output);
|
||||
$this->setTemplateFile("comment", $page);
|
||||
break;
|
||||
case 'multimedia' :
|
||||
$output = $oIS->getImages($target, $module_srl_list, $is_keyword, $page,20);
|
||||
if ($target_types['multimedia'])
|
||||
{
|
||||
$output = $oIS->getImages($target, $module_srl_list, $is_keyword, $page,20);
|
||||
}
|
||||
else
|
||||
{
|
||||
$output = new BaseObject;
|
||||
}
|
||||
Context::set('output', $output);
|
||||
$this->setTemplateFile("multimedia", $page);
|
||||
break;
|
||||
case 'file' :
|
||||
$output = $oIS->getFiles($target, $module_srl_list, $is_keyword, $page, 20);
|
||||
if ($target_types['file'])
|
||||
{
|
||||
$output = $oIS->getFiles($target, $module_srl_list, $is_keyword, $page, 20);
|
||||
}
|
||||
else
|
||||
{
|
||||
$output = new BaseObject;
|
||||
}
|
||||
Context::set('output', $output);
|
||||
$this->setTemplateFile("file", $page);
|
||||
break;
|
||||
default :
|
||||
$output['document'] = $oIS->getDocuments($target, $module_srl_list, 'title_content', $is_keyword, $page, 5);
|
||||
$output['comment'] = $oIS->getComments($target, $module_srl_list, $is_keyword, $page, 5);
|
||||
$output['multimedia'] = $oIS->getImages($target, $module_srl_list, $is_keyword, $page, 5);
|
||||
$output['file'] = $oIS->getFiles($target, $module_srl_list, $is_keyword, $page, 5);
|
||||
if ($target_types['document'])
|
||||
{
|
||||
$output['document'] = $oIS->getDocuments($target, $module_srl_list, 'title_content', $is_keyword, $page, 5);
|
||||
}
|
||||
else
|
||||
{
|
||||
$output['document'] = new BaseObject;
|
||||
}
|
||||
if ($target_types['comment'])
|
||||
{
|
||||
$output['comment'] = $oIS->getComments($target, $module_srl_list, $is_keyword, $page, 5);
|
||||
}
|
||||
else
|
||||
{
|
||||
$output['comment'] = new BaseObject;
|
||||
}
|
||||
if ($target_types['multimedia'])
|
||||
{
|
||||
$output['multimedia'] = $oIS->getImages($target, $module_srl_list, $is_keyword, $page, 5);
|
||||
}
|
||||
else
|
||||
{
|
||||
$output['multimedia'] = new BaseObject;
|
||||
}
|
||||
if ($target_types['file'])
|
||||
{
|
||||
$output['file'] = $oIS->getFiles($target, $module_srl_list, $is_keyword, $page, 5);
|
||||
}
|
||||
else
|
||||
{
|
||||
$output['file'] = new BaseObject;
|
||||
}
|
||||
$output['trackback'] = new BaseObject;
|
||||
Context::set('search_result', $output);
|
||||
Context::set('search_target', 'title_content');
|
||||
|
|
|
|||
|
|
@ -10,7 +10,9 @@ $lang->msg_admin_not_enabled = 'The integrated search is not available. Please s
|
|||
$lang->is_result_text = 'There are <strong>%d</strong> result(s) for <strong>\'%s\'</strong>';
|
||||
$lang->multimedia = 'Images/Video';
|
||||
$lang->integration_search_block_robots = 'Block Robots';
|
||||
$lang->include_search_target = 'Search for selected modules';
|
||||
$lang->integration_search_target_types = 'Search Types';
|
||||
$lang->integration_search_target_modules = 'Search Modules';
|
||||
$lang->include_search_target = 'Search selected modules only';
|
||||
$lang->exclude_search_target = 'Exclude selected modules from search';
|
||||
$lang->is_search_option['document']['title_content'] = 'Subject+Content';
|
||||
$lang->is_search_option['document']['title'] = 'Subject';
|
||||
|
|
|
|||
|
|
@ -10,8 +10,10 @@ $lang->msg_admin_not_enabled = '통합 검색을 사용할 수 없습니다. 통
|
|||
$lang->is_result_text = '<strong>\'%s\'</strong>에 대한 검색결과 <strong>%d</strong>건';
|
||||
$lang->multimedia = '이미지/동영상';
|
||||
$lang->integration_search_block_robots = '로봇 접근 차단';
|
||||
$lang->include_search_target = '선택된 대상만 검색';
|
||||
$lang->exclude_search_target = '선택된 대상을 검색에서 제외';
|
||||
$lang->integration_search_target_types = '검색 대상 종류';
|
||||
$lang->integration_search_target_modules = '검색 대상 페이지';
|
||||
$lang->include_search_target = '선택한 모듈만 검색';
|
||||
$lang->exclude_search_target = '선택한 모듈을 검색에서 제외';
|
||||
$lang->is_search_option['document']['title_content'] = '제목+내용';
|
||||
$lang->is_search_option['document']['title'] = '제목';
|
||||
$lang->is_search_option['document']['content'] = '내용';
|
||||
|
|
|
|||
|
|
@ -2,14 +2,14 @@
|
|||
{@ $_loaded = true; }
|
||||
|
||||
<!--// 컬러셋 체크 -->
|
||||
<!--@if($module_info->colorset != "white")-->
|
||||
{@if(!is_object($module_info)) $module_info = new stdClass;}
|
||||
{@$module_info->colorset = "white"}
|
||||
<!--@if(!isset($module_info->colorset) || $module_info->colorset !== 'white')-->
|
||||
{@ $module_info = $module_info ?? new stdClass}
|
||||
{@ $module_info->colorset = 'white'}
|
||||
<!--@end-->
|
||||
|
||||
<!--// CSS 파일 로드 (컬러셋에 따라서) -->
|
||||
<!--@if($module_info->colorset == "white")-->
|
||||
<!--%import("white.css")-->
|
||||
<!--@if($module_info->colorset === 'white')-->
|
||||
<load target="white.css" />
|
||||
<!--@end-->
|
||||
|
||||
<div id="spot">
|
||||
|
|
@ -24,11 +24,28 @@
|
|||
</div>
|
||||
|
||||
<ul class="localNavigation">
|
||||
<li <!--@if(!$where)-->class="on"<!--@end-->><a href="{getAutoEncodedUrl('where','','page','','division','')}">{$lang->integration_search}</a></li>
|
||||
<li <!--@if($where=='document')-->class="on"<!--@end-->><a href="{getAutoEncodedUrl('where','document','page',1,'division','')}">{$lang->document}</a></li>
|
||||
<li <!--@if($where=='comment')-->class="on"<!--@end-->><a href="{getAutoEncodedUrl('where','comment','page',1,'division','')}">{$lang->comment}</a></li>
|
||||
<li cond="$trackback_module_exist" <!--@if($where=='trackback')-->class="on"<!--@end-->><a href="{getAutoEncodedUrl('where','trackback','page',1,'division','')}">{$lang->trackback}</a></li>
|
||||
<li <!--@if($where=='multimedia')-->class="on"<!--@end-->><a href="{getAutoEncodedUrl('where','multimedia','page',1,'division','')}">{$lang->multimedia}</a></li>
|
||||
<li <!--@if($where=='file')-->class="on"<!--@end-->><a href="{getAutoEncodedUrl('where','file','page',1,'division','')}">{$lang->file}</a></li>
|
||||
</ul>
|
||||
<li class="on"|cond="!$where">
|
||||
<a href="{getAutoEncodedUrl('where','','page','','division','')}">{$lang->integration_search}</a>
|
||||
</li>
|
||||
<!--@if($target_types['document'])-->
|
||||
<li class="on"|cond="$where=='document'">
|
||||
<a href="{getAutoEncodedUrl('where','document','page',1,'division','')}">{$lang->document}</a>
|
||||
</li>
|
||||
<!--@endif-->
|
||||
<!--@if($target_types['comment'])-->
|
||||
<li class="on"|cond="$where=='comment'">
|
||||
<a href="{getAutoEncodedUrl('where','comment','page',1,'division','')}">{$lang->comment}</a>
|
||||
</li>
|
||||
<!--@endif-->
|
||||
<!--@if($target_types['multimedia'])-->
|
||||
<li class="on"|cond="$where=='multimedia'">
|
||||
<a href="{getAutoEncodedUrl('where','multimedia','page',1,'division','')}">{$lang->multimedia}</a>
|
||||
</li>
|
||||
<!--@endif-->
|
||||
<!--@if($target_types['file'])-->
|
||||
<li class="on"|cond="$where=='file'">
|
||||
<a href="{getAutoEncodedUrl('where','file','page',1,'division','')}">{$lang->file}</a>
|
||||
</li>
|
||||
<!--@endif-->
|
||||
</ul>
|
||||
<!--@end-->
|
||||
|
|
|
|||
|
|
@ -1,25 +1,33 @@
|
|||
<!--#include("header.html")-->
|
||||
<include target="header.html" />
|
||||
|
||||
{@ $output = $search_result['document'] }
|
||||
<!--#include("document.html")-->
|
||||
<!--@if($output->data)-->
|
||||
<div class="isMore"><a href="{getAutoEncodedUrl('where','document','page',1)}">more</a></div>
|
||||
<!--@end-->
|
||||
<!--@if($target_types['document'])-->
|
||||
{@ $output = $search_result['document']}
|
||||
<include target="document.html" />
|
||||
<!--@if($output->data)-->
|
||||
<div class="isMore"><a href="{getAutoEncodedUrl('where','document','page',1)}">more</a></div>
|
||||
<!--@endif-->
|
||||
<!--@endif-->
|
||||
|
||||
{@ $output = $search_result['comment'] }
|
||||
<!--#include("comment.html")-->
|
||||
<!--@if($output->data)-->
|
||||
<div class="isMore"><a href="{getAutoEncodedUrl('where','comment','page',1)}">more</a></div>
|
||||
<!--@end-->
|
||||
<!--@if($target_types['comment'])-->
|
||||
{@ $output = $search_result['comment']}
|
||||
<include target="comment.html" />
|
||||
<!--@if($output->data)-->
|
||||
<div class="isMore"><a href="{getAutoEncodedUrl('where','comment','page',1)}">more</a></div>
|
||||
<!--@endif-->
|
||||
<!--@endif-->
|
||||
|
||||
{@ $output = $search_result['multimedia'] }
|
||||
<!--#include("multimedia.html")-->
|
||||
<!--@if($output->data)-->
|
||||
<div class="isMore"><a href="{getAutoEncodedUrl('where','multimedia','page',1)}">more</a></div>
|
||||
<!--@end-->
|
||||
<!--@if($target_types['multimedia'])-->
|
||||
{@ $output = $search_result['multimedia']}
|
||||
<include target="multimedia.html" />
|
||||
<!--@if($output->data)-->
|
||||
<div class="isMore"><a href="{getAutoEncodedUrl('where','multimedia','page',1)}">more</a></div>
|
||||
<!--@endif-->
|
||||
<!--@endif-->
|
||||
|
||||
{@ $output = $search_result['file'] }
|
||||
<!--#include("file.html")-->
|
||||
<!--@if($output->data)-->
|
||||
<div class="isMore"><a href="{getAutoEncodedUrl('where','file','page',1)}">more</a></div>
|
||||
<!--@end-->
|
||||
<!--@if($target_types['file'])-->
|
||||
{@ $output = $search_result['file']}
|
||||
<include target="file.html" />
|
||||
<!--@if($output->data)-->
|
||||
<div class="isMore"><a href="{getAutoEncodedUrl('where','file','page',1)}">more</a></div>
|
||||
<!--@endif-->
|
||||
<!--@endif-->
|
||||
|
|
|
|||
|
|
@ -34,16 +34,35 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="x_control-group">
|
||||
<label for="block_robots" class="x_control-label">{$lang->integration_search_block_robots}</label>
|
||||
<label class="x_control-label">{$lang->integration_search_block_robots}</label>
|
||||
<div class="x_controls">
|
||||
<select name="block_robots" id="block_robots">
|
||||
<option value="Y" selected="selected"|cond="!isset($config->block_robots) || $config->block_robots">{$lang->cmd_yes}</option>
|
||||
<option value="N" selected="selected"|cond="isset($config->block_robots) && !$config->block_robots">{$lang->cmd_no}</option>
|
||||
</select>
|
||||
<label for="block_robots_Y" class="x_inline">
|
||||
<input type="radio" name="block_robots" id="block_robots_Y" value="Y" checked="checked"|cond="!isset($config->block_robots) || $config->block_robots" /> {$lang->cmd_yes}
|
||||
</label>
|
||||
<label for="block_robots_N" class="x_inline">
|
||||
<input type="radio" name="block_robots" id="block_robots_N" value="N" checked="checked"|cond="isset($config->block_robots) && !$config->block_robots" /> {$lang->cmd_no}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="x_control-group">
|
||||
<label class="x_control-label">{$lang->target}</label>
|
||||
<label class="x_control-label">{$lang->integration_search_target_types}</label>
|
||||
<div class="x_controls">
|
||||
<label class="x_inline">
|
||||
<input type="checkbox" name="target_types[]" value="document" checked="checked"|cond="!isset($config->target_types) || !empty($config->target_types['document'])" /> {$lang->document}
|
||||
</label>
|
||||
<label class="x_inline">
|
||||
<input type="checkbox" name="target_types[]" value="comment" checked="checked"|cond="!isset($config->target_types) || !empty($config->target_types['comment'])" /> {$lang->comment}
|
||||
</label>
|
||||
<label class="x_inline">
|
||||
<input type="checkbox" name="target_types[]" value="multimedia" checked="checked"|cond="!isset($config->target_types) || !empty($config->target_types['multimedia'])" /> {$lang->multimedia}
|
||||
</label>
|
||||
<label class="x_inline">
|
||||
<input type="checkbox" name="target_types[]" value="file" checked="checked"|cond="!isset($config->target_types) || !empty($config->target_types['file'])" /> {$lang->file}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="x_control-group">
|
||||
<label class="x_control-label">{$lang->integration_search_target_modules}</label>
|
||||
<div class="x_controls">
|
||||
<select name="target">
|
||||
<option value="include">{$lang->include_search_target}</option>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue