source: trunk/www/views/experiments/explorer/search/index.jsp @ 4306

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

References #1015: Add reporter list from tables that list reporters/reporter info

It is now working from dynamic queries as well.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Date Id
File size: 3.4 KB
Line 
1<%-- $Id: index.jsp 4306 2008-05-21 13:39:59Z nicklas $
2  ------------------------------------------------------------------
3  Copyright (C) 2006 Nicklas Nordborg
4
5  This file is part of BASE - BioArray Software Environment.
6  Available at http://base.thep.lu.se/
7
8  This file is part of BASE.
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 2
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 this program; if not, write to the Free Software
22  Foundation, Inc., 59 Temple Place - Suite 330,
23  Boston, MA  02111-1307, USA.
24  ------------------------------------------------------------------
25
26  @author Nicklas
27  @version 2.0
28--%>
29<%@ page session="false"
30  import="net.sf.basedb.core.SessionControl"
31  import="net.sf.basedb.core.DbControl"
32  import="net.sf.basedb.core.Item"
33  import="net.sf.basedb.core.ItemContext"
34  import="net.sf.basedb.core.BioAssaySet"
35  import="net.sf.basedb.core.DynamicSpotQuery"
36  import="net.sf.basedb.clients.web.Base"
37  import="net.sf.basedb.clients.web.ExperimentExplorer"
38  import="net.sf.basedb.clients.web.WebException"
39  import="net.sf.basedb.util.Values"
40  import="net.sf.basedb.clients.web.util.HTML"
41  import="java.util.Collections"
42%>
43<%
44final int bioAssaySetId = Values.getInt(request.getParameter("bioassayset_id"));
45final SessionControl sc = Base.getExistingSessionControl(pageContext, true);
46final String ID = sc.getId();
47final String cmd = request.getParameter("cmd");
48final String root = request.getContextPath()+"/";
49
50final String listPage = "list.jsp?ID="+ID+"&bioassayset_id="+bioAssaySetId;
51
52String forward = null;
53String redirect = null;
54String message = null;
55
56DbControl dc = null;
57try
58{
59  dc = sc.newDbControl();
60  BioAssaySet bioAssaySet = BioAssaySet.getById(dc, bioAssaySetId);
61  ExperimentExplorer explorer = ExperimentExplorer.getExplorer(bioAssaySet);
62  if (cmd == null || "List".equals(cmd))
63  {
64    ItemContext cc = explorer.getAndSetReporterContext(sc, null);
65    redirect = listPage;
66  }
67  else if ("UpdateContext".equals(cmd))
68  {
69    ItemContext cc = explorer.getAndSetReporterContext(sc, pageContext);
70    redirect = listPage;
71  }
72  else if ("CreateReporterList".equals(cmd))
73  {
74    ItemContext cc = explorer.getAndSetReporterContext(sc, pageContext);
75    DynamicSpotQuery query = explorer.getReporterQuery(dc, Collections.singletonList("@id"));
76    cc.setQuery(query);
77    redirect = "../../../reporterlists/index.jsp?ID="+ID+
78        "&cmd=NewItem&addReporters=1&formId=&fromContext=" + cc.getItemType().name() + 
79        "&subContext="+cc.getSubContext() + "&name=" + HTML.urlEncode(bioAssaySet.getName());
80  }
81
82  else
83  {
84    throw new WebException("popup", "Invalid command", "The command {1} is not recognised as a valid command.", cmd);
85  }
86}
87finally
88{
89  if (dc != null) dc.close();
90}
91if (forward != null)
92{
93  pageContext.forward(forward);
94}
95else if (redirect != null)
96{
97  response.sendRedirect(redirect);
98}
99else if (message == null)
100{
101  response.sendRedirect(root + "common/close_popup.jsp?refresh_opener=1&wait=0");
102}
103else
104{
105  response.sendRedirect(root + "common/close_popup.jsp?refresh_opener=1&message="+HTML.urlEncode(message));
106}
107
108%>
109
110
111
112
Note: See TracBrowser for help on using the repository browser.