source: extensions/net.sf.basedb.examples/trunk/resources/filter_annotated.jsp @ 1537

Last change on this file since 1537 was 1537, checked in by Nicklas Nordborg, 12 years ago

Fixes #359: Changes related to new GUI in BASE 3.1

  • Property svn:eol-style set to native
  • Property svn:keywords set to Date Id
File size: 3.2 KB
Line 
1<%-- 
2  Copyright (C) 2011 Nicklas Nordborg
3
4  This file is part of the Example Code Package for BASE.
5  Available at http://baseplugins.thep.lu.se/
6  BASE main site: http://base.thep.lu.se/
7 
8  This is free software; you can redistribute it and/or
9  modify it under the terms of the GNU General Public License
10  as published by the Free Software Foundation; either version 3
11  of the License, or (at your option) any later version.
12 
13  The software is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  GNU General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with BASE. If not, see <http://www.gnu.org/licenses/>.
20--%>
21<%@ page
22  pageEncoding="UTF-8"
23  session="false"
24  import="net.sf.basedb.core.SessionControl"
25  import="net.sf.basedb.core.ItemContext"
26  import="net.sf.basedb.core.Item"
27  import="net.sf.basedb.core.PropertyFilter"
28  import="net.sf.basedb.core.Operator"
29  import="net.sf.basedb.util.Values"
30  import="net.sf.basedb.clients.web.Base"
31  import="net.sf.basedb.clients.web.util.HTML"
32  import="java.util.Date"
33%>
34<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %>
35<%
36final SessionControl sc = Base.getExistingSessionControl(pageContext, true);
37final String ID = sc.getId();
38final Item itemType = Item.valueOf(request.getParameter("item_type"));
39final ItemContext cc = sc.getCurrentContext(itemType);
40final PropertyFilter annotationFilter = cc.getPropertyFilter("annotationSet");
41final Operator operator = annotationFilter == null ? 
42    null : annotationFilter.getOperator();
43try
44{
45  %>
46  <base:page type="popup" title="Annotation filter">
47  <base:head>
48    <script language="JavaScript">
49    function applyFilter()
50    {
51      var frm = document.forms['filter'];
52      var selected = Forms.getCheckedRadio(frm.what);
53      var filterString = selected ? selected.value : '';
54      var filterFrm = window.opener.document.forms[0];
55      window.opener.Forms.createHidden(filterFrm, 'filter:INT:annotationSet', filterString);
56      filterFrm.submit();
57      window.close();
58    }
59    function select(value)
60    {
61      var frm = document.forms['filter'];
62      Forms.checkRadio(frm.what, value);
63    }
64    </script>
65  </base:head>
66  <base:body>
67    <h1>Annotation filter</h1>
68   
69    <form name="filter">
70    <div class="content bottomborder">
71      <table class="fullform smaller">
72      <tr class="dynamic">
73        <th>Filter</th>
74        <td>
75          <input type="radio" name="what" value="<>" 
76            <%=operator == Operator.NEQ ? "checked" : "" %>
77            ><a href="javascript:select('<>')">Show only items with annotations</a><br>
78          <input type="radio" name="what" value="=" 
79            <%=operator == Operator.EQ ? "checked" : "" %>
80            ><a href="javascript:select('=')">Show only item without annotations</a><br>
81          <input type="radio" name="what" value="" 
82            <%=operator == null ? "checked" : "" %>
83            ><a href="javascript:select('')">Show all items</a><br>
84        </td>
85      </tr>
86      </table>
87    </div>
88    </form>
89   
90    <base:buttongroup subclass="dialogbuttons">
91      <base:button onclick="applyFilter()" title="Ok" />
92      <base:button onclick="window.close()" title="Cancel" />
93    </base:buttongroup>
94  </base:body>
95  </base:page>
96  <%
97}
98finally
99{
100 
101}
102%>
Note: See TracBrowser for help on using the repository browser.