
<!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">
function GetFields()
{
	var theform = document.form1;
	var itemname = theform.itemname.value;
	var fieldname = theform.fname.value;
	var dtype = theform.dtype.value;
	var isnull = theform.isnull.value;
	var vdefault = theform.vdefault.value;
	var maxlength = theform.maxlength.value;
	var vfunction = theform.vfunction.value;
	var vinnertext = theform.vinnertext.value;
	var spage = (theform.spage[0].checked ? theform.spage[0].value : theform.spage[1].value);
	var sisnull = (isnull==0 ? "false" : "true");
	var autofield = (theform.autofield[0].checked ? theform.autofield[0].value : theform.autofield[1].value);
	var islist = (theform.islist.checked ? 1 : 0);
	var notsend = (theform.notsend.checked ? 1 : 0);
	
	if(itemname=="")
	{
		alert("表单提示名称不能为空！");
		theform.itemname.focus();
		return false;
	}
	
	if((dtype=="radio"||dtype=="select"||dtype=="checkbox") && vinnertext=="")
	{
		alert("你选择的select或radio、checkbox类型，必须在表单HTML里设置选择的项目（用逗号[,]分开）！");
		return false;
	}
	
	if(spage=="no") spage = "";
	
	revalue =  "<field:"+fieldname+" itemname=\""+itemname+"\" autofield=\""+autofield+"\" notsend=\""+notsend+"\" type=\""+dtype+"\"";
	revalue += " isnull=\""+sisnull+"\" islist=\""+islist+"\" default=\""+vdefault+"\" function=\""+vfunction+"\"";
	revalue += " maxlength=\""+maxlength+"\" page=\""+spage+"\">\r\n"+vinnertext+"</field:"+fieldname+">\r\n";
	document.form1.fieldstring.value = revalue;

  return true;
  
}
</script>
<style type="text/css">
<!--
td{ padding:2px; padding-left:6px; line-height:150%; }
.STYLE1 {color: #FF3300}
-->
</style>
</head>
<body>
<div class="bodytitle">
	<div class="bodytitleleft"></div>
	<div class="bodytitletxt">频道管理</div>
</div>
<table width="96%" border="0" cellpadding="1" cellspacing="1" align="center" class="tbtitle" style="	background:#E2F5BC;">
  <form name="form1" action="mychannel_field_edit.php" method="post" onSubmit="return GetFields();">
  	<input type='hidden' name='action' value='save'>
  	<input type='hidden' name='ID' value='<?php echo $ID?>'>
  	<input type='hidden' name='fname' value='<?php echo $fname?>'>
	  <input type='hidden' name='issystem' value='<?php echo $issystem?>'>
	  <input type='hidden' name='fieldstring' value=''>
    <tr> 
      <td height="20" colspan="2" bgcolor="#EDF9D5"> 
        <table width="98%" border="0" cellspacing="0" cellpadding="0">
          <tr> 
            <td width="30%"><b><a href="mychannel_main.php">频道管理</a>&gt;&gt;查看/修改字段：</b>            </td>
            <td align="right" style="padding-top:6px;">
			<input type="button" name="ss1" value="当前模型信息" onClick="location='mychannel_edit.php?ID=<?php echo $ID?>&dopost=edit';" class="inputbut" />
              <input type="button" name="ss12" value="频道模型管理" onClick="location='mychannel_main.php';" class="inputbut" />            </td>
          </tr>
        </table> </td>
    </tr>
    <?php if($row['issystem']==1){ ?>
    <tr>
      <td colspan="2" align="center" bgcolor="#FFFFFF">
      	<span class="STYLE1">你当前操作的字段属于系统模型字段：修改系统模型有风险，请不要随便改动系统模型的字段相关的属性。</span>
      </td>
    </tr>
    <?php } ?>
    <tr> 
      <td align="center" bgcolor="#FFFFFF">表单提示文字：</td>
      <td bgcolor="#FFFFFF">
      	<input name="itemname" type="text" id="itemname" value="<?php echo $ctag->GetAtt('itemname')?>"  style="width:150px">
        *（发布内容时显示的项名字）      </td>
    </tr>
    <tr> 
      <td width="28%" align="center" bgcolor="#FFFFFF">字段名称：</td>
      <td width="72%" bgcolor="#FFFFFF" style="table-layout:fixed;word-break:break-all"> 
        <?php echo $fname?>      </td>
    </tr>
	<tr>
      <td align="center" bgcolor="#FFFFFF">字段类型：</td>
      <td bgcolor="#FFFFFF">
	  <input name="autofield" type="radio" class="np" value="1" checked="checked"<?php echo ($ctag->GetAtt('autofield')==1 ? " checked":"");  ?>/>
      系统自动生成表单字段
      <input name="autofield" type="radio" class="np" value="0"<?php echo ( ($ctag->GetAtt('autofield')==''||$ctag->GetAtt('autofield')=='0') ? " checked":"");  ?>/>
      已经固化在发布表单中字段	  </td>
    </tr>
    <tr>
      <td align="center" bgcolor="#FFFFFF">列表处理：</td>
      <td bgcolor="#FFFFFF">
	  <input name="islist" type="checkbox" class="np" id="islist" value="1"<?php echo ($ctag->GetAtt('islist')==1 ? " checked":"");  ?>/>
      使字段可以在列表的底层模板中获得(自定义字段默认仅能在文档模板显示，启用此选项将使列表查询变慢，如无必要请不要选择)
	  <br />
	  <input name="notsend" type="checkbox" class="np" id="notsend" value="1"<?php echo ($ctag->GetAtt('notsend')==1 ? " checked":"");  ?>/>
       前台投稿及采集规则禁用本字段
	  </td>
    </tr>
    <tr> 
      <td align="center" bgcolor="#FFFFFF">数据类型：</td>
      <td bgcolor="#FFFFFF">
      	<select name="dtype" id="type" style="width:200px">
          <?php 
          $dtype = $ctag->GetAtt('type');
          if($dtype!='' && isset($fieldtypes[$dtype]))
          {
          	echo "          <option value='{$dtype}'>{$fieldtypes[$dtype]}</option>\r\n";
          	$canchange = true;
          }
          else
          {
          	echo "          <option value='{$dtype}'>系统专用类型</option>\r\n";
          	$canchange = false;
          }
          if($canchange)
          {
          ?>
          <option value="text">单行文本(varchar)</option>
          <option value="textchar">单行文本(char)</option>
          <option value="multitext">多行文本</option>
          <option value="htmltext">HTML文本</option>
          <option value="textdata">文本保存HTML数据</option>
          <option value="int">整数类型</option>
          <option value="float">小数类型</option>
          <option value="datetime">时间类型</option>
          <option value="img">图片</option>
          <option value="imgfile">图片(仅网址)</option>
          <option value="media">多媒体文件</option>
          <option value="addon">附件类型</option>
          <option value="select">使用option下拉框</option>
          <option value="radio">使用radio选项卡</option>
          <option value="checkbox">Checkbox多选框</option>
          <?php
           }
          ?>
        </select> 
        </td>
    </tr>
    <tr> 
      <td align="center" bgcolor="#FFFFFF">是否分页：</td>
      <td bgcolor="#FFFFFF">
      	<input name="isnull" type="hidden" value="1">
        <input name="spage" type="radio"  value="split"<?php  if($ctag->GetAtt('page')=='split') echo " checked";?>>
        是 &nbsp; 
        <input name="spage" type="radio"  value="no"<?php  if($ctag->GetAtt('page')=='no'||$ctag->GetAtt('page')=='') echo " checked";?>>
        否 
	  </td>
      </tr>
    <tr> 
      <td align="center" bgcolor="#FFFFFF">默认值：</td>
      <td bgcolor="#FFFFFF"> 
      	<input name="vdefault" type="text" id="vdefault" value="<?php echo $ctag->GetAtt('default')?>" style="width:200px">      </td>
    </tr>
    <tr> 
      <td align="center" bgcolor="#FFFFFF">最大长度：</td>
      <td bgcolor="#FFFFFF">
      	<input name="maxlength" type="text" id="maxlength" value="<?php echo $ctag->GetAtt('maxlength')?>" style="width:80px">
        (文本数据必须填写，大于255为text类型)        </td>
    </tr>
    <tr> 
      <td align="center" bgcolor="#FFFFFF">处理函数：</td>
      <td bgcolor="#FFFFFF">
      	<input name="vfunction" type="text" id="vfunction" value="<?php echo $ctag->GetAtt('function')?>" style="width:150px">
        (可选，用'@me'表示当前项目值参数)     </td>
    </tr>
    <tr>
      <td align="center" bgcolor="#FFFFFF">自定义表单HTML：</td>
      <td bgcolor="#FFFFFF">
      	◆自定义表单HTML时，表单名必须为“字段名称”，value='@value'，<br>
      	◆如果定义数据类型为select或radio时，此处填写被选择的项目，用“,”分开，如“男,女,人妖”。      </td>
    </tr>
    <tr> 
      <td align="center" bgcolor="#FFFFFF"><br>      </td>
      <td bgcolor="#FFFFFF">
      	<textarea name="vinnertext" cols="45" rows="5" id="vinnertext"><?php echo $ctag->GetInnerText()?></textarea>      </td>
    </tr>
    <tr> 
      <td height="28" colspan="2">
	  <table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr> 
            <td width="26%" height="45">&nbsp;</td>
            <td width="20%"><input type="submit" name="button" id="button" value="确定" class="inputbut" /></td>
            <td width="54%"><input type="reset" name="button2" id="button2" value="重置" class="inputbut" /></td>
          </tr>
        </table></td>
    </tr>
  </form>
</table>
</body>
</html>