1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120
|
/************************** PARTIE JAVASCRIPT *************************/
// Au load de la page
addThumb = function(d, id){
if(!d.error){
var img = "<img src=\""+escape(d.type)+"\"/>";
var pos = d.file.lastIndexOf("\\");
var name = d.file.substr(pos + 1,d.file.length);
var str = '<a href="'+d.file+'" target="blank">'+img+' - '+name+'</a>';
AddOneRow(name,str,id);
} else {
rapportErreur(d);
}
}
var props = {
hoverClass:"uploadHover",
activeClass:"uploadPress",
disabledClass:"uploadDisabled",
uploadUrl:"Include/uploadfileF.php",
fileMask:["All Files", "*.*"]
}
dojo.byId("listeFichiersReal").value = "";
var mesFichiers = new dojox.form.FileUploader(dojo.mixin({
showProgress:true,
force:"html",
id:"uploader",
isDebug:false,
selectMultipleFiles:false,
deferredUploading:false,
fileListId:"listeFichiersReal",
tabIndex:11
}, props), "selectionReal");
dojo.connect(mesFichiers, "onChange", function(){
mesFichiers.submit(dojo.byId("formFileReal"));
});
dojo.connect(mesFichiers, "onComplete", function(dataArray){
dojo.forEach(dataArray, function(d){
addThumb(d, "tabFichiersReal"); //pour chaque fichier on rajoute une ligne de résultat
});
});
/***************************** FIN PARTIE JAVASCRIPT *******************************/
/***************************** PARTIE HTML *******************************/
<div class="formAnswer">
<div id='PJReal' style='margin-left:10px;'>
<form dojoType='dijit.form.Form' id='formFileReal'>
<fieldset class='thumbField' style="width:500px;"><legend><b>Fichier(s) déjà en pièce jointe : </b></legend>
<input dojoType='dijit.form.TextBox' type='hidden' value = '' id='fichierReal' name='fichierReal'>
<input dojoType='dijit.form.TextBox' type='hidden' value = '' id='ligneReal' name='ligneReal'>
<input dojoType='dijit.form.TextBox' type='hidden' value = '<?php echo $NumDon; ?>' id='NumDonReal' name='NumDonReal'>
<input dojoType='dijit.form.TextBox' type='hidden' value = 'REAL' id='typeReal' name='typeReal'>
<div class='divField'>
<table id='tabFichiersReal' width='500px'>
<?php
//Partie php récupérant les fichiers déjà joints dans la demande
$ssrp = "F".$NumDon;
$dir=$_SESSION['Dir_PJ'].$ssrp.$_SESSION['Dir_REA_Visu']."\\"; // nom du répertoire à lister
if (is_dir($dir)) {
$handle = opendir( $dir );
// si pas d'erreur d'ouverture du dossier on lance le scan
if( $handle != false ){
// Parcours du repertoire
$k = 0;
while( $item = readdir($handle) ){
if($item != '.' && $item != '..'){
if(!is_dir( $dir.$item )){
$type = extension($item);
if(!file_exists('../icons/icon_'.$type.'.gif')){
$type = 'icons/icon_defaut.gif';
} else {
$type = 'icons/icon_'.$type.'.gif';
}
$file = $dir.$item;
$img = "<img src=\"".$type."\"/>";
$str = '<a href="'.$file.'" target="blank">'.$img.' - '.$item.'</a>';
print "<tr><td width='95%'>".$str."</td>";
print "<td align='right'><a href='#' onclick='supprFichier(\"".$item."\",\"".$k."\");'><img src='icons/supprimer.gif'/></a></td></tr>";
$k++;
}
}
}
if($k == 0){
print "<tr><td>Aucun fichier joint.</td></tr>";
}
} else {
print "Impossible d'ouvrir le répertoire de la demande.";
}
// Fermeture du repertoire
closedir($handle);
} else {
print "<tr><td>Aucun fichier joint.</td></tr>";
}
?>
</table>
</div>
</fieldset>
<br>
<div tabIndex="11" id="selectionReal" class="uploadBtn btn"> Ajouter un fichier</div>
//on cache la liste des fichiers à envoyer
<table style='display:none;'>
<tr>
<td valign='top'>
<div class="field" id="listeFichiersReal"></div>
</td>
<input dojoType='dijit.form.TextBox' type='hidden' value='<?php echo $NumDon; ?>' id='numReal' name='numReal'/>
</tr>
</table>
</form>
</div>
</div>
/***************************** FIN PARTIE HTML *******************************/ |
Partager