Modified: ofbiz/branches/20120329_portletWidget/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java?rev=1307601&r1=1307600&r2=1307601&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java (original) +++ ofbiz/branches/20120329_portletWidget/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java Fri Mar 30 20:44:26 2012 @@ -38,7 +38,6 @@ import javax.servlet.http.HttpServletRes import javolution.util.FastList; -import org.apache.commons.lang.StringEscapeUtils; import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.StringUtil; import org.ofbiz.base.util.UtilFormatOut; @@ -54,6 +53,8 @@ import org.ofbiz.webapp.control.RequestH import org.ofbiz.webapp.taglib.ContentUrlTag; import org.ofbiz.widget.ModelWidget; import org.ofbiz.widget.WidgetWorker; +import org.ofbiz.widget.ModelWidget.ShowPortletItemData; +import org.ofbiz.widget.ModelWidget.ShowPortletLinkData; import org.ofbiz.widget.form.ModelFormField.CheckField; import org.ofbiz.widget.form.ModelFormField.ContainerField; import org.ofbiz.widget.form.ModelFormField.DateFindField; @@ -71,6 +72,8 @@ import org.ofbiz.widget.form.ModelFormFi import org.ofbiz.widget.form.ModelFormField.RadioField; import org.ofbiz.widget.form.ModelFormField.RangeFindField; import org.ofbiz.widget.form.ModelFormField.ResetField; +import org.ofbiz.widget.form.ModelFormField.ShowPortletItem; +import org.ofbiz.widget.form.ModelFormField.ShowPortletLink; import org.ofbiz.widget.form.ModelFormField.SubmitField; import org.ofbiz.widget.form.ModelFormField.TextField; import org.ofbiz.widget.form.ModelFormField.TextFindField; @@ -1136,8 +1139,14 @@ public class MacroFormRenderer implement boolean ajaxEnabled = (updateAreas != null || UtilValidate.isNotEmpty(backgroundSubmitRefreshTarget)) && this.javaScriptEnabled; String ajaxUrl = ""; + String returnParams = ""; // #Eam# portletWidget if (ajaxEnabled) { + /* #Bam# portletWidget ajaxUrl = createAjaxParamsFromUpdateAreas(updateAreas, null, context); + */ + returnParams = createReturnParamsFromUpdateAreas(updateAreas, context); + ajaxUrl = createAjaxParamsFromUpdateAreas(updateAreas, null, context, UtilValidate.isNotEmpty(returnParams)); + // #Eam# portletWidget } StringWriter sr = new StringWriter(); sr.append("<@renderSubmitField "); @@ -1173,6 +1182,10 @@ public class MacroFormRenderer implement if (ajaxEnabled) { sr.append(ajaxUrl); } + //#Bam# portletWidget + sr.append("\" returnParams =\""); + sr.append(returnParams); + //#Eam# portletWidget sr.append("\" />"); executeMacro(writer, sr.toString()); this.appendTooltip(writer, context, modelFormField); @@ -2915,6 +2928,12 @@ public class MacroFormRenderer implement * @return Parameter string or empty string if no UpdateArea objects were found */ public String createAjaxParamsFromUpdateAreas(List<ModelForm.UpdateArea> updateAreas, String extraParams, Map<String, ? extends Object> context) { + // #Bam# portletWidget + return createAjaxParamsFromUpdateAreas(updateAreas, extraParams, context, false); + } + + public String createAjaxParamsFromUpdateAreas(List<ModelForm.UpdateArea> updateAreas, String extraParams, Map<String, ? extends Object> context, boolean addReturnParams) { + // #Eam# portletWidget //FIXME copy from HtmlFormRenderer.java if (updateAreas == null) { return ""; @@ -2951,6 +2970,18 @@ public class MacroFormRenderer implement } } } + // #Bam# portletWidget + StringBuilder params = new StringBuilder(); + params.append(ajaxParams); + List<String> addingParams = UtilMisc.toList("portalPageId", "portalPortletId", "portletSeqId", "areaId", "idDescription"); + for (String addingParam : addingParams) { + if (UtilValidate.isNotEmpty(extraParams) && extraParams.contains(addingParam + "=")) { + continue; + } + WidgetWorker.addToParamsIfInContext(params, ctx, addingParam, parameters); + } + ajaxParams = params.toString(); + // #Eam# portletWidget //then add parameters from request. Those parameters could end with an anchor so we must set ajax parameters first if (UtilValidate.isNotEmpty(extraParams)) { if (ajaxParams.length() > 0 && !extraParams.startsWith("&")) { @@ -2961,10 +2992,47 @@ public class MacroFormRenderer implement ajaxUrl += updateArea.getAreaId() + ","; ajaxUrl += this.rh.makeLink(this.request, this.response, UtilHttp.removeQueryStringFromTarget(targetUrl)); ajaxUrl += "," + ajaxParams; + // #Bam# portletWidget + if (addReturnParams) { + if(updateArea.hasRedirParamList()){ + ajaxUrl += ",true"; + } else { + ajaxUrl += ",false"; + } + + } + // #Eam# portletWidget } Locale locale = UtilMisc.ensureLocale(context.get("locale")); return FlexibleStringExpander.expandString(ajaxUrl, context, locale); } + + // #Bam# portletWidget + public String createReturnParamsFromUpdateAreas(List<ModelForm.UpdateArea> updateAreas, Map<String, ? extends Object> context){ + String returnParam = ""; + boolean first = true; + for (ModelForm.UpdateArea updateArea : updateAreas) { + Map<String, Object> ctx = UtilGenerics.checkMap(context); + Map<String, String> redirectParameters = updateArea.getRedirParamList(ctx); + if(UtilValidate.isNotEmpty(redirectParameters)){ + for (String key : redirectParameters.keySet()) { + if(first){ + returnParam += "{'" + key + "' : '" + key + "'"; + first = false; + } + else{ + returnParam += ", '" + key + "' : '" + key + "'"; + } + } + } + } + if (UtilValidate.isNotEmpty(returnParam)) { + returnParam += "}"; + } + return returnParam; + } + // #Eam# portletWidget + /** Extracts parameters from a target URL string, prepares them for an Ajax * JavaScript call. This method is currently set to return a parameter string * suitable for the Prototype.js library. @@ -3137,6 +3205,221 @@ public class MacroFormRenderer implement } } + //#Bam# portletWidget + // same as HtmlFormRenderer except when populate StringWriter sr + public void renderShowPortletLink(Appendable writer, Map<String, Object> context, ShowPortletLink showPortletLink) throws IOException { + ModelFormField modelFormField = showPortletLink.getModelFormField(); + String linkStyle = ""; + //prepare show link properties + String id = ""; + + if (UtilValidate.isNotEmpty(modelFormField.getIdName())) { + id = modelFormField.getIdName(); + } + if (UtilValidate.isNotEmpty(context.get("itemIndex"))) { + id = id + "_" + context.get("itemIndex"); + } + String markSelected = showPortletLink.getMarkSelected(context); + String event = ""; + if (UtilValidate.isNotEmpty(modelFormField.getEvent())) { + event = modelFormField.getEvent(); + } + String action = ""; + if (UtilValidate.isNotEmpty(modelFormField.getAction(context))) { + action = modelFormField.getAction(context); + } + String collapseScreenlet = showPortletLink.getCollapseScreenlet(context); + + String formName = modelFormField.getModelForm().getName(); + List<String> areasList = FastList.newInstance(); + List<String> targetList = FastList.newInstance(); + List<String> paramsList = FastList.newInstance(); + List<String> formList = FastList.newInstance(); + List<String> collapseLis = FastList.newInstance(); + + ShowPortletLinkData splData = WidgetWorker.prepareShowPortletLinkData(showPortletLink, context); + + for(ShowPortletItem showPortletItem : showPortletLink.getShowPortletItems()){ + + ShowPortletItemData spiData = WidgetWorker.prepareShowPortletItemsData(showPortletItem, context); + + if (UtilValidate.isEmpty(spiData.areaId) && + (UtilValidate.isEmpty(spiData.portalPageId) || UtilValidate.isEmpty(spiData.portletId) || UtilValidate.isEmpty(spiData.portletSeqId))) { + Debug.logWarning("The form [" + modelFormField.getModelForm().getFormLocation() + "#" + modelFormField.getModelForm().getName() +"] has a show-portlet field that should define a target-area or must have target-page-id, target-portlet-id and target-seq_id attributes", module); + } + + if (UtilValidate.isNotEmpty(modelFormField.getWidgetStyle())) { + linkStyle = modelFormField.getWidgetStyle(); + } + collapseScreenlet = showPortletItem.getCollapseScreenlet(context); + + //check whether the current form field values should be appended to request parameters or not + List<String> appendFormParams = showPortletItem.getFormsToSerialize(); + areasList.add(spiData.areaId); + targetList.add(spiData.target); + paramsList.add(spiData.params.toString()); + String formParamsString = ""; + if(UtilValidate.isNotEmpty(appendFormParams) && appendFormParams.size() > 0){ + formParamsString = appendFormParams.toString(); + if (formParamsString.startsWith("{")) + formParamsString = formParamsString.replace("{", ""); + if (formParamsString.endsWith("}")) + formParamsString = formParamsString.replace("}", ""); + formParamsString = formParamsString.replace(", ", ","); + } + formList.add(formParamsString); + collapseLis.add(collapseScreenlet); + if(showPortletItem.getRequireConfirmation()) { + event = "onclick"; + action = "return confirm('" + showPortletItem.getConfirmationMessage(context) +"')"; + } + } + if (areasList.size() != targetList.size() + || areasList.size() != paramsList.size()) { + Debug.logWarning("The form Field [" + modelFormField.getModelForm().getFormLocation() + "#" + modelFormField.getModelForm().getName() +"] has define a target and arameters list for each area it is going to refresh", module); + } + StringWriter sr = new StringWriter(); + sr.append("<@rerenderRefreshPortlet "); + sr.append("linkStyle=\""); + sr.append(linkStyle); + sr.append("\" event=\""); + sr.append(event); + sr.append("\" action=\""); + sr.append(action); + sr.append("\" areaId=\""); + sr.append(showPortletLink.listToString(areasList)); + sr.append("\" id=\""); + sr.append(id); + sr.append("\" formName=\""); + sr.append(formName); + sr.append("\" imgSrc=\""); + sr.append(splData.imgSrc); + sr.append("\" title=\""); + sr.append(splData.imgTitle); + + sr.append("\" alternate=\""); + sr.append(splData.alt); + sr.append("\" target=\""); + sr.append(showPortletLink.listToString(targetList)); + sr.append("\" appendFormParams=\""); + sr.append(showPortletLink.listToString(formList)); + sr.append("\" description=\""); + sr.append(splData.description); + sr.append("\" params=\""); + sr.append(showPortletLink.listToString(paramsList)); + sr.append("\" collapse=\""); + sr.append(Boolean.valueOf(collapseScreenlet).toString()); + sr.append("\" markSelected=\""); + sr.append(Boolean.valueOf(markSelected).toString()); + sr.append("\" />"); + executeMacro(writer, sr.toString()); + this.appendTooltip(writer, context, modelFormField); + } + //#Eam# portletWidget + // #Bam# portletWidget + public void makeShowPortletString(Appendable writer, String linkStyle, String targetArea, String target, String targetPortletId, Map<String, String> parameterMap, + String description, String collapse, ModelFormField modelFormField, HttpServletRequest request, HttpServletResponse response, Map<String, Object> context) + throws IOException { + + StringBuilder linkUrl = new StringBuilder(); + + String event = ""; + String action = ""; + String parameterKey = ""; + String parameterValue = ""; + String parameterList = ""; + String parameterForm = ""; + String collapseScreenlet = ""; + //String collapseScreenlet = collapse?"true":""; + + if (UtilValidate.isNotEmpty(modelFormField.getEvent()) && UtilValidate.isNotEmpty(modelFormField.getAction(context))) { + event = modelFormField.getEvent(); + action = modelFormField.getAction(context); + } + + Integer size = Integer.valueOf("0"); + + if( UtilValidate.isNotEmpty(description) && size > 0 && description.length() > size) { + description = description.substring(0, size - 8) + "..." + description.substring(description.length() - 5); + } + + if (UtilValidate.isNotEmpty(collapse)) { + collapseScreenlet = collapse; + } + + /* manage parameters-form and parameter */ + + Appendable localWriter = new StringWriter(); + boolean first = true; + if (UtilValidate.isNotEmpty(parameterMap)) { + //parameterForm = modelFormField.getModelForm().getName(); + for (Map.Entry<String, String> parameter: parameterMap.entrySet()) { + if (parameter.getValue() instanceof String) { + parameterKey = parameter.getKey(); + parameterValue = parameter.getValue(); + if(first){ + // targetPortletId is required for show-portlet + parameterList += "{'portalPortletId':'" + targetPortletId + "', '" + parameterKey + "':'" + parameterValue + "'"; + first = false; + } + else{ + parameterList += ", '" + parameterKey + "':'" + parameterValue + "'"; + } + } else { + Object parameterObject = parameter.getValue(); + + // skip null values + if (parameterObject == null){ + parameterForm = modelFormField.getModelForm().getName(); + } + else if (parameterObject instanceof String[]) { + // it's probably a String[], just get the first value + String[] parameterArray = (String[]) parameterObject; + parameterValue = parameterArray[0]; + Debug.logInfo("Found String array value for parameter [" + parameter.getKey() + "], using first value: " + parameterValue, module); + } else { + // not a String, and not a String[], just use toString + parameterValue = parameterObject.toString(); + } + } + } + if(!first){ // this means that we reached the end and the list wasn't void since we read a first element + parameterList += "}"; + } + } else { + linkUrl.append(localWriter.toString()); + } + + StringWriter sr = new StringWriter(); + sr.append("<@makeShowPortletString "); + sr.append("linkStyle=\""); + sr.append(linkStyle==null?"":linkStyle); + sr.append("\" id=\""); + sr.append(modelFormField.getIdName()); + sr.append("\" event=\""); + sr.append(event); + sr.append("\" action=\""); + sr.append(action); + sr.append("\" target=\""); + sr.append(target); + sr.append("\" targetArea=\""); + sr.append(targetArea); + sr.append("\" targetPortletId=\""); + sr.append(targetPortletId); + sr.append("\" description=\""); + sr.append(description); + sr.append("\" parameterForm=\""); + sr.append(parameterForm); + sr.append("\" parameterList=\""); + sr.append(parameterList); + sr.append("\" collapse=\""); + sr.append(collapseScreenlet); + + sr.append("\" />"); + executeMacro(writer, sr.toString()); + } + // #Eam# portletWidget + public void makeHiddenFormLinkAnchor(Appendable writer, String linkStyle, String description, String confirmation , ModelFormField modelFormField, HttpServletRequest request, HttpServletResponse response, Map<String, Object> context) throws IOException { if (UtilValidate.isNotEmpty(description) || UtilValidate.isNotEmpty(request.getAttribute("image"))) { String hiddenFormName = WidgetWorker.makeLinkHiddenFormName(context, modelFormField); Modified: ofbiz/branches/20120329_portletWidget/framework/widget/src/org/ofbiz/widget/form/ModelForm.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/widget/src/org/ofbiz/widget/form/ModelForm.java?rev=1307601&r1=1307600&r2=1307601&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/framework/widget/src/org/ofbiz/widget/form/ModelForm.java (original) +++ ofbiz/branches/20120329_portletWidget/framework/widget/src/org/ofbiz/widget/form/ModelForm.java Fri Mar 30 20:44:26 2012 @@ -1214,7 +1214,11 @@ public class ModelForm extends ModelWidg continue; } + /* #Bam# portletWidget if (fieldInfo.getFieldType() != ModelFormField.FieldInfo.DISPLAY && fieldInfo.getFieldType() != ModelFormField.FieldInfo.DISPLAY_ENTITY && fieldInfo.getFieldType() != ModelFormField.FieldInfo.HYPERLINK) { + */ + if (fieldInfo.getFieldType() != ModelFormField.FieldInfo.DISPLAY && fieldInfo.getFieldType() != ModelFormField.FieldInfo.DISPLAY_ENTITY && fieldInfo.getFieldType() != ModelFormField.FieldInfo.HYPERLINK && fieldInfo.getFieldType() != ModelFormField.FieldInfo.SHOW_PORTLET) { + // #Eam# portletWidget inputFieldFound = true; continue; } @@ -1238,7 +1242,11 @@ public class ModelForm extends ModelWidg } // skip all of the display/hyperlink fields + /* #Bam# portletWidget if (fieldInfo.getFieldType() == ModelFormField.FieldInfo.DISPLAY || fieldInfo.getFieldType() == ModelFormField.FieldInfo.DISPLAY_ENTITY || fieldInfo.getFieldType() == ModelFormField.FieldInfo.HYPERLINK) { + */ + if (fieldInfo.getFieldType() == ModelFormField.FieldInfo.DISPLAY || fieldInfo.getFieldType() == ModelFormField.FieldInfo.DISPLAY_ENTITY || fieldInfo.getFieldType() == ModelFormField.FieldInfo.HYPERLINK || fieldInfo.getFieldType() == ModelFormField.FieldInfo.SHOW_PORTLET) { + // #Eam# portletWidget continue; } @@ -1568,7 +1576,11 @@ public class ModelForm extends ModelWidg continue; } + /* #Bam# portletWidget if (fieldInfo.getFieldType() != ModelFormField.FieldInfo.DISPLAY && fieldInfo.getFieldType() != ModelFormField.FieldInfo.DISPLAY_ENTITY && fieldInfo.getFieldType() != ModelFormField.FieldInfo.HYPERLINK) { + */ + if (fieldInfo.getFieldType() != ModelFormField.FieldInfo.DISPLAY && fieldInfo.getFieldType() != ModelFormField.FieldInfo.DISPLAY_ENTITY && fieldInfo.getFieldType() != ModelFormField.FieldInfo.HYPERLINK && fieldInfo.getFieldType() != ModelFormField.FieldInfo.SHOW_PORTLET) { + // #Eam# portletWidget // okay, now do the form cell break; } @@ -1592,7 +1604,11 @@ public class ModelForm extends ModelWidg } // skip all of the display/hyperlink fields + /* #Bam# portletWidget if (fieldInfo.getFieldType() == ModelFormField.FieldInfo.DISPLAY || fieldInfo.getFieldType() == ModelFormField.FieldInfo.DISPLAY_ENTITY || fieldInfo.getFieldType() == ModelFormField.FieldInfo.HYPERLINK) { + */ + if (fieldInfo.getFieldType() == ModelFormField.FieldInfo.DISPLAY || fieldInfo.getFieldType() == ModelFormField.FieldInfo.DISPLAY_ENTITY || fieldInfo.getFieldType() == ModelFormField.FieldInfo.HYPERLINK || fieldInfo.getFieldType() == ModelFormField.FieldInfo.SHOW_PORTLET) { + // #Bam# portletWidget continue; } @@ -1614,7 +1630,11 @@ public class ModelForm extends ModelWidg } // skip all non-display and non-hyperlink fields + /* #Bam# portletWidget if (fieldInfo.getFieldType() != ModelFormField.FieldInfo.DISPLAY && fieldInfo.getFieldType() != ModelFormField.FieldInfo.DISPLAY_ENTITY && fieldInfo.getFieldType() != ModelFormField.FieldInfo.HYPERLINK) { + */ + if (fieldInfo.getFieldType() != ModelFormField.FieldInfo.DISPLAY && fieldInfo.getFieldType() != ModelFormField.FieldInfo.DISPLAY_ENTITY && fieldInfo.getFieldType() != ModelFormField.FieldInfo.HYPERLINK && fieldInfo.getFieldType() != ModelFormField.FieldInfo.SHOW_PORTLET) { + // #Eam# portletWidget continue; } @@ -2808,6 +2828,7 @@ public class ModelForm extends ModelWidg protected String areaId; protected String areaTarget; List<WidgetWorker.Parameter> parameterList =FastList.newInstance(); + List<WidgetWorker.Parameter> redirParameterList =FastList.newInstance(); // #Eam# portletWidget /** XML constructor. * @param updateAreaElement The <code><on-xxx-update-area></code> * XML element. @@ -2820,6 +2841,12 @@ public class ModelForm extends ModelWidg for (Element parameterElement: parameterElementList) { this.parameterList.add(new WidgetWorker.Parameter(parameterElement)); } + // #Bam# portletWidget + parameterElementList = UtilXml.childElementList(updateAreaElement, "redirect-parameter"); + for (Element parameterElement: parameterElementList) { + this.redirParameterList.add(new WidgetWorker.Parameter(parameterElement)); + } + // #Eam# portletWidget } /** String constructor. * @param areaId The id of the widget element to be updated @@ -2850,6 +2877,25 @@ public class ModelForm extends ModelWidg public Map<String, String> getParameterMap(Map<String, Object> context) { Map<String, String> fullParameterMap = FastMap.newInstance(); for (WidgetWorker.Parameter parameter: this.parameterList) { + // #Bam# portletWidget : add property sendIfEmpty in parameters + String paramValue = parameter.getValue(context); + if (UtilValidate.isNotEmpty(paramValue) || parameter.sendIfEmpty(context)){ + fullParameterMap.put(parameter.getName(), parameter.getValue(context)); + } + // #Eam# portletWidget + } + + return fullParameterMap; + } + // #Bam# portletWidget + public boolean hasRedirParamList() { + return UtilValidate.isNotEmpty(this.redirParameterList); + } + + public Map<String, String> getRedirParamList(Map<String, Object> context) { + Map<String, String> fullParameterMap = FastMap.newInstance(); + for (WidgetWorker.Parameter parameter: this.redirParameterList) { + // #Eam# portletWidget fullParameterMap.put(parameter.getName(), parameter.getValue(context)); } Modified: ofbiz/branches/20120329_portletWidget/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java?rev=1307601&r1=1307600&r2=1307601&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java (original) +++ ofbiz/branches/20120329_portletWidget/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java Fri Mar 30 20:44:26 2012 @@ -48,6 +48,7 @@ import org.ofbiz.base.util.UtilFormatOut import org.ofbiz.base.util.UtilGenerics; import org.ofbiz.base.util.UtilMisc; import org.ofbiz.base.util.UtilProperties; +import org.ofbiz.base.util.UtilURL;// #Eam# portletWidget import org.ofbiz.base.util.UtilValidate; import org.ofbiz.base.util.UtilXml; import org.ofbiz.base.util.collections.FlexibleMapAccessor; @@ -67,6 +68,7 @@ import org.ofbiz.service.DispatchContext import org.ofbiz.service.GenericServiceException; import org.ofbiz.service.ModelParam; import org.ofbiz.service.ModelService; +import org.ofbiz.widget.ModelWidget; // #Eam# portletWidget import org.ofbiz.widget.WidgetWorker; import org.ofbiz.widget.form.ModelForm.UpdateArea; import org.w3c.dom.Element; @@ -116,6 +118,7 @@ public class ModelFormField { protected Boolean sortField = null; protected String headerLink; protected String headerLinkStyle; + protected ShowPortletLink showPortletLink = null;// #Eam# portletWidget /** On Change Event areas to be updated. */ protected List<UpdateArea> onChangeUpdateAreas; @@ -204,6 +207,15 @@ public class ModelFormField { else if ("image".equals(subElementName)) this.fieldInfo = new ImageField(subElement, this); else if ("container".equals(subElementName)) this.fieldInfo = new ContainerField(subElement, this); else if ("on-field-event-update-area".equals(subElementName)) addOnEventUpdateArea(new UpdateArea(subElement)); + // #Bam# portletWidget + else if ("show-portlet".equals(subElementName)) { + if (this.showPortletLink == null) { + this.showPortletLink = new ShowPortletLink(subElement, this); + this.fieldInfo = this.showPortletLink; + } + addShowPortletTolink(subElement, this); + } + // #Eam# portletWidget else throw new IllegalArgumentException("The field sub-element with name " + subElementName + " is not supported"); } } @@ -215,6 +227,13 @@ public class ModelFormField { else if ("click".equals(updateArea.getEventType())) addOnClickUpdateArea(updateArea); } + // #Bam# portletWidget + public void addShowPortletTolink(Element element, ModelFormField modelFormField) { + ShowPortletLink showLink = modelFormField.getShowPortletLink(); + showLink.addShowPorletTolink(element); + } + // #Eam# portletWidget + protected void addOnChangeUpdateArea(UpdateArea updateArea) { if (onChangeUpdateAreas == null) onChangeUpdateAreas = FastList.newInstance(); onChangeUpdateAreas.add(updateArea); @@ -257,6 +276,11 @@ public class ModelFormField { if (overrideFormField.onChangeUpdateAreas != null) this.onChangeUpdateAreas = overrideFormField.onChangeUpdateAreas; if (overrideFormField.onClickUpdateAreas != null) this.onClickUpdateAreas = overrideFormField.onClickUpdateAreas; this.encodeOutput = overrideFormField.encodeOutput; + // #Bam# portletWidget + if (overrideFormField.showPortletLink != null) { + this.showPortletLink = overrideFormField.showPortletLink; + } + // #Eam# portletWidget } public boolean induceFieldInfo(String defaultFieldType) { @@ -531,6 +555,12 @@ public class ModelFormField { return onClickUpdateAreas; } + // #Bam# portletWidget + public ShowPortletLink getShowPortletLink() { + return showPortletLink; + } + // #Eam# portletWidget + public FieldInfo getFieldInfo() { return fieldInfo; } @@ -1277,6 +1307,7 @@ public class ModelFormField { public static final int PASSWORD = 18; public static final int IMAGE = 19; public static final int DISPLAY_ENTITY = 20; + public static final int SHOW_PORTLET = 22; // #Eam# portletWidget // the numbering here represents the priority of the source; //when setting a new fieldInfo on a modelFormField it will only set @@ -1310,6 +1341,7 @@ public class ModelFormField { fieldTypeByName.put("image", Integer.valueOf(19)); fieldTypeByName.put("display-entity", Integer.valueOf(20)); fieldTypeByName.put("container", Integer.valueOf(21)); + fieldTypeByName.put("show-portlet", Integer.valueOf(22));// #Eam# portletWidget } protected int fieldType; @@ -2389,6 +2421,367 @@ public class ModelFormField { } } + // #Bam# portletWidget + public static class ShowPortletLink extends FieldInfo implements ModelWidget.ShowPortletLink { + + protected FlexibleStringExpander description; + protected FlexibleStringExpander imageTitle; + protected FlexibleStringExpander alternate; + protected FlexibleStringExpander collapseScreenlet; + protected FlexibleStringExpander markSelected; + protected FlexibleStringExpander image; + protected String size; + protected List<ShowPortletItem> showPortletItems = FastList.newInstance(); + + public String listToString(List<String> list) { + String result = ""; + for(String s : list) { + if (UtilValidate.isNotEmpty(s)) { + result = result.concat(s).concat(";"); + } + } + if (result.endsWith(";")) + return result.substring(0, result.length()-1); + return result; + } + + public ShowPortletLink(Element element, ModelFormField modelFormField) { + super(element, modelFormField); + } + + public void renderFieldString(Appendable writer, Map<String, Object> context, FormStringRenderer formStringRenderer) throws IOException { + formStringRenderer.renderShowPortletLink(writer, context, this); + } + + public void addShowPorletTolink(Element element) { + showPortletItems.add(new ShowPortletItem(element, this)); + } + + /** + * @param string + */ + public void setDescription(String string) { + if(UtilValidate.isNotEmpty(string)) { + this.description = FlexibleStringExpander.getInstance(string); + } + } + + /** + * @param string + */ + public void setImageTitle(String string) { + if(UtilValidate.isNotEmpty(string)) { + this.imageTitle = FlexibleStringExpander.getInstance(string); + } + } + + public List<ShowPortletItem> getShowPortletItems(){ + return showPortletItems; + } + + /** + * @param string + */ + public void setAlternate(String string) { + if(UtilValidate.isNotEmpty(string)) { + this.alternate = FlexibleStringExpander.getInstance(string); + } + } + + public String getDescription(Map<String, Object> context) { + if (UtilValidate.isNotEmpty(description)) { + return this.description.expandString(context); + } + return ""; + } + + public String getAlternate(Map<String, Object> context) { + if (UtilValidate.isNotEmpty(alternate)) { + return this.alternate.expandString(context); + } + return ""; + } + + public String getImageTitle(Map<String, Object> context) { + if (UtilValidate.isNotEmpty(imageTitle)) { + return this.imageTitle.expandString(context); + } + return ""; + } + public String getImage(Map<String, Object> context) { + if (UtilValidate.isNotEmpty(imageTitle)) { + return this.image.expandString(context); + } + return ""; + } + + public String getSize() { + return this.size; + } + + public String setSize(String size) { + return this.size = size; + } + + public void setCollapseScreenlet(String collapseScreenlet) { + this.collapseScreenlet = FlexibleStringExpander.getInstance(collapseScreenlet); + } + + public void setMarkSelected(String markSelected) { + this.markSelected = FlexibleStringExpander.getInstance(markSelected); + } + + public String getCollapseScreenlet(Map<String, Object> context) { + String areaIdValue = ""; + if (UtilValidate.isNotEmpty(collapseScreenlet)) { + areaIdValue = this.collapseScreenlet.expandString(context); + } + return areaIdValue; + } + + public String getMarkSelected(Map<String, Object> context) { + String value = ""; + if (UtilValidate.isNotEmpty(markSelected)) { + value = this.markSelected.expandString(context); + } + return value; + } + } + + public static class ShowPortletItem implements ModelWidget.ShowPortletItem { + + protected FlexibleStringExpander areaId; + protected FlexibleStringExpander target; + protected ShowPortletLink showPortletLink; + protected FlexibleStringExpander portletId; + protected boolean requireConfirmation; + protected FlexibleStringExpander confirmationMessage; + protected FlexibleStringExpander portalPageId; + protected FlexibleStringExpander portletSeqId; + protected List<String> formsToSerialize = FastList.newInstance(); + protected List<WidgetWorker.Parameter> parameterList = FastList.newInstance(); + + public ShowPortletItem(Element element, ShowPortletLink showPortletLink) { + this.showPortletLink = showPortletLink; + this.setConfirmationMessage(element.getAttribute("confirmation-message")); + this.setRequireConfirmation(("true".equals(element.getAttribute("request-confirmation")))); + this.setAreaId(element.getAttribute("area-id")); + this.setPortletId(element.getAttribute("portlet-id")); + this.setPortalPageId(element.getAttribute("portal-page-id")); + this.setPortletSeqId(element.getAttribute("portlet-seq-id")); + this.setDescription(element.getAttribute("description")); + this.setAlternate(element.getAttribute("alternate")); + this.setImageTitle(element.getAttribute("image-title")); + this.setTarget(element.getAttribute("target")); + this.setImage (element.getAttribute("image-location")); + this.setSize(element.getAttribute("size")); + this.setCollapseScreenlet(element.getAttribute("collapse-screenlet")); + this.setMarkSelected(element.getAttribute("mark-selected")); + + List<? extends Element> parameterElementList = UtilXml.childElementList(element, "parameter"); + for (Element parameterElement: parameterElementList) { + this.parameterList.add(new WidgetWorker.Parameter(parameterElement)); + } + List<? extends Element> parametersFroms = UtilXml.childElementList(element, "parameters-form"); + for (Element parameterForm: parametersFroms) { + String formName = parameterForm.getAttribute("form-name"); + if (UtilValidate.isEmpty(formName)) { + formName = this.getModelFormField().getModelForm().getName(); + } + if (!formsToSerialize.contains(formName)) { + formsToSerialize.add(formName); + } + } + } + + public ModelFormField getModelFormField() { + return showPortletLink.getModelFormField(); + } + +// public void renderFieldString(Appendable writer, Map<String, Object> context, FormStringRenderer formStringRenderer) throws IOException { +// formStringRenderer.renderShowPortletLink(writer, context, this); +// } + + public List<String> getFormsToSerialize() { + return this.formsToSerialize; + } + + public String getDescription(Map<String, Object> context) { + return showPortletLink.getDescription(context); + } + + public String getPortalPageId(Map<String, Object> context) { + if (UtilValidate.isNotEmpty(portalPageId)) { + return this.portalPageId.expandString(context); + } + return ""; + } + + public String getPortletId(Map<String, Object> context) { + if (UtilValidate.isNotEmpty(portletId)) { + return this.portletId.expandString(context); + } + return ""; + } + + public String getPortletSeqId(Map<String, Object> context) { + if (UtilValidate.isNotEmpty(portletSeqId)) { + return this.portletSeqId.expandString(context); + } + return ""; + } + + public String getConfirmationMessage(Map<String, Object> context) { + String areaIdValue = ""; + if (UtilValidate.isNotEmpty(confirmationMessage)) { + areaIdValue = this.confirmationMessage.expandString(context); + } + return areaIdValue; + } + + public void setRequireConfirmation(boolean reqConfirm) { + requireConfirmation = reqConfirm; + } + + public boolean getRequireConfirmation() { + return requireConfirmation; + } + + public String getAreaId(Map<String, Object> context) { + String areaIdValue = ""; + if (UtilValidate.isNotEmpty(areaId)) { + areaIdValue = this.areaId.expandString(context); + } + return areaIdValue; + } + public String getCollapseScreenlet(Map<String, Object> context) { + return showPortletLink.getCollapseScreenlet(context); + } + + public String getAlternate(Map<String, Object> context) { + return showPortletLink.getAlternate(context); + } + + public String getImageTitle(Map<String, Object> context) { + return showPortletLink.getImageTitle(context); + } + + public String getTarget(Map<String, Object> context) { + if (UtilValidate.isNotEmpty(target)) { + return this.target.expandString(context); + } + return ""; + } + + public Map<String, String> getParameterMap(Map<String, Object> context) { + Map<String, String> fullParameterMap = FastMap.newInstance(); + for (WidgetWorker.Parameter parameter: this.parameterList) { + String paramValue = parameter.getValue(context); + if (UtilValidate.isNotEmpty(paramValue) || parameter.sendIfEmpty(context)){ + if ("idDescription".equals(parameter.getName())) { + if (UtilValidate.isNotEmpty(paramValue)) { + paramValue = UtilURL.removeBadCharForUrl(paramValue); + fullParameterMap.put(parameter.getName(), paramValue); + } + } + else { + fullParameterMap.put(parameter.getName(), paramValue); + } + } + } + return fullParameterMap; + } + + public String getImage(Map<String, Object> context) { + if (UtilValidate.isNotEmpty(target)) { + return this.showPortletLink.image.expandString(context); + } + return ""; + } + + public void setImage(String image) { + showPortletLink.image = FlexibleStringExpander.getInstance(image); + } + + public String getSize() { + return showPortletLink.size; + } + + public void setSize(String size) { + showPortletLink.setSize(size); + } + + /** + * @param string + */ + public void setAreaId(String areaId) { + this.areaId = FlexibleStringExpander.getInstance(areaId); + } + + /** + * @param string + */ + public void setPortletId(String portletId) { + this.portletId = FlexibleStringExpander.getInstance(portletId); + } + + /** + * @param string + */ + public void setPortletSeqId(String portletSeqId) { + this.portletSeqId = FlexibleStringExpander.getInstance(portletSeqId); + } + + public void setCollapseScreenlet(String collapseScreenlet) { + if(UtilValidate.isEmpty(showPortletLink.collapseScreenlet) && UtilValidate.isNotEmpty(collapseScreenlet)) + showPortletLink.setCollapseScreenlet(collapseScreenlet); + } + + public void setMarkSelected(String markSelected) { + if(UtilValidate.isEmpty(showPortletLink.markSelected) && UtilValidate.isNotEmpty(markSelected)) + showPortletLink.setMarkSelected(markSelected); + } + + /** + * @param string + */ + public void setPortalPageId(String portalPageId) { + this.portalPageId = FlexibleStringExpander.getInstance(portalPageId); + } + + /** + * @param string + */ + public void setDescription(String string) { + showPortletLink.setDescription(string); + } + + /** + * @param string + */ + public void setImageTitle(String string) { + showPortletLink.setImageTitle(string); + } + + /** + * @param string + */ + public void setAlternate(String string) { + showPortletLink.setAlternate(string); + } + + /** + * @param string + */ + public void setTarget(String string) { + this.target = FlexibleStringExpander.getInstance(string); + } + public void setConfirmationMessage(String string) { + this.confirmationMessage = FlexibleStringExpander.getInstance(string); + } + } + // #Eam# portletWidget + public static class SubHyperlink { protected FlexibleStringExpander useWhen; protected String linkType; Modified: ofbiz/branches/20120329_portletWidget/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java?rev=1307601&r1=1307600&r2=1307601&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java (original) +++ ofbiz/branches/20120329_portletWidget/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java Fri Mar 30 20:44:26 2012 @@ -47,6 +47,8 @@ import org.ofbiz.webapp.control.RequestH import org.ofbiz.webapp.taglib.ContentUrlTag; import org.ofbiz.widget.ModelWidget; import org.ofbiz.widget.WidgetWorker; +import org.ofbiz.widget.ModelWidget.ShowPortletItemData; //#Eam# portletWidget +import org.ofbiz.widget.ModelWidget.ShowPortletLinkData; //#Eam# portletWidget import org.ofbiz.widget.form.FormStringRenderer; import org.ofbiz.widget.form.ModelForm; import org.ofbiz.widget.form.ModelFormField; @@ -67,6 +69,8 @@ import org.ofbiz.widget.form.ModelFormFi import org.ofbiz.widget.form.ModelFormField.RadioField; import org.ofbiz.widget.form.ModelFormField.RangeFindField; import org.ofbiz.widget.form.ModelFormField.ResetField; +import org.ofbiz.widget.form.ModelFormField.ShowPortletItem; //#Eam# portletWidget +import org.ofbiz.widget.form.ModelFormField.ShowPortletLink; //#Eam# portletWidget import org.ofbiz.widget.form.ModelFormField.SubmitField; import org.ofbiz.widget.form.ModelFormField.TextField; import org.ofbiz.widget.form.ModelFormField.TextFindField; @@ -1605,7 +1609,7 @@ public class HtmlFormRenderer extends Ht public void renderFormatItemRowOpen(Appendable writer, Map<String, Object> context, ModelForm modelForm) throws IOException { Integer itemIndex = (Integer)context.get("itemIndex"); - writer.append(" <tr"); + writer.append(" <tr id=\"" + modelForm.getName() + "_row_" +itemIndex+"\""); //#Eam# portletWidget : add id if (itemIndex!=null) { String altRowStyles = modelForm.getStyleAltRowStyle(context); @@ -2988,4 +2992,119 @@ public class HtmlFormRenderer extends Ht } return ajaxUrl.toString(); } + //#Bam# portletWidget + // same as MacroFormRenderer except when populate writer + public void renderShowPortletLink(Appendable writer, Map<String, Object> context, ShowPortletLink showPortletLink) throws IOException { + ModelFormField modelFormField = showPortletLink.getModelFormField(); + String linkStyle = ""; + //prepare show link properties + String id = ""; + + if (UtilValidate.isNotEmpty(modelFormField.getIdName())) { + id = modelFormField.getIdName(); + } + if (UtilValidate.isNotEmpty(context.get("itemIndex"))) { + id = id + "_" + context.get("itemIndex"); + } + String markSelected = showPortletLink.getMarkSelected(context); + String event = ""; + if (UtilValidate.isNotEmpty(modelFormField.getEvent())) { + event = modelFormField.getEvent(); + } + String action = ""; + if (UtilValidate.isNotEmpty(modelFormField.getAction(context))) { + action = modelFormField.getAction(context); + } + String collapseScreenlet = showPortletLink.getCollapseScreenlet(context); + + String formName = modelFormField.getModelForm().getName(); + List<String> areasList = FastList.newInstance(); + List<String> targetList = FastList.newInstance(); + List<String> paramsList = FastList.newInstance(); + List<String> formList = FastList.newInstance(); + List<String> collapseLis = FastList.newInstance(); + + ShowPortletLinkData splData = WidgetWorker.prepareShowPortletLinkData(showPortletLink, context); + + for(ShowPortletItem showPortletItem : showPortletLink.getShowPortletItems()){ + + ShowPortletItemData spiData = WidgetWorker.prepareShowPortletItemsData(showPortletItem, context); + + if (UtilValidate.isEmpty(spiData.areaId) && + (UtilValidate.isEmpty(spiData.portalPageId) || UtilValidate.isEmpty(spiData.portletId) || UtilValidate.isEmpty(spiData.portletSeqId))) { + Debug.logWarning("The form [" + modelFormField.getModelForm().getFormLocation() + "#" + modelFormField.getModelForm().getName() +"] has a show-portlet field that should define a target-area or must have target-page-id, target-portlet-id and target-seq_id attributes", module); + } + + if (UtilValidate.isNotEmpty(modelFormField.getWidgetStyle())) { + linkStyle = modelFormField.getWidgetStyle(); + } + collapseScreenlet = showPortletItem.getCollapseScreenlet(context); + + //check whether the current form field values should be appended to request parameters or not + List<String> appendFormParams = showPortletItem.getFormsToSerialize(); + areasList.add(spiData.areaId); + targetList.add(spiData.target); + paramsList.add(spiData.params.toString()); + String formParamsString = ""; + if(UtilValidate.isNotEmpty(appendFormParams) && appendFormParams.size() > 0){ + formParamsString = appendFormParams.toString(); + if (formParamsString.startsWith("{")) + formParamsString = formParamsString.replace("{", ""); + if (formParamsString.endsWith("}")) + formParamsString = formParamsString.replace("}", ""); + formParamsString = formParamsString.replace(", ", ","); + } + formList.add(formParamsString); + collapseLis.add(collapseScreenlet); + } + if (areasList.size() != targetList.size() + || areasList.size() != paramsList.size()) { + Debug.logWarning("The form Field [" + modelFormField.getModelForm().getFormLocation() + "#" + modelFormField.getModelForm().getName() +"] has define a target and arameters list for each area it is going to refresh", module); + } + if(UtilValidate.isNotEmpty(id)) { + writer.append("<div id=\"" + id +"_div\""); + } + writer.append(">\n"); + writer.append(" <a "); + if(UtilValidate.isNotEmpty(linkStyle)) { + writer.append(" class=\"" + linkStyle +"\""); + } + writer.append(" href='javascript:refrshPortlet(\"" + showPortletLink.listToString(targetList) +"\", "); + writer.append("\"" + showPortletLink.listToString(areasList) + "\", "); + writer.append("\"" + showPortletLink.listToString(paramsList) + "\", "); + writer.append("\"" + formName +"\", "); + writer.append("\"" + showPortletLink.listToString(formList) + "\", "); + if (UtilValidate.isNotEmpty(showPortletLink.getCollapseScreenlet(context))) { + writer.append("\"" + showPortletLink.getCollapseScreenlet(context) + "\", "); + writer.append("\"" + id + "_div\", "); + } + else { + writer.append("\"\", "); + writer.append("\"\", "); + } + if (UtilValidate.isNotEmpty(showPortletLink.getCollapseScreenlet(context))) { + writer.append("\"" + markSelected + "\")'"); + } + else { + writer.append("\"\")' "); + } + if(UtilValidate.isNotEmpty(event) && UtilValidate.isNotEmpty(action)) { + writer.append(event + "=\"" + action + "\" "); + } + if(UtilValidate.isNotEmpty(splData.imgSrc) && UtilValidate.isNotEmpty(splData.imgTitle)) { + writer.append("title=\"" + splData.imgTitle+ "\""); + } + writer.append(">"); + if(UtilValidate.isNotEmpty(splData.imgSrc)) { + writer.append("<img src=\"" + splData.imgSrc +"\" alt=\"" + splData.alt + "\" title=\"" + splData.imgTitle +"\"/>"); + } + writer.append(splData.description); + writer.append("</a>"); + if(UtilValidate.isNotEmpty(id)) { + writer.append("</div>"); + } + + this.appendTooltip(writer, context, modelFormField); + } + //#Eam# portletWidget } Modified: ofbiz/branches/20120329_portletWidget/framework/widget/src/org/ofbiz/widget/html/HtmlMenuRenderer.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/widget/src/org/ofbiz/widget/html/HtmlMenuRenderer.java?rev=1307601&r1=1307600&r2=1307601&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/framework/widget/src/org/ofbiz/widget/html/HtmlMenuRenderer.java (original) +++ ofbiz/branches/20120329_portletWidget/framework/widget/src/org/ofbiz/widget/html/HtmlMenuRenderer.java Fri Mar 30 20:44:26 2012 @@ -28,6 +28,7 @@ import javax.servlet.http.HttpServletReq import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; +import org.ofbiz.base.util.Debug; //#Eam# portletWidget import org.ofbiz.base.util.StringUtil; import org.ofbiz.base.util.UtilMisc; import org.ofbiz.base.util.UtilValidate; @@ -37,11 +38,19 @@ import org.ofbiz.webapp.control.RequestH import org.ofbiz.webapp.taglib.ContentUrlTag; import org.ofbiz.widget.ModelWidget; import org.ofbiz.widget.WidgetWorker; +//#Bam# portletWidget +import org.ofbiz.widget.ModelWidget.ShowPortletItemData; +import org.ofbiz.widget.ModelWidget.ShowPortletLinkData; +//#Eam# portletWidget import org.ofbiz.widget.menu.MenuStringRenderer; import org.ofbiz.widget.menu.ModelMenu; import org.ofbiz.widget.menu.ModelMenuItem; import org.ofbiz.widget.menu.ModelMenuItem.Image; import org.ofbiz.widget.menu.ModelMenuItem.Link; +//#Bam# portletWidget +import org.ofbiz.widget.menu.ModelMenuItem.ShowPortletItem; +import org.ofbiz.widget.menu.ModelMenuItem.ShowPortletLink; +//#Bam# portletWidget /** * Widget Library - HTML Menu Renderer implementation @@ -181,9 +190,15 @@ public class HtmlMenuRenderer extends Ht writer.append(">"); Link link = menuItem.getLink(); + ShowPortletLink showPortletLink = menuItem.getShowPortletLink(); //#Eam# portletWidget //if (Debug.infoOn()) Debug.logInfo("in HtmlMenuRendererImage, link(0):" + link,""); if (link != null) { renderLink(writer, context, link); + //#Bam# portletWidget + } + else if(showPortletLink != null){ + renderShowPortletLink(writer, context, showPortletLink); + //#Eam# portletWidget } else { String txt = menuItem.getTitle(context); StringUtil.SimpleEncoder simpleEncoder = (StringUtil.SimpleEncoder) context.get("simpleEncoder"); @@ -565,6 +580,14 @@ public class HtmlMenuRenderer extends Ht writer.append(border); writer.append("\""); } + //#Bam# portletWidget + String title = image.getTitle(context); + if (UtilValidate.isNotEmpty(title)) { + writer.append(" title=\""); + writer.append(title); + writer.append("\""); + } + //#Eam# portletWidget String src = image.getSrc(context); if (UtilValidate.isNotEmpty(src)) { writer.append(" src=\""); @@ -598,4 +621,63 @@ public class HtmlMenuRenderer extends Ht } writer.append("/>"); } + //#Bam# portletWidget + public void renderShowPortletLink(Appendable writer, Map<String, Object> context, ShowPortletLink showPortletLink) throws IOException { + ModelMenuItem modelMenuItem = showPortletLink.getModelMenuItem(); + String linkStyle = ""; + //prepare show link properties + String id = ""; + String event = ""; + String action = ""; + if (UtilValidate.isNotEmpty(context.get("itemIndex"))) { + id = id + context.get("itemIndex"); + } + StringBuilder areaCsvString = new StringBuilder(); + + ShowPortletLinkData splData = WidgetWorker.prepareShowPortletLinkData(showPortletLink, context); + + for(ShowPortletItem showPortletItem : showPortletLink.getShowPortletItems()){ + + ShowPortletItemData spiData = WidgetWorker.prepareShowPortletItemsData(showPortletItem, context); + + if(showPortletItem.getRequireConfirmation() && UtilValidate.isNotEmpty(showPortletItem.getConfirmationMessage(context))) { + event = "onclick"; + action = "return confirm('" + showPortletItem.getConfirmationMessage(context) +"')"; + } + + if (UtilValidate.isEmpty(spiData.areaId) && + (UtilValidate.isEmpty(spiData.portalPageId) || UtilValidate.isEmpty(spiData.portletId) || UtilValidate.isEmpty(spiData.portletSeqId))) { + Debug.logWarning("The menu [" + modelMenuItem.getModelMenu().getBoundaryCommentName() +"] has a show-portlet field that should define a target-area or must have target-page-id, target-portlet-id and target-seq_id attributes", module); + } + + if (UtilValidate.isNotEmpty(modelMenuItem.getWidgetStyle())) { + linkStyle = modelMenuItem.getWidgetStyle(); + } + + if (UtilValidate.isNotEmpty( spiData.areaId )) { + StringBuilder areanElement = new StringBuilder(); + areanElement.append(spiData.areaId).append(",").append(spiData.target).append(",").append(spiData.params); + if (UtilValidate.isNotEmpty( areaCsvString )) { + areaCsvString.append(","); + } + areaCsvString.append(areanElement); + } + } + + writer.append(" <a "); + if (UtilValidate.isNotEmpty(event) && UtilValidate.isNotEmpty(action)) { + writer.append(event + "=\"" + action +"\""); + } + if(UtilValidate.isNotEmpty(linkStyle)) { + writer.append(" class=\"" + linkStyle +"\""); + } + writer.append(" href=\"javascript:ajaxUpdateAreas(\'" + areaCsvString.toString() + "\');\" "); + writer.append(">"); + if(UtilValidate.isNotEmpty(splData.imgSrc)) { + writer.append("<img src=\"" + splData.imgSrc +"\" alt=\"" + splData.alt + "\" title=\"" + splData.imgTitle +"\"/>"); + } + writer.append(splData.description); + writer.append("</a>"); + } + //#Eam# portletWidget } Modified: ofbiz/branches/20120329_portletWidget/framework/widget/src/org/ofbiz/widget/menu/MenuStringRenderer.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/widget/src/org/ofbiz/widget/menu/MenuStringRenderer.java?rev=1307601&r1=1307600&r2=1307601&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/framework/widget/src/org/ofbiz/widget/menu/MenuStringRenderer.java (original) +++ ofbiz/branches/20120329_portletWidget/framework/widget/src/org/ofbiz/widget/menu/MenuStringRenderer.java Fri Mar 30 20:44:26 2012 @@ -35,4 +35,5 @@ public interface MenuStringRenderer { public void setUserLoginIdHasChanged(boolean b) throws IOException ; public void renderLink(Appendable writer, Map<String, Object> context, ModelMenuItem.Link link) throws IOException ; public void renderImage(Appendable writer, Map<String, Object> context, ModelMenuItem.Image image) throws IOException ; + public void renderShowPortletLink(Appendable writer, Map<String, Object> context, ModelMenuItem.ShowPortletLink showPortletLink) throws IOException ; } Modified: ofbiz/branches/20120329_portletWidget/framework/widget/src/org/ofbiz/widget/menu/ModelMenuItem.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/widget/src/org/ofbiz/widget/menu/ModelMenuItem.java?rev=1307601&r1=1307600&r2=1307601&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/framework/widget/src/org/ofbiz/widget/menu/ModelMenuItem.java (original) +++ ofbiz/branches/20120329_portletWidget/framework/widget/src/org/ofbiz/widget/menu/ModelMenuItem.java Fri Mar 30 20:44:26 2012 @@ -35,11 +35,13 @@ import org.ofbiz.base.util.StringUtil; import org.ofbiz.base.util.UtilFormatOut; import org.ofbiz.base.util.UtilProperties; import org.ofbiz.base.util.UtilValidate; +import org.ofbiz.base.util.UtilURL; // #Eam# portletWidget import org.ofbiz.base.util.UtilXml; import org.ofbiz.base.util.collections.FlexibleMapAccessor; import org.ofbiz.base.util.string.FlexibleStringExpander; import org.ofbiz.entity.GenericValue; import org.ofbiz.entityext.permission.EntityPermissionChecker; +import org.ofbiz.widget.ModelWidget; // #Eam# portletWidget import org.ofbiz.widget.WidgetWorker; import org.ofbiz.widget.PortalPageWorker; import org.w3c.dom.Element; @@ -53,6 +55,7 @@ public class ModelMenuItem { public static final String module = ModelMenuItem.class.getName(); protected ModelMenu modelMenu; + protected ShowPortletLink showPortletLink;// #Eam# portletWidget protected Map<String, Object> dataMap = new HashMap<String, Object>(); protected String name; @@ -187,7 +190,15 @@ public class ModelMenuItem { if (actionsElement != null) { this.actions = ModelMenuAction.readSubActions(this, actionsElement); } - + // #Bam# portletWidget + List<? extends Element> showPortlets = UtilXml.childElementList(fieldElement, "show-portlet"); + for (Element showPortlet: showPortlets) { + if (UtilValidate.isEmpty(showPortletLink)) { + showPortletLink= new ShowPortletLink(showPortlet, this); + } + showPortletLink.addShowPorletTolink(showPortlet); + } + // #Eam# portletWidget } public ModelMenuItem addUpdateMenuItem(ModelMenuItem modelMenuItem) { @@ -559,6 +570,12 @@ public class ModelMenuItem { return this.link; } + // #BAM# portletWidget + public ShowPortletLink getShowPortletLink() { + return this.showPortletLink; + } + // #EAM# portletWidget + public boolean isSelected(Map<String, Object> context) { return this.name.equals(modelMenu.getSelectedMenuItemContextFieldName(context)); } @@ -825,6 +842,7 @@ public class ModelMenuItem { protected FlexibleStringExpander widthExdr; protected FlexibleStringExpander heightExdr; protected FlexibleStringExpander borderExdr; + protected FlexibleStringExpander title; // #Eam# portletWidget protected String urlMode; public Image(Element imageElement) { @@ -834,6 +852,7 @@ public class ModelMenuItem { setStyle(imageElement.getAttribute("style")); setWidth(imageElement.getAttribute("width")); setHeight(imageElement.getAttribute("height")); + setTitle(imageElement.getAttribute("title"));// #Eam# portletWidget setBorder(UtilFormatOut.checkEmpty(imageElement.getAttribute("border"), "0")); setUrlMode(UtilFormatOut.checkEmpty(imageElement.getAttribute("url-mode"), "content")); @@ -867,6 +886,12 @@ public class ModelMenuItem { return this.borderExdr.expandString(context); } + // #Bam# portletWidget + public String getTitle(Map<String, Object> context) { + return this.title.expandString(context); + } + // #Eam# portletWidget + public String getUrlMode() { return this.urlMode; } @@ -903,5 +928,313 @@ public class ModelMenuItem { this.urlMode = val; } + // #Bam# portletWidget + public void setTitle(String val) { + String titleAttr = UtilFormatOut.checkNull(val); + this.title = FlexibleStringExpander.getInstance(titleAttr); + } + // #Eam# portletWidget + } + + public static class ShowPortletLink implements ModelWidget.ShowPortletLink { + protected ModelMenuItem linkMenuItem; + protected FlexibleStringExpander description; + protected FlexibleStringExpander imageTitle; + protected FlexibleStringExpander alternate; + protected FlexibleStringExpander image; + protected String size; + protected List<ShowPortletItem> showPortletItems = FastList.newInstance(); + public String listToString(List<String> list) { + String result = ""; + for(String s : list) { + result = result.concat(s).concat(";"); + } + if (result.endsWith(";")) { + return result.substring(0, result.length()-1); + } + return result; + } + + public ShowPortletLink(Element linkElement, ModelMenuItem parentMenuItem) { + this.linkMenuItem = parentMenuItem; + } + + public void renderFieldString(Appendable writer, Map<String, Object> context, MenuStringRenderer menuStringRenderer) throws IOException { + menuStringRenderer.renderShowPortletLink(writer, context, this); + } + + public void addShowPorletTolink(Element element) { + showPortletItems.add(new ShowPortletItem(element, this)); + } + + /** + * @param string + */ + public void setDescription(String string) { + if (UtilValidate.isNotEmpty(string)) { + this.description = FlexibleStringExpander.getInstance(string); + } + } + + /** + * @param string + */ + public void setImageTitle(String string) { + if (UtilValidate.isNotEmpty(string)) { + this.imageTitle = FlexibleStringExpander.getInstance(string); + } + } + public ModelMenuItem getModelMenuItem() { + return linkMenuItem; + } + public List<ShowPortletItem> getShowPortletItems() { + return showPortletItems; + } + /** + * @param string + */ + public void setAlternate(String string) { + if (UtilValidate.isNotEmpty(string)) { + this.alternate = FlexibleStringExpander.getInstance(string); + } + } + + public String getDescription(Map<String, Object> context) { + String description = ""; + if (UtilValidate.isNotEmpty(this.description)) { + description = this.description.expandString(context); + } + if (UtilValidate.isEmpty(description)) { + description = this.getModelMenuItem().getTitle(context); + } + return description; + } + + public String getAlternate(Map<String, Object> context) { + if (UtilValidate.isNotEmpty(alternate)) { + return this.alternate.expandString(context); + } + return ""; + } + + public String getImageTitle(Map<String, Object> context) { + if (UtilValidate.isNotEmpty(imageTitle)) { + return this.imageTitle.expandString(context); + } + return ""; + } + + public String getImage(Map<String, Object> context) { + if (UtilValidate.isNotEmpty(imageTitle)) { + return this.image.expandString(context); + } + return ""; + } + + public String getSize() { + return this.size; + } + + public String setSize(String size) { + return this.size = size; + } + } + + public static class ShowPortletItem implements ModelWidget.ShowPortletItem { + + protected FlexibleStringExpander areaId; + protected FlexibleStringExpander target; + protected ShowPortletLink showPortletLink; + protected FlexibleStringExpander portletId; + protected boolean requireConfirmation; + protected FlexibleStringExpander confirmationMessage; + protected FlexibleStringExpander portalPageId; + protected FlexibleStringExpander portletSeqId; + protected List<WidgetWorker.Parameter> parameterList = FastList.newInstance(); + + public ShowPortletItem(Element element, ShowPortletLink showPortletLink) { + this.showPortletLink = showPortletLink; + this.setConfirmationMessage(element.getAttribute("confirmation-message")); + this.setRequireConfirmation(("true".equals(element.getAttribute("request-confirmation")))); + this.setAreaId(element.getAttribute("area-id")); + this.setPortletId(element.getAttribute("portlet-id")); + this.setPortalPageId(element.getAttribute("portal-page-id")); + this.setPortletSeqId(element.getAttribute("portlet-seq-id")); + this.setDescription(element.getAttribute("description")); + this.setAlternate(element.getAttribute("alternate")); + this.setImageTitle(element.getAttribute("image-title")); + this.setTarget(element.getAttribute("target")); + this.setImage (element.getAttribute("image-location")); + this.setSize(element.getAttribute("size")); + + List<? extends Element> parameterElementList = UtilXml.childElementList(element, "parameter"); + for (Element parameterElement: parameterElementList) { + this.parameterList.add(new WidgetWorker.Parameter(parameterElement)); + } + + } + public ModelMenuItem getModelMenuItem() { + return showPortletLink.getModelMenuItem(); + } + + public String getDescription(Map<String, Object> context) { + return showPortletLink.getDescription(context); + } + + public String getPortalPageId(Map<String, Object> context) { + if (UtilValidate.isNotEmpty(portalPageId)) { + return this.portalPageId.expandString(context); + } + return ""; + } + + public String getPortletId(Map<String, Object> context) { + if (UtilValidate.isNotEmpty(portletId)) { + return this.portletId.expandString(context); + } + return ""; + } + + public String getPortletSeqId(Map<String, Object> context) { + if (UtilValidate.isNotEmpty(portletSeqId)) { + return this.portletSeqId.expandString(context); + } + return ""; + } + + public String getAreaId(Map<String, Object> context) { + String areaIdValue = ""; + if (UtilValidate.isNotEmpty(areaId)) { + areaIdValue = this.areaId.expandString(context); + } + return areaIdValue; + } + + public String getAlternate(Map<String, Object> context) { + return showPortletLink.getAlternate(context); + } + + public String getImageTitle(Map<String, Object> context) { + return showPortletLink.getImageTitle(context); + } + + public String getTarget(Map<String, Object> context) { + if (UtilValidate.isNotEmpty(target)) { + return this.target.expandString(context); + } + return ""; + } + + public Map<String, String> getParameterMap(Map<String, Object> context) { + Map<String, String> fullParameterMap = FastMap.newInstance(); + + for (WidgetWorker.Parameter parameter: this.parameterList) { + String paramValue = parameter.getValue(context); + if (UtilValidate.isNotEmpty(paramValue) || parameter.sendIfEmpty(context)){ + if ("idDescription".equals(parameter.getName())) { + if (UtilValidate.isNotEmpty(paramValue)) { + paramValue = UtilURL.removeBadCharForUrl(paramValue); + fullParameterMap.put(parameter.getName(), paramValue); + } + } + else { + fullParameterMap.put(parameter.getName(), paramValue); + } + } + } + return fullParameterMap; + } + + public String getImage(Map<String, Object> context) { + if (UtilValidate.isNotEmpty(this.showPortletLink.image)) { + return this.showPortletLink.image.expandString(context); + } + return ""; + } + public String getSize() { + return showPortletLink.size; + } + + public void setImage(String image) { + this.showPortletLink.image = FlexibleStringExpander.getInstance(image); + } + public void setSize(String size) { + showPortletLink.setSize(size); + } + + /** + * @param string + */ + public void setAreaId(String areaId) { + this.areaId = FlexibleStringExpander.getInstance(areaId); + } + + /** + * @param string + */ + public void setPortletId(String portletId) { + this.portletId = FlexibleStringExpander.getInstance(portletId); + } + + /** + * @param string + */ + public void setPortletSeqId(String portletSeqId) { + this.portletSeqId = FlexibleStringExpander.getInstance(portletSeqId); + } + + /** + * @param string + */ + public void setPortalPageId(String portalPageId) { + this.portalPageId = FlexibleStringExpander.getInstance(portalPageId); + } + /** + * @param string + */ + public void setDescription(String string) { + showPortletLink.setDescription(string); + } + + /** + * @param string + */ + public void setImageTitle(String string) { + showPortletLink.setImageTitle(string); + } + + /** + * @param string + */ + public void setAlternate(String string) { + showPortletLink.setAlternate(string); + } + + /** + * @param string + */ + public void setTarget(String string) { + this.target = FlexibleStringExpander.getInstance(string); + } + + public String getConfirmationMessage(Map<String, Object> context) { + String areaIdValue = ""; + if (UtilValidate.isNotEmpty(confirmationMessage)) { + areaIdValue = this.confirmationMessage.expandString(context); + } + return areaIdValue; + } + + public void setRequireConfirmation(boolean reqConfirm) { + requireConfirmation = reqConfirm; + } + + public boolean getRequireConfirmation() { + return requireConfirmation; + } + + public void setConfirmationMessage(String string) { + this.confirmationMessage = FlexibleStringExpander.getInstance(string); + } } } Modified: ofbiz/branches/20120329_portletWidget/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java?rev=1307601&r1=1307600&r2=1307601&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java (original) +++ ofbiz/branches/20120329_portletWidget/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java Fri Mar 30 20:44:26 2012 @@ -45,6 +45,7 @@ import org.ofbiz.base.util.UtilValidate; import org.ofbiz.base.util.template.FreeMarkerWorker; import org.ofbiz.entity.Delegator; import org.ofbiz.entity.GenericValue; +import org.ofbiz.service.DispatchContext;//#Eam# : portletWidget import org.ofbiz.service.LocalDispatcher; import org.ofbiz.webapp.control.RequestHandler; import org.ofbiz.webapp.taglib.ContentUrlTag; @@ -65,6 +66,10 @@ import freemarker.template.Template; import freemarker.template.TemplateException; import org.xml.sax.SAXException; import javax.xml.parsers.ParserConfigurationException; +//#Bam# portletWidget +import java.util.List; +import org.ofbiz.base.util.string.FlexibleStringExpander; +//#Eam# portletWidget public class MacroScreenRenderer implements ScreenStringRenderer { @@ -788,6 +793,81 @@ public class MacroScreenRenderer impleme executeMacro(writer, "renderScreenletPaginateMenu", parameters); } + /** Create an ajaxXxxx JavaScript CSV string from a list of UpdateArea objects. See + * <code>selectall.js</code>. + * @param updateAreas + * @param extraParams Renderer-supplied additional target parameters + * @param context + * @return Parameter string or empty string if no UpdateArea objects were found + */ + public String createAjaxParamsFromUpdateAreas(RequestHandler rh,HttpServletRequest request, HttpServletResponse response, List<ModelForm.UpdateArea> updateAreas, String extraParams, Map<String, ? extends Object> context) { + //FIXME copy from HtmlFormRenderer.java + if (updateAreas == null) { + return ""; + } + String ajaxUrl = ""; + boolean firstLoop = true; + for (ModelForm.UpdateArea updateArea : updateAreas) { + if (firstLoop) { + firstLoop = false; + } else { + ajaxUrl += ","; + } + Map<String, Object> ctx = UtilGenerics.checkMap(context); + Map<String, String> parameters = updateArea.getParameterMap(ctx); + String targetUrl = updateArea.getAreaTarget(context); + String ajaxParams = getAjaxParamsFromTarget(targetUrl); + if (UtilValidate.isNotEmpty(extraParams)) { + if (ajaxParams.length() > 0 && !extraParams.startsWith("&")) { + ajaxParams += "&"; + } + ajaxParams += extraParams; + } + if(UtilValidate.isNotEmpty(parameters)){ + if(UtilValidate.isEmpty(ajaxParams)){ + ajaxParams = ""; + } + for (String key : parameters.keySet()) { + if (ajaxParams.length() > 0 && ajaxParams.indexOf(key) < 0) { + ajaxParams += "&"; + } + if (ajaxParams.indexOf(key) < 0) { + ajaxParams += key + "=" + parameters.get(key); + } + } + StringBuilder params = new StringBuilder(); + params.append(ajaxParams); + List<String> addingParams = UtilMisc.toList("portalPageId", "portalPortletId", "portletSeqId", "areaId", "idDescription"); + for (String addingParam : addingParams) { + if (UtilValidate.isNotEmpty(ajaxParams) && ajaxParams.contains(addingParam + "=")) { + continue; + } + WidgetWorker.addToParamsIfInContext(params, ctx, addingParam, parameters); + } + ajaxParams = params.toString(); + } + ajaxUrl += updateArea.getAreaId() + ","; + ajaxUrl += rh.makeLink(request, response, UtilHttp.removeQueryStringFromTarget(targetUrl)); + ajaxUrl += "," + ajaxParams; + } + Locale locale = UtilMisc.ensureLocale(context.get("locale")); + return FlexibleStringExpander.expandString(ajaxUrl, context, locale); + } + + /** Extracts parameters from a target URL string, prepares them for an Ajax + * JavaScript call. This method is currently set to return a parameter string + * suitable for the Prototype.js library. + * @param target Target URL string + * @return Parameter string + */ + public static String getAjaxParamsFromTarget(String target) { + String targetParams = UtilHttp.getQueryStringFromTarget(target); + targetParams = targetParams.replace("?", ""); + targetParams = targetParams.replace("&", "&"); + return targetParams; + } + //#Eam# portletWidget + public void renderPortalPageBegin(Appendable writer, Map<String, Object> context, ModelScreenWidget.PortalPage portalPage) throws GeneralException, IOException { String portalPageId = portalPage.getActualPortalPageId(); String originalPortalPageId = portalPage.getOriginalPortalPageId(); @@ -899,8 +979,18 @@ public class MacroScreenRenderer impleme String portalPageId = portalPage.getActualPortalPageId(); String originalPortalPageId = portalPage.getOriginalPortalPageId(); String portalPortletId = portalPortlet.getString("portalPortletId"); + //#Bam# portletWidget + /* String portletSeqId = portalPortlet.getString("portletSeqId"); String columnSeqId = portalPortlet.getString("columnSeqId"); + */ + String portletSeqId = null; + String columnSeqId = null; + if (! portalPortlet.getEntityName().equals("PortalPortlet")){ + portletSeqId = portalPortlet.getString("portletSeqId"); + columnSeqId = portalPortlet.getString("columnSeqId"); + } + //#Eam# portletWidget String confMode = portalPage.getConfMode(context); String editFormName = portalPortlet.getString("editFormName"); String editFormLocation = portalPortlet.getString("editFormLocation"); @@ -921,6 +1011,7 @@ public class MacroScreenRenderer impleme delPortletHint = uiLabelMap.get("CommonDeleteThisPortlet"); editAttributeHint = uiLabelMap.get("CommonEditPortletAttributes"); } + String includedInPage = (String) context.get("includedInPage");//#Eam# : portletWidget StringWriter sr = new StringWriter(); sr.append("<@renderPortalPagePortletBegin "); @@ -952,6 +1043,10 @@ public class MacroScreenRenderer impleme sr.append(editAttributeHint); sr.append("\" confMode=\""); sr.append(confMode); + //#Bam# : portletWidget + sr.append("\" includedInPage=\""); + sr.append(includedInPage); + //#Eam# : portletWidget sr.append("\""); if (UtilValidate.isNotEmpty(editFormName) && UtilValidate.isNotEmpty(editFormLocation)) { sr.append(" editAttribute=\"true\""); @@ -967,6 +1062,11 @@ public class MacroScreenRenderer impleme sr.append("<@renderPortalPagePortletEnd "); sr.append(" confMode=\""); sr.append(confMode); + //#Bam# : portletWidget + String includedInPage = (String) context.get("includedInPage"); + sr.append("\" includedInPage=\""); + sr.append(includedInPage); + //#Eam# : portletWidget sr.append("\" />"); executeMacro(writer, sr.toString()); } @@ -975,11 +1075,49 @@ public class MacroScreenRenderer impleme String portalPortletId = portalPortlet.getString("portalPortletId"); String screenName = portalPortlet.getString("screenName"); String screenLocation = portalPortlet.getString("screenLocation"); + //#Bam# : portletWidget + if (UtilValidate.isEmpty(screenName) || UtilValidate.isEmpty(screenLocation)){ + Debug.logError("Impossible to show portalPortletId="+portalPortletId+" screenName="+screenName+" screenLocation="+screenLocation, module); + return; + } + + LocalDispatcher dispatcher = (LocalDispatcher) context.get("dispatcher"); + DispatchContext dctx = dispatcher.getDispatchContext(); + Boolean hasPermission = true; + if (UtilValidate.isNotEmpty(portalPortlet.get("securityServiceName")) && UtilValidate.isNotEmpty(portalPortlet.get("securityMainAction"))) { + String serviceName = portalPortlet.getString("securityServiceName"); + Map<String, Object> inMap = UtilMisc.toMap("mainAction", portalPortlet.get("securityMainAction"), + "resourceDescription", portalPortletId, + "userLogin",context.get("userLogin")); + //Add request parameters to service context + Map<String, Object> inputFields = UtilGenerics.checkMap(context.get("requestParameters")); + for (String name: inputFields.keySet()) { + inMap.put(name, inputFields.get(name)); + } + inMap = dctx.makeValidContext(serviceName, "IN", inMap); + Map<String, Object> result = dispatcher.runSync(serviceName, inMap); + if (UtilValidate.isNotEmpty(result)) { + hasPermission = (Boolean) result.get("hasPermission"); + + //Add service result parameters to context + for (String name: result.keySet()) { + context.put(name, result.get(name)); + } + } + } + //#Eam# : portletWidget ModelScreen modelScreen = null; if (UtilValidate.isNotEmpty(screenName) && UtilValidate.isNotEmpty(screenLocation)) { try { + if (hasPermission) {//#Eam# : portletWidget modelScreen = ScreenFactory.getScreenFromLocation(screenLocation, screenName); + //#Bam# : portletWidget + } else { + //Display permission error screen + modelScreen = ScreenFactory.getScreenFromLocation("component://common/widget/PortalPageScreens.xml","PermissionErrorScreen"); + } + //#Eam# : portletWidget } catch (IOException e) { String errMsg = "Error rendering portlet ID [" + portalPortletId + "]: " + e.toString(); Debug.logError(e, errMsg, module); |
Free forum by Nabble | Edit this page |