<%@page contentType="text/html; charset=UTF-8"%>
<jsp:include page="header.jsp" flush="false" />
<%@page import="com.csc.library.util.*,com.csc.library.utilities.*"%>
<%@page import="com.csc.library.entry.*,com.csc.library.system.*,com.csc.library.myui.*"%>
<jsp:useBean id="task" class="com.csc.library.system.Task" scope="page" />
<%
	task.setChannel(request, response);
	HelpEntry screen = (HelpEntry) task.process("HelpEntry", "WB_USERHELP");
	screen.process();
	ThaiUtilities th=new ThaiUtilities();
  	CheckUser ch=new CheckUser();
	ch.setRequest(request);	
	ch.process();	
%>

<script language="JavaScript" src="../../JS/SCREEN.js"></script>
<script language="JavaScript">setLang('<%=screen.getUProfile().get("lang")%>');</script>
<script language="JavaScript" src="../../JS/VIEWCALENDAR.js"></script>
<script language="JavaScript" src='../../JS/ICONSMENU.js'></script>
<script language='javascript' src='../../JS/HOTKEY.js'></script>
<script>
	function goAdd(){
		location="user_manage.jsp?acc=add";
	}
	function goEdit(code){
		location="user_manage.jsp?acc=edit&user_id="+code
	}
	function goProcess(code,type,msg){
		bcon=confirm("ต้องการ "+msg+" ข้อมูล ?");
		if(bcon){
			location="user_process.jsp?acc="+type+"&user_id="+code+"&msg="+msg;
		}	
	}
	function goPage(){
		
		location="user_view.jsp?__fixCon=<%=request.getParameter("__fixCon")%>&page_list="+document.getElementById("page_list").value;
	}
	function goSearch(){
		with(document.cscform){
			__fixCon.value="user_name like '%"+search_filter.value+"%'";
			submit();
		}
	}
	function goEnter(){
  		if (window.event && window.event.keyCode == 13){
  			   cal(goSearch());
  		}
	}	

	
	
</script>
<span class="divbar">Forums Administrator Panel </span> <br />
<br />
<form name="cscform" method="post" action="user_view.jsp">
<input type="hidden" name="__fixCon" value="<%=request.getParameter("__fixCon") %>">
<div align="right">
<span class="content_news"><strong>ค้นหาสมาชิก:</strong></span>
 			<%
 			String sFilter=request.getParameter("search_filter");
 			
 			if(sFilter==null)
 				sFilter="";
 			else
 				sFilter=th.ASCII2Unicode(sFilter);	
 			%>
            <input onKeyPress="goEnter();" value="<%=sFilter %>" name="search_filter" type="text" class="content_news" id="textfield" size="30" />
            <span class="content_news">            
          <a href="javascript:goSearch();"><img src="../images/b_search.gif" width="62" height="22" align="absmiddle" /></a>
			</span>
</div>			

<table width="99%" border="0" align="center" cellpadding="0" cellspacing="3">
  <tr>
    <td width="20%" valign="top">
	
<jsp:include page="menu.jsp" flush="false" />	
	
	
    </td>
    <td width="80%" valign="top"><table width="100%" border="1" align="center" cellpadding="0"  cellspacing="0" bordercolor="#FFFFFF">
      <tr>
        <td bordercolor="#000000"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#4F5D6F">
          <tr>
            <td class="maintitle"><div align="left">จัดการผู้ใช้งาน</div></td>
          </tr>
          <tr>
            <td class="subtitle"><table width="100%" border="0" cellspacing="1" cellpadding="1">
                <tr>
                  <td width="7%">รหัส</td>
                  <td  width="20%">ชื่อผู้ใช้งาน</td>
                  <td width="20%">บริษัท</td>
                  <td width="15%">ระดับผู้ใช้งาน</td>
                  <td width="10%">ล็อคการใช้งาน</td>
                  <td width="10%">ผ่านการฝึกอบรม</td>
                  <td width="18%">จัดการ</td>
                </tr>
            </table></td>
          </tr>
        </table></td>
      </tr>
      <tr>
        <td bordercolor="#CCCCCC"><table width="100%" border="0" cellspacing="1" cellpadding="1">
            <%
			String curePage=request.getParameter("page_list");            	
			if(curePage==null)
				curePage="1";
			int maxLine=ch.getRecordPerPage();
			int goPage=Integer.parseInt(curePage);
            while(screen.nextRec()){
            	if ((screen.getInquiry().recNo() <= (maxLine * goPage)) && (screen.getInquiry().recNo() > (maxLine * (goPage - 1)))) {
            %>
          <tr>
            <td width="7%" class="td01"><strong><%=screen.getString("user_id") %></strong></td>
            <td width="20%" class="td02"><%=screen.getString("user_name")%></td>
            <td width="20%" class="td02"><%=screen.getString("wb_company","tdesc")%></td>
            <td width="15%" class="td02"><%=screen.getInquiry().getCurrentDbRecord().getSystemCode("user_group")%></td>
            <td width="10%" class="td02"><%=screen.getInquiry().getCurrentDbRecord().getSystemCode("active_status")%></td>
            <td width="10%" class="td02"><%=screen.getInquiry().getCurrentDbRecord().getSystemCode("training_status")%></td>
            <td width="18%" class="td02">
            <a href="javascript:goEdit('<%=screen.getString("user_id") %>');"><img src="images/edit.gif" alt="แก้ไข" width="20" height="20" border="0" /></a>
             <a href="javascript:goProcess('<%=screen.getString("user_id") %>','delete','ลบ');"><img src="images/trash.gif" alt="ลบ" width="20" height="20" border="0" /></a>
             
            <%if("1".equals(screen.getString("ACTIVE_STATUS"))){ %>
             <a href="javascript:goProcess('<%=screen.getString("user_id")%>','unlock','ปลดล็อค');"><img src="images/key.gif" alt="ปลดล็อค" width="20" height="20"  border="0"/></a>
			<%}else{ %>
			<a href="javascript:goProcess('<%=screen.getString("user_id")%>','lock','ล็อค');"><img src="images/lock.gif" alt="ล็อค" width="20" height="20" border="0"/></a>
			<%} %>
			
			</td>	
			</tr>
			<%}} %>
        </table>
        <table width="100%" border="0" cellspacing="1" cellpadding="1">
              <tr>
                <td><div align="right"><a href="javascript:goAdd();"><img src="images/add.gif" width="60" height="22" border="0" /></a></div></td>
              </tr>
            </table>
        </td>
      </tr>
    </table>
      <table width="100%" border="0" align="center" cellpadding="0" cellspacing="1" class="divbar">
        <tr>
          <td height="25"><div align="right">
              
                 <b>ไปที่หน้า</b>
                <%=ch.getPageTag(Integer.parseInt(curePage),screen.getInquiry().recCount()) %>
              </form>
          </div></td>
        </tr>
      </table></td>
  </tr>
</table>
</form>
<jsp:include page="footer.jsp" flush="false" />