You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by er...@apache.org on 2012/03/26 22:56:30 UTC

svn commit: r1305581 [6/36] - in /ofbiz/branches/20111205EmailHandling: ./ applications/accounting/config/ applications/accounting/data/ applications/accounting/entitydef/ applications/accounting/script/org/ofbiz/accounting/finaccount/ applications/acc...

Modified: ofbiz/branches/20111205EmailHandling/applications/content/src/org/ofbiz/content/content/ContentWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/20111205EmailHandling/applications/content/src/org/ofbiz/content/content/ContentWorker.java?rev=1305581&r1=1305580&r2=1305581&view=diff
==============================================================================
--- ofbiz/branches/20111205EmailHandling/applications/content/src/org/ofbiz/content/content/ContentWorker.java (original)
+++ ofbiz/branches/20111205EmailHandling/applications/content/src/org/ofbiz/content/content/ContentWorker.java Mon Mar 26 20:56:02 2012
@@ -163,9 +163,7 @@ public class ContentWorker implements or
             }
 
             alternateViews = EntityUtil.filterByDate(alternateViews, UtilDateTime.nowTimestamp(), "caFromDate", "caThruDate", true);
-            Iterator<GenericValue> alternateViewIter = alternateViews.iterator();
-            while (alternateViewIter.hasNext()) {
-                GenericValue thisView = alternateViewIter.next();
+            for(GenericValue thisView : alternateViews) {
                 GenericValue altContentRole = EntityUtil.getFirst(EntityUtil.filterByDate(thisView.getRelatedByAndCache("ContentRole", UtilMisc.toMap("partyId", partyId, "roleTypeId", roleTypeId))));
                 GenericValue altContent = null;
                 if (UtilValidate.isNotEmpty(altContentRole)) {
@@ -180,7 +178,7 @@ public class ContentWorker implements or
     }
 
     public static void renderContentAsText(LocalDispatcher dispatcher, Delegator delegator, GenericValue content, Appendable out,
-            Map<String,Object>templateContext, Locale locale, String mimeTypeId, boolean cache) throws GeneralException, IOException {
+            Map<String,Object>templateContext, Locale locale, String mimeTypeId, boolean cache, List<GenericValue> webAnalytics) throws GeneralException, IOException {
         // if the content has a service attached run the service
 
         String serviceName = content.getString("serviceName");
@@ -266,7 +264,12 @@ public class ContentWorker implements or
                     Debug.logError("No content ID found.", module);
                     return;
                 }
-                DataResourceWorker.renderDataResourceAsText(delegator, dataResourceId, out, templateContext, locale, mimeTypeId, cache);
+                
+                if (UtilValidate.isNotEmpty(webAnalytics)) {
+                    DataResourceWorker.renderDataResourceAsText(delegator, dataResourceId, out, templateContext, locale, mimeTypeId, cache, webAnalytics);
+                } else {
+                    DataResourceWorker.renderDataResourceAsText(delegator, dataResourceId, out, templateContext, locale, mimeTypeId, cache);
+                }
 
             // there is a template; render the data and then the template
             } else {
@@ -325,10 +328,17 @@ public class ContentWorker implements or
         return writer.toString();
     }
 
+    public static String renderContentAsText(LocalDispatcher dispatcher, Delegator delegator, String contentId, Appendable out,
+            Map<String, Object> templateContext, Locale locale, String mimeTypeId, String partyId, String roleTypeId, boolean cache, List<GenericValue> webAnalytics) throws GeneralException, IOException {
+        GenericValue content = ContentWorker.findContentForRendering(delegator, contentId, locale, partyId, roleTypeId, cache);
+        ContentWorker.renderContentAsText(dispatcher, delegator, content, out, templateContext, locale, mimeTypeId, cache, webAnalytics);
+        return out.toString();
+    }
+
     public static void renderContentAsText(LocalDispatcher dispatcher, Delegator delegator, String contentId, Appendable out,
             Map<String, Object> templateContext, Locale locale, String mimeTypeId, String partyId, String roleTypeId, boolean cache) throws GeneralException, IOException {
         GenericValue content = ContentWorker.findContentForRendering(delegator, contentId, locale, partyId, roleTypeId, cache);
-        ContentWorker.renderContentAsText(dispatcher, delegator, content, out, templateContext, locale, mimeTypeId, cache);
+        ContentWorker.renderContentAsText(dispatcher, delegator, content, out, templateContext, locale, mimeTypeId, cache, null);
     }
 
     public static String renderSubContentAsText(LocalDispatcher dispatcher, Delegator delegator, String contentId, String mapKey, Map<String, Object> templateContext,
@@ -381,9 +391,7 @@ public class ContentWorker implements or
         }
 
         alternateViews = EntityUtil.filterByDate(alternateViews, UtilDateTime.nowTimestamp(), "caFromDate", "caThruDate", true);
-        Iterator<GenericValue> alternateViewIter = alternateViews.iterator();
-        while (alternateViewIter.hasNext()) {
-            GenericValue thisView = alternateViewIter.next();
+        for(GenericValue thisView : alternateViews) {
             String currentLocaleString = thisView.getString("localeString");
             if (UtilValidate.isEmpty(currentLocaleString)) {
                 continue;
@@ -486,11 +494,9 @@ public class ContentWorker implements or
             if (!isReturnAfter) {
                 List<String> assocTypes = FastList.newInstance();
                 List<GenericValue> relatedAssocs = getContentAssocsWithId(delegator, contentId, fromDate, thruDate, direction, assocTypes);
-                Iterator<GenericValue> it = relatedAssocs.iterator();
                 Map<String, Object> assocContext = FastMap.newInstance();
                 assocContext.put("related", relatedAssocs);
-                while (it.hasNext()) {
-                    GenericValue assocValue = it.next();
+                for(GenericValue assocValue : relatedAssocs) {
                     contentAssocTypeId = (String) assocValue.get("contentAssocTypeId");
                     assocContext.put("contentAssocTypeId", contentAssocTypeId);
                     //assocContext.put("contentTypeId", assocValue.get("contentTypeId"));
@@ -687,9 +693,7 @@ public class ContentWorker implements or
         }
         List<GenericValue> relatedViews = UtilGenerics.checkList(results.get("entityList"));
         //if (Debug.infoOn()) Debug.logInfo("traverse, relatedViews:" + relatedViews,null);
-        Iterator<GenericValue> it = relatedViews.iterator();
-        while (it.hasNext()) {
-            GenericValue assocValue = it.next();
+        for(GenericValue assocValue : relatedViews) {
             Map<String, Object> thisNode = ContentWorker.makeNode(assocValue);
             checkConditions(delegator, thisNode, null, whenMap);
             // boolean isReturnBeforePick = booleanDataType(thisNode.get("isReturnBeforePick"));
@@ -759,12 +763,9 @@ public class ContentWorker implements or
         if (linkDir != null && linkDir.equalsIgnoreCase("TO")) {
             contentIdName = contentIdName.concat("To");
         }
-        GenericValue assoc = null;
         GenericValue content = null;
         String contentTypeId = null;
-        Iterator<GenericValue> assocIt = assocList.iterator();
-        while (assocIt.hasNext()) {
-            assoc = assocIt.next();
+        for(GenericValue assoc : assocList) {
             String contentId = (String) assoc.get(contentIdName);
             if (Debug.infoOn()) Debug.logInfo("contentId:" + contentId, "");
             content = delegator.findByPrimaryKey("Content", UtilMisc.toMap("contentId", contentId));
@@ -850,9 +851,7 @@ public class ContentWorker implements or
         exprList.add(joinExpr);
         if (UtilValidate.isNotEmpty(assocTypes)) {
             List<EntityExpr> exprListOr = FastList.newInstance();
-            Iterator<String> it = assocTypes.iterator();
-            while (it.hasNext()) {
-                String assocType = it.next();
+            for(String assocType : assocTypes) {
                 expr = EntityCondition.makeCondition("contentAssocTypeId", EntityOperator.EQUALS, assocType);
                 exprListOr.add(expr);
             }
@@ -962,9 +961,7 @@ public class ContentWorker implements or
             //if (Debug.infoOn()) Debug.logInfo("getContentAncestry, lst:" + lst, "");
             List<GenericValue> lst2 = EntityUtil.filterByDate(lst);
             //if (Debug.infoOn()) Debug.logInfo("getContentAncestry, lst2:" + lst2, "");
-            Iterator<GenericValue> iter = lst2.iterator();
-            while (iter.hasNext()) {
-                GenericValue contentAssoc = iter.next();
+            for(GenericValue contentAssoc : lst2) {
                 String contentIdOther = contentAssoc.getString(contentIdOtherField);
                 if (!contentAncestorList.contains(contentIdOther)) {
                     getContentAncestryAll(delegator, contentIdOther, passedContentTypeId, direction, contentAncestorList);
@@ -986,9 +983,7 @@ public class ContentWorker implements or
          List<GenericValue> contentAncestorList = FastList.newInstance();
          List<Map<String, Object>> nodeTrail = FastList.newInstance();
          getContentAncestry(delegator, contentId, contentAssocTypeId, direction, contentAncestorList);
-         Iterator<GenericValue> contentAncestorListIter = contentAncestorList.iterator();
-         while (contentAncestorListIter.hasNext()) {
-             GenericValue value = contentAncestorListIter.next();
+         for(GenericValue value : contentAncestorList) {
              Map<String, Object> thisNode = ContentWorker.makeNode(value);
              nodeTrail.add(thisNode);
          }
@@ -1435,13 +1430,10 @@ public class ContentWorker implements or
         thisNode.put("isReturnAfterPick", Boolean.FALSE);
         thisNode.put("isPick", Boolean.TRUE);
         thisNode.put("isFollow", Boolean.TRUE);
-        try {
+        if (thisContent.getModelEntity().getField("caContentAssocTypeId") != null) {
             thisNode.put("contentAssocTypeId", thisContent.get("caContentAssocTypeId"));
             thisNode.put("mapKey", thisContent.get("caMapKey"));
             thisNode.put("fromDate", thisContent.get("caFromDate"));
-            thisNode.put("contentAssocTypeId", thisContent.get("caContentAssocTypeId"));
-        } catch (Exception e) {
-            // This ignores the case when thisContent does not have ContentAssoc values
         }
         return thisNode;
     }
@@ -1451,12 +1443,10 @@ public class ContentWorker implements or
             return "";
         }
         StringBuilder csv = new StringBuilder();
-        Iterator<Map<String, ? extends Object>> it = nodeTrail.iterator();
-        while (it.hasNext()) {
+        for(Map<String, ? extends Object> node : nodeTrail) {
             if (csv.length() > 0) {
                 csv.append(",");
             }
-            Map<String, ? extends Object> node = it.next();
             if (node == null) {
                 break;
             }
@@ -1470,12 +1460,9 @@ public class ContentWorker implements or
         List<List<String>> outList = FastList.newInstance();
         List<String> contentIdList = StringUtil.split(csv, ",");
         GenericValue content = null;
-        String contentId = null;
         String contentName = null;
         List<String> values = null;
-        Iterator<String> it = contentIdList.iterator();
-        while (it.hasNext()) {
-            contentId = it.next();
+        for(String contentId : contentIdList) {
             try {
                 content = delegator.findByPrimaryKeyCache("Content", UtilMisc.toMap("contentId", contentId));
             } catch (GenericEntityException e) {
@@ -1498,10 +1485,7 @@ public class ContentWorker implements or
         }
         List<String> contentIdList = StringUtil.split(csv, ",");
         GenericValue content = null;
-        String contentId = null;
-        Iterator<String> it = contentIdList.iterator();
-        while (it.hasNext()) {
-            contentId = it.next();
+        for(String contentId : contentIdList) {
             try {
                 content = delegator.findByPrimaryKeyCache("Content", UtilMisc.toMap("contentId", contentId));
             } catch (GenericEntityException e) {
@@ -1519,10 +1503,7 @@ public class ContentWorker implements or
             return trail;
         }
         List<GenericValue> contentList = csvToContentList(csv, delegator);
-        GenericValue content = null;
-        Iterator<GenericValue> it = contentList.iterator();
-        while (it.hasNext()) {
-            content = it.next();
+        for(GenericValue content : contentList) {
             Map<String, Object> node = makeNode(content);
             trail.add(node);
         }
@@ -1618,10 +1599,7 @@ public class ContentWorker implements or
             s.append(lbl);
         }
         s.append("=").append(indent).append("==>").append(eol);
-        Set<String> keySet = map.keySet();
-        Iterator<String> it = keySet.iterator();
-        while (it.hasNext()) {
-            String key = it.next();
+        for(String key : map.keySet()) {
             if ("request response session".indexOf(key) < 0) {
                 Object obj = map.get(key);
                 s.append(spc).append(key).append(sep);
@@ -1667,9 +1645,7 @@ public class ContentWorker implements or
         int sz = lst.size();
         if (lbl != null) s.append(lbl);
         s.append("=").append(indent).append("==> sz:").append(sz).append(eol);
-        Iterator<Object> it = lst.iterator();
-        while (it.hasNext()) {
-            Object obj = it.next();
+        for(Object obj : lst) {
             s.append(spc);
             if (obj instanceof GenericValue) {
                 GenericValue gv = (GenericValue)obj;

Modified: ofbiz/branches/20111205EmailHandling/applications/content/src/org/ofbiz/content/content/PermissionRecorder.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/20111205EmailHandling/applications/content/src/org/ofbiz/content/content/PermissionRecorder.java?rev=1305581&r1=1305580&r2=1305581&view=diff
==============================================================================
--- ofbiz/branches/20111205EmailHandling/applications/content/src/org/ofbiz/content/content/PermissionRecorder.java (original)
+++ ofbiz/branches/20111205EmailHandling/applications/content/src/org/ofbiz/content/content/PermissionRecorder.java Mon Mar 26 20:56:02 2012
@@ -236,9 +236,7 @@ public class PermissionRecorder {
         sb.append("<td class=\"headr\" >Pass/Fail</td>");
         sb.append("</tr>");
 
-        Iterator<Map<String, Object>> iter = permCheckResults.iterator();
-        while (iter.hasNext()) {
-            Map<String, Object> cMap = iter.next();
+        for(Map<String, Object> cMap : permCheckResults) {
             sb.append(renderCurrentContentMapHtml(cMap));
         }
         sb.append("</table>");
@@ -248,9 +246,7 @@ public class PermissionRecorder {
     public String renderCurrentContentMapHtml(Map<String, Object> cMap) {
         StringBuilder sb = new StringBuilder();
         List<Map<String, Object>> resultList = UtilGenerics.checkList(cMap.get("checkResultList"));
-        Iterator<Map<String, Object>> iter = resultList.iterator();
-        while (iter.hasNext()) {
-            Map<String, Object> rMap = iter.next();
+        for(Map<String, Object> rMap : resultList) {
             //if (Debug.infoOn()) Debug.logInfo("renderCCMapHtml, (1):" + rMap, module);
             sb.append(renderResultRowHtml(rMap, cMap));
         }

Modified: ofbiz/branches/20111205EmailHandling/applications/content/src/org/ofbiz/content/content/UploadContentAndImage.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/20111205EmailHandling/applications/content/src/org/ofbiz/content/content/UploadContentAndImage.java?rev=1305581&r1=1305580&r2=1305581&view=diff
==============================================================================
--- ofbiz/branches/20111205EmailHandling/applications/content/src/org/ofbiz/content/content/UploadContentAndImage.java (original)
+++ ofbiz/branches/20111205EmailHandling/applications/content/src/org/ofbiz/content/content/UploadContentAndImage.java Mon Mar 26 20:56:02 2012
@@ -463,11 +463,9 @@ public class UploadContentAndImage {
 
         ModelEntity modelEntity = delegator.getModelEntity("ContentAssocDataResourceViewFrom");
         List<String> fieldNames = modelEntity.getAllFieldNames();
-        Iterator<String> iter = fieldNames.iterator();
         Map<String, Object> ftlContext2 = FastMap.newInstance();
         Map<String, Object> ftlContext3 = FastMap.newInstance();
-        while (iter.hasNext()) {
-            String keyName = iter.next();
+        for(String keyName : fieldNames) {
             Object obj = passedParams.get(keyName + suffix);
             ftlContext2.put(keyName, obj);
         }

Modified: ofbiz/branches/20111205EmailHandling/applications/content/src/org/ofbiz/content/data/DataEvents.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/20111205EmailHandling/applications/content/src/org/ofbiz/content/data/DataEvents.java?rev=1305581&r1=1305580&r2=1305581&view=diff
==============================================================================
--- ofbiz/branches/20111205EmailHandling/applications/content/src/org/ofbiz/content/data/DataEvents.java (original)
+++ ofbiz/branches/20111205EmailHandling/applications/content/src/org/ofbiz/content/data/DataEvents.java Mon Mar 26 20:56:02 2012
@@ -167,7 +167,7 @@ public class DataEvents {
 
         // hack for IE and mime types
         if (userAgent.indexOf("MSIE") > -1) {
-            Debug.log("Found MSIE changing mime type from - " + mimeType, module);
+            Debug.logInfo("Found MSIE changing mime type from - " + mimeType, module);
             mimeType = "application/octet-stream";
         }
 
@@ -200,7 +200,7 @@ public class DataEvents {
             stream = (InputStream) resourceData.get("stream");
             length = (Long) resourceData.get("length");
         }
-        Debug.log("Got resource data stream: " + length + " bytes", module);
+        Debug.logInfo("Got resource data stream: " + length + " bytes", module);
 
         // stream the content to the browser
         if (stream != null && length != null) {
@@ -230,7 +230,7 @@ public class DataEvents {
         Delegator delegator = (Delegator) request.getAttribute("delegator");
         Map<String, Object> parameters = UtilHttp.getParameterMap(request);
 
-        Debug.log("Img UserAgent - " + request.getHeader("User-Agent"), module);
+        Debug.logInfo("Img UserAgent - " + request.getHeader("User-Agent"), module);
 
         String dataResourceId = (String) parameters.get("imgId");
         if (UtilValidate.isEmpty(dataResourceId)) {
@@ -269,7 +269,7 @@ public class DataEvents {
             // hack for IE and mime types
             String userAgent = request.getHeader("User-Agent");
             if (userAgent.indexOf("MSIE") > -1) {
-                Debug.log("Found MSIE changing mime type from - " + mimeType, module);
+                Debug.logInfo("Found MSIE changing mime type from - " + mimeType, module);
                 mimeType = "application/octet-stream";
             }
 

Modified: ofbiz/branches/20111205EmailHandling/applications/content/src/org/ofbiz/content/data/DataResourceWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/20111205EmailHandling/applications/content/src/org/ofbiz/content/data/DataResourceWorker.java?rev=1305581&r1=1305580&r2=1305581&view=diff
==============================================================================
--- ofbiz/branches/20111205EmailHandling/applications/content/src/org/ofbiz/content/data/DataResourceWorker.java (original)
+++ ofbiz/branches/20111205EmailHandling/applications/content/src/org/ofbiz/content/data/DataResourceWorker.java Mon Mar 26 20:56:02 2012
@@ -55,6 +55,7 @@ import org.ofbiz.base.location.FlexibleL
 import org.ofbiz.base.util.Debug;
 import org.ofbiz.base.util.FileUtil;
 import org.ofbiz.base.util.GeneralException;
+import org.ofbiz.base.util.StringUtil;
 import org.ofbiz.base.util.UtilGenerics;
 import org.ofbiz.base.util.UtilHttp;
 import org.ofbiz.base.util.UtilIO;
@@ -62,6 +63,7 @@ import org.ofbiz.base.util.UtilMisc;
 import org.ofbiz.base.util.UtilProperties;
 import org.ofbiz.base.util.UtilValidate;
 import org.ofbiz.base.util.UtilXml;
+import org.ofbiz.base.util.StringUtil.StringWrapper;
 import org.ofbiz.base.util.collections.MapStack;
 import org.ofbiz.base.util.template.FreeMarkerWorker;
 import org.ofbiz.base.util.template.XslTransform;
@@ -70,6 +72,7 @@ import org.ofbiz.content.content.UploadC
 import org.ofbiz.entity.Delegator;
 import org.ofbiz.entity.GenericEntityException;
 import org.ofbiz.entity.GenericValue;
+import org.ofbiz.entity.util.EntityUtilProperties;
 import org.ofbiz.service.GenericServiceException;
 import org.ofbiz.service.LocalDispatcher;
 import org.ofbiz.widget.screen.MacroScreenRenderer;
@@ -542,7 +545,7 @@ public class DataResourceWorker  impleme
             latestDir = makeNewDirectory(parent);
         }
 
-        Debug.log("Directory Name : " + latestDir.getName(), module);
+        Debug.logInfo("Directory Name : " + latestDir.getName(), module);
         if (absolute) {
             return latestDir.getAbsolutePath().replace('\\','/');
         } else {
@@ -585,12 +588,18 @@ public class DataResourceWorker  impleme
     public static String renderDataResourceAsText(Delegator delegator, String dataResourceId, Map<String, Object> templateContext,
              Locale locale, String targetMimeTypeId, boolean cache) throws GeneralException, IOException {
         Writer writer = new StringWriter();
-        renderDataResourceAsText(delegator, dataResourceId, writer, templateContext, locale, targetMimeTypeId, cache);
+        renderDataResourceAsText(delegator, dataResourceId, writer, templateContext, locale, targetMimeTypeId, cache, null);
         return writer.toString();
     }
 
-    public static void renderDataResourceAsText(Delegator delegator, String dataResourceId, Appendable out,
+    public static String renderDataResourceAsText(Delegator delegator, String dataResourceId, Appendable out,
             Map<String, Object> templateContext, Locale locale, String targetMimeTypeId, boolean cache) throws GeneralException, IOException {
+       renderDataResourceAsText(delegator, dataResourceId, out, templateContext, locale, targetMimeTypeId, cache, null);
+       return out.toString();
+   }
+
+    public static void renderDataResourceAsText(Delegator delegator, String dataResourceId, Appendable out,
+            Map<String, Object> templateContext, Locale locale, String targetMimeTypeId, boolean cache, List<GenericValue> webAnalytics) throws GeneralException, IOException {
         if (dataResourceId == null) {
             throw new GeneralException("Cannot lookup data resource with for a null dataResourceId");
         }
@@ -655,6 +664,19 @@ public class DataResourceWorker  impleme
                     // get the template data for rendering
                     String templateText = getDataResourceText(dataResource, targetMimeTypeId, locale, templateContext, delegator, cache);
 
+                    // if use web analytics.
+                    if (UtilValidate.isNotEmpty(webAnalytics)) {
+                        StringBuffer newTemplateText = new StringBuffer(templateText);
+                        String webAnalyticsCode = "<script language=\"JavaScript\" type=\"text/javascript\">";
+                        for (GenericValue webAnalytic : webAnalytics) {
+                            StringWrapper wrapString = StringUtil.wrapString((String) webAnalytic.get("webAnalyticsCode"));
+                            webAnalyticsCode += wrapString.toString();
+                        }
+                        webAnalyticsCode += "</script>";
+                        newTemplateText.insert(templateText.lastIndexOf("</head>"), webAnalyticsCode);
+                        templateText = newTemplateText.toString();
+                    }
+
                     // render the FTL template
                     FreeMarkerWorker.renderTemplate("DataResource:" + dataResourceId, templateText, templateContext, out);
                 } catch (TemplateException e) {
@@ -673,7 +695,7 @@ public class DataResourceWorker  impleme
                 if (sourceFileLocation != null && sourceFileLocation.exists()) {
                     UtilMisc.copyFile(sourceFileLocation,targetFileLocation);
                 } else {
-                    String defaultVisualThemeId = UtilProperties.getPropertyValue("general", "VISUAL_THEME");
+                    String defaultVisualThemeId = EntityUtilProperties.getPropertyValue("general", "VISUAL_THEME", delegator);
                     if (defaultVisualThemeId != null) {
                         GenericValue themeValue = delegator.findOne("VisualThemeResource", UtilMisc.toMap("visualThemeId", defaultVisualThemeId, "resourceTypeEnumId", "VT_DOCBOOKSTYLESHEET", "sequenceId", "01"), true);
                         sourceFileLocation = new File(System.getProperty("ofbiz.home") + "/themes" + themeValue.get("resourceValue"));

Modified: ofbiz/branches/20111205EmailHandling/applications/content/src/org/ofbiz/content/layout/LayoutEvents.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/20111205EmailHandling/applications/content/src/org/ofbiz/content/layout/LayoutEvents.java?rev=1305581&r1=1305580&r2=1305581&view=diff
==============================================================================
--- ofbiz/branches/20111205EmailHandling/applications/content/src/org/ofbiz/content/layout/LayoutEvents.java (original)
+++ ofbiz/branches/20111205EmailHandling/applications/content/src/org/ofbiz/content/layout/LayoutEvents.java Mon Mar 26 20:56:02 2012
@@ -593,9 +593,7 @@ public class LayoutEvents {
         GenericValue v = delegator.makeValue(entityName);
         GenericPK passedPK = v.getPrimaryKey();
         Collection<String> keyColl = passedPK.getAllKeys();
-        Iterator<String> keyIt = keyColl.iterator();
-        while (keyIt.hasNext()) {
-            String attrName = keyIt.next();
+        for(String attrName : keyColl) {
             String attrVal = (String)request.getAttribute(attrName);
             if (attrVal == null) {
                 attrVal = (String)paramMap.get(attrName);

Modified: ofbiz/branches/20111205EmailHandling/applications/content/src/org/ofbiz/content/search/SearchWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/20111205EmailHandling/applications/content/src/org/ofbiz/content/search/SearchWorker.java?rev=1305581&r1=1305580&r2=1305581&view=diff
==============================================================================
--- ofbiz/branches/20111205EmailHandling/applications/content/src/org/ofbiz/content/search/SearchWorker.java (original)
+++ ofbiz/branches/20111205EmailHandling/applications/content/src/org/ofbiz/content/search/SearchWorker.java Mon Mar 26 20:56:02 2012
@@ -39,9 +39,11 @@ import org.ofbiz.entity.GenericValue;
 import org.ofbiz.service.LocalDispatcher;
 
 import org.apache.lucene.analysis.standard.StandardAnalyzer;
+import org.apache.lucene.analysis.Analyzer;
 import org.apache.lucene.document.Document;
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.index.IndexWriter;
+import org.apache.lucene.index.IndexWriterConfig;
 import org.apache.lucene.index.Term;
 import org.apache.lucene.store.Directory;
 import org.apache.lucene.store.FSDirectory;
@@ -132,16 +134,21 @@ public class SearchWorker {
         }
         // Now create
         IndexWriter writer = null;
+        long savedWriteLockTimeout = IndexWriterConfig.getDefaultWriteLockTimeout();
+        Analyzer analyzer = new StandardAnalyzer(Version.LUCENE_34);
+        IndexWriterConfig conf = new IndexWriterConfig(Version.LUCENE_34, analyzer);
+
         try {
-            writer = new IndexWriter(directory, new StandardAnalyzer(Version.LUCENE_30), false, IndexWriter.MaxFieldLength.UNLIMITED);
-        } catch (Exception e) {
-            writer = new IndexWriter(directory, new StandardAnalyzer(Version.LUCENE_30), true, IndexWriter.MaxFieldLength.UNLIMITED);
+            IndexWriterConfig.setDefaultWriteLockTimeout(2000);
+            writer  = new IndexWriter(directory, conf);
+        } finally {
+            IndexWriterConfig.setDefaultWriteLockTimeout(savedWriteLockTimeout);
         }
 
         for (GenericValue gv : contentList) {
             indexContent(dispatcher, delegator, context, gv, writer);
         }
-        writer.optimize();
+        writer.forceMerge(1);
         writer.close();
     }
 
@@ -173,17 +180,30 @@ public class SearchWorker {
 
     public static void indexContent(LocalDispatcher dispatcher, Delegator delegator, Map<String, Object> context, GenericValue content, String path) throws Exception {
         Directory directory = FSDirectory.open(new File(getIndexPath(path)));
+        long savedWriteLockTimeout = IndexWriterConfig.getDefaultWriteLockTimeout();
+        Analyzer analyzer = new StandardAnalyzer(Version.LUCENE_35);
+        IndexWriterConfig conf = new IndexWriterConfig(Version.LUCENE_35, analyzer);
         IndexWriter writer = null;
         try {
-            writer = new IndexWriter(directory, new StandardAnalyzer(Version.LUCENE_30), false, IndexWriter.MaxFieldLength.UNLIMITED);
+            try {
+                IndexWriterConfig.setDefaultWriteLockTimeout(2000);
+                writer  = new IndexWriter(directory, conf);
+            } finally {
+                IndexWriterConfig.setDefaultWriteLockTimeout(savedWriteLockTimeout);
+            }
             if (Debug.infoOn()) Debug.logInfo("Used old directory:" + directory.toString(), module);
         } catch (FileNotFoundException e) {
-            writer = new IndexWriter(directory, new StandardAnalyzer(Version.LUCENE_30), true, IndexWriter.MaxFieldLength.UNLIMITED);
+            try {
+                IndexWriterConfig.setDefaultWriteLockTimeout(2000);
+                writer  = new IndexWriter(directory, conf);
+            } finally {
+                IndexWriterConfig.setDefaultWriteLockTimeout(savedWriteLockTimeout);
+            }
             if (Debug.infoOn()) Debug.logInfo("Created new directory:" + directory.toString(), module);
         }
 
         indexContent(dispatcher, delegator, context, content, writer);
-        writer.optimize();
+        writer.forceMerge(1);
         writer.close();
     }
 
@@ -211,14 +231,19 @@ public class SearchWorker {
 
     public static void indexDataResource(Delegator delegator, Map<String, Object> context, String id, String path) throws Exception {
         Directory directory = FSDirectory.open(new File(getIndexPath(path)));
+        long savedWriteLockTimeout = IndexWriterConfig.getDefaultWriteLockTimeout();
+        Analyzer analyzer = new StandardAnalyzer(Version.LUCENE_35);
+        IndexWriterConfig conf = new IndexWriterConfig(Version.LUCENE_35, analyzer);
         IndexWriter writer = null;
+
         try {
-            writer = new IndexWriter(directory, new StandardAnalyzer(Version.LUCENE_30), false, IndexWriter.MaxFieldLength.UNLIMITED);
-        } catch (FileNotFoundException e) {
-            writer = new IndexWriter(directory, new StandardAnalyzer(Version.LUCENE_30), true, IndexWriter.MaxFieldLength.UNLIMITED);
+            IndexWriterConfig.setDefaultWriteLockTimeout(2000);
+            writer  = new IndexWriter(directory, conf);
+        } finally {
+            IndexWriterConfig.setDefaultWriteLockTimeout(savedWriteLockTimeout);
         }
         indexDataResource(delegator, context, id, writer);
-        writer.optimize();
+        writer.forceMerge(1);
         writer.close();
     }
 

Modified: ofbiz/branches/20111205EmailHandling/applications/content/src/org/ofbiz/content/survey/PdfSurveyServices.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/20111205EmailHandling/applications/content/src/org/ofbiz/content/survey/PdfSurveyServices.java?rev=1305581&r1=1305580&r2=1305581&view=diff
==============================================================================
--- ofbiz/branches/20111205EmailHandling/applications/content/src/org/ofbiz/content/survey/PdfSurveyServices.java (original)
+++ ofbiz/branches/20111205EmailHandling/applications/content/src/org/ofbiz/content/survey/PdfSurveyServices.java Mon Mar 26 20:56:02 2012
@@ -111,9 +111,7 @@ public class PdfSurveyServices {
             String surveyQuestionCategoryId = (String) createCategoryResultMap.get("surveyQuestionCategoryId");
 
             pdfStamper.setFormFlattening(true);
-            Iterator<String> i = acroFieldMap.keySet().iterator();
-            while (i.hasNext()) {
-                String fieldName = i.next();
+            for(String fieldName : acroFieldMap.keySet()) {
                 AcroFields.Item item = acroFields.getFieldItem(fieldName);
                 int type = acroFields.getFieldType(fieldName);
                 String value = acroFields.getField(fieldName);
@@ -182,9 +180,7 @@ public class PdfSurveyServices {
                     PdfObject tuValue = null;
 
                     Set<PdfName> dictKeys = UtilGenerics.checkSet(dict.getKeys());
-                    Iterator<PdfName> dictKeyIter = dictKeys.iterator();
-                    while (dictKeyIter.hasNext()) {
-                        PdfName dictKeyName = dictKeyIter.next();
+                    for(PdfName dictKeyName : dictKeys) {
                         PdfObject dictObject = dict.get(dictKeyName);
 
                         if ("/Type".equals(dictKeyName.toString())) {
@@ -271,9 +267,7 @@ public class PdfSurveyServices {
             AcroFields fs = s.getAcroFields();
             Map<String, Object> hm = UtilGenerics.checkMap(fs.getFields());
             s.setFormFlattening(true);
-            Iterator<String> i = hm.keySet().iterator();
-            while (i.hasNext()) {
-                String fieldName = i.next();
+            for(String fieldName : hm.keySet()) {
                 //AcroFields.Item item = fs.getFieldItem(fieldName);
                 //int type = fs.getFieldType(fieldName);
                 String value = fs.getField(fieldName);
@@ -327,11 +321,9 @@ public class PdfSurveyServices {
             // Debug code to get the values for setting TDP
     //        String[] sa = fs.getAppearanceStates("TDP");
     //        for (int i=0;i<sa.length;i++)
-    //            Debug.log("Appearance="+sa[i]);
+    //            Debug.logInfo("Appearance="+sa[i]);
 
-            Iterator<String> iter = map.keySet().iterator();
-            while (iter.hasNext()) {
-                String fieldName = iter.next();
+            for(String fieldName : map.keySet()) {
                 String parmValue = fs.getField(fieldName);
                 acroFieldMap.put(fieldName, parmValue);
             }
@@ -370,11 +362,9 @@ public class PdfSurveyServices {
             // Debug code to get the values for setting TDP
     //      String[] sa = fs.getAppearanceStates("TDP");
     //      for (int i=0;i<sa.length;i++)
-    //          Debug.log("Appearance="+sa[i]);
+    //          Debug.logInfo("Appearance="+sa[i]);
 
-            Iterator<String> iter = map.keySet().iterator();
-            while (iter.hasNext()) {
-                String fieldName = iter.next();
+            for(String fieldName : map.keySet()) {
                 String fieldValue = fs.getField(fieldName);
                 Object obj = acroFieldMap.get(fieldName);
                 if (obj instanceof Date) {
@@ -452,10 +442,8 @@ public class PdfSurveyServices {
             PdfWriter.getInstance(document, baos);
 
             List<GenericValue> responses = delegator.findByAnd("SurveyResponseAnswer", UtilMisc.toMap("surveyResponseId", surveyResponseId));
-            Iterator<GenericValue> iter = responses.iterator();
-            while (iter.hasNext()) {
+            for(GenericValue surveyResponseAnswer : responses) {
                 String value = null;
-                GenericValue surveyResponseAnswer = iter.next();
                 String surveyQuestionId = (String) surveyResponseAnswer.get("surveyQuestionId");
                 GenericValue surveyQuestion = delegator.findByPrimaryKey("SurveyQuestion", UtilMisc.toMap("surveyQuestionId", surveyQuestionId));
                 String questionType = surveyQuestion.getString("surveyQuestionTypeId");
@@ -503,9 +491,7 @@ public class PdfSurveyServices {
 
         try {
             List<GenericValue> responses = delegator.findByAnd("SurveyResponseAnswer", UtilMisc.toMap("surveyResponseId", surveyResponseId));
-            Iterator<GenericValue> iter = responses.iterator();
-            while (iter.hasNext()) {
-                GenericValue surveyResponseAnswer = iter.next();
+            for(GenericValue surveyResponseAnswer : responses) {
                 String surveyQuestionId = (String) surveyResponseAnswer.get("surveyQuestionId");
                 GenericValue surveyQuestion = delegator.findByPrimaryKey("SurveyQuestion", UtilMisc.toMap("surveyQuestionId", surveyQuestionId));
                 qAndA.add(UtilMisc.toMap("question", surveyQuestion, "response", surveyResponseAnswer));
@@ -546,10 +532,8 @@ public class PdfSurveyServices {
             }
 
             List<GenericValue> responses = delegator.findByAnd("SurveyResponseAnswer", UtilMisc.toMap("surveyResponseId", surveyResponseId));
-            Iterator<GenericValue> iter = responses.iterator();
-            while (iter.hasNext()) {
+            for(GenericValue surveyResponseAnswer : responses) {
                 String value = null;
-                GenericValue surveyResponseAnswer = iter.next();
                 String surveyQuestionId = (String) surveyResponseAnswer.get("surveyQuestionId");
 
                 GenericValue surveyQuestion = delegator.findByPrimaryKeyCache("SurveyQuestion", UtilMisc.toMap("surveyQuestionId", surveyQuestionId));

Modified: ofbiz/branches/20111205EmailHandling/applications/content/src/org/ofbiz/content/survey/SurveyWrapper.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/20111205EmailHandling/applications/content/src/org/ofbiz/content/survey/SurveyWrapper.java?rev=1305581&r1=1305580&r2=1305581&view=diff
==============================================================================
--- ofbiz/branches/20111205EmailHandling/applications/content/src/org/ofbiz/content/survey/SurveyWrapper.java (original)
+++ ofbiz/branches/20111205EmailHandling/applications/content/src/org/ofbiz/content/survey/SurveyWrapper.java Mon Mar 26 20:56:02 2012
@@ -181,9 +181,7 @@ public class SurveyWrapper {
         }
 
         Map<String, Object> sqaaWithColIdListByMultiRespId = FastMap.newInstance();
-        Iterator<GenericValue> surveyQuestionAndApplIter = surveyQuestionAndAppls.iterator();
-        while (surveyQuestionAndApplIter.hasNext()) {
-            GenericValue surveyQuestionAndAppl = surveyQuestionAndApplIter.next();
+        for(GenericValue surveyQuestionAndAppl : surveyQuestionAndAppls) {
             String surveyMultiRespColId = surveyQuestionAndAppl.getString("surveyMultiRespColId");
             if (UtilValidate.isNotEmpty(surveyMultiRespColId)) {
                 String surveyMultiRespId = surveyQuestionAndAppl.getString("surveyMultiRespId");
@@ -368,9 +366,7 @@ public class SurveyWrapper {
             }
 
             if (UtilValidate.isNotEmpty(answers)) {
-                Iterator<GenericValue> i = answers.iterator();
-                while (i.hasNext()) {
-                    GenericValue answer = i.next();
+                for(GenericValue answer : answers) {
                     answerMap.put(answer.getString("surveyQuestionId"), answer);
                 }
             }
@@ -378,9 +374,7 @@ public class SurveyWrapper {
 
         // get the pass-thru (posted form data)
         if (UtilValidate.isNotEmpty(passThru)) {
-            Iterator<String> i = passThru.keySet().iterator();
-            while (i.hasNext()) {
-                String key = i.next();
+            for(String key : passThru.keySet()) {
                 if (key.toUpperCase().startsWith("ANSWERS_")) {
                     int splitIndex = key.indexOf('_');
                     String questionId = key.substring(splitIndex+1);
@@ -440,9 +434,7 @@ public class SurveyWrapper {
     public Map<String, Object> getResults(List<GenericValue> questions) throws SurveyWrapperException {
         Map<String, Object> questionResults = FastMap.newInstance();
         if (questions != null) {
-            Iterator<GenericValue> i = questions.iterator();
-            while (i.hasNext()) {
-                GenericValue question = i.next();
+            for(GenericValue question : questions) {
                 Map<String, Object> results = getResultInfo(question);
                 if (results != null) {
                     questionResults.put(question.getString("surveyQuestionId"), results);
@@ -484,10 +476,8 @@ public class SurveyWrapper {
                 resultMap.put("_total", questionTotal);
 
                 // create the map of option info ("_total", "_percent")
-                Iterator<String> i = thisResult.keySet().iterator();
-                while (i.hasNext()) {
+                for(String optId : thisResult.keySet()) {
                     Map<String, Object> optMap = FastMap.newInstance();
-                    String optId = i.next();
                     Long optTotal = (Long) thisResult.get(optId);
                     if (optTotal == null) {
                         optTotal = Long.valueOf(0);

Modified: ofbiz/branches/20111205EmailHandling/applications/content/src/org/ofbiz/content/test/LuceneTests.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/20111205EmailHandling/applications/content/src/org/ofbiz/content/test/LuceneTests.java?rev=1305581&r1=1305580&r2=1305581&view=diff
==============================================================================
--- ofbiz/branches/20111205EmailHandling/applications/content/src/org/ofbiz/content/test/LuceneTests.java (original)
+++ ofbiz/branches/20111205EmailHandling/applications/content/src/org/ofbiz/content/test/LuceneTests.java Mon Mar 26 20:56:02 2012
@@ -33,8 +33,8 @@ import org.apache.lucene.search.BooleanC
 import org.apache.lucene.search.BooleanQuery;
 import org.apache.lucene.search.IndexSearcher;
 import org.apache.lucene.search.Query;
-import org.apache.lucene.search.Searcher;
 import org.apache.lucene.search.TopScoreDocCollector;
+import org.apache.lucene.store.Directory;
 import org.apache.lucene.store.FSDirectory;
 import org.apache.lucene.util.Version;
 import org.ofbiz.base.util.UtilGenerics;
@@ -73,14 +73,21 @@ public class LuceneTests extends OFBizTe
     }
 
     public void testSearchTermHand() throws Exception {
+        Directory directory = FSDirectory.open(new File(SearchWorker.getIndexPath(null)));
+        IndexReader r = null;
+        try {
+            r = IndexReader.open(directory, false);
+        } catch (Exception e) {
+            // ignore
+        }
+
         BooleanQuery combQuery = new BooleanQuery();
         String queryLine = "hand";
-        IndexReader reader = IndexReader.open(FSDirectory.open(new File(SearchWorker.getIndexPath(null))), true);
 
-        Searcher searcher = new IndexSearcher(reader);
-        Analyzer analyzer = new StandardAnalyzer(Version.LUCENE_30);
+        IndexSearcher searcher = new IndexSearcher(r);
+        Analyzer analyzer = new StandardAnalyzer(Version.LUCENE_35);
 
-        QueryParser parser = new QueryParser(Version.LUCENE_30, "content", analyzer);
+        QueryParser parser = new QueryParser(Version.LUCENE_35, "content", analyzer);
         Query query = parser.parse(queryLine);
         combQuery.add(query, BooleanClause.Occur.MUST);
 

Modified: ofbiz/branches/20111205EmailHandling/applications/content/src/org/ofbiz/content/view/SimpleContentViewHandler.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/20111205EmailHandling/applications/content/src/org/ofbiz/content/view/SimpleContentViewHandler.java?rev=1305581&r1=1305580&r2=1305581&view=diff
==============================================================================
--- ofbiz/branches/20111205EmailHandling/applications/content/src/org/ofbiz/content/view/SimpleContentViewHandler.java (original)
+++ ofbiz/branches/20111205EmailHandling/applications/content/src/org/ofbiz/content/view/SimpleContentViewHandler.java Mon Mar 26 20:56:02 2012
@@ -131,7 +131,7 @@ public class SimpleContentViewHandler ex
                 // hack for IE and mime types
                 //String userAgent = request.getHeader("User-Agent");
                 //if (userAgent.indexOf("MSIE") > -1) {
-                //    Debug.log("Found MSIE changing mime type from - " + mimeTypeId, module);
+                //    Debug.logInfo("Found MSIE changing mime type from - " + mimeTypeId, module);
                 //    mimeTypeId = "application/octet-stream";
                 //}
                 // setup chararcter encoding and content type

Modified: ofbiz/branches/20111205EmailHandling/applications/content/src/org/ofbiz/content/webapp/ftl/EditRenderSubContentCacheTransform.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/20111205EmailHandling/applications/content/src/org/ofbiz/content/webapp/ftl/EditRenderSubContentCacheTransform.java?rev=1305581&r1=1305580&r2=1305581&view=diff
==============================================================================
--- ofbiz/branches/20111205EmailHandling/applications/content/src/org/ofbiz/content/webapp/ftl/EditRenderSubContentCacheTransform.java (original)
+++ ofbiz/branches/20111205EmailHandling/applications/content/src/org/ofbiz/content/webapp/ftl/EditRenderSubContentCacheTransform.java Mon Mar 26 20:56:02 2012
@@ -167,10 +167,7 @@ public class EditRenderSubContentCacheTr
 
                     templateRoot.put("context", templateCtx);
                     if (Debug.verboseOn()) {
-                        Set<String> kySet = templateCtx.keySet();
-                        Iterator<String> it = kySet.iterator();
-                        while (it.hasNext()) {
-                            Object ky = (Object)it.next();
+                        for(Object ky : templateCtx.keySet()) {
                             Object val = templateCtx.get(ky);
                             Debug.logVerbose("context key: " + ky + " val: " + val, module);
                         }

Modified: ofbiz/branches/20111205EmailHandling/applications/content/webapp/content/WEB-INF/controller.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/20111205EmailHandling/applications/content/webapp/content/WEB-INF/controller.xml?rev=1305581&r1=1305580&r2=1305581&view=diff
==============================================================================
--- ofbiz/branches/20111205EmailHandling/applications/content/webapp/content/WEB-INF/controller.xml (original)
+++ ofbiz/branches/20111205EmailHandling/applications/content/webapp/content/WEB-INF/controller.xml Mon Mar 26 20:56:02 2012
@@ -745,7 +745,7 @@ under the License.
         <response name="success" type="view" value="EditDataResourceRole"/>
         <response name="error" type="view" value="EditDataResourceRole"/>
     </request-map>
-	
+
     <!-- ================ DataResourceProductFeature Requests ================= -->
     <request-map uri="EditDataResourceProductFeatures">
         <security auth="true" https="true"/>

Modified: ofbiz/branches/20111205EmailHandling/applications/content/widget/content/ContentForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/20111205EmailHandling/applications/content/widget/content/ContentForms.xml?rev=1305581&r1=1305580&r2=1305581&view=diff
==============================================================================
--- ofbiz/branches/20111205EmailHandling/applications/content/widget/content/ContentForms.xml (original)
+++ ofbiz/branches/20111205EmailHandling/applications/content/widget/content/ContentForms.xml Mon Mar 26 20:56:02 2012
@@ -119,13 +119,8 @@ under the License.
     <form name="ListLookupContent" extends="ListContent" type="list" list-name="listIt" paginate-target="LookupContent"
         odd-row-style="alternate-row" default-table-style="basic-table hover-bar">
         <actions>
-            <service service-name="performFind" result-map="result" result-map-list="listIt">
-                <field-map field-name="inputFields" from-field="parameters"/>
-                <field-map field-name="entityName" value="Content"/>
-                <field-map field-name="orderBy" value="contentId"/>
-                <field-map field-name="viewIndex" from-field="viewIndex"/>
-                <field-map field-name="viewSize" from-field="viewSize"/>
-            </service>
+            <set field="parameters.sortField" from-field="parameters.sortField" default-value="contentId"/>
+            <call-parent-actions/>
         </actions>
         <field name="contentId">
             <hyperlink also-hidden="false" target-type="plain" description="${contentId}" target="javascript:set_value('${contentId}')"/>

Modified: ofbiz/branches/20111205EmailHandling/applications/content/widget/content/ContentScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/20111205EmailHandling/applications/content/widget/content/ContentScreens.xml?rev=1305581&r1=1305580&r2=1305581&view=diff
==============================================================================
--- ofbiz/branches/20111205EmailHandling/applications/content/widget/content/ContentScreens.xml (original)
+++ ofbiz/branches/20111205EmailHandling/applications/content/widget/content/ContentScreens.xml Mon Mar 26 20:56:02 2012
@@ -86,7 +86,6 @@ under the License.
     <screen name="navigateContent">
         <section>
             <actions>
-                <set field="layoutSettings.javaScripts[+0]" value="/images/jquery/jquery-1.7.min.js" global="true"/>
                 <set field="titleProperty" value="PageTitleNavigateContent"/>
                 <set field="tabButtonItem" value="navigateContent"/>
                 <set field="labelTitleProperty" value="PageTitleNavigateContent"/>

Modified: ofbiz/branches/20111205EmailHandling/applications/humanres/config/HumanResUiLabels.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/20111205EmailHandling/applications/humanres/config/HumanResUiLabels.xml?rev=1305581&r1=1305580&r2=1305581&view=diff
==============================================================================
--- ofbiz/branches/20111205EmailHandling/applications/humanres/config/HumanResUiLabels.xml (original)
+++ ofbiz/branches/20111205EmailHandling/applications/humanres/config/HumanResUiLabels.xml Mon Mar 26 20:56:02 2012
@@ -786,7 +786,7 @@
     <property key="HumanResAddPersonTraining">
         <value xml:lang="de">Personenschulung hinzufügen</value>
         <value xml:lang="en">Add Person Training</value>
-        <value xml:lang="fr">Ajouter la formation de la personne</value>
+        <value xml:lang="fr">Ajouter une formation</value>
         <value xml:lang="it">Aggiungi corsi persona</value>
         <value xml:lang="pt_BR">Adicionar treinamento para pessoa</value>
         <value xml:lang="zh">新建个人培训</value>
@@ -918,7 +918,7 @@
     </property>
     <property key="HumanResCurrentEmploymentData">
         <value xml:lang="en">Current Employment information</value>
-        <value xml:lang="fr">Information actuelles sur l'emploi</value>
+        <value xml:lang="fr">Informations actuelles sur l'emploi</value>
         <value xml:lang="it">Informazioni attuali sull'impiego</value>
         <value xml:lang="pt_BR">Informação atual de empregado</value>
         <value xml:lang="zh">当前雇佣关系信息</value>
@@ -1486,6 +1486,10 @@
         <value xml:lang="pt_BR">Licença</value>
         <value xml:lang="zh">离职</value>
     </property>
+    <property key="HumanResLeaveCreationSuccess">
+        <value xml:lang="en">Leave request created successfully</value>
+        <value xml:lang="fr">Demande de congés créée avec succès</value>
+    </property>
     <property key="HumanResListEmployments">
         <value xml:lang="en">List Employment</value>
         <value xml:lang="fr">Liste d'emplois</value>
@@ -1735,6 +1739,14 @@
         <value xml:lang="zh">人力资源管理系统</value>
         <value xml:lang="zh_TW">人力資源管理系統</value>
     </property>
+    <property key="HumanResMyLeaves">
+        <value xml:lang="en">My Leaves</value>
+        <value xml:lang="fr">Mes congés</value>
+    </property>
+    <property key="HumanResMyTrainings">
+        <value xml:lang="en">My Trainings</value>
+        <value xml:lang="fr">Mes formations</value>
+    </property>
     <property key="HumanResNewEmplPosition">
         <value xml:lang="de">Stelle anlegen</value>
         <value xml:lang="en">New Employee Position</value>
@@ -2089,6 +2101,7 @@
     </property>
     <property key="HumanResPayRollHistory">
         <value xml:lang="en">PayRoll History</value>
+        <value xml:lang="fr">Historiques des paiements</value>
         <value xml:lang="zh">薪水支付历史</value>
     </property>
     <property key="HumanResPayRollPreferences">
@@ -2540,6 +2553,10 @@
         <value xml:lang="pt_BR">Procurar aprovações de treinamento</value>
         <value xml:lang="zh">查找培训批准</value>
     </property>
+    <property key="PageTitleFindTrainingCalendar">
+        <value xml:lang="en">Find Training Calendar</value>
+        <value xml:lang="fr">Calendrier de formation</value>
+    </property>
     <property key="PageTitleFindTrainingStatus">
         <value xml:lang="en">Find Training Status</value>
         <value xml:lang="fr">Rechercher les états de formation</value>

Modified: ofbiz/branches/20111205EmailHandling/applications/humanres/data/HumanResTypeData.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/20111205EmailHandling/applications/humanres/data/HumanResTypeData.xml?rev=1305581&r1=1305580&r2=1305581&view=diff
==============================================================================
--- ofbiz/branches/20111205EmailHandling/applications/humanres/data/HumanResTypeData.xml (original)
+++ ofbiz/branches/20111205EmailHandling/applications/humanres/data/HumanResTypeData.xml Mon Mar 26 20:56:02 2012
@@ -50,11 +50,15 @@ under the License.
     <StatusItem statusId="STATUS_RELOCATED" statusTypeId="RELOCATION_STATUS"  description="Relocated"/>
     
     <StatusType statusTypeId="TRAINING_STATUS" description="Training Status"/>
+    <StatusItem statusId="TRAINING_APPLIED" statusTypeId="TRAINING_STATUS"  description="Applied"/>
     <StatusItem statusId="TRAINING_APPROVED" statusTypeId="TRAINING_STATUS"  description="Approved"/>
+    <StatusItem statusId="TRAINING_ASSIGNED" statusTypeId="TRAINING_STATUS"  description="Assigned"/>
+    <StatusItem statusId="TRAINING_PROPOSED" statusTypeId="TRAINING_STATUS"  description="Proposed"/>
     <StatusItem statusId="TRAINING_REJECTED" statusTypeId="TRAINING_STATUS"  description="Rejected"/>
 
     <StatusType statusTypeId="LEAVE_STATUS" description="Employee Leave Status"/>
     <StatusItem statusId="LEAVE_APPROVED" statusTypeId="LEAVE_STATUS"  description="Approved"/>
+    <StatusItem statusId="LEAVE_CREATED" statusTypeId="LEAVE_STATUS"  description="Created"/>
     <StatusItem statusId="LEAVE_REJECTED" statusTypeId="LEAVE_STATUS"  description="Rejected"/>
 
     <EmplPositionType description="Programmer" hasTable="N" parentTypeId="" emplPositionTypeId="PROGRAMMER"/>
@@ -149,8 +153,8 @@ under the License.
     <Enumeration description="Technical Exam" enumCode="TECHNICAL" enumId="EXAM_TECHNICAL" sequenceId="02" enumTypeId="EXAM_TYPE"/>
     <Enumeration description="Group Discussion" enumCode="GROUP_DISCN" enumId="EXAM_GROUP_DISCN" sequenceId="03" enumTypeId="EXAM_TYPE"/>
     
-    <EmplLeaveReasonType description="Medical" hasTable="N" parentTypeId="" emplLeaveReasonTypeId="Fever"/>
-    <EmplLeaveReasonType description="Casual" hasTable="N" parentTypeId="" emplLeaveReasonTypeId="Personal Work"/>
+    <EmplLeaveReasonType emplLeaveReasonTypeId="MEDICAL" description="Medical" hasTable="N"/>
+    <EmplLeaveReasonType emplLeaveReasonTypeId="CASUAL" description="Casual" hasTable="N"/>
 
     <PerfReviewItemType perfReviewItemTypeId="TECH" hasTable="N" description="Technical skills"/>
     <PerfReviewItemType perfReviewItemTypeId="RESP" hasTable="N" description="Responsibility"/>

Modified: ofbiz/branches/20111205EmailHandling/applications/humanres/entitydef/entitymodel.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/20111205EmailHandling/applications/humanres/entitydef/entitymodel.xml?rev=1305581&r1=1305580&r2=1305581&view=diff
==============================================================================
--- ofbiz/branches/20111205EmailHandling/applications/humanres/entitydef/entitymodel.xml (original)
+++ ofbiz/branches/20111205EmailHandling/applications/humanres/entitydef/entitymodel.xml Mon Mar 26 20:56:02 2012
@@ -40,7 +40,9 @@ under the License.
   <!-- org.ofbiz.humanres.ability -->
   <!-- ========================================================= -->
 
-    <entity entity-name="PartyQual" package-name="org.ofbiz.humanres.ability" title="Party Qualification Entity">
+    <entity entity-name="PartyQual"
+            package-name="org.ofbiz.humanres.ability"
+            title="Party Qualification Entity">
         <field name="partyId" type="id-ne"></field>
         <field name="partyQualTypeId" type="id-ne"></field>
         <field name="qualificationDesc" type="id-long"></field>
@@ -313,8 +315,8 @@ under the License.
       </relation>
     </entity>
     <view-entity entity-name="BenefitTypeAndParty"
-      package-name="org.ofbiz.humanres.employment"
-      title="Benefit Type Entity">
+             package-name="org.ofbiz.humanres.employment"
+             title="Benefit Type Entity">
       <member-entity entity-alias="BT" entity-name="BenefitType"/>
       <member-entity entity-alias="PB" entity-name="PartyBenefit"/>
       <alias-all entity-alias="BT"/>
@@ -367,8 +369,8 @@ under the License.
       </relation>
     </entity>
     <view-entity entity-name="EmploymentAndPerson"
-        package-name="org.ofbiz.humanres.employment"
-        title="Employment and Person Entity">
+            package-name="org.ofbiz.humanres.employment"
+            title="Employment and Person Entity">
         <member-entity entity-alias="EMPLMNT" entity-name="Employment"/>
         <member-entity entity-alias="PERS" entity-name="Person"/>
         <alias-all entity-alias="EMPLMNT"/>
@@ -434,7 +436,7 @@ under the License.
         <field name="fromDate" type="date-time"/>
         <field name="thruDate" type="date-time"/>
         <field name="approverPartyId" type="id-ne"/>
-          <field name="leaveStatus" type="short-varchar"/>
+        <field name="leaveStatus" type="id-ne"/>
         <field name="description" type="description"/>
         <prim-key field="partyId"/>
         <prim-key field="leaveTypeId"/>
@@ -451,9 +453,13 @@ under the License.
         <relation type="one" fk-name="EMPL_LEAVE_APPR" title="Approver" rel-entity-name="Party">
             <key-map field-name="approverPartyId" rel-field-name="partyId"/>
         </relation>
+        <relation type="one" fk-name="EMPL_LEAVE_STS" rel-entity-name="StatusItem">
+            <key-map field-name="leaveStatus" rel-field-name="statusId"/>
+        </relation>
     </entity>
     <entity entity-name="EmplLeaveType"
             package-name="org.ofbiz.humanres.employment"
+            default-resource-name="HumanResEntityLabels"
             title="Employee Leave Type Entity">
         <field name="leaveTypeId" type="id-ne"/>
         <field name="parentTypeId" type="id-ne"/>
@@ -711,8 +717,8 @@ under the License.
       </relation>
     </entity>
     <view-entity entity-name="EmplPositionAndFulfillment"
-      package-name="org.ofbiz.humanres.position"
-      title="EmplPosition Fulfillment Entity">
+            package-name="org.ofbiz.humanres.position"
+            title="EmplPosition Fulfillment Entity">
       <member-entity entity-alias="EMPPOS" entity-name="EmplPosition"></member-entity>
       <member-entity entity-alias="EPF" entity-name="EmplPositionFulfillment"></member-entity>
       <alias-all entity-alias="EMPPOS"/>
@@ -726,7 +732,7 @@ under the License.
         <key-map field-name="emplPositionTypeId"/>
       </relation>
     </view-entity>
-  <entity entity-name="EmplPositionReportingStruct"
+    <entity entity-name="EmplPositionReportingStruct"
             package-name="org.ofbiz.humanres.position"
             title="EmplPosition Reporting Structure Entity">
       <field name="emplPositionIdReportingTo" type="id-ne"></field>
@@ -811,9 +817,9 @@ under the License.
         <key-map field-name="responsibilityTypeId"/>
       </relation>
     </entity>
-  <entity entity-name="EmplPositionTypeRate" table-name="EMPL_POSITION_TYPE_RATE_NEW"
-    package-name="org.ofbiz.humanres.position"
-    title="EmplPosition Type Rate Entity">
+    <entity entity-name="EmplPositionTypeRate" table-name="EMPL_POSITION_TYPE_RATE_NEW"
+            package-name="org.ofbiz.humanres.position"
+            title="EmplPosition Type Rate Entity">
     <field name="emplPositionTypeId" type="id-ne"/>
     <field name="rateTypeId" type="id-ne"/>
     <field name="payGradeId" type="id"/>
@@ -835,8 +841,8 @@ under the License.
     </relation>
   </entity>
   <view-entity entity-name="EmplPositionTypeRateAndAmount"
-    package-name="org.ofbiz.humanres.position"
-    title="EmplPosition Type Rate Entity and Rate Amount">
+        package-name="org.ofbiz.humanres.position"
+        title="EmplPosition Type Rate Entity and Rate Amount">
     <member-entity entity-alias="EPTR" entity-name="EmplPositionTypeRate"/>
     <member-entity entity-alias="RA" entity-name="RateAmount"/>
     <alias-all entity-alias="EPTR"/>
@@ -943,6 +949,7 @@ under the License.
     </entity>
     <entity entity-name="EmplLeaveReasonType"
             package-name="org.ofbiz.humanres.employment"
+            default-resource-name="HumanResEntityLabels"
             title="Leave Reason Type Entity">
         <field name="emplLeaveReasonTypeId" type="id-ne"/>
         <field name="parentTypeId" type="id-ne"/>

Modified: ofbiz/branches/20111205EmailHandling/applications/humanres/ofbiz-component.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/20111205EmailHandling/applications/humanres/ofbiz-component.xml?rev=1305581&r1=1305580&r2=1305581&view=diff
==============================================================================
--- ofbiz/branches/20111205EmailHandling/applications/humanres/ofbiz-component.xml (original)
+++ ofbiz/branches/20111205EmailHandling/applications/humanres/ofbiz-component.xml Mon Mar 26 20:56:02 2012
@@ -29,6 +29,7 @@ under the License.
     <entity-resource type="data" reader-name="seed" loader="main" location="data/HumanResTypeData.xml"/>
     <entity-resource type="data" reader-name="seed" loader="main" location="data/HumanResHelpData.xml"/>
     <entity-resource type="data" reader-name="seed" loader="main" location="data/HumanResSecurityData.xml"/>
+    <entity-resource type="data" reader-name="seed" loader="main" location="data/HumanResPortletData.xml"/>
     <entity-resource type="data" reader-name="demo" loader="main" location="data/HumanResDemoData.xml"/>
     <service-resource type="model" loader="main" location="servicedef/services.xml"/>
 

Modified: ofbiz/branches/20111205EmailHandling/applications/humanres/script/org/ofbiz/humanres/HumanResServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/20111205EmailHandling/applications/humanres/script/org/ofbiz/humanres/HumanResServices.xml?rev=1305581&r1=1305580&r2=1305581&view=diff
==============================================================================
--- ofbiz/branches/20111205EmailHandling/applications/humanres/script/org/ofbiz/humanres/HumanResServices.xml (original)
+++ ofbiz/branches/20111205EmailHandling/applications/humanres/script/org/ofbiz/humanres/HumanResServices.xml Mon Mar 26 20:56:02 2012
@@ -660,6 +660,8 @@
         <set-nonpk-fields value-field="newEntity" map="parameters"/>
         <create-value value-field="newEntity"/>
         <check-errors/>
+        <property-to-field resource="HumanResUiLabels" property="HumanResLeaveCreationSuccess" field="successMessage"/>
+        <field-to-result field="responseMessage" result-name="successMessage"/>
     </simple-method>
 
     <simple-method method-name="updateEmplLeave" short-description="Update Employee Leave">

Modified: ofbiz/branches/20111205EmailHandling/applications/humanres/widget/EmployeeScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/20111205EmailHandling/applications/humanres/widget/EmployeeScreens.xml?rev=1305581&r1=1305580&r2=1305581&view=diff
==============================================================================
--- ofbiz/branches/20111205EmailHandling/applications/humanres/widget/EmployeeScreens.xml (original)
+++ ofbiz/branches/20111205EmailHandling/applications/humanres/widget/EmployeeScreens.xml Mon Mar 26 20:56:02 2012
@@ -122,6 +122,7 @@ under the License.
                                             <include-screen name="Party" location="component://party/widget/partymgr/ProfileScreens.xml"/>
                                             <include-screen name="Contact" location="component://party/widget/partymgr/ProfileScreens.xml"/>
                                             <include-screen name="contactsAndAccounts" location="component://party/widget/partymgr/ProfileScreens.xml"/>
+                                            <include-screen name="trainingsList"/>
                                         </container>
                                         <container style="profile-right">
                                             <include-screen name="CurrentEmploymentData" location="component://humanres/widget/EmployeeScreens.xml"/>
@@ -298,6 +299,16 @@ under the License.
         </section>
     </screen>
     
+    <screen name="trainingsList">
+        <section>
+            <widgets>
+                <screenlet title="${uiLabelMap.HumanResTrainings}">
+                    <include-form name="simpleListTrainingStatus" location="component://humanres/widget/forms/PersonTrainingForms.xml"/>
+                </screenlet>
+            </widgets>
+        </section>
+    </screen>
+
     <screen name="PayrollHistory">
         <section>
             <actions>
@@ -322,4 +333,29 @@ under the License.
             </widgets>
         </section>
     </screen>
+
+    <screen name="MyLeaveList">
+        <section>
+            <actions>
+                <set field="partyId" from-field="userLogin.partyId"/>
+            </actions>
+            <widgets>
+                <screenlet title="${uiLabelMap.HumanResMyLeaves}" navigation-form-name="ListEmplLeaves">
+                    <include-form name="ListEmplLeaves" location="component://humanres/widget/forms/EmployeeForms.xml"/>
+                </screenlet>
+            </widgets>
+        </section>
+    </screen>
+    <screen name="MyTrainings">
+        <section>
+            <actions>
+                <set field="partyId" from-field="userLogin.partyId"/>
+            </actions>
+            <widgets>
+                <screenlet title="${uiLabelMap.HumanResMyTrainings}">
+                    <include-form name="ListEmplTrainings" location="component://humanres/widget/forms/PersonTrainingForms.xml"/>
+                </screenlet>
+            </widgets>
+        </section>
+    </screen>
 </screens>

Modified: ofbiz/branches/20111205EmailHandling/applications/humanres/widget/PersonTrainingScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/20111205EmailHandling/applications/humanres/widget/PersonTrainingScreens.xml?rev=1305581&r1=1305580&r2=1305581&view=diff
==============================================================================
--- ofbiz/branches/20111205EmailHandling/applications/humanres/widget/PersonTrainingScreens.xml (original)
+++ ofbiz/branches/20111205EmailHandling/applications/humanres/widget/PersonTrainingScreens.xml Mon Mar 26 20:56:02 2012
@@ -23,7 +23,6 @@
     <screen name="TrainingCalendar">
         <section>
             <actions>
-                <set field="titleProperty" value="PageTitleFindTrainingCalendar"/>
                 <set field="parameters.period" from-field="parameters.period" default-value="${initialView}"/>
             </actions>
             <widgets>

Modified: ofbiz/branches/20111205EmailHandling/applications/humanres/widget/forms/EmplLeaveForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/20111205EmailHandling/applications/humanres/widget/forms/EmplLeaveForms.xml?rev=1305581&r1=1305580&r2=1305581&view=diff
==============================================================================
--- ofbiz/branches/20111205EmailHandling/applications/humanres/widget/forms/EmplLeaveForms.xml (original)
+++ ofbiz/branches/20111205EmailHandling/applications/humanres/widget/forms/EmplLeaveForms.xml Mon Mar 26 20:56:02 2012
@@ -66,6 +66,8 @@
                 </sub-hyperlink>
             </display-entity>
         </field>
+        <field name="leaveTypeId"><display-entity entity-name="EmplLeaveType"/></field>
+        <field name="emplLeaveReasonTypeId"><display-entity entity-name="EmplLeaveReasonType"/></field>
         <field name="approverPartyId">
             <display-entity entity-name="PartyNameView" description="${firstName} ${lastName}" key-field-name="partyId">
                 <sub-hyperlink target="/partymgr/control/viewprofile" target-type="inter-app" description="${approverPartyId}" link-style="buttontext">
@@ -73,7 +75,7 @@
                 </sub-hyperlink>
             </display-entity>
         </field>
-        <field name="leaveStatus"><display/></field>
+        <field name="leaveStatus"><display-entity entity-name="StatusItem" key-field-name="statusId"/></field>
         <field name="updateLeave" title="${uiLabelMap.CommonUpdate}" widget-style="buttontext" use-when="hasAdminPermission">
             <hyperlink also-hidden="false" description="${uiLabelMap.CommonUpdate}" target="EditEmplLeave">
                 <parameter param-name="partyId"/>
@@ -89,7 +91,7 @@
             </hyperlink>
         </field>
         <field name="description"><hidden/></field>
-      </form>
+    </form>
     <form name="EditEmplLeave" type="single" target="updateEmplLeaveExt" default-map-name="leaveApp"
         header-row-style="header-row" default-table-style="basic-table">
         <alt-target use-when="leaveApp==null" target="createEmplLeaveExt"/>
@@ -112,7 +114,7 @@
         <field name="submitButton" use-when="leaveApp==null" title="${uiLabelMap.CommonCreate}" widget-style="smallSubmit"><submit button-type="button"/></field>
         <field name="submitButton" use-when="leaveApp!=null" title="${uiLabelMap.CommonUpdate}" widget-style="smallSubmit"><submit button-type="button"/></field>
     </form>
-   <form name="FindLeaveApprovals" target="FindLeaveApprovals" type="single">
+    <form name="FindLeaveApprovals" target="FindLeaveApprovals" type="single">
         <auto-fields-entity entity-name="EmplLeave" default-field-type="find"/>
         <field name="noConditionFind"><hidden value="Y"/></field>
         <!--<field name="approverPartyId" use-when="!hasAdminPermission"><hidden value="${approverPartyId}"/></field>-->
@@ -144,6 +146,8 @@
                 </sub-hyperlink>
             </display-entity>
         </field>
+        <field name="leaveTypeId"><display-entity entity-name="EmplLeaveType"/></field>
+        <field name="emplLeaveReasonTypeId"><display-entity entity-name="EmplLeaveReasonType"/></field>
         <field name="approverPartyId" field-name="approverPartyId">
             <display-entity entity-name="PartyNameView" description="${firstName} ${lastName}" key-field-name="partyId">
                 <sub-hyperlink target="/partymgr/control/viewprofile" target-type="inter-app" description="${approverPartyId}" link-style="buttontext">
@@ -151,7 +155,7 @@
                 </sub-hyperlink>
             </display-entity>
         </field>
-        <field name="leaveStatus"><display/></field>
+        <field name="leaveStatus"><display-entity entity-name="StatusItem" key-field-name="statusId"/></field>
         <field name="UpdateStatus" title="${uiLabelMap.CommonUpdate}" widget-style="buttontext">
             <hyperlink target="EditEmplLeaveStatus" description="${uiLabelMap.CommonUpdate}" >
                 <parameter param-name="partyId"/>

Modified: ofbiz/branches/20111205EmailHandling/applications/humanres/widget/forms/EmployeeForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/20111205EmailHandling/applications/humanres/widget/forms/EmployeeForms.xml?rev=1305581&r1=1305580&r2=1305581&view=diff
==============================================================================
--- ofbiz/branches/20111205EmailHandling/applications/humanres/widget/forms/EmployeeForms.xml (original)
+++ ofbiz/branches/20111205EmailHandling/applications/humanres/widget/forms/EmployeeForms.xml Mon Mar 26 20:56:02 2012
@@ -214,7 +214,7 @@
         <auto-fields-service service-name="updateEmplLeave"/>
         <field name="partyId"><hidden/></field>
         <field name="approverPartyId"><lookup target-form-name="LookupPartyName"/></field>
-        <field name="leaveStatus"><display/></field>
+        <field name="leaveStatus"><display-entity entity-name="StatusItem" key-field-name="statusId"/></field>
         <field name="emplLeaveReasonTypeId"><display/></field>
         <field name="leaveTypeId"><display-entity description="${description}" entity-name="EmplLeaveType"/></field>
         <field name="fromDate"></field>

Modified: ofbiz/branches/20111205EmailHandling/applications/humanres/widget/forms/PersonTrainingForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/20111205EmailHandling/applications/humanres/widget/forms/PersonTrainingForms.xml?rev=1305581&r1=1305580&r2=1305581&view=diff
==============================================================================
--- ofbiz/branches/20111205EmailHandling/applications/humanres/widget/forms/PersonTrainingForms.xml (original)
+++ ofbiz/branches/20111205EmailHandling/applications/humanres/widget/forms/PersonTrainingForms.xml Mon Mar 26 20:56:02 2012
@@ -61,7 +61,7 @@ under the License.
         <field name="approvalStatus"><hidden value="TRAINING_ASSIGNED"/></field>
         <field name="partyId" position="1"><lookup target-form-name="LookupPartyName" size="10"/></field>
         <field name="roleTypeId"> <hidden value="CAL_ATTENDEE"/></field>
-        <field name="add"><submit/></field>
+        <field name="add" title="${uiLabelMap.CommonAdd}"><submit/></field>
     </form>
     <form name="ListTrainingParticipants" list-name="listIt" title="" type="list" odd-row-style="alternate-row" header-row-style="header-row-2" default-table-style="basic-table hover-bar">
         <actions>
@@ -80,9 +80,9 @@ under the License.
                 </sub-hyperlink>
             </display-entity>
         </field>
-        <field name="approvalStatus"><display/></field>
-        <field name="trainingRequestId" widget-style="buttontext"/>
-        <field name="trainingClassTypeId" title="${uiLabelMap.HumanResTrainingClassType}"><display/></field>
+        <field name="approvalStatus"><display-entity entity-name="StatusItem" key-field-name="statusId"/></field>
+        <field name="trainingRequestId" widget-style="buttontext"><display/></field>
+        <field name="trainingClassTypeId"><display-entity entity-name="TrainingClassType"/></field>
     </form>
     <form name="FindTrainingApprovals" target="FindTrainingApprovals" title="" type="single" default-title-style="tableheadtext" default-tooltip-style="tabletext" default-widget-style="inputBox">
         <auto-fields-entity entity-name="PersonTraining" default-field-type="find"/>
@@ -133,6 +133,8 @@ under the License.
                 <parameter param-name="fromDate"/>
             </hyperlink>
         </field>
+        <field name="approvalStatus"><display-entity entity-name="StatusItem" key-field-name="statusId"/></field>
+        <field name="trainingClassTypeId"><display-entity entity-name="TrainingClassType"/></field>
     </form>
     <form name="EditTrainingApprovals" type="single" target="updateTrainingStatus" default-map-name="personTraining">
         <auto-fields-service service-name="updateTrainingStatus" default-field-type="display"/>
@@ -193,5 +195,48 @@ under the License.
         </field>
         <field name="trainingRequestId" widget-style="buttontext"/>
         <field name="trainingClassTypeId" title="${uiLabelMap.HumanResTrainingClassType}"/>
+        <field name="approvalStatus"><display-entity entity-name="StatusItem" key-field-name="statusId"/></field>
+        <field name="trainingClassTypeId"><display-entity entity-name="TrainingClassType"/></field>
+    </form>
+
+    <form name="simpleListTrainingStatus" list-name="listIt" title="" type="list" odd-row-style="alternate-row" default-table-style="basic-table">
+        <actions>
+            <service service-name="performFind" result-map="result" result-map-list="listIt">
+                <field-map field-name="inputFields" from-field="parameters"/>
+                <field-map field-name="entityName" value="PersonTraining"/>
+                <field-map field-name="orderBy" value="fromDate"/>
+                <field-map field-name="viewIndex" from-field="viewIndex"/>
+                <field-map field-name="viewSize" from-field="viewSize"/>
+            </service>
+        </actions>
+        <field name="fromDate"><display type="date-time"/></field>
+        <field name="thruDate"><display type="date-time"/></field>
+        <field name="trainingClassTypeId" title="${uiLabelMap.HumanResTrainingClassType}"/>
+        <field name="approvalStatus"><display-entity entity-name="StatusItem" key-field-name="statusId"/></field>
+        <field name="trainingClassTypeId"><display-entity entity-name="TrainingClassType"/></field>
+        <field name="approverId" widget-style="buttontext">
+            <display-entity entity-name="PartyNameView" key-field-name="partyId" description="${firstName} ${middleName} ${lastName} ${groupName}"/>
+        </field>
+    </form>
+
+    <form name="ListEmplTrainings" type="list" list-name="listIt" separate-columns="true" target="updateEmplLeave" paginate-target="FindEmplLeaves"
+        odd-row-style="alternate-row" header-row-style="header-row-2" default-table-style="basic-table hover-bar">
+        <actions>
+            <entity-condition entity-name="PersonTraining">
+                <condition-expr field-name="partyId" from-field="partyId"/>
+                <order-by field-name="fromDate"/>
+            </entity-condition>
+        </actions>
+        <auto-fields-entity entity-name="PersonTraining" default-field-type="display"/>
+        <field name="partyId" title="${uiLabelMap.FormFieldTitle_employeePartyId}">
+            <display-entity entity-name="PartyNameView" description="${firstName} ${middleName} ${lastName} ${groupName}"/>
+        </field>
+        <field name="approverId">
+            <display-entity entity-name="PartyNameView" key-field-name="partyId" description="${firstName} ${middleName} ${lastName} ${groupName}"/>
+        </field>
+        <field name="trainingRequestId"/>
+        <field name="trainingClassTypeId" title="${uiLabelMap.HumanResTrainingClassType}"/>
+        <field name="approvalStatus"><display-entity entity-name="StatusItem" key-field-name="statusId"/></field>
+        <field name="trainingClassTypeId"><display-entity entity-name="TrainingClassType"/></field>
     </form>
 </forms>

Modified: ofbiz/branches/20111205EmailHandling/applications/manufacturing/data/ManufacturingExampleData.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/20111205EmailHandling/applications/manufacturing/data/ManufacturingExampleData.xml?rev=1305581&r1=1305580&r2=1305581&view=diff
==============================================================================
--- ofbiz/branches/20111205EmailHandling/applications/manufacturing/data/ManufacturingExampleData.xml (original)
+++ ofbiz/branches/20111205EmailHandling/applications/manufacturing/data/ManufacturingExampleData.xml Mon Mar 26 20:56:02 2012
@@ -45,6 +45,11 @@ under the License.
     <FixedAsset fixedAssetId="DEMO_PROD_EQUIPMT_2" fixedAssetName="Demo Production Equipment Two" fixedAssetTypeId="PRODUCTION_EQUIPMENT" dateAcquired="2005-01-01 00:01:00.0" expectedEndOfLife="2010-01-01" calendarId="DEMO_CALENDAR" salvageValue="50" purchaseCost="1000" purchaseCostUomId="USD"/>
     <FixedAssetGeoPoint fixedAssetId="DEMO_PROD_EQUIPMT_2" geoPointId="9000" fromDate="2009-01-09 00:00:00.000"/>
 
+    <FixedAsset fixedAssetId="DEMO_BOOK_GROUP" fixedAssetTypeId="GROUP_EQUIPMENT" fixedAssetName="Demo Book Group"/>
+    <FixedAssetGeoPoint fixedAssetId="DEMO_BOOK_GROUP" geoPointId="9000" fromDate="2011-08-02 00:00:00.000"/>
+    <FixedAsset fixedAssetId="DEMO_BOOK" fixedAssetName="Demo Book" fixedAssetTypeId="PRODUCTION_EQUIPMENT" parentFixedAssetId="DEMO_BOOK_GROUP" calendarId="DEMO_CALENDAR" purchaseCost="200" purchaseCostUomId="USD"/>
+    <FixedAssetGeoPoint fixedAssetId="DEMO_BOOK" geoPointId="9000" fromDate="2011-08-02 00:00:00.000"/>
+
     <FixedAssetDepMethod depreciationCustomMethodId="STR_LINE_DEP_FORMULA" fixedAssetId="DEMO_PROD_EQUIPMT_1"/>
     <FixedAssetDepMethod depreciationCustomMethodId="DBL_DECL_DEP_FORMULA" fixedAssetId="DEMO_PROD_EQUIPMT_2"/>
 </entity-engine-xml>

Modified: ofbiz/branches/20111205EmailHandling/applications/manufacturing/script/org/ofbiz/manufacturing/test/ProductionRunTests.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/20111205EmailHandling/applications/manufacturing/script/org/ofbiz/manufacturing/test/ProductionRunTests.xml?rev=1305581&r1=1305580&r2=1305581&view=diff
==============================================================================
--- ofbiz/branches/20111205EmailHandling/applications/manufacturing/script/org/ofbiz/manufacturing/test/ProductionRunTests.xml (original)
+++ ofbiz/branches/20111205EmailHandling/applications/manufacturing/script/org/ofbiz/manufacturing/test/ProductionRunTests.xml Mon Mar 26 20:56:02 2012
@@ -278,7 +278,6 @@ under the License.
                 <if-compare field="taskTimeDifference" operator="equals" value="-1.0" type="Double"/>
             </or>
         </assert>
-
         <check-errors/>
     </simple-method>
 

Modified: ofbiz/branches/20111205EmailHandling/applications/manufacturing/src/org/ofbiz/manufacturing/bom/BOMHelper.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/20111205EmailHandling/applications/manufacturing/src/org/ofbiz/manufacturing/bom/BOMHelper.java?rev=1305581&r1=1305580&r2=1305581&view=diff
==============================================================================
--- ofbiz/branches/20111205EmailHandling/applications/manufacturing/src/org/ofbiz/manufacturing/bom/BOMHelper.java (original)
+++ ofbiz/branches/20111205EmailHandling/applications/manufacturing/src/org/ofbiz/manufacturing/bom/BOMHelper.java Mon Mar 26 20:56:02 2012
@@ -68,11 +68,8 @@ public class BOMHelper {
         List<GenericValue> productNodesList = delegator.findByAndCache("ProductAssoc", 
                 UtilMisc.toMap("productIdTo", productId, "productAssocTypeId", bomType));
         productNodesList = EntityUtil.filterByDate(productNodesList, inDate);
-        GenericValue oneNode = null;
-        Iterator<GenericValue> nodesIterator = productNodesList.iterator();
         int depth = 0;
-        while (nodesIterator.hasNext()) {
-            oneNode = nodesIterator.next();
+        for (GenericValue oneNode : productNodesList) {
             depth = 0;
             depth = getMaxDepth(oneNode.getString("productId"), bomType, inDate, delegator);
             depth++;
@@ -114,11 +111,9 @@ public class BOMHelper {
         List<GenericValue> productNodesList = delegator.findByAndCache("ProductAssoc",
                 UtilMisc.toMap("productIdTo", productId, "productAssocTypeId", bomType));
         productNodesList = EntityUtil.filterByDate(productNodesList, inDate);
-        GenericValue oneNode = null;
         GenericValue duplicatedNode = null;
         Iterator<GenericValue> nodesIterator = productNodesList.iterator();
-        while (nodesIterator.hasNext()) {
-            oneNode = nodesIterator.next();
+        for(GenericValue oneNode : productNodesList) {
             for (int i = 0; i < productIdKeys.size(); i++) {
                 if (oneNode.getString("productId").equals(productIdKeys.get(i))) {
                     return oneNode;
@@ -141,9 +136,7 @@ public class BOMHelper {
 
         try {
         List<GenericValue> shipmentPlans = delegator.findByAnd("OrderShipment", UtilMisc.toMap("shipmentId", shipmentId));
-        Iterator<GenericValue> shipmentPlansIt = shipmentPlans.iterator();
-        while (shipmentPlansIt.hasNext()) {
-            GenericValue shipmentPlan = shipmentPlansIt.next();
+        for(GenericValue shipmentPlan : shipmentPlans) {
             GenericValue orderItem = shipmentPlan.getRelatedOne("OrderItem");
 
             List<GenericValue> productionRuns = delegator.findByAndCache("WorkOrderItemFulfillment", UtilMisc.toMap("orderId", shipmentPlan.getString("orderId"), "orderItemSeqId", shipmentPlan.getString("orderItemSeqId"), "shipGroupSeqId", shipmentPlan.getString("shipGroupSeqId")));

Modified: ofbiz/branches/20111205EmailHandling/applications/manufacturing/src/org/ofbiz/manufacturing/bom/BOMNode.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/20111205EmailHandling/applications/manufacturing/src/org/ofbiz/manufacturing/bom/BOMNode.java?rev=1305581&r1=1305580&r2=1305581&view=diff
==============================================================================
--- ofbiz/branches/20111205EmailHandling/applications/manufacturing/src/org/ofbiz/manufacturing/bom/BOMNode.java (original)
+++ ofbiz/branches/20111205EmailHandling/applications/manufacturing/src/org/ofbiz/manufacturing/bom/BOMNode.java Mon Mar 26 20:56:02 2012
@@ -114,11 +114,8 @@ public class BOMNode {
         children = FastList.newInstance();
         children.addAll(rows);
         childrenNodes = FastList.newInstance();
-        Iterator<GenericValue> childrenIterator = children.iterator();
-        GenericValue oneChild = null;
         BOMNode oneChildNode = null;
-        while (childrenIterator.hasNext()) {
-            oneChild = childrenIterator.next();
+        for(GenericValue oneChild : children) {
             // Configurator
             oneChildNode = configurator(oneChild, productFeatures, getRootNode().getProductForRules(), inDate);
             // If the node is null this means that the node has been discarded by the rules.
@@ -340,13 +337,11 @@ public class BOMNode {
             rows = EntityUtil.filterByDate(rows, inDate);
         }
         children = FastList.newInstance();
-        children.addAll(rows);;
+        children.addAll(rows);
         childrenNodes = FastList.newInstance();
-        Iterator<GenericValue> childrenIterator = children.iterator();
-        GenericValue oneChild = null;
+
         BOMNode oneChildNode = null;
-        while (childrenIterator.hasNext()) {
-            oneChild = childrenIterator.next();
+        for(GenericValue oneChild : children) {
             oneChildNode = new BOMNode(oneChild.getString("productId"), delegator, dispatcher, userLogin);
             // Configurator
             //oneChildNode = configurator(oneChild, productFeatures, getRootNode().getProductForRules(), delegator);