source: trunk/www/views/experiments/overview/options.jsp @ 3033

Last change on this file since 3033 was 3033, checked in by Nicklas Nordborg, 15 years ago

References #262, #340: First prototype for experiment overview. Reads most of an
experiment. Limited validation. No presets. No detailed information about an error/warning.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Date Id
File size: 5.4 KB
Line 
1<%-- $Id: options.jsp 3033 2006-12-15 14:30:37Z nicklas $
2  ------------------------------------------------------------------
3  Copyright (C) Authors contributing to this file.
4
5  This file is part of BASE - BioArray Software Environment.
6  Available at http://base.thep.lu.se/
7
8  BASE 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 2
11  of the License, or (at your option) any later version.
12
13  BASE 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 this program; if not, write to the Free Software
20  Foundation, Inc., 59 Temple Place - Suite 330,
21  Boston, MA  02111-1307, USA.
22  ------------------------------------------------------------------
23
24  @author Nicklas
25  @version 2.0
26--%>
27<%@ page session="false"
28  import="net.sf.basedb.core.SessionControl"
29  import="net.sf.basedb.core.DbControl"
30  import="net.sf.basedb.core.Experiment"
31  import="net.sf.basedb.core.Project"
32  import="net.sf.basedb.core.Item"
33  import="net.sf.basedb.core.ItemContext"
34  import="net.sf.basedb.core.Permission"
35  import="net.sf.basedb.clients.web.Base"
36  import="net.sf.basedb.clients.web.util.HTML"
37  import="net.sf.basedb.util.Values"
38  import="net.sf.basedb.util.overview.ExperimentOverview"
39  import="net.sf.basedb.util.overview.Node"
40  import="net.sf.basedb.util.overview.ValidationOptions"
41  import="net.sf.basedb.util.overview.Severity"
42  import="net.sf.basedb.util.overview.Validator"
43  import="java.util.List"
44  import="java.util.Map"
45  import="java.util.Iterator"
46%>
47<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %>
48<%@ taglib prefix="t" uri="/WEB-INF/tab.tld" %>
49<%
50final SessionControl sc = Base.getExistingSessionControl(pageContext, true);
51final String ID = sc.getId();
52final float scale = Base.getScale(sc);
53final ItemContext cc = sc.getCurrentContext(Item.EXPERIMENT);
54final int itemId = cc.getId();
55final DbControl dc = sc.newDbControl();
56try
57{
58  Experiment experiment = Experiment.getById(dc, itemId);
59  Project project = sc.getActiveProjectId() == 0 ? null : Project.getById(dc, sc.getActiveProjectId());
60  ExperimentOverview overview = ExperimentOverview.getOverview(experiment, project);
61  ValidationOptions options = overview.getValidationOptions();
62  Map<String, List<Validator>> validators = ExperimentOverview.getValidators();
63  %>
64  <base:page title="" type="popup">
65  <base:head scripts="tabcontrol.js" styles="tabcontrol.css">
66  <script language="JavaScript">
67  function saveOptions()
68  {
69    document.forms['options'].submit();
70  }
71  function toggle(grpId)
72  {
73    var grp = document.getElementById('grp.'+grpId);
74    var grpIcon = document.getElementById('grp.'+grpId+'.icon');
75    var vldId = 1;
76    var vld = document.getElementById('vld.'+grpId+'.'+vldId);
77    if (vld && vld.style.display == 'none')
78    {
79      grpIcon.src = getRoot()+'images/joust/minustop.gif';
80    }
81    else
82    {
83      grpIcon.src = getRoot()+'images/joust/plusonly.gif';
84    }
85    while (vld)
86    {
87      Main.showHide(vld.id);
88      vldId++;
89      vld = document.getElementById('vld.'+grpId+'.'+vldId);
90    }
91  }
92  </script>
93  </base:head>
94    <base:body>
95   
96    <form name="options" action="index.jsp" method="post">
97    <input type="hidden" name="ID" value="<%=ID%>">
98    <input type="hidden" name="cmd" value="SaveValidationOptions">
99   
100    <h3 class="docked">Validation options <base:help tabcontrol="settings" /></h3>
101    <t:tabcontrol id="settings" contentstyle="<%="height: "+(int)(scale*370)+"px;"%>" 
102      position="bottom">
103    <t:tab id="options" title="Validation options" helpid="overview.validationoptions">
104   
105      <table border="0" cellspacing="0" cellpadding="0">
106      <%
107      int grp = 0;
108      for (Map.Entry<String, List<Validator>> entry : validators.entrySet())
109      {
110        String title = entry.getKey();
111        ++grp;
112        int vld = 0;
113        %>
114        <tr id="grp.<%=grp%>">
115          <td colspan="2"><a href="javascript:toggle(<%=grp%>)"
116            ><base:icon id="<%="grp."+grp+".icon"%>" 
117              image="<%=grp > 1 ? "joust/plusonly.gif" : "joust/minustop.gif"%>" 
118            />&nbsp;<b><%=HTML.encodeTags(title)%></b></a>
119          </td>
120        </tr>
121        <%
122        Iterator<Validator> vi = entry.getValue().iterator();
123        while (vi.hasNext())
124        {
125          Validator validator = vi.next();
126          ++vld;
127          Severity option = options.getSeverity(validator);
128          String validatorId = validator.getId();
129          boolean hasNext = vi.hasNext();
130          %>
131          <tr id="vld.<%=grp%>.<%=vld%>" style="<%=grp > 1 ? "display: none;" : ""%>">
132            <td
133              title="<%=HTML.encodeTags(validator.getDescription())%>"
134              ><base:icon image="<%=hasNext ? "joust/big/join.gif" : "joust/big/joinbottom.gif"%>" 
135            /><%=HTML.encodeTags(validator.getTitle())%>&nbsp;&nbsp;</td>
136            <td>
137            <select name="<%=validatorId%>">
138              <%
139              for (Severity s : Severity.values())
140              {
141                %>
142                <option value="<%=s.name()%>" <%=s == option ? "selected" : "" %>><%=s%>
143                <%
144              }
145              %>
146            </select>
147            </td>
148          </tr>
149          <%
150        }
151      }
152      %>
153      </table>
154    </t:tab>
155    </t:tabcontrol>
156   
157    <div align="center">
158    <table>
159    <tr>
160      <td width="50%"><base:button title="Save" onclick="saveOptions()"/></td>
161      <td width="50%"><base:button title="Cancel" onclick="window.close()"/></td>
162    </tr>
163    </table>
164    </div>
165   
166    </form>
167    </base:body>
168  </base:page>
169  <%
170}
171finally
172{
173  if (dc != null) dc.close();
174}
175%>
Note: See TracBrowser for help on using the repository browser.