<!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>
<script language='javascript'>
var fieldstart = <?php echo ($noteid+1)?>;
function CheckSubmit()
{
   if(document.form1.rulename.value==""){
	   alert("规则名称不能为空！");
	   document.form1.rulename.focus();
	   return false;
   }
   if(document.form1.tablename.value==""){
	   alert("导入的数据表的值不能为空！");
	   document.form1.tablename.focus();
	   return false;
   }
   return true;
}
function addMoreField()
{
   var objFieldNum = document.getElementById("fieldnum");
   var objField = document.getElementById("morefield");
   var addvalue = Number(objFieldNum.value);
   var endnum = fieldstart + addvalue;
   if(endnum>50){ alert("不允许超过限定的项目!"); return; }
   for(;fieldstart<endnum;fieldstart++)
   {
      if(fieldstart>9) objField.innerHTML += "字段"+fieldstart+"： <input class='nnpp' name=\"fieldname"+fieldstart+"\" type=\"text\" size=\"15\"> 注解： <input class='nnpp' name=\"comment"+fieldstart+"\" type=\"text\" size=\"15\"> 递属表： <input class='nnpp' name=\"intable"+fieldstart+"\" type=\"text\" size=\"18\"><br>\r\n";
      else objField.innerHTML += "字段0"+fieldstart+"： <input class='nnpp' name=\"fieldname"+fieldstart+"\" type=\"text\" size=\"15\"> 注解： <input class='nnpp' name=\"comment"+fieldstart+"\" type=\"text\" size=\"15\"> 递属表： <input class='nnpp' name=\"intable"+fieldstart+"\" type=\"text\" size=\"18\"><br>\r\n";
      objField.innerHTML += "值类型： <input type='radio' class='np' name='source"+fieldstart+"' value='function'>函数 <input type='radio' class='np' name='source"+fieldstart+"' value='value'>指定值 <input type='radio' class='np' name='source"+fieldstart+"' value='export' checked>导入/采集 指定值或函数： <input name='makevalue"+fieldstart+"' type='text' size='26' class='nnpp'><hr size=1 width=80%>\r\n";
   }
   
}
</script>
<link href="css_body.css" rel="stylesheet" type="text/css" />
<style>
	.nnpp{
	border-bottom:1px solid #98CAEF;
	border-top:1px solid #FFFFFF;
	border-left:1px solid #FFFFFF;
	border-right:1px solid #FFFFFF;
	color:red;
	filter:alpha(opacity=70);
 }
</style>
</head>
<body>
<table width="96%" border="0" cellpadding="1" cellspacing="1" align="center" class="tbtitle" style="	background:#E2F5BC;">
  <tr>
    <td height="19" bgcolor="#EDF9D5"><b><a href="co_export_rule.php"><u>数据规则模型管理</u></a></b>&gt;&gt;修改导入规则</td>
</tr>
<tr>
    <td height="200" bgcolor="#FFFFFF" valign="top">
	<form action="co_export_rule_edit.php" method="post" name="form1" onSubmit="return CheckSubmit();";>
        <input type='hidden' name='action' value='save'>
        <input type='hidden' name='aid' value='<?php echo $aid?>'>
        <table width="800" border="0" cellspacing="1" cellpadding="1">
          <tr> 
            <td height="20" colspan="2" background="img/exbg.gif"><strong>&nbsp;§基本参数：</strong></td>
          </tr>
          <tr> 
            <td width="120" height="24" align="center">规则名称：</td>
            <td height="24"> 
              <input name="rulename" type="text" id="rulename" size="36" value="<?php echo $noteinfos->GetAtt('rulename')?>">
            </td>
          </tr>
          <tr> 
            <td height="24" align="center">入库类型：</td>
            <td height="24">
			<input name="etype" type="radio"  value="当前系统"<?php  if($noteinfos->GetAtt('etype')=='当前系统') echo " checked";?>>
             当前系统 
            <input type="radio" name="etype"  value="其它系统"<?php  if($noteinfos->GetAtt('etype')=='其它系统') echo " checked";?>>
             其它系统
			</td>
          </tr>
          <tr> 
            <td height="24" align="center">针对频道：</td>
            <td height="24">
			<select name="channelid" id="channelid" style="width:150">
                <option value="0">--非系统频道模型--</option>
				<?php 
				$dsql = new DedeSql(false);
				$dsql->SetQuery("Select ID,typename From #@__channeltype where ID>0 order by ID asc");
				$dsql->Execute();
				while($row = $dsql->GetObject()){
				   if($channelid==$row->ID) echo "<option value='{$row->ID}' selected>{$row->typename}</option>\r\n";
				   else  echo "<option value='{$row->ID}'>{$row->typename}</option>\r\n";
				}
				$dsql->Close();
				?>
              </select>
			</td>
          </tr>
        </table>
        <table width="800" border="0" cellspacing="1" cellpadding="1">
          <tr> 
            <td height="20" colspan="2" background="img/exbg.gif"><strong>&nbsp;§数据库基本参数：</strong></td>
          </tr>
          <tr> 
            <td width="120" height="24" align="center">导入的数据表：</td>
            <td><input name="tablename" type="text" id="tablename" size="30" value="<?php echo $noteinfos->GetAtt('tablename')?>">
              （多个表用“,”分开，最多支持两个表）</td>
          </tr>
          <tr> 
            <td height="24" align="center">自动编号字段：</td>
            <td>
            	<input name="autofield" type="text" id="autofield" size="15" value="<?php echo $noteinfos->GetAtt('autofield')?>">
              (表示两个表关连时，第一个表的自动编号字段)
            </td>
          </tr>
          <tr> 
            <td height="24" align="center">多表同步字段：</td>
            <td>
            	<input name="synfield" type="text" id="synfield" size="15" value="<?php echo $noteinfos->GetAtt('synfield')?>">
              （表示第二个表与第一个表的自动编号字段关连字段）
             </td>
          </tr>
        </table>
        <table width="800" border="0" cellspacing="1" cellpadding="1">
          <tr> 
            <td width="120" height="20" colspan="2" background="img/exbg.gif"><strong>&nbsp;§字段设定：</strong></td>
          </tr>
          <tr> 
            <td height="62" colspan="2"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr> 
                  <td width="10%" height="45" align="center">增加字段：</td>
                  <td width="90%"> <input name="fieldnum" type="text" id="fieldnum" value="5" size="8"> 
                    <input type="button" name="Submit" value="增加" onClick="addMoreField();" class="inputbut"> 
                  </td>
                </tr>
                <tr> 
                  <td height="60">&nbsp;</td>
                  <td width="90%" align="left">
                  	<?php 
                  	if(is_array($dtp->CTags))
                    {
	                     $s = 0;
	                     foreach($dtp->CTags as $ctag){
		                      if($ctag->GetName()=='field')
		                      {
		                          $s++;
		                          if($s<10) $ss="0".$s;
		                          else $ss=$s;
		                          $c1="";
		                          $c2="";
		                          $c3="";
		                          if($ctag->GetAtt('source')=='function') $c1=" checked";
		                          else if($ctag->GetAtt('source')=='value') $c2=" checked";
		                          else  $c3=" checked";
		                          $line="
		                          字段{$ss}： 
                    <input class='nnpp' name='fieldname{$s}' type='text' value='".$ctag->GetAtt('name')."' size='15'>
                    注解： 
                    <input class='nnpp' name='comment{$s}' type='text' value='".$ctag->GetAtt('comment')."' size='15'>
                    递属表： 
                    <input class='nnpp' name='intable{$s}' type='text' value='".$ctag->GetAtt('intable')."' size='18'> 
                    <br>
                    值类型：
                  <input type='radio' class='np' name='source{$s}' value='function'{$c1}>函数
                  <input type='radio' class='np' name='source{$s}' value='value'{$c2}>指定值
                  <input type='radio' class='np' name='source{$s}' value='export'{$c3}>导入/采集
                  指定值或函数：
                  <textarea class='nnpp' rows='1' cols='26' name='makevalue{$s}'>".$ctag->GetInnerText()."</textarea>
                  <hr size=1 width=80%>\r\n";
		                          echo $line;
		                      }
		                   }
                    }
                    
                    ?>
                    <span id='morefield'></span>
                    </td>
                </tr>
              </table> </td>
          </tr>
        </table>
        <table width="800" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td>&nbsp;</td>
          </tr>
          <tr> 
            <td bgcolor="#CCCCCC" height="1"></td>
          </tr>
          <tr> 
            <td height="80"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td width="10%">&nbsp;</td>
                  <td width="90%">
				  <input name="提交" type="submit" value="确定"  class="inputbut"/>
                    　 
                   
                  <input name="button" type="reset" class="inputbut" id="button" value="重置"/>				  </td>
                </tr>
              </table></td>
          </tr>
        </table>
      </form>
    </td>
</tr>
</table>
</body>
</html>