From duncan at codespeak.net Tue Aug 1 11:49:37 2006
From: duncan at codespeak.net (duncan at codespeak.net)
Date: Tue, 1 Aug 2006 11:49:37 +0200 (CEST)
Subject: [kupu-checkins] r30832 - in kupu/trunk/kupu: common
common/kupudrawers plone plone/kupu_plone_layer
Message-ID: <20060801094937.07C2B10077@code0.codespeak.net>
Author: duncan
Date: Tue Aug 1 11:49:35 2006
New Revision: 30832
Modified:
kupu/trunk/kupu/common/kupubasetools.js
kupu/trunk/kupu/common/kupudrawers.js
kupu/trunk/kupu/common/kupudrawers/drawer.xsl
kupu/trunk/kupu/common/kupudrawerstyles.css
kupu/trunk/kupu/plone/TODO.txt
kupu/trunk/kupu/plone/kupu_plone_layer/kupuploneeditor.js
kupu/trunk/kupu/plone/plonedrawers.py
Log:
Anchors need to count only selected paragraphs.
Library drawer now has an iframe behind it: in IE this hides select boxes instead of letting them bleed through.
drawer.xsl no longer puts the search box in an form as this could crash IE: should really either move drawers into an iframe or remove other forms as well.
Another fix to making URLs relative.
Protect against bad URL in 'current selection'
Modified: kupu/trunk/kupu/common/kupubasetools.js
==============================================================================
--- kupu/trunk/kupu/common/kupubasetools.js (original)
+++ kupu/trunk/kupu/common/kupubasetools.js Tue Aug 1 11:49:35 2006
@@ -2671,15 +2671,13 @@
var doc = this.editor.getInnerDocument();
var body = doc.body;
var paras = [];
- var lvl1 = 0, lvl2 = 0;
for (var node = body.firstChild; node; node = node.nextSibling) {
var name = node.nodeName.toLowerCase();
var style = name + "|" + node.className;
if (style==style1) {
- paras.push([node,0,++lvl1]);
- lvl2 = 0;
+ paras.push([node,0]);
} else if (style==style2) {
- paras.push([node,1,lvl1 + '.' + ++lvl2]);
+ paras.push([node,1]);
}
}
return paras;
Modified: kupu/trunk/kupu/common/kupudrawers.js
==============================================================================
--- kupu/trunk/kupu/common/kupudrawers.js (original)
+++ kupu/trunk/kupu/common/kupudrawers.js Tue Aug 1 11:49:35 2006
@@ -468,11 +468,19 @@
this.baseelement = getBaseTagClass(document.body, 'div', 'kupu-librarydrawer-parent');
}
this.anchorframe = getBaseTagClass(this.baseelement, 'iframe', 'kupu-anchorframe');
-
+ this.maskframe = getBaseTagClass(this.baseelement, 'iframe', 'kupu-maskframe');
+ var e;
+ if (!this.maskframe) {
+ e = this.maskframe = newElement('iframe',
+ {'className':'kupu-maskframe','src':"javascript:false;", 'frameBorder':"0", 'scrolling':"no" });
+ var style = e.style;
+ style.display = 'none';
+ this.baseelement.insertBefore(e, this.baseelement.firstChild);
+ }
this.tool = tool;
this.element = document.getElementById(this.drawerid);
if (!this.element) {
- var e = document.createElement('div');
+ e = document.createElement('div');
e.id = this.drawerid;
e.className = 'kupu-drawer '+this.drawerid;
this.baseelement.appendChild(e);
@@ -511,8 +519,8 @@
this.hide = function() {
var el = this.element;
- el.style.left = '';
- el.style.top = '';
+ el.style.left = el.style.top = '';
+ this.maskframe.style.display='none';
LibraryDrawer.prototype.hide.call(this);
};
@@ -542,6 +550,7 @@
xsltproc.setParameter("", "usecaptions", 'yes');
}
} catch(e) {
+ if (e && e.name && e.message) e = e.name+': '+e.message;
alert("xlstproc error:" + e);
return; // No XSLT Processor, maybe IE 5.5?
}
@@ -590,6 +599,13 @@
// display the drawer div
this.element.style.display = 'block';
+ // display the mask to hide SELECT boxes in IE
+ var st = this.maskframe.style;
+ var st1 = this.element.style;
+ st.top=st1.top;st.left=st1.left;
+ st.width = this.element.offsetWidth+'px';
+ st.height = this.element.offsetHeight+'px';
+ st.display = '';
};
this._singleLibsXslCallback = function(dom) {
@@ -766,7 +782,7 @@
var newbc = dom.selectSingleNode("//breadcrumbs");
// IE does not support importNode on XML document nodes. As an
- // evil hack, clonde the node instead.
+ // evil hack, clone the node instead.
if (this.editor.getBrowserName() == 'IE') {
newitemsnode = newitemsnode.cloneNode(true);
@@ -1482,6 +1498,7 @@
if (!isSingle) {
var toc = ed.newElement('ul');
};
+ var lvl1=0, lvl2=0;
for (var i = 0; i < selected.length; i++) {
if (selected[i].checked) {
var nodeinfo = this.nodelist[i];
@@ -1495,9 +1512,16 @@
} else {
/* Insert TOC entry here */
var caption = Sarissa.getText(node).truncate(140);
+ var number;
+ if (level==0) {
+ number = ++lvl1;
+ lvl2 = 0;
+ } else {
+ number = lvl1 + '.' + ++lvl2;
+ };
var li = ed.newElement('li', {'className': 'level'+level},
[ed.newElement('a', {'href': '#'+a},
- [ed.newText(nodeinfo[2] + ' ' + caption)])]);
+ [ed.newText(number + ' ' + caption)])]);
if (level==0) {
toc.appendChild(li);
Modified: kupu/trunk/kupu/common/kupudrawers/drawer.xsl
==============================================================================
--- kupu/trunk/kupu/common/kupudrawers/drawer.xsl (original)
+++ kupu/trunk/kupu/common/kupudrawers/drawer.xsl Tue Aug 1 11:49:35 2006
@@ -80,14 +80,14 @@
-
+
Modified: kupu/trunk/kupu/common/kupudrawerstyles.css
==============================================================================
--- kupu/trunk/kupu/common/kupudrawerstyles.css (original)
+++ kupu/trunk/kupu/common/kupudrawerstyles.css Tue Aug 1 11:49:35 2006
@@ -21,10 +21,15 @@
padding: 0 8px 8px 8px;
height: auto;
width: 640px;
- z-index: 2;
+ z-index: 3;
color: black;
}
+.kupu-maskframe {
+ position:absolute;
+ z-index: 3;
+}
+
.kupu-tabledrawer {
width: 408px;
left: 320px;
Modified: kupu/trunk/kupu/plone/TODO.txt
==============================================================================
--- kupu/trunk/kupu/plone/TODO.txt (original)
+++ kupu/trunk/kupu/plone/TODO.txt Tue Aug 1 11:49:35 2006
@@ -223,3 +223,6 @@
Make ReferenceTextField aggressive in the same way. Add configuration
options to select whether TextField and ReferenceWidget are hijacked.
+The drawers really ought to be in a separate DIV: the XSL tries to
+create forms, but since the drawer is already inside a form this is
+illegal and sometimes crashes IE as a result.
Modified: kupu/trunk/kupu/plone/kupu_plone_layer/kupuploneeditor.js
==============================================================================
--- kupu/trunk/kupu/plone/kupu_plone_layer/kupuploneeditor.js (original)
+++ kupu/trunk/kupu/plone/kupu_plone_layer/kupuploneeditor.js Tue Aug 1 11:49:35 2006
@@ -27,6 +27,7 @@
// text until all our links are relative.
var href = base.replace(/\/[^\/]*$/, '/');
+ var pageid = /.*\/([^\/]*)$/.exec(base)[1];
var hrefparts = href.split('/');
contents = contents.replace(/(<[^>]* (?:src|href)=")([^"]*)"/g,
function(str, tag, url, offset, contents) {
@@ -45,7 +46,7 @@
urlparts[common]==hrefparts[common])
common++;
var last = urlparts[common];
- if (common+1 == urlparts.length && (last=='emptypage'||last=='portal_factory')) {
+ if (common+1 == urlparts.length && (last=='emptypage'||last==pageid)) {
urlparts[common] = '';
}
// The base and the url have 'common' parts in common.
Modified: kupu/trunk/kupu/plone/plonedrawers.py
==============================================================================
--- kupu/trunk/kupu/plone/plonedrawers.py (original)
+++ kupu/trunk/kupu/plone/plonedrawers.py Tue Aug 1 11:49:35 2006
@@ -578,6 +578,8 @@
objects = [ o for o in objects if o is not None ]
return objects
+ if obj is None:
+ return None
return [obj]
security.declarePublic("getCurrentParent")
From duncan at codespeak.net Tue Aug 1 16:06:25 2006
From: duncan at codespeak.net (duncan at codespeak.net)
Date: Tue, 1 Aug 2006 16:06:25 +0200 (CEST)
Subject: [kupu-checkins] r30847 - kupu/branch/plone-2.1/common
Message-ID: <20060801140625.C0C4710084@code0.codespeak.net>
Author: duncan
Date: Tue Aug 1 16:06:24 2006
New Revision: 30847
Modified:
kupu/branch/plone-2.1/common/kupubasetools.js
Log:
Fix bug which lower-cased class names.
Modified: kupu/branch/plone-2.1/common/kupubasetools.js
==============================================================================
--- kupu/branch/plone-2.1/common/kupubasetools.js (original)
+++ kupu/branch/plone-2.1/common/kupubasetools.js Tue Aug 1 16:06:24 2006
@@ -338,8 +338,8 @@
parastyles['p'] = 0;
while (options.length > 1) {
opt = options[1];
- var v = opt.value.toLowerCase();
- if (/^thead|tbody|table|t[rdh]\b/.test(v)) {
+ var v = opt.value;
+ if (/^thead|tbody|table|t[rdh]\b/i.test(v)) {
var otable = tableoptions;
var styles = tablestyles;
} else {
From duncan at codespeak.net Thu Aug 3 12:30:40 2006
From: duncan at codespeak.net (duncan at codespeak.net)
Date: Thu, 3 Aug 2006 12:30:40 +0200 (CEST)
Subject: [kupu-checkins] r30928 - kupu/trunk/kupu/plone
Message-ID: <20060803103040.8B6631007C@code0.codespeak.net>
Author: duncan
Date: Thu Aug 3 12:30:38 2006
New Revision: 30928
Modified:
kupu/trunk/kupu/plone/html2captioned.py
Log:
The portal transform can get cached, but that goes wrong if you have both http and https access to a site, so it makes sense to use absolute_url_path rather than absolute_url to stop the protocol and host name being included in the generated page.
Modified: kupu/trunk/kupu/plone/html2captioned.py
==============================================================================
--- kupu/trunk/kupu/plone/html2captioned.py (original)
+++ kupu/trunk/kupu/plone/html2captioned.py Thu Aug 3 12:30:38 2006
@@ -132,7 +132,7 @@
try:
url = target.getRemoteUrl()
except AttributeError:
- url = target.absolute_url()
+ url = target.absolute_url_path()
return tag + url
return match.group(0)
From duncan at codespeak.net Fri Aug 4 10:06:09 2006
From: duncan at codespeak.net (duncan at codespeak.net)
Date: Fri, 4 Aug 2006 10:06:09 +0200 (CEST)
Subject: [kupu-checkins] r30979 - in kupu/trunk/kupu: common
common/kupudrawers plone/kupu_plone_layer
Message-ID: <20060804080609.3BAD61006C@code0.codespeak.net>
Author: duncan
Date: Fri Aug 4 10:06:04 2006
New Revision: 30979
Modified:
kupu/trunk/kupu/common/kupubasetools.js
kupu/trunk/kupu/common/kupudrawers.js
kupu/trunk/kupu/common/kupudrawers/drawer.xsl
kupu/trunk/kupu/plone/kupu_plone_layer/kupuploneinit.js
Log:
Default link target should be unset, not _self. That way we can distinguish between the user explicitly setting a target of _self and not setting anything which implies they want the default (and the default might then be _self for internal and _blank for external links set by js when the page is viewed).
Modified: kupu/trunk/kupu/common/kupubasetools.js
==============================================================================
--- kupu/trunk/kupu/common/kupubasetools.js (original)
+++ kupu/trunk/kupu/common/kupubasetools.js Fri Aug 4 10:06:04 2006
@@ -937,7 +937,7 @@
} else {
linkel.removeAttribute('title');
}
- if (target && target != '') {
+ if (target) {
linkel.setAttribute('target', target);
}
else {
Modified: kupu/trunk/kupu/common/kupudrawers.js
==============================================================================
--- kupu/trunk/kupu/common/kupudrawers.js (original)
+++ kupu/trunk/kupu/common/kupudrawers.js Fri Aug 4 10:06:04 2006
@@ -243,6 +243,7 @@
var preview = getBaseTagClass(this.element, 'iframe', 'kupu-linkdrawer-preview');
this.anchorframe = preview;
this.anchorui = getBaseTagClass(this.element, 'tr', 'kupu-linkdrawer-anchors');
+ this.target = '';
this.selChange = function() {
var anchor = this.getFragment();
@@ -276,9 +277,7 @@
/* add or modify a link */
this.editor.resumeEditing();
var url = input.value;
- var target = '_self';
- if (this.target) target = this.target;
- this.tool.createLink(url, null, null, target);
+ this.tool.createLink(url, null, null, this.target);
input.value = '';
// XXX when reediting a link, the drawer does not close for
@@ -546,6 +545,9 @@
xsltproc.setParameter("", "drawertitle", this.drawertitle);
xsltproc.setParameter("", "showupload", this.showupload);
xsltproc.setParameter("", "showanchors", this.showanchors);
+ if (this.target !== undefined) {
+ xsltproc.setParameter("", "link_target", this.target);
+ }
if (this.editor.config && !!this.editor.config.captions) {
xsltproc.setParameter("", "usecaptions", 'yes');
}
@@ -1387,13 +1389,11 @@
// XXX requiring the user to know what link type to enter is a
// little too much I think. (philiKON)
- var type = null;
var name = getFromSelector('link_name').value;
- var target = null;
- if (getFromSelector('link_target') && getFromSelector('link_target').value != '')
- target = getFromSelector('link_target').value;
+ var node = getFromSelector('link_target');
+ var target = node && node.value;
- this.tool.createLink(uri, type, name, target, title);
+ this.tool.createLink(uri, null, name, target, title);
this.drawertool.closeDrawer();
};
};
Modified: kupu/trunk/kupu/common/kupudrawers/drawer.xsl
==============================================================================
--- kupu/trunk/kupu/common/kupudrawers/drawer.xsl (original)
+++ kupu/trunk/kupu/common/kupudrawers/drawer.xsl Fri Aug 4 10:06:04 2006
@@ -51,7 +51,7 @@
yesinlinetrue
- _self
+
Modified: kupu/trunk/kupu/plone/kupu_plone_layer/kupuploneinit.js
==============================================================================
--- kupu/trunk/kupu/plone/kupu_plone_layer/kupuploneinit.js (original)
+++ kupu/trunk/kupu/plone/kupu_plone_layer/kupuploneinit.js Fri Aug 4 10:06:04 2006
@@ -271,7 +271,7 @@
return kupu;
};
-// modify LinkDrawer so all links have a target
-// defaults to _self, override here if reqd.
-//LinkDrawer.prototype.target = '_blank';
+// modify LinkDrawer so links don't have a target
+LinkDrawer.prototype.target = '';
+LinkLibraryDrawer.prototype.target = '';
From duncan at codespeak.net Fri Aug 4 13:12:13 2006
From: duncan at codespeak.net (duncan at codespeak.net)
Date: Fri, 4 Aug 2006 13:12:13 +0200 (CEST)
Subject: [kupu-checkins] r30984 - in kupu/branch/plone-2.1: common plone
Message-ID: <20060804111213.AB6E910072@code0.codespeak.net>
Author: duncan
Date: Fri Aug 4 13:12:10 2006
New Revision: 30984
Modified:
kupu/branch/plone-2.1/common/kupuhelpers.js
kupu/branch/plone-2.1/common/sarissa_ieemu_xpath.js
kupu/branch/plone-2.1/plone/plonelibrarytool.py
Log:
Issue 5687: Applied something close to the patch.
Issue 5689: Applied part of the suggested patch.
Issue 5690: Applied something like the patch.
Issue 5549: Fixed.
Modified: kupu/branch/plone-2.1/common/kupuhelpers.js
==============================================================================
--- kupu/branch/plone-2.1/common/kupuhelpers.js (original)
+++ kupu/branch/plone-2.1/common/kupuhelpers.js Fri Aug 4 13:12:10 2006
@@ -81,9 +81,9 @@
};
wrappedmethod.args = args;
try {
- if (_SARISSA_IS_MOZ) {
+ if (element.addEventListener) {
element.addEventListener(event, wrappedmethod.execute, false);
- } else if (_SARISSA_IS_IE) {
+ } else if (element.attachEvent) {
element.attachEvent("on" + event, wrappedmethod.execute);
} else {
throw _("Unsupported browser!");
@@ -100,9 +100,9 @@
function removeEventHandler(element, event, method) {
/* method to remove an event handler for both IE and Mozilla */
- if (_SARISSA_IS_MOZ) {
- window.removeEventListener(event, method, false);
- } else if (_SARISSA_IS_IE) {
+ if (element.removeEventListener) {
+ element.removeEventListener(event, method, false);
+ } else if (element.detachEvent) {
element.detachEvent("on" + event, method);
} else {
throw _("Unsupported browser!");
@@ -212,6 +212,9 @@
};
};
var name = child.nodeName.toLowerCase();
+ if (child.attributes[0] && /^_/.test(child.attributes[0])) {
+ name += child.attributes[0].toLowerCase(); // Fix for Opera
+ }
if (dict[name] != undefined) {
if (!dict[name].push) {
dict[name] = new Array(dict[name], value);
Modified: kupu/branch/plone-2.1/common/sarissa_ieemu_xpath.js
==============================================================================
--- kupu/branch/plone-2.1/common/sarissa_ieemu_xpath.js (original)
+++ kupu/branch/plone-2.1/common/sarissa_ieemu_xpath.js Fri Aug 4 13:12:10 2006
@@ -24,6 +24,7 @@
*
*/
if(_SARISSA_HAS_DOM_FEATURE && document.implementation.hasFeature("XPath", "3.0")){
+ var xmldoc = window.XMLDocument || window.Document;
/**
*
SarissaNodeList behaves as a NodeList but is only used as a result to selectNodes,
* so it also has some properties IEs proprietery object features.
@@ -57,7 +58,7 @@
*/
SarissaNodeList.prototype.expr = "";
/** dummy, used to accept IE's stuff without throwing errors */
- XMLDocument.prototype.setProperty = function(x,y){};
+ xmldoc.prototype.setProperty = function(x,y){};
/**
*
Programmatically control namespace URI/prefix mappings for XPath
* queries.
@@ -104,9 +105,9 @@
* @private Flag to control whether a custom namespace resolver should
* be used, set to true by Sarissa.setXpathNamespaces
*/
- XMLDocument.prototype._sarissa_useCustomResolver = false;
+ xmldoc.prototype._sarissa_useCustomResolver = false;
/** @private */
- XMLDocument.prototype._sarissa_xpathNamespaces = new Array();
+ xmldoc.prototype._sarissa_xpathNamespaces = new Array();
/**
*
Extends the XMLDocument to emulate IE's selectNodes.
* @argument sExpr the XPath expression to use
@@ -115,7 +116,7 @@
* @returns the result of the XPath search as a SarissaNodeList
* @throws An error if no namespace URI is found for the given prefix.
*/
- XMLDocument.prototype.selectNodes = function(sExpr, contextNode){
+ xmldoc.prototype.selectNodes = function(sExpr, contextNode){
var nsDoc = this;
var nsresolver = this._sarissa_useCustomResolver
? function(prefix){
@@ -156,7 +157,7 @@
* method when called on Elements
* @returns the result of the XPath search as an (Sarissa)NodeList
*/
- XMLDocument.prototype.selectSingleNode = function(sExpr, contextNode){
+ xmldoc.prototype.selectSingleNode = function(sExpr, contextNode){
var ctx = contextNode?contextNode:null;
sExpr = "("+sExpr+")[1]";
var nodeList = this.selectNodes(sExpr, ctx);
@@ -180,4 +181,5 @@
throw "Method selectNodes is only supported by XML Elements";
};
Sarissa.IS_ENABLED_SELECT_NODES = true;
+ xmldoc = undefined;
};
Modified: kupu/branch/plone-2.1/plone/plonelibrarytool.py
==============================================================================
--- kupu/branch/plone-2.1/plone/plonelibrarytool.py (original)
+++ kupu/branch/plone-2.1/plone/plonelibrarytool.py Fri Aug 4 13:12:10 2006
@@ -180,7 +180,7 @@
# Then check whether the current content allows html
if context is not None and fieldName:
- field = context.getField(fieldName)
+ field = context.getWrappedField(fieldName)
if field:
allowedTypes = getattr(field, 'allowable_content_types', None)
if allowedTypes is not None and not 'text/html' in [t.lower() for t in allowedTypes]:
From duncan at codespeak.net Fri Aug 4 13:38:49 2006
From: duncan at codespeak.net (duncan at codespeak.net)
Date: Fri, 4 Aug 2006 13:38:49 +0200 (CEST)
Subject: [kupu-checkins] r30986 - in kupu/branch/plone-2.1: common doc plone
plone/kupu_plone_layer
Message-ID: <20060804113849.7C4961006E@code0.codespeak.net>
Author: duncan
Date: Fri Aug 4 13:38:46 2006
New Revision: 30986
Modified:
kupu/branch/plone-2.1/common/kupusourceedit.js
kupu/branch/plone-2.1/doc/CHANGES.txt
kupu/branch/plone-2.1/plone/kupu_config.pt
kupu/branch/plone-2.1/plone/kupu_plone_layer/kupu_wysiwyg_support.html
kupu/branch/plone-2.1/plone/plonelibrarytool.py
kupu/branch/plone-2.1/plone/xmlconfig.kupu
Log:
html source edit mode now applies filtering.
Modified: kupu/branch/plone-2.1/common/kupusourceedit.js
==============================================================================
--- kupu/branch/plone-2.1/common/kupusourceedit.js (original)
+++ kupu/branch/plone-2.1/common/kupusourceedit.js Fri Aug 4 13:38:46 2006
@@ -64,10 +64,13 @@
var data='';
if(kupu.config.filtersourceedit) {
window.status = _('Cleaning up HTML...');
- var transform = kupu._filterContent(
- kupu.getInnerDocument().documentElement);
+ var transform = kupu._filterContent(kupu.getInnerDocument().documentElement);
data = kupu.getXMLBody(transform);
data = kupu._fixupSingletons(data).replace(/<\/?body[^>]*>/g, "");
+ if (kupu._getBase && kupu.makeLinksRelative) {
+ var base = kupu._getBase(transform);
+ data = kupu.makeLinksRelative(data, base).replace(/<\/?body[^>]*>/g, "");
+ };
window.status = '';
} else {
data = kupu.getHTMLBody();
Modified: kupu/branch/plone-2.1/doc/CHANGES.txt
==============================================================================
--- kupu/branch/plone-2.1/doc/CHANGES.txt (original)
+++ kupu/branch/plone-2.1/doc/CHANGES.txt Fri Aug 4 13:38:46 2006
@@ -2,6 +2,14 @@
Kupu changes
============
+- 1.3.8
+
+ - HTML view now does filtering by default in Plone (can be turned
+ off in the configlet). This also means that after pasting from e.g.
+ Word the HTML can be cleaned up simply by toggling source view
+ on/off.
+
+
- 1.3.7
- Plone
Modified: kupu/branch/plone-2.1/plone/kupu_config.pt
==============================================================================
--- kupu/branch/plone-2.1/plone/kupu_config.pt (original)
+++ kupu/branch/plone-2.1/plone/kupu_config.pt Fri Aug 4 13:38:46 2006
@@ -93,6 +93,24 @@
+