diff --git a/includes/jump-menu.inc b/includes/jump-menu.inc index c5583cc..3729141 100644 --- a/includes/jump-menu.inc +++ b/includes/jump-menu.inc @@ -116,5 +116,17 @@ function ctools_jump_menu($form_state, $select, $options = array()) { * This is normally only invoked upon submit without javascript enabled. */ function ctools_jump_menu_submit($form, &$form_state) { - $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']; + } + + $form_state['redirect'] = $redirect; } diff --git a/js/jump-menu.js b/js/jump-menu.js index ad8d30c..128fd14 100644 --- a/js/jump-menu.js +++ b/js/jump-menu.js @@ -8,8 +8,12 @@ $('.ctools-jump-menu-change:not(.ctools-jump-menu-processed)') .addClass('ctools-jump-menu-processed') .change(function() { - var loc = $(this).val(); - if (loc) { + var loc = decodeURIComponent($(this).val()); + var urlArray = loc.split('::'); + if (urlArray[1]) { + location.href = urlArray[1]; + } + else { location.href = loc; } return false; @@ -22,12 +26,16 @@ // Find our sibling value. var $select = $(this).parents('form').find('.ctools-jump-menu-select'); - var loc = $select.val(); - if (loc) { + var loc = decodeURIComponent($select.val()); + var urlArray = loc.split('::'); + if (urlArray[1]) { + location.href = urlArray[1]; + } + else { location.href = loc; } return false; }); }; -})(jQuery); \ No newline at end of file +})(jQuery);