Author: adrianc
Date: Tue Apr 21 16:57:51 2009
New Revision: 767221

URL: http://svn.apache.org/viewvc?rev=767221&view=rev
Log:
Fixed invalid HTML generated by the menu widget. Updated BlueLight theme to use 
valid HTML.

When creating new themes for OFBiz, it is important to follow the guidelines 
here:

http://docs.ofbiz.org/display/OFBIZ/OFBiz+maincss.css+HTML+Element+Collection+Styles

Modified:
    ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlMenuRenderer.java
    ofbiz/trunk/themes/bluelight/includes/appbar.ftl
    ofbiz/trunk/themes/bluelight/webapp/bluelight/dropdown.js
    ofbiz/trunk/themes/bluelight/webapp/bluelight/style.css

Modified: 
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlMenuRenderer.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlMenuRenderer.java?rev=767221&r1=767220&r2=767221&view=diff
==============================================================================
--- 
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlMenuRenderer.java 
(original)
+++ 
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlMenuRenderer.java 
Tue Apr 21 16:57:51 2009
@@ -239,17 +239,16 @@
         }
         writer.append(">");
         appendWhitespace(writer);
-        writer.append("<ul>");
-        appendWhitespace(writer);
-        writer.append("<li>");
         String menuTitle = modelMenu.getTitle(context);
         if (UtilValidate.isNotEmpty(menuTitle)) {
+            writer.append("<h2>" + menuTitle + "</h2>");
             appendWhitespace(writer);
-            writer.append(" <h2>" + menuTitle + "</h2>");
         }
+        writer.append("<ul>");
+        appendWhitespace(writer);
+        writer.append("<li>");
         appendWhitespace(writer);
         writer.append(" <ul>");
-
         appendWhitespace(writer);
     }
 
@@ -264,12 +263,12 @@
         //String menuContainerStyle = modelMenu.getMenuContainerStyle(context);
         writer.append(" </ul>");
         appendWhitespace(writer);
-        writer.append(" <br class=\"clear\"/>");
-        appendWhitespace(writer);
         writer.append("</li>");
         appendWhitespace(writer);
         writer.append("</ul>");
         appendWhitespace(writer);
+        writer.append(" <br class=\"clear\"/>");
+        appendWhitespace(writer);
         writer.append("</div>");
         appendWhitespace(writer);
         renderEndingBoundaryComment(writer, "Menu Widget", modelMenu);

Modified: ofbiz/trunk/themes/bluelight/includes/appbar.ftl
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/themes/bluelight/includes/appbar.ftl?rev=767221&r1=767220&r2=767221&view=diff
==============================================================================
--- ofbiz/trunk/themes/bluelight/includes/appbar.ftl (original)
+++ ofbiz/trunk/themes/bluelight/includes/appbar.ftl Tue Apr 21 16:57:51 2009
@@ -26,9 +26,9 @@
   <div class="breadcrumbs">
     <div class="breadcrumbs-start">
       <div id="main-navigation">
+        <h2>${uiLabelMap.CommonHome}</h2>
         <ul>
           <li>
-            <h2>${uiLabelMap.CommonHome}</h2>
             <ul>
             <#list displayApps as display>
               <#assign thisApp = display.getContextRoot()>

Modified: ofbiz/trunk/themes/bluelight/webapp/bluelight/dropdown.js
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/themes/bluelight/webapp/bluelight/dropdown.js?rev=767221&r1=767220&r2=767221&view=diff
==============================================================================
--- ofbiz/trunk/themes/bluelight/webapp/bluelight/dropdown.js (original)
+++ ofbiz/trunk/themes/bluelight/webapp/bluelight/dropdown.js Tue Apr 21 
16:57:51 2009
@@ -1,18 +1,21 @@
 var DropDownMenu = Class.create();
 DropDownMenu.prototype = {
  initialize: function(menuElement) {
-       menuElement.childElements().each(function(node){
-               // if there is a submenu
-               var submenu = $A(node.getElementsByTagName("ul")).first();
-               if(submenu != null){
-                       // make sub-menu invisible
-                       Element.extend(submenu).setStyle({display: 'none'});
-                       // toggle the visibility of the submenu
-                       node.onmouseover = node.onmouseout = function(){
-                               Element.toggle(submenu);
-                       }
-               }
-       });
+    var menuTitle = $A(menuElement.getElementsByTagName("h2")).first();
+    menuElement.childElements().each(function(node){
+        // if there is a submenu
+        var submenu = $A(node.getElementsByTagName("ul")).first();
+        if(submenu != null){
+            // make sub-menu invisible
+            Element.extend(submenu).setStyle({display: 'none'});
+            // toggle the visibility of the submenu
+            if (menuTitle != null) {
+                menuTitle.onmouseover = menuTitle.onmouseout = 
function(){Element.toggle(submenu);};
+                menuTitle = null;
+            }
+            node.onmouseover = node.onmouseout = 
function(){Element.toggle(submenu);};
+        }
+    });
   }
 };
 
@@ -21,7 +24,7 @@
 });
 
 document.observe('dom:loaded', function(){
-       var mainmenu = new DropDownMenu($('main-navigation'));
+    var mainmenu = new DropDownMenu($('main-navigation'));
     var appmenu = new DropDownMenu($('app-navigation'));
 });
 

Modified: ofbiz/trunk/themes/bluelight/webapp/bluelight/style.css
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/themes/bluelight/webapp/bluelight/style.css?rev=767221&r1=767220&r2=767221&view=diff
==============================================================================
--- ofbiz/trunk/themes/bluelight/webapp/bluelight/style.css (original)
+++ ofbiz/trunk/themes/bluelight/webapp/bluelight/style.css Tue Apr 21 16:57:51 
2009
@@ -1069,8 +1069,8 @@
     font-size: 130%;
 }
 
-#main-navigation ul li h2,
-#app-navigation ul li h2 {
+#main-navigation h2,
+#app-navigation h2 {
     color: #FFFFFF;
     font-size: 1.2em;
     font-weight: bold;


Reply via email to