From: richard Date: Tue, 2 Apr 2002 01:40:59 +0000 (+0000) Subject: . link() htmltemplate function now has a "showid" option for links and X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=186c02a756e1ed2b5d055b798434a4a80b00f0ea;p=roundup.git . link() htmltemplate function now has a "showid" option for links and multilinks. When true, it only displays the linked node id as the anchor text. The link value is displayed as a tooltip using the title anchor attribute. git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@687 57a73879-2fb5-44c3-a270-3262357dd7e2 --- diff --git a/CHANGES.txt b/CHANGES.txt index 1460cbb..bca0022 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,7 +1,22 @@ This file contains the changes to the Roundup system over time. The entries are given with the most recent entry first. -2002-03-?? - 0.4.1 +0.4.2 +Feature: + . link() htmltemplate function now has a "showid" option for links and + multilinks. When true, it only displays the linked node id as the anchor + text. The link value is displayed as a tooltip using the title anchor + attribute. + To use in eg. the superseder field, have something like this: + + + + +
View: +
+ + +2002-03-25 - 0.4.1 Feature: . use blobfiles in back_anydbm which is used in back_bsddb. change test_db as dirlist does not work for subdirectories. diff --git a/doc/customizing.txt b/doc/customizing.txt index 9d3f202..cf9f18a 100644 --- a/doc/customizing.txt +++ b/doc/customizing.txt @@ -321,6 +321,8 @@ highly customized. | |text. | | |Options: | | |property (property name) - the property to use in the second case. | +| |showid - use the linked node id as the link text (linked node | +| | "value" will be set as a tooltip) | +---------+-------------------------------------------------------------------+ |count |For a Multilink property, display a count of the number of links in| | |the list. | @@ -515,6 +517,21 @@ As shown in the example, the editor template can also request the display of a "note" field, which is a text area for entering a note to go along with a change. +The tag used in the index may also be used here - it checks to see +if the nominated Multilink property has any entries. This can be used to +eliminate sections of the editor section if the property has no entries:: + + + + + +
View: +
+ + +The "View: " part with the links will only display if the superseder property +has values. + When a change is submitted, the system automatically generates a message describing the changed properties. @@ -543,7 +560,7 @@ message nodes, and selecting a message takes you to its content. The tag used in the index may also be used here - it checks to see if the nominated Multilink property has any entries. This can be used to -eliminate sections of the spool section if the property has no entries.:: +eliminate sections of the spool section if the property has no entries:: diff --git a/roundup/htmltemplate.py b/roundup/htmltemplate.py index d85684f..59ce26c 100644 --- a/roundup/htmltemplate.py +++ b/roundup/htmltemplate.py @@ -15,13 +15,13 @@ # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. # -# $Id: htmltemplate.py,v 1.84 2002-03-29 19:41:48 rochecompaan Exp $ +# $Id: htmltemplate.py,v 1.85 2002-04-02 01:40:58 richard Exp $ __doc__ = """ Template engine. """ -import os, re, StringIO, urllib, cgi, errno, types +import os, re, StringIO, urllib, cgi, errno, types, urllib import hyperdb, date from i18n import _ @@ -331,7 +331,7 @@ class TemplateFunctions: return _('[Menu: not a link]') #XXX deviates from spec - def do_link(self, property=None, is_download=0): + def do_link(self, property=None, is_download=0, showid=0): '''For a Link or Multilink property, display the names of the linked nodes, hyperlinked to the item views on those nodes. For other properties, link to this node with the property as the @@ -355,11 +355,17 @@ class TemplateFunctions: linkcl = self.db.classes[linkname] k = linkcl.labelprop() linkvalue = cgi.escape(linkcl.get(value, k)) + if showid: + label = value + title = ' title="%s"'%linkvalue + # note ... this should be urllib.quote(linkcl.get(value, k)) + else: + label = linkvalue if is_download: - return '%s'%(linkname, value, - linkvalue, linkvalue) + return '%s'%(linkname, value, + linkvalue, title, label) else: - return '%s'%(linkname, value, linkvalue) + return '%s'%(linkname, value, title, label) if isinstance(propclass, hyperdb.Multilink): linkname = propclass.classname linkcl = self.db.classes[linkname] @@ -367,12 +373,18 @@ class TemplateFunctions: l = [] for value in value: linkvalue = cgi.escape(linkcl.get(value, k)) + if showid: + label = value + title = ' title="%s"'%linkvalue + # note ... this should be urllib.quote(linkcl.get(value, k)) + else: + label = linkvalue if is_download: - l.append('%s'%(linkname, value, - linkvalue, linkvalue)) + l.append('%s'%(linkname, value, + linkvalue, title, label)) else: - l.append('%s'%(linkname, value, - linkvalue)) + l.append('%s'%(linkname, value, + title, label)) return ', '.join(l) if is_download: return '%s'%(self.classname, self.nodeid, @@ -1114,6 +1126,10 @@ class NewItemTemplate(TemplateFunctions): # # $Log: not supported by cvs2svn $ +# Revision 1.84 2002/03/29 19:41:48 rochecompaan +# . Fixed display of mutlilink properties when using the template +# functions, menu and plain. +# # Revision 1.83 2002/02/27 04:14:31 richard # Ran it through pychecker, made fixes # diff --git a/roundup/templates/classic/html/issue.item b/roundup/templates/classic/html/issue.item index 6d3dddd..53d058a 100644 --- a/roundup/templates/classic/html/issue.item +++ b/roundup/templates/classic/html/issue.item @@ -23,8 +23,13 @@ Superseder - - + + + + +
View: +
+ Nosy List diff --git a/roundup/templates/extended/html/issue.item b/roundup/templates/extended/html/issue.item index 0bdde8c..84cfecb 100644 --- a/roundup/templates/extended/html/issue.item +++ b/roundup/templates/extended/html/issue.item @@ -1,4 +1,4 @@ - + @@ -51,11 +51,21 @@ - + - + diff --git a/roundup/templates/extended/html/support.item b/roundup/templates/extended/html/support.item index daa2d7a..71ce756 100644 --- a/roundup/templates/extended/html/support.item +++ b/roundup/templates/extended/html/support.item @@ -1,4 +1,4 @@ - +
Superseder - + + + +
View: +
+
Support call - + + + +
View: +
+
@@ -49,7 +49,13 @@ - +
Superseder + + + +
View: +
+
Nosy List