Hi David,
can you please have a look at this commit? any options within myportal now only show the main option. can you please check? Regards, Hans On Wed, 2010-04-28 at 08:33 +0000, [hidden email] wrote: > Author: jonesde > Date: Wed Apr 28 08:33:37 2010 > New Revision: 938816 > > URL: http://svn.apache.org/viewvc?rev=938816&view=rev > Log: > Refactored the various link getParameterList methods to return a Map and expand with the context like most of the other get methods that are used during rendering; that is the biggest change but was part of adding a parameters-map attribute to the form widget hyperlink element to be able to use a script to prepare part or all of the parameters map used in the hidden form instead of having to manually declare all parameters > > Modified: > ofbiz/trunk/framework/widget/dtd/widget-form.xsd > ofbiz/trunk/framework/widget/src/org/ofbiz/widget/WidgetWorker.java > ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java > ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java > ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java > ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlMenuRenderer.java > ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlScreenRenderer.java > ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlTreeRenderer.java > ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuItem.java > ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java > ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenWidget.java > ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/MacroTreeRenderer.java > ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/ModelTree.java > > Modified: ofbiz/trunk/framework/widget/dtd/widget-form.xsd > URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/dtd/widget-form.xsd?rev=938816&r1=938815&r2=938816&view=diff > ============================================================================== > --- ofbiz/trunk/framework/widget/dtd/widget-form.xsd (original) > +++ ofbiz/trunk/framework/widget/dtd/widget-form.xsd Wed Apr 28 08:33:37 2010 > @@ -856,6 +856,9 @@ under the License. > </xs:simpleType> > </xs:attribute> > <xs:attribute name="confirmation-message" type="xs:string"><xs:annotation><xs:documentation>The message displayed in confirmation box</xs:documentation></xs:annotation></xs:attribute> > + <xs:attribute name="parameters-map" type="xs:string"> > + <xs:annotation><xs:documentation>A Map in the context that will be used as additional name/value pairs.</xs:documentation></xs:annotation> > + </xs:attribute> > </xs:attributeGroup> > <xs:element name="parameter"> > <xs:complexType> > > Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/WidgetWorker.java > URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/WidgetWorker.java?rev=938816&r1=938815&r2=938816&view=diff > ============================================================================== > --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/WidgetWorker.java (original) > +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/WidgetWorker.java Wed Apr 28 08:33:37 2010 > @@ -50,7 +50,7 @@ public class WidgetWorker { > > public WidgetWorker () {} > > - public static void buildHyperlinkUrl(Appendable externalWriter, String target, String targetType, List<WidgetWorker.Parameter> parameterList, > + public static void buildHyperlinkUrl(Appendable externalWriter, String target, String targetType, Map<String, String> parameterMap, > String prefix, boolean fullPath, boolean secure, boolean encode, HttpServletRequest request, HttpServletResponse response, Map<String, Object> context) throws IOException { > String localRequestName = UtilHttp.encodeAmpersands(target); > Appendable localWriter = new StringWriter(); > @@ -87,7 +87,7 @@ public class WidgetWorker { > localWriter.append(localRequestName); > } > > - if (UtilValidate.isNotEmpty(parameterList)) { > + if (UtilValidate.isNotEmpty(parameterMap)) { > String localUrl = localWriter.toString(); > externalWriter.append(localUrl); > boolean needsAmp = true; > @@ -96,19 +96,19 @@ public class WidgetWorker { > needsAmp = false; > } > > - for (WidgetWorker.Parameter parameter: parameterList) { > + for (Map.Entry<String, String> parameter: parameterMap.entrySet()) { > if (needsAmp) { > externalWriter.append("&"); > } else { > needsAmp = true; > } > - externalWriter.append(parameter.getName()); > + externalWriter.append(parameter.getKey()); > externalWriter.append('='); > StringUtil.SimpleEncoder simpleEncoder = (StringUtil.SimpleEncoder) context.get("simpleEncoder"); > if (simpleEncoder != null) { > - externalWriter.append(simpleEncoder.encode(parameter.getValue(context))); > + externalWriter.append(simpleEncoder.encode(parameter.getValue())); > } else { > - externalWriter.append(parameter.getValue(context)); > + externalWriter.append(parameter.getValue()); > } > } > } else { > @@ -123,7 +123,7 @@ public class WidgetWorker { > writer.append(location); > } > public static void makeHyperlinkByType(Appendable writer, String linkType, String linkStyle, String targetType, String target, > - List<WidgetWorker.Parameter> parameterList, String description, String targetWindow, String confirmation, ModelFormField modelFormField, > + Map<String, String> parameterMap, String description, String targetWindow, String confirmation, ModelFormField modelFormField, > HttpServletRequest request, HttpServletResponse response, Map<String, Object> context) throws IOException { > String realLinkType = WidgetWorker.determineAutoLinkType(linkType, target, targetType, request); > if ("hidden-form".equals(realLinkType)) { > @@ -137,17 +137,17 @@ public class WidgetWorker { > postMultiFormWriter = new StringWriter(); > wholeFormContext.put("postMultiFormWriter", postMultiFormWriter); > } > - WidgetWorker.makeHiddenFormLinkForm(postMultiFormWriter, target, targetType, targetWindow, parameterList, modelFormField, request, response, context); > + WidgetWorker.makeHiddenFormLinkForm(postMultiFormWriter, target, targetType, targetWindow, parameterMap, modelFormField, request, response, context); > } else { > - WidgetWorker.makeHiddenFormLinkForm(writer, target, targetType, targetWindow, parameterList, modelFormField, request, response, context); > + WidgetWorker.makeHiddenFormLinkForm(writer, target, targetType, targetWindow, parameterMap, modelFormField, request, response, context); > WidgetWorker.makeHiddenFormLinkAnchor(writer, linkStyle, description, confirmation, modelFormField, request, response, context); > } > } else { > - WidgetWorker.makeHyperlinkString(writer, linkStyle, targetType, target, parameterList, description, confirmation, modelFormField, request, response, context, targetWindow); > + WidgetWorker.makeHyperlinkString(writer, linkStyle, targetType, target, parameterMap, description, confirmation, modelFormField, request, response, context, targetWindow); > } > > } > - public static void makeHyperlinkString(Appendable writer, String linkStyle, String targetType, String target, List<WidgetWorker.Parameter> parameterList, > + public static void makeHyperlinkString(Appendable writer, String linkStyle, String targetType, String target, Map<String, String> parameterMap, > String description, String confirmation, ModelFormField modelFormField, HttpServletRequest request, HttpServletResponse response, Map<String, Object> context, String targetWindow) > throws IOException { > if (UtilValidate.isNotEmpty(description) || UtilValidate.isNotEmpty(request.getAttribute("image"))) { > @@ -161,7 +161,7 @@ public class WidgetWorker { > > writer.append(" href=\""); > > - buildHyperlinkUrl(writer, target, targetType, parameterList, null, false, false, true, request, response, context); > + buildHyperlinkUrl(writer, target, targetType, parameterMap, null, false, false, true, request, response, context); > > writer.append("\""); > > @@ -237,7 +237,7 @@ public class WidgetWorker { > } > } > > - public static void makeHiddenFormLinkForm(Appendable writer, String target, String targetType, String targetWindow, List<WidgetWorker.Parameter> parameterList, ModelFormField modelFormField, HttpServletRequest request, HttpServletResponse response, Map<String, Object> context) throws IOException { > + public static void makeHiddenFormLinkForm(Appendable writer, String target, String targetType, String targetWindow, Map<String, String> parameterMap, ModelFormField modelFormField, HttpServletRequest request, HttpServletResponse response, Map<String, Object> context) throws IOException { > writer.append("<form method=\"post\""); > writer.append(" action=\""); > // note that this passes null for the parameterList on purpose so they won't be put into the URL > @@ -256,11 +256,11 @@ public class WidgetWorker { > writer.append(makeLinkHiddenFormName(context, modelFormField)); > writer.append("\">"); > > - for (WidgetWorker.Parameter parameter: parameterList) { > + for (Map.Entry<String, String> parameter: parameterMap.entrySet()) { > writer.append("<input name=\""); > - writer.append(parameter.getName()); > + writer.append(parameter.getKey()); > writer.append("\" value=\""); > - writer.append(parameter.getValue(context)); > + writer.append(parameter.getValue()); > writer.append("\" type=\"hidden\"/>"); > } > > > Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java > URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java?rev=938816&r1=938815&r2=938816&view=diff > ============================================================================== > --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java (original) > +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java Wed Apr 28 08:33:37 2010 > @@ -344,7 +344,7 @@ public class MacroFormRenderer implement > this.request.setAttribute("alternate", encodedAlternate); > this.request.setAttribute("imageTitle", encodedImageTitle); > makeHyperlinkByType(writer, hyperlinkField.getLinkType(), modelFormField.getWidgetStyle(), hyperlinkField.getTargetType(), hyperlinkField.getTarget(context), > - hyperlinkField.getParameterList(), hyperlinkField.getDescription(context), hyperlinkField.getTargetWindow(context), hyperlinkField.getConfirmation(context), modelFormField, > + hyperlinkField.getParameterMap(context), hyperlinkField.getDescription(context), hyperlinkField.getTargetWindow(context), hyperlinkField.getConfirmation(context), modelFormField, > this.request, this.response, context); > > this.appendTooltip(writer, context, modelFormField); > @@ -2813,7 +2813,7 @@ public class MacroFormRenderer implement > if (subHyperlink.shouldUse(context)) { > writer.append(' '); > makeHyperlinkByType(writer, subHyperlink.getLinkType(), subHyperlink.getLinkStyle(), subHyperlink.getTargetType(), subHyperlink.getTarget(context), > - subHyperlink.getParameterList(), subHyperlink.getDescription(context), subHyperlink.getTargetWindow(context), subHyperlink.getConfirmation(context), subHyperlink.getModelFormField(), > + subHyperlink.getParameterMap(context), subHyperlink.getDescription(context), subHyperlink.getTargetWindow(context), subHyperlink.getConfirmation(context), subHyperlink.getModelFormField(), > this.request, this.response, context); > } > } > @@ -2841,7 +2841,7 @@ public class MacroFormRenderer implement > } > > public void makeHyperlinkByType(Appendable writer, String linkType, String linkStyle, String targetType, String target, > - List<WidgetWorker.Parameter> parameterList, String description, String targetWindow, String confirmation , ModelFormField modelFormField, > + Map<String, String> parameterMap, String description, String targetWindow, String confirmation , ModelFormField modelFormField, > HttpServletRequest request, HttpServletResponse response, Map<String, Object> context) throws IOException { > String realLinkType = WidgetWorker.determineAutoLinkType(linkType, target, targetType, request); > > @@ -2858,24 +2858,24 @@ public class MacroFormRenderer implement > postMultiFormWriter = new StringWriter(); > wholeFormContext.put("postMultiFormWriter", postMultiFormWriter); > } > - WidgetWorker.makeHiddenFormLinkForm(postMultiFormWriter, target, targetType, targetWindow, parameterList, modelFormField, request, response, context); > + WidgetWorker.makeHiddenFormLinkForm(postMultiFormWriter, target, targetType, targetWindow, parameterMap, modelFormField, request, response, context); > } else { > - WidgetWorker.makeHiddenFormLinkForm(writer, target, targetType, targetWindow, parameterList, modelFormField, request, response, context); > + WidgetWorker.makeHiddenFormLinkForm(writer, target, targetType, targetWindow, parameterMap, modelFormField, request, response, context); > WidgetWorker.makeHiddenFormLinkAnchor(writer, linkStyle, encodedDescription, confirmation , modelFormField, request, response, context); > } > } else { > - makeHyperlinkString(writer, linkStyle, targetType, target, parameterList, encodedDescription, confirmation , modelFormField, request, response, context, targetWindow); > + makeHyperlinkString(writer, linkStyle, targetType, target, parameterMap, encodedDescription, confirmation , modelFormField, request, response, context, targetWindow); > } > > } > > - public void makeHyperlinkString(Appendable writer, String linkStyle, String targetType, String target, List<WidgetWorker.Parameter> parameterList, > + public void makeHyperlinkString(Appendable writer, String linkStyle, String targetType, String target, Map<String, String> parameterMap, > String description, String confirmation , ModelFormField modelFormField, HttpServletRequest request, HttpServletResponse response, Map<String, Object> context, String targetWindow) > throws IOException { > if (UtilValidate.isNotEmpty(description) || UtilValidate.isNotEmpty(request.getAttribute("image"))) { > StringBuilder linkUrl = new StringBuilder(); > > - WidgetWorker.buildHyperlinkUrl(linkUrl, target, targetType, parameterList, null, false, false, true, request, response, context); > + WidgetWorker.buildHyperlinkUrl(linkUrl, target, targetType, parameterMap, null, false, false, true, request, response, context); > > String event = ""; > String action = ""; > > Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java > URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java?rev=938816&r1=938815&r2=938816&view=diff > ============================================================================== > --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java (original) > +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java Wed Apr 28 08:33:37 2010 > @@ -2281,6 +2281,7 @@ public class ModelFormField { > protected FlexibleStringExpander alternate; > protected FlexibleStringExpander imageTitle; > protected FlexibleStringExpander targetWindowExdr; > + protected FlexibleMapAccessor<Map<String, String>> parametersMapAcsr; > protected List<WidgetWorker.Parameter> parameterList = FastList.newInstance(); > > protected boolean requestConfirmation = false; > @@ -2308,6 +2309,7 @@ public class ModelFormField { > this.linkType = element.getAttribute("link-type"); > this.targetType = element.getAttribute("target-type"); > this.targetWindowExdr = FlexibleStringExpander.getInstance(element.getAttribute("target-window")); > + this.parametersMapAcsr = FlexibleMapAccessor.getInstance(element.getAttribute("parameters-map")); > this.image = element.getAttribute("image-location"); > this.setRequestConfirmation("true".equals(element.getAttribute("request-confirmation"))); > this.setConfirmationMsg(element.getAttribute("confirmation-message")); > @@ -2380,8 +2382,19 @@ public class ModelFormField { > return this.target.expandString(context); > } > > - public List<WidgetWorker.Parameter> getParameterList() { > - return this.parameterList; > + public Map<String, String> getParameterMap(Map<String, Object> context) { > + Map<String, String> fullParameterMap = FastMap.newInstance(); > + > + Map<String, String> addlParamMap = this.parametersMapAcsr.get(context); > + if (addlParamMap != null) { > + fullParameterMap.putAll(addlParamMap); > + } > + > + for (WidgetWorker.Parameter parameter: this.parameterList) { > + fullParameterMap.put(parameter.getName(), parameter.getValue(context)); > + } > + > + return fullParameterMap; > } > > public String getImage() { > @@ -2507,8 +2520,21 @@ public class ModelFormField { > return this.linkType; > } > > - public List<WidgetWorker.Parameter> getParameterList() { > - return this.parameterList; > + public Map<String, String> getParameterMap(Map<String, Object> context) { > + Map<String, String> fullParameterMap = FastMap.newInstance(); > + > + /* leaving this here... may want to add it at some point like the hyperlink element: > + Map<String, String> addlParamMap = this.parametersMapAcsr.get(context); > + if (addlParamMap != null) { > + fullParameterMap.putAll(addlParamMap); > + } > + */ > + > + for (WidgetWorker.Parameter parameter: this.parameterList) { > + fullParameterMap.put(parameter.getName(), parameter.getValue(context)); > + } > + > + return fullParameterMap; > } > > public String getUseWhen(Map<String, Object> context) { > > Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java > URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java?rev=938816&r1=938815&r2=938816&view=diff > ============================================================================== > --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java (original) > +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java Wed Apr 28 08:33:37 2010 > @@ -333,7 +333,7 @@ public class HtmlFormRenderer extends Ht > String description = encode(hyperlinkField.getDescription(context), modelFormField, context); > String confirmation = encode(hyperlinkField.getConfirmation(context), modelFormField, context); > WidgetWorker.makeHyperlinkByType(writer, hyperlinkField.getLinkType(), modelFormField.getWidgetStyle(), hyperlinkField.getTargetType(), hyperlinkField.getTarget(context), > - hyperlinkField.getParameterList(), description, hyperlinkField.getTargetWindow(context), confirmation, modelFormField, > + hyperlinkField.getParameterMap(context), description, hyperlinkField.getTargetWindow(context), confirmation, modelFormField, > this.request, this.response, context); > this.appendTooltip(writer, context, modelFormField); > //appendWhitespace(writer); > @@ -347,7 +347,7 @@ public class HtmlFormRenderer extends Ht > writer.append(' '); > String description = encode(subHyperlink.getDescription(context), subHyperlink.getModelFormField(), context); > WidgetWorker.makeHyperlinkByType(writer, subHyperlink.getLinkType(), subHyperlink.getLinkStyle(), subHyperlink.getTargetType(), subHyperlink.getTarget(context), > - subHyperlink.getParameterList(), description, subHyperlink.getTargetWindow(context), subHyperlink.getConfirmation(context), subHyperlink.getModelFormField(), > + subHyperlink.getParameterMap(context), description, subHyperlink.getTargetWindow(context), subHyperlink.getConfirmation(context), subHyperlink.getModelFormField(), > this.request, this.response, context); > } > } > > Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlMenuRenderer.java > URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlMenuRenderer.java?rev=938816&r1=938815&r2=938816&view=diff > ============================================================================== > --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlMenuRenderer.java (original) > +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlMenuRenderer.java Wed Apr 28 08:33:37 2010 > @@ -418,14 +418,14 @@ public class HtmlMenuRenderer extends Ht > writer.append("\">"); > > StringUtil.SimpleEncoder simpleEncoder = (StringUtil.SimpleEncoder) context.get("simpleEncoder"); > - for (WidgetWorker.Parameter parameter: link.getParameterList()) { > + for (Map.Entry<String, String> parameter: link.getParameterMap(context).entrySet()) { > writer.append("<input name=\""); > - writer.append(parameter.getName()); > + writer.append(parameter.getKey()); > writer.append("\" value=\""); > if (simpleEncoder != null) { > - writer.append(simpleEncoder.encode(parameter.getValue(context))); > + writer.append(simpleEncoder.encode(parameter.getValue())); > } else { > - writer.append(parameter.getValue(context)); > + writer.append(parameter.getValue()); > } > writer.append("\" type=\"hidden\"/>"); > } > @@ -478,11 +478,11 @@ public class HtmlMenuRenderer extends Ht > writer.append("javascript:confirmActionLink('"); > writer.append(confirmationMsg); > writer.append("', '"); > - WidgetWorker.buildHyperlinkUrl(writer, target, link.getUrlMode(), link.getParameterList(), link.getPrefix(context), > + WidgetWorker.buildHyperlinkUrl(writer, target, link.getUrlMode(), link.getParameterMap(context), link.getPrefix(context), > link.getFullPath(), link.getSecure(), link.getEncode(), request, response, context); > writer.append("')"); > } else { > - WidgetWorker.buildHyperlinkUrl(writer, target, link.getUrlMode(), link.getParameterList(), link.getPrefix(context), > + WidgetWorker.buildHyperlinkUrl(writer, target, link.getUrlMode(), link.getParameterMap(context), link.getPrefix(context), > link.getFullPath(), link.getSecure(), link.getEncode(), request, response, context); > } > } > > Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlScreenRenderer.java > URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlScreenRenderer.java?rev=938816&r1=938815&r2=938816&view=diff > ============================================================================== > --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlScreenRenderer.java (original) > +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlScreenRenderer.java Wed Apr 28 08:33:37 2010 > @@ -495,11 +495,11 @@ public class HtmlScreenRenderer extends > writer.append(uniqueItemName); > writer.append("\">"); > > - for (WidgetWorker.Parameter parameter: link.getParameterList()) { > + for (Map.Entry<String, String> parameter: link.getParameterMap(context).entrySet()) { > writer.append("<input name=\""); > - writer.append(parameter.getName()); > + writer.append(parameter.getKey()); > writer.append("\" value=\""); > - writer.append(parameter.getValue(context)); > + writer.append(parameter.getValue()); > writer.append("\" type=\"hidden\"/>"); > } > > @@ -537,7 +537,7 @@ public class HtmlScreenRenderer extends > writer.append(uniqueItemName); > writer.append(".submit()"); > } else { > - WidgetWorker.buildHyperlinkUrl(writer, target, link.getUrlMode(), link.getParameterList(), link.getPrefix(context), > + WidgetWorker.buildHyperlinkUrl(writer, target, link.getUrlMode(), link.getParameterMap(context), link.getPrefix(context), > link.getFullPath(), link.getSecure(), link.getEncode(), request, response, context); > } > writer.append("\""); > > Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlTreeRenderer.java > URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlTreeRenderer.java?rev=938816&r1=938815&r2=938816&view=diff > ============================================================================== > --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlTreeRenderer.java (original) > +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlTreeRenderer.java Wed Apr 28 08:33:37 2010 > @@ -221,7 +221,7 @@ public class HtmlTreeRenderer extends Ht > HttpServletRequest req = (HttpServletRequest) context.get("request"); > if (urlMode != null && urlMode.equalsIgnoreCase("intra-app")) { > if (req != null && res != null) { > - WidgetWorker.buildHyperlinkUrl(writer, target, link.getUrlMode(), link.getParameterList(), link.getPrefix(context), > + WidgetWorker.buildHyperlinkUrl(writer, target, link.getUrlMode(), link.getParameterMap(context), link.getPrefix(context), > link.getFullPath(), link.getSecure(), link.getEncode(), req, res, context); > } else if (prefix != null) { > writer.append(prefix).append(target); > > Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuItem.java > URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuItem.java?rev=938816&r1=938815&r2=938816&view=diff > ============================================================================== > --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuItem.java (original) > +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuItem.java Wed Apr 28 08:33:37 2010 > @@ -28,6 +28,7 @@ import java.util.Map; > import javax.xml.parsers.ParserConfigurationException; > > import javolution.util.FastList; > +import javolution.util.FastMap; > > import org.ofbiz.base.util.Debug; > import org.ofbiz.base.util.StringUtil; > @@ -289,12 +290,12 @@ public class ModelMenuItem { > localItem.name = portalPage.getString("portalPageId"); > localItem.setTitle((String) portalPage.get("portalPageName", locale)); > localItem.link = new Link(this); > - List<WidgetWorker.Parameter> linkParams = localItem.link.getParameterList(); > - linkParams.add(new WidgetWorker.Parameter("portalPageId", portalPage.getString("portalPageId"), false)); > - linkParams.add(new WidgetWorker.Parameter("parentPortalPageId", parentPortalPageId, false)); > + Map<String, String> linkParams = localItem.link.getParameterMap(context); > + linkParams.put("portalPageId", portalPage.getString("portalPageId")); > + linkParams.put("parentPortalPageId", parentPortalPageId); > if (link != null) { > localItem.link.setTarget(link.targetExdr.getOriginal()); > - linkParams.addAll(link.parameterList); > + linkParams.putAll(link.getParameterMap(context)); > } else { > localItem.link.setTarget("showPortalPage"); > } > @@ -741,8 +742,21 @@ public class ModelMenuItem { > return this.linkType; > } > > - public List<WidgetWorker.Parameter> getParameterList() { > - return this.parameterList; > + public Map<String, String> getParameterMap(Map<String, Object> context) { > + Map<String, String> fullParameterMap = FastMap.newInstance(); > + > + /* leaving this here... may want to add it at some point like the hyperlink element: > + Map<String, String> addlParamMap = this.parametersMapAcsr.get(context); > + if (addlParamMap != null) { > + fullParameterMap.putAll(addlParamMap); > + } > + */ > + > + for (WidgetWorker.Parameter parameter: this.parameterList) { > + fullParameterMap.put(parameter.getName(), parameter.getValue(context)); > + } > + > + return fullParameterMap; > } > > public String getConfirmation(Map<String, Object> context) { > > Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java > URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java?rev=938816&r1=938815&r2=938816&view=diff > ============================================================================== > --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java (original) > +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java Wed Apr 28 08:33:37 2010 > @@ -223,15 +223,15 @@ public class MacroScreenRenderer impleme > link.getFullPath(), link.getSecure(), link.getEncode(), request, response, context); > actionUrl = sb.toString(); > parameters.append("["); > - for (WidgetWorker.Parameter parameter: link.getParameterList()) { > + for (Map.Entry<String, String> parameter: link.getParameterMap(context).entrySet()) { > if (parameters.length() >1) { > parameters.append(","); > } > parameters.append("{'name':'"); > - parameters.append(parameter.getName()); > + parameters.append(parameter.getKey()); > parameters.append("'"); > parameters.append(",'value':'"); > - parameters.append(parameter.getValue(context)); > + parameters.append(parameter.getValue()); > parameters.append("'}"); > } > parameters.append("]"); > @@ -244,7 +244,7 @@ public class MacroScreenRenderer impleme > if (UtilValidate.isNotEmpty(target)) { > if (!"hidden-form".equals(linkType)) { > StringBuilder sb = new StringBuilder(); > - WidgetWorker.buildHyperlinkUrl(sb, target, link.getUrlMode(), link.getParameterList(), link.getPrefix(context), > + WidgetWorker.buildHyperlinkUrl(sb, target, link.getUrlMode(), link.getParameterMap(context), link.getPrefix(context), > link.getFullPath(), link.getSecure(), link.getEncode(), request, response, context); > linkUrl = sb.toString(); > } > > Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenWidget.java > URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenWidget.java?rev=938816&r1=938815&r2=938816&view=diff > ============================================================================== > --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenWidget.java (original) > +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenWidget.java Wed Apr 28 08:33:37 2010 > @@ -29,6 +29,7 @@ import javax.servlet.http.HttpServletRes > import javax.xml.parsers.ParserConfigurationException; > > import javolution.util.FastList; > +import javolution.util.FastMap; > > import org.ofbiz.base.util.Debug; > import org.ofbiz.base.util.GeneralException; > @@ -1480,8 +1481,21 @@ public abstract class ModelScreenWidget > return this.linkType; > } > > - public List<WidgetWorker.Parameter> getParameterList() { > - return this.parameterList; > + public Map<String, String> getParameterMap(Map<String, Object> context) { > + Map<String, String> fullParameterMap = FastMap.newInstance(); > + > + /* leaving this here... may want to add it at some point like the hyperlink element: > + Map<String, String> addlParamMap = this.parametersMapAcsr.get(context); > + if (addlParamMap != null) { > + fullParameterMap.putAll(addlParamMap); > + } > + */ > + > + for (WidgetWorker.Parameter parameter: this.parameterList) { > + fullParameterMap.put(parameter.getName(), parameter.getValue(context)); > + } > + > + return fullParameterMap; > } > > public void setText(String val) { > > Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/MacroTreeRenderer.java > URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/MacroTreeRenderer.java?rev=938816&r1=938815&r2=938816&view=diff > ============================================================================== > --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/MacroTreeRenderer.java (original) > +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/MacroTreeRenderer.java Wed Apr 28 08:33:37 2010 > @@ -267,7 +267,7 @@ public class MacroTreeRenderer implement > HttpServletRequest request = (HttpServletRequest) context.get("request"); > > if (UtilValidate.isNotEmpty(target)) { > - WidgetWorker.buildHyperlinkUrl(linkUrl, target, link.getUrlMode(), link.getParameterList(), link.getPrefix(context), > + WidgetWorker.buildHyperlinkUrl(linkUrl, target, link.getUrlMode(), link.getParameterMap(context), link.getPrefix(context), > link.getFullPath(), link.getSecure(), link.getEncode(), request, response, context); > } > > > Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/ModelTree.java > URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/ModelTree.java?rev=938816&r1=938815&r2=938816&view=diff > ============================================================================== > --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/ModelTree.java (original) > +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/ModelTree.java Wed Apr 28 08:33:37 2010 > @@ -930,8 +930,21 @@ public class ModelTree extends ModelWidg > return this.linkType; > } > > - public List<WidgetWorker.Parameter> getParameterList() { > - return this.parameterList; > + public Map<String, String> getParameterMap(Map<String, Object> context) { > + Map<String, String> fullParameterMap = FastMap.newInstance(); > + > + /* leaving this here... may want to add it at some point like the hyperlink element: > + Map<String, String> addlParamMap = this.parametersMapAcsr.get(context); > + if (addlParamMap != null) { > + fullParameterMap.putAll(addlParamMap); > + } > + */ > + > + for (WidgetWorker.Parameter parameter: this.parameterList) { > + fullParameterMap.put(parameter.getName(), parameter.getValue(context)); > + } > + > + return fullParameterMap; > } > > public void setText(String val) { > > Ofbiz on twitter: http://twitter.com/apache_ofbiz Myself on twitter: http://twitter.com/hansbak Antwebsystems.com: Quality services for competitive rates. |
Could you be more specific? Ie, what does "options within myportal" refer to? -David On May 2, 2010, at 1:32 AM, Hans Bakker wrote: > Hi David, > can you please have a look at this commit? > > any options within myportal now only show the main option. > > can you please check? > > Regards, > > Hans > > > On Wed, 2010-04-28 at 08:33 +0000, [hidden email] wrote: >> Author: jonesde >> Date: Wed Apr 28 08:33:37 2010 >> New Revision: 938816 >> >> URL: http://svn.apache.org/viewvc?rev=938816&view=rev >> Log: >> Refactored the various link getParameterList methods to return a Map and expand with the context like most of the other get methods that are used during rendering; that is the biggest change but was part of adding a parameters-map attribute to the form widget hyperlink element to be able to use a script to prepare part or all of the parameters map used in the hidden form instead of having to manually declare all parameters >> >> Modified: >> ofbiz/trunk/framework/widget/dtd/widget-form.xsd >> ofbiz/trunk/framework/widget/src/org/ofbiz/widget/WidgetWorker.java >> ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java >> ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java >> ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java >> ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlMenuRenderer.java >> ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlScreenRenderer.java >> ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlTreeRenderer.java >> ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuItem.java >> ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java >> ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenWidget.java >> ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/MacroTreeRenderer.java >> ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/ModelTree.java >> >> Modified: ofbiz/trunk/framework/widget/dtd/widget-form.xsd >> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/dtd/widget-form.xsd?rev=938816&r1=938815&r2=938816&view=diff >> ============================================================================== >> --- ofbiz/trunk/framework/widget/dtd/widget-form.xsd (original) >> +++ ofbiz/trunk/framework/widget/dtd/widget-form.xsd Wed Apr 28 08:33:37 2010 >> @@ -856,6 +856,9 @@ under the License. >> </xs:simpleType> >> </xs:attribute> >> <xs:attribute name="confirmation-message" type="xs:string"><xs:annotation><xs:documentation>The message displayed in confirmation box</xs:documentation></xs:annotation></xs:attribute> >> + <xs:attribute name="parameters-map" type="xs:string"> >> + <xs:annotation><xs:documentation>A Map in the context that will be used as additional name/value pairs.</xs:documentation></xs:annotation> >> + </xs:attribute> >> </xs:attributeGroup> >> <xs:element name="parameter"> >> <xs:complexType> >> >> Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/WidgetWorker.java >> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/WidgetWorker.java?rev=938816&r1=938815&r2=938816&view=diff >> ============================================================================== >> --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/WidgetWorker.java (original) >> +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/WidgetWorker.java Wed Apr 28 08:33:37 2010 >> @@ -50,7 +50,7 @@ public class WidgetWorker { >> >> public WidgetWorker () {} >> >> - public static void buildHyperlinkUrl(Appendable externalWriter, String target, String targetType, List<WidgetWorker.Parameter> parameterList, >> + public static void buildHyperlinkUrl(Appendable externalWriter, String target, String targetType, Map<String, String> parameterMap, >> String prefix, boolean fullPath, boolean secure, boolean encode, HttpServletRequest request, HttpServletResponse response, Map<String, Object> context) throws IOException { >> String localRequestName = UtilHttp.encodeAmpersands(target); >> Appendable localWriter = new StringWriter(); >> @@ -87,7 +87,7 @@ public class WidgetWorker { >> localWriter.append(localRequestName); >> } >> >> - if (UtilValidate.isNotEmpty(parameterList)) { >> + if (UtilValidate.isNotEmpty(parameterMap)) { >> String localUrl = localWriter.toString(); >> externalWriter.append(localUrl); >> boolean needsAmp = true; >> @@ -96,19 +96,19 @@ public class WidgetWorker { >> needsAmp = false; >> } >> >> - for (WidgetWorker.Parameter parameter: parameterList) { >> + for (Map.Entry<String, String> parameter: parameterMap.entrySet()) { >> if (needsAmp) { >> externalWriter.append("&"); >> } else { >> needsAmp = true; >> } >> - externalWriter.append(parameter.getName()); >> + externalWriter.append(parameter.getKey()); >> externalWriter.append('='); >> StringUtil.SimpleEncoder simpleEncoder = (StringUtil.SimpleEncoder) context.get("simpleEncoder"); >> if (simpleEncoder != null) { >> - externalWriter.append(simpleEncoder.encode(parameter.getValue(context))); >> + externalWriter.append(simpleEncoder.encode(parameter.getValue())); >> } else { >> - externalWriter.append(parameter.getValue(context)); >> + externalWriter.append(parameter.getValue()); >> } >> } >> } else { >> @@ -123,7 +123,7 @@ public class WidgetWorker { >> writer.append(location); >> } >> public static void makeHyperlinkByType(Appendable writer, String linkType, String linkStyle, String targetType, String target, >> - List<WidgetWorker.Parameter> parameterList, String description, String targetWindow, String confirmation, ModelFormField modelFormField, >> + Map<String, String> parameterMap, String description, String targetWindow, String confirmation, ModelFormField modelFormField, >> HttpServletRequest request, HttpServletResponse response, Map<String, Object> context) throws IOException { >> String realLinkType = WidgetWorker.determineAutoLinkType(linkType, target, targetType, request); >> if ("hidden-form".equals(realLinkType)) { >> @@ -137,17 +137,17 @@ public class WidgetWorker { >> postMultiFormWriter = new StringWriter(); >> wholeFormContext.put("postMultiFormWriter", postMultiFormWriter); >> } >> - WidgetWorker.makeHiddenFormLinkForm(postMultiFormWriter, target, targetType, targetWindow, parameterList, modelFormField, request, response, context); >> + WidgetWorker.makeHiddenFormLinkForm(postMultiFormWriter, target, targetType, targetWindow, parameterMap, modelFormField, request, response, context); >> } else { >> - WidgetWorker.makeHiddenFormLinkForm(writer, target, targetType, targetWindow, parameterList, modelFormField, request, response, context); >> + WidgetWorker.makeHiddenFormLinkForm(writer, target, targetType, targetWindow, parameterMap, modelFormField, request, response, context); >> WidgetWorker.makeHiddenFormLinkAnchor(writer, linkStyle, description, confirmation, modelFormField, request, response, context); >> } >> } else { >> - WidgetWorker.makeHyperlinkString(writer, linkStyle, targetType, target, parameterList, description, confirmation, modelFormField, request, response, context, targetWindow); >> + WidgetWorker.makeHyperlinkString(writer, linkStyle, targetType, target, parameterMap, description, confirmation, modelFormField, request, response, context, targetWindow); >> } >> >> } >> - public static void makeHyperlinkString(Appendable writer, String linkStyle, String targetType, String target, List<WidgetWorker.Parameter> parameterList, >> + public static void makeHyperlinkString(Appendable writer, String linkStyle, String targetType, String target, Map<String, String> parameterMap, >> String description, String confirmation, ModelFormField modelFormField, HttpServletRequest request, HttpServletResponse response, Map<String, Object> context, String targetWindow) >> throws IOException { >> if (UtilValidate.isNotEmpty(description) || UtilValidate.isNotEmpty(request.getAttribute("image"))) { >> @@ -161,7 +161,7 @@ public class WidgetWorker { >> >> writer.append(" href=\""); >> >> - buildHyperlinkUrl(writer, target, targetType, parameterList, null, false, false, true, request, response, context); >> + buildHyperlinkUrl(writer, target, targetType, parameterMap, null, false, false, true, request, response, context); >> >> writer.append("\""); >> >> @@ -237,7 +237,7 @@ public class WidgetWorker { >> } >> } >> >> - public static void makeHiddenFormLinkForm(Appendable writer, String target, String targetType, String targetWindow, List<WidgetWorker.Parameter> parameterList, ModelFormField modelFormField, HttpServletRequest request, HttpServletResponse response, Map<String, Object> context) throws IOException { >> + public static void makeHiddenFormLinkForm(Appendable writer, String target, String targetType, String targetWindow, Map<String, String> parameterMap, ModelFormField modelFormField, HttpServletRequest request, HttpServletResponse response, Map<String, Object> context) throws IOException { >> writer.append("<form method=\"post\""); >> writer.append(" action=\""); >> // note that this passes null for the parameterList on purpose so they won't be put into the URL >> @@ -256,11 +256,11 @@ public class WidgetWorker { >> writer.append(makeLinkHiddenFormName(context, modelFormField)); >> writer.append("\">"); >> >> - for (WidgetWorker.Parameter parameter: parameterList) { >> + for (Map.Entry<String, String> parameter: parameterMap.entrySet()) { >> writer.append("<input name=\""); >> - writer.append(parameter.getName()); >> + writer.append(parameter.getKey()); >> writer.append("\" value=\""); >> - writer.append(parameter.getValue(context)); >> + writer.append(parameter.getValue()); >> writer.append("\" type=\"hidden\"/>"); >> } >> >> >> Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java >> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java?rev=938816&r1=938815&r2=938816&view=diff >> ============================================================================== >> --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java (original) >> +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java Wed Apr 28 08:33:37 2010 >> @@ -344,7 +344,7 @@ public class MacroFormRenderer implement >> this.request.setAttribute("alternate", encodedAlternate); >> this.request.setAttribute("imageTitle", encodedImageTitle); >> makeHyperlinkByType(writer, hyperlinkField.getLinkType(), modelFormField.getWidgetStyle(), hyperlinkField.getTargetType(), hyperlinkField.getTarget(context), >> - hyperlinkField.getParameterList(), hyperlinkField.getDescription(context), hyperlinkField.getTargetWindow(context), hyperlinkField.getConfirmation(context), modelFormField, >> + hyperlinkField.getParameterMap(context), hyperlinkField.getDescription(context), hyperlinkField.getTargetWindow(context), hyperlinkField.getConfirmation(context), modelFormField, >> this.request, this.response, context); >> >> this.appendTooltip(writer, context, modelFormField); >> @@ -2813,7 +2813,7 @@ public class MacroFormRenderer implement >> if (subHyperlink.shouldUse(context)) { >> writer.append(' '); >> makeHyperlinkByType(writer, subHyperlink.getLinkType(), subHyperlink.getLinkStyle(), subHyperlink.getTargetType(), subHyperlink.getTarget(context), >> - subHyperlink.getParameterList(), subHyperlink.getDescription(context), subHyperlink.getTargetWindow(context), subHyperlink.getConfirmation(context), subHyperlink.getModelFormField(), >> + subHyperlink.getParameterMap(context), subHyperlink.getDescription(context), subHyperlink.getTargetWindow(context), subHyperlink.getConfirmation(context), subHyperlink.getModelFormField(), >> this.request, this.response, context); >> } >> } >> @@ -2841,7 +2841,7 @@ public class MacroFormRenderer implement >> } >> >> public void makeHyperlinkByType(Appendable writer, String linkType, String linkStyle, String targetType, String target, >> - List<WidgetWorker.Parameter> parameterList, String description, String targetWindow, String confirmation , ModelFormField modelFormField, >> + Map<String, String> parameterMap, String description, String targetWindow, String confirmation , ModelFormField modelFormField, >> HttpServletRequest request, HttpServletResponse response, Map<String, Object> context) throws IOException { >> String realLinkType = WidgetWorker.determineAutoLinkType(linkType, target, targetType, request); >> >> @@ -2858,24 +2858,24 @@ public class MacroFormRenderer implement >> postMultiFormWriter = new StringWriter(); >> wholeFormContext.put("postMultiFormWriter", postMultiFormWriter); >> } >> - WidgetWorker.makeHiddenFormLinkForm(postMultiFormWriter, target, targetType, targetWindow, parameterList, modelFormField, request, response, context); >> + WidgetWorker.makeHiddenFormLinkForm(postMultiFormWriter, target, targetType, targetWindow, parameterMap, modelFormField, request, response, context); >> } else { >> - WidgetWorker.makeHiddenFormLinkForm(writer, target, targetType, targetWindow, parameterList, modelFormField, request, response, context); >> + WidgetWorker.makeHiddenFormLinkForm(writer, target, targetType, targetWindow, parameterMap, modelFormField, request, response, context); >> WidgetWorker.makeHiddenFormLinkAnchor(writer, linkStyle, encodedDescription, confirmation , modelFormField, request, response, context); >> } >> } else { >> - makeHyperlinkString(writer, linkStyle, targetType, target, parameterList, encodedDescription, confirmation , modelFormField, request, response, context, targetWindow); >> + makeHyperlinkString(writer, linkStyle, targetType, target, parameterMap, encodedDescription, confirmation , modelFormField, request, response, context, targetWindow); >> } >> >> } >> >> - public void makeHyperlinkString(Appendable writer, String linkStyle, String targetType, String target, List<WidgetWorker.Parameter> parameterList, >> + public void makeHyperlinkString(Appendable writer, String linkStyle, String targetType, String target, Map<String, String> parameterMap, >> String description, String confirmation , ModelFormField modelFormField, HttpServletRequest request, HttpServletResponse response, Map<String, Object> context, String targetWindow) >> throws IOException { >> if (UtilValidate.isNotEmpty(description) || UtilValidate.isNotEmpty(request.getAttribute("image"))) { >> StringBuilder linkUrl = new StringBuilder(); >> >> - WidgetWorker.buildHyperlinkUrl(linkUrl, target, targetType, parameterList, null, false, false, true, request, response, context); >> + WidgetWorker.buildHyperlinkUrl(linkUrl, target, targetType, parameterMap, null, false, false, true, request, response, context); >> >> String event = ""; >> String action = ""; >> >> Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java >> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java?rev=938816&r1=938815&r2=938816&view=diff >> ============================================================================== >> --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java (original) >> +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java Wed Apr 28 08:33:37 2010 >> @@ -2281,6 +2281,7 @@ public class ModelFormField { >> protected FlexibleStringExpander alternate; >> protected FlexibleStringExpander imageTitle; >> protected FlexibleStringExpander targetWindowExdr; >> + protected FlexibleMapAccessor<Map<String, String>> parametersMapAcsr; >> protected List<WidgetWorker.Parameter> parameterList = FastList.newInstance(); >> >> protected boolean requestConfirmation = false; >> @@ -2308,6 +2309,7 @@ public class ModelFormField { >> this.linkType = element.getAttribute("link-type"); >> this.targetType = element.getAttribute("target-type"); >> this.targetWindowExdr = FlexibleStringExpander.getInstance(element.getAttribute("target-window")); >> + this.parametersMapAcsr = FlexibleMapAccessor.getInstance(element.getAttribute("parameters-map")); >> this.image = element.getAttribute("image-location"); >> this.setRequestConfirmation("true".equals(element.getAttribute("request-confirmation"))); >> this.setConfirmationMsg(element.getAttribute("confirmation-message")); >> @@ -2380,8 +2382,19 @@ public class ModelFormField { >> return this.target.expandString(context); >> } >> >> - public List<WidgetWorker.Parameter> getParameterList() { >> - return this.parameterList; >> + public Map<String, String> getParameterMap(Map<String, Object> context) { >> + Map<String, String> fullParameterMap = FastMap.newInstance(); >> + >> + Map<String, String> addlParamMap = this.parametersMapAcsr.get(context); >> + if (addlParamMap != null) { >> + fullParameterMap.putAll(addlParamMap); >> + } >> + >> + for (WidgetWorker.Parameter parameter: this.parameterList) { >> + fullParameterMap.put(parameter.getName(), parameter.getValue(context)); >> + } >> + >> + return fullParameterMap; >> } >> >> public String getImage() { >> @@ -2507,8 +2520,21 @@ public class ModelFormField { >> return this.linkType; >> } >> >> - public List<WidgetWorker.Parameter> getParameterList() { >> - return this.parameterList; >> + public Map<String, String> getParameterMap(Map<String, Object> context) { >> + Map<String, String> fullParameterMap = FastMap.newInstance(); >> + >> + /* leaving this here... may want to add it at some point like the hyperlink element: >> + Map<String, String> addlParamMap = this.parametersMapAcsr.get(context); >> + if (addlParamMap != null) { >> + fullParameterMap.putAll(addlParamMap); >> + } >> + */ >> + >> + for (WidgetWorker.Parameter parameter: this.parameterList) { >> + fullParameterMap.put(parameter.getName(), parameter.getValue(context)); >> + } >> + >> + return fullParameterMap; >> } >> >> public String getUseWhen(Map<String, Object> context) { >> >> Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java >> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java?rev=938816&r1=938815&r2=938816&view=diff >> ============================================================================== >> --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java (original) >> +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java Wed Apr 28 08:33:37 2010 >> @@ -333,7 +333,7 @@ public class HtmlFormRenderer extends Ht >> String description = encode(hyperlinkField.getDescription(context), modelFormField, context); >> String confirmation = encode(hyperlinkField.getConfirmation(context), modelFormField, context); >> WidgetWorker.makeHyperlinkByType(writer, hyperlinkField.getLinkType(), modelFormField.getWidgetStyle(), hyperlinkField.getTargetType(), hyperlinkField.getTarget(context), >> - hyperlinkField.getParameterList(), description, hyperlinkField.getTargetWindow(context), confirmation, modelFormField, >> + hyperlinkField.getParameterMap(context), description, hyperlinkField.getTargetWindow(context), confirmation, modelFormField, >> this.request, this.response, context); >> this.appendTooltip(writer, context, modelFormField); >> //appendWhitespace(writer); >> @@ -347,7 +347,7 @@ public class HtmlFormRenderer extends Ht >> writer.append(' '); >> String description = encode(subHyperlink.getDescription(context), subHyperlink.getModelFormField(), context); >> WidgetWorker.makeHyperlinkByType(writer, subHyperlink.getLinkType(), subHyperlink.getLinkStyle(), subHyperlink.getTargetType(), subHyperlink.getTarget(context), >> - subHyperlink.getParameterList(), description, subHyperlink.getTargetWindow(context), subHyperlink.getConfirmation(context), subHyperlink.getModelFormField(), >> + subHyperlink.getParameterMap(context), description, subHyperlink.getTargetWindow(context), subHyperlink.getConfirmation(context), subHyperlink.getModelFormField(), >> this.request, this.response, context); >> } >> } >> >> Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlMenuRenderer.java >> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlMenuRenderer.java?rev=938816&r1=938815&r2=938816&view=diff >> ============================================================================== >> --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlMenuRenderer.java (original) >> +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlMenuRenderer.java Wed Apr 28 08:33:37 2010 >> @@ -418,14 +418,14 @@ public class HtmlMenuRenderer extends Ht >> writer.append("\">"); >> >> StringUtil.SimpleEncoder simpleEncoder = (StringUtil.SimpleEncoder) context.get("simpleEncoder"); >> - for (WidgetWorker.Parameter parameter: link.getParameterList()) { >> + for (Map.Entry<String, String> parameter: link.getParameterMap(context).entrySet()) { >> writer.append("<input name=\""); >> - writer.append(parameter.getName()); >> + writer.append(parameter.getKey()); >> writer.append("\" value=\""); >> if (simpleEncoder != null) { >> - writer.append(simpleEncoder.encode(parameter.getValue(context))); >> + writer.append(simpleEncoder.encode(parameter.getValue())); >> } else { >> - writer.append(parameter.getValue(context)); >> + writer.append(parameter.getValue()); >> } >> writer.append("\" type=\"hidden\"/>"); >> } >> @@ -478,11 +478,11 @@ public class HtmlMenuRenderer extends Ht >> writer.append("javascript:confirmActionLink('"); >> writer.append(confirmationMsg); >> writer.append("', '"); >> - WidgetWorker.buildHyperlinkUrl(writer, target, link.getUrlMode(), link.getParameterList(), link.getPrefix(context), >> + WidgetWorker.buildHyperlinkUrl(writer, target, link.getUrlMode(), link.getParameterMap(context), link.getPrefix(context), >> link.getFullPath(), link.getSecure(), link.getEncode(), request, response, context); >> writer.append("')"); >> } else { >> - WidgetWorker.buildHyperlinkUrl(writer, target, link.getUrlMode(), link.getParameterList(), link.getPrefix(context), >> + WidgetWorker.buildHyperlinkUrl(writer, target, link.getUrlMode(), link.getParameterMap(context), link.getPrefix(context), >> link.getFullPath(), link.getSecure(), link.getEncode(), request, response, context); >> } >> } >> >> Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlScreenRenderer.java >> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlScreenRenderer.java?rev=938816&r1=938815&r2=938816&view=diff >> ============================================================================== >> --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlScreenRenderer.java (original) >> +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlScreenRenderer.java Wed Apr 28 08:33:37 2010 >> @@ -495,11 +495,11 @@ public class HtmlScreenRenderer extends >> writer.append(uniqueItemName); >> writer.append("\">"); >> >> - for (WidgetWorker.Parameter parameter: link.getParameterList()) { >> + for (Map.Entry<String, String> parameter: link.getParameterMap(context).entrySet()) { >> writer.append("<input name=\""); >> - writer.append(parameter.getName()); >> + writer.append(parameter.getKey()); >> writer.append("\" value=\""); >> - writer.append(parameter.getValue(context)); >> + writer.append(parameter.getValue()); >> writer.append("\" type=\"hidden\"/>"); >> } >> >> @@ -537,7 +537,7 @@ public class HtmlScreenRenderer extends >> writer.append(uniqueItemName); >> writer.append(".submit()"); >> } else { >> - WidgetWorker.buildHyperlinkUrl(writer, target, link.getUrlMode(), link.getParameterList(), link.getPrefix(context), >> + WidgetWorker.buildHyperlinkUrl(writer, target, link.getUrlMode(), link.getParameterMap(context), link.getPrefix(context), >> link.getFullPath(), link.getSecure(), link.getEncode(), request, response, context); >> } >> writer.append("\""); >> >> Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlTreeRenderer.java >> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlTreeRenderer.java?rev=938816&r1=938815&r2=938816&view=diff >> ============================================================================== >> --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlTreeRenderer.java (original) >> +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlTreeRenderer.java Wed Apr 28 08:33:37 2010 >> @@ -221,7 +221,7 @@ public class HtmlTreeRenderer extends Ht >> HttpServletRequest req = (HttpServletRequest) context.get("request"); >> if (urlMode != null && urlMode.equalsIgnoreCase("intra-app")) { >> if (req != null && res != null) { >> - WidgetWorker.buildHyperlinkUrl(writer, target, link.getUrlMode(), link.getParameterList(), link.getPrefix(context), >> + WidgetWorker.buildHyperlinkUrl(writer, target, link.getUrlMode(), link.getParameterMap(context), link.getPrefix(context), >> link.getFullPath(), link.getSecure(), link.getEncode(), req, res, context); >> } else if (prefix != null) { >> writer.append(prefix).append(target); >> >> Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuItem.java >> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuItem.java?rev=938816&r1=938815&r2=938816&view=diff >> ============================================================================== >> --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuItem.java (original) >> +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuItem.java Wed Apr 28 08:33:37 2010 >> @@ -28,6 +28,7 @@ import java.util.Map; >> import javax.xml.parsers.ParserConfigurationException; >> >> import javolution.util.FastList; >> +import javolution.util.FastMap; >> >> import org.ofbiz.base.util.Debug; >> import org.ofbiz.base.util.StringUtil; >> @@ -289,12 +290,12 @@ public class ModelMenuItem { >> localItem.name = portalPage.getString("portalPageId"); >> localItem.setTitle((String) portalPage.get("portalPageName", locale)); >> localItem.link = new Link(this); >> - List<WidgetWorker.Parameter> linkParams = localItem.link.getParameterList(); >> - linkParams.add(new WidgetWorker.Parameter("portalPageId", portalPage.getString("portalPageId"), false)); >> - linkParams.add(new WidgetWorker.Parameter("parentPortalPageId", parentPortalPageId, false)); >> + Map<String, String> linkParams = localItem.link.getParameterMap(context); >> + linkParams.put("portalPageId", portalPage.getString("portalPageId")); >> + linkParams.put("parentPortalPageId", parentPortalPageId); >> if (link != null) { >> localItem.link.setTarget(link.targetExdr.getOriginal()); >> - linkParams.addAll(link.parameterList); >> + linkParams.putAll(link.getParameterMap(context)); >> } else { >> localItem.link.setTarget("showPortalPage"); >> } >> @@ -741,8 +742,21 @@ public class ModelMenuItem { >> return this.linkType; >> } >> >> - public List<WidgetWorker.Parameter> getParameterList() { >> - return this.parameterList; >> + public Map<String, String> getParameterMap(Map<String, Object> context) { >> + Map<String, String> fullParameterMap = FastMap.newInstance(); >> + >> + /* leaving this here... may want to add it at some point like the hyperlink element: >> + Map<String, String> addlParamMap = this.parametersMapAcsr.get(context); >> + if (addlParamMap != null) { >> + fullParameterMap.putAll(addlParamMap); >> + } >> + */ >> + >> + for (WidgetWorker.Parameter parameter: this.parameterList) { >> + fullParameterMap.put(parameter.getName(), parameter.getValue(context)); >> + } >> + >> + return fullParameterMap; >> } >> >> public String getConfirmation(Map<String, Object> context) { >> >> Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java >> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java?rev=938816&r1=938815&r2=938816&view=diff >> ============================================================================== >> --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java (original) >> +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java Wed Apr 28 08:33:37 2010 >> @@ -223,15 +223,15 @@ public class MacroScreenRenderer impleme >> link.getFullPath(), link.getSecure(), link.getEncode(), request, response, context); >> actionUrl = sb.toString(); >> parameters.append("["); >> - for (WidgetWorker.Parameter parameter: link.getParameterList()) { >> + for (Map.Entry<String, String> parameter: link.getParameterMap(context).entrySet()) { >> if (parameters.length() >1) { >> parameters.append(","); >> } >> parameters.append("{'name':'"); >> - parameters.append(parameter.getName()); >> + parameters.append(parameter.getKey()); >> parameters.append("'"); >> parameters.append(",'value':'"); >> - parameters.append(parameter.getValue(context)); >> + parameters.append(parameter.getValue()); >> parameters.append("'}"); >> } >> parameters.append("]"); >> @@ -244,7 +244,7 @@ public class MacroScreenRenderer impleme >> if (UtilValidate.isNotEmpty(target)) { >> if (!"hidden-form".equals(linkType)) { >> StringBuilder sb = new StringBuilder(); >> - WidgetWorker.buildHyperlinkUrl(sb, target, link.getUrlMode(), link.getParameterList(), link.getPrefix(context), >> + WidgetWorker.buildHyperlinkUrl(sb, target, link.getUrlMode(), link.getParameterMap(context), link.getPrefix(context), >> link.getFullPath(), link.getSecure(), link.getEncode(), request, response, context); >> linkUrl = sb.toString(); >> } >> >> Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenWidget.java >> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenWidget.java?rev=938816&r1=938815&r2=938816&view=diff >> ============================================================================== >> --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenWidget.java (original) >> +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenWidget.java Wed Apr 28 08:33:37 2010 >> @@ -29,6 +29,7 @@ import javax.servlet.http.HttpServletRes >> import javax.xml.parsers.ParserConfigurationException; >> >> import javolution.util.FastList; >> +import javolution.util.FastMap; >> >> import org.ofbiz.base.util.Debug; >> import org.ofbiz.base.util.GeneralException; >> @@ -1480,8 +1481,21 @@ public abstract class ModelScreenWidget >> return this.linkType; >> } >> >> - public List<WidgetWorker.Parameter> getParameterList() { >> - return this.parameterList; >> + public Map<String, String> getParameterMap(Map<String, Object> context) { >> + Map<String, String> fullParameterMap = FastMap.newInstance(); >> + >> + /* leaving this here... may want to add it at some point like the hyperlink element: >> + Map<String, String> addlParamMap = this.parametersMapAcsr.get(context); >> + if (addlParamMap != null) { >> + fullParameterMap.putAll(addlParamMap); >> + } >> + */ >> + >> + for (WidgetWorker.Parameter parameter: this.parameterList) { >> + fullParameterMap.put(parameter.getName(), parameter.getValue(context)); >> + } >> + >> + return fullParameterMap; >> } >> >> public void setText(String val) { >> >> Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/MacroTreeRenderer.java >> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/MacroTreeRenderer.java?rev=938816&r1=938815&r2=938816&view=diff >> ============================================================================== >> --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/MacroTreeRenderer.java (original) >> +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/MacroTreeRenderer.java Wed Apr 28 08:33:37 2010 >> @@ -267,7 +267,7 @@ public class MacroTreeRenderer implement >> HttpServletRequest request = (HttpServletRequest) context.get("request"); >> >> if (UtilValidate.isNotEmpty(target)) { >> - WidgetWorker.buildHyperlinkUrl(linkUrl, target, link.getUrlMode(), link.getParameterList(), link.getPrefix(context), >> + WidgetWorker.buildHyperlinkUrl(linkUrl, target, link.getUrlMode(), link.getParameterMap(context), link.getPrefix(context), >> link.getFullPath(), link.getSecure(), link.getEncode(), request, response, context); >> } >> >> >> Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/ModelTree.java >> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/ModelTree.java?rev=938816&r1=938815&r2=938816&view=diff >> ============================================================================== >> --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/ModelTree.java (original) >> +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/ModelTree.java Wed Apr 28 08:33:37 2010 >> @@ -930,8 +930,21 @@ public class ModelTree extends ModelWidg >> return this.linkType; >> } >> >> - public List<WidgetWorker.Parameter> getParameterList() { >> - return this.parameterList; >> + public Map<String, String> getParameterMap(Map<String, Object> context) { >> + Map<String, String> fullParameterMap = FastMap.newInstance(); >> + >> + /* leaving this here... may want to add it at some point like the hyperlink element: >> + Map<String, String> addlParamMap = this.parametersMapAcsr.get(context); >> + if (addlParamMap != null) { >> + fullParameterMap.putAll(addlParamMap); >> + } >> + */ >> + >> + for (WidgetWorker.Parameter parameter: this.parameterList) { >> + fullParameterMap.put(parameter.getName(), parameter.getValue(context)); >> + } >> + >> + return fullParameterMap; >> } >> >> public void setText(String val) { >> >> > -- > Ofbiz on twitter: http://twitter.com/apache_ofbiz > Myself on twitter: http://twitter.com/hansbak > Antwebsystems.com: Quality services for competitive rates. > |
any option within myportal (mycomms, profile etc) only show the main
page..... Regards, Hans On Sun, 2010-05-02 at 01:45 -0600, David E Jones wrote: > Could you be more specific? Ie, what does "options within myportal" refer to? > > -David > > > On May 2, 2010, at 1:32 AM, Hans Bakker wrote: > > > Hi David, > > can you please have a look at this commit? > > > > any options within myportal now only show the main option. > > > > can you please check? > > > > Regards, > > > > Hans > > > > > > On Wed, 2010-04-28 at 08:33 +0000, [hidden email] wrote: > >> Author: jonesde > >> Date: Wed Apr 28 08:33:37 2010 > >> New Revision: 938816 > >> > >> URL: http://svn.apache.org/viewvc?rev=938816&view=rev > >> Log: > >> Refactored the various link getParameterList methods to return a Map and expand with the context like most of the other get methods that are used during rendering; that is the biggest change but was part of adding a parameters-map attribute to the form widget hyperlink element to be able to use a script to prepare part or all of the parameters map used in the hidden form instead of having to manually declare all parameters > >> > >> Modified: > >> ofbiz/trunk/framework/widget/dtd/widget-form.xsd > >> ofbiz/trunk/framework/widget/src/org/ofbiz/widget/WidgetWorker.java > >> ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java > >> ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java > >> ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java > >> ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlMenuRenderer.java > >> ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlScreenRenderer.java > >> ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlTreeRenderer.java > >> ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuItem.java > >> ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java > >> ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenWidget.java > >> ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/MacroTreeRenderer.java > >> ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/ModelTree.java > >> > >> Modified: ofbiz/trunk/framework/widget/dtd/widget-form.xsd > >> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/dtd/widget-form.xsd?rev=938816&r1=938815&r2=938816&view=diff > >> ============================================================================== > >> --- ofbiz/trunk/framework/widget/dtd/widget-form.xsd (original) > >> +++ ofbiz/trunk/framework/widget/dtd/widget-form.xsd Wed Apr 28 08:33:37 2010 > >> @@ -856,6 +856,9 @@ under the License. > >> </xs:simpleType> > >> </xs:attribute> > >> <xs:attribute name="confirmation-message" type="xs:string"><xs:annotation><xs:documentation>The message displayed in confirmation box</xs:documentation></xs:annotation></xs:attribute> > >> + <xs:attribute name="parameters-map" type="xs:string"> > >> + <xs:annotation><xs:documentation>A Map in the context that will be used as additional name/value pairs.</xs:documentation></xs:annotation> > >> + </xs:attribute> > >> </xs:attributeGroup> > >> <xs:element name="parameter"> > >> <xs:complexType> > >> > >> Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/WidgetWorker.java > >> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/WidgetWorker.java?rev=938816&r1=938815&r2=938816&view=diff > >> ============================================================================== > >> --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/WidgetWorker.java (original) > >> +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/WidgetWorker.java Wed Apr 28 08:33:37 2010 > >> @@ -50,7 +50,7 @@ public class WidgetWorker { > >> > >> public WidgetWorker () {} > >> > >> - public static void buildHyperlinkUrl(Appendable externalWriter, String target, String targetType, List<WidgetWorker.Parameter> parameterList, > >> + public static void buildHyperlinkUrl(Appendable externalWriter, String target, String targetType, Map<String, String> parameterMap, > >> String prefix, boolean fullPath, boolean secure, boolean encode, HttpServletRequest request, HttpServletResponse response, Map<String, Object> context) throws IOException { > >> String localRequestName = UtilHttp.encodeAmpersands(target); > >> Appendable localWriter = new StringWriter(); > >> @@ -87,7 +87,7 @@ public class WidgetWorker { > >> localWriter.append(localRequestName); > >> } > >> > >> - if (UtilValidate.isNotEmpty(parameterList)) { > >> + if (UtilValidate.isNotEmpty(parameterMap)) { > >> String localUrl = localWriter.toString(); > >> externalWriter.append(localUrl); > >> boolean needsAmp = true; > >> @@ -96,19 +96,19 @@ public class WidgetWorker { > >> needsAmp = false; > >> } > >> > >> - for (WidgetWorker.Parameter parameter: parameterList) { > >> + for (Map.Entry<String, String> parameter: parameterMap.entrySet()) { > >> if (needsAmp) { > >> externalWriter.append("&"); > >> } else { > >> needsAmp = true; > >> } > >> - externalWriter.append(parameter.getName()); > >> + externalWriter.append(parameter.getKey()); > >> externalWriter.append('='); > >> StringUtil.SimpleEncoder simpleEncoder = (StringUtil.SimpleEncoder) context.get("simpleEncoder"); > >> if (simpleEncoder != null) { > >> - externalWriter.append(simpleEncoder.encode(parameter.getValue(context))); > >> + externalWriter.append(simpleEncoder.encode(parameter.getValue())); > >> } else { > >> - externalWriter.append(parameter.getValue(context)); > >> + externalWriter.append(parameter.getValue()); > >> } > >> } > >> } else { > >> @@ -123,7 +123,7 @@ public class WidgetWorker { > >> writer.append(location); > >> } > >> public static void makeHyperlinkByType(Appendable writer, String linkType, String linkStyle, String targetType, String target, > >> - List<WidgetWorker.Parameter> parameterList, String description, String targetWindow, String confirmation, ModelFormField modelFormField, > >> + Map<String, String> parameterMap, String description, String targetWindow, String confirmation, ModelFormField modelFormField, > >> HttpServletRequest request, HttpServletResponse response, Map<String, Object> context) throws IOException { > >> String realLinkType = WidgetWorker.determineAutoLinkType(linkType, target, targetType, request); > >> if ("hidden-form".equals(realLinkType)) { > >> @@ -137,17 +137,17 @@ public class WidgetWorker { > >> postMultiFormWriter = new StringWriter(); > >> wholeFormContext.put("postMultiFormWriter", postMultiFormWriter); > >> } > >> - WidgetWorker.makeHiddenFormLinkForm(postMultiFormWriter, target, targetType, targetWindow, parameterList, modelFormField, request, response, context); > >> + WidgetWorker.makeHiddenFormLinkForm(postMultiFormWriter, target, targetType, targetWindow, parameterMap, modelFormField, request, response, context); > >> } else { > >> - WidgetWorker.makeHiddenFormLinkForm(writer, target, targetType, targetWindow, parameterList, modelFormField, request, response, context); > >> + WidgetWorker.makeHiddenFormLinkForm(writer, target, targetType, targetWindow, parameterMap, modelFormField, request, response, context); > >> WidgetWorker.makeHiddenFormLinkAnchor(writer, linkStyle, description, confirmation, modelFormField, request, response, context); > >> } > >> } else { > >> - WidgetWorker.makeHyperlinkString(writer, linkStyle, targetType, target, parameterList, description, confirmation, modelFormField, request, response, context, targetWindow); > >> + WidgetWorker.makeHyperlinkString(writer, linkStyle, targetType, target, parameterMap, description, confirmation, modelFormField, request, response, context, targetWindow); > >> } > >> > >> } > >> - public static void makeHyperlinkString(Appendable writer, String linkStyle, String targetType, String target, List<WidgetWorker.Parameter> parameterList, > >> + public static void makeHyperlinkString(Appendable writer, String linkStyle, String targetType, String target, Map<String, String> parameterMap, > >> String description, String confirmation, ModelFormField modelFormField, HttpServletRequest request, HttpServletResponse response, Map<String, Object> context, String targetWindow) > >> throws IOException { > >> if (UtilValidate.isNotEmpty(description) || UtilValidate.isNotEmpty(request.getAttribute("image"))) { > >> @@ -161,7 +161,7 @@ public class WidgetWorker { > >> > >> writer.append(" href=\""); > >> > >> - buildHyperlinkUrl(writer, target, targetType, parameterList, null, false, false, true, request, response, context); > >> + buildHyperlinkUrl(writer, target, targetType, parameterMap, null, false, false, true, request, response, context); > >> > >> writer.append("\""); > >> > >> @@ -237,7 +237,7 @@ public class WidgetWorker { > >> } > >> } > >> > >> - public static void makeHiddenFormLinkForm(Appendable writer, String target, String targetType, String targetWindow, List<WidgetWorker.Parameter> parameterList, ModelFormField modelFormField, HttpServletRequest request, HttpServletResponse response, Map<String, Object> context) throws IOException { > >> + public static void makeHiddenFormLinkForm(Appendable writer, String target, String targetType, String targetWindow, Map<String, String> parameterMap, ModelFormField modelFormField, HttpServletRequest request, HttpServletResponse response, Map<String, Object> context) throws IOException { > >> writer.append("<form method=\"post\""); > >> writer.append(" action=\""); > >> // note that this passes null for the parameterList on purpose so they won't be put into the URL > >> @@ -256,11 +256,11 @@ public class WidgetWorker { > >> writer.append(makeLinkHiddenFormName(context, modelFormField)); > >> writer.append("\">"); > >> > >> - for (WidgetWorker.Parameter parameter: parameterList) { > >> + for (Map.Entry<String, String> parameter: parameterMap.entrySet()) { > >> writer.append("<input name=\""); > >> - writer.append(parameter.getName()); > >> + writer.append(parameter.getKey()); > >> writer.append("\" value=\""); > >> - writer.append(parameter.getValue(context)); > >> + writer.append(parameter.getValue()); > >> writer.append("\" type=\"hidden\"/>"); > >> } > >> > >> > >> Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java > >> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java?rev=938816&r1=938815&r2=938816&view=diff > >> ============================================================================== > >> --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java (original) > >> +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java Wed Apr 28 08:33:37 2010 > >> @@ -344,7 +344,7 @@ public class MacroFormRenderer implement > >> this.request.setAttribute("alternate", encodedAlternate); > >> this.request.setAttribute("imageTitle", encodedImageTitle); > >> makeHyperlinkByType(writer, hyperlinkField.getLinkType(), modelFormField.getWidgetStyle(), hyperlinkField.getTargetType(), hyperlinkField.getTarget(context), > >> - hyperlinkField.getParameterList(), hyperlinkField.getDescription(context), hyperlinkField.getTargetWindow(context), hyperlinkField.getConfirmation(context), modelFormField, > >> + hyperlinkField.getParameterMap(context), hyperlinkField.getDescription(context), hyperlinkField.getTargetWindow(context), hyperlinkField.getConfirmation(context), modelFormField, > >> this.request, this.response, context); > >> > >> this.appendTooltip(writer, context, modelFormField); > >> @@ -2813,7 +2813,7 @@ public class MacroFormRenderer implement > >> if (subHyperlink.shouldUse(context)) { > >> writer.append(' '); > >> makeHyperlinkByType(writer, subHyperlink.getLinkType(), subHyperlink.getLinkStyle(), subHyperlink.getTargetType(), subHyperlink.getTarget(context), > >> - subHyperlink.getParameterList(), subHyperlink.getDescription(context), subHyperlink.getTargetWindow(context), subHyperlink.getConfirmation(context), subHyperlink.getModelFormField(), > >> + subHyperlink.getParameterMap(context), subHyperlink.getDescription(context), subHyperlink.getTargetWindow(context), subHyperlink.getConfirmation(context), subHyperlink.getModelFormField(), > >> this.request, this.response, context); > >> } > >> } > >> @@ -2841,7 +2841,7 @@ public class MacroFormRenderer implement > >> } > >> > >> public void makeHyperlinkByType(Appendable writer, String linkType, String linkStyle, String targetType, String target, > >> - List<WidgetWorker.Parameter> parameterList, String description, String targetWindow, String confirmation , ModelFormField modelFormField, > >> + Map<String, String> parameterMap, String description, String targetWindow, String confirmation , ModelFormField modelFormField, > >> HttpServletRequest request, HttpServletResponse response, Map<String, Object> context) throws IOException { > >> String realLinkType = WidgetWorker.determineAutoLinkType(linkType, target, targetType, request); > >> > >> @@ -2858,24 +2858,24 @@ public class MacroFormRenderer implement > >> postMultiFormWriter = new StringWriter(); > >> wholeFormContext.put("postMultiFormWriter", postMultiFormWriter); > >> } > >> - WidgetWorker.makeHiddenFormLinkForm(postMultiFormWriter, target, targetType, targetWindow, parameterList, modelFormField, request, response, context); > >> + WidgetWorker.makeHiddenFormLinkForm(postMultiFormWriter, target, targetType, targetWindow, parameterMap, modelFormField, request, response, context); > >> } else { > >> - WidgetWorker.makeHiddenFormLinkForm(writer, target, targetType, targetWindow, parameterList, modelFormField, request, response, context); > >> + WidgetWorker.makeHiddenFormLinkForm(writer, target, targetType, targetWindow, parameterMap, modelFormField, request, response, context); > >> WidgetWorker.makeHiddenFormLinkAnchor(writer, linkStyle, encodedDescription, confirmation , modelFormField, request, response, context); > >> } > >> } else { > >> - makeHyperlinkString(writer, linkStyle, targetType, target, parameterList, encodedDescription, confirmation , modelFormField, request, response, context, targetWindow); > >> + makeHyperlinkString(writer, linkStyle, targetType, target, parameterMap, encodedDescription, confirmation , modelFormField, request, response, context, targetWindow); > >> } > >> > >> } > >> > >> - public void makeHyperlinkString(Appendable writer, String linkStyle, String targetType, String target, List<WidgetWorker.Parameter> parameterList, > >> + public void makeHyperlinkString(Appendable writer, String linkStyle, String targetType, String target, Map<String, String> parameterMap, > >> String description, String confirmation , ModelFormField modelFormField, HttpServletRequest request, HttpServletResponse response, Map<String, Object> context, String targetWindow) > >> throws IOException { > >> if (UtilValidate.isNotEmpty(description) || UtilValidate.isNotEmpty(request.getAttribute("image"))) { > >> StringBuilder linkUrl = new StringBuilder(); > >> > >> - WidgetWorker.buildHyperlinkUrl(linkUrl, target, targetType, parameterList, null, false, false, true, request, response, context); > >> + WidgetWorker.buildHyperlinkUrl(linkUrl, target, targetType, parameterMap, null, false, false, true, request, response, context); > >> > >> String event = ""; > >> String action = ""; > >> > >> Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java > >> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java?rev=938816&r1=938815&r2=938816&view=diff > >> ============================================================================== > >> --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java (original) > >> +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java Wed Apr 28 08:33:37 2010 > >> @@ -2281,6 +2281,7 @@ public class ModelFormField { > >> protected FlexibleStringExpander alternate; > >> protected FlexibleStringExpander imageTitle; > >> protected FlexibleStringExpander targetWindowExdr; > >> + protected FlexibleMapAccessor<Map<String, String>> parametersMapAcsr; > >> protected List<WidgetWorker.Parameter> parameterList = FastList.newInstance(); > >> > >> protected boolean requestConfirmation = false; > >> @@ -2308,6 +2309,7 @@ public class ModelFormField { > >> this.linkType = element.getAttribute("link-type"); > >> this.targetType = element.getAttribute("target-type"); > >> this.targetWindowExdr = FlexibleStringExpander.getInstance(element.getAttribute("target-window")); > >> + this.parametersMapAcsr = FlexibleMapAccessor.getInstance(element.getAttribute("parameters-map")); > >> this.image = element.getAttribute("image-location"); > >> this.setRequestConfirmation("true".equals(element.getAttribute("request-confirmation"))); > >> this.setConfirmationMsg(element.getAttribute("confirmation-message")); > >> @@ -2380,8 +2382,19 @@ public class ModelFormField { > >> return this.target.expandString(context); > >> } > >> > >> - public List<WidgetWorker.Parameter> getParameterList() { > >> - return this.parameterList; > >> + public Map<String, String> getParameterMap(Map<String, Object> context) { > >> + Map<String, String> fullParameterMap = FastMap.newInstance(); > >> + > >> + Map<String, String> addlParamMap = this.parametersMapAcsr.get(context); > >> + if (addlParamMap != null) { > >> + fullParameterMap.putAll(addlParamMap); > >> + } > >> + > >> + for (WidgetWorker.Parameter parameter: this.parameterList) { > >> + fullParameterMap.put(parameter.getName(), parameter.getValue(context)); > >> + } > >> + > >> + return fullParameterMap; > >> } > >> > >> public String getImage() { > >> @@ -2507,8 +2520,21 @@ public class ModelFormField { > >> return this.linkType; > >> } > >> > >> - public List<WidgetWorker.Parameter> getParameterList() { > >> - return this.parameterList; > >> + public Map<String, String> getParameterMap(Map<String, Object> context) { > >> + Map<String, String> fullParameterMap = FastMap.newInstance(); > >> + > >> + /* leaving this here... may want to add it at some point like the hyperlink element: > >> + Map<String, String> addlParamMap = this.parametersMapAcsr.get(context); > >> + if (addlParamMap != null) { > >> + fullParameterMap.putAll(addlParamMap); > >> + } > >> + */ > >> + > >> + for (WidgetWorker.Parameter parameter: this.parameterList) { > >> + fullParameterMap.put(parameter.getName(), parameter.getValue(context)); > >> + } > >> + > >> + return fullParameterMap; > >> } > >> > >> public String getUseWhen(Map<String, Object> context) { > >> > >> Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java > >> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java?rev=938816&r1=938815&r2=938816&view=diff > >> ============================================================================== > >> --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java (original) > >> +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java Wed Apr 28 08:33:37 2010 > >> @@ -333,7 +333,7 @@ public class HtmlFormRenderer extends Ht > >> String description = encode(hyperlinkField.getDescription(context), modelFormField, context); > >> String confirmation = encode(hyperlinkField.getConfirmation(context), modelFormField, context); > >> WidgetWorker.makeHyperlinkByType(writer, hyperlinkField.getLinkType(), modelFormField.getWidgetStyle(), hyperlinkField.getTargetType(), hyperlinkField.getTarget(context), > >> - hyperlinkField.getParameterList(), description, hyperlinkField.getTargetWindow(context), confirmation, modelFormField, > >> + hyperlinkField.getParameterMap(context), description, hyperlinkField.getTargetWindow(context), confirmation, modelFormField, > >> this.request, this.response, context); > >> this.appendTooltip(writer, context, modelFormField); > >> //appendWhitespace(writer); > >> @@ -347,7 +347,7 @@ public class HtmlFormRenderer extends Ht > >> writer.append(' '); > >> String description = encode(subHyperlink.getDescription(context), subHyperlink.getModelFormField(), context); > >> WidgetWorker.makeHyperlinkByType(writer, subHyperlink.getLinkType(), subHyperlink.getLinkStyle(), subHyperlink.getTargetType(), subHyperlink.getTarget(context), > >> - subHyperlink.getParameterList(), description, subHyperlink.getTargetWindow(context), subHyperlink.getConfirmation(context), subHyperlink.getModelFormField(), > >> + subHyperlink.getParameterMap(context), description, subHyperlink.getTargetWindow(context), subHyperlink.getConfirmation(context), subHyperlink.getModelFormField(), > >> this.request, this.response, context); > >> } > >> } > >> > >> Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlMenuRenderer.java > >> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlMenuRenderer.java?rev=938816&r1=938815&r2=938816&view=diff > >> ============================================================================== > >> --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlMenuRenderer.java (original) > >> +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlMenuRenderer.java Wed Apr 28 08:33:37 2010 > >> @@ -418,14 +418,14 @@ public class HtmlMenuRenderer extends Ht > >> writer.append("\">"); > >> > >> StringUtil.SimpleEncoder simpleEncoder = (StringUtil.SimpleEncoder) context.get("simpleEncoder"); > >> - for (WidgetWorker.Parameter parameter: link.getParameterList()) { > >> + for (Map.Entry<String, String> parameter: link.getParameterMap(context).entrySet()) { > >> writer.append("<input name=\""); > >> - writer.append(parameter.getName()); > >> + writer.append(parameter.getKey()); > >> writer.append("\" value=\""); > >> if (simpleEncoder != null) { > >> - writer.append(simpleEncoder.encode(parameter.getValue(context))); > >> + writer.append(simpleEncoder.encode(parameter.getValue())); > >> } else { > >> - writer.append(parameter.getValue(context)); > >> + writer.append(parameter.getValue()); > >> } > >> writer.append("\" type=\"hidden\"/>"); > >> } > >> @@ -478,11 +478,11 @@ public class HtmlMenuRenderer extends Ht > >> writer.append("javascript:confirmActionLink('"); > >> writer.append(confirmationMsg); > >> writer.append("', '"); > >> - WidgetWorker.buildHyperlinkUrl(writer, target, link.getUrlMode(), link.getParameterList(), link.getPrefix(context), > >> + WidgetWorker.buildHyperlinkUrl(writer, target, link.getUrlMode(), link.getParameterMap(context), link.getPrefix(context), > >> link.getFullPath(), link.getSecure(), link.getEncode(), request, response, context); > >> writer.append("')"); > >> } else { > >> - WidgetWorker.buildHyperlinkUrl(writer, target, link.getUrlMode(), link.getParameterList(), link.getPrefix(context), > >> + WidgetWorker.buildHyperlinkUrl(writer, target, link.getUrlMode(), link.getParameterMap(context), link.getPrefix(context), > >> link.getFullPath(), link.getSecure(), link.getEncode(), request, response, context); > >> } > >> } > >> > >> Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlScreenRenderer.java > >> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlScreenRenderer.java?rev=938816&r1=938815&r2=938816&view=diff > >> ============================================================================== > >> --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlScreenRenderer.java (original) > >> +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlScreenRenderer.java Wed Apr 28 08:33:37 2010 > >> @@ -495,11 +495,11 @@ public class HtmlScreenRenderer extends > >> writer.append(uniqueItemName); > >> writer.append("\">"); > >> > >> - for (WidgetWorker.Parameter parameter: link.getParameterList()) { > >> + for (Map.Entry<String, String> parameter: link.getParameterMap(context).entrySet()) { > >> writer.append("<input name=\""); > >> - writer.append(parameter.getName()); > >> + writer.append(parameter.getKey()); > >> writer.append("\" value=\""); > >> - writer.append(parameter.getValue(context)); > >> + writer.append(parameter.getValue()); > >> writer.append("\" type=\"hidden\"/>"); > >> } > >> > >> @@ -537,7 +537,7 @@ public class HtmlScreenRenderer extends > >> writer.append(uniqueItemName); > >> writer.append(".submit()"); > >> } else { > >> - WidgetWorker.buildHyperlinkUrl(writer, target, link.getUrlMode(), link.getParameterList(), link.getPrefix(context), > >> + WidgetWorker.buildHyperlinkUrl(writer, target, link.getUrlMode(), link.getParameterMap(context), link.getPrefix(context), > >> link.getFullPath(), link.getSecure(), link.getEncode(), request, response, context); > >> } > >> writer.append("\""); > >> > >> Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlTreeRenderer.java > >> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlTreeRenderer.java?rev=938816&r1=938815&r2=938816&view=diff > >> ============================================================================== > >> --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlTreeRenderer.java (original) > >> +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlTreeRenderer.java Wed Apr 28 08:33:37 2010 > >> @@ -221,7 +221,7 @@ public class HtmlTreeRenderer extends Ht > >> HttpServletRequest req = (HttpServletRequest) context.get("request"); > >> if (urlMode != null && urlMode.equalsIgnoreCase("intra-app")) { > >> if (req != null && res != null) { > >> - WidgetWorker.buildHyperlinkUrl(writer, target, link.getUrlMode(), link.getParameterList(), link.getPrefix(context), > >> + WidgetWorker.buildHyperlinkUrl(writer, target, link.getUrlMode(), link.getParameterMap(context), link.getPrefix(context), > >> link.getFullPath(), link.getSecure(), link.getEncode(), req, res, context); > >> } else if (prefix != null) { > >> writer.append(prefix).append(target); > >> > >> Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuItem.java > >> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuItem.java?rev=938816&r1=938815&r2=938816&view=diff > >> ============================================================================== > >> --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuItem.java (original) > >> +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuItem.java Wed Apr 28 08:33:37 2010 > >> @@ -28,6 +28,7 @@ import java.util.Map; > >> import javax.xml.parsers.ParserConfigurationException; > >> > >> import javolution.util.FastList; > >> +import javolution.util.FastMap; > >> > >> import org.ofbiz.base.util.Debug; > >> import org.ofbiz.base.util.StringUtil; > >> @@ -289,12 +290,12 @@ public class ModelMenuItem { > >> localItem.name = portalPage.getString("portalPageId"); > >> localItem.setTitle((String) portalPage.get("portalPageName", locale)); > >> localItem.link = new Link(this); > >> - List<WidgetWorker.Parameter> linkParams = localItem.link.getParameterList(); > >> - linkParams.add(new WidgetWorker.Parameter("portalPageId", portalPage.getString("portalPageId"), false)); > >> - linkParams.add(new WidgetWorker.Parameter("parentPortalPageId", parentPortalPageId, false)); > >> + Map<String, String> linkParams = localItem.link.getParameterMap(context); > >> + linkParams.put("portalPageId", portalPage.getString("portalPageId")); > >> + linkParams.put("parentPortalPageId", parentPortalPageId); > >> if (link != null) { > >> localItem.link.setTarget(link.targetExdr.getOriginal()); > >> - linkParams.addAll(link.parameterList); > >> + linkParams.putAll(link.getParameterMap(context)); > >> } else { > >> localItem.link.setTarget("showPortalPage"); > >> } > >> @@ -741,8 +742,21 @@ public class ModelMenuItem { > >> return this.linkType; > >> } > >> > >> - public List<WidgetWorker.Parameter> getParameterList() { > >> - return this.parameterList; > >> + public Map<String, String> getParameterMap(Map<String, Object> context) { > >> + Map<String, String> fullParameterMap = FastMap.newInstance(); > >> + > >> + /* leaving this here... may want to add it at some point like the hyperlink element: > >> + Map<String, String> addlParamMap = this.parametersMapAcsr.get(context); > >> + if (addlParamMap != null) { > >> + fullParameterMap.putAll(addlParamMap); > >> + } > >> + */ > >> + > >> + for (WidgetWorker.Parameter parameter: this.parameterList) { > >> + fullParameterMap.put(parameter.getName(), parameter.getValue(context)); > >> + } > >> + > >> + return fullParameterMap; > >> } > >> > >> public String getConfirmation(Map<String, Object> context) { > >> > >> Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java > >> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java?rev=938816&r1=938815&r2=938816&view=diff > >> ============================================================================== > >> --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java (original) > >> +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java Wed Apr 28 08:33:37 2010 > >> @@ -223,15 +223,15 @@ public class MacroScreenRenderer impleme > >> link.getFullPath(), link.getSecure(), link.getEncode(), request, response, context); > >> actionUrl = sb.toString(); > >> parameters.append("["); > >> - for (WidgetWorker.Parameter parameter: link.getParameterList()) { > >> + for (Map.Entry<String, String> parameter: link.getParameterMap(context).entrySet()) { > >> if (parameters.length() >1) { > >> parameters.append(","); > >> } > >> parameters.append("{'name':'"); > >> - parameters.append(parameter.getName()); > >> + parameters.append(parameter.getKey()); > >> parameters.append("'"); > >> parameters.append(",'value':'"); > >> - parameters.append(parameter.getValue(context)); > >> + parameters.append(parameter.getValue()); > >> parameters.append("'}"); > >> } > >> parameters.append("]"); > >> @@ -244,7 +244,7 @@ public class MacroScreenRenderer impleme > >> if (UtilValidate.isNotEmpty(target)) { > >> if (!"hidden-form".equals(linkType)) { > >> StringBuilder sb = new StringBuilder(); > >> - WidgetWorker.buildHyperlinkUrl(sb, target, link.getUrlMode(), link.getParameterList(), link.getPrefix(context), > >> + WidgetWorker.buildHyperlinkUrl(sb, target, link.getUrlMode(), link.getParameterMap(context), link.getPrefix(context), > >> link.getFullPath(), link.getSecure(), link.getEncode(), request, response, context); > >> linkUrl = sb.toString(); > >> } > >> > >> Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenWidget.java > >> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenWidget.java?rev=938816&r1=938815&r2=938816&view=diff > >> ============================================================================== > >> --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenWidget.java (original) > >> +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenWidget.java Wed Apr 28 08:33:37 2010 > >> @@ -29,6 +29,7 @@ import javax.servlet.http.HttpServletRes > >> import javax.xml.parsers.ParserConfigurationException; > >> > >> import javolution.util.FastList; > >> +import javolution.util.FastMap; > >> > >> import org.ofbiz.base.util.Debug; > >> import org.ofbiz.base.util.GeneralException; > >> @@ -1480,8 +1481,21 @@ public abstract class ModelScreenWidget > >> return this.linkType; > >> } > >> > >> - public List<WidgetWorker.Parameter> getParameterList() { > >> - return this.parameterList; > >> + public Map<String, String> getParameterMap(Map<String, Object> context) { > >> + Map<String, String> fullParameterMap = FastMap.newInstance(); > >> + > >> + /* leaving this here... may want to add it at some point like the hyperlink element: > >> + Map<String, String> addlParamMap = this.parametersMapAcsr.get(context); > >> + if (addlParamMap != null) { > >> + fullParameterMap.putAll(addlParamMap); > >> + } > >> + */ > >> + > >> + for (WidgetWorker.Parameter parameter: this.parameterList) { > >> + fullParameterMap.put(parameter.getName(), parameter.getValue(context)); > >> + } > >> + > >> + return fullParameterMap; > >> } > >> > >> public void setText(String val) { > >> > >> Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/MacroTreeRenderer.java > >> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/MacroTreeRenderer.java?rev=938816&r1=938815&r2=938816&view=diff > >> ============================================================================== > >> --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/MacroTreeRenderer.java (original) > >> +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/MacroTreeRenderer.java Wed Apr 28 08:33:37 2010 > >> @@ -267,7 +267,7 @@ public class MacroTreeRenderer implement > >> HttpServletRequest request = (HttpServletRequest) context.get("request"); > >> > >> if (UtilValidate.isNotEmpty(target)) { > >> - WidgetWorker.buildHyperlinkUrl(linkUrl, target, link.getUrlMode(), link.getParameterList(), link.getPrefix(context), > >> + WidgetWorker.buildHyperlinkUrl(linkUrl, target, link.getUrlMode(), link.getParameterMap(context), link.getPrefix(context), > >> link.getFullPath(), link.getSecure(), link.getEncode(), request, response, context); > >> } > >> > >> > >> Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/ModelTree.java > >> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/ModelTree.java?rev=938816&r1=938815&r2=938816&view=diff > >> ============================================================================== > >> --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/ModelTree.java (original) > >> +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/ModelTree.java Wed Apr 28 08:33:37 2010 > >> @@ -930,8 +930,21 @@ public class ModelTree extends ModelWidg > >> return this.linkType; > >> } > >> > >> - public List<WidgetWorker.Parameter> getParameterList() { > >> - return this.parameterList; > >> + public Map<String, String> getParameterMap(Map<String, Object> context) { > >> + Map<String, String> fullParameterMap = FastMap.newInstance(); > >> + > >> + /* leaving this here... may want to add it at some point like the hyperlink element: > >> + Map<String, String> addlParamMap = this.parametersMapAcsr.get(context); > >> + if (addlParamMap != null) { > >> + fullParameterMap.putAll(addlParamMap); > >> + } > >> + */ > >> + > >> + for (WidgetWorker.Parameter parameter: this.parameterList) { > >> + fullParameterMap.put(parameter.getName(), parameter.getValue(context)); > >> + } > >> + > >> + return fullParameterMap; > >> } > >> > >> public void setText(String val) { > >> > >> > > -- > > Ofbiz on twitter: http://twitter.com/apache_ofbiz > > Myself on twitter: http://twitter.com/hansbak > > Antwebsystems.com: Quality services for competitive rates. > > > Ofbiz on twitter: http://twitter.com/apache_ofbiz Myself on twitter: http://twitter.com/hansbak Antwebsystems.com: Quality services for competitive rates. |
Come on, please throw me a bone here. I'm happy to look into this, but something more specific so I can tell what you're talking about is absolutely necessary, otherwise this goes into the circular file. It's your choice. I gave up reading minds a long time ago. Which page (URLs are a nice way of being specific), which form, which field? What do you actually see and what do you expect to see there? -David On May 2, 2010, at 1:52 AM, Hans Bakker wrote: > any option within myportal (mycomms, profile etc) only show the main > page..... > > Regards, > Hans > > On Sun, 2010-05-02 at 01:45 -0600, David E Jones wrote: >> Could you be more specific? Ie, what does "options within myportal" refer to? >> >> -David >> >> >> On May 2, 2010, at 1:32 AM, Hans Bakker wrote: >> >>> Hi David, >>> can you please have a look at this commit? >>> >>> any options within myportal now only show the main option. >>> >>> can you please check? >>> >>> Regards, >>> >>> Hans >>> >>> >>> On Wed, 2010-04-28 at 08:33 +0000, [hidden email] wrote: >>>> Author: jonesde >>>> Date: Wed Apr 28 08:33:37 2010 >>>> New Revision: 938816 >>>> >>>> URL: http://svn.apache.org/viewvc?rev=938816&view=rev >>>> Log: >>>> Refactored the various link getParameterList methods to return a Map and expand with the context like most of the other get methods that are used during rendering; that is the biggest change but was part of adding a parameters-map attribute to the form widget hyperlink element to be able to use a script to prepare part or all of the parameters map used in the hidden form instead of having to manually declare all parameters >>>> >>>> Modified: >>>> ofbiz/trunk/framework/widget/dtd/widget-form.xsd >>>> ofbiz/trunk/framework/widget/src/org/ofbiz/widget/WidgetWorker.java >>>> ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java >>>> ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java >>>> ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java >>>> ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlMenuRenderer.java >>>> ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlScreenRenderer.java >>>> ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlTreeRenderer.java >>>> ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuItem.java >>>> ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java >>>> ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenWidget.java >>>> ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/MacroTreeRenderer.java >>>> ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/ModelTree.java >>>> >>>> Modified: ofbiz/trunk/framework/widget/dtd/widget-form.xsd >>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/dtd/widget-form.xsd?rev=938816&r1=938815&r2=938816&view=diff >>>> ============================================================================== >>>> --- ofbiz/trunk/framework/widget/dtd/widget-form.xsd (original) >>>> +++ ofbiz/trunk/framework/widget/dtd/widget-form.xsd Wed Apr 28 08:33:37 2010 >>>> @@ -856,6 +856,9 @@ under the License. >>>> </xs:simpleType> >>>> </xs:attribute> >>>> <xs:attribute name="confirmation-message" type="xs:string"><xs:annotation><xs:documentation>The message displayed in confirmation box</xs:documentation></xs:annotation></xs:attribute> >>>> + <xs:attribute name="parameters-map" type="xs:string"> >>>> + <xs:annotation><xs:documentation>A Map in the context that will be used as additional name/value pairs.</xs:documentation></xs:annotation> >>>> + </xs:attribute> >>>> </xs:attributeGroup> >>>> <xs:element name="parameter"> >>>> <xs:complexType> >>>> >>>> Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/WidgetWorker.java >>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/WidgetWorker.java?rev=938816&r1=938815&r2=938816&view=diff >>>> ============================================================================== >>>> --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/WidgetWorker.java (original) >>>> +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/WidgetWorker.java Wed Apr 28 08:33:37 2010 >>>> @@ -50,7 +50,7 @@ public class WidgetWorker { >>>> >>>> public WidgetWorker () {} >>>> >>>> - public static void buildHyperlinkUrl(Appendable externalWriter, String target, String targetType, List<WidgetWorker.Parameter> parameterList, >>>> + public static void buildHyperlinkUrl(Appendable externalWriter, String target, String targetType, Map<String, String> parameterMap, >>>> String prefix, boolean fullPath, boolean secure, boolean encode, HttpServletRequest request, HttpServletResponse response, Map<String, Object> context) throws IOException { >>>> String localRequestName = UtilHttp.encodeAmpersands(target); >>>> Appendable localWriter = new StringWriter(); >>>> @@ -87,7 +87,7 @@ public class WidgetWorker { >>>> localWriter.append(localRequestName); >>>> } >>>> >>>> - if (UtilValidate.isNotEmpty(parameterList)) { >>>> + if (UtilValidate.isNotEmpty(parameterMap)) { >>>> String localUrl = localWriter.toString(); >>>> externalWriter.append(localUrl); >>>> boolean needsAmp = true; >>>> @@ -96,19 +96,19 @@ public class WidgetWorker { >>>> needsAmp = false; >>>> } >>>> >>>> - for (WidgetWorker.Parameter parameter: parameterList) { >>>> + for (Map.Entry<String, String> parameter: parameterMap.entrySet()) { >>>> if (needsAmp) { >>>> externalWriter.append("&"); >>>> } else { >>>> needsAmp = true; >>>> } >>>> - externalWriter.append(parameter.getName()); >>>> + externalWriter.append(parameter.getKey()); >>>> externalWriter.append('='); >>>> StringUtil.SimpleEncoder simpleEncoder = (StringUtil.SimpleEncoder) context.get("simpleEncoder"); >>>> if (simpleEncoder != null) { >>>> - externalWriter.append(simpleEncoder.encode(parameter.getValue(context))); >>>> + externalWriter.append(simpleEncoder.encode(parameter.getValue())); >>>> } else { >>>> - externalWriter.append(parameter.getValue(context)); >>>> + externalWriter.append(parameter.getValue()); >>>> } >>>> } >>>> } else { >>>> @@ -123,7 +123,7 @@ public class WidgetWorker { >>>> writer.append(location); >>>> } >>>> public static void makeHyperlinkByType(Appendable writer, String linkType, String linkStyle, String targetType, String target, >>>> - List<WidgetWorker.Parameter> parameterList, String description, String targetWindow, String confirmation, ModelFormField modelFormField, >>>> + Map<String, String> parameterMap, String description, String targetWindow, String confirmation, ModelFormField modelFormField, >>>> HttpServletRequest request, HttpServletResponse response, Map<String, Object> context) throws IOException { >>>> String realLinkType = WidgetWorker.determineAutoLinkType(linkType, target, targetType, request); >>>> if ("hidden-form".equals(realLinkType)) { >>>> @@ -137,17 +137,17 @@ public class WidgetWorker { >>>> postMultiFormWriter = new StringWriter(); >>>> wholeFormContext.put("postMultiFormWriter", postMultiFormWriter); >>>> } >>>> - WidgetWorker.makeHiddenFormLinkForm(postMultiFormWriter, target, targetType, targetWindow, parameterList, modelFormField, request, response, context); >>>> + WidgetWorker.makeHiddenFormLinkForm(postMultiFormWriter, target, targetType, targetWindow, parameterMap, modelFormField, request, response, context); >>>> } else { >>>> - WidgetWorker.makeHiddenFormLinkForm(writer, target, targetType, targetWindow, parameterList, modelFormField, request, response, context); >>>> + WidgetWorker.makeHiddenFormLinkForm(writer, target, targetType, targetWindow, parameterMap, modelFormField, request, response, context); >>>> WidgetWorker.makeHiddenFormLinkAnchor(writer, linkStyle, description, confirmation, modelFormField, request, response, context); >>>> } >>>> } else { >>>> - WidgetWorker.makeHyperlinkString(writer, linkStyle, targetType, target, parameterList, description, confirmation, modelFormField, request, response, context, targetWindow); >>>> + WidgetWorker.makeHyperlinkString(writer, linkStyle, targetType, target, parameterMap, description, confirmation, modelFormField, request, response, context, targetWindow); >>>> } >>>> >>>> } >>>> - public static void makeHyperlinkString(Appendable writer, String linkStyle, String targetType, String target, List<WidgetWorker.Parameter> parameterList, >>>> + public static void makeHyperlinkString(Appendable writer, String linkStyle, String targetType, String target, Map<String, String> parameterMap, >>>> String description, String confirmation, ModelFormField modelFormField, HttpServletRequest request, HttpServletResponse response, Map<String, Object> context, String targetWindow) >>>> throws IOException { >>>> if (UtilValidate.isNotEmpty(description) || UtilValidate.isNotEmpty(request.getAttribute("image"))) { >>>> @@ -161,7 +161,7 @@ public class WidgetWorker { >>>> >>>> writer.append(" href=\""); >>>> >>>> - buildHyperlinkUrl(writer, target, targetType, parameterList, null, false, false, true, request, response, context); >>>> + buildHyperlinkUrl(writer, target, targetType, parameterMap, null, false, false, true, request, response, context); >>>> >>>> writer.append("\""); >>>> >>>> @@ -237,7 +237,7 @@ public class WidgetWorker { >>>> } >>>> } >>>> >>>> - public static void makeHiddenFormLinkForm(Appendable writer, String target, String targetType, String targetWindow, List<WidgetWorker.Parameter> parameterList, ModelFormField modelFormField, HttpServletRequest request, HttpServletResponse response, Map<String, Object> context) throws IOException { >>>> + public static void makeHiddenFormLinkForm(Appendable writer, String target, String targetType, String targetWindow, Map<String, String> parameterMap, ModelFormField modelFormField, HttpServletRequest request, HttpServletResponse response, Map<String, Object> context) throws IOException { >>>> writer.append("<form method=\"post\""); >>>> writer.append(" action=\""); >>>> // note that this passes null for the parameterList on purpose so they won't be put into the URL >>>> @@ -256,11 +256,11 @@ public class WidgetWorker { >>>> writer.append(makeLinkHiddenFormName(context, modelFormField)); >>>> writer.append("\">"); >>>> >>>> - for (WidgetWorker.Parameter parameter: parameterList) { >>>> + for (Map.Entry<String, String> parameter: parameterMap.entrySet()) { >>>> writer.append("<input name=\""); >>>> - writer.append(parameter.getName()); >>>> + writer.append(parameter.getKey()); >>>> writer.append("\" value=\""); >>>> - writer.append(parameter.getValue(context)); >>>> + writer.append(parameter.getValue()); >>>> writer.append("\" type=\"hidden\"/>"); >>>> } >>>> >>>> >>>> Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java >>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java?rev=938816&r1=938815&r2=938816&view=diff >>>> ============================================================================== >>>> --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java (original) >>>> +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java Wed Apr 28 08:33:37 2010 >>>> @@ -344,7 +344,7 @@ public class MacroFormRenderer implement >>>> this.request.setAttribute("alternate", encodedAlternate); >>>> this.request.setAttribute("imageTitle", encodedImageTitle); >>>> makeHyperlinkByType(writer, hyperlinkField.getLinkType(), modelFormField.getWidgetStyle(), hyperlinkField.getTargetType(), hyperlinkField.getTarget(context), >>>> - hyperlinkField.getParameterList(), hyperlinkField.getDescription(context), hyperlinkField.getTargetWindow(context), hyperlinkField.getConfirmation(context), modelFormField, >>>> + hyperlinkField.getParameterMap(context), hyperlinkField.getDescription(context), hyperlinkField.getTargetWindow(context), hyperlinkField.getConfirmation(context), modelFormField, >>>> this.request, this.response, context); >>>> >>>> this.appendTooltip(writer, context, modelFormField); >>>> @@ -2813,7 +2813,7 @@ public class MacroFormRenderer implement >>>> if (subHyperlink.shouldUse(context)) { >>>> writer.append(' '); >>>> makeHyperlinkByType(writer, subHyperlink.getLinkType(), subHyperlink.getLinkStyle(), subHyperlink.getTargetType(), subHyperlink.getTarget(context), >>>> - subHyperlink.getParameterList(), subHyperlink.getDescription(context), subHyperlink.getTargetWindow(context), subHyperlink.getConfirmation(context), subHyperlink.getModelFormField(), >>>> + subHyperlink.getParameterMap(context), subHyperlink.getDescription(context), subHyperlink.getTargetWindow(context), subHyperlink.getConfirmation(context), subHyperlink.getModelFormField(), >>>> this.request, this.response, context); >>>> } >>>> } >>>> @@ -2841,7 +2841,7 @@ public class MacroFormRenderer implement >>>> } >>>> >>>> public void makeHyperlinkByType(Appendable writer, String linkType, String linkStyle, String targetType, String target, >>>> - List<WidgetWorker.Parameter> parameterList, String description, String targetWindow, String confirmation , ModelFormField modelFormField, >>>> + Map<String, String> parameterMap, String description, String targetWindow, String confirmation , ModelFormField modelFormField, >>>> HttpServletRequest request, HttpServletResponse response, Map<String, Object> context) throws IOException { >>>> String realLinkType = WidgetWorker.determineAutoLinkType(linkType, target, targetType, request); >>>> >>>> @@ -2858,24 +2858,24 @@ public class MacroFormRenderer implement >>>> postMultiFormWriter = new StringWriter(); >>>> wholeFormContext.put("postMultiFormWriter", postMultiFormWriter); >>>> } >>>> - WidgetWorker.makeHiddenFormLinkForm(postMultiFormWriter, target, targetType, targetWindow, parameterList, modelFormField, request, response, context); >>>> + WidgetWorker.makeHiddenFormLinkForm(postMultiFormWriter, target, targetType, targetWindow, parameterMap, modelFormField, request, response, context); >>>> } else { >>>> - WidgetWorker.makeHiddenFormLinkForm(writer, target, targetType, targetWindow, parameterList, modelFormField, request, response, context); >>>> + WidgetWorker.makeHiddenFormLinkForm(writer, target, targetType, targetWindow, parameterMap, modelFormField, request, response, context); >>>> WidgetWorker.makeHiddenFormLinkAnchor(writer, linkStyle, encodedDescription, confirmation , modelFormField, request, response, context); >>>> } >>>> } else { >>>> - makeHyperlinkString(writer, linkStyle, targetType, target, parameterList, encodedDescription, confirmation , modelFormField, request, response, context, targetWindow); >>>> + makeHyperlinkString(writer, linkStyle, targetType, target, parameterMap, encodedDescription, confirmation , modelFormField, request, response, context, targetWindow); >>>> } >>>> >>>> } >>>> >>>> - public void makeHyperlinkString(Appendable writer, String linkStyle, String targetType, String target, List<WidgetWorker.Parameter> parameterList, >>>> + public void makeHyperlinkString(Appendable writer, String linkStyle, String targetType, String target, Map<String, String> parameterMap, >>>> String description, String confirmation , ModelFormField modelFormField, HttpServletRequest request, HttpServletResponse response, Map<String, Object> context, String targetWindow) >>>> throws IOException { >>>> if (UtilValidate.isNotEmpty(description) || UtilValidate.isNotEmpty(request.getAttribute("image"))) { >>>> StringBuilder linkUrl = new StringBuilder(); >>>> >>>> - WidgetWorker.buildHyperlinkUrl(linkUrl, target, targetType, parameterList, null, false, false, true, request, response, context); >>>> + WidgetWorker.buildHyperlinkUrl(linkUrl, target, targetType, parameterMap, null, false, false, true, request, response, context); >>>> >>>> String event = ""; >>>> String action = ""; >>>> >>>> Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java >>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java?rev=938816&r1=938815&r2=938816&view=diff >>>> ============================================================================== >>>> --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java (original) >>>> +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java Wed Apr 28 08:33:37 2010 >>>> @@ -2281,6 +2281,7 @@ public class ModelFormField { >>>> protected FlexibleStringExpander alternate; >>>> protected FlexibleStringExpander imageTitle; >>>> protected FlexibleStringExpander targetWindowExdr; >>>> + protected FlexibleMapAccessor<Map<String, String>> parametersMapAcsr; >>>> protected List<WidgetWorker.Parameter> parameterList = FastList.newInstance(); >>>> >>>> protected boolean requestConfirmation = false; >>>> @@ -2308,6 +2309,7 @@ public class ModelFormField { >>>> this.linkType = element.getAttribute("link-type"); >>>> this.targetType = element.getAttribute("target-type"); >>>> this.targetWindowExdr = FlexibleStringExpander.getInstance(element.getAttribute("target-window")); >>>> + this.parametersMapAcsr = FlexibleMapAccessor.getInstance(element.getAttribute("parameters-map")); >>>> this.image = element.getAttribute("image-location"); >>>> this.setRequestConfirmation("true".equals(element.getAttribute("request-confirmation"))); >>>> this.setConfirmationMsg(element.getAttribute("confirmation-message")); >>>> @@ -2380,8 +2382,19 @@ public class ModelFormField { >>>> return this.target.expandString(context); >>>> } >>>> >>>> - public List<WidgetWorker.Parameter> getParameterList() { >>>> - return this.parameterList; >>>> + public Map<String, String> getParameterMap(Map<String, Object> context) { >>>> + Map<String, String> fullParameterMap = FastMap.newInstance(); >>>> + >>>> + Map<String, String> addlParamMap = this.parametersMapAcsr.get(context); >>>> + if (addlParamMap != null) { >>>> + fullParameterMap.putAll(addlParamMap); >>>> + } >>>> + >>>> + for (WidgetWorker.Parameter parameter: this.parameterList) { >>>> + fullParameterMap.put(parameter.getName(), parameter.getValue(context)); >>>> + } >>>> + >>>> + return fullParameterMap; >>>> } >>>> >>>> public String getImage() { >>>> @@ -2507,8 +2520,21 @@ public class ModelFormField { >>>> return this.linkType; >>>> } >>>> >>>> - public List<WidgetWorker.Parameter> getParameterList() { >>>> - return this.parameterList; >>>> + public Map<String, String> getParameterMap(Map<String, Object> context) { >>>> + Map<String, String> fullParameterMap = FastMap.newInstance(); >>>> + >>>> + /* leaving this here... may want to add it at some point like the hyperlink element: >>>> + Map<String, String> addlParamMap = this.parametersMapAcsr.get(context); >>>> + if (addlParamMap != null) { >>>> + fullParameterMap.putAll(addlParamMap); >>>> + } >>>> + */ >>>> + >>>> + for (WidgetWorker.Parameter parameter: this.parameterList) { >>>> + fullParameterMap.put(parameter.getName(), parameter.getValue(context)); >>>> + } >>>> + >>>> + return fullParameterMap; >>>> } >>>> >>>> public String getUseWhen(Map<String, Object> context) { >>>> >>>> Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java >>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java?rev=938816&r1=938815&r2=938816&view=diff >>>> ============================================================================== >>>> --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java (original) >>>> +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java Wed Apr 28 08:33:37 2010 >>>> @@ -333,7 +333,7 @@ public class HtmlFormRenderer extends Ht >>>> String description = encode(hyperlinkField.getDescription(context), modelFormField, context); >>>> String confirmation = encode(hyperlinkField.getConfirmation(context), modelFormField, context); >>>> WidgetWorker.makeHyperlinkByType(writer, hyperlinkField.getLinkType(), modelFormField.getWidgetStyle(), hyperlinkField.getTargetType(), hyperlinkField.getTarget(context), >>>> - hyperlinkField.getParameterList(), description, hyperlinkField.getTargetWindow(context), confirmation, modelFormField, >>>> + hyperlinkField.getParameterMap(context), description, hyperlinkField.getTargetWindow(context), confirmation, modelFormField, >>>> this.request, this.response, context); >>>> this.appendTooltip(writer, context, modelFormField); >>>> //appendWhitespace(writer); >>>> @@ -347,7 +347,7 @@ public class HtmlFormRenderer extends Ht >>>> writer.append(' '); >>>> String description = encode(subHyperlink.getDescription(context), subHyperlink.getModelFormField(), context); >>>> WidgetWorker.makeHyperlinkByType(writer, subHyperlink.getLinkType(), subHyperlink.getLinkStyle(), subHyperlink.getTargetType(), subHyperlink.getTarget(context), >>>> - subHyperlink.getParameterList(), description, subHyperlink.getTargetWindow(context), subHyperlink.getConfirmation(context), subHyperlink.getModelFormField(), >>>> + subHyperlink.getParameterMap(context), description, subHyperlink.getTargetWindow(context), subHyperlink.getConfirmation(context), subHyperlink.getModelFormField(), >>>> this.request, this.response, context); >>>> } >>>> } >>>> >>>> Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlMenuRenderer.java >>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlMenuRenderer.java?rev=938816&r1=938815&r2=938816&view=diff >>>> ============================================================================== >>>> --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlMenuRenderer.java (original) >>>> +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlMenuRenderer.java Wed Apr 28 08:33:37 2010 >>>> @@ -418,14 +418,14 @@ public class HtmlMenuRenderer extends Ht >>>> writer.append("\">"); >>>> >>>> StringUtil.SimpleEncoder simpleEncoder = (StringUtil.SimpleEncoder) context.get("simpleEncoder"); >>>> - for (WidgetWorker.Parameter parameter: link.getParameterList()) { >>>> + for (Map.Entry<String, String> parameter: link.getParameterMap(context).entrySet()) { >>>> writer.append("<input name=\""); >>>> - writer.append(parameter.getName()); >>>> + writer.append(parameter.getKey()); >>>> writer.append("\" value=\""); >>>> if (simpleEncoder != null) { >>>> - writer.append(simpleEncoder.encode(parameter.getValue(context))); >>>> + writer.append(simpleEncoder.encode(parameter.getValue())); >>>> } else { >>>> - writer.append(parameter.getValue(context)); >>>> + writer.append(parameter.getValue()); >>>> } >>>> writer.append("\" type=\"hidden\"/>"); >>>> } >>>> @@ -478,11 +478,11 @@ public class HtmlMenuRenderer extends Ht >>>> writer.append("javascript:confirmActionLink('"); >>>> writer.append(confirmationMsg); >>>> writer.append("', '"); >>>> - WidgetWorker.buildHyperlinkUrl(writer, target, link.getUrlMode(), link.getParameterList(), link.getPrefix(context), >>>> + WidgetWorker.buildHyperlinkUrl(writer, target, link.getUrlMode(), link.getParameterMap(context), link.getPrefix(context), >>>> link.getFullPath(), link.getSecure(), link.getEncode(), request, response, context); >>>> writer.append("')"); >>>> } else { >>>> - WidgetWorker.buildHyperlinkUrl(writer, target, link.getUrlMode(), link.getParameterList(), link.getPrefix(context), >>>> + WidgetWorker.buildHyperlinkUrl(writer, target, link.getUrlMode(), link.getParameterMap(context), link.getPrefix(context), >>>> link.getFullPath(), link.getSecure(), link.getEncode(), request, response, context); >>>> } >>>> } >>>> >>>> Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlScreenRenderer.java >>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlScreenRenderer.java?rev=938816&r1=938815&r2=938816&view=diff >>>> ============================================================================== >>>> --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlScreenRenderer.java (original) >>>> +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlScreenRenderer.java Wed Apr 28 08:33:37 2010 >>>> @@ -495,11 +495,11 @@ public class HtmlScreenRenderer extends >>>> writer.append(uniqueItemName); >>>> writer.append("\">"); >>>> >>>> - for (WidgetWorker.Parameter parameter: link.getParameterList()) { >>>> + for (Map.Entry<String, String> parameter: link.getParameterMap(context).entrySet()) { >>>> writer.append("<input name=\""); >>>> - writer.append(parameter.getName()); >>>> + writer.append(parameter.getKey()); >>>> writer.append("\" value=\""); >>>> - writer.append(parameter.getValue(context)); >>>> + writer.append(parameter.getValue()); >>>> writer.append("\" type=\"hidden\"/>"); >>>> } >>>> >>>> @@ -537,7 +537,7 @@ public class HtmlScreenRenderer extends >>>> writer.append(uniqueItemName); >>>> writer.append(".submit()"); >>>> } else { >>>> - WidgetWorker.buildHyperlinkUrl(writer, target, link.getUrlMode(), link.getParameterList(), link.getPrefix(context), >>>> + WidgetWorker.buildHyperlinkUrl(writer, target, link.getUrlMode(), link.getParameterMap(context), link.getPrefix(context), >>>> link.getFullPath(), link.getSecure(), link.getEncode(), request, response, context); >>>> } >>>> writer.append("\""); >>>> >>>> Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlTreeRenderer.java >>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlTreeRenderer.java?rev=938816&r1=938815&r2=938816&view=diff >>>> ============================================================================== >>>> --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlTreeRenderer.java (original) >>>> +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlTreeRenderer.java Wed Apr 28 08:33:37 2010 >>>> @@ -221,7 +221,7 @@ public class HtmlTreeRenderer extends Ht >>>> HttpServletRequest req = (HttpServletRequest) context.get("request"); >>>> if (urlMode != null && urlMode.equalsIgnoreCase("intra-app")) { >>>> if (req != null && res != null) { >>>> - WidgetWorker.buildHyperlinkUrl(writer, target, link.getUrlMode(), link.getParameterList(), link.getPrefix(context), >>>> + WidgetWorker.buildHyperlinkUrl(writer, target, link.getUrlMode(), link.getParameterMap(context), link.getPrefix(context), >>>> link.getFullPath(), link.getSecure(), link.getEncode(), req, res, context); >>>> } else if (prefix != null) { >>>> writer.append(prefix).append(target); >>>> >>>> Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuItem.java >>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuItem.java?rev=938816&r1=938815&r2=938816&view=diff >>>> ============================================================================== >>>> --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuItem.java (original) >>>> +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuItem.java Wed Apr 28 08:33:37 2010 >>>> @@ -28,6 +28,7 @@ import java.util.Map; >>>> import javax.xml.parsers.ParserConfigurationException; >>>> >>>> import javolution.util.FastList; >>>> +import javolution.util.FastMap; >>>> >>>> import org.ofbiz.base.util.Debug; >>>> import org.ofbiz.base.util.StringUtil; >>>> @@ -289,12 +290,12 @@ public class ModelMenuItem { >>>> localItem.name = portalPage.getString("portalPageId"); >>>> localItem.setTitle((String) portalPage.get("portalPageName", locale)); >>>> localItem.link = new Link(this); >>>> - List<WidgetWorker.Parameter> linkParams = localItem.link.getParameterList(); >>>> - linkParams.add(new WidgetWorker.Parameter("portalPageId", portalPage.getString("portalPageId"), false)); >>>> - linkParams.add(new WidgetWorker.Parameter("parentPortalPageId", parentPortalPageId, false)); >>>> + Map<String, String> linkParams = localItem.link.getParameterMap(context); >>>> + linkParams.put("portalPageId", portalPage.getString("portalPageId")); >>>> + linkParams.put("parentPortalPageId", parentPortalPageId); >>>> if (link != null) { >>>> localItem.link.setTarget(link.targetExdr.getOriginal()); >>>> - linkParams.addAll(link.parameterList); >>>> + linkParams.putAll(link.getParameterMap(context)); >>>> } else { >>>> localItem.link.setTarget("showPortalPage"); >>>> } >>>> @@ -741,8 +742,21 @@ public class ModelMenuItem { >>>> return this.linkType; >>>> } >>>> >>>> - public List<WidgetWorker.Parameter> getParameterList() { >>>> - return this.parameterList; >>>> + public Map<String, String> getParameterMap(Map<String, Object> context) { >>>> + Map<String, String> fullParameterMap = FastMap.newInstance(); >>>> + >>>> + /* leaving this here... may want to add it at some point like the hyperlink element: >>>> + Map<String, String> addlParamMap = this.parametersMapAcsr.get(context); >>>> + if (addlParamMap != null) { >>>> + fullParameterMap.putAll(addlParamMap); >>>> + } >>>> + */ >>>> + >>>> + for (WidgetWorker.Parameter parameter: this.parameterList) { >>>> + fullParameterMap.put(parameter.getName(), parameter.getValue(context)); >>>> + } >>>> + >>>> + return fullParameterMap; >>>> } >>>> >>>> public String getConfirmation(Map<String, Object> context) { >>>> >>>> Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java >>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java?rev=938816&r1=938815&r2=938816&view=diff >>>> ============================================================================== >>>> --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java (original) >>>> +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java Wed Apr 28 08:33:37 2010 >>>> @@ -223,15 +223,15 @@ public class MacroScreenRenderer impleme >>>> link.getFullPath(), link.getSecure(), link.getEncode(), request, response, context); >>>> actionUrl = sb.toString(); >>>> parameters.append("["); >>>> - for (WidgetWorker.Parameter parameter: link.getParameterList()) { >>>> + for (Map.Entry<String, String> parameter: link.getParameterMap(context).entrySet()) { >>>> if (parameters.length() >1) { >>>> parameters.append(","); >>>> } >>>> parameters.append("{'name':'"); >>>> - parameters.append(parameter.getName()); >>>> + parameters.append(parameter.getKey()); >>>> parameters.append("'"); >>>> parameters.append(",'value':'"); >>>> - parameters.append(parameter.getValue(context)); >>>> + parameters.append(parameter.getValue()); >>>> parameters.append("'}"); >>>> } >>>> parameters.append("]"); >>>> @@ -244,7 +244,7 @@ public class MacroScreenRenderer impleme >>>> if (UtilValidate.isNotEmpty(target)) { >>>> if (!"hidden-form".equals(linkType)) { >>>> StringBuilder sb = new StringBuilder(); >>>> - WidgetWorker.buildHyperlinkUrl(sb, target, link.getUrlMode(), link.getParameterList(), link.getPrefix(context), >>>> + WidgetWorker.buildHyperlinkUrl(sb, target, link.getUrlMode(), link.getParameterMap(context), link.getPrefix(context), >>>> link.getFullPath(), link.getSecure(), link.getEncode(), request, response, context); >>>> linkUrl = sb.toString(); >>>> } >>>> >>>> Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenWidget.java >>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenWidget.java?rev=938816&r1=938815&r2=938816&view=diff >>>> ============================================================================== >>>> --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenWidget.java (original) >>>> +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenWidget.java Wed Apr 28 08:33:37 2010 >>>> @@ -29,6 +29,7 @@ import javax.servlet.http.HttpServletRes >>>> import javax.xml.parsers.ParserConfigurationException; >>>> >>>> import javolution.util.FastList; >>>> +import javolution.util.FastMap; >>>> >>>> import org.ofbiz.base.util.Debug; >>>> import org.ofbiz.base.util.GeneralException; >>>> @@ -1480,8 +1481,21 @@ public abstract class ModelScreenWidget >>>> return this.linkType; >>>> } >>>> >>>> - public List<WidgetWorker.Parameter> getParameterList() { >>>> - return this.parameterList; >>>> + public Map<String, String> getParameterMap(Map<String, Object> context) { >>>> + Map<String, String> fullParameterMap = FastMap.newInstance(); >>>> + >>>> + /* leaving this here... may want to add it at some point like the hyperlink element: >>>> + Map<String, String> addlParamMap = this.parametersMapAcsr.get(context); >>>> + if (addlParamMap != null) { >>>> + fullParameterMap.putAll(addlParamMap); >>>> + } >>>> + */ >>>> + >>>> + for (WidgetWorker.Parameter parameter: this.parameterList) { >>>> + fullParameterMap.put(parameter.getName(), parameter.getValue(context)); >>>> + } >>>> + >>>> + return fullParameterMap; >>>> } >>>> >>>> public void setText(String val) { >>>> >>>> Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/MacroTreeRenderer.java >>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/MacroTreeRenderer.java?rev=938816&r1=938815&r2=938816&view=diff >>>> ============================================================================== >>>> --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/MacroTreeRenderer.java (original) >>>> +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/MacroTreeRenderer.java Wed Apr 28 08:33:37 2010 >>>> @@ -267,7 +267,7 @@ public class MacroTreeRenderer implement >>>> HttpServletRequest request = (HttpServletRequest) context.get("request"); >>>> >>>> if (UtilValidate.isNotEmpty(target)) { >>>> - WidgetWorker.buildHyperlinkUrl(linkUrl, target, link.getUrlMode(), link.getParameterList(), link.getPrefix(context), >>>> + WidgetWorker.buildHyperlinkUrl(linkUrl, target, link.getUrlMode(), link.getParameterMap(context), link.getPrefix(context), >>>> link.getFullPath(), link.getSecure(), link.getEncode(), request, response, context); >>>> } >>>> >>>> >>>> Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/ModelTree.java >>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/ModelTree.java?rev=938816&r1=938815&r2=938816&view=diff >>>> ============================================================================== >>>> --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/ModelTree.java (original) >>>> +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/ModelTree.java Wed Apr 28 08:33:37 2010 >>>> @@ -930,8 +930,21 @@ public class ModelTree extends ModelWidg >>>> return this.linkType; >>>> } >>>> >>>> - public List<WidgetWorker.Parameter> getParameterList() { >>>> - return this.parameterList; >>>> + public Map<String, String> getParameterMap(Map<String, Object> context) { >>>> + Map<String, String> fullParameterMap = FastMap.newInstance(); >>>> + >>>> + /* leaving this here... may want to add it at some point like the hyperlink element: >>>> + Map<String, String> addlParamMap = this.parametersMapAcsr.get(context); >>>> + if (addlParamMap != null) { >>>> + fullParameterMap.putAll(addlParamMap); >>>> + } >>>> + */ >>>> + >>>> + for (WidgetWorker.Parameter parameter: this.parameterList) { >>>> + fullParameterMap.put(parameter.getName(), parameter.getValue(context)); >>>> + } >>>> + >>>> + return fullParameterMap; >>>> } >>>> >>>> public void setText(String val) { >>>> >>>> >>> -- >>> Ofbiz on twitter: http://twitter.com/apache_ofbiz >>> Myself on twitter: http://twitter.com/hansbak >>> Antwebsystems.com: Quality services for competitive rates. >>> >> > -- > Ofbiz on twitter: http://twitter.com/apache_ofbiz > Myself on twitter: http://twitter.com/hansbak > Antwebsystems.com: Quality services for competitive rates. > |
Hi David,
1. i select myportal -> the main page is shown -> is fine 2. i select 'mycomms' within myportal -> expecting mycomms, it is showing 'main' -> not fine! 3. if i select 'profile' -> expecting profile but showing 'main' -> not fine! 4. if i select next option......etc etc Regards, Hans On Sun, 2010-05-02 at 01:57 -0600, David E Jones wrote: > Come on, please throw me a bone here. I'm happy to look into this, but something more specific so I can tell what you're talking about is absolutely necessary, otherwise this goes into the circular file. It's your choice. I gave up reading minds a long time ago. > > Which page (URLs are a nice way of being specific), which form, which field? What do you actually see and what do you expect to see there? > > -David > > > On May 2, 2010, at 1:52 AM, Hans Bakker wrote: > > > any option within myportal (mycomms, profile etc) only show the main > > page..... > > > > Regards, > > Hans > > > > On Sun, 2010-05-02 at 01:45 -0600, David E Jones wrote: > >> Could you be more specific? Ie, what does "options within myportal" refer to? > >> > >> -David > >> > >> > >> On May 2, 2010, at 1:32 AM, Hans Bakker wrote: > >> > >>> Hi David, > >>> can you please have a look at this commit? > >>> > >>> any options within myportal now only show the main option. > >>> > >>> can you please check? > >>> > >>> Regards, > >>> > >>> Hans > >>> > >>> > >>> On Wed, 2010-04-28 at 08:33 +0000, [hidden email] wrote: > >>>> Author: jonesde > >>>> Date: Wed Apr 28 08:33:37 2010 > >>>> New Revision: 938816 > >>>> > >>>> URL: http://svn.apache.org/viewvc?rev=938816&view=rev > >>>> Log: > >>>> Refactored the various link getParameterList methods to return a Map and expand with the context like most of the other get methods that are used during rendering; that is the biggest change but was part of adding a parameters-map attribute to the form widget hyperlink element to be able to use a script to prepare part or all of the parameters map used in the hidden form instead of having to manually declare all parameters > >>>> > >>>> Modified: > >>>> ofbiz/trunk/framework/widget/dtd/widget-form.xsd > >>>> ofbiz/trunk/framework/widget/src/org/ofbiz/widget/WidgetWorker.java > >>>> ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java > >>>> ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java > >>>> ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java > >>>> ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlMenuRenderer.java > >>>> ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlScreenRenderer.java > >>>> ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlTreeRenderer.java > >>>> ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuItem.java > >>>> ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java > >>>> ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenWidget.java > >>>> ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/MacroTreeRenderer.java > >>>> ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/ModelTree.java > >>>> > >>>> Modified: ofbiz/trunk/framework/widget/dtd/widget-form.xsd > >>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/dtd/widget-form.xsd?rev=938816&r1=938815&r2=938816&view=diff > >>>> ============================================================================== > >>>> --- ofbiz/trunk/framework/widget/dtd/widget-form.xsd (original) > >>>> +++ ofbiz/trunk/framework/widget/dtd/widget-form.xsd Wed Apr 28 08:33:37 2010 > >>>> @@ -856,6 +856,9 @@ under the License. > >>>> </xs:simpleType> > >>>> </xs:attribute> > >>>> <xs:attribute name="confirmation-message" type="xs:string"><xs:annotation><xs:documentation>The message displayed in confirmation box</xs:documentation></xs:annotation></xs:attribute> > >>>> + <xs:attribute name="parameters-map" type="xs:string"> > >>>> + <xs:annotation><xs:documentation>A Map in the context that will be used as additional name/value pairs.</xs:documentation></xs:annotation> > >>>> + </xs:attribute> > >>>> </xs:attributeGroup> > >>>> <xs:element name="parameter"> > >>>> <xs:complexType> > >>>> > >>>> Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/WidgetWorker.java > >>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/WidgetWorker.java?rev=938816&r1=938815&r2=938816&view=diff > >>>> ============================================================================== > >>>> --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/WidgetWorker.java (original) > >>>> +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/WidgetWorker.java Wed Apr 28 08:33:37 2010 > >>>> @@ -50,7 +50,7 @@ public class WidgetWorker { > >>>> > >>>> public WidgetWorker () {} > >>>> > >>>> - public static void buildHyperlinkUrl(Appendable externalWriter, String target, String targetType, List<WidgetWorker.Parameter> parameterList, > >>>> + public static void buildHyperlinkUrl(Appendable externalWriter, String target, String targetType, Map<String, String> parameterMap, > >>>> String prefix, boolean fullPath, boolean secure, boolean encode, HttpServletRequest request, HttpServletResponse response, Map<String, Object> context) throws IOException { > >>>> String localRequestName = UtilHttp.encodeAmpersands(target); > >>>> Appendable localWriter = new StringWriter(); > >>>> @@ -87,7 +87,7 @@ public class WidgetWorker { > >>>> localWriter.append(localRequestName); > >>>> } > >>>> > >>>> - if (UtilValidate.isNotEmpty(parameterList)) { > >>>> + if (UtilValidate.isNotEmpty(parameterMap)) { > >>>> String localUrl = localWriter.toString(); > >>>> externalWriter.append(localUrl); > >>>> boolean needsAmp = true; > >>>> @@ -96,19 +96,19 @@ public class WidgetWorker { > >>>> needsAmp = false; > >>>> } > >>>> > >>>> - for (WidgetWorker.Parameter parameter: parameterList) { > >>>> + for (Map.Entry<String, String> parameter: parameterMap.entrySet()) { > >>>> if (needsAmp) { > >>>> externalWriter.append("&"); > >>>> } else { > >>>> needsAmp = true; > >>>> } > >>>> - externalWriter.append(parameter.getName()); > >>>> + externalWriter.append(parameter.getKey()); > >>>> externalWriter.append('='); > >>>> StringUtil.SimpleEncoder simpleEncoder = (StringUtil.SimpleEncoder) context.get("simpleEncoder"); > >>>> if (simpleEncoder != null) { > >>>> - externalWriter.append(simpleEncoder.encode(parameter.getValue(context))); > >>>> + externalWriter.append(simpleEncoder.encode(parameter.getValue())); > >>>> } else { > >>>> - externalWriter.append(parameter.getValue(context)); > >>>> + externalWriter.append(parameter.getValue()); > >>>> } > >>>> } > >>>> } else { > >>>> @@ -123,7 +123,7 @@ public class WidgetWorker { > >>>> writer.append(location); > >>>> } > >>>> public static void makeHyperlinkByType(Appendable writer, String linkType, String linkStyle, String targetType, String target, > >>>> - List<WidgetWorker.Parameter> parameterList, String description, String targetWindow, String confirmation, ModelFormField modelFormField, > >>>> + Map<String, String> parameterMap, String description, String targetWindow, String confirmation, ModelFormField modelFormField, > >>>> HttpServletRequest request, HttpServletResponse response, Map<String, Object> context) throws IOException { > >>>> String realLinkType = WidgetWorker.determineAutoLinkType(linkType, target, targetType, request); > >>>> if ("hidden-form".equals(realLinkType)) { > >>>> @@ -137,17 +137,17 @@ public class WidgetWorker { > >>>> postMultiFormWriter = new StringWriter(); > >>>> wholeFormContext.put("postMultiFormWriter", postMultiFormWriter); > >>>> } > >>>> - WidgetWorker.makeHiddenFormLinkForm(postMultiFormWriter, target, targetType, targetWindow, parameterList, modelFormField, request, response, context); > >>>> + WidgetWorker.makeHiddenFormLinkForm(postMultiFormWriter, target, targetType, targetWindow, parameterMap, modelFormField, request, response, context); > >>>> } else { > >>>> - WidgetWorker.makeHiddenFormLinkForm(writer, target, targetType, targetWindow, parameterList, modelFormField, request, response, context); > >>>> + WidgetWorker.makeHiddenFormLinkForm(writer, target, targetType, targetWindow, parameterMap, modelFormField, request, response, context); > >>>> WidgetWorker.makeHiddenFormLinkAnchor(writer, linkStyle, description, confirmation, modelFormField, request, response, context); > >>>> } > >>>> } else { > >>>> - WidgetWorker.makeHyperlinkString(writer, linkStyle, targetType, target, parameterList, description, confirmation, modelFormField, request, response, context, targetWindow); > >>>> + WidgetWorker.makeHyperlinkString(writer, linkStyle, targetType, target, parameterMap, description, confirmation, modelFormField, request, response, context, targetWindow); > >>>> } > >>>> > >>>> } > >>>> - public static void makeHyperlinkString(Appendable writer, String linkStyle, String targetType, String target, List<WidgetWorker.Parameter> parameterList, > >>>> + public static void makeHyperlinkString(Appendable writer, String linkStyle, String targetType, String target, Map<String, String> parameterMap, > >>>> String description, String confirmation, ModelFormField modelFormField, HttpServletRequest request, HttpServletResponse response, Map<String, Object> context, String targetWindow) > >>>> throws IOException { > >>>> if (UtilValidate.isNotEmpty(description) || UtilValidate.isNotEmpty(request.getAttribute("image"))) { > >>>> @@ -161,7 +161,7 @@ public class WidgetWorker { > >>>> > >>>> writer.append(" href=\""); > >>>> > >>>> - buildHyperlinkUrl(writer, target, targetType, parameterList, null, false, false, true, request, response, context); > >>>> + buildHyperlinkUrl(writer, target, targetType, parameterMap, null, false, false, true, request, response, context); > >>>> > >>>> writer.append("\""); > >>>> > >>>> @@ -237,7 +237,7 @@ public class WidgetWorker { > >>>> } > >>>> } > >>>> > >>>> - public static void makeHiddenFormLinkForm(Appendable writer, String target, String targetType, String targetWindow, List<WidgetWorker.Parameter> parameterList, ModelFormField modelFormField, HttpServletRequest request, HttpServletResponse response, Map<String, Object> context) throws IOException { > >>>> + public static void makeHiddenFormLinkForm(Appendable writer, String target, String targetType, String targetWindow, Map<String, String> parameterMap, ModelFormField modelFormField, HttpServletRequest request, HttpServletResponse response, Map<String, Object> context) throws IOException { > >>>> writer.append("<form method=\"post\""); > >>>> writer.append(" action=\""); > >>>> // note that this passes null for the parameterList on purpose so they won't be put into the URL > >>>> @@ -256,11 +256,11 @@ public class WidgetWorker { > >>>> writer.append(makeLinkHiddenFormName(context, modelFormField)); > >>>> writer.append("\">"); > >>>> > >>>> - for (WidgetWorker.Parameter parameter: parameterList) { > >>>> + for (Map.Entry<String, String> parameter: parameterMap.entrySet()) { > >>>> writer.append("<input name=\""); > >>>> - writer.append(parameter.getName()); > >>>> + writer.append(parameter.getKey()); > >>>> writer.append("\" value=\""); > >>>> - writer.append(parameter.getValue(context)); > >>>> + writer.append(parameter.getValue()); > >>>> writer.append("\" type=\"hidden\"/>"); > >>>> } > >>>> > >>>> > >>>> Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java > >>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java?rev=938816&r1=938815&r2=938816&view=diff > >>>> ============================================================================== > >>>> --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java (original) > >>>> +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java Wed Apr 28 08:33:37 2010 > >>>> @@ -344,7 +344,7 @@ public class MacroFormRenderer implement > >>>> this.request.setAttribute("alternate", encodedAlternate); > >>>> this.request.setAttribute("imageTitle", encodedImageTitle); > >>>> makeHyperlinkByType(writer, hyperlinkField.getLinkType(), modelFormField.getWidgetStyle(), hyperlinkField.getTargetType(), hyperlinkField.getTarget(context), > >>>> - hyperlinkField.getParameterList(), hyperlinkField.getDescription(context), hyperlinkField.getTargetWindow(context), hyperlinkField.getConfirmation(context), modelFormField, > >>>> + hyperlinkField.getParameterMap(context), hyperlinkField.getDescription(context), hyperlinkField.getTargetWindow(context), hyperlinkField.getConfirmation(context), modelFormField, > >>>> this.request, this.response, context); > >>>> > >>>> this.appendTooltip(writer, context, modelFormField); > >>>> @@ -2813,7 +2813,7 @@ public class MacroFormRenderer implement > >>>> if (subHyperlink.shouldUse(context)) { > >>>> writer.append(' '); > >>>> makeHyperlinkByType(writer, subHyperlink.getLinkType(), subHyperlink.getLinkStyle(), subHyperlink.getTargetType(), subHyperlink.getTarget(context), > >>>> - subHyperlink.getParameterList(), subHyperlink.getDescription(context), subHyperlink.getTargetWindow(context), subHyperlink.getConfirmation(context), subHyperlink.getModelFormField(), > >>>> + subHyperlink.getParameterMap(context), subHyperlink.getDescription(context), subHyperlink.getTargetWindow(context), subHyperlink.getConfirmation(context), subHyperlink.getModelFormField(), > >>>> this.request, this.response, context); > >>>> } > >>>> } > >>>> @@ -2841,7 +2841,7 @@ public class MacroFormRenderer implement > >>>> } > >>>> > >>>> public void makeHyperlinkByType(Appendable writer, String linkType, String linkStyle, String targetType, String target, > >>>> - List<WidgetWorker.Parameter> parameterList, String description, String targetWindow, String confirmation , ModelFormField modelFormField, > >>>> + Map<String, String> parameterMap, String description, String targetWindow, String confirmation , ModelFormField modelFormField, > >>>> HttpServletRequest request, HttpServletResponse response, Map<String, Object> context) throws IOException { > >>>> String realLinkType = WidgetWorker.determineAutoLinkType(linkType, target, targetType, request); > >>>> > >>>> @@ -2858,24 +2858,24 @@ public class MacroFormRenderer implement > >>>> postMultiFormWriter = new StringWriter(); > >>>> wholeFormContext.put("postMultiFormWriter", postMultiFormWriter); > >>>> } > >>>> - WidgetWorker.makeHiddenFormLinkForm(postMultiFormWriter, target, targetType, targetWindow, parameterList, modelFormField, request, response, context); > >>>> + WidgetWorker.makeHiddenFormLinkForm(postMultiFormWriter, target, targetType, targetWindow, parameterMap, modelFormField, request, response, context); > >>>> } else { > >>>> - WidgetWorker.makeHiddenFormLinkForm(writer, target, targetType, targetWindow, parameterList, modelFormField, request, response, context); > >>>> + WidgetWorker.makeHiddenFormLinkForm(writer, target, targetType, targetWindow, parameterMap, modelFormField, request, response, context); > >>>> WidgetWorker.makeHiddenFormLinkAnchor(writer, linkStyle, encodedDescription, confirmation , modelFormField, request, response, context); > >>>> } > >>>> } else { > >>>> - makeHyperlinkString(writer, linkStyle, targetType, target, parameterList, encodedDescription, confirmation , modelFormField, request, response, context, targetWindow); > >>>> + makeHyperlinkString(writer, linkStyle, targetType, target, parameterMap, encodedDescription, confirmation , modelFormField, request, response, context, targetWindow); > >>>> } > >>>> > >>>> } > >>>> > >>>> - public void makeHyperlinkString(Appendable writer, String linkStyle, String targetType, String target, List<WidgetWorker.Parameter> parameterList, > >>>> + public void makeHyperlinkString(Appendable writer, String linkStyle, String targetType, String target, Map<String, String> parameterMap, > >>>> String description, String confirmation , ModelFormField modelFormField, HttpServletRequest request, HttpServletResponse response, Map<String, Object> context, String targetWindow) > >>>> throws IOException { > >>>> if (UtilValidate.isNotEmpty(description) || UtilValidate.isNotEmpty(request.getAttribute("image"))) { > >>>> StringBuilder linkUrl = new StringBuilder(); > >>>> > >>>> - WidgetWorker.buildHyperlinkUrl(linkUrl, target, targetType, parameterList, null, false, false, true, request, response, context); > >>>> + WidgetWorker.buildHyperlinkUrl(linkUrl, target, targetType, parameterMap, null, false, false, true, request, response, context); > >>>> > >>>> String event = ""; > >>>> String action = ""; > >>>> > >>>> Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java > >>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java?rev=938816&r1=938815&r2=938816&view=diff > >>>> ============================================================================== > >>>> --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java (original) > >>>> +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java Wed Apr 28 08:33:37 2010 > >>>> @@ -2281,6 +2281,7 @@ public class ModelFormField { > >>>> protected FlexibleStringExpander alternate; > >>>> protected FlexibleStringExpander imageTitle; > >>>> protected FlexibleStringExpander targetWindowExdr; > >>>> + protected FlexibleMapAccessor<Map<String, String>> parametersMapAcsr; > >>>> protected List<WidgetWorker.Parameter> parameterList = FastList.newInstance(); > >>>> > >>>> protected boolean requestConfirmation = false; > >>>> @@ -2308,6 +2309,7 @@ public class ModelFormField { > >>>> this.linkType = element.getAttribute("link-type"); > >>>> this.targetType = element.getAttribute("target-type"); > >>>> this.targetWindowExdr = FlexibleStringExpander.getInstance(element.getAttribute("target-window")); > >>>> + this.parametersMapAcsr = FlexibleMapAccessor.getInstance(element.getAttribute("parameters-map")); > >>>> this.image = element.getAttribute("image-location"); > >>>> this.setRequestConfirmation("true".equals(element.getAttribute("request-confirmation"))); > >>>> this.setConfirmationMsg(element.getAttribute("confirmation-message")); > >>>> @@ -2380,8 +2382,19 @@ public class ModelFormField { > >>>> return this.target.expandString(context); > >>>> } > >>>> > >>>> - public List<WidgetWorker.Parameter> getParameterList() { > >>>> - return this.parameterList; > >>>> + public Map<String, String> getParameterMap(Map<String, Object> context) { > >>>> + Map<String, String> fullParameterMap = FastMap.newInstance(); > >>>> + > >>>> + Map<String, String> addlParamMap = this.parametersMapAcsr.get(context); > >>>> + if (addlParamMap != null) { > >>>> + fullParameterMap.putAll(addlParamMap); > >>>> + } > >>>> + > >>>> + for (WidgetWorker.Parameter parameter: this.parameterList) { > >>>> + fullParameterMap.put(parameter.getName(), parameter.getValue(context)); > >>>> + } > >>>> + > >>>> + return fullParameterMap; > >>>> } > >>>> > >>>> public String getImage() { > >>>> @@ -2507,8 +2520,21 @@ public class ModelFormField { > >>>> return this.linkType; > >>>> } > >>>> > >>>> - public List<WidgetWorker.Parameter> getParameterList() { > >>>> - return this.parameterList; > >>>> + public Map<String, String> getParameterMap(Map<String, Object> context) { > >>>> + Map<String, String> fullParameterMap = FastMap.newInstance(); > >>>> + > >>>> + /* leaving this here... may want to add it at some point like the hyperlink element: > >>>> + Map<String, String> addlParamMap = this.parametersMapAcsr.get(context); > >>>> + if (addlParamMap != null) { > >>>> + fullParameterMap.putAll(addlParamMap); > >>>> + } > >>>> + */ > >>>> + > >>>> + for (WidgetWorker.Parameter parameter: this.parameterList) { > >>>> + fullParameterMap.put(parameter.getName(), parameter.getValue(context)); > >>>> + } > >>>> + > >>>> + return fullParameterMap; > >>>> } > >>>> > >>>> public String getUseWhen(Map<String, Object> context) { > >>>> > >>>> Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java > >>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java?rev=938816&r1=938815&r2=938816&view=diff > >>>> ============================================================================== > >>>> --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java (original) > >>>> +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java Wed Apr 28 08:33:37 2010 > >>>> @@ -333,7 +333,7 @@ public class HtmlFormRenderer extends Ht > >>>> String description = encode(hyperlinkField.getDescription(context), modelFormField, context); > >>>> String confirmation = encode(hyperlinkField.getConfirmation(context), modelFormField, context); > >>>> WidgetWorker.makeHyperlinkByType(writer, hyperlinkField.getLinkType(), modelFormField.getWidgetStyle(), hyperlinkField.getTargetType(), hyperlinkField.getTarget(context), > >>>> - hyperlinkField.getParameterList(), description, hyperlinkField.getTargetWindow(context), confirmation, modelFormField, > >>>> + hyperlinkField.getParameterMap(context), description, hyperlinkField.getTargetWindow(context), confirmation, modelFormField, > >>>> this.request, this.response, context); > >>>> this.appendTooltip(writer, context, modelFormField); > >>>> //appendWhitespace(writer); > >>>> @@ -347,7 +347,7 @@ public class HtmlFormRenderer extends Ht > >>>> writer.append(' '); > >>>> String description = encode(subHyperlink.getDescription(context), subHyperlink.getModelFormField(), context); > >>>> WidgetWorker.makeHyperlinkByType(writer, subHyperlink.getLinkType(), subHyperlink.getLinkStyle(), subHyperlink.getTargetType(), subHyperlink.getTarget(context), > >>>> - subHyperlink.getParameterList(), description, subHyperlink.getTargetWindow(context), subHyperlink.getConfirmation(context), subHyperlink.getModelFormField(), > >>>> + subHyperlink.getParameterMap(context), description, subHyperlink.getTargetWindow(context), subHyperlink.getConfirmation(context), subHyperlink.getModelFormField(), > >>>> this.request, this.response, context); > >>>> } > >>>> } > >>>> > >>>> Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlMenuRenderer.java > >>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlMenuRenderer.java?rev=938816&r1=938815&r2=938816&view=diff > >>>> ============================================================================== > >>>> --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlMenuRenderer.java (original) > >>>> +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlMenuRenderer.java Wed Apr 28 08:33:37 2010 > >>>> @@ -418,14 +418,14 @@ public class HtmlMenuRenderer extends Ht > >>>> writer.append("\">"); > >>>> > >>>> StringUtil.SimpleEncoder simpleEncoder = (StringUtil.SimpleEncoder) context.get("simpleEncoder"); > >>>> - for (WidgetWorker.Parameter parameter: link.getParameterList()) { > >>>> + for (Map.Entry<String, String> parameter: link.getParameterMap(context).entrySet()) { > >>>> writer.append("<input name=\""); > >>>> - writer.append(parameter.getName()); > >>>> + writer.append(parameter.getKey()); > >>>> writer.append("\" value=\""); > >>>> if (simpleEncoder != null) { > >>>> - writer.append(simpleEncoder.encode(parameter.getValue(context))); > >>>> + writer.append(simpleEncoder.encode(parameter.getValue())); > >>>> } else { > >>>> - writer.append(parameter.getValue(context)); > >>>> + writer.append(parameter.getValue()); > >>>> } > >>>> writer.append("\" type=\"hidden\"/>"); > >>>> } > >>>> @@ -478,11 +478,11 @@ public class HtmlMenuRenderer extends Ht > >>>> writer.append("javascript:confirmActionLink('"); > >>>> writer.append(confirmationMsg); > >>>> writer.append("', '"); > >>>> - WidgetWorker.buildHyperlinkUrl(writer, target, link.getUrlMode(), link.getParameterList(), link.getPrefix(context), > >>>> + WidgetWorker.buildHyperlinkUrl(writer, target, link.getUrlMode(), link.getParameterMap(context), link.getPrefix(context), > >>>> link.getFullPath(), link.getSecure(), link.getEncode(), request, response, context); > >>>> writer.append("')"); > >>>> } else { > >>>> - WidgetWorker.buildHyperlinkUrl(writer, target, link.getUrlMode(), link.getParameterList(), link.getPrefix(context), > >>>> + WidgetWorker.buildHyperlinkUrl(writer, target, link.getUrlMode(), link.getParameterMap(context), link.getPrefix(context), > >>>> link.getFullPath(), link.getSecure(), link.getEncode(), request, response, context); > >>>> } > >>>> } > >>>> > >>>> Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlScreenRenderer.java > >>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlScreenRenderer.java?rev=938816&r1=938815&r2=938816&view=diff > >>>> ============================================================================== > >>>> --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlScreenRenderer.java (original) > >>>> +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlScreenRenderer.java Wed Apr 28 08:33:37 2010 > >>>> @@ -495,11 +495,11 @@ public class HtmlScreenRenderer extends > >>>> writer.append(uniqueItemName); > >>>> writer.append("\">"); > >>>> > >>>> - for (WidgetWorker.Parameter parameter: link.getParameterList()) { > >>>> + for (Map.Entry<String, String> parameter: link.getParameterMap(context).entrySet()) { > >>>> writer.append("<input name=\""); > >>>> - writer.append(parameter.getName()); > >>>> + writer.append(parameter.getKey()); > >>>> writer.append("\" value=\""); > >>>> - writer.append(parameter.getValue(context)); > >>>> + writer.append(parameter.getValue()); > >>>> writer.append("\" type=\"hidden\"/>"); > >>>> } > >>>> > >>>> @@ -537,7 +537,7 @@ public class HtmlScreenRenderer extends > >>>> writer.append(uniqueItemName); > >>>> writer.append(".submit()"); > >>>> } else { > >>>> - WidgetWorker.buildHyperlinkUrl(writer, target, link.getUrlMode(), link.getParameterList(), link.getPrefix(context), > >>>> + WidgetWorker.buildHyperlinkUrl(writer, target, link.getUrlMode(), link.getParameterMap(context), link.getPrefix(context), > >>>> link.getFullPath(), link.getSecure(), link.getEncode(), request, response, context); > >>>> } > >>>> writer.append("\""); > >>>> > >>>> Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlTreeRenderer.java > >>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlTreeRenderer.java?rev=938816&r1=938815&r2=938816&view=diff > >>>> ============================================================================== > >>>> --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlTreeRenderer.java (original) > >>>> +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlTreeRenderer.java Wed Apr 28 08:33:37 2010 > >>>> @@ -221,7 +221,7 @@ public class HtmlTreeRenderer extends Ht > >>>> HttpServletRequest req = (HttpServletRequest) context.get("request"); > >>>> if (urlMode != null && urlMode.equalsIgnoreCase("intra-app")) { > >>>> if (req != null && res != null) { > >>>> - WidgetWorker.buildHyperlinkUrl(writer, target, link.getUrlMode(), link.getParameterList(), link.getPrefix(context), > >>>> + WidgetWorker.buildHyperlinkUrl(writer, target, link.getUrlMode(), link.getParameterMap(context), link.getPrefix(context), > >>>> link.getFullPath(), link.getSecure(), link.getEncode(), req, res, context); > >>>> } else if (prefix != null) { > >>>> writer.append(prefix).append(target); > >>>> > >>>> Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuItem.java > >>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuItem.java?rev=938816&r1=938815&r2=938816&view=diff > >>>> ============================================================================== > >>>> --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuItem.java (original) > >>>> +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuItem.java Wed Apr 28 08:33:37 2010 > >>>> @@ -28,6 +28,7 @@ import java.util.Map; > >>>> import javax.xml.parsers.ParserConfigurationException; > >>>> > >>>> import javolution.util.FastList; > >>>> +import javolution.util.FastMap; > >>>> > >>>> import org.ofbiz.base.util.Debug; > >>>> import org.ofbiz.base.util.StringUtil; > >>>> @@ -289,12 +290,12 @@ public class ModelMenuItem { > >>>> localItem.name = portalPage.getString("portalPageId"); > >>>> localItem.setTitle((String) portalPage.get("portalPageName", locale)); > >>>> localItem.link = new Link(this); > >>>> - List<WidgetWorker.Parameter> linkParams = localItem.link.getParameterList(); > >>>> - linkParams.add(new WidgetWorker.Parameter("portalPageId", portalPage.getString("portalPageId"), false)); > >>>> - linkParams.add(new WidgetWorker.Parameter("parentPortalPageId", parentPortalPageId, false)); > >>>> + Map<String, String> linkParams = localItem.link.getParameterMap(context); > >>>> + linkParams.put("portalPageId", portalPage.getString("portalPageId")); > >>>> + linkParams.put("parentPortalPageId", parentPortalPageId); > >>>> if (link != null) { > >>>> localItem.link.setTarget(link.targetExdr.getOriginal()); > >>>> - linkParams.addAll(link.parameterList); > >>>> + linkParams.putAll(link.getParameterMap(context)); > >>>> } else { > >>>> localItem.link.setTarget("showPortalPage"); > >>>> } > >>>> @@ -741,8 +742,21 @@ public class ModelMenuItem { > >>>> return this.linkType; > >>>> } > >>>> > >>>> - public List<WidgetWorker.Parameter> getParameterList() { > >>>> - return this.parameterList; > >>>> + public Map<String, String> getParameterMap(Map<String, Object> context) { > >>>> + Map<String, String> fullParameterMap = FastMap.newInstance(); > >>>> + > >>>> + /* leaving this here... may want to add it at some point like the hyperlink element: > >>>> + Map<String, String> addlParamMap = this.parametersMapAcsr.get(context); > >>>> + if (addlParamMap != null) { > >>>> + fullParameterMap.putAll(addlParamMap); > >>>> + } > >>>> + */ > >>>> + > >>>> + for (WidgetWorker.Parameter parameter: this.parameterList) { > >>>> + fullParameterMap.put(parameter.getName(), parameter.getValue(context)); > >>>> + } > >>>> + > >>>> + return fullParameterMap; > >>>> } > >>>> > >>>> public String getConfirmation(Map<String, Object> context) { > >>>> > >>>> Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java > >>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java?rev=938816&r1=938815&r2=938816&view=diff > >>>> ============================================================================== > >>>> --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java (original) > >>>> +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java Wed Apr 28 08:33:37 2010 > >>>> @@ -223,15 +223,15 @@ public class MacroScreenRenderer impleme > >>>> link.getFullPath(), link.getSecure(), link.getEncode(), request, response, context); > >>>> actionUrl = sb.toString(); > >>>> parameters.append("["); > >>>> - for (WidgetWorker.Parameter parameter: link.getParameterList()) { > >>>> + for (Map.Entry<String, String> parameter: link.getParameterMap(context).entrySet()) { > >>>> if (parameters.length() >1) { > >>>> parameters.append(","); > >>>> } > >>>> parameters.append("{'name':'"); > >>>> - parameters.append(parameter.getName()); > >>>> + parameters.append(parameter.getKey()); > >>>> parameters.append("'"); > >>>> parameters.append(",'value':'"); > >>>> - parameters.append(parameter.getValue(context)); > >>>> + parameters.append(parameter.getValue()); > >>>> parameters.append("'}"); > >>>> } > >>>> parameters.append("]"); > >>>> @@ -244,7 +244,7 @@ public class MacroScreenRenderer impleme > >>>> if (UtilValidate.isNotEmpty(target)) { > >>>> if (!"hidden-form".equals(linkType)) { > >>>> StringBuilder sb = new StringBuilder(); > >>>> - WidgetWorker.buildHyperlinkUrl(sb, target, link.getUrlMode(), link.getParameterList(), link.getPrefix(context), > >>>> + WidgetWorker.buildHyperlinkUrl(sb, target, link.getUrlMode(), link.getParameterMap(context), link.getPrefix(context), > >>>> link.getFullPath(), link.getSecure(), link.getEncode(), request, response, context); > >>>> linkUrl = sb.toString(); > >>>> } > >>>> > >>>> Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenWidget.java > >>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenWidget.java?rev=938816&r1=938815&r2=938816&view=diff > >>>> ============================================================================== > >>>> --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenWidget.java (original) > >>>> +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenWidget.java Wed Apr 28 08:33:37 2010 > >>>> @@ -29,6 +29,7 @@ import javax.servlet.http.HttpServletRes > >>>> import javax.xml.parsers.ParserConfigurationException; > >>>> > >>>> import javolution.util.FastList; > >>>> +import javolution.util.FastMap; > >>>> > >>>> import org.ofbiz.base.util.Debug; > >>>> import org.ofbiz.base.util.GeneralException; > >>>> @@ -1480,8 +1481,21 @@ public abstract class ModelScreenWidget > >>>> return this.linkType; > >>>> } > >>>> > >>>> - public List<WidgetWorker.Parameter> getParameterList() { > >>>> - return this.parameterList; > >>>> + public Map<String, String> getParameterMap(Map<String, Object> context) { > >>>> + Map<String, String> fullParameterMap = FastMap.newInstance(); > >>>> + > >>>> + /* leaving this here... may want to add it at some point like the hyperlink element: > >>>> + Map<String, String> addlParamMap = this.parametersMapAcsr.get(context); > >>>> + if (addlParamMap != null) { > >>>> + fullParameterMap.putAll(addlParamMap); > >>>> + } > >>>> + */ > >>>> + > >>>> + for (WidgetWorker.Parameter parameter: this.parameterList) { > >>>> + fullParameterMap.put(parameter.getName(), parameter.getValue(context)); > >>>> + } > >>>> + > >>>> + return fullParameterMap; > >>>> } > >>>> > >>>> public void setText(String val) { > >>>> > >>>> Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/MacroTreeRenderer.java > >>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/MacroTreeRenderer.java?rev=938816&r1=938815&r2=938816&view=diff > >>>> ============================================================================== > >>>> --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/MacroTreeRenderer.java (original) > >>>> +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/MacroTreeRenderer.java Wed Apr 28 08:33:37 2010 > >>>> @@ -267,7 +267,7 @@ public class MacroTreeRenderer implement > >>>> HttpServletRequest request = (HttpServletRequest) context.get("request"); > >>>> > >>>> if (UtilValidate.isNotEmpty(target)) { > >>>> - WidgetWorker.buildHyperlinkUrl(linkUrl, target, link.getUrlMode(), link.getParameterList(), link.getPrefix(context), > >>>> + WidgetWorker.buildHyperlinkUrl(linkUrl, target, link.getUrlMode(), link.getParameterMap(context), link.getPrefix(context), > >>>> link.getFullPath(), link.getSecure(), link.getEncode(), request, response, context); > >>>> } > >>>> > >>>> > >>>> Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/ModelTree.java > >>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/ModelTree.java?rev=938816&r1=938815&r2=938816&view=diff > >>>> ============================================================================== > >>>> --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/ModelTree.java (original) > >>>> +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/ModelTree.java Wed Apr 28 08:33:37 2010 > >>>> @@ -930,8 +930,21 @@ public class ModelTree extends ModelWidg > >>>> return this.linkType; > >>>> } > >>>> > >>>> - public List<WidgetWorker.Parameter> getParameterList() { > >>>> - return this.parameterList; > >>>> + public Map<String, String> getParameterMap(Map<String, Object> context) { > >>>> + Map<String, String> fullParameterMap = FastMap.newInstance(); > >>>> + > >>>> + /* leaving this here... may want to add it at some point like the hyperlink element: > >>>> + Map<String, String> addlParamMap = this.parametersMapAcsr.get(context); > >>>> + if (addlParamMap != null) { > >>>> + fullParameterMap.putAll(addlParamMap); > >>>> + } > >>>> + */ > >>>> + > >>>> + for (WidgetWorker.Parameter parameter: this.parameterList) { > >>>> + fullParameterMap.put(parameter.getName(), parameter.getValue(context)); > >>>> + } > >>>> + > >>>> + return fullParameterMap; > >>>> } > >>>> > >>>> public void setText(String val) { > >>>> > >>>> > >>> -- > >>> Ofbiz on twitter: http://twitter.com/apache_ofbiz > >>> Myself on twitter: http://twitter.com/hansbak > >>> Antwebsystems.com: Quality services for competitive rates. > >>> > >> > > -- > > Ofbiz on twitter: http://twitter.com/apache_ofbiz > > Myself on twitter: http://twitter.com/hansbak > > Antwebsystems.com: Quality services for competitive rates. > > > Ofbiz on twitter: http://twitter.com/apache_ofbiz Myself on twitter: http://twitter.com/hansbak Antwebsystems.com: Quality services for competitive rates. |
Le 02/05/2010 10:11, Hans Bakker a écrit :
> Hi David, > 1. i select myportal -> the main page is shown -> is fine > 2. i select 'mycomms' within myportal -> expecting mycomms, it is > showing 'main' -> not fine! > 3. if i select 'profile' -> expecting profile but showing 'main' -> not > fine! > 4. if i select next option......etc etc > > Regards, > Hans > > Hans, here is a quick and dirty fix for the portals menus : Index: framework/widget/src/org/ofbiz/widget/menu/ModelMenuItem.java =================================================================== --- framework/widget/src/org/ofbiz/widget/menu/ModelMenuItem.java (revision 940324) +++ framework/widget/src/org/ofbiz/widget/menu/ModelMenuItem.java (working copy) @@ -293,6 +293,8 @@ Map<String, String> linkParams = localItem.link.getParameterMap(context); linkParams.put("portalPageId", portalPage.getString("portalPageId")); linkParams.put("parentPortalPageId", parentPortalPageId); + localItem.link.parameterList.add(new WidgetWorker.Parameter("portalPageId", portalPage.getString("portalPageId"), false)); + localItem.link.parameterList.add(new WidgetWorker.Parameter("parentPortalPageId", parentPortalPageId, false)); if (link != null) { localItem.link.setTarget(link.targetExdr.getOriginal()); linkParams.putAll(link.getParameterMap(context)); Cheers, -- Erwan de FERRIERES www.nereide.biz |
Erwan, If this works you should go ahead and commit it. It looks like this code is kind of a hack anyway, so I wouldn't worry about a hack on a hack (in other words, it doesn't look any quicker or dirtier than the existing code there, so that shouldn't stop you from committing it). Thanks for looking into this. -David On May 4, 2010, at 8:03 AM, Erwan de FERRIERES wrote: > Le 02/05/2010 10:11, Hans Bakker a écrit : >> Hi David, >> 1. i select myportal -> the main page is shown -> is fine >> 2. i select 'mycomms' within myportal -> expecting mycomms, it is >> showing 'main' -> not fine! >> 3. if i select 'profile' -> expecting profile but showing 'main' -> not >> fine! >> 4. if i select next option......etc etc >> >> Regards, >> Hans >> >> > > Hans, > > here is a quick and dirty fix for the portals menus : > > Index: framework/widget/src/org/ofbiz/widget/menu/ModelMenuItem.java > =================================================================== > --- framework/widget/src/org/ofbiz/widget/menu/ModelMenuItem.java (revision 940324) > +++ framework/widget/src/org/ofbiz/widget/menu/ModelMenuItem.java (working copy) > @@ -293,6 +293,8 @@ > Map<String, String> linkParams = localItem.link.getParameterMap(context); > linkParams.put("portalPageId", portalPage.getString("portalPageId")); > linkParams.put("parentPortalPageId", parentPortalPageId); > + localItem.link.parameterList.add(new WidgetWorker.Parameter("portalPageId", portalPage.getString("portalPageId"), false)); > + localItem.link.parameterList.add(new WidgetWorker.Parameter("parentPortalPageId", parentPortalPageId, false)); > if (link != null) { > localItem.link.setTarget(link.targetExdr.getOriginal()); > linkParams.putAll(link.getParameterMap(context)); > > > Cheers, > > -- > Erwan de FERRIERES > www.nereide.biz |
Le 04/05/2010 18:36, David E Jones a écrit :
> > Erwan, > > If this works you should go ahead and commit it. It looks like this code is kind of a hack anyway, so I wouldn't worry about a hack on a hack (in other words, it doesn't look any quicker or dirtier than the existing code there, so that shouldn't stop you from committing it). > > Thanks for looking into this. > Done at r941007, with an improved patch, but still not the best solution. Cheers, -- Erwan de FERRIERES www.nereide.biz |
In reply to this post by Erwan de FERRIERES
Hi Erwan, thanks for your help.
Regards, Hans On Tue, 2010-05-04 at 16:03 +0200, Erwan de FERRIERES wrote: > Le 02/05/2010 10:11, Hans Bakker a écrit : > > Hi David, > > 1. i select myportal -> the main page is shown -> is fine > > 2. i select 'mycomms' within myportal -> expecting mycomms, it is > > showing 'main' -> not fine! > > 3. if i select 'profile' -> expecting profile but showing 'main' -> not > > fine! > > 4. if i select next option......etc etc > > > > Regards, > > Hans > > > > > > Hans, > > here is a quick and dirty fix for the portals menus : > > Index: framework/widget/src/org/ofbiz/widget/menu/ModelMenuItem.java > =================================================================== > --- framework/widget/src/org/ofbiz/widget/menu/ModelMenuItem.java > (revision 940324) > +++ framework/widget/src/org/ofbiz/widget/menu/ModelMenuItem.java > (working copy) > @@ -293,6 +293,8 @@ > Map<String, String> linkParams = > localItem.link.getParameterMap(context); > linkParams.put("portalPageId", > portalPage.getString("portalPageId")); > linkParams.put("parentPortalPageId", > parentPortalPageId); > + localItem.link.parameterList.add(new > WidgetWorker.Parameter("portalPageId", > portalPage.getString("portalPageId"), false)); > + localItem.link.parameterList.add(new > WidgetWorker.Parameter("parentPortalPageId", parentPortalPageId, false)); > if (link != null) { > > localItem.link.setTarget(link.targetExdr.getOriginal()); > > linkParams.putAll(link.getParameterMap(context)); > > > Cheers, > -- http://www.antwebsystems.com : Quality OFBiz support for competitive rates.... |
Free forum by Nabble | Edit this page |