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

Last change on this file since 4093 was 4093, checked in by Johan Enell, 15 years ago

Reverted to revision r4089

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