ASDL#37188 Logboek NS: Mogelijkheid om meerdere foto's tergelijk opsturen
svn path=/Website/trunk/; revision=30551
This commit is contained in:
@@ -214,10 +214,13 @@ if (fso.FolderExists(params.AttachPath))
|
|||||||
document.forms.u2.submit();
|
document.forms.u2.submit();
|
||||||
}
|
}
|
||||||
|
|
||||||
function uploadDone(uploaded_file)
|
function uploadDone(uploaded_files)
|
||||||
{
|
{
|
||||||
FcltMgr.topmanager().window.$.toast({ text: L("lcl_appendix_added").format(uploaded_file), icon: "success", position : 'top-center'});
|
for (i=0; i<uploaded_files.length; i++)
|
||||||
window.location = "<%=protectQS.create("BijlagenForm.asp?x=x"+transitParam)%>";
|
{
|
||||||
|
FcltMgr.topmanager().window.$.toast({ text: L("lcl_appendix_added").format(uploaded_files[i]), icon: "success", position : 'top-center'});
|
||||||
|
}
|
||||||
|
window.location = "<%=protectQS.create("BijlagenForm.asp?x=x"+transitParam)%>";
|
||||||
}
|
}
|
||||||
|
|
||||||
function mailFile()
|
function mailFile()
|
||||||
@@ -321,10 +324,11 @@ if (fso.FolderExists(params.AttachPath))
|
|||||||
if (!pReado && (pMulti || params.multi || fileArray.length == 0)) // Uploadknop erbij
|
if (!pReado && (pMulti || params.multi || fileArray.length == 0)) // Uploadknop erbij
|
||||||
{
|
{
|
||||||
buttons.push({ title: L("lcl_do_upload_image"), action: "doSubmitUpload()", singlepress: true, id: "btn_upload_submit"});
|
buttons.push({ title: L("lcl_do_upload_image"), action: "doSubmitUpload()", singlepress: true, id: "btn_upload_submit"});
|
||||||
|
var isMultiple = (((pMulti || params.multi) && !params.forcesingle) ? "multiple" : "");
|
||||||
%> <tr><td colspan="4">
|
%> <tr><td colspan="4">
|
||||||
<label><%=L("lcl_upload_file")%>:</label>
|
<label><%=L("lcl_upload_file")%>:</label>
|
||||||
<% if (params.extFilter) { Response.Write("(" + safe.html(params.extFilter) + ")"); } %>
|
<% if (params.extFilter) { Response.Write("(" + safe.html(params.extFilter) + ")"); } %>
|
||||||
<input type="file" multiple name="imgfile" style="width: 95%" onchange="iface.button[this.value?'enable':'disable']('btn_upload_submit')">
|
<input type="file" <%=isMultiple%> name="imgfile" style="width: 95%" onchange="iface.button[this.value?'enable':'disable']('btn_upload_submit')">
|
||||||
<div id="uploading" style="display:none">
|
<div id="uploading" style="display:none">
|
||||||
Please wait...
|
Please wait...
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -72,8 +72,12 @@ function jslog(str) // VB Vindt de twee underscores niet leuk
|
|||||||
}
|
}
|
||||||
|
|
||||||
var VB_result = VB_getfiles();
|
var VB_result = VB_getfiles();
|
||||||
|
var result = { message: VB_result("message"),
|
||||||
|
safefilename: []
|
||||||
|
};
|
||||||
|
|
||||||
//__Log(found_fields);
|
//__Log(found_fields);
|
||||||
|
//__Log(found_files);
|
||||||
protectRequest.validateToken(found_fields["__RequestVerificationToken"]);
|
protectRequest.validateToken(found_fields["__RequestVerificationToken"]);
|
||||||
|
|
||||||
|
|
||||||
@@ -83,6 +87,7 @@ function jslog(str) // VB Vindt de twee underscores niet leuk
|
|||||||
{
|
{
|
||||||
var finfo = found_files[j];
|
var finfo = found_files[j];
|
||||||
var safefilename = safe.filename(finfo.name);
|
var safefilename = safe.filename(finfo.name);
|
||||||
|
result.safefilename.push(safefilename);
|
||||||
var BinaryStream = Server.CreateObject("ADODB.Stream");
|
var BinaryStream = Server.CreateObject("ADODB.Stream");
|
||||||
BinaryStream.Type = 1; // adTypeBinary
|
BinaryStream.Type = 1; // adTypeBinary
|
||||||
BinaryStream.Open();
|
BinaryStream.Open();
|
||||||
@@ -98,13 +103,8 @@ function jslog(str) // VB Vindt de twee underscores niet leuk
|
|||||||
{
|
{
|
||||||
HELP;
|
HELP;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
//__Log(result);
|
||||||
var result = { message: VB_result("message"),
|
|
||||||
safefilename: VB_result("safefilename")
|
|
||||||
};
|
|
||||||
|
|
||||||
// Toevoegen bijlage/bestand tracken.
|
// Toevoegen bijlage/bestand tracken.
|
||||||
if (pKey > -1 && params.trackcode && (params.kenmerktype == "E" || params.kenmerktype == "F" || params.kenmerktype == "M"))
|
if (pKey > -1 && params.trackcode && (params.kenmerktype == "E" || params.kenmerktype == "F" || params.kenmerktype == "M"))
|
||||||
@@ -119,28 +119,37 @@ function jslog(str) // VB Vindt de twee underscores niet leuk
|
|||||||
oRs.close();
|
oRs.close();
|
||||||
pKey = String(afspr_key);
|
pKey = String(afspr_key);
|
||||||
}
|
}
|
||||||
var ptxt = L("lcl_shared_attachment_add").format(params.kenmerkoms, found_files[0].name);
|
|
||||||
|
|
||||||
shared.trackaction(params.trackcode, pKey, ptxt);
|
for (j=0; j<result.safefilename.length; j++)
|
||||||
|
{
|
||||||
|
ptxt = L("lcl_shared_attachment_add").format(params.kenmerkoms, result.safefilename[j]);
|
||||||
|
shared.trackaction(params.trackcode, pKey, ptxt);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!result.message && params.forcesingle)
|
if (!result.message && params.forcesingle)
|
||||||
{
|
{ // Er mag maar 1 bestand bestaan.
|
||||||
// Verwijder alle andere bestanden.
|
// Verwijder alle andere bestanden.
|
||||||
var fso = Server.CreateObject("Scripting.FileSystemObject")
|
if (result.safefilename.length>1)
|
||||||
var f = fso.GetFolder(params.AttachPath);
|
|
||||||
for (fc = new Enumerator(f.files); !fc.atEnd(); fc.moveNext())
|
|
||||||
{
|
{
|
||||||
var vFileName = fc.item().Name;
|
result.message += L("lcl_shared_upload_toomany");
|
||||||
if (vFileName != VB_result("safefilename"))
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var fso = Server.CreateObject("Scripting.FileSystemObject")
|
||||||
|
var f = fso.GetFolder(params.AttachPath);
|
||||||
|
for (fc = new Enumerator(f.files); !fc.atEnd(); fc.moveNext())
|
||||||
{
|
{
|
||||||
__Log("Autodelete: " + params.AttachPath + vFileName)
|
var vFileName = fc.item().Name;
|
||||||
DeleteFile(params.AttachPath + vFileName);
|
if (vFileName != result.safefilename[0])
|
||||||
|
{
|
||||||
|
__Log("Autodelete: " + params.AttachPath + vFileName)
|
||||||
|
DeleteFile(params.AttachPath + vFileName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (result.message && result.message != "")
|
if (result.message && result.message != "")
|
||||||
{
|
{
|
||||||
result.message = L("lcl_shared_upload_error_start") + result.message + L("lcl_shared_upload_error_end");
|
result.message = L("lcl_shared_upload_error_start") + result.message + L("lcl_shared_upload_error_end");
|
||||||
@@ -149,112 +158,119 @@ function jslog(str) // VB Vindt de twee underscores niet leuk
|
|||||||
{
|
{
|
||||||
checkWebconfig(params.AttachRootPath);
|
checkWebconfig(params.AttachRootPath);
|
||||||
|
|
||||||
// Eerst Resize/crop
|
for (j=0; j<result.safefilename.length; j++)
|
||||||
if (params.regexp && result.safefilename.match(/\.(png|jpg|jpeg)$/i))
|
|
||||||
{
|
{
|
||||||
var Format = params.regexp.match(/^([RrCc])(\d*)x(\d*)$/i); // P800x600
|
result_safefilename = result.safefilename[j];
|
||||||
if (Format && Format.length == 4)
|
// Eerst Resize/crop
|
||||||
{
|
if (params.regexp && result_safefilename.match(/\.(png|jpg|jpeg)$/i))
|
||||||
var oIMG = new ActiveXObject("SLNKDWF.ImageConvert");
|
{
|
||||||
try
|
var Format = params.regexp.match(/^([RrCc])(\d*)x(\d*)$/i); // P800x600
|
||||||
{
|
if (Format && Format.length == 4)
|
||||||
oIMG.Open(params.AttachPath + result.safefilename);
|
{
|
||||||
}
|
var oIMG = new ActiveXObject("SLNKDWF.ImageConvert");
|
||||||
catch(e)
|
try
|
||||||
{
|
{
|
||||||
result.message = L("lcl_shared_thumbnail_error") + e.description;
|
oIMG.Open(params.AttachPath + result_safefilename);
|
||||||
// Gewoon opruimen
|
}
|
||||||
DeleteFile(params.AttachPath + result.safefilename);
|
catch(e)
|
||||||
}
|
{
|
||||||
|
result.message = L("lcl_shared_thumbnail_error") + e.description;
|
||||||
|
// Gewoon opruimen
|
||||||
|
DeleteFile(params.AttachPath + result_safefilename);
|
||||||
|
}
|
||||||
|
|
||||||
var RrCc = Format[1];
|
var RrCc = Format[1];
|
||||||
var h0 = h = parseInt(Format[2], 10);
|
var h0 = h = parseInt(Format[2], 10);
|
||||||
var w0 = w = parseInt(Format[3], 10);
|
var w0 = w = parseInt(Format[3], 10);
|
||||||
if (RrCc == "R" || RrCc == "r") // Dan niet croppen maar aspect ratio behouden
|
if (RrCc == "R" || RrCc == "r") // Dan niet croppen maar aspect ratio behouden
|
||||||
{
|
{
|
||||||
if (oIMG.Width * h > w * oIMG.Height)
|
if (oIMG.Width * h > w * oIMG.Height)
|
||||||
h = oIMG.Height / oIMG.Width * w;
|
h = oIMG.Height / oIMG.Width * w;
|
||||||
else
|
else
|
||||||
w = oIMG.Width / oIMG.Height * h;
|
w = oIMG.Width / oIMG.Height * h;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (oIMG.Height < h || oIMG.Width < w) // Zou er iets vergroot gaan worden.
|
if (oIMG.Height < h || oIMG.Width < w) // Zou er iets vergroot gaan worden.
|
||||||
{
|
{
|
||||||
if (RrCc == "R" || RrCc == "C") // Dan zijn we streng en eisen we minimale afmeting
|
if (RrCc == "R" || RrCc == "C") // Dan zijn we streng en eisen we minimale afmeting
|
||||||
{
|
{
|
||||||
result.message = L("lcl_shared_photo_small").format(h0, w0, oIMG.Height, oIMG.Width);
|
result.message = L("lcl_shared_photo_small").format(h0, w0, oIMG.Height, oIMG.Width);
|
||||||
DeleteFile(params.AttachPath + result.safefilename);
|
DeleteFile(params.AttachPath + result_safefilename);
|
||||||
}
|
}
|
||||||
else // Dan maar niet, we vergtoten niet.
|
else // Dan maar niet, we vergtoten niet.
|
||||||
{
|
{
|
||||||
h = oIMG.Height;
|
h = oIMG.Height;
|
||||||
w = oIMG.Width;
|
w = oIMG.Width;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!result.message && (oIMG.Height != h || oIMG.Width != w))
|
if (!result.message && (oIMG.Height != h || oIMG.Width != w))
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
__Log("Resize/Cropping from w=" + oIMG.Width + " h=" + oIMG.Height + " to w=" + w + " h=" + h);
|
__Log("Resize/Cropping from w=" + oIMG.Width + " h=" + oIMG.Height + " to w=" + w + " h=" + h);
|
||||||
oIMG.Width = w;
|
oIMG.Width = w;
|
||||||
oIMG.Height = h;
|
oIMG.Height = h;
|
||||||
oIMG.SaveAs(params.AttachPath + result.safefilename);
|
oIMG.SaveAs(params.AttachPath + result_safefilename);
|
||||||
}
|
}
|
||||||
catch (e)
|
catch (e)
|
||||||
{
|
{
|
||||||
result.message = L("lcl_shared_thumbnail_error") + e.description;
|
result.message = L("lcl_shared_thumbnail_error") + e.description;
|
||||||
// Gewoon opruimen
|
// Gewoon opruimen
|
||||||
DeleteFile(params.AttachPath + result.safefilename);
|
DeleteFile(params.AttachPath + result_safefilename);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!result.message)
|
if (!result.message)
|
||||||
switch(pModule)
|
switch(pModule)
|
||||||
{
|
{
|
||||||
case "SML": // Thumb altijd
|
case "SML": // Thumb altijd
|
||||||
try {
|
try {
|
||||||
maxThumbW = 60;
|
maxThumbW = 60;
|
||||||
maxThumbH = 80;
|
maxThumbH = 80;
|
||||||
if (oIMG.Width / oIMG.Height > maxThumbW / maxThumbH)
|
if (oIMG.Width / oIMG.Height > maxThumbW / maxThumbH)
|
||||||
{
|
{
|
||||||
oIMG.Height = oIMG.Height / oIMG.Width * maxThumbW;
|
oIMG.Height = oIMG.Height / oIMG.Width * maxThumbW;
|
||||||
oIMG.Width = maxThumbW;
|
oIMG.Width = maxThumbW;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
oIMG.Width = oIMG.Width / oIMG.Height * maxThumbH;
|
||||||
|
oIMG.Height = maxThumbH;
|
||||||
|
}
|
||||||
|
CreateFullPath(params.AttachPath + "thumb/");
|
||||||
|
oIMG.SaveAs(params.AttachPath + "thumb/" + result_safefilename);
|
||||||
}
|
}
|
||||||
else
|
catch (e)
|
||||||
{
|
{
|
||||||
oIMG.Width = oIMG.Width / oIMG.Height * maxThumbH;
|
result.message = L("lcl_shared_thumbnail_error") + e.description;
|
||||||
oIMG.Height = maxThumbH;
|
DeleteFile(params.AttachPath + "thumb/" + result_safefilename);
|
||||||
}
|
}
|
||||||
CreateFullPath(params.AttachPath + "thumb/");
|
break;
|
||||||
oIMG.SaveAs(params.AttachPath + "thumb/" + result.safefilename);
|
case "FGII":
|
||||||
}
|
// Direct scannen nu, indien dwf bestand. Tekening kan vaker gebruikt worden.
|
||||||
catch (e)
|
var sql = "SELECT cad_tekening_key"
|
||||||
{
|
+ " FROM cad_tekening"
|
||||||
result.message = L("lcl_shared_thumbnail_error") + e.description;
|
+ " WHERE cad_tekening_filenaam || '.dwf' = " + safe.quoted_sql(result_safefilename);
|
||||||
DeleteFile(params.AttachPath + "thumb/" + result.safefilename);
|
var oRs = Oracle.Execute(sql);
|
||||||
}
|
while (!oRs.eof)
|
||||||
break;
|
{
|
||||||
case "FGII":
|
var cad_tek_key = oRs("cad_tekening_key").value;
|
||||||
// Direct scannen nu, indien dwf bestand. Tekening kan vaker gebruikt worden.
|
result.message = scanDWF(cad_tek_key, 1);
|
||||||
var sql = "SELECT cad_tekening_key"
|
oRs.MoveNext();
|
||||||
+ " FROM cad_tekening"
|
}
|
||||||
+ " WHERE cad_tekening_filenaam || '.dwf' = " + safe.quoted_sql(result.safefilename);
|
break;
|
||||||
var oRs = Oracle.Execute(sql);
|
}
|
||||||
while (!oRs.eof)
|
|
||||||
{
|
|
||||||
var cad_tek_key = oRs("cad_tekening_key").value;
|
|
||||||
result.message = scanDWF(cad_tek_key, 1);
|
|
||||||
oRs.MoveNext();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
%><script>
|
%><script>
|
||||||
<% if (result.message) { %>
|
<% if (result.message) { %>
|
||||||
alert("<%=safe.jsstring(result.message)%>");
|
alert("<%=safe.jsstring(result.message)%>");
|
||||||
<% } %>
|
<% } %>
|
||||||
parent.uploadDone("<%=found_files[0].name%>"); // Zoo fout....
|
var JSONdata = "<%=safe.jsstring(JSON.stringify(result.safefilename))%>";
|
||||||
|
var filename_arr = eval('(' + JSONdata + ')');
|
||||||
|
|
||||||
|
parent.uploadDone(filename_arr); // Zoo fout....
|
||||||
</script>
|
</script>
|
||||||
<%
|
<%
|
||||||
Response.End;
|
Response.End;
|
||||||
@@ -294,13 +310,6 @@ Public Function VB_getfiles()
|
|||||||
Set UploadRequest = CreateObject("Scripting.Dictionary")
|
Set UploadRequest = CreateObject("Scripting.Dictionary")
|
||||||
BuildUploadRequest RequestBin
|
BuildUploadRequest RequestBin
|
||||||
|
|
||||||
' Dit moet nog ini een lus voor meerdere bestanden.
|
|
||||||
contentType = UploadRequest.Item("imgfile").Item("ContentType")
|
|
||||||
filepathname = UploadRequest.Item("imgfile").Item("FileName")
|
|
||||||
value = MultiByteToBinary(UploadRequest.Item("imgfile").Item("Value"))
|
|
||||||
js_add_file filepathname, value, contentType
|
|
||||||
result.add "safefilename", filepathname
|
|
||||||
|
|
||||||
' Vul via de (Javascipt) functie js_add_field de globale found_fields
|
' Vul via de (Javascipt) functie js_add_field de globale found_fields
|
||||||
' met de hidden form-fields uit de header
|
' met de hidden form-fields uit de header
|
||||||
Dim ur_key, i, var_naam, var_waarde
|
Dim ur_key, i, var_naam, var_waarde
|
||||||
@@ -309,6 +318,11 @@ Public Function VB_getfiles()
|
|||||||
var_naam = ur_key(i)
|
var_naam = ur_key(i)
|
||||||
if UploadRequest.Item(var_naam).Exists("ContentType") then
|
if UploadRequest.Item(var_naam).Exists("ContentType") then
|
||||||
var_waarde = UploadRequest.Item(var_naam).Item("FileName")
|
var_waarde = UploadRequest.Item(var_naam).Item("FileName")
|
||||||
|
' En dan nu nog de bestanden..
|
||||||
|
contentType = UploadRequest.Item(var_naam).Item("ContentType")
|
||||||
|
filepathname = UploadRequest.Item(var_naam).Item("FileName")
|
||||||
|
value = MultiByteToBinary(UploadRequest.Item(var_naam).Item("Value"))
|
||||||
|
js_add_file filepathname, value, contentType
|
||||||
else
|
else
|
||||||
var_waarde = UploadRequest.Item(var_naam).Item("Value")
|
var_waarde = UploadRequest.Item(var_naam).Item("Value")
|
||||||
end if
|
end if
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ Sub BuildUploadRequest(RequestBin)
|
|||||||
PosEnd = InstrB(PosBeg,RequestBin,getByteString(chr(13)))
|
PosEnd = InstrB(PosBeg,RequestBin,getByteString(chr(13)))
|
||||||
boundary = MidB(RequestBin,PosBeg,PosEnd-PosBeg)
|
boundary = MidB(RequestBin,PosBeg,PosEnd-PosBeg)
|
||||||
boundaryPos = InstrB(1,RequestBin,boundary)
|
boundaryPos = InstrB(1,RequestBin,boundary)
|
||||||
|
img_nr = 1
|
||||||
'Get all data inside the boundaries
|
'Get all data inside the boundaries
|
||||||
Do until (boundaryPos=InstrB(RequestBin,boundary & getByteString("--")))
|
Do until (boundaryPos=InstrB(RequestBin,boundary & getByteString("--")))
|
||||||
'Members variable of objects are put in a dictionary object
|
'Members variable of objects are put in a dictionary object
|
||||||
@@ -30,6 +31,8 @@ Sub BuildUploadRequest(RequestBin)
|
|||||||
FileName = getString(MidB(RequestBin,PosBeg,PosEnd-PosBeg))
|
FileName = getString(MidB(RequestBin,PosBeg,PosEnd-PosBeg))
|
||||||
'Add filename to dictionary object
|
'Add filename to dictionary object
|
||||||
UploadControl.Add "FileName", FileName
|
UploadControl.Add "FileName", FileName
|
||||||
|
Name = Name & img_nr
|
||||||
|
img_nr = img_nr + 1
|
||||||
Pos = InstrB(PosEnd,RequestBin,getByteString("Content-Type:"))
|
Pos = InstrB(PosEnd,RequestBin,getByteString("Content-Type:"))
|
||||||
PosBeg = Pos+14
|
PosBeg = Pos+14
|
||||||
PosEnd = InstrB(PosBeg,RequestBin,getByteString(chr(13)))
|
PosEnd = InstrB(PosBeg,RequestBin,getByteString(chr(13)))
|
||||||
@@ -50,7 +53,7 @@ Sub BuildUploadRequest(RequestBin)
|
|||||||
'Add content to dictionary object
|
'Add content to dictionary object
|
||||||
UploadControl.Add "Value" , Value
|
UploadControl.Add "Value" , Value
|
||||||
'Add dictionary object to main dictionary
|
'Add dictionary object to main dictionary
|
||||||
UploadRequest.Add name, UploadControl
|
UploadRequest.Add Name, UploadControl
|
||||||
'Loop to next object
|
'Loop to next object
|
||||||
BoundaryPos=InstrB(BoundaryPos+LenB(boundary),RequestBin,boundary)
|
BoundaryPos=InstrB(BoundaryPos+LenB(boundary),RequestBin,boundary)
|
||||||
Loop
|
Loop
|
||||||
|
|||||||
Reference in New Issue
Block a user