<!--#include file="../Include/Const.Asp" -->
<!--#include file="../Include/ConnDatabase.asp" -->
<!--#include file="../Include/Md5.asp"-->
<!--#include file="../Include/System_Language.asp" -->
<!--#include file="../Include/Version.Asp" -->
<!--#include file="CheckAdmin.Asp"-->
<%
'*********************************************
'软件名称：博科企业网站内容管理系统（BOKECMS）
'软件开发：博科网络科技工作室
'网    址：http://www.bokew.net
'服务  QQ：530051328
'服务邮箱：bbfhq@163.com
'微信公众号：bokewlkj
'*********************************************
%>
<!doctype html>
<html>
<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="<%=Bokecms_Lang_Copyright(13)%>">
<meta name="author" content="<%=Bokecms_Lang_Copyright(3)%>">
<title><%=Bokecms_Lang_Copyright(1)%> <%=Soft_Version%></title>
<!--#Include file="BokeCMS_Css.Asp"-->
</head>
<body>
<!--#Include file="BokeCMS_Top.Asp"-->
<!--#Include file="BokeCMS_Meun.Asp"-->
<div id="wrap">
	<%
	If InStr(CompanyAdminPurview, "|28,") = 0 Then
		response.Write ("<br /><br /><div style='height:100%; text-align:center' class='main'><font style=""color:red; font-size:14px;"")>"&Bokecms_Lang_System(26)&"</font></div>")
		response.End
	End If

	Dim Result
	Result = request.QueryString("Result")
	Dim ID, GroupID,GroupName,GroupLevel
	ID = request.QueryString("ID")
	If ID = "" Then ID = 0
	Call MemGroupEdit()
	%>
    <div class="main">
        <div class="row ">
            <ol class="breadcrumb">
                <li><i class="fa fa-home"></i><%=Bokecms_Lang_Copyright(14)%></li>
                <li><%=Bokecms_Lang_Copyright(2)%></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="ShortCut2" href="BokeCMS_MemGroup.asp">  
                            <i class="fa fa-users"></i>
                            <div class="title">会员级别列表</div>
                        </a>														
                        <a class="ShortCut4" href="BokeCMS_MemList.asp">  
                            <i class="fa fa-file-text-o"></i>
                            <div class="title">会员列表</div>
                        </a>
                        <a class="ShortCut4" href="BokeCMS_MemEdit.Asp?Result=Add">  
                            <i class="fa fa-file-text-o"></i>
                            <div class="title">添加会员</div>
                        </a>
                        <a class="ShortCut1" href="BokeCMS_Member_purse.asp">  
                            <i class="fa fa-user"></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>会员级别管理</strong></h2>
                    </div>
                    <form name="editForm" method="post" action="?Action=SaveEdit&Result=<%=Result%>&ID=<%=ID%>" class="form-horizontal">
                    <div class="panel-body">
                        <div class="form-group">
                            <label class="col-md-2 control-label" for="text-input">I D：</label>
                            <div class="col-md-4">
                                <input name="ID" type="text" id="ID" class="form-control" value="<%=ID%>" maxlength="16" <%if Result="Modify" then response.write ("readonly")%>>
                                <span class="help-block">不能修改</span>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-md-2 control-label" for="text-input">级别号：</label>
                            <div class="col-md-4">
                                <input name="GroupID" type="text" id="GroupID" class="form-control" value="<%=GroupID%>" maxlength="16" <%if Result="Modify" then response.write ("readonly")%>>
                                <span class="help-block">不能修改</span>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-md-2 control-label" for="text-input">级别名称：</label>
                            <div class="col-md-4">
                                <input name="GroupName" type="text" id="GroupName" class="form-control" value="<%=GroupName%>" maxlength="16">
                                <span class="help-block"></span>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-md-2 control-label" for="text-input">权限值：</label>
                            <div class="col-md-4">
                                <input name="GroupLevel" type="text" id="GroupLevel" style="width: 80" value="<%=GroupLevel%>" <%if Result="Modify" then response.write ("readonly")%> onChange="if(/\D/.test(this.value)){alert('请在权限值中输入整数！');}">
                                <span class="help-block">不能修改</span>
                            </div>
                        </div> 
                        <div class="form-group">
                            <label class="col-md-2 control-label" for="text-input">备注：</label>
                            <div class="col-md-4">
                            	<textarea name="Explain" rows="8" cols="80" id="Explain" class="form-control"><%=Explain%></textarea>
                            </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="<%=Bokecms_Lang_System(32)%>" onClick="history.back(-1)">
                            </div>	
                        </div>
                    </div>
                    </form>
				</div>		
			</div>
        </div>
    </div>
	<!--#Include file="BokeCMS_End.Asp"-->				
</div>
<!--#Include file="BokeCMS_Js.Asp"-->
</body>
</html>
<%
sub MemGroupEdit()
	dim Action, rsCheckAdd, rs, sql
	Action = request.QueryString("Action")
	if Action="SaveEdit" then
		if len(trim(Request.Form("GroupName")))<1 or len(trim(Request.Form("GroupName")))>10  then
			Call SweetAlert("warning", "友情提示", "请填写级别名称（字符数在1-10位之间）！", "false", "history.back(-1)")
			response.end
		end if

		if Result="Add" then
			set rsCheckAdd = conn.execute("select AdminName from BokeCMS_MemGroup where AdminName='" & trim(Request.Form("AdminName")) & "'")
			if not (rsCheckAdd.bof and rsCheckAdd.eof) then
				Call SweetAlert("warning", "友情提示", trim(Request.Form("AdminName")) & "管理员名称已存在！", "false", "history.back(-1)")
				response.end
			end if
		
			set rs = server.createobject("adodb.recordset")
			sql = "select * from BokeCMS_MemGroup"
			rs.open sql,conn,1,3
			rs.addnew
			rs("AdminName") = trim(Request.Form("AdminName"))
			if Request.Form("Working") = 1 then
				rs("Working") = Request.Form("Working")
			else
				rs("Working") = 0
			end if
			rs("Password") = Md5(Request.Form("Password"))
			rs("UserName") = trim(Request.Form("UserName"))
			rs("AdminPurview") = replace(Request.Form("Purview"), " ", "")& ","
			rs("Remark") = trim(Request.Form("Remark"))
			rs("AddTime") = now()
		end if
		if Result="Modify" then
			set rs = server.createobject("adodb.recordset")
			sql = "select * from BokeCMS_MemGroup where ID="&ID
			rs.open sql,conn,1,3
			rs("GroupName") = trim(Request.Form("GroupName"))			
			rs("Explain") = trim(Request.Form("Explain"))
		end if
		rs.update
		rs.close : set rs = nothing
		Call SweetAlert("success", "操作成功", "设置成功！", "false", "location.replace('BokeCMS_MemGroup.asp')")
	else
		if Result="Modify" then
			set rs = server.createobject("adodb.recordset")
			sql = "select * from BokeCMS_MemGroup where ID="& ID
			rs.open sql,conn,1,1
			GroupName = rs("GroupName")
			Explain = rs("Explain")
			ID = rs("ID")
			GroupID = rs("GroupID")
			GroupLevel = rs("GroupLevel")
			rs.close : set rs = nothing
		end if
	end if
end sub
%>