// html editor ----------------------------------------------------------------- function htmlb_hed_refreshTableIds(table) { var rowId=0, colId=0; table.id = htmlb_hed_getUniqueId("htmlb_hed_tbl"); for(i=0; i 0 ){ obj = selectedRange.item(0); } break; case 'None': obj = selectedRange.parentElement(); break; } return obj; } function htmlb_hed_matchTag(editor, elem, tagName) { try { if (elem.tagName.search(tagName)!=-1){ return elem; } if (elem.tagName.toUpperCase()=='TABLE'){ return elem; } if (elem.tagName.toUpperCase()=='DIV'){ if (editor){ elem = editor.getElementsByTagName('TABLE'); if(elem.length>0) elem = elem[0]; }else{ elem = null; } return elem; } if(elem!=null) elem = elem.parentElement; return htmlb_hed_matchTag(editor, elem, tagName); } catch(ex) { return null; } } function htmlb_hed_doDeleteTableCol(editor, errorText) { htmlb_hed_stackForUndo(editor); objRef = htmlb_hed_getRangeRef(editor); if(null==objRef)return; objRef = htmlb_hed_matchTag(editor, objRef, '/^(TABLE)|^(TR)|^(TD)|^(TBODY)/'); if(null==objRef)return; switch(objRef.tagName) { case 'TD': var rowIndex = objRef.parentElement.rowIndex; var cellIndex = objRef.cellIndex; var parentTable = objRef.parentElement.parentElement.parentElement; var newTable = parentTable.cloneNode(true); if (1==newTable.rows[0].cells.length){ parentTable.removeNode(true); return; } for(x=0; x=newTable.rows[0].cells.length){ cellIndex=newTable.rows[0].cells.length-1; } if (rowIndex>=newTable.rows.length){ rowIndex=newTable.rows.length-1; } htmlb_hed_refreshTableIds(newTable); parentTable.outerHTML = newTable.outerHTML; htmlb_hed_toogle_table_border(newTable.id); if (cellIndex>=0&&rowIndex>=0){ var rg = editor.document.body.createTextRange(); var el = editor.document.getElementById(newTable.id+":"+rowIndex+'_'+cellIndex); if(el){ rg.moveToElementText(el); rg.moveStart('character',rg.text.length); rg.select(); } } break; default: alert(errorText); } } function htmlb_hed_doInsertTableRow(editor, errorText) { htmlb_hed_stackForUndo(editor); objRef = htmlb_hed_getRangeRef(editor); if(objRef==null){ alert(errorText); return; } objRef = htmlb_hed_matchTag(editor, objRef, '/^(TABLE)|^(TR)|^(TD)|^(TBODY)/'); if(objRef==null){ alert(errorText); return; } switch(objRef.tagName) { case 'TD': var parentRow = objRef.parentElement; var rowIndex = parentRow.rowIndex; var cellIndex = objRef.cellIndex; var parentTable = objRef.parentElement.parentElement.parentElement; var newTable = parentTable.cloneNode(true); var newRow = newTable.insertRow(rowIndex+1); var style = objRef.className; for(x=0; x< newTable.rows[0].cells.length; x++) { var newCell = newRow.insertCell(); if (style!=""){ newCell.className=style; } } htmlb_hed_refreshTableIds(newTable); parentTable.outerHTML = newTable.outerHTML; htmlb_hed_toogle_table_border(newTable.id); var rg = editor.document.body.createTextRange(); var el = editor.document.getElementById(newTable.id+":"+rowIndex+'_'+cellIndex); if(el){ rg.moveToElementText(el); rg.moveStart('character',rg.text.length); rg.select(); } break; case 'TR': var rowIndex = objRef.rowIndex; var parentTable = objRef.parentElement.parentElement; var newTable = parentTable.cloneNode(true); var newRow = newTable.insertRow(rowIndex+1); for(x=0; x< newTable.rows[0].cells.length; x++) { var newCell = newRow.insertCell(); } htmlb_hed_refreshTableIds(newTable); parentTable.outerHTML = newTable.outerHTML; htmlb_hed_toogle_table_border(newTable.id); break; case 'TABLE': var newTable = objRef.cloneNode(true); var newRow = newTable.insertRow(); for(x=0; x=parentTable.rows.length) { rowIndex=parentTable.rows.length-1; } htmlb_hed_refreshTableIds(parentTable); if (rowIndex>=0) { var rg = editor.document.body.createTextRange(); var el = editor.document.getElementById(parentTable.id+":"+rowIndex+'_'+cellIndex); if(el){ rg.moveToElementText(el); rg.moveStart('character',rg.text.length); rg.select(); } } else { parentTable.removeNode(true); } break; case 'TR': var rowIndex = objRef.rowIndex; var parentTable = objRef.parentElement.parentElement; parentTable.deleteRow(rowIndex); htmlb_hed_refreshTableIds(parentTable); break; default: alert(errorText); } } function htmlb_hed_doInsertTableCol(editor, errorText) { htmlb_hed_stackForUndo(editor); objRef = htmlb_hed_getRangeRef(editor); if(objRef==null){ alert(errorText); return; } objRef = htmlb_hed_matchTag(editor, objRef, '/^(TABLE)|^(TR)|^(TD)|^(TBODY)/'); if(objRef==null){ alert(errorText); return; } switch(objRef.tagName) { case 'TABLE': var newTable=objRef.cloneNode(true); for(x=0; x 0 ){ selectedRange = selectedRange.item(0); selectedRange.runtimeStyle.backgroundColor=sColor; selectedRange.style.backgroundColor=sColor; for(i=0; i"; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += "
"; sSizerHtml += ""; if(bInsertMode){ sSizerHtml += ""; sSizerHtml += txtMap["TXT_HTMLB_HED_TITLE_INS_TB"]; sSizerHtml += ""; }else{ sSizerHtml += ""; sSizerHtml += txtMap["TXT_HTMLB_HED_TITLE_MOD_TB"]; sSizerHtml += ""; } sSizerHtml += "
"; sSizerHtml += "
"; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; if(bInsertMode){ sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; } sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += "
 
"; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += "
"; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += "
"; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; /*if(bInsertMode){ sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; }*/ sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += "
=0){ modWidthUnit=1; modWidth=table.width.substring(0, unitIndx); }else{ modWidthUnit=2; modWidth=table.width; } modCellSpace=table.cellSpacing; modCellPad=table.cellPadding; modBorder=table.border; switch(table.align){ case 'left': modAlign=1; break; case 'center': modAlign=2; break; case 'right': modAlign=3; break; default: modAlign=0; } if(!modSaved){//cancel modSaved=true; modWidthSaved=table.width; if(modWidthUnit==1)modWidthUnitSaved="%"; else modWidthUnitSaved=""; modCellSpaceSaved=modCellSpace; modCellPadSaved=modCellPad; modBorderSaved=modBorder; modAlignSaved=table.align; } } } sSizerHtml += modWidth; sSizerHtml += "\" id=\"htmlb_hed_width\" onChange=\"me.htmlb_hed_tablesizer_val(this);return false;\" onBlur=\"me.htmlb_hed_tablesizer_val(this);return false;\"> "; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += "
"; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += "
"; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += "
"; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += "
 
"; if(bInsertMode){ sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += txtMap["TXT_HTMLB_HED_OK"]; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += " "; sSizerHtml += ""; sSizerHtml += txtMap["TXT_HTMLB_HED_CANCEL"]; sSizerHtml += ""; sSizerHtml += "
"; }else{ sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += txtMap["TXT_HTMLB_HED_OK"]; sSizerHtml += ""; sSizerHtml += "
"; sSizerHtml += ""; sSizerHtml += txtMap["TXT_HTMLB_HED_APPLY"]; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += txtMap["TXT_HTMLB_HED_CANCEL"]; sSizerHtml += ""; sSizerHtml += "
"; } sSizerHtml += "
"; sSizerHtml += "
"; sSizerHtml += "
"; sSizerHtml += "
"; oPopup.innerHTML=sSizerHtml; return oPopup; } function htmlb_hed_tablesizer_val(input){ if (!input) return true; var obj = new Object; obj.id = input.id; obj.formelement = input; obj.getValue = _htmlbjsgetValue; obj.setValue = _htmlbjssetValue; obj.getChecked = _htmlbjsgetChecked; obj.getEnable = _htmlbjsgetEnable; obj.setEnable = _htmlbjssetEnable; obj.selectFocus = _htmlbjsselectfocus; obj.setErrorText = _htmlbInputFieldSetErrorText; if(!checkLength(obj,3)) e="Allowed maximal number of characters is 3"; else if(!checkInteger(obj,"P,","","")||input.value=="") e="Specify an integer value"; else e=null; obj.setErrorText(e); if (e){ input.className="urEdfiTxtEnbl"; return false; } else{ input.className="urEdfTxtEnbl"; return true; } } htmlb_hed_txt=new Array(); function htmlb_hed_addTexts(lang, texts) { if(htmlb_hed_txt[lang]) { for ( var i in texts) { if(!htmlb_hed_txt[lang][i]) { htmlb_hed_txt[lang][i] = texts[i]; } } } else { htmlb_hed_txt[lang] = texts; } } function htmlb_hed_specialChar_select(sId, specChar){ hidePopupMenu(); var editor = document.getElementById(sId); if (editRange!=null&&editRange.parentElement()!=null){ var _char = '&'+specChar; editRange.pasteHTML(_char); editor.focus(); } } function htmlb_hed_makeSpecialCharDialog(sId){ var oPopup = document.getElementById("htmlb_hed_specChar_popup"); if (!oPopup) { var oBody = document.getElementsByTagName("BODY")[0]; var editor = document.getElementById(sId); editor._offsetY=editor.scrollTop; editor._offsetX=editor.scrollLeft; oPopup = document.createElement("SPAN"); oPopup.id="htmlb_hed_specChar_popup"; oPopup.style.position="absolute"; oPopup.style.left="-1999px"; oPopup.style.top="-1999px"; oBody.appendChild(oPopup); setTimeout("htmlb_hed_adapt_offset('"+editor.id+"')", 50); } var txtMap = htmlb_hed_txt[ur_language]; var specials = new Array('cent;','euro;','pound;','yen;','curren;','deg;','copy;','reg;','trade;','nbsp;','mdash;','bull;','para;','sect;','dagger;','Dagger;','laquo;','raquo;','sum;','Delta;','asymp;','ne;','le;','ge;','plusmn;','times;','divide;','frac14;','frac12;','frac34;','permil;','isin;','middot;','hellip;','hArr;','rArr;','loz;','uarr;','darr;','larr;','harr;','rarr;'); var i=0; var sCharsHtml = ""; sCharsHtml += ""; sCharsHtml += ""; sCharsHtml += "
"; sCharsHtml += txtMap["TXT_HTMLB_HED_INS_SC"]; sCharsHtml += "
"; sCharsHtml += ""; sCharsHtml += ""; sCharsHtml += ""; sCharsHtml += "
"; sCharsHtml += ""; sCharsHtml += ""; sCharsHtml += ""; sCharsHtml += ""; sCharsHtml += ""; sCharsHtml += ""; sCharsHtml += ""; sCharsHtml += ""; sCharsHtml += ""; sCharsHtml += ""; sCharsHtml += ""; sCharsHtml += ""; sCharsHtml += ""; sCharsHtml += ""; sCharsHtml += ""; sCharsHtml += ""; sCharsHtml += ""; sCharsHtml += ""; sCharsHtml += ""; sCharsHtml += ""; sCharsHtml += ""; sCharsHtml += ""; sCharsHtml += ""; sCharsHtml += ""; sCharsHtml += ""; sCharsHtml += ""; sCharsHtml += ""; sCharsHtml += ""; sCharsHtml += ""; sCharsHtml += ""; sCharsHtml += ""; sCharsHtml += ""; sCharsHtml += ""; sCharsHtml += ""; sCharsHtml += ""; sCharsHtml += ""; sCharsHtml += ""; sCharsHtml += ""; sCharsHtml += ""; sCharsHtml += ""; sCharsHtml += ""; sCharsHtml += ""; sCharsHtml += ""; sCharsHtml += ""; sCharsHtml += ""; sCharsHtml += ""; sCharsHtml += ""; sCharsHtml += ""; sCharsHtml += ""; sCharsHtml += ""; sCharsHtml += ""; sCharsHtml += ""; sCharsHtml += ""; sCharsHtml += ""; sCharsHtml += ""; sCharsHtml += ""; sCharsHtml += ""; sCharsHtml += ""; sCharsHtml += ""; sCharsHtml += ""; sCharsHtml += ""; sCharsHtml += "
¢£¥¤°
©® 
§«»
Δ
±×÷¼½¾
·
"; sCharsHtml += ""; sCharsHtml += ""; sCharsHtml += txtMap["TXT_HTMLB_HED_CANCEL"]; sCharsHtml += ""; sCharsHtml += "
"; sCharsHtml += "
"; oPopup.innerHTML=sCharsHtml; return oPopup; } function htmlb_hed_insertDateAndTime(editor) { editor.focus(); var d = new Date(); var dateString = sapCal_makeDateString(gDateformat, d.getUTCFullYear(), d.getMonth(), d.getDate()); dateString += " "; dateString += d.toLocaleTimeString(); sel=editor.document.selection.createRange(); sel.pasteHTML(dateString); } function htmlb_hed_showPrintPreview(id) { save(id); myId = id; var editor=document.getElementById(id + "htmlbeditor"); var screenSize=document.getElementById(id + "_SCREEN"); if(screenSize!=null){ var sw, sh, features; switch (screenSize.value){ /*400x300, 640x480, 800x600, 1024x768*/ case '1': sh=300;sw=400;break; case '2': sht=480;sw=640;break; case '3': sh=600;sw=800;break; case '4': sh=768;sw=1024;break; default: sh=600;sw=800; } features="resizable=yes,scrollbars=yes,width="+sw+",height="+sh; mywindow = window.open(document.getElementById('htmlbJavaScriptPath').value + 'prev_htmlbedit.html','_blank',features); }else{ mywindow = window.open(document.getElementById('htmlbJavaScriptPath').value + 'prev_htmlbedit.html','_blank','resizable=yes,scrollbars=yes'); } window.setTimeout("htmlb_hed_printpreview_setContent()",50); } function htmlb_hed_printpreview_setContent() { var x = document.getElementById(myId + "htmlbeditor"); if(x!=null) { try { mywindow.document.createStyleSheet(ur_system.stylepath+"ur_"+ur_system.browser_abbrev+".css"); var content = ''; content += x.innerHTML; content += '__Browser.ExecWB(7, 1);__Browser.outerHTML = "";'; mywindow.document.write(content); mywindow.document.close(); mywindow.close(); } catch(e) { } } } function htmlb_hed_doInsertTextStylePopup(sId, control){ try { var editor = document.getElementById(sId + "htmlbeditor"); var o=control.document.parentWindow.event; var oPopupContent=htmlb_hed_makeTextStyleSelectPopup(editor.id); var arrUrls = new Array(ur_system.stylepath+"ur_"+ur_system.browser_abbrev+".css"); var oPopup = new sapPopup(window,arrUrls,oPopupContent,control,o,0); oPopup.show = htmlb_hed_Popup_show oPopup.onblur = hidePopupMenu; window.onfocus = hidePopupMenu; oPopup.show(true); } catch(ex){ alert(ex); } } htmlb_hed_ur_text_styles=new Array(); htmlb_hed_ur_text_kstyles=new Array(); function htmlb_hed_addUrTextStyles(texts) { for ( var i in texts) { if(!htmlb_hed_ur_text_styles[i]){ htmlb_hed_ur_text_styles[i] = texts[i]; } } htmlb_hed_ur_text_kstyles = new Array('urTxtH1','urTxtH2','urTxtH3','urTxtH4','urTxtStd','urTxtEmph','urTxtMono','urTxtLeg','urTxtRef'); } function htmlb_hed_hasStyle(style){ for (j=0; j"; var urStyleMap = htmlb_hed_ur_text_styles; this.selId=10; for (j=0; j<9; j++){ sCharsHtml += ""; if (selectedIndex>=0){ if (j==selectedIndex) { sCharsHtml += ""; sCharsHtml += ""; sCharsHtml += " "; sCharsHtml += ""; } sCharsHtml += ""; oPopup.innerHTML=sCharsHtml; return oPopup; } function htmlb_hed_MnuToggle(mywindow){ mywindow.className = "urMnuRowOn"; } function htmlb_hed_MnuToggleOut(mywindow){ mywindow.className= "urMnuRowOff"; mywindow.borderColor=""; } function htmlb_hed_Popup_show_nofocus(bDoNotAutoFocus) { this.poscalc(); if (this.onbeforerender) { if (!this.onbeforerender(this)) return; } if (!this.canrender) { showError("Cannot render Popup. Sizes and positions are not set."); return; } if (this.frame.window.mylevel==null) { this.write(bDoNotAutoFocus); } else { this.frame.window.document.getElementsByTagName("DIV").item(0).innerHTML=this.content.html; } if (bDoNotAutoFocus) { } else { //this.frame.window.document.body.focus(); } if (ur_system.direction=="rtl") this.frame.object.style.right = this.position.right+"px"; else this.frame.object.style.left = this.position.left+"px"; this.frame.object.style.top = this.position.top+"px"; this.frame.object.style.width = this.size.width+"px"; this.frame.object.style.height = this.size.height+"px"; return true; } function htmlb_hed_Popup_show(bDoNotAutoFocus) { var sourceoffset = getAbsolutePosition(this.source.object); this.position.left = sourceoffset.left; this.position.top = sourceoffset.top; this.positionbehavior = sapPopupPositionBehavior.EVENT; this.poscalc(); this.position.left = sourceoffset.left+1; this.position.top = sourceoffset.top+20; if (this.onbeforerender) { if (!this.onbeforerender(this)) return; } if (!this.canrender) { showError("Cannot render Popup. Sizes and positions are not set."); return; } if (this.frame.window.mylevel==null) { this.write(bDoNotAutoFocus); } else { this.frame.window.document.getElementsByTagName("DIV").item(0).innerHTML=this.content.html; } if (bDoNotAutoFocus) { } else { //this.frame.window.document.body.focus(); } if (ur_system.direction=="rtl") this.frame.object.style.right = this.position.right+"px"; else this.frame.object.style.left = this.position.left+"px"; this.frame.object.style.top = this.position.top+"px"; this.frame.object.style.width = this.size.width+"px"; this.frame.object.style.height = this.size.height+"px"; return true; } function htmlb_hed_doInsertTextSizePopup(sId, control){ try { var editor = document.getElementById(sId + "htmlbeditor"); var o=control.document.parentWindow.event; var oPopupContent=htmlb_hed_makeStyleSizeSelectPopup(editor.id); var arrUrls = new Array(ur_system.stylepath+"ur_"+ur_system.browser_abbrev+".css"); var oPopup = new sapPopup(window,arrUrls,oPopupContent,control,o,0); oPopup.show = htmlb_hed_Popup_show oPopup.onblur = hidePopupMenu; window.onfocus = hidePopupMenu; oPopup.show(true); } catch(ex){ alert(ex); } } htmlb_hed_ur_text_sizes=new Array(); function htmlb_hed_addTextSizes(texts) { for ( var i in texts) { if(!htmlb_hed_ur_text_sizes[i]){ htmlb_hed_ur_text_sizes[i] = texts[i]; } } } function htmlb_hed_makeStyleSizeSelectPopup(sId){ var txtMap = htmlb_hed_txt[ur_language]; htmlb_hed_addTextSizes({1:txtMap["TXT_HTMLB_XXSMALL"],2:txtMap["TXT_HTMLB_XSMALL"],3:txtMap["TXT_HTMLB_SMALL"],4:txtMap["TXT_HTMLB_MEDIUM"],5:txtMap["TXT_HTMLB_LARGE"],6:txtMap["TXT_HTMLB_XLARGE"],7:txtMap["TXT_HTMLB_XXLARGE"]}); var editor = document.getElementById(sId); var selectedIndex=-1; var oPopup = document.getElementById("htmlb_hed_selectStyleSize_popup"); if (!oPopup) { var oBody = document.getElementsByTagName("BODY")[0]; var editor = document.getElementById(sId); editor._offsetY=editor.scrollTop; editor._offsetX=editor.scrollLeft; oPopup = document.createElement("SPAN"); oPopup.id="htmlb_hed_selectStyleSize_popup"; oPopup.style.position="absolute"; oPopup.style.left="-1999px"; oPopup.style.top="-1999px"; oBody.appendChild(oPopup); setTimeout("htmlb_hed_adapt_offset('"+editor.id+"')", 50); } if (editRange!=null){ var fontsize = editRange.queryCommandValue('FontSize'); if (fontsize != null) { selectedIndex=fontsize; }/*else{ var fontTag = htmlb_hed_matchTag(editor, editRange.parentElement(), "^FONT"); if (fontTag&&fontTag.tagName=="FONT"){ selectedIndex = fontTag.size; } }*/ } var sCharsHtml = ""; var urSizeMap = htmlb_hed_ur_text_sizes; this.selId=10; for (j=1; j<8; j++){ sCharsHtml += ""; if (selectedIndex>=0){ if (j==selectedIndex) { sCharsHtml += ""; } sCharsHtml += "
"; sCharsHtml += ""; sCharsHtml += ""; sCharsHtml += " "; sCharsHtml += ""; sCharsHtml += "
"; oPopup.innerHTML=sCharsHtml; return oPopup; } function htmlb_hed_MnuToggleClickTextStyle(sId, span){ var editor = document.getElementById(sId); editor._offsetY=editor.scrollTop; editor._offsetX=editor.scrollLeft; hidePopupMenu(); htmlb_hed_stackForUndo(editor); var style = span.firstChild.className; var parentStyle=""; if (editRange!=null&&editRange.text!=""&&editRange.parentElement()!=null){ editRange.execCommand('RemoveFormat'); document.createStyleSheet(ur_system.stylepath+"ur_"+ur_system.browser_abbrev+".css"); var _content = editRange.htmlText; if (_content.indexOf("0){ _content = editRange.text; }else{ _content = _content.replace(/class[\s]*=[\s]*['"]*[\w]+['"]*/g, ''); _content = _content.replace(/style[\s]*=[\s]*['"]*[^'"]+['"]*/g, ''); } var pasteStr = ""; pasteStr += _content; pasteStr += ""; editRange.pasteHTML(pasteStr); }else{ var pasteStr = " "; pasteStr += ""; editRange.pasteHTML(pasteStr); } setTimeout("htmlb_hed_adapt_offset('"+editor.id+"')", 50); } function htmlb_hed_doInsertTextForegroundColorPopup(sId, control){ try { var editor = document.getElementById(sId + "htmlbeditor"); var o=control.document.parentWindow.event; var oPopupContent=htmlb_hed_makeTextColorPopup(editor.id); var arrUrls = new Array(ur_system.stylepath+"ur_"+ur_system.browser_abbrev+".css"); var oPopup = new sapPopup(window,arrUrls,oPopupContent,control,o,0); //oPopup.show = htmlb_hed_Popup_show oPopup.onblur = htmlb_hed_hidePopupMenu; window.onfocus = htmlb_hed_hidePopupMenu; oPopup.show(true); } catch(ex){ alert(ex); } } function htmlb_hed_doInsertTextBackgroundColorPopup(sId, control, browserCentric, colorRangeId, tableCellId){ try { var editor = document.getElementById(sId + "htmlbeditor"); var oPopup; var oPopupContent=htmlb_hed_makeBackgroundColorPopup(editor.id, colorRangeId, tableCellId); var arrUrls = new Array(ur_system.stylepath+"ur_"+ur_system.browser_abbrev+".css"); if (browserCentric){ oPopup = new sapPopup(window,arrUrls,oPopupContent,editor,window.event,1); oPopup.positionbehavior = sapPopupPositionBehavior.BROWSERCENTER; }else{ oPopup = new sapPopup(window,arrUrls,oPopupContent,control,control.document.parentWindow.event,0); } oPopup.onblur = htmlb_hed_hidePopupMenu; window.onfocus = htmlb_hed_hidePopupMenu; oPopup.show(true); } catch(ex){ alert(ex); } } htmlb_hed_ur_bkcolors = new Array('urSTWhlTrans','urSTbvCellCritLight','urSTbvCellCritMedium','urSTbvCellCritDark','urSTbvCellBadLight','urSTbvCellBadMedium','urSTbvCellBadDark','urSTbvCellNeg','urCellBgPlain','urSTbvCellSubtotLight','urSTbvCellSubtot','urSTbvCellTot','urSTbvCellGoodLight','urSTbvCellGoodMedium','urSTbvCellGoodDark','urSTbvCellPos','urRIValueUnrated','urCellBgFill2','urGrpBdyWeb1','urCellBgFill1','urPrInNeutral','urVwsRowSel','urCellBgBorder','urSTbvCellAlt','urCellBgFill3','urSTbvCellGrpLvl3','urSTbvCellGrpLvl2','urSTbvCellGrpLvl1','urCellBgHeader','urSTbvCellKeyMedium','urSTbvCellGrpHL','urSTbvCellGrpHLLight'); function htmlb_hed_hasBackgroundColor(color){ for (j=0; jBackground Color
"; sCharsHtml += ""; sCharsHtml += ""; sCharsHtml += ""; sCharsHtml += "
"; sCharsHtml += ""; sCharsHtml += ""; sCharsHtml += ""; if (counter++ == index) style = styleS; else style = styleN; sCharsHtml += ""; if (counter++ == index) style = styleS; else style = styleN; sCharsHtml += ""; if (counter++ == index) style = styleS; else style = styleN; sCharsHtml += ""; if (counter++ == index) style = styleS; else style = styleN; sCharsHtml += ""; if (counter++ == index) style = styleS; else style = styleN; sCharsHtml += ""; if (counter++ == index) style = styleS; else style = styleN; sCharsHtml += ""; if (counter++ == index) style = styleS; else style = styleN; sCharsHtml += ""; if (counter++ == index) style = styleS; else style = styleN; sCharsHtml += ""; sCharsHtml += ""; sCharsHtml += ""; if (counter++ == index) style = styleS; else style = styleN; sCharsHtml += ""; if (counter++ == index) style = styleS; else style = styleN; sCharsHtml += ""; if (counter++ == index) style = styleS; else style = styleN; sCharsHtml += ""; if (counter++ == index) style = styleS; else style = styleN; sCharsHtml += ""; if (counter++ == index) style = styleS; else style = styleN; sCharsHtml += ""; if (counter++ == index) style = styleS; else style = styleN; sCharsHtml += ""; if (counter++ == index) style = styleS; else style = styleN; sCharsHtml += ""; if (counter++ == index) style = styleS; else style = styleN; sCharsHtml += ""; sCharsHtml += ""; sCharsHtml += ""; if (counter++ == index) style = styleS; else style = styleN; sCharsHtml += ""; if (counter++ == index) style = styleS; else style = styleN; sCharsHtml += ""; if (counter++ == index) style = styleS; else style = styleN; sCharsHtml += ""; if (counter++ == index) style = styleS; else style = styleN; sCharsHtml += ""; if (counter++ == index) style = styleS; else style = styleN; sCharsHtml += ""; if (counter++ == index) style = styleS; else style = styleN; sCharsHtml += ""; if (counter++ == index) style = styleS; else style = styleN; sCharsHtml += ""; if (counter++ == index) style = styleS; else style = styleN; sCharsHtml += ""; sCharsHtml += ""; sCharsHtml += ""; if (counter++ == index) style = styleS; else style = styleN; sCharsHtml += ""; if (counter++ == index) style = styleS; else style = styleN; sCharsHtml += ""; if (counter++ == index) style = styleS; else style = styleN; sCharsHtml += ""; if (counter++ == index) style = styleS; else style = styleN; sCharsHtml += ""; if (counter++ == index) style = styleS; else style = styleN; sCharsHtml += ""; if (counter++ == index) style = styleS; else style = styleN; sCharsHtml += ""; if (counter++ == index) style = styleS; else style = styleN; sCharsHtml += ""; if (counter++ == index) style = styleS; else style = styleN; sCharsHtml += ""; sCharsHtml += ""; sCharsHtml += ""; sCharsHtml += ""; sCharsHtml += ""; sCharsHtml += "
        
        
        
        
"; sCharsHtml += ""; sCharsHtml += ""; sCharsHtml += txtMap["TXT_HTMLB_HED_CANCEL"]; sCharsHtml += ""; sCharsHtml += "
"; sCharsHtml += "
"; sCharsHtml += ""; oPopup.innerHTML=sCharsHtml; return oPopup; } function htmlb_hed_colorSelect_cancel(popup){ hidePopupMenu(); } htmlb_hed_ur_txcolors = new Array('#ffffff','#dddddd','#c0c0c0','#969696','#808080','#646464','#4b4b4b','#242424','#000000','#00ffff','#00ccff','#0099cc','#00cc99','#009966','#009900','#00cc00','#00ff00','#00ff66','#99ffff','#99ccff','#9999cc','#99cc99','#999966','#999900','#99cc00','#99ff00','#99ff66','#ccffff','#ffccff','#ff99cc','#ffcc99','#ff9966','#ff9900','#ffcc00','#ffff00','#ffff66','#ff66ff','#ff33ff','#ff00cc','#ff3399','#ff0066','#ff0000','#ff3300','#ff6600','#ff6666','#9966ff','#9933ff','#9900cc','#993399','#990066','#990000','#993300','#996600','#996666','#0066ff','#0033ff','#0000cc','#003399','#000066','#330033','#003300','#006600','#006666'); function htmlb_hed_hasTextColor(color){ for (j=0; j "; } function htmlb_hed_makeTextColorPopup(sId){ var oPopup = document.getElementById("htmlb_hed_selTextColor_popup"); if (!oPopup) { var oBody = document.getElementsByTagName("BODY")[0]; var editor = document.getElementById(sId); editor._offsetY=editor.scrollTop ; editor._offsetX=editor.scrollLeft; oPopup = document.createElement("SPAN"); oPopup.id="htmlb_hed_selTextColor_popup"; oPopup.style.position="absolute"; oPopup.style.left="-1999px"; oPopup.style.top="-1999px"; oBody.appendChild(oPopup); setTimeout("htmlb_hed_adapt_offset('"+editor.id+"')", 50); } var txtMap = htmlb_hed_txt[ur_language]; var index = -1, counter = 0; if (editRange!=null) { var pElement; if (editRange.length) { pElement = editRange[0]; }else{ pElement = editRange.parentElement(); } while (pElement && pElement.tagName == "FONT" && (index = htmlb_hed_hasTextColor(pElement.color)) == -1){ pElement = pElement.parentElement; } } var styleS = "width:100%;border-width:2px!important;background-color:"; var styleN = "width:100%;background-color:"; var sCharsHtml = ""; sCharsHtml += ""; sCharsHtml += ""; sCharsHtml += "
Text Color
"; sCharsHtml += ""; sCharsHtml += ""; sCharsHtml += "
"; sCharsHtml += ""; sCharsHtml += ""; sCharsHtml += ""; for (i=0;i<9;i++) sCharsHtml += htmlb_hed_makeTextColorPopupCell(sCharsHtml, counter++, index, sId); sCharsHtml += ""; sCharsHtml += ""; for (i=0;i<9;i++) sCharsHtml += htmlb_hed_makeTextColorPopupCell(sCharsHtml, counter++, index, sId); sCharsHtml += ""; sCharsHtml += ""; for (i=0;i<9;i++) sCharsHtml += htmlb_hed_makeTextColorPopupCell(sCharsHtml, counter++, index, sId); sCharsHtml += ""; sCharsHtml += ""; for (i=0;i<9;i++) sCharsHtml += htmlb_hed_makeTextColorPopupCell(sCharsHtml, counter++, index, sId); sCharsHtml += ""; sCharsHtml += ""; for (i=0;i<9;i++) sCharsHtml += htmlb_hed_makeTextColorPopupCell(sCharsHtml, counter++, index, sId); sCharsHtml += ""; sCharsHtml += ""; for (i=0;i<9;i++) sCharsHtml += htmlb_hed_makeTextColorPopupCell(sCharsHtml, counter++, index, sId); sCharsHtml += ""; sCharsHtml += ""; for (i=0;i<9;i++) sCharsHtml += htmlb_hed_makeTextColorPopupCell(sCharsHtml, counter++, index, sId); sCharsHtml += ""; sCharsHtml += ""; sCharsHtml += ""; sCharsHtml += ""; sCharsHtml += "
"; sCharsHtml += ""; sCharsHtml += ""; sCharsHtml += txtMap["TXT_HTMLB_HED_CANCEL"]; sCharsHtml += ""; sCharsHtml += "
"; sCharsHtml += "
"; sCharsHtml += "
"; oPopup.innerHTML=sCharsHtml; return oPopup; } function htmlb_hed_txcolor_val_click(aref, sId){ var editor = document.getElementById(sId); hidePopupMenu(); htmlb_hed_stackForUndo(editor); if (editRange!=null&&editRange.parentElement()!=null){ var color=aref.title; var pasteStr; if (editRange.text!=""){ editRange.execCommand('ForeColor', false, color); node = editRange.parentElement(); htmlb_hed_adaptSpanElemColor(node, color); }else{ /*var p = editRange.parentElement(); var span = editor.document.createElement('SPAN'); span.style.color = color; editor.document.appendChild(span);*/ pasteStr = " "; pasteStr += ""; editRange.pasteHTML(pasteStr); } } } function htmlb_hed_bkcolor_val_click(aref, sId, tableCellId){ var style=aref.className; style=style.replace(/urBtnStd/,""); if (tableCellId != "" && tableCellId != "undefined"){ hidePopupMenu(); ghtmlb_hed_stack_colorRange = style; var oPopupContent=htmlb_hed_makeTableCellPropDialog(tableCellId, false, sId); var arrUrls = new Array(ur_system.stylepath+"ur_"+ur_system.browser_abbrev+".css"); var oPopup = new sapPopup(window,arrUrls,oPopupContent,document.getElementById(sId),window.event,0); oPopup.positionbehavior = sapPopupPositionBehavior.BROWSERCENTER; oPopup.onblur = hidePopupMenu; oPopup.show = htmlb_hed_Popup_show_nofocus; window.onfocus = hidePopupMenu; oPopup.show(true); return false; } var editor = document.getElementById(sId); editor._offsetY=editor.scrollTop; editor._offsetX=editor.scrollLeft; htmlb_hed_hidePopupMenu(); htmlb_hed_stackForUndo(editor); if (editRange!=null&&editRange.parentElement()!=null){ var pasteStr; document.createStyleSheet(ur_system.stylepath+"ur_"+ur_system.browser_abbrev+".css"); if (editRange.text!=""){ var cutoff=editRange.htmlText, _token; for (ii=0;ii"; pasteStr += cutoff; pasteStr += ""; editRange.pasteHTML(pasteStr); }else{ pasteStr = " "; pasteStr += ""; editRange.pasteHTML(pasteStr); } } setTimeout("htmlb_hed_adapt_offset('"+editor.id+"')", 50); } function htmlb_hed_MnuToggleClickTextSize(sId, size, sizeToken){ var sizeAttr = new Array("xx-small","x-small","small","medium","large","x-large","xx-large"); var editor = document.getElementById(sId); hidePopupMenu(); htmlb_hed_stackForUndo(editor); if (editRange!=null&&editRange.text!=""){ editRange.execCommand('RemoveFormat'); editRange.execCommand('FontSize',0,size); var _content = editRange.htmlText; var _regEx = /class[\s]*=[\s]*['"]*[^'"]+['"]*/g var _result = _regEx.exec(_content); var pasteStr = ""; pasteStr += _content; pasteStr += ""; var _result=""; if (_content.search("SPAN")!=-1){ var myArray = _content.split(/ "; pasteStr += ""; editRange.pasteHTML(pasteStr); } } htmlb_hed_editor_sizes=new Array(); function htmlb_hed_expPanel_onclick(image, id){ var idStr=id + "htmlbeditor"; var editor = document.getElementById(id + "htmlbeditor"); if (image.className == "urLnkBarScrlRight urSTbvCellGrpLvl3"){ image.className = "urLnkBarScrlLeft urSTbvCellGrpLvl3"; htmlb_hed_editor_hsize = editor.parentElement.parentElement.parentElement.parentElement.offsetWidth; editor.parentElement.parentElement.parentElement.parentElement.style.pixelWidth = document.body.clientWidth-40; }else{ image.className = "urLnkBarScrlRight urSTbvCellGrpLvl3"; editor.parentElement.parentElement.parentElement.parentElement.style.pixelWidth = htmlb_hed_editor_hsize; } } function htmlb_hed_doModTableStyle(editor, sColor, errorText){ try { editor.focus(); var objRef=null; var selectedRange; var selType = editor.document.selection.type; selectedRange = editor.document.selection.createRange(); if (selType=='Control'){ if (selectedRange.length > 0 ){ selectedRange = selectedRange.item(0); selectedRange.className=sColor; for(i=0; i"; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += "
"; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += txtMap["TXT_HTMLB_HED_MOD_CELL"]; sSizerHtml += ""; sSizerHtml += "
"; sSizerHtml += "
"; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += "
 
"; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += "
=0){ modWidthUnit=1; modWidth=cell.width.substring(0, unitIndx); }else{ modWidthUnit=2; modWidth=cell.width; } }else{ modWidthUnit=1; modWidth=""; } // padding... if (cell.style.paddingTop != ""){ modPadTop=cell.style.paddingTop; }else{ modPadTop=cell.currentStyle.paddingTop; } modPadTop=modPadTop.replace("px", ""); if (cell.style.paddingRight != ""){ modPadRight=cell.style.paddingRight; }else{ modPadRight=cell.currentStyle.paddingRight; } modPadRight=modPadRight.replace("px", ""); if (cell.style.paddingBottom != ""){ modPadBottom=cell.style.paddingBottom; }else{ modPadBottom=cell.currentStyle.paddingBottom; } modPadBottom=modPadBottom.replace("px", ""); if (cell.style.paddingLeft != ""){ modPadLeft=cell.style.paddingLeft; }else{ modPadLeft=cell.currentStyle.paddingLeft; } modPadLeft=modPadLeft.replace("px", ""); // align... var _hal, _val; if (cell.align != ""){ _hal = cell.align; }else{ _hal = cell.currentStyle.textAlign; } switch(_hal){ case 'center': modHAlign=1; break; case 'left': modHAlign=2; break; case 'right': modHAlign=3; break; default: modHAlign=0; } if (cell.vAlign != ""){ _val = cell.vAlign; }else{ _val = cell.currentStyle.verticalAlign; } switch(_val){ case 'baseline': modVAlign=1; break; case 'bottom': modVAlign=2; break; case 'top': modVAlign=3; break; default: modVAlign=0; //middle } ghtmlb_hed_stack_colorRange=""; for (i=0;i "; /*TB*/ sSizerHtml += ""; sSizerHtml += ""; /*L1*/ sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += "";/*L1*/ sSizerHtml += ""; /*L2*/ // hor.select sSizerHtml += ""; sSizerHtml += ""; /*TB*/ sSizerHtml += ""; //LINE //------------------------------------------------ (2) sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += "
"; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += "
"; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; /*TB*/ sSizerHtml += ""; sSizerHtml += ""; /*L1*/ sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += "";/*L1*/ sSizerHtml += ""; /*L2*/ // top padd. sSizerHtml += ""; // right padd. sSizerHtml += ""; // Bottom padd. sSizerHtml += ""; // left padd. sSizerHtml += ""; sSizerHtml += ""; /*L2*/ sSizerHtml += "
"; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += "
"; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += "
"; sSizerHtml += "
"; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += "
 "; sSizerHtml += " "; sSizerHtml += ""; sSizerHtml += txtMap["TXT_HTMLB_HED_SELECT"]; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += "
 
"; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += "
"; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += txtMap["TXT_HTMLB_HED_OK"]; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += txtMap["TXT_HTMLB_HED_APPLY"]; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += txtMap["TXT_HTMLB_HED_CANCEL"]; sSizerHtml += ""; sSizerHtml += "
"; sSizerHtml += "
"; sSizerHtml += ""; sSizerHtml += "
"; sSizerHtml += "
"; oPopup.innerHTML=sSizerHtml; return oPopup; } function htmlb_hed_launchContextMenu(sId, control){ try { var o=control.document.parentWindow.event; var oPopupContent=htmlb_hed_makeContextMenuPopup(sId); var arrUrls = new Array(ur_system.stylepath+"ur_"+ur_system.browser_abbrev+".css"); var oPopup = new sapPopup(window,arrUrls,oPopupContent,control,o,0); oPopup.show = htmlb_hed_PopupContextMenu_show oPopup.onblur = hidePopupMenu; window.onfocus = hidePopupMenu; oPopup.show(true); } catch(ex){ alert(ex); } return false; } function htmlb_hed_makeContextMenuPopup(sId){ var txtMap = htmlb_hed_txt[ur_language]; var menu = [ [true, 'CUT', txtMap["TXT_HTMLB_HED_CUT"], true], [true, 'COPY', txtMap["TXT_HTMLB_HED_COPY"], true], [true, 'PASTE', txtMap["TXT_HTMLB_HED_PASTE"], true], [true, 'DIV', "", true], [true, 'SELALL', txtMap["TXT_HTMLB_HED_SELALL"], true], [true, 'DIV', "", true], [true, 'UNDO', txtMap["TXT_HTMLB_UNDO"], false], [true, 'REDO', txtMap["TXT_HTMLB_REDO"], false], [false, 'DIV', "", true], [false, 'INSROW', txtMap["TXT_HTMLB_INSERTTABLEROW"], true], [false, 'DELROW', txtMap["TXT_HTMLB_DELETETABLEROW"], true], [false, 'INSCOL', txtMap["TXT_HTMLB_INSERTTABLECOL"], true], [false, 'DELCOL', txtMap["TXT_HTMLB_DELETETABLECOL"], true] //['MGRI', txtMap["TXT_HTMLB_MG_CELL_RIGHT"]], //['MGLE', txtMap["TXT_HTMLB_MG_CELL_LEFT"]], //['MGUP', txtMap["TXT_HTMLB_MG_CELL_UP"]], //['MGDW', txtMap["TXT_HTMLB_MG_CELL_DOWN"]] ]; var selectedIndex=-1; var editor = document.getElementById(sId + "htmlbeditor"); var oPopup = document.getElementById("htmlb_hed_context_menu_popup"); if (!oPopup) { var oBody = document.getElementsByTagName("BODY")[0]; editor._offsetY=editor.scrollTop ; editor._offsetX=editor.scrollLeft; oPopup = document.createElement("SPAN"); oPopup.id="htmlb_hed_context_menu_popup"; oPopup.style.position="absolute"; oPopup.style.left="-1999px"; oPopup.style.top="-1999px"; oBody.appendChild(oPopup); setTimeout("htmlb_hed_adapt_offset('"+editor.id+"')", 50); } var tableScope = htmlb_hed_hasTableScope(editor); var undoLength = ghtmlb_hed_undoMap[editor.id].length; var redoLength = ghtmlb_hed_redoMap[editor.id].length; for (i=0;i0&&menu[i][1]=="UNDO") menu[i][3] = true; if (redoLength>0&&menu[i][1]=="REDO") menu[i][3] = true; } var sCharsHtml = ""; this.selId=10; for (j=0; j"; }else{ sCharsHtml += ""; } } sCharsHtml += "
"; sCharsHtml += ""; sCharsHtml += ""; sCharsHtml += " "; sCharsHtml += ""; sCharsHtml += "
"; oPopup.innerHTML=sCharsHtml; return oPopup; } function htmlb_hed_PopupContextMenu_show(bDoNotAutoFocus) { var sourceoffset = getAbsolutePosition(this.source.object); this.position.left = sourceoffset.left; this.position.top = sourceoffset.top; this.positionbehavior = sapPopupPositionBehavior.EVENT; this.poscalc(); this.position.left = this.source.event.x + sourceoffset.left; this.position.top = this.source.event.y + sourceoffset.top; if (this.onbeforerender) { if (!this.onbeforerender(this)) return; } if (!this.canrender) { showError("Cannot render Popup. Sizes and positions are not set."); return; } if (this.frame.window.mylevel==null) { this.write(bDoNotAutoFocus); } else { this.frame.window.document.getElementsByTagName("DIV").item(0).innerHTML=this.content.html; } if (bDoNotAutoFocus) { } else { //this.frame.window.document.body.focus(); } if (ur_system.direction=="rtl") this.frame.object.style.right = this.position.right+"px"; else this.frame.object.style.left = this.position.left+"px"; this.frame.object.style.top = this.position.top+"px"; this.frame.object.style.width = this.size.width+"px"; this.frame.object.style.height = this.size.height+"px"; return true; } function htmlb_hed_MnuToggleClickContextMenuItem(sId, cmd){ hidePopupMenu(); var editor = document.getElementById(sId + "htmlbeditor"); editRange=document.getElementById(sId + "htmlbeditor").document.selection.createRange(); var txtMap = htmlb_hed_txt[ur_language]; switch (cmd){ case 'CUT': htmlb_hed_stackForUndo(editor); editor.document.execCommand('Cut', false); break; case 'COPY': editor.document.execCommand('Copy', false); break; case 'PASTE': editor.document.execCommand('Paste', false); htmlb_hed_stackForUndo(editor); break; case 'SELALL': editor.document.execCommand('SelectAll', false); break; case 'INSROW': doInsertTableRowAction(sId, txtMap["TXT_HTMLB_HED_SEL_CELL"]); break; case 'DELROW': doDeleteTableRowAction(sId, txtMap["TXT_HTMLB_HED_SEL_CELL"]); break; case 'INSCOL': doInsertTableColumnAction(sId, txtMap["TXT_HTMLB_HED_SEL_CELL"]); break; case 'DELCOL': doDeleteTableColumnAction(sId, txtMap["TXT_HTMLB_HED_SEL_CELL"]); break; case 'UNDO': htmlb_hed_update_for_undo(editor.id); break; case 'REDO': htmlb_hed_update_for_redo(editor.id); break; } } function htmlb_hed_hasTableScope(editor) { var objRef = htmlb_hed_getRangeRef(editor); if(objRef==null){ return false; } if (objRef.tagName=="TD"||objRef.tagName=="TR"||objRef.tagName=="TABLE"||objRef.tagName=="TBODY"){ return true; } return false; } function htmlb_hed_adaptSpanElemColor(elem, color){ if (node && node.hasChildNodes){ var childNode = node.firstChild; if (childNode.tagName == "SPAN"){ childNode.style.color = color; } for (var i = 1; childNode = childNode.nextSibling; ++i){ if (childNode.tagName == "SPAN"){ childNode.style.color = color; if (childNode.hasChildNodes){ htmlb_hed_adaptSpanElemColorR(childNode.firstChild, color); } } } } } function htmlb_hed_adaptSpanElemColorR(childNode, color){ if (childNode.tagName == "SPAN"){ childNode.style.color = color; } for (var i = 1; childNode = childNode.nextSibling; ++i){ if (childNode.tagName == "SPAN"){ childNode.style.color = color; if (childNode.hasChildNodes){ htmlb_hed_adaptSpanElemColorR(childNode.firstChild, color); } } } } function htmlb_hed_adaptSpanElemClass(elem, cn){ if (node && node.hasChildNodes){ var childNode = node.firstChild; //if (childNode.tagName == "SPAN"){ childNode.className = cn; //} for (var i = 1; childNode = childNode.nextSibling; ++i){ //if (childNode.tagName == "SPAN"){ childNode.className = cn; if (childNode.hasChildNodes){ htmlb_hed_adaptSpanElemClassR(childNode.firstChild, cn); } //} } } } function htmlb_hed_adaptSpanElemClassR(childNode, cn){ //if (childNode.tagName == "SPAN"){ childNode.className = cn; //} for (var i = 1; childNode = childNode.nextSibling; ++i){ //if (childNode.tagName == "SPAN"){ childNode.className = cn; if (childNode.hasChildNodes){ htmlb_hed_adaptSpanElemClassR(childNode.firstChild, cn); } //} } } function htmlb_hed_table_cell_color_modify(popup, sId, colorRangeId, tableCellId){ htmlb_hed_doInsertTextBackgroundColorPopup(sId.replace("htmlbeditor",""), this, true, colorRangeId, tableCellId); } function htmlb_hed_bkcolorSelect_cancel(popup){ htmlb_hed_hidePopupMenu(popup); } function htmlb_hed_hidePopupMenu(content){ if (sapPopupStore[1]){ sapPopupStore[1].hide(); }else{ hidePopupMenu(); } return false; } function htmlb_hed_tablecell_stack_for_popups(width, widthUnit, halign, valign, padTop, padRight, padBottom, padLeft){ ghtmlb_hed_stack_width = width; ghtmlb_hed_stack_widthUnit = widthUnit; switch(halign){ case 'center': ghtmlb_hed_stack_halign=1; break; case 'left': ghtmlb_hed_stack_halign=2; break; case 'right': ghtmlb_hed_stack_halign=3; break; default: ghtmlb_hed_stack_halign=0; } switch(valign){ case 'baseline': ghtmlb_hed_stack_valign=1; break; case 'bottom': ghtmlb_hed_stack_valign=2; break; case 'top': ghtmlb_hed_stack_valign=3; break; default: ghtmlb_hed_stack_padTop = padTop; } ghtmlb_hed_stack_padRight = padRight; ghtmlb_hed_stack_padBottom = padBottom; ghtmlb_hed_stack_padLeft = padLeft; } function htmlb_hed_tablecell_modify(sId, width, widthUnit, halign, valign, padTop, padRight, padBottom, padLeft, colorStyle, editorId){ editor = document.getElementById(editorId); if (editor){ htmlb_hed_stackForUndo(editor); } var cell=document.getElementById(sId); hidePopupMenu(); if(cell){ var style = ghtmlb_hed_stack_colorRange; var myTable = document.getElementById(sId.substring(0, sId.indexOf(":"))); if (myTable&&myTable.border == 0) style += " urTxtStd"; else style += " urSTbvCellStd urTxtStd"; cell.className = style; if (width!=""&&width!="undefined"){ if (width == "0"){ cell.width = ""; }else{ if (widthUnit=="%") cell.width = width+" %"; else cell.width = width; } } if (padTop!=""){ if (padTop!=0)cell.style.paddingTop = padTop; else cell.style.paddingTop = ""; } if (padRight!=""){ if (padRight!=0)cell.style.paddingRight = padRight; else cell.style.paddingRight = ""; } if (padBottom!=""){ if (padBottom!=0)cell.style.paddingBottom = padBottom; else cell.style.paddingBottom = ""; } if (padLeft!=""){ if (padLeft!=0)cell.style.paddingLeft = padLeft; else cell.style.paddingLeft = ""; } // align... if (halign!="")cell.align = halign; if (valign!="")cell.vAlign = valign; cell.focus(); } } function htmlb_hed_tablecell_cancel(sId, width, widthUnit, halign, valign, padTop, padRight, padBottom, padLeft, colorStyle){ var cell=document.getElementById(sId); hidePopupMenu(); if(cell){ var style = colorStyle; if (style != ""){ //style += " urSTbvCellStd urTxtStd"; cell.className = style; } if (width!=""&&width!="undefined"){ if (widthUnit=="%") cell.width = width+" %"; else cell.width = width; }else{ if (width=="undefined")width = ""; cell.width=width; } if (padTop!=""&&padTop!=0)cell.style.paddingTop = padTop; else if (padTop==0) cell.style.paddingTop = ""; if (padRight!=""&&padRight!=0)cell.style.paddingRight = padRight; else if (padRight==0) cell.style.paddingRight = ""; if (padBottom!=""&&padBottom!=0)cell.style.paddingBottom = padBottom; else if (padBottom==0) cell.style.paddingBottom = ""; if (padLeft!=""&&padLeft!=0)cell.style.paddingLeft = padLeft; else if (padLeft==0) cell.style.paddingLeft = ""; // align... cell.align = halign; cell.vAlign = valign; } } function htmlb_hed_tablecell_apply(sId, width, widthUnit, halign, valign, padTop, padRight, padBottom, padLeft, colorStyle){ var cell=document.getElementById(sId); if(cell){ var style = ghtmlb_hed_stack_colorRange; var myTable = document.getElementById(sId.substring(0, sId.indexOf(":"))); if (myTable&&myTable.border == 0) style += " urTxtStd"; else style += " urSTbvCellStd urTxtStd"; cell.className = style; if (width!=""){ if (width == "0"){ cell.width = ""; }else{ if (widthUnit=="%") cell.width = width+" %"; else cell.width = width; } } if (padTop!=""){ if (padTop!=0)cell.style.paddingTop = padTop; else cell.style.paddingTop = ""; } if (padRight!=""){ if (padRight!=0)cell.style.paddingRight = padRight; else cell.style.paddingRight = ""; } if (padBottom!=""){ if (padBottom!=0)cell.style.paddingBottom = padBottom; else cell.style.paddingBottom = ""; } if (padLeft!=""){ if (padLeft!=0)cell.style.paddingLeft = padLeft; else cell.style.paddingLeft = ""; } // align... if (halign!="")cell.align = halign; if (valign!="")cell.vAlign = valign; } } function htmlb_hed_doSelectWebLink(editor){ var selType = editor.document.selection.type; var selection = editor.document.selection.createRange(); var txtMap = htmlb_hed_txt[ur_language]; if (selType=='Text'||selType=='None'){ var elem = htmlb_hed_getRangeRef(editor); if(elem){ elem = htmlb_hed_matchTag(editor, elem, "^A"); if(elem&&elem.tagName=="A"){ if (elem.id=="") elem.id = htmlb_hed_getUniqueId("htmlb_hed_image"); return htmlb_hed_launchLinkPropPopup(editor.id, elem.id, false, "", false); }else if (selection.text != ""){ return htmlb_hed_launchLinkPropPopup(editor.id, null, true, selection.text, false); } } htmlb_hed_launchLinkPropPopup(editor.id, null, true, "", false); }else if (selType=='Control'){ elem = selection.item(0); if (elem.tagName.toUpperCase() == "IMG"){ if (elem.id=="") elem.id = htmlb_hed_getUniqueId("htmlb_hed_image"); // check if we found a link parent... var elemTag = htmlb_hed_matchTag(editor, elem, "^A"); if (elemTag&&elemTag.tagName=="A"){ if (elemTag.id=="") elemTag.id = htmlb_hed_getUniqueId("htmlb_hed_link"); return htmlb_hed_launchLinkPropPopup(editor.id, elemTag.id, false, elem.alt, true); }else{ return htmlb_hed_launchLinkPropPopup(editor.id, elem.id, true, "", false); } }else{ alert(txtMap["TXT_HTMLB_HED_SEL_IMG_LINK"]); return; } }else{ htmlb_hed_launchLinkPropPopup(editor.id, null, true, "", false); } } function htmlb_hed_makeWebLinkDialog(sId, bInsertMode, initText, textReadOnly, editorId){ var oPopup = document.getElementById("htmlb_hed_weblink_popup"); if (!oPopup) { var oBody = document.getElementsByTagName("BODY")[0]; var editor = document.getElementById(editorId); editor._offsetY=editor.scrollTop ; editor._offsetX=editor.scrollLeft; oPopup = document.createElement("SPAN"); oPopup.id="htmlb_hed_weblink_popup"; oPopup.style.position="absolute"; oPopup.style.left="-1999px"; oPopup.style.top="-1999px"; oBody.appendChild(oPopup); setTimeout("htmlb_hed_adapt_offset('"+editor.id+"')", 50); } var modText, modURL, modOpenMode=0; var txtMap = htmlb_hed_txt[ur_language]; var modSaved=false,modTextSaved, modURLSaved, modOpenModeSaved; var sSizerHtml = ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += "
"; sSizerHtml += ""; sSizerHtml += "
"; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += "
"; sSizerHtml += ""; if(bInsertMode){ sSizerHtml += ""; sSizerHtml += txtMap["TXT_HTMLB_HED_TITLE_INS_WE"]; sSizerHtml += ""; }else{ sSizerHtml += ""; sSizerHtml += txtMap["TXT_HTMLB_HED_TITLE_MOD_WE"]; sSizerHtml += ""; } sSizerHtml += "
"; sSizerHtml += "
"; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; if(bInsertMode){ modText=initText; modURL=""; }else{ var link=document.getElementById(sId); if(link){ modText = link.innerText; modURL = link.href; switch(link.target){ case '_blank': modOpenMode=1; break; case '_parent': modOpenMode=2; break; case '_search': modOpenMode=3; break; case '_self': modOpenMode=4; break; case '_top': modOpenMode=5; break; default: modOpenMode=4; } if(!modSaved){//cancel modSaved=true; modTextSaved = modText; modURLSaved = modURL; modOpenModeSaved = modOpenMode; } } } sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += "
 
"; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; if (textReadOnly) sSizerHtml += ""; sSizerHtml += "
"; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += "
"; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += txtMap["TXT_HTMLB_HED_CANCEL"]; sSizerHtml += ""; sSizerHtml += "
"; }else{ sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += txtMap["TXT_HTMLB_HED_OK"]; sSizerHtml += ""; sSizerHtml += "
"; sSizerHtml += ""; sSizerHtml += txtMap["TXT_HTMLB_HED_APPLY"]; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += txtMap["TXT_HTMLB_HED_CANCEL"]; sSizerHtml += ""; sSizerHtml += "
"; } sSizerHtml += "
"; sSizerHtml += "
"; sSizerHtml += "
"; sSizerHtml += "
"; oPopup.innerHTML=sSizerHtml; return oPopup; } function htmlb_hed_link_select(sId, linkText, linkURL, launchMode, insertMode, sEditorId){ hidePopupMenu(); if (insertMode){ if (linkText==""&&linkURL==""){ hidePopupMenu(); return; } var oControl = document.getElementById(sId); if (oControl.tagName == "IMG"){ var elem = oControl.cloneNode(true); var link = document.createElement('A'); if(link){ link.href = linkURL; if (launchMode!=""){ link.target = launchMode; }else{ link.target = "_self"; } link.className = "urLnk urVt1"; link.id = htmlb_hed_getUniqueId("htmlb_hed_link"); } link.appendChild(elem); oControl.replaceNode(link); }else{ if (editRange==null){ editRange=oControl.document.selection.createRange(); } var selType = oControl.document.selection.type; if (selType=='Control'){ var elem = editRange.item(0).cloneNode(true); var parent = elem.parentElement; var link = oControl.document.createElement('A'); if(link){ link.href = linkURL; if (launchMode!=""){ link.target = launchMode; }else{ link.target = "_self"; } link.className = "urLnk urVt1"; link.id = htmlb_hed_getUniqueId("htmlb_hed_link"); link.innerText = linkText; } link.appendChild(elem); editRange.item(0).replaceNode(link); }else{ var link = document.createElement('A'); link.href = linkURL; if (launchMode!=""){ link.target = launchMode; }else{ link.target = "_self"; } link.innerText = linkText; link.className = "urLnk urVt1"; link.id = htmlb_hed_getUniqueId("htmlb_hed_link"); editRange.pasteHTML(link.outerHTML); } } }else{ // modify... var elem=document.getElementById(sId); var editor = document.getElementById(sEditorId); if (editor){ editor._offsetY=editor.scrollTop; editor._offsetX=editor.scrollLeft; } if (elem.tagName == "A"){ // check for an image within... var childNode = elem.firstChild; var gotIt = false; if (childNode.tagName != "IMG"){ for (var i = 1; childNode = childNode.nextSibling; ++i){ if (childNode.tagName == "IMG"){ gotIt = true; break; } } }else{ gotIt = true; } elem.href = linkURL; if (launchMode!=""){ elem.target = launchMode; }else{ elem.target = "_self"; } if (!gotIt) elem.innerText = linkText; elem.focus(); }else if (elem.tagName == "IMG"){ var elemTag = htmlb_hed_matchTag(null, elem, "^A"); if (elemTag&&elemTag.tagName=="A"){ elemTag.href = linkURL; if (launchMode!=""){ elemTag.target = launchMode; }else{ elemTag.target = "_self"; } } } if (editor){ editor.focus(); setTimeout("htmlb_hed_adapt_offset('"+editor.id+"')", 50); } } } function htmlb_hed_link_apply(sId, linkText, linkURL, launchMode, insertMode){ if (linkText==""&&linkURL==""){ return; } var elem=document.getElementById(sId); if (elem.tagName == "A"){ // check for an image within... var childNode = elem.firstChild; var gotIt = false; if (childNode.tagName != "IMG"){ for (var i = 1; childNode = childNode.nextSibling; ++i){ if (childNode.tagName == "IMG"){ gotIt = true; break; } } }else{ gotIt = true; } elem.href = linkURL; if (launchMode!=""){ elem.target = launchMode; }else{ elem.target = "_self"; } if (!gotIt) elem.innerText = linkText; }else if (elem.tagName == "IMG"){ var elemTag = htmlb_hed_matchTag(null, elem, "^A"); if (elemTag&&elemTag.tagName=="A"){ elemTag.href = linkURL; if (launchMode!=""){ elemTag.target = launchMode; }else{ elemTag.target = "_self"; } } } } function doInsertWebLinkAction(id, errorText) { editor = document.getElementById(id + "htmlbeditor"); htmlb_hed_doSelectWebLink(editor); } function htmlb_hed_getUniqueId(prefix){ var d = new Date(); id = prefix; id += d.getYear(); id += (d.getMonth() + 1); id += d.getDate(); id += d.getHours(); id += d.getMinutes(); id += d.getSeconds(); id += htmlb_hed_tableEditorId++; return id; } function htmlb_hed_makeImagePropDialog(sId, editorId){ var oPopup = document.getElementById("htmlb_html_editor_image_popup"); if (!oPopup) { var oBody = document.getElementsByTagName("BODY")[0]; var editor = document.getElementById(editorId); editor._offsetY=editor.scrollTop ; editor._offsetX=editor.scrollLeft; oPopup = document.createElement("SPAN"); oPopup.id="htmlb_html_editor_image_popup"; oPopup.style.position="absolute"; oPopup.style.left="-1999px"; oPopup.style.top="-1999px"; oBody.appendChild(oPopup); setTimeout("htmlb_hed_adapt_offset('"+editor.id+"')", 50); } var modWidth, modHeight, modBorder, modText, modSrc; var modSaved=false,modWidthSaved, modHeightSaved, modBorderSaved, modTextSaved, modSrcSaved; var txtMap = htmlb_hed_txt[ur_language]; var sSizerHtml = ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += "
"; sSizerHtml += ""; sSizerHtml += "
"; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += "
"; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += txtMap["TXT_HTMLB_HED_MOD_IMG"]; sSizerHtml += ""; sSizerHtml += "
"; sSizerHtml += "
"; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; var image=document.getElementById(sId); if(image){ modWidth = image.width; modHeight = image.height; modBorder = image.border; modText = image.alt; modSrc = image.src; if(!modSaved){//cancel modSaved=true; modWidthSaved = modWidth; modHeightSaved = modHeight; modBorderSaved = modBorder; modTextSaved = modText; modSrcSaved = modSrc; } } sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += "
 
"; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += "
"; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += "
"; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += "
"; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += "
"; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += "
 
"; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += "
"; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += txtMap["TXT_HTMLB_HED_OK"]; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += txtMap["TXT_HTMLB_HED_APPLY"]; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += ""; sSizerHtml += txtMap["TXT_HTMLB_HED_CANCEL"]; sSizerHtml += ""; sSizerHtml += "
"; sSizerHtml += "
"; sSizerHtml += "
"; sSizerHtml += "
"; sSizerHtml += "
"; oPopup.innerHTML=sSizerHtml; return oPopup; } function htmlb_hed_image_modify(sId, imageWidth, imageHeight, imageBorder, imageText, imageSrc, editorId){ hidePopupMenu(); var image=document.getElementById(sId); if(image){ var editor = document.getElementById(editorId); editor._offsetY=editor.scrollTop; editor._offsetX=editor.scrollLeft; htmlb_hed_stackForUndo(editor); image.width = imageWidth; image.height = imageHeight; image.border = imageBorder; image.alt = imageText; image.src = imageSrc; image.focus(); editor.focus(); setTimeout("htmlb_hed_adapt_offset('"+editor.id+"')", 50); } } function htmlb_hed_image_cancel(sId, imageWidth, imageHeight, imageBorder, imageText, imageSrc){ hidePopupMenu(); var image=document.getElementById(sId); if(image){ image.width = imageWidth; image.height = imageHeight; image.border = imageBorder; image.alt = imageText; image.src = imageSrc; } } function htmlb_hed_image_apply(sId, imageWidth, imageHeight, imageBorder, imageText, imageSrc){ var image=document.getElementById(sId); if(image){ image.width = imageWidth; image.height = imageHeight; image.border = imageBorder; image.alt = imageText; image.src = imageSrc; } } function htmlb_hed_toogle_table_border(id){ var tb = document.getElementById(id); if (tb){ if (tb.border == 0){ tb.runtimeStyle.border = '1 Dotted #550055' tb.className = ""; }else{ tb.runtimeStyle.cssText = ""; if (tb.className == "") tb.className = "urSTbvStd"; } var tds = tb.getElementsByTagName("td"); for (var i = 0; i < tds.length; i++){ if( tb.border == 0){ if (tds[i].className == "") tds[i].className='urTxtStd'; else tds[i].className=tds[i].className.replace("urSTbvCellStd",""); tds[i].runtimeStyle.border = '1 Dotted #550055'; }else{ if (tds[i].className == "") tds[i].className='urSTbvCellStd urTxtStd'; tds[i].runtimeStyle.cssText = ""; } } } } function htmlb_hed_doInsertSpecialCharPopup(sId, control){ try { var editor = document.getElementById(sId + "htmlbeditor"); var o=control.document.parentWindow.event; var oPopupContent=htmlb_hed_makeSpecialCharDialog(editor.id); var arrUrls = new Array(ur_system.stylepath+"ur_"+ur_system.browser_abbrev+".css"); var oPopup = new sapPopup(window,arrUrls,oPopupContent,control,o,0); oPopup.show = htmlb_hed_Popup_show oPopup.onblur = hidePopupMenu; window.onfocus = hidePopupMenu; oPopup.show(true); } catch(ex){ alert(ex); } } var ghtmlb_hed_undoMap,ghtmlb_hed_redoMap; function htmlb_hed_stackForUndo(editor){ var top = ghtmlb_hed_undoMap[editor.id][ghtmlb_hed_undoMap[editor.id].length-1]; if (top != editor.innerHTML) ghtmlb_hed_undoMap[editor.id].push(editor.innerHTML); } function htmlb_hed_stackForRedo(editor){ var top = ghtmlb_hed_redoMap[editor.id][ghtmlb_hed_redoMap[editor.id].length-1]; if (top != editor.innerHTML) ghtmlb_hed_redoMap[editor.id].push(editor.innerHTML); } function htmlb_hed_pasteEventHandler(sId) { var editor = document.getElementById(sId); htmlb_hed_stackForUndo(editor); setTimeout("htmlb_hed_toogle_tables_border('"+sId+"')", 125); setTimeout("htmlb_hed_check_for_unique_id('"+sId+"')", 250); return true; } function htmlb_hed_mouseEventHandler(sId) { var editor = document.getElementById(sId); var clickEvent = editor.contentWindow ? editor.contentWindow.event : event; if (clickEvent) { editor._offsetX = clickEvent.offsetX - clickEvent.x; editor._offsetY = clickEvent.offsetY - clickEvent.y; } return htmlb_hed_hidePopupMenu(editor); } function htmlb_hed_eventHandler(sId) { var editor = document.getElementById(sId); var editEvent = editor.contentWindow ? editor.contentWindow.event : event; if (editEvent && editEvent.keyCode) { var code = editEvent.keyCode; var ctrlKey = editEvent.ctrlKey; var shiftKey = editEvent.shiftKey; if (ctrlKey && (code == 122 || code == 90)){ setTimeout("htmlb_hed_update_for_undo('"+sId+"')", 125); editEvent.cancelBubble = true; return false; } else if ((ctrlKey && (code == 121 || code == 89)) || ctrlKey && shiftKey && (code == 122 || code == 90)){ setTimeout("htmlb_hed_update_for_redo('"+sId+"')", 125); editEvent.cancelBubble = true; return false; } else if ((code == 32/*BL*/ || code == 13/*RT*/) && editEvent.type == 'keypress'){ htmlb_hed_stackForUndo(editor); editor._offsetX = editEvent.offsetX; editor._offsetY = editEvent.offsetY - editEvent.y; return true; } else if ((code == 8/*DEL*/ || code == 46/*BS*/) && editEvent.type == 'keydown'){ htmlb_hed_stackForUndo(editor); editor._offsetX = editEvent.offsetX; editor._offsetY = editEvent.offsetY - editEvent.y; return true; } } return true; } function htmlb_hed_update_for_undo(sId){ var editor = document.getElementById(sId); editor._offsetY=editor.scrollTop; editor._offsetX=editor.scrollLeft; var content = ghtmlb_hed_undoMap[editor.id].pop(); if (undefined != content){ htmlb_hed_stackForRedo(editor); if (content == editor.innerHTML) content = ghtmlb_hed_undoMap[editor.id].pop(); if (undefined == content) return; editor.innerHTML = content; htmlb_hed_stackForRedo(editor); setTimeout("htmlb_hed_toogle_tables_border('"+sId+"')", 125); }else{ htmlb_hed_stackForUndo(editor); } setTimeout("htmlb_hed_adapt_offset('"+sId+"')", 200); } function htmlb_hed_update_for_redo(sId){ var editor = document.getElementById(sId); editor._offsetY=editor.scrollTop; editor._offsetX=editor.scrollLeft; var content = ghtmlb_hed_redoMap[editor.id].pop(); if (undefined != content){ htmlb_hed_stackForUndo(editor); if (content == editor.innerHTML) content = ghtmlb_hed_redoMap[editor.id].pop(); if (undefined == content) return; editor.innerHTML = content; setTimeout("htmlb_hed_toogle_tables_border('"+sId+"')", 125); }else{ htmlb_hed_stackForRedo(editor); } setTimeout("htmlb_hed_adapt_offset('"+sId+"')", 200); } function htmlb_hed_startupHandler(sId){ var editor = document.getElementById(sId + "htmlbeditor"); if (editor._initialized == null){ editor.onkeydown = function() { return htmlb_hed_eventHandler(editor.id); } editor.onkeypress = function() { return htmlb_hed_eventHandler(editor.id); } editor.onclick = function() { return htmlb_hed_mouseEventHandler(editor.id); } editor.onpaste = function() { return htmlb_hed_pasteEventHandler(editor.id); } editor.ondrop = function() { return htmlb_hed_pasteEventHandler(editor.id); } editor.oncut = function() { htmlb_hed_stackForUndo(editor); return true; } if (ghtmlb_hed_undoMap == null || ghtmlb_hed_undoMap == "undefined"){ ghtmlb_hed_undoMap = new Array(); ghtmlb_hed_undoMap[editor.id] = new Array(); }else if (ghtmlb_hed_undoMap[editor.id] == null || ghtmlb_hed_undoMap[editor.id] == "undefined"){ ghtmlb_hed_undoMap[editor.id] = new Array(); } htmlb_hed_stackForUndo(editor); if (ghtmlb_hed_redoMap == null || ghtmlb_hed_redoMap == "undefined"){ ghtmlb_hed_redoMap = new Array(); ghtmlb_hed_redoMap[editor.id] = new Array(); }else if (ghtmlb_hed_redoMap[editor.id] == null || ghtmlb_hed_redoMap[editor.id] == "undefined"){ ghtmlb_hed_redoMap[editor.id] = new Array(); } editor._initialized = true; } setTimeout("htmlb_hed_toogle_tables_border('"+editor.id+"')", 125); } function htmlb_hed_save_offset(sId){ var editor = document.getElementById(sId + "htmlbeditor"); var offsetX = document.getElementById(sId + "_OFFSETX"); var offsetY = document.getElementById(sId + "_OFFSETY"); if(offsetX&&offsetY&&editor){ offsetX.value = editor.offsetLeft; offsetY.value = editor.offsetTop; } } function htmlb_hed_adapt_offset(sId){ var editor = document.getElementById(sId); editor.scrollTop = editor._offsetY; editor.scrollLeft = editor._offsetX; } function htmlb_hed_toogle_tables_border(sId){ var editor = document.getElementById(sId); if (editor && editor.hasChildNodes){ var childNode = editor.firstChild; if (childNode == null) return; if (childNode.tagName == "TABLE"){ htmlb_hed_toogle_table_borderInternal(childNode); } for (var i = 1; childNode = childNode.nextSibling; ++i){ if (childNode.tagName == "TABLE"){ htmlb_hed_toogle_table_borderInternal(childNode); } if (childNode&&childNode.hasChildNodes){ htmlb_hed_toogle_tables_borderR(childNode.firstChild); } } } } function htmlb_hed_toogle_table_borderInternal(oTable){ if (oTable){ if (oTable.border == 0){ oTable.className = ""; oTable.runtimeStyle.border = '1 Dotted #550055' }else{ oTable.runtimeStyle.cssText = ""; if (oTable.className == "") oTable.className = "urSTbvStd"; } var tds = oTable.getElementsByTagName("td"); for (var i = 0; i < tds.length; i++){ if( oTable.border == 0){ if (tds[i].className == "") tds[i].className='urTxtStd'; tds[i].runtimeStyle.border = '1 Dotted #550055'; }else{ if (tds[i].className == "") tds[i].className='urSTbvCellStd urTxtStd'; tds[i].runtimeStyle.cssText = ""; } } } } function htmlb_hed_toogle_tables_borderR(childNode){ if (childNode == null) return; if (childNode.tagName == "TABLE"){ htmlb_hed_toogle_table_borderInternal(childNode); } if (childNode.hasChildNodes){ htmlb_hed_toogle_tables_borderR(childNode.firstChild); } for (var i = 1; childNode = childNode.nextSibling; ++i){ if (childNode.tagName == "TABLE"){ htmlb_hed_toogle_table_borderInternal(childNode); } if (childNode.hasChildNodes){ htmlb_hed_toogle_tables_borderR(childNode.firstChild); } } } var htmlb_hed_elem_id_map; function htmlb_hed_check_for_unique_idInternal(childNode){ if (childNode.tagName == "TABLE"){ if (childNode.id != ""){ if (htmlb_hed_elem_id_map[childNode.id] == null) htmlb_hed_elem_id_map[childNode.id] = childNode.id; else htmlb_hed_refreshTableIds(childNode); }else{ htmlb_hed_refreshTableIds(childNode); } }else if(childNode.tagName == "IMG" || childNode.tagName == "A"){ if (childNode.id != ""){ if (htmlb_hed_elem_id_map[childNode.id] == null) htmlb_hed_elem_id_map[childNode.id] = childNode.id; else childNode.id = htmlb_hed_getUniqueId(childNode.tagName); }else{ childNode.id = htmlb_hed_getUniqueId(childNode.tagName); } } } function htmlb_hed_check_for_unique_id(sId){ htmlb_hed_elem_id_map = new Array(); var editor = document.getElementById(sId); if (editor && editor.hasChildNodes){ var childNode = editor.firstChild; if (childNode == null) return; htmlb_hed_check_for_unique_idR(childNode); } } function htmlb_hed_check_for_unique_idR(childNode){ if (childNode == null) return; htmlb_hed_check_for_unique_idInternal(childNode); if (childNode&&childNode.hasChildNodes){ htmlb_hed_check_for_unique_idR(childNode.firstChild); } for (var i = 1; childNode = childNode.nextSibling; ++i){ htmlb_hed_check_for_unique_idInternal(childNode); if (childNode.hasChildNodes){ htmlb_hed_check_for_unique_idR(childNode.firstChild); } } } function doSimpleAction(id,action){ // no check needed for these actions var editor = document.getElementById(id + "htmlbeditor"); if ( action == cPRINT) { htmlb_hed_showPrintPreview(id); return; } if ( action == cPREVIEW) { showPreview(id); return; } if (checkDoAction(id) == false) { return; } lastSave = null; switch (action){ case cCUT: htmlb_hed_stackForUndo(editor); editRange.execCommand("Cut"); break; case cCOPY: editRange.execCommand("Copy"); break; case cPASTE: htmlb_hed_stackForUndo(editor); editRange.execCommand("Paste"); break; case cBOLD: htmlb_hed_stackForUndo(editor); editRange.execCommand("Bold"); break; case cITALIC: htmlb_hed_stackForUndo(editor); editRange.execCommand("Italic"); break; case cUNDERLINE: htmlb_hed_stackForUndo(editor); editRange.execCommand("Underline"); break; case cSTRIKETHRU: editRange.execCommand("StrikeThrough"); break; case cSUBSCRIPT: editRange.execCommand("SubScript"); break; case cSUPERSCRIPT: editRange.execCommand("SuperScript"); break; case cOUTDENT: htmlb_hed_stackForUndo(editor); editRange.execCommand("Outdent"); break; case cINDENT: htmlb_hed_stackForUndo(editor); editRange.execCommand("Indent");break; case cLEFT: htmlb_hed_stackForUndo(editor); editRange.execCommand("JustifyLeft"); break; case cCENTER: htmlb_hed_stackForUndo(editor); editRange.execCommand("JustifyCenter"); break; case cRIGHT: htmlb_hed_stackForUndo(editor); editRange.execCommand("JustifyRight"); break; case cPARABUL: htmlb_hed_stackForUndo(editor); editRange.execCommand("InsertUnorderedList"); break; case cPARANUM: htmlb_hed_stackForUndo(editor); editRange.execCommand("InsertOrderedList"); break; case cINSERTRULE: htmlb_hed_stackForUndo(editor); editRange.execCommand("InsertHorizontalRule"); break; case cUNDO: editRange.execCommand("Undo"); break; case cREDO: editRange.execCommand("Redo"); break; case cSELECTALL: editRange.execCommand('selectall'); break; } save(id); } function doComplexAction(id,action,param) { if (checkDoAction(id) == false) { return; } lastSave = null; if (param == "NOP") { return; } switch (action){ case cHX: editRange.execCommand("FormatBlock", 1,param); break; case cFONT_SIZE: editRange.execCommand("FontSize", 1,param); break; case cFORE_COLOR: editRange.execCommand("ForeColor", 1,param); break; case cBACK_COLOR: editRange.execCommand("BackColor", 1,param); break; } save(id); } function save(id) { lastSave = id; var x = document.getElementById(id); var editor = document.getElementById(id + "htmlbeditor"); if(x!=null) x.value = editor.innerHTML; if(editor.document.selection.type.toUpperCase() != "CONTROL") { if (editor.document.selection.createRange().parentElement().id == id + "htmlbeditor") { editRange = editor.document.selection.createRange(); } if (checkParent(editor.document.selection.createRange().parentElement(),id) == true) { editRange = editor.document.selection.createRange(); } } else if(editor.document.selection.type.toUpperCase() == "CONTROL") { ;//editRange = null; } if (0==htmlb_hed_StyleInit){ document.createStyleSheet(ur_system.stylepath+"ur_"+ur_system.browser_abbrev+".css"); htmlb_hed_StyleInit=1; } var y = document.getElementById(id+"_SCREEN"); if(y!=null&&y.value!=""){ doResizeEditor(id,y.value); } var offsetX = document.getElementById(id+"_OFFSETX"); var offsetY = document.getElementById(id+"_OFFSETY"); if (offsetX&&offsetY&&offsetX.value!=""&&offsetY.value!=""){ editor._offsetX = offsetX.value; editor._offsetY = offsetY.value; htmlb_hed_adapt_offset(editor.id); } htmlb_hed_toogle_tables_border(editor.id); }