메인 상단 : 카트 건수, 알림 건수 처리
This commit is contained in:
parent
b6ea928065
commit
b86bbfe97c
@ -14,7 +14,9 @@ import org.springframework.ui.ModelMap;
|
|||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
|
||||||
import nlib.cmm.NlibCommonController;
|
import nlib.cmm.NlibCommonController;
|
||||||
|
import nlib.cmm.service.NlibProperty;
|
||||||
import nlib.cmm.service.NotificationService;
|
import nlib.cmm.service.NotificationService;
|
||||||
|
import nlib.col.service.CartService;
|
||||||
import nlib.user.service.NlibLoginVO;
|
import nlib.user.service.NlibLoginVO;
|
||||||
import nlib.util.StringUtil;
|
import nlib.util.StringUtil;
|
||||||
|
|
||||||
@ -48,6 +50,9 @@ public class MainController extends NlibCommonController {
|
|||||||
@Resource(name="notificationService")
|
@Resource(name="notificationService")
|
||||||
private NotificationService notificationService;
|
private NotificationService notificationService;
|
||||||
|
|
||||||
|
@Resource(name = "cartService")
|
||||||
|
private CartService cartService;
|
||||||
|
|
||||||
@RequestMapping( {"/index.do"} )
|
@RequestMapping( {"/index.do"} )
|
||||||
public String setContent(
|
public String setContent(
|
||||||
HttpServletRequest req,
|
HttpServletRequest req,
|
||||||
@ -61,17 +66,50 @@ public class MainController extends NlibCommonController {
|
|||||||
|
|
||||||
log.debug((authentication == null ? "손님 메인 접속" : authentication.getName() + " 메인 접속"));
|
log.debug((authentication == null ? "손님 메인 접속" : authentication.getName() + " 메인 접속"));
|
||||||
|
|
||||||
|
return "nlib/cmm/home";
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping( {"/cmm/headerSubPart.do"} )
|
||||||
|
public String headerSub(
|
||||||
|
HttpServletRequest request,
|
||||||
|
HttpServletResponse response,
|
||||||
|
Authentication authentication,
|
||||||
|
ModelMap model) throws Exception {
|
||||||
|
|
||||||
|
// 캐쉬된 Reqeust 히스토리 삭제
|
||||||
|
RequestCache cache = new HttpSessionRequestCache();
|
||||||
|
cache.removeRequest(request, response);
|
||||||
|
|
||||||
|
log.debug((authentication == null ? "손님 메인 접속" : authentication.getName() + " 메인 접속"));
|
||||||
|
|
||||||
|
String mbInfoId = getMbInfoId(request);
|
||||||
|
|
||||||
|
// 카트 건수 확인
|
||||||
|
|
||||||
|
// 카트 목록 가져오기
|
||||||
|
int cartCnt = 0;
|
||||||
|
if(StringUtil.isEmpty(mbInfoId)) {
|
||||||
|
// 카트 건수
|
||||||
|
cartCnt = cartService.countCartItemsFromCookie(request, response, "1");
|
||||||
|
cartCnt += cartService.countCartItemsFromCookie(request, response, "2");
|
||||||
|
} else {
|
||||||
|
cartCnt = cartService.countCartItems(mbInfoId, "0");
|
||||||
|
}
|
||||||
|
|
||||||
// 알림 확인
|
// 알림 확인
|
||||||
String mbInfoId = getMbInfoId(req);
|
|
||||||
int unreadNotiCnt = 0;
|
int unreadNotiCnt = 0;
|
||||||
if(!isAlerted(req) && StringUtil.isNotEmpty(mbInfoId)) {
|
if(StringUtil.isNotEmpty(mbInfoId)) {
|
||||||
unreadNotiCnt = notificationService.countUnreadNotification(mbInfoId);
|
unreadNotiCnt = notificationService.countUnreadNotification(mbInfoId);
|
||||||
setAlerted(req, true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!isAlerted(request)) {
|
||||||
|
setAlerted(request, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
model.addAttribute("cartCnt", cartCnt);
|
||||||
model.addAttribute("unreadNotiCnt", unreadNotiCnt);
|
model.addAttribute("unreadNotiCnt", unreadNotiCnt);
|
||||||
|
|
||||||
return "nlib/cmm/home";
|
return "nlib/cmm/headerSubPart";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -5,76 +5,4 @@
|
|||||||
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
|
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
|
||||||
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags"%>
|
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags"%>
|
||||||
|
|
||||||
<!-- HOME -->
|
<jsp:include page="/cmm/headerSubPart.do" />
|
||||||
<%
|
|
||||||
String councilCd = (String)session.getAttribute("councilCd");
|
|
||||||
String councilNm = (String)session.getAttribute("councilNm");
|
|
||||||
%>
|
|
||||||
<script>
|
|
||||||
$(document).ready(function() {
|
|
||||||
$("#imgLogo").attr("src", "/images/logo/img-logo-${councilCd }.png");
|
|
||||||
$("#imgLogo").on("error", function() {
|
|
||||||
|
|
||||||
$("<span id='siteCouncilNm' name='siteCouncilNm'>${councilNm}</span>").insertBefore($("#siteCommonTitle"));
|
|
||||||
$("#siteCouncilNm").attr("style", "border-left:0px !important");
|
|
||||||
|
|
||||||
$(this).remove();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
</script>
|
|
||||||
<h2 class="blind">헤더영역</h2>
|
|
||||||
<div class="inner">
|
|
||||||
|
|
||||||
<h1><a href="javascript:void(0)" onclick="javascript:location.href='/';"><img namme="imgLogo" id="imgLogo" src=""><span name="siteCommonTitle" id="siteCommonTitle">소장자료관</span></a></h1>
|
|
||||||
|
|
||||||
<div class="search-wrap">
|
|
||||||
<h2 class="blind">검색</h2>
|
|
||||||
<form id="searchHeaderForm" name="searchHeaderForm" method="post" action="">
|
|
||||||
<fieldset>
|
|
||||||
<legend>검색</legend>
|
|
||||||
<div class="search-input">
|
|
||||||
<input type="text" placeholder="" title="검색어 입력" name="query" id="query" class="ark_query" value="" autocomplete="off">
|
|
||||||
<button type="button" class="btn-search" id="searchHeaderButton"><span>검색</span></button>
|
|
||||||
<!-- <button type="button" class="btn-search-detail" id="btn-search-detail-cl" onclick="javascript:fn_layerPop('${pageContext.request.contextPath}/search/getDetailedSearchFormPopup.do');">상세검색</button> -->
|
|
||||||
<button type="button" class="btn-search-detail" id="btn-search-detail-cl">상세검색</button>
|
|
||||||
</div>
|
|
||||||
<div class="condition_sear">
|
|
||||||
<select name="searchField" id="searchField1" class="sear_depth">
|
|
||||||
<option value="" selected="selected">전체</option>
|
|
||||||
<option value="TITLE">제목</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</fieldset>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="log">
|
|
||||||
<ul>
|
|
||||||
<sec:authorize access="not isAuthenticated()">
|
|
||||||
<li><!-- 개발자 확인용 타이틀 임시 추가 DDDDDDDDDDD -->
|
|
||||||
<a href="javascript:void(0)" onclick='fn_layerPopWithClass("/login/loginFormPopup.do", "pop-login")' title="${councilNm}(${councilCd})" class="login-btn">로그인</a></li>
|
|
||||||
</sec:authorize>
|
|
||||||
<sec:authorize access="isAuthenticated()">
|
|
||||||
<sec:authentication property="principal.name" var="userName" />
|
|
||||||
<sec:authentication property="principal.loginUserId" var="userId" />
|
|
||||||
|
|
||||||
<li><!-- 개발자 확인용 타이틀 임시 추가 DDDDDDDDDDD -->
|
|
||||||
<a href="javascript:void(0)" onclick="javascript:location.href='${pageContext.request.contextPath}/logout';"
|
|
||||||
title="${userId} - ${councilNm} (${councilCd})" class="login-btn">
|
|
||||||
${userName}님 로그아웃</a>
|
|
||||||
</li>
|
|
||||||
</sec:authorize>
|
|
||||||
|
|
||||||
<li><a href="javascript:void(0)" class="member-btn">회원증</a></li>
|
|
||||||
<sec:authorize access="isAuthenticated()">
|
|
||||||
<li><a href="javascript:void(0)" onclick="javascript:location.href='${pageContext.request.contextPath}/cmm/listNotifications.do';" class="noti-btn">알림(<span class="count">10</span>)</a></li>
|
|
||||||
</sec:authorize>
|
|
||||||
<li><a href="javascript:void(0)" onclick="javascript:location.href='${pageContext.request.contextPath}/cart/listCartItems.do';">카트(<span class="count">10</span>)</a></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
|
|
||||||
</script>
|
|
||||||
|
|||||||
@ -19,6 +19,20 @@
|
|||||||
<put-attribute name="footer" value="/WEB-INF/tiles/inc-popup/footer-popup.jsp" />
|
<put-attribute name="footer" value="/WEB-INF/tiles/inc-popup/footer-popup.jsp" />
|
||||||
</definition>
|
</definition>
|
||||||
|
|
||||||
|
<!-- 다른화면에 포함되는 화면용 -->
|
||||||
|
<definition name="sub" template="/WEB-INF/tiles/tiles-layout-sub.jsp">
|
||||||
|
<put-attribute name="header" value="/WEB-INF/tiles/inc-sub/header-sub.jsp" />
|
||||||
|
<put-attribute name="footer" value="/WEB-INF/tiles/inc-sub/footer-sub.jsp" />
|
||||||
|
</definition>
|
||||||
|
|
||||||
|
<definition name="*/*SubPart" extends="sub">
|
||||||
|
<put-attribute name="main" value="/WEB-INF/jsp/{1}/{2}SubPart.jsp" />
|
||||||
|
</definition>
|
||||||
|
|
||||||
|
<definition name="*/*/*SubPart" extends="sub">
|
||||||
|
<put-attribute name="main" value="/WEB-INF/jsp/{1}/{2}/{3}SubPart.jsp" />
|
||||||
|
</definition>
|
||||||
|
|
||||||
<definition name="*/*Popup" extends="popup">
|
<definition name="*/*Popup" extends="popup">
|
||||||
<put-attribute name="main" value="/WEB-INF/jsp/{1}/{2}Popup.jsp" />
|
<put-attribute name="main" value="/WEB-INF/jsp/{1}/{2}Popup.jsp" />
|
||||||
</definition>
|
</definition>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user