source: trunk/www/my_base/user/reset_filters.jsp @ 5901

Last change on this file since 5901 was 5901, checked in by Nicklas Nordborg, 10 years ago

References #1655: GUI improvements

  • Changed style of the header in popup dialog.


  • Use PNG instead of GIF for help icon.
  • Property svn:eol-style set to native
  • Property svn:keywords set to Date Id
File size: 4.6 KB
Line 
1<%-- $Id: reset_filters.jsp 5901 2011-12-08 08:30:53Z nicklas $
2  ------------------------------------------------------------------
3  Copyright (C) 2005 Nicklas Nordborg
4  Copyright (C) 2006 Jari Häkkinen, Nicklas Nordborg, Martin Svensson
5  Copyright (C) 2007 Johan Enell, Nicklas Nordborg, Martin Svensson
6
7  This file is part of BASE - BioArray Software Environment.
8  Available at http://base.thep.lu.se/
9
10  BASE is free software; you can redistribute it and/or
11  modify it under the terms of the GNU General Public License
12  as published by the Free Software Foundation; either version 3
13  of the License, or (at your option) any later version.
14
15  BASE is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  GNU General Public License for more details.
19
20  You should have received a copy of the GNU General Public License
21  along with BASE. If not, see <http://www.gnu.org/licenses/>.
22  ------------------------------------------------------------------
23
24--%>
25<%@ page pageEncoding="UTF-8" session="false"
26  import="net.sf.basedb.core.SessionControl"
27  import="net.sf.basedb.core.Item"
28  import="net.sf.basedb.core.ItemContext"
29  import="net.sf.basedb.core.DbControl"
30  import="net.sf.basedb.core.User"
31  import="net.sf.basedb.clients.web.Base"
32  import="net.sf.basedb.clients.web.util.HTML"
33  import="net.sf.basedb.util.Values"
34  import="net.sf.basedb.util.ToStringComparator"
35  import="net.sf.basedb.util.NestedIterator"
36  import="java.util.Iterator"
37  import="java.util.List"
38  import="java.util.Set"
39  import="java.util.TreeSet"
40  import="java.util.HashSet"
41  import="java.util.Arrays"
42%>
43<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %>
44<%
45final SessionControl sc = Base.getExistingSessionControl(pageContext, true);
46final String ID = sc.getId();
47final float scale = Base.getScale(sc);
48final String activePage = request.getParameter("page");
49final DbControl dc = sc.newDbControl();
50try
51{
52  final User user = User.getById(dc, sc.getLoggedInUserId());
53  final List<ItemContext> inMemory = sc.getAllCurrentContexts(true, false);
54  final List<ItemContext> inDatabase = sc.getAllCurrentContexts(false, true);
55  final Set<Item> items = new TreeSet<Item>(new ToStringComparator<Item>(false));
56  final Set<Item> dbOnly = new HashSet<Item>();
57  Iterator<ItemContext> it = new NestedIterator(inMemory, inDatabase);
58  for (ItemContext ctx : inMemory)
59  {
60    if (ctx.getNumPropertyFilters() > 0 || ctx.getSortProperty() != null)
61    {
62      items.add(ctx.getItemType());
63    }
64  }
65  for (ItemContext ctx : inDatabase)
66  {
67    if (ctx.getNumPropertyFilters() > 0 || ctx.getSortProperty() != null)
68    {
69      if (items.add(ctx.getItemType())) dbOnly.add(ctx.getItemType());
70    }
71  }
72  %>
73  <base:page type="popup" title="<%="Reset list settings for "+HTML.encodeTags(user.getName())%>">
74  <base:head>
75    <script language="JavaScript">
76    function resetFilters()
77    {
78      var frm = document.forms['preferences'];
79      frm.submit();
80    }
81    function itemTypeOnChange()
82    {
83      var frm = document.forms['preferences'];
84      var dbOnly = frm.item_type[frm.item_type.selectedIndex].text.indexOf('*') >= 0;
85      frm.database.checked = dbOnly;
86    }
87    </script>
88  </base:head>
89  <base:body>
90    <h1>Reset list settings for <%=HTML.encodeTags(user.getName())%>
91      <base:help helpid="userpreferences.resetfilters" /></h1>
92  <br><br>
93
94  <form action="submit_user.jsp?ID=<%=ID%>" method="post" name="preferences" 
95    onsubmit="return false;">
96  <input type=hidden name="cmd" value="ResetFilters">
97
98 
99  <div class="boxed">
100
101    <table class="form" cellspacing=0>
102    <tr>
103      <td class="prompt">Which list?</td>
104      <td>
105        <select name="item_type" onchange="itemTypeOnChange()">
106          <option value="">- all -
107          <%
108          for (Item item : items)
109          {
110            %>
111            <option value="<%=item.name()%>"><%=dbOnly.contains(item) ? "* " : "" %><%=item%>
112            <%
113          }
114          %>
115        </select><br>
116        * = This setting is only in the database
117      </td>
118    </tr>
119    <tr>
120      <td class="prompt">Location</td>
121      <td>
122      <input type="checkbox" name="memory" id="memory" value="1" checked disabled>In-memory<br>
123      <input type="checkbox" name="database" id="database" value="1"><label for="database">In-database</label>
124      </td>
125    </tr>
126    </table>
127    <p>
128    Use this functionality if you are experiencing problems when listing
129    items on a list page. Try first with only the 'In-memory' option selected.
130    If that doesn't help, try the 'In-database' option.
131  </div>
132  </form>
133 
134    <base:buttongroup subclass="dialogbuttons">
135      <base:button onclick="resetFilters();" title="Ok" />
136      <base:button onclick="window.close();" title="Cancel" />
137    </base:buttongroup>
138  </base:body>
139  </base:page>
140  <%
141}
142finally
143{
144  if (dc != null) dc.close();
145}
146%>
Note: See TracBrowser for help on using the repository browser.