Ignore:
Timestamp:
Apr 15, 2006, 1:25:48 AM (19 years ago)
Author:
rub
Message:

Issue ID 330:

o Remove "background treatment"
o Add button "Continue treatment"

Report of svn:1177 (BSF Branch)

Warning: functions.inc.php is not the same of BSF/trunk branch (die_on_sql_error)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/branch-1_6/admin/notification_by_mail.php

    r1161 r1178  
    5151// +-----------------------------------------------------------------------+
    5252$base_url = get_root_url().'admin.php';
     53$must_repost = false;
    5354
    5455// +-----------------------------------------------------------------------+
     
    5758
    5859/*
    59  * Do background treatmetn in order to finish to send mails
     60 * Do timeout treatment in order to finish to send mails
    6061 *
    6162 * @param $post_keyname: key of check_key post array
    62  * @param check_key_treated:array of check_key treated
     63 * @param check_key_treated: array of check_key treated
    6364 * @return none
    6465 */
    65 function do_background_treatment($post_keyname, $check_key_treated = array())
    66 {
    67   global $env_nbm, $base_url;
     66function do_timeout_treatment($post_keyname, $check_key_treated = array())
     67{
     68  global $env_nbm, $base_url, $page, $must_repost;
    6869
    6970  if ($env_nbm['is_sendmail_timeout'])
     
    7980      else
    8081      {
    81         $time_refresh = 10;
     82        $time_refresh = 0;
    8283      }
    8384      $_POST[$post_keyname] = array_diff($_POST[$post_keyname], $check_key_treated);
    84       re_post_http($base_url.get_query_string_diff(array()), sprintf(l10n('nbm_background_treatment_redirect'), $time_refresh) , $time_refresh);
     85     
     86      $must_repost = true;
     87      array_push($page['errors'], sprintf(l10n('nbm_background_treatment_redirect'), $time_refresh));
    8588    }
    8689  }
     
    117120{
    118121  global $conf, $page, $env_nbm;
    119 
    120   // Treatment of simulate post
    121   if (isset($_POST['insert_new_user_nbm']))
    122   {
    123      $check_key_treated = do_subscribe_unsubcribe_notification_by_mail
    124     (
    125       true,
    126       $conf['nbm_default_value_user_enabled'],
    127       $_POST['insert_new_user_nbm']
    128     );
    129     do_background_treatment('insert_new_user_nbm', $check_key_treated);
    130   }
    131122
    132123  // Set null mail_address empty
     
    197188    if ($env_nbm['is_sendmail_timeout'])
    198189    {
    199       if ($conf['nbm_default_value_user_enabled'])
    200       {
    201         // Simulate Post
    202         $_POST['insert_new_user_nbm'] = $check_key_list;
    203         do_background_treatment('insert_new_user_nbm', $check_key_treated);
     190      $quoted_check_key_list = quote_check_key_list(array_diff($check_key_list, $check_key_treated));
     191      if (count($quoted_check_key_list) != 0 )
     192      {
     193        $query = 'delete from '.USER_MAIL_NOTIFICATION_TABLE.' where check_key in ('.implode(",", $quoted_check_key_list).');';
     194        $result = pwg_query($query);
     195
     196        redirect($base_url.get_query_string_diff(array()));
    204197      }
    205198    }
     
    231224    $data_users = get_user_notifications('send', $check_key_list);
    232225
     226    // List all if it's define on options or on timeout
     227    $is_list_all_without_test = ($env_nbm['is_sendmail_timeout'] or $conf['nbm_list_all_enabled_users_to_send']);
     228
    233229    // Check if exist news to list user or send mails
    234     if (($conf['nbm_list_all_enabled_users_to_send'] == false) or ($is_action_send))
     230    if ((!$is_list_all_without_test == false) or ($is_action_send))
    235231    {
    236232      if (count($data_users) > 0)
     
    241237        if ($is_action_send)
    242238        {
    243           $msg_break_timeout = l10n('nbm_nbm_break_timeout_send_mail');
     239          $msg_break_timeout = l10n('nbm_break_timeout_send_mail');
    244240        }
    245241        else
     
    461457    {
    462458      $check_key_treated = unsubcribe_notification_by_mail(true, $_POST['cat_true']);
    463       do_background_treatment('cat_true', $check_key_treated);
     459      do_timeout_treatment('cat_true', $check_key_treated);
    464460    }
    465461    else
     
    467463    {
    468464      $check_key_treated = subcribe_notification_by_mail(true, $_POST['cat_false']);
    469       do_background_treatment('cat_false', $check_key_treated);
     465      do_timeout_treatment('cat_false', $check_key_treated);
    470466    }
    471467    break;
     
    477473    {
    478474      $check_key_treated = do_action_send_mail_notification('send', $_POST['send_selection'], $_POST['send_customize_mail_content']);
    479       do_background_treatment('send_selection', $check_key_treated);
     475      do_timeout_treatment('send_selection', $check_key_treated);
    480476    }
    481477  }
     
    518514}
    519515
     516if ($must_repost)
     517{
     518  // Get name of submit button
     519  $repost_submit_name = '';
     520  if (isset($_POST['falsify']))
     521  {
     522    $repost_submit_name = 'falsify';
     523  }
     524  elseif (isset($_POST['trueify']))
     525  {
     526    $repost_submit_name = 'trueify';
     527  }
     528  elseif (isset($_POST['send_submit']))
     529  {
     530    $repost_submit_name = 'send_submit';
     531  }
     532
     533  $template->assign_block_vars
     534  (
     535    'repost',
     536      array
     537      (
     538        'REPOST_SUBMIT_NAME' => $repost_submit_name
     539      )
     540    );
     541}
     542
    520543switch ($page['mode'])
    521544{
     
    590613              'CHECKED' =>  ( // not check if not selected,  on init select<all
    591614                              isset($_POST['send_selection']) and // not init
    592                               !in_array($nbm_user['check_key'],  $_POST['send_selection']) // not selected
     615                              !in_array($nbm_user['check_key'], $_POST['send_selection']) // not selected
    593616                            )   ? '' : 'checked="checked"',
    594617              'USERNAME'=> $nbm_user['username'],
Note: See TracChangeset for help on using the changeset viewer.