diff --git a/includes/jump-menu.inc b/includes/jump-menu.inc index f586727..447f08a 100644 --- a/includes/jump-menu.inc +++ b/includes/jump-menu.inc @@ -116,8 +116,18 @@ function ctools_jump_menu($form, &$form_state, $select, $options = array()) { * This is normally only invoked upon submit without javascript enabled. */ function ctools_jump_menu_submit($form, &$form_state) { - $redirect = $form_state['values']['jump']; - + // If the path we are redirecting to contains the string :: then treat the + // the string after the double colon as the path to redirect to. + // This allows duplicate paths to be used in jump menus for multiple options. + $redirect_array = explode("::",$form_state['values']['jump']); + + if(isset($redirect_array[1]) && !empty($redirect_array[1])){ + $redirect = $redirect_array[1]; + } + else { + $redirect = $form_state['values']['jump']; + } + // If the path we are redirecting to starts with the base path (for example, // "/somepath/node/1"), we need to strip the base path off before passing it // to $form_state['redirect']. diff --git a/js/jump-menu.js b/js/jump-menu.js index f515c8c..6bd0af6 100644 --- a/js/jump-menu.js +++ b/js/jump-menu.js @@ -10,7 +10,11 @@ .addClass('ctools-jump-menu-processed') .change(function() { var loc = $(this).val(); - if (loc) { + var urlArray = loc.split('::'); + if (urlArray[1]) { + location.href = urlArray[1]; + } + else { location.href = loc; } return false; @@ -24,7 +28,11 @@ // Find our sibling value. var $select = $(this).parents('form').find('.ctools-jump-menu-select'); var loc = $select.val(); - if (loc) { + var urlArray = loc.split('::'); + if (urlArray[1]) { + location.href = urlArray[1]; + } + else { location.href = loc; } return false;