diff options
author | matt <matt@59fd770c-687e-43c8-a1e3-f5a4ff64c105> | 2009-05-12 02:05:29 +0400 |
---|---|---|
committer | matt <matt@59fd770c-687e-43c8-a1e3-f5a4ff64c105> | 2009-05-12 02:05:29 +0400 |
commit | f19ee2f00a6be07d00c23a5b9c081373a955e3d4 (patch) | |
tree | 755721ca1fe3067d511c20944acbf858c1c3a835 /plugins/CoreHome | |
parent | 0a0637ba8a326b957fee6277a8c08bb6ab7d7375 (diff) |
- refs #197 converting field to TEXT for old tables
- refs #103 fixing two bugs: dashboard not highlighted and idgoal wrong parameter in menu (patch by khahn)
Diffstat (limited to 'plugins/CoreHome')
-rw-r--r-- | plugins/CoreHome/templates/broadcast.js | 16 | ||||
-rw-r--r-- | plugins/CoreHome/templates/menu.js | 50 |
2 files changed, 45 insertions, 21 deletions
diff --git a/plugins/CoreHome/templates/broadcast.js b/plugins/CoreHome/templates/broadcast.js index 8cbf8c3ef8..7cbb033ae3 100644 --- a/plugins/CoreHome/templates/broadcast.js +++ b/plugins/CoreHome/templates/broadcast.js @@ -137,11 +137,9 @@ broadcast.updateParamValue = function(newParamValue,urlStr) var valFromUrl = broadcast.getParamValue(paramName,urlStr); if( valFromUrl != '') { - // Prepending '=' to both regToBerePlace and new_val, - // this would make sure that it will only replacing the value that follow by an '=' - var new_val = '=' + p_v[1]; - var regToBeReplace = new RegExp('=' + valFromUrl, 'ig'); - urlStr = urlStr.replace( regToBeReplace, new_val ); + // replacing current param=value to newParamValue; + var regToBeReplace = new RegExp(paramName + '=' + valFromUrl, 'ig'); + urlStr = urlStr.replace( regToBeReplace, newParamValue ); } else { urlStr += (urlStr == '') ? newParamValue : '&' + newParamValue; } @@ -170,7 +168,11 @@ broadcast.loadAjaxContent = function(urlAjax) broadcast.lastUrlRequested = null; } } - piwikMenu.activateMenu( broadcast.getParamValue('module', urlAjax), broadcast.getParamValue('action', urlAjax)); + piwikMenu.activateMenu( + broadcast.getParamValue('module', urlAjax), + broadcast.getParamValue('action', urlAjax), + broadcast.getParamValue('idGoal', urlAjax) + ); ajaxRequest = { type: 'GET', url: urlAjax, @@ -291,4 +293,4 @@ broadcast.getParamValue = function (param, url) } else { return ''; } -};
\ No newline at end of file +}; diff --git a/plugins/CoreHome/templates/menu.js b/plugins/CoreHome/templates/menu.js index d82ba8f7b1..5c1186ed57 100644 --- a/plugins/CoreHome/templates/menu.js +++ b/plugins/CoreHome/templates/menu.js @@ -64,7 +64,8 @@ menu.prototype = var url = $(this).find('a').attr('name'); var module = broadcast.getValueFromUrl("module",url); var action = broadcast.getValueFromUrl("action",url); - + var idGoal = broadcast.getValueFromUrl("idGoal",url); + var main_menu = ($(this).parent().attr("class").match(/nav/)) ? true : false; if(main_menu) { @@ -72,26 +73,47 @@ menu.prototype = } else { - $(this).attr({id: module + '_' + action}); + // so Goals plugin is a little different than other + // we can't identify by it's modules_action so we uses its idGoals. + if(idGoal != '') { + $(this).attr({id: module + '_' + action + '_' + idGoal}); + } + else { + $(this).attr({id: module + '_' + action}); + } } }); }, - activateMenu : function(module,action) + activateMenu : function(module,action,idGoal) { - // we are in the SUB UL LI - var $li = $("#" + module + "_" + action); - piwikMenu.param.superfish.find("li").removeClass('sfHover'); - // we are in the SUB UL LI - if($li.find('ul li').size() == 0) { - $.fn.superfish.currentActiveMenu = $li.parents('li'); - $li.addClass('sfHover'); - $li.parents('ul').css({'display':'block','visibility': 'visible'}); + // getting the right li is a little tricky since goals uses idGoal, and overview is index. + var $li = ''; + // So, if module is Goals, idGoal is present, and action is not Index, must be one of the goals + if(module == 'Goals' && idGoal != '' && action != 'index') { + $li = $("#" + module + "_" + action + "_" + idGoal); } else { + $li = $("#" + module + "_" + action); + } + + // we can't find this li based on Module_action? then li only be the main menu. e.g Dashboard. + var no_sub_menu = false; + if($li.size() == 0) { + $li = $("#" + module); + no_sub_menu = true; + } + + piwikMenu.param.superfish.find("li").removeClass('sfHover'); + if($li.find('ul li').size() != 0 || no_sub_menu == true) { // we clicked on a MAIN LI - $.fn.superfish.currentActiveMenu = $li; - $li.find('>ul li:first').addClass('sfHover'); - $li.find('ul').css({'display':'block','visibility': 'visible'}); + $.fn.superfish.currentActiveMenu = $li; + $li.find('>ul li:first').addClass('sfHover'); + $li.find('ul').css({'display':'block','visibility': 'visible'}); + } else { + // we are in the SUB UL LI + $.fn.superfish.currentActiveMenu = $li.parents('li'); + $li.addClass('sfHover'); + $li.parents('ul').css({'display':'block','visibility': 'visible'}); } $.fn.superfish.currentActiveMenu.showSuperfishUl().siblings().hideSuperfishUl(); }, |