Tema: muy bueno
Ver Mensaje Individual
  #2 (permalink)  
Antiguo 01/09/2006, 09:52
nancy8120
 
Fecha de Ingreso: enero-2006
Mensajes: 233
Antigüedad: 19 años, 1 mes
Puntos: 2
continuacion

<script language="JavaScript" type="text/JavaScript">
parent.eperar(false)

function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}

function preview_multimedia(i,j,tipo) {
var file = i.value
var sw = false
var imagen_actual = "<%=(imagen_preview)%>";

if (file.length <=0 ) return;
var ipreview = document.all('ipreview' + j);

if (isImage(file,tipo)) {
if (tipo == 1) {
ipreview.src = 'file://' + file
} else {
ipreview.src = imagen_actual
}
} else {
ipreview.src = imagen_actual
}
}

function validar(f) {
var total = <%=(strMaxFiles)%>
var vacio = true;

for (i=1; i<=total; i++) {
file = eval("f.file" + i);
if (file.value != "") {
vacio = false
}
}

if (vacio == true) {
alert("No ha seleccionado ningún Archivo para Subir.");
return false
}

parent.eperar(true)
parent.compute(calculate_size())

f.boton_subir.disabled = true;
document.body.style.cursor="wait";

return true
}

function calculate_size() {
var total = <%=(strMaxFiles)%>
var imagen_actual = "<%=(imagen_preview)%>";
var filesize = 0
var page_actual = "http://" + document.location.hostname + imagen_actual

for (i=1; i<=total; i++) {
img = document.all('ipreview' + i);
if (img.src != page_actual) {
filesize += parseInt(img.fileSize);
}
}

return filesize;
}
</script>
</head>

<body>

<form name="form1" method="post" action="<%=(strPaginaActual)%>?valores=<%=(valores )%>&tipo=<%=(tipo)%>&modo=<%=(modo)%>&multimedia_c odigo=<%=(multimedia_codigo)%>" enctype="multipart/form-data" onSubmit="return validar(this)">
<fieldset><legend><strong>Datos Generales</strong></legend>
<table width="100%" align="center" border="0" cellspacing="2" cellpadding="2" class="TablaSimple">
<tr>
<td width="128" rowspan="3" align="center" valign="top"><img src="<%=(big_icon)%>" border="0"></td>
<td width="10%">Galer&iacute;as:</td>
<td>
<select name="galerias" onChange="MM_jumpMenu('self',this,0)">
<%
if multimedia_codigo = 0 then response.Write("<option value=""" & strPaginaActual & """>Seleccione una Galer&iacute;a</option>")
while not RSMultimedia.eof
if RSMultimedia("codigo") = multimedia_codigo then
response.Write("<option value=""" & strPaginaActual & "?modo=edicion&multimedia_codigo=" & RSMultimedia("codigo") & "&tipo=" & tipo & "&valores=" _
& valores & """ selected>" & Apostrofe(RSMultimedia("titulo"),0) & "</option>" & vbcrlf)
else
response.Write("<option value=""" & strPaginaActual & "?modo=edicion&multimedia_codigo=" & RSMultimedia("codigo") & "&tipo=" & tipo & "&valores=" _
& valores & """>" & Apostrofe(RSMultimedia("titulo"),0) & "</option>" & vbcrlf)
end if

RSMultimedia.movenext
wend
%>
</select>
</td>
</tr>
<tr>
<td>T&iacute;tulo:</td>
<td><input name="txttitulo" type="text" maxlength="50" style="width:100%;" value="<%=(multimedia_titulo)%>"></td>
</tr>
<tr>
<td>Descripci&oacute;n:</td>
<td><textarea name="txtdescripcion" rows="5" style="width:100%;"><%=(multimedia_descripcion)%></textarea></td>
</tr>
</table>
</fieldset>

<br>
<fieldset><legend><strong>Subir Archvios</strong></legend>
<div class="DivScroll">
<%
if upload <> "ok" then

strReporte = ""
strTotalOk = 0
strErrorDefault = "El Archivo posee un mal nombre o no existe o simplemente ud. no seleccionó el archivo."
if oFO.TotalFormCount > 0 then
if oFO.FileCount > 0 then
multimedia_titulo = oFO.Form("txttitulo")
multimedia_descripcion = oFO.form("txtdescripcion")

if modo = "agregar" then
if multimedia_titulo = "" then multimedia_titulo = "Galer&iacute;a del " & now()
sSQL = "insert into multimedia(titulo,descripcion,tipo) values ('" & Apostrofe(multimedia_titulo,1) & "', '" & Apostrofe(multimedia_descripcion,1) & "', " _
& tipo & ")"
Master.Execute(sSQL)

sSQL = "select * from multimedia where titulo='" & Apostrofe(multimedia_titulo,1) & "' and tipo=" & tipo & " order by codigo desc"
set RSMultimedia = Master.Execute(sSQL)
if RSMultimedia.bof=false and RSMultimedia.eof=false then
multimedia_codigo = RSMultimedia("codigo")
else
multimedia_codigo = 0
end if
end if

for I = 1 to oFO.FileCount
set oFile = oFO.File(I)

if oFile.ErrorMessage <> "" then
if strErrorDefault <> oFile.ErrorMessage then strReporte = strReporte & oFile.ErrorMessage & " (Archivo <strong>" & I & "</strong>)[separar]"
else
descripcion = oFO.Form("txtdescripcion" & I)
archname = oFile.FileName

if modo = "agregar" then
sSQL = "insert into multimediagaleria (multimedia,fullname,descripcion,sw) values (" & multimedia_codigo & ", '" & Apostrofe(archname,1) & "', " _
& "'" & Apostrofe(descripcion,1) & "', " & 1 & ")"
Master.Execute(sSQL)

sSQL = "select * from multimediagaleria where sw=true order by codigo desc"
set RSGaleria = Master.Execute(sSQL)
newarchname = RSGaleria("codigo") & "." & oFile.FileExtension
end if

oFile.FileName = newarchname

oFile.SaveAsFile

if modo = "agregar" then
sSQL = "update multimediagaleria set archivo='" & newarchname & "', sw=" & 0 & " where codigo=" & RSGaleria("codigo")
Master.Execute(sSQL)
end if

if oFile.UploadSuccessful then
strTotalOk = strTotalOk + 1
strReporte = strReporte & "<ok>El Archivo <strong>" & archname & "</strong> se subió correctamente (Archivo " & I & ").[separar]"
else
if strErrorDefault <> oFile.ErrorMessage then strReporte = strReporte & oFile.ErrorMessage & " (Archivo <strong>" & I & "</strong>)[separar]"
end if
end if

set oFile = Nothing
next

if strTotalOk = 0 and modo = "agregar" then
sSQL = "delete from multimedia where codigo=" & multimedia_codigo
Master.Execute(sSQL)

multimedia_codigo = 0
set Master = DBOpenConection()
end if

response.redirect(strPaginaActual & "?upload=ok&modo=agregar&tipo=" & tipo & "&valores=" & multimedia_codigo & "[separar]&reporte=" & strReporte _
& "&total=" & strTotalOk)
end if
else
bgcolor = strListaSeparator2
for I = 1 to strMaxFiles
if I < 10 then num_foto = "0" & I else num_foto = I
if bgcolor = strListaSeparator1 then bgcolor = strListaSeparator2 else bgcolor = strListaSeparator1
%>
<table width="100%" align="center" border="0" cellspacing="2" cellpadding="2" class="TablaSimple" bgcolor="<%=(bgcolor)%>">
<tr>
<td rowspan="2" width="2%"><%=(num_foto)%></td>
<td width="128" rowspan="2" align="center"><img src="<%=(imagen_preview)%>" border="0" id="ipreview<%=(I)%>" width="100" height="100"></td>
<td width="10%">Archivo:</td>
<td><input type="file" name="file<%=(I)%>" style="width:100%;" onchange="preview_multimedia(this,<%=(I)%>,<%=(tip o)%>)"></td>
</tr>
<tr>
<td>Descripci&oacute;n:</td>
<td><textarea name="txtdescripcion<%=(I)%>" rows="5" style="width:100%;"></textarea></td>
</tr>
</table>
<%
if I < strMaxFiles then
%>
<hr>
<%
end if
next
end if

set oFO = Nothing

else
%>