Ignore:
Timestamp:
Feb 6, 2007, 11:55:12 PM (17 years ago)
Author:
rub
Message:

Issue 0000598: NBM: Add new informations

Notification by mail:
Add new informations about last categories and last images like new feature of RSS notification.

2 parts:

  • Possibility to send HTML mail
  • Include last categories and last images on HTML format into notification mail

ccs & HTML experts! Please! Check, fix, improve and enhance HTML mail content!

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

    • Property svn:ignore
      •  

        old new  
        22gal2
        33feed.xml
         4testmail
  • trunk/admin/notification_by_mail.php

    r1748 r1784  
    8585
    8686      $must_repost = true;
    87       array_push($page['errors'], sprintf(l10n('nbm_background_treatment_redirect'), $time_refresh));
     87      array_push($page['errors'],
     88        l10n_dec('nbm_background_treatment_redirect_second',
     89                 'nbm_background_treatment_redirect_seconds',
     90                  $time_refresh));
    8891    }
    8992  }
     
    271274
    272275          // set env nbm user
    273           set_user_id_on_env_nbm($nbm_user['user_id']);
     276          set_user_on_env_nbm($nbm_user['user_id'], $is_action_send);
    274277
    275278          if ($is_action_send)
    276279          {
     280            set_make_full_url();
    277281            // Fill return list of "treated" check_key for 'send'
    278282            array_push($return_list, $nbm_user['check_key']);
    279             $message = '';
    280283
    281284            if ($conf['nbm_send_detailed_content'])
    282285            {
    283                $news = news($nbm_user['last_send'], $dbnow);
     286               $news = news($nbm_user['last_send'], $dbnow, false, $conf['nbm_send_html_mail']);
    284287               $exist_data = count($news) > 0;
    285288            }
     
    292295            {
    293296              $subject = '['.$conf['gallery_title'].']: '.l10n('nbm_object_news');
    294               $message .= sprintf(l10n('nbm_content_hello'), $nbm_user['username']).",\n\n";
     297
     298              // Assign current var for nbm mail
     299              assign_vars_nbm_mail_content($nbm_user);
     300
     301              $end_punct = ($conf['nbm_send_detailed_content'] ? ':' : '.');
    295302
    296303              if (!is_null($nbm_user['last_send']))
    297                 $message .= sprintf(l10n('nbm_content_new_elements_between'), $nbm_user['last_send'], $dbnow);
    298               else
    299                 $message .= sprintf(l10n('nbm_content_new_elements'), $dbnow);
    300 
    301               if ($conf['nbm_send_detailed_content'])
    302304              {
    303                 $message .= ":\n";
    304 
    305                 foreach ($news as $line)
    306                 {
    307                   $message .= '  o '.$line."\n";
    308                 }
    309                 $message .= "\n";
     305                $env_nbm['mail_template']->assign_block_vars
     306                (
     307                  'content_new_elements_between',
     308                  array
     309                  (
     310                    'DATE_BETWEEN_1' => $nbm_user['last_send'],
     311                    'DATE_BETWEEN_2' => $dbnow,
     312                    'END_PUNCT' => $end_punct
     313                  )
     314                );
    310315              }
    311316              else
    312317              {
    313                 $message .= ".\n";
     318                $env_nbm['mail_template']->assign_block_vars
     319                (
     320                  'content_new_elements_single',
     321                  array
     322                  (
     323                    'DATE_SINGLE' => $dbnow,
     324                    'END_PUNCT' => $end_punct
     325                  )
     326                );
    314327              }
    315328
    316               $message .= sprintf(l10n('nbm_content_goto'), $conf['gallery_title'], $conf['gallery_url'])."\n\n";
    317               $message .= $customize_mail_content."\n\n";
    318               $message .= l10n('nbm_content_byebye')."\n   ".$env_nbm['send_as_name']."\n\n";
    319 
    320               $message .= get_mail_content_subscribe_unsubcribe($nbm_user);
    321 
    322               if (pwg_mail(format_email($nbm_user['username'], $nbm_user['mail_address']), $env_nbm['send_as_mail_formated'], $subject, $message))
     329              if ($conf['nbm_send_detailed_content'])
     330              {
     331                foreach ($news as $data)
     332                {
     333                  $env_nbm['mail_template']->assign_block_vars
     334                  (
     335                    'global_new_line.new_line', array('DATA' => $data)
     336                  );
     337                }
     338              }
     339
     340              if (!empty($customize_mail_content))
     341              {
     342                $env_nbm['mail_template']->assign_block_vars
     343                (
     344                  'custom', array('CUSTOMIZE_MAIL_CONTENT' => $customize_mail_content)
     345                );
     346              }
     347
     348              if ($conf['nbm_send_html_mail'] and $conf['nbm_send_recent_post_dates'])
     349              {
     350                $recent_post_dates = get_recent_post_dates(7, 5, 9);
     351                foreach ($recent_post_dates as $date_detail)
     352                {
     353                  $env_nbm['mail_template']->assign_block_vars
     354                  (
     355                    'recent_post.recent_post_block',
     356                    array
     357                    (
     358                      'TITLE' => get_title_recent_post_date($date_detail),
     359                      'HTML_DATA' => get_html_description_recent_post_date($date_detail)
     360                    )
     361                  );
     362                }
     363              }
     364
     365              $env_nbm['mail_template']->assign_block_vars
     366              (
     367                'goto',
     368                array
     369                (
     370                  'GALLERY_TITLE' => $conf['gallery_title'],
     371                  'GALLERY_URL' => $conf['gallery_url']
     372                )
     373              );
     374
     375              $env_nbm['mail_template']->assign_block_vars
     376              (
     377                'byebye', array('SEND_AS_NAME' => $env_nbm['send_as_name'])
     378              );
     379
     380              if (pwg_mail(
     381                    format_email($nbm_user['username'], $nbm_user['mail_address']),
     382                    $env_nbm['send_as_mail_formated'],
     383                    $subject,
     384                    $env_nbm['mail_template']->parse('notification_by_mail', true),
     385                    $env_nbm['email_format'], $env_nbm['email_format']
     386                    ))
    323387              {
    324388                inc_mail_sent_success($nbm_user);
     
    332396                inc_mail_sent_failed($nbm_user);
    333397              }
     398
     399              unset_make_full_url();
    334400            }
    335401          }
     
    342408            }
    343409          }
     410         
     411          // unset env nbm user
     412          unset_user_on_env_nbm();
    344413        }
    345414
     
    438507      }
    439508   
    440       array_push($page['infos'], sprintf(l10n('nbm_updated_param_count'), $updated_param_count));
     509      array_push($page['infos'],
     510        l10n_dec('nbm_updated_param_count', 'nbm_updated_params_count',
     511          $updated_param_count));
    441512
    442513      // Reload conf with new values
     
    543614      $page['mode'],
    544615      array(
     616        'SEND_HTML_MAIL_YES' => ($conf['nbm_send_html_mail'] ? 'checked="checked"' : ''),
     617        'SEND_HTML_MAIL_NO' => (!$conf['nbm_send_html_mail'] ? 'checked="checked"' : ''),
    545618        'SEND_MAIL_AS' => $conf['nbm_send_mail_as'],
    546619        'SEND_DETAILED_CONTENT_YES' => ($conf['nbm_send_detailed_content'] ? 'checked="checked"' : ''),
    547620        'SEND_DETAILED_CONTENT_NO' => (!$conf['nbm_send_detailed_content'] ? 'checked="checked"' : ''),
    548         'COMPLEMENTARY_MAIL_CONTENT' => $conf['nbm_complementary_mail_content']
     621        'COMPLEMENTARY_MAIL_CONTENT' => $conf['nbm_complementary_mail_content'],
     622        'SEND_RECENT_POST_DATES_YES' => ($conf['nbm_send_recent_post_dates'] ? 'checked="checked"' : ''),
     623        'SEND_RECENT_POST_DATES_NO' => (!$conf['nbm_send_recent_post_dates'] ? 'checked="checked"' : '')
    549624        ));
    550625    break;
Note: See TracChangeset for help on using the changeset viewer.