cvs diff: Diffing . Index: uc_addresses.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/uc_addresses/uc_addresses.module,v retrieving revision 1.28 diff -u -p -r1.28 uc_addresses.module --- uc_addresses.module 20 Apr 2009 20:54:10 -0000 1.28 +++ uc_addresses.module 6 Nov 2009 23:34:57 -0000 @@ -324,7 +327,7 @@ function uc_addresses_form_uc_cart_check $address_book_icon = l(uc_store_get_icon('file:address_book', FALSE, 'address-book-icon'), - 'user/'. $user->uid . '/addresses', array('html' => TRUE)); + 'user/'. $user->uid . '/addresses', array('html' => TRUE, 'query' => drupal_get_destination())); // If we have some addresses saved (almost always true), revise // the delivery/billing address selection @@ -727,7 +730,11 @@ function uc_addresses_list_addresses($ad // on whether the current user can edit the addresses if (user_access(UC_ADDRESSES_ACCESS_ADD_EDIT) || $user->uid == $uid) { - $link = l(t('Add a new address'), 'user/'. $uid .'/addresses/add'); + $link_options = array(); + if (isset($_REQUEST['destination'])) { + $link_options['query'] = drupal_get_destination(); + } + $link = l(t('Add a new address'), 'user/'. $uid .'/addresses/add', $link_options); $output .= $link; } @@ -786,16 +793,21 @@ function theme_uc_addresses_list_address $output = ''; } + + $link_options = array(); + if (isset($_REQUEST['destination'])) { + $link_options['query'] = drupal_get_destination(); + } foreach ($panes as $title => $data) { // We add an edit link only if the user is allowed to edit this address if (user_access(UC_ADDRESSES_ACCESS_ADD_EDIT) || $user->uid == $uid) { $output .= ''; } @@ -891,8 +903,20 @@ function uc_addresses_get_address_form(& } } - // Edit an existing address + // Decide where the cancel link should go, honoring drupal_set_destination(). + if (isset($_REQUEST['destination'])) { + extract(parse_url(urldecode($_REQUEST['destination']))); + } + else if (isset($_REQUEST['edit']['destination'])) { + extract(parse_url(urldecode($_REQUEST['edit']['destination']))); + } + else { + $path = "user/$uid/addresses"; + } + $cancel_url = url($path, array('query' => $query, 'fragment' => $fragment, 'absolute' => TRUE)); + + // Edit an existing address if ($view == 'edit') { $form['submit'] = array('#type' => 'submit', @@ -900,7 +924,7 @@ function uc_addresses_get_address_form(& $form['delete'] = array('#type' => 'submit', '#value' => variable_get('uc_addresses_delete_button', t('Delete address')), - '#suffix' => l(t('Cancel'), 'user/'. $uid .'/addresses/'), + '#suffix' => l(t('Cancel'), $cancel_url), '#disabled' => $address->is_default); } @@ -910,7 +934,7 @@ function uc_addresses_get_address_form(& $form['submit'] = array('#type' => 'submit', '#value' => variable_get('uc_addresses_update_button', t('Add address')), - '#suffix' => l(t('Cancel'), 'user/'. $uid .'/addresses/')); + '#suffix' => l(t('Cancel'), $cancel_url)); } return $form; cvs diff: Diffing po cvs diff: Diffing translations
' - . l(t('Edit this address'), 'user/'. $uid .'/addresses/' . $aid . '/edit') + . l(t('Edit this address'), 'user/'. $uid .'/addresses/' . $aid . '/edit', $link_options) . ($address->is_default ? '' : ' | ' - . l(t('Delete this address'), 'user/'. $uid .'/addresses/' . $aid . '/delete')) + . l(t('Delete this address'), 'user/'. $uid .'/addresses/' . $aid . '/delete', $link_options)) .'