* Readonly document view.
[redakcja.git] / platforma / static / filebrowser / js / AddFileBrowser.js
1 var FileBrowser = {
2     // this is set automatically
3     admin_media_prefix: '',
4     // change this
5     thumb_prefix: 'thumb_',
6     no_thumb: 'filebrowser/img/no_thumb.gif',
7
8     init: function() {
9         // Deduce admin_media_prefix by looking at the <script>s in the
10         // current document and finding the URL of *this* module.
11         var scripts = document.getElementsByTagName('script');
12         for (var i=0; i<scripts.length; i++) {
13             if (scripts[i].src.match(/AddFileBrowser/)) {
14                 var idx = scripts[i].src.indexOf('filebrowser/js/AddFileBrowser');
15                 FileBrowser.admin_media_prefix = scripts[i].src.substring(0, idx);
16                 break;
17             }
18         }
19     },
20     // show FileBrowser
21     show: function(id, href) {
22         // var id2=String(id).split(".").join("___");
23         var id2=String(id).replace(/\-/g,"____").split(".").join("___");
24         FBWindow = window.open(href, String(id2), 'height=600,width=960,resizable=yes,scrollbars=yes');
25         FBWindow.focus();
26     }
27 }
28
29 addEvent(window, 'load', FileBrowser.init);
30