<!--#include file="../fy.Function.asp"-->
<!doctype html>
<html>
<head>
<meta charset="gb2312">
<title>模型自定义字段管理</title>
<link rel="stylesheet" type="text/css" href="../css/base.css">
<link rel="stylesheet" type="text/css" href="../css/content.css">
</head>
<body  onload="SelectModelType()">
<%dim Rs,ModeID,FieldSql,Action,FieldName,FieldType,ColumnType,TableName,Title,Text_Default,TitleSize,fun
Dim IsNotNull,MultipleTextType_Width,MultipleTextType_Height,ID,Type_Default,FieldRS,Description,Type_Type,check
Dim NType_Default,RadioType_Content,ListBoxType_Content,Content,RadioType_Type,ListBoxType_Type,ISType,YHtml
Dim SupportHtmlType_Width,SupportHtmlType_Heigh,OrderID,RadioPic_Type,regex,regError,SearchIF,ValueOnly,savepic
Dim IsEditor,RadioPicType_Height,RadioPicType_Width,collectif
ModeID = 888
if ModeID=0 or ModeID="" Then ModeID=1
TableName="class_fy"
If Not fycms.ChkAdmin() Then   Call fycms.Alert("对不起，你没有操作权限！","")
 ID=ChkNumeric(Request("ID"))
Action = Request.QueryString("A") %>
<div class="content"> 

	<%  
	Select Case Action
		   Case "AddSave"
		   		Call AddSave()
			Case "ESave"
				Call Esave()
			Case "A","E"
				Call AddEdit()
			Case "px"
				Call px()
			Case Else
				Call Main()
	End Select



	IF Action = "Del" Then
		Dim FieldN
		FieldN=fycms.ACTEXE("Select FieldName From Table_fy Where fycms=5 and  ID=" & ID)(0)
		fycms.ACTEXE("Delete from Table_fy  Where fycms=5 and  ID=" & ID & "")
		fycms.ACTEXE("Alter Table "& TableName &" Drop column "& FieldN &"")
		Call fycms.DelCahe(fycmsN & "_"&ModeID&"DIYFieldCache")
		Call fycms.ActErr("删除字段成功","fy_Mode/fy.m.asp?A=L&ModeID="&ModeID&"","")
 	End IF
	

	
	
	Sub px()
			Dim i
			ID = Split(fycms.s("ID"),","):OrderID = Split(fycms.s("OrderID"),",")
			 For I = LBound(ID) To UBound(ID)
					Conn.execute("Update Table_fy set OrderID="&OrderID(I)&" where fycms=5 and  ID = "&ID(I)&"")
			Next 
			set conn=Nothing
		 Response.Redirect "?A=L&ModeID="&ModeID
	End sub

	Sub AddSave()
		FieldType=fycms.S("FieldType")
		Title=fycms.S("Title")
		IsNotNull=ChkNumeric(fycms.S("IsNotNull"))
		ISType=ChkNumeric(fycms.S("ISType"))
		OrderID=ChkNumeric(fycms.S("OrderID"))
		Type_Default=fycms.S("Type_Default")
		Description=fycms.S("Description")
		savepic=ChkNumeric(fycms.S("savepic"))
		YHtml=ChkNumeric(fycms.S("YHtml"))
		IF fycms.Chkchars(Request.Form("FieldName")) = False  Then
			Call fycms.ActErr("字段名称只能为英文、数字及下划线","fy_Mode/fy.m.asp?A=L&ModeID="&ModeID&"","")
 		Else
			FieldName=fycms.S("FieldName") 
		End if
		Dim ActMode_Width,ActMode_Height
		'长度.宽度.
		Select Case FieldType
			Case "TextType"'单行文本
				ActMode_Width =  ChkNumeric(fycms.S("TitleSize"))'文本框长度
				ColumnType="varchar(255)"
			Case "MultipleTextType"'多行文本(不支持Html
				ActMode_Width =  ChkNumeric(fycms.S("MultipleTextType_Width"))
				ActMode_Height =  ChkNumeric(fycms.S("MultipleTextType_Height"))
				Type_Type=YHtml
				 ColumnType="text"
			Case "MultipleHtmlType"'多行文本(支持Html)
				Content = fycms.S("IsEditor")'编辑器属性放入Content字段
				ActMode_Width =  ChkNumeric(fycms.S("SupportHtmlType_Width"))
				ActMode_Height =  ChkNumeric(fycms.S("SupportHtmlType_Heigh"))
				Type_Type=savepic
				ColumnType="text"
			Case "RadioType"'单选项
			    Content = fycms.S("RadioType_Content")
				Type_Type =  ChkNumeric(fycms.S("RadioType_Type"))'显示方式
				ColumnType="varchar(255)"
			Case "ListBoxType"'多选项
			    Content = fycms.S("ListBoxType_Content")
				Type_Type =  ChkNumeric(fycms.S("ListBoxType_Type"))
				If  DataBaseType="access" Then 
					ColumnType="text"
				Else
					ColumnType="varchar(500)"
				End If 
 			Case "NumberType"'数字
			    ActMode_Width =  ChkNumeric(fycms.S("NumberType_TitleSize"))'数字的宽度放入总宽度字段名称中
				ColumnType="int"'
		   Case "DateType"
				 ColumnType="datetime"'echo "日期时间"
		   Case "NumberType"
				ColumnType="int"'echo "数字"
		  case "PicType"
				 Type_Type =ChkNumeric(fycms.S("RadioPic_Type"))
				 ColumnType="text"
 				 ActMode_Width=ChkNumeric(fycms.S("RadioPicType_Width"))
				 ActMode_Height=ChkNumeric(fycms.S("RadioPicType_Height"))
		   Case else
		     ColumnType="varchar(255)"
		End Select 
	
		If fycms.defaultField(FieldName,1)=True Then  Call fycms.Alert("数据库中已存在该字段\n或该字段是系统关键字!", "")
		 Set FieldRS = Server.CreateObject("ADODB.RECORDSET")
		 FieldSql = "Select * From [Table_fy] Where   FieldName='" & FieldName & "' and fycms=5 And ModeID=" & ModeID
		 FieldRS.Open FieldSql, conn, 3, 3
		 If FieldRS.EOF And FieldRS.BOF Then
			FieldRS.AddNew
			FieldRS("FieldName") = FieldName
			FieldRS("FieldType") = FieldType
			FieldRS("ModeID") = ModeID
			FieldRS("Title") = Title
			FieldRS("IsNotNull") = IsNotNull
			FieldRS("Width") = ActMode_Width
			FieldRS("Height") = ActMode_Height
			FieldRS("Type_Default") = Type_Default
			FieldRS("Description") = Description
			FieldRS("Type_Type") = Type_Type
			FieldRS("Content") = Content
			FieldRS("ISType") = ISType
			FieldRS("OrderID") = OrderID
			FieldRS("fycms") = 5
 			FieldRS("check") = ChkNumeric(fycms.S("check"))		
			if ChkNumeric(fycms.S("check"))	="1" then 
			FieldRS("regex") = fycms.S("fun")
			else 
			FieldRS("regex") = fycms.S("regex")
			FieldRS("regError") = fycms.S("regError")
			end if 
 			FieldRS("SearchIF") = ChkNumeric(fycms.S("SearchIF"))		
		    FieldRS("ValueOnly") = ChkNumeric(fycms.S("ValueOnly"))	
		    FieldRS("collectif") = ChkNumeric(fycms.S("collectif"))	
				
		    FieldRS.Update
 			Conn.Execute("Alter Table "&TableName&" Add "&FieldName&" "&ColumnType&"")
			Call fycms.DelCahe(ModeID&"DIYFieldCache")
			Call fycms.DelCahe(ModeID&"DIYFieldListCache")
			echo ("<Script> if (confirm('字段增加成功,继续添加吗?')) { location.href='?A=A&ModeID=" & ModeID& "';} else{location.href='?A=L&ModeID=" & ModeID&"';}</script>")
		 Else
		   Call fycms.Alert("数据库中已存在该字段名称!", "")
		   Exit Sub
		 End If
	End  Sub 


	Sub Esave()
		Title=fycms.S("Title")
		IsNotNull=fycms.S("IsNotNull")
		Type_Default=fycms.S("Type_Default")
		Description=fycms.S("Description")
		OrderID=ChkNumeric(fycms.S("OrderID"))
		savepic=ChkNumeric(fycms.S("savepic"))
		YHtml=ChkNumeric(fycms.S("YHtml"))
		 If TitleSize=0 Then TitleSize=40
		 Set FieldRS = Server.CreateObject("ADODB.RECORDSET")
		 FieldSql = "Select * From [Table_fy] Where ID=" & ID
		 FieldRS.Open FieldSql, conn,1, 3
			FieldRS("ModeID") = ModeID
			FieldRS("Title") = Title
			FieldRS("IsNotNull") = IsNotNull
			Select Case FieldRS("FieldType")
				Case "TextType"'单行文本
					FieldRS("Width") =  ChkNumeric(fycms.S("TitleSize"))'文本框长度
				Case "MultipleTextType"'多行文本(不支持Html
					FieldRS("Width") =  ChkNumeric(fycms.S("MultipleTextType_Width"))
					FieldRS("Height") =  ChkNumeric(fycms.S("MultipleTextType_Height"))
					FieldRS("Type_Type") =YHtml
				Case "MultipleHtmlType"'多行文本(支持Html)
					FieldRS("Content") = fycms.S("IsEditor")'编辑器属性放入Content字段
					FieldRS("Width") =  ChkNumeric(fycms.S("SupportHtmlType_Width"))
					FieldRS("Height") =  ChkNumeric(fycms.S("SupportHtmlType_Heigh"))
					FieldRS("Type_Type") =savepic
				Case "RadioType"'单选项
					FieldRS("Content") = fycms.S("RadioType_Content")
					FieldRS("Type_Type") =  ChkNumeric(fycms.S("RadioType_Type"))'显示方式
				Case "ListBoxType"'多选项
					FieldRS("Content") = fycms.S("ListBoxType_Content")
					FieldRS("Type_Type") =  ChkNumeric(fycms.S("ListBoxType_Type"))		
				Case "NumberType"'数字
					FieldRS("Width") =  ChkNumeric(fycms.S("NumberType_TitleSize"))'数字的宽度放入总宽度字段名称中
				Case "PicType"
				    FieldRS("Type_Type") = ChkNumeric(fycms.S("RadioPic_Type"))
 					FieldRS("Width")=ChkNumeric(fycms.S("RadioPicType_Width"))
					FieldRS("Height")=ChkNumeric(fycms.S("RadioPicType_Height"))
					 
 			End Select 
			FieldRS("Description") = Description
			FieldRS("Type_Default") = Type_Default
			FieldRS("ISType")= ChkNumeric(fycms.S("ISType"))
			FieldRS("OrderID") = OrderID
 			FieldRS("check") = ChkNumeric(fycms.S("check"))		
			If  ChkNumeric(fycms.S("check"))	="1" then 
				FieldRS("regex") = fycms.S("fun")
			Else  
				FieldRS("regex") = fycms.S("regex")
				FieldRS("regError") = fycms.S("regError")
			End  If  
			FieldRS("fycms") = 5
			FieldRS("SearchIF") = ChkNumeric(fycms.S("SearchIF"))		
 		    FieldRS("ValueOnly") = ChkNumeric(fycms.S("ValueOnly"))	
 		    FieldRS("collectif") = ChkNumeric(fycms.S("collectif"))	
				
 			FieldRS.Update
			Call fycms.ActErr("字段修改成功","fy_Mode/fy.m.asp?A=L&ModeID=" & ModeID& "","")
 	End  Sub 
	
%>

	<% Sub Main()%>

	<div class="breadnav">当前位置：<a href="#">后台首页</a> >>  <a href="fy.class.asp">栏目自定义字段</a> >> <a href="?A=L&ModeID=<%= ModeID %>">字段列表</a> >> 浏览[栏目]字段 </div>
    <div class="opers">
	<span class="btn">当前模型：[栏目]</span>&nbsp;&nbsp; <a href="?A=A&ModeID=<%= ModeID %>" class="btn">添加字段</a>  
    </div>
	
	   <form name="Form1" method="post" action="?A=px&ModeID=<%= ModeID %>">
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <thead>
      <tr>
		<th>字段描述</th>
		<th>字段名称</th>
		<th>字段类型</th>
		<th>是否必填</th>
		<th>会员是否禁用</th>
		<th>排序</th>
		<th>管理操作</th>
	  </tr>
    </thead>
<% 
	  Set Rs =fycms.ACTEXE("SELECT * FROM Table_fy Where fycms=5 and  ModeID=" & ModeID & " order by OrderID desc,ID Desc")
	 If Rs.EOF  Then
	 	echo	"<tr><td colspan=""8"" align=""center"">没有记录</td></tr>"
	 Else
		Do While Not Rs.EOF	
			 %>
		  <tr   >
    <td align="center"><%= Rs("Title") %></td>
      <td align="center"><%= Rs("FieldName") %></td>
   <td align="center"><%
	
		 Select Case Rs("FieldType")
		   Case "TextType"
				echo "单行文本"
		   Case "MultipleTextType"
				echo "多行文本(不支持Html)"
		   Case "MultipleHtmlType"
				echo "多行文本(支持Html)"
		   Case "RadioType"
				echo "单选项"
		   Case "ListBoxType"
				echo "多选项"
		   Case "DateType"
				echo "日期时间"
		   Case "PicType"
				echo "图片"
		   Case "FileType"
				echo "文件"
		   Case "NumberType"
				echo "数字"
		   Case "RadomType"
				echo "随机数"
		   Case else
				echo "<font color=red>该字段错误</font>"
		 End Select
%></td>
    <td align="center"><%if Rs("IsNotNull")=0 Then echo "是" Else echo "否" %></td>
    <td align="center"><%if Rs("ISType")=1 Then echo "<font color=green>正常</font>" Else echo "<font color=red>禁用</font>" %> </td>
	<td align="center">
          <input name="OrderID" type="text" class="Ainput" id="OrderID" value="<%=rs("OrderID")%>" size="4" maxlength="3">
          <input name="A" type="hidden" id="A" value="N">
		  <input name="ID" type="hidden" id="ID" value="<%=rs("ID")%>">	
           
	</td>
	<td align="center"><a href="?A=E&ID=<%=Rs("ID")%>&ModeID=<%=Rs("ModeID")%> " >修改</a> ┆ 

<a href="?A=Del&ID=<%=Rs("ID")%>&ModeID=<%=Rs("ModeID")%> " onClick="{if(confirm('确定删除该字段吗?')){return true;}return false;}">删除</a>  </td>

   
	  </tr>
	   <% 
		Rs.movenext
		Loop
	End if	 %>
    <tr>
    <td colspan="8" class="tl"><input type="submit" Class="btn btn_primary" name="Submit" value=" 批量更新排序 "></td>
  </tr>
    </table>
 </form>

   <%End Sub  



   Sub AddEdit()
   Dim A
	if Action="A" Then
		A="AddSave"
		TitleSize="40"
		ISType="1"
		RadioPic_Type="0":check=3
		RadioType_Content="名称-值"& vbCrLf &"名称-值"& vbCrLf &"名称-值"
		ListBoxType_Content="名称-值"& vbCrLf &"名称-值"& vbCrLf &"名称-值"
		SupportHtmlType_Width=670
		SupportHtmlType_heigh=300
		MultipleTextType_Width=300
		MultipleTextType_Height=100
		RadioPicType_Width=400
		RadioPicType_Height=200
		IsEditor="Simple"
		IsNotNull=1
		OrderID=10
		YHtml=0
		savepic=0
		collectif=0
		ValueOnly=1
		SearchIF=1
	Else
		Set FieldRS=server.CreateObject("adodb.recordset") 
		FieldRS.OPen "Select * from Table_fy Where ID = "&ID&" order by ID desc",Conn,1,1
		FieldName = FieldRS("FieldName")
		FieldType = FieldRS("FieldType")  
		ModeID = FieldRS("ModeID") 
		Title = FieldRS("Title")  
		Type_Default = FieldRS("Type_Default") 
		Description = FieldRS("Description") 
		OrderID = FieldRS("OrderID") 
		Select Case FieldType
			Case "TextType"'单行文本
				TitleSize=FieldRS("Width") 
			Case "MultipleTextType"'多行文本(不支持Html
				MultipleTextType_Width=FieldRS("Width") 
				MultipleTextType_Height=FieldRS("Height")
				YHtml=FieldRS("Type_Type")
 			Case "MultipleHtmlType"'多行文本(支持Html)
				IsEditor=FieldRS("Content")
				SupportHtmlType_Width=FieldRS("Width") 
				SupportHtmlType_Heigh=FieldRS("Height")
				savepic=FieldRS("Type_Type")
			Case "RadioType"'单选项
				RadioType_Content=FieldRS("Content")
				RadioType_Type = FieldRS("Type_Type")
			case "PicType"
			    RadioPic_Type = FieldRS("Type_Type")
				RadioPicType_Width=FieldRS("Width") 
				RadioPicType_Height=FieldRS("Height")
			Case "ListBoxType"'多选项
				ListBoxType_Content=FieldRS("Content")
				ListBoxType_Type = FieldRS("Type_Type")
			Case "NumberType"'数字
				TitleSize=FieldRS("Width") 
		End Select 
		ISType=FieldRS("ISType")
		IsNotNull=FieldRS("IsNotNull")
	    check=FieldRS("check")

		if  FieldRS("check")="1" then 
 		fun=FieldRS("regex")
		else
 		regex=FieldRS("regex")
		end if 
		regError=FieldRS("regError")
		SearchIF=FieldRS("SearchIF")
	    ValueOnly=FieldRS("ValueOnly")
		collectif=FieldRS("collectif")
		A="ESave"
 	End  If 
    %> 
	<div class="breadnav">当前位置：<a href="#">后台首页</a> >> <a href="fy.class.asp">栏目自定义字段</a> >> <a href="?A=L&ModeID=<%= ModeID %>">字段列表</a> >> 浏览[栏目]字段 </div>
    <div class="opers">
	<span class="btn">当前模型：[栏目]</span>&nbsp;&nbsp; <a href="?A=A&ModeID=<%= ModeID %>" class="btn">添加字段</a>
	<a href="http://help.fycms.com/link.asp?id=classfield" class="btn btn_primary" target="_blank">帮助</a>
    </div>
	
	<form  name="tcjdxr" method="post" action="?A=<%= A %>&ModeID=<%= Request.QueryString("ModeID") %>&ID=<%= Request.QueryString("ID") %>">
 
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr >
    <td width="15%" align="right"> 字段别名： </td>
    <td class="tl"><input name="Title" value="<%=Title%>"  type="text" class="Ainput" maxlength="20" id="Title" />
    <font color="#ff0066">*</font> 如：文章标题</td>
  </tr>
  <tr >
    <td align="right"> 字段名称： </td>
    <td class="tl"><input name="FieldName" value="<%=FieldName%>" <%If action="E" Then echo " disabled=""disabled"" "%>  type="text" class="Ainput" maxlength="50" id="FieldName" />
        
	   <%If action="E" Then echo " 该字段在 <"&fycms.ACT_C(ModeID,1)&">标签中调用方式{info:"&FieldName&"}, 在内容页调用标签 <font color=red>{info:"&FieldName&"}</font>"%>  <font color="#ff0066">*</font>必须要写英文 </td>
  </tr>
  <tr >
    <td align="right"> 字段描述： </td>
    <td class="tl"><textarea name="Description" rows="6" cols="40" id="Description"><%=Description%></textarea>
	 </td>
  </tr>
  <tr >


  <td align="right"> 是否必填： </td>
    <td class="tl"><input id="IsNotNull_0" <% IF IsNotNull = "0" Then echo "Checked" %> type="radio" name="IsNotNull" value="0" /><label for="IsNotNull_0">是</label><input id="IsNotNull_1" <% IF IsNotNull = "1" Then echo "Checked" %> type="radio" name="IsNotNull" value="1" /><label for="IsNotNull_1">否</label></td>
  </tr>
  <tr >
    <td align="right"> 会员中心调用：</td>
    <td class="tl"><input id="ISType_0" <% IF ISType = "1" Then echo "Checked" %>   type="radio" name="ISType" value="1" /><label for="ISType_0">是</label><input id="ISType_1" type="radio" <% IF ISType = "0" Then echo "Checked" %> name="ISType" value="0" /><label for="ISType_1">否</label></td>
  </tr>
   <tr >
    <td align="right"> 字段排序： </td>
    <td class="tl"><input name="OrderID" value="<%=OrderID%>"  type="text" class="Ainput" maxlength="20" id="OrderID" />
   数字越大,排的越前</td>
  </tr>
 
 
 
   <tr >
    <td align="right">数据校验规则：</td>
    <td class="tl">
      <label for="check3"><input type="radio" name="check"   <% IF check = "3" Then echo "Checked" %>  id="check3"  onClick=chk(3)  value="3">
      默认 </label>
    <label for="check1"><input type="radio" name="check"  <% IF check = "1" Then echo "Checked" %>  id="check1"  onClick=chk(1)  value="1">
      函数 </label>
       <label for="check2"> <input type="radio" name="check"  <% IF check = "2" Then echo "Checked" %>  id="check2" onClick=chk(2)  value="2">
      正则</label>
	 
	  </td>
  </tr> 
 
 
   <tr id="checks3">
    <td align="right">函数名称：</td>
    <td class="tl"><input name="fun" type="text" class="Ainput" id="fun" size="40" value="<%= fun %>">请在Field.asp中自己增加
  	 </td>
  </tr> 
  
   <tr id="checks1">
    <td align="right">数据校验正则：</td>
    <td class="tl"><input name="regEx" type="text" class="Ainput" id="regEx" size="40" value="<%= regEx %>">
 	<select name="select"   onchange="document.tcjdxr.regEx.value=this.value">
          <option selected>-- 常用正则 --</option>
			<option value="^[A-Za-z]+$">英文</option> 
			<option value="^[\u0391-\uFFE5]+$">中文</option> 
<!--			<option value="^[a-z]\w{2,19}$">中英文</option> 
-->			<option value="^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$">email</option> 
			<option value="^[-\+]?\d+$">整型</option> 
          <option value="^\d+$">数字</option> 
			<option value="^[-\+]?\d+(\.\d+)?$">double</option> 
			<option value="^[1-9]\d{4,9}$">qq</option> 
			<option value="^((\(\d{2,3}\))|(\d{3}\-))?(\(0\d{2,3}\)|0\d{2,3}-)?[1-9]\d{6,7}(\-\d{1,4})?$">phone</option> 
			<option value="^((\(\d{2,3}\))|(\d{3}\-))?(1[35][0-9]|189)\d{8}$">mobile</option> 
			<option value="^(http|https|ftp):\/\/[A-Za-z0-9]+\.[A-Za-z0-9]+[\/=\?%\-&_~`@[\]\':+!]*([^<>\])*$">网址</option> 
			<option value="^[A-Za-z0-9\-]+\.([A-Za-z]{2,4}|[A-Za-z]{2,4}\.[A-Za-z]{2})$">域名</option> 
			<option value="^(0|[1-9]\d?|[0-1]\d{2}|2[0-4]\d|25[0-5]).(0|[1-9]\d?|[0-1]\d{2}|2[0-4]\d|25[0-5]).(0|[1-9]\d?|[0-1]\d{2}|2[0-4]\d|25[0-5]).(0|[1-9]\d?|[0-1]\d{2}|2[0-4]\d|25[0-5])$">ip</option> 
               </select>
 </td>
  </tr>
     <tr   id="checks2">
    <td align="right">检验错误提示信息：</td>
    <td class="tl"><input name="regError" type="text" class="Ainput" id="regError" size="40"  value="<%= regError %>">
	 
	
	</td>
  </tr>

  <tr >
    <td align="right"><font color="red">作为采集条件：</font></td>
    <td class="tl">
	
<input id="collectif_0" <% IF collectif = "0" Then echo "Checked" %>    type="radio" name="collectif" value="0" />
<label for="collectif_0">是</label>	

<input id="collectif_1" <% IF collectif = "1" Then echo "Checked" %>   type="radio" name="collectif" value="1" />
<label for="collectif_1">否</label>	
 
	</td>
  </tr>




  <tr >
    <td align="right">作为搜索条件：</td>
    <td class="tl">
	
<input id="SearchIF_0" <% IF SearchIF = "0" Then echo "Checked" %>   type="radio" name="SearchIF" value="0" />
<label for="SearchIF_0">是</label>	

<input id="SearchIF_1" <% IF SearchIF = "1" Then echo "Checked" %>   type="radio" name="SearchIF" value="1" />
<label for="SearchIF_1">否</label>	
 
	</td>
  </tr>


  <tr >
    <td align="right">数据唯一：</td>
    <td class="tl">
	
<input id="ValueOnly_0" <% IF ValueOnly = "0" Then echo "Checked" %>   type="radio" name="ValueOnly" value="0" />
<label for="ValueOnly_0">是</label>	

<input id="ValueOnly_1" <% IF ValueOnly = "1" Then echo "Checked" %>   type="radio" name="ValueOnly" value="1" />
<label for="ValueOnly_1">否</label>	
 
	</td>
  </tr>

  
  
  <tr >
    <td align="right"> 字段类型： </td>
    <td class="tl">	
	
<table id="FieldType" <%If action="E" Then echo " disabled=""disabled"" "%> onClick="SelectModelType()" border="0">
	<tr>
		<td  class="tl"><input id="Type_0" <% IF FieldType = "TextType" Then echo "Checked" %> type="radio" name="FieldType" value="TextType" checked="checked" />
		<label for="Type_0">单行文本</label></td>
		<td  class="tl"><input id="Type_1" <% IF FieldType = "MultipleTextType" Then echo "Checked" %>  type="radio" name="FieldType" value="MultipleTextType" />
		<label for="Type_1">多行文本(不支持Html)</label></td><td  class="tl">
		<input id="Type_2" <% IF FieldType = "MultipleHtmlType" Then echo "Checked" %>   type="radio" name="FieldType" value="MultipleHtmlType" />
		<label for="Type_2" <% IF FieldType = "SupportHtmlType" Then echo "Checked" %> >多行文本(支持Html)</label></td><td  class="tl">
		<input id="Type_3" <% IF FieldType = "RadioType" Then echo "Checked" %>  type="radio" name="FieldType" value="RadioType" /><label for="Type_3">单选项</label>
		</td>
		<td  class="tl"><input id="Type_4" <% IF FieldType = "ListBoxType" Then echo "Checked" %>  type="radio" name="FieldType" value="ListBoxType" /><label for="Type_4">多选项</label></td>
	</tr><tr>
		<td  class="tl"><input id="Type_5" <% IF FieldType = "DateType" Then echo "Checked" %>  type="radio" name="FieldType" value="DateType" />
		<label for="Type_5">日期时间</label></td><td  class="tl">
		<input id="Type_6"  <% IF FieldType = "PicType" Then echo "Checked" %> type="radio" name="FieldType" value="PicType" />
		<label for="Type_6">上传</label></td><td  class="tl"><input <% IF FieldType = "FileType" Then echo "Checked" %>  id="Type_7" type="radio" name="FieldType" value="FileType" />
		<label for="Type_7">下载</label></td><td  class="tl"><input <% IF FieldType = "NumberType" Then echo "Checked" %>  id="Type_8" type="radio" name="FieldType" value="NumberType" />
		<label for="Type_8">数字</label></td><td  class="tl"><input <% IF FieldType = "RadomType" Then echo "Checked" %>  id="Type_9" type="radio" name="FieldType" value="RadomType" />
		<label for="Type_9">随机数</label>
	 </td>
	</tr>
</table>	</td>
  </tr>
  <tbody id="DivTextType">
    <tr>
      <td align="right">文本框长度：</td>
      <td class="tl"><input name="TitleSize" value="<%=TitleSize%>"  type="text" class="Ainput"  maxlength="4" size="10" id="TitleSize" /></td>
    </tr>
  </tbody>
  <tbody id="DivMultipleTextType" style="display:none">
    <tr>
      <td align="right">显示的宽度：</td>
      <td class="tl"><input name="MultipleTextType_Width" type="text" class="Ainput" value="<%=MultipleTextType_Width%>" maxlength="4" size="10" id="MultipleTextType_Width" />
        px</td>
    </tr>
    <tr>
      <td align="right">显示的高度：</td>
      <td class="tl"><input name="MultipleTextType_Height" type="text" class="Ainput" value="<%=MultipleTextType_Height%>" maxlength="4" size="10" id="MultipleTextType_Height" />
        px</td>
    </tr>
    
    <tr>
      <td align="right">是否允许HTML：</td>
      <td class="tl"><input id="YHtml_0" <% IF YHtml = "0" Then echo "Checked" %>   type="radio" name="YHtml" value="0" />
<label for="YHtml_0">是</label>	

<input id="YHtml_1" <% IF YHtml = "1" Then echo "Checked" %>   type="radio" name="YHtml" value="1" />
<label for="YHtml_1">否</label>
 
 </td>
    </tr>    
    
  </tbody>
  <tbody id="DivMultipleHtmlType" style="display:none">
    <tr>
      <td align="right">编辑器菜单名称：</td>
      <td class="tl">       
<input name="IsEditor" type="text" class="Ainput" value="<%=IsEditor%>" maxlength="4" size="10" id="IsEditor" />
<select name="select" onChange="FormatTitle(this, tcjdxr.IsEditor, '')">
          <option selected>-- 请选择 --</option>
          <option value="1">简洁</option>
          <option value="2">超简洁</option>
          <option value="3">全部</option>
        </select>如需自己定义菜单名称,请手工配置editor/fckeditor/fckconfig.js 文件</td>
    </tr>
    <tr>
      <td align="right">显示的宽度：</td>
      <td class="tl"><input name="SupportHtmlType_Width" type="text" class="Ainput" value="<%=SupportHtmlType_Width%>" maxlength="4" size="10" id="SupportHtmlType_Width" />
        px</td>
    </tr>
    <tr>
      <td align="right">显示的高度：</td>
      <td class="tl"><input name="SupportHtmlType_Heigh" type="text" class="Ainput" value="<%=SupportHtmlType_Heigh%>" maxlength="4" size="10" id="SupportHtmlType_Heigh" />
        px</td>
    </tr>
    
    <tr>
      <td align="right">是否保存远程图片：</td>
      <td  class="tl"><input id="savepic_0" <% IF savepic = "0" Then echo "Checked" %>   type="radio" name="savepic" value="0" />
<label for="savepic_0">是</label>	

<input id="savepic_1" <% IF savepic = "1" Then echo "Checked" %>   type="radio" name="savepic" value="1" />
<label for="savepic_1">否</label>	</td>
    </tr>      
  </tbody>
  <tbody id="DivRadioType" style="display:none">
    <tr>
      <td align="right">分行键入每个选项：</td>
      <td class="tl"><textarea name="RadioType_Content" rows="6" cols="40" id="RadioType_Content"><%=RadioType_Content%></textarea>
	  <font color=red>注意 要按照格式书写 名称-值, 以 - 隔开,列:合肥-HeFei</font></td></tr>
    <tr>
      <td align="right">显示选项：</td>
      <td><table id="RadioType_Type" border="0">
        <tr>
          <td class="tl">
		  <input id="RadioType_Type_0"  <% IF RadioType_Type = "0" Then echo "Checked" %>  type="radio" name="RadioType_Type" value="0" checked="checked" />
                <label for="RadioType_Type_0">单选下拉列表框</label></td>
        </tr>
        <tr>
          <td class="tl"><input id="RadioType_Type_1" <% IF RadioType_Type = "1" Then echo "Checked" %>  type="radio" name="RadioType_Type" value="1" />
                <label for="RadioType_Type_1">单选按钮</label></td>
        </tr>
      </table></td>
    </tr>
  </tbody>
  <tbody id="DivListBoxType" style="display:none">
    <tr>
      <td align="right">分行键入每个选项：</td>
      <td  class="tl"><textarea name="ListBoxType_Content" rows="6" cols="40" id="ListBoxType_Content"><%=ListBoxType_Content%></textarea></td></tr>
    <tr>
      <td align="right">显示选项：</td>
      <td><table id="ListBoxType_Type" border="0">
        <tr>
          <td class="tl"><input id="ListBoxType_Type_0"  <% IF ListBoxType_Type = "0" Then echo "Checked" %>  type="radio" name="ListBoxType_Type" value="0" checked="checked" />
                <label for="ListBoxType_Type_0">复选框</label></td>
        </tr>
        <tr>
          <td class="tl"><input id="ListBoxType_Type_1"  <% IF ListBoxType_Type = "1" Then echo "Checked" %>  type="radio" name="ListBoxType_Type" value="1" />
                <label for="ListBoxType_Type_1">多选列表框</label></td>
        </tr>
      </table></td>
    </tr>
  </tbody>
  <tbody id="DivDateType" style="display:none">
  </tbody>
  <tbody id="DivPicType" style="display:none">
    <tr>
      <td align="right">显示选项：</td>
      <td><table id="RadioPic_Type" border="0">
        <tr>
          <td class="tl">
		  
     <input id="RadioPic_Type_0"    type="radio" name="RadioPic_Type" value="0"  <% IF RadioPic_Type = "0"  Then echo "Checked" %>    />
                <label for="RadioPic_Type_0">单个文件上传</label></td>
        </tr>
        <tr>
          <td class="tl">
          <input id="RadioPic_Type_1"   type="radio" name="RadioPic_Type" value="1"   <% IF RadioPic_Type = "1" Then echo "Checked" %>  />
                <label for="RadioPic_Type_1">多个文件上传</label></td>
        </tr>
		
		  
		
      </table></td>
    </tr>  
  
      <tr>
      <td align="right">显示的宽度：</td>
      <td class="tl"><input name="RadioPicType_Width" type="text" class="Ainput" value="<%=RadioPicType_Width%>" maxlength="4" size="10" id="RadioPicType_Width" />
        px</td>
    </tr>
    <tr>
      <td align="right">显示的高度：</td>
      <td class="tl"><input name="RadioPicType_Height" type="text" class="Ainput" value="<%=RadioPicType_Height%>" maxlength="4" size="10" id="RadioPicType_Height" />
        px</td>
    </tr>
		
  </tbody>
  <tbody id="DivRadomType" style="display: none">
  </tbody>
  <tbody id="DivFileType" style="display:none">
  </tbody>
  <tbody id="DivNumberType" style="display:none">
    <tr>
      <td align="right">文本框长度：</td>
      <td class="tl"><input name="NumberType_TitleSize" type="text" class="Ainput" value="40" maxlength="4" size="10" id="NumberType_TitleSize" /></td>
    </tr>
  </tbody>
  <tr>
	<Td align="right">默认值：</td>
      <td class="tl">
 	  <textarea name="type_Default" rows="6" cols="40" id="type_Default"><%=type_Default%></textarea>
 	  注：没有数据录入的默认值，与前台显示无关.</td>
  </tr>

  <tr>
    <td></td>
    <td class="tl">
	  <input type=button onclick=CheckForm() class="btn btn_primary"  name=Submit1 value="  保存字段  " />
      &nbsp;&nbsp; <input type="reset" class="btn" name="Submit2" value="  重置  ">	</td>
  </tr>
</table>

<script language="JavaScript" type="text/javascript">
function FormatTitle(obj, obj2, def_value)
{
    var FormatFlag = obj.options[obj.selectedIndex].value;
    var tmp_Title = FilterHtmlStr(obj2.value);
    switch(FormatFlag)
    {
        case "1" :
            obj2.value = "UserMode";
            break;
        case "2" :
            obj2.value = "Simple";
            break;
        case "3" :
            obj2.value = "Default";
            break;
    }
    obj.selectedIndex = 0;
}
function FilterHtmlStr(str)
{
    str = str.replace(/<.*?>/ig, "");
    return str;
}
function SelectModelType()
{
    var TypeCount=document.getElementsByName("FieldType"); 
    
    for(var i=1;i<TypeCount.length;i++)
    { 
        var DivType=eval("Div"+TypeCount[i].value);
        
        if(TypeCount[i].checked)
        {
            DivType.style.display="";
        }
        else
        {
            DivType.style.display="none";
        }
    }
}


function chk(n){
	if (n == "1"){
		checks1.style.display='none';
		checks2.style.display='none';
		checks3.style.display='';
 	}
	else  if (n == "2"){
		checks1.style.display='';
		checks2.style.display='';
		checks3.style.display='none';
  	}
	else
	{
		checks1.style.display='none';
		checks2.style.display='none';
		checks3.style.display='none';
 	}
}



	function CheckForm()
	{ var form=document.tcjdxr;
	  
	 if (form.Title.value=='')
		{ alert("字段别名不能够为空！");   
		  form.Title.focus();    
		   return false;
		}
	 if (form.FieldName.value=='')
		{ alert("字段名称不能够为空！!");   
		  form.FieldName.focus();    
		   return false;
		}
	    form.submit();
        return true;
	}	
</script>
    <script language="javascript">chk("<%= check %>");</script>


<%  End Sub
%>






<script type="text/javascript">
 
	function SelectModelType()
{
    var TypeCount=document.getElementsByName("FieldType"); 
    
    for(var i=1;i<TypeCount.length;i++)
    { 
        var DivType=eval("Div"+TypeCount[i].value);
        
        if(TypeCount[i].checked)
        {
            DivType.style.display="";
        }
        else
        {
            DivType.style.display="none";
        }
    }
}

 </script>


</div>
</body>
</html>
