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

Last change on this file since 6136 was 6136, checked in by Nicklas Nordborg, 11 years ago

References #1727: Move to HTML5

  • Remove language="javascript" from <script> tags in all JSP files.
File size: 6.5 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" styles="table.css">
62    <script>
63   
64    // Submit the form
65    function startManualScan()
66    {
67      var frm = document.forms['scan'];
68      frm.cmd.value = 'DoManualScan';
69      frm.submit();
70    }
71   
72    function installOnClick(name)
73    {
74      var frm = document.forms['scan'];
75      if (frm[name+'.install'].checked)
76      {
77        if (frm[name+'.uninstall']) frm[name+'.uninstall'].checked = false;
78      }
79    }
80
81    function uninstallOnClick(name)
82    {
83      var frm = document.forms['scan'];
84      if (frm[name+'.uninstall'].checked)
85      {
86        if (frm[name+'.install']) frm[name+'.install'].checked = false;
87      }
88    }
89    </script>
90  </base:head>
91  <base:body>
92  <h1>Extensions and plug-ins installation wizard <base:help helpid="extensions.install-wizard" /></h1>
93 
94 
95  <div class="content">
96  <tbl:table id="scan" subclass="fulltable" action="index.jsp" >
97    <tbl:columndef id="file" title="File" />
98    <tbl:columndef id="status" title="Status" />
99    <tbl:columndef id="install" title="Install" />
100    <tbl:columndef id="uninstall" title="Uninstall" />
101    <tbl:columndef id="about" title="About" />
102 
103    <tbl:data style="top: 0px; margin-top: 0px;">
104      <tbl:headers>
105        <tbl:headerrow>
106          <tbl:columnheaders />
107        </tbl:headerrow>
108      </tbl:headers>
109      <tbl:rows>
110      <%
111      for (ExtensionsFile xtFile : xtFiles)
112      {
113        if (xtFile.getFile() == null) continue; // We skip internal extensions/plug-ins files
114       
115        About about = xtFile.getAbout(); 
116        Throwable error = null;
117        String name = xtFile.getName();
118        String status = "";
119        String icon = "";
120        boolean allowInstall = false;
121        boolean allowUninstall = false;
122        boolean checkInstall = false;
123        boolean checkUninstall = false;
124        if (!xtFile.exists())
125        {
126          status = "Deleted";
127          allowUninstall = true;
128          checkUninstall = true;
129        }
130        else if (!xtFile.isValid())
131        {
132          status = "Invalid";
133          error = xtFile.getValidationError();
134          if (xtFile.isInstalled())
135          {
136            allowUninstall = true;
137            checkUninstall = true;
138          }
139        }
140        else if (xtFile.isNew())
141        {
142          status = "New";
143          allowInstall = true;
144          checkInstall = true;
145        }
146        else if (xtFile.checkModified())
147        {
148          status = "Modified";
149          allowInstall = true;
150          allowUninstall = true;
151          checkInstall = true;
152        }
153        else
154        {
155          status = "Already installed";
156          allowInstall = true;
157          allowUninstall = true;
158        }
159        %>
160        <tbl:row>
161          <tbl:cell column="file"><%=name%></tbl:cell>
162          <tbl:cell column="status"><%=status%></tbl:cell>
163          <tbl:cell column="install"  style="text-align: center;">
164            <%
165            if (allowInstall)
166            {
167              %>
168              <input type="checkbox" name="<%=name%>.install" value="1" <%=checkInstall ? "checked" : "" %>
169                onclick="installOnClick('<%=name%>')">
170              <%
171            }
172            %>
173          </tbl:cell>
174          <tbl:cell column="uninstall" style="text-align: center;">
175            <%
176            if (allowUninstall)
177            {
178              %>
179              <input type="checkbox" name="<%=name%>.uninstall" value="1" <%=checkUninstall ? "checked" : "" %>
180                onclick="uninstallOnClick('<%=name%>')">
181              <%
182            }
183            %>
184          </tbl:cell>
185          <tbl:cell column="about">
186            <%
187            if (about != null)
188            {
189              %>
190              <b><%=about.getName()%></b> <%=about.getVersion() == null ? "" : "(v" + about.getVersion() + ")"%><br>
191              <%=HTML.encodeTags(about.getDescription())%><br>
192              <%=HTML.niceFormat(about.getUrl())%>
193              <%
194            }
195            if (error != null)
196            {
197              %>
198              <div class="messagecontainer error">
199              <%=error.getClass().getSimpleName()%>: <%=HTML.encodeTags(error.getMessage())%>
200              </div>
201              <%
202            }
203            %>
204          </tbl:cell>
205         
206        </tbl:row>
207        <%
208      }
209      %>
210      </tbl:rows>
211    </tbl:data>
212  </tbl:table>
213  </div>
214
215  <base:buttongroup subclass="dialogbuttons">
216    <base:button onclick="startManualScan();" title="Next" />
217    <base:button onclick="window.close();" title="Cancel" />
218  </base:buttongroup>
219 
220  </base:body>
221  </base:page>
222  <%
223}
224finally
225{
226  if (dc != null) dc.close();
227}
228%>
Note: See TracBrowser for help on using the repository browser.