Ignore:
Timestamp:
Apr 5, 2010, 3:49:03 PM (14 years ago)
Author:
cljosse
Message:

[Mail_supervisor] Code refactoring for Piwigo 2.1 compliance

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/Mail_supervisor/admin/mail_superv_admin.php

    r4938 r5670  
    6060  $page['tab'] = $_GET['tab'];
    6161
    62  $icon_path = 'template/yoga/icon/help.png';
    63 
    64 $tabhelp=  '  <img src="'.PHPWG_ROOT_PATH. $icon_path .'" class="button" alt="(?)"> ';
     62if (file_exists ( 'admin/themes/clear/icon/help.png'))
     63{
     64//version 2.1
     65 
     66   $icon_path = 'themes/default/icon/help.png';
     67   $path_js=  'themes/default/js/' ;
     68
     69 }
     70 else
     71 {
     72// version 1.9
     73  $path_js=  "template-common/lib/"; 
     74  $icon_path =  "admin/template/goto/theme/clear/icon/help.png";
     75}
     76 
     77
     78$tabhelp=  '  <img src="'.PHPWG_ROOT_PATH. $icon_path .'"  width=10px   alt="(?)"> ';
    6579
    6680 
     
    8094 
    8195                                                   
    82 $tabsheet->add('mail_superv_help',$tabhelp
    83               ,
     96$tabsheet->add('mail_superv_help',
     97                $tabhelp,
    8498               $my_base_url.'&amp;tab=mail_superv_help');
    8599                           
     
    272286    'PHPWG_VERSION' =>   PHPWG_VERSION ,
    273287         'version' =>    $version ,
    274        
     288        'MAIL_SUPERV_PATH' =>  MAIL_SUPERV_PATH ,
     289        'path_js' => $path_js
    275290                                                )
    276291                                );     
     
    289304   
    290305   $mails_données = Get_Datas() ;
    291    
    292306        $group_id = isset($_POST['group']) ? $_POST['group'] :  '-1'  ;
    293307        if ($group_id >= 0) {
     
    303317                }               
    304318//================================================
    305 
    306 
    307        
     319// info by email to an access granted group of category informations
     320if (isset($_POST['submitEmail']) and !empty($_POST['group']))
     321{
     322  set_make_full_url();
     323  /* TODO: if $category['representative_picture_id']
     324    is empty find child representative_picture_id */
     325/*
     326 * send en email to user's group
     327 *
     328 * @param:
     329 *   - group_id: mail are sent to group with this Id
     330 *   - email_format: mail format
     331 *   - keyargs_subject: mail subject on l10n_args format
     332 *   - dirname: short name of directory including template
     333 *   - tpl_shortname: short template name without extension
     334 *   - assign_vars: array used to assign_vars to mail template
     335 *   - language_selected: send mail only to user with this selected language
     336 *
     337 * @return boolean (Ok or not)
     338*/
     339
     340if (function_exists('get_user_language_desc') ) $titre = get_user_language_desc($conf['gallery_title']);
     341else
     342$titre=$conf['gallery_title'];
     343
     344$message = empty($_POST['MAIL_CONTENT']) ? $mails_données['message_test'] : stripslashes($_POST['MAIL_CONTENT']);
     345
     346 if (function_exists('get_user_language_desc') ) $message = get_user_language_desc($message);
     347  // TODO Mettre un array pour traduction subjet
     348
     349 
     350  pwg_mail_group(
     351    $_POST['group'],
     352    get_str_email_format(true), 
     353    get_l10n_args('[%s] ---> %s', array($titre,'Information') ), //sujet
     354    'cat_group_info',  // template
     355    array
     356    (
     357      'CPL_CONTENT' => $message."\n\n".$user['username']
     358    ),
     359    '' );
     360       
     361
     362$mails_données['message_test']= str_replace('"',"'",$message) ;
     363 unset_make_full_url();
     364        sauve_données();
     365$mails_données = Get_Datas() ;
     366       
     367  $query = '
     368SELECT
     369    name
     370  FROM '.GROUPS_TABLE.'
     371  WHERE id = '.$_POST['group'].'
     372;';
     373  list($group_name) = mysql_fetch_row(pwg_query($query));
     374 
     375  array_push(
     376    $page['infos'],
     377    sprintf(
     378      l10n('An information email was sent to group "%s"'),
     379      $group_name
     380      )
     381    );
     382
     383 load_language('plugin.lang', MAIL_SUPERV_PATH);
     384//=====================================================================================
    308385if ( isset($_POST['test_envoie']) ) {
    309        
    310                 $mails_données['message_test'] = isset($_POST['content']) ? $_POST['content'] :  $mails_données['message_test']  ;
     386$mails_données['message_test'] = empty($_POST['MAIL_CONTENT']) ? '' : stripslashes($_POST['MAIL_CONTENT']);
    311387                $message=$mails_données['message_test'];
     388//test_envoie($message,$group_name,$group_id);
    312389                sauve_données();
    313                 test_envoie($message,$group_name,$group_id);  
     390 
    314391                $mails_données = Get_Datas() ;
    315392               
     
    347424                                'liste' => $destinataires ,
    348425 'version' =>    $version ,
     426                            'MAIL_CONTENT' => $mails_données['message_test'],
     427                    'path_js' => $path_js
    349428                                                )
    350429                                );     
     
    352431        $template->set_filenames(array('plugin_admin_content' => realpath(MAIL_SUPERV_PATH . 'admin/mail_superv_test.tpl')));
    353432                $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
     433               
     434                  $toolbar = 'Basic';
     435  $width = '750px';
     436  $height = '200px';
     437  $areas = array();
     438  $areas[]='MAIL_CONTENT';
     439 //  $areas[]= 'MAIL_CONTENT';
     440 if (!empty($areas))
     441  {
     442  if (function_exists('set_fckeditor_instance'))
     443    set_fckeditor_instance($areas, $toolbar, $width, $height);
     444  }
     445 
    354446   break;
    355447// *************************************************************************
     
    435527                                                'champs_bl' =>  $champs_bl       ,     
    436528                                                'liste_bl' => $liste_bl ,
    437                                 'conf_admin_layout' => $conf['admin_layout'] ,
     529                                //'conf_admin_layout' => $conf['admin_layout'] ,
    438530                                                'istype' => $istype ,
    439531                                                'ip_black' => $ip_black ,
     
    441533                                                'ip_black_len' =>  strlen($ip_black)  ,
    442534                                                'MAIL_SUPERV_PATH' => MAIL_SUPERV_PATH ,
    443 
     535                            'path_js' => $path_js ,
    444536                                                'F_ACTION' => $f_action ,
    445537                                               
     
    474566                                        'smile_bonjour' => $smile_bonjour ,
    475567                                         'version' =>    $version ,
     568                                         'MAIL_SUPERV_PATH' =>  MAIL_SUPERV_PATH ,
     569                         'path_js' => $path_js
    476570                                        )
    477571                        );             
     
    486580//================================================================================
    487581
     582           
    488583
    489584        if  ( $mails_données['reste'] < 0 ) {
Note: See TracChangeset for help on using the changeset viewer.