<%@page contentType="text/html; charset=GBK"%><%@include file="../../include/Admin.jsp"%><%@include file="../../include/DBCon.jsp"%><%if(!StrFormat.isNull(request.getParameter("act"))){if(!StrFormat.isNull(request.getParameter("name")) && request.getParameter("act").equals("mod")){try{DBStmt = DBCon.createStatement();DBSql = "select name from role where name='"+ StrTrans.toGBK(request.getParameter("name")) +"' and id!="+request.getParameter("id");DBRs = DBStmt.executeQuery(DBSql);if(!DBRs.next()){DBSql = "update role set name='"+StrTrans.toGBK(request.getParameter("name"))+"',scopeid='"+StrFormat.isNull(request.getParameter("scopeid"),"")+"' where id="+request.getParameter("id");DBStmt.executeUpdate(DBSql);MesStr = "修改成功！";}else{MesStr = "修改失败：该名称已存在，请更换其他名称！";}}catch(Exception ie){MesStr = "修改失败！";if(isShowErr!=0){MesStr += "\\r\\nErrInfo:"+ie;}}finally{if(DBRs!=null)DBRs.close();if(DBStmt!=null)DBStmt.close();}}else{MesStr = "操作错误！";}out.print("<script language=\"javascript\">alert(\""+MesStr+"\");history.back(-2);</script>");}else{String id="",name="",scopeid="";if(StrFormat.isNum(request.getParameter("id"))){DBSql = "select id,name,scopeid from role where id="+request.getParameter("id");try{DBStmt = DBCon.createStatement();DBRs = DBStmt.executeQuery(DBSql);if(DBRs.next()){id=DBRs.getString("id");name=StrFormat.isNull(DBRs.getString("name"),"");scopeid=StrFormat.isNull(DBRs.getString("scopeid"),"");}}finally{if(DBRs!=null)DBRs.close();if(DBStmt!=null)DBStmt.close();}}else{out.print("<script language=\"javascript\">alert(\"操作错误！\");history.back();</script>");}%><html><head><meta http-equiv="Content-Type" content="text/html; charset=GBK" /><meta name="keywords" content="向继根,Xiang Jigen,QQ,190582560"><meta name="description" content="Programmer:向继根 QQ:190582560 Email:190582560@qq.com"><meta name="author" content="向继根,Xiang Jigen" /><title><%=TitleStr%>修改角色</title><link rel="stylesheet" type="text/css" href="../images/Style.css"/><script type="text/javascript" src="../../js/min.js"></script><script type="text/javascript" src="../../js/common.js"></script><script type="text/javascript" src="../../js/css.js"></script><script type="text/javascript">function doCheck(){if(isNull($GenID('name').value)){alert('名称不能为空！');		$GenID('name').focus();}else{		var value = CheckValue('scope',',');/*alert(value);*/		$GenID('form').action="ModRole.jsp?act=mod&id="+<%=id%>+"&name="+$GenID('name').value+"&scopeid="+value;		$GenID('form').submit();}}</script></head><body><form method="post" name="form" id="form"><table cellpadding="0" cellspacing="1" class="table_list"><caption>修改角色</caption><tr><th width="20%"><span class="red">*</span> <strong>名 称</strong></th><td>&nbsp;<input name="name" type="text" id="name" value="<%=name%>" size="30" /></td></tr><tr><th><strong>权限分配</strong></th><td valign="top"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">	<%int CI=0;int Cols=5;DBSql="select id,name from scope order by id desc";try{DBStmt = DBCon.createStatement();DBRs = DBStmt.executeQuery(DBSql);while(DBRs.next()){if((CI%Cols)==0){out.print("<tr>");}if(StrFormat.isSon(DBRs.getString("id"),scopeid,",")){out.print("<td valign=\"top\"><input name=\"scope\" type=\"checkbox\" class=\"checkbox_style\" value=\""+DBRs.getInt("id")+"\" checked>"+StrFormat.isNull(DBRs.getString("name"),"")+"</td>");}else{out.print("<td valign=\"top\"><input name=\"scope\" type=\"checkbox\" class=\"checkbox_style\" value=\""+DBRs.getInt("id")+"\">"+StrFormat.isNull(DBRs.getString("name"),"")+"</td>");}if((CI%Cols)==(Cols-1)){out.print("</tr>");}CI++;}}finally{if(DBRs!=null)DBRs.close();if(DBStmt!=null)DBStmt.close();}%><tr><td colspan="5">&nbsp;<a href="javascript:void(0);" onClick="CheckAll('scope');">全选</a>&nbsp;<span class="black">/</span>&nbsp;<a href="javascript:void(0);" onClick="CheckRever('scope');">反选</a>&nbsp;<span class="black">/</span>&nbsp;<a href="javascript:void(0);" onClick="CheckNot('scope');">取消</a></td></tr></table></td></tr></table><div id="button"><input type="button" name="dosubmit" class="button_style" value="确 定" onClick="return doCheck();" />&nbsp;<input type="reset" name="reset" class="button_style" value="清 除" />&nbsp;<input type="button" name="button" class="button_style" value="返 回" onClick="history.back();"></div></form></body></html><%}%><%@include file="../../include/DBConClose.jsp"%>