Index: modules/shortcut/shortcut.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/shortcut/shortcut.admin.inc,v retrieving revision 1.3 diff -u -r1.3 shortcut.admin.inc --- modules/shortcut/shortcut.admin.inc 2 Dec 2009 15:09:16 -0000 1.3 +++ modules/shortcut/shortcut.admin.inc 5 Dec 2009 01:50:38 -0000 @@ -372,6 +372,11 @@ function _shortcut_link_form_elements($shortcut_link = NULL) { '#default_value' => $shortcut_link['link_path'], ); + // If the shortcut has a query string, make it editable as well. + if (!empty($shortcut_link['options']['query'])) { + $form['shortcut_link']['link_path']['#default_value'] .= '?' . drupal_http_build_query($shortcut_link['options']['query']); + } + $form['#validate'][] = 'shortcut_link_edit_validate'; $form['submit'] = array( @@ -386,6 +391,11 @@ function shortcut_link_edit_validate($form, &$form_state) { * Validation handler for the shortcut link add and edit forms. */ function shortcut_link_edit_validate($form, &$form_state) { + $form_state['values']['shortcut_link']['options']['query'] = array(); + list($form_state['values']['shortcut_link']['link_path'], $query_string) = explode('?', $form_state['values']['shortcut_link']['link_path']); + if ($query_string) { + parse_str($query_string, $form_state['values']['shortcut_link']['options']['query']); + } if (!shortcut_valid_link($form_state['values']['shortcut_link']['link_path'])) { form_set_error('shortcut_link][link_path', t('The link must correspond to a valid path on the site.')); } @@ -502,11 +512,19 @@ function shortcut_link_add_inline($shortcut_set) { * Returned from shortcut_set_load(). */ function shortcut_link_add_inline($shortcut_set) { + if (strstr($_GET['link'], '?')) { + list($_GET['link'], $query_string) = explode('?', $_GET['link']); + $query = array(); + parse_str($query_string, $query); + } if (isset($_REQUEST['token']) && drupal_valid_token($_REQUEST['token'], 'shortcut-add-link') && shortcut_valid_link($_GET['link'])) { $link = array( 'link_title' => $_GET['name'], 'link_path' => $_GET['link'], ); + if (isset($query)) { + $link['options'] = array('query' => $query); + } shortcut_admin_add_link($link, $shortcut_set, shortcut_max_slots()); if (shortcut_set_save($shortcut_set)) { drupal_set_message(t('Added a shortcut for %title.', array('%title' => $link['link_title']))); Index: modules/shortcut/shortcut.module =================================================================== RCS file: /cvs/drupal/drupal/modules/shortcut/shortcut.module,v retrieving revision 1.11 diff -u -r1.11 shortcut.module --- modules/shortcut/shortcut.module 4 Dec 2009 16:49:47 -0000 1.11 +++ modules/shortcut/shortcut.module 5 Dec 2009 01:50:38 -0000 @@ -527,7 +527,8 @@ function shortcut_page_build(&$page) { function shortcut_page_build(&$page) { if (shortcut_set_edit_access()) { $link = $_GET['q']; - $query_parameters = drupal_get_query_parameters(); + // Allow query parameters in the shortcut link, with a few exceptions here. + $query_parameters = drupal_get_query_parameters(NULL, array('q', 'render', 'page')); if (!empty($query_parameters)) { $link .= '?' . drupal_http_build_query($query_parameters); } @@ -541,6 +541,9 @@ function shortcut_page_build(&$page) { // Check if $link is already a shortcut and set $link_mode accordingly. foreach ($shortcut_set->links as $shortcut) { + if (!empty($shortcut['options']['query'])) { + $shortcut['link_path'] .= '?' . drupal_http_build_query($shortcut['options']['query']); + } if ($link == $shortcut['link_path']) { $mlid = $shortcut['mlid']; break;