svn commit: r1753024 - in /ofbiz/trunk/framework/common: template/includes/ webcommon/WEB-INF/actions/ webcommon/WEB-INF/actions/certs/ widget/

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1753024 - in /ofbiz/trunk/framework/common: template/includes/ webcommon/WEB-INF/actions/ webcommon/WEB-INF/actions/certs/ widget/

jleroux@apache.org
Author: jleroux
Date: Sun Jul 17 08:14:46 2016
New Revision: 1753024

URL: http://svn.apache.org/viewvc?rev=1753024&view=rev
Log:
A modified patch from Pierre Smits for "Ftl to Widget: improve ViewCertificate to use widgets instead of ftl" https://issues.apache.org/jira/browse/OFBIZ-6302

jleroux: I updated the patch. I fixed things by hand: tabs in the groovy files, removed the ftl file because of a tree conflicts due to the recent ftl files move and updated org.ofbiz to org.apache.ofbiz in CertKeystore.groovy

Added:
    ofbiz/trunk/framework/common/webcommon/WEB-INF/actions/
    ofbiz/trunk/framework/common/webcommon/WEB-INF/actions/certs/
    ofbiz/trunk/framework/common/webcommon/WEB-INF/actions/certs/CertKeystore.groovy   (with props)
Removed:
    ofbiz/trunk/framework/common/template/includes/ViewCertificate.ftl
Modified:
    ofbiz/trunk/framework/common/widget/SecurityForms.xml
    ofbiz/trunk/framework/common/widget/SecurityScreens.xml

Added: ofbiz/trunk/framework/common/webcommon/WEB-INF/actions/certs/CertKeystore.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/webcommon/WEB-INF/actions/certs/CertKeystore.groovy?rev=1753024&view=auto
==============================================================================
--- ofbiz/trunk/framework/common/webcommon/WEB-INF/actions/certs/CertKeystore.groovy (added)
+++ ofbiz/trunk/framework/common/webcommon/WEB-INF/actions/certs/CertKeystore.groovy Sun Jul 17 08:14:46 2016
@@ -0,0 +1,37 @@
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.apache.ofbiz.base.component.ComponentConfig;
+import org.apache.ofbiz.base.component.ComponentConfig.KeystoreInfo;
+import org.apache.ofbiz.base.util.*;
+import org.apache.ofbiz.base.util.KeyStoreUtil;
+
+import org.apache.ofbiz.entity.*;
+import org.apache.ofbiz.entity.util.*;
+
+cert = org.apache.ofbiz.base.util.KeyStoreUtil.pemToCert(certString)
+if (cert){
+    context.certType = cert.getType()
+    context.certName = cert.getSubjectX500Principal().getName()
+    context.certSerialNumber = cert.getSerialNumber().toString(16)
+    context.certPublicKey = cert.getPublicKey()
+}
+
+stores = []
+store = []
+Collection<ComponentConfig> allComponentConfigs = ComponentConfig.getAllComponents();
+for (ComponentConfig cc: allComponentConfigs) {
+    if (cc.getKeystoreInfos()){
+        componentName = cc.getComponentName()
+        store = ["componentId" : componentName]
+        store.componentName = componentName
+        for (KeystoreInfo ks : cc.getKeystoreInfos()) {keystoreName = ks.getName()
+            store.keystoreName = ks.getName()
+            }
+        stores.add(store)
+    }
+    
+}
+context.stores = stores

Propchange: ofbiz/trunk/framework/common/webcommon/WEB-INF/actions/certs/CertKeystore.groovy
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/trunk/framework/common/webcommon/WEB-INF/actions/certs/CertKeystore.groovy
------------------------------------------------------------------------------
    svn:keywords = Date Rev Author URL Id

Propchange: ofbiz/trunk/framework/common/webcommon/WEB-INF/actions/certs/CertKeystore.groovy
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: ofbiz/trunk/framework/common/widget/SecurityForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/widget/SecurityForms.xml?rev=1753024&r1=1753023&r2=1753024&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/widget/SecurityForms.xml (original)
+++ ofbiz/trunk/framework/common/widget/SecurityForms.xml Sun Jul 17 08:14:46 2016
@@ -331,12 +331,37 @@ under the License.
         </field>
     </form>
 
-    <form name="ViewCertificate" type="single" target="ViewCertificate"
+    <form name="EditCertificate" type="single" target="ViewCertificate"
         header-row-style="header-row" default-table-style="basic-table">
         <field name="certString">
             <textarea rows="10"/>
         </field>
         <field name="View Cert" title="${uiLabelMap.ViewCert}"><submit/></field>
     </form>
+    
+    <form name="ViewCertificate" type="single" target="ViewCertificate"
+        header-row-style="header-row" default-table-style="basic-table">
+        <field name="certType" title="${uiLabelMap.CertType}">
+            <display/>
+        </field>
+        <field name="certName" title="${uiLabelMap.CertName}">
+            <display/>
+        </field>
+        <field name="certSerialNumber" title="${uiLabelMap.CertSerialNumber}">
+            <display/>
+        </field>
+    </form>
+    
+    <form name="CertToKeystore" type="list" list-name="stores" use-row-submit="true"
+        separate-columns="true" target="importIssuerProvision" odd-row-style="alternate-row" default-table-style="basic-table hover-bar">
+        <field name="certString"><hidden/></field>
+        <field name="componentName" title="${uiLabelMap.CertComponent}"><display/></field>
+        <field name="keystoreName" title="${uiLabelMap.CertKeyStore}"><display/></field>
+        <field name="alias" title="${uiLabelMap.CertKeyAlias}"><text/></field>
+        <field name="importIssuer" title="${uiLabelMap.CertImportIssuer}"><check/></field>
+        <field name="submitButton" title="${uiLabelMap.CommonSave}" widget-style="buttontext" >
+            <submit button-type="button"/>
+        </field>
+    </form>
 
 </forms>

Modified: ofbiz/trunk/framework/common/widget/SecurityScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/widget/SecurityScreens.xml?rev=1753024&r1=1753023&r2=1753024&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/widget/SecurityScreens.xml (original)
+++ ofbiz/trunk/framework/common/widget/SecurityScreens.xml Sun Jul 17 08:14:46 2016
@@ -232,7 +232,7 @@ under the License.
                             <label text="${uiLabelMap.PageTitleEditIssuerProvisions}"/>
                         </container>
                         <screenlet title="${uiLabelMap.PageTitleAddIssuerProvisions}">
-                            <include-form name="ViewCertificate" location="component://common/widget/SecurityForms.xml"/>
+                            <include-form name="EditCertificate" location="component://common/widget/SecurityForms.xml"/>
                         </screenlet>
                         <screenlet title="${uiLabelMap.CertIssuers}">
                             <include-form name="CertIssuerList" location="component://common/widget/SecurityForms.xml"/>
@@ -333,19 +333,21 @@ under the License.
             <actions>
                 <set field="titleProperty" value="PageTitleImportCertificate"/>
                 <set field="tabButtonItem" value="EditCertIssuerProvisions"/>
+                <set field="certString" from-field="requestParameters.certString"/>
+                <script location="component://common/webcommon/WEB-INF/actions/certs/CertKeystore.groovy"/>
             </actions>
             <widgets>
                 <decorator-screen name="SecurityDecorator" location="${parameters.securityDecoratorLocation}">
                     <decorator-section name="body">
                         <container style="page-title">
                             <label text="${uiLabelMap.PageTitleImportCertificate}"/>
-                        </container>
-                        <container style="widget-container">
-                            <platform-specific>
-                                <html>
-                                    <html-template location="component://common/template/includes/ViewCertificate.ftl"/>
-                                </html>
-                            </platform-specific>
+                        <screenlet title="${uiLabelMap.PageTitleAddIssuerProvisions}">
+                            <include-form name="EditCertificate" location="component://common/widget/SecurityForms.xml"/>
+                        </screenlet>
+                        <screenlet title="${uiLabelMap.CertSaveToKeyStore}">
+                            <include-form location="component://common/widget/SecurityForms.xml" name="ViewCertificate"/>
+                            <include-form location="component://common/widget/SecurityForms.xml" name="CertToKeystore"/>
+                        </screenlet>
                         </container>
                     </decorator-section>
                 </decorator-screen>