geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jb...@apache.org
Subject svn commit: r631628 - in /geronimo/server/trunk/plugins/console/plugin-portlets/src/main: java/org/apache/geronimo/console/car/ExportConfigHandler.java webapp/WEB-INF/view/car/index.jsp
Date Wed, 27 Feb 2008 16:12:53 GMT
Author: jbohn
Date: Wed Feb 27 08:12:49 2008
New Revision: 631628

URL: http://svn.apache.org/viewvc?rev=631628&view=rev
Log:
GERONIMO-3867 Add validation to ensure a configuration is selected for export.  Also some
minor changes to make the handler code more consistent.

Modified:
    geronimo/server/trunk/plugins/console/plugin-portlets/src/main/java/org/apache/geronimo/console/car/ExportConfigHandler.java
    geronimo/server/trunk/plugins/console/plugin-portlets/src/main/webapp/WEB-INF/view/car/index.jsp

Modified: geronimo/server/trunk/plugins/console/plugin-portlets/src/main/java/org/apache/geronimo/console/car/ExportConfigHandler.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/console/plugin-portlets/src/main/java/org/apache/geronimo/console/car/ExportConfigHandler.java?rev=631628&r1=631627&r2=631628&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/console/plugin-portlets/src/main/java/org/apache/geronimo/console/car/ExportConfigHandler.java
(original)
+++ geronimo/server/trunk/plugins/console/plugin-portlets/src/main/java/org/apache/geronimo/console/car/ExportConfigHandler.java
Wed Feb 27 08:12:49 2008
@@ -66,17 +66,18 @@
 
     public void renderView(RenderRequest request, RenderResponse response, MultiPageModel
model) throws PortletException, IOException {
         String configId = request.getParameter("configId");
-        PluginType data = ManagementHelper.getManagementHelper(request).getPluginInstaller().getPluginMetadata(
-                Artifact.create(configId));
-        PluginArtifactType instance = data.getPluginArtifact().get(0);
+        PluginInstaller pluginInstaller = ManagementHelper.getManagementHelper(request).getPluginInstaller();
+        Artifact newArtifact = Artifact.create(configId);  
+        PluginType metadata = pluginInstaller.getPluginMetadata(newArtifact);  
+        PluginArtifactType instance = metadata.getPluginArtifact().get(0);
         request.setAttribute("configId", PluginInstallerGBean.toArtifact(instance.getModuleId()).toString());
-        request.setAttribute("name", data.getName());
+        request.setAttribute("name", metadata.getName());
         request.setAttribute("repository", combine(instance.getSourceRepository()));
-        request.setAttribute("category", data.getCategory());
-        request.setAttribute("url", data.getUrl());
-        request.setAttribute("author", data.getAuthor());
-        request.setAttribute("description", data.getDescription());
-        List<LicenseType> licenses = data.getLicense();
+        request.setAttribute("category", metadata.getCategory());
+        request.setAttribute("url", metadata.getUrl());
+        request.setAttribute("author", metadata.getAuthor());
+        request.setAttribute("description", metadata.getDescription());
+        List<LicenseType> licenses = metadata.getLicense();
         if (licenses != null && licenses.size() > 0) {
             request.setAttribute("license", licenses.get(0).getValue());
             if (licenses.get(0).isOsiApproved()) {

Modified: geronimo/server/trunk/plugins/console/plugin-portlets/src/main/webapp/WEB-INF/view/car/index.jsp
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/console/plugin-portlets/src/main/webapp/WEB-INF/view/car/index.jsp?rev=631628&r1=631627&r2=631628&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/console/plugin-portlets/src/main/webapp/WEB-INF/view/car/index.jsp
(original)
+++ geronimo/server/trunk/plugins/console/plugin-portlets/src/main/webapp/WEB-INF/view/car/index.jsp
Wed Feb 27 08:12:49 2008
@@ -19,6 +19,20 @@
 <%@ taglib uri="http://java.sun.com/portlet" prefix="portlet" %>
 <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
 <fmt:setBundle basename="pluginportlets"/>
+
+<script>
+function <portlet:namespace/>validateForm(){
+    with(document.<portlet:namespace/>ExportForm){
+        if (configId.value==null || configId.value=="") {
+            alert("Please select a configuration to export.");
+            return false;
+        }
+    }
+    return true;
+}
+</script>
+
+
 <portlet:defineObjects/>
 <fmt:message key="car.index.summary"/>
 
@@ -49,7 +63,7 @@
 
 <p><fmt:message key="car.index.createGeronimoPluginExp"/></p>
 
-<form name="<portlet:namespace/>ExportForm" action="<portlet:actionURL/>"
method="POST">
+<form name="<portlet:namespace/>ExportForm" action="<portlet:actionURL/>"
method="POST" onsubmit="return <portlet:namespace/>validateForm()">
     <input type="hidden" name="mode" value="configure-before"/>
     <select name="configId">
         <option/>



Mime
View raw message