X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/04b05946ab640eaf9135a73772b704dd41c323e7..717c14c014e3c988bcb392599a47ffa92630da78:/platforma/static/filebrowser/js/FB_FileBrowseField.js diff --git a/platforma/static/filebrowser/js/FB_FileBrowseField.js b/platforma/static/filebrowser/js/FB_FileBrowseField.js new file mode 100755 index 00000000..b0696cea --- /dev/null +++ b/platforma/static/filebrowser/js/FB_FileBrowseField.js @@ -0,0 +1,32 @@ +function FileSubmit(FileURL, ThumbURL, FileType) { + + // var input_id=window.name.split("___").join("."); + var input_id=window.name.replace(/____/g,'-').split("___").join("."); + var preview_id = 'image_' + input_id; + var link_id = 'link_' + input_id; + var help_id = 'help_' + input_id; + input = opener.document.getElementById(input_id); + preview = opener.document.getElementById(preview_id); + link = opener.document.getElementById(link_id); + help = opener.document.getElementById(help_id); + // set new value for input field + input.value = FileURL; + + if (ThumbURL && FileType != "") { + // selected file is an image and thumbnail is available: + // display the preview-image (thumbnail) + // link the preview-image to the original image + link.setAttribute("href", FileURL); + link.setAttribute("target", "_blank"); + preview.setAttribute("src", ThumbURL); + help.setAttribute("style", "display:block"); + } else { + // hide preview elements + link.setAttribute("href", ""); + link.setAttribute("target", ""); + preview.setAttribute("src", ""); + help.setAttribute("style", "display:none"); + } + this.close(); +} +