<?php
$server_version = $_REQUEST["server_version"];
//$server_version = str_replace(".", ";", $server_version);
if($server_version != 0)
{
	$objs = explode(".", $server_version, 3);
	$server_version = $objs[0].".".$objs[1].".".((int)$objs[2] + 1);
}
?>
<div id="div_form_build">
<form action="http://192.168.1.120/build.php" method=post name="form_build" target="submit_build">
<input type=hidden id="build_id" name="build_id" value="0">
<input type=hidden id="svn_version" name="svn_version" value="<?php echo $_REQUEST["svn_version"]?>">
<table border=0 cellspacing='1' cellpadding='0' width=100% bgcolor='#ffffff'>
	<tr bgcolor="#efefef" height=20>
		<td colspan=2>
			<b><span id="dept_form_desc">构建服务端版本</span></b>
			<hr size=1>
		</td>
	</tr>
	<tr>
		<td align=right width=120 bgcolor="#cccccc">版本号:&nbsp;</td>
		<td><input type=text id="server_version" name="server_version" class=box value='<?php echo $server_version?>'></td>
	</tr>
	<tr>
		<td align=right width=120 bgcolor="#cccccc">客户端版本_低:&nbsp;</td>
		<td><input type=text id="client_version_min" name="client_version_min" class=box value='0'></td>
	</tr>
	<tr>
		<td align=right width=120 bgcolor="#cccccc">客户端版本_高:&nbsp;</td>
		<td><input type=text id="client_version_max" name="client_version_max" class=box value='0'></td>
	</tr>
	<tr height=30>
		<td colspan=2 style="padding-left:100"  bgcolor="#cccccc">
				<input type=button value="开始构建" class=btn onclick="SubmitBuild()">
				&nbsp;&nbsp;&nbsp;&nbsp;
				<input type=button value=" 取消 " class=btn onclick="CloseDialog(0)">
		</td>
	</tr>
</table>
</form>
</div>

<div id="div_on_build" style="display:none">
	<b>构建服务端版本......</b>
	<hr size=1>
</div>

<iframe id="submit_build" name="submit_build" width=0 height=0>
</iframe>
<input type=button id="bt_finish_build"  value=" 编译完成 " class=button onclick="CloseDialog(1)" style="display:none">
<script>
	function SubmitBuild()
	{
		$.ajax({
			type: "POST",
			url: "../control/doaction.php",
			dataType: "text",
			data: { 
				action:"build_server",
				job:'add',
				svn_version:$("#svn_version").val(),
				server_version:$("#server_version").val(),
				client_version_min:$('#client_version_min').val(),
				client_version_max:$('#client_version_max').val()		
			},
			timeout: 1000,
			complete: function(){},
			success: function(data)
			{
				$('#build_id').val(parseInt(data));
				$("#div_form_build").css("display", "none");
				$("#div_on_build").css("display", "block");
				$("#bt_finish_build").css("display", "block");
				
				$("#submit_build").attr("width", 580);
				$("#submit_build").attr("height", 300);
				
				document.form_build.submit();
			}
		});
	}
	
</script>