]> code.citadel.org Git - citadel.git/blob - webcit/tiny_mce/plugins/flash/jscripts/flash.js
* Removed the Kevin Roth rich text editor and replaced it with TinyMCE.
[citadel.git] / webcit / tiny_mce / plugins / flash / jscripts / flash.js
1 var url = tinyMCE.getParam("flash_external_list_url");
2 if (url != null) {
3         // Fix relative
4         if (url.charAt(0) != '/')
5                 url = tinyMCE.documentBasePath + "/" + url;
6
7         document.write('<sc'+'ript language="javascript" type="text/javascript" src="' + url + '"></sc'+'ript>');
8 }
9
10 function init() {
11         tinyMCEPopup.resizeToInnerSize();
12
13         var formObj = document.forms[0];
14         var swffile   = tinyMCE.getWindowArg('swffile');
15         var swfwidth  = '' + tinyMCE.getWindowArg('swfwidth');
16         var swfheight = '' + tinyMCE.getWindowArg('swfheight');
17
18         if (swfwidth.indexOf('%')!=-1) {
19                 formObj.width2.value = "%";
20                 formObj.width.value  = swfwidth.substring(0,swfwidth.length-1);
21         } else {
22                 formObj.width2.value = "px";
23                 formObj.width.value  = swfwidth;
24         }
25
26         if (swfheight.indexOf('%')!=-1) {
27                 formObj.height2.value = "%";
28                 formObj.height.value  = swfheight.substring(0,swfheight.length-1);
29         } else {
30                 formObj.height2.value = "px";
31                 formObj.height.value  = swfheight;
32         }
33
34         formObj.file.value = swffile;
35         formObj.insert.value = tinyMCE.getLang('lang_' + tinyMCE.getWindowArg('action'), 'Insert', true);
36
37         selectByValue(formObj, 'link_list', swffile);
38
39         // Handle file browser
40         if (isVisible('filebrowser'))
41                 document.getElementById('file').style.width = '230px';
42
43         // Auto select flash in list
44         if (typeof(tinyMCEFlashList) != "undefined" && tinyMCEFlashList.length > 0) {
45                 for (var i=0; i<formObj.link_list.length; i++) {
46                         if (formObj.link_list.options[i].value == tinyMCE.getWindowArg('swffile'))
47                                 formObj.link_list.options[i].selected = true;
48                 }
49         }
50 }
51
52 function renderFlashList() {
53         if (typeof(tinyMCEFlashList) != "undefined" && tinyMCEFlashList.length > 0) {
54                 var html = "";
55
56                 html += '<tr><td><label for="link_list">{$lang_flash_list}</label></td>';
57                 html += '<td><select id="link_list" name="link_list" style="width: 250px" onfocus="tinyMCE.addSelectAccessibility(event, this, window);" onchange="this.form.file.value=this.options[this.selectedIndex].value;">';
58                 html += '<option value="">---</option>';
59
60                 for (var i=0; i<tinyMCEFlashList.length; i++)
61                         html += '<option value="' + tinyMCEFlashList[i][1] + '">' + tinyMCEFlashList[i][0] + '</option>';
62
63                 html += '</select></td></tr>';
64
65                 document.write(html);
66         }
67 }
68
69 function insertFlash() {
70         var formObj = document.forms[0];
71         var html      = '';
72         var file      = formObj.file.value;
73         var width     = formObj.width.value;
74         var height    = formObj.height.value;
75         if (formObj.width2.value=='%') {
76                 width = width + '%';
77         }
78         if (formObj.height2.value=='%') {
79                 height = height + '%';
80         }
81
82         if (width == "")
83                 width = 100;
84
85         if (height == "")
86                 height = 100;
87
88         html += ''
89                 + '<img src="' + (tinyMCE.getParam("theme_href") + "/images/spacer.gif") + '" '
90                 + 'width="' + width + '" height="' + height + '" '
91                 + 'border="0" alt="' + file + '" title="' + file + '" class="mceItemFlash" />';
92
93         tinyMCEPopup.execCommand("mceInsertContent", true, html);
94         tinyMCE.selectedInstance.repaint();
95
96         tinyMCEPopup.close();
97 }