source: branches/2.8-stable/www/common/import/no_fileformat.jsp @ 4506

Last change on this file since 4506 was 4506, checked in by Nicklas Nordborg, 14 years ago

References #118: Change problematic forms to use POST instead of GET

I have changed most of the forms I could find to use POST instead of GET. Many of them are probably not problematic, but I found some:

  • Form for JEP extra value calculator plug-in
  • Form for JEP intensity transformer plug-in
  • Property svn:eol-style set to native
  • Property svn:keywords set to Date Id
File size: 5.5 KB
Line 
1<%-- $Id: no_fileformat.jsp 4506 2008-09-11 09:29:40Z nicklas $
2  ------------------------------------------------------------------
3  Copyright (C) 2006 Nicklas Nordborg
4  Copyright (C) 2007 Johan Enell
5
6  This file is part of BASE - BioArray Software Environment.
7  Available at http://base.thep.lu.se/
8
9  BASE is free software; you can redistribute it and/or
10  modify it under the terms of the GNU General Public License
11  as published by the Free Software Foundation; either version 3
12  of the License, or (at your option) any later version.
13
14  BASE is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  GNU General Public License for more details.
18
19  You should have received a copy of the GNU General Public License
20  along with this program; if not, write to the Free Software
21  Foundation, Inc., 59 Temple Place - Suite 330,
22  Boston, MA  02111-1307, USA.
23  ------------------------------------------------------------------
24
25  @author Nicklas
26  @version 2.0
27--%>
28<%@ page session="false"
29  import="net.sf.basedb.core.SessionControl"
30  import="net.sf.basedb.core.DbControl"
31  import="net.sf.basedb.core.Item"
32  import="net.sf.basedb.core.Permission"
33  import="net.sf.basedb.core.PluginDefinition"
34  import="net.sf.basedb.core.PluginConfiguration"
35  import="net.sf.basedb.core.PluginType"
36  import="net.sf.basedb.core.ItemContext"
37  import="net.sf.basedb.core.PropertyFilter"
38  import="net.sf.basedb.core.Operator"
39  import="net.sf.basedb.core.Type"
40  import="net.sf.basedb.core.ItemQuery"
41  import="net.sf.basedb.core.ItemResultList"
42  import="net.sf.basedb.core.Include"
43  import="net.sf.basedb.core.File"
44  import="net.sf.basedb.core.Job"
45  import="net.sf.basedb.core.Location"
46  import="net.sf.basedb.core.query.Hql"
47  import="net.sf.basedb.core.query.Expressions"
48  import="net.sf.basedb.core.query.Restrictions"
49  import="net.sf.basedb.core.query.Orders"
50  import="net.sf.basedb.core.plugin.GuiContext"
51  import="net.sf.basedb.core.plugin.Plugin"
52  import="net.sf.basedb.core.plugin.AutoDetectingImporter"
53  import="net.sf.basedb.clients.web.Base"
54  import="net.sf.basedb.clients.web.util.HTML"
55  import="net.sf.basedb.util.Values"
56%>
57<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %>
58<%@ taglib prefix="t" uri="/WEB-INF/tab.tld" %>
59
60<%
61final SessionControl sc = Base.getExistingSessionControl(pageContext, true);
62final String ID = sc.getId();
63final int fileId = Values.getInt(request.getParameter("file_id"));
64final int pluginId = Values.getInt(request.getParameter("plugindefinition_id"));
65final Item itemType = Item.valueOf(request.getParameter("item_type"));
66final String subContext = Values.getString(request.getParameter("subcontext"), "");
67final GuiContext.Type contextType = GuiContext.Type.valueOf(request.getParameter("context_type"));
68final GuiContext context = new GuiContext(itemType, contextType);
69final DbControl dc = sc.newDbControl();
70
71PluginDefinition plugin = null;
72if (pluginId > 0)
73{
74  plugin = PluginDefinition.getById(dc, pluginId);
75}
76
77final ItemContext pluginContext = sc.getCurrentContext(Item.PLUGINDEFINITION);
78pluginContext.setPropertyFilter(new PropertyFilter(
79  "mainType", Operator.EQ, String.valueOf(Plugin.MainType.IMPORT.getValue()), Type.INT));
80pluginContext.setPropertyFilter(new PropertyFilter(
81  "$ctx.itemType", Operator.EQ, String.valueOf(itemType.getValue()), Type.INT));
82try
83{
84  File file = File.getById(dc, fileId);
85  %>
86 
87  <base:page type="popup" title="No matching file format">
88  <base:head>
89    <script language="JavaScript">
90    function addFileFormat()
91    {
92      Main.viewOrEditItem('<%=ID%>', 'PLUGINCONFIGURATION', 0, true);
93    }
94    function tryAgain()
95    {
96      location.reload();
97    }
98    function useWithout()
99    {
100      var frm = document.forms['import'];
101      frm.cmd.value = 'RunPlugin';
102      Forms.createHidden(frm, 'pluginconfiguration_id', 0);
103      frm.submit();
104    }
105    </script>
106  </base:head>
107  <base:body>
108    <form name="import" action="index.jsp" method="post" onsubmit="return false;">
109    <input type="hidden" name="ID" value="<%=ID%>">
110    <input type="hidden" name="cmd" value="AutoDetect">
111    <input type="hidden" name="item_type" value="<%=itemType.name()%>">
112    <input type="hidden" name="subcontext" value="<%=subContext%>">
113    <input type="hidden" name="context_type" value="<%=contextType.name()%>">
114    <input type="hidden" name="title" value="<%=HTML.encodeTags(request.getParameter("title"))%>">
115    <input type="hidden" name="job_name" value="<%=HTML.encodeTags(request.getParameter("job_name"))%>">
116    <input type="hidden" name="job_description" value="<%=HTML.encodeTags(request.getParameter("job_description"))%>">
117    <input type="hidden" name="plugindefinition_id" value="<%=request.getParameter("plugindefinition_id")%>">
118    <input type="hidden" name="file_id" value="<%=fileId%>">
119
120    </form>
121   
122      <base:note type="info" title="No matching file format">
123      <br>
124      No file format that matches the file <b><%=file.getPath().toString()%></b> could be found.
125      <br><br>
126      </base:note>
127 
128    <br>
129    <base:buttongroup align="center">
130      <base:button onclick="addFileFormat()" 
131        image="new.gif" title="Add file format&hellip;" 
132        visible="<%=sc.hasPermission(Permission.CREATE, Item.PLUGINCONFIGURATION)%>"/>
133      <base:button onclick="tryAgain();" image="refresh.gif" title="Try again" />
134      <base:button onclick="useWithout();" image="gonext.gif" 
135        title="Use w/o file format"
136        visible="<%=plugin != null && !plugin.requiresConfiguration() %>" 
137        tooltip="Use the plug-in without any file format" />
138      <base:button onclick="window.close();" title="Cancel" />
139    </base:buttongroup>
140
141  </base:body>
142  </base:page>
143  <%
144}
145finally
146{
147  if (dc != null) dc.close();
148}
149%>
150
Note: See TracBrowser for help on using the repository browser.