function content_dialog_handle_after_save

6.x content.module content_dialog_handle_after_save()

This is the URL we redirect to after saving a piece of content in a dialog, so all we really want to do is close the dialog and reload the parent page.

Remember, we are inside an iframe.

File

modules/content/content.module, line 770

Code

function content_dialog_handle_after_save() {

  $rtn = "";

  $rtn = "";

  $timeout = 1000;

  if (isset($_REQUEST ['del']) && $_REQUEST ['del'] != '') {
    $rtn .= "<h2 class='dialog-handle-after-save'>" . t("The content has been deleted successfully.<br><br>Closing window...") . "</h2>";
  }
  else if (isset($_REQUEST ['cancel']) && $_REQUEST ['cancel'] != '') {
    $rtn .= "<h2 class='dialog-handle-after-save'>" . t("Cancellation successful.<br><br>Closing window...") . "</h2>";
  }
  else {
    $rtn .= "<h2 class='dialog-handle-after-save'>" . t("Your submission has been saved correctly!<br><br>Closing window...") . "</h2>";
  }

  $rtn .= "<br><br><p>" . t("If this windows doesn't close within 3 seconds,") . " <a href='javascript:window.parent.location.reload();'>" . t("click here") . "</a>.</p>";

  // Add this javascript code to when the page loads.
  ///*  DEV: comment out while testing

  $rtn .= "
      <script type='text/javascript'>
        $(document).ready(function() {
          setTimeout(function() {
            
            window.parent.location.reload();
          
          }, $timeout);  
        });
      </script>
  ";
  //*/

  return $rtn;
}