Changeset 5670 for extensions


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

[Mail_supervisor] Code refactoring for Piwigo 2.1 compliance

Location:
extensions/Mail_supervisor
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • extensions/Mail_supervisor/admin/mail_black_liste.tpl

    r4939 r5670  
    11{* $Id: mail_black_liste.tpl 3723 2009-08-07 04:53:38Z rvelices $ *}
    2 {known_script id="jquery" src=$ROOT_URL|@cat:"template-common/lib/jquery.packed.js"}
    3 {known_script id="jquery.cluetip" src=$ROOT_URL|@cat:"template-common/lib/plugins/jquery.cluetip.packed.js"}
     2{known_script id="jquery" src=$path_js|@cat:"jquery.packed.js"}
     3{known_script id="jquery.cluetip" src=$path_js|@cat:"plugins/jquery.cluetip.packed.js"}
    44
    55<script type="text/javascript">
    6 jQuery().ready(function(){ldelim}
    7   jQuery('.cluetip').cluetip({ldelim}
    8     width: 300,
     6jQuery().ready(function()
     7{ldelim}
     8  jQuery('.cluetip').cluetip(
     9  {ldelim}
     10    width: 550,
    911    splitTitle: '|'
    10   });
    11 });
     12  {rdelim});
     13{rdelim});
    1214</script>
    1315
  • 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 ) {
  • extensions/Mail_supervisor/admin/mail_superv_admin.tpl

    r4888 r5670  
    1 {* $Id: mail_black_liste.tpl 3723 2009-08-07 04:53:38Z rvelices $ *}
    2 {known_script id="jquery" src=$ROOT_URL|@cat:"template-common/lib/jquery.packed.js"}
    3 {known_script id="jquery.cluetip" src=$ROOT_URL|@cat:"template-common/lib/plugins/jquery.cluetip.packed.js"}
     1{known_script id="jquery" src= $ROOT_URL|@cat:$path_js|@cat:"jquery.packed.js"}
     2{known_script id="jquery.cluetip" src=$ROOT_URL|@cat:$path_js|@cat:"plugins/jquery.cluetip.packed.js"}
    43
    54<script type="text/javascript">
  • extensions/Mail_supervisor/admin/mail_superv_help.tpl

    r4888 r5670  
     1{known_script id="my_script" src= $MAIL_SUPERV_PATH|@cat:"include/Scripts.js"}
    12<div class="instructions" >
    23<h2>{'Sv_Tab_help'|translate}{'Sv_version'|translate}{$version}</h2>
  • extensions/Mail_supervisor/admin/mail_superv_test.tpl

    r4888 r5670  
    2121         {$liste}
    2222         </td>
    23          
    2423    </tr>
    2524
     
    2726      <td><strong>{'Sv_mail_content'|@translate}</strong></td>
    2827      <td>
    29         <textarea cols="50" rows="5" name="content" id="mail_content" class="description">{$message_test}</textarea>
     28<textarea name="MAIL_CONTENT" id="MAIL_CONTENT" class="description">{$MAIL_CONTENT}</textarea>
    3029      </td>
    3130    </tr>
     
    3635          <input class="submit" type="submit" name="raffraichir" value="{'Sv_refresh'|translate}" />
    3736          <input class="submit" type="submit" name="test_envoie" value="{'Sv_Test'|translate}" />
    38          
    39        
    40          
     37        <input class="submit" type="submit" value="{'Submit'|@translate}" name="submitEmail" {$tag_input_enabled}/>
    4138          </p>
    4239</fieldset>
  • extensions/Mail_supervisor/include/fonctions.php

    r4925 r5670  
    6363           
    6464                $valeurs = implode( ',',$mails_options);
     65 
     66               
    6567                $query = '
    6668                UPDATE '.CONFIG_TABLE.'
     
    9294            array_push($valeurs , "`".$champ."`" . ' = ' .  "0"  )  ;
    9395         }
     96         
    9497    }
    9598$valeurs = implode(", ",$valeurs) ;
  • extensions/Mail_supervisor/include/function_test_send.php

    r4925 r5670  
    6565$groups=get_liste($group_id);
    6666
    67  
    6867//=======================================================================================
    6968  if (count($groups) > 0)
     
    7473   }
    7574   
    76         $args['from'] = $conf_mail['formated_email_webmaster'];
    77 
     75$args['from'] =(function_exists('get_user_language_desc')) ? get_user_language_desc($conf_mail['formated_email_webmaster']):$conf_mail['formated_email_webmaster'];
     76$message_html =$message;
    7877      if (function_exists('get_user_language_desc') and isset($message) and $message <> '')
    7978        $message = get_user_language_desc($message)."\n\n";
     
    8887        );     
    8988        //==================================================================
    90         $message_html = $message_texte;
     89        $message_html .= "</br>" . $message . "</br>" . $message_texte;
    9190
    9291       
     
    223222   }
    224223
    225    
    226224    return  $ret;
    227225 
    228226}
    229227
    230  
    231228?>
  • extensions/Mail_supervisor/main.inc.php

    r4938 r5670  
    22/*
    33Plugin Name: Mail supervisor
    4 Version: 1.3.7
     4Version: 1.4.0
    55Description: Mail supervisor surveille l'envoie des mails.
    66Plugin URI: http://piwigo.org/ext/extension_view.php?eid=315
Note: See TracChangeset for help on using the changeset viewer.