svn commit: r452778 - in /incubator/ofbiz/trunk/framework/common: webcommon/includes/genericLink.ftl widget/CommonScreens.xml

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r452778 - in /incubator/ofbiz/trunk/framework/common: webcommon/includes/genericLink.ftl widget/CommonScreens.xml

jacopoc
Author: jacopoc
Date: Wed Oct  4 00:21:34 2006
New Revision: 452778

URL: http://svn.apache.org/viewvc?view=rev&rev=452778
Log:
Created a generic screen that renders a link (implemented by an hidden form) that can be included in other screens: in the form, the screen's requestParameters are stored as hidden fields and so it is very useful to render links for printed output (based on search constraints).




Added:
    incubator/ofbiz/trunk/framework/common/webcommon/includes/genericLink.ftl   (with props)
Modified:
    incubator/ofbiz/trunk/framework/common/widget/CommonScreens.xml

Added: incubator/ofbiz/trunk/framework/common/webcommon/includes/genericLink.ftl
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/framework/common/webcommon/includes/genericLink.ftl?view=auto&rev=452778
==============================================================================
--- incubator/ofbiz/trunk/framework/common/webcommon/includes/genericLink.ftl (added)
+++ incubator/ofbiz/trunk/framework/common/webcommon/includes/genericLink.ftl Wed Oct  4 00:21:34 2006
@@ -0,0 +1,31 @@
+<#--
+
+Copyright 2001-2006 The Apache Software Foundation
+
+Licensed 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.
+-->
+
+<#if requestParameters?exists && genericLinkName?exists && genericLinkTarget?exists && genericLinkText?exists>
+<form name="${genericLinkName}" <#if genericLinkWindow?exists>target="${genericLinkWindow}"</#if> action="<@ofbizUrl>${genericLinkTarget}</@ofbizUrl>" method="post">
+<#if (!excludeParameters?exists || excludeParameters != "N") && requestParameters?exists>
+<#assign requestParameterKeys = requestParameters.keySet().iterator()>
+<#list requestParameterKeys as requestParameterKey>
+<#assign requestParameterValue = requestParameters.get(requestParameterKey)>
+<#if requestParameterValue?exists && requestParameterValue?has_content>
+<input type="hidden" name="${requestParameterKey}" value="${requestParameterValue}"/>
+</#if>
+</#list>
+</#if>
+<a href="javascript:document.${genericLinkName}.submit();" <#if genericLinkStyle?exists>class="${genericLinkStyle}"</#if>>${genericLinkText}</a>
+</form>
+</#if>

Propchange: incubator/ofbiz/trunk/framework/common/webcommon/includes/genericLink.ftl
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/ofbiz/trunk/framework/common/webcommon/includes/genericLink.ftl
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author URL Id"

Propchange: incubator/ofbiz/trunk/framework/common/webcommon/includes/genericLink.ftl
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: incubator/ofbiz/trunk/framework/common/widget/CommonScreens.xml
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/framework/common/widget/CommonScreens.xml?view=diff&rev=452778&r1=452777&r2=452778
==============================================================================
--- incubator/ofbiz/trunk/framework/common/widget/CommonScreens.xml (original)
+++ incubator/ofbiz/trunk/framework/common/widget/CommonScreens.xml Wed Oct  4 00:21:34 2006
@@ -56,6 +56,32 @@
             </widgets>
         </section>
     </screen>
+    <!--
+        The following screen renders a generic link (implemented by an hidden form)
+        that can be included in other screens in the following way:
+        ...
+        <section>
+            <actions>
+                <set field="genericLinkName" value="formName"/> The name of the hidden form (mandatory)
+                <set field="genericLinkText" value="Link message"/> The link text (mandatory)
+                <set field="genericLinkTarget" value="ApprovedProductRequirementsReport"/> The request name (mandatory)
+                <set field="genericLinkStyle" value="buttontext"/> The style of the link (optional)
+                <set field="genericLinkWindow" value="newWindow"/> The target window (optional): if set, a new browser window is created
+                <set field="excludeParameters" value="N"/> If not set to Y, the requestParameters are included in the form as hidden fields (optional, defaults to N)
+            </actions>
+            <widgets>
+                <include-screen name="genericLink" location="component://common/widget/CommonScreens.xml"/>
+            </widgets>
+        </section>
+        ...
+    -->
+    <screen name="genericLink">
+        <section>
+            <widgets>
+                <platform-specific><html><html-template location="component://common/webcommon/includes/genericLink.ftl"/></html></platform-specific>
+            </widgets>
+        </section>
+    </screen>
 
     <!-- Global decorator for General Screens/Pages -->
     <screen name="GlobalDecorator">