<%@ page language="java" contentType="text/html; charset=utf-8"%>
<%@ page import="java.io.*"%>
<%@ 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" %>
<%
	response.setHeader("Pragma", "No-cache");
	response.setHeader("Cache-Control", "no-cache");
	response.setHeader("Expires", "0");
%>
<%@page import="com.eactive.eai.rms.common.util.CommonConstants"%>
<%
String ServerUrl =  "server.url" + CommonConstants.SERVER_TYPE;
%>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<jsp:include page="/jsp/common/include/css.jsp"/>
<jsp:include page="/jsp/common/include/script.jsp"/>

<script language="javascript" >
var url      = '<c:url value="/common/acl/audit/auditLogMan.json" />';
var url_view = '<c:url value="/common/acl/audit/auditLogMan.view" />';
var isDetail = false;

function isValid(){
	if($('input[name=logSeqNo]').val() == ""){
		alert("<%= localeMessage.getString("role.checkRequired1") %>");
		return false;
	}
	return true;
}

function init(key,callback){
	if(typeof callback === 'function') {
		callback(key);
	}
}

function detail(key){
	if (!isDetail)return;
	$.ajax({  
		type : "POST",
		url:url,
		dataType:"json",
		data:{cmd: 'DETAIL', logSeqNo : key},
		success:function(json){
			var data = json;

		    $('#logSeqNo').val(data.id);
	        $('#logamndHMS').val(data.lastModifiedDate);
	        $('#userId').val(data.userId);
	        $('#systemCode').val(data.systemCode);
	        $('#logTypeText').val(data.logTypeText);
	        $('#remoteAddress').val(data.remoteAddress);
	        $('#logSubMsg').val(data.command);
	        $('#parameters').val(data.parameters);

	        // 사유(message)는 값이 있을 때만 노출
	        if (data.message) {
	        	$('#logMsg').val(data.message);
	        	$('#messageRow').show();
	        } else {
	        	$('#logMsg').val('');
	        	$('#messageRow').hide();
	        }

		},
		error:function(e){
			alert(e.responseText);
		}
	});

}
$(document).ready(function() {	
	var returnUrl = getReturnUrlForReturn();
	
	var key ="${param.logSeqNo}";
	if (key != "" && key !="null"){
		isDetail = true;
	}

	init(key,detail);
	
	$("#btn_previous").click(function(){
		goNav(returnUrl);//LIST로 이동
	});
	
	
	buttonControl(isDetail);
});
 
</script>
</head>
	<body>
		<div class="right_box">
			<div class="content_top">
				<ul class="path">
					<li><a href="#">${rmsMenuPath}</a></li>					
				</ul>					
			</div><!-- end content_top -->
			<div class="content_middle">
				<div class="search_wrap">				
					<img src="<c:url value="/img/btn_previous.png"/>" alt="" id="btn_previous" level="R" status="DETAIL"/>						
				</div>
				<div class="title"><%= localeMessage.getString("auditLogMan.title") %></div>	
				
				<form id="ajaxForm">
					<table class="table_row" cellspacing="0">
						<tr>
							<th style="width:180px;"><%= localeMessage.getString("auditLogMan.logSeqNo") %></th><td><input type="text" id="logSeqNo" name="logSeqNo" readonly="readonly"/> </td>
						</tr>
						<tr>
							<th><%= localeMessage.getString("auditLogMan.logamndHMS") %></th><td><input type="text" id="logamndHMS"  name="logamndHMS" readonly="readonly"/></td>
						</tr>
						<tr>
							<th><%= localeMessage.getString("auditLogMan.userId") %></th><td><input type="text"  id="userId" name="userId" readonly="readonly"/></td>
						</tr>
						<tr>
							<th><%= localeMessage.getString("auditLogMan.systemCode") %></th><td><input type="text"  id="systemCode" name="systemCode" readonly="readonly"/></td>
						</tr>
						<tr>
							<th><%= localeMessage.getString("auditLogMan.logTypeText") %></th><td><input type="text"  id="logTypeText" name="logTypeText" readonly="readonly"/></td>
						</tr>
						<tr>
							<th><%= localeMessage.getString("auditLogMan.remoteAddress") %></th><td><input type="text"  id="remoteAddress" name="remoteAddress" readonly="readonly"/></td>
						</tr>
						<tr>
							<th><%= localeMessage.getString("auditLogMan.command") %></th><td><input type="text"  id="logSubMsg" name="logSubMsg" readonly="readonly"/></td>
						</tr>
						<tr id="messageRow" style="display:none;">
							<th><%= localeMessage.getString("auditLogMan.message") %></th><td><textarea  id="logMsg" name="logMsg" style="width:100%;height:80px" readonly="readonly"></textarea></td>
						</tr>
						<tr height="100px">
							<th><%= localeMessage.getString("auditLogMan.parameters") %></th><td><textarea  id="parameters" name="parameters" style="width:100%;height:200px" readonly="readonly"></textarea></td>
						</tr>
					</table>
				</form>
				
			</div><!-- end content_middle -->
		</div><!-- end right_box -->	
	</body>
</html>

