<!--#include file="../Include/Head.asp"-->

<%call getValidform("proSet",1,0,1)%>
<%call getValidform("photosform",1,1,1)%>
<%Call Kindeditor("editor","Content","Product",1)%>
<%Call Kindeditormini("editor2","Content_a","Product",0)%>
<%Call KindeditorPic("editorPic","Product",0,"upload","Pic")%>
<%Call KindeditorPic("editorPic_a","Product",0,"upload1","Pic_a")%>
<%Call KindeditorPic("editorPic_2","Product",0,"uploada2","Pic_a2")%>
<%Call KindeditorPic("editorPic_3","Product",0,"uploada3","Pic_a3")%>

	<div class="place">
    <span>位置：</span>
    <ul class="placeul">
    <li><a href="../Main/Right.asp">首页</a></li>
    <li><a href="Add.asp">添加产品</a></li>
    </ul>
    </div>
    
    
    <div class="toola" style="border-bottom:1px solid #ddd;">
	<a href="javascript:;" onClick="ShowMore('proSet','symbol')"><font id="symbol">+</font> <font color="red">自定义字段</font></a>
    <ul id="proSet" style="display:none; padding:8px; line-height:24px;">
    <form class="proSet" method="post" action="?Action=ProSet">
    <input type="checkbox" name="ProField" id="ProField" value="PRO01" checked disabled > 名称/标题 
    <input type="checkbox" name="ProField" id="ProField" value="PRO02" <%If IsProField("PRO02") Then%>checked<%End If%>> 分类 
    <input type="checkbox" name="ProField" id="ProField" value="PRO03" <%If IsProField("PRO03") Then%>checked<%End If%>> 略缩图 
    <input type="checkbox" name="ProField" id="ProField" value="PRO04" checked disabled > 内容 
    <input type="checkbox" name="ProField" id="ProField" value="PRO05" <%If IsProField("PRO05") Then%>checked<%End If%>> 副标题 
    <input type="checkbox" name="ProField" id="ProField" value="PRO06" <%If IsProField("PRO06") Then%>checked<%End If%>> 页面名 
    <input type="checkbox" name="ProField" id="ProField" value="PRO07" <%If IsProField("PRO07") Then%>checked<%End If%>> 关键词 
    <input type="checkbox" name="ProField" id="ProField" value="PRO08" <%If IsProField("PRO08") Then%>checked<%End If%>> 描述 
    <input type="checkbox" name="ProField" id="ProField" value="PRO09" <%If IsProField("PRO09") Then%>checked<%End If%>> 作者 
    <input type="checkbox" name="ProField" id="ProField" value="PRO10" <%If IsProField("PRO10") Then%>checked<%End If%>> 来源 
    <input type="checkbox" name="ProField" id="ProField" value="PRO11" <%If IsProField("PRO11") Then%>checked<%End If%>> 外链 
    <input type="checkbox" name="ProField" id="ProField" value="PRO12" <%If IsProField("PRO12") Then%>checked<%End If%>> 备用图 
    <input type="checkbox" name="ProField" id="ProField" value="PRO13" <%If IsProField("PRO13") Then%>checked<%End If%>> 备用内容
    <input type="checkbox" name="ProField" id="ProField" value="PRO14" <%If IsProField("PRO14") Then%>checked<%End If%>> 备注信息
    <input type="submit" value="保存" style="padding:3px 12px;" >
    </form>
    </ul>
    </div>
    
    
  	<div id="tab1" class="tabson">
  
    <%
	sysID=Request_QueryString("id")
	action=Request_QueryString("action")
	If action="edit" then
		Set Rs=server.createobject("adodb.recordSet")
		Sql="select * from Jin_Photos where sysID="&sysID
		Rs.Open Sql,Conn,1,1
		Pid=Rs("Pid")
		PageName=Rs("PageName")
		Title=Rs("Title")
		Title_a=Rs("Title_a")
		Title_b=Rs("Title_b")
		Keywords=Rs("Keywords")
		Descriptions=Rs("Descriptions")
		Author=Rs("Author")
		From=Rs("From")
		Pic=Rs("Pic")
		Pic_a=Rs("Pic_a")
		Content=Rs("Content")
		Content_a=Rs("Content_a")
		Link=Rs("Link")
		Remark=Rs("Remark")
		Rs.close
		Set Rs=nothing
		'--内页多图
		Pic_a=split(Pic_a,"||")
		Pic_a1=Pic_a(0)
		Pic_a2=Pic_a(1)
		Pic_a3=Pic_a(2)
	End If
	%>
    <ul class="forminfo">
    <%If action="edit" then%>
    <form name="form1" class="photosform" action="?Action=editgo&id=<%=sysID%>" method="post">
    <%else%>
    <form name="form1" class="photosform" action="?Action=add" method="post">
    <%end if%>
    
        <li><label>名称/标题<b>*</b></label><input name="Title" type="text" class="newinput450" value="<%=Title%>" datatype="*" nullmsg="产品名称不能为空！" /><i class="Validform_checktip"></i>
        </li>
    
        <li <%If not IsProField("PRO05") Then%>class="hidden"<%End If%>><label>副标题<b></b></label><input name="Title_a" type="text" class="newinput450" value="<%=Title_a%>" /></li>
        
        <li <%If not IsProField("PRO02") Then%>class="hidden"<%End If%>><label class="left">分类<b>*</b></label>  
        <div class="vocation">
		<%call getclass(Web_ModuleID,"Pid",Pid,"Photos","s152")%>
        </div>
        </li>
    
        <li <%If not IsProField("PRO03") Then%>class="hidden"<%End If%>>
        <label>略缩图<b>*</b></label><input name="Pic" id="Pic" type="text" class="newinput450" readonly="readonly" value="<%=Pic%>" />
        <i><a href="javascript:;" id="upload">上传</a></i>  
        </li>
    
        <li <%If not IsProField("PRO12") Then%>class="hidden"<%End If%>><label class="left">内页图<b></b></label>
        <div class="left" style="margin-bottom:15px;">
        <div>
        <input name="Pic_a1" id="Pic_a" type="text" class="newinput450" readonly="readonly" value="<%=Pic_a1%>"/>
        <i><a href="javascript:;" id="upload1">上传</a></i>
        </div>
        <div>
        <input name="Pic_a2" id="Pic_a2" type="text" class="newinput450" readonly="readonly" value="<%=Pic_a2%>"/>
        <i><a href="javascript:;" id="uploada2">上传</a></i>
        </div>
        <div>
        <input name="Pic_a3" id="Pic_a3" type="text" class="newinput450" readonly="readonly" value="<%=Pic_a3%>"/>
        <i><a href="javascript:;" id="uploada3">上传</a></i>
        </div>
        </div>
        </li>
    
    
    
        
        <li <%If not IsProField("PRO06") Then%>class="hidden"<%End If%>>
        <label>页面名<b></b></label><input name="PageName" type="text" class="newinput450" value="<%=PageName%>" />
        </li>
        
        <li <%If not IsProField("PRO07") Then%>class="hidden"<%End If%>>
        <label>关键词<b></b></label><input name="Keywords" type="text" class="newinput450" value="<%=Keywords%>" />
        </li>
        
        <li <%If not IsProField("PRO09") Then%>class="hidden"<%End If%>>
        <label>作者<b></b></label><input name="Author" type="text" class="newinput450" value="<%=Author%>" />
        </li>
        
        <li <%If not IsProField("PRO10") Then%>class="hidden"<%End If%>>
        <label>来源<b></b></label><input name="From" type="text" class="newinput450" value="<%=From%>" />
        </li>
        
        <li <%If not IsProField("PRO11") Then%>class="hidden"<%End If%>>
        <label>外链<b></b></label><input name="Link" type="text" class="newinput450" value="<%=Link%>" />
        </li>
        
        <li <%If not IsProField("PRO08") Then%>class="hidden"<%End If%>>
        <label class="left">描述<b></b></label><textarea name="Descriptions" id="Descriptions" cols="" rows="" class="textinput" style="width:550px;height:60px; float:none"><%=Descriptions%></textarea>
        </li>
        
        <li><label class="left">内容<b>*</b></label><textarea name="Content" cols="" rows="" class="textinput" style="width:700px;height:320px;"><%=Content%></textarea></li>
        
        <li <%If not IsProField("PRO13") Then%>class="hidden"<%End If%>>
        <label class="left">备用内容<b></b></label><textarea name="Content_a" id="Content_a" cols="" rows="" class="textinput" style="width:700px;height:150px;"><%=Content_a%></textarea></li>
        
        <li <%If not IsProField("PRO14") Then%>class="hidden"<%End If%>>
        <label class="left">备注<b></b></label><textarea name="Remark" id="Remark" cols="" rows="" class="textinput" style="width:550px;height:60px;"><%=Remark%></textarea></li>
        
        <li><label>&nbsp;</label><input name="submit" type="submit" class="btn" value="<%If action="edit" then%>提交修改<%else%>确认添加<%end if%>"/>
        <input name="submit" type="button" class="btn" onclick="location.href='<%=session("PhotosPage")%>'"  value="返回列表"/>
        </li>
        
    </form>
    </ul>
    </div> 
    </div> 


<%
'添加图片
If action="add" then
	Pic = sub_str(Trim(request_Form("Pic")),"Upload")
	Pic_a1 = sub_str(Trim(request_Form("Pic_a1")),"Upload")
	Pic_a2 = sub_str(Trim(request_Form("Pic_a2")),"Upload")
	Pic_a3 = sub_str(Trim(request_Form("Pic_a3")),"Upload")
	PicBianhao=get_num("Jin_Photos","Bianhao","PIC")
	Set Rs=server.createobject("adodb.recordSet")
	Sql="select * from Jin_Photos where PageName='"&request_Form("PageName")&"'"
	Rs.open Sql,conn,1,3
	If rs.eof then
	Rs.Addnew
	Rs("lang")=Web_NowLang
	Rs("Bianhao")=PicBianhao
	Rs("Pid")=request_Form("Pid")
	Rs("PageName")=request_Form("PageName")
	Rs("Title")=request_Form("Title")
	Rs("Title_a")=request_Form("Title_a")
	Rs("Title_b")=request_Form("Title_b")
	Rs("Keywords")=replace(replace(request_Form("Keywords"),"，",",")," ",",")
	Rs("Descriptions")=request_Form("Descriptions")
	Rs("Author")=request_Form("Author")
	Rs("From")=request_Form("From")
	Rs("Pic")=Pic
	Rs("Pic_a")=Pic_a1&"||"&Pic_a2&"||"&Pic_a3
	Rs("Content")=request_Form("Content")
	Rs("Content_a")=request_Form("Content_a")
	Rs("Link")=request_Form("Link")
	Rs("Remark")=request_Form("Remark")
	Rs("Addtime")=getDate(Now(),"Y-M-D H:M:S")
	Rs("Edittime")=getDate(Now(),"Y-M-D H:M:S")
	Rs.Update
		'---------静态化
		Set Rsa=server.createobject("adodb.recordSet")
		Sqla="select top 1 * from Jin_Photos order by sysID desc"
		Rsa.open Sqla,conn,1,1
		If not Rsa.eof Then
		If Web_HtmlType=1 Then htmlLink="Case/"&Rsa("sysID")&".Html"
		If Web_HtmlType=2 Then htmlLink="Case/"&getDate(Rsa("Addtime"),"YMDHMS")&".html"
		If Web_HtmlType=3 Then htmlLink="Case/"&Rsa("Title")&".html"
		If Rs("PageName")<>"" then htmlLink1="Case/"&Rsa("PageName")&".Html"
		call getHtml( "Case.asp?ID="&Rsa("sysID") , htmlLink ) 
		call getHtml( "Case.asp?ID="&Rsa("sysID") , htmlLink1 ) 
		End If 
		Rsa.Close
		Set Rsa=nothing
		'---------
	Else 
		Call ShowMsg("该页面名已存在，不可重复！",1)
	End If
	Rs.close
	Set Rs=nothing
	If Web_Thumb then call getSmallPic(web_root&Pic, web_root&"Upload/Product/", Web_ThumbWidth , Web_ThumbHeight)
	response.Redirect session("ListPage")
End If
'修改图片
If action="editgo" then
	Pic = sub_str(Trim(request_Form("Pic")),"Upload")
	Pic_a1 = sub_str(Trim(request_Form("Pic_a1")),"Upload")
	Pic_a2 = sub_str(Trim(request_Form("Pic_a2")),"Upload")
	Pic_a3 = sub_str(Trim(request_Form("Pic_a3")),"Upload")
	Set Rsa=server.createobject("adodb.recordSet")
	Sqla="select * from Jin_Photos where PageName='"&request_Form("PageName")&"' And sysID<>"&request_QueryString("id")
	Rsa.open Sqla,conn,1,3
	If Rsa.eof then
		Set Rs=server.createobject("adodb.recordSet")
		Sql="select * from Jin_Photos where sysID="&request.QueryString("id")
		Rs.open Sql,conn,1,3
		Rs("lang")=Web_NowLang
		Rs("Pid")=request_Form("Pid")
		Rs("PageName")=request_Form("PageName")
		Rs("Title")=request_Form("Title")
		Rs("Title_a")=request_Form("Title_a")
		Rs("Keywords")=replace(replace(request_Form("Keywords"),"，",",")," ",",")
		Rs("Descriptions")=request_Form("Descriptions")
		Rs("Author")=request_Form("Author")
		Rs("From")=request_Form("From")
		Rs("Pic")=Pic
		Rs("Pic_a")=Pic_a1&"||"&Pic_a2&"||"&Pic_a3
		Rs("Content")=request_Form("Content")
		Rs("Content_a")=request_Form("Content_a")
		Rs("Link")=request_Form("Link")
		Rs("Remark")=request_Form("Remark")
		Rs("Edittime")=getDate(Now(),"Y-M-D H:M:S")
		Rs.Update
		'---------静态化
		If Web_HtmlType=1 Then htmlLink="Case/"&Rs("sysID")&".Html"
		If Web_HtmlType=2 Then htmlLink="Case/"&getDate(Rs("Addtime"),"YMDHMS")&".html"
		If Web_HtmlType=3 Then htmlLink="Case/"&Rs("Title")&".html"
		If Rs("PageName")<>"" then htmlLink1="Case/"&Rs("PageName")&".Html"
		call getHtml( "Case.asp?ID="&Rs("sysID") , htmlLink ) 
		call getHtml( "Case.asp?ID="&Rs("sysID") , htmlLink1 ) 
		'---------
		Rs.close
		Set Rs=nothing
	Else 
		Call ShowMsg("该页面名已存在，不可重复！",1)
	End If
	Rsa.close
	Set Rsa=nothing
	If Web_Thumb then call getSmallPic(web_root&Pic, web_root&"Upload/Product/", Web_ThumbWidth , Web_ThumbHeight)
	response.Redirect session("ListPage")
End If

If action="ProSet" Then
	conn.execute "UPDATE [Jin_Config] SET Web_ProField = '"&replace(request_Form("ProField")," ","")&"' where exists(select top 1 sysID from Jin_Config)"
	Call ShowMsg("",2)
End If
%>


<%Call BackFoot()%>