From kupu-dev-owner at codespeak.net Sat Sep 1 08:56:34 2007 From: kupu-dev-owner at codespeak.net (kupu-dev-owner at codespeak.net) Date: Sat, 01 Sep 2007 08:56:34 +0200 Subject: [kupu-checkins] (no subject) Message-ID: Posting to this list is restricted to members only. Please visit http://kupu.oscom.org to join, or for more information. -------------- next part -------------- An embedded message was scrubbed... From: "Irene Boswell" Subject: Re: Date: Sat, 32 Aug 2007 15:50:59 +0900 Size: 861 Url: http://codespeak.net/pipermail/kupu-checkins/attachments/20070901/c2dc5fa0/attachment.eml From kupu-issues at codespeak.net Sat Sep 1 08:56:39 2007 From: kupu-issues at codespeak.net (Kupu issue tracker) Date: Sat, 01 Sep 2007 06:56:39 +0000 Subject: [kupu-checkins] Failed issue tracker submission Message-ID: <20070901065639.5C03C81A6@code0.codespeak.net> I cannot match your message to a node in the database - you need to either supply a full node identifier (with number, eg "[issue123]" or keep the previous subject title intact so I can match that. Subject was: "Re:" Mail Gateway Help ================= Incoming messages are examined for multiple parts: . In a multipart/mixed message or part, each subpart is extracted and examined. The text/plain subparts are assembled to form the textual body of the message, to be stored in the file associated with a "msg" class node. Any parts of other types are each stored in separate files and given "file" class nodes that are linked to the "msg" node. . In a multipart/alternative message or part, we look for a text/plain subpart and ignore the other parts. Summary ------- The "summary" property on message nodes is taken from the first non-quoting section in the message body. The message body is divided into sections by blank lines. Sections where the second and all subsequent lines begin with a ">" or "|" character are considered "quoting sections". The first line of the first non-quoting section becomes the summary of the message. Addresses --------- All of the addresses in the To: and Cc: headers of the incoming message are looked up among the user nodes, and the corresponding users are placed in the "recipients" property on the new "msg" node. The address in the From: header similarly determines the "author" property of the new "msg" node. The default handling for addresses that don't have corresponding users is to create new users with no passwords and a username equal to the address. (The web interface does not permit logins for users with no passwords.) If we prefer to reject mail from outside sources, we can simply register an auditor on the "user" class that prevents the creation of user nodes with no passwords. Actions ------- The subject line of the incoming message is examined to determine whether the message is an attempt to create a new item or to discuss an existing item. A designator enclosed in square brackets is sought as the first thing on the subject line (after skipping any "Fwd:" or "Re:" prefixes). If an item designator (class name and id number) is found there, the newly created "msg" node is added to the "messages" property for that item, and any new "file" nodes are added to the "files" property for the item. If just an item class name is found there, we attempt to create a new item of that class with its "messages" property initialized to contain the new "msg" node and its "files" property initialized to contain any new "file" nodes. Triggers -------- Both cases may trigger detectors (in the first case we are calling the set() method to add the message to the item's spool; in the second case we are calling the create() method to create a new node). If an auditor raises an exception, the original message is bounced back to the sender with the explanatory message given in the exception. $Id: mailgw.py,v 1.104.2.1 2003/02/06 05:44:49 richard Exp $ -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: not available Url: http://codespeak.net/pipermail/kupu-checkins/attachments/20070901/311b8484/attachment.diff From fschulze at codespeak.net Tue Sep 4 16:12:46 2007 From: fschulze at codespeak.net (fschulze at codespeak.net) Date: Tue, 4 Sep 2007 16:12:46 +0200 (CEST) Subject: [kupu-checkins] r46305 - kupu/trunk/kupu/plone Message-ID: <20070904141246.C5C0E819A@code0.codespeak.net> Author: fschulze Date: Tue Sep 4 16:12:45 2007 New Revision: 46305 Modified: kupu/trunk/kupu/plone/plonedrawers.py Log: The label comes from the translation engine and has nothing to do with the site encoding. Decoding it by hand breaks most of the time and we don't have to decode anyway. Modified: kupu/trunk/kupu/plone/plonedrawers.py ============================================================================== --- kupu/trunk/kupu/plone/plonedrawers.py (original) +++ kupu/trunk/kupu/plone/plonedrawers.py Tue Sep 4 16:12:45 2007 @@ -784,11 +784,10 @@ def getKupuFields(self, filter=1): """Returns a list of all kupu editable fields""" inuse = getToolByName(self, 'portal_catalog').uniqueValuesFor('portal_type') - site_encoding = getSiteEncoding(self) for t,f,pt in self._getKupuFields(): if html2captioned.sanitize_portal_type(pt) in inuse or not filter: yield dict(type=t, name=f.getName(), portal_type=pt, - label=f.widget.Label(self).decode(site_encoding)) + label=f.widget.Label(self)) def _getKupuFields(self): """Yield all fields which are editable using kupu""" From fschulze at codespeak.net Tue Sep 4 16:24:20 2007 From: fschulze at codespeak.net (fschulze at codespeak.net) Date: Tue, 4 Sep 2007 16:24:20 +0200 (CEST) Subject: [kupu-checkins] r46306 - kupu/trunk/kupu/plone Message-ID: <20070904142420.F012F8181@code0.codespeak.net> Author: fschulze Date: Tue Sep 4 16:24:20 2007 New Revision: 46306 Modified: kupu/trunk/kupu/plone/html2captioned.py Log: Fixed more encoding errors. The link checker now works with non ascii translations. Modified: kupu/trunk/kupu/plone/html2captioned.py ============================================================================== --- kupu/trunk/kupu/plone/html2captioned.py (original) +++ kupu/trunk/kupu/plone/html2captioned.py Tue Sep 4 16:24:20 2007 @@ -223,9 +223,9 @@ if fields: f = fields[0] self.portal_type = f.portal_type - self.typename = f.type - self.fieldname = f.name - self.fieldlabel = f.label + self.typename = f.type.decode('utf-8') + self.fieldname = f.name.decode('utf-8') + self.fieldlabel = f.label.decode('utf-8') else: self.portal_type = rfg('portal_type', None) self.fieldname = None From kupu-checkins at codespeak.net Thu Sep 6 23:24:47 2007 From: kupu-checkins at codespeak.net (kupu-checkins at codespeak.net) Date: Thu, 6 Sep 2007 23:24:47 +0200 (CEST) Subject: [kupu-checkins] prxpewmh kupu-checkins@codespeak.net Offer Message-ID: <20070906-12612.3644.qmail@client-201.230.247.239.speedy.net.pe> An HTML attachment was scrubbed... URL: http://codespeak.net/pipermail/kupu-checkins/attachments/20070906/fe0e3688/attachment-0001.htm From duncan at codespeak.net Fri Sep 7 15:17:10 2007 From: duncan at codespeak.net (duncan at codespeak.net) Date: Fri, 7 Sep 2007 15:17:10 +0200 (CEST) Subject: [kupu-checkins] r46399 - in kupu/trunk/kupu: doc plone/kupu_plone_layer Message-ID: <20070907131710.A21EA810F@code0.codespeak.net> Author: duncan Date: Fri Sep 7 15:17:09 2007 New Revision: 46399 Modified: kupu/trunk/kupu/doc/CHANGES.txt kupu/trunk/kupu/plone/kupu_plone_layer/kupusearch.xml.pt Log: Fix for Plone ticket #7074 i18n:translate used wrongly in search results. Modified: kupu/trunk/kupu/doc/CHANGES.txt ============================================================================== --- kupu/trunk/kupu/doc/CHANGES.txt (original) +++ kupu/trunk/kupu/doc/CHANGES.txt Fri Sep 7 15:17:09 2007 @@ -2,6 +2,12 @@ Kupu changes ============ +- 1.4.2 + + - Plone tickets + + * 7074: Search for image errors in Kupu + - 1.4.1 Limi asked for some last minute changes for Plone 3: Modified: kupu/trunk/kupu/plone/kupu_plone_layer/kupusearch.xml.pt ============================================================================== --- kupu/trunk/kupu/plone/kupu_plone_layer/kupusearch.xml.pt (original) +++ kupu/trunk/kupu/plone/kupu_plone_layer/kupusearch.xml.pt Fri Sep 7 15:17:09 2007 @@ -12,8 +12,7 @@ - Search Results Search results. From duncan at codespeak.net Mon Sep 10 09:37:37 2007 From: duncan at codespeak.net (duncan at codespeak.net) Date: Mon, 10 Sep 2007 09:37:37 +0200 (CEST) Subject: [kupu-checkins] r46429 - in kupu/trunk/kupu/plone: . tests tests/output Message-ID: <20070910073737.C43D180F0@code0.codespeak.net> Author: duncan Date: Mon Sep 10 09:37:36 2007 New Revision: 46429 Modified: kupu/trunk/kupu/plone/html2captioned.py kupu/trunk/kupu/plone/tests/output/linked.out kupu/trunk/kupu/plone/tests/output/notquoted.out kupu/trunk/kupu/plone/tests/output/simple.out kupu/trunk/kupu/plone/tests/test_html2captioned.py Log: Fixing some broken tests - still two broken :( Modified: kupu/trunk/kupu/plone/html2captioned.py ============================================================================== --- kupu/trunk/kupu/plone/html2captioned.py (original) +++ kupu/trunk/kupu/plone/html2captioned.py Mon Sep 10 09:37:36 2007 @@ -37,6 +37,7 @@ ATTR_VALUE = '=(?:"?)(?P<%s>(?<=")[^"]*|[^ \/>]*)' ATTR_CLASS = ATTR_VALUE % 'class' ATTR_WIDTH = ATTR_VALUE % 'width' +ATTR_HEIGHT = ATTR_VALUE % 'height' ATTR_ALT = ATTR_VALUE % 'alt' ATTR_PATTERN = re.compile(''' @@ -45,9 +46,10 @@ | src\s*=\s*"resolveuid/(?P([^/"#? ]*)) | width%s | alt%s + | height%s | . )*\> - )''' % (ATTR_CLASS, ATTR_WIDTH, ATTR_ALT), re.VERBOSE | re.IGNORECASE | re.DOTALL) + )''' % (ATTR_CLASS, ATTR_WIDTH, ATTR_ALT, ATTR_HEIGHT), re.VERBOSE | re.IGNORECASE | re.DOTALL) SRC_TAIL = re.compile(r'/([^" \/>]+)') CLASS_PATTERN = re.compile('\s*class\s*=\s*("[^"]*captioned[^"]*"|[^" \/>]+)') Modified: kupu/trunk/kupu/plone/tests/output/linked.out ============================================================================== --- kupu/trunk/kupu/plone/tests/output/linked.out (original) +++ kupu/trunk/kupu/plone/tests/output/linked.out Mon Sep 10 09:37:36 2007 @@ -1,9 +1,9 @@
Simple text containing an embedded image
-
-
+
+
image 104ede98d4c7c8eaeaa3b984f7395979 -
-
+ +
Test image caption -
+
Modified: kupu/trunk/kupu/plone/tests/output/notquoted.out ============================================================================== --- kupu/trunk/kupu/plone/tests/output/notquoted.out (original) +++ kupu/trunk/kupu/plone/tests/output/notquoted.out Mon Sep 10 09:37:36 2007 @@ -1,13 +1,13 @@
IE doesn't always quote attributes
-
-
- image 104ede98d4c7c8eaeaa3b984f7395979 -
-
Test image caption
-
-
-
- image 104ede98d4c7c8eaeaa3b984f7395979 -
-
Test image caption
-
+
+
+ image 104ede98d4c7c8eaeaa3b984f7395979 +
+
Test image caption
+
+
+
+ image 104ede98d4c7c8eaeaa3b984f7395979 +
+
Test image caption
+
Modified: kupu/trunk/kupu/plone/tests/output/simple.out ============================================================================== --- kupu/trunk/kupu/plone/tests/output/simple.out (original) +++ kupu/trunk/kupu/plone/tests/output/simple.out Mon Sep 10 09:37:36 2007 @@ -1,16 +1,16 @@
Simple text containing an embedded image
-
-
image 104ede98d4c7c8eaeaa3b984f7395979 -
-
Test image caption
-
-
-
image 104ede98d4c7c8eaeaa3b984f7395979 -
-
Test image caption
-
-
-
image 104ede98d4c7c8eaeaa3b984f7395979 -
-
Test image caption
-
+
+
image 104ede98d4c7c8eaeaa3b984f7395979 +
+
Test image caption
+
+
+
image 104ede98d4c7c8eaeaa3b984f7395979 +
+
Test image caption
+
+
+
image 104ede98d4c7c8eaeaa3b984f7395979 +
+
Test image caption
+
Modified: kupu/trunk/kupu/plone/tests/test_html2captioned.py ============================================================================== --- kupu/trunk/kupu/plone/tests/test_html2captioned.py (original) +++ kupu/trunk/kupu/plone/tests/test_html2captioned.py Mon Sep 10 09:37:36 2007 @@ -8,6 +8,7 @@ from Products.PortalTransforms.tests.test_transforms import * from Products.PortalTransforms.tests.utils import normalize_html +from Products.kupu import kupu_globals PREFIX = abspath(dirname(__file__)) @@ -26,14 +27,11 @@ ('Products.kupu.plone.html2captioned', "linked.in", "linked.out", normalize_html, 0), ) -class MockSubImage: - def getWidth(self): - return 20 - class MockImage: def __init__(self, uid, description): self.uid, self.description = uid, description - self.image_thumb = MockSubImage() + if not uid.startswith('SUB:'): + self.image_thumb = MockSubImage(self) def Title(self): return 'image '+self.uid @@ -45,6 +43,22 @@ return '[url for %s]' % self.uid def getWidth(self): return 600 + def tag(self, height="", width="", **kw): + src = self.absolute_url_path() + alt = self.Title() + if not width: + width = self.getWidth() + return '%s' % (height, src, width, alt) + +class MockSubImage(MockImage): + def __init__(self, parent): + self.uid = parent.uid + self.description = parent.description + + def getWidth(self): + return 20 + def absolute_url_path(self): + return '[url for %s]' % self.uid+'/image_thumb' class MockCatalogTool: def lookupObject(self, uid): @@ -59,11 +73,43 @@ class MockArchetypeTool: reference_catalog = MockCatalogTool() +def mockPageTemplate(self, **kw): + """Acquisition isn't set up correctly for us to use a real PageTemplateFile, + so for the test we just use string formatting. + """ + caption = kw.get('caption', '!caption!') + image = kw.get('image', None) + fullimage = kw.get('fullimage', None) + Class=kw['class'] + width = kw['width'] + owidth = fullimage.getWidth() + if width is None: + kw['width'] = width = image.getWidth() + href = fullimage.absolute_url_path() + tag = image.tag(**kw) + + #if width==owidth: + TEMPLATE = '''
+
%(tag)s
+
%(caption)s
+
''' + #else: + # TEMPLATE = '''
+ #
%(tag)s
+ #
%(caption)s
+ #
''' + + return TEMPLATE % dict( + caption=caption, Class=Class, href=href, width=width, tag=tag) + class MockPortal: # Mock portal class: just enough to let me think I can lookup a # Description for an image from its UID. archetype_tool = MockArchetypeTool() + # Also now needs access to the captioning template + kupu_captioned_image = mockPageTemplate + class TransformTest(TestCase): portal = MockPortal() From duncan at codespeak.net Mon Sep 10 09:38:37 2007 From: duncan at codespeak.net (duncan at codespeak.net) Date: Mon, 10 Sep 2007 09:38:37 +0200 (CEST) Subject: [kupu-checkins] r46430 - kupu/trunk/kupu/doc Message-ID: <20070910073837.E17F780F0@code0.codespeak.net> Author: duncan Date: Mon Sep 10 09:38:37 2007 New Revision: 46430 Modified: kupu/trunk/kupu/doc/CHANGES.txt Log: Updated changes Modified: kupu/trunk/kupu/doc/CHANGES.txt ============================================================================== --- kupu/trunk/kupu/doc/CHANGES.txt (original) +++ kupu/trunk/kupu/doc/CHANGES.txt Mon Sep 10 09:38:37 2007 @@ -4,6 +4,8 @@ - 1.4.2 + - Florian fixed some encoding errors + - Plone tickets * 7074: Search for image errors in Kupu From duncan at codespeak.net Mon Sep 10 09:44:37 2007 From: duncan at codespeak.net (duncan at codespeak.net) Date: Mon, 10 Sep 2007 09:44:37 +0200 (CEST) Subject: [kupu-checkins] r46431 - kupu/trunk/kupu Message-ID: <20070910074437.81C4C80F9@code0.codespeak.net> Author: duncan Date: Mon Sep 10 09:44:37 2007 New Revision: 46431 Modified: kupu/trunk/kupu/version.txt Log: Update for another release Modified: kupu/trunk/kupu/version.txt ============================================================================== --- kupu/trunk/kupu/version.txt (original) +++ kupu/trunk/kupu/version.txt Mon Sep 10 09:44:37 2007 @@ -1 +1 @@ -kupu 1.4.1 +kupu 1.4.2 From duncan at codespeak.net Mon Sep 10 10:05:36 2007 From: duncan at codespeak.net (duncan at codespeak.net) Date: Mon, 10 Sep 2007 10:05:36 +0200 (CEST) Subject: [kupu-checkins] r46432 - kupu/tag/kupu-1.4.2 Message-ID: <20070910080536.AB21380FC@code0.codespeak.net> Author: duncan Date: Mon Sep 10 10:05:36 2007 New Revision: 46432 Added: kupu/tag/kupu-1.4.2/ - copied from r46431, kupu/trunk/kupu/ Log: Create tag for minor bug fix release From duncan at codespeak.net Tue Sep 11 12:15:54 2007 From: duncan at codespeak.net (duncan at codespeak.net) Date: Tue, 11 Sep 2007 12:15:54 +0200 (CEST) Subject: [kupu-checkins] r46465 - in kupu/trunk/kupu: doc plone/kupu_plone_layer Message-ID: <20070911101554.927D28100@code0.codespeak.net> Author: duncan Date: Tue Sep 11 12:15:54 2007 New Revision: 46465 Modified: kupu/trunk/kupu/doc/CHANGES.txt kupu/trunk/kupu/plone/kupu_plone_layer/kupuploneeditor.js Log: Fix Plone issue 6975: adding newlines to the output HTML had broken the test to convert nearly empty HTML to completely empty. Modified: kupu/trunk/kupu/doc/CHANGES.txt ============================================================================== --- kupu/trunk/kupu/doc/CHANGES.txt (original) +++ kupu/trunk/kupu/doc/CHANGES.txt Tue Sep 11 12:15:54 2007 @@ -2,6 +2,12 @@ Kupu changes ============ +- SVN + + - Plone tickets + + * 6975: Cannot save HTML field as NULL + - 1.4.2 - Florian fixed some encoding errors 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 Sep 11 12:15:54 2007 @@ -100,7 +100,7 @@ // We need to get the contents of the body node as xml, but we don't // want the body node itself, so we use a regex to remove it var contents = this.getXMLBody(transform); - if (/^]*>(<\/?(p|br)[^>]*>|\ )*<\/body>$/.test(contents)) { + if (/^]*>(<\/?(p|br)[^>]*>|\ |\s)*<\/body>$/.test(contents)) { contents = ''; /* Ignore nearly empty contents */ } var base = this._getBase(transform); From kupu-checkins at codespeak.net Thu Sep 20 07:09:21 2007 From: kupu-checkins at codespeak.net (kupu-checkins at codespeak.net) Date: Thu, 20 Sep 2007 07:09:21 +0200 (CEST) Subject: [kupu-checkins] September 2007 Message-ID: <20070920081100.2983.qmail@ackj133.neoplus.adsl.tpnet.pl> An HTML attachment was scrubbed... URL: http://codespeak.net/pipermail/kupu-checkins/attachments/20070920/cc63afd1/attachment.htm From kupu-checkins at codespeak.net Mon Sep 24 12:28:11 2007 From: kupu-checkins at codespeak.net (Viagra.com Inc) Date: Mon, 24 Sep 2007 12:28:11 +0200 (CEST) Subject: [kupu-checkins] September 70% OFF Message-ID: <20070924053830.22316.qmail@ppp91-122-56-21.pppoe.avangard-dsl.ru> An HTML attachment was scrubbed... URL: http://codespeak.net/pipermail/kupu-checkins/attachments/20070924/afec1b9c/attachment.htm From kupu-checkins at codespeak.net Tue Sep 25 16:41:31 2007 From: kupu-checkins at codespeak.net (kupu-checkins at codespeak.net) Date: Tue, 25 Sep 2007 16:41:31 +0200 (CEST) Subject: [kupu-checkins] Magazine Message-ID: <20070925094317.3799.qmail@ppp91-76-142-210.pppoe.mtu-net.ru> An HTML attachment was scrubbed... URL: http://codespeak.net/pipermail/kupu-checkins/attachments/20070925/54ed3d8c/attachment-0001.htm From kupu-checkins at codespeak.net Wed Sep 26 17:36:09 2007 From: kupu-checkins at codespeak.net (Viagra.com Inc) Date: Wed, 26 Sep 2007 17:36:09 +0200 (CEST) Subject: [kupu-checkins] Lovers package at discount price! Message-ID: <20070926063807.2505.qmail@gql234.internetdsl.tpnet.pl> An HTML attachment was scrubbed... URL: http://codespeak.net/pipermail/kupu-checkins/attachments/20070926/d0f88b12/attachment.htm From duncan at codespeak.net Thu Sep 27 11:39:10 2007 From: duncan at codespeak.net (duncan at codespeak.net) Date: Thu, 27 Sep 2007 11:39:10 +0200 (CEST) Subject: [kupu-checkins] r46935 - kupu/trunk/kupu/common Message-ID: <20070927093910.E7C448171@code0.codespeak.net> Author: duncan Date: Thu Sep 27 11:39:10 2007 New Revision: 46935 Modified: kupu/trunk/kupu/common/kupudrawers.js kupu/trunk/kupu/common/kupuhelpers.js Log: Anchors weren't always picking up the associated text correctly. Reference browser was getting a js error on initialisation. Modified: kupu/trunk/kupu/common/kupudrawers.js ============================================================================== --- kupu/trunk/kupu/common/kupudrawers.js (original) +++ kupu/trunk/kupu/common/kupudrawers.js Thu Sep 27 11:39:10 2007 @@ -246,18 +246,16 @@ var blocktag = /^DIV|P|BODY|TD|H.$/; var txt = ''; var prefix = '#' + a.name; -findlabel: + for (var node = a; node && !txt; node=node.parentNode) { var txt = node.textContent || node.innerText || ''; if (txt || blocktag.test(node.nodeName)) { break; } - for (var sibling = node.nextSibling; sibling; sibling = sibling.nextSibling) { + for (var sibling = node.nextSibling; sibling && !txt; sibling = sibling.nextSibling) { if (sibling.nodeName=='#text') { txt = sibling.data.strip(); - } else if (blocktag.test(sibling.nodeName)) { - break findlabel; } else { txt += sibling.textContent || sibling.innerText ||''; }; Modified: kupu/trunk/kupu/common/kupuhelpers.js ============================================================================== --- kupu/trunk/kupu/common/kupuhelpers.js (original) +++ kupu/trunk/kupu/common/kupuhelpers.js Thu Sep 27 11:39:10 2007 @@ -969,12 +969,16 @@ }; this.getRange = function() { - return this.selection.getRangeAt(0); + if (this.selection) { + return this.selection.getRangeAt(0); + } }; this.restoreRange = function(range) { var selection = this.selection; - selection.removeAllRanges(); - selection.addRange(range); + if (selection) { + selection.removeAllRanges(); + selection.addRange(range); + } }; //sample kindly snipped from Mozilla's wiki From duncan at codespeak.net Thu Sep 27 11:47:09 2007 From: duncan at codespeak.net (duncan at codespeak.net) Date: Thu, 27 Sep 2007 11:47:09 +0200 (CEST) Subject: [kupu-checkins] r46936 - kupu/trunk/kupu/common Message-ID: <20070927094709.7706F8172@code0.codespeak.net> Author: duncan Date: Thu Sep 27 11:47:09 2007 New Revision: 46936 Modified: kupu/trunk/kupu/common/sarissa.js Log: Use sarissa 0.9.8 (with minor fixes) Modified: kupu/trunk/kupu/common/sarissa.js ============================================================================== --- kupu/trunk/kupu/common/sarissa.js (original) +++ kupu/trunk/kupu/common/sarissa.js Thu Sep 27 11:47:09 2007 @@ -5,7 +5,7 @@ * Sarissa is an ECMAScript library acting as a cross-browser wrapper for native XML APIs. * The library supports Gecko based browsers like Mozilla and Firefox, * Internet Explorer (5.5+ with MSXML3.0+), Konqueror, Safari and a little of Opera - * @version @sarissa.version@ + * @version ${project.version} * @author: Manos Batsis, mailto: mbatsis at users full stop sourceforge full stop net * ==================================================================== * Licence @@ -32,22 +32,37 @@ * @constructor */ function Sarissa(){}; +Sarissa.VERSION = "${project.version}"; Sarissa.PARSED_OK = "Document contains no parsing errors"; Sarissa.PARSED_EMPTY = "Document is empty"; Sarissa.PARSED_UNKNOWN_ERROR = "Not well-formed or other error"; +Sarissa.IS_ENABLED_TRANSFORM_NODE = false; var _sarissa_iNsCounter = 0; var _SARISSA_IEPREFIX4XSLPARAM = ""; var _SARISSA_HAS_DOM_IMPLEMENTATION = document.implementation && true; var _SARISSA_HAS_DOM_CREATE_DOCUMENT = _SARISSA_HAS_DOM_IMPLEMENTATION && document.implementation.createDocument; var _SARISSA_HAS_DOM_FEATURE = _SARISSA_HAS_DOM_IMPLEMENTATION && document.implementation.hasFeature; var _SARISSA_IS_MOZ = _SARISSA_HAS_DOM_CREATE_DOCUMENT && _SARISSA_HAS_DOM_FEATURE; -var _SARISSA_IS_SAFARI = (navigator.userAgent && navigator.vendor && (navigator.userAgent.toLowerCase().indexOf("applewebkit") != -1 || navigator.vendor.indexOf("Apple") != -1)); +var _SARISSA_IS_SAFARI = navigator.userAgent.toLowerCase().indexOf("safari") != -1 || navigator.userAgent.toLowerCase().indexOf("konqueror") != -1; +var _SARISSA_IS_SAFARI_OLD = _SARISSA_IS_SAFARI && parseInt((navigator.userAgent.match(/AppleWebKit\/(\d+)/)||{})[1]) < 420; var _SARISSA_IS_IE = document.all && window.ActiveXObject && navigator.userAgent.toLowerCase().indexOf("msie") > -1 && navigator.userAgent.toLowerCase().indexOf("opera") == -1; +var _SARISSA_IS_OPERA = navigator.userAgent.toLowerCase().indexOf("opera") != -1; if(!window.Node || !Node.ELEMENT_NODE){ Node = {ELEMENT_NODE: 1, ATTRIBUTE_NODE: 2, TEXT_NODE: 3, CDATA_SECTION_NODE: 4, ENTITY_REFERENCE_NODE: 5, ENTITY_NODE: 6, PROCESSING_INSTRUCTION_NODE: 7, COMMENT_NODE: 8, DOCUMENT_NODE: 9, DOCUMENT_TYPE_NODE: 10, DOCUMENT_FRAGMENT_NODE: 11, NOTATION_NODE: 12}; }; -if( typeof XMLDocument == "undefined" && typeof Document != "undefined"){ XMLDocument = Document; } +//This breaks for(x in o) loops in the old Safari +if(_SARISSA_IS_SAFARI_OLD){ + HTMLHtmlElement = document.createElement("html").constructor; + Node = HTMLElement = {}; + HTMLElement.prototype = HTMLHtmlElement.__proto__.__proto__; + HTMLDocument = Document = document.constructor; + var x = new DOMParser(); + XMLDocument = x.constructor; + Element = x.parseFromString("", "text/xml").documentElement.constructor; + x = null; +} +if(typeof XMLDocument == "undefined" && typeof Document !="undefined"){ XMLDocument = Document; } // IE initialization if(_SARISSA_IS_IE){ @@ -69,8 +84,7 @@ var bFound = false, e; for(var i=0; i < idList.length && !bFound; i++){ try{ - var _ = new ActiveXObject(idList[i]); - _ = _; + var oDoc = new ActiveXObject(idList[i]); var o2Store = idList[i]; bFound = true; }catch (objException){ @@ -96,7 +110,7 @@ */ XMLHttpRequest = function() { if(!_SARISSA_XMLHTTP_PROGID){ - _SARISSA_XMLHTTP_PROGID = Sarissa.pickRecentProgID(["Msxml2.XMLHTTP.4.0", "MSXML2.XMLHTTP.3.0", "MSXML2.XMLHTTP", "Microsoft.XMLHTTP"]); + _SARISSA_XMLHTTP_PROGID = Sarissa.pickRecentProgID(["Msxml2.XMLHTTP.6.0", "MSXML2.XMLHTTP.3.0", "MSXML2.XMLHTTP", "Microsoft.XMLHTTP"]); }; return new ActiveXObject(_SARISSA_XMLHTTP_PROGID); }; @@ -108,7 +122,7 @@ // see non-IE version Sarissa.getDomDocument = function(sUri, sName){ if(!_SARISSA_DOM_PROGID){ - _SARISSA_DOM_PROGID = Sarissa.pickRecentProgID(["Msxml2.DOMDocument.4.0", "Msxml2.DOMDocument.3.0", "MSXML2.DOMDocument", "MSXML.DOMDocument", "Microsoft.XMLDOM"]); + _SARISSA_DOM_PROGID = Sarissa.pickRecentProgID(["Msxml2.DOMDocument.6.0", "Msxml2.DOMDocument.3.0", "MSXML2.DOMDocument", "MSXML.DOMDocument", "Microsoft.XMLDOM"]); }; var oDoc = new ActiveXObject(_SARISSA_DOM_PROGID); // if a root tag name was provided, we need to load it in the DOM object @@ -136,7 +150,7 @@ // see non-IE version Sarissa.getParseErrorText = function (oDoc) { var parseErrorText = Sarissa.PARSED_OK; - if(oDoc.parseError.errorCode != 0){ + if(oDoc && oDoc.parseError && oDoc.parseError.errorCode && oDoc.parseError.errorCode != 0){ parseErrorText = "XML Parsing Error: " + oDoc.parseError.reason + "\nLocation: " + oDoc.parseError.url + "\nLine Number " + oDoc.parseError.line + ", Column " + @@ -165,7 +179,7 @@ */ XSLTProcessor = function(){ if(!_SARISSA_XSLTEMPLATE_PROGID){ - _SARISSA_XSLTEMPLATE_PROGID = Sarissa.pickRecentProgID(["Msxml2.XSLTemplate.4.0", "MSXML2.XSLTemplate.3.0"]); + _SARISSA_XSLTEMPLATE_PROGID = Sarissa.pickRecentProgID(["Msxml2.XSLTemplate.6.0", "MSXML2.XSLTemplate.3.0"]); }; this.template = new ActiveXObject(_SARISSA_XSLTEMPLATE_PROGID); this.processor = null; @@ -177,14 +191,17 @@ */ XSLTProcessor.prototype.importStylesheet = function(xslDoc){ if(!_SARISSA_THREADEDDOM_PROGID){ - _SARISSA_THREADEDDOM_PROGID = Sarissa.pickRecentProgID(["MSXML2.FreeThreadedDOMDocument.4.0", "MSXML2.FreeThreadedDOMDocument.3.0"]); - _SARISSA_DOM_XMLWRITER = Sarissa.pickRecentProgID(["Msxml2.MXXMLWriter.4.0", "Msxml2.MXXMLWriter.3.0", "MSXML2.MXXMLWriter", "MSXML.MXXMLWriter", "Microsoft.XMLDOM"]); + _SARISSA_THREADEDDOM_PROGID = Sarissa.pickRecentProgID(["MSXML2.FreeThreadedDOMDocument.6.0", "MSXML2.FreeThreadedDOMDocument.3.0"]); }; xslDoc.setProperty("SelectionLanguage", "XPath"); xslDoc.setProperty("SelectionNamespaces", "xmlns:xsl='http://www.w3.org/1999/XSL/Transform'"); // convert stylesheet to free threaded var converted = new ActiveXObject(_SARISSA_THREADEDDOM_PROGID); // make included/imported stylesheets work if exist and xsl was originally loaded from url + if (_SARISSA_THREADEDDOM_PROGID == "MSXML2.FreeThreadedDOMDocument.6.0") { + converted.setProperty("AllowDocumentFunction", true); + converted.resolveExternals = true; + }; if(xslDoc.url && xslDoc.selectSingleNode("//xsl:*[local-name() = 'import' or local-name() = 'include']") != null){ converted.async = false; converted.load(xslDoc.url); @@ -196,7 +213,7 @@ this.outputMethod = output ? output.getAttribute("method") : "html"; this.template.stylesheet = converted; this.processor = this.template.createProcessor(); - // (re)set default param values + // for getParameter and clearParameters this.paramsSet = []; }; @@ -207,30 +224,23 @@ */ XSLTProcessor.prototype.transformToDocument = function(sourceDoc){ // fix for bug 1549749 - if(_SARISSA_THREADEDDOM_PROGID == "MSXML2.FreeThreadedDOMDocument.3.0"){ + if(_SARISSA_THREADEDDOM_PROGID){ this.processor.input=sourceDoc; - var outDoc=new ActiveXObject(_SARISSA_DOM_PROGID); - this.processor.output=outDoc; - this.processor.transform(); - return outDoc; } else{ + if(!_SARISSA_DOM_XMLWRITER){ + _SARISSA_DOM_XMLWRITER = Sarissa.pickRecentProgID(["Msxml2.MXXMLWriter.6.0", "Msxml2.MXXMLWriter.3.0", "MSXML2.MXXMLWriter", "MSXML.MXXMLWriter", "Microsoft.XMLDOM"]); + }; this.processor.input = sourceDoc; - var outDoc = new ActiveXObject(_SARISSA_DOM_XMLWRITER); - this.processor.output = outDoc; - this.processor.transform(); - var oDoc = new ActiveXObject(_SARISSA_DOM_PROGID); - oDoc.loadXML(outDoc.output+""); - return oDoc; }; }; @@ -277,19 +287,22 @@ * @argument name The parameter base name * @argument value The new parameter value */ - XSLTProcessor.prototype.setParameter = function(nsURI, name, value){ - /* nsURI is optional but cannot be null */ - if(nsURI){ - this.processor.addParameter(name, value, nsURI); - }else{ - this.processor.addParameter(name, value); - }; - /* update updated params for getParameter */ - if(!this.paramsSet[""+nsURI]){ - this.paramsSet[""+nsURI] = []; - }; - this.paramsSet[""+nsURI][name] = value; - }; + XSLTProcessor.prototype.setParameter = function(nsURI, name, value){ + // make value a zero length string if null to allow clearing + value = value ? value : ""; + // nsURI is optional but cannot be null + if(nsURI){ + this.processor.addParameter(name, value, nsURI); + }else{ + this.processor.addParameter(name, value); + }; + // update updated params for getParameter + nsURI = "" + (nsURI || ""); + if(!this.paramsSet[nsURI]){ + this.paramsSet[nsURI] = new Array(); + }; + this.paramsSet[nsURI][name] = value; + }; /** * Gets a parameter if previously set by setParameter. Returns null * otherwise @@ -298,13 +311,28 @@ * @return The parameter value if reviously set by setParameter, null otherwise */ XSLTProcessor.prototype.getParameter = function(nsURI, name){ - nsURI = nsURI || ""; + nsURI = "" + (nsURI || ""); if(this.paramsSet[nsURI] && this.paramsSet[nsURI][name]){ return this.paramsSet[nsURI][name]; }else{ return null; }; }; + /** + * Clear parameters (set them to default values as defined in the stylesheet itself) + */ + XSLTProcessor.prototype.clearParameters = function(){ + for(var nsURI in this.paramsSet){ + for(var name in this.paramsSet[nsURI]){ + if(nsURI!=""){ + this.processor.addParameter(name, "", nsURI); + }else{ + this.processor.addParameter(name, ""); + }; + }; + }; + this.paramsSet = new Array(); + }; }else{ /* end IE initialization, try to deal with real browsers now ;-) */ if(_SARISSA_HAS_DOM_CREATE_DOCUMENT){ /** @@ -333,8 +361,7 @@ Sarissa.__setReadyState__ = function(oDoc, iReadyState){ oDoc.readyState = iReadyState; oDoc.readystate = iReadyState; - if (oDoc.onreadystatechange != null && - typeof oDoc.onreadystatechange == "function") { + if (oDoc.onreadystatechange != null && typeof oDoc.onreadystatechange == "function") { oDoc.onreadystatechange(); } }; @@ -361,11 +388,10 @@ return oDoc; }; if(window.XMLDocument){ - - //if(window.XMLDocument) , now mainly for opera + // do nothing }// TODO: check if the new document has content before trying to copynodes, check for error handling in DOM 3 LS - else if(_SARISSA_HAS_DOM_FEATURE && (typeof Document != 'undefined') && !Document.prototype.load && document.implementation.hasFeature('LS', '3.0')){ - //Opera 9 may get the XPath branch which gives creates XMLDocument, therefore it doesn't reach here which is good + else if(_SARISSA_HAS_DOM_FEATURE && window.Document && !Document.prototype.load && document.implementation.hasFeature('LS', '3.0')){ + //Opera 9 may get the XPath branch which gives creates XMLDocument, therefore it doesn't reach here which is good /** *

Factory method to obtain a new DOM Document object

* @argument sUri the namespace of the root node (if any) @@ -421,27 +447,41 @@ }; }; -if(!document.importNode && _SARISSA_IS_IE){ +if((typeof(document.importNode) == "undefined") && _SARISSA_IS_IE){ try{ /** - * Implementation of importNode for the context window document in IE + * Implementation of importNode for the context window document in IE. + * If oNode is a TextNode, bChildren is ignored. * @param oNode the Node to import * @param bChildren whether to include the children of oNode * @returns the imported node for further use */ document.importNode = function(oNode, bChildren){ + var tmp; if (oNode.nodeName=='#text') { - return document.createTextNode(oNode.data); - } - var tmp = document.createElement("div"); - - var pNode = (oNode.nodeName.toLowerCase()=='tbody')? oNode.parentNode: oNode; - if(bChildren){ - tmp.innerHTML = pNode.xml ? pNode.xml : pNode.outerHTML; - }else{ - tmp.innerHTML = pNode.xml ? pNode.cloneNode(false).xml : pNode.cloneNode(false).outerHTML; + return document.createTextElement(oNode.data); + } + else { + if(oNode.nodeName == "tbody" || oNode.nodeName == "tr"){ + tmp = document.createElement("table"); + } + else if(oNode.nodeName == "td"){ + tmp = document.createElement("tr"); + } + else if(oNode.nodeName == "option"){ + tmp = document.createElement("select"); + } + else{ + tmp = document.createElement("div"); + }; + if(bChildren){ + tmp.innerHTML = oNode.xml ? oNode.xml : oNode.outerHTML; + }else{ + tmp.innerHTML = oNode.xml ? oNode.cloneNode(false).xml : oNode.cloneNode(false).outerHTML; + }; + return tmp.getElementsByTagName("*")[0]; }; - return tmp.getElementsByTagName(oNode.nodeName.replace(/^[^:]*:/,''))[0]; + }; }catch(e){ }; }; @@ -479,18 +519,18 @@ var nodeType = node.nodeType; if(nodeType == Node.TEXT_NODE || nodeType == Node.CDATA_SECTION_NODE){ s += node.data; - } else if(deep == true && - (nodeType == Node.ELEMENT_NODE || - nodeType == Node.DOCUMENT_NODE || - nodeType == Node.DOCUMENT_FRAGMENT_NODE)){ + } else if(deep == true + && (nodeType == Node.ELEMENT_NODE + || nodeType == Node.DOCUMENT_NODE + || nodeType == Node.DOCUMENT_FRAGMENT_NODE)){ s += Sarissa.getText(node, true); }; }; return s; }; -if(!window.XMLSerializer && - Sarissa.getDomDocument && - Sarissa.getDomDocument("","foo", null).xml){ +if(!window.XMLSerializer + && Sarissa.getDomDocument + && Sarissa.getDomDocument("","foo", null).xml){ /** * Utility class to serialize DOM Node objects to XML strings * @constructor @@ -530,6 +570,10 @@ * @argument bPreserveExisting whether to preserve the original content of nodeTo, default is false */ Sarissa.copyChildNodes = function(nodeFrom, nodeTo, bPreserveExisting) { + if(_SARISSA_IS_SAFARI && nodeTo.nodeType == Node.DOCUMENT_NODE){ // SAFARI_OLD ?? + nodeTo = nodeTo.documentElement; //Appearantly there's a bug in safari where you can't appendChild to a document node + } + if((!nodeFrom) || (!nodeTo)){ throw "Both source and destination nodes must be provided"; }; @@ -572,7 +616,7 @@ }; } else { var ownerDoc = nodeTo.nodeType == Node.DOCUMENT_NODE ? nodeTo : nodeTo.ownerDocument; - if(ownerDoc.importNode) { + if(typeof(ownerDoc.importNode) != "undefined") { for(var i=0;i < nodes.length;i++) { nodeTo.appendChild(ownerDoc.importNode(nodes[i], true)); }; @@ -597,9 +641,8 @@ indentSpace = indentSpace?indentSpace:''; var s = indentSpace + '<' + objectName + '>'; var isLeaf = false; - if(!(anyObject instanceof Object) || anyObject instanceof Number || - anyObject instanceof String || anyObject instanceof Boolean || - anyObject instanceof Date){ + if(!(anyObject instanceof Object) || anyObject instanceof Number || anyObject instanceof String + || anyObject instanceof Boolean || anyObject instanceof Date){ s += Sarissa.escape(""+anyObject); isLeaf = true; }else{ @@ -618,11 +661,11 @@ * @param sXml the string to escape */ Sarissa.escape = function(sXml){ - return sXml.replace(/&/g, "&"). - replace(//g, ">"). - replace(/"/g, """). - replace(/'/g, "'"); + return sXml.replace(/&/g, "&") + .replace(//g, ">") + .replace(/"/g, """) + .replace(/'/g, "'"); }; /** @@ -631,10 +674,10 @@ * @param sXml the string to unescape */ Sarissa.unescape = function(sXml){ - return sXml.replace(/'/g,"'"). - replace(/"/g,"\""). - replace(/>/g,">"). - replace(/</g,"<"). - replace(/&/g,"&"); + return sXml.replace(/'/g,"'") + .replace(/"/g,"\"") + .replace(/>/g,">") + .replace(/</g,"<") + .replace(/&/g,"&"); }; // EOF From duncan at codespeak.net Thu Sep 27 11:56:55 2007 From: duncan at codespeak.net (duncan at codespeak.net) Date: Thu, 27 Sep 2007 11:56:55 +0200 (CEST) Subject: [kupu-checkins] r46940 - kupu/trunk/kupu/common Message-ID: <20070927095655.529F48170@code0.codespeak.net> Author: duncan Date: Thu Sep 27 11:56:54 2007 New Revision: 46940 Modified: kupu/trunk/kupu/common/sarissa.js Log: Use sarissa.js from sarissa 0.9.8.1 (with no fixes). Still a few differences in sarissa_ieemu_xpath.js though: I forgot to send those ones to Manos :( Modified: kupu/trunk/kupu/common/sarissa.js ============================================================================== --- kupu/trunk/kupu/common/sarissa.js (original) +++ kupu/trunk/kupu/common/sarissa.js Thu Sep 27 11:56:54 2007 @@ -6,7 +6,8 @@ * The library supports Gecko based browsers like Mozilla and Firefox, * Internet Explorer (5.5+ with MSXML3.0+), Konqueror, Safari and a little of Opera * @version ${project.version} - * @author: Manos Batsis, mailto: mbatsis at users full stop sourceforge full stop net + * @author: @author: Copyright 2004-2007 Emmanouil Batsis, mailto: mbatsis at users full stop sourceforge full stop net + * * ==================================================================== * Licence * ==================================================================== @@ -17,6 +18,7 @@ * In case your copy of Sarissa does not include the license texts, you may find * them online in various formats at http://www.gnu.org and * http://www.apache.org. + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY * KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE * WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE @@ -198,10 +200,13 @@ // convert stylesheet to free threaded var converted = new ActiveXObject(_SARISSA_THREADEDDOM_PROGID); // make included/imported stylesheets work if exist and xsl was originally loaded from url - if (_SARISSA_THREADEDDOM_PROGID == "MSXML2.FreeThreadedDOMDocument.6.0") { - converted.setProperty("AllowDocumentFunction", true); + try{ converted.resolveExternals = true; - }; + converted.setProperty("AllowDocumentFunction", true); + } + catch(e){ + // Ignore. "AllowDocumentFunction" is only supported in MSXML 3.0 SP4 and later. + }; if(xslDoc.url && xslDoc.selectSingleNode("//xsl:*[local-name() = 'import' or local-name() = 'include']") != null){ converted.async = false; converted.load(xslDoc.url); @@ -630,12 +635,12 @@ }; /** - *

Serialize any object to an XML string. All properties are serialized using the property name + *

Serialize any non DOM object to an XML string. All properties are serialized using the property name * as the XML element name. Array elements are rendered as array-item elements, * using their index/key as the value of the key attribute.

* @argument anyObject the object to serialize * @argument objectName a name for that object - * @return the XML serializationj of the given object as a string + * @return the XML serialization of the given object as a string */ Sarissa.xmlize = function(anyObject, objectName, indentSpace){ indentSpace = indentSpace?indentSpace:''; From duncan at codespeak.net Thu Sep 27 13:58:51 2007 From: duncan at codespeak.net (duncan at codespeak.net) Date: Thu, 27 Sep 2007 13:58:51 +0200 (CEST) Subject: [kupu-checkins] r46948 - kupu/trunk/kupu/plone/kupu_references Message-ID: <20070927115851.D0F038190@code0.codespeak.net> Author: duncan Date: Thu Sep 27 13:58:51 2007 New Revision: 46948 Modified: kupu/trunk/kupu/plone/kupu_references/referencebrowser.pt Log: Fix for Plone ticket #7140: kupu fails with danish letters in title. Modified: kupu/trunk/kupu/plone/kupu_references/referencebrowser.pt ============================================================================== --- kupu/trunk/kupu/plone/kupu_references/referencebrowser.pt (original) +++ kupu/trunk/kupu/plone/kupu_references/referencebrowser.pt Thu Sep 27 13:58:51 2007 @@ -85,15 +85,15 @@
Author: duncan Date: Thu Sep 27 14:40:45 2007 New Revision: 46955 Modified: kupu/trunk/kupu/common/kupubasetools.js kupu/trunk/kupu/common/kupucontentfilters.js kupu/trunk/kupu/common/kupudrawers.js kupu/trunk/kupu/common/kupueditor.js Log: Fix for Plone ticket #7139 (Kupu Manage Anchors not working in inline edit) Modified: kupu/trunk/kupu/common/kupubasetools.js ============================================================================== --- kupu/trunk/kupu/common/kupubasetools.js (original) +++ kupu/trunk/kupu/common/kupubasetools.js Thu Sep 27 14:40:45 2007 @@ -677,7 +677,7 @@ this._removeStyle = function() { function needbreak(e) { if (isblock && e) { - if (blocktagre.test(e.nodeName) || e.nodeName=='BR') return; + if (blocktagre.test(e.nodeName) || /^br$/i.test(e.nodeName)) return; parent.insertBefore(ed.newElement('br'), n); } } @@ -1711,8 +1711,7 @@ for (var i=0; i < currtable.childNodes.length; i++) { var currtbody = currtable.childNodes[i]; if (currtbody.nodeType != 1 || - (currtbody.nodeName.toUpperCase() != "THEAD" && - currtbody.nodeName.toUpperCase() != "TBODY")) { + (/^thead|tbody$/i.test(currtbody.nodeName))) { continue; } for (var j=0; j < currtbody.childNodes.length; j++) { @@ -1808,7 +1807,7 @@ this._isBodyRow = function(row) { for (var node = row.firstChild; node; node=node.nextSibling) { - if (/TD/.test(node.nodeName)) { + if (/^td$/i.test(node.nodeName)) { return true; } } @@ -1819,7 +1818,7 @@ // Remove formatted div or p from a cell var nxt, n; for (var node = el.firstChild; node;) { - if (/^DIV|P$/i.test(node.nodeName)) { + if (/^div|p$/i.test(node.nodeName)) { for (var n = node.firstChild; n;) { var nxt = n.nextSibling; el.insertBefore(n, node); // Move nodes out of div @@ -1857,7 +1856,7 @@ var row = rows[i]; var currnumcols = 0; for (var node = row.firstChild; node; node=node.nextSibling) { - if (/td|th/i.test(node.nodeName)) { + if (/^(td|th)$/i.test(node.nodeName)) { currnumcols += parseInt(node.getAttribute('colSpan') || '1'); }; }; @@ -1879,7 +1878,7 @@ } for (var node = row.firstChild; node;) { var nxt = node.nextSibling; - if (/TD|TH/.test(node.nodeName)) { + if (/^(td|th)$/i.test(node.nodeName)) { this._cleanCell(node); newrow.appendChild(node); }; @@ -1936,13 +1935,13 @@ var hrows = [], brows = [], frows = []; for (var node = table.firstChild; node; node = node.nextSibling) { - var nodeName = node.nodeName; - if (/TR/.test(node.nodeName)) { + var nodeName = node.nodeName.toLowerCase(); + if (/tr/i.test(node.nodeName)) { brows.push(node); - } else if (/THEAD|TBODY|TFOOT/.test(node.nodeName)) { - var rows = nodeName=='THEAD' ? hrows : nodeName=='TFOOT' ? frows : brows; + } else if (/thead|tbody|tfoot/i.test(node.nodeName)) { + var rows = nodeName=='thead' ? hrows : nodeName=='tfoot' ? frows : brows; for (var inode = node.firstChild; inode; inode = inode.nextSibling) { - if (/TR/.test(inode.nodeName)) { + if (/tr/i.test(inode.nodeName)) { rows.push(inode); }; }; @@ -2308,11 +2307,12 @@ var path = ''; var url = null; // for links we want to display the url too var currnode = selNode; - while (currnode != null && currnode.nodeName != '#document') { - if (currnode.nodeName.toLowerCase() == 'a') { + var nn; + while (currnode != null && (nn=currnode.nodeName.toLowerCase()) != '#document') { + if (nn=='a') { url = currnode.getAttribute('href'); }; - path = '/' + currnode.nodeName.toLowerCase() + path; + path = '/' + nn + path; currnode = currnode.parentNode; } Modified: kupu/trunk/kupu/common/kupucontentfilters.js ============================================================================== --- kupu/trunk/kupu/common/kupucontentfilters.js (original) +++ kupu/trunk/kupu/common/kupucontentfilters.js Thu Sep 27 14:40:45 2007 @@ -724,7 +724,7 @@ var kid = kids[i]; if (kid.parentNode !== htmlnode) { - if (kid.tagName == 'BODY') { + if (kid.tagName.toLowerCase()=='body') { if (nodename != 'html') continue; } else if (kid.parentNode.tagName === htmlnode.tagName) { continue; // IE bug: nodes appear multiple places Modified: kupu/trunk/kupu/common/kupudrawers.js ============================================================================== --- kupu/trunk/kupu/common/kupudrawers.js (original) +++ kupu/trunk/kupu/common/kupudrawers.js Thu Sep 27 14:40:45 2007 @@ -155,9 +155,9 @@ event = event || window.event; var target = event.currentTarget || event.srcElement; var el = target; - while (el.nodeName != 'LI') { el = el.parentNode; }; + while (!/^li$/i.test(el.nodeName)) { el = el.parentNode; }; var thistab = el; - while (el.nodeName != 'UL') { el = el.parentNode; }; + while (!/^ul$/i.test(el.nodeName)) { el = el.parentNode; }; var tabs = el.getElementsByTagName('li'); for (var i = 0; i < tabs.length; i++) { var el = tabs[i]; @@ -243,7 +243,7 @@ proto.anchorText = function(a) { // Text inside anchor, or immediate sibling block tag, or parent block. - var blocktag = /^DIV|P|BODY|TD|H.$/; + var blocktag = /^div|p|body|td|h.$/i; var txt = ''; var prefix = '#' + a.name; @@ -254,7 +254,7 @@ } for (var sibling = node.nextSibling; sibling && !txt; sibling = sibling.nextSibling) { - if (sibling.nodeName=='#text') { + if (sibling.nodeName.toLowerCase()=='#text') { txt = sibling.data.strip(); } else { txt += sibling.textContent || sibling.innerText ||''; @@ -1709,7 +1709,7 @@ if (level==0) { toc.appendChild(li); } else { - if (!toc.lastChild || toc.lastChild.nodeName != 'ul') { + if (!toc.lastChild || toc.lastChild.nodeName.toLowerCase() != 'ul') { toc.appendChild(ed.newElement('ul')); } toc.lastChild.appendChild(li); @@ -1733,10 +1733,10 @@ }; } var node = ed.getSelection().parentElement(); - if (node.nodeName == 'BODY') { + if (node.nodeName.toLowerCase() == 'body') { node.insertBefore(toc, node.firstChild); } else { - while (node.parentNode.nodeName != 'BODY') { + while (node.parentNode.nodeName.toLowerCase() != 'body') { node = node.parentNode; } node.parentNode.insertBefore(toc, node); Modified: kupu/trunk/kupu/common/kupueditor.js ============================================================================== --- kupu/trunk/kupu/common/kupueditor.js (original) +++ kupu/trunk/kupu/common/kupueditor.js Thu Sep 27 14:40:45 2007 @@ -559,7 +559,7 @@ if (this._isDocumentSelected()) { var cursel = this.getInnerDocument().selection; var currange = cursel.createRange(); - if (cursel.type=="Control" && currange.item(0).nodeName=="BODY") { + if (cursel.type=="Control" && currange.item(0).nodeName.toLowerCase()=="body") { /* This happens when you try to active an embedded * object */ this._restoreSelection(true); From duncan at codespeak.net Thu Sep 27 15:30:54 2007 From: duncan at codespeak.net (duncan at codespeak.net) Date: Thu, 27 Sep 2007 15:30:54 +0200 (CEST) Subject: [kupu-checkins] r46958 - in kupu/trunk/kupu/plone: . kupu_references Message-ID: <20070927133054.217DE8141@code0.codespeak.net> Author: duncan Date: Thu Sep 27 15:30:52 2007 New Revision: 46958 Modified: kupu/trunk/kupu/plone/kupu_references/referencebrowser.pt kupu/trunk/kupu/plone/plonedrawers.py Log: Re-fixed Plone ticket #7140: kupu fails with danish letters in title, and cleaned up translated labels. Modified: kupu/trunk/kupu/plone/kupu_references/referencebrowser.pt ============================================================================== --- kupu/trunk/kupu/plone/kupu_references/referencebrowser.pt (original) +++ kupu/trunk/kupu/plone/kupu_references/referencebrowser.pt Thu Sep 27 15:30:52 2007 @@ -85,15 +85,15 @@
An HTML attachment was scrubbed... URL: http://codespeak.net/pipermail/kupu-checkins/attachments/20070929/8eae103b/attachment.htm