session-row.jspf 4.42 KB
Newer Older
1
<%@ page import="org.jivesoftware.messenger.Session,
2 3
                 org.xmpp.packet.Presence,
                 java.net.URLEncoder"%>
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
 <%--
  -	$RCSfile$
  -	$Revision$
  -	$Date$
--%>

<%--
  - 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
--%>

<%  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
31
        <%  String name = sess.getAddress().getNode(); %>
Matt Tucker's avatar
Matt Tucker committed
32 33
            <a href="session-details.jsp?jid=<%= URLEncoder.encode(sess.getAddress().toString(), "UTF-8") %>" title="Click for more info..."
             ><%= ((name != null && !"".equals(name)) ? name : "<i>Anonymous</i>") %></a>
34 35 36 37
    </td>
    <td width="15%" nowrap>
        <%= sess.getAddress().getResource() %>
    </td>
Matt Tucker's avatar
Matt Tucker committed
38
    <td>
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
        <%  int _status = sess.getStatus();
            if (_status == Session.STATUS_CLOSED) {
        %>
            Closed

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

            Connected

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

            Streaming

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

            Authenticated

        <%  } else { %>

            Unknown

        <%  } %>
    </td>
Matt Tucker's avatar
Matt Tucker committed
62 63 64 65 66 67 68 69
    <%  if (sess.getConnection().isSecure()) { %>
        <td width="1%">
            <img src="images/lock.gif" width="16" height="16" border="0"
            title="User is connected via SSL">
        </td>
     <% } else { %>
        <td width="1%"><img src="images/blank.gif" width="1" height="1"></td>
     <% } %>
70

Derek DeMoro's avatar
Derek DeMoro committed
71
    <%  Presence.Show _show = sess.getPresence().getShow();
72
        String _stat = sess.getPresence().getStatus();
Derek DeMoro's avatar
Derek DeMoro committed
73
        if (_show == Presence.Show.away) {
74 75
    %>
        <td width="1%"
Matt Tucker's avatar
Matt Tucker committed
76
            ><img src="images/bullet-yellow-14x14.gif" width="14" height="14" border="0" title="Away"
77 78 79 80 81 82 83 84 85 86 87 88 89
            ></td>
        <td width="46%">
            <%  if (_stat != null) { %>

                <%= _stat %>

            <%  } else { %>

                Away

            <%  } %>
        </td>

Derek DeMoro's avatar
Derek DeMoro committed
90
    <%  } else if (_show == Presence.Show.chat) { %>
91 92

        <td width="1%"
Matt Tucker's avatar
Matt Tucker committed
93
            ><img src="images/bullet-green-14x14.gif" width="14" height="14" border="0" title="Available to Chat"
94 95 96 97 98
            ></td>
        <td width="46%">
            Available to Chat
        </td>

Derek DeMoro's avatar
Derek DeMoro committed
99
    <%  } else if (_show == Presence.Show.dnd) { %>
100 101

        <td width="1%"
Matt Tucker's avatar
Matt Tucker committed
102
            ><img src="images/bullet-red-14x14.gif" width="14" height="14" border="0" title="Do Not Disturb"
103 104 105 106 107 108 109 110 111 112 113 114 115
            ></td>
        <td width="46%">
            <%  if (_stat != null) { %>

                <%= sess.getPresence().getStatus() %>

            <%  } else { %>

                Do Not Disturb

            <%  } %>
        </td>

Derek DeMoro's avatar
Derek DeMoro committed
116
    <%  } else if (_show == null) { %>
117 118

        <td width="1%"
Matt Tucker's avatar
Matt Tucker committed
119
            ><img src="images/bullet-green-14x14.gif" width="14" height="14" border="0" title="Online"
120 121 122 123 124
            ></td>
        <td width="46%">
            Online
        </td>

Derek DeMoro's avatar
Derek DeMoro committed
125
    <%  } else if (_show == Presence.Show.xa) { %>
126 127

        <td width="1%"
128
            ><img src="images/bullet-yellow-14x14.gif" width="14" height="14" border="0" title="Extended Away"
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153
            ></td>
        <td width="46%">
            <%  if (_stat != null) { %>

                <%= sess.getPresence().getStatus() %>

            <%  } else { %>

                Extended Away

            <%  } %>
        </td>

    <%  } else { %>

        <td colspan="2" width="46%">
            Unknown/Not Recognized
        </td>

    <%  } %>

    <td width="1%" nowrap>
        <%= sess.getConnection().getInetAddress().getHostAddress() %>
    </td>

Bill Lynch's avatar
Bill Lynch committed
154
    <td width="1%" nowrap align="center" style="border-right:1px #ccc solid;">
Derek DeMoro's avatar
Derek DeMoro committed
155
        <a href="session-summary.jsp?jid=<%= URLEncoder.encode(sess.getAddress().toString(), "UTF-8") %>&close=true"
156 157
         title="Click to kill session..."
         onclick="return confirm('Are you sure you want to close this connection?');"
Matt Tucker's avatar
Matt Tucker committed
158
         ><img src="images/delete-16x16.gif" width="16" height="16" border="0"></a>
159 160
    </td>
</tr>