Oki så får i hele scriptet !!
editor.asp
<!--#include file="connect.asp" -->
<title>RC MEDIA - ADVANCED CONTENT EDITOR</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel=stylesheet href="style.css">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html XMLNS:ACE>
<head>
<?import namespace="ACE" implementation="editor/ace.htc" />
<script language="JavaScript">
function Init()
{
//specify the dimension
idContent.editorWidth = "580";
idContent.editorHeight = "492";
//idContent.useSave = true;
idContent.useBtnInsertText = true;
idContent.useBtnStyle = true;
idContent.useBtnParagraph = true;
idContent.useBtnFontName = true;
idContent.useBtnFontSize = true;
idContent.useBtnCut = true;
idContent.useBtnCopy = true;
idContent.useBtnPaste = true;
idContent.useBtnUndo = true;
idContent.useBtnRedo = true;
idContent.useBtnWord = true;
idContent.putBtnBreak() //line break
idContent.useBtnBold = true;
idContent.useBtnItalic = true;
idContent.useBtnUnderline = true;
idContent.useBtnStrikethrough = true;
idContent.useBtnSuperscript = true;
idContent.useBtnSubscript = true;
idContent.useBtnJustifyLeft = true;
idContent.useBtnJustifyCenter = true;
idContent.useBtnJustifyRight = true;
idContent.useBtnJustifyFull = true;
idContent.useBtnInsertOrderedList = true;
idContent.useBtnInsertUnorderedList = true;
idContent.useBtnIndent = true;
idContent.useBtnOutdent = true;
idContent.useBtnHorizontalLine = true;
idContent.useBtnTable = true;
idContent.useBtnExternalLink = true;
//idContent.useBtnInternalLink = true;
idContent.useBtnUnlink = true;
idContent.useBtnInternalImage = true;
idContent.useBtnForeground = true;
idContent.useBtnBackground = true;
idContent.useBtnAbsolute = true;
idContent.useBtnRemoveFormat = true;
idContent.useBtnInsertSymbol = true;
idContent.useBtnDocumentBackground = true;
//fill editor with content
idContent.content=idContentTemp.innerHTML
//Apply buttons
idContent.applyButtons()
}
function OpenImgLookup() {
var popleft=((document.body.clientWidth - 550) / 2)+window.screenLeft;
var poptop=(((document.body.clientHeight - 600) / 2))+window.screenTop-40;
window.open("editor/InsertImg.asp","NewWindow","scrollbars=yes,width=600,height=650,left="+popleft+",top="+poptop)
}
</script>
</head>
<body bgcolor=#E2E2E2 leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onload="Init()">
<!--PRELOAD START-->
<SCRIPT LANGUAGE="JavaScript">
if ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4))
{ document.write('<DIV ID="PleaseWait" STYLE="position: absolute; left:2%; top:35%;"><TABLE BORDER="0" WIDTH="100%" HEIGHT="95%"><TR><TD ALIGN="center"><IMG SRC="henter-data.gif" WIDTH="115" HEIGHT="125" ALT=""></TD></TR></TABLE></DIV>'); }
</SCRIPT>
<!--PRELOAD SLUT-->
<script>
function Save()
{
//Transfer the edited content to the form
Form1.content.value=idContent.content;
Form1.submit();
}
</script>
<ACE:AdvContentEditor id="idContent" onSave="Save()" onImgLookupOpen="OpenImgLookup()" />
<%
If request.querystring("ret")="igen" then
SQL = "Select TempSide AS NAV_PAGE From TempSide Where TempID = 1 "
Set rs = Connect.Execute(SQL)
else
SQL = "Select * From [NAVIGATION_MENU] Where NAV_PKEY = "&request.querystring("catid")&" "
Set rs = Connect.Execute(SQL)
end if
%>
<DIV id=idContentTemp style="display:none"><%=rs("NAV_PAGE")%></DIV>
<table bgcolor=#E2E2E2 width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td align="right">
<form method="post" name="Form1" action="save_doc.asp?NodeID=<%=request.querystring("NodeID")%>&catid=<%=request.querystring("catid")%>">
<%If request.querystring("ret")<>"igen" then%>
Side Navn:<strong> <%=rs("NAV_TITLE")%></strong>
<%End IF%>
<input type="hidden" name="content" value="">
<input class="3dLook" name="Submit" type="submit" OnClick="java script:Save()" value=" Preview ">
</form>
</td>
</tr>
</table>
<%
rs.close
%>
<!--PRELOAD START-->
<SCRIPT LANGUAGE="JavaScript">
<!--
www.eksperten.dk --
// if ((navigator.appName == "Netscape") && (parseInt(navigator.appVersion) >= 4))
// { document.layers['PleaseWait'].visibility="hide"; }
// else
if ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4))
{ document.all("PleaseWait").style.visibility="hidden"; }
//
www.eksperten.dk -->
</SCRIPT>
<!--PRELOAD SLUT-->
</body>
</html>
<%
Set Connect = Nothing
%>
InsertLink.asp
<html>
<head>
<TITLE>==WEBTITEL==</TITLE>
<meta name="description" content="==BESKRIVELSE==">
<meta name="keywords" content="==SØGE ORDENE==">
<meta name="robots" content="INDEX, FOLLOW">
<meta name="revisit-after" content="7">
<meta name="Rating" content="General">
<meta name="distribution" content="Global">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<script>
alert(window.opener.parent.frames['script'].idLinkURL);
</script>
<a href="#" onclick="opener.parent.frames['script'].document.getElementById('idLinkURL').value='weeeee';window.close()">test</a>
</body>
</html>
ace.htc
<!--
ADVANCED CONTENT EDITOR Version 1.01 - for IE5.5 or later
Copyright © 2003, Bo Ebsen & Morten Galten / RC MEDIA A/S. All rights reserved
http://www.rc-media.dk-->
<public:component tagName=AdvContentEditor>
<public:defaults viewLinkContent/>
<public:attach event="oncontentready" onevent="initEditor();"/>
<public:property name="content" id="content" put="putContent" get="getContent"/>
<public:property name="editorWidth" id="editorWidth" put="putEditorWidth"/>
<public:property name="editorHeight" id="editorHeight" put="putEditorHeight"/>
<public:property name="baseUrl" id="baseUrl" put="putBaseUrl"/>
<public:property name="baseUrlNew" id="baseUrlNew" put="putBaseUrlNew"/>
<public:method name="baseUrlUpdate" />
<public:property name="useSave" id="useSave" put="putUseSave"/>
<public:event name="onlinkLookupOpen" ID="linkLookupOpen" />
<public:event name="onImgLookupOpen" ID="imgLookupOpen" />
<public:property name="imageProperties" id="imageProperties" get="getImageProperties"/>
<public:property name="docBgColor" id="docBgColor" put="putDocBgColor" get="getDocBgColor"/>
<public:method name="InsertCustomHTML" />
<public:method name="checkImage" />
<public:method name="UpdateImage" />
<public:method name="InsertImage" />
<public:method name="setPosition" />
<public:property name="displayMode" id="displayMode" get="getDisplayMode"/>
<public:event name="onSave" ID="contentSave" />
<public:property name="useBtnInsertText" id="useBtnInsertText" put="putBtnInsertText"/>
<public:property name="useBtnStyle" id="useBtnStyle" put="putBtnStyle"/>
<public:property name="useBtnParagraph" id="useBtnParagraph" put="putBtnParagraph"/>
<public:property name="useBtnFontName" id="useBtnFontName" put="putBtnFontName"/>
<public:property name="useBtnFontSize" id="useBtnFontSize" put="putBtnFontSize"/>
<public:property name="useBtnCut" id="useBtnCut" put="putBtnCut"/>
<public:property name="useBtnCopy" id="useBtnCopy" put="putBtnCopy"/>
<public:property name="useBtnPaste" id="useBtnPaste" put="putBtnPaste"/>
<public:property name="useBtnUndo" id="useBtnUndo" put="putBtnUndo"/>
<public:property name="useBtnRedo" id="useBtnRedo" put="putBtnRedo"/>
<public:property name="useBtnWord" id="useBtnWord" put="putBtnWord"/>
<public:property name="useBtnBold" id="useBtnBold" put="putBtnBold"/>
<public:property name="useBtnItalic" id="useBtnItalic" put="putBtnItalic"/>
<public:property name="useBtnUnderline" id="useBtnUnderline" put="putBtnUnderline"/>
<public:property name="useBtnStrikethrough" id="useBtnStrikethrough" put="putBtnStrikethrough"/>
<public:property name="useBtnSuperscript" id="useBtnSuperscript" put="putBtnSuperscript"/>
<public:property name="useBtnSubscript" id="useBtnSubscript" put="putBtnSubscript"/>
<public:property name="useBtnJustifyLeft" id="useBtnJustifyLeft" put="putBtnJustifyLeft"/>
<public:property name="useBtnJustifyCenter" id="useBtnJustifyCenter" put="putBtnJustifyCenter"/>
<public:property name="useBtnJustifyRight" id="useBtnJustifyRight" put="putBtnJustifyRight"/>
<public:property name="useBtnJustifyFull" id="useBtnJustifyFull" put="putBtnJustifyFull"/>
<public:property name="useBtnInsertOrderedList" id="useBtnInsertOrderedList" put="putBtnInsertOrderedList"/>
<public:property name="useBtnInsertUnorderedList" id="useBtnInsertUnorderedList" put="putBtnInsertUnorderedList"/>
<public:property name="useBtnIndent" id="useBtnIndent" put="putBtnIndent"/>
<public:property name="useBtnOutdent" id="useBtnOutdent" put="putBtnOutdent"/>
<public:property name="useBtnHorizontalLine" id="useBtnHorizontalLine" put="putBtnHorizontalLine"/>
<public:property name="useBtnTable" id="useBtnTable" put="putBtnTable"/>
<public:property name="useBtnExternalLink" id="useBtnExternalLink" put="putBtnExternalLink"/>
<public:property name="useBtnInternalLink" id="useBtnInternalLink" put="putBtnInternalLink"/>
<public:property name="useBtnUnlink" id="useBtnUnlink" put="putBtnUnlink"/>
<public:property name="useBtnInternalImage" id="useBtnInternalImage" put="putBtnInternalImage"/>
<public:property name="useBtnForeground" id="useBtnForeground" put="putBtnForeground"/>
<public:property name="useBtnBackground" id="useBtnBackground" put="putBtnBackground"/>
<public:property name="useBtnAbsolute" id="useBtnAbsolute" put="putBtnAbsolute"/>
<public:property name="useBtnRemoveFormat" id="useBtnRemoveFormat" put="putBtnRemoveFormat"/>
<public:property name="useBtnInsertSymbol" id="useBtnInsertSymbol" put="putBtnInsertSymbol"/>
<public:property name="useBtnDocumentBackground" id="useBtnDocumentBackground" put="putBtnDocumentBackground"/>
<public:method name="putBtnBreak" />
<public:method name="applyButtons" />
<public:property name="ContentEditable" id="ContentEditable" put="putContentEditable"/>
</public:component>
<SCRIPT language="javascript" src="../js/PopUrl.js" type="text/javascript"></SCRIPT>
<HTML>
<HEAD>
<!-- Stylesheet Feature -->
<link id="DocStyle" rel="stylesheet" href="ace.css" type="text/css">
<style>
select
{
height: 22px;
top:2;
font:8pt verdana,arial,sans-serif
}
.bar
{
BORDER-TOP: ##666666 1px solid; BACKGROUND: #CCCCCC; WIDTH: 100%; BORDER-BOTTOM: #000000 1px solid; HEIGHT: 20px
}
.tblCoolbar
{
background-color: #E2E2E2; padding:1px; color:menutext;
border-width:1px; border-style:solid;
border-color:threedhighlight threedshadow threedshadow threedhighlight;
}
.editArea
{
width: 104px;
height: 30px;
border : 1px solid lightgrey;
padding : 10, 10, 10, 10;
background-color : White;
overflow : auto;
}
.editAreaTmp
{
height : 1px;
width : 1px;
overflow : auto;
}
td
{
font:8pt verdana,arial,sans-serif
}
div
{
font:10pt tahoma,arial,sans-serif
}
</style>
<script language=javascript>
var bContentEditable;
function putContentEditable(vValue)
{
bContentEditable = vValue;
if(bContentEditable)
{
idContent.contentEditable='true';
}
else
{
idContent.contentEditable='false';
}
}
var intEditorWidth;
var intEditorHeight;
function putEditorWidth(vValue)
{
intEditorWidth = vValue;
idContent.style.width= intEditorWidth;
idToolbar.style.width=intEditorWidth
idToolbarBottom.style.width=intEditorWidth
}
function putEditorHeight(vValue)
{
intEditorHeight = vValue;
idContent.style.height= intEditorHeight;
}
function initEditor()
{
setPosition()
window.onresize = setPosition
idContent.contentEditable='true';
InitStyle()//must be placed before unselectable = "on"
var arrHTMLFormatBlock = new Array(
"<HTML><h1>.</h1></HTML>",
"<HTML><h2>.</h2></HTML>",
"<HTML><h3>.</h3></HTML>",
"<HTML><h4>.</h4></HTML>",
"<HTML><h5>.</h5></HTML>",
"<HTML><h6>.</h6></HTML>",
"<HTML><pre>.</pre></HTML>",
"<HTML><body>.</body></HTML>")
var arrTagFormatBlock = new Array("H1","H2","H3","H4","H5","H6","PRE","P")
idContentTmp.contentEditable='true';//Tmp
for (i=0; i<arrTagFormatBlock.length; i++)
{//Tmp
idContentTmp.innerHTML = arrHTMLFormatBlock[i]
idContentTmp.focus()
idContentTmp.document.execCommand("SelectAll")
eval("id"+arrTagFormatBlock[i]).innerHTML = idContentTmp.document.queryCommandValue('FormatBlock')
}
/* Slow on startup*/
for (i=0; i<document.all.length; i++)
document.all(i).unselectable = "on";
//idContent.innerHTML = "<DIV></DIV>"
idContent.unselectable = "off";
idContentTmp.unselectable = "off";
idLinkURL.unselectable = "off";
document.execCommand("2D-Position", true, true);
document.execCommand("MultipleSelection", true, true);
document.execCommand("LiveResize", true, true);
TableInit()//must be placed after unselectable = "on"
//idContent.BaseURL = "
http://webdev/ContentEditor/" //special
//doCmd('JustifyLeft')
//btnJustifyLeft.state=document.queryCommandState('justifyleft');
//btnOut(btnJustifyLeft);
idContent.innerHTML = sContent;
idContent.focus()
btnSave.disabled = false
}
/******************************************************************
queryCommandEnable menentukan button disable atau nggak.
Kalau action-nya open window (custom) harus di-protect dgn [if(this.en==false)return;]
Tapi kalo action-nya standard command, tdk perlu, karena kalau tdk di-support tdk
akan terjadi apa2.
Kalau tanpa queryCommandEnable otomatis tdk perlu [if(this.en==false)return;]
drawIcon utk toggle, drawIcon2 utk nontogle.
drawIcon(800,23,"btnFilter","Filter","filterbox.style.display='block';filterbox.style.pixelLeft=(intbodyWidth - filterbox.offsetWidth) / 2 ; filterbox.style.pixelTop=((intbodyHeight - filterbox.offsetHeight) / 2)-60")
*/
var bBtnInsertText;
var bBtnStyle;
var bBtnParagraph;
var bBtnFontName;
var bBtnFontSize;
var bBtnCut;
var bBtnCopy;
var bBtnPaste;
var bBtnUndo;
var bBtnRedo;
var bBtnWord;
var bBtnBold;
var bBtnItalic;
var bBtnUnderline;
var bBtnStrikethrough;
var bBtnSuperscript;
var bBtnSubscript;
var bBtnJustifyLeft;
var bBtnJustifyCenter;
var bBtnJustifyRight;
var bBtnJustifyFull;
var bBtnInsertOrderedList;
var bBtnInsertUnorderedList;
var bBtnIndent;
var bBtnOutdent;
var bBtnHorizontalLine;
var bBtnTable;
var bBtnExternalLink;
var bBtnInternalLink;
var bBtnUnlink;
var bBtnInternalImage;
var bBtnForeground;
var bBtnBackground;
var bBtnAbsolute;
var bBtnRemoveFormat;
var bBtnInsertSymbol;
var bBtnDocumentBackground;
var sHTMLButtons = "";
function putBtnInsertText(vValue)
{
bBtnInsertText = vValue;
if(bBtnInsertText)
sHTMLButtons += drawIcon2(349,23,"btnInsertText","Insert Text","InsertText()")//tanpa queryCommandState- OK
}
function putBtnStyle(vValue)
{
bBtnStyle = vValue;
if(bBtnStyle)
sHTMLButtons += drawIcon2(0,57,"btnStyle","Apply Style","if(this.en==false)return;displayStyleBox()")//OK
}
function putBtnParagraph(vValue)
{
bBtnParagraph = vValue;
if(bBtnParagraph)
sHTMLButtons += drawIcon2(57,106,"btnParagraph","Paragraph","if(this.en==false)return;displayParagraphBox()")
}
function putBtnFontName(vValue)
{
bBtnFontName = vValue;
if(bBtnFontName)
sHTMLButtons += drawIcon2(163,143,"btnFontName","Font Name","if(this.en==false)return;displayFontNameBox()")
}
function putBtnFontSize(vValue)
{
bBtnFontSize = vValue;
if(bBtnFontSize)
sHTMLButtons += drawIcon2(306,43,"btnFontSize","Font Size","if(this.en==false)return;displayFontSizeBox()")
}
function putBtnCut(vValue)
{
bBtnCut = vValue;
if(bBtnCut)
sHTMLButtons += drawIcon2(372,23,"btnCut","Cut","doCmd('Cut');")//OK
}
function putBtnCopy(vValue)
{
bBtnCopy = vValue;
if(bBtnCopy)
sHTMLButtons += drawIcon2(395,23,"btnCopy","Copy","doCmd('Copy');")//OK : tanpa btnOver(this), begitu habis diklik posisi onmouseover tetap kelihatan..
}
function putBtnPaste(vValue)
{
bBtnPaste = vValue;
if(bBtnPaste)
sHTMLButtons += drawIcon2(418,23,"btnPaste","Paste","doCmd('Paste');")//OK
}
function putBtnUndo(vValue)
{
bBtnUndo = vValue;
if(bBtnUndo)
sHTMLButtons += drawIcon2(441,23,"btnUndo","Undo","doCmd('Undo')")//OK
}
function putBtnRedo(vValue)
{
bBtnRedo = vValue;
if(bBtnRedo)
sHTMLButtons += drawIcon2(464,23,"btnRedo","Redo","doCmd('Redo')")//OK
}
function putBtnWord(vValue)
{
bBtnWord = vValue;
if(bBtnWord)
sHTMLButtons += drawIcon2(1108,23,"btnWord","Paste from Word","pasteFromWord()")//OK
}
function putBtnBold(vValue)
{
bBtnBold = vValue;
if(bBtnBold)
sHTMLButtons += drawIcon(487,23,"btnBold","Bold","doCmd('Bold');this.state=!this.state;")//OK
}
function putBtnItalic(vValue)
{
bBtnItalic = vValue;
if(bBtnItalic)
sHTMLButtons += drawIcon(510,23,"btnItalic","Italic","doCmd('italic');this.state=!this.state;")//OK
}
function putBtnUnderline(vValue)
{
bBtnUnderline = vValue;
if(bBtnUnderline)
sHTMLButtons += drawIcon(533,23,"btnUnderline","Underline","doCmd('underline');this.state=!this.state;")//OK
}
function putBtnStrikethrough(vValue)
{
bBtnStrikethrough = vValue;
if(bBtnStrikethrough)
sHTMLButtons += drawIcon(556,23,"btnStrikethrough","Strikethrough","doCmd('strikethrough');this.state=!this.state;")//OK
}
function putBtnSuperscript(vValue)
{
bBtnSuperscript = vValue;
if(bBtnSuperscript)
sHTMLButtons += drawIcon(579,23,"btnSuperscript","Superscript","doCmd('superscript');this.state=!this.state;")//OK
}
function putBtnSubscript(vValue)
{
bBtnSubscript = vValue;
if(bBtnSubscript)
sHTMLButtons += drawIcon(602,23,"btnSubscript","Subscript","doCmd('subscript');this.state=!this.state;")//OK
}
function putBtnJustifyLeft(vValue)
{
bBtnJustifyLeft = vValue;
if(bBtnJustifyLeft)
sHTMLButtons += drawIcon(648,23,"btnJustifyLeft","Justify Left","Justify(this,'justifyleft');")//OK
}
function putBtnJustifyCenter(vValue)
{
bBtnJustifyCenter = vValue;
if(bBtnJustifyCenter)
sHTMLButtons += drawIcon(671,23,"btnJustifyCenter","Justify Center","Justify(this,'justifycenter');")//OK
}
function putBtnJustifyRight(vValue)
{
bBtnJustifyRight = vValue;
if(bBtnJustifyRight)
sHTMLButtons += drawIcon(694,23,"btnJustifyRight","Justify Right","Justify(this,'justifyright');")//OK
}
function putBtnJustifyFull(vValue)
{
bBtnJustifyFull = vValue;
if(bBtnJustifyFull)
sHTMLButtons += drawIcon(717,23,"btnJustifyFull","Justify Full","Justify(this,'justifyfull');")//OK
}
function putBtnInsertOrderedList(vValue)
{
bBtnInsertOrderedList = vValue;
if(bBtnInsertOrderedList)
sHTMLButtons += drawIcon(740,23,"btnInsertOrderedList","Ordered List","List(this);")//OK
}
function putBtnInsertUnorderedList(vValue)
{
bBtnInsertUnorderedList = vValue;
if(bBtnInsertUnorderedList)
sHTMLButtons += drawIcon(763,23,"btnInsertUnorderedList","Unordered List","List(this);")//OK
}
function putBtnIndent(vValue)
{
bBtnIndent = vValue;
if(bBtnIndent)
sHTMLButtons += drawIcon2(786,23,"btnIndent","Indent","doCmd('indent');")//OK
}
function putBtnOutdent(vValue)
{
bBtnOutdent = vValue;
if(bBtnOutdent)
sHTMLButtons += drawIcon2(809,23,"btnOutdent","Outdent","doCmd('outdent');")//OK
}
function putBtnHorizontalLine(vValue)
{//tanpa queryCommandState
bBtnHorizontalLine = vValue;
if(bBtnHorizontalLine)
sHTMLButtons += drawIcon2(832,23,"btnHorizontalLine","Horizontal Line","doCmd('InsertHorizontalRule')")//OK
}
function putBtnTable(vValue)
{
bBtnTable = vValue;
if(bBtnTable)
sHTMLButtons += drawIcon2(855,23,"btnTable","Create Table","displayTableBox()")//OK
}
function putBtnExternalLink(vValue)
{
bBtnExternalLink = vValue;
if(bBtnExternalLink)
sHTMLButtons += drawIcon2(878,23,"btnExternalLink","External Link","DisplayExternalLinkBox()")//OK
}
function putBtnInternalLink(vValue)
{//Custom Button (Internal Link)
bBtnInternalLink = vValue;
if(bBtnInternalLink)
sHTMLButtons += drawIcon2(901,23,"btnInternalLink","Internal Link","DisplayInternalLinkBox()")//OK
}
function putBtnUnlink(vValue)
{
bBtnUnlink = vValue;
if(bBtnUnlink)
sHTMLButtons += drawIcon2(924,23,"btnUnlink","Unlink","doCmd('unlink')")//OK
}
function putBtnInternalImage(vValue)
{
bBtnInternalImage = vValue;
if(bBtnInternalImage)
sHTMLButtons += drawIcon2(970,23,"btnInternalImage","Internal Image","if(this.en==false)return;displayExternalImageBox()")//OK
}
function putBtnForeground(vValue)
{
bBtnForeground = vValue;
if(bBtnForeground)
sHTMLButtons += drawIcon2(993,23,"btnForeground","Foreground","if(this.en==false)return;displayFgColorBox()")//OK
}
function putBtnBackground(vValue)
{
bBtnBackground = vValue;
if(bBtnBackground)
sHTMLButtons += drawIcon2(1016,23,"btnBackground","Background","if(this.en==false)return;displayBgColorBox()")//OK
}
function putBtnAbsolute(vValue)
{
bBtnAbsolute = vValue;
if(bBtnAbsolute)
sHTMLButtons += drawIcon2(1039,23,"btnAbsolute","Make Absolute","doCmd('absoluteposition')")//OK
}
function putBtnRemoveFormat(vValue)
{
bBtnRemoveFormat = vValue;
if(bBtnRemoveFormat)
sHTMLButtons += drawIcon2(1062,23,"btnRemoveFormat","Remove Formatting","doCmd('removeformat')")//OK
}
function putBtnInsertSymbol(vValue)
{
bBtnInsertSymbol = vValue;
if(bBtnInsertSymbol)
sHTMLButtons += drawIcon2(625,23,"btnInsertSymbol","Insert Symbol","displaySymbolBox()")//OK
}
function putBtnDocumentBackground(vValue)
{
bBtnDocumentBackground = vValue;
if(bBtnDocumentBackground)
sHTMLButtons += drawIcon2(1085,23,"btnDocumentBackground","Document Background","if(this.en==false)return;displayDocBgColorBox()")
}
function putBtnBreak()
{
sHTMLButtons += "<br>"
}
function applyButtons()
{
id01.innerHTML = sHTMLButtons
document.onselectionchange = document_onselectionchanged
}
//****************************************************************
var sBaseUrl;
function putBaseUrl(vValue)
{
sBaseUrl = vValue;
}
var sBaseUrlNew;
function putBaseUrlNew(vValue)
{
sBaseUrlNew = vValue;
}
function baseUrlUpdate()//ver.2.5
{
var sTmp;
var sATag = idContent.document.body.all.tags("A");
for (var i = sATag.length - 1; i >= 0; i--)
{
oA = sATag[i];
sTmp=new String(oA.href);
//oA.href = (oA.href).replace(sBaseUrl,sBaseUrlNew);
oA.href = (sTmp.toLowerCase()).replace(sBaseUrl.toLowerCase(),sBaseUrlNew);
}
var sImgTag = idContent.document.body.all.tags("IMG");
for (var i = sImgTag.length - 1; i >= 0; i--)
{
oA = sImgTag[i];
sTmp=new String(oA.src);
//oA.src = (oA.src).replace(sBaseUrl,sBaseUrlNew);
oA.src = (sTmp.toLowerCase()).replace(sBaseUrl.toLowerCase(),sBaseUrlNew);
}
}
var bUseSave;
function putUseSave(vValue)
{
bUseSave = vValue;
if(bUseSave)
{
btnSave.style.display = "block";
}
else
{
btnSave.style.display = "none";
}
}
var sContent="";
function putContent(vValue)
{
sContent = vValue;
idContent.innerHTML = sContent;
//idContent.innerHTML = vValue;
}
function replaceAnd(str)
{
var arrTmp = str.split("&");
if (arrTmp.length > 1) str = arrTmp.join("&");
return str;
}
function getContent()
{
return replaceAnd(idContent.innerHTML);
}
//*********************
function DisplayInternalLinkBox()
{
PopupHide()
var oEvent = createEventObject();
linkLookupOpen.fire(oEvent);
return true;
}
//*********************
function InsertCustomHTML(sHTML)//ver.2.5
{
idContent.focus()
var oSel = document.selection.createRange()
var sType = document.selection.type
if (sType=="Control")
{
oSel.item(0).outerHTML = sHTML
}
else
{
oSel.pasteHTML(sHTML)
}
}
//*********************
function displayExternalImageBox()
{
PopupHide()
var oEvent = createEventObject();
imgLookupOpen.fire(oEvent);
return true;
}
var arrImageProperties;
function getImageProperties()
{
arrImageProperties = checkImage();
return arrImageProperties;
}
function checkImage()
{
var oSel = document.selection.createRange()
var sType = document.selection.type
if ((oSel.item) && (oSel.item(0).tagName=="IMG")) //If image is selected
{
var arrVal = new Array(oSel.item(0).src,
oSel.item(0).alt,
oSel.item(0).align,
oSel.item(0).border,
oSel.item(0).width,
oSel.item(0).height,
oSel.item(0).hspace,
oSel.item(0).vspace)
}
else
{
var arrVal = new Array();
}
return arrVal;
}
var sDocBgColor;
function putDocBgColor(vValue)
{
sDocBgColor = vValue;
idContent.style.background = sDocBgColor;
}
function getDocBgColor()
{
if(idContent.style.background=="none transparent scroll repeat 0% 0%")//ver.2.5
return ""
else
return idContent.style.background;
}
function UpdateImage(inpImgURL,inpImgAlt,inpImgAlign,inpImgBorder,inpImgWidth,inpImgHeight,inpHSpace,inpVSpace)
{
var oSel = document.selection.createRange()
var sType = document.selection.type
if ((oSel.item) && (oSel.item(0).tagName=="IMG"))
{
oSel.item(0).style.width="";
oSel.item(0).style.height="";
oSel.item(0).src = inpImgURL
if(inpImgAlt!="")
oSel.item(0).alt = inpImgAlt
else
oSel.item(0).removeAttribute("alt",0)
oSel.item(0).align = inpImgAlign
oSel.item(0).border = inpImgBorder
if(inpImgWidth!="")
oSel.item(0).width = inpImgWidth
else
oSel.item(0).removeAttribute("width",0)
if(inpImgHeight!="")
oSel.item(0).height = inpImgHeight
else
oSel.item(0).removeAttribute("height",0)
if(inpHSpace!="")
oSel.item(0).hspace = inpHSpace
else
oSel.item(0).removeAttribute("hspace",0)
if(inpVSpace!="")
oSel.item(0).vspace = inpVSpace
else
oSel.item(0).removeAttribute("vspace",0)
}
}
function InsertImage(inpImgURL,inpImgAlt,inpImgAlign,inpImgBorder,inpImgWidth,inpImgHeight,inpHSpace,inpVSpace)
{
document.execCommand("InsertImage",false,inpImgURL);
var oSel = document.selection.createRange()
var sType = document.selection.type
if ((oSel.item) && (oSel.item(0).tagName=="IMG"))
{
if(inpImgAlt!="")
oSel.item(0).alt = inpImgAlt
oSel.item(0).align = inpImgAlign
oSel.item(0).border = inpImgBorder
if(inpImgWidth!="")
oSel.item(0).width = inpImgWidth
if(inpImgHeight!="")
oSel.item(0).height = inpImgHeight
if(inpHSpace!="")
oSel.item(0).hspace = inpHSpace
if(inpVSpace!="")
oSel.item(0).vspace = inpVSpace
}
}
function Save()
{
if (displayMode == "HTML"){alert("Please uncheck 'Edit HTML'");return;}
//idContent.innerHTML
idContent.innerText = idContent.innerHTML
idContent.innerHTML = idContent.innerText;
var oEvent = createEventObject();
contentSave.fire(oEvent);
}
function PopupHide()
{
parabox.style.display = "none"
fontnamebox.style.display = "none"
fontsizebox.style.display = "none"
tablebox.style.display = "none"
linkbox.style.display = "none"
fgcolorbox.style.display = "none"
bgcolorbox.style.display = "none"
stylebox.style.display = "none"
symbolbox.style.display = "none"
docbgcolorbox.style.display = "none"
}
function setPosition()
{
if(parabox.style.display=="block")
{
parabox.style.pixelLeft = (idContent.style.pixelWidth-parabox.offsetWidth)/2
parabox.style.pixelTop = (idContent.style.pixelHeight-parabox.offsetHeight)/2
}
if(fontnamebox.style.display=="block")
{
fontnamebox.style.pixelLeft = (idContent.style.pixelWidth-fontnamebox.offsetWidth)/2
fontnamebox.style.pixelTop = (idContent.style.pixelHeight-fontnamebox.offsetHeight)/2
}
if(fontsizebox.style.display=="block")
{
fontsizebox.style.pixelLeft = (idContent.style.pixelWidth-fontsizebox.offsetWidth)/2
fontsizebox.style.pixelTop = (idContent.style.pixelHeight-fontsizebox.offsetHeight)/2
}
if(tablebox.style.display=="block")
{
tablebox.style.pixelLeft = (idContent.style.pixelWidth-tablebox.offsetWidth)/2
tablebox.style.pixelTop = 10;//(idContent.style.pixelHeight+49+29-tablebox.offsetHeight)/2
}
if(linkbox.style.display=="block")
{
linkbox.style.pixelLeft = (idContent.style.pixelWidth-linkbox.offsetWidth)/2
linkbox.style.pixelTop = (idContent.style.pixelHeight-linkbox.offsetHeight)/2
}
if(fgcolorbox.style.display=="block")
{
fgcolorbox.style.pixelLeft = (idContent.style.pixelWidth-fgcolorbox.offsetWidth)/2
fgcolorbox.style.pixelTop = (idContent.style.pixelHeight-fgcolorbox.offsetHeight)/2
}
if(bgcolorbox.style.display=="block")
{
bgcolorbox.style.pixelLeft = (idContent.style.pixelWidth-bgcolorbox.offsetWidth)/2
bgcolorbox.style.pixelTop = (idContent.style.pixelHeight-bgcolorbox.offsetHeight)/2
}
if(docbgcolorbox.style.display=="block")
{
docbgcolorbox.style.pixelLeft = (idContent.style.pixelWidth-docbgcolorbox.offsetWidth)/2
docbgcolorbox.style.pixelTop = (idContent.style.pixelHeight-docbgcolorbox.offsetHeight)/2
}
if(stylebox.style.display=="block")
{
stylebox.style.pixelLeft = (idContent.style.pixelWidth-stylebox.offsetWidth)/2
stylebox.style.pixelTop = (idContent.style.pixelHeight-stylebox.offsetHeight)/2
}
if(symbolbox.style.display=="block")
{
symbolbox.style.pixelLeft = (idContent.style.pixelWidth-symbolbox.offsetWidth)/2
symbolbox.style.pixelTop = (idContent.style.pixelHeight-symbolbox.offsetHeight)/2
}
}
function InsertText()
{
PopupHide()
var oNode=document.createElement("div");
idContent.insertBefore(oNode);
oNode.style.fontFamily="Tahoma";
oNode.innerText='Enter text here';
oNode.style.position="absolute";
oNode.setActive()
}
function doCmd(sCmd,sOption)
{
PopupHide()
var oSel = document.selection.createRange()
var sType = document.selection.type
var oTarget = (sType == "None" ? idContent.document : oSel)
oTarget.execCommand(sCmd, false, sOption)
}
function document_onselectionchanged()
{
//Cut & Copy(try)
try
{
if(bBtnCut)
{
if(document.queryCommandEnabled('Cut'))
{
btnCut.en=true;
btnCut.style.pixelTop=0;//posisi enable
btnCopy.en=true;
btnCopy.style.pixelTop=0;
}
else
{
btnCut.en=false;
btnCut.style.pixelTop=-66;//posisi disable
btnCopy.en=false;
btnCopy.style.pixelTop=-66;
}
}
}
catch(e)
{}
//Bold, Italic, Underline
if(bBtnBold)
{
if(document.queryCommandEnabled('Bold'))
{
btnBold.en=true;
btnBold.state=document.queryCommandState('Bold');
btnOut(btnBold); //=>if(btn.state){btn.style.pixelTop=-88}else{btn.style.pixelTop=0}
}
else
{
btnBold.en=false;
btnBold.style.pixelTop=-66;
}
}
if(bBtnItalic)
{
if(document.queryCommandEnabled('Italic'))
{
btnItalic.en=true;
btnItalic.state=document.queryCommandState('Italic');
btnOut(btnItalic);
}
else
{
btnItalic.en=false;
btnItalic.style.pixelTop=-66;
}
}
if(bBtnUnderline)
{
if(document.queryCommandEnabled('Underline'))
{
btnUnderline.en=true;
btnUnderline.state=document.queryCommandState('Underline');
btnOut(btnUnderline);
}
else
{
btnUnderline.en=false;
btnUnderline.style.pixelTop=-66;
}
}
if(bBtnStrikethrough)
{
if(document.queryCommandEnabled('Strikethrough'))
{
btnStrikethrough.en=true;
btnStrikethrough.state=document.queryCommandState('Strikethrough');
btnOut(btnStrikethrough);
}
else
{
btnStrikethrough.en=false;
btnStrikethrough.style.pixelTop=-66;
}
}
if(bBtnSuperscript)
{
if(document.queryCommandEnabled('Superscript'))
{
btnSuperscript.en=true;
btnSuperscript.state=document.queryCommandState('Superscript');
btnOut(btnSuperscript);
}
else
{
btnSuperscript.en=false;
btnSuperscript.style.pixelTop=-66;
}
}
if(bBtnSubscript)
{
if(document.queryCommandEnabled('Subscript'))
{
btnSubscript.en=true;
btnSubscript.state=document.queryCommandState('Subscript');
btnOut(btnSubscript);
}
else
{
btnSubscript.en=false;
btnSubscript.style.pixelTop=-66;
}
}
//Justify (try)
try
{
if(bBtnJustifyLeft)
{
if(document.queryCommandEnabled('justifyleft'))
{
btnJustifyLeft.en=true;
btnJustifyLeft.state=document.queryCommandState('justifyleft');
btnOut(btnJustifyLeft);
}
else
{
btnJustifyLeft.en=false;
btnJustifyLeft.style.pixelTop=-66;
}
}
if(bBtnJustifyCenter)
{
if(document.queryCommandEnabled('JustifyCenter'))
{
btnJustifyCenter.en=true;
btnJustifyCenter.state=document.queryCommandState('JustifyCenter');
btnOut(btnJustifyCenter);
}
else
{
btnJustifyCenter.en=false;
btnJustifyCenter.style.pixelTop=-66;
}
}
if(bBtnJustifyRight)
{
if(document.queryCommandEnabled('JustifyRight'))
{
btnJustifyRight.en=true;
btnJustifyRight.state=document.queryCommandState('JustifyRight');
btnOut(btnJustifyRight);
}
else
{
btnJustifyRight.en=false;
btnJustifyRight.style.pixelTop=-66;
}
}
if(bBtnJustifyFull)
{
if(document.queryCommandEnabled('JustifyFull'))
{
btnJustifyFull.en=true;
btnJustifyFull.state=document.queryCommandState('JustifyFull');
btnOut(btnJustifyFull);
}
else
{
btnJustifyFull.en=false;
btnJustifyFull.style.pixelTop=-66;
}
}
}
catch(e)
{}
//Ordered & Unordered List
if(bBtnInsertOrderedList)
{
if(document.queryCommandEnabled('InsertOrderedList'))
{
btnInsertOrderedList.en=true;
btnInsertOrderedList.state=document.queryCommandState('InsertOrderedList');
btnOut(btnInsertOrderedList);
}
else
{
btnInsertOrderedList.en=false;
btnInsertOrderedList.style.pixelTop=-66;
}
}
if(bBtnInsertUnorderedList)
{
if(document.queryCommandEnabled('InsertUnorderedList'))
{
btnInsertUnorderedList.en=true;
btnInsertUnorderedList.state=document.queryCommandState('InsertUnorderedList');
btnOut(btnInsertUnorderedList);
}
else
{
btnInsertUnorderedList.en=false;
btnInsertUnorderedList.style.pixelTop=-66;
}
}
//Indent & Outdent
if(bBtnIndent)
{
if(document.queryCommandEnabled('Indent'))
{
btnIndent.en=true;
btnOut(btnIndent);
}
else
{
btnIndent.en=false;
btnIndent.style.pixelTop=-66;
}
}
if(bBtnOutdent)
{
if(document.queryCommandEnabled('Outdent'))
{
btnOutdent.en=true;
btnOut(btnOutdent);
}
else
{
btnOutdent.en=false;
btnOutdent.style.pixelTop=-66;
}
}
//Horizontal Line
if(bBtnHorizontalLine)
{
if(document.queryCommandEnabled('InsertHorizontalRule'))
{
btnHorizontalLine.en = true
btnHorizontalLine.style.pixelTop=0;
}
else
{
btnHorizontalLine.en = false
btnHorizontalLine.style.pixelTop=-66;
}
}
//Unlink
try
{
if(bBtnUnlink)
{
if(document.queryCommandEnabled('Unlink'))
{
btnUnlink.en = true
btnUnlink.style.pixelTop=0;
}
else
{
btnUnlink.en = false
btnUnlink.style.pixelTop=-66;
}
}
}
catch(e)
{}
//Image
if(bBtnInternalImage)
{
if(document.queryCommandEnabled('InsertImage'))
{
btnInternalImage.en = true
btnInternalImage.style.pixelTop=0;
//btnExternalImage.en = true
//btnExternalImage.style.pixelTop=0;
}
else
{
btnInternalImage.en = false
btnInternalImage.style.pixelTop=-66;
//btnExternalImage.en = false
//btnExternalImage.style.pixelTop=-66;
}
}
//Color
if(bBtnBackground)
{
if(document.queryCommandEnabled('BackColor'))
{
btnBackground.en = true
btnBackground.style.pixelTop=0;
}
else
{
btnBackground.en = false
btnBackground.style.pixelTop=-66;
}
}
if(bBtnForeground)
{
if(document.queryCommandEnabled('ForeColor'))
{
btnForeground.en = true
btnForeground.style.pixelTop=0;
}
else
{
btnForeground.en = false
btnForeground.style.pixelTop=-66;
}
}
//Absolute
if(bBtnAbsolute)
{
if(document.queryCommandEnabled('absoluteposition'))
{
btnAbsolute.en = true
btnAbsolute.style.pixelTop=0;
}
else
{
btnAbsolute.en = false
btnAbsolute.style.pixelTop=-66;
}
}
//Remove Format
if(bBtnRemoveFormat)
{
if(document.queryCommandEnabled('removeformat'))
{
btnRemoveFormat.en = true
btnRemoveFormat.style.pixelTop=0;
}
else
{
btnRemoveFormat.en = false
btnRemoveFormat.style.pixelTop=-66;
}
}
var oSel = idContent.document.selection.createRange()
var sType = idContent.document.selection.type
//Style
if(bBtnStyle)
{
if(oSel.parentElement && oSel.text!="")
{
btnStyle.en = true
btnStyle.style.pixelTop=0;
}
else
{
btnStyle.en = false
btnStyle.style.pixelTop=-66;
}
}
if(bBtnInsertSymbol)
{
if(oSel.parentElement)
{
btnInsertSymbol.en = true
btnInsertSymbol.style.pixelTop=0;
}
else
{
btnInsertSymbol.en = false
btnInsertSymbol.style.pixelTop=-66;
}
}
//Paragraph, Font Name, Font Size
if(bBtnParagraph)
{
if(document.queryCommandEnabled('FormatBlock'))
{
btnParagraph.en = true
btnParagraph.style.pixelTop=0;
if(document.queryCommandValue('FormatBlock')==null)
btnParagraphText.innerHTML = ""
else
btnParagraphText.innerHTML = "<font face='MS Sans Serif' size=1 color=#316AC5><b>"+document.queryCommandValue('FormatBlock')+"</b></font>";
}
else
{
if(document.queryCommandValue('FormatBlock')==null)
btnParagraphText.innerHTML = ""
else
btnParagraphText.innerHTML = "<font face='MS Sans Serif' size=1 color=silver><b>"+document.queryCommandValue('FormatBlock')+"</b></font>";
btnParagraph.en = false
btnParagraph.style.pixelTop=-66;
}
}
if(bBtnFontName)
{
if(document.queryCommandEnabled('FontName'))
{
btnFontName.en = true
btnFontName.style.pixelTop=0;
if(document.queryCommandValue('FontName')==null)
btnFontNameText.innerHTML = "";
else
btnFontNameText.innerHTML = "<font face='MS Sans Serif' size=1 color=#316AC5><b>"+document.queryCommandValue('FontName')+"</b></font>";
}
else
{
if(document.queryCommandValue('FontName')==null)
btnFontNameText.innerHTML = "";
else
btnFontNameText.innerHTML = "<font face='MS Sans Serif' size=1 color=silver><b>"+document.queryCommandValue('FontName')+"</b></font>";
btnFontName.en = false
btnFontName.style.pixelTop=-66;
}
}
if(bBtnFontSize)
{
if(document.queryCommandEnabled('FontSize'))
{
btnFontSize.en = true
btnFontSize.style.pixelTop=0;
if(document.queryCommandValue('FontSize')==null)
btnFontSizeText.innerHTML = "";
else
btnFontSizeText.innerHTML = "<font face='MS Sans Serif' size=1 color=#316AC5><b>"+document.queryCommandValue('FontSize')+"</b></font>";
}
else
{
if(document.queryCommandValue('FontSize')==null)
btnFontSizeText.innerHTML = "";
else
btnFontSizeText.innerHTML = "<font face='MS Sans Serif' size=1 color=silver><b>"+document.queryCommandValue('FontSize')+"</b></font>";
btnFontSize.en = false
btnFontSize.style.pixelTop=-66;
}
}
/*
bBtnInsertText
bBtnPaste
bBtnUndo
bBtnRedo
bBtnWord
bBtnTable
bBtnExternalLink
bBtnInternalLink
bBtnDocumentBackground
*/
}
function Justify(btn,sCmd)
{
if(btn.state)return;//when clicked, no change if already true
if(btn!=btnJustifyLeft)
{
btnJustifyLeft.state=false;
btnOut(btnJustifyLeft);
}
if(btn!=btnJustifyCenter)
{
btnJustifyCenter.state=false;
btnOut(btnJustifyCenter);
}
if(btn!=btnJustifyRight)
{
btnJustifyRight.state=false;
btnOut(btnJustifyRight);
}
if(btn!=btnJustifyFull)
{
btnJustifyFull.state=false;
btnOut(btnJustifyFull);
}
doCmd(sCmd);
btn.state=!btn.state;
}
function List(btn)
{
if(btn==btnInsertOrderedList)
{
doCmd('insertorderedlist');
btn.state=!btn.state;
btnInsertUnorderedList.state=false;
btnOut(btnInsertUnorderedList);
}
if(btn==btnInsertUnorderedList)
{
doCmd('insertunorderedlist');
btn.state=!btn.state;
btnInsertOrderedList.state=false;
btnOut(btnInsertOrderedList);
}
}
/********************************************************************/
/* Toolbar Stuff
/********************************************************************/
function btnOver(btn)
{
if(btn.en==false)return;
if(btn.state){btn.style.pixelTop=-44}else{btn.style.pixelTop=-22};
}
function btnDown(btn)
{
if(btn.en==false)return;
btn.style.pixelTop=-44;
}
function btnUp(btn)
{
if(btn.en==false)return;
if(btn.state)
{
//togle exception for justify button
//if btn.state already true, when it's clicked, onmouseup will still true
if(btn==btnJustifyLeft||
btn==btnJustifyCenter||
btn==btnJustifyRight||
btn==btnJustifyFull)
{btn.style.pixelTop=-88}
else
btn.style.pixelTop=0
}
else
{btn.style.pixelTop=-88}
}
function btnOut(btn)
{
if(btn.en==false)return;
if(btn.state){btn.style.pixelTop=-88}else{btn.style.pixelTop=0}
}
function insertHTML(sHTML)
{
var oSel = idContent.document.selection.createRange()
var sType = idContent.document.selection.type
if (sType=="Control")
oSel.item(0).outerHTML = sHTML
else
oSel.pasteHTML(sHTML)
}
function GetElement(oElement,sMatchTag)
{
while (oElement!=null && oElement.tagName!=sMatchTag)
{
if(oElement.id=="idContent") return null;
oElement = oElement.parentElement
}
return oElement
}
function drawIcon(left,width,id,title,command)
{
var sHTML = ""
sHTML += ("<span unselectable=\"on\" id=\"span"+id+"\" style=\"width: "+width+";height:22;\">")
sHTML += (" <span unselectable=\"on\" style=\"position:absolute;clip: rect(0 "+width+" 22 0)\">")
sHTML += (" <img unselectable=\"on\" id=\""+id+"\" ")
sHTML += (" title=\""+title+"\" onclick=\""+command+"\" src=\"editor/ace.gif\" ")
sHTML += (" style=\"position:absolute;top:0;left:-"+left+";\" ")
sHTML += (" onmouseover=\"btnOver(this)\" ")
sHTML += (" onmousedown=\"btnDown(this)\" ")
sHTML += (" onmouseup=\"btnUp(this)\" ")
sHTML += (" onmouseout=\"btnOut(this)\" ")
sHTML += (" width=\"1361\" ")
sHTML += (" height=\"110\">")
sHTML += (" </span>")
sHTML += ("</span>")
return sHTML;
}
function drawIcon2(left,width,id,title,command)
{
var sHTML = "";
sHTML += ("<span unselectable=\"on\" id=\"span"+id+"\" style=\"width: "+width+";height:22;\">")
sHTML += (" <span unselectable=\"on\" style=\"position:absolute;clip: rect(0 "+width+" 22 0)\">")
sHTML += (" <img unselectable=\"on\" id=\""+id+"\" ")
sHTML += (" title=\""+title+"\" onclick=\""+command+"\" src=\"editor/ace.gif\" ")
sHTML += (" style=\"position:absolute;top:0;left:-"+left+";\" ")
sHTML += (" onmouseover=\"if(this.en==false)return;this.style.pixelTop=-22\" ")
sHTML += (" onmousedown=\"if(this.en==false)return;this.style.pixelTop=-44\" ")
sHTML += (" onmouseup=\"if(this.en==false)return;this.style.pixelTop=-22\" ")
sHTML += (" onmouseout=\"if(this.en==false)return;this.style.pixelTop=0\" ")
sHTML += (" width=\"1361\" ")
sHTML += (" height=\"110\">")
sHTML += (" <table width="+width+"><tr><td onselectstart='return false' style=\"position:absolute;top:4;left:7;\" id=\""+id+"Text\"></td></tr></table>")
sHTML += (" </span>")
sHTML += ("</span>")
return sHTML;
}
/*
1. link bila diinsertkan yg ada link yg lain/proses copy paste maka ada
http://localhost/...... (
ie5 replace => pake vbscript
ie55 replace => pake javascript replace
replace case-sensitive) => sudah di-apply LCase & toLowerCase
*/
var displayMode = "RICH"
function getDisplayMode()
{
return displayMode;
}
function setDisplayMode()
{
PopupHide()
if(displayMode=='RICH')
{
idContent.clearAttributes;
idContent.style.fontFamily = 'Arial, Courier New';
idContent.style.fontSize = '12px';
idContent.innerText = idContent.innerHTML
displayMode = 'HTML';
idToolbar.style.display = "none";
}
else
{
idContent.clearAttributes;
idContent.style.fontFamily = '';
idContent.style.fontSize = '';
idContent.innerHTML = idContent.innerText;
displayMode = 'RICH';
idToolbar.style.display = "block";
}
}
function pasteFromWord()
{
idContent.focus()
var oSel = document.selection.createRange()
if(oSel.parentElement)//yg dipilih text bukan control
{
idContentTmp.focus()
idContentTmp.document.execCommand("SelectAll")
idContentTmp.document.execCommand("Paste")
oSel.pasteHTML(cleanFromWord())
}
}
function cleanFromWord()
{
for (var i = 0; i < idContentTmp.all.length; i++)
{
idContentTmp.all[i].removeAttribute("className","",0);
idContentTmp.all[i].removeAttribute("style","",0);
}
var sHTML = idContentTmp.innerHTML;
sHTML = sHTML.replace(/<\?xml:.*?\/>/g, "");
sHTML = sHTML.replace(/<o:p> <\/o:p>/g, "");
//sHTML = sHTML.replace(/o:/g, ""); //problem with mailto:xxxxx
sHTML = sHTML.replace(/<o:p>/g, "");
//sHTML = sHTML.replace(/<\/o:p>/g, ""); //not needed
sHTML = sHTML.replace(/<st1:.*?>/g, "");
return sHTML;
}
</script>
<!--
<script TYPE="text/javascript" FOR="document" EVENT="onselectionchange" language="JavaScript">
document_onselectionchanged()
</script>
-->
<script language=JavaScript for=idContent event=onkeypress>
if(chkBreakMode.checked)
{
if (event.keyCode==13)
{
if (event.shiftKey==false)
{
var thisSel =
document.selection.createRange();
thisSel.pasteHTML('<br>')
event.cancelBubble = true;
event.returnValue = false;
thisSel.select();
thisSel.moveEnd("character", 1);
thisSel.moveStart("character", 1);
thisSel.collapse(false);
return false;
idContent.focus();
}
else
{
return event.keyCode=13
}
}
}
</script>
</HEAD>
<BODY oncontextmenu="return false" ondragstart="return false" style="font:8pt verdana,arial,sans-serif">
<!-- CONTENT EDIT AREA -->
<div class="editAreaTmp" id="idContentTmp" name="idContentTmp"></div>
<table id="idToolbar" bgcolor=#E2E2E2 cellpadding=0 cellspacing=0 class=tblCoolbar height=49>
<tr>
<td>
<span id="id01" unselectable="on"></span>
</td>
</tr>
</table>
<table width="100%" cellpadding=0 cellspacing=0 border=0 ID="Table20">
<tr>
<td>
<div class="editArea" id="idContent" name="idContent" onclick="PopupHide()"></div>
</td>
</tr>
</table>
<table border=0 cellpadding=0 cellspacing=0 ID="idToolbarBottom" class=tblCoolbar height=29>
<tr>
<td>
<input type='checkbox' onclick='setDisplayMode()' id=chkDisplayMode name=chkDisplayMode> HTML
<input type='checkbox' id="chkBreakMode" name=chkBreakMode> BR
</td>
<td align=right>
<INPUT style="display:none" type="button" value="Save" onClick="Save()" id=btnSave name=btnSave disabled>
</td>
</tr>
</table>
<!-- /CONTENT EDIT AREA -->
<!-- Link box -->
<script language=javascript>
var oSelStore;
var sTypeStore;
var oElStore;
var isLayerActive;
function DisplayExternalLinkBox()
{
PopupHide()
linkbox.style.display='block';
setPosition()
var sURL;
var oSel = document.selection.createRange()
var sType = document.selection.type
oSelStore = oSel
sTypeStore = sType
if (oSel.parentElement)//If text is selected on a layer
{
oEl = GetElement(oSel.parentElement(),"DIV")//!
oElStore = oEl;//Store the active layer, so we can activate it after editing links
isLayerActive=true;
}
else//If control is selected
{
isLayerActive=false;
}
/*****************************************************************************/
/* idLinkImage & idLinkImageBorder
/*****************************************************************************/
//Is the selection image or not ?
if (oSel.parentElement)//If not an image (such as text)
{
oEl = GetElement(oSel.parentElement(),"A")//Get A element if any
idLinkImage.style.display = "none";//do not display Image features on the Link Dialog
}
else //If a control
{
oEl = GetElement(oSel.item(0),"A")//Get A element if any
if ((oSel.item) && (oSel.item(0).tagName=="IMG")) //If an image
{
idLinkImage.style.display = "block"; //display Image features on the Link Dialog
idLinkImageBorder.value = oSel.item(0).border; //get image border
}
}
/*****************************************************************************/
/* idLinkTarget & idLinkType & idLinkURL
/*****************************************************************************/
//Is there an A element ?
if (oEl)//If Yes
{
btnLinkAction.value = "Update"
sURL = oEl.href //get image url
idLinkTarget.value = oEl.target;//get image target
if(sURL.indexOf(":")!=-1)
{
switch(sURL.split(":")[0])
{
case "http":
idLinkType.value = "
http://"; idLinkURL.value = sURL.substr(7);
break;
case "https":
idLinkType.value = "
https://"; idLinkURL.value = sURL.substr(8);
break;
case "mailto":
idLinkType.value = "mailto:";
idLinkURL.value = sURL.split(":")[1];
break;
case "ftp":
idLinkType.value = "
ftp://"; idLinkURL.value = sURL.substr(6);
break;
case "news":
idLinkType.value = "news:";
idLinkURL.value = sURL.split(":")[1];
break;
}
}
else
{
idLinkType.value = "";
idLinkURL.value = sURL;
}
}
else //If No A element
{
btnLinkAction.value = "Insert"
idLinkTarget.value = ""
idLinkType.value = ""
idLinkURL.value = ""
idLinkImageBorder.value = 0
}
idLinkURL.focus();//tambahan
}
function CreateHyperlink()
{
//idContent.focus()
PopupHide()//Hide Link Dialog
//Get URL typed by user
var inpURL = idLinkURL.value
var inpURLType = idLinkType.value
var sURL = inpURLType + inpURL
//Use the previous active selection
var oSel = oSelStore;// document.selection.createRange()
var sType = sTypeStore;// document.selection.type
//if(oElStore!=null)
{
/***********************************************************************/
/* idLinkImageBorder
/***********************************************************************/
if ((oSel.item) && (oSel.item(0).tagName=="IMG")) //If image is selected
{
oSel.item(0).width = oSel.item(0).offsetWidth //kasih attribute width
oSel.item(0).height = oSel.item(0).offsetHeight //kasih attribute height
oSel.item(0).border = idLinkImageBorder.value
}
if(inpURL!="")//If there is URL typed by user
{
if (oSel.parentElement) //If text selection
{
if(btnLinkAction.value == "Insert")
{
if(oSel.text!="")
{
//noop
}
else
{
var oSelTmp = oSel.duplicate()
oSel.text = sURL //displayed text = sURL
oSel.setEndPoint("StartToStart",oSelTmp)
oSel.select()
sType="Text"
}
}
if(btnLinkAction.value == "Update") //pasti ada A element
{
if(oSel.text!="")
{
//noop
//oEl = GetElement(oSel.parentElement(),"A")
//oEl.innerText = sURL
}
else
{
//noop
//oEl = GetElement(oSel.parentElement(),"A")
//oEl.innerText = sURL
}
}
}
/***********************************************************************/
/* idLinkType & idLinkURL (sURL)
/***********************************************************************/
oSel.execCommand("CreateLink",false,sURL)
//After A element created, then add the Target
//oSel = document.selection.createRange()
if (oSel.parentElement)
{
oEl = GetElement(oSel.parentElement(),"A")
}
else
{
oEl = GetElement(oSel.item(0),"A")
}
if(oEl)
{
if(idLinkTarget.value=="")
{
oEl.removeAttribute("target",0)
}
else
{
oEl.target = idLinkTarget.value;
}
}
idContent.focus()
oSel.select()//tambahan
}
//Activate layer again
if(isLayerActive)oElStore.setActive();
}
}
</script>
<div id="linkbox" style="position:absolute;display:none">
<table border="0" cellpadding="0" cellspacing="0" style="table-layout: fixed" bgcolor=Gainsboro ID="Table1">
<col width=310><col width=13>
<tr>
<td>
<div class="bar" style="padding-left: 5px;">
<font size="2" face="Verdana" color="black"><b>Insert/Edit Link</b></font>
</div>
</td>
<td style="cursor:hand" onclick="linkbox.style.display='none';if(isLayerActive)oElStore.setActive();">
<div class="bar">
<font size="2" face="Verdana" color="black"><b>X</b></font>
</div>
</td>
</tr>
<tr>
<td colspan=2 style="border-left: #336699 1px solid;border-right: #336699 1px solid;border-bottom: #336699 1px solid;">
<table cellpadding="0" cellspacing="3" align=center ID="Table2">
<tr>
<td>
<select id="idLinkType" NAME="idLinkType">
<option value="" selected></option>
<option value="
http://" selected>
http://</option> <option value="
https://">https://</option> <option value="mailto:">mailto:</option>
<option value="
ftp://">ftp://</option> <option value="news:">news:</option>
</select>
<input type=text size=30 id=idLinkURL value="" style="height: 19px;font:8pt verdana,arial,sans-serif" NAME="idLinkURL">
</td>
</tr>
<tr>
<td>
Target :
<select id="idLinkTarget" NAME="idLinkTarget">
<option value="" selected></option>
<option value="_self" selected>self</option>
<option value="_blank">blank</option>
<option value="_parent">parent</option>
</select>
<div id="idLinkImage" style="display:none">
<br>
Image Border :
<select id="idLinkImageBorder" NAME="idLinkImageBorder">
<option value="0" selected>0</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
</select>
</div>
</td>
</tr>
<tr>
<td align=center><br>
<input type="button" value="Cancel" onclick="linkbox.style.display='none';if(isLayerActive)oElStore.setActive();" style="height: 22px;font:8pt verdana,arial,sans-serif" ID="Button1" NAME="Button1">
<input type="button" id="btnLinkAction" name="btnLinkAction" value="Insert" onclick="CreateHyperlink();linkbox.style.display='none'" style="height: 22px;font:8pt verdana,arial,sans-serif">
<input type="button" value="Dokument Link" onClick="PopLink('editor/InsertLink.asp')";linkbox.style.display='none'" style="height: 22px;font:8pt verdana,arial,sans-serif">
</td>
</tr>
</table>
<br>
</td>
</tr>
</table>
</div>
<!-- /Link box -->
<!-- Colour box -->
<script language=javascript>
function displayFgColorBox()
{
PopupHide()
if(divFgColor.innerHTML=="")
{
divFgColor.innerHTML=writeColorPicker("idForeColor","doCmd('ForeColor',idForeColor.value);fgcolorbox.style.display='none'",0);
for (i=0; i<divFgColor.all.length; i++)
divFgColor.all(i).unselectable = "on";
}
setDefaultColor("idForeColor","")
fgcolorbox.style.display='block';
setPosition()
}
function displayBgColorBox()
{
PopupHide()
if(divBgColor.innerHTML=="")
{
divBgColor.innerHTML=writeColorPicker("idBackColor","doCmd('BackColor',idBackColor.value);bgcolorbox.style.display='none'",0);
for (i=0; i<divBgColor.all.length; i++)
divBgColor.all(i).unselectable = "on";
}
setDefaultColor("idBackColor","")
bgcolorbox.style.display='block';
setPosition()
}
function displayDocBgColorBox()
{
PopupHide()
if(divDocBgColor.innerHTML=="")
{
divDocBgColor.innerHTML=writeColorPicker("idDocBackColor","idContent.style.background=idDocBackColor.value;docbgcolorbox.style.display='none'",0);
for (i=0; i<divDocBgColor.all.length; i++)
divDocBgColor.all(i).unselectable = "on";
}
setDefaultColor("idDocBackColor","")
docbgcolorbox.style.display='block';
setPosition()
}
function setDefaultColor(Name,Color)
{
var OutputID = Name
var TextID = Name + "_1"
var ColorID = Name + "_2"
eval(OutputID).value = Color;
eval(TextID).innerHTML = "<font size=1>"+Color+"</font>"
eval(ColorID).style.background = Color;
}
function writeColorPicker(Name,Command,Type)
{
var OutputID = Name
var TextID = Name + "_1"
var ColorID = Name + "_2"
var c1 = new Array("FFFFCC","FFCC66","FF9900","FFCC99","FF6633","FFCCCC","CC9999","FF6699","FF99CC","FF66CC","FFCCFF","CC99CC","CC66FF","CC99FF","9966CC","CCCCFF","9999CC","3333FF","6699FF","0066FF","99CCFF","66CCFF","99CCCC","CCFFFF","99FFCC","66CC99","66FF99","99FF99","CCFFCC","33FF33","66FF00","CCFF99","99FF00","CCFF66","CCCC66","FFFFFF")
var c2 = new Array("FFFF99","FFCC00","FF9933","FF9966","CC3300","FF9999","CC6666","FF3366","FF3399","FF00CC","FF99FF","CC66CC","CC33FF","9933CC","9966FF","9999FF","6666FF","3300FF","3366FF","0066CC","3399FF","33CCFF","66CCCC","99FFFF","66FFCC","33CC99","33FF99","66FF66","99CC99","00FF33","66FF33","99FF66","99FF33","CCFF00","CCCC33","CCCCCC")
var c3 = new Array("FFFF66","FFCC33","CC9966","FF6600","FF3300","FF6666","CC3333","FF0066","FF0099","FF33CC","FF66FF","CC00CC","CC00FF","9933FF","6600CC","6633FF","6666CC","3300CC","0000FF","3366CC","0099FF","00CCFF","339999","66FFFF","33FFCC","00CC99","00FF99","33FF66","66CC66","00FF00","33FF00","66CC00","99CC66","CCFF33","999966","999999")
var c4 = new Array("FFFF33","CC9900","CC6600","CC6633","FF0000","FF3333","993333","CC3366","CC0066","CC6699","FF33FF","CC33CC","9900CC","9900FF","6633CC","6600FF","666699","3333CC","0000CC","0033FF","6699CC","3399CC","669999","33FFFF","00FFCC","339966","33CC66","00FF66","669966","00CC00","33CC00","66CC33","99CC00","CCCC99","999933","666666")
var c5 = new Array("FFFF00","CC9933","996633","993300","CC0000","FF0033","990033","996666","993366","CC0099","FF00FF","990099","996699","660099","663399","330099","333399","000099","0033CC","003399","336699","0099CC","006666","00FFFF","33CCCC","009966","00CC66","339933","336633","33CC33","339900","669933","99CC33","666633","999900","333333")
var c6 = new Array("CCCC00","996600","663300","660000","990000","CC0033","330000","663333","660033","990066","CC3399","993399","660066","663366","330033","330066","333366","000066","000033","003366","006699","003333","336666","00CCCC","009999","006633","009933","006600","003300","00CC33","009900","336600","669900","333300","666600","000000")
var sHTML = "";
sHTML += ("<table border=0 width=370 align=center cellpadding=0 cellspacing=0><tr><td width=45> <table border=1 cellpadding=0 cellspacing=0><tr><td id='"+ColorID+"' width=25 height=25></td></tr></table> <div id='"+TextID+"'><font size=1> </font></div> </td><td> </td><td>")
sHTML += ("<table cellpadding=0 cellspacing=1 bgcolor=black>")
if(Type==0)
{
for(var i=1;i<=6;i++)
{
sHTML += ("<tr>")
for(var r=0;r<eval("c"+i).length;r++)
{
var colour = eval("c"+i+"[r]")
sHTML += ("<td onclick=\""+OutputID+".value='"+colour+"';"+Command+"\" style=\"cursor:hand;background-color:"+colour+";\" width=9 height=6 onmouseover=\""+ColorID+".style.background='#"+colour+"';"+TextID+".innerHTML='<font size=1>"+colour+"</font>'\"></td>")
}
sHTML += ("</tr>")
}
}
if(Type==1)
{
for(var i=1;i<=6;i++)
{
sHTML += ("<tr>")
for(var r=0;r<eval("c"+i).length;r++)
{
var colour = eval("c"+i+"[r]")
sHTML += ("<td onclick=\""+ColorID+".style.background='#"+colour+"';"+TextID+".innerHTML='<font size=1>"+colour+"</font>';"+OutputID+".value='"+colour+"';"+Command+"\" style=\"cursor:hand;background-color:"+colour+";\" width=9 height=6 onmouseover=\"\"></td>")
}
sHTML += ("</tr>")
}
}
sHTML += ("</table>")
sHTML += ("<input type=hidden id='"+OutputID+"'>")
sHTML += ("</td></tr></table>")
return sHTML;
}
</script>
<!-- Colour box -->
<div id="fgcolorbox" style="position:absolute;display:none;">
<table border="0" cellpadding="0" cellspacing="0" style="table-layout: fixed" bgcolor="Gainsboro" ID="Table3">
<col width="430">
<col width="13">
<tr>
<td>
<div class="bar" style="padding-left: 5px;">
<font size="2" face="Verdana" color="black"><b>Select Foreground Color</b></font>
</div>
</td>
<td style="cursor:hand" onclick="fgcolorbox.style.display='none'">
<div class="bar">
<font size="2" face="Verdana" color="black"><b>X</b></font>
</div>
</td>
</tr>
<tr>
<td colspan="2" style="border-left: #336699 1px solid;border-right: #336699 1px solid;border-bottom: #336699 1px solid;">
<br>
<div id="divFgColor"></div>
<br>
</td>
</tr>
</table>
</div>
<!-- /Colour box -->
<!-- Colour box -->
<div id="bgcolorbox" style="position:absolute;display:none;">
<table border="0" cellpadding="0" cellspacing="0" style="table-layout: fixed" bgcolor="Gainsboro" ID="Table4">
<col width="430">
<col width="13">
<tr>
<td>
<div class="bar" style="padding-left: 5px;">
<font size="2" face="Verdana" color="black"><b>Select Background Color</b></font>
</div>
</td>
<td style="cursor:hand" onclick="bgcolorbox.style.display='none'">
<div class="bar">
<font size="2" face="Verdana" color="black"><b>X</b></font>
</div>
</td>
</tr>
<tr>
<td colspan="2" style="border-left: #336699 1px solid;border-right: #336699 1px solid;border-bottom: #336699 1px solid;">
<br>
<div id="divBgColor"></div>
<br>
</td>
</tr>
</table>
</div>
<!-- /Colour box -->
<!-- Document Colour box -->
<div id="docbgcolorbox" style="position:absolute;display:none;">
<table border="0" cellpadding="0" cellspacing="0" style="table-layout: fixed" bgcolor="Gainsboro" ID="Table19">
<col width="430">
<col width="13">
<tr>
<td>
<div class="bar" style="padding-left: 5px;">
<font size="2" face="Verdana" color="black"><b>Select Document Background Color</b></font>
</div>
</td>
<td style="cursor:hand" onclick="docbgcolorbox.style.display='none'">
<div class="bar">
<font size="2" face="Verdana" color="black"><b>X</b></font>
</div>
</td>
</tr>
<tr>
<td colspan="2" style="border-left: #336699 1px solid;border-right: #336699 1px solid;border-bottom: #336699 1px solid;">
<br>
<div id="divDocBgColor"></div>
<br>
</td>
</tr>
</table>
</div>
<!-- /Document Colour box -->
<!-- Paragraph box -->
<script language=javascript>
function displayParagraphBox()
{
PopupHide()
parabox.style.display='block';
setPosition()
}
function displayFontNameBox()
{
PopupHide()
fontnamebox.style.display='block';
setPosition()
}
function displayFontSizeBox()
{
PopupHide()
fontsizebox.style.display='block';
setPosition()
}
function setParagraph(Paragraph)
{
btnParagraphText.innerHTML = "<font face='MS Sans Serif' size=1 color=#316AC5><b>"+Paragraph+"</b></font>";
}
function setFontName(FontName)
{
btnFontNameText.innerHTML = "<font face='MS Sans Serif' size=1 color=#316AC5><b>"+FontName+"</b></font>";
}
function setFontSize(FontSize)
{
btnFontSizeText.innerHTML = "<font face='MS Sans Serif' size=1 color=#316AC5><b>"+FontSize+"</b></font>";
}
</script>
<div id="parabox" style="position:absolute;display:none;">
<table border="0" cellpadding="0" cellspacing="0" style="table-layout: fixed" bgcolor=Gainsboro ID="Table5">
<col width=240><col width=13>
<tr>
<td>
<div class="bar" style="padding-left: 5px;">
<font size="2" face="Verdana" color="black"><b>Paragraph Style</b></font>
</div>
</td>
<td style="cursor:hand" onclick="parabox.style.display='none'">
<div class="bar">
<font size="2" face="Verdana" color="black"><b