diff --git a/APPL/Shared/BijlagenForm.asp b/APPL/Shared/BijlagenForm.asp index def733cb20..ce6bb6cbb5 100644 --- a/APPL/Shared/BijlagenForm.asp +++ b/APPL/Shared/BijlagenForm.asp @@ -214,10 +214,13 @@ if (fso.FolderExists(params.AttachPath)) 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'}); - window.location = "<%=protectQS.create("BijlagenForm.asp?x=x"+transitParam)%>"; + for (i=0; i"; } function mailFile() @@ -321,10 +324,11 @@ if (fso.FolderExists(params.AttachPath)) 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"}); + var isMultiple = (((pMulti || params.multi) && !params.forcesingle) ? "multiple" : ""); %> <% if (params.extFilter) { Response.Write("(" + safe.html(params.extFilter) + ")"); } %> - + name="imgfile" style="width: 95%" onchange="iface.button[this.value?'enable':'disable']('btn_upload_submit')"> diff --git a/APPL/Shared/UploadForm_save.asp b/APPL/Shared/UploadForm_save.asp index 8dbfc14058..f430431a56 100644 --- a/APPL/Shared/UploadForm_save.asp +++ b/APPL/Shared/UploadForm_save.asp @@ -72,8 +72,12 @@ function jslog(str) // VB Vindt de twee underscores niet leuk } var VB_result = VB_getfiles(); + var result = { message: VB_result("message"), + safefilename: [] + }; //__Log(found_fields); + //__Log(found_files); 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 safefilename = safe.filename(finfo.name); + result.safefilename.push(safefilename); var BinaryStream = Server.CreateObject("ADODB.Stream"); BinaryStream.Type = 1; // adTypeBinary BinaryStream.Open(); @@ -98,13 +103,8 @@ function jslog(str) // VB Vindt de twee underscores niet leuk { HELP; } - - } - - var result = { message: VB_result("message"), - safefilename: VB_result("safefilename") - }; + //__Log(result); // Toevoegen bijlage/bestand tracken. 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(); 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; j1) { - var vFileName = fc.item().Name; - if (vFileName != VB_result("safefilename")) + result.message += L("lcl_shared_upload_toomany"); + } + 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) - DeleteFile(params.AttachPath + vFileName); + var vFileName = fc.item().Name; + if (vFileName != result.safefilename[0]) + { + __Log("Autodelete: " + params.AttachPath + vFileName) + DeleteFile(params.AttachPath + vFileName); + } } } } - if (result.message && result.message != "") { 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); - // Eerst Resize/crop - if (params.regexp && result.safefilename.match(/\.(png|jpg|jpeg)$/i)) + for (j=0; j w * oIMG.Height) - h = oIMG.Height / oIMG.Width * w; - else - w = oIMG.Width / oIMG.Height * h; - } + var RrCc = Format[1]; + var h0 = h = parseInt(Format[2], 10); + var w0 = w = parseInt(Format[3], 10); + if (RrCc == "R" || RrCc == "r") // Dan niet croppen maar aspect ratio behouden + { + if (oIMG.Width * h > w * oIMG.Height) + h = oIMG.Height / oIMG.Width * w; + else + w = oIMG.Width / oIMG.Height * h; + } - 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 - { - result.message = L("lcl_shared_photo_small").format(h0, w0, oIMG.Height, oIMG.Width); - DeleteFile(params.AttachPath + result.safefilename); - } - else // Dan maar niet, we vergtoten niet. - { - h = oIMG.Height; - w = oIMG.Width; - } - } - if (!result.message && (oIMG.Height != h || oIMG.Width != w)) - { - try { - __Log("Resize/Cropping from w=" + oIMG.Width + " h=" + oIMG.Height + " to w=" + w + " h=" + h); - oIMG.Width = w; - oIMG.Height = h; - oIMG.SaveAs(params.AttachPath + result.safefilename); - } - catch (e) - { - result.message = L("lcl_shared_thumbnail_error") + e.description; - // Gewoon opruimen - DeleteFile(params.AttachPath + result.safefilename); - } - } - } - } + 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 + { + result.message = L("lcl_shared_photo_small").format(h0, w0, oIMG.Height, oIMG.Width); + DeleteFile(params.AttachPath + result_safefilename); + } + else // Dan maar niet, we vergtoten niet. + { + h = oIMG.Height; + w = oIMG.Width; + } + } + if (!result.message && (oIMG.Height != h || oIMG.Width != w)) + { + try { + __Log("Resize/Cropping from w=" + oIMG.Width + " h=" + oIMG.Height + " to w=" + w + " h=" + h); + oIMG.Width = w; + oIMG.Height = h; + oIMG.SaveAs(params.AttachPath + result_safefilename); + } + catch (e) + { + result.message = L("lcl_shared_thumbnail_error") + e.description; + // Gewoon opruimen + DeleteFile(params.AttachPath + result_safefilename); + } + } + } + } - if (!result.message) - switch(pModule) - { - case "SML": // Thumb altijd - try { - maxThumbW = 60; - maxThumbH = 80; - if (oIMG.Width / oIMG.Height > maxThumbW / maxThumbH) - { - oIMG.Height = oIMG.Height / oIMG.Width * maxThumbW; - oIMG.Width = maxThumbW; + if (!result.message) + switch(pModule) + { + case "SML": // Thumb altijd + try { + maxThumbW = 60; + maxThumbH = 80; + if (oIMG.Width / oIMG.Height > maxThumbW / maxThumbH) + { + oIMG.Height = oIMG.Height / 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; - oIMG.Height = maxThumbH; + result.message = L("lcl_shared_thumbnail_error") + e.description; + DeleteFile(params.AttachPath + "thumb/" + result_safefilename); } - CreateFullPath(params.AttachPath + "thumb/"); - oIMG.SaveAs(params.AttachPath + "thumb/" + result.safefilename); - } - catch (e) - { - result.message = L("lcl_shared_thumbnail_error") + e.description; - DeleteFile(params.AttachPath + "thumb/" + result.safefilename); - } - break; - case "FGII": - // Direct scannen nu, indien dwf bestand. Tekening kan vaker gebruikt worden. - var sql = "SELECT cad_tekening_key" - + " FROM cad_tekening" - + " WHERE cad_tekening_filenaam || '.dwf' = " + safe.quoted_sql(result.safefilename); - 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; + break; + case "FGII": + // Direct scannen nu, indien dwf bestand. Tekening kan vaker gebruikt worden. + var sql = "SELECT cad_tekening_key" + + " FROM cad_tekening" + + " WHERE cad_tekening_filenaam || '.dwf' = " + safe.quoted_sql(result_safefilename); + 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; + } } - } + } %> <% Response.End; @@ -294,13 +310,6 @@ Public Function VB_getfiles() Set UploadRequest = CreateObject("Scripting.Dictionary") 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 ' met de hidden form-fields uit de header Dim ur_key, i, var_naam, var_waarde @@ -309,6 +318,11 @@ Public Function VB_getfiles() var_naam = ur_key(i) if UploadRequest.Item(var_naam).Exists("ContentType") then 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 var_waarde = UploadRequest.Item(var_naam).Item("Value") end if diff --git a/APPL/Shared/upload.inc b/APPL/Shared/upload.inc index 22fe2133d6..ca4f105020 100644 --- a/APPL/Shared/upload.inc +++ b/APPL/Shared/upload.inc @@ -9,6 +9,7 @@ Sub BuildUploadRequest(RequestBin) PosEnd = InstrB(PosBeg,RequestBin,getByteString(chr(13))) boundary = MidB(RequestBin,PosBeg,PosEnd-PosBeg) boundaryPos = InstrB(1,RequestBin,boundary) + img_nr = 1 'Get all data inside the boundaries Do until (boundaryPos=InstrB(RequestBin,boundary & getByteString("--"))) 'Members variable of objects are put in a dictionary object @@ -30,6 +31,8 @@ Sub BuildUploadRequest(RequestBin) FileName = getString(MidB(RequestBin,PosBeg,PosEnd-PosBeg)) 'Add filename to dictionary object UploadControl.Add "FileName", FileName + Name = Name & img_nr + img_nr = img_nr + 1 Pos = InstrB(PosEnd,RequestBin,getByteString("Content-Type:")) PosBeg = Pos+14 PosEnd = InstrB(PosBeg,RequestBin,getByteString(chr(13))) @@ -50,7 +53,7 @@ Sub BuildUploadRequest(RequestBin) 'Add content to dictionary object UploadControl.Add "Value" , Value 'Add dictionary object to main dictionary - UploadRequest.Add name, UploadControl + UploadRequest.Add Name, UploadControl 'Loop to next object BoundaryPos=InstrB(BoundaryPos+LenB(boundary),RequestBin,boundary) Loop