Ménage : deprecated javascript & browseforfolder
This commit is contained in:
		
							parent
							
								
									3e28602075
								
							
						
					
					
						commit
						078e439113
					
				|  | @ -94,7 +94,6 @@ bureau/admin/bro_main.php -text | |||
| bureau/admin/bro_pref.php -text | ||||
| bureau/admin/bro_tgzdown.php -text | ||||
| bureau/admin/bro_view.php -text | ||||
| bureau/admin/browseforfolder.php -text | ||||
| bureau/admin/browseforfolder2.php -text | ||||
| bureau/admin/cron.php -text | ||||
| bureau/admin/dom_add.php -text | ||||
|  |  | |||
|  | @ -1,178 +0,0 @@ | |||
| <?php | ||||
| /* | ||||
| 	Navigateur de dossiers en php. (BrowseForFolder in win32 api :) | ||||
|         Version 1.0 | ||||
|         Notes : | ||||
|             Benjamin Sonntag 23/12/2001 Version initiale: n'utilise qu'un seul uid : 1... | ||||
|         Fichier : | ||||
|             browseforfolder.php3 : Dialogue de navigation BrowseForFolder | ||||
| $caller = composant form appelant (de la forme forms['main'].component ) | ||||
| 
 | ||||
| function browseforfolder(caller) { | ||||
|     eval("file=document."+caller+".value"); | ||||
|     w=window.open("browseforfolder.php?caller="+caller+"&file="+file,"browseforfolder","width=300,height=400,scrollbars,left=100,top=100"); | ||||
| } | ||||
| 
 | ||||
| requires : ife($test,$iftrue,$iffalse) function :  | ||||
| 
 | ||||
| function ife($test,$true,$false="") { | ||||
| 	if ($test) | ||||
| 		return $true; | ||||
| 	else | ||||
| 		return $false; | ||||
| } | ||||
| 
 | ||||
|     BrowseForFolder($curdir); Retourne le tableau avec la liste des dossiers à afficher dans | ||||
|         la fonction browseforfolder sachant que le dossier actuel et curdir | ||||
|         retourne un tableau de tableau de la forme : | ||||
|                 dir => "directory"      Nom du dossier | ||||
|                 level => 0-n            Niveau du dossier (0=racine 1,2 ...) | ||||
|                 put => "/sub/sub/directory" Contenu de la variable post à ajouter pour la balise A si ="" c'est le dossier courant. | ||||
|         Si probleme, positionne $errbrowsefold | ||||
|         Sinon, retourne le tableau et $maxlevel contient le nombre maximum de sous-dossiers. | ||||
| */ | ||||
| include("../class/config.php"); | ||||
| 
 | ||||
| // FIXME Refaire ce truc hein...
 | ||||
| $fields = array ( | ||||
|         "caller"               => array ("request", "string", ""), | ||||
|         "select"               => array ("request", "string", ""), | ||||
|         "curdir"               => array ("request", "string", ""), | ||||
|         "lastcurdir"           => array ("request", "string", ""), | ||||
|         "file"                 => array ("request", "string", ""), | ||||
| ); | ||||
| getFields($fields); | ||||
| 
 | ||||
| function _subbrowse($curdir,$pos,$level) { | ||||
| 	global $maxlevel,$root,$brlist; | ||||
| 	if ($level>$maxlevel) | ||||
| 	$maxlevel=$level; | ||||
| 	$rot=substr($curdir,0,$pos); | ||||
| 	$next=@strpos($curdir,"/",$pos+1); | ||||
| 	$nextstr=substr($curdir,$pos+1,$next-$pos-1); | ||||
| 	$c=opendir($root.$rot); | ||||
| 	$i=0; $tmp = array(); | ||||
| 	while ($r=readdir($c)) {  | ||||
| 		if (is_dir($root.$rot."/".$r) && $r!="." && $r!="..") { $tmp[$i++]=$r; } | ||||
| 	} | ||||
|  	sort($tmp);	 | ||||
| 	foreach ($tmp as $r) { | ||||
| 			/* Ajout */ | ||||
| 			$brlist[]=array("dir"=>$r,"level"=>$level,"put"=> ife($curdir==$rot."/".$r."/","",$rot."/".$r)); | ||||
| 			if ($r==$nextstr) { | ||||
| 				_subbrowse($curdir,$next,$level+1); | ||||
| 			} | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| function browseforfolder($curdir) { | ||||
| 	global $maxlevel,$root,$brlist; | ||||
|         $maxlevel=0; | ||||
|         $pat=explode("/",$curdir); | ||||
|         $brlist=array(array("dir"=>"/","level"=>0,"put"=> ife($curdir=="/","","/") )); | ||||
|         _subbrowse($curdir,0,1); | ||||
|         return $brlist; | ||||
| } | ||||
| 
 | ||||
| $root=getuserpath(); | ||||
| // pour utiliser 'la ou est browseforfolder', mettre dirname($HTTP_SERVER_VARS["PATH_TRANSLATED"]);
 | ||||
| 
 | ||||
| if (substr($file,0,1)!="/") $file="/".$file; | ||||
| if (substr($file,-1)!="/") $file.="/"; | ||||
| if (!$file) $file="/"; | ||||
| 
 | ||||
| $errbrowsefold=0;    /* Erreur lors de la création d'un dossier */ | ||||
| $brlist=array();    /* Liste des dossiers ... */ | ||||
| $maxlevel=0; | ||||
| 
 | ||||
| 
 | ||||
| if (isset($select) && $select) { | ||||
|         /* Go ahead, let's send the javascript ...*/ | ||||
| ?>
 | ||||
| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr"> | ||||
| <head> | ||||
| <title>Browser for folder</title> | ||||
| <link rel="stylesheet" href="styles/style.css" type="text/css" /> | ||||
| <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> | ||||
| 
 | ||||
| <?php | ||||
|         echo "<head><script type=\"text/javascript\">\n"; | ||||
|         echo "window.opener.document.".$caller.".value='".addslashes($file)."';\n"; | ||||
|         echo "window.opener.window.focus();\n"; | ||||
|         echo "window.close();\n"; | ||||
|         echo "</script>\n"; | ||||
| 	echo "</head><body></body></html>"; | ||||
|         exit(); | ||||
| } | ||||
| 
 | ||||
| ?>
 | ||||
| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | ||||
| <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr"> | ||||
| <head> | ||||
| <title>Recherche d'un dossier</title> | ||||
| <link rel="stylesheet" href="styles/style.css" type="text/css" /> | ||||
| <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> | ||||
| <script type="text/javascript"> | ||||
| /* Fonction appellée lors du lancement d'un popup Fichier : */ | ||||
| function popupfile() { | ||||
|         window.focus(); | ||||
|         if (document.forms["main"].file) | ||||
|                 document.forms["main"].file.focus(); | ||||
| } | ||||
| </script> | ||||
| </head> | ||||
| <body onload="popupfile();"> | ||||
| <h3><?php __("Searching for a folder"); ?></h3>
 | ||||
| <?php | ||||
| 
 | ||||
| $ar=browseforfolder($file); | ||||
| if ($errbrowsefold) { | ||||
|         /* Si le dossier spécifié n'existe pas ou est un fichier : */ | ||||
|         echo _("Error, cannot find this folder")."<br />"; | ||||
|         /* Retour : */ | ||||
|         echo "<a href=\"browseforfolder.php?caller=".urlencode($caller)."&curdir=".$root."\">"._("Back to the root folder")."</a><br />"; | ||||
| } else { | ||||
|         /* Sinon, tout va bien, on affiche le tableau */ | ||||
|         reset($ar); | ||||
| ?>
 | ||||
| <form method="post" id="main" name="main" action="browseforfolder.php"> | ||||
| <p> | ||||
| <input type="hidden" name="caller" value="<?php echo $caller; ?>" /> | ||||
| <input type="hidden" name="lastcurdir" value="<?php echo $curdir; ?>" /> | ||||
| 
 | ||||
| <input type="text" class="int" name="file" size="20" value="<?php ehe($file); ?>" /><br /> | ||||
| 
 | ||||
| <input type="submit" name="select" value="<?php __("Select"); ?>" class="inb" />  | ||||
| <input type="button" name="cancel" value="<?php __("Cancel"); ?>" class="inb" onclick="window.close();" />  | ||||
| </p> | ||||
| </form> | ||||
| 
 | ||||
| <table style="border: 0" cellspacing="2" cellpadding="0"> | ||||
| 
 | ||||
| <?php | ||||
|         while (list($key,$val)=each($ar)) { | ||||
|                 echo "<tr>\n"; | ||||
|                 for ($i=0;$i<$val["level"];$i++) | ||||
|                         echo "<td width=\"16\"></td>"; | ||||
|                 if ($val["put"]!="") { | ||||
| 			?>
 | ||||
|                         <td width="16"><img src="icon/folder.png" width="16" height="16" alt="" /></td> | ||||
| 			<?php | ||||
|                 } else { | ||||
| 				?>
 | ||||
|                         <td width="16"><img src="icon/openfold.png" width="16" height="16" alt="" /></td> | ||||
| 			<?php | ||||
|                 } | ||||
|                 echo "<td colspan=\"".($maxlevel-$val["level"]+1)."\">"; | ||||
|                 if ($val["put"]!="") { | ||||
|                         echo "<a href=\"browseforfolder.php?caller=".urlencode($caller)."&file=".urlencode($val["put"])."\">".$val["dir"]."</a>"; | ||||
|                 } else { | ||||
|                         echo "<b>".$val["dir"]."</b>"; | ||||
|                 } | ||||
|                 echo "</td>\n</tr>\n"; | ||||
|         } | ||||
| } // OK ?
 | ||||
| ?>
 | ||||
| </table> | ||||
| </body> | ||||
| </html> | ||||
|  | @ -1,90 +1,7 @@ | |||
| var menulist = new Array(); | ||||
| 
 | ||||
| /* | ||||
| menulist[0] = "menu-dom"; | ||||
| menulist[1] = "menu-mail"; | ||||
| menulist[2] = "menu-ftp"; | ||||
| menulist[3] = "menu-sql"; | ||||
| menulist[4] = "menu-adm"; | ||||
| */ | ||||
| 
 | ||||
| var menu_opened = ""; | ||||
| 
 | ||||
| /* | ||||
| function deploy(menu) | ||||
| { | ||||
| 	for (var i = 0; i < menulist.length; i++) | ||||
| 	{ | ||||
| 		if (checkObj(menulist[i])) | ||||
| 		{ | ||||
| 			var div_content = new getObj(menulist[i]); | ||||
| 			var div_img = new getObj("img-" + menulist[i]); | ||||
| 
 | ||||
| 			div_content.style.display = "none"; | ||||
| 			div_img.obj.src = "/images/plus.png"; | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	if (menu == 0) | ||||
| 		return; | ||||
| 
 | ||||
| 	var div_content = new getObj(menu); | ||||
| 	var div_img = new getObj("img-" + menu); | ||||
| 
 | ||||
| 	if (menu_opened == menu) | ||||
| 	{ | ||||
| 		div_content.style.display = "none"; | ||||
| 		div_img.obj.src = "/images/plus.png"; | ||||
| 		menu_opened = ""; | ||||
| 	} | ||||
| 	else | ||||
| 	{ | ||||
| 		div_content.style.display = "block"; | ||||
| 		div_img.obj.src = "/images/minus.png"; | ||||
| 		menu_opened = menu; | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| function getObj(name) | ||||
| { | ||||
| 	if (document.getElementById) | ||||
| 	{ | ||||
| 		this.obj = document.getElementById(name); | ||||
| 		this.style = document.getElementById(name).style; | ||||
| 	} | ||||
| 		else if (document.all) | ||||
| 	{ | ||||
| 		this.obj = document.all[name]; | ||||
| 		this.style = document.all[name].style; | ||||
| 	} | ||||
| 		else if (document.layers) | ||||
| 	{ | ||||
| 		this.obj = document.layers[name]; | ||||
| 		this.style = document.layers[name]; | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| function checkObj(name) | ||||
| { | ||||
| 	if (document.getElementById) | ||||
| 	{ | ||||
| 		 if (document.getElementById(name)) | ||||
| 			 return true; | ||||
| 	} | ||||
| 		else if (document.all) | ||||
| 	{ | ||||
| 		if (document.all[name]) | ||||
| 			return true; | ||||
| 	} | ||||
| 		else if (document.layers) | ||||
| 	{ | ||||
| 		if (document.layers[name]) | ||||
| 			return true; | ||||
| 	} | ||||
| 	return false; | ||||
| } | ||||
| */ | ||||
| 
 | ||||
| function help(hid) { | ||||
| 	var top=100; /* (10-screen.height); */ | ||||
| 	var left=100; /*(10-screen.width); */ | ||||
|  | @ -93,12 +10,6 @@ function help(hid) { | |||
| 	window.open('./aide/help.php?hid='+hid,'help','top='+top+',left='+left+',width='+largeur+',height='+hauteur+',scrollbars=yes'); | ||||
| } | ||||
| 
 | ||||
| function browseforfolder(caller) { | ||||
| 		eval("file=document."+caller+".value"); | ||||
|     w=window.open("browseforfolder.php?caller="+caller+"&file="+file,"browseforfolder","width=300,height=400,scrollbars,left=100,top=100"); | ||||
| 		alert("Please contact you administrator (the method 'browseforfolderdeprecated' is normaly deprecated)."); | ||||
| } | ||||
| 
 | ||||
| function CheckAll() { | ||||
|     chk=document.getElementById('checkall').checked; | ||||
|     for (var i = 0; i < document.main.elements.length; i++) { | ||||
|  | @ -108,81 +19,6 @@ function CheckAll() { | |||
|     } | ||||
| } | ||||
| 
 | ||||
| function hide(s) { | ||||
|     if (document.all) { | ||||
|         if (document.all[s]) { | ||||
|             document.all[s].visibility="invisible"; | ||||
|             eval("document.all."+s+".style.display=\"none\""); | ||||
|         } | ||||
|     } else { | ||||
|         if (document.getElementById(s)) { | ||||
|             document.getElementById(s).visibility="invisible"; | ||||
|             document.getElementById(s).style.display="none"; | ||||
|         } | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| /* Affiche le composant s */ | ||||
| function show(s,shm) { | ||||
|     if (!shm) shm="block"; | ||||
|     if (document.all) { | ||||
|         if (document.all[s]) { | ||||
|             document.all[s].visibility="visible"; | ||||
|             eval("document.all."+s+".style.display=\""+shm+"\""); | ||||
|         } | ||||
|     } else { | ||||
|         if (document.getElementById(s)) { | ||||
|             document.getElementById(s).visibility="visible"; | ||||
|             document.getElementById(s).style.display=shm; | ||||
|         } | ||||
|     } | ||||
| } | ||||
| /* Affiche / Cache le composant s */ | ||||
| function swap(s,shm) { | ||||
|     if (document.all) { | ||||
|         if (document.all[s]) { | ||||
|             if (document.all[s].visibility=="visible") { | ||||
|                 hide(s); | ||||
|             } else { | ||||
|                 show(s,shm); | ||||
|             } | ||||
|         } | ||||
|     } else { | ||||
|         if (document.getElementById(s)) { | ||||
|             if (document.getElementById(s).visibility=="visible") { | ||||
|                 hide(s); | ||||
|             } else { | ||||
|                 show(s,shm); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| /** | ||||
| * Function check_form_mail_validity | ||||
| * is used to check if a given mail is a valid RFC 2822 mail adress and set the according image onto the page. | ||||
| * @param : id_elem , id of the mail input box we are checking | ||||
| */ | ||||
| function check_mail_form_validity(id_elem) { | ||||
|   var mail = document.getElementById('rcp-'+id_elem).value; | ||||
|   var mail_element = document.getElementById('rcp-'+id_elem); | ||||
|   var src = ""; | ||||
|   var alt = ""; | ||||
| 
 | ||||
|   if (mail != "" ) { | ||||
|     if(is_valid_mail(mail_element.value) != true ){ | ||||
|       src = "images/check_no.png"; | ||||
|       alt = "KO"; | ||||
|     } else { | ||||
|       src ="images/check_ok.png"; | ||||
|       alt ="OK"; | ||||
|     } | ||||
|   }  | ||||
| 
 | ||||
|   document.getElementById('valid-rcp-'+id_elem).src = src; | ||||
|   document.getElementById('valid-rcp-'+id_elem).alt = alt; | ||||
| } | ||||
| 
 | ||||
| /* | ||||
| * Function :is_valid_mail | ||||
| * @param : interger arg, an RFC 2822 mail adress | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	 Alan Garcia
						Alan Garcia