@Ghazascanner
_2019runbot
Ghazascanner File Manager
server :Linux adweb87 2.6.32-754.el6.x86_64 #1 SMP Tue Jun 19 21:26:04 UTC 2018 x86_64
Current Path :
/
home
/
sanchung
/
public_html
/
admin
/
_popup
/
pediter
/
Path :
Upload File :
New :
File
Dir
/home/sanchung/public_html/admin/_popup/pediter/spaw_script.js.php
/**** Ư¼ö¹®ÀÚ »ðÀÔ ****/ function InsertSpecialCharacter() { var retString = window.showModalDialog("/newpopko/editer/frmSpChPanel.asp", "" ,"dialogHeight: 520px; dialogWidth: 350px; edge: Raised; center: Yes; scroll: No; help: No; resizable: No; status: No;"); window.frames['psk_Editer'].focus(); var selection = window.frames['psk_Editer'].document.selection.createRange(); if (retString != null) selection.pasteHTML(retString); } /**** ÆíÁý±â⠱⺻¼ÂÆÃ S ****/ function psk_stylesheet(StyleFile){ this[edit].document.designMode = "On"; if(this[edit].document.readyState == "complete"){ this[edit].document.createStyleSheet(StyleFile); } } /**** ÆíÁý±â⠱⺻¼ÂÆÃ E ****/ /**** ÆíÁý±ââ ¸ðµå Àüȯ S ****/ function psk_edit_mode(){ var mode; if(document.all.HTML.checked == true) mode = "HTML"; else mode = "EDITOR"; if(mode == "EDITOR"){ iText = this[edit].document.body.innerText; this[edit].document.body.innerHTML = iText; } else if(mode == "HTML"){ iHTML = this[edit].document.body.innerHTML; this[edit].document.body.innerText = iHTML; } } /**** ÆíÁý±ââ ¸ðµå Àüȯ E ****/ /**** À̹ÌÁö ³Ö±â ****/ function psk_image_up(id, gv, edit){ if(document.all.HTML.checked == true){ alert("HTMLÆíÁý ÇØÁ¦ÈÄ »ç¿ëÇϼ¼¿ä. "); return false; } // insert image // window.frames['PopupForm'].focus(); var gValues = showModalDialog('/admin/_popup/pediter/img_library.php', 'image', 'dialogWidth:440px; dialogHeight:160px; status:no ; center: Yes; scroll: No;'); if(gValues != null){ if(gValues.Type == 'Geturl') imgSrc = gValues.Src; else if(gValues.Type == 'Upload') { UpImages[UpImages.length] = gValues.Src; imgSrc = gValues.Src; } this['PopupForm'].document.execCommand('insertimage', false, imgSrc); } } function html_check(){ if(document.all.HTML.checked == true){ alert("HTMLÆíÁý ÇØÁ¦ÈÄ »ç¿ëÇϼ¼¿ä. "); return false; } } /**** ÀϹÝÀûÀÎ HTML ÅÂ±× S ****/ function psk_click(type, sender){ if(document.all.HTML.checked == true){ alert("HTMLÆíÁý ÇØÁ¦ÈÄ »ç¿ëÇϼ¼¿ä. "); return false; } this[edit].focus(); if(type == 'link'){ /**** Hyperlink ****/ this[edit].document.execCommand('createlink'); Editer = eval(window.frames[edit].document.body); Atag = Editer.getElementsByTagName("A"); if(Atag){ for(i=0; i<Atag.length; i++){ Atag(i).target = '_blank'; } } } else if(type == 'fontcolor'){ /**** ±ÛÀÚ»ö»ó º¯°æ ****/ var fCol = ColorPicker(null); if(fCol != null) this[edit].document.execCommand('forecolor', false, fCol); } else if(type == 'backcolor'){ /**** ±ÛÀÚ ¹è°æ»ö»ó º¯°æ ****/ var bCol = ColorPicker(null); if(bCol != null) this[edit].document.execCommand('backcolor', false, bCol); } else if(type == 'bgcolor') { /**** ¹®¼ ¹è°æ»ö»ó º¯°æ ****/ var bgCol = ColorPicker(null); if(bgCol != null) this[edit].document.body.style.backgroundColor = bgCol; } else if(type == 'fontname') { /**** ±Û²Ã º¯°æ ****/ fontname = sender.options[sender.selectedIndex].value; this[edit].document.execCommand('fontname', false, fontname); } else if(type == 'fontsize') { /**** ±ÛÀÚ »çÀÌÁî º¯°æ ****/ fontsize = sender.options[sender.selectedIndex].value; this[edit].document.execCommand('fontsize', false, fontsize); } else if(type == 'layer') { /**** ·¹ÀÌ¾î »ðÀÔ ****/ layerString = "<div style='position:absolute; border:1 dashed #000000; top:100; left:100; width:100'></div>"; window.frames['PopupForm'].focus(); var selection = window.frames['PopupForm'].document.selection.createRange(); selection.pasteHTML(layerString); } else if(type == 'flash') { /**** Ç÷¡½Ã »ðÀÔ ****/ objectStr = "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width='197' height='36'>" +"<param name='movie' value='http://diora.or.kr//flash/logo.swf'>" +"<param name='quality' value='high'>" +"<embed src='http://diora.or.kr//flash/logo.swf' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='197' height='36'></embed></object>"; window.frames['PopupForm'].focus(); var selection = window.frames['PopupForm'].document.selection.createRange(); selection.pasteHTML(objectStr); } else { /**** ETC ****/ this[edit].document.execCommand(type, false, null); } } /**** ÀϹÝÀûÀÎ HTML ÅÂ±× E ****/ /**** Ä÷¯ ÃÆ® ****/ function ColorPicker(curcolor) { return showModalDialog('/admin/_popup/pediter/color.php', curcolor, 'scroll: No; dialogHeight:340px; dialogWidth:340px; resizable:no; status:no'); } /**** Ä÷¯ ÃÆ® ****/ // ·¹À̾î selected check // function psk_select_layer(edit) { if (this[edit].document.selection.type == "Control"){ var tControl = this[edit].document.selection.createRange(); if (tControl(0).tagName == 'DIV'){ return(tControl(0)); } else { alert("¼±ÅÃÇϽŠ·¹À̾ ¾ø½À´Ï´Ù. "); return false; } } else { alert("¼±ÅÃÇϽŠ·¹À̾ ¾ø½À´Ï´Ù. "); return false; } } // ·¹À̾î selected check // // ·¹ÀÌ¾î ¼öÁ¤ // function psk_layer_edit(){ var slayer = psk_select_layer(edit); if(slayer){ // °´Ã¼ ¼±¾ð // function oldValue(width, height, top, left, bwidth, bstyle, bcolor) { this.width = width; this.height = height; this.top = top; this.left = left; } // iValue = ¼±ÅÃÇÑ À̹ÌÁö °ü·Ã °ª // alert(slayer.style.borderWidth); // cls[ci].runtimeStyle.borderWidth = ""; // cls[ci].runtimeStyle.borderStyle = ""; // cls[ci].runtimeStyle.borderColor = ""; var iValue = new oldValue(); iValue.width = slayer.style.width; iValue.height = slayer.style.height; iValue.top = slayer.style.top; iValue.left = slayer.style.left; iValue.bwidth = slayer.style.borderWidth; iValue.bstyle = slayer.style.borderStyle; iValue.bcolor = slayer.style.borderColor; // cValue = ¹Ù²î´Â À̹ÌÁö °ü·Ã °ª // //var cValue = showModalDialog('./editer/layer_edit.php', iValue, 'dialogHeight:210px; dialogWidth:470px; status:no; center: Yes; scroll: No;'); } } // image selected check // function psk_select_img(edit) { if (this[edit].document.selection.type == "Control"){ var tControl = this[edit].document.selection.createRange(); if (tControl(0).tagName == 'IMG'){ return(tControl(0)); } else { alert("¼±ÅÃÇϽб׏²ÀÌ ¾ø½À´Ï´Ù. "); return false; } } else { alert("¼±ÅÃÇϽб׏²ÀÌ ¾ø½À´Ï´Ù. "); return false; } } // image selected check // /**** À̹ÌÁö ÆíÁý S ****/ function psk_image_edit(){ if(document.all.HTML.checked == true){ alert("HTMLÆíÁý ÇØÁ¦ÈÄ »ç¿ëÇϼ¼¿ä. "); return false; } var simg = psk_select_img(edit); if(simg) { // °´Ã¼ ¼±¾ð // function oldValue(src,alt,width,height,border,align,hspace,vspace) { this.src = src; this.alt = alt; this.width = width; this.height = height; this.border = border; this.align = align; this.hspace = hspace; this.vspace = vspace; } // iValue = ¼±ÅÃÇÑ À̹ÌÁö °ü·Ã °ª // var iValue = new oldValue(); iValue.src = simg.src; iValue.alt = simg.alt; iValue.width = simg.width; iValue.height = simg.height; iValue.border = simg.border; iValue.align = simg.align; iValue.hspace = simg.hspace; iValue.vspace = simg.vspace; // cValue = ¹Ù²î´Â À̹ÌÁö °ü·Ã °ª // var cValue = showModalDialog('./editer/img_edit.php', iValue, 'dialogHeight:215px; dialogWidth:470px; status:no; center: Yes; scroll: No;'); if (cValue) { simg.src = cValue.src; if (cValue.alt){ simg.alt = cValue.alt; } else { simg.removeAttribute("alt"); } simg.align = cValue.align; simg.width = cValue.width; simg.height = cValue.height; if (cValue.border) { simg.border = cValue.border; } else { simg.removeAttribute("border"); } if (cValue.hspace) { simg.hspace = cValue.hspace; } else { simg.removeAttribute("hspace"); } if (cValue.vspace) { simg.vspace = cValue.vspace; } else { simg.removeAttribute("vspace"); } } } } // image edit // /******************************************************************/ /******************************************************************/ /******************************************************************/ /******************************************************************/ /******************************************************************/ /******************************************************************/ /******************************************************************/ /******************************************************************/ // table create // function psk_table_create(editor, sender) { if (this['psk_Editer'].document.selection.type != "Control") { var insertTb = showModalDialog('./editer/table.php', null, 'dialogWidth:400px; dialogHeight:270px; status:no; scroll: No;'); if (insertTb) { this['psk_Editer'].focus(); var newtable = document.createElement('TABLE'); newtable.width = insertTb.width; newtable.height = insertTb.height; newtable.border = insertTb.border; if (insertTb.cellPadding) newtable.cellPadding = insertTb.cellPadding; if (insertTb.cellSpacing) newtable.cellSpacing = insertTb.cellSpacing; newtable.bgColor = insertTb.bgColor; // create rows for (i=0;i<parseInt(insertTb.rows);i++) { var newrow = document.createElement('TR'); for (j=0; j<parseInt(insertTb.cols); j++) { var newcell = document.createElement('TD'); newrow.appendChild(newcell); } newtable.appendChild(newrow); } var selection = this['psk_Editer'].document.selection.createRange(); selection.pasteHTML(newtable.outerHTML); psk_table_clearness(this['psk_Editer'].document.body); } psk_table_clearness(this['psk_Editer'].document.body); } } // table create // // table borders clearness // function psk_table_clearness(psk_edit) { var tables = new Array(); tables = psk_edit.getElementsByTagName("TABLE"); tablecnt = tables.length; for(i=0; i<tablecnt; i++){ if(tables[i].border == 0) { tables[i].runtimeStyle.borderWidth = "1px"; tables[i].runtimeStyle.borderStyle = "dashed"; tables[i].runtimeStyle.borderColor = "#DDDDDD"; } var tds = tables[i].cells; tdscnt = tds.length; for(j=0; j<tdscnt; j++){ if(tables[i].border == 0) { tds[j].runtimeStyle.borderWidth = "1px"; tds[j].runtimeStyle.borderStyle = "dashed"; tds[j].runtimeStyle.borderColor = "#DDDDDD"; } } } } // table borders clearness // // table edit // function psk_table_edit() { var editTable; if (this['psk_Editer'].document.selection.type == "Control") { // TABLE SELECT CHECK // var tSelect = this['psk_Editer'].document.selection.createRange(); if (tSelect(0).tagName == 'TABLE') { editTable = tSelect(0); } } if(editTable) { var tValues = {}; tValues.width = (editTable.style.width)?editTable.style.width:editTable.width; tValues.height = (editTable.style.height)?editTable.style.height:editTable.height; tValues.border = editTable.border; tValues.cellPadding = editTable.cellPadding; tValues.cellSpacing = editTable.cellSpacing; tValues.bgColor = editTable.bgColor; var newValues = showModalDialog('./editer/table.php', tValues, 'dialogWidth:400px; dialogHeight:270px; status:no; scroll: No;'); if (newValues) { editTable.width = (newValues.width)?newValues.width:''; editTable.style.width = (newValues.width)?newValues.width:''; editTable.height = (newValues.height)?newValues.height:''; editTable.style.height = (newValues.height)?newValues.height:''; editTable.border = (newValues.border)?newValues.border:''; if(newValues.cellPadding) editTable.cellPadding = newValues.cellPadding; if(newValues.cellSpacing) editTable.cellSpacing = newValues.cellSpacing; editTable.bgColor = (newValues.bgColor)?newValues.bgColor:''; psk_table_clearness(window.frames['psk_Editer'].document.body); } } this['psk_Editer'].focus(); } // table edit // // td edit // function psk_table_td_edit(editor, sender) { var cd = psk_Get("TD"); if (cd) { var cProps = {}; cProps.width = cd.style.width; cProps.height = cd.style.height; cProps.bgColor = cd.bgColor; cProps.align = cd.align; cProps.vAlign = cd.vAlign; cProps.className = cd.className; cProps.noWrap = cd.noWrap; cProps.styleOptions = new Array(); var ncProps = showModalDialog('tdedit.php', cProps, 'dialogWidth:300px; dialogHeight:180px; status:no; scroll: No;'); if (ncProps) { cd.align = ncProps.align; cd.vAlign = ncProps.vAlign; cd.width = ncProps.width; cd.style.width = ncProps.width; cd.height = ncProps.height; cd.style.height = ncProps.height; cd.bgColor = ncProps.bgColor; cd.className = ncProps.className; cd.noWrap = ncProps.noWrap; } } this['psk_Editer'].focus(); } // td edit // // insert tr // function psk_table_row_insert(editor, sender) { var stable = psk_Get('TABLE'); var str = psk_Get('TR'); if (stable && str) { var newrow = stable.insertRow(str.rowIndex+1); for (i=0; i<str.cells.length; i++) { if (str.cells(i).rowSpan > 1) { str.cells(i).rowSpan++; } else { var newcell = str.cells(i).cloneNode(); newrow.appendChild(newcell); } } for (i=0; i<str.rowIndex; i++) { var temprow = stable.rows(i); for (j=0; j<temprow.cells.length; j++) { if (temprow.cells(j).rowSpan > (str.rowIndex - i)) { temprow.cells(j).rowSpan++; } } } } this['psk_Editer'].focus(); } // insert tr // function psk_Get(getObject) { if (window.frames['psk_Editer'].document.selection.type == "Control") { return(null); } else { this['psk_Editer'].focus(); var tSelect = window.frames["psk_Editer"].document.selection.createRange(); //var tSelect = psk_Editer.document.selection.createRange(); //alert(tSelect.tagName); tSelect = tSelect.parentElement(); if(getObject == 'TR') { while ((tSelect.tagName != 'TR') && (tSelect.tagName != 'TABLE') && (tSelect.tagName != 'BODY')) { tSelect = tSelect.parentElement; } } else if(getObject == 'TABLE') { while ((tSelect.tagName != 'TABLE') && (tSelect.tagName != 'BODY')) { tSelect = tSelect.parentElement; } } else if(getObject == 'TD') { while ((tSelect.tagName != 'TD') && (tSelect.tagName != 'TH') && (tSelect.tagName != 'TABLE') && (tSelect.tagName != 'BODY')) { tSelect = tSelect.parentElement; } } if (tSelect.tagName == getObject) { return(tSelect); } else { return(null); } } } // insert td // function psk_table_col_insert(editor, sender) { var stable = psk_Get('TABLE'); var str = psk_Get('TR'); var std = psk_Get('TD'); if (stable && std && str) { // get "real" cell position and form cell matrix var tm = SPAW_formCellMatrix(stable); for (j=0; j<tm[str.rowIndex].length; j++) { if (tm[str.rowIndex][j] == std.cellIndex) { realIndex=j; break; } } // insert column based on real cell matrix for (i=0; i<stable.rows.length; i++) { if (tm[i][realIndex] != -1) { if (stable.rows(i).cells(tm[i][realIndex]).colSpan > 1) { stable.rows(i).cells(tm[i][realIndex]).colSpan++; } else { var newc = stable.rows(i).insertCell(tm[i][realIndex]+1); var nc = stable.rows(i).cells(tm[i][realIndex]).cloneNode(); newc.replaceNode(nc); } } } } this['psk_Editer'].focus(); } // insert td // function psk_table_row_delete(editor, sender) { // var ct = SPAW_getTable(editor); // current table // var cr = SPAW_getTR(editor); // current row // var cd = SPAW_getTD(editor); // current cell var stable = psk_Get('TABLE'); var str = psk_Get('TR'); var std = psk_Get('TD'); if (stable && str && std) { if (stable.rows.length<=1) { // ¼±ÅÃÇÑ Ç¥°¡ ÇÑÁÙÀϰæ¿ì Ç¥ »èÁ¦ // stable.removeNode(true); } else { // get "real" cell position and form cell matrix var tm = SPAW_formCellMatrix(stable); // decrease rowspan for cells that were spanning through current row for (i=0; i<str.rowIndex; i++) { var temprow = stable.rows(i); for (j=0; j<temprow.cells.length; j++) { if (temprow.cells(j).rowSpan > (str.rowIndex - i)) { temprrow.cells(j).rowSpan--; } } } curCI = -1; // check for current row cells spanning more than 1 row for (i=0; i<tm[str.rowIndex].length; i++) { prevCI = curCI; curCI = tm[str.rowIndex][i]; if (curCI != -1 && curCI != prevCI && str.cells(curCI).rowSpan>1 && (cr.rowIndex+1)<stable.rows.length) { ni = i; nrCI = tm[str.rowIndex+1][ni]; while (nrCI == -1) { ni++; if (ni<stable.rows(str.rowIndex+1).cells.length) nrCI = tm[str.rowIndex+1][ni]; else nrCI = stable.rows(str.rowIndex+1).cells.length; } var newc = stable.rows(str.rowIndex+1).insertCell(nrCI); stable.rows(str.rowIndex).cells(curCI).rowSpan--; var nc = ct.rows(str.rowIndex).cells(curCI).cloneNode(); newc.replaceNode(nc); // fix the matrix cs = (str.cells(curCI).colSpan>1)?str.cells(curCI).colSpan:1; for (j=i; j<(i+cs);j++) { tm[str.rowIndex+1][j] = nrCI; nj = j; } for (j=nj; j<tm[str.rowIndex+1].length; j++) { if (tm[str.rowIndex+1][j] != -1) tm[str.rowIndex+1][j]++; } } } stable.deleteRow(str.rowIndex); } } this['psk_Editer'].focus(); } // deleteRow // delete td // function psk_table_col_delete(editor, sender) { var ct = psk_Get("TABLE"); var cr = psk_Get("TR"); var cd = psk_Get("TD"); if (cd && cr && ct) { // get "real" cell position and form cell matrix var tm = SPAW_formCellMatrix(ct); if (tm[0].length<=1) { ct.removeNode(true); } else { for (j=0; j<tm[cr.rowIndex].length; j++) { if (tm[cr.rowIndex][j] == cd.cellIndex) { realIndex=j; break; } } for (i=0; i<ct.rows.length; i++) { if (tm[i][realIndex] != -1) { if (ct.rows(i).cells(tm[i][realIndex]).colSpan>1) { ct.rows(i).cells(tm[i][realIndex]).colSpan--; } else { ct.rows(i).deleteCell(tm[i][realIndex]); } } } } } this['psk_Editer'].focus(); } // delete td // function SPAW_formCellMatrix(ct) { var tm = new Array(); for (i=0; i<ct.rows.length; i++) { tm[i]=new Array(); } for (i=0; i<ct.rows.length; i++) { jr=0; for (j=0; j<ct.rows(i).cells.length;j++) { while (tm[i][jr] != undefined) { jr++; } for (jh=jr; jh<jr+(ct.rows(i).cells(j).colSpan?ct.rows(i).cells(j).colSpan:1);jh++) { for (jv=i; jv<i+(ct.rows(i).cells(j).rowSpan?ct.rows(i).cells(j).rowSpan:1);jv++) { if (jv==i) { tm[jv][jh]=ct.rows(i).cells(j).cellIndex; } else { tm[jv][jh]=-1; } } } } } return(tm); } // divide tr // function psk_table_row_divide(editor, sender) { var ct = psk_Get("TABLE"); var cr = psk_Get("TR"); var cd = psk_Get("TD"); if (cd && cr && ct) { // get "real" cell position and form cell matrix var tm = SPAW_formCellMatrix(ct); for (j=0; j<tm[cr.rowIndex].length; j++) { if (tm[cr.rowIndex][j] == cd.cellIndex) { realIndex=j; break; } } if (cd.rowSpan>1) { // split only current cell // find where to insert a cell in the next row i = realIndex; while (tm[cr.rowIndex+1][i] == -1){ i++; } if (i == tm[cr.rowIndex+1].length) { ni = ct.rows(cr.rowIndex+1).cells.length; } else { ni = tm[cr.rowIndex+1][i]; } var newc = ct.rows(cr.rowIndex+1).insertCell(ni); cd.rowSpan--; var nc = cd.cloneNode(); newc.replaceNode(nc); cd.rowSpan = 1; } else { // add new row and make all other cells to span one row more ct.insertRow(cr.rowIndex+1); for (i=0; i<cr.cells.length; i++) { if (i != cd.cellIndex) { rs = cr.cells(i).rowSpan>1?cr.cells(i).rowSpan:1; cr.cells(i).rowSpan = rs+1; } } for (i=0; i<cr.rowIndex; i++) { var tempr = ct.rows(i); for (j=0; j<tempr.cells.length; j++) { if (tempr.cells(j).rowSpan > (cr.rowIndex - i)) { tempr.cells(j).rowSpan++; } } } // clone current cell to new row var newc = ct.rows(cr.rowIndex+1).insertCell(0); var nc = cd.cloneNode(); newc.replaceNode(nc); } } this['psk_Editer'].focus(); } // divide tr // // divide td // function psk_table_col_divide(editor, sender) { var ct = psk_Get("TABLE"); var cr = psk_Get("TR"); var cd = psk_Get("TD"); if (cd && cr && ct) { // get "real" cell position and form cell matrix var tm = SPAW_formCellMatrix(ct); for (j=0; j<tm[cr.rowIndex].length; j++) { if (tm[cr.rowIndex][j] == cd.cellIndex) { realIndex=j; break; } } if (cd.colSpan>1) { // split only current cell var newc = ct.rows(cr.rowIndex).insertCell(cd.cellIndex+1); cd.colSpan--; var nc = cd.cloneNode(); newc.replaceNode(nc); cd.colSpan = 1; } else { // clone current cell var newc = ct.rows(cr.rowIndex).insertCell(cd.cellIndex+1); var nc = cd.cloneNode(); newc.replaceNode(nc); for (i=0; i<tm.length; i++) { if (i!=cr.rowIndex && tm[i][realIndex] != -1) { cs = ct.rows(i).cells(tm[i][realIndex]).colSpan>1?ct.rows(i).cells(tm[i][realIndex]).colSpan:1; ct.rows(i).cells(tm[i][realIndex]).colSpan = cs+1; } } } } this['psk_Editer'].focus(); } // divide td // // merge td // function psk_table_cols_merge(editor, sender) { var ct = psk_Get("TABLE"); var cr = psk_Get("TR"); var cd = psk_Get("TD"); if (cd && cr && ct) { // get "real" cell position and form cell matrix var tm = SPAW_formCellMatrix(ct); for (j=0; j<tm[cr.rowIndex].length; j++) { if (tm[cr.rowIndex][j] == cd.cellIndex) { realIndex=j; break; } } if (cd.cellIndex+1<cr.cells.length) { ccrs = cd.rowSpan?cd.rowSpan:1; cccs = cd.colSpan?cd.colSpan:1; ncrs = cr.cells(cd.cellIndex+1).rowSpan?cr.cells(cd.cellIndex+1).rowSpan:1; nccs = cr.cells(cd.cellIndex+1).colSpan?cr.cells(cd.cellIndex+1).colSpan:1; // check if theres nothing between these 2 cells j=realIndex; while(tm[cr.rowIndex][j] == cd.cellIndex) { j++; } if (tm[cr.rowIndex][j] == cd.cellIndex+1) { if (ccrs == ncrs) { cd.colSpan = cccs+nccs; cd.innerHTML += cr.cells(cd.cellIndex+1).innerHTML; cr.deleteCell(cd.cellIndex+1); } } } } this['psk_Editer'].focus(); } // merge td // // merge tr // function psk_table_rows_merge(editor, sender) { var ct = psk_Get("TABLE"); var cr = psk_Get("TR"); var cd = psk_Get("TD"); if(cd && cr && ct) { // get "real" cell position and form cell matrix var tm = SPAW_formCellMatrix(ct); for(j=0; j<tm[cr.rowIndex].length; j++) { if(tm[cr.rowIndex][j] == cd.cellIndex) { crealIndex=j; break; } } ccrs = cd.rowSpan?cd.rowSpan:1; cccs = cd.colSpan?cd.colSpan:1; if (cr.rowIndex+ccrs<ct.rows.length) { ncellIndex = tm[cr.rowIndex+ccrs][crealIndex]; if (ncellIndex != -1 && (crealIndex==0 || (crealIndex>0 && (tm[cr.rowIndex+ccrs][crealIndex-1]!=tm[cr.rowIndex+ccrs][crealIndex])))) { ncrs = ct.rows(cr.rowIndex+ccrs).cells(ncellIndex).rowSpan?ct.rows(cr.rowIndex+ccrs).cells(ncellIndex).rowSpan:1; nccs = ct.rows(cr.rowIndex+ccrs).cells(ncellIndex).colSpan?ct.rows(cr.rowIndex+ccrs).cells(ncellIndex).colSpan:1; // proceed only if current and next cell colspans are equal if (cccs == nccs) { // increase rowspan of current cell and append content of the next cell to current cd.innerHTML += ct.rows(cr.rowIndex+ccrs).cells(ncellIndex).innerHTML; ct.rows(cr.rowIndex+ccrs).deleteCell(ncellIndex); cd.rowSpan = ccrs+ncrs; } } } } this['psk_Editer'].focus(); } // merge tr // /* function SPAW_getParentTag(editor) { var trange = this[editor+'_rEdit'].document.selection.createRange(); if (window.frames[editor+'_rEdit'].document.selection.type != "Control") { return (trange.parentElement()); } else { return (trange(0)); } } // trim functions function SPAW_ltrim(txt) { var spacers = " \t\r\n"; while (spacers.indexOf(txt.charAt(0)) != -1) { txt = txt.substr(1); } return(txt); } function SPAW_rtrim(txt) { var spacers = " \t\r\n"; while (spacers.indexOf(txt.charAt(txt.length-1)) != -1) { txt = txt.substr(0,txt.length-1); } return(txt); } function SPAW_trim(txt) { return(SPAW_ltrim(SPAW_rtrim(txt))); } // is selected text a full tags inner html? function SPAW_isFoolTag(editor, el) { var trange = this[editor+'_rEdit'].document.selection.createRange(); var ttext; if (trange != null) ttext = SPAW_trim(trange.htmlText); if (ttext != SPAW_trim(el.innerHtml)) return false; else return true; } // switch to wysiwyg mode // switch to html mode function SPAW_getFieldByEditor(editor, field) { var thefield; // get field by editor name if no field passed if (field == null || field == "") { var flds = document.getElementsByName(editor); thefield = flds[0].id; } else { thefield=field; } return thefield; } function SPAW_getHtmlValue(editor, thefield) { var htmlvalue; if(document.all['SPAW_'+editor+'_editor_mode'].value == 'design') { // wysiwyg htmlvalue = this[editor+'_rEdit'].document.body.innerHTML; } else { // code htmlvalue = document.all[thefield].value; } return htmlvalue; } function SPAW_updateField(editor, field) { var thefield = SPAW_getFieldByEditor(editor, field); var htmlvalue = SPAW_getHtmlValue(editor, thefield); if (document.all[thefield].value != htmlvalue) { // something changed document.all[thefield].value = htmlvalue; } } function SPAW_confirm(editor,block,message) { return showModalDialog('/spaw/spaw/dialogs/confirm.php?lang=' + document.all['SPAW_'+editor+'_lang'].value + '&theme=' + document.all['SPAW_'+editor+'_theme'].value + '&block=' + block + '&message=' + message, null, 'dialogHeight:100px; dialogWidth:300px; resizable:no; status:no'); } // toggle borders worker function function SPAW_toggle_borders(editor, root, toggle) { // get toggle mode (on/off) var toggle_mode = toggle; if (toggle == null) { var tgl_borders = document.getElementById("SPAW_"+editor+"_borders"); if (tgl_borders != null) { toggle_mode = tgl_borders.value; } else { toggle_mode = "on" } } var tbls = new Array(); if (root.tagName == "TABLE") { tbls[0] = root; } else { // get all tables starting from root tbls = root.getElementsByTagName("TABLE"); } var tbln = 0; if (tbls != null) tbln = tbls.length; for (ti = 0; ti<tbln; ti++) { if ((tbls[ti].style.borderWidth == 0 || tbls[ti].style.borderWidth == "0px") && (tbls[ti].border == 0 || tbls[ti].border == "0px") && (toggle_mode == "on")) { tbls[ti].runtimeStyle.borderWidth = "1px"; tbls[ti].runtimeStyle.borderStyle = "dashed"; tbls[ti].runtimeStyle.borderColor = "#aaaaaa"; } // no border else { tbls[ti].runtimeStyle.borderWidth = ""; tbls[ti].runtimeStyle.borderStyle = ""; tbls[ti].runtimeStyle.borderColor = ""; } var cls = tbls[ti].cells; // loop through cells for (ci = 0; ci<cls.length; ci++) { if ((tbls[ti].style.borderWidth == 0 || tbls[ti].style.borderWidth == "0px") && (tbls[ti].border == 0 || tbls[ti].border == "0px") && (cls[ci].style.borderWidth == 0 || cls[ci].style.borderWidth == "0px") && (toggle_mode == "on")) { cls[ci].runtimeStyle.borderWidth = "1px"; cls[ci].runtimeStyle.borderStyle = "dashed"; cls[ci].runtimeStyle.borderColor = "#aaaaaa"; } else { cls[ci].runtimeStyle.borderWidth = ""; cls[ci].runtimeStyle.borderStyle = ""; cls[ci].runtimeStyle.borderColor = ""; } } // cells loop } // tables loop } // SPAW_toggle_borders // returns base toolbar image name function SPAW_base_image_name(ctrl) { var imgname = ctrl.src.substring(0,ctrl.src.lastIndexOf("/"))+"/tb_"+ctrl.id.substr(ctrl.id.lastIndexOf("_tb_")+4, ctrl.id.length); return imgname; } var spaw_context_html = ""; function SPAW_update_toolbar(editor, force) { window.frames[editor+'_rEdit'].focus(); var pt = SPAW_getParentTag(editor); if (pt) { if (pt.outerHTML == spaw_context_html && !force) { return; } else { spaw_context_html = pt.outerHTML; } } // button sets table_row_items = [ "table_row_insert", "table_row_delete" ]; table_cell_items = [ "table_cell_prop", "table_column_insert", "table_column_delete", "table_cell_merge_right", "table_cell_merge_down", "table_cell_split_horizontal", "table_cell_split_vertical" ]; table_obj_items = [ "table_prop" ]; img_obj_items = [ "image_prop" ]; standard_cmd_items = [ // command, control id ["cut", "cut"], ["copy", "copy"], ["paste", "paste"], ["undo", "undo"], ["redo", "redo"], ["bold", "bold"], ["italic", "italic"], ["underline", "underline"], ["justifyleft", "left"], ["justifycenter", "center"], ["justifyright", "right"], ["indent", "indent"], ["outdent", "unindent"], ["forecolor", "fore_color"], ["backcolor", "bg_color"], ["insertorderedlist", "ordered_list"], ["insertunorderedlist", "bulleted_list"], ["createlink", "hyperlink"], ["inserthorizontalrule","hr"] ]; togglable_items = [ // command, control id ["bold", "bold"], ["italic", "italic"], ["underline", "underline"], ["justifyleft", "left"], ["justifycenter", "center"], ["justifyright", "right"], ["insertorderedlist", "ordered_list"], ["insertunorderedlist", "bulleted_list"], ["createlink", "hyperlink"], ["inserthorizontalrule","hr"] ]; standard_dropdowns = [ // command, control id ["fontname", "font"], ["fontsize", "fontsize"], ["formatblock", "paragraph"] ]; // proceed only if active toolbar is enabled if (!spaw_active_toolbar) return; window.frames[editor+'_rEdit'].focus(); // get object references var eobj = window.frames[editor+'_rEdit']; // editor iframe var edoc = eobj.document; // editor docutment // enable image insert SPAW_toggle_tbi(editor,"image_insert", true); // enable table insert SPAW_toggle_tbi(editor,"table_create", true); // toggle table buttons // get table var ct = SPAW_getTable(editor); if (ct) { // table found // enable table properties SPAW_toggle_tb_items(editor,table_obj_items, true); // get table row var cr = SPAW_getTR(editor); if (cr) { // enable table row features SPAW_toggle_tb_items(editor,table_row_items, true); // get table cell var cd = SPAW_getTD(editor); if (cd) { // enable cell features SPAW_toggle_tb_items(editor,table_cell_items, true); } else { // disable cell features SPAW_toggle_tb_items(editor,table_cell_items, false); // disable image insert SPAW_toggle_tbi(editor,"image_insert", false); } } else { // disable table row and cell features SPAW_toggle_tb_items(editor,table_cell_items, false); SPAW_toggle_tb_items(editor,table_row_items, false); // disable image insert SPAW_toggle_tbi(editor,"image_insert", false); } } else { // disable all available table related buttons SPAW_toggle_tb_items(editor,table_obj_items, false); SPAW_toggle_tb_items(editor,table_row_items, false); SPAW_toggle_tb_items(editor,table_cell_items, false); } // end table buttons // image buttons // get image var im = SPAW_getImg(editor); if (im) { // enable image buttons SPAW_toggle_tb_items(editor,img_obj_items, true); // disable table insert SPAW_toggle_tbi(editor,"table_create", false); } else { // disable image buttons SPAW_toggle_tb_items(editor,img_obj_items, false); } // end image buttons // set state and enable/disable standard command buttons for (i=0; i<togglable_items.length; i++) { SPAW_toggle_tbi_state(editor, standard_cmd_items[i][1], edoc.queryCommandState(standard_cmd_items[i][0])); } for (i=0; i<standard_cmd_items.length; i++) { SPAW_toggle_tbi(editor, standard_cmd_items[i][1], edoc.queryCommandEnabled(standard_cmd_items[i][0])); } // set state of toggle borders button if (document.all["SPAW_"+editor+"_borders"].value == "on") { SPAW_toggle_tbi_state(editor, "toggle_borders", true); } else { SPAW_toggle_tbi_state(editor, "toggle_borders", false); } // dropdowns for (i=0; i<standard_dropdowns.length; i++) { SPAW_toggle_tbi_dropdown(editor, standard_dropdowns[i][1], edoc.queryCommandValue(standard_dropdowns[i][0])); } // style dropdown var pt = SPAW_getParentTag(editor); SPAW_toggle_tbi_dropdown(editor, "style", pt.className); } // enable/disable toolbar item function SPAW_toggle_tb_items(editor, items, enable) { for (i=0; i<items.length; i++) { SPAW_toggle_tbi(editor, items[i], enable); } } // enable/disable toolbar item function SPAW_toggle_tbi(editor, item, enable) { if (document.all["SPAW_"+editor+"_tb_"+item]) { var ctrl = document.all["SPAW_"+editor+"_tb_"+item]; if (enable) { if (ctrl) { eval("SPAW_"+document.all["SPAW_"+editor+"_theme"].value+"_bt_out(ctrl);"); } } else { if (ctrl) { eval("SPAW_"+document.all["SPAW_"+editor+"_theme"].value+"_bt_off(ctrl);"); } } } } // set state of the toolbar item function SPAW_toggle_tbi_state(editor, item, state) { if (document.all["SPAW_"+editor+"_tb_"+item]) { var ctrl = document.all["SPAW_"+editor+"_tb_"+item]; ctrl.setAttribute("spaw_state",state) eval("SPAW_"+document.all["SPAW_"+editor+"_theme"].value+"_bt_out(ctrl);"); } } // set dropdown value function SPAW_toggle_tbi_dropdown(editor, item, value) { if (document.all["SPAW_"+editor+"_tb_"+item]) { var ctrl = document.all["SPAW_"+editor+"_tb_"+item]; ctrl.options[0].selected = true; for (ii=0; ii<ctrl.options.length; ii++) { if (ctrl.options[ii].value == value) { ctrl.options[ii].selected = true; } else { ctrl.options[ii].selected = false; } } } } */ /* function SPAW_delete_click(editor, sender) { alert('delete'); window.frames['spaw1_rEdit'].focus(); this['spaw1_rEdit'].document.execCommand('delete', false, null); // SPAW_update_toolbar(editor, true); } */