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=759086&r1=759085&r2=759086&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 Fri Mar 27 10:11:46 2009 @@ -23,26 +23,39 @@ import java.io.Reader; import java.io.StringReader; import java.io.StringWriter; +import java.math.BigDecimal; import java.net.MalformedURLException; import java.net.URL; import java.util.HashMap; import java.util.HashSet; +import java.util.List; +import java.util.Locale; import java.util.Map; import javax.servlet.ServletContext; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import javolution.util.FastMap; + import org.ofbiz.base.location.FlexibleLocation; import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.GeneralException; import org.ofbiz.base.util.FileUtil; +import org.ofbiz.base.util.StringUtil; +import org.ofbiz.base.util.UtilFormatOut; import org.ofbiz.base.util.UtilGenerics; import org.ofbiz.base.util.UtilHttp; import org.ofbiz.base.util.UtilMisc; import org.ofbiz.base.util.UtilValidate; import org.ofbiz.base.util.template.FreeMarkerWorker; +import org.ofbiz.entity.GenericDelegator; +import org.ofbiz.service.LocalDispatcher; import org.ofbiz.webapp.control.RequestHandler; +import org.ofbiz.webapp.taglib.ContentUrlTag; +import org.ofbiz.widget.WidgetContentWorker; +import org.ofbiz.widget.WidgetDataResourceWorker; +import org.ofbiz.widget.WidgetWorker; import org.ofbiz.widget.form.FormStringRenderer; import org.ofbiz.widget.form.ModelForm; import org.ofbiz.widget.html.HtmlFormRenderer; @@ -98,7 +111,7 @@ String containerId = container.getId(context); String autoUpdateTarget = container.getAutoUpdateTargetExdr(context); HttpServletRequest request = (HttpServletRequest) context.get("request"); - String autoUpdateLink = null; + String autoUpdateLink = ""; if (UtilValidate.isNotEmpty(autoUpdateTarget) && UtilHttp.isJavaScriptEnabled(request)) { if (UtilValidate.isEmpty(containerId)) { containerId = getNextElementId(); @@ -110,7 +123,7 @@ } StringWriter sr = new StringWriter(); sr.append("<@renderContainerBegin "); - sr.append("containerId=\""); + sr.append("id=\""); sr.append(containerId); sr.append("\" style=\""); sr.append(container.getStyle(context)); @@ -130,12 +143,13 @@ public void renderLabel(Appendable writer, Map<String, Object> context, ModelScreenWidget.Label label) throws IOException { String labelText = label.getText(context); - String style = label.getStyle(context); - String id = label.getId(context); + if(UtilValidate.isNotEmpty(labelText)){ + labelText = StringUtil.htmlEncoder.encode(labelText); + } StringWriter sr = new StringWriter(); sr.append("<@renderLabel "); sr.append("text=\""); - sr.append(label.getText(context)); + sr.append(labelText); sr.append("\" id=\""); sr.append(label.getId(context)); sr.append("\" style=\""); @@ -156,45 +170,411 @@ } public void renderLink(Appendable writer, Map<String, Object> context, ModelScreenWidget.Link link) throws IOException { - // TODO: not implemented + HttpServletResponse response = (HttpServletResponse) context.get("response"); + HttpServletRequest request = (HttpServletRequest) context.get("request"); + + String targetWindow = link.getTargetWindow(context); + String target = link.getTarget(context); + + String uniqueItemName = link.getModelScreen().getName() + "_LF_" + UtilMisc.<String>addToBigDecimalInMap(context, "screenUniqueItemIndex", BigDecimal.ONE); + + String linkType = WidgetWorker.determineAutoLinkType(link.getLinkType(), target, link.getUrlMode(), request); + String linkUrl = ""; + String actionUrl = ""; + StringBuilder parameters=new StringBuilder(); + if ("hidden-form".equals(linkType)) { + StringBuilder sb = new StringBuilder(); + WidgetWorker.buildHyperlinkUrl(sb, target, link.getUrlMode(), null, link.getPrefix(context), + link.getFullPath(), link.getSecure(), link.getEncode(), request, response, context); + actionUrl = sb.toString(); + parameters.append("["); + for (WidgetWorker.Parameter parameter: link.getParameterList()) { + if(parameters.length() >1){ + parameters.append(","); + } + parameters.append("{'name':'"); + parameters.append(parameter.getName()); + parameters.append("'"); + parameters.append(",'value':'"); + parameters.append(parameter.getValue(context)); + parameters.append("'}"); + } + parameters.append("]"); + + } + String id = link.getId(context); + String style = link.getStyle(context); + String name = link.getName(context); + String text = link.getText(context); + if (UtilValidate.isNotEmpty(target)) { + if (!"hidden-form".equals(linkType)) { + StringBuilder sb = new StringBuilder(); + WidgetWorker.buildHyperlinkUrl(sb, target, link.getUrlMode(), link.getParameterList(), link.getPrefix(context), + link.getFullPath(), link.getSecure(), link.getEncode(), request, response, context); + linkUrl = sb.toString(); + } + } + String imgStr = ""; + ModelScreenWidget.Image img = link.getImage(); + if (img == null) { + StringBuilder sb = new StringBuilder(); + renderImage(sb,context,img); + imgStr = sb.toString(); + } + StringWriter sr = new StringWriter(); + sr.append("<@renderLink "); + sr.append("parameterList="); + sr.append(parameters.length()==0?"\"\"":parameters.toString()); + sr.append(" targetWindow=\""); + sr.append(targetWindow); + sr.append("\" target=\""); + sr.append(target); + sr.append("\" uniqueItemName=\""); + sr.append(uniqueItemName); + sr.append("\" linkType=\""); + sr.append(linkType); + sr.append("\" actionUrl=\""); + sr.append(actionUrl); + sr.append("\" id=\""); + sr.append(id); + sr.append("\" style=\""); + sr.append(style); + sr.append("\" name=\""); + sr.append(name); + sr.append("\" linkUrl=\""); + sr.append(linkUrl); + sr.append("\" text=\""); + sr.append(text); + sr.append("\" imgStr=\""); + sr.append(imgStr); + sr.append("\" />"); + executeMacro(writer, sr.toString()); } public void renderImage(Appendable writer, Map<String, Object> context, ModelScreenWidget.Image image) throws IOException { - // TODO: not implemented + if( image == null) + return ; + String src = image.getSrc(context); + String id = image.getId(context); + String style = image.getStyle(context); + String wid = image.getWidth(context); + String hgt = image.getHeight(context); + String border = image.getBorder(context); + String alt = image.getAlt(context); + + String urlMode = image.getUrlMode(); + boolean fullPath = false; + boolean secure = false; + boolean encode = false; + HttpServletResponse response = (HttpServletResponse) context.get("response"); + HttpServletRequest request = (HttpServletRequest) context.get("request"); + String urlString = ""; + if (urlMode != null && urlMode.equalsIgnoreCase("intra-app")) { + if (request != null && response != null) { + ServletContext ctx = (ServletContext) request.getAttribute("servletContext"); + RequestHandler rh = (RequestHandler) ctx.getAttribute("_REQUEST_HANDLER_"); + urlString = rh.makeLink(request, response, src, fullPath, secure, encode); + } else { + urlString = src; + } + } else if (urlMode != null && urlMode.equalsIgnoreCase("content")) { + if (request != null && response != null) { + StringBuffer newURL = new StringBuffer(); + ContentUrlTag.appendContentPrefix(request, newURL); + newURL.append(src); + urlString = newURL.toString(); + } + } else { + urlString = src; + } + StringWriter sr = new StringWriter(); + sr.append("<@renderImage "); + sr.append("src=\""); + sr.append(src); + sr.append("\" id=\""); + sr.append(id); + sr.append("\" style=\""); + sr.append(style); + sr.append("\" wid=\""); + sr.append(wid); + sr.append("\" hgt=\""); + sr.append(hgt); + sr.append("\" border=\""); + sr.append(border); + sr.append("\" alt=\""); + sr.append(alt); + sr.append("\" urlString=\""); + sr.append(urlString); + sr.append("\" />"); + executeMacro(writer, sr.toString()); } public void renderContentBegin(Appendable writer, Map<String, Object> context, ModelScreenWidget.Content content) throws IOException { - // TODO: not implemented + String editRequest = content.getEditRequest(context); + String editContainerStyle = content.getEditContainerStyle(context); + String enableEditName = content.getEnableEditName(context); + String enableEditValue = (String)context.get(enableEditName); + + if (Debug.verboseOn()) Debug.logVerbose("directEditRequest:" + editRequest, module); + + StringWriter sr = new StringWriter(); + sr.append("<@renderContentBegin "); + sr.append("editRequest=\""); + sr.append(editRequest); + sr.append("\" enableEditValue=\""); + sr.append(enableEditValue); + sr.append("\" editContainerStyle=\""); + sr.append(editContainerStyle); + sr.append("\" />"); + executeMacro(writer, sr.toString()); } public void renderContentBody(Appendable writer, Map<String, Object> context, ModelScreenWidget.Content content) throws IOException { - // TODO: not implemented + // FIXME: copy those code from HtmlScreenRenderer.java + Locale locale = UtilMisc.ensureLocale(context.get("locale")); + //Boolean nullThruDatesOnly = Boolean.valueOf(false); + String mimeTypeId = "text/html"; + String expandedContentId = content.getContentId(context); + String expandedDataResourceId = content.getDataResourceId(context); + String renderedContent = null; + LocalDispatcher dispatcher = (LocalDispatcher) context.get("dispatcher"); + GenericDelegator delegator = (GenericDelegator) context.get("delegator"); + + // make a new map for content rendering; so our current map does not get clobbered + Map<String, Object> contentContext = FastMap.newInstance(); + contentContext.putAll(context); + String dataResourceId = (String)contentContext.get("dataResourceId"); + if (Debug.verboseOn()) Debug.logVerbose("expandedContentId:" + expandedContentId, module); + + try { + if (UtilValidate.isNotEmpty(dataResourceId)) { + if (WidgetDataResourceWorker.dataresourceWorker != null) { + renderedContent = WidgetDataResourceWorker.dataresourceWorker.renderDataResourceAsTextExt(delegator, dataResourceId, contentContext, locale, mimeTypeId, false); + } else { + Debug.logError("Not rendering content, WidgetDataResourceWorker.dataresourceWorker not found.", module); + } + } else if (UtilValidate.isNotEmpty(expandedContentId)) { + if (WidgetContentWorker.contentWorker != null) { + renderedContent = WidgetContentWorker.contentWorker.renderContentAsTextExt(dispatcher, delegator, expandedContentId, contentContext, locale, mimeTypeId, true); + } else { + Debug.logError("Not rendering content, WidgetContentWorker.contentWorker not found.", module); + } + } else if (UtilValidate.isNotEmpty(expandedDataResourceId)) { + if (WidgetDataResourceWorker.dataresourceWorker != null) { + renderedContent = WidgetDataResourceWorker.dataresourceWorker.renderDataResourceAsTextExt(delegator, expandedDataResourceId, contentContext, locale, mimeTypeId, false); + } else { + Debug.logError("Not rendering content, WidgetDataResourceWorker.dataresourceWorker not found.", module); + } + } + if (UtilValidate.isEmpty(renderedContent)) { + String editRequest = content.getEditRequest(context); + if (UtilValidate.isNotEmpty(editRequest)) { + if (WidgetContentWorker.contentWorker != null) { + WidgetContentWorker.contentWorker.renderContentAsTextExt(dispatcher, delegator, "NOCONTENTFOUND", writer, contentContext, locale, mimeTypeId, true); + } else { + Debug.logError("Not rendering content, WidgetContentWorker.contentWorker not found.", module); + } + } + } else { + if (content.xmlEscape()) { + renderedContent = UtilFormatOut.encodeXmlValue(renderedContent); + } + + writer.append(renderedContent); + } + + } catch (GeneralException e) { + String errMsg = "Error rendering included content with id [" + expandedContentId + "] : " + e.toString(); + Debug.logError(e, errMsg, module); + //throw new RuntimeException(errMsg); + } catch (IOException e2) { + String errMsg = "Error rendering included content with id [" + expandedContentId + "] : " + e2.toString(); + Debug.logError(e2, errMsg, module); + //throw new RuntimeException(errMsg); + } } public void renderContentEnd(Appendable writer, Map<String, Object> context, ModelScreenWidget.Content content) throws IOException { - // TODO: not implemented + String expandedContentId = content.getContentId(context); + String editMode = "Edit"; + String editRequest = content.getEditRequest(context); + String editContainerStyle = content.getEditContainerStyle(context); + String enableEditName = content.getEnableEditName(context); + String enableEditValue = (String)context.get(enableEditName); + String urlString = ""; + if (editRequest != null && editRequest.toUpperCase().indexOf("IMAGE") > 0) { + editMode += " Image"; + } + + if (UtilValidate.isNotEmpty(editRequest) && "true".equals(enableEditValue)) { + HttpServletResponse response = (HttpServletResponse) context.get("response"); + HttpServletRequest request = (HttpServletRequest) context.get("request"); + if (request != null && response != null) { + if (editRequest.indexOf("?") < 0) editRequest += "?"; + else editRequest += "&"; + editRequest += "contentId=" + expandedContentId; + ServletContext ctx = (ServletContext) request.getAttribute("servletContext"); + RequestHandler rh = (RequestHandler) ctx.getAttribute("_REQUEST_HANDLER_"); + urlString = rh.makeLink(request, response, editRequest, false, false, false); + } + + StringWriter sr = new StringWriter(); + sr.append("<@renderContentEnd "); + sr.append("urlString=\""); + sr.append(urlString); + sr.append("\" editMode=\""); + sr.append(editMode); + sr.append("\" editContainerStyle=\""); + sr.append(editContainerStyle); + sr.append("\" editRequest=\""); + sr.append(editRequest); + sr.append("\" enableEditValue=\""); + sr.append(enableEditValue); + sr.append("\" />"); + executeMacro(writer, sr.toString()); + } } public void renderContentFrame(Appendable writer, Map<String, Object> context, ModelScreenWidget.Content content) throws IOException { - // TODO: not implemented + String dataResourceId = content.getDataResourceId(context); + String urlString = "/ViewSimpleContent?dataResourceId=" + dataResourceId; + String width = content.getWidth(); + String height = content.getHeight(); + String border = content.getBorder(); + String fullUrlString = ""; + HttpServletRequest request = (HttpServletRequest) context.get("request"); + HttpServletResponse response = (HttpServletResponse) context.get("response"); + if (request != null && response != null) { + ServletContext ctx = (ServletContext) request.getAttribute("servletContext"); + RequestHandler rh = (RequestHandler) ctx.getAttribute("_REQUEST_HANDLER_"); + fullUrlString = rh.makeLink(request, response, urlString, true, false, false); + } + StringWriter sr = new StringWriter(); + sr.append("<@renderContentFrame "); + sr.append("fullUrl=\""); + sr.append(fullUrlString); + sr.append("\" width=\""); + sr.append(width); + sr.append("\" height=\""); + sr.append(height); + sr.append("\" border=\""); + sr.append(border); + sr.append("\" />"); + executeMacro(writer, sr.toString()); } public void renderSubContentBegin(Appendable writer, Map<String, Object> context, ModelScreenWidget.SubContent content) throws IOException { - // TODO: not implemented + String editRequest = content.getEditRequest(context); + String editContainerStyle = content.getEditContainerStyle(context); + String enableEditName = content.getEnableEditName(context); + String enableEditValue = (String)context.get(enableEditName); + + StringWriter sr = new StringWriter(); + sr.append("<@renderSubContentBegin "); + sr.append(" editContainerStyle=\""); + sr.append(editContainerStyle); + sr.append("\" editRequest=\""); + sr.append(editRequest); + sr.append("\" enableEditValue=\""); + sr.append(enableEditValue); + sr.append("\" />"); + executeMacro(writer, sr.toString()); } public void renderSubContentBody(Appendable writer, Map<String, Object> context, ModelScreenWidget.SubContent content) throws IOException { - // TODO: not implemented + // FIXME: copy those code from HtmlScreenRenderer.java + Locale locale = Locale.getDefault(); + String mimeTypeId = "text/html"; + String expandedContentId = content.getContentId(context); + String expandedMapKey = content.getMapKey(context); + String renderedContent = ""; + LocalDispatcher dispatcher = (LocalDispatcher) context.get("dispatcher"); + GenericDelegator delegator = (GenericDelegator) context.get("delegator"); + + // create a new map for the content rendering; so our current context does not get overwritten! + Map<String, Object> contentContext = FastMap.newInstance(); + contentContext.putAll(context); + + try { + if (WidgetContentWorker.contentWorker != null) { + renderedContent = WidgetContentWorker.contentWorker.renderSubContentAsTextExt(dispatcher, delegator, expandedContentId, expandedMapKey, contentContext, locale, mimeTypeId, true); + //Debug.logInfo("renderedContent=" + renderedContent, module); + } else { + Debug.logError("Not rendering content, WidgetContentWorker.contentWorker not found.", module); + } + if (UtilValidate.isEmpty(renderedContent)) { + String editRequest = content.getEditRequest(context); + if (UtilValidate.isNotEmpty(editRequest)) { + if (WidgetContentWorker.contentWorker != null) { + WidgetContentWorker.contentWorker.renderContentAsTextExt(dispatcher, delegator, "NOCONTENTFOUND", writer, contentContext, locale, mimeTypeId, true); + } else { + Debug.logError("Not rendering content, WidgetContentWorker.contentWorker not found.", module); + } + } + } else { + if (content.xmlEscape()) { + renderedContent = UtilFormatOut.encodeXmlValue(renderedContent); + } + + writer.append(renderedContent); + } + + } catch (GeneralException e) { + String errMsg = "Error rendering included content with id [" + expandedContentId + "] : " + e.toString(); + Debug.logError(e, errMsg, module); + //throw new RuntimeException(errMsg); + } catch (IOException e2) { + String errMsg = "Error rendering included content with id [" + expandedContentId + "] : " + e2.toString(); + Debug.logError(e2, errMsg, module); + //throw new RuntimeException(errMsg); + } } public void renderSubContentEnd(Appendable writer, Map<String, Object> context, ModelScreenWidget.SubContent content) throws IOException { - // TODO: not implemented + String editMode = "Edit"; + String editRequest = content.getEditRequest(context); + String editContainerStyle = content.getEditContainerStyle(context); + String enableEditName = content.getEnableEditName(context); + String enableEditValue = (String)context.get(enableEditName); + String expandedContentId = content.getContentId(context); + String expandedMapKey = content.getMapKey(context); + String urlString = ""; + if (editRequest != null && editRequest.toUpperCase().indexOf("IMAGE") > 0) { + editMode += " Image"; + } + if (UtilValidate.isNotEmpty(editRequest) && "true".equals(enableEditValue)) { + HttpServletResponse response = (HttpServletResponse) context.get("response"); + HttpServletRequest request = (HttpServletRequest) context.get("request"); + if (request != null && response != null) { + if (editRequest.indexOf("?") < 0) editRequest += "?"; + else editRequest += "&"; + editRequest += "contentId=" + expandedContentId; + if (UtilValidate.isNotEmpty(expandedMapKey)) { + editRequest += "&mapKey=" + expandedMapKey; + } + ServletContext ctx = (ServletContext) request.getAttribute("servletContext"); + RequestHandler rh = (RequestHandler) ctx.getAttribute("_REQUEST_HANDLER_"); + urlString = rh.makeLink(request, response, editRequest, false, false, false); + } + } + + StringWriter sr = new StringWriter(); + sr.append("<@renderSubContentEnd "); + sr.append("urlString=\""); + sr.append(urlString); + sr.append("\" editMode=\""); + sr.append(editMode); + sr.append("\" editContainerStyle=\""); + sr.append(editContainerStyle); + sr.append("\" editRequest=\""); + sr.append(editRequest); + sr.append("\" enableEditValue=\""); + sr.append(enableEditValue); + sr.append("\" />"); + executeMacro(writer, sr.toString()); } - public void appendWhitespace(Appendable writer) throws IOException { - // appending line ends for now, but this could be replaced with a simple space or something - writer.append("\r\n"); - } + public void renderScreenletBegin(Appendable writer, Map<String, Object> context, boolean collapsed, ModelScreenWidget.Screenlet screenlet) throws IOException { HttpServletRequest request = (HttpServletRequest) context.get("request"); HttpServletResponse response = (HttpServletResponse) context.get("response"); @@ -203,33 +583,22 @@ if (tabMenu != null) { tabMenu.renderWidgetString(writer, context, this); } - StringWriter sr = new StringWriter(); - sr.append("<@renderScreenletBegin "); - sr.append("id=\""); - sr.append(screenlet.getId(context)); - sr.append("\" />"); - executeMacro(writer, sr.toString()); - + String title = screenlet.getTitle(context); boolean collapsible = screenlet.collapsible(); ModelScreenWidget.Menu navMenu = screenlet.getNavigationMenu(); ModelScreenWidget.Form navForm = screenlet.getNavigationForm(); - String collapsibleAreaId = null; - if (UtilValidate.isNotEmpty(title) || navMenu != null || navForm != null || collapsible) { - writer.append("<div class=\"screenlet-title-bar\">"); - appendWhitespace(writer); - writer.append("<ul>"); - appendWhitespace(writer); - if (UtilValidate.isNotEmpty(title)) { - writer.append("<li class=\"h3\">"); - writer.append(title); - writer.append("</li>"); - appendWhitespace(writer); - } + String collapsibleAreaId = ""; + String expandToolTip = ""; + String collapseToolTip = ""; + String fullUrlString = ""; + boolean padded = screenlet.padded(); + String menuString = ""; + boolean showMore = false; + if (UtilValidate.isNotEmpty(title) || navMenu != null || navForm != null || collapsible) { + showMore = true; if (collapsible) { collapsibleAreaId = this.getNextElementId(); - String expandToolTip = null; - String collapseToolTip = null; Map<String, Object> uiLabelMap = UtilGenerics.checkMap(context.get("uiLabelMap")); Map<String, Object> paramMap = UtilGenerics.checkMap(context.get("requestParameters")); Map<String, Object> requestParameters = new HashMap<String, Object>(paramMap); @@ -237,65 +606,55 @@ expandToolTip = (String) uiLabelMap.get("CommonExpand"); collapseToolTip = (String) uiLabelMap.get("CommonCollapse"); } - writer.append("<li class=\""); - if (collapsed) { - writer.append("collapsed\"><a "); - if (javaScriptEnabled) { - writer.append("onclick=\"javascript:toggleScreenlet(this, '" + collapsibleAreaId + "', '" + expandToolTip + "', '" + collapseToolTip + "');\""); - } else { - requestParameters.put(screenlet.getPreferenceKey(context) + "_collapsed", "false"); - String queryString = UtilHttp.urlEncodeArgs(requestParameters); - writer.append("href=\"" + request.getRequestURI() + "?" + queryString + "\""); - } - if (UtilValidate.isNotEmpty(expandToolTip)) { - writer.append(" title=\"" + expandToolTip + "\""); - } - } else { - writer.append("expanded\"><a "); - if (javaScriptEnabled) { - writer.append("onclick=\"javascript:toggleScreenlet(this, '" + collapsibleAreaId + "', '" + expandToolTip + "', '" + collapseToolTip + "');\""); - } else { - requestParameters.put(screenlet.getPreferenceKey(context) + "_collapsed", "true"); - String queryString = UtilHttp.urlEncodeArgs(requestParameters); - writer.append("href=\"" + request.getRequestURI() + "?" + queryString + "\""); - } - if (UtilValidate.isNotEmpty(collapseToolTip)) { - writer.append(" title=\"" + collapseToolTip + "\""); - } - } - writer.append("> </a></li>"); - appendWhitespace(writer); + if (!javaScriptEnabled){ + requestParameters.put(screenlet.getPreferenceKey(context) + "_collapsed", "false"); + String queryString = UtilHttp.urlEncodeArgs(requestParameters); + fullUrlString = request.getRequestURI() + "?" + queryString; + } } if (!collapsed) { + StringBuilder sb = new StringBuilder(); if (navMenu != null) { MenuStringRenderer savedRenderer = (MenuStringRenderer) context.get("menuStringRenderer"); MenuStringRenderer renderer = new ScreenletMenuRenderer(request, response); context.put("menuStringRenderer", renderer); - navMenu.renderWidgetString(writer, context, this); + navMenu.renderWidgetString(sb, context, this); context.put("menuStringRenderer", savedRenderer); } else if (navForm != null) { - renderScreenletPaginateMenu(writer, context, navForm); + renderScreenletPaginateMenu(sb, context, navForm); } + menuString = sb.toString(); } - writer.append("</ul>"); - appendWhitespace(writer); - writer.append("<br class=\"clear\" />"); - appendWhitespace(writer); - writer.append("</div>"); - appendWhitespace(writer); - writer.append("<div"); - if (UtilValidate.isNotEmpty(collapsibleAreaId)) { - writer.append(" id=\"" + collapsibleAreaId + "\""); - if (collapsed) { - writer.append(" style=\"display: none;\""); - } - } - if (screenlet.padded()) { - writer.append(" class=\"screenlet-body\""); - } - writer.append(">"); - appendWhitespace(writer); } + + StringWriter sr = new StringWriter(); + sr.append("<@renderScreenletBegin "); + sr.append("id=\""); + sr.append(screenlet.getId(context)); + sr.append("\" title=\""); + sr.append(title); + sr.append("\" collapsible="); + sr.append(Boolean.toString(collapsible)); + sr.append(" collapsibleAreaId=\""); + sr.append(collapsibleAreaId); + sr.append("\" expandToolTip=\""); + sr.append(expandToolTip); + sr.append("\" collapseToolTip=\""); + sr.append(collapseToolTip); + sr.append("\" fullUrlString=\""); + sr.append(fullUrlString); + sr.append("\" padded="); + sr.append(Boolean.toString(padded)); + sr.append(" menuString=\""); + sr.append(menuString); + sr.append("\" showMore="); + sr.append(Boolean.toString(showMore)); + sr.append(" collapsed="); + sr.append(Boolean.toString(collapsed)); + sr.append(" javaScriptEnabled="); + sr.append(Boolean.toString(javaScriptEnabled)); + sr.append(" />"); + executeMacro(writer, sr.toString()); } public void renderScreenletSubWidget(Appendable writer, Map<String, Object> context, ModelScreenWidget subWidget, ModelScreenWidget.Screenlet screenlet) throws GeneralException, IOException { @@ -399,70 +758,77 @@ String linkText; - appendWhitespace(writer); + // The current screenlet title bar navigation syling requires rendering // these links in reverse order // Last button - writer.append("<li class=\"" + modelForm.getPaginateLastStyle()); + String paginateLastStyle = modelForm.getPaginateLastStyle(); + String paginateLastLabel = modelForm.getPaginateLastLabel(context); + String lastLinkUrl = ""; if (highIndex < listSize) { - writer.append("\"><a href=\""); int page = (listSize / viewSize) - 1; linkText = prepLinkText + page + anchor; - // - make the link - writer.append(rh.makeLink(request, response, linkText)); - writer.append("\">" + modelForm.getPaginateLastLabel(context) + "</a>"); - } else { - // disabled button - writer.append(" disabled\">" + modelForm.getPaginateLastLabel(context)); - } - writer.append("</li>"); - appendWhitespace(writer); - // Next button - writer.append("<li class=\"" + modelForm.getPaginateNextStyle()); + lastLinkUrl = rh.makeLink(request, response, linkText); + } + String paginateNextStyle = modelForm.getPaginateNextStyle(); + String paginateNextLabel = modelForm.getPaginateNextLabel(context); + String nextLinkUrl = ""; if (highIndex < listSize) { - writer.append("\"><a href=\""); linkText = prepLinkText + (viewIndex + 1) + anchor; // - make the link - writer.append(rh.makeLink(request, response, linkText)); - writer.append("\">" + modelForm.getPaginateNextLabel(context) + "</a>"); - } else { - // disabled button - writer.append(" disabled\">" + modelForm.getPaginateNextLabel(context)); - } - writer.append("</li>"); - appendWhitespace(writer); - if (listSize > 0) { - writer.append("<li>"); - writer.append((lowIndex + 1) + " - " + (lowIndex + actualPageSize ) + " " + ofLabel + " " + listSize); - writer.append("</li>"); - appendWhitespace(writer); - } - // Previous button - writer.append("<li class=\"nav-previous"); + nextLinkUrl = rh.makeLink(request, response, linkText); + } + String paginatePreviousStyle = modelForm.getPaginatePreviousStyle(); + String paginatePreviousLabel = modelForm.getPaginatePreviousLabel(context); + String previousLinkUrl = ""; if (viewIndex > 0) { - writer.append("\"><a href=\""); linkText = prepLinkText + (viewIndex - 1) + anchor; - // - make the link - writer.append(rh.makeLink(request, response, linkText)); - writer.append("\">" + modelForm.getPaginatePreviousLabel(context) + "</a>"); - } else { - // disabled button - writer.append(" disabled\">" + modelForm.getPaginatePreviousLabel(context)); - } - writer.append("</li>"); - appendWhitespace(writer); - // First button - writer.append("<li class=\"nav-first"); + previousLinkUrl = rh.makeLink(request, response, linkText); + } + String paginateFirstStyle = modelForm.getPaginateFirstStyle(); + String paginateFirstLabel = modelForm.getPaginateFirstLabel(context); + String firstLinkUrl = ""; if (viewIndex > 0) { - writer.append("\"><a href=\""); linkText = prepLinkText + 0 + anchor; - writer.append(rh.makeLink(request, response, linkText)); - writer.append("\">" + modelForm.getPaginateFirstLabel(context) + "</a>"); - } else { - writer.append(" disabled\">" + modelForm.getPaginateFirstLabel(context)); + firstLinkUrl = rh.makeLink(request, response, linkText); } - writer.append("</li>"); - appendWhitespace(writer); + + StringWriter sr = new StringWriter(); + sr.append("<@renderScreenletPaginateMenu "); + sr.append("lowIndex=\""); + sr.append(Integer.toString(lowIndex)); + sr.append("\" actualPageSize=\""); + sr.append(Integer.toString(actualPageSize)); + sr.append("\" ofLabel=\""); + sr.append(ofLabel); + sr.append("\" listSize=\""); + sr.append(Integer.toString(listSize)); + sr.append("\" paginateLastStyle=\""); + sr.append(paginateLastStyle); + sr.append("\" lastLinkUrl=\""); + sr.append(lastLinkUrl); + sr.append("\" paginateLastLabel=\""); + sr.append(paginateLastLabel); + sr.append("\" paginateNextStyle=\""); + sr.append(paginateNextStyle); + sr.append("\" nextLinkUrl=\""); + sr.append(nextLinkUrl); + sr.append("\" paginateNextLabel=\""); + sr.append(paginateNextLabel); + sr.append("\" paginatePreviousStyle=\""); + sr.append(paginatePreviousStyle); + sr.append("\" paginatePreviousLabel=\""); + sr.append(paginatePreviousLabel); + sr.append("\" previousLinkUrl=\""); + sr.append(previousLinkUrl); + sr.append("\" paginateFirstStyle=\""); + sr.append(paginateFirstStyle); + sr.append("\" paginateFirstLabel=\""); + sr.append(paginateFirstLabel); + sr.append("\" firstLinkUrl=\""); + sr.append(firstLinkUrl); + sr.append("\" />"); + executeMacro(writer, sr.toString()); } } Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenViewHandler.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenViewHandler.java?rev=759086&r1=759085&r2=759086&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenViewHandler.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenViewHandler.java Fri Mar 27 10:11:46 2009 @@ -88,7 +88,7 @@ } ScreenStringRenderer screenStringRenderer = new MacroScreenRenderer(UtilProperties.getPropertyValue("widget", getName() + ".screenrenderer"), writer); - FormStringRenderer formStringRenderer = new MacroFormRenderer(UtilProperties.getPropertyValue("widget", getName() + ".formrenderer"), writer); + FormStringRenderer formStringRenderer = new MacroFormRenderer(UtilProperties.getPropertyValue("widget", getName() + ".formrenderer"), writer, request, response); ScreenRenderer screens = new ScreenRenderer(writer, null, screenStringRenderer); screens.populateContextForRequest(request, response, servletContext); Added: ofbiz/trunk/framework/widget/templates/htmlFormMacroLibrary.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/templates/htmlFormMacroLibrary.ftl?rev=759086&view=auto ============================================================================== --- ofbiz/trunk/framework/widget/templates/htmlFormMacroLibrary.ftl (added) +++ ofbiz/trunk/framework/widget/templates/htmlFormMacroLibrary.ftl Fri Mar 27 10:11:46 2009 @@ -0,0 +1,201 @@ +<#-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +<#macro renderField text><#if text?exists>${text}</#if></#macro> + +<#macro renderDisplayField idName description class alert> +<#if class?has_content || alert=="true"><span class="<#if class?has_content>${class}<#if alert=="true"> alert</#if>"</#if>><#rt/></#if> +<#if description?has_content>${description}<#else> </#if><#if class?has_content || alert=="true"></span></#if> +</#macro> +<#macro renderHyperlinkField></#macro> + +<#macro renderTextField name className alert value textSize maxlength id event action clientAutocomplete ajaxUrl ajaxEnabled> +<input type="text" name="${name?default("")?html}"<#rt/> +<@renderClass className alert /> +<#if value?has_content> value="${value}"</#if><#if textSize?has_content> size="${textSize}"</#if><#if maxlength?has_content> maxlength="${maxlength}"</#if><#rt/> +<#if id?has_content> id="${id}"</#if><#if event?has_content && action?has_content>${event}="${action}"</#if><#if clientAutocomplete?has_content && clientAutocomplete=="false"> autocomplete="off"</#if>/><#rt/> +<#if ajaxEnabled?has_content && ajaxEnabled> +<script language="JavaScript" type="text/javascript">ajaxAutoCompleter('${ajaxUrl}');</script> +</#if> +</#macro> + +<#macro renderTextareaField name className alert cols rows id readonly value visualEdtiorEnalble buttons> +<textarea name="${name}" <@renderClass className alert /><#if cols?has_content> cols="${cols}"</#if><#if rows?has_content> rows="${rows}"</#if><#if id?has_content> id="${id}"</#if><#if readonly?has_content> ${readonly}</#if>><#rt/> +<#if value?has_content> ${value}</#if><#if maxlength?has_content> maxlength="${maxlength}"</#if></textarea><#rt/> +<#if visualEdtiorEnalble?has_content> + <script language="javascript" src="/images/htmledit/whizzywig.js" type="text/javascript"></script><#rt/> + <script language="javascript" type="text/javascript"> buttonPath = "/images/htmledit/"; cssFile="/images/htmledit/simple.css";makeWhizzyWig("<#rt/> +<#if id?has_content> "${id}"</#if>","<#if buttons?has_content> "${buttons}"</#if>")</script> +</#if> +</#macro> + +<#macro renderDateTimeField name className alert title value size maxlength id dateType shortDateInput timeDropdownParamName defaultDateTimeString calGif localizedIconTitle timeDropdown timeHourName classString hour1 hour2 timeMinutesName minutes isTwelveHour ampmName amSelected pmSelected compositeType formName> +<input type="text" name="${name}" <@renderClass className alert /><#rt/> +<#if title?has_content> title="${title}"</#if><#if value?has_content> value="${value}"</#if><#if size?has_content> size="${size}"</#if><#rt/> +<#if maxlength?has_content> maxlength="${maxlength}"</#if><#if id?has_content> id="${id}"</#if>/><#rt/> +<#if dateType!="time" > +<#if shortDateInput?exists && shortDateInput> + <a href="javascript:call_cal_notime(document.<#rt/> +<#else> + <a href="javascript:call_cal(document.<#rt/> +</#if> +${formName}.<#if timeDropdownParamName?has_content>${timeDropdownParamName},'</#if><#if defaultDateTimeString?has_content>${defaultDateTimeString},');"></#if><#rt/> +<#if calGif?has_content><img src="${calGif}" width="16" height="16" border="0" alt="<#if localizedIconTitle?has_content>${localizedIconTitle}</#if>" title="<#if localizedIconTitle?has_content>${localizedIconTitle}</#if>"/><#rt/></#if> +</a><#rt/> +</#if> +<#if timeDropdown?has_content && timeDropdown=="time-dropdown"> + <select name="${timeHourName}" <#if classString?has_content>class="${classString}"</#if>><#rt/> + <#if isTwelveHour> +<#assign x=11> +<#list 1..x as i> +<option value="${i}" <#if hour1?has_content><#if i=hour1>selected</#if></#if>>${i}</option><#rt/> +</#list> +<#else> +<#assign x=23> +<#list 1..x as i> +<option value="${i}"<#if hour2?has_content><#if i=hour2> selected</#if></#if>>${i}</option><#rt/> +</#list> +</#if> +</select>:<select name="${timeMinutesName}" <#if classString?has_content>class="${classString}"</#if>><#rt/> +<#assign x=59> +<#list 1..x as i> +<option value="${i}"<#if minutes?has_content><#if i=minutes> selected</#if></#if>>${i}</option><#rt/> +</#list> +</select><#rt/> +<#if isTwelveHour> + <select name="${ampmName}" <#if classString?has_content>class="${classString}"</#if>><#rt/> + <option value="AM" ${amSelected}>AM</option><#rt/> + <option value="PM" ${pmSelected}>PM</option><#rt/> + </select><#rt/> +</#if> +<input type="hidden" name="${compositeType}" value="Timestamp"/> +</#if> +</#macro> + +<#macro renderDropDownField name className alert id multiple formName otherFieldName event action size firstInList currentValue explicitDescription allowEmpty options fieldName otherFieldName otherValue otherFieldSize> +<select name="${name?default("")}" <@renderClass className alert /><#if id?has_content> id="${id}"</#if><#if multiple?has_content> multiple="multiple"</#if><#if otherFieldSize?has_content> onchange="process_choice(this,document.${formName}.${otherFieldName})"</#if><#if event?has_content> ${event}="${action}"</#if><#if size?has_content> size="${size}"</#if>> +<#if firstInList?has_content && currentValue?has_content> + <option selected="selected" value="${currentValue}">${explicitDescription}</option><#rt/> + <option value="${currentValue}">---</option><#rt/> +</#if> +<#if allowEmpty?has_content> +<option value=""> </option> +</#if> +<#list options as item> +<option<#if currentValue?has_content && currentValue == item.key && dDFCurrent?has_content && "selected" == dDFCurrent> selected="selected"<#elseif !currentValue?has_content && noCurrentSelectedKey?has_content && noCurrentSelectedKey == item.key> selected="selected"</#if> value="${item.key}">${item.description}</option><#rt/> +</#list> +</select> +<#if otherFieldName?has_content> +<noscript><input type='text' name='${otherFieldName}' /></noscript> +<script type='text/javascript' language='JavaScript'><!-- +disa = ' disabled'; +if(other_choice(document.${formName}.${fieldName})) + disa = ''; +document.write("<input type='text' name='${otherFieldName}' value='${otherValue}' size='${otherFieldSize}'"+disa+" onfocus='check_choice(document.${formName}.${fieldName})' />"); +if(disa && document.styleSheets) + document.${formName}.${fieldName}.style.visibility = 'hidden'; +//--></script> +</#if> +</#macro> + +<#macro renderCheckField items className alert allChecked currentValue name event action> +<#list items as item> +<input type="checkbox" <@renderClass className alert /><#rt/> +<#if allChecked?has_content && allChecked> checked="checked" <#elseif allChecked?has_content && !allChecked><#elseif currentValue?has_content && currentValue==item.key> checked="checked"</#if> name="${name?default("")?html}" value="${item.key?default("")?html}"<#if event?has_content> ${event}="${action}"</#if>/><#rt/> +${item.description} +</#list> +</#macro> +<#macro renderRadioField items className alert currentValue noCurrentSelectedKey name event ation> +<#list items as item> +<div <@renderClass className alert />><#rt/> +<input type="radio"<#if currentValue?has_content><#if rp.currentValue==item.key> checked="checked"</#if><#elseif noCurrentSelectedKey?has_content && noCurrentSelectedKey == item.key> checked="checked"</#if> name="${name?default("")?html}" value="${item.key?default("")?html}"<#if event?has_content> ${event}="${action}"</#if>/><#rt/> +${item.description}</div> +</#list> +</#macro> + +<#macro renderSubmitField buttonType className alert formName title name event action imgSrc> +<#if buttonType=="text-link"> + <a <@renderClass className alert /> href="javascript:document.${formName}.submit()"><#if title?has_content> title="${title}"</#if> </a> +<#elseif buttonType=="image"> + <input type="image" src="${imgSrc}" <#if className?has_content> class="${className}</#if><#if alert?has_content> ${alert}</#if>"<#if name?has_content> name="${name}"</#if><#if title?has_content> alt="${title}"</#if><#if event?has_content> ${event}="${action}"</#if> /> +<#else> +<input type="submit" <#if className?has_content> class="${className}</#if><#if alert?has_content> ${alert}</#if>"<#if name?exists> name="${name}"</#if><#if title?has_content> value="${title}"</#if><#if event?has_content> ${event}="${action}"</#if> /></#if> +</#macro> +<#macro renderResetField className alert name title><input type="reset" <@renderClass className alert /> name="${name}"<#if title?has_content> value="${title}"</#if>/></#macro> + +<#macro renderHiddenField name value><input type="hidden" name="${name}"<#if value?has_content> value="${value}"</#if>/></#macro> +<#macro renderIgnoredField></#macro> + +<#macro renderFieldTitle style title><#if style?has_content><span class="${style}></#if>${title}<#if style?has_content></span></#if></#macro> +<#macro renderSingleFormFieldTitle></#macro> + +<#macro renderFormOpen linkUrl formType targetWindow containerId containerStyle autocomplete name useRowSubmit><form method="post" action="${linkUrl}"<#if formType=="upload"> enctype="multipart/form-data"</#if><#if targetWindow?has_content> target="${targetWindow}"</#if><#if containerId?has_content> id="${containerId}"</#if> class=<#if containerStyle?has_content>"${containerStyle}"<#else>"basic-form"</#if> onSubmit="javascript:submitFormDisableSubmits(this)"<#if autocomplete?has_content> autocomplete="${autocomplete}"</#if> name="${name}" <#if useRowSubmit?has_content && useRowSubmit><input type="hidden" name="_useRowSubmit" value="Y"/></#if>></#macro> +<#macro renderFormClose focusFieldName formName></form><#if focusFieldName?has_content><script language="JavaScript" type="text/javascript">document.${formName}.${focusFieldName}.focus();</script></#if></#macro> +<#macro renderMultiFormClose></#macro> + +<#macro renderFormatListWrapperOpen style> <table cellspacing="0" class="<#if style?has_content>${style}<#else>basic-table form-widget-table dark-grid</#if>" > </#macro> +<#macro renderFormatListWrapperClose> </table></#macro> + +<#macro renderFormatHeaderRowOpen style> <tr class="<#if style?has_content>${style}<#else>header-row</#if>"></#macro> +<#macro renderFormatHeaderRowClose> </tr></#macro> +<#macro renderFormatHeaderRowCellOpen style positionSpan> <td <#if positionSpan?has_content && positionSpan gt 1 >colspan="${positionSpan}"</#if><#if style?has_content>class="${style}"</#if></#macro> +<#macro renderFormatHeaderRowCellClose></td></#macro> + +<#macro renderFormatHeaderRowFormCellOpen style> <td <#if style?has_content>class="${style}"</#if>></#macro> +<#macro renderFormatHeaderRowFormCellClose></td></#macro> +<#macro renderFormatHeaderRowFormCellTitleSeparator style isLast><#if style?has_content><sapn class="${style}"></#if> - <#if style?has_content></span></#if></#macro> + +<#macro renderFormatItemRowOpen itemIndex altRowStyles evenRowStyle oddRowStyle> <tr <#if itemIndex?has_content><#if itemIndex%2==0><#if evenRowStyle?has_content>class="${evenRowStyle}<#if altRowStyles?has_content> ${altRowStyles}</#if>"<#elseif altRowStyles?has_content>class="${altRowStyles}"</#if><#else><#if oddRowStyle?has_content>class="${oddRowStyle}<#if altRowStyles?has_content> ${altRowStyles}</#if>"<#elseif altRowStyles?has_content>class="${altRowStyles}"</#if></#if></#if> ></#macro> +<#macro renderFormatItemRowClose> </tr></#macro> +<#macro renderFormatItemRowCellOpen style positionSpan> <td <#if positionSpan?has_content && positionSpan >1>colspan="${positionSpan}"</#if><#if style?has_content>class="${style}"</#if></#macro> +<#macro renderFormatItemRowCellClose> </td></#macro> +<#macro renderFormatItemRowFormCellOpen style> <td<#if style?has_content> class="${style}"</#if>></#macro> +<#macro renderFormatItemRowFormCellClose></td></#macro> + +<#macro renderFormatSingleWrapperOpen style> <table cellspacing="0" <#if style?has_content>class="${style}"</#if> ></#macro> +<#macro renderFormatSingleWrapperClose> </table></#macro> + +<#macro renderFormatFieldRowOpen> <tr></#macro> +<#macro renderFormatFieldRowClose> </tr></#macro> +<#macro renderFormatFieldRowTitleCellOpen style> <td class="<#if style?has_content>${style}<#else>label</#if>"></#macro> +<#macro renderFormatFieldRowTitleCellClose></td></#macro> +<#macro renderFormatFieldRowSpacerCell></#macro> +<#macro renderFormatFieldRowWidgetCellOpen positionSpan style> <td<#if positionSpan?has_content && positionSpan gt 0> colspan="${1+positionSpan*3}"</#if><#if style?has_content> class="${style}"</#if>></#macro> +<#macro renderFormatFieldRowWidgetCellClose></td></#macro> + +<#macro renderFormatEmptySpace> </#macro> + +<#macro renderTextFindField></#macro> +<#macro renderDateFindField></#macro> +<#macro renderRangeFindField></#macro> +<#macro renderLookupField></#macro> +<#macro renderFileField></#macro> +<#macro renderPasswordField></#macro> +<#macro renderImageField></#macro> +<#macro renderBanner></#macro> +<#macro renderFieldGroupOpen></#macro> +<#macro renderFieldGroupClose></#macro> + +<#macro renderHyperlinkTitle name title><#if title?has_content>${title}<br/></#if><input type="checkbox" name="selectAll" value="Y" onclick="javascript:toggleAll(this, '${name}');"/></#macro> +<#macro renderSortField style title linkUrl ajaxEnabled><a<#if style?has_content> class="${style}"</#if> href="<#if ajaxEnabled?has_content && ajaxEnabled>javascript:ajaxUpdateAreas('${linkUrl}')<#else>${linkUrl}</#if>">${title}</a></#macro> +<#macro formatBoundaryComment boundaryType widgetType widgetName><!-- ${boundaryType} ${widgetType} ${widgetName} --></#macro> + +<#macro renderTooltip tooltip tooltipStyle><#if tooltip?has_content><span class="<#if tooltipStyle?exists>${tooltipStyle}<#else>tooltip</#if>">${tooltip}</span><#rt/></#if></#macro> +<#macro renderClass className alert><#if className?has_content>class="${className}</#if><#if alert?exists> ${alert}</#if><#if className?exists>"<#rt/></#if></#macro> +<#macro renderAsterisks requiredField requiredStyle><#if requiredField=="true"><#if requiredStyle?has_content>*</#if></#if></#macro> \ No newline at end of file Propchange: ofbiz/trunk/framework/widget/templates/htmlFormMacroLibrary.ftl ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/framework/widget/templates/htmlFormMacroLibrary.ftl ------------------------------------------------------------------------------ svn:keywords = Date Rev Author URL Id Propchange: ofbiz/trunk/framework/widget/templates/htmlFormMacroLibrary.ftl ------------------------------------------------------------------------------ svn:mime-type = text/plain Modified: ofbiz/trunk/framework/widget/templates/htmlScreenMacroLibrary.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/templates/htmlScreenMacroLibrary.ftl?rev=759086&r1=759085&r2=759086&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/templates/htmlScreenMacroLibrary.ftl (original) +++ ofbiz/trunk/framework/widget/templates/htmlScreenMacroLibrary.ftl Fri Mar 27 10:11:46 2009 @@ -24,23 +24,71 @@ <#if autoUpdateLink?has_content> <script type="text/javascript">ajaxUpdateAreaPeriodic('${id}', '${autoUpdateLink}', '', '${autoUpdateInterval}');</script> </#if> -<div<#if id?hasContent> id="${id}"</#if><#if style?hasContent> class="${style}"</#if>> +<div<#if id?has_content> id="${id}"</#if><#if style?has_content> class="${style}"</#if>> </#macro> <#macro renderContainerEnd></div></#macro> -<#macro renderContentBegin></#macro> +<#macro renderContentBegin editRequest enableEditValue editContainerStyle><#if editRequest?has_content && enableEditValue><div class=${editContainerStyle}></#if></#macro> <#macro renderContentBody></#macro> -<#macro renderContentEnd></#macro> -<#macro renderSubContentBegin></#macro> +<#macro renderContentEnd urlString editMode editContainerStyle editRequest enableEditValue> +<#if editRequest?exists && enableEditValue> +<#if urlString?exists><a href="${urlString}">${editMode}</a><#rt/></#if> +<#if editContainerStyle?exists></div><#rt/></#if> +</#if> +</#macro> +<#macro renderSubContentBegin editContainerStyle editRequest enableEditValue><#if editRequest?exists && enableEditValue><div class="${editContainerStyle}"></#if></#macro> <#macro renderSubContentBody></#macro> -<#macro renderSubContentEnd></#macro> +<#macro renderSubContentEnd> +<#if editRequest?exists && enableEditValue> +<#if urlString?exists><a href="${urlString}">${editMode}</a><#rt/></#if> +<#if editContainerStyle?exists></div><#rt/></#if> +</#if> +</#macro> -<#macro renderHorizontalSeparator id style><hr<#if id?hasContent> id="${id}"</#if><#if style?hasContent> class="${style}"</#if>/></#macro> -<#macro renderLabel text id style><#if text?exists><#if id?has_content || style?has_content><span<#if id?hasContent> id="${id}"</#if><#if style?hasContent> class="${style}"</#if>></#if>${text}<#if id?has_content || style?has_content></span></#if></#if></#macro> -<#macro renderLink></#macro> -<#macro renderImage></#macro> +<#macro renderHorizontalSeparator id style><hr<#if id?has_content> id="${id}"</#if><#if style?has_content> class="${style}"</#if>/></#macro> +<#macro renderLabel text id style><#if text?exists><#if id?has_content || style?has_content><span<#if id?has_content> id="${id}"</#if><#if style?has_content> class="${style}"</#if>></#if>${text}<#if id?has_content || style?has_content></span></#if></#if></#macro> +<#macro renderLink parameterList targetWindow target uniqueItemName linkType actionUrl id style name linkUrl text imgStr> +<#if "hidden-form" == linkType> +<form method="post" action="${actionUrl}" <#if targetWindow?has_content>target="${targetWindow}"</#if> onSubmit="javascript:submitFormDisableSubmits(this)" name="${uniqueItemName}"><#rt/> +<#list parameterList as parameter> +<input name="${parameter.name}" value="${parameter.value}" type="hidden"/><#rt/> +</#list> +</form><#rt/> +</#if> +<a <#if id?has_content>id="${id}"</#if> <#if style?has_content>class="${style}"</#if> <#if name?has_content>name="${name}"</#if> <#if targetWindow?has_content>target="${targetWindow}"</#if> href="<#if "hidden-form"==linkType>javascript:document.${uniqueItemName}.submit()<#else>${linkUrl}</#if>"><#rt/> +<#if image?has_content>${imgStr}<#else><#if text?has_content>${text}</#if></#if></a> +</#macro> +<#macro renderImage src id style wid hgt border alt urlString> +<#if src?has_content> +<img <#if id?has_content>id="${id}"</#if><#if style?has_content> class="${style}"</#if><#if wid?has_content> width="${wid}"</#if><#if hgt?has_content> height="${hgt}"</#if><#if border?has_content> border="${border}"</#if><#if alt?has_content> alt="${alt}"</#if> src="${urlString}" /> +</#if> +</#macro> -<#macro renderContentFrame></#macro> -<#macro renderScreenletBegin id><div class="screenlet"<#if id?hasContent> id="${id}"</#if>></#macro> +<#macro renderContentFrame fullUrl width height border><iframe src="${fullUrl}" width="${width}" height="${height}" <#if border?has_content>border="${border}"</#if> /></#macro> +<#macro renderScreenletBegin id title collapsible collapsibleAreaId expandToolTip collapseToolTip fullUrlString padded menuString showMore collapsed javaScriptEnabled> +<div class="screenlet"<#if id?has_content> id="${id}"</#if>><#rt/> +<#if showMore> +<div class="screenlet-title-bar"><ul><#if title?has_content><li class="h3">${title}</li></#if> +<#if collapsible> +<li class="<#rt/> +<#if collapsed> +collapsed"><a <#if javaScriptEnabled>onclick="javascript:toggleScreenlet(this, '${collapsibleAreaId}', '${expandToolTip}', '${collapseToolTip}');"<#else>href="${fullUrlString}"</#if><#if expandToolTip?has_content> title="${expandToolTip}"</#if> +<#else> +expanded"><a <#if javaScriptEnabled>onclick="javascript:toggleScreenlet(this, '${collapsibleAreaId}', '${expandToolTip}', '${collapseToolTip}');"<#else>href="${fullUrlString}"</#if><#if expandToolTip?has_content> title="${expandToolTip}"</#if> +</#if> +> </a></li> +</#if> +<#if !collapsed> +${menuString} +</#if> +</ul><br class="clear" /></div><div <#if collapsibleAreaId?has_content> id="${collapsibleAreaId}" <#if collapsed> style="${collapsed}display: none;"</#if></#if><#if padded> class="screenlet-body"</#if>> +</#if> +</#macro> <#macro renderScreenletSubWidget></#macro> <#macro renderScreenletEnd></div></div></#macro> - +<#macro renderScreenletPaginateMenu> +<li class="${paginateLastStyle}<#if lastLinkUrl?has_content>"><a href="${lastLinkUrl}">${paginateLastLabel}</a><#else> disabled">${paginateLastLabel}</#if></li><#rt/> +<li class="${paginateNextStyle}<#if nextLinkUrl?has_content>"><a href="${nextLinkUrl}">${paginateNextLabel}</a><#else> disabled">${paginateNextLabel}</#if></li><#rt/> +<#if listSize>0>${lowIndex + 1}" - "${lowIndex + actualPageSize}" "${ofLabel}" "${listSize}<#rt/></#if> +<li class="${paginatePreviousStyle}<#if previousLinkUrl?has_content>"><a href="${previousLinkUrl}">${paginatePreviousLabel}</a><#else> disabled">${paginatePreviousLabel}</#if></li><#rt/> +<li class="${paginateFirstStyle}<#if firstLinkUrl?has_content>"><a href="${firstLinkUrl}">${paginateFirstLabel}</a><#else> disabled">${paginateFirstLabel}</#if></li> +</#macro> |
Free forum by Nabble | Edit this page |