<!--#include file="../../ACT.Function.asp"-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>自定义表单管理 By ACTCMS.COM</title>
<link href="../../Images/css1/css.css" rel="stylesheet" type="text/css">
</head>
<body>
<%
	   Dim Act_Form,ModeID,ModeName,Rs
	   ModeID = ACTCMS.ChkNumeric(Request("ModeID"))
	   if ModeID=0 or ModeID="" Then ModeID=1
		ModeName=ACTCMS.actexe("select ModeName from ModeForm_ACT where ModeID="&ModeID&"")(0)
		 %>
		<table width="590" border="0" align="center" cellpadding="2" cellspacing="1" class="table">
    <form name="form1" method="post" action="" id="form1">
	<td align="center" class="bg_tr"><%= ModeName %>的HTML调用代码</td>
    </tr>
  <tr>
    <td align="center">
	<%	If ACTCMS.S("A")="Html" Then %>
    <textarea name="textarea" cols="50" rows="24"  style="width:100%;"><% Call ListForm() %></textarea>
	<%Else %><textarea name="textarea" cols="10" rows="4"  style="width:100%;"><%response.write "<script language=""javascript"" type=""text/javascript"" src="""
response.write actcms.ActCMS_Sys(2)&ACTCMS.ActSys&"plus/Form/ACT.F.ASP?ModeID="&ModeID
	response.write """></script>"%></textarea>
	<%End If %>
	</td>
    </tr>
  <tr>
    <td align="center"><input id="Button1" type="button" value=" 复制到剪贴板 " class="ACT_btn" onClick="A_CP('textarea')" />
                                &nbsp;
    <input id="Button2" type="button" value=" 关闭对话框 " class="ACT_btn" onClick="window.close()" /></td>
  </tr></form>
</table>


	<%


	Sub ListForm()
	 If Not ACTCMS.ACTEXE("SELECT ModeID FROM ModeForm_ACT Where ModeID=" & ModeID & " order by ModeID desc").eof Then
		   Act_Form="<table width=""100%"" border=""0"" align=""center"" cellpadding=""2"" cellspacing=""1"">"& vbCrLf
		   Act_Form=Act_Form & "<script type='text/javascript' src='" &ACTCMS.ActSys&"ACT_INC/WebTime/WdatePicker.js'></script>"
		   Act_Form=Act_Form & "<form name=""myform"" action=""" &ACTCMS.ActSys&  "plus/Form/ACT.F.ASP?A=Save&ModeID=" & ModeID & """ method=""post""> "& vbCrLf
		   Act_Form=Act_Form& ACT_MXList(ModeID)& vbCrLf
		   Set Rs=ACTCMS.actexe("select FormCode from ModeForm_ACT where ModeID="&ModeID&"")
			if not  rs.eof then
				if Rs("FormCode")=0 then 
					Act_Form=Act_Form& "<tr><td>验证码：</td><td>"
				Act_Form=Act_Form& "<input type=""text"" size=""10"" name=""Code""> <img style=""cursor:hand;""  src="""&ACTCMS.ActSys&"ACT_INC/Code.asp?s='+Math.random();"" id=""IMG1"" onclick=this.src="""&ACTCMS.ActSys&"ACT_INC/Code.asp?s='+Math.random();"" alt=""看不清楚? 换一张！"">"
				Act_Form=Act_Form& "</td></tr>"
			end if 
			end if  
		   Act_Form=Act_Form& "<tr> <td  colspan=""2"" align=""center"">"
		   Act_Form=Act_Form&"<input type=submit  name=Submit1 value=""  提 交  "" />&nbsp;"
		   Act_Form=Act_Form& "<input type=""reset"" name=""Submit2""  value=""  重 置  "" /></td></tr>"
		   Act_Form=Act_Form&  "</form>"& vbCrLf
		   Act_Form=Act_Form&  "</table>"& vbCrLf
		   response.write Act_Form
		 End if	
	End Sub 

	Public Function ACT_MXList(ModeID)'表现方式.输出模型
	 Dim RSObj
	  Set RSObj=ACTCMS.ACTEXE("Select * from TableForm_ACT  Where ModeID=" & ModeID & " and ISType = 0  order by OrderID desc,ID Desc")
		If Not rsobj.eof Then 
			Do While Not RSObj.Eof
				ACT_MXList=ACT_MXList &"<tr><td  width=""10%""  align=""left"">"&RSObj("Title")&"：</td><td align=""left"">"&ListField(RSObj,RSObj("id"))&"</td></tr>"
			RSObj.MoveNext
			Loop
		End If 
	  RSObj.Close:Set RSObj=Nothing
	End function


	Function ListField(RSObj,id)
		Dim i , TitleTypeArr,checked,IsNotNull
		If rsobj("IsNotNull")="0" Then 
			IsNotNull="  <font color=red title=""必填"">*</font>  "&rsobj("Description")
		Else
			IsNotNull="  "&rsobj("Description")
		End If 
		 Select Case RSObj("FieldType")
		   Case "TextType"
				ListField= "<input type=""text"" title="""&RSObj("Description")&""" name="""&RSObj("FieldName")&""" size="""&RSObj("width")&""" value="""&RSObj("Type_Default")&""">"&IsNotNull
		   Case "MultipleTextType"
				ListField= "<textarea title="""&RSObj("Description")&""" name="""&RSObj("FieldName")&""" style=""height:"&RSObj("height")&"px;width:"&RSObj("width")&"px;"">"&RSObj("Type_Default")&"</textarea>"&IsNotNull
		   Case "MultipleHtmlType"
				ListField="<input type=hidden id="&RSObj("FieldName")&" name="&RSObj("FieldName")&" value="&RSObj("Type_Default")&"><input type=hidden id="&RSObj("FieldName")&"___Config value=><iframe id="&RSObj("FieldName")&"___Frame src="&ACTCMS.ActSys&"editor/fckeditor/editor/fckeditor.html?InstanceName="&RSObj("FieldName")&"&Toolbar="&RSObj("Content")&" width="&RSObj("width")&"px height="&RSObj("height")&"px frameborder=no scrolling=no></iframe>"
		   Case "RadioType"
				TitleTypeArr=Split(RSObj("Content"), vbCrLf)
				If RSObj("Type_Type")=0 Then 
				  ListField= ListField&"<select  name="""&RSObj("FieldName")&""">"
				  For I = 0 To UBound(TitleTypeArr)
					If RSObj("Type_Default")=TitleTypeArr(I) Then checked="selected" Else checked=""
					ListField = ListField & "<option value='" & TitleTypeArr(I) & "' "&checked&">" & TitleTypeArr(I) & "</option>"& vbCrLf
				  Next
					ListField= ListField&" </select>"&IsNotNull
				Else
				  For I = 0 To UBound(TitleTypeArr)
					If RSObj("Type_Default")=TitleTypeArr(I) Then checked="checked" Else checked=""
					ListField = ListField &"<label for="""&RSObj("FieldName")&i&"""> <input  id="""&RSObj("FieldName")&i&""" type=""radio""  name="""&RSObj("FieldName")&""" value="""&TitleTypeArr(I)&""" "&checked&" />"&TitleTypeArr(I)&"&nbsp;&nbsp;</label>"& vbCrLf
				  Next
				    ListField = ListField&IsNotNull
				End If 
		   Case "ListBoxType"
				TitleTypeArr=Split(RSObj("Content"), vbCrLf)
				If RSObj("Type_Type")=0 Then 
				  For I = 0 To UBound(TitleTypeArr)
					If RSObj("Type_Default")=TitleTypeArr(I) Then checked="checked" Else checked=""
					ListField = ListField &"<label for="""&RSObj("FieldName")&i&"""> <input  id="""&RSObj("FieldName")&i&""" type=""checkbox""  name="""&RSObj("FieldName")&""" value="""&TitleTypeArr(I)&""" "&checked&" />"&TitleTypeArr(I)&"&nbsp;&nbsp;</label>"& vbCrLf
				  Next
				   ListField = ListField&IsNotNull
				Else
				  ListField= ListField&"<select  size=""4""   style=""width:300px;height:126px""  name="""&RSObj("FieldName")&""" multiple>"
				  For I = 0 To UBound(TitleTypeArr)
					If RSObj("Type_Default")=TitleTypeArr(I) Then checked="checked" Else checked=""
					ListField = ListField & "<option value=""" & TitleTypeArr(I) & """ "&checked&">" & vbCrLf& TitleTypeArr(I) & "</option>"& vbCrLf
				  Next
					ListField= ListField&" </select>"&IsNotNull
				End If 
		   Case "DateType"
				ListField= ListField&"<input name="""&RSObj("FieldName")&""" type=""text"" id="""&RSObj("FieldName")&""" value="""" >"
				ListField= ListField&"<input type=""button"" class=""ACT_btn"" width=""34"" onclick=""OpenWindowAndSetValue('"&ACTCMS.ActSys&"act_inc/SelectDate.asp',280,150,window,document.tcjdxr."&RSObj("FieldName")&");document.tcjdxr."&RSObj("FieldName")&".focus();"" value=""选择日期"" />"	&IsNotNull
		   Case "PicType"
				ListField= "<input  name="""&RSObj("FieldName")&""" type=""text""  value="""" size=""40""><iframe src="""&ACTCMS.ActSys&"Plus/Form/Upload.asp?ModeID="&RSObj("ModeID")&"&instr=1&instrname="&RSObj("FieldName")&"&YNContent=0&amp;instrct=content"" name=""image"" width='75%' height=""25"" scrolling=""No"" frameborder=""0"" id=""image""></iframe>"
		   Case "FileType"
				ListField= "<input  name="""&RSObj("FieldName")&""" type=""text""  value="""" size=""40""><iframe src="""&ACTCMS.ActSys&"Plus/Form/Upload.asp?ModeID="&RSObj("ModeID")&"&instr=1&instrname="&RSObj("FieldName")&"&YNContent=0&file=yes&amp;instrct=content"" name=""image"" width='75%' height=""25"" scrolling=""No"" frameborder=""0"" id=""image""></iframe>"&IsNotNull
		   Case "NumberType"
				ListField= "<input type=""text"" name="""&RSObj("FieldName")&""" size="""&RSObj("width")&""" value="""&RSObj("Type_Default")&""">"&IsNotNull
		   Case "RadomType"
				ListField= "<input type=""text"" name="""&RSObj("FieldName")&""" size=""25""  value="""&ACTCMS.MakeRandom(20)&""">"&IsNotNull
		   Case else
				ListField= "<font color=red>该字段错误</font>"
		   End Select 
	End Function 


%>		
<script>
			function A_CP(ob)
			{
				var obj=MM_findObj(ob); 
				if (obj) 
				{
					obj.select();js=obj.createTextRange();js.execCommand("Copy");}
					alert('复制成功，粘贴到你要调用的html代码里即可!');
				}
				function MM_findObj(n, d) { //v4.0
			  var p,i,x;
			  if(!d) d=document;
			  if((p=n.indexOf("?"))>0&&parent.frames.length)
			   {
				d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);
			   }
			  if(!(x=d[n])&&d.all) x=d.all[n];
			  for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
			  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
			  if(!x && document.getElementById) x=document.getElementById(n); return x;
			}
  </script>
		  