<!DOCTYPE HTML>
<html>
<head>
<#include "/adminPage/common.html"/>
<style type="text/css">
.layui-form-label{
	width: 150px;
}
.layui-input-block{
	margin-left: 180px;
}
</style>
</head>
<body class="layui-layout-body">
	<div class="layui-layout layui-layout-admin">

		<#include "/adminPage/header.html"/>
		<#include "/adminPage/menu.html"/>

		<div class="layui-body">
			<!-- 内容主体区域 -->
			<div style="padding: 15px">
				<fieldset class="layui-elem-field layui-field-title">
					<legend>${menuStr.remote}</legend>
				</fieldset>

				<form action="${ctx}/adminPage/remote" id="searchForm" method="post">
					<div class="layui-form">
						<div class="layui-inline">
							<button type="button" class="layui-btn layui-btn-normal" onclick="add()">${remoteStr.add}</button>

							<button type="button" class="layui-btn" onclick="addGroup()">${remoteStr.addGroup}</button>

							<button type="button" class="layui-btn" onclick="cmdGroup()">${remoteStr.cmdGroup}</button>
							
							<button type="button" class="layui-btn layui-btn-normal" onclick="asycSelect()">${remoteStr.asycSelect}</button>
							
							<button type="button" class="layui-btn layui-btn-normal" onclick="nginxMonitor()">${remoteStr.nginxMonitor}</button>
						</div>
						
						<div class="layui-inline">
							<div class="layui-form-mid layui-word-aux">${remoteStr.tips}</div>
						</div>
						
						<input type="hidden" id="projectVersion" value="${projectVersion}">
					</div>
				</form>


				<table class="layui-table layui-form" id="tree-table">

				</table>
				
			</div>
		</div>
	</div>

	<div style="height: 0px; width: 0px; overflow: hidden;">
		<!-- 弹出框 -->
		<div class="layui-form" id="windowDiv" style="padding: 15px; display: none">
			<form id="addForm">
				<input type="hidden" name="id" id="id">
				<input type="hidden" name="remote" value="1">
				
				<div class="layui-form-item">
					<label class="layui-form-label">${remoteStr.alias}</label>
					<div class="layui-input-block">
						<input type="text" name="descr" id="descr" class="layui-input">
					</div>
				</div>

				<div class="layui-form-item">
					<label class="layui-form-label">${remoteStr.protocol}</label>
					<div class="layui-input-block">
						<select id="protocol" name="protocol">
							<option>http</option>
							<option>https</option>
						</select>
					</div>
				</div>


				<div class="layui-form-item">
					<label class="layui-form-label">${remoteStr.ip}</label>
					<div class="layui-input-block">
						<input type="text" name="ip" id="ip" class="layui-input">
					</div>
				</div>

				<div class="layui-form-item">
					<label class="layui-form-label">${remoteStr.port}</label>
					<div class="layui-input-block">
						<input type="number" name="port" id="port" class="layui-input">
					</div>
				</div>

				<div class="layui-form-item">
					<label class="layui-form-label">${remoteStr.name}</label>
					<div class="layui-input-block">
						<input type="text" name="name" id="name" class="layui-input">
					</div>
				</div>

				<div class="layui-form-item">
					<label class="layui-form-label">${remoteStr.pass}</label>
					<div class="layui-input-block">
						<input type="password" name="pass" id="pass" class="layui-input">
					</div>
				</div>
				

				<div class="layui-form-item">
					<label class="layui-form-label">${remoteStr.group}</label>
					<div class="layui-input-block">


						<div id="parentId"></div>
					</div>
				</div>

				<div class="layui-form-item">
					<input type="hidden" name="code" id="code"> 
					<input type="hidden" name="auth" id="auth"> 
					<button type="button" class="layui-btn layui-btn-normal" onclick="addOver()">${commonStr.submit}</button>
					<button type="button" class="layui-btn" onclick="layer.closeAll()">${commonStr.close}</button>
				</div>
			</form>
		</div>

		<div class="layui-form" id="groupDiv" style="padding: 15px; display: none">
			<form id="addGroupForm">
				<input type="hidden" name="id" id="groupId">

				<div class="layui-form-item">
					<label class="layui-form-label">${commonStr.name}</label>
					<div class="layui-input-block">
						<input type="text" name="name" id="groupName" class="layui-input">
					</div>
				</div>

				<div class="layui-form-item">
					<label class="layui-form-label">${remoteStr.groupParent}</label>
					<div class="layui-input-block">
						<div id="groupParentId"></div>
					</div>
				</div>


				<div class="layui-form-item">
					<button type="button" class="layui-btn layui-btn-normal" onclick="addGroupOver()">${commonStr.submit}</button>
					<button type="button" class="layui-btn" onclick="layer.closeAll()">${commonStr.close}</button>
				</div>
			</form>
		</div>

		<!-- 弹出框 -->
		<div class="layui-form" id="contentDiv" style="display: none">
			<input type="hidden" id="path" value="path">
			<textarea class="layui-textarea" id="content" style="height: 700px; width: 1200px; resize: none; background-color: #ededed;" readonly="readonly" spellcheck="false"></textarea>
		</div>


		<div class="layui-form" id="selectDiv" style="padding: 15px; display: none">
			<form id="asycForm">
				<div class="layui-form-item">
					<label class="layui-form-label">${remoteStr.serverFrom}</label>
					<div class="layui-input-block">
						<div id="remoteFromId"></div>
					</div>
				</div>
				
				<div class="layui-form-item">
					<label class="layui-form-label">${remoteStr.serverSelect}</label>
					<div class="layui-input-block">
						<div id="remoteSelectId"></div>
					</div>
				</div>

				<div class="layui-form-item">
					<button type="button" class="layui-btn layui-btn-normal" onclick="asycOver()">${remoteStr.asyc}</button>
					<button type="button" class="layui-btn" onclick="layer.closeAll()">${commonStr.close}</button>
				</div>
			</form>
		</div>
		
		
		<div class="layui-form" id="nginxDiv" style="padding: 15px; display: none">
			<div class="layui-form-item">
				<label class="layui-form-label">${remoteStr.email}</label>
				<div class="layui-input-inline">
					<input type="text" name="mail" id="mail" class="layui-input" placeholder="${remoteStr.mailMany}">
				</div>
				<div class="layui-input-inline" style="width: auto;">
					<button type="button" class="layui-btn layui-btn-normal" onclick="showSelectMail()">${remoteStr.setSmtp}</button>
				</div>
				<div class="layui-input-inline" style="width: auto;">
					<button type="button" class="layui-btn" onclick="testMail()">${remoteStr.testMail}</button>
				</div>
			</div>
			
			<div class="layui-form-item">
				<label class="layui-form-label">${remoteStr.nginxMonitor}</label>
				<div class="layui-input-inline">
					<select name="nginxMonitor" id="nginxMonitor">
						<option value="false">${commonStr.close}</option>
						<option value="true">${commonStr.open}</option>
					</select>
				</div>
			</div>

			<div class="layui-form-item">
				<button type="button" class="layui-btn layui-btn-normal" onclick="nginxOver()">${commonStr.ok}</button>
				<button type="button" class="layui-btn" onclick="layer.closeAll()">${commonStr.close}</button>
			</div>
		</div>
		


		<div class="layui-form" id="cmdDiv" style="padding: 15px; display: none">
			<form id="cmdForm">
				<div class="layui-form-item">
					<label class="layui-form-label">${remoteStr.server}</label>
					<div class="layui-input-block">
						<div id="remoteCmdSelectId"></div>
					</div>
				</div>

				<div class="layui-form-item" id="cmdDiv">
					<label class="layui-form-label">${remoteStr.cmd}</label>
					<div class="layui-input-block">
						<select name="cmd" lay-filter="cmd">
							<option value="check">${remoteStr.check}</option>
							<option value="replace">${remoteStr.replace}</option>
							<option value="reload">${remoteStr.reload}</option>
							<option value="start">${remoteStr.start}</option>
							<option value="stop">${remoteStr.stop}</option>
							<option value="update">${remoteStr.update}</option>
						</select>
					</div>
				</div>
				
				<div class="layui-form-item" id="intervalDiv" style="display: none;">
					<label class="layui-form-label">${remoteStr.interval}</label>
					<div class="layui-input-block">
						<input type="number" id="interval" name="interval" class="layui-input" value="1">
					</div>
				</div>
				
				
				<div class="layui-form-item">
					<button type="button" class="layui-btn layui-btn-normal" onclick="cmdOver()">${remoteStr.execute}</button>
					<button type="button" class="layui-btn" onclick="layer.closeAll()">${commonStr.close}</button>
				</div>
			</form>
		</div>
		
		<div class="layui-form" id="codeDiv" style="padding: 15px; display: none">
			<div class="layui-form-item" id="imgCode">
				<label class="layui-form-label">${loginStr.code}</label>
				<div class="layui-input-inline" style="width: 240px;">
					<input type="text" id="codeInput" class="layui-input" style="width: 100px;display: inline-block;">
					<img src="" id="codeImg" onclick="refreshCode('codeImg')">
				</div>
			</div>
			
			<div class="layui-form-item" id="authCode" >
				<label class="layui-form-label">${loginStr.authCode}</label>
				<div class="layui-input-inline" style="width: 240px;">
					<input type="text" id="authInput" class="layui-input" style="display: inline-block;">
				</div>
			</div>
			
			<div class="layui-form-item" style="text-align: right;">
				<button type="button" class="layui-btn layui-btn-normal" onclick="addOverSubmit()">${commonStr.submit}</button>
				<button type="button" class="layui-btn" onclick="layer.close(codeIndex)">${commonStr.close}</button>
			</div>
		</div>

	</div>

	
	<#include '/adminPage/script.html'/>
	<#include '/adminPage/select_mail.html'/>
	<script src="${ctx}/lib/auto-line-number/auto-line-number.js" type="text/javascript"></script>
	<script src="${ctx}/js/adminPage/remote/index.js?v=${jsrandom}" type="text/javascript"></script>
</body>


</html>