<%
	Class ACTM_diy
 
	
	Public Function ACT_MXEdit(ModeID,aid)'表现方式.输出模型
 	 Dim RS
	  Set RS=fycms.ACTEXE("Select * from Table_diy_fy  Where ModeID=" & ModeID & "  and fycms=1 and aid="&aid&"  order by OrderID desc,ID asc")
	  	Do While Not RS.Eof
			ACT_MXEdit=ACT_MXEdit &"<dl><dt>"&RS("Title")&"：</dt>"&vbCrLf&"<dd>"&EditField(RS,ModeID,aID)&"</dd></dl>"&vbCrLf
			
		RS.MoveNext
		Loop
	  RS.Close:Set RS=Nothing
	 ACT_MXEdit=vbCrLf&ACT_MXEdit& vbCrLf 
	End function

  
 

 
	
	Function tip_fy(ModeID,FieldName)
		  Dim RSObj
		  Set RSObj=fycms.ACTEXE("Select * from Table_diy_fy  Where ModeID=" & ModeID & " and FieldName='"&FieldName&"'  order by OrderID asc,ID Desc")
			If Not rsobj.eof Then 
				If rsobj("IsNotNull")="0" Then 
					tip_fy="  <font color=red title=""必填"">*</font>  "&rsobj("Description")
				Else
					tip_fy="  "&rsobj("Description")
				End If 
			Else
				tip_fy=""
			End If 
	End Function 

 

	Function EditField(RSObj,ModeID,aID)

		Dim i,IsNotNull,TitleTypeArr,checked,rs1,FieldName
		Dim arrtitle,arrvalue,titles,d_content
	  
	  FieldName= RSObj("FieldName")
		d_content=LTemplate(fycms.actsys&"data/Field/"&ModeID&"/"&md5(modeid&RSObj("FieldName")&aID,32)&".txt")
 		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"
				EditField= "<input class=""Ainput"" title="""&RSObj("Description")&""" type=""text"" name="""&RSObj("FieldName")&""" size="""&RSObj("width")&""" value="""&d_content&""">"&IsNotNull& vbCrLf 
		   Case "MultipleTextType"
				EditField= "<textarea title="""&RSObj("Description")&""" name="""&RSObj("FieldName")&""" style=""height:"&RSObj("height")&"px;width:"&RSObj("width")&"px;"">"&d_content&"</textarea>"&IsNotNull& vbCrLf 
		   Case "MultipleHtmlType"
				EditField=EditField&writeeditor(0,""&RSObj("FieldName")&"",""&RSObj("FieldName")&"","",d_content)
 		   Case "RadioType"
				TitleTypeArr=Split(RSObj("Content"), vbCrLf)
				If RSObj("Type_Type")=0 Then 
				  EditField= EditField&"<select  name="""&RSObj("FieldName")&""">"
				  For I = 0 To UBound(TitleTypeArr)
					arrtitle=Split(TitleTypeArr(I),"-")
					If  UBound(arrtitle)="1" Then 
						titles=arrtitle(0)
						arrvalue=arrtitle(1)
					ElseIf  TitleTypeArr(I)<>"" Then 
					titles=arrtitle(0)
					arrvalue=arrtitle(0)
					Else
						Exit for
					End If 

					If d_content=arrvalue Then checked="selected" Else checked=""
					EditField = EditField & "<option value='" & arrvalue & "' "&checked&">" & titles & "</option>"& vbCrLf
				  Next
					EditField= EditField&" </select>"&IsNotNull& vbCrLf 
				Else
				  For I = 0 To UBound(TitleTypeArr)
					arrtitle=Split(TitleTypeArr(I),"-")
					If  UBound(arrtitle)="1" Then 
						titles=arrtitle(0)
						arrvalue=arrtitle(1)
					ElseIf  TitleTypeArr(I)<>"" Then 
					titles=arrtitle(0)
					arrvalue=arrtitle(0)
					Else
						Exit for
					End If 
					
					
					If d_content=arrvalue Then checked="checked" Else checked=""
					EditField = EditField &"<label for="""&RSObj("FieldName")&i&"""> <input  id="""&RSObj("FieldName")&i&""" type=""radio""  name="""&RSObj("FieldName")&""" value="""&arrvalue&""" "&checked&" />"&titles&"&nbsp;&nbsp;</label>"& vbCrLf
				  Next
				    EditField = EditField&IsNotNull
				End If 
		   Case "ListBoxType"
				TitleTypeArr=Split(RSObj("Content"), vbCrLf)
				If RSObj("Type_Type")=0 Then 
				  For I = 0 To UBound(TitleTypeArr)
				
					arrtitle=Split(TitleTypeArr(I),"-")
					If  UBound(arrtitle)="1" Then 
						titles=arrtitle(0)
						arrvalue=arrtitle(1)
					ElseIf  TitleTypeArr(I)<>"" Then 
					titles=arrtitle(0)
					arrvalue=arrtitle(0)
					Else
						Exit for
					End If 
					If fycms.FoundInArr(d_content,arrvalue,",")=true Then checked="checked" Else checked=""
					EditField = EditField &"<label for="""&RSObj("FieldName")&i&"""> <input  id="""&RSObj("FieldName")&i&""" type=""checkbox""  name="""&RSObj("FieldName")&""" value="""&arrvalue&""" "&checked&" />"&titles&"&nbsp;&nbsp;</label>"& vbCrLf
				  Next
				  EditField = EditField&IsNotNull
				Else
				    EditField= EditField&"<select  size=""4""   style=""width:300px;height:126px""  name="""&RSObj("FieldName")&""" multiple>"
				  For I = 0 To UBound(TitleTypeArr)
					arrtitle=Split(TitleTypeArr(I),"-")
					If  UBound(arrtitle)="1" Then 
						titles=arrtitle(0)
						arrvalue=arrtitle(1)
					ElseIf  TitleTypeArr(I)<>"" Then 
					titles=arrtitle(0)
					arrvalue=arrtitle(0)
					Else
						Exit for
					End If 
					If fycms.FoundInArr(d_content,arrvalue,",")=true Then checked="selected" Else checked=""
					EditField = EditField & "<option value=""" & arrvalue & """ "&checked&">" & vbCrLf& titles & "</option>"& vbCrLf
				  Next
					EditField= EditField&" </select>"&IsNotNull
				End If 
		   Case "DateType"
				EditField= EditField&"<input class=""Ainput"" name="""&RSObj("FieldName")&""" type=""text"" id="""&RSObj("FieldName")&""" value="""&d_content&""" onClick=WdatePicker();  >"&IsNotNull
		   Case "PicType"
  			 	If RSObj("Type_Type")="0" Then 
  			
						EditField= "<input t class=""Ainput""  name="""&RSObj("FieldName")&""" type=""text"" id="""&RSObj("FieldName")&""" value="""&d_content&""" size=""50"">"&IsNotNull
				
			
				  	   EditField=EditField&"<input id=""PicUrls"&RSObj("FieldName")&""" class=""btn btn_primary"" onClick=""javascript:tdialog(1,'"&fycms.actsys&fycms.adminurl&"/include/Upload_Admin.asp?ModeID=1&instr=1&instrname="&RSObj("FieldName")&"&YNContent=1&file=yes&amp;instrct=content');"" name=""button"" type=""button""   value=""点击上传文件"">"&IsNotNull

				
				Else

					EditField=EditField&"<style type=""text/css"">"		
					EditField=EditField&"#thumbnails"&RSObj("FieldName")&" div.thumbshow{text-align:center;margin:2px;padding:2px;width:162px;height:155px;border: dashed 1px #B8B808; background:#FFFFF6;float:left}"
					EditField=EditField&"#thumbnails"&RSObj("FieldName")&" div.thumbshow img{width:130px;height:92px;border:1px solid #CCCC00;padding:1px}"
					EditField=EditField&"</style>"


					EditField=EditField&"<div id=""sapload"&RSObj("FieldName")&""">"& vbCrLf 
					EditField=EditField&	"</div>"& vbCrLf 
					EditField=EditField&"<div id=""divFileProgressContainer"&RSObj("FieldName")&"""></div>"&IsNotNull
					EditField=EditField&"<div id=""thumbnails"&RSObj("FieldName")&"""></div>"&IsNotNull
					EditField=EditField&"<input type='hidden' name='PicUrls"&RSObj("FieldName")&"' id='PicUrls"&RSObj("FieldName")&"'>"&IsNotNull
					
					
					EditField=EditField& "<script type=""text/javascript"">"& vbCrLf 
					EditField=EditField&"// <![CDATA["& vbCrLf 
					EditField=EditField&"var so = new SWFObject("""&fycms.ACTSYS&"fy_inc/sapload.swf"", ""sapload"&RSObj("FieldName")&""", ""450"", ""25"", ""9"", ""#ffffff"");"& vbCrLf 
					EditField=EditField&"so.addVariable('types','jpg;gif;bmp;png');"
					EditField=EditField&"so.addVariable('isGet','1');"& vbCrLf 
					EditField=EditField&"so.addVariable('args','aid="&id&";ih="&RSObj("FieldName")&";myid=Upload;ModeID="&ModeID&";U='+fyuser+"";""+';P='+fypass+"";""+'Yname="&RSObj("FieldName")&"');"& vbCrLf 
					EditField=EditField&"so.addVariable('upUrl','"&fycms.ACTSYS&fycms.admindir()&"/include/Uploadall.asp');"& vbCrLf 
					EditField=EditField&"so.addVariable('fileName','Filedata');"& vbCrLf 
					EditField=EditField&"so.addVariable('maxNum','110');"& vbCrLf 
					EditField=EditField&"so.addVariable('maxSize','"&fycms.fycms_Sys(10)/1024&"');"& vbCrLf 
					EditField=EditField&"so.addVariable('etmsg','1');"& vbCrLf 
					EditField=EditField&"so.addVariable('ltmsg','1');"& vbCrLf 
					EditField=EditField&"so.addParam('wmode','transparent');"& vbCrLf 
					EditField=EditField&"so.write(""sapload"&RSObj("FieldName")&""");"& vbCrLf 


 
					  EditField=EditField&"var PicUrls"&RSObj("FieldName")&"='"&fycms.typepic(RSObj("FieldName"),id)&"';"& vbCrLf 
					  EditField=EditField&"var PicUrlArr"&RSObj("FieldName")&"=null;"& vbCrLf 
					  EditField=EditField&"if (PicUrls"&RSObj("FieldName")&"!='')"& vbCrLf 
					  EditField=EditField&" { "& vbCrLf 
					  EditField=EditField&"PicUrlArr"&RSObj("FieldName")&"=PicUrls"&RSObj("FieldName")&".split('|||');"& vbCrLf 
					  EditField=EditField&" for ( var i=1 ;i<PicUrlArr"&RSObj("FieldName")&".length+1;i++){ "& vbCrLf 
					  '  EditField=EditField&"  addImage(""aaa"", """", """", """");"& vbCrLf 
					 
					  
					 EditField=EditField&"    addImage('"&RSObj("FieldName")&"',PicUrlArr"&RSObj("FieldName")&"[i-1].split('|')[0],PicUrlArr"&RSObj("FieldName")&"[i-1].split('|')[1],PicUrlArr"&RSObj("FieldName")&"[i-1].split('|')[2],PicUrlArr"&RSObj("FieldName")&"[i-1].split('|')[3],PicUrlArr"&RSObj("FieldName")&"[i-1].split('|')[4]);"& vbCrLf 
					  EditField=EditField&"  }"& vbCrLf 
					  EditField=EditField&"  }"& vbCrLf 

 
					EditField=EditField&"// ]]>"& vbCrLf 
					EditField=EditField&"</script>"			& vbCrLf 	
					 


				End If 
 		   Case "FileType"
						EditField= "<input t class=""Ainput""  name="""&RSObj("FieldName")&""" type=""text"" id="""&RSObj("FieldName")&""" value="""&d_content&""" size=""50"">"&IsNotNull
				
			
				  	   EditField=EditField&"<input id=""PicUrls"&RSObj("FieldName")&""" class=""btn btn_primary"" onClick=""javascript:tdialog(1,'"&fycms.actsys&fycms.adminurl&"/include/Upload_Admin.asp?ModeID=1&instr=1&instrname="&RSObj("FieldName")&"&YNContent=1&file=yes&amp;instrct=content');"" name=""button"" type=""button""   value=""点击上传文件"">"&IsNotNull
		   Case "NumberType"
				EditField= "<input class=""Ainput""  type=""text"" name="""&RSObj("FieldName")&""" size="""&RSObj("width")&""" value="""&d_content&""">"&IsNotNull
		   Case "RadomType"
				EditField= "<input class=""Ainput""  type=""text"" name="""&RSObj("FieldName")&""" size=""25""  value="""&d_content&""">"&IsNotNull
		   Case else
				EditField= "<font color=red>该字段错误</font>"
		   End Select 
 	End Function 





 


End Class 
	Dim M_diy
	Set M_diy = New ACTM_diy
%>