<!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="Content-Type" content="text/html; charset=gb2312">
<title>修改采集节点</title>
<link href="css_body.css" rel="stylesheet" type="text/css" />
<script language='javascript' src='main.js'></script>
<script language='javascript'>
function ShowHide(objname)
{
   var obj = document.getElementById(objname);
   if(obj.style.display=="none") obj.style.display = "block";
	 else obj.style.display="none";
}

function ShowItem(objname)
{
 	var obj = document.getElementById(objname);
 	obj.style.display = "block";
}
function TSourceType()
{
  var r1 = document.getElementById('source1');
  var r2 = document.getElementById('source2');
  if(r1.checked){
     document.getElementById('st1').style.display = 'block';
	 document.getElementById('st2').style.display = 'block';
	 document.getElementById('st3').style.display = 'block';
  }else
  {
     document.getElementById('st1').style.display = 'none';
	 document.getElementById('st2').style.display = 'none';
	 document.getElementById('st3').style.display = 'none';
  }
}

function ShowHideRfurl()
{
  var r1 = document.getElementById('isref1');
  var r2 = document.getElementById('isref2');
  if(r2.checked){
     document.getElementById('rfurlct').style.display = 'block';
  }else{
     document.getElementById('rfurlct').style.display = 'none';
  }
}

</script>
<style type="text/css">
<!--
.STYLE1 {color: #FFFFFF}
.STYLE3 {color: #666666}
-->
</style>
</head>
<body>
<form name="form1" method="post" action="co_edit_action.php">
 <input type='hidden' name='exrule' value='<?php echo $exrule?>'>
  <input type='hidden' name='nid' value='<?php echo $nid?>'>
<table width="96%" border="0" cellpadding="1" cellspacing="1" align="center" class="tbtitle" style="	background:#E2F5BC;">
    <tr> 
      <td height="20"><table width="100%" border="0" cellpadding="0" cellspacing="0">
          <tr> 
            <td width="47%" height="18">&nbsp;<b><a href='co_main.php'>采集管理</a>＞更改采集节点：</b></td>
            <td width="53%" align="right"> <input type="button" name="b11" value="节点管理"  class="inputbut" style="width:80" onClick="location.href='co_main.php';"> 
              &nbsp; <input type="button" name="b122" value="节点管理"  class="inputbut" style="width:80" onClick="location.href='co_url.php';"> 
              &nbsp; </td>
          </tr>
        </table></td>
    </tr>
  </table>
<table width="96%" border="0" cellpadding="1" cellspacing="1" align="center" class="tbtitle" style="	background:#E2F5BC;">
    <tr>
      <td bgcolor="#FFFFFF">
  <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" id="head1">
  <tr> 
    <td colspan="2" bgcolor="#EDF9D5"> <table border="0" cellpadding="0" cellspacing="0">
        <tr> 
          <td width="84" height="24" align="center" bgcolor="#FFFFFF">&nbsp;网址获取</td>
          <td width="84" align="center" bgcolor="#006600"><a href="#" class="STYLE1" onClick="ShowItem2()"><u>内容规则</u></a></td>
        </tr>
      </table></td>
  </tr>
</table>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" id="head2" style="display:none">
  <tr> 
    <td colspan="2" bgcolor="#EDF9D5"> <table height="24" border="0" cellpadding="0" cellspacing="0">
        <tr> 
          <td width="84" align="center" bgcolor="#006600"><a href="#" class="STYLE1" onClick="ShowItem1()"><u>网址获取</u></a>&nbsp;</td>
          <td width="84" align="center" bgcolor="#FFFFFF">内容规则</td>
        </tr>
      </table></td>
  </tr>
</table>
  <table width="98%" border="0" align="center" cellpadding="3" cellspacing="1" id="needset" style="margin-bottom:6px">
    <tr> 
      <td bgcolor="#F2F6E5">
      	<table width="400" border="0" cellspacing="0" cellpadding="0">
          <tr class="top" onClick="ShowHide('sitem');" style="cursor:hand"> 
            <td width="26" align="center"><img src="img/file_tt.gif" width="7" height="8"></td>
            <td width="374">节点基本信息<a name="d1"></a></td>
          </tr>
        </table></td>
    </tr>
    <tr id="sitem" style="display:block"> 
      <td bgcolor="#FFFFFF">
<table width="98%" border="0" cellspacing="0" cellpadding="0">
          <tr> 
            <td width="16%" height="24">节点名称：</td>
            <td width="26%"><input name="notename" type="text" id="notename" value="<?php echo $notename?>" style="width:150px"></td>
            <td width="17%">页面编码：</td>
            <td width="41%"> <input type="radio" name="language"  value="gb2312"<?php if($language=='gb2312') echo " checked";?>>
              GB2312 
              <input type="radio" name="language"  value="utf-8"<?php if($language=='utf-8') echo " checked";?>>
              UTF8 
              <input type="radio" name="language"  value="big5"<?php if($language=='big5') echo " checked";?>>
              BIG5 </td>
          </tr>
          <tr> 
            <td height="24">图片相对网址： </td>
            <td><input name="imgurl" type="text" id="imgurl" style="width:150px" value="<?php echo $imgurl?>"></td>
            <td>物理路径：</td>
            <td><input name="imgdir" type="text" id="imgdir" style="width:150px" value="<?php echo $imgdir?>"></td>
          </tr>
          <tr> 
            <td height="24">文档来源：(文档中使用)</td>
            <td><input name="arcsource" type="text" id="arcsource" style="width:200px" value="<?php echo $arcsource; ?>" /></td>
            <td>区域匹配模式： </td>
            <td><input type="radio" name="matchtype"  value="regex"<?php if($matchtype=="regex") echo " checked";?> />
正则表达式
  <input name="matchtype" type="radio"  value="string"<?php if($matchtype=="string"||$matchtype=="") echo " checked";?> />
字符串 </td>
          </tr>
          <tr bgcolor="#F0F2EE"> 
            <td height="24" colspan="4">以下选项仅在开启防盗链模式才需设定，如果目标网站没有防盗链功能，请不要开启，否则会降低采集速度。</td>
          </tr>
          <tr> 
            <td height="24">防盗链模式：</td>
            <td><input name="isref" id='isref1' onclick="ShowHideRfurl()" type="radio" value="no"<?php if($isref=="no"||$isref=="") echo " checked";?>>
              不开启 
              <input name="isref" type="radio" id='isref2' onclick="ShowHideRfurl()" value="yes"<?php if($isref=="yes") echo " checked";?>>
              开启</td>
            <td>资源下载超时时间：</td>
            <td><input name="exptime" type="text" id="exptime" value="<?php echo $exptime?>" size="8">
              秒</td>
          </tr>
          <tr <?php if($isref!="yes") echo "style='display:none'";  ?>> 
            <td height="24">引用网址：</td>
            <td colspan="3"><input name="refurl" type="text" id="refurl" size="45" value="<?php echo $refurl?>">
              （需加http://）</td>
          </tr>
        </table>
      </td>
    </tr>
    <tr> 
      <td bgcolor="#F2F6E5">
      	<table width="400" border="0" cellspacing="0" cellpadding="0">
          <tr class="top" onClick="ShowHide('slist');" style="cursor:hand"> 
            <td width="26" align="center"><img src="img/file_tt.gif" width="7" height="8"></td>
            <td width="374">采集列表获取规则</td>
          </tr>
        </table>
      </td>
    </tr>
    <tr id="slist" style="display:block"> 
      <td height="76" bgcolor="#FFFFFF">
      	<table width="100%" border="0" cellspacing="0" cellpadding="0">
		  <tr>
		  <td height="24">来源网址获取方式：</td>
            <td colspan="2">
            	<input name="source" type="radio" id="source1" value="var"  onClick="TSourceType()" <?php if($source=="var") echo " checked";?>>
符合特定序列的列表网址
  <input name="source" type="radio" id="source" value="source2" onClick="TSourceType()"<?php if($source=="app") echo " checked";?>> 
  手工指定列表网址 
        </td>
          </tr>
		  <tr id="st1">
            <td height="24">分页变量起始值：</td>
            <td colspan="2">
            	<input name="varstart" type="text" id="varstart" size="15" value="<?php echo $varstart?>">
              变量结束值： 
              <input name="varend" type="text" id="varend" size="15" value="<?php echo $varend?>">
              表示 [var:分页] 的范围）           </td>
          </tr>
          <tr id="st2"> 
            <td width="18%" height="24">来源网址：</td>
            <td colspan="2">
            	<input name="sourceurl" type="text" id="sourceurl" style="width:500px" value="<?php echo $urlTag->GetAtt('value')?>">               </td>
          </tr>
          <tr id="st3">  
            <td height="24">&nbsp;</td>
            <td colspan="2">对于比较规则分多页的列表网址，用 http://abc.com/list.php?page=[var:分页] 
              的形式，然后指定&quot;分页变量起始值&quot;。</td>
          </tr>
          <tr>
            <td height="24" colspan="3" bgcolor="#FBFDF2"><strong>如果来源网址是列表网址，请指定下面文章内容网址获取规则的属性：</strong></td>
          </tr>
          <tr> 
            <td height="24">用正则匹配置网址：</td>
            <td colspan="2">
            	文章网址需包含：
            	  <input name="need" type="text" id="need" size="15" style="width:150px" value="<?php echo $needTag->GetInnerText()?>">
              　网址不能包含： 
              <input name="cannot" type="text" id="cannot" size="15" style="width:150px" value="<?php echo $cannotTag->GetInnerText()?>">
			 </td>
          </tr>
          <?php 
			$l1 = '';
			$l2 = '';
			$linkarea = $linkareaTag->GetInnerText();
			if(!empty($linkarea)){
			    $linkareas = explode('[var:区域]',$linkarea);
				$l1 = $linkareas[0];
				if(!empty($linkareas[1])) $l2 = $linkareas[1];
			}
			?>
          <tr> 
            <td height="100">限定HTML范围：<br />
              <span class="STYLE3">（如果文章网址命名不规范，用正则的形式无法正确获得需要的网址，设置此选项来获得）</span><br>            </td>
            <td width="42%">
			     起始HTML：<br>
			       <textarea name="linkareas" style="width:90%" rows="5" id="linkareas"><?php echo $l1; ?></textarea>			      </td>
            <td width="40%">
			      结束HTML：<br>
			     <textarea name="linkareae" style="width:90%" rows="5" id="linkareae"><?php echo $l2; ?></textarea>			</td>
          </tr>
          <tr>
            <td height="24" colspan="3" bgcolor="#FBFDF2"><strong>如果你想手工指定要采集的网址或除了规则网址外，还有其它网址，请在下面指定：</strong></td>
          </tr>
          <tr>
            <td height="110" valign="top"><strong>手工指定网址：</strong><a href="javascript:ShowHide('handurlhelp');"><img src="img/help.gif " width="16" height="16" border="0"></a><br>
              (每行一条网址，<br>
              不支持使用变量)</td>
            <td colspan="2">
			<span id='handurlhelp' style='display:none;background-color:#efefef'>
			对于部份符合规则，部份不符合规则的网址，可以把不符合规则的放在这里，例：像<br>
http://xx.com/aaa/index.html<br>
http://xx.com/aaa/list_2.html<br>
http://xx.com/aaa/list_3.html...<br>
这样的网址，你可以用变量指定 list_[var:分页].html，<br>
然后把 
            http://xx.com/aaa/index.html(该网址不符分页规则) 填写在下面。			</span>
    <textarea name="sourceurls" id="sourceurls" style="width:95%;height:100px"><?php echo $urlTag->GetInnerText()?></textarea>   </td>
		  </tr>
        </table>
		</td>
    </tr>
    <tr> 
      <td height="52" align="center" bgcolor="#FFFFFF"> 
        <input type="submit" name="b121" value="保存节点" class="inputbut" style="width:80">
        &nbsp;&nbsp;
        <input type="reset" name="b122" value="重置节点" class="inputbut" style="width:80">
      </td>
    </tr>
	</table>
  
  <table width="98%" border="0" align="center" cellpadding="3" cellspacing="1" id="adset" style="display:none">
    <tr> 
      <td bgcolor="#F2F6E5"> <table width="400" border="0" cellspacing="0" cellpadding="0">
          <tr class="top" onClick="ShowHide('sart');" style="cursor:hand"> 
            <td width="26" align="center"><img src="img/file_tt.gif" width="7" height="8"></td>
            <td width="374">网页内容获取规则<a name="d2"></a></td>
          </tr>
        </table></td>
    </tr>
    <tr id="sart" style="display:block"> 
      <td height="113" valign="top" bgcolor="#FFFFFF"><table width="100%" border="0" cellspacing="0" cellpadding="0" style="margin-bottom:6px">
          <tr> 
            <td height="24" colspan="3">　测试单页网址： 
              <input name="testurl" type="text" id="testurl2" value="http://" size="50">
              （仅用于编辑规则完成后测试，测试时不会本地化远程媒体）</td>
          </tr>
          <tr> 
            <td height="60" colspan="3"><strong>　字段设置说明：</strong><br/>
              　１、规则：如果采集的内容为分页文档，请在文章body字段&quot;分页内容字段&quot;这个选项打勾。<br/>
              　２、变量：如果你的字段值使用的不是[var:内容]，而是指定的其它值，则导出时直接使用该值，并且采集时不会分析该项目。<br>
              　３、过滤规则：如果有多个规则，请用{dede:teim}规则一{/dede:trim}换行{dede:teim}规则二{/dede:trim}...表示</td>
          </tr>
          <tr bgcolor="#EBEFD1"> 
            <td height="24"><strong>　文档是否分页：</strong></td>
            <td colspan="2"> <input name="sptype" type="radio"  value="none"<?php if($sppageTag->GetAtt('sptype')==""||$sppageTag->GetInnerText()=="") echo " checked"?>>
              不分页 
              <input name="sptype" type="radio" value="full" <?php if($sppageTag->GetAtt('sptype')=="full") echo " checked"?>>
              全部列出的分页列表 
              <input type="radio" name="sptype"  value="next"<?php if($sppageTag->GetAtt('sptype')=="next") echo " checked"?>>
              上下页形式或不完整的分页列表</td>
          </tr>
          <tr> 
            <td width="18%" height="60">分页链接区域匹配规则：<br/>
              文档分多页时才需选此项</td>
            <td> 
              <?php 
			$l1 = '';
			$l2 = '';
			$sppage = $sppageTag->GetInnerText();
			if(!empty($sppage)){
			    $sppages = explode('[var:分页区域]',$sppage);
				$l1 = $sppages[0];
				if(!empty($sppages[1])) $l2 = $sppages[1];
			}
			?>
              分页链接区域开始HTML： <br> <textarea name="sppages" rows="3" id="textarea3" style="width:90%"><?php echo $l1?></textarea> 
            </td>
            <td width="48%"> 分页链接区域结束HTML： <br> <textarea name="sppagee" rows="3" id="textarea4" style="width:90%"><?php echo $l2?></textarea> 
            </td>
          </tr>
        </table>
        <table width="100%" border="0" cellspacing="0" cellpadding="0" style="margin-bottom:6px">
          <tr> 
            <td width="98%" height="26" colspan="3" background="img/menubg.gif" bgcolor="#66CCFF">　<strong>＞内容字段列表：</strong></td>
          </tr>
        </table>
        <?php 
          $s=0;
          //$dtp->LoadString($notes);
          foreach($dtp3->CTags as $k => $ctag)
          {
          	if($ctag->GetName()=='note')
          	{
          		$s++;
          		$dtp->LoadString($ctag->GetInnerText());
          		$smatch = "";
          		$sfunction = "";
          		$strim = "";
          		$sfield = $ctag->GetAtt('field');
          		$svalue = $ctag->GetAtt('value');
              $sisunit = $ctag->GetAtt('isunit');
              $sisdown = $ctag->GetAtt('isdown');
              $comment = $ctag->GetAtt('comment');
          		foreach($dtp->CTags as $n => $ntag)
          		{
          			$tname = $ntag->GetName();
          			if($tname=='match') $smatch = $ntag->GetInnerText();
          			else if($tname=='function') $sfunction = $ntag->GetInnerText();
          			else if($tname=='trim') $strim .= "{dede:trim}".$ntag->GetInnerText()."{/dede:trim}\r\n";
          		}
          ?>
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr bgcolor="#EBEFD1"> 
            <td width="18%" height="24"> &nbsp; 
			 <?php 
			 if($smatch!=""){ $fcolor=" style='color:red' "; $tstyle=""; }
			 else{ $fcolor=""; $tstyle=" style='display:none' "; }
			 ?>
			 <a href="javascript:ShowHide('fieldlist<?php echo $s?>');"<?php echo $fcolor?>><b>＞<u><?php echo $comment?></u></b></a>
			  <input type="hidden" name="comment<?php echo $s?>" id="comment<?php echo $s?>2" value="<?php echo $comment?>"> 
            </td>
            <td width="28%"> <input name="field<?php echo $s?>" type="text" id="field<?php echo $s?>2" value="<?php echo $sfield?>" size="22" style="width:200px"></td>
            <td width="14%" align="right">字段值：</td>
            <td width="40%"> <input name="value<?php echo $s?>" type="text" id="value<?php echo $s?>2" value="<?php echo $svalue?>" size="25"> 
            </td>
          </tr>
          <tr> 
            <td colspan="4">
			<table width="100%" border="0" cellspacing="0" cellpadding="0" id="fieldlist<?php echo $s?>"<?php echo $tstyle?>>
                <tr> 
                  <td width="18%" height="80">匹配区域：</td>
                  <td height="20"> 
                    <?php 
				  $mm1 = '';
				  $mm2 = '';
				  if(!empty($smatch)){
				     $smatchs = explode('[var:内容]',$smatch);
					 $mm1 = $smatchs[0];
					 if(!empty($smatchs[1])) $mm2 = $smatchs[1];
				  }
				  ?>
                    开始无重复HTML：<br> <textarea name="matchs<?php echo $s?>" rows="4" id="matchs<?php echo $s?>" style="width:90%"><?php echo $mm1?></textarea> 
                  </td>
                  <td height="20"> 结尾无重复HTML：<br> <textarea name="matche<?php echo $s?>" rows="4" id="matche<?php echo $s?>" style="width:90%"><?php echo $mm2?></textarea> 
                  </td>
                </tr>
                <tr> 
                  <td height="63">过滤规则：</td>
                  <td height="63"> <textarea name="trim<?php echo $s?>" cols="20" rows="3" id="trim<?php echo $s; ?>" style="width:90%"><?php echo $strim?></textarea> 
                  </td>
                  <td height="63"> <input name="isunit<?php echo $s?>" type="checkbox" id="isunit<?php echo $s?>2" value="1" <?php if($sisunit=='1') echo " checked";?>>
                    分页内容字段（规则中只允许单一的该类型字段）<br/> <input name="isdown<?php echo $s?>" type="checkbox" id="isdown<?php echo $s?>2" value="1" <?php if($sisdown=='1') echo " checked";?>>
                    下载字段里的多媒体资源 </td>
                </tr>
                <tr> 
                  <td width="18%" height="60">自定义处理接口：</td>
                  <td width="42%" height="20"><textarea name="function<?php echo $s?>" cols="20" rows="3" id="textarea7" style="width:90%"><?php echo $sfunction?></textarea> 
                  </td>
                  <td width="40%" height="20"> 函数或程序的变量<br>
                    @body 表示原始网页 @litpic 缩略图<br>
                    @me 表示当前标记值和最终结果 </td>
                </tr>
              </table></td>
          </tr>
        </table>
        <?php   } } ?>
      </td>
    </tr>
	<tr> 
      <td height="52" align="center" bgcolor="#FFFFFF"> 
        <input type="submit" name="b121" value="保存节点" class="inputbut" style="width:80">
        &nbsp;&nbsp;
        <input type="reset" name="b122" value="重置节点" class="inputbut" style="width:80">
      </td>
    </tr>
    <tr> 
      <td height="24" bgcolor="#EBF9D9">&nbsp; </td>
    </tr>
</table></td>
    </tr>
  </table>
</form>
</body>
</html>