
<!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">
var notAllow = " aid ID typeid typeid2 sortrank iscommend ismake channel arcrank click money title shorttitle color writer source litpic pubdate senddate arcatt adminID memberID description keywords templet lastpost postnum redirecturl mtype userip ";
function GetFields()
{
	var issystem = document.form1.issystem.value;
	var fieldname = document.form1.fname.value;
	var itemname = document.form1.itemname.value;
	var dtype = document.form1.dtype.value;
	var isnull = document.form1.isnull.value;
	var vdefault = document.form1.vdefault.value;
	var maxlength = document.form1.maxlength.value;
	var vfunction = document.form1.vfunction.value;
	var vinnertext = document.form1.vinnertext.value;
	if(document.form1.spage[0].checked) var spage = document.form1.spage[0].value;
	else var spage = document.form1.spage[1].value;
	if(isnull==0) var sisnull="false";
	else var sisnull="true";
	if(issystem!=1)
	{
	  if(notAllow.indexOf(" "+fieldname+" ") >-1 ) {
		  alert("字段名称不合法，如下名称是不允许的：\n"+notAllow);
		  return false;
	  }
	  if((dtype=="text"||dtype=="radio"||dtype=="select") && maxlength==""){
		  alert("你选择的是文本、select或radio类型，必须设置最大字符长度！");
		  return false;
	  }
	  if((dtype=="radio"||dtype=="select") && vinnertext==""){
		  alert("你选择的select或radio类型，必须在表单HTML里设置选择的项目（用逗号[,]分开）！");
		  return false;
	  }
	  if(itemname==""){
		  alert("表单提示名称不能为空！");
		  return false;
	  }
	}
	if(spage=="no") spage = "";
	revalue =  "<field:"+fieldname+" itemname=\""+itemname+"\" type=\""+dtype+"\"";
	revalue += " isnull=\""+sisnull+"\" default=\""+vdefault+"\" function=\""+vfunction+"\"";
	revalue += " maxlength=\""+maxlength+"\" page=\""+spage+"\">"+vinnertext+"</field:"+fieldname+">\r\n";
	document.form1.editfield.value = revalue;
	document.form1.submit();
	return true;
}
</script>
</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">
  	<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='editfield' value=''>
    <tr> 
      <td height="20" colspan="2"> 
        <table width="98%" border="0" cellspacing="0" cellpadding="0">
          <tr> 
            <td width="30%"><b>&nbsp;<a href="mychannel_main.php"></a>查看/修改字段：</b>            </td>
            <td align="right">
			<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($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:35%">
        *（发布内容时显示的项名字）        </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">
      	<select name="dtype" id="type" style="width:250">
          <?php 
          $dtype = $ctag->GetAtt('type');
          if($dtype!='' && isset($fieldtypes[$dtype])) echo "          <option value='{$dtype}'>{$fieldtypes[$dtype]}</option>\r\n";
          else echo "          <option value='{$dtype}'>{$dtype}</option>\r\n";
          ?>
          <option value="text">单行文本</option>
          <option value="multitext">多行文本</option>
          <option value="htmltext">HTML文本</option>
          <option value="int">整数类型</option>
          <option value="float">小数类型</option>
          <option value="datetime">时间类型</option>
          <option value="img">图片</option>
          <option value="media">多媒体文件</option>
          <option value="addon">附件类型</option>
          <option value="textdata">文本存放数据</option>
          <option value="select">使用option下拉框</option>
          <option value="radio">使用radio选项卡</option>
          <option value="imgfile">图片(无格式)</option>
        </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')?>">      </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')?>">
        (文本数据必须填写，大于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:35%">
        (可选，用'@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" bgcolor="#E8F8FF">
	  <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" onclick="GetFields()"/></td>
            <td width="54%"><input type="reset" name="button2" id="button2" value="重置" class="inputbut" /></td>
          </tr>
        </table></td>
    </tr>
  </form>
</table>
</body>
</html>