////////////////////////////////////////////////////////////////////////////////
// Constants
-var minWidth = 450; // minumum width
+var ctxpath = "/siman/";
+var minWidth = 400; // minumum width
var wrapWidth = 1245; //width at which all icons will appear on one bar
var maxchar = 64000; // maximum number of characters per save
var lang = "en"; //xhtml language
wrapWidth = 14 * 24;
defaultFont = "Arial, Helvetica, sans-serif";
- initRTE("../rtef/images/", "../rtef/", "", true);
+ initRTE(ctxpath + "rtef/images/", ctxpath + "rtef/", "", true);
}
function initTextEditor() {
wrapWidth = 15 * 24;
defaultFont = "Arial, Helvetica, sans-serif";
- initRTE("../rtef/images/", "../rtef/", "", true);
+ initRTE(ctxpath + "rtef/images/", ctxpath + "rtef/", "", true);
}
function addCommand(name, action) {
document.writeln('<tbody><tr>');
insertBar();
if(fullscreen || activeCommand.get("save") != null){
- document.writeln('<td><input type="image" class="rteImg" src="'+imagesPath+'save.gif" alt="'+lblSave+'" title="'+lblSave+'" onmouseover="this.className=\'rteImgUp\'" onmouseout="this.className=\'rteImg\'" onmousedown="this.className=\'rteImgDn\'" onmouseup="this.className=\'rteImgUp\'" onClick="submitEdit()"></td>');
+ document.writeln('<td><input type="image" class="rteImg" id="'+rte+'SaveButton" src="'+imagesPath+'save.gif" alt="'+lblSave+'" title="'+lblSave+'" onmouseover="this.className=\'rteImgUp\'" onmouseout="this.className=\'rteImg\'" onmousedown="this.className=\'rteImgDn\'" onmouseup="this.className=\'rteImgUp\'" onClick="prepareSubmitEdit(\''+rte+'\')"></td>');
nbcommand += 1;
}
if(!isSafari && !isKonqueror) {
// insertImg(lblUnformat,"unformat.gif","rteCommand('"+rte+"','removeformat')");
insertSep();
}
- if(isIE || isSafari || isKonqueror) {
+ if(false) {
addCommand("cut","rteCommand('"+rte+"','cut')");
// insertImg(lblCut,"cut.gif","rteCommand('"+rte+"','cut')");
addCommand("copy","rteCommand('"+rte+"','copy')");
// insertImg(lblCopy,"copy.gif","rteCommand('"+rte+"','copy')");
- }
- if(isSafari || isKonqueror) {
addCommand("paste","rteCommand('"+rte+"','InsertText')");
// insertImg(lblPaste,"paste.gif","rteCommand('"+rte+"','InsertText')");
}
// insertImg(lblAlgnRight,"right_just.gif","rteCommand('"+rte+"','justifyright')");
addCommand("justifyfull","rteCommand('"+rte+"','justifyfull')");
// insertImg(lblJustifyFull,"justifyfull.gif","rteCommand('"+rte+"','justifyfull')");
- if(!isSafari && !isKonqueror) {
+ insertSep();
+ addCommand("numbered_list","rteCommand('"+rte+"','insertorderedlist')");
+// insertImg(lblOL,"numbered_list.gif","rteCommand('"+rte+"','insertorderedlist')");
+ addCommand("list","rteCommand('"+rte+"','insertunorderedlist')");
+// insertImg(lblUL,"list.gif","rteCommand('"+rte+"','insertunorderedlist')");
+ addCommand("hyperlink","dlgLaunch('"+rte+"','link')");
+// insertImg(lblInsertLink,"hyperlink.gif","dlgLaunch('"+rte+"','link')");
+ if(false) {
insertSep();
- addCommand("numbered_list","rteCommand('"+rte+"','insertorderedlist')");
-// insertImg(lblOL,"numbered_list.gif","rteCommand('"+rte+"','insertorderedlist')");
- addCommand("list","rteCommand('"+rte+"','insertunorderedlist')");
-// insertImg(lblUL,"list.gif","rteCommand('"+rte+"','insertunorderedlist')");
- addCommand("outdent","rteCommand('"+rte+"','outdent')");
-// insertImg(lblOutdent,"outdent.gif","rteCommand('"+rte+"','outdent')");
- addCommand("indent","rteCommand('"+rte+"','indent')");
-// insertImg(lblIndent,"indent.gif","rteCommand('"+rte+"','indent')");
insertSep();
addCommand("textcolor","dlgColorPalette('"+rte+"','forecolor')","forecolor_"+rte);
// insertImg(lblTextColor,"textcolor.gif","dlgColorPalette('"+rte+"','forecolor')","forecolor_"+rte);
insertSep();
addCommand("special_char","dlgLaunch('"+rte+"','char')");
// insertImg(lblInsertChar,"special_char.gif","dlgLaunch('"+rte+"','char')");
- addCommand("hyperlink","dlgLaunch('"+rte+"','link')");
-// insertImg(lblInsertLink,"hyperlink.gif","dlgLaunch('"+rte+"','link')");
addCommand("image","dlgLaunch('"+rte+"','image')");
// insertImg(lblAddImage,"image.gif","dlgLaunch('"+rte+"','image')");
addCommand("insert_table","dlgLaunch('"+rte+"','table')");
// insertImg(lblInsertTable,"insert_table.gif","dlgLaunch('"+rte+"','table')");
}
+ addCommand("outdent","rteCommand('"+rte+"','outdent')");
+// insertImg(lblOutdent,"outdent.gif","rteCommand('"+rte+"','outdent')");
+ addCommand("indent","rteCommand('"+rte+"','indent')");
+// insertImg(lblIndent,"indent.gif","rteCommand('"+rte+"','indent')");
insertSep();
- if(!isSafari && !isKonqueror) {
+ if(false) {
addCommand("replace","dlgLaunch('"+rte+"','replace')");
// insertImg(lblSearch,"replace.gif","dlgLaunch('"+rte+"','replace')");
}
if(id!=null){
td = "<td id='"+id+"'>";
}
- document.writeln(td+'<img class="rteImg" src="'+imagesPath+image+'" alt="'+name+'" title="'+name+'" onMouseDown="'+command+';return false" onmouseover="this.className=\'rteImgUp\'" onmouseout="this.className=\'rteImg\'" onmousedown="this.className=\'rteImgDn\'" onmouseup="this.className=\'rteImgUp\'"></td>');
+ document.writeln(td+'<img class="rteImg" src="'+imagesPath+image+'" alt="'+name+'" title="'+name+'" onClick="'+command+';return false" onmouseover="this.className=\'rteImgUp\'" onmouseout="this.className=\'rteImg\'" onmousedown="this.className=\'rteImgDn\'" onmouseup="this.className=\'rteImgUp\'"></td>');
}
function enableDesignMode(rte, html, css, readOnly) {
if(isGecko && !readOnly) {
//attach a keyboard handler for gecko browsers to make keyboard shortcuts work
oRTE.addEventListener("keypress", geckoKeyPress, true);
- oRTE.addEventListener("focus", function (){dlgCleanUp();}, false);
}
} catch(e) {
alert(lblErrorPreload);
//gecko may take some time to enable design mode.
//Keep looping until able to set.
if(isGecko){
- setTimeout("enableDesignMode('"+rte+"', '"+html+"', '"+css+"', "+readOnly+");", 200);
+ if(!timeLeft) {
+ timeLeft = 5000;
+ }
+ if(timeLeft > 0) {
+ setTimeout("enableDesignMode('"+rte+"', '"+html+"', '"+css+"', "+readOnly+ "','"+(timeLeft-200)+"');", 200);
+ }
}else{
return false;
}
return rtn;
}
-function setFormText(popup, content){
+function setFormText(popup, content, timeLeft){
//set link text value in dialog windows
if(content != "undefined")
{
}catch(e){
//may take some time to create dialog window.
//Keep looping until able to set.
- setTimeout("setFormText('"+popup+"','" + content + "');", 10);
- }
+ if(!timeLeft) {
+ timeLeft = 5000;
+ }
+ if(timeLeft > 0) {
+ setTimeout("setFormText('"+popup+"','" + content + "','"+(timeLeft-200)+"');", 200);
+ }
+ }
}
}
//function to store range of current selection
var oRTE = returnRTE(rte);
var selection;
- if(document.all){
+ if(document.all){ //IE
selection = oRTE.document.selection;
if(selection != null){
rng = selection.createRange();
}
}else{
selection = oRTE.getSelection();
- rng = selection.getRangeAt(selection.rangeCount - 1).cloneRange();
+ if(selection.rangeCount > 0) {
+ rng = selection.getRangeAt(selection.rangeCount - 1).cloneRange();
+ } else {
+ rng = oRTE.document.createRange();
+ }
}
return rng;
}
}
}
}
+
+//*****************
+//Validation
+//*****************
+function enableRTEvalidation(rteName) {
+ document.getElementById(rteName+'SaveButton').addEventListener("click", function(event){
+ updateRTEs();
+ field = document.getElementById('hdn'+rteName);
+ if(field.value != null && (field.value == "" || field.value.replace(/^\s+|\s+$/g,"").length == 0)) {
+ event.preventDefault();
+ }
+ });
+}
+
\ No newline at end of file