<?php 
class CActionBuildServer extends CActionBase
{
	function doAction()
	{
		$ret = 0;
		$job = $_POST["job"];
		switch($job)
		{
			case "add":
				$ret = $this->Add();
			break;
			case "mod":
				$ret = $this->Mod();
			break;
			case "del":
				$ret = $this->Del();
			break;
		}
		
		return $ret;
	}	
	
	function Add()
	{
		global $UserInfo;
		$svn_version = $_POST["svn_version"];
		$server_version = $_POST["server_version"];
		$client_version_min = $_POST["client_version_min"];
		$client_version_max = $_POST["client_version_max"];
		$build_id = $this->db->GetMaxField('tb_project_version', 'Build_id')+1;
		
		$sql = "insert into tb_project_version (Build_id, Project_id,Svn_version, Server_version, Client_version_min, Client_version_max, Comlie_user, Comlie_time,Complie_state) values (";
		$sql = $sql . $build_id . ",";
		$sql = $sql . "1,";
		$sql = $sql . "'".$svn_version."',";
		$sql = $sql . "'".$server_version."',";
		$sql = $sql . "'".$client_version_min."',";
		$sql = $sql . "'".$client_version_max."',";
		$sql = $sql . $UserInfo["UID"].", now(), 1)";
		
		$this->db->ExeSql($sql);
		return $build_id;
	}
	
	function Mod()
	{
		return 0;
	}
	
	function Del()
	{
		return 0;	
	}
	
};
?>
