diff --git a/APPL/API2/model_bes_discipline.inc b/APPL/API2/model_bes_discipline.inc index adb3463583..3a659cf588 100644 --- a/APPL/API2/model_bes_discipline.inc +++ b/APPL/API2/model_bes_discipline.inc @@ -122,15 +122,10 @@ _model_bes_discipline = // Internal only "label": L("ins_discipline_ktodrempel"), "typ": "number" }, - "_upload": { - "dbs": "", - "label": L("lcl_bes_symbol_upload"), - "typ": "button2", - "defaultvalue": L("lcl_bes_browse_upload") - }, "symbolname": { "dbs": "ins_discipline_image", - "typ": "varchar", + "typ": "symbol", + "module": "BESD", "label": L("lcl_bes_symbol_name") }, "externnr": { diff --git a/APPL/API2/model_bgt_discipline.inc b/APPL/API2/model_bgt_discipline.inc index ab4334f483..b9d67ff723 100644 --- a/APPL/API2/model_bgt_discipline.inc +++ b/APPL/API2/model_bgt_discipline.inc @@ -109,15 +109,10 @@ function _model_bgt_discipline() "default": "false", "hidden_fld": true }, - "_upload": { - "dbs": "", - "label": L("lcl_bgt_symbol_upload"), - "typ": "button2", - "defaultvalue": L("lcl_bgt_browse_upload") - }, "symbolname": { "dbs": "ins_discipline_image", - "typ": "varchar", + "typ": "symbol", + "module": "BGTD", "label": L("lcl_bgt_symbol_name") }, "externnr": { diff --git a/APPL/API2/model_cht_discipline.inc b/APPL/API2/model_cht_discipline.inc index c8ca360b2e..a16b57bb1e 100644 --- a/APPL/API2/model_cht_discipline.inc +++ b/APPL/API2/model_cht_discipline.inc @@ -94,15 +94,10 @@ function model_cht_discipline(disc_key, params) "typ": "number", "multiedit": true }, - "_upload": { - "dbs": "", - "label": L("lcl_res_symbol_upload"), - "typ": "button2", - "defaultvalue": L("lcl_res_browse_upload") - }, "symbolname": { "dbs": "ins_discipline_image", - "typ": "varchar", + "typ": "symbol", + "module": "CHTD", "label": L("lcl_res_symbol_name") } */ diff --git a/APPL/API2/model_cnt_discipline.inc b/APPL/API2/model_cnt_discipline.inc index 668bd99b7b..4479c295d5 100644 --- a/APPL/API2/model_cnt_discipline.inc +++ b/APPL/API2/model_cnt_discipline.inc @@ -101,15 +101,10 @@ _model_cnt_discipline = // Internal only "label": L("ins_discipline_email"), "typ": "varchar" }, -// "_upload": { -// "dbs": "", -// "label": L("lcl_cnt_symbol_upload"), -// "typ": "button2", -// "defaultvalue": L("lcl_cnt_browse_upload") -// }, "symbolname": { "dbs": "ins_discipline_image", - "typ": "varchar", + "typ": "symbol", + "module": "CNTD", "label": L("lcl_cnt_symbol_name") }, "externnr": { diff --git a/APPL/API2/model_ins_discipline.inc b/APPL/API2/model_ins_discipline.inc index 0b1104eb58..282837ce7a 100644 --- a/APPL/API2/model_ins_discipline.inc +++ b/APPL/API2/model_ins_discipline.inc @@ -101,15 +101,10 @@ _model_ins_discipline = // Internal only "typ": "color", "label": L("lcl_ins_colors") }, - "_upload": { - "dbs": "", - "label": L("lcl_ins_symbol_upload"), - "typ": "button2", - "defaultvalue": L("lcl_ins_browse_upload") - }, "symbolname": { "dbs": "ins_discipline_image", - "typ": "varchar", + "typ": "symbol", + "module": "INSD", "label": L("lcl_ins_symbol_name") }, "externnr": { diff --git a/APPL/API2/model_mld_srtdiscipline.inc b/APPL/API2/model_mld_srtdiscipline.inc index dbd10cf5a3..9739d3b331 100644 --- a/APPL/API2/model_mld_srtdiscipline.inc +++ b/APPL/API2/model_mld_srtdiscipline.inc @@ -138,15 +138,10 @@ function model_mld_srtdiscipline() "label": L("lcl_ins_colors"), "defaultvalue": "" }, - "_upload": { - "dbs": "", - "label": L("lcl_mld_symbol_upload"), - "typ": "button2", - "defaultvalue": L("lcl_mld_browse_upload") - }, "symbolname": { "dbs": "ins_srtdiscipline_image", - "typ": "varchar", + "typ": "symbol", + "module": "MLDSD", "label": L("lcl_mld_symbol_name") }, "externnr": { diff --git a/APPL/API2/model_mld_stdmelding.inc b/APPL/API2/model_mld_stdmelding.inc index 6efa4006e7..0092d6aea5 100644 --- a/APPL/API2/model_mld_stdmelding.inc +++ b/APPL/API2/model_mld_stdmelding.inc @@ -324,7 +324,8 @@ function model_mld_stdmelding() }, "symbolname": { "dbs": "mld_stdmelding_image", - "typ": "varchar", + "typ": "symbol", + "module": "MLDS", "label": L("lcl_mld_symbol_name") }, "colors": { @@ -484,12 +485,6 @@ function model_mld_stdmelding() "typ": "varchar", "label": L("lcl_mld_externurl") }, - "_upload": { - "dbs": "", - "label": L("lcl_mld_symbol_upload"), - "typ": "button2", - "defaultvalue": L("lcl_mld_browse_upload") - }, "_limitlabel": { "dbs": "", "label": "", diff --git a/APPL/API2/model_res_discipline.inc b/APPL/API2/model_res_discipline.inc index 1785daf755..13c72b1071 100644 --- a/APPL/API2/model_res_discipline.inc +++ b/APPL/API2/model_res_discipline.inc @@ -145,15 +145,10 @@ _model_res_discipline = // Internal only "typ": "number", "multiedit": true }, - "_upload": { - "dbs": "", - "label": L("lcl_res_symbol_upload"), - "typ": "button2", - "defaultvalue": L("lcl_res_browse_upload") - }, "symbolname": { "dbs": "ins_discipline_image", - "typ": "varchar", + "typ": "symbol", + "module": "RESD", "label": L("lcl_res_symbol_name") }, "externnr": { diff --git a/APPL/CAD/cad_tekening_list.inc b/APPL/CAD/cad_tekening_list.inc index ca25b53789..ed21279f36 100644 --- a/APPL/CAD/cad_tekening_list.inc +++ b/APPL/CAD/cad_tekening_list.inc @@ -27,9 +27,7 @@ FCLTHeader.Requires({ plugins:["jQuery"], function tekening_list(pautfunction, params) { - var buttons = []; - - autfunction = "WEB_CADFOF"; + var autfunction = "WEB_CADFOF"; var authparams = user.checkAutorisation(autfunction); var canAdd = (authparams.ALGwritelevel < 9); @@ -79,12 +77,6 @@ function tekening_list(pautfunction, params) var url = "appl/CAD/default.asp?floor_key=" + cadData.flr_key + "&concept=1"; FcltMgr.openDetail(url, L("lcl_fg_tek_rapp")); } - - function Upload() - { - url = "<%=protectQS.create("../shared/BijlagenForm.asp?module=FGII")%>"; - FcltMgr.openModalDetail(url, L("lcl_upload_file")); - } @@ -290,8 +282,6 @@ function tekening_list(pautfunction, params) return {eVerschil : eVerschil, eContouren: eContouren}; } - buttons.push({title: L("lcl_upload_file"), action:"Upload();", icon: "fa-upload", id:"bSearch" }); - var rst = new ResultsetTable({ sql: sqln, keyColumn: "row_key", // we gebruiken hem niet maar hij mag niet leeg zijn ID: "workTable", @@ -299,8 +289,7 @@ function tekening_list(pautfunction, params) rowData: fnrowData, rowActionEnabler: fnrowActionEnabler, outputmode: outputmode, - filterParams: params, - buttons: buttons + filterParams: params }); rst.addColumn(new Column({caption: L("lcl_fg_tek_loc"), content: "alg_locatie_omschrijving"})); diff --git a/APPL/CAD/tekening_edit.asp b/APPL/CAD/tekening_edit.asp index 9e735fb4a6..679219c72a 100644 --- a/APPL/CAD/tekening_edit.asp +++ b/APPL/CAD/tekening_edit.asp @@ -35,9 +35,8 @@ var authparams = user.checkAutorisation(autfunction); <%=L("lcl_fg_tek_fac_change_file")%> @@ -45,7 +44,7 @@ var authparams = user.checkAutorisation(autfunction); <% MODAL_START(); %> -
+ <% /* Pass on some relevant paramaters */ MODAL_BLOCK_START("", L("lcl_fg_tek_change_file"), { icon: "fa-file-edit" }); %> @@ -56,16 +55,11 @@ var authparams = user.checkAutorisation(autfunction); ROFIELDTR("fld", L("lcl_location"), loc); ROFIELDTR("fld", L("lcl_building"), bld); ROFIELDTR("fld", L("lcl_floor"), flr); - FCLTflexfileselector("file", - "sgFile", - { - filename: file_name, - label: L("lcl_fg_tek_file"), - flexmodule: "FGII" - }); + FILEPICKERTR("file", L("lcl_fg_tek_file"), file_name, { "key": cad_tek_key, "module": "FGII" }); + MODAL_BLOCK_END(); - var buttons = [{title: L("lcl_submit"), icon: "fa-fclt-save", action: "doSubmit()", importance: 1}, + var buttons = [{title: L("lcl_submit"), icon: "fa-fclt-save", action: "cad_tek_submit()", importance: 1}, {title: L("lcl_cancel"), icon: "fa-fclt-cancel", action: "FcltMgr.closeDetail(window, { cancel: true })", importance: 3}]; SIMPLE_BLOCK_START(); CreateButtons(buttons); diff --git a/APPL/FAC/fac_edit_menu.asp b/APPL/FAC/fac_edit_menu.asp index 2e442daece..8b327f9fcd 100644 --- a/APPL/FAC/fac_edit_menu.asp +++ b/APPL/FAC/fac_edit_menu.asp @@ -205,12 +205,6 @@ if (menu_key > -1) } } - function edit_image() - { - var url = "<%=protectQS.create("../../appl/shared/BijlagenForm.asp?module=MENU&multi=1")%>"; - FcltMgr.openModalDetail(url, L("lcl_mrk_upload_foto")); - } - function menuitemChanged(init_key) { var new_menuitem_key = init_key || parseInt($("#fac_menuitems_key :SELECTED").val(), 10); @@ -346,7 +340,6 @@ if (menu_key > -1) var buttons = []; buttons.push({ title: L("lcl_submit"), icon: "fa-fclt-save", action: "doSubmit()" }); - buttons.push({ title: L("lcl_image"), icon: "fa-upload", action: "edit_image()"}); buttons.push({ title: L("lcl_cancel"), icon: "fa-fclt-cancel", action: "doCancel()" }); IFRAMER_HEADER(L("lcl_fac_menuoptie"), buttons); @@ -504,15 +497,7 @@ if (menu_key > -1) RWCHECKBOXTR("portal", "fldcheck", mobilemenu ? L("lcl_menu_app") : L("lcl_menuportal"), portal); - // een icon zou geen flexfile zijn, kan dus ook wat anders kiezen Hoe netjes? TODO - RWFIELDTR("image", "fld", L("lcl_image")+" (icon)", image); - - FCLTflexfileselector("image", - "sgFile", - { filename: image, - label: L("lcl_image"), - flexmodule: "MENU" - }); + RWSYMBOLTR("image", L("lcl_image"), image, { "module": "MENU", "key": menu_key }); BLOCK_END(); diff --git a/APPL/FAC/fac_show_menu.asp b/APPL/FAC/fac_show_menu.asp index b7613c61f3..14fae5576c 100644 --- a/APPL/FAC/fac_show_menu.asp +++ b/APPL/FAC/fac_show_menu.asp @@ -120,12 +120,6 @@ function fncolGroep(oRsvalue) window.location.href = "fac_edit_menu.asp?menu_key=<%=menu_key%>&menuitem_key=<%=menuitem_key%>"; } - function edit_image() - { - var url = "<%=protectQS.create("../../appl/shared/BijlagenForm.asp?module=MENU&multi=1")%>"; - FcltMgr.openModalDetail(url, L("lcl_mrk_upload_foto") ); - } - function copy_menu() { FcltMgr.openDetail("/appl/fac/fac_menu.asp?copy=1&menu_key=<%=menu_key%>", L("lcl_fac_menu_copy") + " " + L("lcl_fac_menuoptie").toLowerCase()); @@ -158,7 +152,6 @@ function fncolGroep(oRsvalue) <% SUBFRAME_START(); buttons = [ { title: L("lcl_change"), icon: "fa-fclt-edit", action: "edit_menu()" }, - { title: L("lcl_image"), icon: "fa-upload", action: "edit_image()" }, { title: L("lcl_fac_menu_copy"), icon: "fa-copy", action: "copy_menu()", tooltip: L("lcl_fac_menu_copy_hint") }, { title: L("lcl_delete"), icon: "fa-trash-alt", action: "delete_menu()" }]; IFRAMER_HEADER(L("lcl_fac_menuoptie"), buttons); @@ -235,7 +228,7 @@ SUBFRAME_START(); ROCHECKBOXTR("fldcheck", mobilemenu ? L("lcl_menu_app") : L("lcl_menuportal"), portal, { suppressEmpty: true }); // Afbeelding - ROFIELDTR("fld", L("lcl_image"), image, { suppressEmpty: true }); + ROSYMBOLTR("fld", L("lcl_image"), image, { "key": menu_key, "module": "MENU" }); BLOCK_END(); %>
diff --git a/APPL/FontAwesome/iconpicker.asp b/APPL/FontAwesome/iconpicker.asp index e7f126c22f..43f7e15349 100644 --- a/APPL/FontAwesome/iconpicker.asp +++ b/APPL/FontAwesome/iconpicker.asp @@ -23,7 +23,7 @@ FCLTHeader.Requires({ plugins:["jQuery"], js: ["jQuery-ui.js"]}); FCLTHeader.Generate(); %> + <% SUBFRAME_START(); @@ -188,13 +168,7 @@ else maxlength: 100 }); - RWFIELDTR("srtdeel_image", "fld", L("lcl_ins_image"), srtdeel.srtdeel_image ); - - var params = { datatype: "button", - html: "title='" + L("lcl_obj_image_upload") + "' onclick='UploadImage()'", - endicon: "fa-cloud-upload" - } - RWFIELDTR("image_button", "button", L("lcl_obj_image_upload"), L("lcl_fg_upload"), params); + RWSYMBOLTR("srtdeel_image", L("lcl_ins_image"), srtdeel.srtdeel_image, { "key": srtdeel_key, "module": "INSPHS" }); RWFIELDTR("srtdeel_volgnr", "fld", L("lcl_ins_volgnr"), srtdeel.srtdeel_volgnr ); RWFIELDTR("srtdeel_eenheid", "fld", L("lcl_obj_unit"), srtdeel.srtdeel_eenheid ); FCLTcalendar("vervaldatum", @@ -240,12 +214,7 @@ else BLOCK_END(); BLOCK_START("insGraph", L("lcl_graphics"), {icon: "fa-map"}); - RWFIELDTR("srtdeel_acadsymbol", "fld", L("lcl_obj_symbol"), srtdeel.srtdeel_acadsymbol ); - var params = { datatype: "button", - html: "title='" + L("lcl_obj_symbol_upload") + "' onclick='UploadAcadsymbol()'", - endicon: "fa-cloud-upload" - } - RWFIELDTR("symbol_button", "button", L("lcl_obj_symbol_upload"), L("lcl_fg_upload"), params); + RWSYMBOLTR("srtdeel_acadsymbol", L("lcl_obj_symbol"), srtdeel.srtdeel_acadsymbol, { "key": srtdeel_key, "module": "FGIIS" }); RWFIELDTR("srtdeel_acadsymbol_dwgx", "fldshort", L("lcl_obj_symbol_dwgx"), srtdeel.srtdeel_acadsymbol_dwgx ); RWFIELDTR("srtdeel_acadsymbol_dwgy", "fldshort", L("lcl_obj_symbol_dwgy"), srtdeel.srtdeel_acadsymbol_dwgy ); if (srtdeel.ins_disc_params_type&16) // alleen als de discipline labels aan heeft staan diff --git a/APPL/INS/ins_show_deel.asp b/APPL/INS/ins_show_deel.asp index 1ad924dc2f..158bf8470a 100644 --- a/APPL/INS/ins_show_deel.asp +++ b/APPL/INS/ins_show_deel.asp @@ -574,7 +574,7 @@ oRs.Close(); if (uitvoertijd) uitvoertijd = uitvoertijd + " " + (uitvoertijd_eenheid == 'D'? L("lcl_mld_days") : L("lcl_mld_hours")) ROFIELDTR("fldshort", L("lcl_ins_uitvoertijd"), uitvoertijd, {suppressEmpty: true}); - ROFIELDTR("fld", L("lcl_ins_deel_image"), deel_image, { suppressEmpty: true }); + ROSYMBOLTR("fld", L("lcl_ins_deel_image"), deel_image, { "key": ins_key, "module": "INSPHD" }); BLOCK_END(); // Note: levert op deze manier (soms?) ongeldige html op (tr zonder table) diff --git a/APPL/INS/ins_show_srtdeel.asp b/APPL/INS/ins_show_srtdeel.asp index f40dd34557..d2d7676a7b 100644 --- a/APPL/INS/ins_show_srtdeel.asp +++ b/APPL/INS/ins_show_srtdeel.asp @@ -120,8 +120,7 @@ oRs.close(); ROFIELDTR("fld", L("lcl_obj_srtdeel_code"), srtdeel.srtdeel_code); ROFIELDTR("fld", L("lcl_descr"), srtdeel.srtdeel_omschrijving, { translate: { fld: "ins_srtdeel_omschrijving", key : srtdeel_key }}); - - ROFIELDTR("fld", L("lcl_ins_symbol_name"), srtdeel.srtdeel_image, {suppressEmpty: true } ); + ROSYMBOLTR("fld", L("lcl_ins_symbol_name"), srtdeel.srtdeel_image, { "key": srtdeel_key, "module": "INSPHS" }); ROFIELDTR("fld", L("lcl_ins_volgnr"), srtdeel.srtdeel_volgnr, {suppressEmpty: true } ); ROFIELDTR("fld", L("lcl_obj_unit"), srtdeel.srtdeel_eenheid, { suppressEmpty: true, translate: { fld: "ins_srtdeel_eenheid", key : srtdeel_key }}); @@ -198,25 +197,6 @@ oRs.close(); } BLOCK_END(); - - - if (srtdeel.srtdeel_image) - { - var imageFile = S("ins_image_path") + srtdeel.srtdeel_image; - if (fso.FileExists(Server.MapPath(imageFile))) - { - BLOCK_START("insImage", L("lcl_ins_image") + ": " + srtdeel.srtdeel_image); -%> - - - <%=L(" id="insphoto" src="<%=safe.htmlattr(imageFile)%>"> - - -<% - BLOCK_END(); - } - } - generateFlexKenmerkBlock({ urole: urole, //ins_key: ins_key, bewerkniveau: "S", diff --git a/APPL/Localscripts/iface.js b/APPL/Localscripts/iface.js index 8ce93a4535..7872608b02 100644 --- a/APPL/Localscripts/iface.js +++ b/APPL/Localscripts/iface.js @@ -493,6 +493,98 @@ var iface = break; } } + }, + // Opent een upload modal en callbacked naar update_symbol_fld + upload_symbol: function _upload_symbol() { + let fld = $(this).attr("aria-controls"); + let url = $(this).data("upload-url"); + let isNew = $(this).data("new"); + if (isNew && $("#" + fld).val()) { + url += "&newfilename=" + $("#" + fld).val(); + } + parent.FcltMgr.openModalDetail( url + , L("lcl_mld_symbol_upload") + , { callback: FcltCallbackAndThen(function (json) { iface.update_symbol_fld(json, fld); }) } + ); + }, + // Verwijdert een bestand of icoon uit een symbool-veld en callbacked naar update_symbol_fld + remove_symbol: function _remove_symbol() { + let fld = $(this).attr("aria-controls"); + let $val_fld = $("#" + fld); + let $filebtn = $("[aria-controls=" + fld + "].symbol-upload"); + let valType = $(this).closest("td[data-type]").attr("data-type"); // Gecombineerd symbool-veld + if (typeof valType === "undefined") { + if ($(this).closest(".iconpicker").length) { // Alleen een iconpicker + valType = 1; + } else if ($(this).closest(".filepicker").length) { // Alleen een filepicker + valType = 2; + } + } + if (valType == 1) { + iface.update_symbol_fld({ "delete": true }, fld); + } else if (valType == 2) { + let fileName = $val_fld.val(); + FcltMgr.confirm(L("lcl_delete") + " " + fileName + "?", function() { + let data = {}; + protectRequest.dataToken(data); + let url = $("[aria-controls=" + fld + "].symbol-delete").attr("data-delete-url"); + let isNew = $filebtn.data("new"); + if (isNew && $val_fld.val()) { + url += "&newfilename=" + $val_fld.val(); + } + $.post( + url, + data, + FcltCallbackAndThen(function (json) { iface.update_symbol_fld({ "delete": true }, fld); }) + ); + }); + } + }, + // Opent de iconpicker in een modal en callbacked naar update_symbol_fld + iconpicker: function _iconpicker() { + let fld = $(this).attr("aria-controls"); + parent.FcltMgr.openModalDetail( rooturl + "/appl/FontAwesome/iconpicker.asp" + , L("lcl_fac_choose_fa_icon") + , { callback: FcltCallbackAndThen(function (json) { iface.update_symbol_fld(json, fld); }), + width: 1000 } + ); + }, + + update_symbol_fld: function _update_symbol_fld(json, fld) { + let $iconbtn = $("[aria-controls=" + fld + "].symbol-iconpicker"); + let $filebtn = $("[aria-controls=" + fld + "].symbol-upload"); + let $del_btn = $("[aria-controls=" + fld + "].symbol-delete"); + let $val_fld = $("#" + fld); // Het hidden value veld (de echte waarde) + if (json.success) { + if (json.icon) { + $iconbtn = $(".symbol-iconpicker[aria-controls=" + fld + "]"); + $iconbtn.val(json.icon).attr("title", json.icon); // Knop + $iconbtn.closest(".button-icon-wrapper").find("i").replaceWith(I(json.icon)); + $val_fld.val(json.icon).closest("td[data-type]").attr("data-type", "1"); + } else if ("fileName" in json) { + if (json.fileName) { // Er is een bestand + if ($filebtn.data("module").indexOf("FGII") === 0) { + json.fileName = json.fileName.replace(/\.dwf$/, ""); // DWF's worden zonder extensie in de DB opgeslagen + } + $filebtn = $(".symbol-upload[aria-controls=" + fld + "]"); + $filebtn.val(json.fileName).attr("title", json.fileName); // Knop + $val_fld.val(json.fileName).closest("td[data-type]").attr("data-type", "2"); + $del_btn.attr("data-delete-url", json.deleteUrl); // Om de delete knop te doen werken + } else { + iface.update_symbol_fld({ delete: true }, fld); + } + } + } else if (json.delete) { + $iconbtn.val(L("mgt_kenmerk_icon")).attr("title", $iconbtn.data("default-title")); + $filebtn.val(L("lcl_image")).attr("title", $filebtn.data("default-title")); + $val_fld.val("").closest("td[data-type]").attr("data-type", "0"); // Leeg + $iconbtn.closest(".button-icon-wrapper").find("i").replaceWith(I("fa-flag")); // Default FA-icoon + $del_btn.attr("data-delete-url", ""); + } + }, + + preview_image: function _preview_image() { + FcltMgr.openModalDetail($(this).data("preview-url"), L("lcl_flex_preview")); } } // params: checkOnly : [] beperkt array met velden die gecontroleerd moeten worden @@ -1288,6 +1380,11 @@ $(function () $(".text-styles > .default-clickable-icon").on("click", iface._insert_bb_code); $("textarea.bb_enabled:not([readonly])").on("keydown", iface.onKeydown_bb_code); + $(".symbol-upload").on("click", iface.upload_symbol); + $(".symbol-delete").on("click", iface.remove_symbol); + $(".symbol-iconpicker").on("click", iface.iconpicker); + $("[data-preview-url]").on("click", iface.preview_image); + // set trigger on mouseenter event to resize labels function setResizeOnMouseenter() { $('td.label label, td.label label > span').filter(':not([title]), [title=""]').off('mouseenter').on('mouseenter', function(event) { diff --git a/APPL/MGT/bes_discipline.asp b/APPL/MGT/bes_discipline.asp index daea58ec1f..37e194eb48 100644 --- a/APPL/MGT/bes_discipline.asp +++ b/APPL/MGT/bes_discipline.asp @@ -63,7 +63,6 @@ scaffolding(this_model, "forothers", "fedeliver", "ordermandate", - "_upload", "symbolname" ] }, diff --git a/APPL/MGT/mld_stdmelding.asp b/APPL/MGT/mld_stdmelding.asp index 919becc143..2e9bf31716 100644 --- a/APPL/MGT/mld_stdmelding.asp +++ b/APPL/MGT/mld_stdmelding.asp @@ -176,7 +176,6 @@ var this_params = { "fields": [ "hint", "externallink", - "_upload", "symbolname", "colors", "survey", diff --git a/APPL/SCF/scaffolding.inc b/APPL/SCF/scaffolding.inc index 7269123583..a48a5cb498 100644 --- a/APPL/SCF/scaffolding.inc +++ b/APPL/SCF/scaffolding.inc @@ -314,11 +314,15 @@ function scf_ROFIELDTR(model, fld, val, key, params) { ROTEXTAREATR("fldtxt", field.label, txt, params); } - else if (field.typ == "color" || field.typ == "symbol") + else if (field.typ == "color") { params.datatype = field.typ; ROFIELDTR("fldshort", field.label, txt, params); } + else if (field.typ == "symbol") + { + ROSYMBOLTR(fld, field.label, val, { "key": key, "module": field.module }); + } else { ROFIELDTR("fld", field.label, txt, params); @@ -793,7 +797,7 @@ function scf_RWFIELDTR(model, fld, val, key, params) } else if (field.typ == "symbol") { - scf_SYMBOL(fld, field, val, { "key": key }); + RWSYMBOLTR(fld, field.label, val, { "key": key, "module": field.module }); } else if (field.typ == "varchar" && field.events) { @@ -947,42 +951,6 @@ function scf_BUTTONSPAN(fld, field, params) +''); } -function scf_SYMBOL(fld, field, val, params) { - var valType = 0; // Geen waarde - if (val) { - if (val.indexOf("fa-") > -1 && val.indexOf(".") === -1) { - valType = 1; // Icoon - } else { - valType = 2; // Bestand - } - } - Response.Write('' - +' ' - +' ' - +' ' - +' ' - +' ' - +' ' - +' ' + (valType == 1 ? I(val) : I("fa-flag")) + '' - +' ' - +' ' - +' ' - +' ' + I("fa-file-image") + '' - +' ' - +' ' - +' ' - +I("fa-trash-alt") - +' ' - +' ' - +''); -} - function scf_DIV(fld, field, params) { Response.Write('
'+field.defaultvalue+'
'); diff --git a/APPL/SCF/scaffolding_edit.inc b/APPL/SCF/scaffolding_edit.inc index 0a7302991c..817d0b9f05 100644 --- a/APPL/SCF/scaffolding_edit.inc +++ b/APPL/SCF/scaffolding_edit.inc @@ -317,84 +317,6 @@ function scaffolding_edit(model, scf_params) sethint(); } - function scf_upload() { - let fld = $(this).attr("aria-controls"); - let url = $(this).data("upload-url"); -<% if (key === -1) { %> - if ($("#" + fld).val()) { - url += "&newfilename=" + $("#" + fld).val(); - } -<% } %> - parent.FcltMgr.openModalDetail( url - , L("lcl_mld_symbol_upload") - , { callback: FcltCallbackAndThen(function (json) { scf_update_symbol(json, fld); }) } - ); - } - - function scf_delete_symbol() { - let fld = $(this).attr("aria-controls"); - let valType = $(this).closest("[data-type]").attr("data-type") || 0; - if (valType == 1) { - scf_update_symbol({ "delete": true }, fld); - } else if (valType == 2) { - let fileName = $("#" + fld).val(); - FcltMgr.confirm(L("lcl_delete") + " " + fileName + "?", function() { - let data = {}; - protectRequest.dataToken(data); - let url = $("[aria-controls=" + fld + "].symbol-delete").attr("data-delete-url"); -<% if (key === -1) { %> - if ($("#" + fld).val()) { - url += "&newfilename=" + $("#" + fld).val(); - } -<% } %> - $.post( - url, - data, - FcltCallbackAndThen(function (json) { scf_update_symbol({ "delete": true }, fld); }) - ); - }); - } - } - - function scf_iconpicker() { - let fld = $(this).attr("aria-controls"); - parent.FcltMgr.openModalDetail( "<%=safe.jsstring(rooturl + "/appl/FontAwesome/iconpicker.asp")%>" - , L("lcl_fac_choose_fa_icon") - , { callback: FcltCallbackAndThen(function (json) { scf_update_symbol(json, fld); }), - width: 1000 } - ); - } - - function scf_update_symbol(json, fld) { - let $iconbtn = $("[aria-controls=" + fld + "].scf-iconpicker"); - let $filebtn = $("[aria-controls=" + fld + "].scf-upload"); - let $del_btn = $("[aria-controls=" + fld + "].symbol-delete"); - let $val_fld = $("#" + fld); // Het hidden value veld (de echte waarde) - if (json.success) { - if (json.icon) { - $iconbtn = $(".scf-iconpicker[aria-controls=" + fld + "]"); - $iconbtn.val(json.icon).attr("title", json.icon); // Knop - $iconbtn.closest(".button-icon-wrapper").find("i").replaceWith(I(json.icon)); - $val_fld.val(json.icon).closest("td").attr("data-type", "1"); - } else if ("fileName" in json) { - if (json.fileName) { // Er is een bestand - $filebtn = $(".scf-upload[aria-controls=" + fld + "]"); - $filebtn.val(json.fileName).attr("title", json.fileName); // Knop - $val_fld.val(json.fileName).closest("td").attr("data-type", "2"); - $del_btn.attr("data-delete-url", json.deleteUrl); // Om de delete knop te doen werken - } else { - scf_update_symbol({ delete: true }, fld); - } - } - } else if (json.delete) { - $iconbtn.val(L("mgt_kenmerk_icon")).attr("title", $iconbtn.data("default-title")); - $filebtn.val(L("lcl_image")).attr("title", $iconbtn.data("default-title")); - $val_fld.val("").closest("td").attr("data-type", "0"); // Leeg - $iconbtn.closest(".button-icon-wrapper").find("i").replaceWith(I("fa-flag")); // Default FA-icoon - $del_btn.attr("data-delete-url", ""); - } - } - $(function() { $('textarea').resize(function () { FcltMgr.resized(window) }); @@ -412,9 +334,6 @@ function scaffolding_edit(model, scf_params) window.lastinputid = this.htmlFor; sethint(); }); - $("[type=button].scf-upload").on("click", scf_upload); - $(".symbol-delete").on("click", scf_delete_symbol); - $(".scf-iconpicker").on("click", scf_iconpicker); FcltMgr.resized(); // Indien labels over meer dan 1 regel staan. }); diff --git a/APPL/Shared/Bijlagen.asp b/APPL/Shared/Bijlagen.asp index 9348331098..53be18c377 100644 --- a/APPL/Shared/Bijlagen.asp +++ b/APPL/Shared/Bijlagen.asp @@ -29,7 +29,7 @@ function bijlagen(autfunction, label, module, reado, imp_exp_key) { if (xfunc.canWrite(autfunction)) { - var url = "../shared/BijlagenForm.asp?module=" + module + transitParam; + var url = "../shared/BijlagenForm.asp?key=0&module=" + module + transitParam; if (reado) url += "&reado=1"; if (imp_exp_key) diff --git a/APPL/Shared/BijlagenForm.asp b/APPL/Shared/BijlagenForm.asp index a9d10208a9..20baac1e77 100644 --- a/APPL/Shared/BijlagenForm.asp +++ b/APPL/Shared/BijlagenForm.asp @@ -51,7 +51,7 @@ if (!agent.match(/MSIE \d|Trident/)) FCLTHeader.Requires({ js:["./BijlagenForm_async.js"] }); } -protectQS.verify({ allowparams: ["no_autoscroll", "newfilename"]}); // tamper check +protectQS.verify({ allowparams: ["no_autoscroll", "newfilename"] }); // tamper check // key of folder wordt doorgegeven @@ -490,7 +490,7 @@ __Log("Zoeken bestanden onder " + params.AttachPath); } let extraTransitParam = ""; <% if (pKey === -1 && "linkImmediate" in params) { %> - extraTransitParam = "&newfilename=" + encodeURIComponent(uploaded_files[0]); + extraTransitParam = "&newfilename=" + encodeURIComponent(uploaded_files[0].replace(/\.dwf$/, "")); <% } %> window.location = "<%=protectQS.create("BijlagenForm.asp?x=x" + transitParam)%>" + extraTransitParam; } diff --git a/APPL/Shared/BijlagenForm_delete.asp b/APPL/Shared/BijlagenForm_delete.asp index 06ac31f959..853ae96903 100644 --- a/APPL/Shared/BijlagenForm_delete.asp +++ b/APPL/Shared/BijlagenForm_delete.asp @@ -24,7 +24,7 @@ else if (pModule == "MLD" && pNiveau == "O") <% -protectQS.verify({ allowparams: ["newfilename"]}); // tamper check +protectQS.verify({ allowparams: ["newfilename"] }); // tamper check protectRequest.validateToken(); var pKenmerk_key = getQParamInt("kenmerk_key", -1); @@ -46,6 +46,9 @@ if (pDoDelete === "" && "linkImmediate" in params) { } else { pDoDelete = getQParam("newfilename", ""); } + if (pDoDelete && pModule.indexOf("FGII") === 0) { + pDoDelete = pDoDelete.replace(/(\.dwf)?$/, ".dwf"); + } } result = { success: true, toaster: L("lcl_appendix_removed").format(safe.html(pDoDelete))}; diff --git a/APPL/Shared/BijlagenPreview.asp b/APPL/Shared/BijlagenPreview.asp index 882b8af6d2..a5797a3d31 100644 --- a/APPL/Shared/BijlagenPreview.asp +++ b/APPL/Shared/BijlagenPreview.asp @@ -39,7 +39,7 @@ var picsPerLine = getQParamInt("nrOfPict", -1); var regex = new RegExp(S("flexPreviewExt"), "i"); for (var x = 0; x < p_key_arr.length; x++) { - var params = flexProps(pModule, p_key_arr[x], String(pKenmerk_key), pNiveau); + var params = flexProps(pModule, p_key_arr[x], String(pKenmerk_key), pNiveau, { getFiles: true }); for (var i = 0; i < params.files.length; i++) { // Only preview the extensions as specified in S("flexPreviewExt") @@ -92,7 +92,9 @@ var picsPerLine = getQParamInt("nrOfPict", -1); for (var i = 0; i < lijst.length; i++) { - href = protectQS.create(OpenFlexFile( lijst[i].module + href = params.directlink + ? protectQS.create(lijst[i].deepurl) + : protectQS.create(OpenFlexFile( lijst[i].module , lijst[i].key , { mime_type: lijst[i].mimetype, contentdp: "inline" } )); diff --git a/APPL/Shared/FlexFiles.inc b/APPL/Shared/FlexFiles.inc index 1e56b284ec..3ada3f8e3f 100644 --- a/APPL/Shared/FlexFiles.inc +++ b/APPL/Shared/FlexFiles.inc @@ -8,8 +8,6 @@ Context: Note: pModule, pKey en pSubpath worden genormaliseerd tot simpele/veilige padnamen - - pickfile heeft als bijeffect dat je een bijlage uit de lijst kunt kiezen */ var fso = Server.CreateObject("Scripting.FileSystemObject"); // Die hebben we hier *zo* vaak nodig. @@ -327,8 +325,15 @@ function flexProps(pModule, pKey, pSubpath, pNiveau, params) result.AttachRootPath = S("flexfilespath") + "/cad/concept/"; result.AttachPath = result.AttachRootPath; result.searchfile = true; - result.multi = true; result.extFilter = "dwf"; + result.linkImmediate = { + "table" : "cad_tekening", + "key_col" : "cad_tekening_key", + "link_col" : "cad_tekening_filenaam" + } + if (typeof pKey === "string") { + params.filter = "^" + safe.regexp(pKey) + ".dwf$"; + } break; case "FGIIV": // Vluchtplannen result.AttachRootPath = S("flexfilespath") + "/cad/vlucht/"; @@ -337,17 +342,22 @@ function flexProps(pModule, pKey, pSubpath, pNiveau, params) result.multi = true; result.extFilter = "dwf"; break; - case "FGIIS": // Facilitor Graphics symbolen + case "FGIIS": // Facilitor Graphics symbolen result.AttachRootPath = S("flexfilespath") + "/cad/symbols/"; result.AttachPath = result.AttachRootPath; - result.pickfile = true; - result.multi = true; result.extFilter = "dwf"; + result.linkImmediate = { + "table" : "ins_srtdeel", + "key_col" : "ins_srtdeel_key", + "link_col" : "ins_srtdeel_acadsymbol" + } + if (typeof pKey === "string") { + params.filter = "^" + safe.regexp(pKey) + ".dwf$"; + } break; case "FGIIP": result.AttachRootPath = S("flexfilespath") + "/cad/prj/"; result.AttachPath = result.AttachRootPath + pKey + "/"; - result.pickfile = true; result.multi = true; result.extFilter = "dwf"; break; @@ -365,6 +375,7 @@ function flexProps(pModule, pKey, pSubpath, pNiveau, params) // Bestanden zijn te vinden op prs_bedrijf.prs_bedrijf_image_loc of ...cust/xxxx/photos/bes/[disc_key]/ // Wij kunnen alleen bestanden naar ...cust/xxxx/photos/bes/[disc_key]/ uploaden. result.AttachRootPath = Server.MapPath(S("bes_image_path")); + result.RelativePath = S("bes_image_path"); result.AttachPath = result.AttachRootPath + "/" + pKey + "/"; result.extFilter = S("imgAllowedExt"); result.pickfile = true; @@ -375,90 +386,111 @@ function flexProps(pModule, pKey, pSubpath, pNiveau, params) case "INSPHS": // ins_srtdeel (Objectsoort) // Bestanden zijn te vinden op ...cust/x/photos/ins result.AttachRootPath = Server.MapPath(S("ins_image_path")); + result.RelativePath = S("ins_image_path"); result.AttachPath = result.AttachRootPath + "/"; result.extFilter = S("imgAllowedExt"); - result.pickfile = true; - result.multi = true; result.regexp = S("ins_photo_size"); result.directlink = true; + result.linkImmediate = "ins_srtdeel"; + if (typeof pKey === "string") { + params.filter = "^" + safe.regexp(pKey) + "$"; + } break; case "BESD": // bes_discipline symbolen result.AttachRootPath = Server.MapPath(S("besd_image_path")); + result.RelativePath = S("besd_image_path"); result.AttachPath = result.AttachRootPath + "/"; - result.pickfile = true; - result.multi = true; result.extFilter = S("imgAllowedExt"); result.regexp = S("bes_photo_size"); result.directlink = true; + result.linkImmediate = "discipline"; + if (typeof pKey === "string") { + params.filter = safe.regexp(pKey); + } break; case "BGTD": // bgt_discipline symbolen result.AttachRootPath = Server.MapPath(S("bgtd_image_path")); + result.RelativePath = S("bgtd_image_path"); result.AttachPath = result.AttachRootPath + "/"; - result.pickfile = true; - result.multi = true; result.extFilter = S("imgAllowedExt"); result.regexp = S("bgt_photo_size"); result.directlink = true; + result.linkImmediate = "discipline"; + if (typeof pKey === "string") { + params.filter = safe.regexp(pKey); + } break; case "INSD": // ins_discipline symbolen result.AttachRootPath = Server.MapPath(S("insd_image_path")); + result.RelativePath = S("insd_image_path"); result.AttachPath = result.AttachRootPath + "/"; - result.pickfile = true; - result.multi = true; result.extFilter = S("imgAllowedExt"); result.regexp = S("ins_photo_size"); result.directlink = true; + result.linkImmediate = "discipline"; + if (typeof pKey === "string") { + params.filter = safe.regexp(pKey); + } break; case "CNTD": // cnt_discipline symbolen result.AttachRootPath = Server.MapPath(S("cntd_image_path")); + result.RelativePath = S("cntd_image_path"); result.AttachPath = result.AttachRootPath + "/"; - result.pickfile = true; - result.multi = true; result.extFilter = S("imgAllowedExt"); result.regexp = S("cnt_photo_size"); result.directlink = true; + result.linkImmediate = "discipline"; + if (typeof pKey === "string") { + params.filter = safe.regexp(pKey); + } break; case "RESD": // ins_discipline symbolen result.AttachRootPath = Server.MapPath(S("resd_image_path")); + result.RelativePath = S("resd_image_path"); result.AttachPath = result.AttachRootPath + "/"; - result.pickfile = true; - result.multi = true; result.extFilter = S("imgAllowedExt"); result.regexp = S("res_photo_size"); result.directlink = true; + result.linkImmediate = "discipline"; + if (typeof pKey === "string") { + params.filter = safe.regexp(pKey); + } break; case "MLDS": // Stdmelding symbolen result.AttachRootPath = Server.MapPath(S("mlds_image_path")); + result.RelativePath = S("mlds_image_path"); result.AttachPath = result.AttachRootPath + "/"; - result.pickfile = true; - result.multi = true; result.extFilter = S("imgAllowedExt"); result.regexp = S("mld_photo_size"); result.directlink = true; + result.linkImmediate = "mld_stdmelding"; + if (typeof pKey === "string") { + params.filter = safe.regexp(pKey); + } break; case "MLDD": // mld_discipline symbolen result.AttachRootPath = Server.MapPath(S("mldd_image_path")); + result.RelativePath = S("mldd_image_path"); result.AttachPath = result.AttachRootPath + "/"; result.extFilter = S("imgAllowedExt"); result.regexp = S("mld_photo_size"); result.directlink = true; - result.linkImmediate = { - "table" : "ins_tab_discipline", - "key_col" : "ins_discipline_key", - "link_col" : "ins_discipline_image" - } - if (typeof pKey == "string") { - params.filter = "^" + safe.regexp(pKey) + "$"; + result.linkImmediate = "discipline"; + if (typeof pKey === "string") { + params.filter = safe.regexp(pKey); } break; case "MLDSD": // mld_srtdiscipline symbolen result.AttachRootPath = Server.MapPath(S("mldsd_image_path")); + result.RelativePath = S("mldsd_image_path"); result.AttachPath = result.AttachRootPath + "/"; - result.pickfile = true; - result.multi = true; result.extFilter = S("imgAllowedExt"); result.regexp = S("mld_photo_size"); result.directlink = true; + result.linkImmediate = "ins_srtdiscipline"; + if (typeof pKey === "string") { + params.filter = safe.regexp(pKey); + } break; case "ALG": case "BES": @@ -512,6 +544,7 @@ function flexProps(pModule, pKey, pSubpath, pNiveau, params) case "ALGPHT": // Bestanden zijn te vinden op ...cust/x/photos result.AttachRootPath = Server.MapPath(S("alg_image_path")); + /* result.RelativePath => Wordt verderop al geregeld */ if (pModule == "ALGPHL") result.AttachRootPath += '/locatie'; if (pModule == "ALGPHG") @@ -520,11 +553,10 @@ function flexProps(pModule, pKey, pSubpath, pNiveau, params) result.AttachRootPath += '/terrein'; result.AttachPath = result.AttachRootPath + "/"; result.extFilter = S("imgAllowedExt"); - result.pickfile = true; - result.searchfile = true; result.multi = true; result.regexp = S("alg_photo_size"); result.directlink = true; + /* result.linkImmediate = "discipline"; TODO */ if (typeof pKey == "string") params.filter = pKey; break; @@ -533,16 +565,16 @@ function flexProps(pModule, pKey, pSubpath, pNiveau, params) case "RESPHD": // Bestanden zijn te vinden op ...cust/x/photos result.AttachRootPath = Server.MapPath(S("res_image_path")); + /* result.RelativePath => Wordt verderop al geregeld */ if (pModule == "RESPHA") result.AttachRootPath += '/artikel'; if (pModule == "RESPHD") result.AttachRootPath += '/deel'; result.AttachPath = result.AttachRootPath + "/"; result.extFilter = S("imgAllowedExt"); - result.searchfile = true; - result.multi = true; result.regexp = S("res_photo_size"); result.directlink = true; + /* result.linkImmediate = "discipline"; TODO */ if (typeof pKey == "string") params.filter = pKey; break; @@ -587,25 +619,27 @@ function flexProps(pModule, pKey, pSubpath, pNiveau, params) // Bestanden zijn te vinden op ...cust/x/photos result.AttachRootPath = Server.MapPath(S("ins_image_path")); result.AttachRootPath += '/deel'; + result.RelativePath = S("ins_image_path") + "/deel/"; result.AttachPath = result.AttachRootPath + "/"; result.extFilter = S("imgAllowedExt"); - result.pickfile = true; - result.searchfile = true; - result.multi = true; - result.RelativePath = S("ins_image_path") + "/insdeel/"; - //result.forcesingle = true; // verwijder eventuele anderen result.regexp = S("ins_photo_size"); // "r200x150", Resized naar binnen 200x150 (zonder crop, met behoud aspect ratio) result.directlink = true; - if (typeof pKey == "string") - params.filter = pKey; + result.linkImmediate = "ins_deel"; + if (typeof pKey === "string") { + params.filter = "^" + safe.regexp(pKey) + "$"; + } break; case "MENU": result.AttachRootPath = Server.MapPath(S("menu_image_path")); + result.RelativePath = S("menu_image_path"); result.AttachPath = result.AttachRootPath + "/"; - result.multi = true; result.extFilter = S("flexExtensionFilter"); // was "jpg|png"; maar tegenwoordig ook andere bestanden result.regexp = S("menu_photo_size"); result.directlink = true; + result.linkImmediate = "fac_menu"; + if (typeof pKey === "string") { + params.filter = "^" + safe.regexp(pKey) + "$"; + } break; case "BDRADR": result.AttachRootPath = S("bdradrfiles_path"); @@ -791,6 +825,14 @@ function flexProps(pModule, pKey, pSubpath, pNiveau, params) result.maxfiles = 10; oRs.Close(); break; + case "STYLE": /* TODO */ + result.AttachRootPath = Server.MapPath(S("style_image_path")); + result.RelativePath = S("style_image_path"); + result.AttachPath = result.AttachRootPath + "/" + pKey + "/"; // pKey = de naam van het style-item + result.extFilter = S("imgAllowedExt"); + result.regexp = S("menu_photo_size"); // TODO + result.directlink = true; // ? + break; default: _AiAi("INTERNAL_ERROR, invalid module {0}".format(pModule)); } @@ -807,6 +849,22 @@ function flexProps(pModule, pKey, pSubpath, pNiveau, params) result.AttachRootPath = result.AttachRootPath.replace("..", "_"); result.AttachPath = result.AttachPath.replace("..", "_"); + if (typeof result.linkImmediate === "string") { // Alleen tabelnaam mag ook, dan gaan we uit van _key en _image column-namen + if (result.linkImmediate === "discipline") { + result.linkImmediate = { + "table" : "ins_tab_discipline", + "key_col" : "ins_discipline_key", + "link_col": "ins_discipline_image" + } + } else { + result.linkImmediate = { + "table" : result.linkImmediate, + "key_col" : result.linkImmediate + "_key", + "link_col": result.linkImmediate + "_image" + } + } + } + if (result.fac_bijlagen && ((pKey > 0) || params.bijlagen_key > 0)) { var v_bijlagen = get_bijlagen(pModule, pKey, pKenmerk_key, params.bijlagen_key, pNiveau, params.kenmerk_geldig); @@ -852,7 +910,11 @@ function flexProps(pModule, pKey, pSubpath, pNiveau, params) + " WHERE " + result.linkImmediate.key_col + " = " + pKey; var oRs = Oracle.Execute(sql); if (!oRs.EoF) { - params.filter += safe.regexp(oRs(0).Value); + var linkedFilename = oRs(0).Value; + if (linkedFilename && pModule.indexOf("FGII") === 0) { // Deze worden mogelijk zonder extensie opgeslagen in de DB + linkedFilename = linkedFilename.replace(/(\.dwf)?$/, ".dwf"); + } + params.filter += safe.regexp(linkedFilename); } oRs.Close(); params.filter += "$"; @@ -863,14 +925,13 @@ function flexProps(pModule, pKey, pSubpath, pNiveau, params) { totalfiles ++; var fsoFile = fc.item(); - if (params.filter && !(new RegExp(params.filter, "i").test(fsoFile.Name))) - continue; - - if (result.extFilter && !(new RegExp(".({0})$".format(result.extFilter), "i").test(fsoFile.Name))) - { + if (params.filter && !(new RegExp(params.filter, "i").test(fsoFile.Name))) { continue; } + if (result.extFilter && !(new RegExp(".({0})$".format(result.extFilter), "i").test(fsoFile.Name))) { + continue; + } var extension = fsoFile.Name.split(".").pop().toLowerCase(); var ffile = { key: -1 , name: fsoFile.Name @@ -885,7 +946,6 @@ function flexProps(pModule, pKey, pSubpath, pNiveau, params) { ffile.ishistory = true; } - var filedata = oneFileInfo(ffile, result, pModule, pKey, pSubpath, pNiveau, params); result.files.push(filedata); } @@ -1007,44 +1067,40 @@ function oneFileInfo(pFileData, pResult, pModule, pKey, pSubpath, pNiveau, param if (pResult.directlink) { var root = HTTP.urlzelfnoroot() + pResult.RelativePath; - if (pModule.substr(0, 5) == "ALGPH") - { - var root = HTTP.urlzelfnoroot() + S("ins_image_path"); + if (pModule.substr(0, 5) == "ALGPH") { + root = HTTP.urlzelfnoroot() + S("alg_image_path"); if (pModule == "ALGPHL") root += 'locatie/'; if (pModule == "ALGPHG") root += 'gebouw/'; if (pModule == "ALGPHT") root += 'terrein/'; - } - if (pModule.substr(0, 5) == "RESPH") - { - var root = HTTP.urlzelfnoroot() + S("res_image_path"); + } else if (pModule.substr(0, 5) == "RESPH") { + root = HTTP.urlzelfnoroot() + S("res_image_path"); if (pModule == "RESPHA") root += 'artikel/'; if (pModule == "RESPHD") root += 'deel/'; } - filedata.deepurl = root + filedata.name; - } - else // Alleen streaming, bestand staat buiten webroot? + } + else // Alleen streaming, bestand staat buiten webroot? + { + var deepurl = HTTP.urlzelf() + "/appl/shared/BijlagenStream.asp" + + "?module=" + pModule; + if (filedata.key > 0) { - var deepurl = HTTP.urlzelf() + "/appl/shared/BijlagenStream.asp" - + "?module=" + pModule; - if (filedata.key > 0) - { - deepurl += "&bijlagen_key=" + filedata.key; - } - else - { - deepurl += "&key=" + pKey - + (pNiveau? "&niveau=" + pNiveau : "") - + "&kenmerk_key=" + pSubpath - + "&filename=" + Server.URLencode(filedata.name); - } - filedata.deepurl = protectQS.create(deepurl); + deepurl += "&bijlagen_key=" + filedata.key; } + else + { + deepurl += "&key=" + pKey + + (pNiveau? "&niveau=" + pNiveau : "") + + "&kenmerk_key=" + pSubpath + + "&filename=" + Server.URLencode(filedata.name); + } + filedata.deepurl = protectQS.create(deepurl); + } } return filedata; } @@ -1394,8 +1450,7 @@ function DeleteFile(fullpath, km_params) if ("linkImmediate" in km_params && pKey > 0) { // Unlink dit bestand ook van de entiteit waar het bij hoor in de DB var sql = "UPDATE " + km_params.linkImmediate.table + " SET " + km_params.linkImmediate.link_col + " = NULL" - + " WHERE " + km_params.linkImmediate.link_col + " = " + safe.quoted_sql(km_params.file) // Overbodig maar ok - + " AND " + km_params.linkImmediate.key_col + " = " + km_params.refkey; + + " WHERE " + km_params.linkImmediate.key_col + " = " + km_params.refkey; Oracle.Execute(sql); } diff --git a/APPL/Shared/UploadForm_save.asp b/APPL/Shared/UploadForm_save.asp index 3d27bc1578..e335f251ef 100644 --- a/APPL/Shared/UploadForm_save.asp +++ b/APPL/Shared/UploadForm_save.asp @@ -193,9 +193,13 @@ var oorzaak_bekend = false; result.filesize.push(fso.GetFile(attachfile).Size); var oCrypto = new ActiveXObject("SLNKDWF.Crypto"); result.digest.push(oCrypto.hex_sha1_file(attachfile)); + var linkedFilename = savedfilename; + if (pModule.indexOf("FGII") === 0) { + linkedFilename = linkedFilename.replace(/\.dwf$/, ""); + } if ("linkImmediate" in params && pKey > 0) { // Link dit bestand direct aan de entiteit waar het bij hoor in de DB var sql = "UPDATE " + params.linkImmediate.table - + " SET " + params.linkImmediate.link_col + " = " + safe.quoted_sql(savedfilename) + + " SET " + params.linkImmediate.link_col + " = " + safe.quoted_sql(linkedFilename) + " WHERE " + params.linkImmediate.key_col + " = " + pKey; Oracle.Execute(sql); } diff --git a/APPL/Shared/default.css b/APPL/Shared/default.css index 5ade708e56..4147fef0e7 100644 --- a/APPL/Shared/default.css +++ b/APPL/Shared/default.css @@ -1914,7 +1914,7 @@ body:not(#listbody, #planbody) td.label { width: 30%; } section#searchbody td.label + td, -body:not(#listbody, #planbody) td.label:not(.flexsearch) + td:not([data-type]) { +body:not(#listbody, #planbody) td.label:not(.flexsearch) + td:not(.iconpicker, .filepicker, [data-type]) { width: 70%; } @@ -2759,6 +2759,8 @@ span:is(.bijlage, .bijlage1, .endicon, .starticon) { text-align: left; } + +.button-icon-wrapper:hover > [type=button]:not([disabled]), input[type=button]:hover:not([disabled]), input[type=text].button:hover:not([disabled]), .uploadbutton:hover, @@ -2766,13 +2768,12 @@ span.button:hover { color: var(--buttonhovercolor); background-color:var(--buttonhoverbackgroundcolor); } - -input:hover:not([disabled]) + span:is(.bijlage, .bijlage1, .endicon), -.button-icon-wrapper:hover > .starticon { +.button-icon-wrapper:hover > :is(.starticon, + [type=button]:not([disabled]) + :is(.bijlage, .bijlage1, .endicon)) { color: var(--buttonhovercolor); } -input[type=button][disabled]{ +input[type=button][disabled] { cursor: default; } @@ -3073,48 +3074,37 @@ input[type=file] { padding-right: 10px; /* Button default */ } -/* Symbool knoppen */ -[data-type] .button-icon-wrapper { - overflow: hidden; -} -[data-type] .button-icon-wrapper input[type=button] { - text-overflow: ellipsis; - overflow: hidden; - white-space: nowrap; -} .symbol-delete { font-size: 1.2em; } -[data-type] { + +/* Symbool knoppen */ +:is(.iconpicker, .filepicker, [data-type]) { display: grid; column-gap: 1px; } +:is(.iconpicker, .filepicker, [data-type]) .button-icon-wrapper { + overflow: hidden; +} +:is(.iconpicker, .filepicker, [data-type]) .button-icon-wrapper input[type=button] { + text-overflow: ellipsis; + overflow: hidden; + white-space: nowrap; +} /* type = 0 laat 2 gelijke knoppen zien */ [data-type="0"] { grid-template-columns: 1fr 1fr; } -[data-type="0"] .fa-picker { - grid-area: 1 / 1; -} -[data-type="0"] .file-picker { - grid-area: 1 / 2; -} /* Anders 1 knop met 1 'delete'-icoontje */ -:is([data-type="1"], [data-type="2"]) { - grid-template-columns: 99fr 1fr; -} -:is([data-type="1"], [data-type="2"]) :is(.fa-picker, .file-picker) { - grid-area: 1 / 1; -} -:is([data-type="1"], [data-type="2"]) .symbol-delete { - grid-area: 1 / 2; +:is([data-type="1"], [data-type="2"], .iconpicker, .filepicker) { + grid-template-columns: 999fr 1fr; } -[data-type="0"] > .symbol-delete, [data-type="1"] > .file-picker, -[data-type="2"] > .fa-picker { +[data-type="2"] > .fa-picker, +:is([data-type="0"], .iconpicker, .filepicker) > [type=hidden][value=""] ~ .symbol-delete { display: none; } @@ -3168,6 +3158,7 @@ img.kenmerk[src]:not([src=""]) + .flex-bijlage.button-icon-wrapper { } span.starticon { left: 0.5em; + right: initial; } span:is(.starticon, .endicon) { diff --git a/APPL/Shared/default.inc b/APPL/Shared/default.inc index 33fadf3228..edc7c16052 100644 --- a/APPL/Shared/default.inc +++ b/APPL/Shared/default.inc @@ -34,6 +34,7 @@ settings = // logischer is om ze ooit allemaal onder een /photos/ te plaatsen image_path_virtual: { v: custpath }, menu_image_path: { v: custpath + "/flexfiles/menu/" }, + style_image_path: { v: custpath + "/flexfiles/FAC/style/" }, alg_image_path: { v: custpath + "/photos/" }, prs_image_path: { v: custpath + "/flexfiles/prs/" }, res_image_path: { v: custpath + "/photos/" }, diff --git a/APPL/Shared/iface.inc b/APPL/Shared/iface.inc index f588e2fb42..8cd03497bb 100644 --- a/APPL/Shared/iface.inc +++ b/APPL/Shared/iface.inc @@ -6,6 +6,7 @@ Description: generic interface functions for buttons and maybe more __Logging & 64 onderdukt de suppressEmpty functionaliteit */ %> + <% if (JSON_Result) @@ -675,11 +676,6 @@ function ROFIELD(pclass, plabel, pvalue, params) pvalue = safe.showFloat(pvalue, params.decimals, params.trimZeros); pclass += " float"; break; - case "symbol": - if (pvalue.indexOf("fa-") > -1 && pvalue.indexOf(".") === -1) { - safe_value = I(pvalue); - } - break; default: break; } @@ -727,7 +723,7 @@ function ROFIELD(pclass, plabel, pvalue, params) if (params.secret) input += " title='{0}' onclick='this.innerText=this.title;this.onclick=null'>".format(safe.htmlattr(pvalue)) + I("fa-eye fa-lg") +""; else - input += ">" + (safe_value ? safe_value : safe.html(pvalue)) + ""; + input += ">" + safe.html(pvalue) + ""; if (params.tooltip) input += " " + safe.html(params.tooltip) + ""; @@ -1034,25 +1030,117 @@ function CHECKBOX(pclass, pid, pvalue, params) Response.Write(CHECKBOX_HTML(pclass, pid, pvalue, params)); } -function SWITCH_TOGGLE_HTML(pname, pclass, plabel, pvalue, params) -{ - params = params || {}; - var result = ''; - result += '
'; - - pclass = (pclass ? pclass + " " : "") + "switch-checkbox"; - result += CHECKBOX_HTML(pclass, pname, pvalue, params); - - result += '"; - result += '
'; - +function ICONPICKER_HTML(pname, plabel, pvalue) { + var result = ""; + var hasIcon = pvalue && pvalue.indexOf("fa-") > -1 && pvalue.indexOf(".") === -1; + // De TR functies die deze aanroepen moeten het hidden fld maar aanmaken die deze picker dan vult + result += "" + + " " + (hasIcon ? I(pvalue) : I("fa-flag")) + "" + + " " + + ""; return result; } -function SWITCH_TOGGLE(pname, pclass, plabel, pvalue, params) +function FILEPICKER_HTML(pname, plabel, pvalue, params) { + var result = ""; + // De TR functies die deze aanroepen moeten het hidden fld maar aanmaken die deze picker dan vult + result += "" + + " " + I("fa-file-image") + "" + + " " + + ""; + return result; +} + +// Laat 2 knoppen zien, 1 voor de iconpicker en 1 voor de filepicker +function RWSYMBOLTR_HTML(pname, plabel, pvalue, params) +{ + var valType = 0; // Geen waarde + if (pvalue) { + valType = pvalue.indexOf("fa-") === 0 ? 1 : 2; + } + var result = "" + + " " + + " " + + " " + + " " + + " " + + ICONPICKER_HTML(pname, plabel, pvalue) + + FILEPICKER_HTML(pname, plabel, pvalue, params) + + " " + + I("fa-trash-alt") + + " " + + " " + + ""; + return result; +} + +function FILEPICKERTR(pname, plabel, pvalue, params) { + params = params || {}; + Response.Write("" + + " " + + " " + + " " + + " " + + " " + + FILEPICKER_HTML(pname, plabel, pvalue, params) + + " " + + I("fa-trash-alt") + + " " + + " " + + ""); +} + +function RWSYMBOLTR(pname, plabel, pvalue, params) { params = params || {}; - Response.Write(SWITCH_TOGGLE_HTML(pname, pclass, plabel, pvalue, params)); + Response.Write(RWSYMBOLTR_HTML(pname, plabel, pvalue, params)); +} + +function ROSYMBOLTR_HTML(pname, plabel, pvalue, params) +{ + var valType = 0; + var preview_url = "../Shared/BijlagenPreview.asp?key=" + params.key + "&module=" + params.module; + if (pvalue) { + if (pvalue.indexOf("fa-") === 0) { + valType = 1; // Icon + } else { + valType = 2; // Image + var fileProps = flexProps(params.module, params.key, null, null, { getFiles: true }); + if (!fileProps.files.length) { + valType = 0; + } + } + } + + if (valType == 0 && (params.suppressEmpty && !(__Logging & 64))) + return; // Early exit + + var result = "" + + " " + + " " + + (valType == 2 ? "" + I("fa-image fa-lg") + "" + : "") + + " " + + " " + + (valType == 1 ? I(pvalue + " fa-lg") : "" + safe.html(pvalue) + "") + + " " + + ""; + return result; +} + +function ROSYMBOLTR(pname, plabel, pvalue, params) +{ + params = params || {}; + params.suppressEmpty = params.suppressEmpty || true; // Default true + Response.Write(ROSYMBOLTR_HTML(pname, plabel, pvalue, params)); } function RWCHECKBOXTR(pname, pclass, plabel, pvalue, params)