source: trunk/www/lims/arraydesigns/features/index.jsp @ 4511

Last change on this file since 4511 was 4511, checked in by Jari Häkkinen, 14 years ago

Addresses #1106. Missed to change reference wherefrom retrive GPLv3 license text. And some other changes.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Date Id
File size: 5.0 KB
Line 
1<%-- $Id: index.jsp 4511 2008-09-11 20:04:27Z jari $
2  ------------------------------------------------------------------
3  Copyright (C) 2006 Jari Hakkinen, Nicklas Nordborg
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 3
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 BASE. If not, see <http://www.gnu.org/licenses/>.
20  ------------------------------------------------------------------
21
22  @author Nicklas
23  @version 2.0
24--%>
25<%@ page session="false"
26  import="net.sf.basedb.core.SessionControl"
27  import="net.sf.basedb.core.DbControl"
28  import="net.sf.basedb.core.Item"
29  import="net.sf.basedb.core.ItemContext"
30  import="net.sf.basedb.core.ItemQuery"
31  import="net.sf.basedb.core.DataQuery"
32  import="net.sf.basedb.core.DataResultIterator"
33  import="net.sf.basedb.core.Permission"
34  import="net.sf.basedb.core.PermissionDeniedException"
35  import="net.sf.basedb.core.ArrayDesign"
36  import="net.sf.basedb.core.data.FeatureData"
37  import="net.sf.basedb.core.data.ReporterData"
38  import="net.sf.basedb.clients.web.Base"
39  import="net.sf.basedb.clients.web.WebException"
40  import="net.sf.basedb.clients.web.util.HTML"
41  import="net.sf.basedb.util.Values"
42  import="java.util.List"
43%>
44<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %>
45<%@ taglib prefix="tbl" uri="/WEB-INF/table.tld" %>
46<%!
47  private static final ItemContext defaultContext = Base.createDefaultContext("position", 
48    "position,externalId,block,row,column,reporter.name,reporter.externalId");
49  private static final Item itemType = Item.FEATURE;
50%>
51<%
52final int arrayDesignId = Values.getInt(request.getParameter("arraydesign_id"));
53
54final SessionControl sc = Base.getExistingSessionControl(pageContext, true);
55final String ID = sc.getId();
56final String cmd = request.getParameter("cmd");
57final String root = request.getContextPath()+"/";
58final String listPage = "list_features.jsp?ID="+ID+"&arraydesign_id="+arrayDesignId;
59final String viewPage = "view_feature.jsp?ID="+ID+"&arraydesign_id="+arrayDesignId;
60
61String forward = null;
62String redirect = null;
63String message = null;
64DbControl dc = null;
65
66try
67{
68  if (cmd == null || "List".equals(cmd))
69  {
70    // Display the list page without updatinging the current context
71    Base.getAndSetCurrentContext(sc, itemType, null, defaultContext, true);
72    redirect = listPage;
73  }
74  else if ("UpdateContext".equals(cmd))
75  {
76    // Display the list page after updating the current context from the request parameters
77    Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
78    redirect = listPage;
79  }
80  else if ("LoadContext".equals(cmd))
81  {
82    // Display the list page after loading a saved context
83    int contextId = Values.getInt(request.getParameter("context"));
84    Base.loadContext(sc, contextId, defaultContext);
85    redirect = listPage;
86  }
87  else if ("ViewItem".equals(cmd))
88  {
89    // Display the view page for a single item
90    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
91    forward = viewPage;
92  }
93  else if ("ExportItems".equals(cmd))
94  {
95    // Run an export plugin in a list context
96    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
97    dc = sc.newDbControl();   
98    final ArrayDesign arrayDesign = ArrayDesign.getById(dc, arrayDesignId);
99    final DataQuery<FeatureData> query = arrayDesign.getFeatures();
100    cc.configureQuery(query, true);
101    cc.setQuery(query);
102    redirect = "../../../common/export/index.jsp?ID="+ID+"&cmd=SelectPlugin&item_type="+itemType.name()+"&context_type=LIST&title=Export+features+of+array+design";
103  }
104  else if ("CreateReporterList".equals(cmd))
105  {
106    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
107    dc = sc.newDbControl();   
108    final ArrayDesign arrayDesign = ArrayDesign.getById(dc, arrayDesignId);
109    final DataQuery<ReporterData> query = arrayDesign.getReporters();
110    cc.configureQuery(query, true);
111    cc.setQuery(query);
112    redirect = "../../../views/reporterlists/index.jsp?ID="+ID+
113      "&cmd=NewItem&addReporters=1&formId=features&fromContext=FEATURE" +
114      "&name=" + HTML.urlEncode(arrayDesign.getName());
115  }
116  else
117  {
118    throw new WebException("popup", "Invalid command", "The command {1} is not recognised as a valid command.", cmd);
119  }
120
121}
122finally
123{
124  if (dc != null) dc.close();
125}
126if (forward != null)
127{
128  pageContext.forward(forward);
129}
130else if (redirect != null)
131{
132  response.sendRedirect(redirect);
133}
134else if (message == null)
135{
136  response.sendRedirect(root + "common/close_popup.jsp?refresh_opener=1&wait=0");
137}
138else
139{
140  response.sendRedirect(root + "common/close_popup.jsp?refresh_opener=1&message="+HTML.urlEncode(message));
141}
142
143%>
Note: See TracBrowser for help on using the repository browser.