<%@Page Language="C#" Inherits="IWMS.Admin.GatherRuleAdd" MasterPageFile="admin.master"%>
<asp:Content ContentPlaceHolderId="cphHead" runat="server">
	<style type="text/css">
	.numTable{
	  font-size:12px;
	  font-family:tahoma;
	  border:1 solid #999;
	  table-layout:fixed;
	  height:100%
	  }
	.numLine{
	  line-height:16px;
	  position:relative;
	  overflow:hidden;
	  height:120px;
	  padding-left:2;
	  }
	.numTextarea{
	  line-height:16px;
	  width:280px;
	  height:120px;
	  border:none;
	  border-top:1px solid #eee;
	  overflow:scroll;
	  word-wrap:normal;
	  <%if(Request.Browser.Browser=="AppleMAC-Safari"){%>
	  white-space:nowrap;
	  <%}%>
	  }
	</style>
	<script type="text/javascript" src="inc/PinYin.js"></script>
	<script type="text/javascript" src="inc/admin_articleadd.js"></script>
	<script type="text/javascript">
		<asp:Literal id="sortArr" runat="server"/>
	</script>
	<script type="text/javascript">
	<!--
	iwms.classID="<%=sortID.ClientID%>";
	function Export()
	{
		var id = parseInt("<%=Request.QueryString["id"]%>");
		var ifm = document.getElementById("ifm_export");
		if (id>0){
			ifm.src = "admin_export.aspx?id="+id+"&w=grule";
		}
		return false;
	}
	
	function WizardAdd(v_arr)
	{
		var o_arr = new Array("<%=name.ClientID%>", "<%=startUrl.ClientID%>", "<%=charset.ClientID%>",
					"<%=area.ClientID%>", "<%=list.ClientID%>", "<%=listNext.ClientID%>",
					"<%=title.ClientID%>", "<%=content.ClientID%>", "<%=author.ClientID%>",
					"<%=source.ClientID%>", "<%=time.ClientID%>", "<%=pageTitle.ClientID%>",
					"<%=nextPage.ClientID%>"
					);
		for (var i=0; i<o_arr.length; i++){
			document.getElementById(o_arr[i]).value = v_arr[i];
		}
	}
	-->
	</script>
	<%
	if(Request.Browser.Browser=="Firefox"){
		ad1.Attributes["wrap"]="off";
		ad2.Attributes["wrap"]="off";
	}
	%>

</asp:Content>

<asp:Content ContentPlaceHolderId="cphMain" runat="server">
	<form id="MyForm" runat="server">
		<asp:ValidationSummary 
			 DisplayMode="BulletList" 
			 EnableClientScript="true"
			 ShowSummary="false"
			 ShowMessageBox="true"
			 HeaderText="请正确填写以下内容"
			 runat="server"/>
	
	<div class="mframe">
	<div class="tl"></div>
	<div class="rt"></div>
	<div class="tm">
		<span class="tt"><asp:Literal id="titleAct" runat="server"/>新闻采集规则</span>
	</div>
	<div class="wrapper">
	<div class="ml"></div>
	<div class="mr"></div>
	<div class="mm">
		<asp:Label id="myLabel" class="msgBar" EnableViewState="false" runat="server"/>
		<fieldset>
		<legend>规则信息</legend>
		<table cellpadding="3" width="95%" align="center" >
		  <tr> 
		   <th width="120">
			采集名称：
		</th><td>
			<asp:TextBox Columns="30" MaxLength="100" id="name" runat="server"/>
			<asp:RequiredFieldValidator
				ControlToValidate="name"
				ErrorMessage="采集名必须填写"
				Display="None"
				runat="server"/>
			　(<a href="#" onclick="window.open('admin_gatherruleadd.htm','wizard','width=600,height=360,status=1');"><b>向导模式制作规则</b></a> | <a href="http://www.iwms.net/c52.aspx" target="_blank">下载更多采集规则</a>)
		</td></tr>
		<tr><th>	
			采集地址：
		</th><td>
			<asp:TextBox Columns="60" MaxLength="250" id="startUrl" runat="server"/>
			<asp:RequiredFieldValidator
				ControlToValidate="startUrl"
				ErrorMessage="采集地址必须填写"
				Display="None"
				runat="server"/>
		</td></tr>
		<tr><th>	
			入库分类：
		</th><td>
			<asp:DropDownList id="sortID"
				runat="server"/>
			<asp:RequiredFieldValidator
				ControlToValidate="sortID"
				ErrorMessage="入库分类必须选择"
				Display="None"
				runat="server"/>
		</td></tr>
		<tr><th>	
			网页编码：
		</th><td>
			<asp:DropDownList id="charset" runat="server">
				<asp:ListItem value="gb2312">GB2312</asp:ListItem>
				<asp:ListItem value="big5">BIG5</asp:ListItem>
				<asp:ListItem value="utf-8">UTF-8</asp:ListItem>
			</asp:DropDownList>
		</td></tr>
		<tr><th>	
			采集新闻数：
		</th><td>
			<asp:TextBox Columns="7" MaxLength="7" id="downNum" Style="text-align:right" Text="10" runat="server"/>
			<asp:RequiredFieldValidator
				ControlToValidate="downNum"
				ErrorMessage="采集数必须填写"
				Display="None"
				runat="server"/>
			<asp:RegularExpressionValidator
				ControlToValidate="downNum"
				ValidationExpression="\d+"
				ErrorMessage="采集数只能是数字"
				Display="None"
				runat="server"/>
			(采集数,不一定都入库)
		</td></tr>
		<tr><th>	
			不经过审核：
		</th><td>
			<asp:RadioButtonList id="passed" RepeatDirection="Horizontal" RepeatLayout="flow"
				runat="server">
				<asp:ListItem>是</asp:ListItem>
				<asp:ListItem Selected="true">否</asp:ListItem>
			</asp:RadioButtonList>
		</td></tr>
		<tr><th>	
			倒序采集：
		</th><td>
			<asp:RadioButtonList id="inverted" RepeatDirection="Horizontal" RepeatLayout="flow"
				runat="server">
				<asp:ListItem>是</asp:ListItem>
				<asp:ListItem Selected="true">否</asp:ListItem>
			</asp:RadioButtonList>
		</td></tr>
		<tr><th>	
			下载站外图片：
		</th><td>
			<asp:RadioButtonList id="downImg" RepeatDirection="Horizontal" RepeatLayout="flow"
				runat="server">
				<asp:ListItem>是</asp:ListItem>
				<asp:ListItem Selected="true">否</asp:ListItem>
			</asp:RadioButtonList>
		</td></tr>
		<tr><th>	
			下载图片加水印：
		</th><td>
			<asp:RadioButtonList id="imgMark" RepeatDirection="Horizontal" RepeatLayout="flow"
				runat="server">
				<asp:ListItem>是</asp:ListItem>
				<asp:ListItem Selected="true">否</asp:ListItem>
			</asp:RadioButtonList>
		</td></tr>
		<tr><th>	
			生成标题图片：
		</th><td>
			<asp:RadioButtonList id="autoTitleImg" RepeatDirection="Horizontal" RepeatLayout="flow"
				runat="server">
				<asp:ListItem>是</asp:ListItem>
				<asp:ListItem Selected="true">否</asp:ListItem>
			</asp:RadioButtonList>
		</td></tr>
		<tr><th>	
			采集为站外链接：
		</th><td>
			<asp:RadioButtonList id="linkOut" RepeatDirection="Horizontal" RepeatLayout="flow"
				runat="server">
				<asp:ListItem>是</asp:ListItem>
				<asp:ListItem Selected="true">否</asp:ListItem>
			</asp:RadioButtonList>
		</td></tr>
		<tr><th>	
			新闻可评论：
		</th><td>
			<asp:RadioButtonList id="allowRemark" RepeatDirection="Horizontal" RepeatLayout="flow"
				runat="server">
				<asp:ListItem>是</asp:ListItem>
				<asp:ListItem Selected="true">否</asp:ListItem>
			</asp:RadioButtonList>
		</td></tr>
		<tr><th>	
			重复标题不添加：
		</th><td>
			<asp:RadioButtonList id="checkDuplicate" RepeatDirection="Horizontal" RepeatLayout="flow"
				runat="server">
				<asp:ListItem>是</asp:ListItem>
				<asp:ListItem Selected="true">否</asp:ListItem>
			</asp:RadioButtonList>
			<span class="explain">相同地址和标题不采集，只判断一个月内添加内容</span>
		</td></tr>
		<tr><th>	
			从内容生成简介：
		</th><td>
			<asp:RadioButtonList id="makeSummary" RepeatDirection="Horizontal" RepeatLayout="flow"
				runat="server">
				<asp:ListItem>是</asp:ListItem>
				<asp:ListItem Selected="true">否</asp:ListItem>
			</asp:RadioButtonList>
		</td></tr>
		<tr><th>	
			采集新闻标题含：
		</th><td>
			<asp:TextBox Columns="40" MaxLength="250" id="titleInclude" runat="server"/>
			<span class="explain">多个使用,分隔</span>
		</td></tr>
		<tr><th>	
			采集新闻标题不含：
		</th><td>
			<asp:TextBox Columns="40" MaxLength="250" id="titleExclude" runat="server"/>
			<span class="explain">多个使用,分隔</span>
		</td></tr>
		<tr><th>代理服务器：
		</th>
		<td>
			<asp:TextBox id="proxy"
				Columns="20"
				title="如:http://proxyadress.com:8080"
				runat="server"
				/>
			用户名 <asp:TextBox id="proxyUsername" Columns="10" runat="server"/>
			密码  <asp:TextBox id="proxyPassword" Columns="10" textmode="Password" runat="server"/>
		</td></tr>
		<tr><td colspan="2" align="right"><a href="#top">↑Top</a></td></tr>
		</table>
		</fieldset>
		
		<fieldset>
		<legend>列表匹配规则</legend>
		 <table cellpadding="3" width="95%" align="center" >
		<tr><th>	
			新闻列表范围：
		</th><td>
			<asp:TextBox size="60" id="area" runat="server"/>(捕获组area)
		</td></tr>
		<tr><th>	
			新闻链接：
		</th><td>
			<asp:TextBox size="60" id="list" runat="server"/>(捕获组url)
			<asp:RequiredFieldValidator
				ControlToValidate="list"
				ErrorMessage="新闻链接规则必须填写"
				Display="None"
				runat="server"/>
		</td></tr>
		<tr><th>	
			新闻列表下一页：
		</th><td>
			<asp:TextBox size="60" id="listNext" runat="server"/>(捕获组url)
		</td></tr>
		</table>
		</fieldset>
		
		<fieldset>
		<legend>新闻匹配规则</legend>
		 <table cellpadding="3" width="95%" align="center" >
		<tr><td colspan="2" align="right"><a href="#top">↑Top</a></td></tr>
		<tr><th>	
			新闻标题：
		</th><td>
			<asp:TextBox size="60" id="title" runat="server"/>(捕获组title)
			<asp:RequiredFieldValidator
				ControlToValidate="title"
				ErrorMessage="新闻标题规则必须填写"
				Display="None"
				runat="server"/>
		</td></tr>
		<tr><th>	
			新闻内容：
		</th><td>
			<asp:TextBox size="48" id="content" runat="server"/>
			<asp:CheckBox id="contentOut" Text="外部文件" title="当新闻内容在另一包含文件中时使用&#13;&#10;此时内容规则应为此文件url" runat="server"/>(捕获组content)
		</td></tr>
		<tr><th>	
			新闻作者：
		</th><td>
			<asp:TextBox size="60" id="author" runat="server"/>(捕获组author)
		</td></tr>
		<tr><th>	
			新闻来源：
		</th><td>
			<asp:TextBox size="60" id="source" runat="server"/>(捕获组source)
		</td></tr>
		<tr><th>	
			新闻时间：
		</th><td>
			<asp:TextBox size="60" id="time" runat="server"/>(捕获组time)
		</td></tr>
		<tr><th>	
			分页标题：
		</th><td>
			<asp:TextBox size="60" id="pageTitle" runat="server"/>(捕获组title,当前页url为[url])
		</td></tr>
		<tr><th>	
			新闻下一页：
		</th><td>
			<asp:TextBox size="60" id="nextPage" runat="server"/>(捕获组url)
		</td></tr>
		<tr><td colspan="2">	
			<b>新闻内容/广告过滤：</b>(每行为一项)
			　　<select id="selFilter"><option>添加预设过滤内容</option></select>
		</td></tr>
		<tr><td colspan="2">
			<table width="638">
			<tr><td width="304">
				<table width="100%" class="numTable" cellpadding="0" cellspacing="0">
				<tr>
			    <td bgcolor="#eeeeee" width="24" height="100">
			      <div id="linenum1" class="numLine">
			      </div>
			    </td>
				<td width="280">
					<asp:TextBox
						Columns="40"
						Rows="5"
						TextMode="Multiline"
						id="ad1"
						CssClass="numTextarea"
						runat="server"/>
				</td></tr>
				</table>
			</td>
			<td width="30"><div class="vTxt"><ul><li>&nbsp;→替换为→</li></ul></div></td>
			<td width="304">
				<table width="100%" class="numTable" cellpadding="0" cellspacing="0">
				<tr>
			    <td bgcolor="#eeeeee" width="24" height="100" style="overflow:hidden">
			      <div id="linenum2" class="numLine">
			      </div>
			    </td>
				<td width="280">
					<asp:TextBox
						Columns="40"
						Rows="5"
						TextMode="Multiline"
						id="ad2"
						CssClass="numTextarea"
						runat="server"/>
				</td></tr>
				</table>
			</td></tr>
			</table>
			<script type="text/javascript">
			<!--
			var o_ad1=document.getElementById("<%=ad1.ClientID%>");
			var o_ad2=document.getElementById("<%=ad2.ClientID%>");
			LineNum(o_ad1,document.getElementById("linenum1"));
			LineNum(o_ad2,document.getElementById("linenum2"));
			function LineNum(textarea,linenum){
				for(var i=1,s="";i<=100;i++)
					s+=("00"+i).replace(/.*(\d{3}$)/,"$1")+"<br/>";
				linenum.innerHTML=s;
				textarea.onscroll=function(){
					linenum.scrollTop=this.scrollTop;
				}
			}
			-->
			</script>
			<script type="text/javascript" src="inc/gather_filter.js"></script>
		</td></tr>
		<tr><td colspan="2" align="right"><a href="#top">↑Top</a></td></tr>
		</table>
		</fieldset>
		
		<div align="center" style="padding:10px">
			<asp:Button id="Submit" text="添 加" onclick="Submit_OnClick" runat="server"/> &nbsp;
			<asp:Button id="export" text="导出规则" runat="server"/>
		</div>
		<div style="padding:10px 20px">
			导入采集规则 <input type="file" id="upRule" size="15" runat="server"/>
			<asp:Button id="import" text="导入" onclick="import_Onclick" runat="server"/>
		</div>
		
	</div>
	</div>
	<div class="bl"></div>
	<div class="br"></div>
	<div class="bm"></div>
	</div>
	</form>
	
	<iframe id="ifm_export" src="about:blank" height="0" width="0" style="visibility: hidden"></iframe>
	
	<script type="text/javascript">
	setOptionColor();
	</script>
</asp:Content>