⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 archive-search.jsp

📁 openfire 服务器源码下载
💻 JSP
📖 第 1 页 / 共 3 页
字号:
<td>
    <td width="0" height="100%" valign="middle">
        <div class="verticalrule"></div>
    </td>
</td>
<td>
    <table>
        <tr valign="top">
            <td>
                <img src="images/icon_keywords.gif" align="absmiddle" alt="" style="margin-right: 4px;"/>
                <b><fmt:message key="archive.search.keywords" /></b> <fmt:message key="archive.search.keywords.optional" />
            </td>
        </tr>
        <tr>
            <td>
                <% if(isArchiveEnabled){%>
                <input type="text" name="keywords" size="35" class="keyword-field" value="<%= query != null ? query : ""%>"/>
                <% } else { %>
                    <fmt:message key="archive.search.keywords.disabled">
                        <fmt:param value="<a href='archiving-settings.jsp'>" />
                        <fmt:param value="</a>" />
                    </fmt:message>
                <% } %>
            </td>
        </tr>
    </table>
</td>
</tr>
</table>
</div>
<input type="submit" name="submitForm" value="<fmt:message key="archive.search.submit" />" class="small-text"/>


<input type="hidden" name="start"  />
<input type="hidden" name="range"  />
<input type="hidden" name="parseRange" />
</form>

<%
    // Code for the searches.

%>

<% if (conversations != null && conversations.size() > 0) { %>
<table id="searchResults" width="100%" style="<%= conversations == null ? "display:none;" : "" %>">
    <tr>
        <td colspan="2">
            <h3><fmt:message key="archive.search.results" /> <%= conversations.size() %></h3>
            <p class="resultDescription">
                <fmt:message key="archive.search.results.description">
                    <fmt:param value="<%= conversations.size()%>" />
                </fmt:message>
            </p>
        </td>
    </tr>
    <tr valign="top">
        <td width="300">
            <!-- Search Result Table -->
            <table cellspacing="0" class="light-gray-border">
                <tr class="light-gray-border-bottom">
                    <td class="light-gray-border-bottom">
                        <%
                            int endPoint = (start + range) > conversations.size() ? conversations.size() : (start + range);
                        %>
                        <span class="small-label-with-padding">
                            <%= start + 1%> - <%= endPoint %> <fmt:message key="archive.search.results.xofy" />
                            <%= conversations.size()%></span>
                    </td>
                    <td align="right" nowrap class="light-gray-border-bottom" style="padding-right:3px;">
                          <%  if (numPages > 1) { %>

                        <p>
                            <%  int num = 5 + curPage;
                                int s = curPage - 1;
                                if (s > 5) {
                                    s -= 5;
                                }
                                if (s < 5) {
                                    s = 0;
                                }
                                if (s > 2) {
                            %>
                            <a href="javascript:submitFormAgain('0', '<%= range%>');">1</a> ...

                            <%
                                }
                                int i = 0;
                                for (i = s; i < numPages && i < num; i++) {
                                    String sep = ((i + 1) < numPages) ? " " : "";
                                    boolean isCurrent = (i + 1) == curPage;
                            %>
                            <a href="javascript:submitFormAgain('<%= (i*range) %>', '<%= range %>');"
                               class="<%= ((isCurrent) ? "small-label" : "small-label-no-bold") %>"
                                ><%= (i + 1) %></a><%= sep %>

                            <%  } %>

                            <%  if (i < numPages) { %>

                            ... <a href="javascript:submitFormAgain('<%= ((numPages-1)*range) %>', '<%= range %>');"><%= numPages %></a>

                            <%  } %>
                        </p>

                        <%  } else { %>
                        &nbsp;
                        <%  } %>

                    </td>
                </tr>
                <tr>
                    <td colspan="2" align="left">
                        <div style="HEIGHT:300px;width:285px;OVERFLOW:auto">
                            <table cellpadding="3" cellspacing="0" width="100%" class="conversation-table">

                                <%
                                    int i = 1;
                                    int end = start + range + 1;
                                    for (Conversation conversation : conversations) {
                                        if(i == end){
                                            break;
                                        }
                                        else if(i < start){
                                            i++;
                                            continue;
                                        }
                                        Map<String, JID> participants = getParticipants(conversation);
                                        String color = "#FFFFFF";
                                        if (i % 2 == 0) {
                                            color = "#F0F0F0";
                                        }

                                %>
                                <tr id="<%= conversation.getConversationID()%>" valign="top" bgcolor="<%= color%>" onclick="showConversation('<%= conversation.getConversationID() %>'); return false;">
                                    <td><b><%= i %>.</b></td>
                                    <td width="98%">
                                        <% if (conversation.getRoom() == null) { %>
                                            <%
                                                Iterator iter = participants.keySet().iterator();
                                                while (iter.hasNext()) {
                                                    String name = (String)iter.next();
                                            %>
                                            <%= name%><br/>
                                            <% } %>
                                        <% } else { %>
                                            <i><fmt:message key="archive.search.group_conversation">
                                                <fmt:param value="<%= conversation.getRoom().getNode() %>" />
                                            </fmt:message></i><br>
                                            <fmt:message key="archive.search.results.participants" /> <%= conversation.getParticipants().size() %>
                                        <% } %>
                                    </td>
                                    <td align="right" nowrap>
                                        <%= getFormattedDate(conversation)%>
                                    </td>
                                </tr>
                                <% i++;
                                } %>
                            </table>
                        </div>
                    </td>
                </tr>
            </table>
        </td>
        <td>


             <!-- Conversation Viewer (empty) -->
            <div id="chat-viewer-empty">
                <table class="light-gray-border" width="100%" style="height: 323px;">
                    <tr>
                        <td align="center" valign="top" bgcolor="#fafafa">
                            <br>
                            <p>Select a conversation to the left to view details.</p></td>
                    </tr>
                </table>
            </div>

            <!-- Conversation Viewer -->
            <div id="chat-viewer" style="display:none;">
                <table class="light-gray-border" cellspacing="0">
                    <tr valign="top">
                        <td width="99%" bgcolor="#f0f0f0" class="light-gray-border-bottom" style="padding: 3px 2px 4px 5px;">
                            <span class="small-label"><fmt:message key="archive.search.results.participants" /></span>&nbsp;
                            <span class="small-text" id="con-participant1"></span>&nbsp;
                            <span class="small-text" id="con-participant2"></span><br/>
                            <span class="small-label"><fmt:message key="archive.search.results.messagecount" /></span>&nbsp;
                            <span class="small-text" id="con-noMessages"></span><br/>
                            <span class="small-label"><fmt:message key="archive.search.results.date" /></span>&nbsp;
                            <span class="small-text" id="con-chatTime"></span><br/>
                            <span class="small-label"><fmt:message key="archive.search.results.duration" /></span>&nbsp;
                            <span class="small-text" id="con-duration"></span>
                        </td>
                        <td id="pdf-image" width="1%" bgcolor="#f0f0f0" nowrap align="right" class="light-gray-border-bottom" style="padding: 4px 3px 3px 0px;">
                            <img src="images/icon_pdf.gif" alt="" align="texttop" border="0" /> <span id="con-chat-link"></span>
                        </td>

                    </tr>
                    <tr>
                        <td colspan="2">
                            <div class="conversation" id="conversation-body" style="HEIGHT:241px;width:100%;OVERFLOW:auto">
                            </div>
                        </td>
                    </tr>
                </table>
            </div>


        </td>
    </tr>
</table>

<% } else if(submit) { %>
<span class="description">
<fmt:message key="archive.search.results.none" />
</span>
<% } %>


<script type="text/javascript">
    grayOut(f.participant1);
    grayOut(f.participant2);
    grayOut(f.startDate);
    grayOut(f.endDate);

     function catcalc(cal) {
        var endDateField = $('endDate');
        var startDateField = $('startDate');

        var endTime = new Date(endDateField.value);
        var startTime = new Date(startDateField.value);
        if(endTime.getTime() < startTime.getTime()){
            alert("<fmt:message key="archive.search.daterange.error" />");
            startDateField.value = "<fmt:message key="archive.search.daterange.any" />";
        }
    }

    Calendar.setup(
    {
        inputField  : "startDate",         // ID of the input field
        ifFormat    : "%m/%d/%y",    // the date format
        button      : "startDateTrigger",       // ID of the button
        onUpdate    :  catcalc
    });

    Calendar.setup(
    {
        inputField  : "endDate",         // ID of the input field
        ifFormat    : "%m/%d/%y",    // the date format
        button      : "endDateTrigger",       // ID of the button
        onUpdate    :  catcalc
    });
</script>
</body>
</html>

<%!
    public TreeMap<String, JID> getParticipants(Conversation conv) {
        final TreeMap<String, JID> participants = new TreeMap<String, JID>();
        for (JID jid : conv.getParticipants()) {
            try {
                if (jid == null) {
                    continue;
                }
                String identifier = jid.toBareJID();
                try {
                    identifier = UserNameManager.getUserName(jid, jid.toBareJID());
                } catch (UserNotFoundException e) {
                    // Ignore
                }
                participants.put(identifier, jid);
            }
            catch (Exception e) {
                Log.error(e);
            }

        }

        return participants;
    }

    public String getFormattedDate(Conversation conv) {
        return JiveGlobals.formatDate(conv.getStartDate());
    }
%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -