Index: extensions/Mail_supervisor/admin/mail_superv_admin.php
===================================================================
--- extensions/Mail_supervisor/admin/mail_superv_admin.php	(revision 7050)
+++ extensions/Mail_supervisor/admin/mail_superv_admin.php	(revision 8917)
@@ -28,4 +28,5 @@
 
 if (!defined('MAIL_SUPERV_PATH')) define('MAIL_SUPERV_PATH' , PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)).'/');
+if (!defined('MAIL_SUPERV_PATH_ABS')) define('MAIL_SUPERV_PATH_ABS' ,  dirname(__FILE__).'/');
 
 global $user, $lang, $conf, $errors,$mails_donnees;
@@ -77,7 +78,4 @@
 
 $tabhelp=  '  <img src="'.PHPWG_ROOT_PATH. $icon_path .'"  width=10px   alt="(?)"> ';
-
- 
-
 $tabsheet = new tabsheet();
 $tabsheet->add('mail_superv_admin',
@@ -98,5 +96,4 @@
                $my_base_url.'&amp;tab=mail_superv_help');
 			   
-			   
 $tabsheet->select($page['tab']);
 $tabsheet->assign();
@@ -133,5 +130,8 @@
 		if (!isset($mails_options[check_header_carbon])) $mails_options[check_header_carbon] = 'off' ;  //1
 		if (!isset($mails_options[check_mailto])) $mails_options[check_mailto] = 'off' ;  //0
-//================================================================================================		
+//================================================================================================	
+$mails_options[set_auto] = 'off' ;
+$mails_options[no_connect] = 'off' ;
+	
 $mails_donnees = Get_Datas();
 
@@ -144,6 +144,4 @@
 $aff_nb=true;
 
-
-	
 // *************************************************************************
 // |                          Selection de l'onglet                        |
@@ -151,17 +149,7 @@
 
 	 	$modif=false ;
-		/*
-		$sql="SELECT * 
-FROM `".$prefixeTable."plugins` 
-WHERE `id` LIKE 'Mail_supervisor'
-";
- $result = @pwg_query($sql);
-	if ($result) {
-	    $versions = mysql_fetch_array($result,MYSQL_ASSOC);
-	}
-$version = $versions['version'];
-*/
-$plugin =  Get_Version_plugins( MAIL_SUPERV_PATH);
-$version = $plugin['version'] ;
+
+	$plugin =  Get_Version_plugins( MAIL_SUPERV_PATH);
+	$version = $plugin['version'] ;
  //=========================================================
 
@@ -219,5 +207,5 @@
 	}
 
-  
+  //===================================================================
 	if ( $_POST['submit'] == l10n('Sv_Valider') )  
 		{
@@ -287,10 +275,14 @@
 	 'version' =>	 $version ,
 	'MAIL_SUPERV_PATH' =>  MAIL_SUPERV_PATH ,
-	'path_js' => $path_js
+	'path_js' => $path_js,
+    'MAIL_SUPERV_PATH_ABS' => MAIL_SUPERV_PATH_ABS,
+     
 		 				)
 				);	
 
 	$template->set_filenames(array('plugin_admin_content' => realpath(MAIL_SUPERV_PATH . 'admin/mail_superv_admin.tpl')));
-		$template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
+ 
+
+	$template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
 		
  break; 
@@ -302,146 +294,132 @@
  
    case 'mail_superv_test':
-   
-   $mails_donnees = Get_Datas() ;
-   	$group_id = isset($_POST['group']) ? $_POST['group'] :  '-1'  ;
-	if ($group_id >= 0) {
-      $query = '
-		SELECT
-    		name
-  		FROM '.GROUPS_TABLE.'
-  		WHERE id = '.$group_id.'
-		;';
-  		list($group_name) = mysql_fetch_row(pwg_query($query));
+   		load_language('plugin.lang', MAIL_SUPERV_PATH); 
+   		$mails_donnees = Get_Datas() ;
+   		$group_id = isset($_POST['group']) ? $_POST['group'] :  '-1'  ;
+
+		if ($group_id >= 0) {
+      		$query = 'SELECT
+    					name
+  						FROM '.GROUPS_TABLE.'
+  						WHERE id = '.$group_id.'
+						;';
+  			list($group_name) = mysql_fetch_row(pwg_query($query));
 		}	else {
 				$group_name="";		 
 		}		
+
 //================================================
 // info by email to an access granted group of category informations
-if (isset($_POST['submitEmail']) and !empty($_POST['group']))
+
+
+if (isset($_POST['Submit']) and !empty($_POST['group']))
 {
   set_make_full_url();
+
   /* TODO: if $category['representative_picture_id'] 
     is empty find child representative_picture_id */
-/*
- * send en email to user's group
- *
- * @param:
- *   - group_id: mail are sent to group with this Id
- *   - email_format: mail format
- *   - keyargs_subject: mail subject on l10n_args format
- *   - dirname: short name of directory including template
- *   - tpl_shortname: short template name without extension
- *   - assign_vars: array used to assign_vars to mail template
- *   - language_selected: send mail only to user with this selected language
- *
- * @return boolean (Ok or not)
-*/ 
-
-if (function_exists('get_user_language_desc') ) $titre = get_user_language_desc($conf['gallery_title']);
-else
-$titre=$conf['gallery_title'];
-
-$message = empty($_POST['MAIL_CONTENT']) ? $mails_donnees['message_test'] : stripslashes($_POST['MAIL_CONTENT']);
+
+
+	if (function_exists('get_user_language_desc') ) $titre = get_user_language_desc($conf['gallery_title']);
+	else $titre=$conf['gallery_title'];
+
+	$message = empty($_POST['MAIL_CONTENT']) ? $mails_donnees['message_test'] : stripslashes($_POST['MAIL_CONTENT']);
 
  if (function_exists('get_user_language_desc') ) $message = get_user_language_desc($message);
-  // TODO Mettre un array pour traduction subjet
-
-  
-  pwg_mail_group(
-    $_POST['group'],
-    get_str_email_format(true),  
-    get_l10n_args('[%s] ---> %s', array($titre,'Information') ), //sujet
-    'cat_group_info',  // template 
-    array
-    (
-      'CPL_CONTENT' => $message."\n\n".$user['username'] 
-    ),
-    '' );
-	
-
-$mails_donnees['message_test']= str_replace('"',"'",$message) ;
- unset_make_full_url();
+
+ if ( $_POST['Submit']==l10n('Sv_Envoyer') ) {
+	 /*
+	 * send en email to user's group
+	 *
+	 * @param:
+	 *   - group_id: mail are sent to group with this Id
+	 *   - email_format: mail format
+	 *   - keyargs_subject: mail subject on l10n_args format
+	 *   - dirname: short name of directory including template
+	 *   - tpl_shortname: short template name without extension
+	 *   - assign_vars: array used to assign_vars to mail template
+	 *   - language_selected: send mail only to user with this selected language
+	 *
+	 * @return boolean (Ok or not)
+	*/   
+  	pwg_mail_group(
+    		$_POST['group'],
+    		get_str_email_format(true),  
+    		get_l10n_args('[%s] ---> %s', array($titre,'Information') ), //sujet
+    		'cat_group_info',  // template 
+    		array    ('CPL_CONTENT' => $message."\n\n".$user['username'] ),
+    		'' );
+	
+	$mails_donnees['message_test']= str_replace('"',"'",$message) ;
+
+ 	unset_make_full_url();
 	sauve_donnees();
-$mails_donnees = Get_Datas() ;
-	
-  $query = '
-SELECT
-    name
-  FROM '.GROUPS_TABLE.'
-  WHERE id = '.$_POST['group'].'
-;';
-  list($group_name) = mysql_fetch_row(pwg_query($query));
-  
-  array_push(
-    $page['infos'],
-    sprintf(
-      l10n('An information email was sent to group "%s"'),
-      $group_name
-      )
-    );
+	$mails_donnees = Get_Datas() ;
+    $query = 'SELECT
+    		name
+  			FROM '.GROUPS_TABLE.'
+ 			WHERE id = '.$_POST['group'].'
+			;';
+		list($group_name) = mysql_fetch_row(pwg_query($query));
+		 
+		  array_push(
+					$page['infos'],
+					sprintf( l10n('An information email was sent to group "%s"'),
+							$group_name  )
+					); 
+								$group_id =-1 ;
+  }
 }  
- load_language('plugin.lang', MAIL_SUPERV_PATH);
-//=====================================================================================
-if ( isset($_POST['test_envoie']) ) {
-$mails_donnees['message_test'] = empty($_POST['MAIL_CONTENT']) ? '' : stripslashes($_POST['MAIL_CONTENT']);
-		$message=$mails_donnees['message_test'];
-//test_envoie($message,$group_name,$group_id); 
-		sauve_donnees();
-  
-		$mails_donnees = Get_Datas() ;
-		
-  } 
-
+
+//======================================================================================
   $groups[-1] = '---------';
-
-  $query = '
-    SELECT id, name
-		FROM '.GROUPS_TABLE.'
-		ORDER BY name ASC
-		;';
+  $query = ' SELECT id, name
+			FROM '.GROUPS_TABLE.'
+			ORDER BY name ASC
+			;';
 
   $result = pwg_query($query);
 //----------------------------------------------------------------	
   while ($row = mysql_fetch_array($result,MYSQL_ASSOC))
-  {
-    $groups[$row['id']] = $row['name'];
-  }
+  {    $groups[$row['id']] = $row['name'];  }
  //--------------------------------------------------------------- 
-
+if ( isset($_POST['Submit'])) $group_id=-1;
   $template->assign(
     	'Group',
-   		array(
-	  		'group_options'=> $groups,
-			'selected' => $group_id 
+   		array( 'group_options'=> $groups,
+				'selected' => $group_id 
 			)
  		);
 //=================================================================
 $destinataires= implode("<br />",get_liste($group_id));
+if( $destinataires !="" )
+$infos_message .= " List :<hr>" .  $destinataires . "<hr>" ;
+ 
   $template->assign(
   					array(
-				'Groupe'     => $groups,
-    			'message_test' => $mails_donnees['message_test'] ,
-				'liste' => $destinataires ,
- 'version' =>	 $version ,
-			    'MAIL_CONTENT' => $mails_donnees['message_test'],
-	            'path_js' => $path_js
+						'Groupe'     => $groups,
+    					'message_test' => $mails_donnees['message_test'] ,
+						'liste' => $destinataires ,
+ 						'version' =>	 $version ,
+						'MAIL_CONTENT' => $mails_donnees['message_test'],
+						'path_js' => $path_js,
+                        'MAIL_SUPERV_PATH_ABS' => MAIL_SUPERV_PATH_ABS,
+                        'MAIL_SUPERV_PATH' => MAIL_SUPERV_PATH ,
 		 				)
 				);	
 				
-   	$template->set_filenames(array('plugin_admin_content' => realpath(MAIL_SUPERV_PATH . 'admin/mail_superv_test.tpl')));
-		$template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
-		
-		  $toolbar = 'Basic';
-  $width = '750px';
-  $height = '200px';
-  $areas = array();
-  $areas[]='MAIL_CONTENT';
- //  $areas[]= 'MAIL_CONTENT';
- if (!empty($areas))
-  {
-  if (function_exists('set_fckeditor_instance'))
-    set_fckeditor_instance($areas, $toolbar, $width, $height);
-  }
-  
+   $template->set_filenames(array('plugin_admin_content' => realpath(MAIL_SUPERV_PATH . 'admin/mail_superv_test.tpl')));
+   $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
+//=========================================================================		
+		$toolbar = 'Basic';
+  		$width = '750px';
+  		$height = '200px';
+  		$areas = array();
+  		$areas[]='MAIL_CONTENT';
+		if (!empty($areas)){
+  				if (function_exists('set_fckeditor_instance'))
+    				set_fckeditor_instance($areas, $toolbar, $width, $height);
+  			}
+			
    break;
 // *************************************************************************
@@ -453,6 +431,6 @@
  //------------------------------------------------------------------------------------
       	$mails_options[no_mail_list] = isset($_POST['no_mail_list']) ? $_POST['no_mail_list'] : $mails_options[no_mail_list] ;
-      	$mails_options[no_connect] = isset($_POST['no_connect']) ? $_POST['no_connect'] : $mails_options[no_connect] ;
-	    $mails_options[set_auto] = isset($_POST['set_auto']) ? $_POST['set_auto'] : $mails_options[set_auto] ;		
+      	$mails_options[no_connect] = 'off' ;//isset($_POST['no_connect']) ? $_POST['no_connect'] : $mails_options[no_connect] ;
+	    $mails_options[set_auto] = 'off' ;//isset($_POST['set_auto']) ? $_POST['set_auto'] : $mails_options[set_auto] ;		
 //=======================================================================================	
     $info_ip = (isset($info_ip)) ? $info_ip : '' ;
@@ -485,6 +463,6 @@
       		{
 				$mails_options[no_mail_list] = isset($_POST['no_mail_list']) ? $_POST['no_mail_list'] : "off" ;
-      			$mails_options[no_connect] = isset($_POST['no_connect']) ? $_POST['no_connect'] : "off" ;
-      			$mails_options[set_auto] = isset($_POST['set_auto']) ? $_POST['set_auto'] : "off" ;
+      			$mails_options[no_connect] ='off' ;// isset($_POST['no_connect']) ? $_POST['no_connect'] : "off" ;
+      			$mails_options[set_auto] = 'off' ;//isset($_POST['set_auto']) ? $_POST['set_auto'] : "off" ;
 				$mails_options[set_id] = isset($_POST['set_id']) ? $_POST['set_id'] : "off" ;
 				sauve_options();
@@ -518,31 +496,32 @@
      $template->assign(
   					array(
-					'start' => $params['start'],
-					'per_page' => $params['per_page'] ,
-			        'maxipage'  =>  $maxipage ,
-					    'smile_bonjour' => $smile_bonjour ,
-						'img_logo' => $img_logo ,
-                		'champs_ip' => $champs_ip ,					
-						'liste_ip' => $liste_ip,
-						'champs_bl' =>  $champs_bl 	 ,	
-						'liste_bl' => $liste_bl ,
-                 		//'conf_admin_layout' => $conf['admin_layout'] ,
-						'istype' => $istype ,
-						'ip_black' => $ip_black ,
-						'IS_SPAM' => test_spam(  $ip_black),
-						'ip_black_len' =>  strlen($ip_black)  ,
-						'MAIL_SUPERV_PATH' => MAIL_SUPERV_PATH ,
-	                    'path_js' => $path_js ,
-						'F_ACTION' => $f_action ,
+                        'start' => $params['start'],
+                        'per_page' => $params['per_page'] ,
+                        'maxipage'  =>  $maxipage ,
+                        'smile_bonjour' => $smile_bonjour ,
+                        'img_logo' => $img_logo ,
+                        'champs_ip' => $champs_ip ,					
+                        'liste_ip' => $liste_ip,
+                        'champs_bl' =>  $champs_bl 	 ,	
+                        'liste_bl' => $liste_bl ,
+                        //'conf_admin_layout' => $conf['admin_layout'] ,
+                        'istype' => $istype ,
+                        'ip_black' => $ip_black ,
+                        'IS_SPAM' => test_spam(  $ip_black),
+                        'ip_black_len' =>  strlen($ip_black)  ,
+                        'MAIL_SUPERV_PATH' => MAIL_SUPERV_PATH ,
+                        'path_js' => $path_js ,
+                        'F_ACTION' => $f_action ,
 						
-						'no_mail_list' => ($mails_options[no_mail_list] == 'on') ? 'checked="checked"' : '' ,
+                        'no_mail_list' => ($mails_options[no_mail_list] == 'on') ? 'checked="checked"' : '' ,
                         'no_connect' => ($mails_options[no_connect] == 'on') ? 'checked="checked"' : '' ,
-						'set_auto' => ($mails_options[set_auto] == 'on') ? 'checked="checked"' : '' ,
-						'set_id' => ($mails_options[set_id] == 'on') ? 'checked="checked"' : '' ,
-						'IP' =>  $ip ,						
-						'PAYS' =>  $pays  ,
- 		                'VILLE' =>  $ville ,
- 		                'REGION' =>  $region ,	
-						 'version' =>	 $version ,
+                        'set_auto' => ($mails_options[set_auto] == 'on') ? 'checked="checked"' : '' ,
+                        'set_id' => ($mails_options[set_id] == 'on') ? 'checked="checked"' : '' ,
+                        'IP' =>  $ip ,						
+                        'PAYS' =>  $pays  ,
+                        'VILLE' =>  $ville ,
+                        'REGION' =>  $region ,	
+                        'version' =>	 $version ,
+                        'MAIL_SUPERV_PATH_ABS' => MAIL_SUPERV_PATH_ABS,
 		 			)
 				);			 
@@ -567,5 +546,6 @@
 					 'version' =>	 $version ,
 					 'MAIL_SUPERV_PATH' =>  MAIL_SUPERV_PATH ,
-	                 'path_js' => $path_js
+	                 'path_js' => $path_js,
+                        'MAIL_SUPERV_PATH_ABS' => MAIL_SUPERV_PATH_ABS
 					)
 			);		
