Index: openacs-4/packages/acs-templating/www/resources/rte/blank.htm =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/rte/Attic/blank.htm,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-templating/www/resources/rte/blank.htm 18 Mar 2005 17:14:55 -0000 1.1 @@ -0,0 +1,11 @@ + + + + + + + + + + + Index: openacs-4/packages/acs-templating/www/resources/rte/changelog.txt =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/rte/Attic/changelog.txt,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-templating/www/resources/rte/changelog.txt 18 Mar 2005 17:14:55 -0000 1.1 @@ -0,0 +1,64 @@ +Cross-Browser Rich Text Editor change log + +3/4/2005 - Updated insert link function to automatically place highlighted text in link text field +3/2/2005 - Replaced insert image icon +3/2/2005 - To satisfy a handful of people who have a problem with my "no license" policy I have added "// This code is public domain. Redistribution and use of this code, with or without modification, is permitted." to top of richtext.js. +3/1/2005 - Fixed display of buttons when submitting in view source mode +3/1/2005 - Fixed toggleHTMLSrc() function to update view source textbox with XHTML-converted code +3/1/2005 - Removed XHTML demo and included genXHTML option in initRTE function is standard demo +3/1/2005 - Changed back default behaviour of IE (again) to insert

tags when hitting return. Previous fix broke list items and indenting functionality in IE. +2/24/2005 - Added XHTML output demo (demo_xhtml.htm) +2/24/2005 - Fixed view source checkbox for RTEs not displaying buttons +2/24/2005 - Added label tag to view source checkbox +2/24/2005 - Updated insert link function to display more advanced dialog window +2/24/2005 - popup dialogs (insert table and insert link) now are centered in the user's screen +2/24/2005 - Updated demo.php and demo.asp to allow actual submission of the forms, to demonstrate getting the submitted value of the RTE +2/24/2005 - Fixed corrupt demo.php file +2/24/2005 - Changed behaviour in IE so that when return is pressed, a
is inserted instead of a new paragraph (now functions same as Gecko browsers) +2/10/2005 - Fixed IE crash when back button is clicked (changed doctype in blank.htm) +2/10/2005 - Added table insert functionality (thanks dannyuk1982!) +2/10/2005 - Cleaned up code considerably +2/10/2005 - Updated default rte widths (IE and Gecko are now the same width by default) +2/10/2005 - Tried to turn off useCSS in Gecko by default (to keep generated html consistent with IE), but enabling this disables the ability to use the 'hilitecolor' command in Firefox for some reason +11/12/2004 - Fixed palette position when rte is embedded within multiple divs. +11/12/2004 - Fixed button events for non-IE browsers (now uses CSS) +11/9/2004 - Fixed bug when using SSL saying page has unsecured items (re-added blank.htm). +11/9/2004 - Changed back default behaviour of IE to insert

tags when hitting return. Previous fix broke list items and indenting functionality in IE +11/2/2004 - Changed default behaviour of IE to insert
tags instead of

tags upon hitting return - thanks TotalJSNoob and archv1le! +7/14/2004 - Changed rte.css to maintain td styles under parent objects +5/18/2004 - Added CSS file for RTE button styles. css is no longer printed every time a new rte is created. +5/18/2004 - Made color palette smaller +5/18/2004 - Fixed placement of color pallette for rtes embedded within divs - thanks Ernst! +5/18/2004 - If a css is specified, the body tag is no longer overruled - thanks Ernst! +5/18/2004 - Fixed headings dropdown, replacing < and > characters +4/13/2004 - Fixed bug with standard textarea and updateRTE function +4/12/2004 - Fixed bug with IE where toggle source would err if only content was horizontal rules +4/12/2004 - Fixed bug where nothing would be returned if the only content was horizontal rules and/or images +4/9/2004 - Fixed bug for Konqueror browser +4/9/2004 - Added multi.htm to demonstrate using multiple RTEs on one page. +4/9/2004 - Fixed bug in IE where you could set style on document objects not in iframe. +4/9/2004 - Updated buttons look and feel - thanks Ernst! +3/31/2004 - Fixed bug in stripHTML function - thanks valli! +3/19/2004 - Fixed bug with Gecko browsers where
is returned when empty content submitted. +2/23/2004 - Fixed bug with Mac Safari 1.2 +1/16/2004 - Added Justify Full button +1/9/2004 - Added updateRTEs function to update all rtes on page +1/9/2004 - Fixed bug with updateRTE in readOnly mode +1/8/2004 - Added parameter to writeRichText function, readOnly +1/8/2004 - Fixed bug with Mozilla when adding blank url links +1/8/2004 - Fixed init bug for Konqueror and Mac IE browsers. Added parameters to init function for images path, includes path, and css file +1/6/2004 - Added compressed richtext_compressed.js file to zip. File size is 37% smaller +1/5/2004 - Removed reference to style.css +1/5/2004 - Fixed demo form submit code +1/2/2004 - Fixed crashing with Mozilla 1.3 +1/2/2004 - Fixed bug with Mozilla 1.3 +1/2/2004 - Fixed problem with html view on submit +12/26/2003 - Fixed color palette dropdowns for multiple RTEs. Improved enableDesignMode function. +12/23/2003 - Fixed several bugs with multiple RTEs on one page. +12/22/2003 - Added support for IE5. +12/22/2003 - Modified code to remove all timeout settings. Fixed IE stylesheet support. Blank.htm is no longer needed. +12/17/2003 - Changed code for IE enableDesignMode function to load quicker and to eliminate use of timeout. +12/8/2003 - Fixed bug with IE5. +12/8/2003 - Added in keyboard shortcut support for Mozilla. Code contributed by Anti Veeranna +12/5/2003 - Removed dependence on browserdetect.js and removed js link. Also updated initRTE function to speed up load. +12/5/2003 - Created changelog.txt to keep track of version history from now on. \ No newline at end of file Index: openacs-4/packages/acs-templating/www/resources/rte/demo.asp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/rte/Attic/demo.asp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-templating/www/resources/rte/demo.asp 18 Mar 2005 17:14:55 -0000 1.1 @@ -0,0 +1,100 @@ + + + + + Cross-Browser Rich Text Editor + + + + + + + + + +

Cross-Browser Rich Text Editor

+

PscContestWinner

+

The cross-browser rich-text editor (RTE) is based on the designMode() functionality introduced in Internet Explorer 5, and implemented in Mozilla 1.3+ using the Mozilla Rich Text Editing API. The cross-browser rich-text editor now includes table support (as of 2/10/2005) as well as an option to generate xhtml-compliant code (as of 2/24/2005).

+

Requires: IE5+/Mozilla 1.3+/Mozilla Firebird/Firefox 0.6.1+/Netscape 7.1+, or any other browser that fully supports designMode() for all rich-text features to function properly. All other browsers will display a standard textarea box instead. For frequently asked questions and support, please visit http://www.kevinroth.com/forums/index.php?c=2

+

Source: rte.zip, rte.tar.gz
+Included in the zip are HTML, ASP, and PHP demos. Also, here is an html demo showing multiple RTEs on one page.

+

This code is public domain. Redistribution and use of this code, with or without modification, is permitted.

+

Change Log: changelog.txt

+ +

If you feel that the work I've done has value to you, I would greatly appreciate a paypal donation (click button below). Another way you can help me out is to sign up for a free flat screen, to help me get mine. Again, I am very grateful for any and all contributions.

+
+ + + + + + + +
+ + +
" method="post" onsubmit="return submitForm();"> + + + + + +

Click submit to post the form and reload with your rte content.

+

+
+<% +function RTESafe(strText) + 'returns safe code for preloading in the RTE + dim tmpString + + tmpString = trim(strText) + + 'convert all types of single quotes + tmpString = replace(tmpString, chr(145), chr(39)) + tmpString = replace(tmpString, chr(146), chr(39)) + tmpString = replace(tmpString, "'", "'") + + 'convert all types of double quotes + tmpString = replace(tmpString, chr(147), chr(34)) + tmpString = replace(tmpString, chr(148), chr(34)) +' tmpString = replace(tmpString, """", "\""") + + 'replace carriage returns & line feeds + tmpString = replace(tmpString, chr(10), " ") + tmpString = replace(tmpString, chr(13), " ") + + RTESafe = tmpString +end function +%> + + + + Index: openacs-4/packages/acs-templating/www/resources/rte/demo.htm =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/rte/Attic/demo.htm,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-templating/www/resources/rte/demo.htm 18 Mar 2005 17:14:55 -0000 1.1 @@ -0,0 +1,70 @@ + + + + + Cross-Browser Rich Text Editor + + + + + + + + + +

Cross-Browser Rich Text Editor

+

PscContestWinner

+

The cross-browser rich-text editor (RTE) is based on the designMode() functionality introduced in Internet Explorer 5, and implemented in Mozilla 1.3+ using the Mozilla Rich Text Editing API. The cross-browser rich-text editor now includes table support (as of 2/10/2005) as well as an option to generate xhtml-compliant code (as of 2/24/2005).

+

This code is public domain. Redistribution and use of this code, with or without modification, is permitted.

+

For frequently asked question and support, please visit http://www.kevinroth.com/forums/index.php?c=2

+

Requires: IE5+/Mozilla 1.3+/Mozilla Firebird/Firefox 0.6.1+/Netscape 7.1+, or any other browser that fully supports designMode() for all rich-text features to function properly. All other browsers will display a standard textarea box instead.

+

Source: rte.zip, rte.tar.gz
+Included in the zip are HTML, ASP, and PHP demos. Also, here is an html demo showing multiple RTEs on one page.

+

Change Log: changelog.txt

+ +

If you feel that the work I've done has value to you, I would greatly appreciate a paypal donation (click button below). Another way you can help me out is to sign up for a free flat screen, to help me get mine. Again, I am very grateful for any and all contributions.

+
+ + + + + + + +
+ + +
+ + + + +

Click submit to show the value of the text box.

+

+
+ + + + Index: openacs-4/packages/acs-templating/www/resources/rte/demo.php =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/rte/Attic/demo.php,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-templating/www/resources/rte/demo.php 18 Mar 2005 17:14:55 -0000 1.1 @@ -0,0 +1,101 @@ + + + + + Cross-Browser Rich Text Editor + + + + + + + + + +

Cross-Browser Rich Text Editor

+

PscContestWinner

+

The cross-browser rich-text editor (RTE) is based on the designMode() functionality introduced in Internet Explorer 5, and implemented in Mozilla 1.3+ using the Mozilla Rich Text Editing API. The cross-browser rich-text editor now includes table support (as of 2/10/2005) as well as an option to generate xhtml-compliant code (as of 2/24/2005).

+

This code is public domain. Redistribution and use of this code, with or without modification, is permitted.

+

For frequently asked question and support, please visit http://www.kevinroth.com/forums/index.php?c=2

+

Requires: IE5+/Mozilla 1.3+/Mozilla Firebird/Firefox 0.6.1+/Netscape 7.1+, or any other browser that fully supports designMode() for all rich-text features to function properly. All other browsers will display a standard textarea box instead.

+

Source: rte.zip, rte.tar.gz
+Included in the zip are HTML, ASP, and PHP demos. Also, here is an html demo showing multiple RTEs on one page.

+

Change Log: changelog.txt

+ +

If you feel that the work I've done has value to you, I would greatly appreciate a paypal donation (click button below). Another way you can help me out is to sign up for a free flat screen, to help me get mine. Again, I am very grateful for any and all contributions.

+
+ + + + + + + +
+ + +
" method="post" onsubmit="return submitForm();"> + + + + + +

Click submit to post the form and reload with your rte content.

+

+
+ + + + + Index: openacs-4/packages/acs-templating/www/resources/rte/html2xhtml.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/rte/Attic/html2xhtml.js,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-templating/www/resources/rte/html2xhtml.js 18 Mar 2005 17:14:55 -0000 1.1 @@ -0,0 +1,274 @@ +/*============================================================================== + + HTML2XHTML Converter 1.0 + ======================== + Copyright (c) 2004 Vyacheslav Smolin + + +Author: +------- +Vyacheslav Smolin (http://www.richarea.com, http://html2xhtml.richarea.com, +re@richarea.com) + +About the script: +----------------- +HTML2XHTML Converter (H2X) generates a well formed XHTML string from a HTML DOM +object. + +Requirements: +------------- +H2X works in MS IE 5.0 for Windows or above, in Netscape 7.1, Mozilla 1.3 or +above. It should work in all Mozilla based browsers. + +Usage: +------ +Please see description of function get_xhtml below. + +Demo: +----- +http://html2xhtml.richarea.com/, http://www.richarea.com/demo/ + +License: +-------- +Free for non-commercial using. Please contact author for commercial licenses. + + +==============================================================================*/ + + +//add \n before opening tag +var need_nl_before = '|div|p|table|tbody|tr|td|th|title|head|body|script|comment|li|meta|h1|h2|h3|h4|h5|h6|hr|ul|ol|option|'; +//add \n after opening tag +var need_nl_after = '|html|head|body|p|th|style|'; + +var re_comment = new RegExp(); +re_comment.compile("^$"); + +var re_hyphen = new RegExp(); +re_hyphen.compile("-$"); + + +// Convert inner text of node to xhtml +// Call: get_xhtml(node); +// get_xhtml(node, lang, encoding) -- to convert whole page +// other parameters are for inner usage and should be omitted +// Parameters: +// node - dom node to convert +// lang - document lang (need it if whole page converted) +// encoding - document charset (need it if whole page converted) +// need_nl - if true, add \n before a tag if it is in list need_nl_before +// inside_pre - if true, do not change content, as it is inside a
+function get_xhtml(node, lang, encoding, need_nl, inside_pre) {
+	var i;
+	var text = '';
+	var children = node.childNodes;
+	var child_length = children.length;
+	var tag_name;
+	var do_nl = need_nl ? true : false;
+	var page_mode = true;
+	
+	for (i = 0; i < child_length; i++) {
+		var child = children[i];
+		
+		switch (child.nodeType) {
+			case 1: { //ELEMENT_NODE
+				var tag_name = String(child.tagName).toLowerCase();
+				
+				if (tag_name == '') break;
+				
+				if (tag_name == 'meta') {
+					var meta_name = String(child.name).toLowerCase();
+					if (meta_name == 'generator') break;
+				}
+				
+				if (!need_nl && tag_name == 'body') { //html fragment mode
+					page_mode = false;
+				}
+				
+				if (tag_name == '!') { //COMMENT_NODE in IE 5.0/5.5
+					//get comment inner text
+					var parts = re_comment.exec(child.text);
+					
+					if (parts) {
+						//the last char of the comment text must not be a hyphen
+						var inner_text = parts[1];
+						text += fix_comment(inner_text);
+					}
+				} else {
+					if (tag_name == 'html') {
+						text = '\n\n';
+					}
+					
+					//inset \n to make code more neat
+					if (need_nl_before.indexOf('|'+tag_name+'|') != -1) {
+						if ((do_nl || text != '') && !inside_pre) text += '\n';
+					} else {
+						do_nl = true;
+					}
+					
+					text += '<'+tag_name;
+					
+					//add attributes
+					var attr = child.attributes;
+					var attr_length = attr.length;
+					var attr_value;
+					
+					var attr_lang = false;
+					var attr_xml_lang = false;
+					var attr_xmlns = false;
+					
+					var is_alt_attr = false;
+					
+					for (j = 0; j < attr_length; j++) {
+						var attr_name = attr[j].nodeName.toLowerCase();
+						
+						if (!attr[j].specified && 
+							(attr_name != 'selected' || !child.selected) && 
+							(attr_name != 'style' || child.style.cssText == '') && 
+							attr_name != 'value') continue; //IE 5.0
+						
+						if (attr_name == '_moz_dirty' || 
+							attr_name == '_moz_resizing' || 
+							tag_name == 'br' && 
+							attr_name == 'type' && 
+							child.getAttribute('type') == '_moz') continue;
+						
+						var valid_attr = true;
+						
+						switch (attr_name) {
+							case "style":
+								attr_value = child.style.cssText;
+								break;
+							case "class":
+								attr_value = child.className;
+								break;
+							case "http-equiv":
+								attr_value = child.httpEquiv;
+								break;
+							case "noshade": break; //this set of choices will extend
+							case "checked": break;
+							case "selected": break;
+							case "multiple": break;
+							case "nowrap": break;
+							case "disabled": break;
+								attr_value = attr_name;
+								break;
+							default:
+								try {
+									attr_value = child.getAttribute(attr_name, 2);
+								} catch (e) {
+									valid_attr = false;
+								}
+								break;
+						}
+						
+						//html tag attribs
+						if (attr_name == 'lang') {
+							attr_lang = true;
+							attr_value = lang;
+						}
+						if (attr_name == 'xml:lang') {
+							attr_xml_lang = true;
+							attr_value = lang;
+						}
+						if (attr_name == 'xmlns') attr_xmlns = true;
+						if (valid_attr) {
+							//value attribute set to "0" is not handled correctly in Mozilla
+							if (!(tag_name == 'li' && attr_name == 'value')) {
+								text += ' '+attr_name+'="'+fix_attribute(attr_value)+'"';
+							}
+						}
+						
+						if (attr_name == 'alt') is_alt_attr = true;
+					}
+					
+					if (tag_name == 'img' && !is_alt_attr) {
+						text += ' alt=""';
+					}
+					
+					if (tag_name == 'html') {
+						if (!attr_lang) text += ' lang="'+lang+'"';
+						if (!attr_xml_lang) text += ' xml:lang="'+lang+'"';
+						if (!attr_xmlns) text += ' xmlns="http://www.w3.org/1999/xhtml"';
+					}
+					
+					if (child.canHaveChildren || child.hasChildNodes()){
+						text += '>';
+//						if (need_nl_after.indexOf('|'+tag_name+'|') != -1) {
+//							text += '\n';
+//						}
+						text += get_xhtml(child, lang, encoding, true, inside_pre || tag_name == 'pre' ? true : false);
+						text += '';
+					} else {
+						if (tag_name == 'style' || tag_name == 'title' || tag_name == 'script') {
+							text += '>';
+							var inner_text;
+							if (tag_name == 'script') {
+								inner_text = child.text;
+							} else {
+								inner_text = child.innerHTML;
+							}
+							
+							if (tag_name == 'style') {
+								inner_text = String(inner_text).replace(/[\n]+/g,'\n');
+							}
+							
+							text += inner_text+'';
+						} else {
+							text += ' />';
+						}
+					}
+				}
+				break;
+			}
+			case 3: { //TEXT_NODE
+				if (!inside_pre) { //do not change text inside 
 tag
+					if (child.nodeValue != '\n') {
+						text += fix_text(child.nodeValue);
+					}
+				} else {
+					text += child.nodeValue;
+				}
+				break;
+			}
+			case 8: { //COMMENT_NODE
+				text += fix_comment(child.nodeValue);
+				break;
+			}
+			default:
+				break;
+		}
+	}
+	
+	if (!need_nl && !page_mode) { //delete head and body tags from html fragment
+		text = text.replace(/<\/?head>[\n]*/gi, "");
+		text = text.replace(/[\n]*/gi, "");
+		text = text.replace(/<\/?body>[\n]*/gi, "");
+	}
+	
+	return text;
+}
+
+//fix inner text of a comment
+function fix_comment(text) {
+	//delete double hyphens from the comment text
+	text = text.replace(/--/g, "__");
+	
+	if(re_hyphen.exec(text)) { //last char must not be a hyphen
+		text += " ";
+	}
+	
+	return "";
+}
+
+//fix content of a text node
+function fix_text(text) {
+	//convert <,> and & to the corresponding entities
+	return String(text).replace(/\n{2,}/g, "\n").replace(/\&/g, "&").replace(//g, ">").replace(/\u00A0/g, " ");
+}
+
+//fix content of attributes href, src or background
+function fix_attribute(text) {
+	//convert <,>, & and " to the corresponding entities
+	return String(text).replace(/\&/g, "&").replace(//g, ">").replace(/\"/g, """);
+}
Index: openacs-4/packages/acs-templating/www/resources/rte/insert_link.htm
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/rte/Attic/insert_link.htm,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/acs-templating/www/resources/rte/insert_link.htm	18 Mar 2005 17:14:55 -0000	1.1
@@ -0,0 +1,67 @@
+
+
+
+
+	Insert Link
+	
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + +
Tip: To insert an email link, start your URL with "mailto:"
URL:
Text:
Target: + +
+ + +
+ +
+ + + Index: openacs-4/packages/acs-templating/www/resources/rte/insert_table.htm =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/rte/Attic/insert_table.htm,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-templating/www/resources/rte/insert_table.htm 18 Mar 2005 17:14:55 -0000 1.1 @@ -0,0 +1,70 @@ + + + + + Insert Table + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
Rows:Columns:
Table width: + +
Border thickness:pixels
Cell padding:Cell spacing:
+ + +
+ +
+ + + Index: openacs-4/packages/acs-templating/www/resources/rte/multi.htm =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/rte/Attic/multi.htm,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-templating/www/resources/rte/multi.htm 18 Mar 2005 17:14:55 -0000 1.1 @@ -0,0 +1,79 @@ + + + + + Cross-Browser Rich Text Editor + + + + + + + + + +

Cross-Browser Rich Text Editor

+

PscContestWinner

+

The cross-browser rich-text editor (RTE) is based on the designMode() functionality introduced in Internet Explorer 5, and implemented in Mozilla 1.3+ using the Mozilla Rich Text Editing API. The cross-browser rich-text editor now includes table support (as of 2/10/2005) as well as an option to generate xhtml-compliant code (as of 2/24/2005).

+

This code is public domain. Redistribution and use of this code, with or without modification, is permitted.

+

For frequently asked question and support, please visit http://www.kevinroth.com/forums/index.php?c=2

+

Requires: IE5+/Mozilla 1.3+/Mozilla Firebird/Firefox 0.6.1+/Netscape 7.1+, or any other browser that fully supports designMode() for all rich-text features to function properly. All other browsers will display a standard textarea box instead.

+

Source: rte.zip, rte.tar.gz
+Included in the zip are HTML, ASP, and PHP demos. Also, here is an html demo showing multiple RTEs on one page.

+

Change Log: changelog.txt

+ +

If you feel that the work I've done has value to you, I would greatly appreciate a paypal donation (click button below). Another way you can help me out is to sign up for a free flat screen, to help me get mine. Again, I am very grateful for any and all contributions.

+
+ + + + + + + +
+ + +
+ + + + + +

Click submit to show the value of the text box.

+

+
+ + + + Index: openacs-4/packages/acs-templating/www/resources/rte/palette.htm =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/rte/Attic/palette.htm,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-templating/www/resources/rte/palette.htm 18 Mar 2005 17:14:55 -0000 1.1 @@ -0,0 +1,126 @@ + + + + + Text Color + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Index: openacs-4/packages/acs-templating/www/resources/rte/richtext.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/rte/Attic/richtext.js,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-templating/www/resources/rte/richtext.js 18 Mar 2005 17:14:55 -0000 1.1 @@ -0,0 +1,685 @@ +// Cross-Browser Rich Text Editor +// http://www.kevinroth.com/rte/demo.htm +// Written by Kevin Roth (kevin@NOSPAMkevinroth.com - remove NOSPAM) +// Visit the support forums at http://www.kevinroth.com/forums/index.php?c=2 +// This code is public domain. Redistribution and use of this code, with or without modification, is permitted. + +//init variables +var isRichText = false; +var rng; +var currentRTE; +var allRTEs = ""; + +var isIE; +var isGecko; +var isSafari; +var isKonqueror; + +var imagesPath; +var includesPath; +var cssFile; +var generateXHTML; + +var lang = "en"; +var encoding = "iso-8859-1"; + + +function initRTE(imgPath, incPath, css, genXHTML) { + //set browser vars + var ua = navigator.userAgent.toLowerCase(); + isIE = ((ua.indexOf("msie") != -1) && (ua.indexOf("opera") == -1) && (ua.indexOf("webtv") == -1)); + isGecko = (ua.indexOf("gecko") != -1); + isSafari = (ua.indexOf("safari") != -1); + isKonqueror = (ua.indexOf("konqueror") != -1); + + generateXHTML = genXHTML; + + //check to see if designMode mode is available + //Safari/Konqueror think they are designMode capable even though they are not + if (document.getElementById && document.designMode && !isSafari && !isKonqueror) { + isRichText = true; + } + + if (isIE) { + document.onmouseover = raiseButton; + document.onmouseout = normalButton; + document.onmousedown = lowerButton; + document.onmouseup = raiseButton; + } + + //set paths vars + imagesPath = imgPath; + includesPath = incPath; + cssFile = css; + + if (isRichText) document.writeln(''); + + //for testing standard textarea, uncomment the following line + //isRichText = false; +} + +function writeRichText(rte, html, width, height, buttons, readOnly, extra_content, on_fail) { + if (isRichText) { + if (allRTEs.length > 0) allRTEs += ";"; + allRTEs += rte; + + if (readOnly) buttons = false; + + //adjust minimum table widths + if (isIE) { + if (buttons && (width < 540)) width = 540; + var tablewidth = width; + } else { + if (buttons && (width < 540)) width = 540; + var tablewidth = width + 4; + } + + document.writeln('
'); + + if (!readOnly) document.writeln('
 
'); + + if (buttons == true) { + document.writeln(''); + document.writeln(' '); + document.writeln(' '); + document.writeln(' '); + document.writeln(' '); + document.writeln(' '); + document.writeln(' '); + document.writeln('
'); + document.writeln(' '); + document.writeln(' '); + document.writeln(' '); + document.writeln(' '); + document.writeln(' '); + document.writeln(' '); + document.writeln('
'); + + document.writeln(''); + document.writeln(' '); + document.writeln(' '); + document.writeln(' '); + document.writeln(' '); + document.writeln(' '); + document.writeln(' '); + document.writeln(' '); + document.writeln(' '); + document.writeln(' '); + document.writeln(' '); + document.writeln(' '); + document.writeln(' '); + document.writeln(' '); + document.writeln(' '); + document.writeln(' '); + document.writeln(' '); + document.writeln(' '); + document.writeln(' '); + document.writeln(' '); + document.writeln(' '); + document.writeln(' '); + document.writeln(' '); + document.writeln(' '); + if (isIE) { + document.writeln(' '); + } + // document.writeln(' '); + // document.writeln(' '); + // document.writeln(' '); + // document.writeln(' '); + // document.writeln(' '); + // document.writeln(' '); + // document.writeln(' '); + document.writeln(' '); + document.writeln(' '); + document.writeln('
BoldItalicUnderlineAlign LeftCenterAlign RightJustify FullHorizontal RuleOrdered ListUnordered ListOutdentIndent
Text Color
Background Color
Insert LinkAdd Image
Insert Table
Spell CheckCutCopyPasteUndoRedo
'); + + } + + document.writeln(''); + + document.writeln(''); + document.writeln(''); + document.writeln('
'); + + if (extra_content) { + document.writeln(extra_content); + } + + document.getElementById('hdn' + rte).value = html; + enableDesignMode(rte, html, readOnly); + } else { + if (on_fail) { + document.writeln(on_fail); + } else { + if (!readOnly) { + document.writeln(''); + } else { + document.writeln(''); + } + } + } +} + +function enableDesignMode(rte, html, readOnly) { + var frameHtml = "\n"; + frameHtml += "\n"; + //to reference your stylesheet, set href property below to your stylesheet path and uncomment + if (cssFile.length > 0) { + frameHtml += "\n"; + } else { + frameHtml += "\n"; + } + frameHtml += "\n"; + frameHtml += "\n"; + frameHtml += html + "\n"; + frameHtml += "\n"; + frameHtml += ""; + + if (document.all) { + var oRTE = frames[rte].document; + oRTE.open(); + oRTE.write(frameHtml); + oRTE.close(); + if (!readOnly) { + oRTE.designMode = "On"; + + function evt_ie_keypress(event) {ieKeyPress(event, rte);}; + frames[rte].document.attachEvent("onkeypress",evt_ie_keypress); + } + } else { + try { + if (!readOnly) document.getElementById(rte).contentDocument.designMode = "on"; + try { + var oRTE = document.getElementById(rte).contentWindow.document; + oRTE.open(); + oRTE.write(frameHtml); + oRTE.close(); + if (isGecko && !readOnly) { + //attach a keyboard handler for gecko browsers to make keyboard shortcuts work + oRTE.addEventListener("keypress", geckoKeyPress, true); + } + } catch (e) { + alert("Error preloading content."); + } + } catch (e) { + //gecko may take some time to enable design mode. + //Keep looping until able to set. + if (isGecko) { + setTimeout("enableDesignMode('" + rte + "', '" + html + "', " + readOnly + ");", 10); + } else { + return false; + } + } + } +} + +function updateRTE(rte) { + if (!isRichText) return; + + //check for readOnly mode + var readOnly = false; + if (document.all) { + if (frames[rte].document.designMode != "On") readOnly = true; + } else { + if (document.getElementById(rte).contentDocument.designMode != "on") readOnly = true; + } + + if (isRichText && !readOnly) { + //if viewing source, switch back to design view + if (document.getElementById("chkSrc" + rte).checked) document.getElementById("chkSrc" + rte).click(); + setHiddenVal(rte); + } +} + +function setHiddenVal(rte) { + //set hidden form field value for current rte + var oHdnField = document.getElementById('hdn' + rte); + + //convert html output to xhtml (thanks Timothy Bell and Vyacheslav Smolin!) + if (oHdnField.value == null) oHdnField.value = ""; + if (document.all) { + if (generateXHTML) { + oHdnField.value = get_xhtml(frames[rte].document.body, lang, encoding); + } else { + oHdnField.value = frames[rte].document.body.innerHTML; + } + } else { + if (generateXHTML) { + oHdnField.value = get_xhtml(document.getElementById(rte).contentWindow.document.body, lang, encoding); + } else { + oHdnField.value = document.getElementById(rte).contentWindow.document.body.innerHTML; + } + } + + //if there is no content (other than formatting) set value to nothing + if (stripHTML(oHdnField.value.replace(" ", " ")) == "" && + oHdnField.value.toLowerCase().search(" 0) { + mOffsetTop += mOffsetParent.offsetTop; + mOffsetParent = mOffsetParent.offsetParent; + parents_up--; + } + + return mOffsetTop; +} + +// Ernst de Moor: Fix the amount of digging parents up, in case the RTE editor itself is displayed in a div. +// KJR 11/12/2004 Changed to position palette based on parent div, so palette will always appear in proper location regardless of nested divs +function getOffsetLeft(elm) { + var mOffsetLeft = elm.offsetLeft; + var mOffsetParent = elm.offsetParent; + var parents_up = 2; + + while(parents_up > 0) { + mOffsetLeft += mOffsetParent.offsetLeft; + mOffsetParent = mOffsetParent.offsetParent; + parents_up--; + } + + return mOffsetLeft; +} + +function selectFont(rte, selectname) { + //function to handle font changes + var idx = document.getElementById(selectname).selectedIndex; + // First one is always a label + if (idx != 0) { + var selected = document.getElementById(selectname).options[idx].value; + var cmd = selectname.replace('_' + rte, ''); + rteCommand(rte, cmd, selected); + document.getElementById(selectname).selectedIndex = 0; + } +} + +function insertHTML(html) { + //function to add HTML -- thanks dannyuk1982 + var rte = currentRTE; + + var oRTE; + if (document.all) { + oRTE = frames[rte]; + } else { + oRTE = document.getElementById(rte).contentWindow; + } + + oRTE.focus(); + if (document.all) { + var oRng = oRTE.document.selection.createRange(); + oRng.pasteHTML(html); + oRng.collapse(false); + oRng.select(); + } else { + oRTE.document.execCommand('insertHTML', false, html); + } +} + +function showHideElement(element, showHide) { + //function to show or hide elements + //element variable can be string or object + if (document.getElementById(element)) { + element = document.getElementById(element); + } + + if (showHide == "show") { + element.style.visibility = "visible"; + } else if (showHide == "hide") { + element.style.visibility = "hidden"; + } +} + +function setRange(rte) { + //function to store range of current selection + var oRTE; + if (document.all) { + oRTE = frames[rte]; + var selection = oRTE.document.selection; + if (selection != null) rng = selection.createRange(); + } else { + oRTE = document.getElementById(rte).contentWindow; + var selection = oRTE.getSelection(); + rng = selection.getRangeAt(selection.rangeCount - 1).cloneRange(); + } + return rng; +} + +function stripHTML(oldString) { + //function to strip all html + var newString = oldString.replace(/(<([^>]+)>)/ig,""); + + //replace carriage returns and line feeds + newString = newString.replace(/\r\n/g," "); + newString = newString.replace(/\n/g," "); + newString = newString.replace(/\r/g," "); + + //trim string + newString = trim(newString); + + return newString; +} + +function trim(inputString) { + // Removes leading and trailing spaces from the passed string. Also removes + // consecutive spaces and replaces it with one space. If something besides + // a string is passed in (null, custom object, etc.) then return the input. + if (typeof inputString != "string") return inputString; + var retValue = inputString; + var ch = retValue.substring(0, 1); + + while (ch == " ") { // Check for spaces at the beginning of the string + retValue = retValue.substring(1, retValue.length); + ch = retValue.substring(0, 1); + } + ch = retValue.substring(retValue.length - 1, retValue.length); + + while (ch == " ") { // Check for spaces at the end of the string + retValue = retValue.substring(0, retValue.length - 1); + ch = retValue.substring(retValue.length - 1, retValue.length); + } + + // Note that there are two spaces in the string - look for multiple spaces within the string + while (retValue.indexOf(" ") != -1) { + // Again, there are two spaces in each of the strings + retValue = retValue.substring(0, retValue.indexOf(" ")) + retValue.substring(retValue.indexOf(" ") + 1, retValue.length); + } + return retValue; // Return the trimmed string back to the user +} + +//******************** +//Gecko-Only Functions +//******************** +function geckoKeyPress(evt) { + //function to add bold, italic, and underline shortcut commands to gecko RTEs + //contributed by Anti Veeranna (thanks Anti!) + var rte = evt.target.id; + + if (evt.ctrlKey) { + var key = String.fromCharCode(evt.charCode).toLowerCase(); + var cmd = ''; + switch (key) { + case 'b': cmd = "bold"; break; + case 'i': cmd = "italic"; break; + case 'u': cmd = "underline"; break; + }; + + if (cmd) { + rteCommand(rte, cmd, null); + + // stop the event bubble + evt.preventDefault(); + evt.stopPropagation(); + } + } +} + +//***************** +//IE-Only Functions +//***************** +function ieKeyPress(evt, rte) { + var key = (evt.which || evt.charCode || evt.keyCode); + var stringKey = String.fromCharCode(key).toLowerCase(); + +//the following breaks list and indentation functionality in IE (don't use) +// switch (key) { +// case 13: +// //insert
tag instead of

+// //change the key pressed to null +// evt.keyCode = 0; +// +// //insert
tag +// currentRTE = rte; +// insertHTML('
'); +// break; +// }; +} + +function checkspell() { + //function to perform spell check + try { + var tmpis = new ActiveXObject("ieSpell.ieSpellExtension"); + tmpis.CheckAllLinkedDocuments(document); + } + catch(exception) { + if(exception.number==-2146827859) { + if (confirm("ieSpell not detected. Click Ok to go to download page.")) + window.open("http://www.iespell.com/download.php","DownLoad"); + } else { + alert("Error Loading ieSpell: Exception " + exception.number); + } + } +} + +function raiseButton(e) { + var el = window.event.srcElement; + + className = el.className; + if (className == 'rteImage' || className == 'rteImageLowered') { + el.className = 'rteImageRaised'; + } +} + +function normalButton(e) { + var el = window.event.srcElement; + + className = el.className; + if (className == 'rteImageRaised' || className == 'rteImageLowered') { + el.className = 'rteImage'; + } +} + +function lowerButton(e) { + var el = window.event.srcElement; + + className = el.className; + if (className == 'rteImage' || className == 'rteImageRaised') { + el.className = 'rteImageLowered'; + } +} Index: openacs-4/packages/acs-templating/www/resources/rte/richtext_compressed.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/rte/Attic/richtext_compressed.js,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-templating/www/resources/rte/richtext_compressed.js 18 Mar 2005 17:14:55 -0000 1.1 @@ -0,0 +1 @@ +$="��Rich�=f�se;�rng;��;��lRTEs��;��IE;��Gecko;��Safari;��Konqu�or;�i�sPath;��;�cssFile;��L;�lang�en�;�encod�g��o-8859-1�;funct� �itRTE(imgPath,�cPath,css,genXHTML֭ua=navigator.us�Ag����IE=(�msie�)!=-1)&&�op�a�)==-1)&&�webtv�)==-1)��Gecko=�gecko�)!=-1��Safari=�safari�)!=-1��Konqu�or=�konqu�or�)!=-1��L=genXHTMLǨget�ById&&�d�&&!�Safari&&!�Konqu�or��Rich�=true;}��IE֨onmouseov�=ra�e�out=norm��down=low��up=ra�eB�;}i�sPath=imgPath;�=�cPath;cssFile=css��Rich�)�� type�text/css�>@import �'+�+'�.css�;'ɧwriteRich�(�,�,�,�,b�s,�{��Rich����lRTEs�>0)�lRTEs+�;�;�lRTEs+=���b�s=f�se��IE��b�s&&(�<540))�=540;�t��=���b�s&&(�<540))�=540;�t��=�+4;}�div�Div�>')�b�s==true��t�Back� cellpadd�g=2 cellspac�g=0 id�B�s1_բ�'+t��+'�� [Style]��

�>Paragraph <p�1�1 <h1�2�2 <h2�3�3 <h3�4�4 <h4�5�5 <h5�6�6 <h6>��

�>Address <ADDR>��
�>Formatted <pre>�/�<�	[Font]��Ari�, Helvetica, sans-s�if�>Ari�Couri� New, Couri�, mono�>Couri� New��Times New Roman, Times, s�if�>Times New Roman��V�dana, Ari�, Helvetica, sans-s�if�>V�dana�/�<�	[Size]��1�>1��2�>2��3�>3��4�>4��5�>5��6�>6��7�>7�/�<�text��� Color�� Color���, \\'fore��><�bg��Background Color�Background Color���, \\'hilite��><�s�t_t��� T��� T��dlg�T��, \\'t��>')��IE֣ln('		<�spellcheck�Spell Check�Spell Check�checkspell()�>'�}�ln('		'�}�ifr� id�բ nȯբ�'+�+'px� ߯'+�+'px� src�'+�+'blank.htm�>')�!��br /><�put type�checkbox� id�chkSrcբ onclick�toggleHTMLSrc�,'+b�s+'ɢ />