<?xml version="1.0" encoding="UTF-8"?>
<!-- ident "$Id$ SMI" -->

<!-- Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
     Use is subject to license terms. -->
     
<jsp:root version="1.2" 
          xmlns:f="http://java.sun.com/jsf/core" 
          xmlns:h="http://java.sun.com/jsf/html" 
          xmlns:jsp="http://java.sun.com/JSP/Page" 
          xmlns:ui="http://www.sun.com/web/ui">
    <jsp:directive.page contentType="text/html;charset=UTF-8" 
                        pageEncoding="UTF-8"/>
    <f:view>
        <f:loadBundle basename="com.sun.ut.console.resource.ConsoleLabels" var="msg"/>
        <ui:page>
            <ui:html>
                <ui:head title="#{login.serverName} - #{msg.default_pageTitle}">
                    <ui:meta name="Copyright" content="#{msg.meta_copyright}" />
                    <ui:script url="../../js/Tokens.js"/>
                </ui:head>    
                <ui:body focus="f1:p1:z1"> 
                    <ui:form id="f1">
                        <jsp:directive.include file="../misc/Masthead.jsp"/>
                        <ui:tabSet binding="#{tabs.tabSet}" selected="tokens"/>
                        <ui:alert binding ="#{tokensHandler.statusMessage.alert}"/>

                        <ui:contentPageTitle id="p1" 
                                             title="#{msg.tokens_page_label}">

                            <ui:markup tag="div" styleClass="TtlHlpDiv">
                                <ui:helpInline id="h1" type="page"
                                               text="#{msg.tokens_base_page_help}">
                                    <ui:helpWindow windowTitle="#{msg.helpWindow_title}" 
                                                   pageTitle="#{msg.helpWindow_pageTitle}"
                                                   mastheadImageUrl="/images/productName.png"
                                                   mastheadImageHeight="40"
                                                   mastheadImageWidth="204"   
                                                   helpFile="tokens.html"
                                                   toolTip="#{msg.helpWindow_link_tooltip}"
                                                   linkIcon="true" linkText="#{msg.tokens_help_link}" />
                                </ui:helpInline>
                            </ui:markup>
                            <f:verbatim><br/></f:verbatim>
                            <ui:markup tag="div" styleClass="ConMgn">
                            <ui:dropDown id="z1"
                                             items="#{tokensHandler.searchCriteria.options}" 
                                             selected="#{tokensHandler.searchCriteria.filter}"
                                             toolTip="#{msg.dtu_searchCriteria_options_tooltip}"/>
                                <ui:textField id="z2"
                                              text="#{tokensHandler.searchCriteria.searchString}" 
                                              columns="40"
                                              toolTip="#{msg.dtu_searchCriteria_searchString_tooltip}"/>
                                <ui:staticText text="&#160;" escape="false"/>
                                <ui:button id="search"
                                           text="#{msg.search_button}" 
                                           primary="true"
                                           action="#{tokensHandler.search}"
                                           toolTip="#{msg.dtu_search_button_tooltip}"
                                           alt="#{msg.search_button_alt}"/>
                                <f:verbatim><br/><br/></f:verbatim>

                                <ui:table id="t1"
                                          title="#{msg.tokens_registered_tokens}" 
                                          paginateButton="true"
                                          paginationControls="true"
                                          selectMultipleButton="true"
                                          selectMultipleButtonOnClick="setTimeout('disableActions()', 0)"
                                          deselectMultipleButton="true"
                                          deselectMultipleButtonOnClick="setTimeout('disableActions()', 0)"
                                          clearSortButton="true"
                                          summary="#{msg.tokens_table_summary}"
                                          toolTip="#{msg.tokens_table_tooltip}">

                                    <ui:tableRowGroup sourceData="#{tokensHandler.registeredTokens}"
                                                      rows="20"
                                                      sourceVar="tokensRowGroup"
                                                      binding="#{tokensHandler.tableRowGroup}"
                                                      selected="#{tokensHandler.selectHelper.selectedState}">

                                        <!-- Selection column -->
                                        <ui:tableColumn extraHeaderHtml="nowrap='nowrap'" 
                                                        extraFooterHtml="nowrap='nowrap'"
                                                        extraTableFooterHtml="nowrap='nowrap'"
                                                        selectId="select">
                                            <ui:checkbox id="select" 
                                                         onClick="setTimeout('initAllRows();disableActions()', 0)"
                                                         selected="#{tokensHandler.selectHelper.selected}"
                                                         selectedValue="#{tokensHandler.selectHelper.selectedValue}"
                                                         toolTip="#{msg.tokens_table_selectedValue_tooltip}"/>
                                        </ui:tableColumn>

                                        <!-- Token column -->
                                        <ui:tableColumn headerText="#{msg.tokens_token_header}" 
                                                        rowHeader="true"
                                                        style="width: 15%;"
                                                        sort="id">
                                            <ui:hyperlink text="#{tokensRowGroup.value.id}" 
                                                          action="#{tokensHandler.selectToken}"
                                                          immediate="true"
                                                          toolTip="#{msg.tokens_table_value_tooltip}">
                                                <f:param name="selectedTokenId" 
                                                         value="#{tokensRowGroup.value.id}"/>
                                            </ui:hyperlink>
                                        </ui:tableColumn>

                                        <!-- Status column -->
                                        <ui:tableColumn headerText="#{msg.tokens_status_header}" 
                                                        rowHeader="true"
                                                        sort="status"
                                                        style="width: 10%;">
                                            <ui:image icon="#{tokensRowGroup.value.statusIcon}"
                                                      alt="#{msg.token_status_image_alt}" 
                                                      toolTip="#{tokensRowGroup.value.status}" />
                                            <ui:staticText text="&#160;" escape="false"/>
                                            <ui:staticText text="#{tokensRowGroup.value.status}"/>
                                        </ui:tableColumn>
                                        
                                        <!-- Session type column -->
                                        <ui:tableColumn headerText="#{msg.tokens_session_type_header}" 
                                                        rowHeader="true"
                                                        sort="sessionTypeDescription"
                                                        style="width: 10%;"
                                                        rendered="#{tokensHandler.kioskInstalled}">
                                            <ui:staticText text="#{tokensRowGroup.value.sessionTypeDescription}"/>
                                        </ui:tableColumn>

                                        <!-- Owner column -->
                                        <ui:tableColumn headerText="#{msg.tokens_owner_header}" 
                                                        rowHeader="true"
                                                        style="width: 18%;"
                                                        sort="owner">
                                            <ui:staticText text="#{tokensRowGroup.value.owner}"/>
                                        </ui:tableColumn>

                                        <!-- Description column -->
                                        <ui:tableColumn headerText="#{msg.tokens_description_header}"
                                                        sort="description"
                                                        rowHeader="true">
                                            <ui:staticText text="#{tokensRowGroup.value.description}"/>
                                        </ui:tableColumn>
                                    </ui:tableRowGroup>

                                    <f:facet name="actionsTop">
                                        <f:subview id="actionsTop">
                                            <ui:button id="new"
                                                       disabled="false"
                                                       text="#{msg.new_button}"
                                                       action="newToken"
                                                       immediate="true"
                                                       toolTip="#{msg.tokens_new_button_tooltip}"
                                                       alt="#{msg.new_button_alt}"/>
                                            <ui:button id="delete"
                                                       disabled="true"
                                                       text="#{msg.delete_button}"
                                                       action="#{tokensHandler.delete}"
                                                       onClick="if (confirmDeleteSelectedRows() == false) return false"
                                                       toolTip="#{msg.tokens_delete_button_tooltip}"
                                                       alt="#{msg.delete_button_alt}"/>
                                            <ui:button id="enable"
                                                       disabled="true"
                                                       text="#{msg.enable_button}"
                                                       action="#{tokensHandler.enable}"
                                                       toolTip="#{msg.tokens_enable_button_tooltip}"
                                                       alt="#{msg.enable_button_alt}"/>
                                            <ui:button id="disable"
                                                       disabled="true"
                                                       text="#{msg.disable_button}"
                                                       action="#{tokensHandler.disable}"
                                                       toolTip="#{msg.tokens_disable_button_tooltip}"
                                                       alt="#{msg.disable_button_alt}"/>
                                            <ui:dropDown id="sessionActions"
                                                        submitForm="true"
                                                        action="#{tokensHandler.modifySession}"
                                                        disabled="true"
                                                        rendered="#{tokensHandler.kioskInstalled}"
                                                        items="#{tokensHandler.sessionActionsOptions}"
                                                        selected="#{tokensHandler.sessionType}"/>
                                            </f:subview>
                                    </f:facet>

                                </ui:table>

                            </ui:markup>
                        </ui:contentPageTitle> 
                    </ui:form>
                </ui:body>
            </ui:html>    
        </ui:page>
    </f:view>
</jsp:root> 


