<%-- 
    Document   : users_management
    Created on : Feb 1, 2008, 7:04:27 PM
    Author     : aili
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
   
<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<f:view locale="#{facade.locale}">
<%@ include file ="../../../WEB-INF/jspf/Header.jspf" %>
    <tr>
        <td>
            <h:form>
                <table cellpadding="0" cellspacing="0" class="menu">
                    <tr style="height:21px">
                        <td colspan="2"></td>
                        <td align="center" valign="top"><img src="../../../style/arrow_down.gif" alt="" /></td>
                    </tr>
                    <%@ include file="../../../WEB-INF/jspf/UserMenu.jspf" %>
                </table>
            </h:form>
            <ul class="submenu">
                <li class="active"><h:outputText value="#{msgs.Users}" /></li>
                <li><h:outputLink value="register_users.faces">
                        <h:outputText value="#{msgs.Add_users}" /></h:outputLink></li>
                <li><h:outputLink value="import_users.faces">
                        <h:outputText value="#{msgs.Import_users}" /></h:outputLink></li>
            </ul>
        </td>                        
    </tr>
    <tr>
        <td class="heading">
            <c:if test="${param.msg == 'success'}"><h:outputText value="#{msgs.users_successfully_added}" /></c:if>
            <h:messages layout="table" />
            <span onclick="createOverlay()" class="helpbutton">?</span>
        </td>
    </tr>
    <tr>
        <td>

            <div style="display:none" id="page_helptext">
                <div class="helpheader">
                    <h:outputText styleClass="helptitle" value="#{msgs.Users}" />
                    <span class="vocClose" onclick="destroyOverlay()"><h:outputText value="#{msgs.Close}" /></span>
                </div>
                <h:outputText styleClass="helpcontent" value="#{msgs.Users_helptext}" escape="false" />
            </div>
            
            <h:form>
                <h4><h:outputText value="#{msgs.Users}"/></h4>
                <%-- Search --%>
                <h:outputText value="#{msgs.Search}" />:
                <h:inputText value="#{ProfileBean.searchWord}" />
                <%--<h:selectOneMenu id="School" rendered="#{SubgroupAttributeBean.schoolAttribute}" value="#{ProfileBean.searchSchool}">
                    <f:selectItem itemValue="" itemLabel="School" />
                    <f:selectItems value="#{SubgroupBean.schoolsList}" />
                </h:selectOneMenu>--%>
                <h:selectOneMenu id="users_group" value="#{ProfileBean.searchGroup}">
                    <f:selectItem itemValue="" itemLabel="#{msgs.group}" />
                    <f:selectItems value="#{SubgroupBean.groupsSelectList}" />
                </h:selectOneMenu>
                <h:selectBooleanCheckbox title="#{msgs.Only_my_users}" value="#{ProfileBean.myUsers}" />
                <h:commandButton value="#{msgs.Search}" action="#{ProfileBean.searchUsers}" />
                <h:commandButton value="#{msgs.Reset}" action="#{ProfileBean.resetFilter}" />
                <br /><br />

                <c:if test="${ProfileBean.usersListDataModel.rowCount > 0}" >
                <table class='table_list' width='100%'>
                    <tr>
                        <c:if test="${Session.managerOrAdmin}"><th style="width:5px"></th></c:if>
                        <th><h:commandLink action="#{ProfileBean.orderUsers}" >
                                <h:outputText value="#{msgs.First_name}" />
                                <f:param name="column_name" value="firstName" />
                            </h:commandLink>
                        </th>
                        <th><h:commandLink action="#{ProfileBean.orderUsers}" >
                                <h:outputText value="#{msgs.Last_name}" />
                                <f:param name="column_name" value="lastName" />
                            </h:commandLink>
                        </th>
                        <th><h:commandLink action="#{ProfileBean.orderUsers}" >
                                <h:outputText value="#{msgs.Role}" />
                                <f:param name="column_name" value="userRole" />
                            </h:commandLink>
                        </th>
                        <c:if test="${SubgroupAttributeBean.schoolAttribute}" >
                        <th><%--<h:commandLink action="#{ProfileBean.orderUsers}" >--%>
                                <h:outputText value="#{msgs.user_schools}" />
                            <%--    <f:param name="column_name" value="school" />
                            </h:commandLink>--%>
                        </th>
                        </c:if>
                        <th></th>
                    </tr>
                    <h:outputText value="#{ProfileBean.allUsersTable}" escape="false" />
                </table>
                <table border="0" width="99%">
                    <tr>
                        <td style="width:33%">
                            <h:commandLink rendered="#{ProfileBean.hasPrevious}" value="#{msgs.Previous}" action="#{ProfileBean.previousPage}" />
                        </td>
                        <td style="text-align:center;width:33%">
                            <h:outputText value="#{ProfileBean.currentPos}" />
                        </td>
                        <td style="text-align:right;width:33%">
                            <h:commandLink rendered="#{ProfileBean.hasNext}" value="#{msgs.Next}" action="#{ProfileBean.nextPage}" />
                        </td>
                    </tr>
                </table>

                <span id="deltext" style="display:none">
                    <h:outputText value="#{msgs.users_delete_confirmation}" />
                </span>

                    <h:commandButton action="#{facade.delUsers}" value="#{msgs.Delete}" rendered="#{Session.managerOrAdmin}"
                    onclick="return delItems(\'deltext\')" />

                </c:if>
            </h:form>
        </td>
    </tr>
<%@ include file ="../../../WEB-INF/jspf/Footer.jspf" %>
</f:view>