1
|
1 |
var url = tinyMCE.getParam("flash_external_list_url");
|
|
2 |
if (url != null) {
|
|
3 |
// Fix relative
|
|
4 |
if (url.charAt(0) != '/' && url.indexOf('://') == -1)
|
|
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 |
document.getElementById("filebrowsercontainer").innerHTML = getBrowserHTML('filebrowser','file','flash','flash');
|
|
14 |
|
|
15 |
// Image list outsrc
|
|
16 |
var html = getFlashListHTML('filebrowser','file','flash','flash');
|
|
17 |
if (html == "")
|
|
18 |
document.getElementById("linklistrow").style.display = 'none';
|
|
19 |
else
|
|
20 |
document.getElementById("linklistcontainer").innerHTML = html;
|
|
21 |
|
|
22 |
var formObj = document.forms[0];
|
|
23 |
var swffile = tinyMCE.getWindowArg('swffile');
|
|
24 |
var swfwidth = '' + tinyMCE.getWindowArg('swfwidth');
|
|
25 |
var swfheight = '' + tinyMCE.getWindowArg('swfheight');
|
|
26 |
|
|
27 |
if (swfwidth.indexOf('%')!=-1) {
|
|
28 |
formObj.width2.value = "%";
|
|
29 |
formObj.width.value = swfwidth.substring(0,swfwidth.length-1);
|
|
30 |
} else {
|
|
31 |
formObj.width2.value = "px";
|
|
32 |
formObj.width.value = swfwidth;
|
|
33 |
}
|
|
34 |
|
|
35 |
if (swfheight.indexOf('%')!=-1) {
|
|
36 |
formObj.height2.value = "%";
|
|
37 |
formObj.height.value = swfheight.substring(0,swfheight.length-1);
|
|
38 |
} else {
|
|
39 |
formObj.height2.value = "px";
|
|
40 |
formObj.height.value = swfheight;
|
|
41 |
}
|
|
42 |
|
|
43 |
formObj.file.value = swffile;
|
|
44 |
formObj.insert.value = tinyMCE.getLang('lang_' + tinyMCE.getWindowArg('action'), 'Insert', true);
|
|
45 |
|
|
46 |
selectByValue(formObj, 'linklist', swffile);
|
|
47 |
|
|
48 |
// Handle file browser
|
|
49 |
if (isVisible('filebrowser'))
|
|
50 |
document.getElementById('file').style.width = '230px';
|
|
51 |
|
|
52 |
// Auto select flash in list
|
|
53 |
if (typeof(tinyMCEFlashList) != "undefined" && tinyMCEFlashList.length > 0) {
|
|
54 |
for (var i=0; i<formObj.linklist.length; i++) {
|
|
55 |
if (formObj.linklist.options[i].value == tinyMCE.getWindowArg('swffile'))
|
|
56 |
formObj.linklist.options[i].selected = true;
|
|
57 |
}
|
|
58 |
}
|
|
59 |
}
|
|
60 |
|
|
61 |
function getFlashListHTML() {
|
|
62 |
if (typeof(tinyMCEFlashList) != "undefined" && tinyMCEFlashList.length > 0) {
|
|
63 |
var html = "";
|
|
64 |
|
|
65 |
html += '<select id="linklist" name="linklist" style="width: 250px" onfocus="tinyMCE.addSelectAccessibility(event, this, window);" onchange="this.form.file.value=this.options[this.selectedIndex].value;">';
|
|
66 |
html += '<option value="">---</option>';
|
|
67 |
|
|
68 |
for (var i=0; i<tinyMCEFlashList.length; i++)
|
|
69 |
html += '<option value="' + tinyMCEFlashList[i][1] + '">' + tinyMCEFlashList[i][0] + '</option>';
|
|
70 |
|
|
71 |
html += '</select>';
|
|
72 |
|
|
73 |
return html;
|
|
74 |
}
|
|
75 |
|
|
76 |
return "";
|
|
77 |
}
|
|
78 |
|
|
79 |
function insertFlash() {
|
|
80 |
var formObj = document.forms[0];
|
|
81 |
var html = '';
|
|
82 |
var file = formObj.file.value;
|
|
83 |
var width = formObj.width.value;
|
|
84 |
var height = formObj.height.value;
|
|
85 |
if (formObj.width2.value=='%') {
|
|
86 |
width = width + '%';
|
|
87 |
}
|
|
88 |
if (formObj.height2.value=='%') {
|
|
89 |
height = height + '%';
|
|
90 |
}
|
|
91 |
|
|
92 |
if (width == "")
|
|
93 |
width = 100;
|
|
94 |
|
|
95 |
if (height == "")
|
|
96 |
height = 100;
|
|
97 |
|
|
98 |
html += ''
|
|
99 |
+ '<img src="' + (tinyMCE.getParam("theme_href") + "/images/spacer.gif") + '" mce_src="' + (tinyMCE.getParam("theme_href") + "/images/spacer.gif") + '" '
|
|
100 |
+ 'width="' + width + '" height="' + height + '" '
|
|
101 |
+ 'border="0" alt="' + file + '" title="' + file + '" class="mceItemFlash" />';
|
|
102 |
|
|
103 |
tinyMCEPopup.execCommand("mceInsertContent", true, html);
|
|
104 |
tinyMCE.selectedInstance.repaint();
|
|
105 |
|
|
106 |
tinyMCEPopup.close();
|
|
107 |
}
|