ofbiz-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lekt...@apache.org
Subject svn commit: r608747 - /ofbiz/trunk/framework/common/webcommon/includes/header.ftl
Date Fri, 04 Jan 2008 05:07:59 GMT
Author: lektran
Date: Thu Jan  3 21:07:59 2008
New Revision: 608747

URL: http://svn.apache.org/viewvc?rev=608747&view=rev
Log:
Use a Set when adding layoutSettings.javaScripts to the header so that each script is loaded
only once

Modified:
    ofbiz/trunk/framework/common/webcommon/includes/header.ftl

Modified: ofbiz/trunk/framework/common/webcommon/includes/header.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/webcommon/includes/header.ftl?rev=608747&r1=608746&r2=608747&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/webcommon/includes/header.ftl (original)
+++ ofbiz/trunk/framework/common/webcommon/includes/header.ftl Thu Jan  3 21:07:59 2008
@@ -38,8 +38,13 @@
     </#if>
     <#if layoutSettings.javaScripts?has_content>
         <#--layoutSettings.javaScripts is a list of java scripts. -->
+        <#-- use a Set to make sure each javascript is declared only once, but iterate
the list to maintain the correct order -->
+        <#assign javaScriptsSet = Static["org.ofbiz.base.util.UtilMisc"].toSet(layoutSettings.javaScripts)/>
         <#list layoutSettings.javaScripts as javaScript>
-            <script language="javascript" src="<@ofbizContentUrl>${javaScript}</@ofbizContentUrl>"
type="text/javascript"></script>
+            <#if javaScriptsSet.contains(javaScript)>
+                <#assign nothing = javaScriptsSet.remove(javaScript)/>
+                <script language="javascript" src="<@ofbizContentUrl>${javaScript}</@ofbizContentUrl>"
type="text/javascript"/>
+            </#if>
         </#list>
     </#if>
     <#if layoutSettings.styleSheets?has_content>



Mime
View raw message