Changeset 3708
- Timestamp:
- Sep 5, 2007, 5:48:53 PM (15 years ago)
- Location:
- trunk/www/admin/plugindefinitions
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/www/admin/plugindefinitions/auto_install.jsp
r3706 r3708 31 31 import="net.sf.basedb.core.Item" 32 32 import="net.sf.basedb.core.ItemContext" 33 import="net.sf.basedb.core.ItemNotFoundException" 34 import="net.sf.basedb.core.ItemQuery" 35 import="net.sf.basedb.core.PluginDefinition" 36 import="net.sf.basedb.core.PluginConfiguration" 33 37 import="net.sf.basedb.core.SessionControl" 38 import="net.sf.basedb.core.query.Hql" 39 import="net.sf.basedb.core.query.Restrictions" 40 import="net.sf.basedb.core.query.Expressions" 41 import="net.sf.basedb.util.FileUtil" 34 42 import="net.sf.basedb.util.PluginInfo" 43 import="net.sf.basedb.util.PluginConfigInfo" 35 44 import="net.sf.basedb.clients.web.util.HTML" 36 45 import="net.sf.basedb.clients.web.Base" 37 46 47 import="java.util.Collections" 38 48 import="java.util.List" 39 49 import="java.util.ArrayList" 50 import="java.util.Iterator" 40 51 %> 41 52 <%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> … … 52 63 try 53 64 { 54 String title = "Plugin Autoinstaller";65 String title = "Plugin autoinstaller"; 55 66 java.io.File pluginDir = new java.io.File(request.getParameter("plugin_path")); 67 List<PluginInfo> pluginInfos = new ArrayList<PluginInfo>(); 68 List<java.io.File> jarFiles = FileUtil.findFiles(pluginDir, null, "jar", true); 56 69 70 StringBuilder newPlugins = new StringBuilder(); 71 72 for (java.io.File file : jarFiles) 73 { 74 pluginInfos.addAll(PluginInfo.loadFromJar(file)); 75 } 57 76 %> 58 77 <base:page type="popup" title="<%=title%>"> … … 66 85 frm.submit(); 67 86 } 87 function toggle(grpId) 88 { 89 var grp = document.getElementById('grp.'+grpId); 90 var grpIcon = document.getElementById('grp.'+grpId+'.icon'); 91 var cnfId = 1; 92 var cnf = document.getElementById('cnf.'+grpId+'.'+cnfId); 93 if (cnf && cnf.style.display == 'none') 94 { 95 grpIcon.src = getRoot()+'images/joust/minustop.gif'; 96 } 97 else 98 { 99 grpIcon.src = getRoot()+'images/joust/plusonly.gif'; 100 } 101 while (cnf) 102 { 103 Main.showHide(cnf.id); 104 cnfId++; 105 cnf = document.getElementById('cnf.'+grpId+'.'+cnfId); 106 } 107 } 108 function setConfigsOnChange(pluginId, selectList) 109 { 110 var installoption = selectList[selectList.selectedIndex].value; 111 if (installoption == 'plugin+confs') 112 { 113 var cnfId = 1; 114 var cnf = document.getElementById('setconfig.'+pluginId+'.'+cnfId); 115 while (cnf) 116 { 117 for (var i = 0; i < cnf.length; i++) 118 { 119 120 if (cnf[i].value == 'import') 121 { 122 cnf.selectedIndex = i; 123 i = cnf.length; 124 } 125 } 126 cnfId++; 127 cnf = document.getElementById('setconfig.'+pluginId+'.'+cnfId); 128 } 129 } 130 else 131 { 132 var cnfId = 1; 133 var cnf = document.getElementById('setconfig.'+pluginId+'.'+cnfId); 134 while (cnf) 135 { 136 for (var i = 0; i < cnf.length; i++) 137 { 138 139 if (cnf[i].value == 'none') 140 { 141 cnf.selectedIndex = i; 142 i = cnf.length; 143 } 144 } 145 cnfId++; 146 cnf = document.getElementById('setconfig.'+pluginId+'.'+cnfId); 147 } 148 } 149 } 68 150 </script> 69 151 </base:head> 70 152 <base:body> 71 <form name="autoinstall" action="index.jsp" method=" get" onsubmit="return false;">153 <form name="autoinstall" action="index.jsp" method="post" onsubmit="return false;"> 72 154 <input type="hidden" name="ID" value="<%=ID%>"> 73 155 <input type="hidden" name="cmd" value="LoadPlugins"> 156 157 <h3 class="docked"><%=title%> <base:help tabcontrol="plugins" /></h3> 158 159 <t:tabcontrol id="plugins" contentstyle="<%="height: "+(int)(scale*260)+"px;"%>" 160 position="bottom"> 161 <t:tab id="plugins" title="Available plugins" validate="validatePlugins()" helpid="plugindefinition.autoinstaller.plugins"> 162 <div align="left"> 163 <table border="0" cellspacing="0" cellpadding="0"> 164 <tr> 165 <td><b>Plugins</b></td> 166 <td><b>Install</b></td> 167 </tr> 168 <% 169 int plugin = 0; 170 for (PluginInfo info : pluginInfos) 171 { 172 String name = info.getAbout().getName(); 173 List<PluginConfigInfo> cnfInfos = info.getConfigurations(); 174 ++plugin; 175 int cnf = 0; 176 boolean hasConfigs = cnfInfos != null && !cnfInfos.isEmpty(); 177 boolean classExists = true; 178 boolean jarExists = true; 179 PluginDefinition pd = null; 180 try 181 { 182 pd = PluginDefinition.getByClassName(dc, info.getClassName()); 183 if (pd.getJarPath().equals(info.getJarPath())) 184 { 185 jarExists = true; 186 } 187 } 188 catch(ItemNotFoundException ex) 189 { 190 classExists = false; 191 jarExists = false; 192 } 193 %> 194 <tr id="plugin.<%=plugin%>"> 195 <td style="padding-top: 6px;"> 196 <% 197 if (hasConfigs) 198 { 199 %> 200 <a href="javascript:toggle(<%=plugin%>)" title="Expand/collaps to see/hide configurations"> 201 <base:icon id="<%="grp."+plugin+".icon"%>" image="joust/plusonly.gif" /> 202 <% 203 } 204 %> 205 <%=HTML.encodeTags(name)%></a> 206 </td> 207 <td> 208 <select name="setplugin.<%=plugin%>" 209 onchange="setConfigsOnChange(<%=plugin%>,this)" <%=classExists&&jarExists ? "disabled" : "" %>> 210 <option value="none" title="Plugin will not be installed">--None-- 211 <option value="plugin" title="Plugin will be installed">Only plugin 212 <% 213 if (hasConfigs) 214 { 215 %> 216 <option value="plugin+confs" title="Plugin and configurations will be installed">With configurations 217 <% 218 } 219 %> 220 </select> 221 <base:icon image="<%=classExists&&!jarExists ? "itemexists.gif" : "" %>" /> 222 <base:icon image="<%=classExists&&jarExists ? "hasvalues.gif" : "" %>" /> 223 </td> 224 </tr> 225 <% 226 if (hasConfigs) 227 { 228 Iterator<PluginConfigInfo> cnfi = cnfInfos.iterator(); 229 while (cnfi.hasNext()) 230 { 231 PluginConfigInfo cnfInfo = cnfi.next(); 232 boolean isDublicate = false; 233 if (classExists) 234 { 235 ItemQuery<PluginConfiguration> cnfQuery = pd.getPluginConfigurations(); 236 cnfQuery.restrict(Restrictions.eq(Hql.property("name"), Expressions.string(cnfInfo.getName()))); 237 Iterator<PluginConfiguration> it = cnfQuery.iterate(dc); 238 isDublicate = it != null && it.hasNext(); 239 } 240 ++cnf; 241 boolean hasNext = cnfi.hasNext(); 242 %> 243 <tr id="cnf.<%=plugin%>.<%=cnf%>" style="display: none;"> 244 <td> 245 <base:icon 246 image="<%=hasNext ? "joust/big/join.gif" : "joust/big/joinbottom.gif"%>" 247 /> 248 <%=HTML.encodeTags(cnfInfo.getName())%> 249 </td> 250 <td> 251 <select id="setconfig.<%=plugin%>.<%=cnf%>"> 252 <option value="none" title="Configuration will not be imported">--None-- 253 <option value="import" title="Configuration will be imported">Import 254 </select> 255 <base:icon image="<%=isDublicate ? "warning.gif" : ""%>" /> 256 </td> 257 </tr> 258 <% 259 } 260 } 261 } 262 %> 263 </table> 264 </div> 265 <div align=left style="padding-top:20px"> 266 <i><base:icon image="itemexists.gif" /> = Class with same name exists in another jar-file</i><br> 267 <i><base:icon image="warning.gif" /> = Configuration already exists</i><br> 268 <i><base:icon image="hasvalues.gif" /> = Plugin allready installed, <br> 269 class-name and jar-file are the same as an installed plugin</i> 270 </div> 271 </t:tab> 272 273 </t:tabcontrol> 74 274 75 275 <table align="center"> -
trunk/www/admin/plugindefinitions/index.jsp
r3679 r3708 28 28 --%> 29 29 <%@ page session="false" 30 import="net.sf.basedb.core.Application" 30 31 import="net.sf.basedb.core.SessionControl" 31 32 import="net.sf.basedb.core.DbControl" … … 129 130 ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); 130 131 cc.setId(0); 131 redirect = editPage; 132 if (Application.getNonCorePluginDirectory() == null) 133 { 134 redirect = editPage; 135 } 136 else 137 { 138 String pluginPath = Application.getNonCorePluginDirectory().getPath(); 139 redirect = "select_installation_type.jsp?ID="+ID+"&plugin_path="+pluginPath; 140 } 141 } 142 else if("InstallationType".equals(cmd)) 143 { 144 //Either manually or auto installation is selected 145 if (request.getParameter("installationtypes").equals("autoinstall")) 146 { 147 String pluginPath = request.getParameter("plugin_path"); 148 redirect = "auto_install.jsp?ID="+ID+"&plugin_path="+pluginPath; 149 } 150 else if (request.getParameter("installationtypes").equals("manuellinstall")) 151 { 152 redirect = editPage; 153 } 154 155 } 156 else if("LoadPlugins".equals(cmd)) 157 { 158 //Loads plugins from jars that have been selected in auto_installer.jsp 159 dc = sc.newDbControl(); 132 160 } 133 161 else if ("UpdateItem".equals(cmd))
Note: See TracChangeset
for help on using the changeset viewer.