<commit_before><%--

//
// This file is part of the OpenNMS(R) Application.
//
// OpenNMS(R) is Copyright (C) 2002-2003 The OpenNMS Group, Inc.  All rights reserved.
// OpenNMS(R) is a derivative work, containing both original code, included code and modified
// code that was published under the GNU General Public License. Copyrights for modified 
// and included code are below.
//
// OpenNMS(R) is a registered trademark of The OpenNMS Group, Inc.
//
// Modifications:
//
// 2006 Aug 15: HTML fixes from bug #1558. - <EMAIL>
//
// Copyright (C) 1999-2001 Oculan Corp.  All rights reserved.
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//
// For more information contact:
//      OpenNMS Licensing       <<EMAIL>>
//      http://www.opennms.org/
//      http://www.opennms.com///

--%>

<%@page language="java"
	contentType="text/html"
	session="true"
	import="java.util.*,
		java.text.DecimalFormat,
		org.opennms.web.element.NetworkElementFactory,
		org.opennms.web.alarm.*
		"
%>
<%!
    public static final DecimalFormat MINUTE_FORMAT = new DecimalFormat( "00" );
%>
<%
    //get the service names, in alpha order
    Map serviceNameMap = new TreeMap(NetworkElementFactory.getServiceNameToIdMap());
    Set serviceNameSet = serviceNameMap.keySet();
    Iterator serviceNameIterator = serviceNameSet.iterator();

    //get the severity names, in severity order
    List severities = AlarmUtil.getSeverityList();
    Iterator severityIterator = severities.iterator();

    //get the current time values
    Calendar now = Calendar.getInstance();
    int nowHour = now.get(Calendar.HOUR); //gets the hour as a value between 1-12
    int nowMinute = now.get(Calendar.MINUTE);
    int nowAmPm = now.get(Calendar.AM_PM);
%>

<form action="alarm/query" method="get">
  <table width="100%" border="0" cellpadding="2" cellspacing="0">
    <tr>
      <td valign="top">
        <table width="100%" border="0" cellpadding="2" cellspacing="0" >
          <tr>
            <td>Alarm Text Contains:</td>
            <td>TCP/IP Address Like:</td>
          </tr>

          <tr>
            <td><input type="text" name="msgsub" /></td>
            <td><input type="text" name="iplike" value="*.*.*.*" /></td>
          </tr>

          <tr>
            <td>Node Label Contains:</td>
            <td>Severity:</td>
          </tr>

          <tr>
            <td><input type="text" name="nodenamelike" /></td>
            <td>
              <select name="severity" size="1">
                <option selected="selected"><%=AlarmUtil.ANY_SEVERITIES_OPTION%></option>

                <% while( severityIterator.hasNext() ) { %>
                  <% int severity = ((Integer)severityIterator.next()).intValue(); %>
                  <option value="<%=severity%>">
                    <%=AlarmUtil.getSeverityLabel(severity)%>
                  </option>
                <% } %>
              </select>
            </td>
          </tr>

          <tr>
            <td colspan="2">Service:</td>
          </tr>
          <tr>
            <td colspan="2">
              <select name="service" size="1">
                <option selected><%=AlarmUtil.ANY_SERVICES_OPTION%></option>

                <% while( serviceNameIterator.hasNext() ) { %>
                  <% String name = (String)serviceNameIterator.next(); %>
                  <option value="<%=serviceNameMap.get(name)%>"><%=name%></option>
                <% } %>
              </select>
            </td>
          </tr>

          <tr><td colspan="2"><hr width=100% /></td></tr>

          <tr>
            <td valign="top">
              <input type="checkbox" name="useaftertime" value="1"/>Alarms After:
            </td>
            <td valign="top">
              <input type="checkbox" name="usebeforetime" value="1"/>Alarms Before:
            </td>
          </tr>
          <tr>
            <td>
              <select name="afterhour" size="1">
                <% for( int i = 1; i < 13; i++ ) { %>
                  <option value="<%=i%>" <%=(nowHour==i) ? "selected" : ""%>>
                    <%=i%>
                  </option>
                <% } %>
              </select>

              <input type="text" name="afterminute" size="4" maxlength="2" value="<%=MINUTE_FORMAT.format(nowMinute)%>" />

              <select name="afterampm" size="1">
                <option value="am" <%=(nowAmPm == Calendar.AM && nowHour != 12) ? "selected" : ""%>>AM</option>
                <option value="pm" <%=(nowAmPm == Calendar.PM && nowHour == 12) ? "selected" : ""%>>Noon</option>
                <option value="pm" <%=(nowAmPm == Calendar.PM && nowHour != 12) ? "selected" : ""%>>PM</option>
                <option value="am" <%=(nowAmPm == Calendar.AM && nowHour == 12) ? "selected" : ""%>>Midnight</option>
              </select>
            </td>
            <td>
              <select name="beforehour" size="1">
                <% for( int i = 1; i < 13; i++ ) { %>
                  <option value="<%=i%>" <%=(nowHour==i) ? "selected=\"selected\"" : ""%>>
                    <%=i%>
                  </option>
                <% } %>
              </select>

              <input type="text" name="beforeminute" size="4" maxlength="2" value="<%=MINUTE_FORMAT.format(nowMinute)%>" />

              <select name="beforeampm" size="1">
                <option value="am" <%=(nowAmPm == Calendar.AM && nowHour != 12) ? "selected" : ""%>>AM</option>
                <option value="pm" <%=(nowAmPm == Calendar.PM && nowHour == 12) ? "selected" : ""%>>Noon</option>
                <option value="pm" <%=(nowAmPm == Calendar.PM && nowHour != 12) ? "selected" : ""%>>PM</option>
                <option value="am" <%=(nowAmPm == Calendar.AM && nowHour == 12) ? "selected" : ""%>>Midnight</option>
              </select>
            </td>
          </tr>
          <tr>
            <td>
              <select name="aftermonth" size="1">
                <% for( int i = 0; i < 12; i++ ) { %>
                  <option value="<%=i%>" <%=(now.get(Calendar.MONTH)==i) ? "selected" : ""%>>
                    <%=months[i]%>
                  </option>
                <% } %>
              </select>

              <input type="text" name="afterdate" size="4" maxlength="2" value="<%=now.get(Calendar.DATE)%>" />
              <input type="text" name="afteryear" size="6" maxlength="4" value="<%=now.get(Calendar.YEAR)%>" />
            </td>
            <td>
              <select name="beforemonth" size="1">
                <% for( int i = 0; i < 12; i++ ) { %>
                  <option value="<%=i%>" <%=(now.get(Calendar.MONTH)==i) ? "selected" : ""%>>
                    <%=months[i]%>
                  </option>
                <% } %>
              </select>

              <input type="text" name="beforedate" size="4" maxlength="2" value="<%=now.get(Calendar.DATE)%>" />
              <input type="text" name="beforeyear" size="6" maxlength="4" value="<%=now.get(Calendar.YEAR)%>" />
            </td>
          </tr>

          <tr><td colspan="2"><hr width=100% /></td></tr>

          <tr>
            <td>Sort By:</td>
            <td>Number of Alarms Per Page:</td>
          </tr>
          <tr>
            <td>
              <select name="sortby" size="1">
                <option value="id"           >Alarm ID  (Descending)</option><commit_msg>BUG 1961: fix advanced search page which wasn't changed when the list page change what it accepted as filters<commit_after><%--

//
// This file is part of the OpenNMS(R) Application.
//
// OpenNMS(R) is Copyright (C) 2002-2003 The OpenNMS Group, Inc.  All rights reserved.
// OpenNMS(R) is a derivative work, containing both original code, included code and modified
// code that was published under the GNU General Public License. Copyrights for modified 
// and included code are below.
//
// OpenNMS(R) is a registered trademark of The OpenNMS Group, Inc.
//
// Modifications:
//
// 2006 Aug 15: HTML fixes from bug #1558. - <EMAIL>
//
// Copyright (C) 1999-2001 Oculan Corp.  All rights reserved.
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//
// For more information contact:
//      OpenNMS Licensing       <<EMAIL>>
//      http://www.opennms.org/
//      http://www.opennms.com///

--%>

<%@page language="java"
	contentType="text/html"
	session="true"
	import="java.util.*,
		java.text.DecimalFormat,
		org.opennms.web.element.NetworkElementFactory,
		org.opennms.web.alarm.*
		"
%>
<%!
    public static final DecimalFormat MINUTE_FORMAT = new DecimalFormat( "00" );
%>
<%
    //get the service names, in alpha order
    Map serviceNameMap = new TreeMap(NetworkElementFactory.getServiceNameToIdMap());
    Set serviceNameSet = serviceNameMap.keySet();
    Iterator serviceNameIterator = serviceNameSet.iterator();

    //get the severity names, in severity order
    List severities = AlarmUtil.getSeverityList();
    Iterator severityIterator = severities.iterator();

    //get the current time values
    Calendar now = Calendar.getInstance();
    int nowHour = now.get(Calendar.HOUR); //gets the hour as a value between 1-12
    int nowMinute = now.get(Calendar.MINUTE);
    int nowAmPm = now.get(Calendar.AM_PM);
%>

<form action="alarm/query" method="get">
  <table width="100%" border="0" cellpadding="2" cellspacing="0">
    <tr>
      <td valign="top">
        <table width="100%" border="0" cellpadding="2" cellspacing="0" >
          <tr>
            <td>Alarm Text Contains:</td>
            <td>TCP/IP Address Like:</td>
          </tr>

          <tr>
            <td><input type="text" name="msgsub" /></td>
            <td><input type="text" name="iplike" value="*.*.*.*" /></td>
          </tr>

          <tr>
            <td>Node Label Contains:</td>
            <td>Severity:</td>
          </tr>

          <tr>
            <td><input type="text" name="nodenamelike" /></td>
            <td>
              <select name="severity" size="1">
                <option selected="selected"><%=AlarmUtil.ANY_SEVERITIES_OPTION%></option>

                <% while( severityIterator.hasNext() ) { %>
                  <% int severity = ((Integer)severityIterator.next()).intValue(); %>
                  <option value="<%=severity%>">
                    <%=AlarmUtil.getSeverityLabel(severity)%>
                  </option>
                <% } %>
              </select>
            </td>
          </tr>

          <tr>
            <td colspan="2">Service:</td>
          </tr>
          <tr>
            <td colspan="2">
              <select name="service" size="1">
                <option selected><%=AlarmUtil.ANY_SERVICES_OPTION%></option>

                <% while( serviceNameIterator.hasNext() ) { %>
                  <% String name = (String)serviceNameIterator.next(); %>
                  <option value="<%=serviceNameMap.get(name)%>"><%=name%></option>
                <% } %>
              </select>
            </td>
          </tr>

          <tr><td colspan="2"><hr width=100% /></td></tr>

          <tr>
            <td valign="top">
              <input type="checkbox" name="useafterfirsteventtime" value="1"/>Alarm First Event After:
            </td>
            <td valign="top">
              <input type="checkbox" name="usebeforefirsteventtime" value="1"/>Alarm First Event Before:
            </td>
          </tr>
          <tr>
            <td>
              <select name="afterfirsteventtimehour" size="1">
                <% for( int i = 1; i < 13; i++ ) { %>
                  <option value="<%=i%>" <%=(nowHour==i) ? "selected" : ""%>>
                    <%=i%>
                  </option>
                <% } %>
              </select>

              <input type="text" name="afterfirsteventtimeminute" size="4" maxlength="2" value="<%=MINUTE_FORMAT.format(nowMinute)%>" />

              <select name="afterfirsteventtimeampm" size="1">
                <option value="am" <%=(nowAmPm == Calendar.AM && nowHour != 12) ? "selected" : ""%>>AM</option>
                <option value="pm" <%=(nowAmPm == Calendar.PM && nowHour == 12) ? "selected" : ""%>>Noon</option>
                <option value="pm" <%=(nowAmPm == Calendar.PM && nowHour != 12) ? "selected" : ""%>>PM</option>
                <option value="am" <%=(nowAmPm == Calendar.AM && nowHour == 12) ? "selected" : ""%>>Midnight</option>
              </select>
            </td>
            <td>
              <select name="beforefirsteventtimehour" size="1">
                <% for( int i = 1; i < 13; i++ ) { %>
                  <option value="<%=i%>" <%=(nowHour==i) ? "selected=\"selected\"" : ""%>>
                    <%=i%>
                  </option>
                <% } %>
              </select>

              <input type="text" name="beforefirsteventtimeminute" size="4" maxlength="2" value="<%=MINUTE_FORMAT.format(nowMinute)%>" />

              <select name="beforefirsteventtimeampm" size="1">
                <option value="am" <%=(nowAmPm == Calendar.AM && nowHour != 12) ? "selected" : ""%>>AM</option>
                <option value="pm" <%=(nowAmPm == Calendar.PM && nowHour == 12) ? "selected" : ""%>>Noon</option>
                <option value="pm" <%=(nowAmPm == Calendar.PM && nowHour != 12) ? "selected" : ""%>>PM</option>
                <option value="am" <%=(nowAmPm == Calendar.AM && nowHour == 12) ? "selected" : ""%>>Midnight</option>
              </select>
            </td>
          </tr>
          <tr>
            <td>
              <select name="afterfirsteventtimemonth" size="1">
                <% for( int i = 0; i < 12; i++ ) { %>
                  <option value="<%=i%>" <%=(now.get(Calendar.MONTH)==i) ? "selected" : ""%>>
                    <%=months[i]%>
                  </option>
                <% } %>
              </select>

              <input type="text" name="afterfirsteventtimedate" size="4" maxlength="2" value="<%=now.get(Calendar.DATE)%>" />
              <input type="text" name="afterfirsteventtimeyear" size="6" maxlength="4" value="<%=now.get(Calendar.YEAR)%>" />
            </td>
            <td>
              <select name="beforefirsteventtimemonth" size="1">
                <% for( int i = 0; i < 12; i++ ) { %>
                  <option value="<%=i%>" <%=(now.get(Calendar.MONTH)==i) ? "selected" : ""%>>
                    <%=months[i]%>
                  </option>
                <% } %>
              </select>

              <input type="text" name="beforefirsteventtimedate" size="4" maxlength="2" value="<%=now.get(Calendar.DATE)%>" />
              <input type="text" name="beforefirsteventtimeyear" size="6" maxlength="4" value="<%=now.get(Calendar.YEAR)%>" />
            </td>
          </tr>

          <tr>
            <td valign="top">
              <input type="checkbox" name="useafterlasteventtime" value="1"/>Alarm Last Event After:
            </td>
            <td valign="top">
              <input type="checkbox" name="usebeforelasteventtime" value="1"/>Alarm Last Event Before:
            </td>
          </tr>
          <tr>
            <td>
              <select name="afterlasteventtimehour" size="1">
                <% for( int i = 1; i < 13; i++ ) { %>
                  <option value="<%=i%>" <%=(nowHour==i) ? "selected" : ""%>>
                    <%=i%>
                  </option>
                <% } %>
              </select>

              <input type="text" name="afterlasteventtimeminute" size="4" maxlength="2" value="<%=MINUTE_FORMAT.format(nowMinute)%>" />

              <select name="afterlasteventtimeampm" size="1">
                <option value="am" <%=(nowAmPm == Calendar.AM && nowHour != 12) ? "selected" : ""%>>AM</option>
                <option value="pm" <%=(nowAmPm == Calendar.PM && nowHour == 12) ? "selected" : ""%>>Noon</option>
                <option value="pm" <%=(nowAmPm == Calendar.PM && nowHour != 12) ? "selected" : ""%>>PM</option>
                <option value="am" <%=(nowAmPm == Calendar.AM && nowHour == 12) ? "selected" : ""%>>Midnight</option>
              </select>
            </td>
            <td>
              <select name="beforelasteventtimehour" size="1">
                <% for( int i = 1; i < 13; i++ ) { %>
                  <option value="<%=i%>" <%=(nowHour==i) ? "selected=\"selected\"" : ""%>>
                    <%=i%>
                  </option>
                <% } %>
              </select>

              <input type="text" name="beforelasteventtimeminute" size="4" maxlength="2" value="<%=MINUTE_FORMAT.format(nowMinute)%>" />

              <select name="beforelasteventtimeampm" size="1">
                <option value="am" <%=(nowAmPm == Calendar.AM && nowHour != 12) ? "selected" : ""%>>AM</option>
                <option value="pm" <%=(nowAmPm == Calendar.PM && nowHour == 12) ? "selected" : ""%>>Noon</option>
                <option value="pm" <%=(nowAmPm == Calendar.PM && nowHour != 12) ? "selected" : ""%>>PM</option>
                <option value="am" <%=(nowAmPm == Calendar.AM && nowHour == 12) ? "selected" : ""%>>Midnight</option>
              </select>
            </td>
          </tr>
          <tr>
            <td>
              <select name="afterlasteventtimemonth" size="1">
                <% for( int i = 0; i < 12; i++ ) { %>
                  <option value="<%=i%>" <%=(now.get(Calendar.MONTH)==i) ? "selected" : ""%>>
                    <%=months[i]%>
                  </option>
                <% } %>
              </select>

              <input type="text" name="afterlasteventtimedate" size="4" maxlength="2" value="<%=now.get(Calendar.DATE)%>" />
              <input type="text" name="afterlasteventtimeyear" size="6" maxlength="4" value="<%=now.get(Calendar.YEAR)%>" />
            </td>
            <td>
              <select name="beforelasteventtimemonth" size="1">
                <% for( int i = 0; i < 12; i++ ) { %>
                  <option value="<%=i%>" <%=(now.get(Calendar.MONTH)==i) ? "selected" : ""%>>
                    <%=months[i]%>
                  </option>
                <% } %>
              </select>

              <input type="text" name="beforelasteventtimedate" size="4" maxlength="2" value="<%=now.get(Calendar.DATE)%>" />
              <input type="text" name="beforelasteventtimeyear" size="6" maxlength="4" value="<%=now.get(Calendar.YEAR)%>" />
            </td>
          </tr>

          <tr><td colspan="2"><hr width=100% /></td></tr>

          <tr>
            <td>Sort By:</td>
            <td>Number of Alarms Per Page:</td>
          </tr>
          <tr>
            <td>
              <select name="sortby" size="1">
                <option value="id"           >Alarm ID  (Descending)</option>
{'fraction_non_alphanumeric': 0.17877375043866245, 'fraction_numerical': 0.014538527096806537, 'mean_word_length': 1.9066006119772694, 'pattern_counts': {'":': 0, '<': 487, '<?xml version=': 0, '>': 475, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2142192', 'n_tokens_mistral': 6511, 'n_tokens_neox': 5931, 'n_words': 1415}