<%@ Page CodeFileBaseClass="IlgharCMS.Lib.AdminPageBase" %>
<%@ Register TagPrefix="IlgharUC" TagName="Ime" Src="../../ime.dwt.ascx"%>
<%@ Register TagPrefix="IlgharUC" TagName="LanguageMenu" Src="../../language_menu.dwt.ascx"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!-- TemplateInfo codeOutsideHTMLIsLocked="true" -->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>添加服务器</title>
<ilghar:Comment><link rel="stylesheet" type="text/css" href="../../S01/CHS/css/common.css" /></ilghar:Comment>
<link rel="stylesheet" href="<%=CssPath%>common.css" />
<script type="text/javascript" src="<%=CommonPath%>ajax.js"></script>
<script type="text/javascript" src="<%=JsPath%>common.js"></script>
<ilgharUC:Ime Ime="true" Eot="true" runat="server" />
<script type="text/javascript">
function XmlHttpCallBack(xmlHttp)
{
	if (xmlHttp.status == 200)
		alert("添加成功！");
	else
		alert("添加失败！请查看日志！");

	document.getElementById("Submit").disabled = false;
}

function OnSubmit(form)
{
	if (form.Name.value == "")
	{
		alert("名称不能空！");
		form.Name.select();
		return false;
	}
	
	if (!form.MaxHostCount.value.match(/^\d+$/))
	{
		alert("最大虚拟主机个数格式不正确！");
		form.MaxHostCount.select();
		return false;
	}
	
	if (form.HostDefaultDomain.value == "")
	{
		alert("虚拟主机默认域名不能空！");
		form.HostDefaultDomain.select();
		return false;
	}
	
	if (!form.HostPortBase.value.match(/^\d+$/))
	{
		alert("虚拟主机基端口格式不正确！");
		form.HostPortBase.select();
		return false;
	}
	
	var data = "Name=" + encodeURIComponent(form.Name.value);
	data += "&IP=" + encodeURIComponent(form.IP.value);
	data += "&AllowCreateHost=" + document.getElementById("AllowCreateHostYes").checked;
	data += "&HostFolder=" + encodeURIComponent(form.HostFolder.value);
	data += "&MaxHostCount=" + encodeURIComponent(form.MaxHostCount.value);
	data += "&HostDefaultDomain=" + encodeURIComponent(form.HostDefaultDomain.value);
	data += "&HostPortBase=" + encodeURIComponent(form.HostPortBase.value);
	data += "&CMSFolder=" + encodeURIComponent(form.CMSFolder.value);
	data += "&DataFolder=" + encodeURIComponent(form.DataFolder.value);
	data += "&WebSiteFolder=" + encodeURIComponent(form.WebSiteFolder.value);
	
	document.getElementById("Submit").disabled = true;
	_ajax.Post("<%=WebPath%>ilghar.aspx?Lang=<%=ContentLang%>&Object=Server&Operation=Add", data, XmlHttpCallBack);
	return false;
}
</script>
</head>
<body>
<div class="WhiteHeader">
	<div class="Left"><img src="<%=ImagePath%>close_frame.gif" onclick="OpenCloseLeftFrame()" /></div>
	<div class="Title">添加服务器</div>
	<div class="Right">
		<ilgharUC:LanguageMenu runat="server" />
		<img height="15" src="<%=ImagePath%>dropdown.gif" onmouseover="this.src='<%=ImagePath%>dropdown_over.gif';ShowLanguageMenu(this);" onmouseout="this.src='<%=ImagePath%>dropdown.gif'" />
		语言：<%=CurrentLanguage%>
	</div>
</div>
<div class="Block">
	<ul class="TabMenu">
		<li class="Left"></li>
		<li class="Middle"><a href="list.aspx?Lang=<%=ContentLang%>">服务器列表</a></li>
		<li class="Right"></li>
		<li class="Left Selected"></li>
		<li class="Middle Selected">添加服务器</li>
		<li class="Right Selected"></li>
	</ul>
	<ul class="Title">
		<li class="Left"></li>
		<li class="Middle"></li>
		<li class="Right"></li>
	</ul>
	<form method="post" onsubmit="return OnSubmit(this)">
		<table border="0" cellpadding="4" cellspacing="1">
			<tbody>
				<tr>
					<th width="120">名称：</th>
					<td><input type="text" name="Name" maxlength="50" class="Text <%=ContentLang%>Font" /></td>
				</tr>
				<tr>
					<th>IP：</th>
					<td><input type="text" name="IP" maxlength="20" class="Text" /></td>
				</tr>
				<tr>
					<th>允许开通虚拟主机：</th>
					<td>
						<input type="radio" name="AllowCreateHost" id="AllowCreateHostYes" checked="checked" /><label for="AllowCreateHostYes">是</label>
						<input type="radio" name="AllowCreateHost" id="AllowCreateHostNo" /><label for="AllowCreateHostNo">否</label>
					</td>
				</tr>
				<tr>
					<th>虚拟主机存放目录：</th>
					<td><input type="text" name="HostFolder" size="30" maxlength="255" class="Text" /></td>
				</tr>
				<tr>
					<th>最大虚拟主机个数：</th>
					<td><input type="text" name="MaxHostCount" size="10" maxlength="10" class="Text" /></td>
				</tr>
				<tr>
					<th>虚拟主机默认域名：</th>
					<td><input type="text" name="HostDefaultDomain" size="30" maxlength="255" class="Text" />可以用星号（*）代替当前主机名称</td>
				</tr>
				<tr>
					<th>虚拟主机基端口：</th>
					<td><input type="text" name="HostPortBase" value="0" maxlength="255" class="Text" />设置0，则表示默认（80）</td>
				</tr>
				<tr>
					<th>CMS系统存放目录：</th>
					<td><input type="text" name="CMSFolder" size="30" maxlength="255" class="Text" /></td>
				</tr>
				<tr>
					<th>数据存放目录：</th>
					<td><input type="text" name="DataFolder" size="30" maxlength="255" class="Text" /></td>
				</tr>
				<tr>
					<th>网站存放目录：</th>
					<td><input type="text" name="WebSiteFolder" size="30" maxlength="255" class="Text" /></td>
				</tr>
			</tbody>
			<tfoot>
				<tr>
					<td colspan="2"><input type="submit" id="Submit" class="Button" value="添加" /></td>
				</tr>
			</tfoot>
		</table>
	</form>
	<div class="Footer"></div>
</div>
<script type="text/javascript">
HandleFake404();
</script>
</body>
</html>