Files
eapim-admin/WebContent/jsp/common/screen/main.jsp
T
2026-06-04 18:11:31 +09:00

192 lines
7.1 KiB
Plaintext

<%@ page contentType="text/html; charset=utf-8"%>
<%@page import="com.eactive.eai.rms.common.util.StringUtils"%>
<%@page import="com.eactive.eai.rms.env.EmsConfig"%>
<%@page import="com.eactive.eai.common.util.SystemUtil"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<%@ include file="/jsp/common/include/localemessage.jsp" %>
<c:set var="themeColor" value="<%=System.getProperty(\"theme.color\")%>" scope="session" />
<%
String topPage = request.getContextPath() + StringUtils.defaultString((String) request.getAttribute("topPage"), "/top_04.do");
String mainPage = StringUtils.defaultString((String) request.getAttribute("mainPage"), "");
String menuId = StringUtils.defaultString((String) request.getAttribute("menuId"), "");
if (!"".equals(mainPage)) {
topPage = topPage + "?mainPage=" + mainPage;
}
if(!"".equals(menuId)) {
if(topPage.contains("?")) {
topPage += "&menuId=" + menuId;
} else {
topPage += "?menuId=" + menuId;
}
}
//2020.04.28 탭에 서버 구분표시 김소희차장님 요청반영
String systemModeTitle = SystemUtil.getSystemModeTitle();
String drmode = System.getProperty(EmsConfig.DR_MODE);
if("Y".equals(drmode)){
systemModeTitle = "[DR] ";
}
%>
<!DOCTYPE html>
<html>
<head>
<title><%= systemModeTitle %><%= localeMessage.getString("screen.title") %></title>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="icon" href="<c:url value="/img/ic_eai_favi_${themeColor}.png"/>" type="image/ico" sizes="16x16" />
<link rel="stylesheet" type="text/css" media="screen" href="<c:url value="/css/web_ui.css"/>"/>
<link rel="stylesheet" type="text/css" media="screen" href="<c:url value="/css/theme_${themeColor}.css"/>" />
<script language="javascript" src="<c:url value="/js/jquery-1.12.1.min.js"/>"></script>
<script language="javascript">
var $ = jQuery.noConflict();
var urlParam = window.document.location.search;
var mod = "";
var strServiceType = "<%=request.getParameter("serviceType")%>";
if(urlParam != ""){
if(urlParam.indexOf("mod=") > -1){
mod = urlParam.substring((urlParam.indexOf("mod=") + 4), urlParam.lastIndexOf("&"));
sessionStorage["mod"] = mod;
}
// 대시보드 상세화면으로부터 특정화면을 지정하여 Open 하는 경우.
// session에 저장되어 있는 serviceType과 화면 지정할 때 선택한 serviceType이 다른 경우
// 대시보드 상세화면에서 지정한 serviceType으로 session에 저장되어 있는 serviceType을 변경합니다.
if(strServiceType != "null" && sessionStorage["serviceType"] != strServiceType)
{
sessionStorage["serviceType"] = strServiceType;
}
}
$(document).ready(function() {
var url = '<%=topPage%>';
if (url.indexOf("?")>=0){
url = url + "&serviceType="+ sessionStorage["serviceType"];
}else{
url = url + "?serviceType="+ sessionStorage["serviceType"];
}
$("#topFrame").attr('src',url);
$(".topMenu").load(function(){ // iframe이 모두 load된후 제어
$(".topMenu").contents().find('.gnb').on("mouseenter", function(e){
$(".topMenu").css("height","450px");
});
$(".topMenu").contents().find('.gnb').on("mouseleave",function(e){
$(".topMenu").css("height","80px");
});
});
});
function changeLocale(lang){
console.log("lang : " + lang);
location.href = "/monitoring/main.do?lang="+lang;
}
</script>
</head>
<body>
<iframe class="topMenu" src="" id="topFrame" name="topFrame" scrolling="no" noresize="noresize"></iframe>
<iframe class="leftMenu" src="" name="leftFrame" scrolling="no" noresize="noresize"></iframe>
<iframe class="rightCon" src="" name="mainFrame" scrolling="auto"></iframe>
<%-- 자동 로그아웃 경고 모달 --%>
<div id="autoLogoutModal" style="display:none; position:fixed; top:0; left:0; width:100%; height:100%; background:rgba(0,0,0,0.5); z-index:99999;">
<div style="position:absolute; top:50%; left:50%; transform:translate(-50%,-50%); background:#fff; padding:30px 40px; border-radius:4px; text-align:center; min-width:320px; box-shadow:0 4px 20px rgba(0,0,0,0.3);">
<h3 style="margin:0 0 12px; color:#333; font-size:16px;">자동 로그아웃 안내</h3>
<p style="margin:0 0 22px; color:#666; font-size:14px;">
장시간 사용하지 않아 <strong><span id="autoLogoutSeconds">60</span>초</strong> 후 자동 로그아웃됩니다.
</p>
<button id="autoLogoutContinue" style="margin-right:8px; padding:8px 22px; background:#337ab7; color:#fff; border:none; border-radius:3px; cursor:pointer; font-size:13px;">계속 사용</button>
<button id="autoLogoutNow" style="padding:8px 22px; background:#d9534f; color:#fff; border:none; border-radius:3px; cursor:pointer; font-size:13px;">로그아웃</button>
</div>
</div>
<script type="text/javascript">
(function () {
var IDLE_MS = ${autoLogoutTimeout} * 60 * 1000; // 설정값(분) → ms
var WARN_MS = 60 * 1000; // 로그아웃 1분 전 경고
var CHECK_INTERVAL = 5000; // 5초 간격 체크
var countdownTimer = null;
/* sessionStorage: iframe 포함 모든 동일-origin 프레임과 공유 */
function getLastActivity() {
var t = sessionStorage.getItem('lastActivity');
return t ? parseInt(t, 10) : Date.now();
}
function markActivity() {
sessionStorage.setItem('lastActivity', String(Date.now()));
}
function resetTimer() {
markActivity();
if ($('#autoLogoutModal').is(':visible')) {
$('#autoLogoutModal').hide();
clearInterval(countdownTimer);
}
}
function showWarning(remainMs) {
var sec = Math.ceil(remainMs / 1000);
$('#autoLogoutSeconds').text(sec);
$('#autoLogoutModal').show();
clearInterval(countdownTimer);
countdownTimer = setInterval(function () {
sec--;
if (sec <= 0) {
clearInterval(countdownTimer);
doLogout();
} else {
$('#autoLogoutSeconds').text(sec);
}
}, 1000);
}
function doLogout() {
location.href = '<%=request.getContextPath()%>/rms/logout.do';
}
/* 상위 프레임(main.jsp) 활동 감지 */
['mousemove', 'keydown', 'click', 'touchstart'].forEach(function (e) {
document.addEventListener(e, markActivity, true);
});
/* 주기적 유휴 시간 체크 */
setInterval(function () {
var idle = Date.now() - getLastActivity();
var remain = IDLE_MS - idle;
if (remain <= 0) {
clearInterval(countdownTimer);
doLogout();
} else if (remain <= WARN_MS && !$('#autoLogoutModal').is(':visible')) {
showWarning(remain);
}
}, CHECK_INTERVAL);
/* 버튼 이벤트 */
$(document).on('click', '#autoLogoutContinue', function () {
resetTimer();
$.get('<%=request.getContextPath()%>/checkSession.do'); // 서버 세션도 갱신
});
$(document).on('click', '#autoLogoutNow', function () {
doLogout();
});
/* 페이지 로드 시 초기화 */
markActivity();
})();
</script>
</body>
</html>