Hi,

I'm about to add a feature into Node Go To in my own Drupal installation and wanted to know if I there was any interest and support to have this officially reviewed and added to Node Go To?

The feature goes like this:
Whenever somebody opens a form from a view (or some other place in Drupal) and then updates the form content, they should be after the submit redirected to the place they came from as long as it lies within the current Drupal site.
An example: I have an address form that shows up in multiple views, and some views use the Views Alpha Pager. Whenever users update an address, they should be sent back to the view they came from (and the alpha pager page they came from) for best usability.

The way I'm planning it to implement:
- Add a setting to the Node Go To Admin screen that allows an admin to check if they want that feature activated.
- Write the HTTP Referrer to the user's session cookie whenever a tracked form is being opened.
- On Submit, check if the admin setting is set, then if there is a cookie value there to be used. If yes, redirect to the cookie value.

Does this sound OK? Is there maybe another module doing this already? Node Go To comes so close, and I like that it is a very focussed module.

Sorry if this is not the official way to ask for something like this; I'm relatively new to writing code for Drupal.
Regards,
Gerald

Comments

vm’s picture

Category: support » feature
bighoffa’s picture

I would find this feature to be extremely useful. Let me know how things are progressing and if you might need some assistance in programming or testing.

Gerald Mengisen’s picture

Thank you very much for your offer and sorry for my late reply.

Meanwhile, I've found a workaround for views in general:
Add a "Node: Edit link" column to your view and choose "Return to view" as handler. This returns you in the view where you came from, even for alpha pager views.

It's not perfect, but suffices for my current project. I'll get back to this once my project ends (end of October).

If somebody else wants to give it a shot, I've so far identified the place where you would store the referrer:

function nodegoto_nodeapi(&$node, $op, $teaser, $page){
  
  if($node->type == 'myform_towatch' && $page){
    switch ($op) {
        case 'view':
          //$_SESSION['nodegoto_referrer'] = $_SERVER['HTTP_REFERER'];
          // watchdog("nodegotoe,"View Referrer: " . $_SERVER['HTTP_REFERER']);
          break;
          
        case 'insert':
          // watchdog("nodegoto","Insert Referrer: " . $_SERVER['HTTP_REFERER']);
          break;
        case 'delete':
          // watchdog("nodegoto", "Delete Referrer: " . $_SERVER['HTTP_REFERER']);
          break;
        default:
          break;
    }
  }
}

I've also read somewhere that $_SERVER['HTTP_REFERER'] cannot be trusted to contain something, and that Drupal 6 stores the link history, so a Drupal 6 implementation would be certainly more bullet-proof. For Drupal 5, I would use the redirections defined in the Node Goto admin sections in case the referrer is empty.