bgneal@312: tinyMCEPopup.requireLangPack(); bgneal@312: bgneal@312: function init() { bgneal@312: tinyMCEPopup.resizeToInnerSize(); bgneal@312: bgneal@312: document.getElementById('backgroundimagebrowsercontainer').innerHTML = getBrowserHTML('backgroundimagebrowser','backgroundimage','image','table'); bgneal@312: document.getElementById('bgcolor_pickcontainer').innerHTML = getColorPickerHTML('bgcolor_pick','bgcolor'); bgneal@312: bgneal@312: var inst = tinyMCEPopup.editor; bgneal@312: var dom = inst.dom; bgneal@312: var trElm = dom.getParent(inst.selection.getStart(), "tr"); bgneal@312: var formObj = document.forms[0]; bgneal@312: var st = dom.parseStyle(dom.getAttrib(trElm, "style")); bgneal@312: bgneal@312: // Get table row data bgneal@312: var rowtype = trElm.parentNode.nodeName.toLowerCase(); bgneal@312: var align = dom.getAttrib(trElm, 'align'); bgneal@312: var valign = dom.getAttrib(trElm, 'valign'); bgneal@312: var height = trimSize(getStyle(trElm, 'height', 'height')); bgneal@312: var className = dom.getAttrib(trElm, 'class'); bgneal@312: var bgcolor = convertRGBToHex(getStyle(trElm, 'bgcolor', 'backgroundColor')); bgneal@312: var backgroundimage = getStyle(trElm, 'background', 'backgroundImage').replace(new RegExp("url\\(['\"]?([^'\"]*)['\"]?\\)", 'gi'), "$1"); bgneal@312: var id = dom.getAttrib(trElm, 'id'); bgneal@312: var lang = dom.getAttrib(trElm, 'lang'); bgneal@312: var dir = dom.getAttrib(trElm, 'dir'); bgneal@312: bgneal@312: selectByValue(formObj, 'rowtype', rowtype); bgneal@312: bgneal@312: // Any cells selected bgneal@312: if (dom.select('td.mceSelected,th.mceSelected', trElm).length == 0) { bgneal@312: // Setup form bgneal@312: addClassesToList('class', 'table_row_styles'); bgneal@312: TinyMCE_EditableSelects.init(); bgneal@312: bgneal@312: formObj.bgcolor.value = bgcolor; bgneal@312: formObj.backgroundimage.value = backgroundimage; bgneal@312: formObj.height.value = height; bgneal@312: formObj.id.value = id; bgneal@312: formObj.lang.value = lang; bgneal@312: formObj.style.value = dom.serializeStyle(st); bgneal@312: selectByValue(formObj, 'align', align); bgneal@312: selectByValue(formObj, 'valign', valign); bgneal@312: selectByValue(formObj, 'class', className, true, true); bgneal@312: selectByValue(formObj, 'dir', dir); bgneal@312: bgneal@312: // Resize some elements bgneal@312: if (isVisible('backgroundimagebrowser')) bgneal@312: document.getElementById('backgroundimage').style.width = '180px'; bgneal@312: bgneal@312: updateColor('bgcolor_pick', 'bgcolor'); bgneal@312: } else bgneal@312: tinyMCEPopup.dom.hide('action'); bgneal@312: } bgneal@312: bgneal@312: function updateAction() { bgneal@312: var inst = tinyMCEPopup.editor, dom = inst.dom, trElm, tableElm, formObj = document.forms[0]; bgneal@312: var action = getSelectValue(formObj, 'action'); bgneal@312: bgneal@312: tinyMCEPopup.restoreSelection(); bgneal@312: trElm = dom.getParent(inst.selection.getStart(), "tr"); bgneal@312: tableElm = dom.getParent(inst.selection.getStart(), "table"); bgneal@312: bgneal@312: // Update all selected rows bgneal@312: if (dom.select('td.mceSelected,th.mceSelected', trElm).length > 0) { bgneal@312: tinymce.each(tableElm.rows, function(tr) { bgneal@312: var i; bgneal@312: bgneal@312: for (i = 0; i < tr.cells.length; i++) { bgneal@312: if (dom.hasClass(tr.cells[i], 'mceSelected')) { bgneal@312: updateRow(tr, true); bgneal@312: return; bgneal@312: } bgneal@312: } bgneal@312: }); bgneal@312: bgneal@312: inst.addVisual(); bgneal@312: inst.nodeChanged(); bgneal@312: inst.execCommand('mceEndUndoLevel'); bgneal@312: tinyMCEPopup.close(); bgneal@312: return; bgneal@312: } bgneal@312: bgneal@312: switch (action) { bgneal@312: case "row": bgneal@312: updateRow(trElm); bgneal@312: break; bgneal@312: bgneal@312: case "all": bgneal@312: var rows = tableElm.getElementsByTagName("tr"); bgneal@312: bgneal@312: for (var i=0; i