6 var formObj = document.forms[0]; |
6 var formObj = document.forms[0]; |
7 var inst = tinyMCEPopup.editor, dom = inst.dom; |
7 var inst = tinyMCEPopup.editor, dom = inst.dom; |
8 var cols = 2, rows = 2, border = 0, cellpadding = -1, cellspacing = -1, align, width, height, className, caption, frame, rules; |
8 var cols = 2, rows = 2, border = 0, cellpadding = -1, cellspacing = -1, align, width, height, className, caption, frame, rules; |
9 var html = '', capEl, elm; |
9 var html = '', capEl, elm; |
10 var cellLimit, rowLimit, colLimit; |
10 var cellLimit, rowLimit, colLimit; |
|
11 |
|
12 tinyMCEPopup.restoreSelection(); |
11 |
13 |
12 if (!AutoValidator.validate(formObj)) { |
14 if (!AutoValidator.validate(formObj)) { |
13 alert(inst.getLang('invalid_data')); |
15 alert(inst.getLang('invalid_data')); |
14 return false; |
16 return false; |
15 } |
17 } |
83 capEl.innerHTML = '<br mce_bogus="1"/>'; |
85 capEl.innerHTML = '<br mce_bogus="1"/>'; |
84 |
86 |
85 elm.insertBefore(capEl, elm.firstChild); |
87 elm.insertBefore(capEl, elm.firstChild); |
86 } |
88 } |
87 |
89 |
88 dom.setAttrib(elm, 'width', width, true); |
90 if (width && /(pt|em|cm)$/.test(width)) { |
|
91 dom.setStyle(elm, 'width', width); |
|
92 dom.setAttrib(elm, 'width', ''); |
|
93 } else { |
|
94 dom.setAttrib(elm, 'width', width, true); |
|
95 dom.setStyle(elm, 'width', ''); |
|
96 } |
89 |
97 |
90 // Remove these since they are not valid XHTML |
98 // Remove these since they are not valid XHTML |
91 dom.setAttrib(elm, 'borderColor', ''); |
99 dom.setAttrib(elm, 'borderColor', ''); |
92 dom.setAttrib(elm, 'bgColor', ''); |
100 dom.setAttrib(elm, 'bgColor', ''); |
93 dom.setAttrib(elm, 'background', ''); |
101 dom.setAttrib(elm, 'background', ''); |
94 dom.setAttrib(elm, 'height', ''); |
102 |
|
103 if (height) { |
|
104 dom.setStyle(elm, 'height', height); |
|
105 dom.setAttrib(elm, 'height', ''); |
|
106 } |
95 |
107 |
96 if (background != '') |
108 if (background != '') |
97 elm.style.backgroundImage = "url('" + background + "')"; |
109 elm.style.backgroundImage = "url('" + background + "')"; |
98 else |
110 else |
99 elm.style.backgroundImage = ''; |
111 elm.style.backgroundImage = ''; |
134 |
146 |
135 html += makeAttrib('id', id); |
147 html += makeAttrib('id', id); |
136 html += makeAttrib('border', border); |
148 html += makeAttrib('border', border); |
137 html += makeAttrib('cellpadding', cellpadding); |
149 html += makeAttrib('cellpadding', cellpadding); |
138 html += makeAttrib('cellspacing', cellspacing); |
150 html += makeAttrib('cellspacing', cellspacing); |
139 html += makeAttrib('width', width); |
151 |
|
152 if (width && /(pt|em|cm)$/.test(width)) { |
|
153 if (style) |
|
154 style += '; '; |
|
155 |
|
156 style += 'width: ' + width; |
|
157 } else |
|
158 html += makeAttrib('width', width); |
|
159 |
|
160 /* if (height) { |
|
161 if (style) |
|
162 style += '; '; |
|
163 |
|
164 style += 'height: ' + height; |
|
165 }*/ |
|
166 |
140 //html += makeAttrib('height', height); |
167 //html += makeAttrib('height', height); |
141 //html += makeAttrib('bordercolor', bordercolor); |
168 //html += makeAttrib('bordercolor', bordercolor); |
142 //html += makeAttrib('bgcolor', bgcolor); |
169 //html += makeAttrib('bgcolor', bgcolor); |
143 html += makeAttrib('align', align); |
170 html += makeAttrib('align', align); |
144 html += makeAttrib('frame', frame); |
171 html += makeAttrib('frame', frame); |
259 action = "update"; |
286 action = "update"; |
260 formObj.insert.value = inst.getLang('update'); |
287 formObj.insert.value = inst.getLang('update'); |
261 } |
288 } |
262 |
289 |
263 addClassesToList('class', "table_styles"); |
290 addClassesToList('class', "table_styles"); |
|
291 TinyMCE_EditableSelects.init(); |
264 |
292 |
265 // Update form |
293 // Update form |
266 selectByValue(formObj, 'align', align); |
294 selectByValue(formObj, 'align', align); |
267 selectByValue(formObj, 'frame', frame); |
295 selectByValue(formObj, 'frame', frame); |
268 selectByValue(formObj, 'rules', rules); |
296 selectByValue(formObj, 'rules', rules); |
269 selectByValue(formObj, 'class', className); |
297 selectByValue(formObj, 'class', className, true, true); |
270 formObj.cols.value = cols; |
298 formObj.cols.value = cols; |
271 formObj.rows.value = rows; |
299 formObj.rows.value = rows; |
272 formObj.border.value = border; |
300 formObj.border.value = border; |
273 formObj.cellpadding.value = cellpadding; |
301 formObj.cellpadding.value = cellpadding; |
274 formObj.cellspacing.value = cellspacing; |
302 formObj.cellspacing.value = cellspacing; |