<%@ page contentType="text/html; charset=utf-8"%>
<%@ page import="java.util.*"%>
<%@ page import="cn.js.fan.util.*"%>
<%@ page import="cn.js.fan.module.cms.*"%>
<%@ page import="cn.js.fan.module.pvg.*"%>
<%@ page import="cn.js.fan.web.*"%>
<%@ taglib uri="/WEB-INF/tlds/LabelTag.tld" prefix="lt" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title><lt:Label res="res.label.cms.user" key="mgr_user_group"/></title>
<link href="../common.css" rel="stylesheet" type="text/css">
<link href="default.css" rel="stylesheet" type="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">
<!--
.style4 {
	color: #FFFFFF;
	font-weight: bold;
}
-->
</style>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<jsp:useBean id="usergroupmgr" scope="page" class="cn.js.fan.module.pvg.UserGroupMgr"/>
<jsp:useBean id="privilege" scope="page" class="cn.js.fan.module.pvg.Privilege"/>
<%
if (!privilege.isUserPrivValid(request, Priv.PRIV_ADMIN))
{
	out.print(cn.js.fan.web.SkinUtil.makeErrMsg(request, cn.js.fan.web.SkinUtil.LoadString(request, "pvg_invalid")));
	return;
}
%>
<%
String op = StrUtil.getNullString(request.getParameter("op"));
if (op.equals("add")) {
	try {
		if (usergroupmgr.add(request))
			out.print(StrUtil.Alert(SkinUtil.LoadString(request,"info_op_success")));
	}
	catch (ErrMsgException e) {
		out.print(StrUtil.Alert_Back(e.getMessage()));
	}
}
if (op.equals("del")) {
	if (usergroupmgr.del(request))
			out.print(StrUtil.Alert(SkinUtil.LoadString(request,"info_op_success")));
	else
			out.print(StrUtil.Alert(SkinUtil.LoadString(request,"info_op_fail")));
}
%>
<table cellSpacing="0" cellPadding="0" width="100%">
  <tbody>
    <tr>
      <td class="head"><lt:Label res="res.label.cms.user" key="mgr_user_group"/></td>
    </tr>
  </tbody>
</table>
<%
String code;
String desc;
UserGroup ugroup = new UserGroup();
Vector result = ugroup.list();
Iterator ir = result.iterator();
%>
<br>
<br>
<table style="BORDER-RIGHT: #a6a398 1px solid; BORDER-TOP: #a6a398 1px solid; BORDER-LEFT: #a6a398 1px solid; BORDER-BOTTOM: #a6a398 1px solid" cellSpacing="0" cellPadding="3" width="95%" align="center">
  <tbody>
    <tr>
      <td class="thead" style="PADDING-LEFT: 10px" noWrap width="21%"><lt:Label res="res.label.cms.user" key="name"/></td>
      <td class="thead" noWrap width="31%"><img src="images/tl.gif" align="absMiddle" width="10" height="15"><lt:Label res="res.label.cms.user" key="desc"/></td>
      <td class="thead" noWrap width="13%"><lt:Label res="res.label.cms.user" key="sys_reserve"/></td>
      <td width="35%" noWrap class="thead"><img src="images/tl.gif" align="absMiddle" width="10" height="15"><%=SkinUtil.LoadString(request,"op")%></td>
    </tr>
<%
while (ir.hasNext()) {
 	UserGroup ug = (UserGroup)ir.next();
	code = ug.getCode();
	desc = ug.getDesc();
	%>
    <tr class="row" style="BACKGROUND-COLOR: #ffffff">
      <td style="PADDING-LEFT: 10px">&nbsp;<img src="images/arrow.gif" align="absmiddle">&nbsp;<a href="user_group_op.jsp?op=edit&code=<%=StrUtil.UrlEncode(code)%>"><%=code%></a></td>
      <td><a href="user_group_op.jsp?op=edit&code=<%=StrUtil.UrlEncode(code)%>"><%=desc%></a></td>
      <td><%=ug.isSystem()?SkinUtil.LoadString(request,"yes"):SkinUtil.LoadString(request,"no")%></td>
      <td>
	  <a href="user_group_op.jsp?op=edit&code=<%=StrUtil.UrlEncode(code)%>">[ <%=SkinUtil.LoadString(request,"op_edit")%> ]</a> 
	  [ <a href="user_group_priv.jsp?group_code=<%=StrUtil.UrlEncode(code)%>&desc=<%=StrUtil.UrlEncode(desc)%>"><lt:Label res="res.label.cms.user" key="priv"/></a> ] [ <a href="user_m.jsp?group_code=<%=StrUtil.UrlEncode(code)%>"><lt:Label res="res.label.cms.user" key="user"/></a> ]
	  <%if (!ug.isSystem()) {%>
[ <a onClick="if (!confirm('<lt:Label res="res.label.cms.user" key="group_m_msg"/>')) return false" href="user_group_m.jsp?op=del&code=<%=StrUtil.UrlEncode(code)%>"><%=SkinUtil.LoadString(request,"op_del")%></a> ]
<%}%></td>
    </tr>
<%}%>
  </tbody>
</table>
<HR noShade SIZE=1>
<DIV style="WIDTH: 95%" align=right>
  <INPUT 
onclick="javascript:location.href='user_group_op.jsp';" type="button" value="<%=SkinUtil.LoadString(request,"op_add")%>">
</DIV>
</body>
<script language="javascript">
<!--
function form1_onsubmit()
{
	errmsg = "";
	if (form1.pwd.value!=form1.pwd_confirm.value)
		errmsg += "<lt:Label res="res.label.cms.user" key="mima_check"/>"
	if (errmsg!="")
	{
		alert(errmsg);
		return false;
	}
}
//-->
</script>
</html>