Author: jacopoc
Date: Tue Oct 9 03:17:22 2007 New Revision: 583091 URL: http://svn.apache.org/viewvc?rev=583091&view=rev Log: Added ability to specify an event/action pairs on an hyperlink field. Added escape code for input text fields. Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/WidgetWorker.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java 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=583091&r1=583090&r2=583091&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/WidgetWorker.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/WidgetWorker.java Tue Oct 9 03:17:22 2007 @@ -74,7 +74,7 @@ buffer.append(location); } - public static void makeHyperlinkString(StringBuffer buffer, String linkStyle, String targetType, String target, String description, HttpServletRequest request, HttpServletResponse response, Map context, String targetWindow) { + public static void makeHyperlinkString(StringBuffer buffer, String linkStyle, String targetType, String target, String description, HttpServletRequest request, HttpServletResponse response, Map context, String targetWindow, String event, String action) { if (UtilValidate.isNotEmpty(description)) { buffer.append("<a"); @@ -96,6 +96,13 @@ buffer.append("\""); } + if (UtilValidate.isNotEmpty(event) && UtilValidate.isNotEmpty(action)) { + buffer.append(" "); + buffer.append(event); + buffer.append("=\""); + buffer.append(action); + buffer.append('"'); + } buffer.append('>'); 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=583091&r1=583090&r2=583091&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 Tue Oct 9 03:17:22 2007 @@ -63,6 +63,7 @@ import org.ofbiz.widget.form.ModelFormField.TextFindField; import org.ofbiz.widget.form.ModelFormField.TextareaField; +import org.apache.commons.lang.StringEscapeUtils; /** * Widget Library - HTML Form Renderer implementation @@ -191,7 +192,9 @@ hyperlinkField.getTargetType(), hyperlinkField.getTarget(context), hyperlinkField.getDescription(context), - hyperlinkField.getTargetWindow(context)); + hyperlinkField.getTargetWindow(context), + modelFormField.getEvent(), + modelFormField.getAction(context)); this.appendTooltip(buffer, context, modelFormField); //this.appendWhitespace(buffer); } @@ -208,13 +211,14 @@ subHyperlink.getTargetType(), subHyperlink.getTarget(context), subHyperlink.getDescription(context), - subHyperlink.getTargetWindow(context)); + subHyperlink.getTargetWindow(context), + null, null); } } - public void makeHyperlinkString(StringBuffer buffer, String linkStyle, String targetType, String target, String description, String targetWindow) { + public void makeHyperlinkString(StringBuffer buffer, String linkStyle, String targetType, String target, String description, String targetWindow, String event, String action) { Map context = null; - WidgetWorker.makeHyperlinkString(buffer, linkStyle, targetType, target, description, this.request, this.response, context, targetWindow); + WidgetWorker.makeHyperlinkString(buffer, linkStyle, targetType, target, description, this.request, this.response, context, targetWindow, event, action); } /* (non-Javadoc) @@ -234,7 +238,7 @@ String value = modelFormField.getEntry(context, textField.getDefaultValue(context)); if (UtilValidate.isNotEmpty(value)) { buffer.append(" value=\""); - buffer.append(UtilFormatOut.encodeXmlValue(value)); + buffer.append(StringEscapeUtils.escapeHtml(value)); buffer.append('"'); } @@ -318,7 +322,7 @@ String value = modelFormField.getEntry(context, textareaField.getDefaultValue(context)); if (UtilValidate.isNotEmpty(value)) { - buffer.append(UtilFormatOut.encodeXmlValue(value)); + buffer.append(StringEscapeUtils.escapeHtml(value)); } buffer.append("</textarea>"); @@ -945,7 +949,7 @@ if (UtilValidate.isNotEmpty(value)) { buffer.append(" value=\""); - buffer.append(value); + buffer.append(StringEscapeUtils.escapeHtml(value)); buffer.append('"'); } @@ -2102,7 +2106,7 @@ String value = modelFormField.getEntry(context, textField.getDefaultValue(context)); if (UtilValidate.isNotEmpty(value)) { buffer.append(" value=\""); - buffer.append(value); + buffer.append(StringEscapeUtils.escapeHtml(value)); buffer.append('"'); } @@ -2327,7 +2331,7 @@ if (UtilValidate.isNotEmpty(targetBuffer.toString()) && targetBuffer.toString().toLowerCase().startsWith("javascript:")) { targetType="plain"; } - makeHyperlinkString(buffer, modelFormField.getHeaderLinkStyle(), targetType, targetBuffer.toString(), titleText, null); + makeHyperlinkString(buffer, modelFormField.getHeaderLinkStyle(), targetType, targetBuffer.toString(), titleText, null, null, null); } else if (modelFormField.isRowSubmit()) { if (UtilValidate.isNotEmpty(titleText)) buffer.append(titleText).append("<br/>"); buffer.append("<input type=\"checkbox\" name=\"selectAll\" value=\"Y\" onclick=\"javascript:toggleAll(this, '"); |
Free forum by Nabble | Edit this page |