Author: adrianc
Date: Thu Apr 23 17:54:30 2009 New Revision: 767996 URL: http://svn.apache.org/viewvc?rev=767996&view=rev Log: Some work on the screen widgets: 1. Added renderScreenBegin and renderScreenEnd methods to ScreenStringRenderer.java. 2. Updated HtmlScreenRenderer.java and MacroScreenRenderer.java to emit the <DOCTYPE> element first - before any widget comments or template content. 3. Removed <DOCTYPE> elements from templates that no longer need them. 4. Added screen and section boundary comments to MacroScreenRenderer.java. Modified: ofbiz/trunk/applications/order/webapp/ordermgr/request/CompletedCustRequestNotification.ftl ofbiz/trunk/applications/order/webapp/ordermgr/request/CreateCustRequestNotification.ftl ofbiz/trunk/applications/party/templates/email/ChangePersonalInfoNotification.ftl ofbiz/trunk/applications/party/templates/email/CreatePartyNotification.ftl ofbiz/trunk/applications/party/templates/email/VerifyEmailAddressNotification.ftl ofbiz/trunk/applications/workeffort/webapp/workeffort/workeffort/EventReminderEmail.ftl ofbiz/trunk/framework/common/webcommon/includes/insertDropDown.ftl ofbiz/trunk/framework/common/webcommon/includes/lookup.ftl ofbiz/trunk/framework/common/webcommon/includes/simple.ftl ofbiz/trunk/framework/widget/src/org/ofbiz/widget/fo/FoScreenRenderer.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlScreenRenderer.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ScreenRenderer.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ScreenStringRenderer.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/text/TextScreenRenderer.java ofbiz/trunk/framework/widget/templates/htmlScreenMacroLibrary.ftl ofbiz/trunk/themes/bluelight/includes/header.ftl ofbiz/trunk/themes/flatgrey/includes/header.ftl ofbiz/trunk/themes/smoothfeather/includes/header.ftl Modified: ofbiz/trunk/applications/order/webapp/ordermgr/request/CompletedCustRequestNotification.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/request/CompletedCustRequestNotification.ftl?rev=767996&r1=767995&r2=767996&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/request/CompletedCustRequestNotification.ftl (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/request/CompletedCustRequestNotification.ftl Thu Apr 23 17:54:30 2009 @@ -16,7 +16,6 @@ specific language governing permissions and limitations under the License. --> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> Modified: ofbiz/trunk/applications/order/webapp/ordermgr/request/CreateCustRequestNotification.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/request/CreateCustRequestNotification.ftl?rev=767996&r1=767995&r2=767996&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/request/CreateCustRequestNotification.ftl (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/request/CreateCustRequestNotification.ftl Thu Apr 23 17:54:30 2009 @@ -16,7 +16,6 @@ specific language governing permissions and limitations under the License. --> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> Modified: ofbiz/trunk/applications/party/templates/email/ChangePersonalInfoNotification.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/templates/email/ChangePersonalInfoNotification.ftl?rev=767996&r1=767995&r2=767996&view=diff ============================================================================== --- ofbiz/trunk/applications/party/templates/email/ChangePersonalInfoNotification.ftl (original) +++ ofbiz/trunk/applications/party/templates/email/ChangePersonalInfoNotification.ftl Thu Apr 23 17:54:30 2009 @@ -16,7 +16,6 @@ specific language governing permissions and limitations under the License. --> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> Modified: ofbiz/trunk/applications/party/templates/email/CreatePartyNotification.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/templates/email/CreatePartyNotification.ftl?rev=767996&r1=767995&r2=767996&view=diff ============================================================================== --- ofbiz/trunk/applications/party/templates/email/CreatePartyNotification.ftl (original) +++ ofbiz/trunk/applications/party/templates/email/CreatePartyNotification.ftl Thu Apr 23 17:54:30 2009 @@ -16,7 +16,6 @@ specific language governing permissions and limitations under the License. --> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> Modified: ofbiz/trunk/applications/party/templates/email/VerifyEmailAddressNotification.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/templates/email/VerifyEmailAddressNotification.ftl?rev=767996&r1=767995&r2=767996&view=diff ============================================================================== --- ofbiz/trunk/applications/party/templates/email/VerifyEmailAddressNotification.ftl (original) +++ ofbiz/trunk/applications/party/templates/email/VerifyEmailAddressNotification.ftl Thu Apr 23 17:54:30 2009 @@ -16,7 +16,6 @@ specific language governing permissions and limitations under the License. --> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> Modified: ofbiz/trunk/applications/workeffort/webapp/workeffort/workeffort/EventReminderEmail.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/webapp/workeffort/workeffort/EventReminderEmail.ftl?rev=767996&r1=767995&r2=767996&view=diff ============================================================================== --- ofbiz/trunk/applications/workeffort/webapp/workeffort/workeffort/EventReminderEmail.ftl (original) +++ ofbiz/trunk/applications/workeffort/webapp/workeffort/workeffort/EventReminderEmail.ftl Thu Apr 23 17:54:30 2009 @@ -16,7 +16,6 @@ specific language governing permissions and limitations under the License. --> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <#assign docLangAttr = locale.toString()?replace("_", "-")> <#assign langDir = "ltr"> <#if "ar.iw"?contains(docLangAttr?substring(0, 2))> Modified: ofbiz/trunk/framework/common/webcommon/includes/insertDropDown.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/webcommon/includes/insertDropDown.ftl?rev=767996&r1=767995&r2=767996&view=diff ============================================================================== --- ofbiz/trunk/framework/common/webcommon/includes/insertDropDown.ftl (original) +++ ofbiz/trunk/framework/common/webcommon/includes/insertDropDown.ftl Thu Apr 23 17:54:30 2009 @@ -1,4 +1,3 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <#-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file Modified: ofbiz/trunk/framework/common/webcommon/includes/lookup.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/webcommon/includes/lookup.ftl?rev=767996&r1=767995&r2=767996&view=diff ============================================================================== --- ofbiz/trunk/framework/common/webcommon/includes/lookup.ftl (original) +++ ofbiz/trunk/framework/common/webcommon/includes/lookup.ftl Thu Apr 23 17:54:30 2009 @@ -1,4 +1,3 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <#-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file Modified: ofbiz/trunk/framework/common/webcommon/includes/simple.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/webcommon/includes/simple.ftl?rev=767996&r1=767995&r2=767996&view=diff ============================================================================== --- ofbiz/trunk/framework/common/webcommon/includes/simple.ftl (original) +++ ofbiz/trunk/framework/common/webcommon/includes/simple.ftl Thu Apr 23 17:54:30 2009 @@ -1,4 +1,3 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <#-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/fo/FoScreenRenderer.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/fo/FoScreenRenderer.java?rev=767996&r1=767995&r2=767996&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/fo/FoScreenRenderer.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/fo/FoScreenRenderer.java Thu Apr 23 17:54:30 2009 @@ -50,6 +50,13 @@ return "xsl-fo"; } + public void renderScreenBegin(Appendable writer, Map<String, Object> context) throws IOException { + } + + public void renderScreenEnd(Appendable writer, Map<String, Object> context) throws IOException { + + } + public void renderSectionBegin(Appendable writer, Map<String, Object> context, ModelScreenWidget.Section section) throws IOException { renderBeginningBoundaryComment(writer, section.isMainSection?"Screen":"Section Widget", section); } Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlScreenRenderer.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlScreenRenderer.java?rev=767996&r1=767995&r2=767996&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlScreenRenderer.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlScreenRenderer.java Thu Apr 23 17:54:30 2009 @@ -71,6 +71,14 @@ return "html"; } + public void renderScreenBegin(Appendable writer, Map<String, Object> context) throws IOException { + writer.append("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">"); + appendWhitespace(writer); + } + + public void renderScreenEnd(Appendable writer, Map<String, Object> context) throws IOException { + } + public void renderSectionBegin(Appendable writer, Map<String, Object> context, ModelScreenWidget.Section section) throws IOException { renderBeginningBoundaryComment(writer, section.isMainSection?"Screen":"Section Widget", section); } 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=767996&r1=767995&r2=767996&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 Thu Apr 23 17:54:30 2009 @@ -116,11 +116,35 @@ return rendererName; } + public void renderScreenBegin(Appendable writer, Map<String, Object> context) throws IOException { + executeMacro("<@renderScreenBegin/>"); + } + + public void renderScreenEnd(Appendable writer, Map<String, Object> context) throws IOException { + executeMacro("<@renderScreenEnd/>"); + } + public void renderSectionBegin(Appendable writer, Map<String, Object> context, ModelScreenWidget.Section section) throws IOException { - // TODO: not implemented FIXME + if (section.boundaryCommentsEnabled()) { + StringWriter sr = new StringWriter(); + sr.append("<@renderSectionBegin "); + sr.append("boundaryComment=\"Begin "); + sr.append(section.isMainSection ? "Screen " : "Section Widget "); + sr.append(section.getBoundaryCommentName()); + sr.append("\"/>"); + executeMacro(sr.toString()); + } } public void renderSectionEnd(Appendable writer, Map<String, Object> context, ModelScreenWidget.Section section) throws IOException { - // TODO: not implemented FIXME + if (section.boundaryCommentsEnabled()) { + StringWriter sr = new StringWriter(); + sr.append("<@renderSectionEnd "); + sr.append("boundaryComment=\"End "); + sr.append(section.isMainSection ? "Screen " : "Section Widget "); + sr.append(section.getBoundaryCommentName()); + sr.append("\"/>"); + executeMacro(sr.toString()); + } } public void renderContainerBegin(Appendable writer, Map<String, Object> context, ModelScreenWidget.Container container) throws IOException { Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ScreenRenderer.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ScreenRenderer.java?rev=767996&r1=767995&r2=767996&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ScreenRenderer.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ScreenRenderer.java Thu Apr 23 17:54:30 2009 @@ -118,7 +118,9 @@ GenericWidgetOutput gwo = screenCache.get(screenCombinedName, wcck); if (gwo == null) { Writer sw = new StringWriter(); + screenStringRenderer.renderScreenBegin(writer, context); modelScreen.renderScreenString(sw, context, screenStringRenderer); + screenStringRenderer.renderScreenEnd(writer, context); gwo = new GenericWidgetOutput(sw.toString()); screenCache.put(screenCombinedName, wcck, gwo); writer.append(gwo.toString()); @@ -126,7 +128,9 @@ writer.append(gwo.toString()); } } else { + screenStringRenderer.renderScreenBegin(writer, context); modelScreen.renderScreenString(writer, context, screenStringRenderer); + screenStringRenderer.renderScreenEnd(writer, context); } return ""; } Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ScreenStringRenderer.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ScreenStringRenderer.java?rev=767996&r1=767995&r2=767996&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ScreenStringRenderer.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ScreenStringRenderer.java Thu Apr 23 17:54:30 2009 @@ -28,6 +28,8 @@ */ public interface ScreenStringRenderer { public String getRendererName(); + public void renderScreenBegin(Appendable writer, Map<String, Object> context) throws IOException; + public void renderScreenEnd(Appendable writer, Map<String, Object> context) throws IOException; public void renderSectionBegin(Appendable writer, Map<String, Object> context, ModelScreenWidget.Section section) throws IOException; public void renderSectionEnd(Appendable writer, Map<String, Object> context, ModelScreenWidget.Section section) throws IOException; public void renderContainerBegin(Appendable writer, Map<String, Object> context, ModelScreenWidget.Container container) throws IOException; Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/text/TextScreenRenderer.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/text/TextScreenRenderer.java?rev=767996&r1=767995&r2=767996&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/text/TextScreenRenderer.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/text/TextScreenRenderer.java Thu Apr 23 17:54:30 2009 @@ -39,6 +39,12 @@ return "text"; } + public void renderScreenBegin(Appendable writer, Map<String, Object> context) throws IOException { + } + + public void renderScreenEnd(Appendable writer, Map<String, Object> context) throws IOException { + } + public void renderSectionBegin(Appendable writer, Map<String, Object> context, ModelScreenWidget.Section section) throws IOException { // do nothing, this is just a place holder container for HTML } Modified: ofbiz/trunk/framework/widget/templates/htmlScreenMacroLibrary.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/templates/htmlScreenMacroLibrary.ftl?rev=767996&r1=767995&r2=767996&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/templates/htmlScreenMacroLibrary.ftl (original) +++ ofbiz/trunk/framework/widget/templates/htmlScreenMacroLibrary.ftl Thu Apr 23 17:54:30 2009 @@ -17,9 +17,25 @@ under the License. --> -<#macro renderSectionBegin></#macro> -<#macro renderSectionEnd> +<#macro renderScreenBegin> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> </#macro> + +<#macro renderScreenEnd> +</#macro> + +<#macro renderSectionBegin boundaryComment> +<#if boundaryComment?has_content> +<!-- ${boundaryComment} --> +</#if> +</#macro> + +<#macro renderSectionEnd boundaryComment> +<#if boundaryComment?has_content> +<!-- ${boundaryComment} --> +</#if> +</#macro> + <#macro renderContainerBegin id style autoUpdateLink autoUpdateInterval> <#if autoUpdateLink?has_content> <script type="text/javascript">ajaxUpdateAreaPeriodic('${id}', '${autoUpdateLink}', '', '${autoUpdateInterval}');</script> Modified: ofbiz/trunk/themes/bluelight/includes/header.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/themes/bluelight/includes/header.ftl?rev=767996&r1=767995&r2=767996&view=diff ============================================================================== --- ofbiz/trunk/themes/bluelight/includes/header.ftl (original) +++ ofbiz/trunk/themes/bluelight/includes/header.ftl Thu Apr 23 17:54:30 2009 @@ -16,16 +16,13 @@ specific language governing permissions and limitations under the License. --> - <#if (requestAttributes.person)?exists><#assign person = requestAttributes.person></#if> <#if (requestAttributes.partyGroup)?exists><#assign partyGroup = requestAttributes.partyGroup></#if> - <#assign docLangAttr = locale.toString()?replace("_", "-")> <#assign langDir = "ltr"> <#if "ar.iw"?contains(docLangAttr?substring(0, 2))> <#assign langDir = "rtl"> </#if> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html lang="${docLangAttr}" dir="${langDir}" xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> Modified: ofbiz/trunk/themes/flatgrey/includes/header.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/themes/flatgrey/includes/header.ftl?rev=767996&r1=767995&r2=767996&view=diff ============================================================================== --- ofbiz/trunk/themes/flatgrey/includes/header.ftl (original) +++ ofbiz/trunk/themes/flatgrey/includes/header.ftl Thu Apr 23 17:54:30 2009 @@ -22,7 +22,6 @@ <#if "ar.iw"?contains(docLangAttr?substring(0, 2))> <#assign langDir = "rtl"> </#if> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html lang="${docLangAttr}" dir="${langDir}" xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> Modified: ofbiz/trunk/themes/smoothfeather/includes/header.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/themes/smoothfeather/includes/header.ftl?rev=767996&r1=767995&r2=767996&view=diff ============================================================================== --- ofbiz/trunk/themes/smoothfeather/includes/header.ftl (original) +++ ofbiz/trunk/themes/smoothfeather/includes/header.ftl Thu Apr 23 17:54:30 2009 @@ -23,7 +23,6 @@ <#if "ar.iw"?contains(docLangAttr?substring(0, 2))> <#assign langDir = "rtl"> </#if> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="${docLangAttr}" lang="${docLangAttr}" dir="${langDir}"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> |
Free forum by Nabble | Edit this page |