You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@roller.apache.org by sn...@apache.org on 2006/10/08 21:54:16 UTC
svn commit: r454197 [28/29] - in /incubator/roller/trunk/web:
WEB-INF/classes/ roller-ui/authoring/editors/
roller-ui/authoring/editors/xinha/ roller-ui/authoring/editors/xinha/conf/
roller-ui/authoring/editors/xinha/contrib/ roller-ui/authoring/editor...
Propchange: incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/plugins/UnFormat/img/unformat.gif
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/plugins/UnFormat/lang/de.js
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/plugins/UnFormat/lang/de.js?view=auto&rev=454197
==============================================================================
--- incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/plugins/UnFormat/lang/de.js (added)
+++ incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/plugins/UnFormat/lang/de.js Sun Oct 8 12:53:13 2006
@@ -0,0 +1,12 @@
+// I18N constants
+// LANG: "de", ENCODING: UTF-8 | ISO-8859-1
+{
+ "Page Cleaner": "Seite bereinigen",
+ "Cleaning Area": "Reinigungsbereich",
+ "Selection": "Ausgewählter Bereich",
+ "All": "Alles",
+ "Cleaning options": "Reinigungsoptionen",
+ "Formatting:": "Formatierung:",
+ "All HTML:": "Ganzes HTML:",
+ "Select which types of formatting you would like to remove." : "Wählen Sie aus welche Formatierungen Sie entfernen wollen."
+};
Added: incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/plugins/UnFormat/lang/fr.js
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/plugins/UnFormat/lang/fr.js?view=auto&rev=454197
==============================================================================
--- incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/plugins/UnFormat/lang/fr.js (added)
+++ incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/plugins/UnFormat/lang/fr.js Sun Oct 8 12:53:13 2006
@@ -0,0 +1,12 @@
+// I18N constants
+// LANG: "fr", ENCODING: UTF-8
+{
+ "Page Cleaner": "Nettoyeur de page",
+ "Cleaning Area": "Zone de nettoyage",
+ "Selection": "Sélection",
+ "All": "Tout",
+ "Cleaning options": "Options de nettoyage",
+ "Formatting:": "Format",
+ "All HTML:": "Tout le HTML",
+ "Select which types of formatting you would like to remove.": "Sélectionnez quel type de formatage vous voulez supprimer."
+};
\ No newline at end of file
Added: incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/plugins/UnFormat/lang/nb.js
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/plugins/UnFormat/lang/nb.js?view=auto&rev=454197
==============================================================================
--- incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/plugins/UnFormat/lang/nb.js (added)
+++ incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/plugins/UnFormat/lang/nb.js Sun Oct 8 12:53:13 2006
@@ -0,0 +1,13 @@
+// I18N constants
+// LANG: "nb", ENCODING: UTF-8
+// translated: Kim Steinhaug, http://www.steinhaug.com/, kim@steinhaug.com
+{
+ "Page Cleaner": "Dokumentvasker",
+ "Cleaning Area": "Vaskeområde",
+ "Selection": "Markert område",
+ "All": "Hele dokumentet",
+ "Cleaning options": "Vaskemetoder",
+ "Formatting:": "Formattering:",
+ "All HTML:": "All HTML-kode:",
+ "Select which types of formatting you would like to remove.": "Velg hva slags formattering du ønsker å fjerne."
+};
\ No newline at end of file
Added: incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/plugins/UnFormat/lang/nl.js
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/plugins/UnFormat/lang/nl.js?view=auto&rev=454197
==============================================================================
--- incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/plugins/UnFormat/lang/nl.js (added)
+++ incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/plugins/UnFormat/lang/nl.js Sun Oct 8 12:53:13 2006
@@ -0,0 +1,12 @@
+// I18N constants
+// LANG: "nl", ENCODING: UTF-8
+{
+ "Page Cleaner": "Pagina Schoonmaker",
+ "Cleaning Area": "Schoonmaak gebied",
+ "Selection": "Geselecteerde tekst",
+ "All": "Alles",
+ "Cleaning options": "Schoonmaak opties",
+ "Formatting:": "Format",
+ "All HTML:": "Alle html",
+ "Select which types of formatting you would like to remove." : "Selecteer welke types van Formatteren je wilt verwijderen"
+};
Added: incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/plugins/UnFormat/lang/no.js
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/plugins/UnFormat/lang/no.js?view=auto&rev=454197
==============================================================================
--- incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/plugins/UnFormat/lang/no.js (added)
+++ incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/plugins/UnFormat/lang/no.js Sun Oct 8 12:53:13 2006
@@ -0,0 +1,13 @@
+// I18N constants
+// LANG: "no", ENCODING: UTF-8
+// translated: Kim Steinhaug, http://www.steinhaug.com/, kim@steinhaug.com
+{
+ "Page Cleaner": "Dokumentvasker",
+ "Cleaning Area": "Vaskeområde",
+ "Selection": "Markert område",
+ "All": "Hele dokumentet",
+ "Cleaning options": "Vaskemetoder",
+ "Formatting:": "Formattering:",
+ "All HTML:": "All HTML-kode:",
+ "Select which types of formatting you would like to remove.": "Velg hva slags formattering du ønsker å fjerne."
+};
\ No newline at end of file
Added: incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/plugins/UnFormat/popups/unformat.html
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/plugins/UnFormat/popups/unformat.html?view=auto&rev=454197
==============================================================================
--- incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/plugins/UnFormat/popups/unformat.html (added)
+++ incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/plugins/UnFormat/popups/unformat.html Sun Oct 8 12:53:13 2006
@@ -0,0 +1,85 @@
+<html>
+
+<head>
+<title>Page Cleaner</title>
+<link rel="stylesheet" type="text/css" href="../../../popups/popup.css" />
+<script type="text/javascript" src="../../../popups/popup.js"></script>
+<script type="text/javascript">
+
+
+
+UnFormat = window.opener.UnFormat;
+window.resizeTo(300, 100);
+
+var x = opener.screenX + (opener.outerWidth - window.outerWidth) / 2;
+var y = opener.screenY + (opener.outerHeight - window.outerHeight) / 2;
+window.moveTo(x, y);
+
+
+function Init() {
+ __dlg_translate('UnFormat');
+ __dlg_init();
+}
+
+function onOK() {
+ var param = new Object();
+
+ if (document.getElementById('clean_selection').checked) {
+ param["cleaning_area"] = "selection";
+ } else {
+ param["cleaning_area"] = "all";
+ }
+
+ var fields = ["formatting", "html_all"];
+
+ for (var i in fields) {
+ var id = fields[i];
+ var el = document.getElementById(id);
+ if (el.checked) {param[id] = true;}
+ }
+
+ __dlg_close(param);
+ return false;
+}
+
+function onCancel() {
+ __dlg_close(null);
+ return false;
+}
+
+</script>
+</head>
+
+<body class="Dialog" onload="Init();self.focus();">
+
+<div class="title">Page Cleaner</div>
+
+<form action="" method="get">
+ <fieldset>
+ <legend>Cleaning Area</legend>
+ <span>Selection</span><input type="radio" name="cleaning_area" id="clean_selection" value="selection" checked="checked" />
+ <span>All</span><input type="radio" name="cleaning_area" id="clean_page" value="page" />
+ </fieldset>
+ <br>
+ <fieldset>
+ <legend>Cleaning options</legend>
+ <div class="space"></div>
+ <div class="fr">Formatting:</div>
+ <input type="checkbox" id="formatting" value="" checked />
+ <p />
+ <div class="fr">All HTML:</div>
+ <input type="checkbox" id="html_all" value="" />
+ <p />
+ </fieldset>
+ <br /><br />
+ <p style="text-align:center"><span>Select which types of formatting you would like to remove.</span></p>
+
+<div id="buttons">
+ <button type="button" name="ok" onclick="return onOK();">OK</button>
+ <button type="button" name="cancel" onclick="return onCancel();">Cancel</button>
+</div>
+
+</form>
+
+</body>
+</html>
\ No newline at end of file
Added: incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/plugins/UnFormat/un-format.js
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/plugins/UnFormat/un-format.js?view=auto&rev=454197
==============================================================================
--- incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/plugins/UnFormat/un-format.js (added)
+++ incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/plugins/UnFormat/un-format.js Sun Oct 8 12:53:13 2006
@@ -0,0 +1,65 @@
+// Unormat plugin for HTMLArea
+
+
+function UnFormat(editor) {
+ this.editor = editor;
+ var cfg = editor.config;
+ var self = this;
+
+ cfg.registerButton({
+ id : "unformat",
+ tooltip : this._lc("Page Cleaner"),
+ image : editor.imgURL("unformat.gif", "UnFormat"),
+ textMode : false,
+ action : function(editor) {
+ self.buttonPress(editor);
+ }
+ });
+
+ cfg.addToolbarElement("unformat", "killword", 1);
+}
+
+UnFormat._pluginInfo = {
+ name : "UnFormat",
+ version : "1.0",
+ license : "htmlArea"
+};
+
+
+UnFormat.prototype._lc = function(string) {
+ return HTMLArea._lc(string, 'UnFormat');
+};
+
+UnFormat.prototype.buttonPress = function(editor){
+ editor._popupDialog( "plugin://UnFormat/unformat", function( param){
+ if (param) {
+ if (param["cleaning_area"] == "all") {
+ var html = editor._doc.body.innerHTML;
+ } else {
+ var html = editor.getSelectedHTML();
+ }
+
+ if (param["html_all"]== true) {
+ html = html.replace(/<[\!]*?[^<>]*?>/g, "");
+ }
+
+ if (param["formatting"] == true) {
+ html = html.replace(/style="[^"]*"/gi, "");
+ html = html.replace(/<\/?font[^>]*>/gi,"");
+ html = html.replace(/<\/?b>/gi,"");
+ html = html.replace(/<\/?strong[^>]*>/gi,"");
+ html = html.replace(/<\/?i>/gi,"");
+ html = html.replace(/<\/?em[^>]*>/gi,"");
+ html = html.replace(/<\/?u[^>]*>/gi,"");
+ html = html.replace(/<\/?strike[^>]*>/gi,"");
+ html = html.replace(/ align=[^\s|>]*/gi,"");
+ html = html.replace(/ class=[^\s|>]*/gi,"");
+ }
+ if (param["cleaning_area"] == "all") {
+ editor._doc.body.innerHTML = html;
+ } else {
+ editor.insertHTML(html);
+ }
+ } else { return false; }
+ }, null);
+};
\ No newline at end of file
Added: incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/popupdiv.js
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/popupdiv.js?view=auto&rev=454197
==============================================================================
--- incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/popupdiv.js (added)
+++ incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/popupdiv.js Sun Oct 8 12:53:13 2006
@@ -0,0 +1,369 @@
+/** This file is derived from PopupDiv, developed by Mihai Bazon for
+ * SamWare.net. Modifications were needed to make it usable in HTMLArea.
+ * HTMLArea is a free WYSIWYG online HTML editor from InteractiveTools.com.
+ *
+ * This file does not function standalone. It is dependent of global functions
+ * defined in HTMLArea-3.0 (htmlarea.js).
+ *
+ * Please see file htmlarea.js for further details.
+ **/
+
+var is_ie = ( (navigator.userAgent.toLowerCase().indexOf("msie") != -1) &&
+ (navigator.userAgent.toLowerCase().indexOf("opera") == -1) );
+var is_compat = (document.compatMode == "BackCompat");
+
+function PopupDiv(editor, titleText, handler, initFunction) {
+ var self = this;
+
+ this.editor = editor;
+ this.doc = editor._mdoc;
+ this.handler = handler;
+
+ var el = this.doc.createElement("div");
+ el.className = "content";
+
+ var popup = this.doc.createElement("div");
+ popup.className = "dialog popupdiv";
+ this.element = popup;
+ var s = popup.style;
+ s.position = "absolute";
+ s.left = "0px";
+ s.top = "0px";
+
+ var title = this.doc.createElement("div");
+ title.className = "title";
+ this.title = title;
+ popup.appendChild(title);
+
+ HTMLArea._addEvent(title, "mousedown", function(ev) {
+ self._dragStart(is_ie ? window.event : ev);
+ });
+
+ var button = this.doc.createElement("div");
+ button.className = "button";
+ title.appendChild(button);
+ button.innerHTML = "×";
+ title.appendChild(this.doc.createTextNode(titleText));
+ this.titleText = titleText;
+
+ button.onmouseover = function() {
+ this.className += " button-hilite";
+ };
+ button.onmouseout = function() {
+ this.className = this.className.replace(/\s*button-hilite\s*/g, " ");
+ };
+ button.onclick = function() {
+ this.className = this.className.replace(/\s*button-hilite\s*/g, " ");
+ self.close();
+ };
+
+ popup.appendChild(el);
+ this.content = el;
+
+ this.doc.body.appendChild(popup);
+
+ this.dragging = false;
+ this.onShow = null;
+ this.onClose = null;
+ this.modal = false;
+
+ initFunction(this);
+};
+
+PopupDiv.currentPopup = null;
+
+PopupDiv.prototype.showAtElement = function(el, mode) {
+ this.defaultSize();
+ var pos, ew, eh;
+ var popup = this.element;
+ popup.style.display = "block";
+ var w = popup.offsetWidth;
+ var h = popup.offsetHeight;
+ popup.style.display = "none";
+ if (el != window) {
+ pos = PopupDiv.getAbsolutePos(el);
+ ew = el.offsetWidth;
+ eh = el.offsetHeight;
+ } else {
+ pos = {x:0, y:0};
+ var size = PopupDiv.getWindowSize();
+ ew = size.x;
+ eh = size.y;
+ }
+ var FX = false, FY = false;
+ if (mode.indexOf("l") != -1) {
+ pos.x -= w;
+ FX = true;
+ }
+ if (mode.indexOf("r") != -1) {
+ pos.x += ew;
+ FX = true;
+ }
+ if (mode.indexOf("t") != -1) {
+ pos.y -= h;
+ FY = true;
+ }
+ if (mode.indexOf("b") != -1) {
+ pos.y += eh;
+ FY = true;
+ }
+ if (mode.indexOf("c") != -1) {
+ FX || (pos.x += Math.round((ew - w) / 2));
+ FY || (pos.y += Math.round((eh - h) / 2));
+ }
+ this.showAt(pos.x, pos.y);
+};
+
+PopupDiv.prototype.defaultSize = function() {
+ var s = this.element.style;
+ var cs = this.element.currentStyle;
+ var addX = (is_ie && is_compat) ? (parseInt(cs.borderLeftWidth) +
+ parseInt(cs.borderRightWidth) +
+ parseInt(cs.paddingLeft) +
+ parseInt(cs.paddingRight)) : 0;
+ var addY = (is_ie && is_compat) ? (parseInt(cs.borderTopWidth) +
+ parseInt(cs.borderBottomWidth) +
+ parseInt(cs.paddingTop) +
+ parseInt(cs.paddingBottom)) : 0;
+ s.display = "block";
+ s.width = (this.content.offsetWidth + addX) + "px";
+ s.height = (this.content.offsetHeight + this.title.offsetHeight) + "px";
+ s.display = "none";
+};
+
+PopupDiv.prototype.showAt = function(x, y) {
+ this.defaultSize();
+ var s = this.element.style;
+ s.display = "block";
+ s.left = x + "px";
+ s.top = y + "px";
+ this.hideShowCovered();
+
+ PopupDiv.currentPopup = this;
+ HTMLArea._addEvents(this.doc.body, ["mousedown", "click"], PopupDiv.checkPopup);
+ HTMLArea._addEvents(this.editor._doc.body, ["mousedown", "click"], PopupDiv.checkPopup);
+ if (is_ie && this.modal) {
+ this.doc.body.setCapture(false);
+ this.doc.body.onlosecapture = function() {
+ (PopupDiv.currentPopup) && (this.doc.body.setCapture(false));
+ };
+ }
+ window.event && HTMLArea._stopEvent(window.event);
+
+ if (typeof this.onShow == "function") {
+ this.onShow();
+ } else if (typeof this.onShow == "string") {
+ eval(this.onShow);
+ }
+
+ var field = this.element.getElementsByTagName("input")[0];
+ if (!field) {
+ field = this.element.getElementsByTagName("select")[0];
+ }
+ if (!field) {
+ field = this.element.getElementsByTagName("textarea")[0];
+ }
+ if (field) {
+ field.focus();
+ }
+};
+
+PopupDiv.prototype.close = function() {
+ this.element.style.display = "none";
+ PopupDiv.currentPopup = null;
+ this.hideShowCovered();
+ HTMLArea._removeEvents(this.doc.body, ["mousedown", "click"], PopupDiv.checkPopup);
+ HTMLArea._removeEvents(this.editor._doc.body, ["mousedown", "click"], PopupDiv.checkPopup);
+ is_ie && this.modal && this.doc.body.releaseCapture();
+ if (typeof this.onClose == "function") {
+ this.onClose();
+ } else if (typeof this.onClose == "string") {
+ eval(this.onClose);
+ }
+ this.element.parentNode.removeChild(this.element);
+};
+
+PopupDiv.prototype.getForm = function() {
+ var forms = this.content.getElementsByTagName("form");
+ return (forms.length > 0) ? forms[0] : null;
+};
+
+PopupDiv.prototype.callHandler = function() {
+ var tags = ["input", "textarea", "select"];
+ var params = new Object();
+ for (var ti = tags.length; --ti >= 0;) {
+ var tag = tags[ti];
+ var els = this.content.getElementsByTagName(tag);
+ for (var j = 0; j < els.length; ++j) {
+ var el = els[j];
+ params[el.name] = el.value;
+ }
+ }
+ this.handler(this, params);
+ return false;
+};
+
+PopupDiv.getAbsolutePos = function(el) {
+ var r = { x: el.offsetLeft, y: el.offsetTop };
+ if (el.offsetParent) {
+ var tmp = PopupDiv.getAbsolutePos(el.offsetParent);
+ r.x += tmp.x;
+ r.y += tmp.y;
+ }
+ return r;
+};
+
+PopupDiv.getWindowSize = function() {
+ if (window.innerHeight) {
+ return { y: window.innerHeight, x: window.innerWidth };
+ }
+ if (this.doc.body.clientHeight) {
+ return { y: this.doc.body.clientHeight, x: this.doc.body.clientWidth };
+ }
+ return { y: this.doc.documentElement.clientHeight, x: this.doc.documentElement.clientWidth };
+};
+
+PopupDiv.prototype.hideShowCovered = function () {
+ var self = this;
+ function isContained(el) {
+ while (el) {
+ if (el == self.element) {
+ return true;
+ }
+ el = el.parentNode;
+ }
+ return false;
+ };
+ var tags = new Array("applet", "select");
+ var el = this.element;
+
+ var p = PopupDiv.getAbsolutePos(el);
+ var EX1 = p.x;
+ var EX2 = el.offsetWidth + EX1;
+ var EY1 = p.y;
+ var EY2 = el.offsetHeight + EY1;
+
+ if (el.style.display == "none") {
+ EX1 = EX2 = EY1 = EY2 = 0;
+ }
+
+ for (var k = tags.length; k > 0; ) {
+ var ar = this.doc.getElementsByTagName(tags[--k]);
+ var cc = null;
+
+ for (var i = ar.length; i > 0;) {
+ cc = ar[--i];
+ if (isContained(cc)) {
+ cc.style.visibility = "visible";
+ continue;
+ }
+
+ p = PopupDiv.getAbsolutePos(cc);
+ var CX1 = p.x;
+ var CX2 = cc.offsetWidth + CX1;
+ var CY1 = p.y;
+ var CY2 = cc.offsetHeight + CY1;
+
+ if ((CX1 > EX2) || (CX2 < EX1) || (CY1 > EY2) || (CY2 < EY1)) {
+ cc.style.visibility = "visible";
+ } else {
+ cc.style.visibility = "hidden";
+ }
+ }
+ }
+};
+
+PopupDiv.prototype._dragStart = function (ev) {
+ if (this.dragging) {
+ return false;
+ }
+ this.dragging = true;
+ PopupDiv.currentPopup = this;
+ var posX = ev.clientX;
+ var posY = ev.clientY;
+ if (is_ie) {
+ posY += this.doc.body.scrollTop;
+ posX += this.doc.body.scrollLeft;
+ } else {
+ posY += window.scrollY;
+ posX += window.scrollX;
+ }
+ var st = this.element.style;
+ this.xOffs = posX - parseInt(st.left);
+ this.yOffs = posY - parseInt(st.top);
+ HTMLArea._addEvent(this.doc, "mousemove", PopupDiv.dragIt);
+ HTMLArea._addEvent(this.doc, "mouseover", HTMLArea._stopEvent);
+ HTMLArea._addEvent(this.doc, "mouseup", PopupDiv.dragEnd);
+ HTMLArea._stopEvent(ev);
+};
+
+PopupDiv.dragIt = function (ev) {
+ var popup = PopupDiv.currentPopup;
+ if (!(popup && popup.dragging)) {
+ return false;
+ }
+ is_ie && (ev = window.event);
+ var posX = ev.clientX;
+ var posY = ev.clientY;
+ if (is_ie) {
+ posY += this.doc.body.scrollTop;
+ posX += this.doc.body.scrollLeft;
+ } else {
+ posY += window.scrollY;
+ posX += window.scrollX;
+ }
+ popup.hideShowCovered();
+ var st = popup.element.style;
+ st.left = (posX - popup.xOffs) + "px";
+ st.top = (posY - popup.yOffs) + "px";
+ HTMLArea._stopEvent(ev);
+};
+
+PopupDiv.dragEnd = function () {
+ var popup = PopupDiv.currentPopup;
+ if (!popup) {
+ return false;
+ }
+ popup.dragging = false;
+ HTMLArea._removeEvent(popup.doc, "mouseup", PopupDiv.dragEnd);
+ HTMLArea._removeEvent(popup.doc, "mouseover", HTMLArea._stopEvent);
+ HTMLArea._removeEvent(popup.doc, "mousemove", PopupDiv.dragIt);
+ popup.hideShowCovered();
+};
+
+PopupDiv.checkPopup = function (ev) {
+ is_ie && (ev = window.event);
+ var el = is_ie ? ev.srcElement : ev.target;
+ var cp = PopupDiv.currentPopup;
+ for (; (el != null) && (el != cp.element); el = el.parentNode);
+ if (el == null) {
+ cp.modal || ev.type == "mouseover" || cp.close();
+ HTMLArea._stopEvent(ev);
+ }
+};
+
+PopupDiv.prototype.addButtons = function() {
+ var self = this;
+ var div = this.doc.createElement("div");
+ this.content.appendChild(div);
+ div.className = "buttons";
+ for (var i = 0; i < arguments.length; ++i) {
+ var btn = arguments[i];
+ var button = this.doc.createElement("button");
+ div.appendChild(button);
+ button.innerHTML = HTMLArea._lc(buttons[btn], 'HTMLArea');
+ switch (btn) {
+ case "ok":
+ button.onclick = function() {
+ self.callHandler();
+ self.close();
+ };
+ break;
+ case "cancel":
+ button.onclick = function() {
+ self.close();
+ };
+ break;
+ }
+ }
+};
Added: incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/popups/about.html
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/popups/about.html?view=auto&rev=454197
==============================================================================
--- incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/popups/about.html (added)
+++ incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/popups/about.html Sun Oct 8 12:53:13 2006
@@ -0,0 +1,296 @@
+<!--
+
+(c) dynarch.com, 2003-2004
+Author: Mihai Bazon, http://dynarch.com/mishoo
+Distributed as part of HTMLArea 3.0
+
+"You are not expected to understand this... I don't neither."
+
+ (from The Linux Kernel Source Code,
+ ./arch/x86_64/ia32/ptrace.c:90)
+
+;-)
+
+-->
+
+<html style="height: 100%">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<title>About Xinha</title>
+<script type="text/javascript" src="popup.js"></script>
+<script type="text/javascript">
+window.resizeTo(450, 250);
+var TABS = [];
+var CURRENT_TAB = 0;
+var CONTENT_HEIGHT_DIFF = 0;
+var CONTENT_WIDTH_DIFF = 0;
+function selectTab(idx) {
+ var ct = TABS[CURRENT_TAB];
+ ct.className = ct.className.replace(/\s*tab-current\s*/, ' ');
+ ct = TABS[CURRENT_TAB = idx];
+ ct.className += ' tab-current';
+ for (var i = TABS.length; --i >= 0;) {
+ var area = document.getElementById("tab-area-" + i);
+ if (CURRENT_TAB == i) {
+ area.style.display = "block";
+ } else {
+ area.style.display = "none";
+ }
+ }
+ document.body.style.visibility = "hidden";
+ document.body.style.visibility = "visible";
+ document.cookie = "HTMLAREA-ABOUT-TAB=" + idx;
+}
+var editor = null;
+function initDocument() {
+ editor = window.dialogArguments;
+ HTMLArea = window.opener.HTMLArea;
+
+ var plugins = document.getElementById("plugins");
+ var j = 0;
+ var html = "<table width='99%' cellpadding='2' cellspacing=2 style='margin-top: 1em; collapse-borders: collapse; border: 1px solid black;'>" +
+ "<thead><tr>" +
+ "<td>Name</td>" +
+ "<td>Developer</td>" +
+ "<td>Sponsored by</td>" +
+ "<td>License</td>" +
+ "</tr></thead><tbody>";
+ for (var i in editor.plugins) {
+ var info = editor.plugins[i];
+ if (typeof info != 'object' || !info.name || typeof info.name !='string') continue;
+ html += "<tr><td>" + info.name + " v" + info.version + "</td>" +
+ "<td><a href='" + info.developer_url + "' target='_blank' title='Visit developer website'>" +
+ info.developer + "</a></td>" +
+ "<td><a href='" + info.sponsor_url + "' target='_blank' title='Visit sponsor website'>" +
+ info.sponsor + "</a></td>" +
+ "<td>" + info.license + "</td></tr>";
+ ++j;
+ }
+
+ if (j) {
+ html += "</tbody></table>" +
+ "<p>License \"htmlArea\" means that the plugin is distributed under the same terms " +
+ "as Xinha itself.</p>";
+ plugins.innerHTML = "<p>The following plugins have been loaded.</p>" + html;
+ } else {
+ plugins.innerHTML = "<p>No plugins have been loaded</p>";
+ }
+
+ plugins.innerHTML += "<p>User agent reports:<br/>" + navigator.userAgent + "</p>";
+
+ var content = document.getElementById("content");
+ if (window.innerHeight) {
+ CONTENT_HEIGHT_DIFF = window.innerHeight - 250;
+ CONTENT_WIDTH_DIFF = window.innerWidth - content.offsetWidth;
+ } else {
+ CONTENT_HEIGHT_DIFF = document.body.offsetHeight - 250;
+ CONTENT_WIDTH_DIFF = document.body.offsetWidth - 400;
+ }
+ window.onresize();
+ var bar = document.getElementById("tabbar");
+ j = 0;
+ for (var i = bar.firstChild; i; i = i.nextSibling) {
+ TABS.push(i);
+ i.__msh_tab = j;
+ i.onmousedown = function(ev) { selectTab(this.__msh_tab); HTMLArea._stopEvent(ev || window.event); };
+ var area = document.getElementById("tab-area-" + j);
+ if (/tab-current/.test(i.className)) {
+ CURRENT_TAB = j;
+ area.style.display = "block";
+ } else {
+ area.style.display = "none";
+ }
+ ++j;
+ }
+ if (document.cookie.match(/HTMLAREA-ABOUT-TAB=([0-9]+)/))
+ selectTab(RegExp.$1);
+}
+window.onresize = function() {
+ var content = document.getElementById("content");
+ if (window.innerHeight) {
+ content.style.height = (window.innerHeight - CONTENT_HEIGHT_DIFF) + "px";
+ content.style.width = (window.innerWidth - CONTENT_WIDTH_DIFF) + "px";
+ } else {
+ content.style.height = (document.body.offsetHeight - CONTENT_HEIGHT_DIFF) + "px";
+ //content.style.width = (document.body.offsetWidth - CONTENT_WIDTH_DIFF) + "px";
+ }
+}
+</script>
+<style>
+ html,body,textarea,table
+ { font-family: helvetica,arial,sans-serif;
+ font-size: 11px; padding: 0px; margin: 0px;
+ }
+
+ body { padding: 0px; background: #f5f6f6; color: black; }
+ a:link, a:visited { color: #00f; }
+ a:hover { color: #f00; }
+ a:active { color: #f80; }
+ button { font: 11px; border-width: 1px; background-color:#f5f6f6; color:black; }
+
+ p { margin: 0.5em 0px; }
+
+ #tdheader h1
+ { font: bold 40px "Staccato222 BT", cursive; margin: 0px; padding-left:4px; border-bottom: 1px solid #6a6; }
+ h1 { font: bold 20px; margin: 0px; border-bottom: 1px solid #6a6; }
+ h2 { font: bold 110%; margin: 0.7em 0px; }
+
+ thead {
+ font-weight: bold;
+ background-color: #CCC;
+ }
+
+ thead td { padding-left:4px; }
+
+ .buttons {
+ text-align: right; padding: 3px;
+ background-color: white;
+ border-top: 1px solid #555;
+ }
+
+ #tabbar {
+ position: relative;
+ left: 10px;
+ }
+ .tab {
+ color: #OOO;
+ cursor: pointer;
+ margin-left: -5px;
+ float: left; position: relative;
+ border: 1px solid #555;
+ top: -3px; left: -2px;
+ padding: 2px 10px 3px 10px;
+ border-top: none; background-color: #CCC;
+ -moz-border-radius: 0px 0px 4px 4px;
+ z-index: 0;
+ }
+ .tab-current
+ {
+ color: #000;
+ top: -4px;
+ background-color: #f5f6f6;
+ padding: 3px 10px 4px 10px;
+ z-index: 10;
+ }
+
+ li, ol, ul { margin-top: 0px; margin-bottom: 0px; }
+</style></head>
+<body onload="__dlg_init(); initDocument();"
+><table cellspacing="0" cellpadding="0" style="border-collapse: collapse;
+ width: 100%; height: 100%;">
+
+<tr style="height: 1em"><td id="tdheader">
+
+<h1><img src="../images/xinha_logo.gif" alt="Xinha" /></h1>
+
+</td></tr>
+<tr><td id="tdcontent" style="padding: 0.5em;">
+
+<div style="overflow: auto; height: 250px;" id="content">
+<div id="tab-areas">
+
+<div id="tab-area-0">
+
+ <p>A free WYSIWYG editor replacement for <tt><textarea></tt> fields.</p>
+ <p>Visit the <a href="http://xinha.gogo.co.nz/">Xinha Website</a> for more information.</p>
+
+ <p>
+ Use of Xinha is granted by the terms of the htmlArea License (based on BSD license)
+ </p>
+ <p>
+ Xinha was originally based on work by Mihai Bazon which is:
+ </p>
+ <blockquote><pre>Copyright (c) 2003-2004 dynarch.com.
+ Copyright (c) 2002-2003 interactivetools.com, inc.
+ This copyright notice MUST stay intact for use.</pre></blockquote>
+
+</div>
+
+<div id="tab-area-1">
+
+ <p>
+ The development of Xinha would not have been possible without the original work of <a href="http://dynarch.com/">Mihai Bazon</a>, <a href="http://interactivetools.com" target="_blank">InteractiveTools.com</a>, and the many sponsors and contributors from around the world.
+ </p>
+
+</div>
+
+<div id="tab-area-2">
+<pre>htmlArea License (based on BSD license)
+Copyright (c) 2002-2004, interactivetools.com, inc.
+Copyright (c) 2003-2004 dynarch.com
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+1) Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+2) Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+3) Neither the name of interactivetools.com, inc. nor the names of its
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.</pre>
+</div>
+
+<div id="tab-area-3">
+<div id="plugins">
+</div>
+</div>
+
+
+<div id="tab-area-4">
+ <script type="text/javascript">
+ if(window.opener && window.opener.HTMLArea)
+ {
+ var ver = window.opener.HTMLArea.version;
+ document.write('<pre>'
+ + '\nRelease: ' + ver.Release + ' (' + ver.Date + ')'
+ + '\nHead: ' + ver.Head
+ + '\nRevision: ' + ver.Revision
+ + '\nLast Changed By: ' + ver.RevisionBy
+ + '\n' +
+ '</pre>');
+ }
+ else
+ {
+ document.write('<pre>Version information unavailable.</pre>');
+ }
+ </script>
+</div>
+
+</div></div>
+
+
+</td></tr>
+<tr style="height: 1em"><td id="tdfooter">
+
+
+<div class="buttons">
+<div id="tabbar"
+><div class="tab tab-current"
+>About</div><div class="tab"
+>Thanks</div><div class="tab"
+>License</div><div class="tab"
+>Plugins</div><div class="tab"
+>Version</div></div>
+<button type="button" onclick="__dlg_close(null);">Close</button>
+</div>
+
+</td></tr></table>
+
+</body></html>
Added: incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/popups/blank.html
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/popups/blank.html?view=auto&rev=454197
==============================================================================
--- incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/popups/blank.html (added)
+++ incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/popups/blank.html Sun Oct 8 12:53:13 2006
@@ -0,0 +1,2 @@
+<html>
+</html>
\ No newline at end of file
Added: incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/popups/color_picker.js
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/popups/color_picker.js?view=auto&rev=454197
==============================================================================
--- incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/popups/color_picker.js (added)
+++ incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/popups/color_picker.js Sun Oct 8 12:53:13 2006
@@ -0,0 +1,500 @@
+
+ /**
+ * Gogo Internet Services Color Picker Javascript Widget
+ * colorPicker for short.
+ *
+ * @author James Sleeman <ja...@gogo.co.nz>
+ * @date June, 2005
+ *
+ * The colorPicker class provides access to a color map for selecting
+ * colors which will be passed back to a callback (usually such a callback would
+ * write the RGB hex value returned into a field, but that's up to you).
+ *
+ * The color map presented is a standard rectangular pallate with 0->360 degrees of
+ * hue on the Y axis and 0->100% saturation on the X axis, the value (brightness) is
+ * selectable as a vertical column of grey values. Also present is a one row of
+ * white->grey->black for easy selection of these colors.
+ *
+ * A checkbox is presented, which when checked will force the palatte into "web safe"
+ * mode, only colours in the "web safe palatte" of 216 colors will be shown, the palatte
+ * is adjusted so that the normal blend of colours are "rounded" to the nearest web safe
+ * one. It should be noted that "web safe" colours really are a thing of the past,
+ * not only can pretty much every body display several million colours, but it's actually
+ * been found that of those 216 web safe colours only 20 to 30 are actually going to be
+ * displayed equally on the majority of monitors, and those are mostly yellows!
+ *
+ * =Usage Example=
+ * {{{
+ * <!-- Here is the field --> <!-- And we will use this button to open the picker"
+ * <input type="text" id="myField" /> <input type="button" value="..." id="myButton" />
+ * <script>
+ * // now when the window loads link everything up
+ * window.onload = function()
+ * {
+ *
+ * var myField = document.getElementById('myField'); // Get our field
+ * var myButton = document.getElementById('myButton'); // And the button
+ * var myPicker = new colorPicker // Make a picker
+ * (
+ * {
+ * // Cellsize is the width and height of each colour cell
+ * cellsize: '5px',
+ * // Callback is the function to execute when we are done,
+ * // this one puts the color value into the field
+ * callback: function(color){myField.value=color},
+ * // Granularity defines the maximum number of colors per row/column
+ * // more colors (high number) gives a smooth gradient of colors
+ * // but it will take (much) longer to display, while a small number
+ * // displays quickly, but doesn't show as many different colors.
+ * // Experiement with it, 18 seems like a good number.
+ * granularity: 18
+ * }
+ * );
+ *
+ * // And now hookup the button to open the picker,
+ * // the function to do that is myPicker.open()
+ * // it accepts two parameters, the "anchorage" and the element to anchor to
+ * // to anchor to.
+ * //
+ * // anchorage is made up of two of the keywords bottom,top,left and right
+ * // left: the left edge of the picker will align to the left edge of the element
+ * // or right: the right edgeof the picker aligns to the right edge of the element
+ * // top: the picker will appear above the element
+ * // or bottom: the picker will appear below the element
+ *
+ * myButton.onclick =
+ * function()
+ * { // anchorage , element to anchor to
+ * myPicker.open('bottom,right', myPicker)
+ * };
+ * }
+ * </script>
+ * }}}
+ */
+
+ function colorPicker(params)
+ {
+ var picker = this;
+ this.callback = params.callback?params.callback:function(color){alert('You picked ' + color )};
+
+ this.cellsize = params.cellsize?params.cellsize:'10px';
+ this.side = params.granularity?params.granularity:18;
+
+ this.value = 1;
+ this.saved_cells = null;
+ this.table = document.createElement('table');
+ this.table.cellSpacing = this.table.cellPadding = 0;
+ this.tbody = document.createElement('tbody');
+ this.table.appendChild(this.tbody);
+ this.table.style.border = '1px solid WindowFrame';
+ this.table.style.backgroundColor = 'Window';
+ // Add a title bar and close button
+ var tr = document.createElement('tr');
+ var td = document.createElement('td');
+ var but = document.createElement('button');
+ but.onclick = function() { picker.close(); }
+ but.appendChild(document.createTextNode('x'));
+ td.appendChild(but);
+ td.style.position = 'relative';
+ td.style.verticalAlign = 'middle';
+ but.style.cssFloat = 'right';
+ but.style.styleFloat = 'right';
+
+
+ td.colSpan = this.side + 3;
+ td.style.backgroundColor = 'ActiveCaption';
+ td.style.color = 'CaptionText';
+ td.style.fontFamily = 'small-caption,caption,sans-serif';
+ td.style.fontSize = 'x-small';
+ td.appendChild(document.createTextNode('Click a color...'));
+ td.style.borderBottom = '1px solid WindowFrame';
+
+ tr.appendChild(td);
+ this.tbody.appendChild(tr);
+ but = tr = td = null;
+
+ this.constrain_cb = document.createElement('input');
+ this.constrain_cb.type = 'checkbox';
+
+ this.chosenColor = document.createElement('input');
+ this.chosenColor.type = 'text';
+ this.chosenColor.size = '7';
+
+ this.backSample = document.createElement('div');
+ this.backSample.appendChild(document.createTextNode('\u00A0'));
+ this.backSample.style.fontWeight = 'bold';
+ this.backSample.style.fontFamily = 'small-caption,caption,sans-serif';
+ this.backSample.fontSize = 'x-small';
+
+ this.foreSample = document.createElement('div');
+ this.foreSample.appendChild(document.createTextNode('Sample'));
+ this.foreSample.style.fontWeight = 'bold';
+ this.foreSample.style.fontFamily = 'small-caption,caption,sans-serif';
+ this.foreSample.fontSize = 'x-small';
+
+ /** Convert a decimal number to a two byte hexadecimal representation.
+ * Zero-pads if necessary.
+ *
+ * @param integer dec Integer from 0 -> 255
+ * @returns string 2 character hexadecimal (zero padded)
+ */
+ function toHex(dec)
+ {
+ var h = dec.toString(16);
+ if(h.length < 2) h = '0' + h;
+ return h;
+ }
+
+ /** Convert a color object {red:x, green:x, blue:x} to an RGB hex triplet
+ * @param object tuple {red:0->255, green:0->255, blue:0->255}
+ * @returns string hex triplet (#rrggbb)
+ */
+
+ function tupleToColor(tuple)
+ {
+ return '#' + toHex(tuple.red) + toHex(tuple.green) + toHex(tuple.blue);
+ }
+
+ /** Determine the nearest power of a number to another number
+ * (eg nearest power of 4 to 5 => 4, of 4 to 7 => 8)
+ *
+ * @usedby rgbToWebsafe
+ * @param number num number to round to nearest power of <power>
+ * @param number power number to find the nearest power of
+ * @returns number Nearest power of <power> to num.
+ */
+
+ function nearestPowerOf(num,power)
+ {
+ return Math.round(Math.round(num / power) * power);
+ }
+
+ /** Concatenate the hex representation of dec to itself and return as an integer.
+ * eg dec = 10 -> A -> AA -> 170
+ *
+ * @usedby rgbToWebsafe
+ * @param dec integer
+ * @returns integer
+ */
+
+ function doubleHexDec(dec)
+ {
+ return parseInt(dec.toString(16) + dec.toString(16), 16);
+ }
+
+ /** Convert a given RGB color to the nearest "Web-Safe" color. A websafe color only has the values
+ * 00, 33, 66, 99, CC and FF for each of the red, green and blue components (thus 6 shades of each
+ * in combination to produce 6 * 6 * 6 = 216 colors).
+ *
+ * @param color object {red:0->255, green:0->255, blue:0->255}
+ * @returns object {red:51|102|153|204|255, green:51|102|153|204|255, blue:51|102|153|204|255}
+ */
+ function rgbToWebsafe(color)
+ {
+ // For each take the high byte, divide by three, round and multiply by three before rounding again
+ color.red = doubleHexDec(nearestPowerOf(parseInt(toHex(color.red).charAt(0), 16), 3));
+ color.blue = doubleHexDec(nearestPowerOf(parseInt(toHex(color.blue).charAt(0), 16), 3));
+ color.green = doubleHexDec(nearestPowerOf(parseInt(toHex(color.green).charAt(0), 16), 3));
+ return color;
+ }
+
+ /** Convert a combination of hue, saturation and value into an RGB color.
+ * Hue is defined in degrees, saturation and value as a floats between 0 and 1 (0% -> 100%)
+ *
+ * @param h float angle of hue around color wheel 0->360
+ * @param s float saturation of color (no color (grey)) 0->1 (vibrant)
+ * @param v float value (brightness) of color (black) 0->1 (bright)
+ * @returns object {red:0->255, green:0->255, blue:0->255}
+ * @seealso http://en.wikipedia.org/wiki/HSV_color_space
+ */
+ function hsvToRGB(h,s,v)
+ {
+ var colors;
+ if(s == 0)
+ {
+ // GREY
+ colors = {red:v,green:v,blue:v}
+ }
+ else
+ {
+ h /= 60;
+ var i = Math.floor(h);
+ var f = h - i;
+ var p = v * (1 - s);
+ var q = v * (1 - s * f);
+ var t = v * (1 - s * (1 - f) );
+ switch(i)
+ {
+ case 0: colors = {red:v, green:t, blue:p}; break;
+ case 1: colors = {red:q, green:v, blue:p}; break;
+ case 2: colors = {red:p, green:v, blue:t}; break;
+ case 3: colors = {red:p, green:q, blue:v}; break;
+ case 4: colors = {red:t, green:p, blue:v}; break;
+ case 5:
+ default:colors = {red:v, green:p, blue:q}; break;
+ }
+ }
+ colors.red = Math.ceil(colors.red * 255);
+ colors.green = Math.ceil(colors.green * 255);
+ colors.blue = Math.ceil(colors.blue * 255);
+ return colors;
+ }
+
+ /** Open the color picker
+ *
+ * @param string anchorage pair of sides of element to anchor the picker to
+ * "top,left" "top,right" "bottom,left" or "bottom,right"
+ * @param HTML_ELEMENT element the element to anchor the picker to sides of
+ *
+ * @note The element is just referenced here for positioning (anchoring), it
+ * does not automatically get the color copied into it. See the usage instructions
+ * for the class.
+ */
+
+ this.open = function(anchorage,element)
+ {
+ this.table.style.display = '';
+
+ this.pick_color();
+
+ // Find position of the element
+ this.table.style.position = 'absolute';
+ var e = element;
+ var top = 0;
+ var left = 0;
+ do
+ {
+ top += e.offsetTop;
+ left += e.offsetLeft;
+ e = e.offsetParent;
+ }
+ while(e)
+
+ var x, y;
+ if(/top/.test(anchorage))
+ {
+ this.table.style.top = (top - this.table.offsetHeight) + 'px';
+ }
+ else
+ {
+ this.table.style.top = (top + element.offsetHeight) + 'px';
+ }
+
+ if(/left/.test(anchorage))
+ {
+ this.table.style.left = left + 'px';
+ }
+ else
+ {
+ this.table.style.left = (left - (this.table.offsetWidth - element.offsetWidth)) + 'px';
+ }
+ };
+
+ /** Draw the color picker. */
+ this.pick_color = function()
+ {
+ var rows, cols;
+ var picker = this;
+ var huestep = 359/this.side;
+ var saturstep = 1/this.side;
+ var valustep = 1/this.side;
+ var constrain = this.constrain_cb.checked;
+
+ if(this.saved_cells == null)
+ {
+ this.saved_cells = new Array();
+
+ for(var row = 0; row <= this.side; row++)
+ {
+ var tr = document.createElement('tr');
+ this.saved_cells[row] = new Array();
+ for(var col = 0; col <= this.side; col++)
+ {
+ var td = document.createElement('td');
+ if(constrain)
+ {
+ td.colorCode = tupleToColor(rgbToWebsafe(hsvToRGB(huestep*row, saturstep*col, this.value)));
+ }
+ else
+ {
+ td.colorCode = tupleToColor(hsvToRGB(huestep*row, saturstep*col, this.value));
+ }
+ this.saved_cells[row][col] = td;
+ td.style.height = td.style.width = this.cellsize;
+ td.style.backgroundColor = td.colorCode;
+ td.hue = huestep * row;
+ td.saturation = saturstep*col;
+ td.onmouseover = function()
+ {
+ picker.chosenColor.value = this.colorCode;
+ picker.backSample.style.backgroundColor = this.colorCode;
+ picker.foreSample.style.color = this.colorCode;
+ if((this.hue >= 195 && this.saturation > 0.25) || picker.value < 0.75)
+ {
+ picker.backSample.style.color = 'white';
+ }
+ else
+ {
+ picker.backSample.style.color = 'black';
+ }
+ }
+ td.onclick = function() { picker.callback(this.colorCode); picker.close(); }
+ td.appendChild(document.createTextNode(' '));
+ td.style.cursor = 'pointer';
+ tr.appendChild(td);
+ td = null;
+ }
+
+ // Add a blank and thena value column
+ var td = document.createElement('td');
+ td.appendChild(document.createTextNode(' '));
+ td.style.width = this.cellsize;
+ tr.appendChild(td);
+ td = null;
+
+ var td = document.createElement('td');
+ td.appendChild(document.createTextNode(' '));
+ td.style.width = this.cellsize;
+ td.style.height = this.cellsize;
+ td.constrainedColorCode = tupleToColor(rgbToWebsafe(hsvToRGB(0,0,valustep*row)));
+ td.style.backgroundColor = td.colorCode = tupleToColor(hsvToRGB(0,0,valustep*row));
+ td.hue = huestep * row;
+ td.saturation = saturstep*col;
+ td.hsv_value = valustep*row;
+ td.onclick = function() {
+ picker.value = this.hsv_value; picker.pick_color();
+ if(picker.constrain_cb.checked)
+ {
+ picker.chosenColor.value = this.constrainedColorCode;
+ }
+ else
+ {
+ picker.chosenColor.value = this.colorCode;
+ }
+ }
+ td.style.cursor = 'pointer';
+ tr.appendChild(td);
+ td = null;
+
+ this.tbody.appendChild(tr);
+ tr = null;
+ }
+
+ // Add one row of greys
+ var tr = document.createElement('tr');
+ this.saved_cells[row] = new Array();
+ for(var col = 0; col <= this.side; col++)
+ {
+ var td = document.createElement('td');
+ if(constrain)
+ {
+ td.colorCode = tupleToColor(rgbToWebsafe(hsvToRGB(0, 0, valustep*(this.side-col))));
+ }
+ else
+ {
+ td.colorCode = tupleToColor(hsvToRGB(0, 0, valustep*(this.side-col)));
+ }
+ this.saved_cells[row][col] = td;
+ td.style.height = td.style.width = this.cellsize;
+ td.style.backgroundColor = td.colorCode;
+ td.hue = 0;
+ td.saturation = 0;
+ td.onmouseover = function()
+ {
+ picker.chosenColor.value = this.colorCode;
+ picker.backSample.style.backgroundColor = this.colorCode;
+ picker.foreSample.style.color = this.colorCode;
+ if((this.hue >= 195 && this.saturation > 0.25) || picker.value < 0.75)
+ {
+ picker.backSample.style.color = 'white';
+ }
+ else
+ {
+ picker.backSample.style.color = 'black';
+ }
+ }
+ td.onclick = function() { picker.callback(this.colorCode); picker.close(); }
+ td.appendChild(document.createTextNode(' '));
+ td.style.cursor = 'pointer';
+ tr.appendChild(td);
+ td = null;
+ }
+ this.tbody.appendChild(tr);
+ tr = null;
+
+
+ var tr = document.createElement('tr');
+ var td = document.createElement('td');
+ tr.appendChild(td);
+ td.colSpan = this.side + 3;
+ td.style.padding = '3px';
+
+ var div = document.createElement('div');
+ var label = document.createElement('label');
+ label.appendChild(document.createTextNode('Web Safe: '));
+
+ this.constrain_cb.onclick = function() { picker.pick_color() };
+ label.appendChild(this.constrain_cb);
+ label.style.fontFamily = 'small-caption,caption,sans-serif';
+ label.style.fontSize = 'x-small';
+ div.appendChild(label);
+ td.appendChild(div);
+
+ var div = document.createElement('div');
+ var label = document.createElement('label');
+ label.style.fontFamily = 'small-caption,caption,sans-serif';
+ label.style.fontSize = 'x-small';
+ label.appendChild(document.createTextNode('Color: '));
+ label.appendChild(this.chosenColor);
+ div.appendChild(label);
+ td.appendChild(div);
+
+ var sampleTable = document.createElement('table');
+ sampleTable.style.width = '100%';
+ var sampleBody = document.createElement('tbody');
+ sampleTable.appendChild(sampleBody);
+ var sampleRow = document.createElement('tr');
+ sampleBody.appendChild(sampleRow);
+ var leftSampleCell = document.createElement('td');
+ sampleRow.appendChild(leftSampleCell);
+ leftSampleCell.appendChild(this.backSample);
+ leftSampleCell.style.width = '50%';
+ var rightSampleCell = document.createElement('td');
+ sampleRow.appendChild(rightSampleCell);
+ rightSampleCell.appendChild(this.foreSample);
+ rightSampleCell.style.width = '50%';
+
+ td.appendChild(sampleTable);
+
+
+ this.tbody.appendChild(tr);
+ document.body.appendChild(this.table);
+
+ }
+ else
+ {
+ for(var row = 0; row <= this.side; row++)
+ {
+ for(var col = 0; col <= this.side; col++)
+ {
+ if(constrain)
+ {
+ this.saved_cells[row][col].colorCode = tupleToColor(rgbToWebsafe(hsvToRGB(huestep*row, saturstep*col, this.value)));
+ }
+ else
+ {
+ this.saved_cells[row][col].colorCode = tupleToColor(hsvToRGB(huestep*row, saturstep*col, this.value));
+ }
+ this.saved_cells[row][col].style.backgroundColor = this.saved_cells[row][col].colorCode;
+ }
+ }
+ }
+ };
+
+ /** Close the color picker */
+ this.close = function()
+ {
+ this.table.style.display = 'none';
+ };
+
+ }
\ No newline at end of file
Added: incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/popups/custom2.html
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/popups/custom2.html?view=auto&rev=454197
==============================================================================
--- incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/popups/custom2.html (added)
+++ incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/popups/custom2.html Sun Oct 8 12:53:13 2006
@@ -0,0 +1,35 @@
+<html style="width:300px; Height: 60px;">
+ <head>
+ <title>Select Phrase</title>
+<script language="javascript">
+
+var myTitle = window.dialogArguments;
+document.title = myTitle;
+
+
+function returnSelected() {
+ var idx = document.all.textPulldown.selectedIndex;
+ var text = document.all.textPulldown[idx].text;
+
+ window.returnValue = text; // set return value
+ window.close(); // close dialog
+}
+
+</script>
+</head>
+<body bgcolor="#FFFFFF" topmargin=15 leftmargin=0>
+
+<form method=get onSubmit="Set(document.all.ColorHex.value); return false;">
+<div align=center>
+
+<select name="textPulldown">
+<option>The quick brown</option>
+<option>fox jumps over</option>
+<option>the lazy dog.</option>
+</select>
+
+<input type="button" value=" Go " onClick="returnSelected()">
+
+</div>
+</form>
+</body></html>
\ No newline at end of file
Added: incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/popups/editor_help.html
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/popups/editor_help.html?view=auto&rev=454197
==============================================================================
--- incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/popups/editor_help.html (added)
+++ incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/popups/editor_help.html Sun Oct 8 12:53:13 2006
@@ -0,0 +1,61 @@
+<html>
+ <head>
+ <title>Editor Help</title>
+ <script type="text/javascript" src="popup.js"></script>
+ <link rel="stylesheet" type="text/css" href="popup.css" />
+
+<script type="text/javascript">
+HTMLArea = window.opener.HTMLArea;
+function Init() {
+ __dlg_translate('HTMLArea');
+ __dlg_init();
+ window.resizeTo(400, 480);
+}
+
+
+function onCancel() {
+ __dlg_close(null);
+ return false;
+}
+
+</script>
+</head>
+
+<body class="dialog" onload="Init()">
+<div class="title">Xinha Help</div>
+<table width="100%" style="background: white none repeat scroll 0%;">
+ <thead style="border: 1px solid gray; background: silver none repeat scroll 0%;">
+ <tr>
+ <th colspan="2">
+ <span style="text-align:center">Keyboard shortcuts</span><br />
+ <span>The editor provides the following key combinations:</span>
+ </th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr><td>ENTER</td><td><span>new paragraph</span>(<P>)</td></tr>
+ <tr><td>SHIFT-ENTER</td><td><span>insert linebreak</span>(<BR>)</td></tr>
+ <tr><td>CTRL-A</td><td><span>Select all</span></td></tr>
+ <tr><td>CTRL-B</td><td><span>Bold</span></td></tr>
+ <tr><td>CTRL-I</td><td><span>Italic</span></td></tr>
+ <tr><td>CTRL-U</td><td><span>Underline</span></td></tr>
+ <tr><td>CTRL-S</td><td><span>Strikethrough</span></td></tr>
+ <tr><td>CTRL-L</td><td><span>Justify Left</span></td></tr>
+ <tr><td>CTRL-E</td><td><span>Justify Center</span></td></tr>
+ <tr><td>CTRL-R</td><td><span>Justify Right</span></td></tr>
+ <tr><td>CTRL-J</td><td><span>Justify Full</span></td></tr>
+ <tr><td>CTRL-Z</td><td><span>Undoes your last action</span></td></tr>
+ <tr><td>CTRL-Y</td><td><span>Redoes your last action</span></td></tr>
+ <tr><td>CTRL-N</td><td><span>Set format to paragraph</span></td></tr>
+ <tr><td>CTRL-0 (zero)</td><td><span>Clean content pasted from Word</span></td></tr>
+ <tr><td>CTRL-1 .. CTRL-6</td><td><span>Headings</span> (<h1> .. <h6>)</td></tr>
+ <tr><td>CTRL-X</td><td><span>Cut selection</span></td></tr>
+ <tr><td>CTRL-C</td><td><span>Copy selection</span></td></tr>
+ <tr><td>CTRL-V</td><td><span>Paste from clipboard</span></td></tr>
+ </tbody>
+</table>
+<div id="buttons">
+ <button type="button" name="cancel" onclick="return onCancel();">Close</button>
+</div>
+</body>
+</html>
\ No newline at end of file
Added: incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/popups/insert_image.html
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/popups/insert_image.html?view=auto&rev=454197
==============================================================================
--- incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/popups/insert_image.html (added)
+++ incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/popups/insert_image.html Sun Oct 8 12:53:13 2006
@@ -0,0 +1,173 @@
+<html>
+
+<head>
+ <title>Insert Image</title>
+
+<script type="text/javascript" src="popup.js"></script>
+<link rel="stylesheet" type="text/css" href="popup.css" />
+
+<script type="text/javascript">
+
+window.resizeTo(400, 100);
+
+HTMLArea = window.opener.HTMLArea;
+function i18n(str) {
+ return (HTMLArea._lc(str, 'HTMLArea'));
+}
+
+function Init() {
+ __dlg_translate('HTMLArea');
+ __dlg_init();
+ // Make sure the translated string appears in the drop down. (for gecko)
+ document.getElementById("f_align").selectedIndex = 1;
+ document.getElementById("f_align").selectedIndex = 5;
+ var param = window.dialogArguments;
+ if (param) {
+ document.getElementById("f_url").value = param["f_url"];
+ document.getElementById("f_alt").value = param["f_alt"];
+ document.getElementById("f_border").value = param["f_border"];
+ document.getElementById("f_align").value = param["f_align"];
+ document.getElementById("f_vert").value = param["f_vert"];
+ document.getElementById("f_horiz").value = param["f_horiz"];
+ window.ipreview.location.replace(param.f_url);
+ }
+ document.getElementById("f_url").focus();
+}
+
+function onOK() {
+ var required = {
+ "f_url": i18n("You must enter the URL")
+ };
+ for (var i in required) {
+ var el = document.getElementById(i);
+ if (!el.value) {
+ alert(required[i]);
+ el.focus();
+ return false;
+ }
+ }
+ // pass data back to the calling window
+ var fields = ["f_url", "f_alt", "f_align", "f_border",
+ "f_horiz", "f_vert"];
+ var param = new Object();
+ for (var i in fields) {
+ var id = fields[i];
+ var el = document.getElementById(id);
+ param[id] = el.value;
+ }
+ __dlg_close(param);
+ return false;
+}
+
+function onCancel() {
+ __dlg_close(null);
+ return false;
+}
+
+function onPreview() {
+ var f_url = document.getElementById("f_url");
+ var url = f_url.value;
+ if (!url) {
+ alert(i18n("You must enter the URL"));
+ f_url.focus();
+ return false;
+ }
+ window.ipreview.location.replace(url);
+ return false;
+}
+</script>
+
+</head>
+
+<body class="dialog" onload="Init()">
+
+<div class="title">Insert Image</div>
+<!--- new stuff --->
+<form action="" method="get">
+<table border="0" width="100%" style="padding: 0px; margin: 0px">
+ <tbody>
+
+ <tr>
+ <td style="width: 7em; text-align: right">Image URL:</td>
+ <td><input type="text" name="url" id="f_url" style="width:75%"
+ title="Enter the image URL here" />
+ <button name="preview" onclick="return onPreview();"
+ title="Preview the image in a new window">Preview</button>
+ </td>
+ </tr>
+ <tr>
+ <td style="width: 7em; text-align: right">Alternate text:</td>
+ <td><input type="text" name="alt" id="f_alt" style="width:100%"
+ title="For browsers that don't support images" /></td>
+ </tr>
+
+ </tbody>
+</table>
+
+<p />
+
+<fieldset style="float: left; margin-left: 5px;">
+<legend>Layout</legend>
+
+<div class="space"></div>
+
+<div class="fl">Alignment:</div>
+<select size="1" name="align" id="f_align"
+ title="Positioning of this image">
+ <option value="" >Not set</option>
+ <option value="left" >Left</option>
+ <option value="right" >Right</option>
+ <option value="texttop" >Texttop</option>
+ <option value="absmiddle" >Absmiddle</option>
+ <option value="baseline" selected="1" >Baseline</option>
+ <option value="absbottom" >Absbottom</option>
+ <option value="bottom" >Bottom</option>
+ <option value="middle" >Middle</option>
+ <option value="top" >Top</option>
+</select>
+
+<p />
+
+<div class="fl">Border thickness:</div>
+<input type="text" name="border" id="f_border" size="5"
+title="Leave empty for no border" />
+
+<div class="space"></div>
+
+</fieldset>
+
+<fieldset style="float:right; margin-right: 5px;">
+<legend>Spacing</legend>
+
+<div class="space"></div>
+
+<div class="fr">Horizontal:</div>
+<input type="text" name="horiz" id="f_horiz" size="5"
+title="Horizontal padding" />
+
+<p />
+
+<div class="fr">Vertical:</div>
+<input type="text" name="vert" id="f_vert" size="5"
+title="Vertical padding" />
+
+<div class="space"></div>
+
+</fieldset>
+<br clear="all" />
+<table width="100%" style="margin-bottom: 0.2em">
+ <tr>
+ <td valign="bottom">
+ <div class="fr">Image Preview:</div>
+ <iframe name="ipreview" id="ipreview" frameborder="0" style="border : 1px solid gray;"
+ height="200" width="300" src="blank.html"></iframe>
+ </td>
+ <td valign="bottom" style="text-align: right">
+ <button type="button" name="ok" onclick="return onOK();">OK</button><br>
+ <button type="button" name="cancel" onclick="return onCancel();">Cancel</button>
+ </td>
+ </tr>
+</table>
+</form>
+</body>
+</html>
\ No newline at end of file
Added: incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/popups/insert_table.html
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/popups/insert_table.html?view=auto&rev=454197
==============================================================================
--- incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/popups/insert_table.html (added)
+++ incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/popups/insert_table.html Sun Oct 8 12:53:13 2006
@@ -0,0 +1,157 @@
+<html>
+
+<head>
+ <title>Insert Table</title>
+
+<script type="text/javascript" src="popup.js"></script>
+<link rel="stylesheet" type="text/css" href="popup.css" />
+
+<script type="text/javascript">
+
+window.resizeTo(410, 250);
+
+HTMLArea = window.opener.HTMLArea;
+function i18n(str) {
+ return (HTMLArea._lc(str, 'HTMLArea'));
+}
+
+function Init() {
+ HTMLArea = window.opener.HTMLArea; // load the HTMLArea plugin and lang file
+ __dlg_translate('HTMLArea');
+ __dlg_init(null, HTMLArea.is_ie ? null : {width:410,height:250});
+ // Make sure the translated string appears in the drop down. (for gecko)
+ document.getElementById("f_unit").selectedIndex = 1;
+ document.getElementById("f_unit").selectedIndex = 0;
+ document.getElementById("f_align").selectedIndex = 1;
+ document.getElementById("f_align").selectedIndex = 0;
+ document.getElementById("f_rows").focus();
+}
+
+function onOK() {
+ var required = {
+ "f_rows": i18n("You must enter a number of rows"),
+ "f_cols": i18n("You must enter a number of columns")
+ };
+ for (var i in required) {
+ var el = document.getElementById(i);
+ if (!el.value) {
+ alert(required[i]);
+ el.focus();
+ return false;
+ }
+ }
+ var fields = ["f_rows", "f_cols", "f_width", "f_unit", "f_fixed",
+ "f_align", "f_border", "f_spacing", "f_padding"];
+ var param = new Object();
+ for (var i in fields) {
+ var id = fields[i];
+ var el = document.getElementById(id);
+ param[id] = (el.type == "checkbox") ? el.checked : el.value;
+ }
+ __dlg_close(param);
+ return false;
+}
+
+function onCancel() {
+ __dlg_close(null);
+ return false;
+}
+
+</script>
+
+</head>
+
+<body class="dialog" onload="Init()">
+
+<div class="title">Insert Table</div>
+
+<form action="" method="get">
+<table border="0" style="padding: 0px; margin: 0px">
+ <tbody>
+
+ <tr>
+ <td style="width: 4em; text-align: right">Rows:</td>
+ <td><input type="text" name="rows" id="f_rows" size="5" title="Number of rows" value="2" /></td>
+ <td style="width: 4em; text-align: right">Width:</td>
+ <td><input type="text" name="width" id="f_width" size="5" title="Width of the table" value="100" /></td>
+ <td><select size="1" name="unit" id="f_unit" title="Width unit">
+ <option value="%" selected="1" >Percent</option>
+ <option value="px" >Pixels</option>
+ <option value="em" >Em</option>
+ </select></td>
+ </tr>
+ <tr>
+ <td style="width: 4em; text-align: right">Cols:</td>
+ <td><input type="text" name="cols" id="f_cols" size="5" title="Number of columns" value="4" /></td>
+ <td style="text-align: right"><input type="checkbox" checked="checked" name="fixed" id="f_fixed" /></td>
+ <td colspan="2"><label for="f_fixed"
+ >Fixed width columns</label></td>
+ </tr>
+ </tbody>
+</table>
+
+<p />
+
+<fieldset style="float: left; margin-left: 5px;">
+<legend>Layout</legend>
+
+<div class="space"></div>
+
+<div class="fl">Alignment:</div>
+<select size="1" name="align" id="f_align"
+ title="Positioning of this table">
+ <option value="" selected="1" >Not set</option>
+ <option value="left" >Left</option>
+ <option value="right" >Right</option>
+ <option value="texttop" >Texttop</option>
+ <option value="absmiddle" >Absmiddle</option>
+ <option value="baseline" >Baseline</option>
+ <option value="absbottom" >Absbottom</option>
+ <option value="bottom" >Bottom</option>
+ <option value="middle" >Middle</option>
+ <option value="top" >Top</option>
+</select>
+
+<p />
+
+<div class="fl">Border thickness:</div>
+<input type="text" name="border" id="f_border" size="5" value="1"
+title="Leave empty for no border" />
+<!--
+<p />
+
+<div class="fl">Collapse borders:</div>
+<input type="checkbox" name="collapse" id="f_collapse" />
+-->
+<div class="space"></div>
+
+</fieldset>
+
+<fieldset style="float:right; margin-right: 5px;">
+<legend>Spacing</legend>
+
+<div class="space"></div>
+
+<div class="fr">Cell spacing:</div>
+<input type="text" name="spacing" id="f_spacing" size="5" value="1"
+title="Space between adjacent cells" />
+
+<p />
+
+<div class="fr">Cell padding:</div>
+<input type="text" name="padding" id="f_padding" size="5" value="1"
+title="Space between content and border in cell" />
+
+<div class="space"></div>
+
+</fieldset>
+
+<div style="margin-top: 85px; border-top: 1px solid #999; padding: 2px; text-align: right;">
+<button type="button" name="ok" onclick="return onOK();">OK</button>
+<button type="button" name="cancel" onclick="return onCancel();">Cancel</button>
+</div>
+
+</form>
+
+</body>
+</html>
\ No newline at end of file
Added: incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/popups/link.html
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/popups/link.html?view=auto&rev=454197
==============================================================================
--- incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/popups/link.html (added)
+++ incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/popups/link.html Sun Oct 8 12:53:13 2006
@@ -0,0 +1,136 @@
+<html>
+
+<head>
+ <title>Insert/Modify Link</title>
+ <script type="text/javascript" src="popup.js"></script>
+ <link rel="stylesheet" type="text/css" href="popup.css" />
+
+ <script type="text/javascript">
+ window.resizeTo(400, 200);
+
+HTMLArea = window.opener.HTMLArea;
+
+function i18n(str) {
+ return (HTMLArea._lc(str, 'HTMLArea'));
+}
+
+function onTargetChanged() {
+ var f = document.getElementById("f_other_target");
+ if (this.value == "_other") {
+ f.style.visibility = "visible";
+ f.select();
+ f.focus();
+ } else f.style.visibility = "hidden";
+}
+
+function Init() {
+ __dlg_translate('HTMLArea');
+ __dlg_init();
+
+ // Make sure the translated string appears in the drop down. (for gecko)
+ document.getElementById("f_target").selectedIndex = 1;
+ document.getElementById("f_target").selectedIndex = 0;
+
+ var param = window.dialogArguments;
+ var target_select = document.getElementById("f_target");
+ var use_target = true;
+ if (param) {
+ if ( typeof param["f_usetarget"] != "undefined" ) {
+ use_target = param["f_usetarget"];
+ }
+ if ( typeof param["f_href"] != "undefined" ) {
+ document.getElementById("f_href").value = param["f_href"];
+ document.getElementById("f_title").value = param["f_title"];
+ comboSelectValue(target_select, param["f_target"]);
+ if (target_select.value != param.f_target) {
+ var opt = document.createElement("option");
+ opt.value = param.f_target;
+ opt.innerHTML = opt.value;
+ target_select.appendChild(opt);
+ opt.selected = true;
+ }
+ }
+ }
+ if (! use_target) {
+ document.getElementById("f_target_label").style.visibility = "hidden";
+ document.getElementById("f_target").style.visibility = "hidden";
+ document.getElementById("f_target_other").style.visibility = "hidden";
+ }
+ var opt = document.createElement("option");
+ opt.value = "_other";
+ opt.innerHTML = i18n("Other");
+ target_select.appendChild(opt);
+ target_select.onchange = onTargetChanged;
+ document.getElementById("f_href").focus();
+ document.getElementById("f_href").select();
+}
+
+function onOK() {
+ var required = {
+ // f_href shouldn't be required or otherwise removing the link by entering an empty
+ // url isn't possible anymore.
+ // "f_href": i18n("You must enter the URL where this link points to")
+ };
+ for (var i in required) {
+ var el = document.getElementById(i);
+ if (!el.value) {
+ alert(required[i]);
+ el.focus();
+ return false;
+ }
+ }
+ // pass data back to the calling window
+ var fields = ["f_href", "f_title", "f_target" ];
+ var param = new Object();
+ for (var i in fields) {
+ var id = fields[i];
+ var el = document.getElementById(id);
+ param[id] = el.value;
+ }
+ if (param.f_target == "_other")
+ param.f_target = document.getElementById("f_other_target").value;
+ __dlg_close(param);
+ return false;
+}
+
+function onCancel() {
+ __dlg_close(null);
+ return false;
+}
+
+</script>
+
+</head>
+
+<body class="dialog" onload="Init()">
+<div class="title">Insert/Modify Link</div>
+<form>
+<table border="0" style="width: 100%;">
+ <tr>
+ <td class="label">URL:</td>
+ <td><input type="text" id="f_href" style="width: 100%" /></td>
+ </tr>
+ <tr>
+ <td class="label">Title (tooltip):</td>
+ <td><input type="text" id="f_title" style="width: 100%" /></td>
+ </tr>
+ <tr>
+ <td class="label"><span id="f_target_label">Target:</span></td>
+ <td><select id="f_target">
+ <option value="">None (use implicit)</option>
+ <option value="_blank">New window (_blank)</option>
+ <option value="_self">Same frame (_self)</option>
+ <option value="_top">Top frame (_top)</option>
+ </select>
+ <input type="text" name="f_other_target" id="f_other_target" size="10" style="visibility: hidden" />
+ </td>
+ </tr>
+</table>
+
+<div id="buttons">
+ <button type="submit" name="ok" onclick="return onOK();">OK</button>
+ <button type="button" name="cancel" onclick="return onCancel();">Cancel</button>
+</div>
+</form>
+</body>
+</html>
\ No newline at end of file
Added: incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/popups/old_insert_image.html
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/popups/old_insert_image.html?view=auto&rev=454197
==============================================================================
--- incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/popups/old_insert_image.html (added)
+++ incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/popups/old_insert_image.html Sun Oct 8 12:53:13 2006
@@ -0,0 +1,206 @@
+<!-- based on insimage.dlg -->
+
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 HTML 3.2//EN">
+<HTML id=dlgImage STYLE="width: 432px; height: 194px; ">
+<HEAD>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+<meta http-equiv="MSThemeCompatible" content="Yes">
+<TITLE>Insert Image</TITLE>
+<style>
+ html, body, button, div, input, select, fieldset { font-family: MS Shell Dlg; font-size: 8pt; position: absolute; };
+</style>
+<SCRIPT defer>
+
+function _CloseOnEsc() {
+ if (event.keyCode == 27) { window.close(); return; }
+}
+
+function _getTextRange(elm) {
+ var r = elm.parentTextEdit.createTextRange();
+ r.moveToElementText(elm);
+ return r;
+}
+
+window.onerror = HandleError
+
+function HandleError(message, url, line) {
+ var str = "An error has occurred in this dialog." + "\n\n"
+ + "Error: " + line + "\n" + message;
+ alert(str);
+ window.close();
+ return true;
+}
+
+function Init() {
+ var elmSelectedImage;
+ var htmlSelectionControl = "Control";
+ var globalDoc = window.dialogArguments;
+ var grngMaster = globalDoc.selection.createRange();
+
+ // event handlers
+ document.body.onkeypress = _CloseOnEsc;
+ btnOK.onclick = new Function("btnOKClick()");
+
+ txtFileName.fImageLoaded = false;
+ txtFileName.intImageWidth = 0;
+ txtFileName.intImageHeight = 0;
+
+ if (globalDoc.selection.type == htmlSelectionControl) {
+ if (grngMaster.length == 1) {
+ elmSelectedImage = grngMaster.item(0);
+ if (elmSelectedImage.tagName == "IMG") {
+ txtFileName.fImageLoaded = true;
+ if (elmSelectedImage.src) {
+ txtFileName.value = elmSelectedImage.src.replace(/^[^*]*(\*\*\*)/, "$1"); // fix placeholder src values that editor converted to abs paths
+ txtFileName.intImageHeight = elmSelectedImage.height;
+ txtFileName.intImageWidth = elmSelectedImage.width;
+ txtVertical.value = elmSelectedImage.vspace;
+ txtHorizontal.value = elmSelectedImage.hspace;
+ txtBorder.value = elmSelectedImage.border;
+ txtAltText.value = elmSelectedImage.alt;
+ selAlignment.value = elmSelectedImage.align;
+ }
+ }
+ }
+ }
+ txtFileName.value = txtFileName.value || "http://";
+ txtFileName.focus();
+}
+
+function _isValidNumber(txtBox) {
+ var val = parseInt(txtBox);
+ if (isNaN(val) || val < 0 || val > 999) { return false; }
+ return true;
+}
+
+function btnOKClick() {
+ var elmImage;
+ var intAlignment;
+ var htmlSelectionControl = "Control";
+ var globalDoc = window.dialogArguments;
+ var grngMaster = globalDoc.selection.createRange();
+
+ // error checking
+
+ if (!txtFileName.value || txtFileName.value == "http://") {
+ alert("Image URL must be specified.");
+ txtFileName.focus();
+ return;
+ }
+ if (txtHorizontal.value && !_isValidNumber(txtHorizontal.value)) {
+ alert("Horizontal spacing must be a number between 0 and 999.");
+ txtHorizontal.focus();
+ return;
+ }
+ if (txtBorder.value && !_isValidNumber(txtBorder.value)) {
+ alert("Border thickness must be a number between 0 and 999.");
+ txtBorder.focus();
+ return;
+ }
+ if (txtVertical.value && !_isValidNumber(txtVertical.value)) {
+ alert("Vertical spacing must be a number between 0 and 999.");
+ txtVertical.focus();
+ return;
+ }
+
+ // delete selected content and replace with image
+ if (globalDoc.selection.type == htmlSelectionControl && !txtFileName.fImageLoaded) {
+ grngMaster.execCommand('Delete');
+ grngMaster = globalDoc.selection.createRange();
+ }
+
+ idstr = "\" id=\"556e697175657e537472696e67"; // new image creation ID
+ if (!txtFileName.fImageLoaded) {
+ grngMaster.execCommand("InsertImage", false, idstr);
+ elmImage = globalDoc.all['556e697175657e537472696e67'];
+ elmImage.removeAttribute("id");
+ elmImage.removeAttribute("src");
+ grngMaster.moveStart("character", -1);
+ } else {
+ elmImage = grngMaster.item(0);
+ if (elmImage.src != txtFileName.value) {
+ grngMaster.execCommand('Delete');
+ grngMaster = globalDoc.selection.createRange();
+ grngMaster.execCommand("InsertImage", false, idstr);
+ elmImage = globalDoc.all['556e697175657e537472696e67'];
+ elmImage.removeAttribute("id");
+ elmImage.removeAttribute("src");
+ grngMaster.moveStart("character", -1);
+ txtFileName.fImageLoaded = false;
+ }
+ grngMaster = _getTextRange(elmImage);
+ }
+
+ if (txtFileName.fImageLoaded) {
+ elmImage.style.width = txtFileName.intImageWidth;
+ elmImage.style.height = txtFileName.intImageHeight;
+ }
+
+ if (txtFileName.value.length > 2040) {
+ txtFileName.value = txtFileName.value.substring(0,2040);
+ }
+
+ elmImage.src = txtFileName.value;
+
+ if (txtHorizontal.value != "") { elmImage.hspace = parseInt(txtHorizontal.value); }
+ else { elmImage.hspace = 0; }
+
+ if (txtVertical.value != "") { elmImage.vspace = parseInt(txtVertical.value); }
+ else { elmImage.vspace = 0; }
+
+ elmImage.alt = txtAltText.value;
+
+ if (txtBorder.value != "") { elmImage.border = parseInt(txtBorder.value); }
+ else { elmImage.border = 0; }
+
+ elmImage.align = selAlignment.value;
+ grngMaster.collapse(false);
+ grngMaster.select();
+ window.close();
+}
+</SCRIPT>
+</HEAD>
+<BODY id=bdy onload="Init()" style="background: threedface; color: windowtext;" scroll=no>
+
+<DIV id=divFileName style="left: 0.98em; top: 1.2168em; width: 7em; height: 1.2168em; ">Image URL:</DIV>
+<INPUT ID=txtFileName type=text style="left: 8.54em; top: 1.0647em; width: 21.5em;height: 2.1294em; " tabIndex=10 onfocus="select()">
+
+<DIV id=divAltText style="left: 0.98em; top: 4.1067em; width: 6.58em; height: 1.2168em; ">Alternate Text:</DIV>
+<INPUT type=text ID=txtAltText tabIndex=15 style="left: 8.54em; top: 3.8025em; width: 21.5em; height: 2.1294em; " onfocus="select()">
+
+<FIELDSET id=fldLayout style="left: .9em; top: 7.1em; width: 17.08em; height: 7.6em;">
+<LEGEND id=lgdLayout>Layout</LEGEND>
+</FIELDSET>
+
+<FIELDSET id=fldSpacing style="left: 18.9em; top: 7.1em; width: 11em; height: 7.6em;">
+<LEGEND id=lgdSpacing>Spacing</LEGEND>
+</FIELDSET>
+
+<DIV id=divAlign style="left: 1.82em; top: 9.126em; width: 4.76em; height: 1.2168em; ">Alignment:</DIV>
+<SELECT size=1 ID=selAlignment tabIndex=20 style="left: 10.36em; top: 8.8218em; width: 6.72em; height: 1.2168em; ">
+<OPTION id=optNotSet value=""> Not set </OPTION>
+<OPTION id=optLeft value=left> Left </OPTION>
+<OPTION id=optRight value=right> Right </OPTION>
+<OPTION id=optTexttop value=textTop> Texttop </OPTION>
+<OPTION id=optAbsMiddle value=absMiddle> Absmiddle </OPTION>
+<OPTION id=optBaseline value=baseline SELECTED> Baseline </OPTION>
+<OPTION id=optAbsBottom value=absBottom> Absbottom </OPTION>
+<OPTION id=optBottom value=bottom> Bottom </OPTION>
+<OPTION id=optMiddle value=middle> Middle </OPTION>
+<OPTION id=optTop value=top> Top </OPTION>
+</SELECT>
+
+<DIV id=divHoriz style="left: 19.88em; top: 9.126em; width: 4.76em; height: 1.2168em; ">Horizontal:</DIV>
+<INPUT ID=txtHorizontal style="left: 24.92em; top: 8.8218em; width: 4.2em; height: 2.1294em; ime-mode: disabled;" type=text size=3 maxlength=3 value="" tabIndex=25 onfocus="select()">
+
+<DIV id=divBorder style="left: 1.82em; top: 12.0159em; width: 8.12em; height: 1.2168em; ">Border Thickness:</DIV>
+<INPUT ID=txtBorder style="left: 10.36em; top: 11.5596em; width: 6.72em; height: 2.1294em; ime-mode: disabled;" type=text size=3 maxlength=3 value="" tabIndex=21 onfocus="select()">
+
+<DIV id=divVert style="left: 19.88em; top: 12.0159em; width: 3.64em; height: 1.2168em; ">Vertical:</DIV>
+<INPUT ID=txtVertical style="left: 24.92em; top: 11.5596em; width: 4.2em; height: 2.1294em; ime-mode: disabled;" type=text size=3 maxlength=3 value="" tabIndex=30 onfocus="select()">
+
+<BUTTON ID=btnOK style="left: 31.36em; top: 1.0647em; width: 7em; height: 2.2em; " type=submit tabIndex=40>OK</BUTTON>
+<BUTTON ID=btnCancel style="left: 31.36em; top: 3.6504em; width: 7em; height: 2.2em; " type=reset tabIndex=45 onClick="window.close();">Cancel</BUTTON>
+
+</BODY>
+</HTML>
\ No newline at end of file
Added: incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/popups/popup.css
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/popups/popup.css?view=auto&rev=454197
==============================================================================
--- incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/popups/popup.css (added)
+++ incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/popups/popup.css Sun Oct 8 12:53:13 2006
@@ -0,0 +1,32 @@
+html, body {
+ background: ButtonFace;
+ color: ButtonText;
+ font: 11px Tahoma,Verdana,sans-serif;
+ margin: 0px;
+ padding: 0px;
+}
+body { padding: 5px; }
+form { padding: 0px; margin: 0px; }
+form p {
+ margin-top: 5px;
+ margin-bottom: 5px;
+}
+table {
+ font: 11px Tahoma,Verdana,sans-serif;
+}
+select, input, button { font: 11px Tahoma,Verdana,sans-serif; }
+button { width: 70px; }
+table .label { text-align: right; width: 8em; }
+
+.fl { width: 9em; float: left; padding: 2px 5px; text-align: right; }
+.fr { width: 7em; float: left; padding: 2px 5px; text-align: right; }
+fieldset { padding: 0px 10px 5px 5px; }
+.space { padding: 2px; }
+.title { background: #ddf; color: #000; font-weight: bold; font-size: 120%; padding: 3px 10px; margin-bottom: 10px;
+border-bottom: 1px solid black; letter-spacing: 2px;
+}
+
+#buttons {
+ margin-top: 1em; border-top: 1px solid #999;
+ padding: 2px; text-align: right;
+}
\ No newline at end of file
Added: incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/popups/popup.js
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/popups/popup.js?view=auto&rev=454197
==============================================================================
--- incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/popups/popup.js (added)
+++ incubator/roller/trunk/web/roller-ui/authoring/editors/xinha/popups/popup.js Sun Oct 8 12:53:13 2006
@@ -0,0 +1,140 @@
+// htmlArea v3.0 - Copyright (c) 2002, 2003 interactivetools.com, inc.
+// This copyright notice MUST stay intact for use (see license.txt).
+//
+// Portions (c) dynarch.com, 2003
+//
+// A free WYSIWYG editor replacement for <textarea> fields.
+// For full source code and docs, visit http://www.interactivetools.com/
+//
+// Version 3.0 developed by Mihai Bazon.
+// http://dynarch.com/mishoo
+//
+// $Id: popup.js 594 2006-10-03 16:13:53Z ray $
+HTMLArea = window.opener.HTMLArea;
+
+function getAbsolutePos(el) {
+ var r = { x: el.offsetLeft, y: el.offsetTop };
+ if (el.offsetParent) {
+ var tmp = getAbsolutePos(el.offsetParent);
+ r.x += tmp.x;
+ r.y += tmp.y;
+ }
+ return r;
+}
+
+function comboSelectValue(c, val) {
+ var ops = c.getElementsByTagName("option");
+ for (var i = ops.length; --i >= 0;) {
+ var op = ops[i];
+ op.selected = (op.value == val);
+ }
+ c.value = val;
+}
+
+function __dlg_onclose() {
+ opener.Dialog._return(null);
+}
+
+function __dlg_init(bottom, win_dim) {
+ if(window.__dlg_init_done) return true;
+
+ if(window.opener._editor_skin != "") {
+ var head = document.getElementsByTagName("head")[0];
+ var link = document.createElement("link");
+ link.type = "text/css";
+ link.href = window.opener._editor_url + 'skins/' + window.opener._editor_skin + '/skin.css';
+ link.rel = "stylesheet";
+ head.appendChild(link);
+ }
+ window.dialogArguments = opener.Dialog._arguments;
+
+ var body = document.body;
+
+ if(win_dim)
+ {
+ window.resizeTo(win_dim.width, win_dim.height);
+ if(win_dim.top && win_dim.left)
+ {
+ window.moveTo(win_dim.left,win_dim.top);
+ }
+ else
+ {
+ if (!HTMLArea.is_ie)
+ {
+ var x = opener.screenX + (opener.outerWidth - win_dim.width) / 2;
+ var y = opener.screenY + (opener.outerHeight - win_dim.height) / 2;
+ }
+ else
+ {//IE does not have window.outer... , so center it on the screen at least
+ var x = (self.screen.availWidth - win_dim.width) / 2;
+ var y = (self.screen.availHeight - win_dim.height) / 2;
+ }
+ window.moveTo(x,y);
+ }
+ }
+ else if (window.sizeToContent) {
+ window.sizeToContent();
+ window.sizeToContent(); // for reasons beyond understanding,
+ // only if we call it twice we get the
+ // correct size.
+ window.addEventListener("unload", __dlg_onclose, true);
+ window.innerWidth = body.offsetWidth + 5;
+ window.innerHeight = body.scrollHeight + 2;
+ // center on parent
+ var x = opener.screenX + (opener.outerWidth - window.outerWidth) / 2;
+ var y = opener.screenY + (opener.outerHeight - window.outerHeight) / 2;
+ window.moveTo(x, y);
+ } else {
+ var docElm = document.documentElement ? document.documentElement : null;
+ var body_height = docElm && docElm.scrollTop ? docElm.scrollHeight : body.scrollHeight;
+
+ window.resizeTo(body.scrollWidth, body_height);
+ var ch = docElm && docElm.clientHeight ? docElm.clientHeight : body.clientHeight;
+ var cw = docElm && docElm.clientWidth ? docElm.clientWidth : body.clientWidth;
+
+ window.resizeBy(body.offsetWidth - cw, body_height - ch);
+ var W = body.offsetWidth;
+ var H = 2 * body_height - ch;
+ var x = (screen.availWidth - W) / 2;
+ var y = (screen.availHeight - H) / 2;
+ window.moveTo(x, y);
+ }
+ HTMLArea.addDom0Event(document.body, 'keypress', __dlg_close_on_esc);
+ window.__dlg_init_done = true;
+}
+
+function __dlg_translate(context) {
+ var types = ["input", "select", "legend", "span", "option", "td", "button", "div", "label", "a", "img"];
+ for (var type = 0; type < types.length; ++type) {
+ var spans = document.getElementsByTagName(types[type]);
+ for (var i = spans.length; --i >= 0;) {
+ var span = spans[i];
+ if (span.firstChild && span.firstChild.data) {
+ var txt = HTMLArea._lc(span.firstChild.data, context);
+ if (txt)
+ span.firstChild.data = txt;
+ }
+ if (span.title) {
+ var txt = HTMLArea._lc(span.title, context);
+ if (txt)
+ span.title = txt;
+ }
+ }
+ }
+ document.title = HTMLArea._lc(document.title, context);
+}
+
+// closes the dialog and passes the return info upper.
+function __dlg_close(val) {
+ opener.Dialog._return(val);
+ window.close();
+}
+
+function __dlg_close_on_esc(ev) {
+ ev || (ev = window.event);
+ if (ev.keyCode == 27) {
+ __dlg_close(null);
+ return false;
+ }
+ return true;
+}