No regular expressions were active.
1 |
|
// Import
external l
ist url ja
vascript
|
|
|
2 |
|
var url =
tinyMCE.ge
tParam("te
mplate_ext
ernal_list
_url");
|
|
|
3 |
|
if (url !=
null) {
|
|
|
4 |
|
// Fix
relative
|
|
|
5 |
|
if (ur
l.charAt(0
) != '/' &
& url.inde
xOf('://')
== -1)
|
|
|
6 |
|
ur
l = tinyMC
E.document
BasePath +
"/" + url
;
|
|
|
7 |
|
|
|
|
8 |
|
docume
nt.write('
<sc'+'ript
language=
"javascrip
t" type="t
ext/javasc
ript" src=
"' + url +
'"></sc'+
'ript>');
|
|
|
9 |
|
}
|
|
|
10 |
|
|
|
|
11 |
|
var TPU =
{ //Templa
te Popup U
tils
|
|
|
12 |
|
curren
tTemplateH
TML : null
,
|
|
|
13 |
|
templa
tes : [],
|
|
|
14 |
|
inst :
tinyMCE.g
etInstance
ById(tinyM
CE.getWind
owArg('edi
tor_id')),
|
|
|
15 |
|
plugin
: tinyMCE
.getWindow
Arg('plugi
nObj'),
|
|
|
16 |
|
data :
tinyMCE.s
electedIns
tance.getD
ata('templ
ate'),
|
|
|
17 |
|
|
|
|
18 |
|
init :
function(
) {
|
|
|
19 |
|
do
cument.for
ms[0].inse
rt.value =
tinyMCE.g
etLang('la
ng_' + thi
s.data.cur
rentAction
, 'Insert'
, true);
|
|
|
20 |
|
TP
U.loadTemp
latePaths(
);
|
|
|
21 |
|
|
|
|
22 |
|
if
(this.dat
a.currentA
ction == "
update")
|
|
|
23 |
|
document
.getElemen
tById('war
ning').inn
erHTML = t
inyMCE.get
Lang('lang
_template_
warning');
|
|
|
24 |
|
|
|
|
25 |
|
th
is.resizeI
nputs();
|
|
|
26 |
|
},
|
|
|
27 |
|
|
|
|
28 |
|
loadTe
mplatePath
s : functi
on() {
|
|
|
29 |
|
va
r tsrc, se
l, x, u;
|
|
|
30 |
|
|
|
|
31 |
|
ts
rc = tinyM
CE.getPara
m("templat
e_template
s", false)
;
|
|
|
32 |
|
se
l = docume
nt.getElem
entById('t
path');
|
|
|
33 |
|
|
|
|
34 |
|
//
Setup ext
ernal temp
late list
|
|
|
35 |
|
if
(!tsrc &&
typeof(ti
nyMCETempl
ateList) !
= 'undefin
ed') {
|
|
|
36 |
|
for (x=0
, tsrc = [
]; x<tinyM
CETemplate
List.lengt
h; x++)
|
|
|
37 |
|
tsrc
.push({tit
le : tinyM
CETemplate
List[x][0]
, src : ti
nyMCETempl
ateList[x]
[1], descr
iption : t
inyMCETemp
lateList[x
][2]});
|
|
|
38 |
|
}
|
|
|
39 |
|
|
|
|
40 |
|
fo
r (x=0; x<
tsrc.lengt
h; x++) {
|
|
|
41 |
|
u = tsrc
[x].src;
|
|
|
42 |
|
|
|
|
43 |
|
// Force
absolute
|
|
|
44 |
|
if (u.in
dexOf('://
') == -1 &
& u.indexO
f('/') !=
0)
|
|
|
45 |
|
u =
tinyMCE.do
cumentBase
Path + "/"
+ u;
|
|
|
46 |
|
|
|
|
47 |
|
tsrc[x].
src = u;
|
|
|
48 |
|
}
|
|
|
49 |
|
|
|
|
50 |
|
TP
U.template
s = tsrc;
|
|
|
51 |
|
|
|
|
52 |
|
fo
r (x = 0;
x < tsrc.l
ength; x++
)
|
|
|
53 |
|
sel.opti
ons[sel.op
tions.leng
th] = new
Option(tsr
c[x].title
, tsrc[x].
src);
|
|
|
54 |
|
},
|
|
|
55 |
|
|
|
|
56 |
|
select
Template :
function(
o) {
|
|
|
57 |
|
va
r x, d = w
indow.fram
es['templa
tesrc'].do
cument;
|
|
|
58 |
|
|
|
|
59 |
|
th
is.current
TemplateHT
ML = this.
plugin._re
placeValue
s(this.get
FileConten
ts(o.value
));
|
|
|
60 |
|
|
|
|
61 |
|
//
Force com
plete docu
ment
|
|
|
62 |
|
/* if
(!/<body/
gi.test(th
is.current
TemplateHT
ML)) {
|
|
|
63 |
|
this.cur
rentTempla
teHTML = '
<html xmln
s="http://
www.w3.org
/1999/xhtm
l">' +
|
|
|
64 |
|
'<he
ad>' +
|
|
|
65 |
|
'<title>bl
ank_page</
title>' +
|
|
|
66 |
|
'<meta htt
p-equiv="C
ontent-Typ
e" content
="text/htm
l; charset
=UTF-8" />
' +
|
|
|
67 |
|
'</h
ead>' +
|
|
|
68 |
|
'<bo
dy>' +
|
|
|
69 |
|
this
.currentTe
mplateHTML
+
|
|
|
70 |
|
'</b
ody>' +
|
|
|
71 |
|
'</h
tml>';
|
|
|
72 |
|
}*
/
|
|
|
73 |
|
|
|
|
74 |
|
//
Write HTM
L to previ
ew iframe
|
|
|
75 |
|
d.
body.inner
HTML = thi
s.currentT
emplateHTM
L;
|
|
|
76 |
|
|
|
|
77 |
|
//
Display d
escription
|
|
|
78 |
|
fo
r (x = 0;
x < TPU.te
mplates.le
ngth; x++)
{
|
|
|
79 |
|
if (TPU.
templates[
x].src ==
o.value) {
|
|
|
80 |
|
docu
ment.getEl
ementById(
'tmpldesc'
).innerHTM
L = TPU.te
mplates[x]
.descripti
on;
|
|
|
81 |
|
brea
k;
|
|
|
82 |
|
}
|
|
|
83 |
|
}
|
|
|
84 |
|
},
|
|
|
85 |
|
|
|
|
86 |
|
insert
Template :
function(
) {
|
|
|
87 |
|
va
r sel, opt
;
|
|
|
88 |
|
|
|
|
89 |
|
se
l = docume
nt.getElem
entById('t
path');
|
|
|
90 |
|
op
t = sel.op
tions[sel.
selectedIn
dex];
|
|
|
91 |
|
|
|
|
92 |
|
//
Is it a t
emplate or
snippet
|
|
|
93 |
|
if
(TPU.curr
entTemplat
eHTML.inde
xOf('mceTm
pl'))
|
|
|
94 |
|
tinyMCEP
opup.execC
ommand('mc
eTemplate'
, false, {
title : op
t.text, ts
rc : opt.v
alue, body
: TPU.cur
rentTempla
teHTML});
|
|
|
95 |
|
el
se
|
|
|
96 |
|
tinyMCEP
opup.execC
ommand('mc
eInsertCon
tent', fal
se, TPU.cu
rrentTempl
ateHTML);
|
|
|
97 |
|
|
|
|
98 |
|
ti
nyMCEPopup
.close();
|
|
|
99 |
|
},
|
|
|
100 |
|
|
|
|
101 |
|
getFil
eContents
: function
(u) {
|
|
|
102 |
|
va
r x, d, t
= 'text/pl
ain';
|
|
|
103 |
|
|
|
|
104 |
|
fu
nction g(s
) {
|
|
|
105 |
|
x = 0;
|
|
|
106 |
|
|
|
|
107 |
|
try {
|
|
|
108 |
|
x =
new Active
XObject(s)
;
|
|
|
109 |
|
} catch
(s) {
|
|
|
110 |
|
}
|
|
|
111 |
|
|
|
|
112 |
|
return x
;
|
|
|
113 |
|
};
|
|
|
114 |
|
|
|
|
115 |
|
x
= window.A
ctiveXObje
ct ? g('Ms
xml2.XMLHT
TP') || g(
'Microsoft
.XMLHTTP')
: new XML
HttpReques
t();
|
|
|
116 |
|
|
|
|
117 |
|
//
Synchrono
us AJAX lo
ad file
|
|
|
118 |
|
x.
overrideMi
meType &&
x.override
MimeType(t
);
|
|
|
119 |
|
x.
open("GET"
, u, false
);
|
|
|
120 |
|
x.
send(null)
;
|
|
|
121 |
|
|
|
|
122 |
|
re
turn x.res
ponseText;
|
|
|
123 |
|
},
|
|
|
124 |
|
|
|
|
125 |
|
resize
Inputs : f
unction()
{
|
|
|
126 |
|
va
r wHeight,
wWidth, e
lm;
|
|
|
127 |
|
|
|
|
128 |
|
if
(!self.in
nerWidth)
{
|
|
|
129 |
|
wHeight
= document
.body.clie
ntHeight -
160;
|
|
|
130 |
|
wWidth =
document.
body.clien
tWidth - 4
0;
|
|
|
131 |
|
}
else {
|
|
|
132 |
|
wHeight
= self.inn
erHeight -
160;
|
|
|
133 |
|
wWidth =
self.inne
rWidth - 4
0;
|
|
|
134 |
|
}
|
|
|
135 |
|
|
|
|
136 |
|
el
m = docume
nt.getElem
entById('t
emplatesrc
');
|
|
|
137 |
|
|
|
|
138 |
|
if
(elm) {
|
|
|
139 |
|
elm.styl
e.height =
Math.abs(
wHeight) +
'px';
|
|
|
140 |
|
elm.styl
e.width =
Math.abs(
wWidth - 5
) + 'px';
|
|
|
141 |
|
}
|
|
|
142 |
|
}
|
|
|
143 |
|
};
|
|
|