* Readonly document view.
[redakcja.git] / platforma / static / filebrowser / js / FB_FileBrowseField.js
1 function FileSubmit(FileURL, ThumbURL, FileType) {
2
3     // var input_id=window.name.split("___").join(".");
4     var input_id=window.name.replace(/____/g,'-').split("___").join(".");
5     var preview_id = 'image_' + input_id;
6     var link_id = 'link_' + input_id;
7     var help_id = 'help_' + input_id;
8     input = opener.document.getElementById(input_id);
9     preview = opener.document.getElementById(preview_id);
10     link = opener.document.getElementById(link_id);
11     help = opener.document.getElementById(help_id);
12     // set new value for input field
13     input.value = FileURL;
14
15     if (ThumbURL && FileType != "") {
16         // selected file is an image and thumbnail is available:
17         // display the preview-image (thumbnail)
18         // link the preview-image to the original image
19         link.setAttribute("href", FileURL);
20         link.setAttribute("target", "_blank");
21         preview.setAttribute("src", ThumbURL);
22         help.setAttribute("style", "display:block");
23     } else {
24         // hide preview elements
25         link.setAttribute("href", "");
26         link.setAttribute("target", "");
27         preview.setAttribute("src", "");
28         help.setAttribute("style", "display:none");
29     }
30     this.close();
31 }
32