session-row.jspf 6.88 KB
Newer Older
1 2 3 4 5
 <%--
  -	$Revision$
  -	$Date$
--%>

6
<%@ page import="org.jivesoftware.openfire.session.Session,
7
                 org.jivesoftware.openfire.session.LocalClientSession,
8
                 org.jivesoftware.util.LocaleUtils,
9 10 11 12 13
                 org.jivesoftware.util.StringUtils,
                 org.xmpp.packet.JID,
                 org.xmpp.packet.Presence"%>
 <%@ page import="java.net.URLEncoder"%>

14
 <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
15

16 17 18 19 20 21 22 23
 <%--
   - This page is meant to be included in other pages. It assumes 2 variables:
   -     * 'sess', a org.jivesoftware.xmpp.Session object
   -     * 'count', an int representing the row number we're on.
   -     * 'current', a boolean which indicates the current row the user is looking (pass in
   -       false if there is no current row.
   -     * 'linkURL', a String representing the JSP page to link to
 --%>
24 25 26 27 28 29 30 31 32 33 34 35 36

<%  if (current) { %>

    <tr class="jive-current">

<%  } else { %>

    <tr class="jive-<%= (((count % 2) == 0) ? "even" : "odd") %>">

<%  } %>

    <td width="1%" nowrap><%= count %></td>
    <td width="10%" nowrap>
Derek DeMoro's avatar
Derek DeMoro committed
37
        <%  String name = sess.getAddress().getNode(); %>
38
            <a href="session-details.jsp?jid=<%= URLEncoder.encode(sess.getAddress().toString(), "UTF-8") %>" title="<fmt:message key='session.row.cliked' />"
39
            ><%= ((!sessionManager.isAnonymousRoute(sess.getUsername())) ? JID.unescapeNode(name): "<i>"+LocaleUtils.getLocalizedString("session.details.anonymous")+"</i>") %></a>
40 41
    </td>
    <td width="15%" nowrap>
Sven Tantau's avatar
Sven Tantau committed
42
        <%= StringUtils.escapeHTMLTags(sess.getAddress().getResource()) %>
43
    </td>
44 45 46 47 48 49 50
    <td nowrap>
            <% if (sess instanceof LocalClientSession) { %>
             <fmt:message key="session.details.local" />
            <% } else { %>
             <fmt:message key="session.details.remote" />
            <% } %>
    </td>
Matt Tucker's avatar
Matt Tucker committed
51
    <td>
52 53 54
        <%  int _status = sess.getStatus();
            if (_status == Session.STATUS_CLOSED) {
        %>
55
            <fmt:message key="session.details.close" />
56 57 58

        <%  } else if (_status == Session.STATUS_CONNECTED) { %>

59
            <fmt:message key="session.details.connect" />
60

61
        <% } else if (_status == org.jivesoftware.openfire.session.Session.STATUS_AUTHENTICATED) { %>
62

63
            <fmt:message key="session.details.authenticated" />
64 65 66

        <%  } else { %>

67
            <fmt:message key="session.details.unknown" />
68 69 70

        <%  } %>
    </td>
71 72 73 74 75 76 77 78 79 80 81
    <td width="1%">
        <%  if (sess.isSecure()) {
                if (sess.getPeerCertificates() != null && sess.getPeerCertificates().length > 0) { %>
                    <img src="images/lock_both.gif" width="16" height="16" border="0" title="<fmt:message key='session.row.cliked_ssl' /> (mutual authentication)" alt="<fmt:message key='session.row.cliked_ssl' /> (mutual authentication)">
        <%      } else { %>
                    <img src="images/lock.gif" width="16" height="16" border="0" title="<fmt:message key='session.row.cliked_ssl' />" alt="<fmt:message key='session.row.cliked_ssl' />">
        <%      }
            } else { %>
                    <img src="images/blank.gif" width="1" height="1" alt="">
     <%     } %>
    </td>
Derek DeMoro's avatar
Derek DeMoro committed
82
    <%  Presence.Show _show = sess.getPresence().getShow();
83
        String _stat = sess.getPresence().getStatus();
84 85 86
        if (!sess.getPresence().isAvailable()) {
     %>
        <td width="1%"
87
            ><img src="images/user-clear-16x16.gif" width="16" height="16" border="0" title="<fmt:message key='user.properties.offline' />" alt="<fmt:message key='user.properties.offline' />"
88 89 90 91 92
            ></td>
        <td width="46%">
                <fmt:message key="user.properties.offline" />
        </td>
      <%  } else if (_show == Presence.Show.away) { %>
93
        <td width="1%"
94
            ><img src="images/im_away.gif" width="16" height="16" border="0" title="<fmt:message key='session.details.away' />" alt="<fmt:message key='session.details.away' />"
95 96 97 98
            ></td>
        <td width="46%">
            <%  if (_stat != null) { %>

Sven Tantau's avatar
Sven Tantau committed
99
                <%= StringUtils.escapeHTMLTags(_stat) %>
100 101 102

            <%  } else { %>

103
                <fmt:message key="session.details.away" />
104 105 106 107

            <%  } %>
        </td>

Derek DeMoro's avatar
Derek DeMoro committed
108
    <%  } else if (_show == Presence.Show.chat) { %>
109 110

        <td width="1%"
111
            ><img src="images/im_free_chat.gif" width="16" height="16" border="0" title="<fmt:message key='session.details.chat_available' />" alt="<fmt:message key='session.details.chat_available' />"
112 113
            ></td>
        <td width="46%">
114
            <fmt:message key="session.details.chat_available" />
115 116
        </td>

Derek DeMoro's avatar
Derek DeMoro committed
117
    <%  } else if (_show == Presence.Show.dnd) { %>
118 119

        <td width="1%"
120
            ><img src="images/im_dnd.gif" width="16" height="16" border="0" title="<fmt:message key='session.details.not_disturb' />" alt="<fmt:message key='session.details.not_disturb' />"
121 122 123 124
            ></td>
        <td width="46%">
            <%  if (_stat != null) { %>

Sven Tantau's avatar
Sven Tantau committed
125
                <%= StringUtils.escapeHTMLTags(sess.getPresence().getStatus()) %>
126 127 128

            <%  } else { %>

129
                <fmt:message key="session.details.not_disturb" />
130 131 132 133

            <%  } %>
        </td>

Derek DeMoro's avatar
Derek DeMoro committed
134
    <%  } else if (_show == null) { %>
135 136

        <td width="1%"
137
            ><img src="images/im_available.gif" width="16" height="16" border="0" title="<fmt:message key='session.details.online' />" alt="<fmt:message key='session.details.online' />"
138 139
            ></td>
        <td width="46%">
140
            <fmt:message key="session.details.online" />
141 142
        </td>

Derek DeMoro's avatar
Derek DeMoro committed
143
    <%  } else if (_show == Presence.Show.xa) { %>
144 145

        <td width="1%"
146
            ><img src="images/im_away.gif" width="16" height="16" border="0" title="<fmt:message key='session.details.extended' />" alt="<fmt:message key='session.details.extended' />"
147 148 149 150
            ></td>
        <td width="46%">
            <%  if (_stat != null) { %>

Sven Tantau's avatar
Sven Tantau committed
151
                <%= StringUtils.escapeHTMLTags(sess.getPresence().getStatus()) %>
152 153 154

            <%  } else { %>

155
                <fmt:message key="session.details.extended" />
156 157 158 159 160 161 162

            <%  } %>
        </td>

    <%  } else { %>

        <td colspan="2" width="46%">
163
            <fmt:message key="session.details.unknown" />
164 165 166 167
        </td>

    <%  } %>

168 169 170 171
    <td width="1%" nowrap>
        <%= sess.getPresence().getPriority() %>
    </td>

172
    <td width="1%" nowrap>
173 174 175 176 177
        <% try { %>
            <%= sess.getHostAddress() %>
        <% } catch (java.net.UnknownHostException e) { %>
            Invalid session/connection
        <% } %>
178 179
    </td>

Bill Lynch's avatar
Bill Lynch committed
180
    <td width="1%" nowrap align="center" style="border-right:1px #ccc solid;">
181
        <a href="session-summary.jsp?jid=<%= URLEncoder.encode(sess.getAddress().toString(), "UTF-8") %>&close=true&csrf=${csrf}"
182 183
         title="<fmt:message key="session.row.cliked_kill_session" />"
         onclick="return confirm('<fmt:message key="session.row.confirm_close" />');"
184
         ><img src="images/delete-16x16.gif" width="16" height="16" border="0" alt=""></a>
185
    </td>
Sven Tantau's avatar
Sven Tantau committed
186
</tr>