<!--#include file="../Include/Const.Asp" -->
<!--#include file="../Include/ConnDatabase.asp" -->
<!--#include file="../Include/system_language.asp" -->
<!--#include file="CheckAdmin.Asp"-->
<!--#include file="../Generate/SC_Config.Asp"-->
<!--#include file="../Generate/SC_Function.Asp"-->
<!--#include file="../Generate/SC_Product.Asp"-->
<!--#include file="../Generate/SC_Index.Asp"-->
<%
'*********************************************
'软件名称：电家企业网站内容管理系统
'软件开发：电脑家园工作室
'网   址：http://www.537600.cn
'服务QQ：530051328
'服务邮箱：bbfhq@163.com
'微信公众号：diannaojiayuan
'*********************************************
%>
<%
Dim Result
Result = request.QueryString("Result")
Dim ID, ProductName, ViewFlag, ClassSeo, SortName, SortID, SortPath
Dim ProductNo, Maker, CommendFlag, NewFlag, MobileFlag,IsTop, SeoTitle, SeoKeywords, SeoDescription
Dim SmallPic, BigPic, OtherPic, Content, ClickNumber, Sequence,N_Price,M_Price,V_Price,P_Price
ID = request.QueryString("ID")
Call ProductEdit()
Call SiteInfo()
%>
<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="<%=DianJiaCMS_Lang_Copyright(13)%>">
<meta name="author" content="<%=DianJiaCMS_Lang_Copyright(3)%>">
<title><%=DianJiaCMS_Lang_Copyright(1)%> <%=Soft_Version%></title>
<!--#Include file="DianJiaCMS_Css.Asp"-->
<script charset="utf-8" src="../KindEditor/kindeditor.js"></script>
<script charset="utf-8" src="../KindEditor/lang/zh_CN.js"></script>
<script charset="utf-8" src="../KindEditor/plugins/code/prettify.js"></script>
<script>
KindEditor.ready(function(K) {
	var editor = K.create('textarea[name="Content"]', {
		cssPath : '../KindEditor/plugins/code/prettify.css',
		uploadJson : '../KindEditor/asp/upload_json.asp?action=product',
		fileManagerJson : '../KindEditor/asp/file_manager_json.asp',
		allowFileManager : true,
		afterBlur : function() {
		this.sync();
		K.ctrl(document, 13, function() {
		K('form[name=editForm]')[0].submit();
		});
		K.ctrl(this.edit.doc, 13, function() {
		K('form[name=editForm]')[0].submit();
		});
		}
	});
	K('#SmallImage').click(function() {
		editor.loadPlugin('image', function() {
			editor.plugin.imageDialog({
				imageUrl : K('#SmallPic').val(),
				clickFn : function(url, title, width, height, border, align) {
					K('#SmallPic').val(url);
					editor.hideDialog();
				}
			});
		});
	});
	K('#BigImage').click(function() {
		editor.loadPlugin('image', function() {
			editor.plugin.imageDialog({
				imageUrl : K('#BigPic').val(),
				clickFn : function(url, title, width, height, border, align) {
					K('#BigPic').val(url);
					editor.hideDialog();
				}
			});
		});
	});
	K('#OtherImage').click(function() {
		editor.loadPlugin('multiimage', function() {
			var aVal=""
			editor.plugin.multiImageDialog({
				
				clickFn : function(urlList) {
					var div = K('#OtherPic');
					aVal=div.val()
					K.each(urlList, function(i, data) {
						if (div.val() == "")
							aVal =aVal + data.url
						else
							aVal =aVal + "|" +  data.url

					div.val(aVal);
					});
					editor.hideDialog();
				}
			});
		});
	});
});
</script>
</head>

<body>
<!--#Include file="DianJiaCMS_Top.Asp"-->
<!--#Include file="DianJiaCMS_Meun.Asp"-->
<div id="wrap">
	<%
	If InStr(CompanyAdminPurview, "|3,") = 0 Then
		response.Write ("<br /><br /><div style='height:100%; text-align:center' class='main'><font style=""color:red; font-size:14px;"")>"&DianJiaCMS_Lang_System(26)&"</font></div>")
		response.End
	End If
	%>
    <div class="main">
        <div class="row">
            <ol class="breadcrumb">
                <li><i class="fa fa-home"></i> <%=DianJiaCMS_Lang_Copyright(14)%></li>
                <li class="active"><a href="">功能模块</a></li>
                <li class="active">产品管理</li>
            </ol>	
        </div>
        <div class="row ">
            <div class="col-lg-12 hideInIE8">
                <div class="panel panel-default">
                    <div class="panel-heading">
                        <h2><i class="fa fa-edit"></i><span class="break"></span><strong>产品管理</strong></h2> 
                    </div>
                    <div class="panel-body">
                        <a class="ShortCut1" href="DianJiaCMS_Funct_ProductEdit.Asp?Result=Add">  
                            <i class="fa fa-sign-in"></i>
                            <div class="title">添加产品</div>
                        </a>					
                        <a class="ShortCut2" href="DianJiaCMS_Funct_Product.Asp">  
                            <i class="fa fa-th"></i>
                            <div class="title">产品列表</div>
                        </a>	
                        <a class="ShortCut3" href="DianJiaCMS_Funct_ProductSort.Asp">  
                            <i class="fa fa-sitemap"></i>
                            <div class="title">产品分类</div>
                        </a>													
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
			<div class="col-md-12">
                <div class="panel panel-default">
                    <div class="panel-heading">
                        <h2><i class="fa fa-gears"></i><span class="break"></span><strong><%If Result = "Add" then%>添加<%ElseIf Result = "Modify" then%>修改<%End If%>产品</strong></h2>
                    </div>
                    <div class="panel-body">
                    <form name="editForm" method="post" action="?Action=SaveEdit&Result=<%=Result%>&ID=<%=ID%>" class="form-horizontal">
                        <div class="form-group">
                            <label class="col-md-2 control-label">产品名称：</label>
                            <div class="col-md-6">
                                <input name="ProductName" type="text" id="ProductName"  value="<%=ProductName%>" maxlength="100"  style="width:350px; height:30px;"> <font color="red">*</font><br>
                                <label class="checkbox-inline" for="ViewFlag">
                                    <input type="checkbox" id="ViewFlag" name="ViewFlag" value="1" <%If Result = "Add" then response.write ("checked")%><%if ViewFlag then response.write ("checked")%>> PC显示
                                </label>
                                <%If mStatus Then%>
                                <label class="checkbox-inline" for="MobileFlag">
                                    <input type="checkbox" id="MobileFlag" name="MobileFlag" value="1" <%If Result = "Add" then response.write ("checked")%><%if MobileFlag then response.write ("checked")%>> 手机显示
                                </label>
                                <%End If%>								
                                <label class="checkbox-inline" for="CommendFlag">
                                    <input name="CommendFlag" type="checkbox" id="CommendFlag" value="1" <%if CommendFlag=True then response.write ("checked")%>> 是否推荐
                                </label>
                                <label class="checkbox-inline" for="IsTop">
                                    <input type="checkbox" id="IsTop" name="IsTop" value="1" <%if IsTop=True then response.write ("checked")%>> 是否固顶
                                </label> 								
                                <label class="checkbox-inline" for="NewFlag">
                                    <input name="NewFlag" type="checkbox" id="NewFlag" value="1" <%if NewFlag=True then response.write ("checked")%>> 是否新品
                                </label>  

                            </div>
                        </div> 
                        <div class="form-group">
                            <label class="col-md-2 control-label">静态文件名：</label>
                            <div class="col-md-4">
                                <%If Result = "Add" then%>
                                <input name="ClassSeo" type="text" id="ClassSeo" class="form-control">
                                <div class="radio">
                                    <label class="radio-inline" for="oAutopinyin_1">
                                        <input name="oAutopinyin" type="radio" id="oAutopinyin_1" value="1" checked="checked"> 自动生成系统默认静态文件名<font color="red">（已填写“静态文件名”则该功能无效）</font>
                                    </label>
                                </div>
								<%If ClassSeoISPY = True Then%>
                                <div class="radio">
                                    <label class="radio-inline" for="oAutopinyin_2">
                                        <input name="oAutopinyin" type="radio" id="oAutopinyin_2" value="2"> 将标题转换为拼音<font color="red">（已填写“静态文件名”则该功能无效）</font>
                                    </label>
                                </div>
								<%End If%>
                                <%elseif Result = "Modify" then%>
                                <input type="text" value="<%= ClassSeo %>" class="form-control" readonly>
                                <%end if%>
                                <span class="help-block"></span>
                            </div>
                        </div> 
                        <%If EnableSeo = True Then%>
                        <div class="form-group">
                            <label class="col-md-2 control-label">关键词：</label>
                            <div class="col-md-6">
                                <input name="SeoKeywords" type="text" id="SeoKeywords" class="form-control" value="<%=SeoKeywords%>" maxlength="250">
                                <span class="help-block">SEO：多个关键词请用“,”半角逗号分开</span>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-md-2 control-label">描述：</label>
                            <div class="col-md-6">
                                <input name="SeoDescription" type="text" id="SeoDescription" class="form-control" value="<%=SeoDescription%>" maxlength="250">
                                <span class="help-block">SEO：请填写描述</span>
                            </div>
                        </div>
                        <%End If%>
                        <div class="form-group">
                            <label class="col-md-2 control-label">产品类别：</label>
                            <div class="col-md-5">
                                <select size="1" style="width:200px; height:30px;" name="SortSelect" id="SortSelect" onChange="AddSort()">
                                <option value="" valuepath="">请选择...</option>
                                <%Call ProductSort(0, 0)%>
                                </select> <font color="red">*</font>
                                <span class="help-block">
                                    <input name="SortID" type="hidden" id="SortID" value="<%=SortID%>" readonly class="form-control">
                                    <input name="SortPath" type="hidden" id="SortPath" value="<%=SortPath%>" readonly class="form-control">
                                </span>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-md-2 control-label">产品编号：</label>
                            <div class="col-md-5">
                                <input name="ProductNo" type="text" id="ProductNo" style="width:200px; height:30px;" value="<%=ProductNo%>" maxlength="180"> <font color="red">*</font>
                                <span class="help-block"></span>
                            </div>
                        </div>
                        <%
						If Result = "Modify" Then
							Set rs = server.CreateObject("adodb.recordset")
							sql = "select * from DianJiaCMS_Product where ID="& ID
							rs.Open sql, conn, 1, 1
							If rs.bof And rs.EOF Then
								response.Write ("<center>数据库记录读取错误！</center>")
								response.End
							End If
							If rs("Attribute")<>"" And rs("Attribute_value")<>"" Then
								Attribute_1 = Split(rs("Attribute"), "§§§")
								Attribute_value_1 = Split(rs("Attribute_value"), "§§§")
								Num_1 = UBound(Attribute_1) + 1
							Else
								Num_1 = 0
							End If
							rs.Close
							Set rs = Nothing
						Else
							Num_1 = 0
						End If
						%>
                        <div class="form-group">
                            <label class="col-md-2 control-label">自定义产品属性：</label>
                            <div class="col-md-5">
                                <div class="input-group">
                                    <input type="text" id="Num_1" name="Num_1" class="form-control" value="<%=Num_1%>">
                                    <span class="input-group-btn">
                                        <button type="button" class="btn btn-default" onClick="num_1()">设置</button>
                                    </span>
                                    <span class="input-group-btn">
                                        <button type="button" class="btn btn-default" onClick="num_1_1()">增加一个</button>
                                    </span>
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-md-2 control-label"></label>
                            <div class="col-md-10" id="num_1_str" style="padding-left:0;">
                                <%For i=0 to (Num_1-1)%>
                                <div style=" margin-bottom:10px; overflow:hidden;">
                                    <div class="col-md-5" style="padding-top:3px;">
                                        <div class="input-group">
                                            <span class="input-group-addon">属性名称</span>
                                            <input type="text" class="form-control" name="Attribute<%=i%>" id="Attribute<%=i%>" value="<%=Attribute_1(i)%>">
                                        </div>
                                    </div>
                                    <div class="col-md-5" style="padding-top:3px;">
                                        <div class="input-group">
                                            <span class="input-group-addon">属性值</span>
                                            <input type="text" class="form-control" name="Attribute<%=i%>_value" id="Attribute<%=i%>_value" value="<%=Attribute_value_1(i)%>">
                                        </div>
                                    </div>
                                </div>
                                <%Next%>
                            </div>
                        </div>
						<%If product_price = True then%>
                        <div class="form-group">
                            <label class="col-md-2 control-label">市场价格：</label>
                            <div class="col-md-5">
                                <input name="N_Price" type="text" style="width:100px; height:30px;" value="<%=N_Price%>" maxlength="80" onKeyUp="if(isNaN(value)){alert('只允许输入数字');value='';}" onafterpaste="this.value=this.value.replace(/\D/g,'')">元 <font color="red">*</font>
                                <span class="help-block"></span>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-md-2 control-label">会员价格：</label>
                            <div class="col-md-5">
                                <input name="M_Price" type="text" style="width:100px; height:30px;" value="<%=M_Price%>" maxlength="80" onKeyUp="if(isNaN(value)){alert('只允许输入数字');value='';}" onafterpaste="this.value=this.value.replace(/\D/g,'')">元 <font color="red">*</font>
                                <span class="help-block"></span>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-md-2 control-label">VIP价格：</label>
                            <div class="col-md-5">
                                <input name="V_Price" type="text" style="width:100px; height:30px;" value="<%=V_Price%>" maxlength="80" onKeyUp="if(isNaN(value)){alert('只允许输入数字');value='';}" onafterpaste="this.value=this.value.replace(/\D/g,'')">元 <font color="red">*</font>
                                <span class="help-block"></span>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-md-2 control-label">批发价格：</label>
                            <div class="col-md-5">
                                <input name="P_Price" type="text" style="width:100px; height:30px;" value="<%=P_Price%>" maxlength="80" onKeyUp="if(isNaN(value)){alert('只允许输入数字');value='';}" onafterpaste="this.value=this.value.replace(/\D/g,'')">元 <font color="red">*</font>
                                <span class="help-block"></span>
                            </div>
                        </div>
						<%End If%>
						<div class="form-group">
                            <label class="col-md-2 control-label">出品公司：</label>
                            <div class="col-md-5">
                                <input name="Maker" type="text" style="width:300px; height:30px;" value="<%=Maker%>" maxlength="250"> <font color="red">*</font>
                                <span class="help-block"><a href="javascript:" onClick="document.editForm.Maker.value='<%=ComName%>'"><%=ComName%></a>&nbsp; |&nbsp; <a href="javascript:" onClick="document.editForm.Maker.value='网络转载'">网络转载</a> </span>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-md-2 control-label">产品大图：</label>
                            <div class="col-md-5">
                            	<div class="input-group">
                                    <input type="text" id="BigPic" name="BigPic" class="form-control" value="<%=BigPic%>" readonly>
                                    <span class="input-group-btn">
                                    <button type="button" id="BigImage" class="btn btn-default">上传图片</button>
                                    </span><font color="red">*</font>
                                </div>
                                <span class="help-block">产品大图主要是做内页显示使用</span>
                            </div>
                        </div>                     
                        <div class="form-group">
                            <label class="col-md-2 control-label">产品小图：</label>
                            <div class="col-md-5"> 
                            	<div class="input-group">
                                    <input type="text" id="SmallPic" name="SmallPic" class="form-control" value="<%=SmallPic%>" readonly>
                                    <span class="input-group-btn">
                                    <button type="button" id="SmallImage" class="btn btn-default">上传图片</button>
                                    </span> <font color="red">*</font>
                                </div>
                                <span class="help-block">小图可以直接使用大图地址：<a href="javascript:void(0)" onClick="document.editForm.SmallPic.value=document.editForm.BigPic.value">点击复制上方大图地址</a></span>
                            </div>
                        </div>  
                        <div class="form-group">
                            <label class="col-md-2 control-label">更多产品图片：</label>
                            <div class="col-md-5">
                                <textarea rows="5" cols="80" name="OtherPic" id="OtherPic" class="form-control"><%=OtherPic%></textarea>                                
                                <span class="input-group-btn">
                                <button type="button" id="OtherImage" class="btn btn-default">批量上传</button>
                                </span>
                                <span class="help-block">上传多张产品图片</span>
                            </div>
                        </div>  
                        <div class="form-group">
                            <label class="col-md-2 control-label">产品详细介绍：</label>
                                <div class="col-md-10">
                                <textarea name="Content" style="width:95%;height:400px;visibility:hidden;" class="form-control"><%=Server.HTMLEncode(Content)%></textarea> <font color="red">*</font>
								<input type="checkbox" name="T_SaveImg" value="1" /> 保存内容中网络图片到本地
                                <span class="help-block"></span>
                            </div>
                        </div>
                        <%If EnableViews = True Then%>  
                        <div class="form-group">
                            <label class="col-md-2 control-label">浏览数：</label>
                            <div class="col-md-4">
                                <input type="text" name="ClickNumber" id="ClickNumber" class="form-control" value="<%=ClickNumber%>" onKeyDown="OnKeyDown()" onChange="OnChange(this, <%=ClickNumber%>)" />
                                <span class="help-block">可以手动输入案例的浏览数量。</span>
                            </div>
                        </div> 
                        <%End If%>
                        <div class="form-group">
                            <label class="col-md-2 control-label">排序：</label>
                            <div class="col-md-4">
                                <input name="Sequence" type="text" id="Sequence" class="form-control" value="<%=Sequence%>" onKeyDown="OnKeyDown()" onChange="OnChange(this, <%=Sequence%>)">
                                <span class="help-block">数字越小排名越靠前。</span>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-md-2 control-label"></div>
                            <div class="col-md-10">
                                <input name="submitSaveEdit" type="submit" id="submitSaveEdit" class="btn btn-danger btn-lg" value="保存产品信息">
                                <input type="button" class="btn btn-danger btn-lg" value="<%=DianJiaCMS_Lang_System(32)%>" onClick="history.back(-1)">
                            </div>	
                        </div>
                    </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!--#Include file="DianJiaCMS_End.Asp"-->		
</div>
<!--#Include file="DianJiaCMS_Js.Asp"-->
</body>
</html>
<%
Sub ProductEdit()
Dim Action, rsRepeat, rs, sql
Action = request.QueryString("Action")
If Action = "SaveEdit" Then
	Set rs = server.CreateObject("adodb.recordset")
	If Len(Trim(request.Form("ProductName")))<1 Then
		Call SweetAlert("warning", "友情提示", "请填写产品名称！", "false", "history.back(-1)")
		response.End
	End If
	If Request.Form("SortID") = "" And Request.Form("SortPath") = "" Then
		Call SweetAlert("warning", "友情提示", "请选择所属分类！", "false", "history.back(-1)")
		response.End
	End If
	If Request.Form("ProductNo") = "" Then
		Call SweetAlert("warning", "友情提示", "请填写产品编号！", "false", "history.back(-1)")
		response.End
	End If
If product_price = True then
	If Request.Form("N_Price") = "" Then
		Call SweetAlert("warning", "友情提示", "请填写产品市场价格！", "false", "history.back(-1)")
		response.End
	End If
	If Request.Form("M_Price") = "" Then
		Call SweetAlert("warning", "友情提示", "请填写产品会员价格！", "false", "history.back(-1)")
		response.End
	End If
	If Request.Form("V_Price") = "" Then
		Call SweetAlert("warning", "友情提示", "请填写产品VIP价格！", "false", "history.back(-1)")
		response.End
	End If
	If Request.Form("P_Price") = "" Then
		Call SweetAlert("warning", "友情提示", "请填写产品批发价格！", "false", "history.back(-1)")
		response.End
	End If
End If
	If LTrim(request.Form("Maker")) = "" Then
		Call SweetAlert("warning", "友情提示", "请填写出品公司！", "false", "history.back(-1)")
		response.End
	End If
	If LTrim(request.Form("SmallPic")) = "" Then
		Call SweetAlert("warning", "友情提示", "请上传产品小图！", "false", "history.back(-1)")
		response.End
	End If
	If LTrim(request.Form("BigPic")) = "" Then
		Call SweetAlert("warning", "友情提示", "请上传产品大图！", "false", "history.back(-1)")
		response.End
	End If
	If LTrim(request.Form("Content")) = "" Then
		Call SweetAlert("warning", "友情提示", "请填写产品详细介绍！", "false", "history.back(-1)")
		response.End
	End If

	If Result = "Add" Then
		Set rsRepeat = conn.Execute("select ProductNo from DianJiaCMS_Product where ProductNo='" & Trim(Request.Form("ProductNo")) & "'")
		If Not (rsRepeat.bof And rsRepeat.EOF) Then
			Call SweetAlert("warning", "友情提示", Trim(Request.Form("ProductNo")) & "产品编号已存在！", "false", "history.back(-1)")
			response.End
		End If
		rsRepeat.Close : Set rsRepeat = Nothing

		sql = "select * from DianJiaCMS_Product"
		rs.Open sql, conn, 1, 3
		rs.addnew
		rs("ProductName") = Trim(Request.Form("ProductName"))
		If Request.Form("ClassSeo") = "" then
			If Request.Form("oAutopinyin") = "1" then rs("ClassSeo") = TimeToName()
			If Request.Form("oAutopinyin") = "2" then rs("ClassSeo") = Left(Pinyin(trim(request.form("ProductName"))),200)
		Else
			rs("ClassSeo") = trim(Request.form("ClassSeo"))
		End If
		If Request.Form("ViewFlag") = 1 Then
			rs("ViewFlag") = Request.Form("ViewFlag")
		Else
			rs("ViewFlag") = 0
		End If
		If Request.Form("CommendFlag") = 1 Then
			rs("CommendFlag") = Request.Form("CommendFlag")
		Else
			rs("CommendFlag") = 0
		End If
		if Request.Form("IsTop") = 1 then
			rs("IsTop") = Request.Form("IsTop")
		else
			rs("IsTop") = 0
		end If	
		If Request.Form("NewFlag") = 1 Then
			rs("NewFlag") = Request.Form("NewFlag")
		Else
			rs("NewFlag") = 0
		End If
		If Request.Form("MobileFlag") = 1 Then
			rs("MobileFlag") = Request.Form("MobileFlag")
		Else
			rs("MobileFlag") = 0
		End If
		
		rs("SortID") = Request.Form("SortID")
		rs("SortPath") = Request.Form("SortPath")
		rs("ProductNo") = Trim(Request.Form("ProductNo"))
        If product_price = True then
		rs("N_Price") = Trim(Request.Form("N_Price"))
		rs("M_Price") = Trim(Request.Form("M_Price"))
		rs("V_Price") = Trim(Request.Form("V_Price"))
		rs("P_Price") = Trim(Request.Form("P_Price"))
		End If
		rs("Maker") = Trim(Request.Form("Maker"))
		rs("SmallPic") = Trim(Request.Form("SmallPic"))
		rs("BigPic") = Trim(Request.Form("BigPic"))
		rs("OtherPic") = Trim(Request.Form("OtherPic"))
		rs("Content") = RTrim(Request.Form("Content"))
		rs("AddTime") = Now()
		rs("UpdateTime") = Now()
		Num_1 = CheckStr(Request.Form("Num_1"), 1)
		If Num_1 = "" Then Num_1 = 0
		If Num_1>0 Then
			For i = 0 To Num_1 - 1
				If CheckStr(Request.Form("Attribute"&i), 0)<>"" And CheckStr(Request.Form("Attribute"&i&"_value"), 0)<>"" Then
					If Attribute = "" Then
						Attribute = CheckStr(Request.Form("Attribute"&i), 0)
						Attribute_value = CheckStr(Request.Form("Attribute"&i&"_value"), 0)
					Else
						Attribute = Attribute&"§§§"&CheckStr(Request.Form("Attribute"&i), 0)
						Attribute_value = Attribute_value&"§§§"&CheckStr(Request.Form("Attribute"&i&"_value"), 0)
					End If
				End If
			Next
		End If
		rs("Attribute") = Attribute
		rs("Attribute_value") = Attribute_value
		rs("SeoTitle") = Trim(Request.Form("SeoTitle"))
		rs("SeoKeywords") = Trim(Request.Form("SeoKeywords"))
		rs("SeoDescription") = Trim(Request.Form("SeoDescription"))
		
		If EnableViews Then rs("ClickNumber") = trim(Request.Form("ClickNumber"))
		rs("Sequence") = trim(Request.Form("Sequence"))
		rs.update
		rs.close : set rs = nothing
	  
		set rs = server.createobject("adodb.recordset")
		sql = "select top 1 ID,ClassSeo from DianJiaCMS_Product order by ID desc"
		rs.Open sql, conn, 1, 1
		ID = rs("ID")
		rs.close : set rs = nothing

		Call html_To_Product(ID, "PC")
		If mStatus Then Call html_To_Product(ID, "Mobile")
		Call html_To_Index("Index", "PC")'生成PC首页
		If mStatus Then Call html_To_Index("Index", "Mobile")'生成WAP首页
	End If
	If Result = "Modify" Then
		sql = "select * from DianJiaCMS_Product where ID="&ID
		rs.Open sql, conn, 1, 3
		rs("ProductName") = Trim(Request.Form("ProductName"))
		If Request.Form("ViewFlag") = 1 Then
			rs("ViewFlag") = Request.Form("ViewFlag")
		Else
			rs("ViewFlag") = 0
		End If
		If Request.Form("CommendFlag") = 1 Then
			rs("CommendFlag") = Request.Form("CommendFlag")
		Else
			rs("CommendFlag") = 0
		End If
		if Request.Form("IsTop") = 1 then
			rs("IsTop") = Request.Form("IsTop")
		else
			rs("IsTop") = 0
		end If	
		If Request.Form("NewFlag") = 1 Then
			rs("NewFlag") = Request.Form("NewFlag")
		Else
			rs("NewFlag") = 0
		End If
		If Request.Form("MobileFlag") = 1 Then
			rs("MobileFlag") = Request.Form("MobileFlag")
		Else
			rs("MobileFlag") = 0
		End If

		rs("SortID") = Request.Form("SortID")
		rs("SortPath") = Request.Form("SortPath")
		rs("ProductNo") = Trim(Request.Form("ProductNo"))
		If product_price = True then
		rs("N_Price") = Trim(Request.Form("N_Price"))
		rs("M_Price") = Trim(Request.Form("M_Price"))
		rs("V_Price") = Trim(Request.Form("V_Price"))
		rs("P_Price") = Trim(Request.Form("P_Price"))
		End If
		rs("Maker") = Trim(Request.Form("Maker"))
		rs("SmallPic") = Trim(Request.Form("SmallPic"))
		rs("BigPic") = Trim(Request.Form("BigPic"))
		rs("OtherPic") = Trim(Request.Form("OtherPic"))
		rs("Content") = RTrim(Request.Form("Content"))
		rs("UpdateTime") = Now()
		Num_1 = CheckStr(Request.Form("Num_1"), 1)
		If Num_1 = "" Then Num_1 = 0
		If Num_1 > 0 Then
			For i = 0 To Num_1 - 1
				If CheckStr(Request.Form("Attribute"&i), 0)<>"" And CheckStr(Request.Form("Attribute"&i&"_value"), 0)<>"" Then
					If Attribute = "" Then
						Attribute = CheckStr(Request.Form("Attribute"&i), 0)
						Attribute_value = CheckStr(Request.Form("Attribute"&i&"_value"), 0)
					Else
						Attribute = Attribute&"§§§"&CheckStr(Request.Form("Attribute"&i), 0)
						Attribute_value = Attribute_value&"§§§"&CheckStr(Request.Form("Attribute"&i&"_value"), 0)
					End If
				End If
			Next
		End If
		rs("Attribute") = Attribute
		rs("Attribute_value") = Attribute_value
		rs("SeoTitle") = Trim(Request.Form("SeoTitle"))
		rs("SeoKeywords") = Trim(Request.Form("SeoKeywords"))
		rs("SeoDescription") = Trim(Request.Form("SeoDescription"))
		
		If EnableViews Then rs("ClickNumber") = trim(Request.Form("ClickNumber"))
		rs("Sequence") = trim(Request.Form("Sequence"))

		ID = rs("ID")
		rs.update
		rs.close : set rs = nothing
		
		Call html_To_Product(ID, "PC")
		If mStatus Then Call html_To_Product(ID, "Mobile")
		Call html_To_Index("Index", "PC")'生成PC首页
		If mStatus Then Call html_To_Index("Index", "Mobile")'生成WAP首页
	End If

'==========================保存远程图片和添加水印开始===================================
Dim AspJpeg,T_SaveImg,T_UploadDir '建立变量
AspJpeg=Request.Form("AspJpeg")
T_SaveImg=Request.Form("T_SaveImg")
if T_SaveImg="" then T_SaveImg=0
if T_SaveImg=1 then'保存远程图片
T_UploadDir=""&SysRootDir&"UploadFile/Product/"
content=ReplaceRemoteUrl(content,T_UploadDir,AspJpeg)
else
content=content
end If
'==========================保存远程图片、添加水印结束========537600.cn==============
    Call SweetAlert("success", "操作成功", "已生成本记录详细页和网站首页，请在“生成静态”中批量生成产品模块栏目及分类页！", "false", "location.replace('DianJiaCMS_Funct_Product.Asp')")

Else
	If Result = "Modify" Then
		Set rs = server.CreateObject("adodb.recordset")
		sql = "select * from DianJiaCMS_Product where ID="& ID
		rs.Open sql, conn, 1, 1
		If rs.bof And rs.EOF Then
			response.Write ("<center>数据库记录读取错误！</center>")
			response.End
		End If
		ProductName = rs("ProductName")
		ViewFlag = rs("ViewFlag")
		ClassSeo = rs("ClassSeo")&Separated&rs("ID")
		SortName = SortText(rs("SortID"))
		SortID = rs("SortID")
		SortPath = rs("SortPath")
		ProductNo = rs("ProductNo")
		N_Price=rs("N_Price")
		M_Price=rs("M_Price")
		V_Price=rs("V_Price")
		P_Price=rs("P_Price")
		Maker = rs("Maker")
		CommendFlag = rs("CommendFlag")
		IsTop= rs("IsTop")
		NewFlag = rs("NewFlag")
		MobileFlag = rs("MobileFlag")
		SmallPic = rs("SmallPic")
		BigPic = rs("BigPic")
		OtherPic = rs("OtherPic")
		Content = rs("Content")
		SeoTitle = rs("SeoTitle")
		SeoKeywords = rs("SeoKeywords")
		SeoDescription = rs("SeoDescription")
		ClickNumber = rs("ClickNumber")
		Sequence = rs("Sequence")
		rs.close : set rs = nothing
	Else
		ClickNumber = 10
		Sequence = 10
		randomize timer
		ProductNo = Hour(now) & Minute(now) & Second(now) & "-" & int(900*rnd)+100
	End If
End If
End Sub

Function SortText(ID)
    Dim rs, sql
    Set rs = server.CreateObject("adodb.recordset")
    sql = "Select * From DianJiaCMS_ProductSort where ID="&ID
    rs.Open sql, conn, 1, 1
    SortText = rs("SortName")
	rs.close : set rs = nothing
End Function

Function ProductSort(ID, ClassNum)
	Dim rs
	set rs = Server.CreateObject("adodb.recordset")
	rs.open "select * from DianJiaCMS_ProductSort where ParentID="&ID&" Order by ID asc", conn, 1, 2
	Do Until rs.eof
		If SortID = rs("ID") Then
			response.Write "<option value='"&rs("ID")&"' valuepath='"&rs("SortPath")&"' selected>"
		Else
			response.Write "<option value='"&rs("ID")&"' valuepath='"&rs("SortPath")&"'>"
		End If
		For ClassN = 1 to ClassNum
			response.Write "│"
		Next
		response.Write "│├ "&rs("SortName")
		response.Write "</option>"
		ClassNum = ClassNum + 1
		Call ProductSort(rs("ID"), ClassNum)
		ClassNum = ClassNum - 1
		rs.movenext
	Loop
	rs.close : set rs = nothing
End Function
%>