Buenas tardes tengo el siguiente código, quiero agregar una fila de checkbox de manera que cuando seleccione los archivos a enviar, se envien todos, el problemas es que solo me envia un solo archivo. Agradeceria la ayuda:
<html>
<head>
</head>
<link rel="stylesheet" type="text/css" href="D:\Content\main.css" media="screen" />
<script type="text/javascript" src="http://jqueryjs.googlecode.com/files/jquery-1.3.1.min.js"> </script>
<script>
var xmlPath = "D:/PreView/testxml";
var contentPath = xmlPath + "/Content";
var templatePath = contentPath + "/Template.xsl";
var outPath = "D:/PreView/outxml";
var logoPath = contentPath + "/logo.png";
var cssPath = contentPath + "/main.css";
var Fo = new ActiveXObject("Scripting.FileSystemObject");
var StrOut = new String();
var FileName = new String();
var Extention = new String();
function PreviewInvoice(id) {
var path = document.getElementById(id).value;
alert(path);
var xml = new ActiveXObject("Microsoft.XMLDOM")
xml.async = false
xml.load(path)
// Load the XSL
var xsl = new ActiveXObject("Microsoft.XMLDOM")
xsl.async = false
xsl.load(templatePath)
// Transform
var msg = xml.transformNode(xsl)
document.getElementById("example").innerHTML = msg;
//Logo
var elem = document.getElementById("imgLogo");
elem.src = logoPath;
//separar campos por pipe
var elemenComent = document.getElementById("comentario");
var str = elemenComent.innerHTML;
var n = str.replace(/[|]/g, "<br>");
document.getElementById("comentario").innerHTML = n;
}
function ProcessInvoice(fileName) {
if (confirm('Firmar?')) {
var originalFilePath = xmlPath + "/" + fileName;
var newFilePath = outPath + "/" + fileName;
var fso = new ActiveXObject("Scripting.FileSystemObject");
fso.CopyFile(originalFilePath, newFilePath, 1);
fso.DeleteFile(originalFilePath, true);
alert("Enviado");
location.reload(true);
}
}
function DeleteFile(fileName) {
if (confirm('Eliminar?')) {
var originalFilePath = xmlPath + "/" + fileName;
var fso = new ActiveXObject("Scripting.FileSystemObject");
fso.DeleteFile(originalFilePath, true);
alert("Eliminado");
location.reload(true);
}
}
///////////AQUI MI DUDA\\\\\\\\\\\\\\\\\\\\\\\\
function ProcessInvoices(filesName) {
if (confirm('Firmar documentos?')) {
var originalFilesPath = xmlPath + "/" + filesName;
var newFilePath = outPath + "/" + filesName;
var fso = new ActiveXObject("Scripting.FileSystemObject");
fso.CopyFile(originalFilesPath, newFilePath, 1);
fso.DeleteFile(originalFilesPath, true);
alert("Enviados");
location.reload(true);
}
}
function FindFile(FOo) {
var FSo = new Enumerator(FOo.Files);
StrOut += "<div align=right><button class=\"Field\" onclick=\"ProcessInvoices('" + FSo.item().name + "')\">Enviar</button></div>"
for (i = 0; !FSo.atEnd() ; FSo.moveNext()) {
if (FileName == "*" || FSo.item().name.slice(0, FSo.item().name.lastIndexOf(".")).toLowerCase().in dexOf(FileName) > -1)
if (Extention == "*" || FSo.item().name.slice(FSo.item().name.lastIndexOf( ".") + 1).toLowerCase().indexOf(Extention) > -1) {
StrOut += "<tr " + ((i % 2) ? "" : "bgcolor=#DDAA55") + "><td width=50%><font class=find>" + FSo.item().name + "</font></td><td width=25%><font class=find><button class=\"Field\" onclick=\"PreviewInvoice('" + FSo.item().name + "')\">Ver</button><input id='" + FSo.item().name + "' type='hidden' value='" + FSo.item().Path + "'></font><font class=find><button class=\"Field\" onclick=\"ProcessInvoice('" + FSo.item().name + "')\"> Enviar</button><input id='" + FSo.item().name + "' type='checkbox' value='" + FSo.item().Path + "'></font><font class=find><button class=\"Field\" onclick=\"DeleteFile('" + FSo.item().name + "')\">Eliminar</button></font></td></tr>";
i++;
}
}
if (i == 0) {
document.getElementById('noInvoices').style.displa y = 'block';
}
}
function Scan() {
if (navigator.appName != "Microsoft Internet Explorer") {
document.getElementById('NoIE').style.display = 'block';
} else {
FileName = (search.value.lastIndexOf(".") > -1) ? search.value.slice(0, search.value.lastIndexOf(".")) : (search.value.length > 0) ? search.value.toLowerCase() : "*"; //Get Searched File Name
Extention = (search.value.lastIndexOf(".") > -1) ? search.value.slice(search.value.lastIndexOf(".") + 1).toLowerCase() : "*"; // Get Searched File Extention Name
if (xmlPath.length > 0 && Fo.FolderExists(xmlPath)) {
StrOut = "<table border=0 width=100% cellspacing=0>"
FindFile(Fo.GetFolder(xmlPath));
outPut.innerHTML = StrOut + "</table>";
}
else alert("Insert Correct Path Address");
}
}
function PrintElem(elem) {
Popup($(elem).html());
}
function Popup(data) {
var mywindow = window.open('', 'forma_preview', 'height=800,width=600');
mywindow.document.write('<html><head><title>forma_ preview</title>');
mywindow.document.write('<link rel="stylesheet" type="text/css" href="\\iserver\\apps\\preview\\testxml\\content\\ main.css" media="screen" />');
mywindow.document.write('</head> <body onload="window.print()">');
mywindow.document.write(data);
mywindow.document.write('</body></html>');
return true;
}
</script>
<body onload="Scan()" topmargin="0" leftmargin="0">
<div align="center" style="background-color: #30627F;">
<a href="http://www.alrconsultores.com" target="blank">
</a>
<br></br>
<input size="50" type="hidden" value=".xml" id="search" name="search" class="Field">
</div>
<div id="outPut"></div>
<div align="center" id="noInvoices" style="display: none">
<br></br>
<marquee style="height: 30px; width: 900px; font-weight: bold; background-color: 750204; font-size: 16px; color: FCF7F7; border-width: 2; border-style: dotted; border-color: 30627F;" behavior="scroll" direction="left" scrollamount="6">=> No poder visualizar <=</marquee>
</div>
<div align="center" id="NoIE" style="display: none">
<br></br>
<marquee style="height: 30px; width: 900px; font-weight: bold; background-color: 750204; font-size: 16px; color: FCF7F7; border-width: 2; border-style: dotted; border-color: 30627F;" behavior="scroll" direction="left" scrollamount="6">=> Esta aplicacion solo funciona con Internet Explorer 9 <=</marquee>
</div>
<div id="example" align="center" />
</div>
<br />
</body>
</html>