<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" media="screen" href="/monitoring/addon/bootstrap.min.css" />
<link rel="stylesheet" type="text/css" media="screen" href="/monitoring/addon/codemirror/lib/codemirror.css" />
<link rel="stylesheet" type="text/css" media="screen" href="/monitoring/addon/codemirror/theme/dracula.css" />
<script src="/monitoring/addon/jquery-1.12.1.min.js"></script>
<script src="/monitoring/addon/bootstrap.min.js"></script>
<script src="/monitoring/addon/codemirror/lib/codemirror.js"></script>
<script src="/monitoring/addon/codemirror/mode/javascript/javascript.js"></script>
<script src="/monitoring/addon/codemirror/addon/edit/matchbrackets.js"></script>
<script src="/monitoring/addon/codemirror/addon/comment/comment.js"></script>
<script src="/monitoring/addon/codemirror/addon/comment/continuecomment.js"></script>

<link rel="stylesheet" type="text/css" media="screen" href="/monitoring/addon/codemirror/addon/lint/lint.css" />
<script src="/monitoring/addon/codemirror/addon/lint/lint.js"></script>
<script src="/monitoring/addon/codemirror/addon/lint/javascript-lint.js"></script>
<script src="/monitoring/addon/codemirror/addon/lint/json-lint.js"></script>
<title>EDIT MOCK FILES</title>
<style type="text/css">
.CodeMirror {
	font-size: 14px;
}
.title {
	font-size: 28px;
	font-weight: bold;
	margin-top: 5px;
	margin-bottom: 5px;
}
</style>
</head>
<body>
	<div class="container" style="width: 95%; height: 95%;">
		<div class="title">
			<span>JSON Content</span>
		</div>
		<div class="form-group">
			<div>
				<textarea id="contentText" class="form-control" readonly="readonly"></textarea>
			</div>
		</div>
	</div>
	<script>

	var editor;
	var activeFileName;
	
	function init() {
		
	}
	
	$(document).ready(function() {
		
		init();
		
		console.log('<%=request.getAttribute("jsonString")%>');
		
		var textArea = document.getElementById('contentText');
		
		editor = CodeMirror.fromTextArea(textArea, {
			lineNumbers : false,
			matchBrackets : true,
			autoCloseBrackets : true,
			readOnly : true,
			theme: 'dracula',
			mode : "application/json"
		});
		
		editor.setSize('100%', '100%');
		try {
			var jsonObj = JSON.parse(opener.window.document.getElementsByName('bzwkDataCtnt')[0].value);
			editor.getDoc().setValue(JSON.stringify(jsonObj, null, 2));
		} catch(error) {
			editor.getDoc().setValue('JSON 형식의 데이터가 아닙니다.');
		}
		
	});
	</script>
</body>
</html>