svn commit: r744842 - in /ofbiz/trunk/framework/webtools: config/ webapp/webtools/WEB-INF/ webapp/webtools/WEB-INF/actions/labelmanager/ webapp/webtools/labelmanager/ widget/

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

svn commit: r744842 - in /ofbiz/trunk/framework/webtools: config/ webapp/webtools/WEB-INF/ webapp/webtools/WEB-INF/actions/labelmanager/ webapp/webtools/labelmanager/ widget/

jleroux@apache.org
Author: jleroux
Date: Mon Feb 16 07:51:34 2009
New Revision: 744842

URL: http://svn.apache.org/viewvc?rev=744842&view=rev
Log:
Marco's LabelReferences3.patch from  "New tool to get labels information" https://issues.apache.org/jira/browse/OFBIZ-2070 - OFBIZ-2070

Added:
    ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/labelmanager/ViewFile.groovy
    ofbiz/trunk/framework/webtools/webapp/webtools/labelmanager/ViewFile.ftl
    ofbiz/trunk/framework/webtools/webapp/webtools/labelmanager/ViewReferences.ftl
Modified:
    ofbiz/trunk/framework/webtools/config/WebtoolsUiLabels.xml
    ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/controller.xml
    ofbiz/trunk/framework/webtools/webapp/webtools/labelmanager/SearchLabels.ftl
    ofbiz/trunk/framework/webtools/webapp/webtools/labelmanager/ViewHardcodedLabels.ftl
    ofbiz/trunk/framework/webtools/webapp/webtools/labelmanager/ViewLabels.ftl
    ofbiz/trunk/framework/webtools/widget/LabelManagerScreens.xml

Modified: ofbiz/trunk/framework/webtools/config/WebtoolsUiLabels.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/config/WebtoolsUiLabels.xml?rev=744842&r1=744841&r2=744842&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/config/WebtoolsUiLabels.xml (original)
+++ ofbiz/trunk/framework/webtools/config/WebtoolsUiLabels.xml Mon Feb 16 07:51:34 2009
@@ -1502,6 +1502,10 @@
         <value xml:lang="fr">La traduction ${key} existe déjà dans le fichier ${fileName}</value>
         <value xml:lang="it">La label ${key} esiste già nel file ${fileName}</value>
     </property>
+    <property key="WebtoolsLabelManagerOnlyMissingTranslations">
+        <value xml:lang="en">Only Missing Translations</value>
+        <value xml:lang="it">Solo traduzioni mancanti</value>
+    </property>
     <property key="WebtoolsLabelManagerReferences">
         <value xml:lang="en">References</value>
         <value xml:lang="it">Referenze</value>
@@ -1535,6 +1539,14 @@
         <value xml:lang="fr">Mettre à jour les fichiers de traduction</value>
         <value xml:lang="it">Aggiorna files delle labels</value>
     </property>
+    <property key="WebtoolsLabelManagerViewFile">
+        <value xml:lang="en">View file</value>
+        <value xml:lang="it">Mostra file</value>
+    </property>
+    <property key="WebtoolsLabelManagerViewReferences">
+        <value xml:lang="en">View Labels References</value>
+        <value xml:lang="it">Mostra referenze labels</value>
+    </property>
     <property key="WebtoolsLabelManagerWarningMessage">
         <value xml:lang="en">There are some labels with more than translation for the same language</value>
         <value xml:lang="fr">Il y a des traduction dupliquées pour le même langage</value>

Added: ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/labelmanager/ViewFile.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/labelmanager/ViewFile.groovy?rev=744842&view=auto
==============================================================================
--- ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/labelmanager/ViewFile.groovy (added)
+++ ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/labelmanager/ViewFile.groovy Mon Feb 16 07:51:34 2009
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import java.net.URI;
+import org.ofbiz.base.util.FileUtil;
+import org.ofbiz.base.util.StringUtil;
+
+fileToString = "";
+if (parameters.fileName) {
+    file = new File(new URI(parameters.fileName));
+    fileToString = FileUtil.readString("UTF-8", file);
+    rows = StringUtil.split(fileToString, System.getProperty("line.separator"));
+}
+context.rows = rows;

Modified: ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/controller.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/controller.xml?rev=744842&r1=744841&r2=744842&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/controller.xml (original)
+++ ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/controller.xml Mon Feb 16 07:51:34 2009
@@ -489,7 +489,19 @@
         <response name="success" type="view" value="SearchLabels"/>
         <response name="error" type="view" value="UpdateLabel"/>
     </request-map>
-
+    
+    <request-map uri="ViewReferences">
+        <security https="true" auth="true"/>
+        <response name="success" type="view" value="ViewReferences"/>
+        <response name="error" type="view" value="ViewReferences"/>
+    </request-map>
+    
+    <request-map uri="ViewFile">
+        <security https="true" auth="true"/>
+        <response name="success" type="view" value="ViewFile"/>
+        <response name="error" type="view" value="ViewFile"/>
+    </request-map>
+    
     <!-- cert requests -->
     <request-map uri="myCertificates">
         <security https="true"/>
@@ -638,7 +650,9 @@
     <!-- Label Manager Views -->
     <view-map name="SearchLabels" type="screen" page="component://webtools/widget/LabelManagerScreens.xml#SearchLabels"/>
     <view-map name="UpdateLabel" type="screen" page="component://webtools/widget/LabelManagerScreens.xml#UpdateLabel"/>
-
+    <view-map name="ViewReferences" type="screen" page="component://webtools/widget/LabelManagerScreens.xml#ViewReferences"/>
+    <view-map name="ViewFile" type="screen" page="component://webtools/widget/LabelManagerScreens.xml#ViewFile"/>
+    
     <!-- Temporal expression views -->
     <view-map name="editTemporalExpression" type="screen" page="component://webtools/widget/TempExprScreens.xml#EditTemporalExpression"/>
     <view-map name="findTemporalExpression" type="screen" page="component://webtools/widget/TempExprScreens.xml#FindTemporalExpression"/>

Modified: ofbiz/trunk/framework/webtools/webapp/webtools/labelmanager/SearchLabels.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/webapp/webtools/labelmanager/SearchLabels.ftl?rev=744842&r1=744841&r2=744842&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/webapp/webtools/labelmanager/SearchLabels.ftl (original)
+++ ofbiz/trunk/framework/webtools/webapp/webtools/labelmanager/SearchLabels.ftl Mon Feb 16 07:51:34 2009
@@ -70,6 +70,15 @@
         </td>
       </tr>
       <tr>
+        <td colspan="2">&nbsp;</td>
+        <td align="right" class="label">
+          ${uiLabelMap.WebtoolsLabelManagerOnlyMissingTranslations}
+        </td>
+        <td align="left">
+          <input type="checkbox" name="onlyMissingTranslations" value="Y" <#if parameters.onlyMissingTranslations?exists && parameters.onlyMissingTranslations == "Y">checked</#if>>
+        </td>
+      </tr>
+      <tr>
         <td colspan="4" align="center">
           <#if (duplicatedLocalesLabels > 0)>
             <br/>

Added: ofbiz/trunk/framework/webtools/webapp/webtools/labelmanager/ViewFile.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/webapp/webtools/labelmanager/ViewFile.ftl?rev=744842&view=auto
==============================================================================
--- ofbiz/trunk/framework/webtools/webapp/webtools/labelmanager/ViewFile.ftl (added)
+++ ofbiz/trunk/framework/webtools/webapp/webtools/labelmanager/ViewFile.ftl Mon Feb 16 07:51:34 2009
@@ -0,0 +1,33 @@
+<#--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<div class="screenlet-body">
+    <table class="basic-table" cellspacing="3">
+        <tr>
+            <td colspan="2"><b>${uiLabelMap.WebtoolsLabelManagerFileName}</b> ${parameters.fileName?if_exists}</td>
+        </tr>
+        <tr>
+            <td colspan="2">&nbsp;</td>
+        </tr>
+        <#list rows as row>
+        <tr>
+            <td colspan="2">${row?if_exists}</td>
+        </tr>
+        </#list>
+    </table>
+</div>

Modified: ofbiz/trunk/framework/webtools/webapp/webtools/labelmanager/ViewHardcodedLabels.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/webapp/webtools/labelmanager/ViewHardcodedLabels.ftl?rev=744842&r1=744841&r2=744842&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/webapp/webtools/labelmanager/ViewHardcodedLabels.ftl (original)
+++ ofbiz/trunk/framework/webtools/webapp/webtools/labelmanager/ViewHardcodedLabels.ftl Mon Feb 16 07:51:34 2009
@@ -6,17 +6,23 @@
       <td>${uiLabelMap.WebtoolsLabelManagerKey}</td>
       <td>${uiLabelMap.WebtoolsLabelManagerReferences}</td>
     </tr>
-    <#assign rowNum = 1>
+    <#assign rowNumber = 1>
+    <#assign rowNum = "2">
     <#list referencesList as reference>
       <#assign labelFound = 'N'>
       <#assign refNum = Static["org.ofbiz.webtools.labelmanager.LabelManagerFactory"].getLabelReferenceFile(reference)>
       <#if (refNum > 0)>
-        <tr>
-          <td>${rowNum}</td>
+        <tr <#if rowNum == "1">class="alternate-row"</#if>>
+          <td>${rowNumber}</td>
           <td>${reference}</td>
-          <td>${refNum}</td>
+          <td align="center"><#if (refNum > 0)><a href="<@ofbizUrl>ViewReferences?sourceKey=${reference}</@ofbizUrl>">${refNum}</a><#else>${refNum}</#if></td>
         </tr>
-        <#assign rowNum = rowNum + 1>
+        <#assign rowNumber = rowNumber + 1>
+        <#if rowNum == "2">
+          <#assign rowNum = "1">
+        <#else>
+          <#assign rowNum = "2">
+        </#if>
       </#if>
     </#list>
   </table>

Modified: ofbiz/trunk/framework/webtools/webapp/webtools/labelmanager/ViewLabels.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/webapp/webtools/labelmanager/ViewLabels.ftl?rev=744842&r1=744841&r2=744842&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/webapp/webtools/labelmanager/ViewLabels.ftl (original)
+++ ofbiz/trunk/framework/webtools/webapp/webtools/labelmanager/ViewLabels.ftl Mon Feb 16 07:51:34 2009
@@ -23,6 +23,7 @@
   </#if>
   <table class="basic-table hover-bar" cellspacing="3">
     <tr class="header-row">
+      <td>${uiLabelMap.WebtoolsLabelManagerRow}</td>
       <td>${uiLabelMap.WebtoolsLabelManagerKey}</td>
       <td>${uiLabelMap.WebtoolsLabelManagerFileName}</td>
       <td>${uiLabelMap.WebtoolsLabelManagerReferences}</td>
@@ -50,11 +51,22 @@
     </tr>
     <#if parameters.searchLabels?exists>
       <#assign rowNum = "2">
+      <#assign rowNumber = 1>
       <#assign previousKey = "">
       <#list labelsList as labelList>
         <#assign label = labels.get(labelList)>
         <#assign showLabel = true>
-        <#if parameters.labelKey?exists && parameters.labelKey != "" && parameters.labelKey != label.labelKey>
+        <#if parameters.onlyMissingTranslations?exists && parameters.onlyMissingTranslations == "Y" &&
+             parameters.labelLocaleName?exists && parameters.labelLocaleName != "">
+          <#assign labelValue = label.getLabelValue(parameters.labelLocaleName)?if_exists>
+          <#if labelValue?exists && labelValue?has_content>
+            <#assign value = labelValue.getLabelValue()?if_exists>
+            <#if value?exists && value?has_content>
+              <#assign showLabel = false>
+            </#if>
+          </#if>
+        </#if>
+        <#if showLabel && parameters.labelKey?exists && parameters.labelKey != "" && parameters.labelKey != label.labelKey>
           <#assign showLabel = false>
         </#if>
         <#if showLabel && parameters.labelFileName?exists && parameters.labelFileName != "" && parameters.labelFileName != label.fileName>
@@ -66,6 +78,7 @@
         <#if showLabel == true>
           <#assign labelKey = label.labelKey>
           <tr <#if rowNum == "1">class="alternate-row"</#if>>
+            <td>${rowNumber}</td>
             <td><a href="<@ofbizUrl>UpdateLabel?sourceKey=${labelKey}&sourceFileName=${label.fileName}&sourceKeyComment=${label.labelKeyComment?if_exists}</@ofbizUrl>" <#if previousKey == labelKey>class="submenutext"</#if>>${label.labelKey}</a></td>
             <td>${label.fileName}</td>
             <#assign referenceNum = 0>
@@ -73,14 +86,14 @@
             <#if reference?exists && reference?has_content>
                  <#assign referenceNum = reference.size()>
             </#if>
-            <td align="center">${referenceNum}</td>
+            <td align="center"><#if (referenceNum > 0)><a href="<@ofbizUrl>ViewReferences?sourceKey=${labelKey}</@ofbizUrl>">${referenceNum}</a><#else>${referenceNum}</#if></td>
             <#list localesFound as localeFound>
               <#assign labelVal = label.getLabelValue(localeFound)?if_exists>
               <#assign showLocale = true>
               <#if parameters.labelLocaleName?exists && parameters.labelLocaleName != "" && parameters.labelLocaleName != localeFound>
                 <#assign showLocale = false>
               </#if>
-              <#if showLocale == true>
+              <#if showLocale>
                 <#if labelVal?has_content>
                   <td>${labelVal.getLabelValue()}</td>
                 <#else>
@@ -95,8 +108,9 @@
             <#assign rowNum = "2">
           </#if>
           <#assign previousKey = labelKey>
+          <#assign rowNumber = rowNumber + 1>
         </#if>
-      </#list>
+      </#list>
     </#if>
   </table>
 </div>

Added: ofbiz/trunk/framework/webtools/webapp/webtools/labelmanager/ViewReferences.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/webapp/webtools/labelmanager/ViewReferences.ftl?rev=744842&view=auto
==============================================================================
--- ofbiz/trunk/framework/webtools/webapp/webtools/labelmanager/ViewReferences.ftl (added)
+++ ofbiz/trunk/framework/webtools/webapp/webtools/labelmanager/ViewReferences.ftl Mon Feb 16 07:51:34 2009
@@ -0,0 +1,54 @@
+<#--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<div class="screenlet-body">
+    <form method="post" action="<@ofbizUrl></@ofbizUrl>" name="ViewReferencesForm">
+        <table class="basic-table" cellspacing="3">
+            <tr>
+                <td colspan="2"><b>${uiLabelMap.WebtoolsLabelManagerKey}</b> ${parameters.sourceKey?if_exists}</td>
+            </tr>
+            <tr>
+                <td colspan="2">&nbsp;</td>
+            </tr>
+            <tr class="header-row">
+                <td>${uiLabelMap.WebtoolsLabelManagerRow}</td>
+                <td>${uiLabelMap.WebtoolsLabelManagerFileName}</td>
+                <td>${uiLabelMap.WebtoolsLabelManagerReferences}</td>
+            </tr>
+            <#if parameters.sourceKey?exists>
+              <#assign rowNum = "2">
+              <#assign rowNumber = 1>
+              <#assign reference = references.get(parameters.sourceKey)>
+              <#assign entries = reference.entrySet()>
+              <#list entries as entry>
+                <tr>
+                    <td>${rowNumber}</td>
+                    <td><a href="<@ofbizUrl>ViewFile?fileName=${entry.getKey()}</@ofbizUrl>">${entry.getKey()}</a></td>
+                    <td>${entry.getValue()}</td>
+                </tr>
+                <#if rowNum == "2">
+                  <#assign rowNum = "1">
+                <#else>
+                  <#assign rowNum = "2">
+                </#if>
+                <#assign rowNumber = rowNumber + 1>
+              </#list>
+            </#if>
+        </table>
+    </form>
+</div>

Modified: ofbiz/trunk/framework/webtools/widget/LabelManagerScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/widget/LabelManagerScreens.xml?rev=744842&r1=744841&r2=744842&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/widget/LabelManagerScreens.xml (original)
+++ ofbiz/trunk/framework/webtools/widget/LabelManagerScreens.xml Mon Feb 16 07:51:34 2009
@@ -72,4 +72,50 @@
             </fail-widgets>
         </section>
     </screen>
+    <screen name="ViewReferences">
+        <section>
+            <condition>
+                <if-has-permission permission="LABEL_MANAGER_VIEW"/>
+            </condition>
+            <actions>
+                <set field="titleProperty" value="WebtoolsLabelManagerViewReferences"/>
+                <script location="component://webtools/webapp/webtools/WEB-INF/actions/labelmanager/LabelManager.groovy"/>
+            </actions>
+            <widgets>
+                <decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}">
+                    <decorator-section name="body">
+                        <screenlet id="ViewReferencesPanel" title="${uiLabelMap.WebtoolsLabelManagerViewReferences}">
+                            <platform-specific><html><html-template location="component://webtools/webapp/webtools/labelmanager/ViewReferences.ftl"/></html></platform-specific>
+                        </screenlet>
+                    </decorator-section>
+                </decorator-screen>
+            </widgets>
+            <fail-widgets>
+                <label style="h3">${uiLabelMap.WebtoolsLabelManagerSecuryError}</label>
+            </fail-widgets>
+        </section>
+    </screen>
+    <screen name="ViewFile">
+        <section>
+            <condition>
+                <if-has-permission permission="LABEL_MANAGER_VIEW"/>
+            </condition>
+            <actions>
+                <set field="titleProperty" value="WebtoolsLabelManagerViewFile"/>
+                <script location="component://webtools/webapp/webtools/WEB-INF/actions/labelmanager/ViewFile.groovy"/>
+            </actions>
+            <widgets>
+                <decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}">
+                    <decorator-section name="body">
+                        <screenlet id="ViewFilePanel" title="${uiLabelMap.WebtoolsLabelManagerViewFile}">
+                            <platform-specific><html><html-template location="component://webtools/webapp/webtools/labelmanager/ViewFile.ftl"/></html></platform-specific>
+                        </screenlet>
+                    </decorator-section>
+                </decorator-screen>
+            </widgets>
+            <fail-widgets>
+                <label style="h3">${uiLabelMap.WebtoolsLabelManagerSecuryError}</label>
+            </fail-widgets>
+        </section>
+    </screen>
 </screens>