<!--#include file="../Include/Const.Asp" -->
<!--#include file="../Include/ConnSiteData.Asp" -->
<!--#include file="../CheckAdmin.Asp"-->
<%
If InStr(session("GroupPurview"),"|12,") = 0 Then
    response.Write ("<br /><br /><div align=""center""><font style=""color:red; font-size:9pt; "")>您没有管理该模块的权限！</font></div>")
   response.End
End If
%>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" href="../Images/Admin_style.css">
<link rel="stylesheet" href="../JavaScript/selectcolor/colorPicker.css" type="text/css" />
<script language="javascript" type="text/javascript" src="../JavaScript/selectcolor/jquery.min.js"></script>
<script language="javascript" type="text/javascript" src="../JavaScript/selectcolor/jquery.colorPicker.min.js"/></script>
<script type="text/javascript">
  $(function() {    
   $('#color1').colorPicker();
  });
function sorteditedit(){
if (document.editsortedit.TSortName.value.replace(/^\s*/g,"")=="") {
    alert("任务分类名称不能为空,请认真填写!");
    document.editsortedit.TSortName.focus();
    return false;
 }
}
</script>
<%
Dim Result
Result = request.QueryString("Result")
Dim ID,TSortName,T_color
ID = request.QueryString("ID")

    Call TasksSortEdit()

%>
<br />
<table class="tableBorder" width="95%" border="0" align="center" cellpadding="5" cellspacing="1">
  <form name="editsortedit" method="post" action="TasksSortEdit.Asp?Action=SaveEdit&Result=<%=Result%>&ID=<%=ID%>"" onSubmit="return sorteditedit()">
    <tr>
      <th height="22" colspan="2" sytle="line-height:150%">【<%If Result = "Add" then%>添加<%ElseIf Result = "Modify" then%>修改<%End If%>事项分类】</th>
    </tr>
    <tr>
      <td width="20%" align="right" class="forumRow">分类名称：</td>
      <td width="80%" class="forumRowHighlight"><input name="TSortName" type="text" id="TSortName" style="width: 180" value="<%=TSortName%>"> <font color="red">*</font></td>
    </tr>
    <tr>
      <td align="right" class="forumRow">颜色：</td>
      <td class="forumRowHighlight"> 
      <input id="color1" type="text" name="color1" value="<%=T_color%>" />
		
      </td>
    </tr>
    
    <tr>
      <td align="right" class="forumRow"></td>
      <td class="forumRowHighlight"><input name="submitSaveEdit" type="submit" id="submitSaveEdit" value="保存"> <input type="button" value="返回上一页" onclick="history.back(-1)"></td>
    </tr>
  </form>
</table>
<%
Sub TasksSortEdit()
    Dim Action, rs, sql
    Action = request.QueryString("Action")
    If Action = "SaveEdit" Then
        Set rs = server.CreateObject("adodb.recordset")
        If Result = "Add" Then
            sql = "select * from Zqj_TasksSort"
            rs.Open sql, conn, 1, 3
            rs.addnew           
            rs("SortName")=Request.Form("TSortName")
			rs("T_color")=Request.Form("color1")
        End If
        If Result = "Modify" Then
            sql = "select * from Zqj_TasksSort where ID="&ID
            rs.Open sql, conn, 1, 3
            rs("SortName")=Request.Form("TSortName")
			rs("T_color")=Request.Form("color1")
        End If
        rs.update
        rs.Close
        Set rs = Nothing
        response.Write "<script language='javascript'>alert('设置成功！');location.replace('TasksSort.Asp');</script>"
    Else
        If Result = "Modify" Then
            Set rs = server.CreateObject("adodb.recordset")
            sql = "select * from Zqj_TasksSort where ID="& ID
            rs.Open sql, conn, 1, 1
            If rs.RecordCount = 0 Then
                response.Write "<script language='javascript'>alert('无此记录！');history.back(-1)</script>"
                response.End
            End If
              ID = rs("ID")
              TSortName=rs("SortName")
			  T_color=rs("T_color")
			  rs.Close
            Set rs = Nothing
        End If
    End If
End Sub
%>