source: trunk/www/admin/extensions/wizard.jsp @ 7232

Last change on this file since 7232 was 7232, checked in by Nicklas Nordborg, 5 years ago

References #2042: Add support for ignoring an extension or other file in the extensions directory

It is now possible to select "Ignore" option in the installation wizard. The IgnoreFilter class is used to filter out the selected files which are then processed with the IgnoreFileProcessor. The "Ignore" option is selected by default for files with an error. It is possible to "Ignore" any file. If the extension is already installed the uninstall option is automatically selected as well.

There is currently no way to get back the ignored files again. Until that is resolved the workaround is to stop Tomcat, edit the extensions-settings.xml file (located in userfiles directory configured in base.config) and then start Tomcat again.

File size: 7.4 KB
Line 
1<%-- $Id:manual_scan.jsp 4187 2008-03-20 11:15:25Z nicklas $
2  ------------------------------------------------------------------
3  Copyright (C) 2005 Nicklas Nordborg
4  Copyright (C) 2006 Jari Häkkinen, Nicklas Nordborg
5  Copyright (C) 2007 Martin Svensson
6
7  This file is part of BASE - BioArray Software Environment.
8  Available at http://base.thep.lu.se/
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 3
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 BASE. If not, see <http://www.gnu.org/licenses/>.
22  ------------------------------------------------------------------
23
24  @author Nicklas
25  @version 2.0
26--%>
27<%@ page pageEncoding="UTF-8" session="false"
28  import="net.sf.basedb.core.Application"
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.plugin.About"
34  import="net.sf.basedb.clients.web.Base"
35  import="net.sf.basedb.clients.web.WebException"
36  import="net.sf.basedb.util.Values"
37  import="net.sf.basedb.clients.web.util.HTML"
38  import="net.sf.basedb.util.extensions.ExtensionPoint"
39  import="net.sf.basedb.util.extensions.Extension"
40  import="net.sf.basedb.util.extensions.ExtendedAbout"
41  import="net.sf.basedb.util.extensions.manager.ExtensionsManager"
42  import="net.sf.basedb.util.extensions.manager.ExtensionsFile"
43  import="net.sf.basedb.clients.web.extensions.ExtensionsControl"
44  import="net.sf.basedb.clients.web.extensions.UnsafeScriptable"
45  import="net.sf.basedb.clients.web.servlet.ContentSecurityPolicyFilter"
46  import="java.util.List"
47%>
48<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %>
49<%@ taglib prefix="tbl" uri="/WEB-INF/table.tld" %>
50<%
51final SessionControl sc = Base.getExistingSessionControl(pageContext, true);
52final String ID = sc.getId();
53final float scale = Base.getScale(sc);
54DbControl dc = null;
55try
56{
57  dc = sc.newDbControl();
58  ExtensionsControl ec = ExtensionsControl.get(dc);
59  ec.checkPermission(Permission.WRITE);
60  ec.scanForChanges();
61  List<ExtensionsFile> xtFiles = ec.getFiles();
62  %>
63  <base:page type="popup" title="Extensions and plug-ins installation wizard">
64  <base:head scripts="table.js,~wizard.js" styles="table.css" />
65  <base:body>
66  <h1>Extensions and plug-ins installation wizard <base:help helpid="extensions.install-wizard" /></h1>
67  <div class="content">
68  <tbl:table id="scan" subclass="fulltable" action="index.jsp" >
69    <tbl:columndef id="file" title="File" />
70    <tbl:columndef id="status" title="Status" />
71    <tbl:columndef id="install" title="Install" />
72    <tbl:columndef id="uninstall" title="Uninstall" />
73    <tbl:columndef id="ignore" title="Ignore" />
74    <tbl:columndef id="about" title="About" />
75 
76    <tbl:data style="top: 0px; margin-top: 0px;">
77      <tbl:headers>
78        <tbl:headerrow>
79          <tbl:columnheaders />
80        </tbl:headerrow>
81      </tbl:headers>
82      <tbl:rows>
83      <%
84      for (ExtensionsFile xtFile : xtFiles)
85      {
86        if (xtFile.getFile() == null) continue; // We skip internal extensions/plug-ins files
87        List<Extension<?>> unsafeExtensions = ec.checkUnsafeScriptableUsage(xtFile);
88       
89        About about = xtFile.getAbout();
90        ExtendedAbout xtAbout = about instanceof ExtendedAbout ? (ExtendedAbout)about : null;
91        Throwable error = null;
92        String name = xtFile.getName();
93        String status = "";
94        String icon = "";
95        boolean allowInstall = false;
96        boolean allowUninstall = false;
97        boolean allowIgnore = false;
98        boolean checkInstall = false;
99        boolean checkUninstall = false;
100        boolean checkIgnore = false;
101        if (!xtFile.exists())
102        {
103          status = "Deleted";
104          allowUninstall = true;
105          checkUninstall = true;
106        }
107        else if (!xtFile.isValid())
108        {
109          status = "Invalid";
110          error = xtFile.getValidationError();
111          if (xtFile.isInstalled())
112          {
113            allowUninstall = true;
114            checkUninstall = true;
115          }
116          allowIgnore = true;
117          checkIgnore = true;
118        }
119        else if (xtFile.isNew())
120        {
121          status = "New";
122          allowInstall = true;
123          allowIgnore = true;
124          checkInstall = true;
125        }
126        else if (xtFile.wasModified())
127        {
128          status = "Modified";
129          allowInstall = true;
130          allowUninstall = true;
131          checkInstall = true;
132        }
133        else if (xtFile.hasError())
134        {
135          status = "Error";
136          allowInstall = true;
137          allowUninstall = true;
138          allowIgnore = true;
139        }
140        else
141        {
142          status = "Already installed";
143          allowInstall = true;
144          allowUninstall = true;
145          allowIgnore = true;
146        }
147        %>
148        <tbl:row>
149          <tbl:cell column="file" style="white-space: nowrap;"><%=name%></tbl:cell>
150          <tbl:cell column="status"><%=status%></tbl:cell>
151          <tbl:cell column="install"  style="text-align: center;">
152            <%
153            if (allowInstall)
154            {
155              %>
156              <input type="checkbox" class="auto-init" data-auto-init="install" 
157                name="<%=name%>.install" value="1" <%=checkInstall ? "checked" : "" %>
158                >
159              <%
160            }
161            %>
162          </tbl:cell>
163          <tbl:cell column="uninstall" style="text-align: center;">
164            <%
165            if (allowUninstall)
166            {
167              %>
168              <input type="checkbox" class="auto-init" data-auto-init="uninstall"
169                name="<%=name%>.uninstall" value="1" <%=checkUninstall ? "checked" : "" %>
170                >
171              <%
172            }
173            %>
174          </tbl:cell>
175          <tbl:cell column="ignore" style="text-align: center;">
176            <%
177            if (allowIgnore)
178            {
179              %>
180              <input type="checkbox" class="auto-init" data-auto-init="ignore"
181                name="<%=name%>.ignore" value="1" <%=checkIgnore ? "checked" : "" %>
182                >
183              <%
184            }
185            %>
186          </tbl:cell>
187          <tbl:cell column="about">
188            <%
189            if (about != null)
190            {
191              %>
192              <b><%=HTML.encodeTags(about.getName())%></b> <%=about.getVersion() == null ? "" : "(v" + about.getVersion() + ")"%><br>
193              <%=HTML.encodeTags(about.getDescription())%><br>
194              <%=HTML.niceFormat(about.getUrl())%>
195              <%
196            }
197            if (unsafeExtensions.size() > 0)
198            {
199              %>
200              <div class="messagecontainer note">
201                <base:icon image="warning.png" />
202                This plug-in contain <%=unsafeExtensions.size()%> extension(s) that
203                may violate the <b>Content Security Policy</b> setting on this server.
204                See BASE documentation for more information.
205              </div>
206              <%
207            }
208            if (error != null)
209            {
210              %>
211              <div class="messagecontainer error">
212              <%=error.getClass().getSimpleName()%>: <%=HTML.encodeTags(error.getMessage())%>
213              </div>
214              <%
215            }
216            %>
217          </tbl:cell>
218         
219        </tbl:row>
220        <%
221      }
222      %>
223      </tbl:rows>
224    </tbl:data>
225  </tbl:table>
226  </div>
227
228  <base:buttongroup subclass="dialogbuttons">
229    <base:button id="startScan" title="Next" />
230    <base:button id="close" title="Cancel" />
231  </base:buttongroup>
232 
233  </base:body>
234  </base:page>
235  <%
236}
237finally
238{
239  if (dc != null) dc.close();
240}
241%>
Note: See TracBrowser for help on using the repository browser.