You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2009/02/15 09:42:07 UTC
svn commit: r744635 - in /ofbiz/trunk/framework:
base/src/org/ofbiz/base/util/ webtools/config/ webtools/servicedef/
webtools/src/org/ofbiz/webtools/labelmanager/
webtools/webapp/webtools/WEB-INF/actions/labelmanager/
webtools/webapp/webtools/labelmana...
Author: jleroux
Date: Sun Feb 15 08:42:06 2009
New Revision: 744635
URL: http://svn.apache.org/viewvc?rev=744635&view=rev
Log:
Marco's LabelReferences2.patch from "New tool to get labels information" https://issues.apache.org/jira/browse/OFBIZ-2070 - OFBIZ-2070
Added:
ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/labelmanager/LabelReferences.java
ofbiz/trunk/framework/webtools/webapp/webtools/labelmanager/ViewHardcodedLabels.ftl
Modified:
ofbiz/trunk/framework/base/src/org/ofbiz/base/util/FileUtil.java
ofbiz/trunk/framework/webtools/config/WebtoolsUiLabels.xml
ofbiz/trunk/framework/webtools/servicedef/services.xml
ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/labelmanager/LabelManagerFactory.java
ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/labelmanager/LabelManager.groovy
ofbiz/trunk/framework/webtools/webapp/webtools/labelmanager/ViewLabels.ftl
ofbiz/trunk/framework/webtools/widget/LabelManagerScreens.xml
Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/FileUtil.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/FileUtil.java?rev=744635&r1=744634&r2=744635&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/FileUtil.java (original)
+++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/FileUtil.java Sun Feb 15 08:42:06 2009
@@ -33,11 +33,11 @@
import java.util.List;
import java.util.Set;
-import org.apache.commons.io.FileUtils;
-
import javolution.util.FastList;
import javolution.util.FastSet;
+import org.apache.commons.io.FileUtils;
+
/**
* File Utilities
*
@@ -215,6 +215,28 @@
}
}
}
+
+ public static List<File> findFiles(String fileExt, String basePath, String partialPath, String stringToFind) throws IOException {
+ if (basePath == null) {
+ basePath = System.getProperty("ofbiz.home");
+ }
+
+ Set<String> stringsToFindInPath = FastSet.newInstance();
+ Set<String> stringsToFindInFile = FastSet.newInstance();
+
+ if (partialPath != null) {
+ stringsToFindInPath.add(partialPath);
+ }
+ if (stringToFind != null) {
+ stringsToFindInFile.add(stringToFind);
+ }
+
+ List<File> fileList = FastList.newInstance();
+ FileUtil.searchFiles(fileList, new File(basePath), new SearchTextFilesFilter(fileExt, stringsToFindInPath, stringsToFindInFile), true);
+
+ return fileList;
+ }
+
public static List<File> findXmlFiles(String basePath, String partialPath, String rootElementName, String xsdOrDtdName) throws IOException {
if (basePath == null) {
basePath = System.getProperty("ofbiz.home");
Modified: ofbiz/trunk/framework/webtools/config/WebtoolsUiLabels.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/config/WebtoolsUiLabels.xml?rev=744635&r1=744634&r2=744635&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/config/WebtoolsUiLabels.xml (original)
+++ ofbiz/trunk/framework/webtools/config/WebtoolsUiLabels.xml Sun Feb 15 08:42:06 2009
@@ -564,16 +564,13 @@
<value xml:lang="pt_BR">Parte da famÃlia OfBiz de software de fonte aberta</value>
<!--value xml:lang="pt_PT">Parte do Software de Fonte Aberta para Grupos Abertos Para o Negócio</value-->
<value xml:lang="pt_PT">Parte da famÃlia OfBiz de software de fonte aberta</value>
- <!--value xml:lang="ro">Parte accesibila pentru Business Family of Open Source Software</value-->
- <!--value xml:lang="ro">Parte din Open for Business Family of Open Source Software</value-->
+ <!--value xml:lang="ro">Parte accesibila pentru Business Family of Open Source Software</valuevalue xml:lang="ro">Parte din Open for Business Family of Open Source Software</value-->
<value xml:lang="ro">Partea de Deschidere Pentru Afaceri Familiale din Open Source Software</value>
- <!--value xml:lang="ru">ЧаÑÑÑ ÑемейÑÑва ÐÐ Open For Business</value-->
- <!--value xml:lang="ru">ЧаÑÑÑ ÑемейÑÑва "Open For Business Family" пÑогÑаммнÑÑ
пÑодÑкÑов Open Source </value-->
+ <!--value xml:lang="ru">ЧаÑÑÑ ÑемейÑÑва ÐÐ Open For Business</valuevalue xml:lang="ru">ЧаÑÑÑ ÑемейÑÑва "Open For Business Family" пÑогÑаммнÑÑ
пÑодÑкÑов Open Source </value-->
<value xml:lang="ru">ÐÑ
Ð¾Ð´Ð¸Ñ Ð² ÑоÑÑав ÑемейÑÑва Open For Business</value>
<!--value xml:lang="th">à¹à¸à¹à¸à¸ªà¹à¸§à¸à¸«à¸à¸¶à¹à¸à¸à¸à¸à¸à¸¸à¸£à¸à¸´à¸à¹à¸à¸à¸à¸£à¸à¸à¸à¸£à¸±à¸§à¸à¸µà¹à¹à¸à¹à¸à¸à¸à¸à¸à¹à¹à¸§à¸£à¹à¹à¸à¹à¸à¸à¸à¸à¸ª</value-->
<value xml:lang="th">สà¹à¸§à¸à¸«à¸à¸¶à¹à¸à¸à¸à¸à¸à¸¸à¸£à¸à¸´à¸à¹à¸à¸à¸à¸£à¸à¸à¸à¸£à¸±à¸§à¸à¸µà¹à¹à¸à¹à¸à¸à¸à¸à¸à¹à¹à¸§à¸£à¹à¹à¸à¹à¸à¸à¸à¸à¸ª</value>
- <!--value xml:lang="zh">å¼æºè½¯ä»¶OFBizçç»æé¨å</value-->
- <!--value xml:lang="zh">å¼æºè½¯ä»¶OFBizçç»æé¨å</value-->
+ <!--value xml:lang="zh">å¼æºè½¯ä»¶OFBizçç»æé¨å</valuevalue xml:lang="zh">å¼æºè½¯ä»¶OFBizçç»æé¨å</value-->
<value xml:lang="zh">å¼æºè½¯ä»¶OFBiz家æçä¸é¨å</value>
<value xml:lang="zh_CN">OFBizçä¸é¨å</value>
</property>
@@ -1471,6 +1468,10 @@
<value xml:lang="fr">Nom de fichier</value>
<value xml:lang="it">Nome File</value>
</property>
+ <property key="WebtoolsLabelManagerHardcoded">
+ <value xml:lang="en">Hardcoded labels</value>
+ <value xml:lang="it">Label non traducibili</value>
+ </property>
<property key="WebtoolsLabelManagerKey">
<value xml:lang="en">Key</value>
<value xml:lang="fr">Clef</value>
@@ -1501,11 +1502,19 @@
<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="WebtoolsLabelManagerReferences">
+ <value xml:lang="en">References</value>
+ <value xml:lang="it">Referenze</value>
+ </property>
<property key="WebtoolsLabelManagerRemove">
<value xml:lang="en">Remove Label</value>
<value xml:lang="fr">Supprimer la traduction</value>
<value xml:lang="it">Rimuovi label</value>
</property>
+ <property key="WebtoolsLabelManagerRow">
+ <value xml:lang="en">Row n.</value>
+ <value xml:lang="it">N.riga</value>
+ </property>
<property key="WebtoolsLabelManagerSearchBy">
<value xml:lang="en">Filter Labels Info By</value>
<value xml:lang="fr">Filtrer les traductions</value>
@@ -1672,6 +1681,14 @@
<value xml:lang="th">หà¸à¹à¸§à¸¢à¸à¸§à¸²à¸¡à¸à¸³</value>
<value xml:lang="zh">å
å</value>
</property>
+ <property key="WebtoolsMessage1">
+ <value xml:lang="en">This page can be used to export data from the database </value>
+ <value xml:lang="fr">Cette page peut être utilisée pour exporter des données depuis la base</value>
+ <value xml:lang="it">Questa pagine può essere usata per esportare i dati dal database</value>
+ <value xml:lang="ro">Aceasta pagina poate fi folosita pentru exportarea datelor din database</value>
+ <value xml:lang="th">หà¸à¹à¸²à¸à¸µà¹à¹à¸à¹à¸à¸²à¸£à¸ªà¹à¸à¸à¸à¸à¸à¹à¸à¸¡à¸¹à¸¥à¸à¸²à¸à¸à¸²à¸à¸à¹à¸à¸¡à¸¹à¸¥</value>
+ <value xml:lang="zh">æ¬é¡µé¢ç¨äºä»æ°æ®åºå¯¼åºæ°æ® </value>
+ </property>
<property key="WebtoolsMessage10">
<value xml:lang="en">number of time the job will retry on error; use -1 for no limit or leave empty for service default</value>
<value xml:lang="fr">Nombre de fois où le job sera relancé en cas d'erreur; utilisez -1 pour ne définir aucune limite ou laissez vide pour utilisez la valeur par défaut du service</value>
@@ -1750,13 +1767,13 @@
<value xml:lang="it">Scritti XML per tutti i dati in</value>
<value xml:lang="th">à¹à¸à¸µà¸¢à¸ XML สำหรัà¸à¸à¹à¸à¸¡à¸¹à¸¥à¸à¸±à¹à¸à¸«à¸¡à¸à¹à¸</value>
</property>
- <property key="WebtoolsMessage1">
- <value xml:lang="en">This page can be used to export data from the database </value>
- <value xml:lang="fr">Cette page peut être utilisée pour exporter des données depuis la base</value>
- <value xml:lang="it">Questa pagine può essere usata per esportare i dati dal database</value>
- <value xml:lang="ro">Aceasta pagina poate fi folosita pentru exportarea datelor din database</value>
- <value xml:lang="th">หà¸à¹à¸²à¸à¸µà¹à¹à¸à¹à¸à¸²à¸£à¸ªà¹à¸à¸à¸à¸à¸à¹à¸à¸¡à¸¹à¸¥à¸à¸²à¸à¸à¸²à¸à¸à¹à¸à¸¡à¸¹à¸¥</value>
- <value xml:lang="zh">æ¬é¡µé¢ç¨äºä»æ°æ®åºå¯¼åºæ°æ® </value>
+ <property key="WebtoolsMessage2">
+ <value xml:lang="en">The exported documents will have a root tag of "<entity-engine-xml>"</value>
+ <value xml:lang="fr">Les documents exportés auront une balise de racine de "<entity-engine-xml>"</value>
+ <value xml:lang="it">I documenti esportati avranno un root tag "<entity-engine-xml>"</value>
+ <value xml:lang="ro">Documentele exportate vor avea un root tag "<entity-engine-xml>"</value>
+ <value xml:lang="th">à¸à¸²à¸£à¸ªà¹à¸à¹à¸à¸à¸ªà¸²à¸£à¸à¸°à¸à¹à¸à¸à¹à¸à¹à¸£à¸¹à¸à¹à¸à¹à¸à¸à¸à¸ "<entity-engine-xml>"</value>
+ <value xml:lang="zh">导åºçææ¡£ä¼æä¸ä¸ª"<entity-engine-xml>"çæ ¹æ ç¾</value>
</property>
<property key="WebtoolsMessage20">
<value xml:lang="en">Wrote</value>
@@ -1819,13 +1836,13 @@
<value xml:lang="it">NOTA: Questi risultati delle prestazioni potrebbero variare in base ai differenti database,</value>
<value xml:lang="th">หมายà¹à¸«à¸à¸¸:à¸à¸²à¸£à¸à¸£à¸°à¸à¸³à¹à¸«à¸¥à¹à¸²à¸à¸µà¹à¸à¸²à¸à¸à¸°à¹à¸à¹à¸à¸à¸¥à¹à¸«à¹à¹à¸à¸´à¸à¸à¸²à¸£à¸à¸·à¹à¸à¸à¸²à¸¢à¸à¸µà¹à¸à¸µà¸ªà¸³à¸«à¸£à¸±à¸à¸à¸§à¸²à¸¡à¹à¸à¸à¸à¹à¸²à¸</value>
</property>
- <property key="WebtoolsMessage2">
- <value xml:lang="en">The exported documents will have a root tag of "<entity-engine-xml>"</value>
- <value xml:lang="fr">Les documents exportés auront une balise de racine de "<entity-engine-xml>"</value>
- <value xml:lang="it">I documenti esportati avranno un root tag "<entity-engine-xml>"</value>
- <value xml:lang="ro">Documentele exportate vor avea un root tag "<entity-engine-xml>"</value>
- <value xml:lang="th">à¸à¸²à¸£à¸ªà¹à¸à¹à¸à¸à¸ªà¸²à¸£à¸à¸°à¸à¹à¸à¸à¹à¸à¹à¸£à¸¹à¸à¹à¸à¹à¸à¸à¸à¸ "<entity-engine-xml>"</value>
- <value xml:lang="zh">导åºçææ¡£ä¼æä¸ä¸ª"<entity-engine-xml>"çæ ¹æ ç¾</value>
+ <property key="WebtoolsMessage3">
+ <value xml:lang="en">There will be one file for each Entity in the configured delegator for this webapp</value>
+ <value xml:lang="fr">Il y aura un dossier pour chaque entité dans le delegator configuré pour cette webapp</value>
+ <value xml:lang="it">C'è un file per ogni Entità nel delegator configurato per questa applicazione web</value>
+ <value xml:lang="ro">Exista un file pentru orice Entitate din delegatorul configurat pentru aceasta aplicatie web.</value>
+ <value xml:lang="th">มี 1 à¹à¸à¸¥à¹à¸ªà¸³à¸«à¸£à¸±à¸à¸à¸±à¸§à¸à¸¢à¹à¸²à¸ Entity à¹à¸à¸à¸²à¸£à¸ªà¸£à¹à¸²à¸à¸à¸±à¸§à¹à¸à¸à¸ªà¸³à¸«à¸£à¸±à¸à¹à¸à¸£à¹à¸à¸£à¸¡à¸à¸£à¸°à¸¢à¸¸à¸à¸à¹à¸à¸µà¹</value>
+ <value xml:lang="zh">å¨ä¸ºè¿ä¸ªåºç¨é
ç½®ç代表ä¸ï¼ä¼å¯¹æ¯ä¸ªå®ä½æä¸ä¸ªæ件ã</value>
</property>
<property key="WebtoolsMessage30">
<value xml:lang="en">databases, JDBC drivers, JTA implementations (transaction managers), connection pools, </value>
@@ -1847,14 +1864,6 @@
<value xml:lang="it">server hardware, connessioni di rete).</value>
<value xml:lang="th">server ฮารà¹à¸à¹à¸§à¸£à¹,à¹à¸à¸·à¹à¸à¸¡à¹à¸¢à¸à¹à¸à¸£à¸·à¸à¸à¹à¸²à¸¢).</value>
</property>
- <property key="WebtoolsMessage3">
- <value xml:lang="en">There will be one file for each Entity in the configured delegator for this webapp</value>
- <value xml:lang="fr">Il y aura un dossier pour chaque entité dans le delegator configuré pour cette webapp</value>
- <value xml:lang="it">C'è un file per ogni Entità nel delegator configurato per questa applicazione web</value>
- <value xml:lang="ro">Exista un file pentru orice Entitate din delegatorul configurat pentru aceasta aplicatie web.</value>
- <value xml:lang="th">มี 1 à¹à¸à¸¥à¹à¸ªà¸³à¸«à¸£à¸±à¸à¸à¸±à¸§à¸à¸¢à¹à¸²à¸ Entity à¹à¸à¸à¸²à¸£à¸ªà¸£à¹à¸²à¸à¸à¸±à¸§à¹à¸à¸à¸ªà¸³à¸«à¸£à¸±à¸à¹à¸à¸£à¹à¸à¸£à¸¡à¸à¸£à¸°à¸¢à¸¸à¸à¸à¹à¸à¸µà¹</value>
- <value xml:lang="zh">å¨ä¸ºè¿ä¸ªåºç¨é
ç½®ç代表ä¸ï¼ä¼å¯¹æ¯ä¸ªå®ä½æä¸ä¸ªæ件ã</value>
- </property>
<property key="WebtoolsMessage4">
<value xml:lang="en">Complete XML document (root tag: entity-engine-xml)</value>
<value xml:lang="fr">Compléter le document XML (balise racine : entity-engine-xml)(</value>
@@ -2299,6 +2308,12 @@
<value xml:lang="th">Pop up หà¸à¹à¸²à¸«à¸¥à¸±à¸à¹à¸à¸£à¸·à¹à¸à¸à¸¡à¸·à¸à¸à¸±à¸à¸à¸²à¹à¸§à¹à¸</value>
<value xml:lang="zh">å¼¹åºWebå·¥å
·é¦é¡µ</value>
</property>
+ <property key="WebtoolsPreConfiguredSet">
+ <value xml:lang="en">Pre-configured set</value>
+ <value xml:lang="fr">Ensemble pré-configuré</value>
+ <value xml:lang="it">Impostazioni Pre-configurate</value>
+ <value xml:lang="th">à¸à¸±à¹à¸à¸à¹à¸²à¸à¹à¸à¸à¸à¸²à¸£à¸ªà¸£à¹à¸²à¸</value>
+ </property>
<property key="WebtoolsPreConfiguredSet1">
<value xml:lang="en">Catalog Export</value>
<value xml:lang="fr">Exporter le catalogue</value>
@@ -2329,12 +2344,6 @@
<value xml:lang="it">Prodotti Parte 4</value>
<value xml:lang="th">สิà¸à¸à¹à¸²à¸ªà¹à¸§à¸à¸à¸µà¹ 4</value>
</property>
- <property key="WebtoolsPreConfiguredSet">
- <value xml:lang="en">Pre-configured set</value>
- <value xml:lang="fr">Ensemble pré-configuré</value>
- <value xml:lang="it">Impostazioni Pre-configurate</value>
- <value xml:lang="th">à¸à¸±à¹à¸à¸à¹à¸²à¸à¹à¸à¸à¸à¸²à¸£à¸ªà¸£à¹à¸²à¸</value>
- </property>
<property key="WebtoolsPriority">
<value xml:lang="de">Dringlichkeit</value>
<value xml:lang="en">Priority</value>
@@ -3069,6 +3078,14 @@
<value xml:lang="th">à¸à¸²à¸£à¹à¸¥à¸·à¸à¸à¸£à¸°à¸à¸±à¸à¹à¸à¸à¸²à¸£à¸à¸³à¸«à¸à¸à¹à¸§à¸¥à¸²à¸à¸µà¹à¹à¸«à¸¡à¸²à¸°à¸ªà¸¡à¸à¸µà¹à¸ªà¸¸à¸à¹à¸à¸¢à¸à¹à¸à¸¡à¸¹à¸¥à¸à¸³à¸à¸§à¸à¸¡à¸²à¸à¸à¸¥à¸¥à¸±à¸à¸à¹à¸à¸µà¹à¹à¸à¹à¸à¸°à¹à¸à¹à¹à¸à¹à¹à¸à¸à¹à¸à¸à¸´à¸à¸à¸¥à¸²à¸à¸à¸à¸à¹à¸à¸à¸à¸¥à¸´à¹à¸à¸à¸±à¹à¸</value>
<value xml:lang="zh">Timingï¼å®æ¶ï¼çº§å«ä¼ç»é¢ç²å°æåºåºç¨ç¨åºè¿è¡æ
åµçä¿¡æ¯ï¼éäºè°è¯ç¨åºã</value>
</property>
+ <property key="WebtoolsTitle">
+ <value xml:lang="en">Title</value>
+ <value xml:lang="fr">Titre</value>
+ <value xml:lang="it">Titolo</value>
+ <value xml:lang="ro">Titlu</value>
+ <value xml:lang="th">หัวà¹à¸£à¸·à¹à¸à¸</value>
+ <value xml:lang="zh">æ é¢</value>
+ </property>
<property key="WebtoolsTitle1">
<value xml:lang="en">The purpose of this Web Tools administration package is to contain all of the</value>
<value xml:lang="fr">Le but de cet d'ensemble d'outils Web d'administration est de contenir tout les outils</value>
@@ -3117,14 +3134,6 @@
<value xml:lang="th">à¸à¸§à¸²à¸¡à¸à¸¶à¸à¸à¸à¹à¸à¹à¸¥à¸°à¸à¸§à¸²à¸¡à¸£à¸¹à¹à¸à¸§à¸²à¸¡à¸ªà¸²à¸¡à¸²à¸£à¸à¹à¸à¸à¸²à¸£à¸à¸±à¸à¸à¸²à¸£ วิà¹à¸à¸£à¸²à¸°à¸«à¹à¸à¹à¸à¸¡à¸¹à¸¥ à¸à¸±à¸à¸à¸²à¹à¸à¸à¹à¸²à¸à¸«à¸à¹à¸²à¸à¸¢à¹à¸²à¸à¹à¸à¹à¸¡à¸à¸µà¹</value>
<value xml:lang="zh">å
容åç¥è¯ç®¡çãæ°æ®åæçã</value>
</property>
- <property key="WebtoolsTitle">
- <value xml:lang="en">Title</value>
- <value xml:lang="fr">Titre</value>
- <value xml:lang="it">Titolo</value>
- <value xml:lang="ro">Titlu</value>
- <value xml:lang="th">หัวà¹à¸£à¸·à¹à¸à¸</value>
- <value xml:lang="zh">æ é¢</value>
- </property>
<property key="WebtoolsToFindAll">
<value xml:lang="en">To find ALL of Entity</value>
<value xml:lang="fr">Pour trouver TOUT sur l'entité </value>
Modified: ofbiz/trunk/framework/webtools/servicedef/services.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/servicedef/services.xml?rev=744635&r1=744634&r2=744635&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/servicedef/services.xml (original)
+++ ofbiz/trunk/framework/webtools/servicedef/services.xml Sun Feb 15 08:42:06 2009
@@ -43,8 +43,8 @@
location="org.ofbiz.webtools.WebToolsServices" invoke="entityImport" auth="true" use-transaction="false">
<description>Imports an entity xml file or text string</description>
<permission-service service-name="entityMaintPermCheck" main-action="VIEW"/>
- <attribute name="filename" type="String" mode="IN" optional="true"/>
- <attribute name="fmfilename" type="String" mode="IN" optional="true"/>
+ <attribute name="filename" type="String" mode="IN" optional="true" allow-html="any"/>
+ <attribute name="fmfilename" type="String" mode="IN" optional="true" allow-html="any"/>
<attribute name="fulltext" type="String" mode="IN" optional="true" allow-html="any"/>
<attribute name="isUrl" type="String" mode="IN" optional="true"/>
<attribute name="mostlyInserts" type="String" mode="IN" optional="true"/>
Modified: ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/labelmanager/LabelManagerFactory.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/labelmanager/LabelManagerFactory.java?rev=744635&r1=744634&r2=744635&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/labelmanager/LabelManagerFactory.java (original)
+++ ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/labelmanager/LabelManagerFactory.java Sun Feb 15 08:42:06 2009
@@ -6,9 +6,9 @@
* 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
@@ -35,13 +35,12 @@
import org.ofbiz.base.util.UtilGenerics;
import org.ofbiz.base.util.UtilMisc;
import org.ofbiz.base.util.UtilProperties;
-import org.ofbiz.base.util.UtilXml;
-
import org.ofbiz.base.util.UtilValidate;
+import org.ofbiz.base.util.UtilXml;
import org.ofbiz.base.util.cache.UtilCache;
+import org.ofbiz.entity.model.ModelReader;
import org.ofbiz.service.DispatchContext;
import org.ofbiz.service.ServiceUtil;
-
import org.w3c.dom.Comment;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -51,25 +50,28 @@
public static final String module = LabelManagerFactory.class.getName();
public static final String resource = "WebtoolsUiLabels";
-
- public static final String keySeparator = ";";
-
+
+ public static final String keySeparator = "#";
+
protected static UtilCache<String, LabelManagerFactory> labelManagerFactoryCache = new UtilCache<String, LabelManagerFactory>("LabelManagerFactory");
-
+
protected static Map<String, LabelInfo> labels = null;
protected static Map<String, String> fileNamesFound = null;
protected static Map<String, String> fileComponent = null;
protected static Set<String> localesFound = null;
protected static Set<String> componentNamesFound = null;
+ protected static Map<String, Map<String, Integer>> references = null;
protected static int duplicatedLocalesLabels = 0;
-
+
protected static String delegatorName;
-
+ protected static ModelReader entityModelReader;
+ protected static DispatchContext dispatchContext;
+
public static LabelManagerFactory getLabelManagerFactory(String delegatorName) throws GeneralException {
if (UtilValidate.isEmpty(delegatorName)) {
delegatorName = "default";
}
-
+
LabelManagerFactory lmf = labelManagerFactoryCache.get(delegatorName);
if (lmf == null) {
@@ -78,47 +80,50 @@
}
return lmf;
}
-
+
protected LabelManagerFactory(String delegatorName) throws GeneralException {
LabelManagerFactory.delegatorName = delegatorName;
-
+ LabelManagerFactory.entityModelReader = ModelReader.getModelReader(delegatorName);
+ LabelManagerFactory.dispatchContext = new DispatchContext("LabelManagerDispCtx", null, this.getClass().getClassLoader(), null);
+
prepareAll();
}
-
+
private static void prepareAll() throws GeneralException {
labels = new TreeMap<String, LabelInfo>();
fileNamesFound = new TreeMap<String, String>();
fileComponent = new TreeMap<String, String>();
localesFound = new TreeSet<String>();
componentNamesFound = new TreeSet<String>();
+ references = null;
int duplicatedLocales = 0;
-
+
try {
Collection<ComponentConfig> componentConfigs = ComponentConfig.getAllComponents();
-
+
for (ComponentConfig componentConfig: componentConfigs) {
String componentName = componentConfig.getComponentName();
List<File> resourceFiles = FileUtil.findXmlFiles(componentConfig.getRootLocation(), null, "resource", null);
-
+
for (File resourceFile: resourceFiles) {
String fileName = resourceFile.getName();
Document resourceDocument = UtilXml.readXmlDocument(resourceFile.toURI().toURL());
Element resourceElem = resourceDocument.getDocumentElement();
String labelKeyComment = "";
-
- for (Node propertyNode: UtilXml.childNodeList(resourceElem.getFirstChild())) {
+
+ for (Node propertyNode: UtilXml.childNodeList(resourceElem.getFirstChild())) {
if (propertyNode instanceof Element) {
Element propertyElem = (Element)propertyNode;
String labelKey = StringUtil.htmlSpecialChars(propertyElem.getAttribute("key"), true, true, false);
String labelComment = "";
-
+
for (Node valueNode: UtilXml.childNodeList(propertyElem.getFirstChild())) {
if (valueNode instanceof Element) {
Element valueElem = (Element)valueNode;
String localeName = valueElem.getAttribute("xml:lang");
String labelValue = StringUtil.htmlSpecialChars(UtilXml.nodeValue(valueElem.getFirstChild()), true, true, false);
LabelInfo label = (LabelInfo)labels.get(labelKey + keySeparator + fileName);
-
+
if (UtilValidate.isEmpty(label)) {
label = new LabelInfo(labelKey, labelKeyComment, fileName, componentName, localeName, labelValue, labelComment);
labels.put(labelKey + keySeparator + fileName, label);
@@ -130,12 +135,12 @@
localesFound.add(localeName);
componentNamesFound.add(componentName);
fileNamesFound.put(fileName, resourceFile.toURI().toString());
- fileComponent.put(fileName, componentName);
- labelComment = "";
+ fileComponent.put(fileName, componentName);
+ labelComment = "";
} else if (valueNode instanceof Comment) {
labelComment = labelComment + StringUtil.htmlSpecialChars(valueNode.getNodeValue(), true, true, false);
}
- }
+ }
labelKeyComment = "";
} else if (propertyNode instanceof Comment) {
labelKeyComment = labelKeyComment + StringUtil.htmlSpecialChars(propertyNode.getNodeValue(), true, true, false);
@@ -143,6 +148,9 @@
}
}
}
+
+ // get labels references from sources
+ references = LabelReferences.getLabelReferences();
} catch(IOException ioe) {
throw new GeneralException(ioe.getMessage());
} catch(Exception e) {
@@ -150,19 +158,19 @@
}
duplicatedLocalesLabels = duplicatedLocales;
}
-
+
public static Map<String, LabelInfo> getLabels() {
return labels;
}
-
+
public static Set<String> getLocalesFound() {
return localesFound;
}
-
+
public static Map<String, String> getFileNamesFound() {
return fileNamesFound;
}
-
+
public static String getFileComponent(String fileName) {
String componentName = null;
if (UtilValidate.isNotEmpty(fileName)) {
@@ -170,19 +178,51 @@
}
return componentName;
}
-
+
public static Set<String> getComponentNamesFound() {
return componentNamesFound;
}
+
+ public static Map<String, Map<String, Integer>> getReferences() {
+ return references;
+ }
public static Set<String> getLabelsList() {
return labels.keySet();
}
+ public static Set<String> getReferencesList() {
+ return references.keySet();
+ }
+
+ public static int getLabelReferenceFile(String key) {
+ int refFile = 0;
+ boolean keyFound = false;
+
+ for (Map.Entry<String, String> e: fileNamesFound.entrySet()) {
+ String keyToSearch = key + keySeparator + e.getKey();
+
+ if (labels.containsKey(keyToSearch)) {
+ keyFound = true;
+ break;
+ }
+ }
+
+ if (!keyFound) {
+ Map<String, Integer> reference = references.get(key);
+
+ if (UtilValidate.isNotEmpty(reference)) {
+ refFile = reference.size();
+ }
+ }
+
+ return refFile;
+ }
+
public static int getDuplicatedLocalesLabels() {
return duplicatedLocalesLabels;
}
-
+
public static Map<String, Object> updateLabelKey(DispatchContext dctx, Map<String, ? extends Object> context) {
String key = (String)context.get("key");
String keyComment = (String)context.get("keyComment");
@@ -194,13 +234,13 @@
List<String> localeValues = UtilGenerics.cast(context.get("localeValues"));
List<String> localeComments = UtilGenerics.cast(context.get("localeComments"));
Locale locale = (Locale) context.get("locale");
-
+
// Remove a Label
if (UtilValidate.isNotEmpty(removeLabel)) {
labels.remove(key + keySeparator + fileName);
} else if (UtilValidate.isNotEmpty(confirm)) {
LabelInfo label = labels.get(key + keySeparator + fileName);
-
+
// Update a Label
if (update_label.equalsIgnoreCase("Y")) {
if (UtilValidate.isNotEmpty(label)) {
@@ -220,12 +260,12 @@
}
}
}
- }
+ }
}
-
+
return ServiceUtil.returnSuccess();
}
-
+
private static int updateLabelValue(List<String> localeNames, List<String> localeValues, List<String> localeComments, LabelInfo label, String key, String keyComment, String fileName) {
int notEmptyLabels = 0;
int i = 0;
@@ -233,7 +273,7 @@
String localeName = (String)localeNames.get(i);
String localeValue = (String)localeValues.get(i);
String localeComment = (String)localeComments.get(i);
-
+
if (UtilValidate.isNotEmpty(localeValue) || UtilValidate.isNotEmpty(localeComment)) {
if (label == null) {
try {
@@ -251,7 +291,7 @@
}
i++;
}
-
+
return notEmptyLabels;
}
}
Added: ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/labelmanager/LabelReferences.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/labelmanager/LabelReferences.java?rev=744635&view=auto
==============================================================================
--- ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/labelmanager/LabelReferences.java (added)
+++ ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/labelmanager/LabelReferences.java Sun Feb 15 08:42:06 2009
@@ -0,0 +1,635 @@
+/*
+ * 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.
+ */
+package org.ofbiz.webtools.labelmanager;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.TreeMap;
+
+import org.ofbiz.base.util.Debug;
+import org.ofbiz.base.util.FileUtil;
+import org.ofbiz.base.util.GeneralException;
+import org.ofbiz.base.util.UtilFormatOut;
+import org.ofbiz.base.util.UtilValidate;
+import org.ofbiz.base.util.UtilXml;
+import org.ofbiz.entity.GenericEntityException;
+import org.ofbiz.entity.model.ModelEntity;
+import org.ofbiz.entity.model.ModelField;
+import org.ofbiz.service.ModelParam;
+import org.ofbiz.service.ModelService;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+public class LabelReferences {
+
+ public static final String module = LabelReferences.class.getName();
+ private static final String uiLabelMap = "${uiLabelMap.";
+ private static final String uiLabelMapInLayoutSettings = "uiLabelMap.";
+ private static final String formFieldTitle = "FormFieldTitle_";
+ private static final String getMessage = "UtilProperties.getMessage";
+ private static Map<String, Map<String, Integer>> references = null;
+
+ public static Map<String, Map<String, Integer>> getLabelReferences() throws GeneralException {
+ references = new TreeMap<String, Map<String, Integer>>();
+
+ // get labels from FTL files
+ getLabelsFromFtlFiles();
+
+ // get labels from java files
+ getLabelsFromJavaFiles();
+
+ // get labels from simple method files
+ getLabelsFromSimpleMethodFiles();
+
+ // get labels from form widgets files
+ getLabelsFromFormWidgets();
+
+ // get labels from screen widgets files
+ getLabelsFromScreenWidgets();
+
+ // get labels from menu widgets files
+ getLabelsFromMenuWidgets();
+
+ return references;
+ }
+
+ private static void getLabelsFromFtlFiles() throws GeneralException {
+ try {
+ List<File> ftlFiles = FileUtil.findFiles("ftl", null, null, uiLabelMap);
+
+ for (File ftlFile: ftlFiles) {
+ String fileNameURI = ftlFile.toURI().toString();
+ String inFile = FileUtil.readString("UTF-8", ftlFile);
+ int pos = 0;
+ while (pos >= 0){
+ pos = inFile.indexOf(uiLabelMap, pos);
+
+ if (pos >= 0) {
+ int endLabel = inFile.indexOf("}", pos);
+
+ if (endLabel >= 0) {
+ String labelKey = inFile.substring(pos + uiLabelMap.length(), endLabel);
+ setLabelReference(labelKey, fileNameURI);
+ pos = endLabel;
+ } else {
+ pos = pos + uiLabelMap.length();
+ }
+ }
+ }
+ }
+ } catch(IOException ioe) {
+ throw new GeneralException(ioe.getMessage());
+ }
+ }
+
+ private static void getLabelsFromJavaFiles() throws GeneralException {
+ try {
+ List<File> javaFiles = FileUtil.findFiles("java", null, null, getMessage);
+
+ for (File javaFile: javaFiles) {
+ getJavaLabels(javaFile, getMessage);
+ }
+ } catch(IOException ioe) {
+ throw new GeneralException(ioe.getMessage());
+ }
+ }
+
+ private static void getJavaLabels(File javaFile, String message) throws GeneralException {
+ try {
+ String fileNameURI = javaFile.toURI().toString();
+ String inFile = FileUtil.readString("UTF-8", javaFile);
+ int pos = 0;
+ while (pos >= 0){
+ pos = inFile.indexOf(message, pos);
+
+ if (pos >= 0) {
+ int offSet = (pos + 200 > inFile.length()) ? inFile.length() : pos + 200;
+ String searchComma = inFile.substring(pos, offSet);
+ int firstComma = searchComma.indexOf(",\"", 0);
+
+ if (firstComma < 0) {
+ firstComma = searchComma.indexOf(", \"", 0);
+ pos = pos + firstComma + 3;
+ } else {
+ pos = pos + firstComma + 2;
+ }
+
+ if (firstComma >= 0) {
+ offSet = (pos + 100 > inFile.length()) ? inFile.length() : pos + 100;
+ searchComma = inFile.substring(pos, offSet);
+ int secondComma = searchComma.indexOf("\",", 0);
+ int endString = pos;
+
+ if (secondComma < 0) {
+ secondComma = searchComma.indexOf("\" ,", 0);
+ endString = endString + secondComma + 1;
+ } else {
+ endString = endString + secondComma;
+ }
+
+ if (secondComma >= 0) {
+ setLabelReference(inFile.substring(pos, endString), fileNameURI);
+ pos = endString;
+ }
+ }
+ pos += 1;
+ }
+ }
+ } catch(IOException ioe) {
+ throw new GeneralException(ioe.getMessage());
+ }
+ }
+
+ private static void getLabelsFromSimpleMethodFiles() throws GeneralException {
+ try {
+ List<File> simpleMethodsFiles = FileUtil.findXmlFiles(null, null, "simple-methods", "http://ofbiz.apache.org/dtds/simple-methods.xsd");
+
+ for (File simpleMethodFile: simpleMethodsFiles) {
+ String fileNameURI = simpleMethodFile.toURI().toString();
+ Document simpleMethodDocument = UtilXml.readXmlDocument(simpleMethodFile.toURI().toURL());
+ Element rootElem = simpleMethodDocument.getDocumentElement();
+
+ for (Element elem1: UtilXml.childElementList(rootElem)) {
+ checkSimpleMethodTag(elem1, fileNameURI);
+ for (Element elem2: UtilXml.childElementList(elem1)) {
+ checkSimpleMethodTag(elem2, fileNameURI);
+ for (Element elem3: UtilXml.childElementList(elem2)) {
+ checkSimpleMethodTag(elem3, fileNameURI);
+ for (Element elem4: UtilXml.childElementList(elem3)) {
+ checkSimpleMethodTag(elem4, fileNameURI);
+ for (Element elem5: UtilXml.childElementList(elem4)) {
+ checkSimpleMethodTag(elem5, fileNameURI);
+ for (Element elem6: UtilXml.childElementList(elem5)) {
+ checkSimpleMethodTag(elem6, fileNameURI);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ } catch(IOException ioe) {
+ throw new GeneralException(ioe.getMessage());
+ } catch(Exception e) {
+ throw new GeneralException(e.getMessage());
+ }
+ }
+
+ private static void checkSimpleMethodTag(Element elem, String fileNameURI) throws GeneralException {
+ // fail-property labels
+ if ("fail-property".equals(elem.getTagName())) {
+ getFailPropertyTag(elem, fileNameURI);
+ // property-to-field labels
+ } else if ("property-to-field".equals(elem.getTagName())) {
+ getPropertyToFieldTag(elem, fileNameURI);
+ }
+ }
+
+ private static void getLabelsFromFormWidgets() throws GeneralException {
+ try {
+ List<File> formsFiles = FileUtil.findXmlFiles(null, null, "forms", "http://ofbiz.apache.org/dtds/widget-form.xsd");
+
+ for (File formsFile: formsFiles) {
+ String fileNameURI = formsFile.toURI().toString();
+ Document formDocument = UtilXml.readXmlDocument(formsFile.toURI().toURL());
+ Element rootElem = formDocument.getDocumentElement();
+
+ for (Element elem1: UtilXml.childElementList(rootElem)) {
+ checkFormsTag(elem1, fileNameURI);
+ for (Element elem2: UtilXml.childElementList(elem1)) {
+ checkFormsTag(elem2, fileNameURI);
+ for (Element elem3: UtilXml.childElementList(elem2)) {
+ checkFormsTag(elem3, fileNameURI);
+ for (Element elem4: UtilXml.childElementList(elem3)) {
+ checkFormsTag(elem4, fileNameURI);
+ for (Element elem5: UtilXml.childElementList(elem4)) {
+ checkFormsTag(elem5, fileNameURI);
+ }
+ }
+ }
+ }
+ }
+ }
+ } catch(IOException ioe) {
+ throw new GeneralException(ioe.getMessage());
+ } catch(Exception e) {
+ throw new GeneralException(e.getMessage());
+ }
+ }
+
+ private static void checkFormsTag(Element elem, String fileNameURI) throws GeneralException {
+ // auto fields entity labels
+ if ("auto-fields-entity".equals(elem.getTagName())) {
+ getAutoFieldsEntityTag(elem, fileNameURI);
+ // auto fields service labels
+ } else if ("auto-fields-service".equals(elem.getTagName())) {
+ getAutoFieldsServiceTag(elem, fileNameURI);
+ // field labels
+ } else if ("field".equals(elem.getTagName())) {
+ getFieldTag(elem, fileNameURI);
+ // option description labels
+ } else if ("option".equals(elem.getTagName())) {
+ getOptionTag(elem, fileNameURI);
+ // hyperlink/sub-hyperlink description labels
+ } else if ("hyperlink".equals(elem.getTagName()) ||
+ "sub-hyperlink".equals(elem.getTagName())) {
+ getHyperlinkTag(elem, fileNameURI);
+ }
+ }
+
+ private static void getLabelsFromScreenWidgets() throws GeneralException {
+ try {
+ List<File> screensFiles = FileUtil.findXmlFiles(null, null, "screens", "http://ofbiz.apache.org/dtds/widget-screen.xsd");
+
+ for (File screensFile: screensFiles) {
+ String fileNameURI = screensFile.toURI().toString();
+ Document screenDocument = UtilXml.readXmlDocument(screensFile.toURI().toURL());
+ Element rootElem = screenDocument.getDocumentElement();
+
+ for (Element elem1: UtilXml.childElementList(rootElem)) {
+ checkScreensTag(elem1, fileNameURI);
+ for (Element elem2: UtilXml.childElementList(elem1)) {
+ checkScreensTag(elem2, fileNameURI);
+ for (Element elem3: UtilXml.childElementList(elem2)) {
+ checkScreensTag(elem3, fileNameURI);
+ for (Element elem4: UtilXml.childElementList(elem3)) {
+ checkScreensTag(elem4, fileNameURI);
+ for (Element elem5: UtilXml.childElementList(elem4)) {
+ checkScreensTag(elem5, fileNameURI);
+ for (Element elem6: UtilXml.childElementList(elem5)) {
+ checkScreensTag(elem6, fileNameURI);
+ for (Element elem7: UtilXml.childElementList(elem6)) {
+ checkScreensTag(elem7, fileNameURI);
+ for (Element elem8: UtilXml.childElementList(elem7)) {
+ checkScreensTag(elem8, fileNameURI);
+ for (Element elem9: UtilXml.childElementList(elem8)) {
+ checkScreensTag(elem9, fileNameURI);
+ for (Element elem10: UtilXml.childElementList(elem9)) {
+ checkScreensTag(elem10, fileNameURI);
+ for (Element elem11: UtilXml.childElementList(elem10)) {
+ checkScreensTag(elem11, fileNameURI);
+ for (Element elem12: UtilXml.childElementList(elem11)) {
+ checkScreensTag(elem12, fileNameURI);
+ for (Element elem13: UtilXml.childElementList(elem12)) {
+ checkScreensTag(elem13, fileNameURI);
+ for (Element elem14: UtilXml.childElementList(elem13)) {
+ checkScreensTag(elem14, fileNameURI);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ } catch(IOException ioe) {
+ throw new GeneralException(ioe.getMessage());
+ } catch(Exception e) {
+ throw new GeneralException(e.getMessage());
+ }
+ }
+
+ private static void checkScreensTag(Element elem, String fileNameURI) {
+ // set labels
+ if ("set".equals(elem.getTagName())) {
+ getSetTag(elem, fileNameURI);
+ // screenlet labels
+ } else if ("screenlet".equals(elem.getTagName())) {
+ getScreenletTag(elem, fileNameURI);
+ // label labels
+ } else if ("label".equals(elem.getTagName())) {
+ getLabelTag(elem, fileNameURI);
+ // link labels
+ } else if ("link".equals(elem.getTagName())) {
+ getLinkTag(elem, fileNameURI);
+ }
+ }
+
+ private static void getLabelsFromMenuWidgets() throws GeneralException {
+ try {
+ List<File> menusFiles = FileUtil.findXmlFiles(null, null, "menus", "http://ofbiz.apache.org/dtds/widget-menu.xsd");
+
+ for (File menuFiles: menusFiles) {
+ String fileNameURI = menuFiles.toURI().toString();
+ Document menuDocument = UtilXml.readXmlDocument(menuFiles.toURI().toURL());
+ Element rootElem = menuDocument.getDocumentElement();
+
+ for (Element elem1: UtilXml.childElementList(rootElem)) {
+ checkMenuTag(elem1, fileNameURI);
+ for (Element elem2: UtilXml.childElementList(elem1)) {
+ checkMenuTag(elem2, fileNameURI);
+ for (Element elem3: UtilXml.childElementList(elem2)) {
+ checkMenuTag(elem3, fileNameURI);
+ for (Element elem4: UtilXml.childElementList(elem3)) {
+ checkMenuTag(elem4, fileNameURI);
+ for (Element elem5: UtilXml.childElementList(elem4)) {
+ checkMenuTag(elem5, fileNameURI);
+ }
+ }
+ }
+ }
+ }
+ }
+ } catch(IOException ioe) {
+ throw new GeneralException(ioe.getMessage());
+ } catch(Exception e) {
+ throw new GeneralException(e.getMessage());
+ }
+ }
+
+ private static void checkMenuTag(Element elem, String fileNameURI) {
+ // menu-item labels
+ if ("menu-item".equals(elem.getTagName())) {
+ getMenuItemTag(elem, fileNameURI);
+ }
+ }
+
+ private static void setLabelReference(String labelKey, String fileNameURI) {
+ Map<String, Integer> reference = references.get(labelKey);
+ if (UtilValidate.isEmpty(reference)) {
+ reference = new TreeMap<String, Integer>();
+ reference.put(fileNameURI, new Integer(1));
+ references.put(labelKey, reference);
+ } else {
+ Integer labelsInFile = reference.get(fileNameURI);
+
+ if (UtilValidate.isEmpty(labelsInFile)) {
+ labelsInFile = new Integer(1);
+ }
+ else {
+ labelsInFile = new Integer(labelsInFile.intValue() + 1);
+ }
+ reference.put(fileNameURI, labelsInFile);
+ }
+ }
+
+ private static boolean getLabelFromTag(Element element, String fileNameURI, String attributeValue, String stringToSearch) {
+ boolean stringFound = false;
+
+ if (UtilValidate.isNotEmpty(attributeValue)) {
+ int pos = 0;
+
+ while (pos >= 0){
+ pos = attributeValue.indexOf(stringToSearch, pos);
+
+ if (pos >= 0) {
+ int graph = attributeValue.indexOf("}", pos);
+
+ if (graph >= 0) {
+ String labelKey = attributeValue.substring(pos + stringToSearch.length(), graph);
+ setLabelReference(labelKey, fileNameURI);
+ stringFound = true;
+ pos = graph;
+ }
+ pos += 1;
+ }
+ }
+ }
+ return stringFound;
+ }
+
+ private static void getSetTag(Element element, String fileNameURI) {
+ String setField = UtilFormatOut.checkNull(element.getAttribute("field"));
+ String setValue = UtilFormatOut.checkNull(element.getAttribute("value"));
+ String fromField = UtilFormatOut.checkNull(element.getAttribute("from-field"));
+
+ if (UtilValidate.isNotEmpty(setField)) {
+ if (UtilValidate.isNotEmpty(setValue) &&
+ ("applicationTitle".equals(setField) ||
+ "titleProperty".equals(setField) ||
+ "title".equals(setField))) {
+ // set field with hardcoded labels
+ if (!getLabelFromTag(element, fileNameURI, setValue, uiLabelMap)) {
+ setLabelReference(setValue, fileNameURI);;
+ }
+ } else if (UtilValidate.isNotEmpty(fromField) &&
+ ("layoutSettings.companyName".equals(setField) ||
+ "layoutSettings.companySubtitle".equals(setField))) {
+ // set field labels
+ if (fromField.startsWith(uiLabelMapInLayoutSettings)) {
+ setLabelReference(fromField.substring(uiLabelMapInLayoutSettings.length(), fromField.length()), fileNameURI);
+ // set field with hardcoded labels
+ } else {
+ setLabelReference(fromField, fileNameURI);
+ }
+ }
+ }
+ }
+
+ private static void getScreenletTag(Element element, String fileNameURI) {
+ String screenTitle = UtilFormatOut.checkNull(element.getAttribute("title"));
+
+ if (UtilValidate.isNotEmpty(screenTitle)) {
+ // screenlet title with hardcoded labels
+ if (!getLabelFromTag(element, fileNameURI, screenTitle, uiLabelMap)) {
+ setLabelReference(screenTitle, fileNameURI);;
+ }
+ }
+ }
+
+ private static void getAutoFieldsEntityTag(Element element, String fileNameURI) throws GeneralException {
+ try {
+ String entityName = UtilFormatOut.checkNull(element.getAttribute("entity-name"));
+ String defaultFieldType = UtilFormatOut.checkNull(element.getAttribute("default-field-type"));
+
+ if (UtilValidate.isNotEmpty(entityName) && UtilValidate.isNotEmpty(defaultFieldType) && (!("hidden".equals(defaultFieldType)))) {
+ ModelEntity entity = LabelManagerFactory.entityModelReader.getModelEntity(entityName);
+
+ for (Iterator<ModelField> f = entity.getFieldsIterator(); f.hasNext();) {
+ ModelField field = f.next();
+ setLabelReference(formFieldTitle + field.getName(), fileNameURI);
+ }
+ }
+ } catch(Exception e) {
+ throw new GeneralException(e.getMessage());
+ }
+ }
+
+ private static void getAutoFieldsServiceTag(Element element, String fileNameURI) throws GeneralException {
+ try {
+ String serviceName = UtilFormatOut.checkNull(element.getAttribute("service-name"));
+ String defaultFieldType = UtilFormatOut.checkNull(element.getAttribute("default-field-type"));
+
+ if (UtilValidate.isNotEmpty(serviceName) && (!("hidden".equals(defaultFieldType)))) {
+ ModelService modelService = LabelManagerFactory.dispatchContext.getModelService(serviceName);
+ List<ModelParam> modelParams = modelService.getInModelParamList();
+ Iterator<ModelParam> modelParamIter = modelParams.iterator();
+
+ while (modelParamIter.hasNext()) {
+ ModelParam modelParam = (ModelParam) modelParamIter.next();
+ // skip auto params that the service engine populates...
+ if ("userLogin".equals(modelParam.name) || "locale".equals(modelParam.name) || "timeZone".equals(modelParam.name)) {
+ continue;
+ }
+
+ if (modelParam.formDisplay) {
+ if (UtilValidate.isNotEmpty(modelParam.entityName) && UtilValidate.isNotEmpty(modelParam.fieldName)) {
+ ModelEntity modelEntity;
+ try {
+ modelEntity = LabelManagerFactory.entityModelReader.getModelEntity(modelParam.entityName);
+
+ if (modelEntity != null) {
+ ModelField modelField = modelEntity.getField(modelParam.fieldName);
+
+ if (modelField != null) {
+ setLabelReference(formFieldTitle + modelField.getName(), fileNameURI);
+ }
+ }
+ } catch (GenericEntityException e) {
+ Debug.logError(e, module);
+ }
+ }
+
+ setLabelReference(formFieldTitle + modelParam.name, fileNameURI);
+ }
+ }
+ }
+ } catch(Exception e) {
+ throw new GeneralException(e.getMessage());
+ }
+ }
+
+ private static void getHyperlinkTag(Element element, String fileNameURI) {
+ String hyperlinkDescription = UtilFormatOut.checkNull(element.getAttribute("description"));
+
+ if (UtilValidate.isNotEmpty(hyperlinkDescription)) {
+ // hyperlink description with hardcoded labels
+ if (!getLabelFromTag(element, fileNameURI, hyperlinkDescription, uiLabelMap)) {
+ setLabelReference(hyperlinkDescription, fileNameURI);;
+ }
+ }
+ }
+
+ private static void getFieldTag(Element element, String fileNameURI) {
+ String labelKey = UtilFormatOut.checkNull(element.getAttribute("name"));
+ labelKey = formFieldTitle + labelKey;
+ String fieldTitle = UtilFormatOut.checkNull(element.getAttribute("title"));
+ String tooltip = UtilFormatOut.checkNull(element.getAttribute("tooltip"));
+ boolean escludeField= false;
+
+ for (Element fieldTypeElem: UtilXml.childElementList(element)) {
+ if ("hidden".equals(fieldTypeElem.getTagName())) {
+ escludeField = true;
+ } else if ("ignore".equals(fieldTypeElem.getTagName())) {
+ escludeField = true;
+ }
+ }
+
+ if (!escludeField) {
+ // field name labels
+ if (UtilValidate.isEmpty(fieldTitle)) {
+ setLabelReference(labelKey, fileNameURI);
+ } else {
+ // field title with hardcoded labels
+ if (!getLabelFromTag(element, fileNameURI, fieldTitle, uiLabelMap)) {
+ setLabelReference(fieldTitle, fileNameURI);;
+ }
+ }
+
+ if (UtilValidate.isNotEmpty(tooltip)) {
+ // tooltip with hardcoded labels
+ if (!getLabelFromTag(element, fileNameURI, tooltip, uiLabelMap)) {
+ setLabelReference(tooltip, fileNameURI);;
+ }
+ }
+ }
+ }
+
+ private static void getLabelTag(Element element, String fileNameURI) {
+ String labelText = UtilFormatOut.checkNull(element.getAttribute("text"));
+ String labelValue = UtilFormatOut.checkNull(UtilXml.elementValue(element));
+
+ // label text labels
+ if (UtilValidate.isNotEmpty(labelText)) {
+ // label text with hardcoded labels
+ if (!getLabelFromTag(element, fileNameURI, labelText, uiLabelMap)) {
+ setLabelReference(labelText, fileNameURI);;
+ }
+ // label value labels
+ } else if (UtilValidate.isNotEmpty(labelValue)) {
+ // label value with hardcoded labels
+ if (!getLabelFromTag(element, fileNameURI, labelValue, uiLabelMap)) {
+ setLabelReference(labelValue, fileNameURI);;
+ }
+ }
+ }
+
+ private static void getMenuItemTag(Element element, String fileNameURI) {
+ String menuItemTitle = UtilFormatOut.checkNull(element.getAttribute("title"));
+
+ if (UtilValidate.isNotEmpty(menuItemTitle)) {
+ // menu item title with hardcoded labels
+ if (!getLabelFromTag(element, fileNameURI, menuItemTitle, uiLabelMap)) {
+ setLabelReference(menuItemTitle, fileNameURI);;
+ }
+ }
+ }
+
+ private static void getFailPropertyTag(Element element, String fileNameURI) {
+ String propertyValue = UtilFormatOut.checkNull(element.getAttribute("property"));
+
+ if (UtilValidate.isNotEmpty(propertyValue)) {
+ // fail-property labels
+ setLabelReference(propertyValue, fileNameURI);
+ }
+ }
+
+ private static void getOptionTag(Element element, String fileNameURI) {
+ String description = UtilFormatOut.checkNull(element.getAttribute("description"));
+
+ if (UtilValidate.isNotEmpty(description)) {
+ // option description with hardcoded labels
+ if (!getLabelFromTag(element, fileNameURI, description, uiLabelMap)) {
+ setLabelReference(description, fileNameURI);;
+ }
+ }
+ }
+
+ private static void getLinkTag(Element element, String fileNameURI) {
+ String linkText = UtilFormatOut.checkNull(element.getAttribute("text"));
+
+ if (UtilValidate.isNotEmpty(linkText)) {
+ // link text with hardcoded labels
+ if (!getLabelFromTag(element, fileNameURI, linkText, uiLabelMap)) {
+ setLabelReference(linkText, fileNameURI);;
+ }
+ }
+ }
+
+ private static void getPropertyToFieldTag(Element element, String fileNameURI) {
+ String property = UtilFormatOut.checkNull(element.getAttribute("property"));
+
+ // property-to-field labels
+ if (UtilValidate.isNotEmpty(property)) {
+ setLabelReference(property, fileNameURI);
+ }
+ }
+}
+
+
Modified: ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/labelmanager/LabelManager.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/labelmanager/LabelManager.groovy?rev=744635&r1=744634&r2=744635&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/labelmanager/LabelManager.groovy (original)
+++ ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/labelmanager/LabelManager.groovy Sun Feb 15 08:42:06 2009
@@ -26,4 +26,7 @@
context.localesFound = LabelManagerFactory.getLocalesFound();
context.fileNamesFound = LabelManagerFactory.getFileNamesFound();
context.componentNamesFound = LabelManagerFactory.getComponentNamesFound();
+context.references = LabelManagerFactory.getReferences();
+context.referencesList = LabelManagerFactory.getReferencesList();
context.duplicatedLocalesLabels = LabelManagerFactory.getDuplicatedLocalesLabels();
+context.keySeparator = LabelManagerFactory.keySeparator;
Added: 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=744635&view=auto
==============================================================================
--- ofbiz/trunk/framework/webtools/webapp/webtools/labelmanager/ViewHardcodedLabels.ftl (added)
+++ ofbiz/trunk/framework/webtools/webapp/webtools/labelmanager/ViewHardcodedLabels.ftl Sun Feb 15 08:42:06 2009
@@ -0,0 +1,24 @@
+<div class="screenlet-body">
+ <#if parameters.searchLabels?exists>
+ <table class="basic-table hover-bar" cellspacing="3">
+ <tr class="header-row">
+ <td>${uiLabelMap.WebtoolsLabelManagerRow}</td>
+ <td>${uiLabelMap.WebtoolsLabelManagerKey}</td>
+ <td>${uiLabelMap.WebtoolsLabelManagerReferences}</td>
+ </tr>
+ <#assign rowNum = 1>
+ <#list referencesList as reference>
+ <#assign labelFound = 'N'>
+ <#assign refNum = Static["org.ofbiz.webtools.labelmanager.LabelManagerFactory"].getLabelReferenceFile(reference)>
+ <#if (refNum > 0)>
+ <tr>
+ <td>${rowNum}</td>
+ <td>${reference}</td>
+ <td>${refNum}</td>
+ </tr>
+ <#assign rowNum = rowNum + 1>
+ </#if>
+ </#list>
+ </table>
+ </#if>
+</div>
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=744635&r1=744634&r2=744635&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/webapp/webtools/labelmanager/ViewLabels.ftl (original)
+++ ofbiz/trunk/framework/webtools/webapp/webtools/labelmanager/ViewLabels.ftl Sun Feb 15 08:42:06 2009
@@ -25,6 +25,7 @@
<tr class="header-row">
<td>${uiLabelMap.WebtoolsLabelManagerKey}</td>
<td>${uiLabelMap.WebtoolsLabelManagerFileName}</td>
+ <td>${uiLabelMap.WebtoolsLabelManagerReferences}</td>
<#list localesFound as localeFound>
<#assign showLocale = true>
<#if parameters.labelLocaleName?exists && parameters.labelLocaleName != "" && parameters.labelLocaleName != localeFound>
@@ -63,9 +64,16 @@
<#assign showLabel = false>
</#if>
<#if showLabel == true>
+ <#assign labelKey = label.labelKey>
<tr <#if rowNum == "1">class="alternate-row"</#if>>
- <td><a href="<@o...@ofbizUrl>" <#if previousKey == label.labelKey>class="submenutext"</#if>>${label.labelKey}</a></td>
+ <td><a href="<@o...@ofbizUrl>" <#if previousKey == labelKey>class="submenutext"</#if>>${label.labelKey}</a></td>
<td>${label.fileName}</td>
+ <#assign referenceNum = 0>
+ <#assign reference = references.get(labelKey)?if_exists>
+ <#if reference?exists && reference?has_content>
+ <#assign referenceNum = reference.size()>
+ </#if>
+ <td align="center">${referenceNum}</td>
<#list localesFound as localeFound>
<#assign labelVal = label.getLabelValue(localeFound)?if_exists>
<#assign showLocale = true>
@@ -86,7 +94,7 @@
<#else>
<#assign rowNum = "2">
</#if>
- <#assign previousKey = label.labelKey>
+ <#assign previousKey = labelKey>
</#if>
</#list>
</#if>
Modified: ofbiz/trunk/framework/webtools/widget/LabelManagerScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/widget/LabelManagerScreens.xml?rev=744635&r1=744634&r2=744635&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/widget/LabelManagerScreens.xml (original)
+++ ofbiz/trunk/framework/webtools/widget/LabelManagerScreens.xml Sun Feb 15 08:42:06 2009
@@ -37,7 +37,10 @@
</screenlet>
<screenlet id="ViewLabelsPanel" title="${uiLabelMap.WebtoolsLabelManager}" collapsible="false">
<platform-specific><html><html-template location="component://webtools/webapp/webtools/labelmanager/ViewLabels.ftl"/></html></platform-specific>
- </screenlet>
+ </screenlet>
+ <screenlet id="ViewHardcodedLabelsPanel" title="${uiLabelMap.WebtoolsLabelManagerHardcoded}" collapsible="false">
+ <platform-specific><html><html-template location="component://webtools/webapp/webtools/labelmanager/ViewHardcodedLabels.ftl"/></html></platform-specific>
+ </screenlet>
</decorator-section>
</decorator-screen>
</widgets>