<?php
 $format_ajax="<script type='text/javascript'> upload_ajax('%1\$s','%2\$s','%3\$s','%4\$s'); </script>";
 $format_ajax_inline="upload_ajax('%1\$s','%2\$s','%3\$s','%4\$s');";
$link_retour='<p style="text-align:center;"><a href="gestion_users.php" alt="'.RETOUR.'" >'.RETOUR.'</a></p>';
$link_add_rub="<p style='text-align:center;'><a href='gestion_users.php?conf=new' alt='' Onclick= \" {".sprintf($format_ajax_inline,'droit','include/lib/lib.gestion_users.php','aff_user_form_login'," true")." return false; }\" >".ADD_NEW_USER."</a></p>";
//  Couche JS Non intrusif pour oblige a enregistrer la pags si click ailleurs que dans element centraux form
array_push($js_lib, "add_click_onload"); array_push($function_js_init, "add_click_onload('menu','');");
?>
	<div id="menu_inter" class="menu3">&nbsp;</div>
	<div id="config">
		<div class="contenu_config">
			<div class="i_box">
				<?php printf("<h1>%1\$s</h1>",GESTION_USERS); ?>
			</div>
			<div class="a_box">
				<div id="retour_js"></div>
				<?php if (isset($_GET['user']))printf($format_ajax,'retour_js','include/lib/lib.gestion_users.php','mod_user_form'," \'".$_SESSION['hash_acces_utilisateur']."\', true ");
				      else print aff_list_action_users($_user_);
				      ?>
				<br /><br />
			</div>
		</div>
	</div>
	<div id="droit" class="a_box">
		<h2><?php print TEXT_ACTION ?></h2>
		<div id="droit_content" >
		<?php
		if (isset($_GET['conf'])){
		  switch($_GET['conf']){
		  	case 'new':
		  	if (!isset($_POST['login'])) print aff_user_form_login();
			else {
				include(TBL_SYS_CONFIG_PERSO_INC);
				if (isset($_user_[trim($_POST['login'])])) echo "<p class='erreur'>".USER_EXIST."</p><br />".$link_retour;
				else print aff_user_form($_POST['login']);
			}
			break;
		  	case 'edit':
		  	if (isset($_POST['user_key']))  printf($format_ajax,'retour_js','include/lib/lib.gestion_users.php','mod_user_form'," \'".$_POST['user_key']."\', \'true\'   ");
			break;
		  	case 'up':
		  	if (isset($_POST['user_key']))
				print up_user_file($_POST['user_key'],$_POST);
			break;
		  	case 'add':
		  	if (isset($_POST['login'])){
				printf($format_ajax,'droit_content','include/lib/lib.gestion_users.php','add_user_base'," \'".$_POST['login']."\',\'".$_POST['pass1']."\', true   ");
				print add_user_file ($_POST);
			} else echo "print erreur ";
		  	case 'supp':
		  	if (isset($_POST['user_key'])){
				if (isset($_GET['confirm'])){
				supp_user_base($_POST['login'],$_POST['user_key'],true);
				print '<p id="dr_01"></p><p id="dr_02"></p>';
				printf($format_ajax,'dr_01','include/lib/lib.gestion_users.php','supp_user_file'," \'".$_POST['login']."\',\'".$_POST['user_key']."\', true ");
// 				printf($format_ajax,'dr_02','include/lib/lib.gestion_users.php','supp_user_base'," \'".$_POST['login']."\',\'".$_POST['user_key']."\', true ");
				}
				else tep_page_confirm('gestion_users.php','conf=supp&amp;confirm=supp',CONFIRM_SUPP_USER,$_POST,'');
			}
			break;
			default:
				if (_USER_PERSO__GRP<=2) print $link_add_rub;
		  }
		}
		else if (_USER_PERSO__GRP<=2) print $link_add_rub;
		?>
		</div>
		<div id="droit_nav">
		<?php if (isset($_GET['conf'])) print $link_retour; ?>
		</div>
	</div>
</div>