[Checkins] SVN: zope3org/trunk/src/zorg/wikification/browser/ Fixed
encoding problems in the WikiLink processor.
Uwe Oestermeier
uwe_oestermeier at iwm-kmrc.de
Wed Mar 22 08:02:53 EST 2006
Log message for revision 66117:
Fixed encoding problems in the WikiLink processor.
Changed:
U zope3org/trunk/src/zorg/wikification/browser/scripts/link.js
U zope3org/trunk/src/zorg/wikification/browser/wikilink.py
U zope3org/trunk/src/zorg/wikification/browser/wikipage.py
-=-
Modified: zope3org/trunk/src/zorg/wikification/browser/scripts/link.js
===================================================================
--- zope3org/trunk/src/zorg/wikification/browser/scripts/link.js 2006-03-21 18:14:44 UTC (rev 66116)
+++ zope3org/trunk/src/zorg/wikification/browser/scripts/link.js 2006-03-22 13:02:51 UTC (rev 66117)
@@ -8,7 +8,6 @@
return clickreturnvalue()
}
-
function hidelinkmenu(obj, e, dropmenuID) {
if (typeof dropmenuobj!="undefined") //hide previous menu
@@ -26,15 +25,21 @@
var offsets = Position.cumulativeOffset(obj)
- var x = offsets[0]
- var y = Math.max(Event.pointerY(e), offsets[1], dropmenuobj.y)
+ var x = offsets[0] // offsets[0]-clearbrowseredge(obj, "leftedge")+"px"
+ var y = offsets[1]
+
+ if (dropmenuobj.y) {
+ y = Math.max(Event.pointerY(e), dropmenuobj.y, y) // -clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+"px"
+ }
+
dropmenuobj.x=x
dropmenuobj.y=y
+
+ dropmenuobj.style.left=x + "px"
+ dropmenuobj.style.top=y + "px"
- dropmenuobj.style.left=x // -clearbrowseredge(obj, "leftedge")+"px"
- dropmenuobj.style.top=y // -clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+"px"
+ $('menu_pos').innerHTML = "x: " + x + ", y: " + y + "offsets[0]: " + offsets[0] + "offsets[1]: " + offsets[1]
- oldLinkMenuTarget = newLinkMenuTarget
}
}
Modified: zope3org/trunk/src/zorg/wikification/browser/wikilink.py
===================================================================
--- zope3org/trunk/src/zorg/wikification/browser/wikilink.py 2006-03-21 18:14:44 UTC (rev 66116)
+++ zope3org/trunk/src/zorg/wikification/browser/wikilink.py 2006-03-22 13:02:51 UTC (rev 66117)
@@ -64,9 +64,9 @@
def textLink(self) :
wikified, link = self.processor.wikifyLink(self.link)
if wikified :
- pattern = u'<a class="wiki-link" href="%s">[%s]</a>'
+ pattern = '<a class="wiki-link" href="%s">[%s]</a>'
else :
- pattern = u'<a class="wiki-link" href="%s">%s</a>'
+ pattern = '<a class="wiki-link" href="%s">%s</a>'
return pattern % (link, self.label)
def _tagAttrs(self, attrs) :
@@ -81,10 +81,10 @@
wikified, link = self.processor.wikifyLink(self.link)
if wikified :
- pattern = u'<a href="%s" class="wiki-link"%s>'
+ pattern = '<a href="%s" class="wiki-link"%s>'
return pattern % (link, self._tagAttrs(attrs))
else :
- pattern = u'<a href="%s"%s>'
+ pattern = '<a href="%s"%s>'
return pattern % (link, self._tagAttrs(attrs))
@@ -297,17 +297,17 @@
>>> link_processor = BaseLinkProcessor(page)
>>> link_processor.handle_data('A [link]')
>>> link_processor.pieces
- [u'A <a class="wiki-link" href="...@@wikiedit.html?add=link">[link]</a>']
+ ['A <a class="wiki-link" href="...@@wikiedit.html?add=link">[link]</a>']
>>> link_processor = BaseLinkProcessor(page)
>>> link_processor.handle_data('A [link] and [another one]')
>>> link_processor.pieces
- [u'A <a ...>[link]</a> and <a ...>[another one]</a>']
+ ['A <a ...>[link]</a> and <a ...>[another one]</a>']
"""
-
+
if self.placeholder is not None :
self.placeholder.label += text
self.pieces.append(text)
@@ -329,11 +329,11 @@
result += placeholder.textLink()
self.placeholder = None
- result += text[end:]
+ result += text[end:]
+
self.pieces.append(result)
-
-
+
class MenuPlaceholder(Placeholder) :
""" A placeholder, that offers various edit options for the user.
Placeholders are created by the link processor on demand and are referenced
@@ -345,10 +345,10 @@
>>> page = WikiPage(site, TestRequest())
>>> processor = BaseLinkProcessor(page)
- >>> placeholder1 = processor.createPlaceholder(u"Label", "http://link")
+ >>> placeholder1 = processor.createPlaceholder("Label", "http://link")
>>> placeholder1.index
0
- >>> placeholder2 = processor.createPlaceholder(u"Label", "http://link")
+ >>> placeholder2 = processor.createPlaceholder("Label", "http://link")
>>> placeholder2.index
1
@@ -375,7 +375,7 @@
attrs.append(("id", self.link_id))
return self._link % (link, self.onMouseOver, self._tagAttrs(attrs))
else :
- pattern = u'<a href="%s"%s>'
+ pattern = '<a href="%s"%s>'
return pattern % (self.link, self._tagAttrs(attrs))
def textLink(self) :
@@ -398,7 +398,7 @@
def startTag(self, attrs) :
""" Called when a starttag for a placeholder is detected. """
- pattern = u'<a href="%s"%s>'
+ pattern = '<a href="%s"%s>'
return pattern % (self.link, self._tagAttrs(attrs))
class RenamedPlaceholder(SavingPlaceholder) :
@@ -453,7 +453,7 @@
if description :
dc.description = description
- return name # zapi.absoluteURL(contained, self.page.request)
+ return name.encode("utf-8")
def textLink(self) :
name = self.addObject()
@@ -461,7 +461,7 @@
def startTag(self, attrs) :
name = self.addObject()
- pattern = u'<a href="%s"%s>'
+ pattern = '<a href="%s"%s>'
return pattern % (name, self._tagAttrs(attrs))
Modified: zope3org/trunk/src/zorg/wikification/browser/wikipage.py
===================================================================
--- zope3org/trunk/src/zorg/wikification/browser/wikipage.py 2006-03-21 18:14:44 UTC (rev 66116)
+++ zope3org/trunk/src/zorg/wikification/browser/wikipage.py 2006-03-22 13:02:51 UTC (rev 66117)
@@ -97,12 +97,8 @@
self.dc = dc
self.title = dc.title or self.untitled
- self.language = dc.Language()
+ self.language = dc.Language()
-
- def prepare(self) :
- pass
-
def verb(self) :
""" Returns a descriptive verb. """
return _('View')
@@ -228,7 +224,8 @@
def renderBody(self) :
body = self.getBody()
if body is not None :
- return self.wikify(unicode(body, encoding="utf-8"))
+ wikified = self.wikify(body)
+ return unicode(wikified, encoding="utf-8")
return u"Sorry, not wikifiable at the moment."
@@ -462,9 +459,9 @@
factory = dict(rest=RestEditor, kupu=KupuEditor, tinymce=TinyMCEEditor)
chooser = EditOptions
+
_main = None
-
-
+
def __init__(self, context, request) :
super(WikiEditor, self).__init__(context, request)
self.editor = self.parameter('editor', storage=self.session)
@@ -492,7 +489,6 @@
processor = ILinkProcessor(self)
processor.command = cmd
processor.link_id = link_id
-
body = self.getBody()
processor.feed(body)
file = self.getFile()
@@ -537,15 +533,16 @@
def display(self) :
""" Returns the data that should be edited. """
+
file = self.getFile()
return self.main.readFile(file)
def update(self, editor=None):
""" Saves the edited content and redirects to the wiki view. """
+
file = self.getFile()
self.main.saveTo(file)
self.request.response.redirect(self.nextURL())
- #self.request.response.redirect("wiki.html")
class EditWikiContainerPage(WikiContainerPage, EditWikiPage) :
More information about the Checkins
mailing list