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

Last change on this file since 6986 was 6986, checked in by Nicklas Nordborg, 8 years ago

Merge patch release 3.6.1 to the trunk.

File size: 6.8 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 import="net.sf.basedb.clients.web.servlet.ContentSecurityPolicyFilter"%>
28<%@page import="net.sf.basedb.clients.web.extensions.UnsafeScriptable"%>
29<%@page import="net.sf.basedb.util.extensions.ExtendedAbout"%>
30<%@ page pageEncoding="UTF-8" session="false"
31  import="net.sf.basedb.core.Application"
32  import="net.sf.basedb.core.SessionControl"
33  import="net.sf.basedb.core.DbControl"
34  import="net.sf.basedb.core.Item"
35  import="net.sf.basedb.core.Permission"
36  import="net.sf.basedb.core.plugin.About"
37  import="net.sf.basedb.clients.web.Base"
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="net.sf.basedb.util.extensions.ExtensionPoint"
42  import="net.sf.basedb.util.extensions.Extension"
43  import="net.sf.basedb.util.extensions.manager.ExtensionsManager"
44  import="net.sf.basedb.util.extensions.manager.ExtensionsFile"
45  import="net.sf.basedb.clients.web.extensions.ExtensionsControl"
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="about" title="About" />
74 
75    <tbl:data style="top: 0px; margin-top: 0px;">
76      <tbl:headers>
77        <tbl:headerrow>
78          <tbl:columnheaders />
79        </tbl:headerrow>
80      </tbl:headers>
81      <tbl:rows>
82      <%
83      for (ExtensionsFile xtFile : xtFiles)
84      {
85        if (xtFile.getFile() == null) continue; // We skip internal extensions/plug-ins files
86        List<Extension<?>> unsafeExtensions = ec.checkUnsafeScriptableUsage(xtFile);
87       
88        About about = xtFile.getAbout();
89        ExtendedAbout xtAbout = about instanceof ExtendedAbout ? (ExtendedAbout)about : null;
90        Throwable error = null;
91        String name = xtFile.getName();
92        String status = "";
93        String icon = "";
94        boolean allowInstall = false;
95        boolean allowUninstall = false;
96        boolean checkInstall = false;
97        boolean checkUninstall = false;
98        if (!xtFile.exists())
99        {
100          status = "Deleted";
101          allowUninstall = true;
102          checkUninstall = true;
103        }
104        else if (!xtFile.isValid())
105        {
106          status = "Invalid";
107          error = xtFile.getValidationError();
108          if (xtFile.isInstalled())
109          {
110            allowUninstall = true;
111            checkUninstall = true;
112          }
113        }
114        else if (xtFile.isNew())
115        {
116          status = "New";
117          allowInstall = true;
118          checkInstall = true;
119        }
120        else if (xtFile.checkModified())
121        {
122          status = "Modified";
123          allowInstall = true;
124          allowUninstall = true;
125          checkInstall = true;
126        }
127        else if (xtFile.hasError())
128        {
129          status = "Error";
130          allowInstall = true;
131          allowUninstall = true;
132        }
133        else
134        {
135          status = "Already installed";
136          allowInstall = true;
137          allowUninstall = true;
138        }
139        %>
140        <tbl:row>
141          <tbl:cell column="file"><%=name%></tbl:cell>
142          <tbl:cell column="status"><%=status%></tbl:cell>
143          <tbl:cell column="install"  style="text-align: center;">
144            <%
145            if (allowInstall)
146            {
147              %>
148              <input type="checkbox" class="auto-init" data-auto-init="install" 
149                name="<%=name%>.install" value="1" <%=checkInstall ? "checked" : "" %>
150                >
151              <%
152            }
153            %>
154          </tbl:cell>
155          <tbl:cell column="uninstall" style="text-align: center;">
156            <%
157            if (allowUninstall)
158            {
159              %>
160              <input type="checkbox" class="auto-init" data-auto-init="uninstall"
161                name="<%=name%>.uninstall" value="1" <%=checkUninstall ? "checked" : "" %>
162                >
163              <%
164            }
165            %>
166          </tbl:cell>
167          <tbl:cell column="about">
168            <%
169            if (about != null)
170            {
171              %>
172              <b><%=HTML.encodeTags(about.getName())%></b> <%=about.getVersion() == null ? "" : "(v" + about.getVersion() + ")"%><br>
173              <%=HTML.encodeTags(about.getDescription())%><br>
174              <%=HTML.niceFormat(about.getUrl())%>
175              <%
176            }
177            if (unsafeExtensions.size() > 0)
178            {
179              %>
180              <div class="messagecontainer note">
181                <base:icon image="warning.png" />
182                This plug-in contain <%=unsafeExtensions.size()%> extension(s) that
183                may violate the <b>Content Security Policy</b> setting on this server.
184                See BASE documentation for more information.
185              </div>
186              <%
187            }
188            if (error != null)
189            {
190              %>
191              <div class="messagecontainer error">
192              <%=error.getClass().getSimpleName()%>: <%=HTML.encodeTags(error.getMessage())%>
193              </div>
194              <%
195            }
196            %>
197          </tbl:cell>
198         
199        </tbl:row>
200        <%
201      }
202      %>
203      </tbl:rows>
204    </tbl:data>
205  </tbl:table>
206  </div>
207
208  <base:buttongroup subclass="dialogbuttons">
209    <base:button id="startScan" title="Next" />
210    <base:button id="close" title="Cancel" />
211  </base:buttongroup>
212 
213  </base:body>
214  </base:page>
215  <%
216}
217finally
218{
219  if (dc != null) dc.close();
220}
221%>
Note: See TracBrowser for help on using the repository browser.