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

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

References #1655: GUI improvements

  • Make sure content on dialog can be placed so that it fills the free space between the title and buttons.


  • The 'Logout' dialog is easy and provides the simple case where everything is centered in the remaining space. Should also work when resizing the dialog.


  • The 'Reset filters' and 'Broadcast message' dialogs need a bit more work. The look ok now, but there are some minor things to fix yet.
  • Property svn:eol-style set to native
  • Property svn:keywords set to Date Id
File size: 4.7 KB
Line 
1<%-- $Id: reset_filters.jsp 5902 2011-12-08 14:01:38Z 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 String title = "Reset list settings for "+HTML.encodeTags(user.getName());
54  final List<ItemContext> inMemory = sc.getAllCurrentContexts(true, false);
55  final List<ItemContext> inDatabase = sc.getAllCurrentContexts(false, true);
56  final Set<Item> items = new TreeSet<Item>(new ToStringComparator<Item>(false));
57  final Set<Item> dbOnly = new HashSet<Item>();
58  Iterator<ItemContext> it = new NestedIterator(inMemory, inDatabase);
59  for (ItemContext ctx : inMemory)
60  {
61    if (ctx.getNumPropertyFilters() > 0 || ctx.getSortProperty() != null)
62    {
63      items.add(ctx.getItemType());
64    }
65  }
66  for (ItemContext ctx : inDatabase)
67  {
68    if (ctx.getNumPropertyFilters() > 0 || ctx.getSortProperty() != null)
69    {
70      if (items.add(ctx.getItemType())) dbOnly.add(ctx.getItemType());
71    }
72  }
73  %>
74  <base:page type="popup" title="<%=title%>">
75  <base:head>
76    <script language="JavaScript">
77    function resetFilters()
78    {
79      var frm = document.forms['preferences'];
80      frm.submit();
81    }
82    function itemTypeOnChange()
83    {
84      var frm = document.forms['preferences'];
85      var dbOnly = frm.item_type[frm.item_type.selectedIndex].text.indexOf('*') >= 0;
86      frm.database.checked = dbOnly;
87    }
88    </script>
89  </base:head>
90  <base:body>
91    <h1><%=title%><base:help helpid="userpreferences.resetfilters" /></h1>
92    <div class="content">
93      <form action="submit_user.jsp?ID=<%=ID%>" method="post" name="preferences" 
94        onsubmit="return false;">
95        <input type=hidden name="cmd" value="ResetFilters">
96
97        <table class="fullform smaller">
98        <tr>
99          <th>Which list?</th>
100          <td>
101            <select name="item_type" onchange="itemTypeOnChange()" style="width: 100%;">
102              <option value="">- all -
103              <%
104              for (Item item : items)
105              {
106                %>
107                <option value="<%=item.name()%>"><%=dbOnly.contains(item) ? "* " : "" %><%=item%>
108                <%
109              }
110              %>
111            </select><br>
112          </td>
113        </tr>
114        <tr>
115          <th>Location</th>
116          <td>
117          <input type="checkbox" name="memory" id="memory" value="1" checked disabled>In-memory
118          <input type="checkbox" name="database" id="database" value="1"><label for="database">In-database</label>
119          </td>
120        </tr>
121        </table>
122       
123        <div class="padded">
124        * = This setting is only in the database
125        </div>
126       
127        <div class="padded">
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    </div>
134
135    <base:buttongroup subclass="dialogbuttons">
136      <base:button onclick="resetFilters();" title="Ok" />
137      <base:button onclick="window.close();" title="Cancel" />
138    </base:buttongroup>
139  </base:body>
140  </base:page>
141  <%
142}
143finally
144{
145  if (dc != null) dc.close();
146}
147%>
Note: See TracBrowser for help on using the repository browser.