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/08/07 21:13:05 UTC

svn commit: r1370439 [5/5] - in /ofbiz/branches/20120329_portletWidget/framework: base/src/org/ofbiz/base/util/ common/config/ common/data/ common/entitydef/ common/webcommon/WEB-INF/ common/widget/ images/webapp/images/ minilang/src/org/ofbiz/minilang...

Modified: ofbiz/branches/20120329_portletWidget/framework/widget/src/org/ofbiz/widget/screen/ModelScreenWidget.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/widget/src/org/ofbiz/widget/screen/ModelScreenWidget.java?rev=1370439&r1=1370438&r2=1370439&view=diff
==============================================================================
--- ofbiz/branches/20120329_portletWidget/framework/widget/src/org/ofbiz/widget/screen/ModelScreenWidget.java (original)
+++ ofbiz/branches/20120329_portletWidget/framework/widget/src/org/ofbiz/widget/screen/ModelScreenWidget.java Tue Aug  7 19:13:03 2012
@@ -45,6 +45,7 @@ import org.ofbiz.base.util.string.Flexib
 import org.ofbiz.entity.Delegator;
 import org.ofbiz.entity.GenericEntityException;
 import org.ofbiz.entity.GenericValue;
+import org.ofbiz.entity.util.EntityUtil; //#Eam# portletWidget
 import org.ofbiz.widget.ModelWidget;
 import org.ofbiz.widget.ModelWidgetAction;
 import org.ofbiz.widget.WidgetFactory;
@@ -345,9 +346,6 @@ public abstract class ModelScreenWidget 
                 for (ModelWidget subWidget : this.subWidgets) {
                     if (formName.equals(subWidget.getName()) && subWidget instanceof Form) {
                         this.navigationForm = (Form) subWidget;
-                        // Let's give this a try, it can be removed later if it
-                        // proves to cause problems
-                        this.padded = false;
                         break;
                     }
                 }
@@ -1602,12 +1600,44 @@ public abstract class ModelScreenWidget 
         protected String originalPortalPageId;
         protected String actualPortalPageId;
         protected Boolean usePrivate;
+        //#Bam# portletWidget
+        protected FlexibleStringExpander portalPortletId;
+        protected FlexibleStringExpander portletSeqId;
+        private static final List<String> portletFieldNames = initPortletFieldNames();
+
+        static private List<String> initPortletFieldNames(){
+            List<String> _portletFieldNames = FastList.newInstance();
+            _portletFieldNames.add("screenName");
+            _portletFieldNames.add("screenLocation");
+            _portletFieldNames.add("useScreen");
+            _portletFieldNames.add("useScript");
+            _portletFieldNames.add("scriptName");
+            _portletFieldNames.add("uiLabelLocation");
+            _portletFieldNames.add("formName");
+            _portletFieldNames.add("formLocation");
+            _portletFieldNames.add("pkIdName");
+            _portletFieldNames.add("editAreaDivId");
+            _portletFieldNames.add("subAreaDivId");
+            _portletFieldNames.add("titleLabel");
+            _portletFieldNames.add("useMenu");
+            _portletFieldNames.add("menuName");
+            _portletFieldNames.add("menuLocation");
+            _portletFieldNames.add("helpName");
+            _portletFieldNames.add("editFormName");
+            _portletFieldNames.add("editFormLocation");
+            return _portletFieldNames;
+        }
+        //#Eam# portletWidget
 
         public PortalPage(ModelScreen modelScreen, Element portalPageElement) {
             super(modelScreen, portalPageElement);
             this.idExdr = FlexibleStringExpander.getInstance(portalPageElement.getAttribute("id"));
             this.confModeExdr = FlexibleStringExpander.getInstance(portalPageElement.getAttribute("conf-mode"));
             this.usePrivate = !("false".equals(portalPageElement.getAttribute("use-private")));
+            //#Bam# portletWidget
+            this.portalPortletId = FlexibleStringExpander.getInstance(portalPageElement.getAttribute("portalPortletId"));
+            this.portletSeqId = FlexibleStringExpander.getInstance(portalPageElement.getAttribute("portletSeqId"));
+            //#Eam# portletWidget
         }
 
         @Override
@@ -1617,9 +1647,10 @@ public abstract class ModelScreenWidget 
                 GenericValue portalPage = null;
                 List<GenericValue> portalPageColumns = null;
                 List<GenericValue> portalPagePortlets = null;
-                List<GenericValue> portletAttributes = null;
 
                 String expandedPortalPageId = getId(context);
+                String portalPortletId = this.portalPortletId.expandString(context);//#Eam# portletWidget
+                String portletSeqId = this.portletSeqId.expandString(context);//#Eam# portletWidget
 
                 if (UtilValidate.isNotEmpty(expandedPortalPageId)) {
                     if (usePrivate) {
@@ -1643,6 +1674,45 @@ public abstract class ModelScreenWidget 
                     return;
                 }
 
+                //#Bam# portletWidget
+                if (UtilValidate.isNotEmpty(portalPortletId)) {
+                    GenericValue portletValue = null;
+                    if ( UtilValidate.isNotEmpty(portletSeqId)) {
+                        portletValue = delegator.findOne("PortalPagePortletView", UtilMisc.toMap("portalPageId", actualPortalPageId, "portalPortletId", portalPortletId, "portletSeqId", portletSeqId), false);
+                    } else {
+                        List<GenericValue> portletValues = delegator.findByAnd("PortalPagePortletView", UtilMisc.toMap("portalPageId", actualPortalPageId, "portalPortletId", portalPortletId), null, false);
+                        if (UtilValidate.isNotEmpty(portletValues)) {
+                            portletValue = EntityUtil.getFirst(portletValues);
+                            portletSeqId = portletValue.getString("portletSeqId");
+                        }
+                    }
+                    if ( UtilValidate.isEmpty(portletValue)) {
+                        portletValue = delegator.findOne("PortalPortlet", UtilMisc.toMap("portalPortletId", portalPortletId), false);
+                    }
+
+                    if (UtilValidate.isNotEmpty(portletValue)) {
+                        //remove from context value which will be initialized by this portlet
+                        for (String portletField : portletFieldNames) {
+                            if (context.containsKey(portletField)) context.put(portletField, null); //remove not works, suppose it's a because it's a stack
+                        }
+                        context.put("portletValue",portletValue);
+                        context.put("portalPageId", actualPortalPageId);
+                        context.put("portletSeqId", portletSeqId);
+                        context.put("portalPortletId", portalPortletId);
+
+                        retrievePortletAttributes(context);
+                        putScreenNameLocationValue(delegator, context, portletValue);
+
+                        // Renders the portalPagePortlet
+                        context.put("includedInPage", "N"); // portletWidget modification
+                        screenStringRenderer.renderPortalPagePortletBegin(writer, context, this, portletValue);
+                        screenStringRenderer.renderPortalPagePortletBody(writer, context, this, portletValue);
+                        screenStringRenderer.renderPortalPagePortletEnd(writer, context, this, portletValue);
+                    }
+                } else {
+                    context.put("includedInPage", "Y"); // portletWidget modification
+                //#Eam# portletWidget
+
                 // Renders the portalPage header
                 screenStringRenderer.renderPortalPageBegin(writer, context, this);
                 
@@ -1693,6 +1763,8 @@ public abstract class ModelScreenWidget 
                         context.put("nextColumnSeqId", nextColumnSeqId);
                        
                         // Get portlet's attributes
+                        //#Bam# portletWidget
+                        /*
                         portletAttributes = delegator.findList("PortletAttribute",
                             EntityCondition.makeCondition(UtilMisc.toMap("portalPageId", portletValue.get("portalPageId"), "portalPortletId", portletValue.get("portalPortletId"), "portletSeqId", portletValue.get("portletSeqId"))),
                             null, null, null, false);
@@ -1701,7 +1773,30 @@ public abstract class ModelScreenWidget 
                             GenericValue attribute = attributesIterator.next();
                             context.put(attribute.getString("attrName"), attribute.getString("attrValue"));
                         }
+                        */
+                        for (String portletField : portletFieldNames) {
+                            if (context.containsKey(portletField))     context.remove(portletField);
+                        }
+                        //if (context.containsKey("areaDivId"))        context.remove("areaDivId"); with id build with portalPageId portalPortletId portletSeqId, it seem, it's no more necessary because always unique
+                        if (context.containsKey("component"))        context.remove("component");
+                        if (context.containsKey("portletLongId"))    context.remove("portletLongId");
+                        if (context.containsKey("portletTypeId"))    context.remove("portletTypeId");
+                        if (context.containsKey("subComponent"))     context.remove("subComponent");
+                        if (context.containsKey("webapp"))           context.remove("webapp");
+                        if (context.containsKey("areaId"))           context.remove("areaId");
+
+                        context.put("portletValue",portletValue);
+                        context.put("portalPageId", portletValue.get("portalPageId"));
+                        context.put("portalPortletId", portletValue.get("portalPortletId"));
+                        context.put("portletSeqId", portletValue.get("portletSeqId"));
+
+                        retrievePortletAttributes(context);
+
+                        ListIterator<GenericValue> attributesIterator = (ListIterator<GenericValue>) context.remove("portletAttributesIterator");
                         
+                        putScreenNameLocationValue(delegator, context, portletValue);
+                        //#Eam# portletWidget
+
                         // Renders the portalPagePortlet
                         screenStringRenderer.renderPortalPagePortletBegin(writer, context, this, portletValue);
                         screenStringRenderer.renderPortalPagePortletBody(writer, context, this, portletValue);
@@ -1725,6 +1820,7 @@ public abstract class ModelScreenWidget 
                 }
                 // Renders the portalPage footer
                 screenStringRenderer.renderPortalPageEnd(writer, context, this);
+              } //#Eam# portletWidget
             } catch (IOException e) {
                 String errMsg = "Error rendering PortalPage with portalPageId [" + getId(context) + "]: " + e.toString();
                 Debug.logError(e, errMsg, module);
@@ -1736,6 +1832,214 @@ public abstract class ModelScreenWidget 
             }
         }
 
+        /**
+         *  update screenName and screenLocation in portletValue with correct value if it's with a portletType or if it's a default value
+         * @param delegator
+         * @param context
+         * @param portletValue
+         * @throws GenericEntityException
+         */
+        private static void putScreenNameLocationValue(Delegator delegator, Map<String,Object> context, GenericValue portletValue) throws GenericEntityException{
+            if (UtilValidate.isNotEmpty(portletValue.get("portletTypeId"))) {
+                //update screen values
+                GenericValue portletType = delegator.findOne("PortletType", true, "portletTypeId", portletValue.get("portletTypeId"));
+                if (UtilValidate.isEmpty(portletType)){
+                    Debug.logError("PortletId = " + portletValue.get("portalPortletId") + " with a not existing portletType, portletTypeId = " + portletValue.get("portletTypeId"), module);
+                } else {
+                    portletValue.put("screenName", portletType.get("screenName"));
+                    portletValue.put("screenLocation", portletType.get("screenLocation"));
+                }
+            } else {
+                if (UtilValidate.isEmpty(portletValue.get("screenName"))){
+                    portletValue.put("screenName", context.get("screenName"));
+                }
+                if (UtilValidate.isEmpty(portletValue.get("screenLocation"))){
+                    portletValue.put("screenLocation", context.get("screenLocation"));
+                }
+            }
+        }
+
+        protected static Map<String,Object> retrievePortletAttributes (Map<String,Object> context) throws GenericEntityException {
+            Delegator delegator = (Delegator) context.get("delegator");
+            String portalPageId = (String) context.get("portalPageId");
+            String portalPortletId = (String) context.get("portalPortletId");
+            GenericValue portletValue = (GenericValue) context.remove("portletValue");
+            if (UtilValidate.isEmpty(portletValue)) {
+                portletValue = delegator.findOne("PortalPortlet", UtilMisc.toMap("portalPortletId", portalPortletId), false);
+            }
+            String portletSeqId= (String) context.get("portletSeqId");
+
+            List<GenericValue> portletAttributes = delegator.findList("PortletAttribute",
+                    EntityCondition.makeCondition(UtilMisc.toMap("portalPageId", "_NA_", "portalPortletId", portalPortletId, "portletSeqId", "00000")),
+                    null, null, null, false);
+            //Begin addon modification : portletWidget
+
+            //Retrieve attributes from portletValue
+            // portalPortlet field overwrite PortletAttribute coming from portalPageId _NA_
+            if (UtilValidate.isNotEmpty(portletValue)) {
+                for (String portletField : portletFieldNames) {
+                    if (UtilValidate.isNotEmpty(portletValue.get(portletField)))     portletAttributes.add(delegator.makeValidValue("PortletAttribute", UtilMisc.toMap("attrName",portletField,"attrValue", portletValue.get(portletField))));
+                }
+                if (UtilValidate.isNotEmpty(portletValue.get("helpName"))) {
+                    String helpName = (String) portletValue.get("helpName");
+                    if (helpName.startsWith("DETAIL_") && helpName.length()>7) {
+                        helpName = (String) context.get(helpName.substring(7, helpName.length()));
+                    }
+                    portletAttributes.add(delegator.makeValidValue("PortletAttribute", UtilMisc.toMap("attrName","helpName","attrValue", helpName)));
+                }
+            }
+            //End addon modification : portletWidget
+
+            if (UtilValidate.isNotEmpty(portletSeqId)) {
+                List<GenericValue> portalPortletAttributes = delegator.findList("PortletAttribute",
+                        EntityCondition.makeCondition(UtilMisc.toMap("portalPageId", portalPageId, "portalPortletId", portalPortletId, "portletSeqId",portletSeqId)),
+                        null, null, null, false);
+                if (UtilValidate.isNotEmpty(portalPortletAttributes)) {
+                    portletAttributes.addAll(portalPortletAttributes);
+                }
+            }
+            ListIterator<GenericValue> portletAttributesIterator = portletAttributes.listIterator();
+            while (portletAttributesIterator.hasNext()) {
+                GenericValue attribute = portletAttributesIterator.next();
+                context.put(attribute.getString("attrName"), attribute.getString("attrValue"));
+            }
+            if (UtilValidate.isNotEmpty(portletValue.get("portletLongId"))) context.put("portletLongId", portletValue.get("portletLongId"));
+            if (UtilValidate.isNotEmpty(portletValue.get("portletTypeId"))) context.put("portletTypeId", portletValue.get("portletTypeId"));
+            if (UtilValidate.isNotEmpty(portletValue.get("component")))     context.put("component", portletValue.get("component"));
+            if (UtilValidate.isNotEmpty(portletValue.get("subComponent")))  context.put("subComponent", portletValue.get("subComponent"));
+            if (UtilValidate.isNotEmpty(portletValue.get("webapp")))        context.put("webapp", portletValue.get("webapp"));
+
+            // put default value in areaId, use value in attribute (so in context) or in parameters or PP_${portalPageId}${portalPortletId}${portletSeqId}
+            String areaId = (String) context.get("areaId");
+            if (UtilValidate.isEmpty(areaId)) {
+                Map<String, Object> contextParameters = UtilGenerics.checkMap( context.get("parameters"));
+                areaId = (String) contextParameters.get("areaId");
+            }
+            if (UtilValidate.isEmpty(areaId)) {
+                areaId = "PP_"+portalPageId+portalPortletId+portletSeqId;
+            }
+            context.put("currentAreaId", "PP_"+portalPageId+portalPortletId+portletSeqId);
+            context.put("areaId", areaId);
+
+            //Begin addon modification : portletWidget
+            String portletLongId = (String) context.get("portletLongId");
+            if (UtilValidate.isEmpty(portletLongId)) {
+                portletLongId = portalPortletId;
+            }
+            if (UtilValidate.isNotEmpty(portletValue.get("component"))) {
+                if (UtilValidate.isNotEmpty(portletValue) && UtilValidate.isNotEmpty(portletValue.get("screenName"))) {
+                    context.put("screenName", portletValue.get("screenName"));
+                } else {
+                    context.put("screenName", portletLongId);
+                }
+            } 
+
+            // prepare location for screen form menu
+            StringBuffer location = new StringBuffer();
+            StringBuffer uiLabelLocation = new StringBuffer();
+            if (UtilValidate.isNotEmpty(portletValue.get("component"))){
+                location.append("component://").append(portletValue.get("component")).append("/widget/");
+                if (UtilValidate.isNotEmpty(context.get("webapp"))) {
+                    location.append(context.get("webapp")).append("/");
+                }
+                uiLabelLocation.append(location);
+                location.append(context.get("subComponent"));
+            }
+            //End addon modification : portletWidget
+            if (UtilValidate.isNotEmpty(portletValue.get("component"))) {
+                if (UtilValidate.isNotEmpty(portletValue) && UtilValidate.isNotEmpty(portletValue.get("screenLocation"))
+                        && "Y".equals(portletValue.get("useScreen"))) {
+                    context.put("screenLocation",portletValue.get("screenLocation"));
+                } else if ("Y".equals(portletValue.get("useScreen")) ) {
+                    context.put("screenLocation", location +"Screens.xml");
+                }
+            } 
+            else if (UtilValidate.isNotEmpty(portletValue)) {
+                context.put("screenLocation", portletValue.get("screenLocation"));
+            }
+
+            //if (UtilValidate.isEmpty(context.get("areaDivId")))     context.put("areaDivId", "PP_" + portalPageId + portalPortletId + portletSeqId); with id build with portalPageId portalPortletId portletSeqId, it seem, it's no more necessary because always unique
+            if (UtilValidate.isEmpty(context.get("editAreaDivId"))) context.put("editAreaDivId", portletLongId + "_EditArea");
+            if (UtilValidate.isEmpty(context.get("entity")))        context.put("entity", portletLongId);
+            if (UtilValidate.isEmpty(context.get("helpName")))      context.put("helpName", "HELP_" + portalPortletId);
+            if (UtilValidate.isEmpty(context.get("subAreaDivId")))  context.put("subAreaDivId", portletLongId + "_SubArea");
+            if (UtilValidate.isEmpty(context.get("titleLabel")))    context.put("titleLabel", "PageTitle"+portletLongId);
+
+                if (UtilValidate.isNotEmpty(portletValue) && UtilValidate.isNotEmpty(portletValue.get("menuName")) ){
+                    context.put("menuName", portletValue.get("menuName"));
+                } else {
+                    context.put("menuName", portletLongId);
+                }
+
+                if (UtilValidate.isNotEmpty(portletValue.get("portletTypeId"))){
+                    if (UtilValidate.isNotEmpty(portletValue) && UtilValidate.isNotEmpty(portletValue.get("menuLocation"))
+                            && "Y".equals(portletValue.get("useMenu")) ){
+                        context.put("menuLocation", portletValue.get("menuLocation"));
+                    } else if ("Y".equals(portletValue.get("useMenu")) ) {
+                        context.put("menuLocation", location.toString() + "Menus.xml");
+                    }
+                }
+
+            if (UtilValidate.isNotEmpty(portletValue.get("portletTypeId"))){
+                if (UtilValidate.isNotEmpty(portletValue) 
+                        && UtilValidate.isNotEmpty(portletValue.get("scriptName"))
+                        && "Y".equals(portletValue.get("useScript"))  ){
+                    context.put("scriptName", portletValue.get("scriptName"));
+                } else {
+                    StringBuffer scriptName = new StringBuffer();
+                    scriptName.append("component://").append(context.get("component"))
+                                                     .append("/script/org/ofbiz/")
+                                                     .append(context.get("component"))
+                                                     .append("/");
+                    if (UtilValidate.isNotEmpty(context.get("webapp"))) {
+                        scriptName.append(context.get("webapp")).append("/");
+                    }
+                    // test if we should use script, if yes add scriptName in context
+                    if (UtilValidate.isNotEmpty(portletValue) && "Y".equals(portletValue.get("useScript"))) {
+                        context.put("scriptName", scriptName.append(context.get("subComponent")).append("Wactions.xml").append("#").append(portletLongId) );
+                    }
+                }
+                if (UtilValidate.isNotEmpty(portletValue) && UtilValidate.isNotEmpty(portletValue.get("uiLabelLocation")) ){
+                    context.put("uiLabelLocation", portletValue.get("uiLabelLocation"));
+                } else {
+                    uiLabelLocation.append("CommonScreens.xml");
+                    context.put("uiLabelLocation", uiLabelLocation );
+                }
+            }
+            if (UtilValidate.isEmpty(context.get("formName"))) {
+                if (UtilValidate.isNotEmpty(portletValue) && UtilValidate.isNotEmpty(portletValue.get("formName")) ){
+                    context.put("formName", portletValue.get("formName"));
+                } else {
+                    context.put("formName", portletLongId);
+                }
+            }
+            if (UtilValidate.isEmpty(context.get("formLocation"))) {
+                if (UtilValidate.isNotEmpty(portletValue) && UtilValidate.isNotEmpty(portletValue.get("formLocation")) ){
+                    context.put("formLocation", portletValue.get("formLocation"));
+                } else {
+                    context.put("formLocation", location.toString() + "Forms.xml");
+                }
+            }
+
+            if (UtilValidate.isEmpty(context.get("editFormName"))){
+                if (UtilValidate.isNotEmpty(portletValue) && UtilValidate.isNotEmpty(portletValue.get("editFormName")) ){
+                    context.put("editFormName", portletValue.get("editFormName"));
+                } else {
+                    context.put("editFormName", "EditParam_"+portletLongId);
+                }
+            }
+            if (UtilValidate.isEmpty(context.get("editFormLocation"))) {
+                if (UtilValidate.isNotEmpty(portletValue) && UtilValidate.isNotEmpty(portletValue.get("editFormLocation")) ){
+                    context.put("editFormLocation", portletValue.get("editFormLocation"));
+                } else {
+                    context.put("editFormLocation", location.toString() + "Forms.xml");
+                }
+            }
+            //End addon modification : portletWidget
+            context.put("portletAttributesIterator", portletAttributesIterator);
+            return context;
+        }
+
         public String getId(Map<String, Object> context) {
             return this.idExdr.expandString(context);
         }

Modified: ofbiz/branches/20120329_portletWidget/framework/widget/src/org/ofbiz/widget/screen/ScreenRenderer.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/widget/src/org/ofbiz/widget/screen/ScreenRenderer.java?rev=1370439&r1=1370438&r2=1370439&view=diff
==============================================================================
--- ofbiz/branches/20120329_portletWidget/framework/widget/src/org/ofbiz/widget/screen/ScreenRenderer.java (original)
+++ ofbiz/branches/20120329_portletWidget/framework/widget/src/org/ofbiz/widget/screen/ScreenRenderer.java Tue Aug  7 19:13:03 2012
@@ -190,7 +190,7 @@ public class ScreenRenderer {
         HttpSession session = request.getSession();
 
         // attribute names to skip for session and application attributes; these are all handled as special cases, duplicating results and causing undesired messages
-        Set<String> attrNamesToSkip = UtilMisc.toSet("delegator", "dispatcher", "security", "webSiteId",
+        Set<String> attrNamesToSkip = UtilMisc.toSet("delegator", "dispatcher", "authz", "security", "webSiteId",
                 "org.apache.catalina.jsp_classpath");
         Map<String, Object> parameterMap = UtilHttp.getCombinedMap(request, attrNamesToSkip);
 

Modified: ofbiz/branches/20120329_portletWidget/framework/widget/src/org/ofbiz/widget/text/TextFormRenderer.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/widget/src/org/ofbiz/widget/text/TextFormRenderer.java?rev=1370439&r1=1370438&r2=1370439&view=diff
==============================================================================
--- ofbiz/branches/20120329_portletWidget/framework/widget/src/org/ofbiz/widget/text/TextFormRenderer.java (original)
+++ ofbiz/branches/20120329_portletWidget/framework/widget/src/org/ofbiz/widget/text/TextFormRenderer.java Tue Aug  7 19:13:03 2012
@@ -46,6 +46,7 @@ import org.ofbiz.widget.form.ModelFormFi
 import org.ofbiz.widget.form.ModelFormField.RadioField;
 import org.ofbiz.widget.form.ModelFormField.RangeFindField;
 import org.ofbiz.widget.form.ModelFormField.ResetField;
+import org.ofbiz.widget.form.ModelFormField.ShowPortletLink;
 import org.ofbiz.widget.form.ModelFormField.SubmitField;
 import org.ofbiz.widget.form.ModelFormField.TextField;
 import org.ofbiz.widget.form.ModelFormField.TextFindField;
@@ -298,4 +299,9 @@ public class TextFormRenderer implements
 
     public void renderContainerFindField(Appendable writer, Map<String, Object> context, ContainerField containerField) throws IOException {
     }
+
+    @Override
+    public void renderShowPortletLink(Appendable writer, Map<String, Object> context, ShowPortletLink showPortletLink) {
+        // TODO Auto-generated method stub
+    }
 }

Modified: ofbiz/branches/20120329_portletWidget/framework/widget/src/org/ofbiz/widget/xml/XmlFormRenderer.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/widget/src/org/ofbiz/widget/xml/XmlFormRenderer.java?rev=1370439&r1=1370438&r2=1370439&view=diff
==============================================================================
--- ofbiz/branches/20120329_portletWidget/framework/widget/src/org/ofbiz/widget/xml/XmlFormRenderer.java (original)
+++ ofbiz/branches/20120329_portletWidget/framework/widget/src/org/ofbiz/widget/xml/XmlFormRenderer.java Tue Aug  7 19:13:03 2012
@@ -46,6 +46,7 @@ import org.ofbiz.widget.form.ModelFormFi
 import org.ofbiz.widget.form.ModelFormField.RadioField;
 import org.ofbiz.widget.form.ModelFormField.RangeFindField;
 import org.ofbiz.widget.form.ModelFormField.ResetField;
+import org.ofbiz.widget.form.ModelFormField.ShowPortletLink;
 import org.ofbiz.widget.form.ModelFormField.SubmitField;
 import org.ofbiz.widget.form.ModelFormField.TextField;
 import org.ofbiz.widget.form.ModelFormField.TextFindField;
@@ -339,4 +340,9 @@ public class XmlFormRenderer implements 
 
     public void renderContainerFindField(Appendable writer, Map<String, Object> context, ContainerField containerField) throws IOException {
     }
+
+    @Override
+    public void renderShowPortletLink(Appendable writer, Map<String, Object> context, ShowPortletLink showPortletLink) {
+        // TODO Auto-generated method stub
+    }
 }

Modified: ofbiz/branches/20120329_portletWidget/framework/widget/templates/htmlFormMacroLibrary.ftl
URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/widget/templates/htmlFormMacroLibrary.ftl?rev=1370439&r1=1370438&r2=1370439&view=diff
==============================================================================
--- ofbiz/branches/20120329_portletWidget/framework/widget/templates/htmlFormMacroLibrary.ftl (original)
+++ ofbiz/branches/20120329_portletWidget/framework/widget/templates/htmlFormMacroLibrary.ftl Tue Aug  7 19:13:03 2012
@@ -47,8 +47,19 @@ under the License.
     </#if>
 </#macro>
 <#macro renderHyperlinkField></#macro>
+<#macro makeShowPortletString linkStyle id event action target targetArea targetPortletId description parameterForm parameterList collapse>
+<div <#if id?has_content>id="${id}_div"</#if>><a href="javascript:ajaxUpdateArea('${targetArea}','${target}',<#if parameterForm?has_content> jQuery('#${parameterForm}').serialize()<#elseif parameterList?has_content>${parameterList}<#else>'portalPortletId=${targetPortletId}'</#if>); <#if collapse?has_content>toggleParentScreenlet('${collapse}');</#if>">${description}</a></div>
+</#macro>
+<#macro rerenderRefreshPortlet linkStyle event action areaId id formName imgSrc title alternate target appendFormParams description params collapse markSelected>
+<#if id?has_content><div id="${id}_div"></#if>
+<a <#if linkStyle?has_content>class="${linkStyle}"</#if> href='javascript:refrshPortlet("${target}", "${areaId}", "${params}", "${formName}", "${appendFormParams}", "${collapse}", <#if (collapse== "true"  || markSelected=="true" ) && id?has_content>"${id}_div"<#else>""</#if>,"${markSelected}" )' <#if action?has_content && event?has_content> ${event}="${action}"</#if><#if imgSrc?length == 0 && title?has_content> title="${title}"</#if>><#if imgSrc?has_content><img src="${imgSrc}" alt="${alternate}" title="${title}"/></#if>${description}</a><#if id?has_content></div></#if>
+</#macro>
 
+<#--#Bam# validate-form
 <#macro renderTextField name className alert value textSize maxlength id event action disabled clientAutocomplete ajaxUrl ajaxEnabled mask>
+-->
+<#macro renderTextField name className alert value textSize maxlength id event action disabled clientAutocomplete validateLinkOnEnter validateLinkId ajaxUrl ajaxEnabled mask>
+<#--#Eam# validate-form -->
     <#if mask?has_content>
       <script type="text/javascript">
         jQuery(function($){jQuery("#${id}").mask("${mask}");});
@@ -61,6 +72,7 @@ under the License.
     <#if maxlength?has_content> maxlength="${maxlength}"</#if><#rt/>
     <#if disabled?has_content && disabled> disabled="disabled"</#if><#rt/>
     <#if id?has_content> id="${id}"</#if><#rt/>
+    <#if validateLinkOnEnter?has_content && validateLinkOnEnter && validateLinkId?has_content>onkeydown="if ((window.event && window.event.keyCode == 13) || (event && event.keyCode == 13)) clickLink('${validateLinkId}_div')"</#if> <#--#Eam# validate-form -->
     <#if event?has_content && action?has_content> ${event}="${action}"</#if><#rt/>
     <#if clientAutocomplete?has_content && clientAutocomplete=="false"> autocomplete="off"</#if><#rt/>
     /><#t/>
@@ -277,13 +289,15 @@ ${item.description}</span>
 </#list>
 </#macro>
 
-<#macro renderSubmitField buttonType className alert formName title name event action imgSrc confirmation containerId ajaxUrl>
+<#-- <#macro renderSubmitField buttonType className alert formName title name event action imgSrc confirmation containerId ajaxUrl> -->
+<#macro renderSubmitField buttonType className alert formName title name event action imgSrc confirmation containerId ajaxUrl returnParams>
 <#if buttonType=="text-link">
  <a <@renderClass className alert /> href="javascript:document.${formName}.submit()" <#if confirmation?has_content>onclick="return confirm('${confirmation?js_string}');"</#if>><#if title?has_content>${title}</#if> </a>
 <#elseif buttonType=="image">
  <input type="image" src="${imgSrc}" <@renderClass className alert /><#if name?has_content> name="${name}"</#if><#if title?has_content> alt="${title}"</#if><#if event?has_content> ${event}="${action}"</#if> <#if confirmation?has_content>onclick="return confirm('${confirmation?js_string}');"</#if>/>
 <#else>
-<input type="<#if containerId?has_content>button<#else>submit</#if>" <@renderClass className alert /><#if name?exists> name="${name}"</#if><#if title?has_content> value="${title}"</#if><#if event?has_content> ${event}="${action}"</#if><#if containerId?has_content> onclick="<#if confirmation?has_content>if (confirm('${confirmation?js_string}')) </#if>ajaxSubmitFormUpdateAreas('${containerId}', '${ajaxUrl}')"<#else><#if confirmation?has_content> onclick="return confirm('${confirmation?js_string}');"</#if></#if>/></#if>
+<#--<input type="<#if containerId?has_content>button<#else>submit</#if>" <@renderClass className alert /><#if name?exists> name="${name}"</#if><#if title?has_content> value="${title}"</#if><#if event?has_content> ${event}="${action}"</#if><#if containerId?has_content> onclick="<#if confirmation?has_content>if (confirm('${confirmation?js_string}')) </#if>ajaxSubmitFormUpdateAreas('${containerId}', '${ajaxUrl}')"<#else><#if confirmation?has_content> onclick="return confirm('${confirmation?js_string}');"</#if></#if>/></#if>-->
+<input type="<#if containerId?has_content>button<#else>submit</#if>" <@renderClass className alert /><#if name?exists> name="${name}"</#if><#if title?has_content> value="${title}"</#if><#if event?has_content> ${event}="${action}"</#if><#if containerId?has_content> onclick="<#if confirmation?has_content>if (confirm('${confirmation?js_string}')) </#if><#if returnParams?has_content>ajaxSubmitFormUpdateAreasWithReturn('${containerId}', '${ajaxUrl}', ${returnParams})"<#else>ajaxSubmitFormUpdateAreas('${containerId}', '${ajaxUrl}')"</#if><#else><#if confirmation?has_content> onclick="return confirm('${confirmation?js_string}');"</#if></#if>/></#if>
 </#macro>
 
 <#macro renderResetField className alert name title>
@@ -377,7 +391,7 @@ ${item.description}</span>
 </#macro>
 
 <#macro renderFormatItemRowOpen formName itemIndex altRowStyles evenRowStyle oddRowStyle>
-    <tr <#if itemIndex?has_content><#if itemIndex%2==0><#if evenRowStyle?has_content>class="${evenRowStyle}<#if altRowStyles?has_content> ${altRowStyles}</#if>"<#elseif altRowStyles?has_content>class="${altRowStyles}"</#if><#else><#if oddRowStyle?has_content>class="${oddRowStyle}<#if altRowStyles?has_content> ${altRowStyles}</#if>"<#elseif altRowStyles?has_content>class="${altRowStyles}"</#if></#if></#if> >
+    <tr <#if itemIndex?has_content>id="${formName}_row_${itemIndex}" </#if><#if itemIndex?has_content><#if itemIndex%2==0><#if evenRowStyle?has_content>class="${evenRowStyle}<#if altRowStyles?has_content> ${altRowStyles}</#if>"<#elseif altRowStyles?has_content>class="${altRowStyles}"</#if><#else><#if oddRowStyle?has_content>class="${oddRowStyle}<#if altRowStyles?has_content> ${altRowStyles}</#if>"<#elseif altRowStyles?has_content>class="${altRowStyles}"</#if></#if></#if> >
 </#macro>
 <#macro renderFormatItemRowClose formName>
     </tr>
@@ -440,7 +454,11 @@ ${item.description}</span>
 
 <#macro renderFormatEmptySpace>&nbsp;</#macro>
 
+<#--#Bam# validate-form
 <#macro renderTextFindField name value defaultOption opEquals opBeginsWith opContains opIsEmpty opNotEqual className alert size maxlength autocomplete titleStyle hideIgnoreCase ignCase ignoreCase>
+-->
+<#macro renderTextFindField name value defaultOption opEquals opBeginsWith opContains opIsEmpty opNotEqual className alert size maxlength autocomplete validateLinkOnEnter validateLinkId titleStyle hideIgnoreCase ignCase ignoreCase>
+<#--#Eam# validate-form -->
 <#if opEquals?has_content>
 <select <#if name?has_content>name="${name}_op"</#if>    class="selectBox"><#rt/>
 <option value="equals"<#if defaultOption=="equals"> selected="selected"</#if>>${opEquals}</option><#rt/>
@@ -452,7 +470,11 @@ ${item.description}</span>
 <#else>
 <input type="hidden" name=<#if name?has_content> "${name}_op"</#if>    value="${defaultOption}"/><#rt/>
 </#if>
+<#--#Bam# validate-form
  <input type="text" <@renderClass className alert /> name="${name}"<#if value?has_content> value="${value}"</#if><#if size?has_content> size="${size}"</#if><#if maxlength?has_content> maxlength="${maxlength}"</#if><#if autocomplete?has_content> autocomplete="off"</#if>/><#rt/>
+-->
+ <input type="text" <@renderClass className alert /> <#if validateLinkOnEnter?has_content && validateLinkOnEnter && validateLinkId?has_content>onkeydown="if ((window.event && window.event.keyCode == 13) || (event && event.keyCode == 13)) clickLink('${validateLinkId}_div')"</#if> name="${name}"<#if value?has_content> value="${value}"</#if><#if size?has_content> size="${size}"</#if><#if maxlength?has_content> maxlength="${maxlength}"</#if><#if autocomplete?has_content> autocomplete="off"</#if>/><#rt/>
+<#--#Eam# validate-form -->
 <#if titleStyle?has_content><span class="${titleStyle}" ><#rt/></#if>
 <#if hideIgnoreCase>
  <input type="hidden" name="${name}_ic" value=<#if ignCase>"Y"<#else> ""</#if>/><#rt/>
@@ -770,4 +792,8 @@ Parameter: lastViewName, String, optiona
 
 <#macro makeHiddenFormLinkForm actionUrl name parameters targetWindow><form method="post" action="${actionUrl}" <#if targetWindow?has_content>target="${targetWindow}"</#if> onsubmit="javascript:submitFormDisableSubmits(this)" name="${name}"><#list parameters as parameter><input name="${parameter.name}" value="${parameter.value}" type="hidden"/></#list></form></#macro>
 <#macro makeHiddenFormLinkAnchor linkStyle hiddenFormName event action imgSrc description confirmation><a <#if linkStyle?has_content>class="${linkStyle}"</#if> href="javascript:document.${hiddenFormName}.submit()"<#if action?has_content && event?has_content> ${event}="${action}"</#if><#if confirmation?has_content> onclick="return confirm('${confirmation?js_string}')"</#if>><#if imgSrc?has_content><img src="${imgSrc}" alt=""/></#if>${description}</a></#macro>
+<#--#Bam# validate-form
 <#macro makeHyperlinkString linkStyle hiddenFormName event action imgSrc title alternate linkUrl targetWindow description confirmation><a <#if linkStyle?has_content>class="${linkStyle}"</#if> href="${linkUrl}"<#if targetWindow?has_content> target="${targetWindow}"</#if><#if action?has_content && event?has_content> ${event}="${action}"</#if><#if confirmation?has_content> onclick="return confirm('${confirmation?js_string}')"</#if><#if imgSrc?length == 0 && title?has_content> title="${title}"</#if>><#if imgSrc?has_content><img src="${imgSrc}" alt="${alternate}" title="${title}"/></#if>${description}</a></#macro>
+-->
+<#macro makeHyperlinkString linkStyle hiddenFormName event action id imgSrc title alternate linkUrl targetWindow description confirmation><#if id?has_content><div id="${id}_div"></#if><a <#if linkStyle?has_content>class="${linkStyle}"</#if> href="${linkUrl}"<#if targetWindow?has_content> target="${targetWindow}"</#if><#if action?has_content && event?has_content> ${event}="${action}"</#if><#if confirmation?has_content> onclick="return confirm('${confirmation?js_string}')"</#if><#if imgSrc?length == 0 && title?has_content> title="${title}"</#if>><#if imgSrc?has_content><img src="${imgSrc}" alt="${alternate}" title="${title}"/></#if>${description}</a><#if id?has_content></div></#if></#macro>
+<#--#Eam# validate-form -->

Modified: ofbiz/branches/20120329_portletWidget/framework/widget/templates/htmlScreenMacroLibrary.ftl
URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/widget/templates/htmlScreenMacroLibrary.ftl?rev=1370439&r1=1370438&r2=1370439&view=diff
==============================================================================
--- ofbiz/branches/20120329_portletWidget/framework/widget/templates/htmlScreenMacroLibrary.ftl (original)
+++ ofbiz/branches/20120329_portletWidget/framework/widget/templates/htmlScreenMacroLibrary.ftl Tue Aug  7 19:13:03 2012
@@ -193,7 +193,11 @@ ${menuString}
   </table>
 </#macro>
 
+<#--#Bam# portletWidget  add new field in PortalPageColumn to be able to have multiple line in a portalPage. Each line has multiple column
 <#macro renderPortalPageColumnBegin originalPortalPageId portalPageId columnSeqId confMode="false" width="auto" delColumnLabel="Delete column" delColumnHint="Delete this column" addPortletLabel="Add portlet" addPortletHint="Add a new portlet to this column" colWidthLabel="Col. width:" setColumnSizeHint="Set column size">
+-->
+<#macro renderPortalPageColumnBegin originalPortalPageId portalPageId columnSeqId confMode="false" width="auto" delColumnLabel="Delete column" delColumnHint="Delete this column" addPortletLabel="Add portlet" addPortletHint="Add a new portlet to this column" colWidthLabel="Col. width:" setColumnSizeHint="Set column size" newLine="N">
+<#--#Eam# portletWidget -->
   <#assign columnKey = portalPageId+columnSeqId>
   <#assign columnKeyFields = '<input name="portalPageId" value="' + portalPageId + '" type="hidden"/><input name="columnSeqId" value="' + columnSeqId + '" type="hidden"/>'>
   <script type="text/javascript">
@@ -205,6 +209,11 @@ ${menuString}
       }
     }
   </script>
+  <#--#Bam# portletWidget  add new field in PortalPageColumn to be able to have multiple line in a portalPage. Each line has multiple column -->
+  <#if newLine == "Y">
+    </tr></table><table width="100%"><tr>
+  </#if>
+  <#--#Eam# portletWidget -->
   <td class="portal-column<#if confMode == "true">-config</#if> connectedSortable" style="vertical-align: top; <#if width?has_content> width:${width};</#if>" id="portalColumn_${columnSeqId}">
     <#if confMode == "true">
       <div class="portal-column-config-title-bar">
@@ -237,10 +246,17 @@ ${menuString}
   </td>
 </#macro>
 
+<#--#Bam# portletWidget -->
+<#--
 <#macro renderPortalPagePortletBegin originalPortalPageId portalPageId portalPortletId portletSeqId prevPortletId="" prevPortletSeqId="" nextPortletId="" nextPortletSeqId="" columnSeqId="" prevColumnSeqId="" nextColumnSeqId="" confMode="false" delPortletHint="Remove this portlet" editAttribute="false" editAttributeHint="Edit portlet parameters">
+-->
+<#macro renderPortalPagePortletBegin originalPortalPageId portalPageId portalPortletId portletSeqId includedInPage prevPortletId="" prevPortletSeqId="" nextPortletId="" nextPortletSeqId="" columnSeqId="" prevColumnSeqId="" nextColumnSeqId="" confMode="false" delPortletHint="Remove this portlet" editAttribute="false" editAttributeHint="Edit portlet parameters">
+<#--#Eam# portletWidget  -->
   <#assign portletKey = portalPageId+portalPortletId+portletSeqId>
   <#assign portletKeyFields = '<input name="portalPageId" value="' + portalPageId + '" type="hidden"/><input name="portalPortletId" value="' + portalPortletId + '" type="hidden"/><input name="portletSeqId" value="' + portletSeqId  + '" type="hidden"/>'>
+  <#if includedInPage=="Y"><#--#Bam# portletWidget -->
   <div id="PP_${portletKey}" name="portalPortlet" class="noClass" portalPageId="${portalPageId}" portalPortletId="${portalPortletId}" columnSeqId="${columnSeqId}" portletSeqId="${portletSeqId}">
+  </#if><#--#Bam# portletWidget -->
     <#if confMode == "true">
       <div class="portlet-config" id="PPCFG_${portletKey}">
         <div class="portlet-config-title-bar">
@@ -314,8 +330,73 @@ ${menuString}
       </#if>
 </#macro>
 
+<#--#Bam# portletWidget screenlet navigation form (ajax) -->
+<#macro renderScreenletBeginWithPaginate id title collapsible saveCollapsed collapsibleAreaId expandToolTip collapseToolTip fullUrlString padded menuString showMore collapsed javaScriptEnabled paginateStyle paginateFirstStyle viewIndex highIndex listSize viewSize ajaxEnabled javaScriptEnabled ajaxFirstUrl firstUrl paginateFirstLabel paginatePreviousStyle ajaxPreviousUrl previousUrl paginatePreviousLabel pageLabel ajaxSelectUrl selectUrl ajaxSelectSizeUrl selectSizeUrl commonDisplaying paginateNextStyle ajaxNextUrl nextUrl paginateNextLabel paginateLastStyle ajaxLastUrl lastUrl paginateLastLabel paginateViewSizeLabel>
+<div class="screenlet"<#if id?has_content> id="${id}"</#if>><#rt/>
+<#if showMore>
+<div class="screenlet-title-bar-pager">
+        <ul>
+<#if title?has_content>
+            <li class="h3">${title}</li>
+</#if>
+            <li>&nbsp;</li>
+<#if listSize gt viewSize>
+            <li class="${paginateFirstStyle}<#if viewIndex gt 0>"><a href="<#if ajaxEnabled>javascript:ajaxUpdateAreas('${ajaxFirstUrl}')<#else>${firstUrl}</#if>">${paginateFirstLabel}</a><#else>-disabled"><span>${paginateFirstLabel}</span></#if></li>
+            <li class="${paginatePreviousStyle}<#if viewIndex gt 0>"><a href="<#if ajaxEnabled>javascript:ajaxUpdateAreas('${ajaxPreviousUrl}')<#else>${previousUrl}</#if>">${paginatePreviousLabel}</a><#else>-disabled"><span>${paginatePreviousLabel}</span></#if></li>
+     <#if listSize gt 0 && javaScriptEnabled>
+            <li class="nav-page-select">${pageLabel} 
+                <select name="page" size="1" onchange="<#if ajaxEnabled>javascript:ajaxUpdateAreas('${ajaxSelectUrl}')<#else>location.href='${selectUrl}'+this.value;</#if>"><#rt/>
+        <#assign x=Static["java.lang.Math"].floor(listSize/viewSize)>
+        <#if listSize gt (viewIndex*viewSize)><#assign x=x+1></#if>
+        <#list 1..x as i>
+            <#if i == (viewIndex+1)><option selected="selected" value="<#else><option value="</#if>${i-1}">${i}</option>
+        </#list>
+                </select>
+            </li>
+    </#if>
+            <li class="${paginateNextStyle}<#if highIndex lt listSize>"><a href="<#if ajaxEnabled>javascript:ajaxUpdateAreas('${ajaxNextUrl}')<#else>${nextUrl}</#if>">${paginateNextLabel}</a><#else>-disabled"><span>${paginateNextLabel}</span></#if></li>
+            <li class="${paginateLastStyle}<#if highIndex lt listSize>"><a href="<#if ajaxEnabled>javascript:ajaxUpdateAreas('${ajaxLastUrl}')<#else>${lastUrl}</#if>">${paginateLastLabel}</a><#else>-disabled"><span>${paginateLastLabel}</span></#if></li>
+    <#if javaScriptEnabled>
+            <li class="nav-pagesize">
+                <select name="pageSize" size="1" onchange="<#if ajaxEnabled>javascript:ajaxUpdateAreas('${ajaxSelectSizeUrl}')<#else>location.href='${selectSizeUrl}';</#if>"><#rt/>
+        <#assign availPageSizes = [20, 30, 50, 100, 200]>
+        <#list availPageSizes as ps>
+                    <option <#if viewSize == ps>selected="selected" </#if> value="${ps}">${ps}</option>
+        </#list>
+                </select> ${paginateViewSizeLabel}
+            </li>
+            <li>&nbsp;</li>
+    </#if>
+</#if>
+
+<#if collapsible>
+            <li class="<#rt/>
+    <#if collapsed>
+collapsed"><a <#if javaScriptEnabled>onclick="javascript:toggleScreenlet(this, '${collapsibleAreaId}', '${saveCollapsed?string}', '${expandToolTip}', '${collapseToolTip}');"<#else>href="${fullUrlString}"</#if><#if expandToolTip?has_content> title="${expandToolTip}"</#if>
+    <#else>
+expanded nav-displaying"><a <#if javaScriptEnabled>onclick="javascript:toggleScreenlet(this, '${collapsibleAreaId}', '${saveCollapsed?string}', '${expandToolTip}', '${collapseToolTip}');"<#else>href="${fullUrlString}"</#if><#if collapseToolTip?has_content> title="${collapseToolTip}"</#if>
+    </#if>>&nbsp;</a>
+            </li>
+            <#if listSize gt viewSize>
+            <li class="nav-displaying">${commonDisplaying}</li>
+            </#if>
+</#if>
+        </ul>
+
+</div>
+<#if menuString?has_content><div class="screenlet-title-bar"><ul>${menuString}</ul></div></#if><#--#Eam# portletWidget -->
+</#if>
+<div <#if collapsibleAreaId?has_content> id="${collapsibleAreaId}" <#if collapsed> style="display: none;"</#if></#if><#if padded> class="screenlet-body"<#else> class="screenlet-body no-padding"</#if>>
+</#macro>
+<#--#Eam# portletWidget navigation form (ajax)-->
+<#--#Bam# portletWidget
 <#macro renderPortalPagePortletEnd confMode="false">
+-->
+<#macro renderPortalPagePortletEnd includedInPage confMode="false">
+<#--#Bam# portletWidget -->
+  <#if includedInPage=="Y"> <#--#Eam# portletWidget -->
   </div>
+  </#if> <#--#Eam# portletWidget -->
   <#if confMode == "true">
     </div>
   </#if>