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

Last change on this file since 6259 was 6259, checked in by Nicklas Nordborg, 10 years ago

References #1729 and #1730. Fixed for the extension manager except the frame with the tree outline.

File size: 5.9 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.manager.ExtensionsManager"
41  import="net.sf.basedb.util.extensions.manager.ExtensionsFile"
42  import="net.sf.basedb.clients.web.extensions.ExtensionsControl"
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<%
48final SessionControl sc = Base.getExistingSessionControl(pageContext, true);
49final String ID = sc.getId();
50final float scale = Base.getScale(sc);
51DbControl dc = null;
52try
53{
54  dc = sc.newDbControl();
55  ExtensionsControl ec = ExtensionsControl.get(dc);
56  ec.checkPermission(Permission.WRITE);
57  ec.scanForChanges();
58  List<ExtensionsFile> xtFiles = ec.getFiles();
59  %>
60  <base:page type="popup" title="Extensions and plug-ins installation wizard">
61  <base:head scripts="table.js,~wizard.js" styles="table.css" />
62  <base:body>
63  <h1>Extensions and plug-ins installation wizard <base:help helpid="extensions.install-wizard" /></h1>
64  <div class="content">
65  <tbl:table id="scan" subclass="fulltable" action="index.jsp" >
66    <tbl:columndef id="file" title="File" />
67    <tbl:columndef id="status" title="Status" />
68    <tbl:columndef id="install" title="Install" />
69    <tbl:columndef id="uninstall" title="Uninstall" />
70    <tbl:columndef id="about" title="About" />
71 
72    <tbl:data style="top: 0px; margin-top: 0px;">
73      <tbl:headers>
74        <tbl:headerrow>
75          <tbl:columnheaders />
76        </tbl:headerrow>
77      </tbl:headers>
78      <tbl:rows>
79      <%
80      for (ExtensionsFile xtFile : xtFiles)
81      {
82        if (xtFile.getFile() == null) continue; // We skip internal extensions/plug-ins files
83       
84        About about = xtFile.getAbout(); 
85        Throwable error = null;
86        String name = xtFile.getName();
87        String status = "";
88        String icon = "";
89        boolean allowInstall = false;
90        boolean allowUninstall = false;
91        boolean checkInstall = false;
92        boolean checkUninstall = false;
93        if (!xtFile.exists())
94        {
95          status = "Deleted";
96          allowUninstall = true;
97          checkUninstall = true;
98        }
99        else if (!xtFile.isValid())
100        {
101          status = "Invalid";
102          error = xtFile.getValidationError();
103          if (xtFile.isInstalled())
104          {
105            allowUninstall = true;
106            checkUninstall = true;
107          }
108        }
109        else if (xtFile.isNew())
110        {
111          status = "New";
112          allowInstall = true;
113          checkInstall = true;
114        }
115        else if (xtFile.checkModified())
116        {
117          status = "Modified";
118          allowInstall = true;
119          allowUninstall = true;
120          checkInstall = true;
121        }
122        else
123        {
124          status = "Already installed";
125          allowInstall = true;
126          allowUninstall = true;
127        }
128        %>
129        <tbl:row>
130          <tbl:cell column="file"><%=name%></tbl:cell>
131          <tbl:cell column="status"><%=status%></tbl:cell>
132          <tbl:cell column="install"  style="text-align: center;">
133            <%
134            if (allowInstall)
135            {
136              %>
137              <input type="checkbox" class="auto-init" data-auto-init="install" 
138                name="<%=name%>.install" value="1" <%=checkInstall ? "checked" : "" %>
139                >
140              <%
141            }
142            %>
143          </tbl:cell>
144          <tbl:cell column="uninstall" style="text-align: center;">
145            <%
146            if (allowUninstall)
147            {
148              %>
149              <input type="checkbox" class="auto-init" data-auto-init="uninstall"
150                name="<%=name%>.uninstall" value="1" <%=checkUninstall ? "checked" : "" %>
151                >
152              <%
153            }
154            %>
155          </tbl:cell>
156          <tbl:cell column="about">
157            <%
158            if (about != null)
159            {
160              %>
161              <b><%=about.getName()%></b> <%=about.getVersion() == null ? "" : "(v" + about.getVersion() + ")"%><br>
162              <%=HTML.encodeTags(about.getDescription())%><br>
163              <%=HTML.niceFormat(about.getUrl())%>
164              <%
165            }
166            if (error != null)
167            {
168              %>
169              <div class="messagecontainer error">
170              <%=error.getClass().getSimpleName()%>: <%=HTML.encodeTags(error.getMessage())%>
171              </div>
172              <%
173            }
174            %>
175          </tbl:cell>
176         
177        </tbl:row>
178        <%
179      }
180      %>
181      </tbl:rows>
182    </tbl:data>
183  </tbl:table>
184  </div>
185
186  <base:buttongroup subclass="dialogbuttons">
187    <base:button id="startScan" title="Next" />
188    <base:button id="close" title="Cancel" />
189  </base:buttongroup>
190 
191  </base:body>
192  </base:page>
193  <%
194}
195finally
196{
197  if (dc != null) dc.close();
198}
199%>
Note: See TracBrowser for help on using the repository browser.