summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: d932a44)
raw | patch | inline | side by side (parent: d932a44)
author | richard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Sun, 15 Dec 2002 23:55:34 +0000 (23:55 +0000) | ||
committer | richard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Sun, 15 Dec 2002 23:55:34 +0000 (23:55 +0000) |
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@1411 57a73879-2fb5-44c3-a270-3262357dd7e2
diff --git a/CHANGES.txt b/CHANGES.txt
index a949424eb0f902fff3b4cc6842db0e6dc9a1e20a..28cc97e3ddaf5342e69b85819fe6bc8d70d04895 100644 (file)
--- a/CHANGES.txt
+++ b/CHANGES.txt
2003-01-?? 0.5.4
- key the templates cache off full path, not filename
- implemented whole-database locking
+- hyperlinking of special text (url, email, item designator) in messages
2002-12-11 0.5.3
diff --git a/TODO.txt b/TODO.txt
index d21f0cf65b30bf88f16ecfd089e761b376577161..556029e1b99356ad4422ba7ad9e7c09533cd458e 100644 (file)
--- a/TODO.txt
+++ b/TODO.txt
pending web re-enable auth basic http auth
pending web allow multilink selections to select a "none" element to allow
people with broken browsers to select nothing?
-pending web automagically link designators
pending web add checkbox-based removal/addition for multilink entries
(eg "add me"/"remove me" for nosy list)
pending web search "refinement" - pre-fill the search page with the
diff --git a/roundup/cgi/client.py b/roundup/cgi/client.py
index e338d7a389814ffcd6d6a87a31c2a4b4724b797c..856bad8da170d1871ad1866c67051c73877aba49 100644 (file)
--- a/roundup/cgi/client.py
+++ b/roundup/cgi/client.py
-# $Id: client.py,v 1.62 2002-12-11 01:46:46 richard Exp $
+# $Id: client.py,v 1.63 2002-12-15 23:55:33 richard Exp $
__doc__ = """
WWW request handler (also used in the stand-alone server).
else:
propname = key
-
# does the property exist?
if not properties.has_key(propname):
if mlaction != 'set':
index f87cdb696ad2456c9b264ea934d0c3d595d97d5b..b65dec552b519b0e04b3ff85f59ad41e810edf9e 100644 (file)
return cmp(self._value, other)
class StringHTMLProperty(HTMLProperty):
- def plain(self, escape=0):
+ url_re = re.compile(r'\w{3,6}://\S+')
+ email_re = re.compile(r'\w+@[\w\.\-]+')
+ designator_re = re.compile(r'([a-z_]+)([\d+])')
+ def _url_repl(self, match):
+ s = match.group(0)
+ return '<a href="%s">%s</a>'%(s, s)
+ def _email_repl(self, match):
+ s = match.group(0)
+ return '<a href="mailto:%s">%s</a>'%(s, s)
+ def _designator_repl(self, match):
+ s = match.group(0)
+ s1 = match.group(1)
+ s2 = match.group(2)
+ try:
+ # make sure s1 is a valid tracker classname
+ self._db.getclass(s1)
+ return '<a href="%s">%s %s</a>'%(s, s1, s2)
+ except KeyError:
+ return '%s%s'%(s1, s2)
+
+ def plain(self, escape=0, hyperlink=1):
''' Render a "plain" representation of the property
+
+ "escape" turns on/off HTML quoting
+ "hyperlink" turns on/off in-text hyperlinking of URLs, email
+ addresses and designators
'''
if self._value is None:
return ''
if escape:
- return cgi.escape(str(self._value))
- return str(self._value)
+ s = cgi.escape(str(self._value))
+ else:
+ s = self._value
+ if hyperlink:
+ s = self.url_re.sub(self._url_repl, s)
+ s = self.email_re.sub(self._email_repl, s)
+ s = self.designator_re.sub(self._designator_repl, s)
+ return s
def stext(self, escape=0):
''' Render the value of the property as StructuredText.
index dcba3e0646f5620d834c412188a52b63f598b228..abe2ce75a7233d9444ee9a9944da87ad7a1a4a5c 100644 (file)
</tr>
<tr>
<td colspan="4" class="content">
- <pre tal:content="msg/content">content</pre>
+ <pre tal:content="structure msg/content">content</pre>
</td>
</tr>
</tal:block>