summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 1282203)
raw | patch | inline | side by side (parent: 1282203)
author | richard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Wed, 23 Jan 2002 05:10:28 +0000 (05:10 +0000) | ||
committer | richard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Wed, 23 Jan 2002 05:10:28 +0000 (05:10 +0000) |
- download() now implemented correctly, replacing link(is_download=1) [fixed in the
templates, but link(is_download=1) will still work for existing templates]
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@588 57a73879-2fb5-44c3-a270-3262357dd7e2
templates, but link(is_download=1) will still work for existing templates]
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@588 57a73879-2fb5-44c3-a270-3262357dd7e2
diff --git a/doc/index.html b/doc/index.html
index c047a4afa6cec55c809bb7eeac6f731c7946658a..3e05a2f01f968ebb0061063f8497978d2ac83ace 100644 (file)
--- a/doc/index.html
+++ b/doc/index.html
For other properties, link to this node with the property as the text.
<p>
<em>Options:</em><br>
-property (property name) - the property to use in the second case.<br>
-is_download (boolean) - to be used for links te <em>file</em> class nodes -
-this indicates that the URL should have the specified property (usually
-<em>name</em>) appended so that the download has the correct name (instead
-of the node designator.)
+property (property name) - the property to use in the second case.
</td></tr>
<tr><td valign="top"><strong>count</strong></td>
</td></tr>
<tr><td valign="top"><strong>download</strong></td>
-<td>Show a Link("file") or Multilink("file")
-property using links that allow you to download files.
+<td>For a Link or Multilink property, display the names of the linked
+nodes, hyperlinked to the item views on those nodes.
+<p>
+For other properties, link to this node with the property as the text.
+<p>
+In all cases, append the name (key property) of the item to the path so it
+is the name of the file being downloaded.
<p>
<em>Arguments:</em><br>
property (property name) - the property to use.
<p> </p>
<hr>
-$Id: index.html,v 1.26 2002-01-16 04:54:27 richard Exp $
+$Id: index.html,v 1.27 2002-01-23 05:10:27 richard Exp $
<p> </p>
</body></html>
index 4157729b652c808d1cda17673d185532be82da1a..159041051d006b97e815c3a22349bbb18902bbf0 100644 (file)
--- a/roundup/htmltemplate.py
+++ b/roundup/htmltemplate.py
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
#
-# $Id: htmltemplate.py,v 1.68 2002-01-22 22:55:28 richard Exp $
+# $Id: htmltemplate.py,v 1.69 2002-01-23 05:10:27 richard Exp $
__doc__ = """
Template engine.
'''
if not self.nodeid:
return _('[Download: not called from item]')
- propclass = self.properties[property]
- value = self.cl.get(self.nodeid, property)
- if isinstance(propclass, hyperdb.Link):
- linkcl = self.db.classes[propclass.classname]
- linkvalue = linkcl.get(value, k)
- return '<a href="%s%s">%s</a>'%(linkcl, value, linkvalue)
- if isinstance(propclass, hyperdb.Multilink):
- linkcl = self.db.classes[propclass.classname]
- l = []
- for value in value:
- linkvalue = linkcl.get(value, k)
- l.append('<a href="%s%s">%s</a>'%(linkcl, value, linkvalue))
- return ', '.join(l)
- return _('[Download: not a link]')
+ return self.do_link(property, is_download=1)
def do_checklist(self, property, **args):
if not isinstance(propcl, hyperdb.Multilink):
return _('[List: not a Multilink]')
value = self.cl.get(self.nodeid, property)
- value.sort()
+ value.sort()
if reverse:
value.reverse()
comments = {}
history = self.cl.history(self.nodeid)
+ history.sort()
if direction == 'descending':
history.reverse()
for id, evt_date, user, action, args in history:
#
# $Log: not supported by cvs2svn $
+# Revision 1.68 2002/01/22 22:55:28 richard
+# . htmltemplate list() wasn't sorting...
+#
# Revision 1.67 2002/01/22 22:46:22 richard
# more htmltemplate cleanups and unit tests
#
index d8d72092e16ba358cd7ec9b0f203d35394626567..ab57d4464a84e8d73cfbb32b03284220018e2ddf 100644 (file)
-<!-- $Id: file.index,v 1.3 2001-10-21 11:42:15 richard Exp $-->
+<!-- $Id: file.index,v 1.4 2002-01-23 05:10:27 richard Exp $-->
<tr>
<property name="name">
- <td><display call="link('name', is_download=1)"></td>
+ <td><display call="download('name')"></td>
</property>
<property name="type">
<td><display call="plain('type')"></td>
diff --git a/roundup/templates/extended/html/file.index b/roundup/templates/extended/html/file.index
index 50c16972f3c4ab19d17a4d6721fd376d007e7c59..ab69ce68fa4cfea8efffbf6eba98c81c539ebeaa 100644 (file)
-<!-- $Id: file.index,v 1.2 2001-10-21 11:42:15 richard Exp $-->
+<!-- $Id: file.index,v 1.3 2002-01-23 05:10:28 richard Exp $-->
<tr>
<property name="name">
- <td><display call="link('name', is_download=1)"></td>
+ <td><display call="download('name')"></td>
</property>
<property name="type">
<td><display call="plain('type')"></td>
index 37572394865abfc0d1400511246e848d8287c887..d7b15f03965437fa9ffa768c8c38b473ce940052 100644 (file)
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
-# $Id: test_htmltemplate.py,v 1.4 2002-01-22 22:46:22 richard Exp $
+# $Id: test_htmltemplate.py,v 1.5 2002-01-23 05:10:28 richard Exp $
import unittest, cgi
# def do_menu(self, property, size=None, height=None, showid=0):
def testMenu_nonlinks(self):
- self.assertEqual(self.tf.do_menu('string'), _('[Menu: not a link]'))
- self.assertEqual(self.tf.do_menu('date'), _('[Menu: not a link]'))
- self.assertEqual(self.tf.do_menu('interval'), _('[Menu: not a link]'))
- self.assertEqual(self.tf.do_menu('password'), _('[Menu: not a link]'))
+ s = _('[Menu: not a link]')
+ self.assertEqual(self.tf.do_menu('string'), s)
+ self.assertEqual(self.tf.do_menu('date'), s)
+ self.assertEqual(self.tf.do_menu('interval'), s)
+ self.assertEqual(self.tf.do_menu('password'), s)
def testMenu_link(self):
self.assertEqual(self.tf.do_menu('link'), '''<select name="link">
self.assertEqual(self.tf.do_reldate('date', pretty=1),
' 1 January 2000')
+# def do_download(self, property):
+ def testDownload_novalue(self):
+ self.assertEqual(self.tf.do_download('novalue'),
+ _('[no %(propname)s]')%{'propname':'novalue'.capitalize()})
+
+ def testDownload_string(self):
+ self.assertEqual(self.tf.do_download('string'),
+ '<a href="test_class1/Node 1: I am a string">Node 1: '
+ 'I am a string</a>')
+
+ def testDownload_file(self):
+ self.assertEqual(self.tf.do_download('filename', is_download=1),
+ '<a href="test_class1/file.foo">file.foo</a>')
+
+ def testDownload_date(self):
+ self.assertEqual(self.tf.do_download('date'),
+ '<a href="test_class1/2000-01-01.00:00:00">2000-01-01.00:00:00</a>')
+
+ def testDownload_interval(self):
+ self.assertEqual(self.tf.do_download('interval'),
+ '<a href="test_class1/- 3d">- 3d</a>')
+
+ def testDownload_link(self):
+ self.assertEqual(self.tf.do_download('link'),
+ '<a href="other1/the key">the key</a>')
+
+ def testDownload_multilink(self):
+ self.assertEqual(self.tf.do_download('multilink'),
+ '<a href="other1/the key">the key</a>, '
+ '<a href="other2/the key">the key</a>')
+
def suite():
return unittest.makeSuite(NodeCase, 'test')
#
# $Log: not supported by cvs2svn $
+# Revision 1.4 2002/01/22 22:46:22 richard
+# more htmltemplate cleanups and unit tests
+#
# Revision 1.3 2002/01/22 06:35:40 richard
# more htmltemplate tests and cleanup
#