Author: erwan
Date: Sun Jun 20 22:42:50 2010 New Revision: 956423 URL: http://svn.apache.org/viewvc?rev=956423&view=rev Log: OFBIZ-3817 jQuery Menu fix https://issues.apache.org/jira/browse/OFBIZ-3817 Modified: ofbiz/branches/jquery/framework/common/widget/CommonScreens.xml ofbiz/branches/jquery/themes/bizznesstime/webapp/bizznesstime/js/application.js ofbiz/branches/jquery/themes/bluelight/webapp/bluelight/dropdown.js ofbiz/branches/jquery/themes/droppingcrumbs/webapp/droppingcrumbs/js/dropdown.js ofbiz/branches/jquery/themes/tomahawk/includes/appbarClose.ftl ofbiz/branches/jquery/themes/tomahawk/webapp/tomahawk/js/dropdown.js Modified: ofbiz/branches/jquery/framework/common/widget/CommonScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/framework/common/widget/CommonScreens.xml?rev=956423&r1=956422&r2=956423&view=diff ============================================================================== --- ofbiz/branches/jquery/framework/common/widget/CommonScreens.xml (original) +++ ofbiz/branches/jquery/framework/common/widget/CommonScreens.xml Sun Jun 20 22:42:50 2010 @@ -114,9 +114,8 @@ under the License. <section> <actions> <!-- The default (global) java scripts --> - <set field="layoutSettings.javaScripts[+0]" value="/images/prototypejs/scriptaculous.js" global="true"/> - <set field="layoutSettings.javaScripts[+0]" value="/images/prototypejs/prototype.js" global="true"/> - <set field="layoutSettings.javaScripts[]" value="/images/prototypejs/resize.js" global="true"/> + <set field="layoutSettings.javaScripts[+0]" value="/images/jquery/jquery-1.4.2.js" global="true"/> + <set field="layoutSettings.javaScripts[]" value="/images/jquery/plugins/jquery.class/jquery.class.js" global="true"/> <set field="layoutSettings.javaScripts[]" value="/images/selectall.js" global="true"/> <set field="layoutSettings.javaScripts[]" value="/images/fieldlookup.js" global="true"/> <set field="layoutSettings.javaScripts[]" value="/images/calendarDateSelect/calendar_date_select.js" global="true"/> @@ -190,8 +189,8 @@ under the License. <widgets> <platform-specific><html><html-template location="${appbarCloseTemplateLocation}"/></html></platform-specific> </widgets> - </section> - + </section> + <!-- render messages --> <platform-specific><html><html-template location="${messagesTemplateLocation}"/></html></platform-specific> @@ -231,7 +230,7 @@ under the License. <field-map field-name="userPrefGroupTypeId" value="GLOBAL_PREFERENCES"/> </service> <set field="userPreferences" from-field="prefResult.userPrefMap" global="true"/> - + <property-map resource="general" map-name="generalProperties" global="true"/> <set field="visualThemeId" from-field="userPreferences.VISUAL_THEME" global="true"/> <service service-name="getVisualThemeResources"> @@ -314,9 +313,10 @@ under the License. <set field="layoutSettings.styleSheets[+0]" value="/images/maincss.css" global="true"/> <set field="layoutSettings.rtlStyleSheets[+0]" value="/images/mainrtl.css" global="true"/> <!-- The default (global) java scripts --> + <set field="layoutSettings.javaScripts[+0]" value="/images/jquery/jquery-1.4.2.js" global="true"/> + <set field="layoutSettings.javaScripts[]" value="/images/jquery/plugins/jquery.class/jquery.class.js" global="true"/> <set field="layoutSettings.javaScripts[]" value="/images/selectall.js" global="true"/> <set field="layoutSettings.javaScripts[]" value="/images/fieldlookup.js" global="true"/> - <set field="layoutSettings.javaScripts[]" value="/images/prototypejs/prototype.js" global="true"/> <set field="layoutSettings.javaScripts[]" value="/images/calendarDateSelect/calendar_date_select.js" global="true"/> <set field="initialLocale" type="String" value="${parameters.userLogin.lastLocale}" default-value="${groovy:locale.toString()}"/> <set field="layoutSettings.javaScripts[]" value="/images/calendarDateSelect/locale/${initialLocale}.js" global="true"/> @@ -523,7 +523,7 @@ under the License. <section> <actions> <entity-one entity-name="PortalPage" value-field="portalPage" use-cache="true"/> - <get-related value-field="portalPage" relation-name="PortalPageColumn" + <get-related value-field="portalPage" relation-name="PortalPageColumn" order-by-list="columnSeqId" list="portalPageColumns" use-cache="true"/> <entity-and entity-name="PortalPagePortletView" list="portalPagePortlets" use-cache="true"> <field-map field-name="portalPageId" from-field="portalPage.portalPageId"/> Modified: ofbiz/branches/jquery/themes/bizznesstime/webapp/bizznesstime/js/application.js URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/themes/bizznesstime/webapp/bizznesstime/js/application.js?rev=956423&r1=956422&r2=956423&view=diff ============================================================================== --- ofbiz/branches/jquery/themes/bizznesstime/webapp/bizznesstime/js/application.js (original) +++ ofbiz/branches/jquery/themes/bizznesstime/webapp/bizznesstime/js/application.js Sun Jun 20 22:42:50 2010 @@ -28,42 +28,41 @@ adds functionality to style layout eleme **************************************************/ //ADD CLEARFIX STYLING TO MAIN CONTENT AREA OFBIZ.clearFix = function(){ - if($$('.contentarea')){ - $$('.contentarea').each(function(elm) { - $(elm).addClassName('clearfix'); + if(jQuery('.contentarea')){ + jQuery('.contentarea').each(function(elm) { + jQuery(this).addClass('clearfix'); }); } } //GLOBAL FUNCTION FOR APP DROP-DROWN SECTIONS OFBIZ.initExpansion = function() { - if($$('.contracted')){ - $$('.contracted').each(function(elm) { - $(elm).next().style.display = 'none'; + if(jQuery('.contracted')){ + jQuery('.contracted').each(function(elm) { + jQuery(this).next().css({'display': 'none'}); }); } - if($$('.expanded, .contracted')) { - $$('.expanded, .contracted').each(function(elm) { - $(elm).onclick = function() { - Effect.toggle($(elm).next(),'blind',{ - duration : .2, - afterFinish: function() { - if($(elm).next().visible()) { - $(elm).removeClassName('contracted'); - $(elm).addClassName('expanded'); + if(jQuery('.expanded, .contracted')) { + jQuery('.expanded, .contracted').each(function(elm) { + var menu = jQuery(this); + menu.click( function() { + menu.next().toggle( function () { + if(menu.next().is(':visible')) { + menu.removeClass('contracted'); + menu.addClass('expanded'); } else { - $(elm).removeClassName('expanded'); - $(elm).addClassName('contracted'); + menu.removeClass('expanded'); + menu.addClass('contracted'); } - } + }); }); - } - }); - } + }); + }; } -OFBIZ.Effect = Object.extend({}, Effect); +//OFBIZ.Effect = Object.extend({}, Effect); +/* Object.extend(Element,{ findElement: function(element, tagName) { var element = $(element); @@ -72,7 +71,7 @@ Object.extend(Element,{ element = element.parentNode; return $(element); } -}); +});*/ /***************************************************** FORM FOCUS AND BLUR @@ -80,11 +79,11 @@ javascript solution to make form focus s consistent cross browser form platforms that don't support input:focus (cough, cough, IE, cough) *****************************************************/ -Event.observe(window, 'load', function() { - var fields = $$("input, textarea"); +jQuery('document').ready(function () { + var fields = jQuery("input, textarea"); for (var i = 0; i < fields.length; i++) { - fields[i].onfocus = function() {this.className += ' focused';} - fields[i].onblur = function() {this.className = this.className.replace('focused', '');} + fields[i].focus (function() {this.className += ' focused';}); + fields[i].blur (function() {this.className = this.className.replace('focused', '');}); } }); @@ -99,17 +98,17 @@ message automatically fades on keypress, var humanMsg = { setup: function(appendTo, msgOpacity) { humanMsg.msgID = 'humanMsg'; - appendTo = appendTo || $$('body')[0]; + appendTo = appendTo || jQuery('body')[0]; humanMsg.msgOpacity = 0.5; if (msgOpacity !== undefined) { humanMsg.msgOpacity = parseFloat(msgOpacity); } - var myTemplate = new Template( + /*var myTemplate = new Template( '<div id="#{msgID}" class="humanMsg" style="display:none;">'+ '<div></div>'+ '</div> '); - var show = {msgID: humanMsg.msgID}; - appendTo.insert(myTemplate.evaluate(show)); + var show = {msgID: humanMsg.msgID};*/ + jQuery('<div id="' + humanMsg.msgID + '" class="humanMsg" style="display:none;"><div></div></div>').appendTo(appendTo); }, displayMsg: function(msg) { if (msg === '') { @@ -145,8 +144,10 @@ displays preferences (language, theme, t in modal window instead of popup/new window **************************************************/ //PREFERENCES POPUPS -ModalWindow = Class.create({ - initialize: function(){ +var ModalWindow = function () {}; + +jQuery.extend(ModalWindow.prototype, { + init: function(){ this.cont = ""; this.overlay = ""; this.win = ""; @@ -168,19 +169,19 @@ ModalWindow = Class.create({ }); //LOAD MODAL PREFERENCE WINDOWS -Event.observe(window, 'load', function() { +jQuery('document').ready (function () { get = new ModalWindow(); - $("language").observe('click',function(e) { + jQuery("language").click (function(e) { var locale = new Element('div', {id:'modal-contents'}).update("<img src='/bizznesstime/images/ajax-loader.gif'/>Updating Languages, please wait..."); var localeUpdate = new Ajax.Updater('modal-contents', this.rel, {method: 'get'}); get.show(locale,true); }); - $("theme").observe('click',function(e) { + jQuery("theme").click (function(e) { var look = new Element('div', {id:'modal-contents'}).update("<img src='/bizznesstime/images/ajax-loader.gif'/>Updating Themes, please wait..."); var lookUpdate = new Ajax.Updater('modal-contents', this.rel, {method: 'get'}); get.show(look,true); }); - $("timezone").observe('click',function(e) { + jQuery("timezone").click (function(e) { var time = new Element('div', {id:'modal-contents'}).update("<img src='/bizznesstime/images/ajax-loader.gif'/>Updating Timezones, please wait..."); var timeUpdate = new Ajax.Updater('modal-contents', this.rel, {method: 'get'}); get.show(time,true); @@ -191,7 +192,7 @@ Event.observe(window, 'load', function() LOAD 'EM UP **************************************************/ //LOAD GLOBAL APP FUNCTIONS -document.observe('dom:loaded', function(){ +jQuery('document').ready(function () { OFBIZ.clearFix(); OFBIZ.initExpansion(); humanMsg.setup(); Modified: ofbiz/branches/jquery/themes/bluelight/webapp/bluelight/dropdown.js URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/themes/bluelight/webapp/bluelight/dropdown.js?rev=956423&r1=956422&r2=956423&view=diff ============================================================================== --- ofbiz/branches/jquery/themes/bluelight/webapp/bluelight/dropdown.js (original) +++ ofbiz/branches/jquery/themes/bluelight/webapp/bluelight/dropdown.js Sun Jun 20 22:42:50 2010 @@ -17,33 +17,31 @@ specific language governing permissions under the License. */ -var DropDownMenu = Class.create(); -DropDownMenu.prototype = { - initialize: function(menuElement) { - 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);}; +var DropDownMenu = ( + function(menuElement) { + var menuTitle = menuElement.find("h2:first"); + menuElement.children().each(function(node){ + // if there is a submenu + var submenu = jQuery(this).find("ul:first"); + + if(submenu != null){ + // make sub-menu invisible + submenu.hide(); + // toggle the visibility of the submenu + if (menuTitle != null) { + menuTitle.mouseover (function(){ submenu.css({'display': 'block'});}); + menuTitle.mouseout (function(){submenu.hide();}); } + jQuery(this).mouseover (function(){submenu.css({'display': 'block'});}); + jQuery(this).mouseout (function(){submenu.hide();}); + } }); } -}; - -Event.observe(window, "load", function(){ +); +jQuery("document").ready(function(){ + var mainmenu = new DropDownMenu(jQuery('#main-navigation')); + var appmenu = new DropDownMenu(jQuery('#app-navigation')); }); -document.observe('dom:loaded', function(){ - var mainmenu = new DropDownMenu($('main-navigation')); - var appmenu = new DropDownMenu($('app-navigation')); -}); Modified: ofbiz/branches/jquery/themes/droppingcrumbs/webapp/droppingcrumbs/js/dropdown.js URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/themes/droppingcrumbs/webapp/droppingcrumbs/js/dropdown.js?rev=956423&r1=956422&r2=956423&view=diff ============================================================================== --- ofbiz/branches/jquery/themes/droppingcrumbs/webapp/droppingcrumbs/js/dropdown.js (original) +++ ofbiz/branches/jquery/themes/droppingcrumbs/webapp/droppingcrumbs/js/dropdown.js Sun Jun 20 22:42:50 2010 @@ -17,33 +17,30 @@ specific language governing permissions under the License. */ -var DropDownMenu = Class.create(); -DropDownMenu.prototype = { - initialize: function(menuElement) { - 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);}; +var DropDownMenu = ( + function(menuElement) { + var menuTitle = menuElement.find("h2:first"); + menuElement.children().each(function(node){ + // if there is a submenu + var submenu = jQuery(this).find("ul:first"); + + if(submenu != null){ + // make sub-menu invisible + submenu.hide(); + // toggle the visibility of the submenu + if (menuTitle != null) { + menuTitle.mouseover (function(){ submenu.css({'display': 'block'});}); + menuTitle.mouseout (function(){submenu.hide();}); } + jQuery(this).mouseover (function(){submenu.css({'display': 'block'});}); + jQuery(this).mouseout (function(){submenu.hide();}); + } }); } -}; - -Event.observe(window, "load", function(){ - -}); +); -document.observe('dom:loaded', function(){ - var mainmenu = new DropDownMenu($('main-navigation')); - var appmenu = new DropDownMenu($('app-navigation')); +jQuery("document").ready(function(){ + var mainmenu = new DropDownMenu(jQuery('#main-navigation')); + var appmenu = new DropDownMenu(jQuery('#app-navigation')); }); Modified: ofbiz/branches/jquery/themes/tomahawk/includes/appbarClose.ftl URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/themes/tomahawk/includes/appbarClose.ftl?rev=956423&r1=956422&r2=956423&view=diff ============================================================================== --- ofbiz/branches/jquery/themes/tomahawk/includes/appbarClose.ftl (original) +++ ofbiz/branches/jquery/themes/tomahawk/includes/appbarClose.ftl Sun Jun 20 22:42:50 2010 @@ -108,7 +108,7 @@ under the License. <#if userLogin?exists> <script type="text/javascript"> - var mainmenu = new DropDownMenu($('main-navigation')); - var appmenu = new DropDownMenu($('app-navigation')); + var mainmenu = new DropDownMenu(jQuery('#main-navigation')); + var appmenu = new DropDownMenu(jQuery('#app-navigation')); </script> </#if> Modified: ofbiz/branches/jquery/themes/tomahawk/webapp/tomahawk/js/dropdown.js URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/themes/tomahawk/webapp/tomahawk/js/dropdown.js?rev=956423&r1=956422&r2=956423&view=diff ============================================================================== --- ofbiz/branches/jquery/themes/tomahawk/webapp/tomahawk/js/dropdown.js (original) +++ ofbiz/branches/jquery/themes/tomahawk/webapp/tomahawk/js/dropdown.js Sun Jun 20 22:42:50 2010 @@ -17,26 +17,25 @@ specific language governing permissions under the License. */ -var DropDownMenu = Class.create(); -DropDownMenu.prototype = { - initialize: function(menuElement) { - var menuTitle = $A(menuElement.getElementsByTagName("h2")).first(); - - menuElement.childElements().each(function(node){ +var DropDownMenu = ( + function(menuElement) { + var menuTitle = menuElement.find("h2:first"); + menuElement.children().each(function(node){ // if there is a submenu - var submenu = $A(node.getElementsByTagName("ul")).first(); + var submenu = jQuery(this).find("ul:first"); + if(submenu != null){ // make sub-menu invisible - Element.hide(submenu); + submenu.hide(); // toggle the visibility of the submenu if (menuTitle != null) { - menuTitle.onmouseover = function(){Element.extend(submenu).setStyle({display: 'block'});}; - menuTitle.onmouseout = function(){Element.hide(submenu);}; + menuTitle.mouseover (function(){ submenu.css({'display': 'block'});}); + menuTitle.mouseout (function(){submenu.hide();}); } - node.onmouseover = function(){Element.extend(submenu).setStyle({display: 'block'});}; - node.onmouseout = function(){Element.hide(submenu);}; + jQuery(this).mouseover (function(){submenu.css({'display': 'block'});}); + jQuery(this).mouseout (function(){submenu.hide();}); } }); } -}; \ No newline at end of file +); \ No newline at end of file |
Free forum by Nabble | Edit this page |