parent
df08ecb6da
commit
11e125fd7e
8 changed files with 137 additions and 16 deletions
|
@ -28,6 +28,7 @@ import org.codelibs.fess.app.web.base.FessAdminAction;
|
|||
import org.codelibs.fess.helper.PluginHelper;
|
||||
import org.codelibs.fess.helper.PluginHelper.Artifact;
|
||||
import org.codelibs.fess.helper.PluginHelper.ArtifactType;
|
||||
import org.codelibs.fess.util.RenderDataUtil;
|
||||
import org.lastaflute.web.Execute;
|
||||
import org.lastaflute.web.response.HtmlResponse;
|
||||
import org.lastaflute.web.ruts.process.ActionRuntime;
|
||||
|
@ -45,7 +46,7 @@ public class AdminPluginAction extends FessAdminAction {
|
|||
protected void setupHtmlData(final ActionRuntime runtime) {
|
||||
super.setupHtmlData(runtime);
|
||||
runtime.registerData("helpLink", systemHelper.getHelpLink(fessConfig.getOnlineHelpNamePlugin()));
|
||||
// runtime.registerData("availableArtifactItems", getAllAvailableArtifacts());
|
||||
//runtime.registerData("availableArtifactItems", getAllAvailableArtifacts());
|
||||
runtime.registerData("installedArtifactItems", getAllInstalledArtifacts());
|
||||
}
|
||||
|
||||
|
@ -76,10 +77,32 @@ public class AdminPluginAction extends FessAdminAction {
|
|||
|
||||
@Execute
|
||||
public HtmlResponse install(final InstallForm form) {
|
||||
// TODO
|
||||
validate(form, messages -> {}, () -> {
|
||||
return asHtml(path_AdminPlugin_AdminPluginInstallpluginJsp);
|
||||
});
|
||||
verifyToken(() -> {
|
||||
return asHtml(path_AdminPlugin_AdminPluginInstallpluginJsp);
|
||||
});
|
||||
Artifact artifact = new Artifact(form.name, form.version, form.url);
|
||||
try {
|
||||
pluginHelper.installArtifact(artifact);
|
||||
saveInfo(messages -> messages.addSuccessInstallPlugin(GLOBAL, artifact.getFileName()));
|
||||
} catch (Exception e) {
|
||||
logger.warn("Failed to install " + artifact.getFileName(), e);
|
||||
saveError(messages -> messages.addErrorsFailedToInstallPlugin(GLOBAL, artifact.getFileName()));
|
||||
}
|
||||
return redirect(getClass());
|
||||
}
|
||||
|
||||
|
||||
@Execute
|
||||
public HtmlResponse installplugin() {
|
||||
saveToken();
|
||||
return asHtml(path_AdminPlugin_AdminPluginInstallpluginJsp).renderWith(data -> {
|
||||
RenderDataUtil.register(data, "availableArtifactItems", getAllAvailableArtifacts());
|
||||
}).useForm(InstallForm.class, op -> op.setup(form -> {}));
|
||||
}
|
||||
|
||||
private HtmlResponse asListHtml() {
|
||||
return asHtml(path_AdminPlugin_AdminPluginJsp).useForm(DeleteForm.class);
|
||||
}
|
||||
|
@ -107,6 +130,7 @@ public class AdminPluginAction extends FessAdminAction {
|
|||
item.put("type", ArtifactType.getType(artifact).getId());
|
||||
item.put("name", artifact.getName());
|
||||
item.put("version", artifact.getVersion());
|
||||
item.put("url", artifact.getUrl());
|
||||
return item;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,4 +28,7 @@ public class InstallForm {
|
|||
@Size(max = 100)
|
||||
public String version;
|
||||
|
||||
@Size(max = 200)
|
||||
public String url;
|
||||
|
||||
}
|
||||
|
|
|
@ -291,6 +291,9 @@ public interface FessHtmlPath {
|
|||
/** The path of the HTML: /admin/plugin/admin_plugin.jsp */
|
||||
HtmlNext path_AdminPlugin_AdminPluginJsp = new HtmlNext("/admin/plugin/admin_plugin.jsp");
|
||||
|
||||
/** The path of the HTML: /admin/plugin/admin_plugin_installplugin.jsp */
|
||||
HtmlNext path_AdminPlugin_AdminPluginInstallpluginJsp = new HtmlNext("/admin/plugin/admin_plugin_installplugin.jsp");
|
||||
|
||||
/** The path of the HTML: /admin/relatedcontent/admin_relatedcontent.jsp */
|
||||
HtmlNext path_AdminRelatedcontent_AdminRelatedcontentJsp = new HtmlNext("/admin/relatedcontent/admin_relatedcontent.jsp");
|
||||
|
||||
|
|
|
@ -2952,8 +2952,8 @@ public class FessLabels extends UserMessages {
|
|||
/** The key of the message: Reload */
|
||||
public static final String LABELS_reload_doc_index_button = "{labels.reload_doc_index_button}";
|
||||
|
||||
/** The key of the message: Plugin Manager */
|
||||
public static final String LABELS_plugin_management = "{labels.plugin_management}";
|
||||
/** The key of the message: Plugin */
|
||||
public static final String LABELS_plugin_title = "{labels.plugin_title}";
|
||||
|
||||
/** The key of the message: Plugin List */
|
||||
public static final String LABELS_plugin_list_name = "{labels.plugin_list_name}";
|
||||
|
@ -2970,6 +2970,9 @@ public class FessLabels extends UserMessages {
|
|||
/** The key of the message: Delete */
|
||||
public static final String LABELS_plugin_delete = "{labels.plugin_delete}";
|
||||
|
||||
/** The key of the message: Install */
|
||||
public static final String LABELS_plugin_install = "{labels.plugin_install}";
|
||||
|
||||
/**
|
||||
* Assert the property is not null.
|
||||
* @param property The value of the property. (NotNull)
|
||||
|
|
|
@ -112,7 +112,7 @@ public class ResourceUtil {
|
|||
}
|
||||
|
||||
public static Path getPluginPath(final String... names) {
|
||||
return getPath("plutin", names);
|
||||
return getPath("plugin", names);
|
||||
}
|
||||
|
||||
public static Path getProjectPropertiesFile() {
|
||||
|
|
|
@ -976,9 +976,10 @@ labels.download_diagnostic_logs_button=Download Logs
|
|||
labels.reload_doc_index=Reload Doc Index
|
||||
labels.reload_doc_index_button=Reload
|
||||
|
||||
labels.plugin_management=Plugin Manager
|
||||
labels.plugin_title=Plugin
|
||||
labels.plugin_list_name=Plugin List
|
||||
labels.plugin_type=Type
|
||||
labels.plugin_name=Name
|
||||
labels.plugin_version=Version
|
||||
labels.plugin_delete=Delete
|
||||
labels.plugin_install=Install
|
|
@ -3,7 +3,7 @@
|
|||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title><la:message key="labels.admin_brand_title" /> | <la:message
|
||||
key="labels.plugin_management" /></title>
|
||||
key="labels.plugin_title" /></title>
|
||||
<jsp:include page="/WEB-INF/view/common/admin/head.jsp"></jsp:include>
|
||||
</head>
|
||||
<body class="hold-transition skin-blue sidebar-mini">
|
||||
|
@ -16,7 +16,7 @@
|
|||
<div class="content-wrapper">
|
||||
<section class="content-header">
|
||||
<h1>
|
||||
<la:message key="labels.plugin_management" />
|
||||
<la:message key="labels.plugin_title" />
|
||||
</h1>
|
||||
<jsp:include page="/WEB-INF/view/common/admin/crud/breadcrumb.jsp"></jsp:include>
|
||||
</section>
|
||||
|
@ -31,7 +31,7 @@
|
|||
<div class="btn-group pull-right">
|
||||
<la:link href="installplugin" styleClass="btn btn-success btn-xs">
|
||||
<em class="fa fa-plus"></em>
|
||||
<la:message key="labels.crud_link_create" />
|
||||
<la:message key="labels.plugin_install" />
|
||||
</la:link>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -63,15 +63,14 @@
|
|||
<td>${f:h(artifact.name)}</td>
|
||||
<td>${f:h(artifact.version)}</td>
|
||||
<td>
|
||||
|
||||
<button type="button" class="btn btn-danger btn-xs" name="delete"
|
||||
data-toggle="modal" data-target="#confirmToDelete"
|
||||
value="<la:message key="labels.crud_button_delete" />">
|
||||
data-toggle="modal" data-target='#confirmToDelete-${f:h(artifact.name)}-${f:h(artifact.version).replace(".", "\\.")}'
|
||||
value="<la:message key="labels.design_delete_button" />">
|
||||
<em class="fa fa-trash"></em>
|
||||
<la:message key="labels.crud_button_delete" />
|
||||
<la:message key="labels.design_delete_button" />
|
||||
</button>
|
||||
<div class="modal modal-danger fade" id="confirmToDelete" tabindex="-1"
|
||||
role="dialog">
|
||||
<div class="modal modal-danger fade" id='confirmToDelete-${f:h(artifact.name)}-${f:h(artifact.version)}'
|
||||
tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
|
@ -107,7 +106,6 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</c:forEach>
|
||||
|
|
|
@ -0,0 +1,89 @@
|
|||
<%@page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%><!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title><la:message key="labels.admin_brand_title" /> | <la:message
|
||||
key="labels.plugin_install_title" /></title>
|
||||
<jsp:include page="/WEB-INF/view/common/admin/head.jsp"></jsp:include>
|
||||
</head>
|
||||
<body class="hold-transition skin-blue sidebar-mini">
|
||||
<div class="wrapper">
|
||||
<jsp:include page="/WEB-INF/view/common/admin/header.jsp"></jsp:include>
|
||||
<jsp:include page="/WEB-INF/view/common/admin/sidebar.jsp">
|
||||
<jsp:param name="menuCategoryType" value="system" />
|
||||
<jsp:param name="menuType" value="plugin" />
|
||||
</jsp:include>
|
||||
<div class="content-wrapper">
|
||||
<section class="content-header">
|
||||
<h1>
|
||||
<la:message key="labels.plugin_install_title" />
|
||||
</h1>
|
||||
<jsp:include page="/WEB-INF/view/common/admin/crud/breadcrumb.jsp"></jsp:include>
|
||||
</section>
|
||||
<section class="content">
|
||||
<la:form action="/admin/plugin/" styleClass="form-horizontal">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<!-- /.box-header -->
|
||||
<div class="box-body">
|
||||
<%-- Message --%>
|
||||
<div>
|
||||
<la:info id="msg" message="true">
|
||||
<div class="alert alert-info">${msg}</div>
|
||||
</la:info>
|
||||
<la:errors />
|
||||
</div>
|
||||
<%-- List --%>
|
||||
<div class="data-wrapper">
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<table class="table table-bordered table-striped dataTable">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th><la:message key="labels.plugin_type" /></th>
|
||||
<th><la:message key="labels.plugin_name" /></th>
|
||||
<th><la:message key="labels.plugin_version" /></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
<c:forEach var="artifact" varStatus="s"
|
||||
items="${availableArtifactItems}">
|
||||
<tr>
|
||||
<td>${f:h(artifact.type)}</td>
|
||||
<td>${f:h(artifact.name)}</td>
|
||||
<td>${f:h(artifact.version)}</td>
|
||||
<td>
|
||||
<la:form action="/admin/plugin/" styleClass="form-horizontal">
|
||||
<input type="hidden" name="name" value="${f:h(artifact.name)}">
|
||||
<input type="hidden" name="version" value="${f:h(artifact.version)}">
|
||||
<input type="hidden" name="url" value="${f:h(artifact.url)}">
|
||||
<button type="submit" class="btn btn-warning"
|
||||
name="install"
|
||||
value="<la:message key="labels.crud_button_install" />">
|
||||
<em class="fa fa-plus"></em>
|
||||
<la:message key="labels.crud_button_install" />
|
||||
</button>
|
||||
</la:form>
|
||||
</td>
|
||||
</tr>
|
||||
</c:forEach>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.data-wrapper -->
|
||||
</div>
|
||||
<!-- /.box-body -->
|
||||
<!-- /.box-footer -->
|
||||
</div>
|
||||
<!-- /.box -->
|
||||
</div>
|
||||
</div>
|
||||
</la:form>
|
||||
</section>
|
||||
</div>
|
||||
<jsp:include page="/WEB-INF/view/common/admin/footer.jsp"></jsp:include>
|
||||
</div>
|
||||
<jsp:include page="/WEB-INF/view/common/admin/foot.jsp"></jsp:include>
|
||||
</body>
|
||||
</html>
|
Loading…
Add table
Reference in a new issue