import mtweb.0.4.1
[mtweb] / web / libs / tiny_mce / plugins / tinybrowser / js / tinybrowser.js.php
1 <?php
2 $mainpage = (strpos(basename($_SERVER['HTTP_REFERER']),'tinybrowser.php') === 0 ? true : false);
3 require_once('../config_tinybrowser.php');
4
5 if($mainpage && !isset($_GET['feid']) && $tinybrowser['integration'] == 'tinymce')
6         {?>
7         function selectURL(url)
8         {
9                 document.passform.fileurl.value = url;
10                 FileBrowserDialogue.mySubmit();
11         }
12         var FileBrowserDialogue = {
13             init : function () {
14                 // Here goes your code for setting your custom things onLoad.
15                                 rowHighlight();
16             },
17             mySubmit : function () {
18                           var URL = document.passform.fileurl.value;
19                 var win = tinyMCEPopup.getWindowArg("window");
20         
21                 // insert information now
22                 win.document.getElementById(tinyMCEPopup.getWindowArg("input")).value = URL;
23         
24                 // for image browsers: update image dimensions
25                           if (typeof(win.ImageDialog) != "undefined" && document.URL.indexOf('type=image') != -1)
26                                   {
27                         if (win.ImageDialog.getImageData) win.ImageDialog.getImageData();
28                         if (win.ImageDialog.showPreviewImage) win.ImageDialog.showPreviewImage(URL);
29                                   }
30         
31                 // close popup window
32                 tinyMCEPopup.close();
33             }
34         }
35         tinyMCEPopup.onInit.add(FileBrowserDialogue.init, FileBrowserDialogue);
36         <?php 
37         }
38 elseif($mainpage && !isset($_GET['feid']) && $tinybrowser['integration'] == 'fckeditor')
39         {?>
40         function selectURL(url){
41         // window.opener.SetUrl( url, width, height, alt);
42         window.opener.SetUrl( url ) ;
43         window.close() ;
44         }
45         <?php
46         }
47 elseif($mainpage && $_GET['feid'] != '')
48         {?>
49         function selectURL(url) {
50         opener.document.getElementById("<?php echo $_GET['feid']; ?>").value = url;
51         // Set img source of element id, if img id exists (format is elementid + "img")
52         if (
53         typeof(opener.document.getElementById("<?php echo $_GET['feid']; ?>img")) != "undefined"
54         && opener.document.getElementById("<?php echo $_GET['feid']; ?>img") != null
55         && opener.document.getElementById("<?php echo $_GET['feid']; ?>img").src.length != 0
56                 )
57            {
58                 opener.document.getElementById("<?php echo $_GET['feid']; ?>img").src = url;
59                 }
60         self.close();
61         }
62         <?php
63         }
64 ?>
65
66 rowHighlight = function() {
67 var x = document.getElementsByTagName('tr');
68 for (var i=0;i<x.length;i++) 
69         {
70         x[i].onmouseover = function () {this.className = "over " + this.className;}
71         x[i].onmouseout = function () {this.className = this.className.replace("over", ""); this.className = this.className.replace(" ", "");}
72         }
73 var y = document.getElementsByTagName('th');
74 for (var ii=0;ii<y.length;ii++) 
75         {
76         y[ii].onmouseover = function () {if(this.className != "nohvr") this.className = "over " + this.className;}
77         y[ii].onmouseout = function () {this.className = this.className.replace("over", ""); this.className = this.className.replace(" ", "");}
78         }
79 }