You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by le...@apache.org on 2008/01/04 06:07:59 UTC

svn commit: r608747 - /ofbiz/trunk/framework/common/webcommon/includes/header.ftl

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="<@o...@ofbizContentUrl>" type="text/javascript"></script>
+            <#if javaScriptsSet.contains(javaScript)>
+                <#assign nothing = javaScriptsSet.remove(javaScript)/>
+                <script language="javascript" src="<@o...@ofbizContentUrl>" type="text/javascript"/>
+            </#if>
         </#list>
     </#if>
     <#if layoutSettings.styleSheets?has_content>