<%@ page contentType="text/html; charset=GBK" session="false"%>

<%@ taglib uri="/cmsTag" prefix="cms"%>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>

		<%
			response.setHeader("Pragma", "No-cache");
			response.setHeader("Cache-Control", "no-cache");
			response.setDateHeader("Expires", 0);
		%>
		<title></title>
		<link rel="stylesheet" type="text/css" href="../../style/default/main.css" />
		<!--加载 js -->

		<script type="text/javascript" src="../javascript/commonUtil.js"></script>




		<!--加载 js 结束 -->


	</head>

	<body>




		<form method="post" action="../../publish/generateContent.cmd" id="generateForm" name="generateForm">
			<input type="hidden" id="siteId" name="siteId" value="1" />
			<input type="hidden" id="classIdInfo" name="classIdInfo" />
			<input type="hidden" id="staticType" name="staticType" />
			
		</form>

		<input type="button" value=" 首 页 静 态 化" onClick="javascript:submitGenerateHomePageForm();" />
		<input type="button" value=" 栏 目 静 态 化" onClick="javascript:submitGenerateClassForm();" />
		<input type="button" value="内 容 静 态 化  " onClick="javascript:submitGenerateContentForm();" />
		<input type="button" value="整 体 静 态 化 " onClick="javascript:submitGenerateAllForm();" />
		
		<input type="button" value="指定的内容ID范围" onClick="javascript:submitGenerateAllForm();" />
		<input type="button" value="指定内容添加时间范围" onClick="javascript:submitGenerateAllForm();" />

		<div id='content'>
			<cms:SystemClassList type="all">

				<table width="100%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="b5d6e6">
					<tr>

						<td width="2%" height="22" background="images/bg.gif" bgcolor="#FFFFFF">
							<div align="center">
								<input type="checkbox" class="classCheck" id="selectAll" name="selectAll" value="selectAll" onclick="regCheckBox(this);" />
							</div>
						</td>

						<td width="32%" height="22" background="images/bg.gif" bgcolor="#FFFFFF">
							<div align="center">
								<span class="STYLE1">栏目名</span>
							</div>
						</td>
						<td width="12%" height="22" background="images/bg.gif" bgcolor="#FFFFFF">
							<div align="center">
								<span class="STYLE1">发布类型</span>
							</div>
						</td>
						<td width="27%" height="22" background="images/bg.gif" bgcolor="#FFFFFF">
							<div align="center">
								<span class="STYLE1">栏目静态URL风格</span>
							</div>
						</td>
						<td width="27%" height="22" background="images/bg.gif" bgcolor="#FFFFFF">
							<div align="center">
								<span class="STYLE1">内容静态URL风格</span>
							</div>
						</td>

					</tr>



					<cms:SysClass>
						<tr>

							<td height="20" bgcolor="#FFFFFF" style="margin-top: 10px;">
								<div align="center">
									<cms:if test="${Class.needStaticAction}">
										<input type="checkbox" id="${Class.classId}" name="checkClass" value="${Class.classId}#${Class.contentProduceType}#${Class.classProduceType}" onclick="regCheckBox(this);" />
									</cms:if>
								</div>
							</td>


							<td height="20" bgcolor="#FFFFFF" style="margin-top: 50px;">
								<div align="left">
									<span class="STYLE1">${Class.layerUIClassName}</span>
								</div>
							</td>
							<td height="40" bgcolor="#FFFFFF" style="margin-top: 10px;">
								<div align="center">
									<span class="STYLE1"> ${Class.produceTypeString}</span>
								</div>
							</td>
							<td height="20" bgcolor="#FFFFFF" style="margin-top: 10px;">
								<div align="center">
									<span class="STYLE1">/site/栏目ID.html</span>
								</div>
							</td>
							<td bgcolor="#FFFFFF" style="margin-top: 10px;">
								<div align="center">
									<span class="STYLE1">/site/栏目ID.html</span>
								</div>
							</td>

						</tr>

					</cms:SysClass>


				</table>

			</cms:SystemClassList>
		</div>

	</body>

</html>
<script type="text/javascript">

var checkedIdMap = new HashMapJs();

function submitGenerateHomePageForm()
{

  // document.getElementById("generateContentForm").action="../../engine/generateContent.cmd";
   document.getElementById("staticType").value=0;
  // document.getElementById("classIdInfo").value=checkedIdMap.allValueToString('&');
    
   document.getElementById("generateForm").submit();
   
}



function submitGenerateClassForm()
{
   if(!checkSelectCheckBox())
   {
      alert("请选择要操作的栏目");
      return;
   }
  // document.getElementById("generateContentForm").action="../../engine/generateContent.cmd";
   document.getElementById("staticType").value=1;
   document.getElementById("classIdInfo").value=checkedIdMap.allValueToString('&');
   document.getElementById("generateForm").submit();
   
}

function submitGenerateContentForm()
{
  if(!checkSelectCheckBox())
   {
      alert("请选择要操作的栏目");
      return;
   }
  // document.getElementById("generateContentForm").action="../../engine/generateContent.cmd?";
  
   document.getElementById("staticType").value=2;
   document.getElementById("classIdInfo").value=checkedIdMap.allValueToString('&');
   document.getElementById("generateForm").submit();
   
}



function submitGenerateAllForm()
{

   if(!checkSelectCheckBox())
   {
      alert("请选择要操作的栏目");
      return;
   }
  
  // document.getElementById("generateContentForm").action="../../engine/generateContent.cmd";
   document.getElementById("classIdInfo").value=checkedIdMap.allValueToString('&');
   document.getElementById("staticType").value=3;
   document.getElementById("generateForm").submit();
   
}

function regCheckBox(cBox)
{
  if(cBox.id==="selectAll" && cBox.checked==true)
  {
      selectAll();
      return false;
  }
  
  if(cBox.id==="selectAll" && cBox.checked==false)
  {
      unSelectAll();
      return false;
  }
  
   
  if(cBox.checked)
  {
      //document.getElementById("classId").value=cBox.value;
      checkedIdMap.put(cBox.value,cBox.value);
  
  }
  else
  {
      checkedIdMap.remove(cBox.value,cBox.value);
      document.getElementById("selectAll").checked=false;
  }
  

   return false;
  
}

function checkSelectCheckBox()
{
   if(checkedIdMap.size()==0)
   {
      return false;
   }
   
   return true;

}

function selectAll()
{
   var checks = document.getElementsByName('checkClass');

   for(var i = 0; i < checks.length; i++)
   {
      checks[i].checked=true;  
      checkedIdMap.put(checks[i].value,checks[i].value);
        
   }
   checkedIdMap.remove('selectAll');
}

function unSelectAll()
{
   var checks = document.getElementsByName('checkClass');

   for(var i = 0; i < checks.length; i++)
   {
      checks[i].checked=false;
   }
   checkedIdMap.removeAll();

}



</script>
