mjon_git/src/main/webapp/WEB-INF/jsp/kopost/search/search.jsp
2023-06-12 11:15:02 +09:00

546 lines
22 KiB
Plaintext

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@page import="itn.let.solr.search.service.SearchService.SOLR_CORE"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags"%>
<%@ taglib prefix="ui" uri="http://egovframework.gov/ctl/ui"%>
<c:set var="solrCores" value="<%=SOLR_CORE.values()%>" />
<c:set var="FILE" value="<%=SOLR_CORE.FILE%>" />
<c:set var="WEBPAGE" value="<%=SOLR_CORE.WEBPAGE%>" />
<c:set var="BOARD" value="<%=SOLR_CORE.BOARD%>" />
<jsp:useBean id="now" class="java.util.Date" />
<head>
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<!-- <script src="http://code.jquery.com/jquery-1.10.2.js"></script> -->
<script src="https://code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
</head>
<body>
<section class="sub">
<div class="s_visual s_visual_img06">
<div class="textbar">
<p class="s_tit">통합검색</p>
<p class="s_text">우체국물류지원단의 통합검색을 보여드립니다</p>
</div>
</div>
<!--내용s-->
<div id="container">
<form name="frmSearch1" id="frmSearch1" method="get" action="/web/search/search.do" class="totalsh" onsubmit="return checkForm(this);">
<input type="hidden" name="prevQ" value="${param.q}" />
<input type="hidden" id="rangeView" name="rangeView" value="${param.rangeView}" />
<input type="hidden" id="detailYn" name="detailYn" value="" />
<input type="hidden" id="pageIndex" name="pageIndex" value="1" />
<input type="hidden" id="categoryData" name="categoryData" value="${param.categoryData}" />
<div class="all_search">
<div class="all_search_input">
<label for="q1">검색</label>
<input type="text" class="search_box" size="45" maxlength="200" placeholder="검색어를 입력해주세요" name="q" id="q1" value="${param.q}" />
<button class="sch_btn2" type="button" value="검색" onclick="search();">
<i class="fa fa-search" aria-hidden="true"></i>
</button>
<button type="button" id=a1 style="cursor: hand" onclick="style.display='none';b1.style.display='';c1.style.display=''" class="btn_more" value="상세검색">
상세검색 <i class="fa fa-caret-square-o-down" aria-hidden="true"></i>
</button>
<p class="check">
<label for="re">결과내 검색</label>
<input type="checkbox" name="re" id="re" value="Y" ${param.re eq 'Y' ? 'checked="checked"' : ''} /> 결과 내 재검색
</p>
</div>
<div class="search_more_wrap">
<div class="close_btn" id=b1 style="cursor: hand; display: none" onclick="style.display='none';a1.style.display='';c1.style.display='none'">
<img src="/img/us_close.png" alt="닫기">
</div>
<div class="content" id=c1 style="display: none">
<table class="more_search_table">
<!-- <tr>
<th>검색어</th>
<td colspan="3"><input type="text" class="width_100" maxlength="200" placeholder="검색어를 입력해주세요" value=""></td>
</tr> -->
<tr>
<th>검색대상</th>
<td colspan="3">
<ul>
<c:forEach var="c" items="${paramValues.category}" varStatus="s">
<c:choose>
<c:when test="${c eq '주요사업'}"><c:set var="c1" value="checked='checked'" /></c:when>
<c:when test="${c eq '참여마당'}"><c:set var="c2" value="checked='checked'" /></c:when>
<c:when test="${c eq '알림마당'}"><c:set var="c3" value="checked='checked'" /></c:when>
<c:when test="${c eq '열린경영'}"><c:set var="c4" value="checked='checked'" /></c:when>
<c:when test="${c eq '기관소개'}"><c:set var="c5" value="checked='checked'" /></c:when>
<c:otherwise><c:set var="c0" value="checked='checked'" /></c:otherwise>
</c:choose>
</c:forEach>
<li><label for="category0">전체</label><input type="checkbox" id="category0" name="category" value="" ${c0}> 전체</li>
<li><label for="category1">주요사업</label><input type="checkbox" class="otherCategory" id="category1" name="category" value="주요사업" ${c1} /> 주요사업</li>
<li><label for="category2">참여마당</label><input type="checkbox" class="otherCategory" id="category2" name="category" value="참여마당" ${c2} /> 참여마당</li>
<li><label for="category3">알림마당</label><input type="checkbox" class="otherCategory" id="category3" name="category" value="알림마당" ${c3} /> 알림마당</li>
<li><label for="category4">열린경영</label><input type="checkbox" class="otherCategory" id="category4" name="category" value="열린경영" ${c4} /> 열린경영</li>
<li><label for="category5">기관소개</label><input type="checkbox" class="otherCategory" id="category5" name="category" value="기관소개" ${c5} /> 기관소개</li>
</ul>
</td>
</tr>
<tr>
<th>검색기간</th>
<td>
<ul>
<li><label for="all">전체</label><input type="radio" name="date" id="all" value="" ${empty param.date ? 'checked="checked"' : ''} /> 전체</li>
<li><label for="1d">1일</label><input type="radio" name="date" id="1d" value="1d" ${param.date eq '1d' ? 'checked="checked"' : ''} /> 1일</li>
<li><label for="1w">1주</label><input type="radio" name="date" id="1w" value="1w" ${param.date eq '1w' ? 'checked="checked"' : ''} /> 1주</li>
<li><label for="1m">1개월</label><input type="radio" name="date" id="1m" value="1m" ${param.date eq '1m' ? 'checked="checked"' : ''} /> 1개월</li>
<li><label for="3m">3개월</label><input type="radio" name="date" id="3m" value="3m" ${param.date eq '3m' ? 'checked="checked"' : ''} /> 3개월</li>
<li><label for="6m">6개월</label><input type="radio" name="date" id="6m" value="6m" ${param.date eq '6m' ? 'checked="checked"' : ''} /> 6개월</li>
</ul>
</td>
<th>기간설정</th>
<td class="set_period">
<label for="sdate">시작</label><input type="text" id="sdate" name="sdate" value="${param.sdate}" />
<button name="달력" onClick="calendar(event, 'sdate')"><i class="fa fa-calendar" aria-hidden="true"></i></button> ~
<label for="edate">끝</label><input type="text" id="edate" name="edate" value="${param.edate}" />
<button name="달력" onClick="calendar(event, 'start_date2')"><i class="fa fa-calendar" aria-hidden="true"></i></button>
</tr>
</table>
<ul class="all_search_btn">
<li><button type="button" class="btn btn_b02" value="상세검색" onclick="detailSearch();"><i class="fa fa-search" aria-hidden="true"></i> 상세검색</button></li>
<li><button type="button" class="btn" onclick="location.href='/web/search/search.do'" value="초기화"><i class="fa fa-undo" aria-hidden="true"></i> 초기화</button></li>
</ul>
</div>
</div>
</div>
</form>
<form name="frmSearch2" id="frmSearch2" method="post" action="/web/search/search.do">
<input type="hidden" id="rangeView" name="rangeView" value="${param.rangeView}" />
<input name="q" id="q" value="${param.q}" type="hidden">
<input name="re" id="re" value="${param.re}" type="hidden">
<input type="hidden" name="prevQ" value="${param.q}" />
</form>
<c:set var="boardList" value="${resultMap['board']}" />
<c:set var="webpageList" value="${resultMap['webpage']}" />
<c:set var="fileList" value="${resultMap['file']}" />
<c:choose>
<c:when test="${empty param.rangeView}"><c:set var="allCurrent" value="current" /></c:when>
<c:when test="${'board' eq param.rangeView}"><c:set var="boardCurrent" value="current" /></c:when>
<c:when test="${'file' eq param.rangeView}"><c:set var="fileCurrent" value="current" /></c:when>
<c:when test="${'webpage' eq param.rangeView}"><c:set var="webpageCurrent" value="current" /></c:when>
<c:otherwise><c:set var="c0" value="checked='checked'" /></c:otherwise>
</c:choose>
<ul class="tab tab_wid4">
<li class="${allCurrent}" data-tab="tab1">전체<span>(${totalCount}건)</span></li>
<li class="${boardCurrent}" data-tab="tab2">게시판<span>(${resultCntMap['board']}건)</span></li>
<li class="${webpageCurrent}" data-tab="tab3">정보화면<span>(${resultCntMap['webpage']}건)</span></li>
<li class="${fileCurrent}" data-tab="tab4">파일<span>(${resultCntMap['file']}건)</span></li>
</ul>
<c:if test="${empty param.rangeView}">
<div class="tabcontent ${allCurrent}" id="tab1">
<div class="search_all_list">
<c:if test="${not empty totalCount}">
"<span>${param.q}</span>" 에 대한 검색결과가 총 ${totalCount}건이 있습니다.
</c:if>
<c:if test="${empty totalCount}">
검색된 결과가 없습니다.
</c:if>
</div>
<div class="search_all_wrap">
<div class="search_all_tt_box">
<div class="search_all_title">게시판(${resultCntMap['board']}건)</div>
<c:if test="${empty param.rangeView}">
<div class="search_all_more">
<a href="javascript:void(0);" onclick="searchTab('board');">결과 더보기</a>
</div>
</c:if>
</div>
<c:if test="${fn:length(boardList) eq 0}">
<ul class="search_all_board">
<li class="no">검색결과가 없습니다.</li>
</ul>
</c:if>
<c:forEach var="result" items="${boardList}" varStatus="sts">
<ul class="search_all_board" onclick="location.href='${result.url}'">
<li class="tt"><c:out value="${empty result.nttSjHl ? result.nttSj : result.nttSjHl}" escapeXml="false"/></li>
<li class="content">
<c:if test="${empty result.hl}">
<c:set var="text">${result.text}</c:set>
<c:out value="${text}" escapeXml="true" />
</c:if>
<c:if test="${not empty result.hl}">${result.hl}</c:if>
</li>
<li class="navi">${fn:replace(result.menuCours, '|', ' > ') }</li>
<li class="date"><fmt:formatDate value="${result.frstRegistPnttm}" pattern="yyyy-MM-dd"/></li>
</ul>
</c:forEach>
</div>
<div class="search_all_wrap">
<div class="search_all_tt_box">
<div class="search_all_title">정보화면 (${resultCntMap['webpage']}건)</div>
<c:if test="${empty param.rangeView}">
<div class="search_all_more">
<a href="javascript:void(0);" onclick="searchTab('webpage');">결과 더보기</a>
</div>
</c:if>
</div>
<c:if test="${fn:length(webpageList) eq 0}">
<ul class="search_all_board">
<li class="no">검색결과가 없습니다.</li>
</ul>
</c:if>
<c:forEach var="result" items="${webpageList}" varStatus="sts">
<ul class="search_all_board" onclick="location.href='${result.url}'">
<li class="tt">${result.menuNm}</li>
<li class="content">
<c:if test="${empty result.hl}">
<c:set var="text">${result.text}</c:set>
<c:out value="${text}" escapeXml="true" />
</c:if>
<c:if test="${not empty result.hl}">${result.hl}</c:if>
</li>
<li class="navi">${fn:replace(result.menuCours, '|', ' > ') }</li>
<li class="date"><fmt:formatDate value="${result.frstRegistPnttm}" pattern="yyyy-MM-dd"/></li>
</ul>
</c:forEach>
</div>
<div class="search_all_wrap">
<div class="search_all_tt_box">
<div class="search_all_title">첨부파일 (${resultCntMap['file']}건)</div>
<c:if test="${empty param.rangeView}">
<div class="search_all_more">
<a href="javascript:void(0);" onclick="searchTab('file');">결과 더보기</a>
</div>
</c:if>
</div>
<c:if test="${fn:length(fileList) eq 0}">
<ul class="search_all_board">
<li class="no">검색결과가 없습니다.</li>
</ul>
</c:if>
<c:forEach var="result" items="${fileList}" varStatus="sts">
<ul class="search_all_board" onclick="location.href='${result.url}'">
<li class="tt"><c:out value="${result.orignlFileNm}" escapeXml="false"/></li>
<li class="content">
<c:if test="${empty result.hl}">
<c:set var="text">${result.text}</c:set>
<c:out value="${text}" escapeXml="true" />
</c:if>
<c:if test="${not empty result.hl}">${result.hl}</c:if>
</li>
<li class="navi">${fn:replace(result.menuCours, '|', ' > ') }</li>
<li class="date"><fmt:formatDate value="${result.frstRegistPnttm}" pattern="yyyy-MM-dd"/></li>
</ul>
</c:forEach>
</div>
</div>
</c:if>
<c:if test="${empty param.rangeView or param.rangeView eq 'board'}">
<div class="tabcontent ${boardCurrent}" id="tab2">
<div class="search_all_wrap">
<div class="search_all_tt_box">
<div class="search_all_title">게시판(${resultCntMap['board']}건)</div>
<c:if test="${empty param.rangeView}">
<div class="search_all_more">
<a href="javascript:void(0);" onclick="searchTab('board');">결과 더보기</a>
</div>
</c:if>
</div>
<c:if test="${fn:length(boardList) eq 0}">
<ul class="search_all_board">
<li class="no">검색결과가 없습니다.</li>
</ul>
</c:if>
<c:forEach var="result" items="${boardList}" varStatus="sts">
<ul class="search_all_board" onclick="location.href='${result.url}'">
<li class="tt"><c:out value="${empty result.nttSjHl ? result.nttSj : result.nttSjHl}" escapeXml="false"/></li>
<li class="content">
<c:if test="${empty result.hl}">
<c:set var="text">${result.text}</c:set>
<c:out value="${text}" escapeXml="true" />
</c:if>
<c:if test="${not empty result.hl}">${result.hl}</c:if>
</li>
<li class="navi">${fn:replace(result.menuCours, '|', ' > ') }</li>
<li class="date"><fmt:formatDate value="${result.frstRegistPnttm}" pattern="yyyy-MM-dd"/></li>
</ul>
</c:forEach>
</div>
</div>
</c:if>
<c:if test="${empty param.rangeView or param.rangeView eq 'webpage'}">
<div class="tabcontent ${webpageCurrent}" id="tab3">
<div class="search_all_wrap">
<div class="search_all_tt_box">
<div class="search_all_title">정보화면(${resultCntMap['webpage']}건)</div>
<c:if test="${empty param.rangeView}">
<div class="search_all_more">
<a href="javascript:void(0);" onclick="searchTab('webpage');">결과 더보기</a>
</div>
</c:if>
</div>
<c:if test="${fn:length(webpageList) eq 0}">
<ul class="search_all_board">
<li class="no">검색결과가 없습니다.</li>
</ul>
</c:if>
<c:forEach var="result" items="${webpageList}" varStatus="sts">
<ul class="search_all_board" onclick="location.href='${result.url}'">
<li class="tt"><c:out value="${empty result.nttSjHl ? result.nttSj : result.nttSjHl}" escapeXml="false"/></li>
<li class="content">
<c:if test="${empty result.hl}">
<c:set var="text">${result.text}</c:set>
<c:out value="${text}" escapeXml="true" />
</c:if>
<c:if test="${not empty result.hl}">${result.hl}</c:if>
</li>
<li class="navi">${fn:replace(result.menuCours, '|', ' > ') }</li>
<li class="date"><fmt:formatDate value="${result.frstRegistPnttm}" pattern="yyyy-MM-dd"/></li>
</ul>
</c:forEach>
</div>
</div>
</c:if>
<c:if test="${empty param.rangeView or param.rangeView eq 'file'}">
<div class="tabcontent ${fileCurrent}" id="tab4">
<div class="search_all_wrap">
<div class="search_all_tt_box">
<div class="search_all_title">첨부파일(${resultCntMap['file']}건)</div>
<c:if test="${empty param.rangeView}">
<div class="search_all_more">
<a href="javascript:void(0);" onclick="searchTab('file');">결과 더보기</a>
</div>
</c:if>
</div>
<c:if test="${fn:length(fileList) eq 0}">
<ul class="search_all_board">
<li class="no">검색결과가 없습니다.</li>
</ul>
</c:if>
<c:forEach var="result" items="${fileList}" varStatus="sts">
<ul class="search_all_board" onclick="location.href='${result.url}'">
<li class="tt"><c:out value="${result.orignlFileNm}" escapeXml="false"/></li>
<li class="content">
<c:if test="${empty result.hl}">
<c:set var="text">${result.text}</c:set>
<c:out value="${text}" escapeXml="true" />
</c:if>
<c:if test="${not empty result.hl}">${result.hl}</c:if>
</li>
<li class="navi">${fn:replace(result.menuCours, '|', ' > ') }</li>
<li class="date"><fmt:formatDate value="${result.frstRegistPnttm}" pattern="yyyy-MM-dd"/></li>
</ul>
</c:forEach>
</div>
</div>
</c:if>
<c:if test="${not empty param.rangeView and totalRecordCount > 0}">
<!-- 페이징 -->
<div class="board_number">
<nav class="pg_wrap">
<ui:pagination paginationInfo="${paginationInfo}" type="imageWeb" jsFunction="searchList" />
</nav>
</div>
</c:if>
<!-- <link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<script src="http://code.jquery.com/jquery-1.10.2.js"></script>
<script src="http://code.jquery.com/ui/1.10.4/jquery-ui.js"></script> -->
<script>
$(function(){
$('#q1').autocomplete({
source: function(request, response) {
$.getJSON("/json/ajaxSuggest.do",
{
q: encodeURIComponent(request.term)
},
function(data) {
response(
$.map(data.resultList, function(item) {
return {
label: item,
value: item
}
})
);
});
},
minLength: 1,
select: function( event, ui ) {
console.log( ui.item ?
"Selected: " + ui.item.label :
"Nothing selected, input was " + this.value);
},
open: function() {
$( this ).removeClass( "ui-corner-all" ).addClass( "ui-corner-top" );
},
close: function() {
$( this ).removeClass( "ui-corner-top" ).addClass( "ui-corner-all" );
}
});
});
</script>
<script>
$(function() {
/*
$('ul.tab li').click(function() {
var activeTab = $(this).attr('data-tab');
$('ul.tab li').removeClass('current');
$('.tabcontent').removeClass('current');
$(this).addClass('current');
$('#' + activeTab).addClass('current');
});
*/
$('ul.tab li').click(function() {
if ($(this).attr('data-tab') == 'tab1') {
searchTab('');
}
else if ($(this).attr('data-tab') == 'tab2') {
searchTab('board');
}
else if ($(this).attr('data-tab') == 'tab3') {
searchTab('webpage');
}
else if ($(this).attr('data-tab') == 'tab4') {
searchTab('file');
}
});
var coreName = '';
<c:forEach var="core" items="${solrCores}" varStatus="status">
<c:if test="${core.value eq param.rangeView}">
coreName = '${core.name}';
</c:if>
</c:forEach>
var title = '통합검색(' + coreName + '목록) | 통합검색 ';
document.title = title;
var detailYn = '${param.detailYn}';
if ('Y' == detailYn) {
$('#a1').hide();
$('#b1').show();
$('#c1').show();
}
else {
$('#a1').show();
$('#b1').hide();
$('#c1').hide();
}
$(':checkbox[name=category]').click(function(){
var $category = $(this);
if ($category.attr('id') != 'category0' && $category.is(':checked')) {
$('#category0').prop('checked', false);
}
else if ($category.attr('id') == 'category0' && $category.is(':checked')) {
$('.otherCategory').prop('checked', false);
}
});
/*
var options = {
url: function(q) {
return "/web/search/ajaxSuggest.do?q=" + encodeURIComponent(q);
},
getValue: function(element) {
return element.name;
},
ajaxSettings: {
dataType: "json",
method: "POST",
data: {
dataType: "json"
}
},
preparePostData: function(data) {
data.q = $("#q1").val();
return data;
},
requestDelay: 400
};
$("#q1").easyAutocomplete(options); */
});
function paging(pageIndex) {
if (rangeView) {
$('#' + rangeView + 'PageIndex').val(pageIndex);
} else {
$('#pageIndex').val(pageIndex);
}
var frmNm = rangeView == '' ? frmSearch2 : rangeView + 'Frm';
$('#' + frmNm)[0].submit();
}
function checkForm(form) {
$('#pageIndex').val("1");
if (!form.q.value) {
alert("검색어를 입력하세요.");
$("#q1").focus();
return false;
}
var categoryData = '';
$(':checkbox[name=category]').each(function(i,e) {
if ($(e).is(':checked')) {
var comma = categoryData.length == 0 ? '' : ',';
if (e.value) {
categoryData += (comma+e.value);
}
}
});
$('#categoryData').val(categoryData);
return true;
}
function search() {
$('#detailYn').val("N");
$("#rangeView").val('');
$(':checkbox[name=category]').prop('checked', false);
$(':radio[name=date]').prop('checked', false);
$('#sdate').val('');
$('#edate').val('');
var form = document.frmSearch1;
if (checkForm(form)) {
form.submit();
}
}
function detailSearch() {
$('#detailYn').val("Y");
$("#rangeView").val('');
var form = document.frmSearch1;
if (checkForm(form)) {
form.submit();
}
}
function searchTab(rv) {
$("#rangeView").val(rv);
$('#pageIndex').val("1");
var form = document.frmSearch1;
if (checkForm(form)) {
form.submit();
}
}
function searchList(pageNo) {
document.frmSearch1.pageIndex.value = pageNo;
document.frmSearch1.method = "get";
document.frmSearch1.action = "<c:url value='/web/search/search.do'/>";
document.frmSearch1.submit();
}
</script>
</div>
<!--내용e-->
</section>
</body>