cvs diff: Diffing includes Index: includes/signup_cancel.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/signup/includes/signup_cancel.inc,v retrieving revision 1.1.2.2 diff -u -p -r1.1.2.2 signup_cancel.inc --- includes/signup_cancel.inc 20 Dec 2008 04:28:56 -0000 1.1.2.2 +++ includes/signup_cancel.inc 24 Jan 2009 02:00:03 -0000 @@ -29,12 +29,14 @@ function signup_cancel_link_confirm_form ); $form['#submit'][] = 'signup_cancel_link_confirm_form_submit'; + $abort_url = isset($_REQUEST['destination']) ? $_REQUEST['destination'] : "node/$info->nid"; + // TODO: Should this include information to identify the username, // anon_mail, and possibly the custom signup form data, too? return confirm_form( $form, t('Are you sure you want to cancel the signup to %node_title?', array('%node_title' => $info->title)), - 'node/'. $info->nid, + $abort_url, t('This action cannot be undone.'), t('Cancel signup'), t('Keep signup') ); Index: includes/signup_edit_form.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/signup/includes/signup_edit_form.inc,v retrieving revision 1.1.2.2 diff -u -p -r1.1.2.2 signup_edit_form.inc --- includes/signup_edit_form.inc 22 Jan 2009 20:13:22 -0000 1.1.2.2 +++ includes/signup_edit_form.inc 24 Jan 2009 02:00:03 -0000 @@ -98,9 +98,6 @@ function signup_edit_form($form_state, $ if (!$can_edit) { // If they can't edit, mark all the fields as disabled. $site_form['signup_form_data'][$key]['#disabled'] = TRUE; - // Also, remove the required attribute from all fields (so that the - // cancel button, if it exists, will work). - $site_form['signup_form_data'][$key]['#required'] = FALSE; } } } @@ -115,10 +112,18 @@ function signup_edit_form($form_state, $ ); } if ($can_cancel) { + if (isset($_REQUEST['destination'])) { + $destination = drupal_get_destination(); + unset($_REQUEST['destination']); + } + else { + // If there's no destination already set, redirect to the node. + $destination = 'destination='. urlencode("node/$signup->nid"); + } + $signup_token = signup_get_token($signup->sid, 'cancel'); $form['elements']['cancel-signup'] = array( - '#type' => 'submit', - '#value' => t('Cancel signup'), - '#submit' => array('signup_edit_form_cancel_submit'), + '#type' => 'markup', + '#value' => l(t('Cancel signup'), "signup/cancel/$signup->sid/$signup_token", array('query' => $destination)), ); } @@ -172,17 +177,6 @@ function signup_edit_form_save_submit($f } /** - * Submit callback to cancel the signup when editing an existing signup. - */ -function signup_edit_form_cancel_submit($form, &$form_state) { - signup_cancel_signup($form['#signup']->sid); - if (empty($_REQUEST['destination'])) { - // If there's no destination already set, redirect to the node. - $form_state['redirect'] = 'node/'. $form['#signup']->nid; - } -} - -/** * Page handler for the administrator page to edit an existing signup. * * @param $signup cvs diff: Diffing js Index: js/signup_edit_form.js =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/signup/js/signup_edit_form.js,v retrieving revision 1.1 diff -u -p -r1.1 signup_edit_form.js --- js/signup_edit_form.js 22 Jan 2009 18:59:29 -0000 1.1 +++ js/signup_edit_form.js 24 Jan 2009 02:00:03 -0000 @@ -7,9 +7,6 @@ * except for the 'Update signup' button. When a user clicks that, * the other form elements are enabled, and the 'Update signup' button * text changes into 'Save changes'. - * - * We also have to enable the form elements whenever the form is - * submitted so that the cancel button works properly. */ Drupal.behaviors.enableSignupEditForm = function(context) { var $button = $('#edit-save', context).click(enableSave); @@ -19,17 +16,11 @@ Drupal.behaviors.enableSignupEditForm = $form_elements.attr('disabled', 'disabled'); $button.attr('disabled', '').val(Drupal.t('Edit')); - $('#edit-cancel-signup').attr('disabled', '') - $form.submit(enableElements); function enableSave() { $form_elements.attr('disabled', ''); $button.unbind('click', enableSave).val(original_button_title); return false; } - - function enableElements() { - $form_elements.attr('disabled', ''); - } }