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 @@ yes inline true - _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 @@
+HTML View +
+ + + + +
When checked, Kupu's HTML view will display the +filtered HTML which will be sent to the server. Uncheck this box to see the raw HTML generated by the browser. +
+
+ +
+
Styles
Modified: kupu/branch/plone-2.1/plone/kupu_plone_layer/kupu_wysiwyg_support.html ============================================================================== --- kupu/branch/plone-2.1/plone/kupu_plone_layer/kupu_wysiwyg_support.html (original) +++ kupu/branch/plone-2.1/plone/kupu_plone_layer/kupu_wysiwyg_support.html Fri Aug 4 13:38:46 2006 @@ -20,12 +20,12 @@ - + - +
@@ -42,6 +42,7 @@ 1 application/xhtml+xml 1 + 1 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:38:46 2006 @@ -156,6 +156,10 @@ def installBeforeUnload(self): return getattr(self, 'install_beforeunload', True) + security.declareProtected('View', "getFiltersourceedit") + def getFiltersourceedit(self): + return getattr(self, 'filtersourceedit', True) + security.declareProtected('View', 'isKupuEnabled') def isKupuEnabled(self, useragent='', allowAnonymous=False, REQUEST=None, context=None, fieldName=None): def numerics(s): @@ -348,12 +352,16 @@ def configure_kupu(self, linkbyuid, table_classnames, html_exclusions, style_whitelist, class_blacklist, installBeforeUnload=None, parastyles=None, + filterSourceEdit=None, REQUEST=None): """Delete resource types through the ZMI""" self.linkbyuid = int(linkbyuid) self.table_classnames = table_classnames if installBeforeUnload is not None: self.install_beforeunload = bool(installBeforeUnload) + if filterSourceEdit is not None: + self.filtersourceedit = bool(filterSourceEdit) + if parastyles: self.paragraph_styles = [ line.strip() for line in parastyles if line.strip() ] Modified: kupu/branch/plone-2.1/plone/xmlconfig.kupu ============================================================================== --- kupu/branch/plone-2.1/plone/xmlconfig.kupu (original) +++ kupu/branch/plone-2.1/plone/xmlconfig.kupu Fri Aug 4 13:38:46 2006 @@ -18,6 +18,7 @@ 1 application/xhtml+xml 1 + 1 From duncan at codespeak.net Fri Aug 4 13:59:21 2006 From: duncan at codespeak.net (duncan at codespeak.net) Date: Fri, 4 Aug 2006 13:59:21 +0200 (CEST) Subject: [kupu-checkins] r30989 - kupu/branch/plone-2.1/plone Message-ID: <20060804115921.EF7BF10072@code0.codespeak.net> Author: duncan Date: Fri Aug 4 13:59:18 2006 New Revision: 30989 Modified: kupu/branch/plone-2.1/plone/plonelibrarytool.py Log: Fix issue 5714: context.getField() can throw attribute error if not an AT content type. (Actually now context.getWrappedField() but the same issue applies: check for the method before using). 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:59:18 2006 @@ -183,7 +183,7 @@ return False # Then check whether the current content allows html - if context is not None and fieldName: + if context is not None and fieldName and hasattr(context, 'getWrappedField'): field = context.getWrappedField(fieldName) if field: allowedTypes = getattr(field, 'allowable_content_types', None) From duncan at codespeak.net Fri Aug 4 14:04:32 2006 From: duncan at codespeak.net (duncan at codespeak.net) Date: Fri, 4 Aug 2006 14:04:32 +0200 (CEST) Subject: [kupu-checkins] r30991 - in kupu/branch/plone-2.1/plone: . kupu_plone_layer Message-ID: <20060804120432.C81AE10072@code0.codespeak.net> Author: duncan Date: Fri Aug 4 14:04:31 2006 New Revision: 30991 Modified: kupu/branch/plone-2.1/plone/body.kupu kupu/branch/plone-2.1/plone/kupu_plone_layer/kupu_wysiwyg_support.html Log: Fix for ticket 5713 Modified: kupu/branch/plone-2.1/plone/body.kupu ============================================================================== --- kupu/branch/plone-2.1/plone/body.kupu (original) +++ kupu/branch/plone-2.1/plone/body.kupu Fri Aug 4 14:04:31 2006 @@ -17,7 +17,7 @@ base python:posfactory > 0 and base[:posfactory+15] or base; base kupu_base_override|base;" tal:attributes="src string:${base}/emptypage; - tabindex python:tabindex is not None and tabindex + 1 or None;" + tabindex tabindex/next|nothing;" > - + @@ -349,7 +349,7 @@
- From duncan at codespeak.net Fri Aug 4 14:24:20 2006 From: duncan at codespeak.net (duncan at codespeak.net) Date: Fri, 4 Aug 2006 14:24:20 +0200 (CEST) Subject: [kupu-checkins] r30992 - in kupu/branch/plone-2.1/common: . kupudrawers Message-ID: <20060804122420.DD9431006E@code0.codespeak.net> Author: duncan Date: Fri Aug 4 14:24:19 2006 New Revision: 30992 Modified: kupu/branch/plone-2.1/common/kupubasetools.js kupu/branch/plone-2.1/common/kupudrawers.js kupu/branch/plone-2.1/common/kupudrawers/drawer.xsl Log: Fix for ticket 5679: No longer puts target="_self" attribute on links. 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 Fri Aug 4 14:24:19 2006 @@ -898,7 +898,7 @@ } else { linkel.removeAttribute('title'); } - if (target && target != '') { + if (target) { linkel.setAttribute('target', target); } else { Modified: kupu/branch/plone-2.1/common/kupudrawers.js ============================================================================== --- kupu/branch/plone-2.1/common/kupudrawers.js (original) +++ kupu/branch/plone-2.1/common/kupudrawers.js Fri Aug 4 14:24:19 2006 @@ -134,6 +134,7 @@ } var input = getBaseTagClass(this.element, 'input', 'kupu-linkdrawer-input'); var preview = getBaseTagClass(this.element, 'iframe', 'kupu-linkdrawer-preview'); + this.target = ""; this.createContent = function() { /* display the drawer */ @@ -154,9 +155,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 @@ -997,9 +996,8 @@ // 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.drawertool.closeDrawer(); Modified: kupu/branch/plone-2.1/common/kupudrawers/drawer.xsl ============================================================================== --- kupu/branch/plone-2.1/common/kupudrawers/drawer.xsl (original) +++ kupu/branch/plone-2.1/common/kupudrawers/drawer.xsl Fri Aug 4 14:24:19 2006 @@ -299,7 +299,7 @@ Target
- From duncan at codespeak.net Fri Aug 4 16:19:19 2006 From: duncan at codespeak.net (duncan at codespeak.net) Date: Fri, 4 Aug 2006 16:19:19 +0200 (CEST) Subject: [kupu-checkins] r31003 - in kupu/branch/kupu-1.3: . common common/kupudrawers default doc plone plone/kupu_plone_layer Message-ID: <20060804141919.54D9710076@code0.codespeak.net> Author: duncan Date: Fri Aug 4 16:19:13 2006 New Revision: 31003 Modified: kupu/branch/kupu-1.3/common/kupubasetools.js kupu/branch/kupu-1.3/common/kupudrawers.js kupu/branch/kupu-1.3/common/kupudrawers/drawer.xsl kupu/branch/kupu-1.3/common/kupuhelpers.js kupu/branch/kupu-1.3/common/kupusourceedit.js kupu/branch/kupu-1.3/common/sarissa_ieemu_xpath.js kupu/branch/kupu-1.3/default/toolbar.kupu kupu/branch/kupu-1.3/doc/CHANGES.txt kupu/branch/kupu-1.3/plone/body.kupu kupu/branch/kupu-1.3/plone/kupu_config.pt kupu/branch/kupu-1.3/plone/kupu_plone_layer/kupuplone.css.dtml kupu/branch/kupu-1.3/plone/plonelibrarytool.py kupu/branch/kupu-1.3/plone/xmlconfig.kupu kupu/branch/kupu-1.3/version.txt Log: Merged all the changes from Plone 2.1 branch across to kupu 1.3 branch so now they are completely in step. Modified: kupu/branch/kupu-1.3/common/kupubasetools.js ============================================================================== --- kupu/branch/kupu-1.3/common/kupubasetools.js (original) +++ kupu/branch/kupu-1.3/common/kupubasetools.js Fri Aug 4 16:19:13 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 { @@ -898,7 +898,7 @@ } else { linkel.removeAttribute('title'); } - if (target && target != '') { + if (target) { linkel.setAttribute('target', target); } else { Modified: kupu/branch/kupu-1.3/common/kupudrawers.js ============================================================================== --- kupu/branch/kupu-1.3/common/kupudrawers.js (original) +++ kupu/branch/kupu-1.3/common/kupudrawers.js Fri Aug 4 16:19:13 2006 @@ -134,6 +134,7 @@ } var input = getBaseTagClass(this.element, 'input', 'kupu-linkdrawer-input'); var preview = getBaseTagClass(this.element, 'iframe', 'kupu-linkdrawer-preview'); + this.target = ""; this.createContent = function() { /* display the drawer */ @@ -154,9 +155,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 @@ -997,9 +996,8 @@ // 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.drawertool.closeDrawer(); Modified: kupu/branch/kupu-1.3/common/kupudrawers/drawer.xsl ============================================================================== --- kupu/branch/kupu-1.3/common/kupudrawers/drawer.xsl (original) +++ kupu/branch/kupu-1.3/common/kupudrawers/drawer.xsl Fri Aug 4 16:19:13 2006 @@ -299,7 +299,7 @@ Target
- Modified: kupu/branch/kupu-1.3/common/kupuhelpers.js ============================================================================== --- kupu/branch/kupu-1.3/common/kupuhelpers.js (original) +++ kupu/branch/kupu-1.3/common/kupuhelpers.js Fri Aug 4 16:19:13 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/kupu-1.3/common/kupusourceedit.js ============================================================================== --- kupu/branch/kupu-1.3/common/kupusourceedit.js (original) +++ kupu/branch/kupu-1.3/common/kupusourceedit.js Fri Aug 4 16:19:13 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/kupu-1.3/common/sarissa_ieemu_xpath.js ============================================================================== --- kupu/branch/kupu-1.3/common/sarissa_ieemu_xpath.js (original) +++ kupu/branch/kupu-1.3/common/sarissa_ieemu_xpath.js Fri Aug 4 16:19:13 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/kupu-1.3/default/toolbar.kupu ============================================================================== --- kupu/branch/kupu-1.3/default/toolbar.kupu (original) +++ kupu/branch/kupu-1.3/default/toolbar.kupu Fri Aug 4 16:19:13 2006 @@ -52,7 +52,7 @@ Modified: kupu/branch/kupu-1.3/doc/CHANGES.txt ============================================================================== --- kupu/branch/kupu-1.3/doc/CHANGES.txt (original) +++ kupu/branch/kupu-1.3/doc/CHANGES.txt Fri Aug 4 16:19:13 2006 @@ -2,6 +2,43 @@ 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. + + - Fix bugs: + + * class names were being lowercased + + * target="_self" being added to links when it shouldn't have been. + + * stopped sniffing browser on event interface + + * work round Opera not allowing _ in config tags. + + * Sarissa patched for Opera. + + * fixed bug with tabindex + + * fix buggy lookup of allowable_content_types + +- 1.3.7 + + - Plone + + * Disable spellchecker as it freezes IE + + - General + + * Robustness fix for js. + + * Fix for customisation screen. + + * isKupuEnabled should only return True for a field which actually allows html. + - 1.3.6 - Plone @@ -25,7 +62,7 @@ - 1.3.4 - - Silva + - Silva * Fixed some small issues in external sources support. @@ -65,18 +102,18 @@ - 1.3.2 - Zope 2 - + * Updated Zope 2 distribution, it was broken in several ways. - Silva - + * Fixed problem with ExternalSources, which made that sources could not be added to a page (clicking 'add' would not do anything). - 1.3.1 - Silva: - + * Fixed problem with IE that turned all src attributes (images) and hrefs (links) into absolute URLs, failing miserably on Zope/Silva setups. @@ -162,7 +199,7 @@ - Linking to the current folder produced an empty link. Now it links to "." - Changed how kupu in Plone handles non-HTML content e.g. STX. Now it won't - load for fields in Archetypes content if the content type isn't HTML (but + load for fields in Archetypes content if the content type isn't HTML (but it does put in a link allowing you to force a conversion). See http://plone.org/collector/3900 @@ -177,13 +214,13 @@ and tablecells to 'align'. Apache Lenya enhancements: - + * improved handling of image assets * enabled roundtrip of image editing between Kupu and BXE (http://issues.apache.org/bugzilla/show_bug.cgi?id=29164) * fixed bug that inserted multiple meta charset entries per save. * slight wording changes here and there - + - Kupu 1.2rc1 The following issues have been resolved (see the `issue tracker`_ @@ -203,7 +240,7 @@ - Fixed 'phantom whitespace' problem. Saved format was 'text/html' which non-AT content types interpret as an alias for 'stx'. Now sets format to 'html' for non-AT content types. - - Opening a drawer gave error 404 on Plone systems when Archetypes + - Opening a drawer gave error 404 on Plone systems when Archetypes was not installed. @@ -273,7 +310,7 @@ * Added Selection object that provides a cross-browser API for working with the document's selection and cursor. This can be used to e.g. add - and manipulate arbitrary elements (it's used for instance in Silva's + and manipulate arbitrary elements (it's used for instance in Silva's definition lists code). * Templates for different systems are now generated with an @@ -327,7 +364,7 @@ * Added POST support - * Finally added some more documentation, made some older docs less + * Finally added some more documentation, made some older docs less Zope specific * Added toolboxes, a plugin for tools, to seperate functionality from @@ -355,7 +392,7 @@ * A lot of small bugfixes... - 1.0.1 (2003-12-10) - + * Fixed bug that caused saving to fail in Mozilla 1.3.1 * Fixed bug that prevented Zope from booting when Epoz and Plone were @@ -412,7 +449,7 @@ * Added new attributes on
+HTML View +
+ + + + +
When checked, Kupu's HTML view will display the +filtered HTML which will be sent to the server. Uncheck this box to see the raw HTML generated by the browser. +
+
+ +
+
Styles
Modified: kupu/branch/kupu-1.3/plone/kupu_plone_layer/kupuplone.css.dtml ============================================================================== --- kupu/branch/kupu-1.3/plone/kupu_plone_layer/kupuplone.css.dtml (original) +++ kupu/branch/kupu-1.3/plone/kupu_plone_layer/kupuplone.css.dtml Fri Aug 4 16:19:13 2006 @@ -23,7 +23,10 @@ } -div.kupu-toolboxes {display: none} +div.kupu-toolboxes, +#kupu-spellchecker {display: none} + + /*select.kupu-tb-styles {display: block}*/ Modified: kupu/branch/kupu-1.3/plone/plonelibrarytool.py ============================================================================== --- kupu/branch/kupu-1.3/plone/plonelibrarytool.py (original) +++ kupu/branch/kupu-1.3/plone/plonelibrarytool.py Fri Aug 4 16:19:13 2006 @@ -156,6 +156,10 @@ def installBeforeUnload(self): return getattr(self, 'install_beforeunload', True) + security.declareProtected('View', "getFiltersourceedit") + def getFiltersourceedit(self): + return getattr(self, 'filtersourceedit', True) + security.declareProtected('View', 'isKupuEnabled') def isKupuEnabled(self, useragent='', allowAnonymous=False, REQUEST=None, context=None, fieldName=None): def numerics(s): @@ -179,8 +183,8 @@ return False # Then check whether the current content allows html - if context is not None and fieldName: - field = context.getField(fieldName) + if context is not None and fieldName and hasattr(context, 'getWrappedField'): + 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]: @@ -348,12 +352,16 @@ def configure_kupu(self, linkbyuid, table_classnames, html_exclusions, style_whitelist, class_blacklist, installBeforeUnload=None, parastyles=None, + filterSourceEdit=None, REQUEST=None): """Delete resource types through the ZMI""" self.linkbyuid = int(linkbyuid) self.table_classnames = table_classnames if installBeforeUnload is not None: self.install_beforeunload = bool(installBeforeUnload) + if filterSourceEdit is not None: + self.filtersourceedit = bool(filterSourceEdit) + if parastyles: self.paragraph_styles = [ line.strip() for line in parastyles if line.strip() ] Modified: kupu/branch/kupu-1.3/plone/xmlconfig.kupu ============================================================================== --- kupu/branch/kupu-1.3/plone/xmlconfig.kupu (original) +++ kupu/branch/kupu-1.3/plone/xmlconfig.kupu Fri Aug 4 16:19:13 2006 @@ -18,6 +18,7 @@ 1 application/xhtml+xml 1 + 1 Modified: kupu/branch/kupu-1.3/version.txt ============================================================================== --- kupu/branch/kupu-1.3/version.txt (original) +++ kupu/branch/kupu-1.3/version.txt Fri Aug 4 16:19:13 2006 @@ -1 +1 @@ -kupu 1.3.7 (SVN/Unreleased) +kupu 1.3.8 (SVN/Unreleased) From duncan at codespeak.net Fri Aug 4 16:29:58 2006 From: duncan at codespeak.net (duncan at codespeak.net) Date: Fri, 4 Aug 2006 16:29:58 +0200 (CEST) Subject: [kupu-checkins] r31005 - in kupu/branch/plone-2.1: . default doc silva Message-ID: <20060804142958.9C32610078@code0.codespeak.net> Author: duncan Date: Fri Aug 4 16:29:57 2006 New Revision: 31005 Modified: kupu/branch/plone-2.1/default/toolbar.kupu kupu/branch/plone-2.1/doc/CHANGES.txt kupu/branch/plone-2.1/silva/head.kupu kupu/branch/plone-2.1/version.txt Log: Finish bringing branch/plone-2.1 and branch/kupu-1.3 back into alignment. They should now be identical again apart from the kupu_wysiwyg_support.html being prebuilt on the plone-2.1 branch. Modified: kupu/branch/plone-2.1/default/toolbar.kupu ============================================================================== --- kupu/branch/plone-2.1/default/toolbar.kupu (original) +++ kupu/branch/plone-2.1/default/toolbar.kupu Fri Aug 4 16:29:57 2006 @@ -52,7 +52,7 @@ 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 16:29:57 2006 @@ -9,6 +9,21 @@ Word the HTML can be cleaned up simply by toggling source view on/off. + - Fix bugs: + + * class names were being lowercased + + * target="_self" being added to links when it shouldn't have been. + + * stopped sniffing browser on event interface + + * work round Opera not allowing _ in config tags. + + * Sarissa patched for Opera. + + * fixed bug with tabindex + + * fix buggy lookup of allowable_content_types - 1.3.7 Modified: kupu/branch/plone-2.1/silva/head.kupu ============================================================================== --- kupu/branch/plone-2.1/silva/head.kupu (original) +++ kupu/branch/plone-2.1/silva/head.kupu Fri Aug 4 16:29:57 2006 @@ -59,4 +59,7 @@ + + + Modified: kupu/branch/plone-2.1/version.txt ============================================================================== --- kupu/branch/plone-2.1/version.txt (original) +++ kupu/branch/plone-2.1/version.txt Fri Aug 4 16:29:57 2006 @@ -1 +1 @@ -kupu 1.3.7-plone +kupu 1.3.8 (SVN/Unreleased) From duncan at codespeak.net Wed Aug 9 13:04:22 2006 From: duncan at codespeak.net (duncan at codespeak.net) Date: Wed, 9 Aug 2006 13:04:22 +0200 (CEST) Subject: [kupu-checkins] r31197 - kupu/trunk/kupu/common Message-ID: <20060809110422.08F2810053@code0.codespeak.net> Author: duncan Date: Wed Aug 9 13:04:21 2006 New Revision: 31197 Modified: kupu/trunk/kupu/common/kupudrawers.js Log: Fix for reload button: IE doesn't resend the request unless it has expired from cache, so set the 'If-Modified-Since' header on the request to force this. Modified: kupu/trunk/kupu/common/kupudrawers.js ============================================================================== --- kupu/trunk/kupu/common/kupudrawers.js (original) +++ kupu/trunk/kupu/common/kupudrawers.js Wed Aug 9 13:04:21 2006 @@ -962,7 +962,7 @@ var src_uri = src_node.selectSingleNode('text()').nodeValue; src_uri = src_uri.strip(); // needs kupuhelpers.js - this._loadXML(src_uri, this._libraryContentCallback); + this._loadXML(src_uri, this._libraryContentCallback, null, true); }; this.removeSelection = function() { @@ -1181,7 +1181,7 @@ return result; }; - this._loadXML = function(uri, callback, body) { + this._loadXML = function(uri, callback, body, reload) { function _sarissaCallback() { /* callback for Sarissa when the callback is called because the data's ready it @@ -1226,6 +1226,9 @@ // a web server expects from a POST. xmlhttp.setRequestHeader('content-type', 'application/x-www-form-urlencoded'); }; + if (reload) { + xmlhttp.setRequestHeader("If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT"); + } xmlhttp.send(body); } catch(e) { if (e && e.name && e.message) { // Microsoft From duncan at codespeak.net Tue Aug 22 16:54:34 2006 From: duncan at codespeak.net (duncan at codespeak.net) Date: Tue, 22 Aug 2006 16:54:34 +0200 (CEST) Subject: [kupu-checkins] r31484 - in kupu/trunk/kupu: common plone Message-ID: <20060822145434.72D821005A@code0.codespeak.net> Author: duncan Date: Tue Aug 22 16:54:25 2006 New Revision: 31484 Modified: kupu/trunk/kupu/common/kupudrawers.js kupu/trunk/kupu/plone/plonedrawers.py Log: Fix for slow loading libraries to stop the current node getting confused. UID based linking was broken for images where a specific scale was selected. Modified: kupu/trunk/kupu/common/kupudrawers.js ============================================================================== --- kupu/trunk/kupu/common/kupudrawers.js (original) +++ kupu/trunk/kupu/common/kupudrawers.js Tue Aug 22 16:54:25 2006 @@ -758,7 +758,7 @@ src_uri = src_uri.strip(); // needs kupuhelpers.js // Now load the library into the items pane. Since we have // to load the XML, do this via a call back - this._loadXML(src_uri, this._libraryContentCallback, null); + this._loadXML(src_uri, this._libraryContentCallback, null, false, libnode); this.shared.newimages = null; }; }; @@ -771,13 +771,13 @@ } } - this._libraryContentCallback = function(dom, src_uri) { + this._libraryContentCallback = function(dom, src_uri, libnode) { /* callback for when a library's contents (item list) is loaded This is also used as he handler for reloading a standard collection. */ - var libnode = this.xmldata.selectSingleNode('//*[@selected]'); + //var libnode = this.xmldata.selectSingleNode('//*[@selected]'); var itemsnode = libnode.selectSingleNode("items"); var bcnode = libnode.selectSingleNode("breadcrumbs"); var newitemsnode = dom.selectSingleNode("//items"); @@ -962,7 +962,7 @@ var src_uri = src_node.selectSingleNode('text()').nodeValue; src_uri = src_uri.strip(); // needs kupuhelpers.js - this._loadXML(src_uri, this._libraryContentCallback, null, true); + this._loadXML(src_uri, this._libraryContentCallback, null, true, current); }; this.removeSelection = function() { @@ -1181,7 +1181,7 @@ return result; }; - this._loadXML = function(uri, callback, body, reload) { + this._loadXML = function(uri, callback, body, reload, extra) { function _sarissaCallback() { /* callback for Sarissa when the callback is called because the data's ready it @@ -1203,7 +1203,7 @@ dom = Sarissa.getDomDocument(); dom.loadXML(xmlhttp.responseText); } - callback.apply(self, [dom, uri]); + callback.apply(self, [dom, uri, extra]); }; }; var self = this; Modified: kupu/trunk/kupu/plone/plonedrawers.py ============================================================================== --- kupu/trunk/kupu/plone/plonedrawers.py (original) +++ kupu/trunk/kupu/plone/plonedrawers.py Tue Aug 22 16:54:25 2006 @@ -279,8 +279,6 @@ url = obj.absolute_url() preview = self.tool.getPreviewUrl(portal_type, url) - sizes = self.get_image_sizes(obj, portal_type, url) - if collection and self.resource_type.allow_browse: src = obj.absolute_url() if not src.endswith('/'): src += '/' @@ -291,6 +289,8 @@ if UID and self.linkbyuid: url = self.base+'/resolveuid/%s' % UID + sizes = self.get_image_sizes(obj, portal_type, url) + icon = self.icon(obj.getIcon(1)) size, width, height = self.sizes(obj) @@ -336,8 +336,6 @@ collection = portal_type in self.coll_types preview = self.tool.getPreviewUrl(portal_type, url) - sizes = self.get_image_sizes(brain, portal_type, url) - # Path for the uid catalog doesn't have the leading '/' path = brain.getPath() UID = None @@ -362,6 +360,8 @@ if UID and self.linkbyuid: url = self.base+'/resolveuid/%s' % UID + sizes = self.get_image_sizes(brain, portal_type, url) + icon = self.icon(brain.getIcon) size, width, height = self.sizes(brain)