<%@ page contentType="text/html; charset=GBK" session="false"%>
<%@ taglib uri="/cmsTag" prefix="cms"%>


<!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>
		<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
		<meta http-equiv="Content-Type" content="text/html; charset=gbk" />
		<link href="../style/blue/css/main.css" type="text/css" rel="stylesheet" />
		<link href="../style/blue/css/reset-min.css" rel="stylesheet" type="text/css" />
		<script type="text/javascript" src="../common/js/jquery-1.7.gzjs"></script>
		<script type="text/javascript" src="../javascript/commonUtil_src.js"></script>
	
		<script>
		basePath='<cms:BasePath/>';
		
		 var api = frameElement.api, W = api.opener; 
		 
         if("true"==="${param.fromFlow}")
         {     	 	
            	W.$.dialog(
			    { 
			   					title :'提示',
			    				width: '190px', 
			    				height: '60px', 
			                    lock: true, 
			                    parent:api,
			    				icon: '32X32/succ.png', 
			    				
			                    content: "编辑站群节点成功!",
	
			    				ok: function()
			    				{
			    					W.window.location.reload();
			    				}
				});      
         }
         
         var ref_flag=/^(\w){1,25}$/; 
         
         var ref_name = /^[\u0391-\uFFE5a-zA-Z\w-]{2,30}$/;
         
         var ref_url = /^http[s]?:\/\/([\w-]+\.)+[\w-]+([\w-./?%&=:]*)?$/;

         $(function()
		 {
		    validate('siteName',0,ref_name,'格式为文字,数字,上下划线(至少输入2字)');
 			validate('siteFlag',0,ref_flag,'格式为字母,数字,下划线');
 			validate('siteUrl',0,ref_url,'格式为合法的URL地址');	
	
		 })
    
      	</script>
	</head>
	<body>


		<table width="100%" border="0" cellspacing="0" cellpadding="0">
			<tr>
				<td align="left" valign="top">
					<!--main start-->
					<div class="addtit">
						<img src="../style/icons/sitemap-image.png" width="16" height="16" />节点信息
					</div>
					
					<cms:Site siteId="${param.siteId}">
					<form id="siteForm" name="siteForm" method="post">
						<table width="100%" border="0" cellpadding="0" cellspacing="0" class="form-table">
							
							<tr>
								<td width="23%" class="input-title">
									<strong>站点名称: 
								</td>
								<td class="td-input">
									<input id="siteName" name="siteName" type="text" class="form-input" size="60" value="${Site.siteName}"/>
									<span class="red">*</span><span class="ps"></span>
								</td>
							</tr>

							<tr>
								<td class="input-title">
									<strong>站点标识: 
								</td>
								<td class="td-input">
									<input id="siteFlag" name="siteFlag" type="text" class="form-input" size="60" value="${Site.siteFlag}" disabled/>
									<span class="red">*</span><span class="ps"></span>
								</td>
							</tr>
							
							<tr>
								<td class="input-title">
									<strong>域名: 
								</td>
								<td class="td-input">
									<input id="siteUrl" name="siteUrl" type="text" class="form-input" size="60" value="${Site.siteUrl}"/>
									<span class="red">*</span><span class="ps"></span>
								</td>
							</tr>




							<tr>
								<td class="input-title">
									<strong>站点描叙:</strong>
								</td>
								<td class="td-input">
									<textarea id="siteDesc" name="siteDesc" class="form-textarea" style="width:315px; height:50px;">${Site.siteDesc}</textarea>
							</tr>

							<tr>
								<td class="input-title">
									<strong>模板编码: 
								</td>
								<td class="td-input">
									<input type="radio" name="templateCharset" value="GBK" />
									GBK&nbsp;
									<input type="radio" name="templateCharset" value="UTF-8"/>
									UTF-8
								</td>
							</tr>

							


						</table>
						<!-- hidden -->
						<input type="hidden" id="siteId" name="siteId" value="${Site.siteId}" />
						
						<input type="hidden" id='siteUrlOld'  value='${Site.siteUrl}' />
					</form>
					<div style="height:16px"></div>
					 
					<div class="breadnavTab"  >
					<table width="100%" border="0" cellspacing="0" cellpadding="0" >
						<tr class="btnbg100">
							<td width="76%" class="input-title"></td>
							<td class="td-input">
								<a href="javascript:submitSiteForm();"  class="btnwithico"><img src="../style/icons/tick.png" width="16" height="16" /><b>确认&nbsp;</b> </a>
								<a href="javascript:close();"  class="btnwithico" onclick=""><img src="../style/icon/close.png" width="16" height="16"/><b>取消&nbsp;</b> </a>
							</td>
							<td valign="top">

							</td>
						</tr>
					</table>
					</div>


				</td>
			</tr>


			</tr>
		</table>
		<!--[if lt IE 7]>
        <script type="text/javascript" src="js/unitpngfix.js"></script>
<![endif]-->
	</body>
</html>
<script>  
 
initRadio('templateCharset','${Site.templateCharset}');

function close()
{
	api.close();
}

function submitSiteForm()
{
	var hasError = false;
	//系统信息字段验证
    var currError = submitValidate('siteName',0,ref_name,'格式为文字,数字,上下划线(至少输入2字)');
        
        if(currError)
        {
        	hasError = true;
        }
        
    currError = submitValidate('siteFlag',0,ref_flag,'格式为字母,数字,下划线');

   		if(currError)
        {
        	hasError = true;
        }
        
    currError = submitValidate('siteUrl',0,ref_url,'格式为合法的URL地址');

   		if(currError)
        {
        	hasError = true;
        }
    
    
    			
    if(hasError)
    {
    	$("#submitFormBut").removeAttr("disabled"); 
	    $("#submitFormImg").removeAttr("disabled"); 
	    
	    return;

	}
	
	//后台验证
	
		var siteUrl = $('#siteUrl').val();
		
		if( !$('#siteUrl').val().endWith( '/' ) )
        {
              siteUrl = $('#siteUrl').val() + '/';
        }

		if(siteUrl != $('#siteUrlOld').val())
        {			
			 
			
			var count = validateExistFlag('sysSiteUrl', siteUrl);
			
			if(count > 0)
			{
				hasError = true;
				showTips('siteUrl', '系统已存在此值，不可重复录入');
	
			}
			
			if(hasError)
		    {		    
			    return;
			}
		}

   var siteForm = document.getElementById('siteForm');
   siteForm.action="<cms:BasePath/>site/editSiteBaseInfo.cmd";
   siteForm.submit();
}

   
  
</script>
</cms:Site>
