annotate roundup/htmltemplate.py @ 930:3c344e942055

Use same regex to split search terms as used to index text. Fix to back_metakit for not changing journaltag on reopen. Fix htmltemplate's do_link so [No <whatever>] strings are href'd. Fix bogus "nosy edited ok" msg - the **d syntax does NOT share d between caller and callee.
author Gordon B. McMillan <gmcm@users.sourceforge.net>
date Thu, 01 Aug 2002 15:06:26 +0000
parents 3216c4f06ec4
children fdcf16b444a9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
213
d45384bc6420 Added the copyright/license notice to (nearly) all files...
Richard Jones <richard@users.sourceforge.net>
parents: 171
diff changeset
1 #
d45384bc6420 Added the copyright/license notice to (nearly) all files...
Richard Jones <richard@users.sourceforge.net>
parents: 171
diff changeset
2 # Copyright (c) 2001 Bizar Software Pty Ltd (http://www.bizarsoftware.com.au/)
d45384bc6420 Added the copyright/license notice to (nearly) all files...
Richard Jones <richard@users.sourceforge.net>
parents: 171
diff changeset
3 # This module is free software, and you may redistribute it and/or modify
d45384bc6420 Added the copyright/license notice to (nearly) all files...
Richard Jones <richard@users.sourceforge.net>
parents: 171
diff changeset
4 # under the same terms as Python, so long as this copyright message and
d45384bc6420 Added the copyright/license notice to (nearly) all files...
Richard Jones <richard@users.sourceforge.net>
parents: 171
diff changeset
5 # disclaimer are retained in their original form.
d45384bc6420 Added the copyright/license notice to (nearly) all files...
Richard Jones <richard@users.sourceforge.net>
parents: 171
diff changeset
6 #
214
18134bffab37 stupid typo
Richard Jones <richard@users.sourceforge.net>
parents: 213
diff changeset
7 # IN NO EVENT SHALL BIZAR SOFTWARE PTY LTD BE LIABLE TO ANY PARTY FOR
213
d45384bc6420 Added the copyright/license notice to (nearly) all files...
Richard Jones <richard@users.sourceforge.net>
parents: 171
diff changeset
8 # DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING
d45384bc6420 Added the copyright/license notice to (nearly) all files...
Richard Jones <richard@users.sourceforge.net>
parents: 171
diff changeset
9 # OUT OF THE USE OF THIS CODE, EVEN IF THE AUTHOR HAS BEEN ADVISED OF THE
d45384bc6420 Added the copyright/license notice to (nearly) all files...
Richard Jones <richard@users.sourceforge.net>
parents: 171
diff changeset
10 # POSSIBILITY OF SUCH DAMAGE.
d45384bc6420 Added the copyright/license notice to (nearly) all files...
Richard Jones <richard@users.sourceforge.net>
parents: 171
diff changeset
11 #
d45384bc6420 Added the copyright/license notice to (nearly) all files...
Richard Jones <richard@users.sourceforge.net>
parents: 171
diff changeset
12 # BIZAR SOFTWARE PTY LTD SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
d45384bc6420 Added the copyright/license notice to (nearly) all files...
Richard Jones <richard@users.sourceforge.net>
parents: 171
diff changeset
13 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
d45384bc6420 Added the copyright/license notice to (nearly) all files...
Richard Jones <richard@users.sourceforge.net>
parents: 171
diff changeset
14 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS"
d45384bc6420 Added the copyright/license notice to (nearly) all files...
Richard Jones <richard@users.sourceforge.net>
parents: 171
diff changeset
15 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
d45384bc6420 Added the copyright/license notice to (nearly) all files...
Richard Jones <richard@users.sourceforge.net>
parents: 171
diff changeset
16 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
d45384bc6420 Added the copyright/license notice to (nearly) all files...
Richard Jones <richard@users.sourceforge.net>
parents: 171
diff changeset
17 #
930
3c344e942055 Use same regex to split search terms as used to index text.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 926
diff changeset
18 # $Id: htmltemplate.py,v 1.109 2002-08-01 15:06:08 gmcm Exp $
406
bdc2ea127ae9 Added module docstrings to all modules.
Jürgen Hermann <jhermann@users.sourceforge.net>
parents: 401
diff changeset
19
bdc2ea127ae9 Added module docstrings to all modules.
Jürgen Hermann <jhermann@users.sourceforge.net>
parents: 401
diff changeset
20 __doc__ = """
bdc2ea127ae9 Added module docstrings to all modules.
Jürgen Hermann <jhermann@users.sourceforge.net>
parents: 401
diff changeset
21 Template engine.
902
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
22
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
23 Three types of template files exist:
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
24 .index used by IndexTemplate
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
25 .item used by ItemTemplate and NewItemTemplate
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
26 .filter used by IndexTemplate
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
27
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
28 Templating works by instantiating one of the *Template classes above,
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
29 passing in a handle to the cgi client, identifying the class and the
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
30 template source directory.
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
31
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
32 The *Template class reads in the appropriate template text, and when the
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
33 render() method is called, the template text is fed to an re.sub which
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
34 calls the subfunc and then all the funky do_* methods as required.
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
35
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
36 Templating is tested by the test_htmltemplate unit test suite. If you add
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
37 a template function, add a test for all data types or the angry pink bunny
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
38 will hunt you down.
406
bdc2ea127ae9 Added module docstrings to all modules.
Jürgen Hermann <jhermann@users.sourceforge.net>
parents: 401
diff changeset
39 """
25
4cf1daf2f2eb More Grande Splite
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
40
915
930b57864dc8 nicer error messages, and a bugfix
Richard Jones <richard@users.sourceforge.net>
parents: 913
diff changeset
41 import sys, os, re, StringIO, urllib, cgi, errno, types, urllib
821
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
42
651
6257d4e49d2a Ran it through pychecker, made fixes
Richard Jones <richard@users.sourceforge.net>
parents: 640
diff changeset
43 import hyperdb, date
488
ab9e236cd524 I18N'ification
Richard Jones <richard@users.sourceforge.net>
parents: 467
diff changeset
44 from i18n import _
25
4cf1daf2f2eb More Grande Splite
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
45
340
9311fa91f478 Added do_stext to htmltemplate, thanks Brad Clements.
Richard Jones <richard@users.sourceforge.net>
parents: 332
diff changeset
46 # This imports the StructureText functionality for the do_stext function
9311fa91f478 Added do_stext to htmltemplate, thanks Brad Clements.
Richard Jones <richard@users.sourceforge.net>
parents: 332
diff changeset
47 # get it from http://dev.zope.org/Members/jim/StructuredTextWiki/NGReleases
9311fa91f478 Added do_stext to htmltemplate, thanks Brad Clements.
Richard Jones <richard@users.sourceforge.net>
parents: 332
diff changeset
48 try:
9311fa91f478 Added do_stext to htmltemplate, thanks Brad Clements.
Richard Jones <richard@users.sourceforge.net>
parents: 332
diff changeset
49 from StructuredText.StructuredText import HTML as StructuredText
9311fa91f478 Added do_stext to htmltemplate, thanks Brad Clements.
Richard Jones <richard@users.sourceforge.net>
parents: 332
diff changeset
50 except ImportError:
9311fa91f478 Added do_stext to htmltemplate, thanks Brad Clements.
Richard Jones <richard@users.sourceforge.net>
parents: 332
diff changeset
51 StructuredText = None
9311fa91f478 Added do_stext to htmltemplate, thanks Brad Clements.
Richard Jones <richard@users.sourceforge.net>
parents: 332
diff changeset
52
627
952679be9e2c Added simple editing for classes that don't define a templated interface.
Richard Jones <richard@users.sourceforge.net>
parents: 623
diff changeset
53 class MissingTemplateError(ValueError):
651
6257d4e49d2a Ran it through pychecker, made fixes
Richard Jones <richard@users.sourceforge.net>
parents: 640
diff changeset
54 '''Error raised when a template file is missing
6257d4e49d2a Ran it through pychecker, made fixes
Richard Jones <richard@users.sourceforge.net>
parents: 640
diff changeset
55 '''
627
952679be9e2c Added simple editing for classes that don't define a templated interface.
Richard Jones <richard@users.sourceforge.net>
parents: 623
diff changeset
56 pass
952679be9e2c Added simple editing for classes that don't define a templated interface.
Richard Jones <richard@users.sourceforge.net>
parents: 623
diff changeset
57
318
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
58 class TemplateFunctions:
651
6257d4e49d2a Ran it through pychecker, made fixes
Richard Jones <richard@users.sourceforge.net>
parents: 640
diff changeset
59 '''Defines the templating functions that are used in the HTML templates
6257d4e49d2a Ran it through pychecker, made fixes
Richard Jones <richard@users.sourceforge.net>
parents: 640
diff changeset
60 of the roundup web interface.
6257d4e49d2a Ran it through pychecker, made fixes
Richard Jones <richard@users.sourceforge.net>
parents: 640
diff changeset
61 '''
318
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
62 def __init__(self):
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
63 self.form = None
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
64 self.nodeid = None
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
65 self.filterspec = None
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
66 self.globals = {}
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
67 for key in TemplateFunctions.__dict__.keys():
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
68 if key[:3] == 'do_':
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
69 self.globals[key[3:]] = getattr(self, key)
25
4cf1daf2f2eb More Grande Splite
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
70
651
6257d4e49d2a Ran it through pychecker, made fixes
Richard Jones <richard@users.sourceforge.net>
parents: 640
diff changeset
71 # These are added by the subclass where appropriate
6257d4e49d2a Ran it through pychecker, made fixes
Richard Jones <richard@users.sourceforge.net>
parents: 640
diff changeset
72 self.client = None
6257d4e49d2a Ran it through pychecker, made fixes
Richard Jones <richard@users.sourceforge.net>
parents: 640
diff changeset
73 self.instance = None
6257d4e49d2a Ran it through pychecker, made fixes
Richard Jones <richard@users.sourceforge.net>
parents: 640
diff changeset
74 self.templates = None
6257d4e49d2a Ran it through pychecker, made fixes
Richard Jones <richard@users.sourceforge.net>
parents: 640
diff changeset
75 self.classname = None
6257d4e49d2a Ran it through pychecker, made fixes
Richard Jones <richard@users.sourceforge.net>
parents: 640
diff changeset
76 self.db = None
6257d4e49d2a Ran it through pychecker, made fixes
Richard Jones <richard@users.sourceforge.net>
parents: 640
diff changeset
77 self.cl = None
6257d4e49d2a Ran it through pychecker, made fixes
Richard Jones <richard@users.sourceforge.net>
parents: 640
diff changeset
78 self.properties = None
6257d4e49d2a Ran it through pychecker, made fixes
Richard Jones <richard@users.sourceforge.net>
parents: 640
diff changeset
79
806
83becf3faa2f Fix the cycles (a clear method, called after render...
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 804
diff changeset
80 def clear(self):
83becf3faa2f Fix the cycles (a clear method, called after render...
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 804
diff changeset
81 for key in TemplateFunctions.__dict__.keys():
83becf3faa2f Fix the cycles (a clear method, called after render...
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 804
diff changeset
82 if key[:3] == 'do_':
83becf3faa2f Fix the cycles (a clear method, called after render...
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 804
diff changeset
83 del self.globals[key[3:]]
83becf3faa2f Fix the cycles (a clear method, called after render...
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 804
diff changeset
84
755
49c9522675b9 can now just display a link/multilink id - useful for stylesheet stuff
Richard Jones <richard@users.sourceforge.net>
parents: 749
diff changeset
85 def do_plain(self, property, escape=0, lookup=1):
318
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
86 ''' display a String property directly;
25
4cf1daf2f2eb More Grande Splite
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
87
318
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
88 display a Date property in a specified time zone with an option to
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
89 omit the time from the date stamp;
25
4cf1daf2f2eb More Grande Splite
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
90
318
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
91 for a Link or Multilink property, display the key strings of the
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
92 linked nodes (or the ids if the linked class has no key property)
755
49c9522675b9 can now just display a link/multilink id - useful for stylesheet stuff
Richard Jones <richard@users.sourceforge.net>
parents: 749
diff changeset
93 when the lookup argument is true, otherwise just return the
49c9522675b9 can now just display a link/multilink id - useful for stylesheet stuff
Richard Jones <richard@users.sourceforge.net>
parents: 749
diff changeset
94 linked ids
318
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
95 '''
25
4cf1daf2f2eb More Grande Splite
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
96 if not self.nodeid and self.form is None:
488
ab9e236cd524 I18N'ification
Richard Jones <richard@users.sourceforge.net>
parents: 467
diff changeset
97 return _('[Field: not called from item]')
25
4cf1daf2f2eb More Grande Splite
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
98 propclass = self.properties[property]
4cf1daf2f2eb More Grande Splite
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
99 if self.nodeid:
397
d47818b09265 more new property handling
Richard Jones <richard@users.sourceforge.net>
parents: 392
diff changeset
100 # make sure the property is a valid one
d47818b09265 more new property handling
Richard Jones <richard@users.sourceforge.net>
parents: 392
diff changeset
101 # TODO: this tests, but we should handle the exception
651
6257d4e49d2a Ran it through pychecker, made fixes
Richard Jones <richard@users.sourceforge.net>
parents: 640
diff changeset
102 dummy = self.cl.getprops()[property]
397
d47818b09265 more new property handling
Richard Jones <richard@users.sourceforge.net>
parents: 392
diff changeset
103
d47818b09265 more new property handling
Richard Jones <richard@users.sourceforge.net>
parents: 392
diff changeset
104 # get the value for this property
d47818b09265 more new property handling
Richard Jones <richard@users.sourceforge.net>
parents: 392
diff changeset
105 try:
d47818b09265 more new property handling
Richard Jones <richard@users.sourceforge.net>
parents: 392
diff changeset
106 value = self.cl.get(self.nodeid, property)
d47818b09265 more new property handling
Richard Jones <richard@users.sourceforge.net>
parents: 392
diff changeset
107 except KeyError:
d47818b09265 more new property handling
Richard Jones <richard@users.sourceforge.net>
parents: 392
diff changeset
108 # a KeyError here means that the node doesn't have a value
d47818b09265 more new property handling
Richard Jones <richard@users.sourceforge.net>
parents: 392
diff changeset
109 # for the specified property
d47818b09265 more new property handling
Richard Jones <richard@users.sourceforge.net>
parents: 392
diff changeset
110 if isinstance(propclass, hyperdb.Multilink): value = []
d47818b09265 more new property handling
Richard Jones <richard@users.sourceforge.net>
parents: 392
diff changeset
111 else: value = ''
25
4cf1daf2f2eb More Grande Splite
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
112 else:
4cf1daf2f2eb More Grande Splite
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
113 # TODO: pull the value from the form
224
ad2c98faec97 using isinstance(blah, Foo) now instead of isFooType
Richard Jones <richard@users.sourceforge.net>
parents: 214
diff changeset
114 if isinstance(propclass, hyperdb.Multilink): value = []
25
4cf1daf2f2eb More Grande Splite
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
115 else: value = ''
224
ad2c98faec97 using isinstance(blah, Foo) now instead of isFooType
Richard Jones <richard@users.sourceforge.net>
parents: 214
diff changeset
116 if isinstance(propclass, hyperdb.String):
25
4cf1daf2f2eb More Grande Splite
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
117 if value is None: value = ''
4cf1daf2f2eb More Grande Splite
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
118 else: value = str(value)
270
a4241ddd22d7 Added the Password property type.
Richard Jones <richard@users.sourceforge.net>
parents: 250
diff changeset
119 elif isinstance(propclass, hyperdb.Password):
a4241ddd22d7 Added the Password property type.
Richard Jones <richard@users.sourceforge.net>
parents: 250
diff changeset
120 if value is None: value = ''
488
ab9e236cd524 I18N'ification
Richard Jones <richard@users.sourceforge.net>
parents: 467
diff changeset
121 else: value = _('*encrypted*')
224
ad2c98faec97 using isinstance(blah, Foo) now instead of isFooType
Richard Jones <richard@users.sourceforge.net>
parents: 214
diff changeset
122 elif isinstance(propclass, hyperdb.Date):
547
e4ef6df2345c display links a html link in history.
Engelbert Gruber <grubert@users.sourceforge.net>
parents: 538
diff changeset
123 # this gives "2002-01-17.06:54:39", maybe replace the "." by a " ".
25
4cf1daf2f2eb More Grande Splite
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
124 value = str(value)
224
ad2c98faec97 using isinstance(blah, Foo) now instead of isFooType
Richard Jones <richard@users.sourceforge.net>
parents: 214
diff changeset
125 elif isinstance(propclass, hyperdb.Interval):
25
4cf1daf2f2eb More Grande Splite
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
126 value = str(value)
880
de3da99a7c02 Add Number and Boolean types to hyperdb.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 878
diff changeset
127 elif isinstance(propclass, hyperdb.Number):
de3da99a7c02 Add Number and Boolean types to hyperdb.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 878
diff changeset
128 value = str(value)
de3da99a7c02 Add Number and Boolean types to hyperdb.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 878
diff changeset
129 elif isinstance(propclass, hyperdb.Boolean):
de3da99a7c02 Add Number and Boolean types to hyperdb.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 878
diff changeset
130 value = value and "Yes" or "No"
224
ad2c98faec97 using isinstance(blah, Foo) now instead of isFooType
Richard Jones <richard@users.sourceforge.net>
parents: 214
diff changeset
131 elif isinstance(propclass, hyperdb.Link):
531
32c1dd156605 plain rendering of links in the htmltemplate now generate a hyperlink...
Richard Jones <richard@users.sourceforge.net>
parents: 528
diff changeset
132 if value:
755
49c9522675b9 can now just display a link/multilink id - useful for stylesheet stuff
Richard Jones <richard@users.sourceforge.net>
parents: 749
diff changeset
133 if lookup:
49c9522675b9 can now just display a link/multilink id - useful for stylesheet stuff
Richard Jones <richard@users.sourceforge.net>
parents: 749
diff changeset
134 linkcl = self.db.classes[propclass.classname]
804
af4826d8773d Default labelprops to id.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 757
diff changeset
135 k = linkcl.labelprop(1)
755
49c9522675b9 can now just display a link/multilink id - useful for stylesheet stuff
Richard Jones <richard@users.sourceforge.net>
parents: 749
diff changeset
136 value = linkcl.get(value, k)
531
32c1dd156605 plain rendering of links in the htmltemplate now generate a hyperlink...
Richard Jones <richard@users.sourceforge.net>
parents: 528
diff changeset
137 else:
32c1dd156605 plain rendering of links in the htmltemplate now generate a hyperlink...
Richard Jones <richard@users.sourceforge.net>
parents: 528
diff changeset
138 value = _('[unselected]')
224
ad2c98faec97 using isinstance(blah, Foo) now instead of isFooType
Richard Jones <richard@users.sourceforge.net>
parents: 214
diff changeset
139 elif isinstance(propclass, hyperdb.Multilink):
755
49c9522675b9 can now just display a link/multilink id - useful for stylesheet stuff
Richard Jones <richard@users.sourceforge.net>
parents: 749
diff changeset
140 if lookup:
49c9522675b9 can now just display a link/multilink id - useful for stylesheet stuff
Richard Jones <richard@users.sourceforge.net>
parents: 749
diff changeset
141 linkcl = self.db.classes[propclass.classname]
804
af4826d8773d Default labelprops to id.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 757
diff changeset
142 k = linkcl.labelprop(1)
755
49c9522675b9 can now just display a link/multilink id - useful for stylesheet stuff
Richard Jones <richard@users.sourceforge.net>
parents: 749
diff changeset
143 labels = []
49c9522675b9 can now just display a link/multilink id - useful for stylesheet stuff
Richard Jones <richard@users.sourceforge.net>
parents: 749
diff changeset
144 for v in value:
49c9522675b9 can now just display a link/multilink id - useful for stylesheet stuff
Richard Jones <richard@users.sourceforge.net>
parents: 749
diff changeset
145 labels.append(linkcl.get(v, k))
49c9522675b9 can now just display a link/multilink id - useful for stylesheet stuff
Richard Jones <richard@users.sourceforge.net>
parents: 749
diff changeset
146 value = ', '.join(labels)
49c9522675b9 can now just display a link/multilink id - useful for stylesheet stuff
Richard Jones <richard@users.sourceforge.net>
parents: 749
diff changeset
147 else:
49c9522675b9 can now just display a link/multilink id - useful for stylesheet stuff
Richard Jones <richard@users.sourceforge.net>
parents: 749
diff changeset
148 value = ', '.join(value)
25
4cf1daf2f2eb More Grande Splite
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
149 else:
651
6257d4e49d2a Ran it through pychecker, made fixes
Richard Jones <richard@users.sourceforge.net>
parents: 640
diff changeset
150 value = _('Plain: bad propclass "%(propclass)s"')%locals()
250
1d428068485c *gak* ... xmp is Old Skool apparently.
Richard Jones <richard@users.sourceforge.net>
parents: 245
diff changeset
151 if escape:
342
0b7d62e414b6 Added the wrap="hard" attribute to the textarea of the note field...
Richard Jones <richard@users.sourceforge.net>
parents: 340
diff changeset
152 value = cgi.escape(value)
25
4cf1daf2f2eb More Grande Splite
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
153 return value
4cf1daf2f2eb More Grande Splite
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
154
340
9311fa91f478 Added do_stext to htmltemplate, thanks Brad Clements.
Richard Jones <richard@users.sourceforge.net>
parents: 332
diff changeset
155 def do_stext(self, property, escape=0):
9311fa91f478 Added do_stext to htmltemplate, thanks Brad Clements.
Richard Jones <richard@users.sourceforge.net>
parents: 332
diff changeset
156 '''Render as structured text using the StructuredText module
9311fa91f478 Added do_stext to htmltemplate, thanks Brad Clements.
Richard Jones <richard@users.sourceforge.net>
parents: 332
diff changeset
157 (see above for details)
9311fa91f478 Added do_stext to htmltemplate, thanks Brad Clements.
Richard Jones <richard@users.sourceforge.net>
parents: 332
diff changeset
158 '''
9311fa91f478 Added do_stext to htmltemplate, thanks Brad Clements.
Richard Jones <richard@users.sourceforge.net>
parents: 332
diff changeset
159 s = self.do_plain(property, escape=escape)
9311fa91f478 Added do_stext to htmltemplate, thanks Brad Clements.
Richard Jones <richard@users.sourceforge.net>
parents: 332
diff changeset
160 if not StructuredText:
9311fa91f478 Added do_stext to htmltemplate, thanks Brad Clements.
Richard Jones <richard@users.sourceforge.net>
parents: 332
diff changeset
161 return s
9311fa91f478 Added do_stext to htmltemplate, thanks Brad Clements.
Richard Jones <richard@users.sourceforge.net>
parents: 332
diff changeset
162 return StructuredText(s,level=1,header=0)
9311fa91f478 Added do_stext to htmltemplate, thanks Brad Clements.
Richard Jones <richard@users.sourceforge.net>
parents: 332
diff changeset
163
563
0f58d6a35a8b Wrote more unit tests for htmltemplate...
Richard Jones <richard@users.sourceforge.net>
parents: 558
diff changeset
164 def determine_value(self, property):
0f58d6a35a8b Wrote more unit tests for htmltemplate...
Richard Jones <richard@users.sourceforge.net>
parents: 558
diff changeset
165 '''determine the value of a property using the node, form or
0f58d6a35a8b Wrote more unit tests for htmltemplate...
Richard Jones <richard@users.sourceforge.net>
parents: 558
diff changeset
166 filterspec
0f58d6a35a8b Wrote more unit tests for htmltemplate...
Richard Jones <richard@users.sourceforge.net>
parents: 558
diff changeset
167 '''
0f58d6a35a8b Wrote more unit tests for htmltemplate...
Richard Jones <richard@users.sourceforge.net>
parents: 558
diff changeset
168 propclass = self.properties[property]
0f58d6a35a8b Wrote more unit tests for htmltemplate...
Richard Jones <richard@users.sourceforge.net>
parents: 558
diff changeset
169 if self.nodeid:
0f58d6a35a8b Wrote more unit tests for htmltemplate...
Richard Jones <richard@users.sourceforge.net>
parents: 558
diff changeset
170 value = self.cl.get(self.nodeid, property, None)
0f58d6a35a8b Wrote more unit tests for htmltemplate...
Richard Jones <richard@users.sourceforge.net>
parents: 558
diff changeset
171 if isinstance(propclass, hyperdb.Multilink) and value is None:
0f58d6a35a8b Wrote more unit tests for htmltemplate...
Richard Jones <richard@users.sourceforge.net>
parents: 558
diff changeset
172 return []
0f58d6a35a8b Wrote more unit tests for htmltemplate...
Richard Jones <richard@users.sourceforge.net>
parents: 558
diff changeset
173 return value
0f58d6a35a8b Wrote more unit tests for htmltemplate...
Richard Jones <richard@users.sourceforge.net>
parents: 558
diff changeset
174 elif self.filterspec is not None:
0f58d6a35a8b Wrote more unit tests for htmltemplate...
Richard Jones <richard@users.sourceforge.net>
parents: 558
diff changeset
175 if isinstance(propclass, hyperdb.Multilink):
0f58d6a35a8b Wrote more unit tests for htmltemplate...
Richard Jones <richard@users.sourceforge.net>
parents: 558
diff changeset
176 return self.filterspec.get(property, [])
0f58d6a35a8b Wrote more unit tests for htmltemplate...
Richard Jones <richard@users.sourceforge.net>
parents: 558
diff changeset
177 else:
0f58d6a35a8b Wrote more unit tests for htmltemplate...
Richard Jones <richard@users.sourceforge.net>
parents: 558
diff changeset
178 return self.filterspec.get(property, '')
0f58d6a35a8b Wrote more unit tests for htmltemplate...
Richard Jones <richard@users.sourceforge.net>
parents: 558
diff changeset
179 # TODO: pull the value from the form
0f58d6a35a8b Wrote more unit tests for htmltemplate...
Richard Jones <richard@users.sourceforge.net>
parents: 558
diff changeset
180 if isinstance(propclass, hyperdb.Multilink):
0f58d6a35a8b Wrote more unit tests for htmltemplate...
Richard Jones <richard@users.sourceforge.net>
parents: 558
diff changeset
181 return []
0f58d6a35a8b Wrote more unit tests for htmltemplate...
Richard Jones <richard@users.sourceforge.net>
parents: 558
diff changeset
182 else:
0f58d6a35a8b Wrote more unit tests for htmltemplate...
Richard Jones <richard@users.sourceforge.net>
parents: 558
diff changeset
183 return ''
0f58d6a35a8b Wrote more unit tests for htmltemplate...
Richard Jones <richard@users.sourceforge.net>
parents: 558
diff changeset
184
0f58d6a35a8b Wrote more unit tests for htmltemplate...
Richard Jones <richard@users.sourceforge.net>
parents: 558
diff changeset
185 def make_sort_function(self, classname):
0f58d6a35a8b Wrote more unit tests for htmltemplate...
Richard Jones <richard@users.sourceforge.net>
parents: 558
diff changeset
186 '''Make a sort function for a given class
0f58d6a35a8b Wrote more unit tests for htmltemplate...
Richard Jones <richard@users.sourceforge.net>
parents: 558
diff changeset
187 '''
0f58d6a35a8b Wrote more unit tests for htmltemplate...
Richard Jones <richard@users.sourceforge.net>
parents: 558
diff changeset
188 linkcl = self.db.classes[classname]
0f58d6a35a8b Wrote more unit tests for htmltemplate...
Richard Jones <richard@users.sourceforge.net>
parents: 558
diff changeset
189 if linkcl.getprops().has_key('order'):
0f58d6a35a8b Wrote more unit tests for htmltemplate...
Richard Jones <richard@users.sourceforge.net>
parents: 558
diff changeset
190 sort_on = 'order'
0f58d6a35a8b Wrote more unit tests for htmltemplate...
Richard Jones <richard@users.sourceforge.net>
parents: 558
diff changeset
191 else:
0f58d6a35a8b Wrote more unit tests for htmltemplate...
Richard Jones <richard@users.sourceforge.net>
parents: 558
diff changeset
192 sort_on = linkcl.labelprop()
0f58d6a35a8b Wrote more unit tests for htmltemplate...
Richard Jones <richard@users.sourceforge.net>
parents: 558
diff changeset
193 def sortfunc(a, b, linkcl=linkcl, sort_on=sort_on):
0f58d6a35a8b Wrote more unit tests for htmltemplate...
Richard Jones <richard@users.sourceforge.net>
parents: 558
diff changeset
194 return cmp(linkcl.get(a, sort_on), linkcl.get(b, sort_on))
0f58d6a35a8b Wrote more unit tests for htmltemplate...
Richard Jones <richard@users.sourceforge.net>
parents: 558
diff changeset
195 return sortfunc
0f58d6a35a8b Wrote more unit tests for htmltemplate...
Richard Jones <richard@users.sourceforge.net>
parents: 558
diff changeset
196
0f58d6a35a8b Wrote more unit tests for htmltemplate...
Richard Jones <richard@users.sourceforge.net>
parents: 558
diff changeset
197 def do_field(self, property, size=None, showid=0):
318
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
198 ''' display a property like the plain displayer, but in a text field
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
199 to be edited
563
0f58d6a35a8b Wrote more unit tests for htmltemplate...
Richard Jones <richard@users.sourceforge.net>
parents: 558
diff changeset
200
0f58d6a35a8b Wrote more unit tests for htmltemplate...
Richard Jones <richard@users.sourceforge.net>
parents: 558
diff changeset
201 Note: if you would prefer an option list style display for
0f58d6a35a8b Wrote more unit tests for htmltemplate...
Richard Jones <richard@users.sourceforge.net>
parents: 558
diff changeset
202 link or multilink editing, use menu().
318
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
203 '''
162
717f12e6ccf2 Features and fixes.
Richard Jones <richard@users.sourceforge.net>
parents: 155
diff changeset
204 if not self.nodeid and self.form is None and self.filterspec is None:
401
a930feb07dc4 Added globbing for win32, and sample marking in a 2nd file to test it
Jürgen Hermann <jhermann@users.sourceforge.net>
parents: 398
diff changeset
205 return _('[Field: not called from item]')
563
0f58d6a35a8b Wrote more unit tests for htmltemplate...
Richard Jones <richard@users.sourceforge.net>
parents: 558
diff changeset
206 if size is None:
0f58d6a35a8b Wrote more unit tests for htmltemplate...
Richard Jones <richard@users.sourceforge.net>
parents: 558
diff changeset
207 size = 30
0f58d6a35a8b Wrote more unit tests for htmltemplate...
Richard Jones <richard@users.sourceforge.net>
parents: 558
diff changeset
208
25
4cf1daf2f2eb More Grande Splite
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
209 propclass = self.properties[property]
563
0f58d6a35a8b Wrote more unit tests for htmltemplate...
Richard Jones <richard@users.sourceforge.net>
parents: 558
diff changeset
210
0f58d6a35a8b Wrote more unit tests for htmltemplate...
Richard Jones <richard@users.sourceforge.net>
parents: 558
diff changeset
211 # get the value
0f58d6a35a8b Wrote more unit tests for htmltemplate...
Richard Jones <richard@users.sourceforge.net>
parents: 558
diff changeset
212 value = self.determine_value(property)
0f58d6a35a8b Wrote more unit tests for htmltemplate...
Richard Jones <richard@users.sourceforge.net>
parents: 558
diff changeset
213 # now display
228
1d1848c99abe Fixed some isFooTypes that I missed.
Richard Jones <richard@users.sourceforge.net>
parents: 224
diff changeset
214 if (isinstance(propclass, hyperdb.String) or
1d1848c99abe Fixed some isFooTypes that I missed.
Richard Jones <richard@users.sourceforge.net>
parents: 224
diff changeset
215 isinstance(propclass, hyperdb.Date) or
1d1848c99abe Fixed some isFooTypes that I missed.
Richard Jones <richard@users.sourceforge.net>
parents: 224
diff changeset
216 isinstance(propclass, hyperdb.Interval)):
25
4cf1daf2f2eb More Grande Splite
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
217 if value is None:
4cf1daf2f2eb More Grande Splite
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
218 value = ''
4cf1daf2f2eb More Grande Splite
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
219 else:
525
d046cc4ba7d3 How about that ... date fields have never worked ...
Richard Jones <richard@users.sourceforge.net>
parents: 524
diff changeset
220 value = cgi.escape(str(value))
25
4cf1daf2f2eb More Grande Splite
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
221 value = '&quot;'.join(value.split('"'))
4cf1daf2f2eb More Grande Splite
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
222 s = '<input name="%s" value="%s" size="%s">'%(property, value, size)
880
de3da99a7c02 Add Number and Boolean types to hyperdb.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 878
diff changeset
223 elif isinstance(propclass, hyperdb.Boolean):
de3da99a7c02 Add Number and Boolean types to hyperdb.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 878
diff changeset
224 checked = value and "checked" or ""
de3da99a7c02 Add Number and Boolean types to hyperdb.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 878
diff changeset
225 s = '<input type="checkbox" name="%s" %s>'%(property, checked)
de3da99a7c02 Add Number and Boolean types to hyperdb.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 878
diff changeset
226 elif isinstance(propclass, hyperdb.Number):
de3da99a7c02 Add Number and Boolean types to hyperdb.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 878
diff changeset
227 s = '<input name="%s" value="%s" size="%s">'%(property, value, size)
270
a4241ddd22d7 Added the Password property type.
Richard Jones <richard@users.sourceforge.net>
parents: 250
diff changeset
228 elif isinstance(propclass, hyperdb.Password):
a4241ddd22d7 Added the Password property type.
Richard Jones <richard@users.sourceforge.net>
parents: 250
diff changeset
229 s = '<input type="password" name="%s" size="%s">'%(property, size)
224
ad2c98faec97 using isinstance(blah, Foo) now instead of isFooType
Richard Jones <richard@users.sourceforge.net>
parents: 214
diff changeset
230 elif isinstance(propclass, hyperdb.Link):
563
0f58d6a35a8b Wrote more unit tests for htmltemplate...
Richard Jones <richard@users.sourceforge.net>
parents: 558
diff changeset
231 linkcl = self.db.classes[propclass.classname]
806
83becf3faa2f Fix the cycles (a clear method, called after render...
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 804
diff changeset
232 if linkcl.getprops().has_key('order'):
83becf3faa2f Fix the cycles (a clear method, called after render...
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 804
diff changeset
233 sort_on = 'order'
83becf3faa2f Fix the cycles (a clear method, called after render...
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 804
diff changeset
234 else:
83becf3faa2f Fix the cycles (a clear method, called after render...
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 804
diff changeset
235 sort_on = linkcl.labelprop()
83becf3faa2f Fix the cycles (a clear method, called after render...
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 804
diff changeset
236 options = linkcl.filter(None, {}, [sort_on], [])
563
0f58d6a35a8b Wrote more unit tests for htmltemplate...
Richard Jones <richard@users.sourceforge.net>
parents: 558
diff changeset
237 # TODO: make this a field display, not a menu one!
25
4cf1daf2f2eb More Grande Splite
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
238 l = ['<select name="%s">'%property]
804
af4826d8773d Default labelprops to id.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 757
diff changeset
239 k = linkcl.labelprop(1)
312
5a2c43891c20 [SF#473124]: UI inconsistency with Link fields.
Richard Jones <richard@users.sourceforge.net>
parents: 307
diff changeset
240 if value is None:
5a2c43891c20 [SF#473124]: UI inconsistency with Link fields.
Richard Jones <richard@users.sourceforge.net>
parents: 307
diff changeset
241 s = 'selected '
5a2c43891c20 [SF#473124]: UI inconsistency with Link fields.
Richard Jones <richard@users.sourceforge.net>
parents: 307
diff changeset
242 else:
5a2c43891c20 [SF#473124]: UI inconsistency with Link fields.
Richard Jones <richard@users.sourceforge.net>
parents: 307
diff changeset
243 s = ''
488
ab9e236cd524 I18N'ification
Richard Jones <richard@users.sourceforge.net>
parents: 467
diff changeset
244 l.append(_('<option %svalue="-1">- no selection -</option>')%s)
563
0f58d6a35a8b Wrote more unit tests for htmltemplate...
Richard Jones <richard@users.sourceforge.net>
parents: 558
diff changeset
245 for optionid in options:
0f58d6a35a8b Wrote more unit tests for htmltemplate...
Richard Jones <richard@users.sourceforge.net>
parents: 558
diff changeset
246 option = linkcl.get(optionid, k)
0f58d6a35a8b Wrote more unit tests for htmltemplate...
Richard Jones <richard@users.sourceforge.net>
parents: 558
diff changeset
247 s = ''
0f58d6a35a8b Wrote more unit tests for htmltemplate...
Richard Jones <richard@users.sourceforge.net>
parents: 558
diff changeset
248 if optionid == value:
0f58d6a35a8b Wrote more unit tests for htmltemplate...
Richard Jones <richard@users.sourceforge.net>
parents: 558
diff changeset
249 s = 'selected '
0f58d6a35a8b Wrote more unit tests for htmltemplate...
Richard Jones <richard@users.sourceforge.net>
parents: 558
diff changeset
250 if showid:
0f58d6a35a8b Wrote more unit tests for htmltemplate...
Richard Jones <richard@users.sourceforge.net>
parents: 558
diff changeset
251 lab = '%s%s: %s'%(propclass.classname, optionid, option)
0f58d6a35a8b Wrote more unit tests for htmltemplate...
Richard Jones <richard@users.sourceforge.net>
parents: 558
diff changeset
252 else:
0f58d6a35a8b Wrote more unit tests for htmltemplate...
Richard Jones <richard@users.sourceforge.net>
parents: 558
diff changeset
253 lab = option
0f58d6a35a8b Wrote more unit tests for htmltemplate...
Richard Jones <richard@users.sourceforge.net>
parents: 558
diff changeset
254 if size is not None and len(lab) > size:
0f58d6a35a8b Wrote more unit tests for htmltemplate...
Richard Jones <richard@users.sourceforge.net>
parents: 558
diff changeset
255 lab = lab[:size-3] + '...'
0f58d6a35a8b Wrote more unit tests for htmltemplate...
Richard Jones <richard@users.sourceforge.net>
parents: 558
diff changeset
256 lab = cgi.escape(lab)
0f58d6a35a8b Wrote more unit tests for htmltemplate...
Richard Jones <richard@users.sourceforge.net>
parents: 558
diff changeset
257 l.append('<option %svalue="%s">%s</option>'%(s, optionid, lab))
0f58d6a35a8b Wrote more unit tests for htmltemplate...
Richard Jones <richard@users.sourceforge.net>
parents: 558
diff changeset
258 l.append('</select>')
0f58d6a35a8b Wrote more unit tests for htmltemplate...
Richard Jones <richard@users.sourceforge.net>
parents: 558
diff changeset
259 s = '\n'.join(l)
0f58d6a35a8b Wrote more unit tests for htmltemplate...
Richard Jones <richard@users.sourceforge.net>
parents: 558
diff changeset
260 elif isinstance(propclass, hyperdb.Multilink):
0f58d6a35a8b Wrote more unit tests for htmltemplate...
Richard Jones <richard@users.sourceforge.net>
parents: 558
diff changeset
261 sortfunc = self.make_sort_function(propclass.classname)
0f58d6a35a8b Wrote more unit tests for htmltemplate...
Richard Jones <richard@users.sourceforge.net>
parents: 558
diff changeset
262 linkcl = self.db.classes[propclass.classname]
696
709f8f1d5661 Sorting was applied to all nodes of the MultiLink class...
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 678
diff changeset
263 if value:
709f8f1d5661 Sorting was applied to all nodes of the MultiLink class...
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 678
diff changeset
264 value.sort(sortfunc)
563
0f58d6a35a8b Wrote more unit tests for htmltemplate...
Richard Jones <richard@users.sourceforge.net>
parents: 558
diff changeset
265 # map the id to the label property
0f58d6a35a8b Wrote more unit tests for htmltemplate...
Richard Jones <richard@users.sourceforge.net>
parents: 558
diff changeset
266 if not showid:
804
af4826d8773d Default labelprops to id.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 757
diff changeset
267 k = linkcl.labelprop(1)
563
0f58d6a35a8b Wrote more unit tests for htmltemplate...
Richard Jones <richard@users.sourceforge.net>
parents: 558
diff changeset
268 value = [linkcl.get(v, k) for v in value]
0f58d6a35a8b Wrote more unit tests for htmltemplate...
Richard Jones <richard@users.sourceforge.net>
parents: 558
diff changeset
269 value = cgi.escape(','.join(value))
0f58d6a35a8b Wrote more unit tests for htmltemplate...
Richard Jones <richard@users.sourceforge.net>
parents: 558
diff changeset
270 s = '<input name="%s" size="%s" value="%s">'%(property, size, value)
0f58d6a35a8b Wrote more unit tests for htmltemplate...
Richard Jones <richard@users.sourceforge.net>
parents: 558
diff changeset
271 else:
0f58d6a35a8b Wrote more unit tests for htmltemplate...
Richard Jones <richard@users.sourceforge.net>
parents: 558
diff changeset
272 s = _('Plain: bad propclass "%(propclass)s"')%locals()
0f58d6a35a8b Wrote more unit tests for htmltemplate...
Richard Jones <richard@users.sourceforge.net>
parents: 558
diff changeset
273 return s
0f58d6a35a8b Wrote more unit tests for htmltemplate...
Richard Jones <richard@users.sourceforge.net>
parents: 558
diff changeset
274
617
edd210915e64 Alternate email addresses are now available for users.
Richard Jones <richard@users.sourceforge.net>
parents: 614
diff changeset
275 def do_multiline(self, property, rows=5, cols=40):
edd210915e64 Alternate email addresses are now available for users.
Richard Jones <richard@users.sourceforge.net>
parents: 614
diff changeset
276 ''' display a string property in a multiline text edit field
edd210915e64 Alternate email addresses are now available for users.
Richard Jones <richard@users.sourceforge.net>
parents: 614
diff changeset
277 '''
edd210915e64 Alternate email addresses are now available for users.
Richard Jones <richard@users.sourceforge.net>
parents: 614
diff changeset
278 if not self.nodeid and self.form is None and self.filterspec is None:
edd210915e64 Alternate email addresses are now available for users.
Richard Jones <richard@users.sourceforge.net>
parents: 614
diff changeset
279 return _('[Multiline: not called from item]')
edd210915e64 Alternate email addresses are now available for users.
Richard Jones <richard@users.sourceforge.net>
parents: 614
diff changeset
280
edd210915e64 Alternate email addresses are now available for users.
Richard Jones <richard@users.sourceforge.net>
parents: 614
diff changeset
281 propclass = self.properties[property]
edd210915e64 Alternate email addresses are now available for users.
Richard Jones <richard@users.sourceforge.net>
parents: 614
diff changeset
282
edd210915e64 Alternate email addresses are now available for users.
Richard Jones <richard@users.sourceforge.net>
parents: 614
diff changeset
283 # make sure this is a link property
edd210915e64 Alternate email addresses are now available for users.
Richard Jones <richard@users.sourceforge.net>
parents: 614
diff changeset
284 if not isinstance(propclass, hyperdb.String):
edd210915e64 Alternate email addresses are now available for users.
Richard Jones <richard@users.sourceforge.net>
parents: 614
diff changeset
285 return _('[Multiline: not a string]')
edd210915e64 Alternate email addresses are now available for users.
Richard Jones <richard@users.sourceforge.net>
parents: 614
diff changeset
286
edd210915e64 Alternate email addresses are now available for users.
Richard Jones <richard@users.sourceforge.net>
parents: 614
diff changeset
287 # get the value
edd210915e64 Alternate email addresses are now available for users.
Richard Jones <richard@users.sourceforge.net>
parents: 614
diff changeset
288 value = self.determine_value(property)
edd210915e64 Alternate email addresses are now available for users.
Richard Jones <richard@users.sourceforge.net>
parents: 614
diff changeset
289 if value is None:
edd210915e64 Alternate email addresses are now available for users.
Richard Jones <richard@users.sourceforge.net>
parents: 614
diff changeset
290 value = ''
edd210915e64 Alternate email addresses are now available for users.
Richard Jones <richard@users.sourceforge.net>
parents: 614
diff changeset
291
edd210915e64 Alternate email addresses are now available for users.
Richard Jones <richard@users.sourceforge.net>
parents: 614
diff changeset
292 # display
edd210915e64 Alternate email addresses are now available for users.
Richard Jones <richard@users.sourceforge.net>
parents: 614
diff changeset
293 return '<textarea name="%s" rows="%s" cols="%s">%s</textarea>'%(
edd210915e64 Alternate email addresses are now available for users.
Richard Jones <richard@users.sourceforge.net>
parents: 614
diff changeset
294 property, rows, cols, value)
edd210915e64 Alternate email addresses are now available for users.
Richard Jones <richard@users.sourceforge.net>
parents: 614
diff changeset
295
757
00d360a4978a Added optional additional property to display in a Multilink form menu.
Richard Jones <richard@users.sourceforge.net>
parents: 755
diff changeset
296 def do_menu(self, property, size=None, height=None, showid=0,
880
de3da99a7c02 Add Number and Boolean types to hyperdb.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 878
diff changeset
297 additional=[], **conditions):
757
00d360a4978a Added optional additional property to display in a Multilink form menu.
Richard Jones <richard@users.sourceforge.net>
parents: 755
diff changeset
298 ''' For a Link/Multilink property, display a menu of the available
00d360a4978a Added optional additional property to display in a Multilink form menu.
Richard Jones <richard@users.sourceforge.net>
parents: 755
diff changeset
299 choices
00d360a4978a Added optional additional property to display in a Multilink form menu.
Richard Jones <richard@users.sourceforge.net>
parents: 755
diff changeset
300
00d360a4978a Added optional additional property to display in a Multilink form menu.
Richard Jones <richard@users.sourceforge.net>
parents: 755
diff changeset
301 If the additional properties are specified, they will be
00d360a4978a Added optional additional property to display in a Multilink form menu.
Richard Jones <richard@users.sourceforge.net>
parents: 755
diff changeset
302 included in the text of each option in (brackets, with, commas).
563
0f58d6a35a8b Wrote more unit tests for htmltemplate...
Richard Jones <richard@users.sourceforge.net>
parents: 558
diff changeset
303 '''
0f58d6a35a8b Wrote more unit tests for htmltemplate...
Richard Jones <richard@users.sourceforge.net>
parents: 558
diff changeset
304 if not self.nodeid and self.form is None and self.filterspec is None:
0f58d6a35a8b Wrote more unit tests for htmltemplate...
Richard Jones <richard@users.sourceforge.net>
parents: 558
diff changeset
305 return _('[Field: not called from item]')
0f58d6a35a8b Wrote more unit tests for htmltemplate...
Richard Jones <richard@users.sourceforge.net>
parents: 558
diff changeset
306
0f58d6a35a8b Wrote more unit tests for htmltemplate...
Richard Jones <richard@users.sourceforge.net>
parents: 558
diff changeset
307 propclass = self.properties[property]
0f58d6a35a8b Wrote more unit tests for htmltemplate...
Richard Jones <richard@users.sourceforge.net>
parents: 558
diff changeset
308
0f58d6a35a8b Wrote more unit tests for htmltemplate...
Richard Jones <richard@users.sourceforge.net>
parents: 558
diff changeset
309 # make sure this is a link property
0f58d6a35a8b Wrote more unit tests for htmltemplate...
Richard Jones <richard@users.sourceforge.net>
parents: 558
diff changeset
310 if not (isinstance(propclass, hyperdb.Link) or
0f58d6a35a8b Wrote more unit tests for htmltemplate...
Richard Jones <richard@users.sourceforge.net>
parents: 558
diff changeset
311 isinstance(propclass, hyperdb.Multilink)):
0f58d6a35a8b Wrote more unit tests for htmltemplate...
Richard Jones <richard@users.sourceforge.net>
parents: 558
diff changeset
312 return _('[Menu: not a link]')
0f58d6a35a8b Wrote more unit tests for htmltemplate...
Richard Jones <richard@users.sourceforge.net>
parents: 558
diff changeset
313
0f58d6a35a8b Wrote more unit tests for htmltemplate...
Richard Jones <richard@users.sourceforge.net>
parents: 558
diff changeset
314 # sort function
0f58d6a35a8b Wrote more unit tests for htmltemplate...
Richard Jones <richard@users.sourceforge.net>
parents: 558
diff changeset
315 sortfunc = self.make_sort_function(propclass.classname)
0f58d6a35a8b Wrote more unit tests for htmltemplate...
Richard Jones <richard@users.sourceforge.net>
parents: 558
diff changeset
316
0f58d6a35a8b Wrote more unit tests for htmltemplate...
Richard Jones <richard@users.sourceforge.net>
parents: 558
diff changeset
317 # get the value
0f58d6a35a8b Wrote more unit tests for htmltemplate...
Richard Jones <richard@users.sourceforge.net>
parents: 558
diff changeset
318 value = self.determine_value(property)
0f58d6a35a8b Wrote more unit tests for htmltemplate...
Richard Jones <richard@users.sourceforge.net>
parents: 558
diff changeset
319
0f58d6a35a8b Wrote more unit tests for htmltemplate...
Richard Jones <richard@users.sourceforge.net>
parents: 558
diff changeset
320 # display
621
f333f6decdc2 [SF#516854] "My Issues" and redisplay
Richard Jones <richard@users.sourceforge.net>
parents: 617
diff changeset
321 if isinstance(propclass, hyperdb.Multilink):
f333f6decdc2 [SF#516854] "My Issues" and redisplay
Richard Jones <richard@users.sourceforge.net>
parents: 617
diff changeset
322 linkcl = self.db.classes[propclass.classname]
806
83becf3faa2f Fix the cycles (a clear method, called after render...
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 804
diff changeset
323 if linkcl.getprops().has_key('order'):
83becf3faa2f Fix the cycles (a clear method, called after render...
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 804
diff changeset
324 sort_on = 'order'
83becf3faa2f Fix the cycles (a clear method, called after render...
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 804
diff changeset
325 else:
880
de3da99a7c02 Add Number and Boolean types to hyperdb.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 878
diff changeset
326 sort_on = linkcl.labelprop()
de3da99a7c02 Add Number and Boolean types to hyperdb.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 878
diff changeset
327 options = linkcl.filter(None, conditions, [sort_on], [])
621
f333f6decdc2 [SF#516854] "My Issues" and redisplay
Richard Jones <richard@users.sourceforge.net>
parents: 617
diff changeset
328 height = height or min(len(options), 7)
f333f6decdc2 [SF#516854] "My Issues" and redisplay
Richard Jones <richard@users.sourceforge.net>
parents: 617
diff changeset
329 l = ['<select multiple name="%s" size="%s">'%(property, height)]
804
af4826d8773d Default labelprops to id.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 757
diff changeset
330 k = linkcl.labelprop(1)
621
f333f6decdc2 [SF#516854] "My Issues" and redisplay
Richard Jones <richard@users.sourceforge.net>
parents: 617
diff changeset
331 for optionid in options:
f333f6decdc2 [SF#516854] "My Issues" and redisplay
Richard Jones <richard@users.sourceforge.net>
parents: 617
diff changeset
332 option = linkcl.get(optionid, k)
f333f6decdc2 [SF#516854] "My Issues" and redisplay
Richard Jones <richard@users.sourceforge.net>
parents: 617
diff changeset
333 s = ''
672
d92e06a3a56e Fixed display of mutlilink properties...
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 651
diff changeset
334 if optionid in value or option in value:
621
f333f6decdc2 [SF#516854] "My Issues" and redisplay
Richard Jones <richard@users.sourceforge.net>
parents: 617
diff changeset
335 s = 'selected '
f333f6decdc2 [SF#516854] "My Issues" and redisplay
Richard Jones <richard@users.sourceforge.net>
parents: 617
diff changeset
336 if showid:
f333f6decdc2 [SF#516854] "My Issues" and redisplay
Richard Jones <richard@users.sourceforge.net>
parents: 617
diff changeset
337 lab = '%s%s: %s'%(propclass.classname, optionid, option)
f333f6decdc2 [SF#516854] "My Issues" and redisplay
Richard Jones <richard@users.sourceforge.net>
parents: 617
diff changeset
338 else:
f333f6decdc2 [SF#516854] "My Issues" and redisplay
Richard Jones <richard@users.sourceforge.net>
parents: 617
diff changeset
339 lab = option
f333f6decdc2 [SF#516854] "My Issues" and redisplay
Richard Jones <richard@users.sourceforge.net>
parents: 617
diff changeset
340 if size is not None and len(lab) > size:
f333f6decdc2 [SF#516854] "My Issues" and redisplay
Richard Jones <richard@users.sourceforge.net>
parents: 617
diff changeset
341 lab = lab[:size-3] + '...'
757
00d360a4978a Added optional additional property to display in a Multilink form menu.
Richard Jones <richard@users.sourceforge.net>
parents: 755
diff changeset
342 if additional:
00d360a4978a Added optional additional property to display in a Multilink form menu.
Richard Jones <richard@users.sourceforge.net>
parents: 755
diff changeset
343 m = []
00d360a4978a Added optional additional property to display in a Multilink form menu.
Richard Jones <richard@users.sourceforge.net>
parents: 755
diff changeset
344 for propname in additional:
00d360a4978a Added optional additional property to display in a Multilink form menu.
Richard Jones <richard@users.sourceforge.net>
parents: 755
diff changeset
345 m.append(linkcl.get(optionid, propname))
00d360a4978a Added optional additional property to display in a Multilink form menu.
Richard Jones <richard@users.sourceforge.net>
parents: 755
diff changeset
346 lab = lab + ' (%s)'%', '.join(m)
621
f333f6decdc2 [SF#516854] "My Issues" and redisplay
Richard Jones <richard@users.sourceforge.net>
parents: 617
diff changeset
347 lab = cgi.escape(lab)
f333f6decdc2 [SF#516854] "My Issues" and redisplay
Richard Jones <richard@users.sourceforge.net>
parents: 617
diff changeset
348 l.append('<option %svalue="%s">%s</option>'%(s, optionid,
f333f6decdc2 [SF#516854] "My Issues" and redisplay
Richard Jones <richard@users.sourceforge.net>
parents: 617
diff changeset
349 lab))
f333f6decdc2 [SF#516854] "My Issues" and redisplay
Richard Jones <richard@users.sourceforge.net>
parents: 617
diff changeset
350 l.append('</select>')
f333f6decdc2 [SF#516854] "My Issues" and redisplay
Richard Jones <richard@users.sourceforge.net>
parents: 617
diff changeset
351 return '\n'.join(l)
563
0f58d6a35a8b Wrote more unit tests for htmltemplate...
Richard Jones <richard@users.sourceforge.net>
parents: 558
diff changeset
352 if isinstance(propclass, hyperdb.Link):
621
f333f6decdc2 [SF#516854] "My Issues" and redisplay
Richard Jones <richard@users.sourceforge.net>
parents: 617
diff changeset
353 # force the value to be a single choice
f333f6decdc2 [SF#516854] "My Issues" and redisplay
Richard Jones <richard@users.sourceforge.net>
parents: 617
diff changeset
354 if type(value) is types.ListType:
f333f6decdc2 [SF#516854] "My Issues" and redisplay
Richard Jones <richard@users.sourceforge.net>
parents: 617
diff changeset
355 value = value[0]
563
0f58d6a35a8b Wrote more unit tests for htmltemplate...
Richard Jones <richard@users.sourceforge.net>
parents: 558
diff changeset
356 linkcl = self.db.classes[propclass.classname]
0f58d6a35a8b Wrote more unit tests for htmltemplate...
Richard Jones <richard@users.sourceforge.net>
parents: 558
diff changeset
357 l = ['<select name="%s">'%property]
804
af4826d8773d Default labelprops to id.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 757
diff changeset
358 k = linkcl.labelprop(1)
563
0f58d6a35a8b Wrote more unit tests for htmltemplate...
Richard Jones <richard@users.sourceforge.net>
parents: 558
diff changeset
359 s = ''
0f58d6a35a8b Wrote more unit tests for htmltemplate...
Richard Jones <richard@users.sourceforge.net>
parents: 558
diff changeset
360 if value is None:
0f58d6a35a8b Wrote more unit tests for htmltemplate...
Richard Jones <richard@users.sourceforge.net>
parents: 558
diff changeset
361 s = 'selected '
0f58d6a35a8b Wrote more unit tests for htmltemplate...
Richard Jones <richard@users.sourceforge.net>
parents: 558
diff changeset
362 l.append(_('<option %svalue="-1">- no selection -</option>')%s)
806
83becf3faa2f Fix the cycles (a clear method, called after render...
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 804
diff changeset
363 if linkcl.getprops().has_key('order'):
83becf3faa2f Fix the cycles (a clear method, called after render...
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 804
diff changeset
364 sort_on = 'order'
83becf3faa2f Fix the cycles (a clear method, called after render...
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 804
diff changeset
365 else:
880
de3da99a7c02 Add Number and Boolean types to hyperdb.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 878
diff changeset
366 sort_on = linkcl.labelprop()
de3da99a7c02 Add Number and Boolean types to hyperdb.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 878
diff changeset
367 options = linkcl.filter(None, conditions, [sort_on], [])
466
a3548136f7bb Two bug fixes and a feature.
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 411
diff changeset
368 for optionid in options:
25
4cf1daf2f2eb More Grande Splite
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
369 option = linkcl.get(optionid, k)
4cf1daf2f2eb More Grande Splite
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
370 s = ''
672
d92e06a3a56e Fixed display of mutlilink properties...
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 651
diff changeset
371 if value in [optionid, option]:
25
4cf1daf2f2eb More Grande Splite
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
372 s = 'selected '
4cf1daf2f2eb More Grande Splite
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
373 if showid:
4cf1daf2f2eb More Grande Splite
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
374 lab = '%s%s: %s'%(propclass.classname, optionid, option)
4cf1daf2f2eb More Grande Splite
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
375 else:
4cf1daf2f2eb More Grande Splite
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
376 lab = option
4cf1daf2f2eb More Grande Splite
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
377 if size is not None and len(lab) > size:
4cf1daf2f2eb More Grande Splite
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
378 lab = lab[:size-3] + '...'
757
00d360a4978a Added optional additional property to display in a Multilink form menu.
Richard Jones <richard@users.sourceforge.net>
parents: 755
diff changeset
379 if additional:
00d360a4978a Added optional additional property to display in a Multilink form menu.
Richard Jones <richard@users.sourceforge.net>
parents: 755
diff changeset
380 m = []
00d360a4978a Added optional additional property to display in a Multilink form menu.
Richard Jones <richard@users.sourceforge.net>
parents: 755
diff changeset
381 for propname in additional:
00d360a4978a Added optional additional property to display in a Multilink form menu.
Richard Jones <richard@users.sourceforge.net>
parents: 755
diff changeset
382 m.append(linkcl.get(optionid, propname))
878
8828f0f2e825 minor bugfix
Richard Jones <richard@users.sourceforge.net>
parents: 872
diff changeset
383 lab = lab + ' (%s)'%', '.join(map(str, m))
563
0f58d6a35a8b Wrote more unit tests for htmltemplate...
Richard Jones <richard@users.sourceforge.net>
parents: 558
diff changeset
384 lab = cgi.escape(lab)
25
4cf1daf2f2eb More Grande Splite
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
385 l.append('<option %svalue="%s">%s</option>'%(s, optionid, lab))
4cf1daf2f2eb More Grande Splite
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
386 l.append('</select>')
4cf1daf2f2eb More Grande Splite
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
387 return '\n'.join(l)
488
ab9e236cd524 I18N'ification
Richard Jones <richard@users.sourceforge.net>
parents: 467
diff changeset
388 return _('[Menu: not a link]')
25
4cf1daf2f2eb More Grande Splite
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
389
318
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
390 #XXX deviates from spec
673
604c84696461 link() htmltemplate function now has a "showid" option for links & multilinks.
Richard Jones <richard@users.sourceforge.net>
parents: 672
diff changeset
391 def do_link(self, property=None, is_download=0, showid=0):
318
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
392 '''For a Link or Multilink property, display the names of the linked
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
393 nodes, hyperlinked to the item views on those nodes.
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
394 For other properties, link to this node with the property as the
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
395 text.
313
489b70c37f32 feature [SF#473127]: Filenames.
Richard Jones <richard@users.sourceforge.net>
parents: 312
diff changeset
396
318
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
397 If is_download is true, append the property value to the generated
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
398 URL so that the link may be used as a download link and the
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
399 downloaded file name is correct.
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
400 '''
25
4cf1daf2f2eb More Grande Splite
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
401 if not self.nodeid and self.form is None:
488
ab9e236cd524 I18N'ification
Richard Jones <richard@users.sourceforge.net>
parents: 467
diff changeset
402 return _('[Link: not called from item]')
568
c7ead967db85 more htmltemplate tests and cleanup
Richard Jones <richard@users.sourceforge.net>
parents: 563
diff changeset
403
c7ead967db85 more htmltemplate tests and cleanup
Richard Jones <richard@users.sourceforge.net>
parents: 563
diff changeset
404 # get the value
c7ead967db85 more htmltemplate tests and cleanup
Richard Jones <richard@users.sourceforge.net>
parents: 563
diff changeset
405 value = self.determine_value(property)
c7ead967db85 more htmltemplate tests and cleanup
Richard Jones <richard@users.sourceforge.net>
parents: 563
diff changeset
406
25
4cf1daf2f2eb More Grande Splite
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
407 propclass = self.properties[property]
890
a568596dbea7 Unit tests and a few fixes.
Richard Jones <richard@users.sourceforge.net>
parents: 880
diff changeset
408 if isinstance(propclass, hyperdb.Boolean):
a568596dbea7 Unit tests and a few fixes.
Richard Jones <richard@users.sourceforge.net>
parents: 880
diff changeset
409 value = value and "Yes" or "No"
a568596dbea7 Unit tests and a few fixes.
Richard Jones <richard@users.sourceforge.net>
parents: 880
diff changeset
410 elif isinstance(propclass, hyperdb.Link):
930
3c344e942055 Use same regex to split search terms as used to index text.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 926
diff changeset
411 if value in ('', None, []):
3c344e942055 Use same regex to split search terms as used to index text.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 926
diff changeset
412 return _('[no %(propname)s]')%{'propname':property.capitalize()}
245
8a0d548c07a1 Fixed bug in the generation of links to Link/Multilink in indexes.
Richard Jones <richard@users.sourceforge.net>
parents: 244
diff changeset
413 linkname = propclass.classname
8a0d548c07a1 Fixed bug in the generation of links to Link/Multilink in indexes.
Richard Jones <richard@users.sourceforge.net>
parents: 244
diff changeset
414 linkcl = self.db.classes[linkname]
804
af4826d8773d Default labelprops to id.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 757
diff changeset
415 k = linkcl.labelprop(1)
678
9fe50036e8df Fix for date properties as labels.
Richard Jones <richard@users.sourceforge.net>
parents: 676
diff changeset
416 linkvalue = cgi.escape(str(linkcl.get(value, k)))
673
604c84696461 link() htmltemplate function now has a "showid" option for links & multilinks.
Richard Jones <richard@users.sourceforge.net>
parents: 672
diff changeset
417 if showid:
604c84696461 link() htmltemplate function now has a "showid" option for links & multilinks.
Richard Jones <richard@users.sourceforge.net>
parents: 672
diff changeset
418 label = value
676
bc46480e2a2b Fixed serialisation problem...
Richard Jones <richard@users.sourceforge.net>
parents: 673
diff changeset
419 title = ' title="%s"'%linkvalue
bc46480e2a2b Fixed serialisation problem...
Richard Jones <richard@users.sourceforge.net>
parents: 673
diff changeset
420 # note ... this should be urllib.quote(linkcl.get(value, k))
673
604c84696461 link() htmltemplate function now has a "showid" option for links & multilinks.
Richard Jones <richard@users.sourceforge.net>
parents: 672
diff changeset
421 else:
604c84696461 link() htmltemplate function now has a "showid" option for links & multilinks.
Richard Jones <richard@users.sourceforge.net>
parents: 672
diff changeset
422 label = linkvalue
676
bc46480e2a2b Fixed serialisation problem...
Richard Jones <richard@users.sourceforge.net>
parents: 673
diff changeset
423 title = ''
313
489b70c37f32 feature [SF#473127]: Filenames.
Richard Jones <richard@users.sourceforge.net>
parents: 312
diff changeset
424 if is_download:
673
604c84696461 link() htmltemplate function now has a "showid" option for links & multilinks.
Richard Jones <richard@users.sourceforge.net>
parents: 672
diff changeset
425 return '<a href="%s%s/%s"%s>%s</a>'%(linkname, value,
604c84696461 link() htmltemplate function now has a "showid" option for links & multilinks.
Richard Jones <richard@users.sourceforge.net>
parents: 672
diff changeset
426 linkvalue, title, label)
313
489b70c37f32 feature [SF#473127]: Filenames.
Richard Jones <richard@users.sourceforge.net>
parents: 312
diff changeset
427 else:
673
604c84696461 link() htmltemplate function now has a "showid" option for links & multilinks.
Richard Jones <richard@users.sourceforge.net>
parents: 672
diff changeset
428 return '<a href="%s%s"%s>%s</a>'%(linkname, value, title, label)
890
a568596dbea7 Unit tests and a few fixes.
Richard Jones <richard@users.sourceforge.net>
parents: 880
diff changeset
429 elif isinstance(propclass, hyperdb.Multilink):
930
3c344e942055 Use same regex to split search terms as used to index text.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 926
diff changeset
430 if value in ('', None, []):
3c344e942055 Use same regex to split search terms as used to index text.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 926
diff changeset
431 return _('[no %(propname)s]')%{'propname':property.capitalize()}
245
8a0d548c07a1 Fixed bug in the generation of links to Link/Multilink in indexes.
Richard Jones <richard@users.sourceforge.net>
parents: 244
diff changeset
432 linkname = propclass.classname
8a0d548c07a1 Fixed bug in the generation of links to Link/Multilink in indexes.
Richard Jones <richard@users.sourceforge.net>
parents: 244
diff changeset
433 linkcl = self.db.classes[linkname]
804
af4826d8773d Default labelprops to id.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 757
diff changeset
434 k = linkcl.labelprop(1)
25
4cf1daf2f2eb More Grande Splite
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
435 l = []
4cf1daf2f2eb More Grande Splite
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
436 for value in value:
678
9fe50036e8df Fix for date properties as labels.
Richard Jones <richard@users.sourceforge.net>
parents: 676
diff changeset
437 linkvalue = cgi.escape(str(linkcl.get(value, k)))
673
604c84696461 link() htmltemplate function now has a "showid" option for links & multilinks.
Richard Jones <richard@users.sourceforge.net>
parents: 672
diff changeset
438 if showid:
604c84696461 link() htmltemplate function now has a "showid" option for links & multilinks.
Richard Jones <richard@users.sourceforge.net>
parents: 672
diff changeset
439 label = value
604c84696461 link() htmltemplate function now has a "showid" option for links & multilinks.
Richard Jones <richard@users.sourceforge.net>
parents: 672
diff changeset
440 title = ' title="%s"'%linkvalue
676
bc46480e2a2b Fixed serialisation problem...
Richard Jones <richard@users.sourceforge.net>
parents: 673
diff changeset
441 # note ... this should be urllib.quote(linkcl.get(value, k))
673
604c84696461 link() htmltemplate function now has a "showid" option for links & multilinks.
Richard Jones <richard@users.sourceforge.net>
parents: 672
diff changeset
442 else:
604c84696461 link() htmltemplate function now has a "showid" option for links & multilinks.
Richard Jones <richard@users.sourceforge.net>
parents: 672
diff changeset
443 label = linkvalue
676
bc46480e2a2b Fixed serialisation problem...
Richard Jones <richard@users.sourceforge.net>
parents: 673
diff changeset
444 title = ''
313
489b70c37f32 feature [SF#473127]: Filenames.
Richard Jones <richard@users.sourceforge.net>
parents: 312
diff changeset
445 if is_download:
673
604c84696461 link() htmltemplate function now has a "showid" option for links & multilinks.
Richard Jones <richard@users.sourceforge.net>
parents: 672
diff changeset
446 l.append('<a href="%s%s/%s"%s>%s</a>'%(linkname, value,
604c84696461 link() htmltemplate function now has a "showid" option for links & multilinks.
Richard Jones <richard@users.sourceforge.net>
parents: 672
diff changeset
447 linkvalue, title, label))
313
489b70c37f32 feature [SF#473127]: Filenames.
Richard Jones <richard@users.sourceforge.net>
parents: 312
diff changeset
448 else:
673
604c84696461 link() htmltemplate function now has a "showid" option for links & multilinks.
Richard Jones <richard@users.sourceforge.net>
parents: 672
diff changeset
449 l.append('<a href="%s%s"%s>%s</a>'%(linkname, value,
604c84696461 link() htmltemplate function now has a "showid" option for links & multilinks.
Richard Jones <richard@users.sourceforge.net>
parents: 672
diff changeset
450 title, label))
25
4cf1daf2f2eb More Grande Splite
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
451 return ', '.join(l)
313
489b70c37f32 feature [SF#473127]: Filenames.
Richard Jones <richard@users.sourceforge.net>
parents: 312
diff changeset
452 if is_download:
930
3c344e942055 Use same regex to split search terms as used to index text.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 926
diff changeset
453 if value in ('', None, []):
3c344e942055 Use same regex to split search terms as used to index text.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 926
diff changeset
454 return _('[no %(propname)s]')%{'propname':property.capitalize()}
313
489b70c37f32 feature [SF#473127]: Filenames.
Richard Jones <richard@users.sourceforge.net>
parents: 312
diff changeset
455 return '<a href="%s%s/%s">%s</a>'%(self.classname, self.nodeid,
489b70c37f32 feature [SF#473127]: Filenames.
Richard Jones <richard@users.sourceforge.net>
parents: 312
diff changeset
456 value, value)
489b70c37f32 feature [SF#473127]: Filenames.
Richard Jones <richard@users.sourceforge.net>
parents: 312
diff changeset
457 else:
930
3c344e942055 Use same regex to split search terms as used to index text.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 926
diff changeset
458 if value in ('', None, []):
3c344e942055 Use same regex to split search terms as used to index text.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 926
diff changeset
459 value = _('[no %(propname)s]')%{'propname':property.capitalize()}
313
489b70c37f32 feature [SF#473127]: Filenames.
Richard Jones <richard@users.sourceforge.net>
parents: 312
diff changeset
460 return '<a href="%s%s">%s</a>'%(self.classname, self.nodeid, value)
25
4cf1daf2f2eb More Grande Splite
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
461
318
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
462 def do_count(self, property, **args):
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
463 ''' for a Multilink property, display a count of the number of links in
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
464 the list
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
465 '''
25
4cf1daf2f2eb More Grande Splite
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
466 if not self.nodeid:
488
ab9e236cd524 I18N'ification
Richard Jones <richard@users.sourceforge.net>
parents: 467
diff changeset
467 return _('[Count: not called from item]')
574
d41d94511170 more htmltemplate cleanups and unit tests
Richard Jones <richard@users.sourceforge.net>
parents: 568
diff changeset
468
25
4cf1daf2f2eb More Grande Splite
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
469 propclass = self.properties[property]
574
d41d94511170 more htmltemplate cleanups and unit tests
Richard Jones <richard@users.sourceforge.net>
parents: 568
diff changeset
470 if not isinstance(propclass, hyperdb.Multilink):
d41d94511170 more htmltemplate cleanups and unit tests
Richard Jones <richard@users.sourceforge.net>
parents: 568
diff changeset
471 return _('[Count: not a Multilink]')
d41d94511170 more htmltemplate cleanups and unit tests
Richard Jones <richard@users.sourceforge.net>
parents: 568
diff changeset
472
d41d94511170 more htmltemplate cleanups and unit tests
Richard Jones <richard@users.sourceforge.net>
parents: 568
diff changeset
473 # figure the length then...
25
4cf1daf2f2eb More Grande Splite
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
474 value = self.cl.get(self.nodeid, property)
574
d41d94511170 more htmltemplate cleanups and unit tests
Richard Jones <richard@users.sourceforge.net>
parents: 568
diff changeset
475 return str(len(value))
25
4cf1daf2f2eb More Grande Splite
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
476
318
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
477 # XXX pretty is definitely new ;)
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
478 def do_reldate(self, property, pretty=0):
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
479 ''' display a Date property in terms of an interval relative to the
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
480 current date (e.g. "+ 3w", "- 2d").
25
4cf1daf2f2eb More Grande Splite
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
481
318
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
482 with the 'pretty' flag, make it pretty
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
483 '''
25
4cf1daf2f2eb More Grande Splite
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
484 if not self.nodeid and self.form is None:
488
ab9e236cd524 I18N'ification
Richard Jones <richard@users.sourceforge.net>
parents: 467
diff changeset
485 return _('[Reldate: not called from item]')
574
d41d94511170 more htmltemplate cleanups and unit tests
Richard Jones <richard@users.sourceforge.net>
parents: 568
diff changeset
486
25
4cf1daf2f2eb More Grande Splite
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
487 propclass = self.properties[property]
574
d41d94511170 more htmltemplate cleanups and unit tests
Richard Jones <richard@users.sourceforge.net>
parents: 568
diff changeset
488 if not isinstance(propclass, hyperdb.Date):
488
ab9e236cd524 I18N'ification
Richard Jones <richard@users.sourceforge.net>
parents: 467
diff changeset
489 return _('[Reldate: not a Date]')
574
d41d94511170 more htmltemplate cleanups and unit tests
Richard Jones <richard@users.sourceforge.net>
parents: 568
diff changeset
490
25
4cf1daf2f2eb More Grande Splite
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
491 if self.nodeid:
4cf1daf2f2eb More Grande Splite
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
492 value = self.cl.get(self.nodeid, property)
4cf1daf2f2eb More Grande Splite
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
493 else:
574
d41d94511170 more htmltemplate cleanups and unit tests
Richard Jones <richard@users.sourceforge.net>
parents: 568
diff changeset
494 return ''
d41d94511170 more htmltemplate cleanups and unit tests
Richard Jones <richard@users.sourceforge.net>
parents: 568
diff changeset
495 if not value:
d41d94511170 more htmltemplate cleanups and unit tests
Richard Jones <richard@users.sourceforge.net>
parents: 568
diff changeset
496 return ''
d41d94511170 more htmltemplate cleanups and unit tests
Richard Jones <richard@users.sourceforge.net>
parents: 568
diff changeset
497
d41d94511170 more htmltemplate cleanups and unit tests
Richard Jones <richard@users.sourceforge.net>
parents: 568
diff changeset
498 # figure the interval
640
7dd13fd5d8ea fixed some problems in date calculations
Richard Jones <richard@users.sourceforge.net>
parents: 639
diff changeset
499 interval = date.Date('.') - value
25
4cf1daf2f2eb More Grande Splite
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
500 if pretty:
4cf1daf2f2eb More Grande Splite
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
501 if not self.nodeid:
488
ab9e236cd524 I18N'ification
Richard Jones <richard@users.sourceforge.net>
parents: 467
diff changeset
502 return _('now')
721
c63b71a949a8 forgot to fix the templating for last change
Richard Jones <richard@users.sourceforge.net>
parents: 696
diff changeset
503 return interval.pretty()
25
4cf1daf2f2eb More Grande Splite
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
504 return str(interval)
4cf1daf2f2eb More Grande Splite
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
505
318
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
506 def do_download(self, property, **args):
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
507 ''' show a Link("file") or Multilink("file") property using links that
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
508 allow you to download files
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
509 '''
25
4cf1daf2f2eb More Grande Splite
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
510 if not self.nodeid:
488
ab9e236cd524 I18N'ification
Richard Jones <richard@users.sourceforge.net>
parents: 467
diff changeset
511 return _('[Download: not called from item]')
617
edd210915e64 Alternate email addresses are now available for users.
Richard Jones <richard@users.sourceforge.net>
parents: 614
diff changeset
512 return self.do_link(property, is_download=1)
25
4cf1daf2f2eb More Grande Splite
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
513
4cf1daf2f2eb More Grande Splite
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
514
835
255bdcf39e8c added sorting of checklist HTML display
Richard Jones <richard@users.sourceforge.net>
parents: 829
diff changeset
515 def do_checklist(self, property, sortby=None):
318
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
516 ''' for a Link or Multilink property, display checkboxes for the
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
517 available choices to permit filtering
835
255bdcf39e8c added sorting of checklist HTML display
Richard Jones <richard@users.sourceforge.net>
parents: 829
diff changeset
518
255bdcf39e8c added sorting of checklist HTML display
Richard Jones <richard@users.sourceforge.net>
parents: 829
diff changeset
519 sort the checklist by the argument (+/- property name)
318
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
520 '''
25
4cf1daf2f2eb More Grande Splite
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
521 propclass = self.properties[property]
306
36ae7ffb8a42 Fixed Checklist function - wasn't always working on a list.
Richard Jones <richard@users.sourceforge.net>
parents: 303
diff changeset
522 if (not isinstance(propclass, hyperdb.Link) and not
36ae7ffb8a42 Fixed Checklist function - wasn't always working on a list.
Richard Jones <richard@users.sourceforge.net>
parents: 303
diff changeset
523 isinstance(propclass, hyperdb.Multilink)):
488
ab9e236cd524 I18N'ification
Richard Jones <richard@users.sourceforge.net>
parents: 467
diff changeset
524 return _('[Checklist: not a link]')
306
36ae7ffb8a42 Fixed Checklist function - wasn't always working on a list.
Richard Jones <richard@users.sourceforge.net>
parents: 303
diff changeset
525
36ae7ffb8a42 Fixed Checklist function - wasn't always working on a list.
Richard Jones <richard@users.sourceforge.net>
parents: 303
diff changeset
526 # get our current checkbox state
25
4cf1daf2f2eb More Grande Splite
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
527 if self.nodeid:
306
36ae7ffb8a42 Fixed Checklist function - wasn't always working on a list.
Richard Jones <richard@users.sourceforge.net>
parents: 303
diff changeset
528 # get the info from the node - make sure it's a list
307
dac78e092228 CGI interface view customisation section may now be hidden
Richard Jones <richard@users.sourceforge.net>
parents: 306
diff changeset
529 if isinstance(propclass, hyperdb.Link):
306
36ae7ffb8a42 Fixed Checklist function - wasn't always working on a list.
Richard Jones <richard@users.sourceforge.net>
parents: 303
diff changeset
530 value = [self.cl.get(self.nodeid, property)]
36ae7ffb8a42 Fixed Checklist function - wasn't always working on a list.
Richard Jones <richard@users.sourceforge.net>
parents: 303
diff changeset
531 else:
36ae7ffb8a42 Fixed Checklist function - wasn't always working on a list.
Richard Jones <richard@users.sourceforge.net>
parents: 303
diff changeset
532 value = self.cl.get(self.nodeid, property)
128
ce36f2962b94 Fixed handling of passed-in values in form elements (ie. during a drill-down)
Richard Jones <richard@users.sourceforge.net>
parents: 127
diff changeset
533 elif self.filterspec is not None:
306
36ae7ffb8a42 Fixed Checklist function - wasn't always working on a list.
Richard Jones <richard@users.sourceforge.net>
parents: 303
diff changeset
534 # get the state from the filter specification (always a list)
128
ce36f2962b94 Fixed handling of passed-in values in form elements (ie. during a drill-down)
Richard Jones <richard@users.sourceforge.net>
parents: 127
diff changeset
535 value = self.filterspec.get(property, [])
25
4cf1daf2f2eb More Grande Splite
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
536 else:
306
36ae7ffb8a42 Fixed Checklist function - wasn't always working on a list.
Richard Jones <richard@users.sourceforge.net>
parents: 303
diff changeset
537 # it's a new node, so there's no state
25
4cf1daf2f2eb More Grande Splite
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
538 value = []
306
36ae7ffb8a42 Fixed Checklist function - wasn't always working on a list.
Richard Jones <richard@users.sourceforge.net>
parents: 303
diff changeset
539
36ae7ffb8a42 Fixed Checklist function - wasn't always working on a list.
Richard Jones <richard@users.sourceforge.net>
parents: 303
diff changeset
540 # so we can map to the linked node's "lable" property
36ae7ffb8a42 Fixed Checklist function - wasn't always working on a list.
Richard Jones <richard@users.sourceforge.net>
parents: 303
diff changeset
541 linkcl = self.db.classes[propclass.classname]
36ae7ffb8a42 Fixed Checklist function - wasn't always working on a list.
Richard Jones <richard@users.sourceforge.net>
parents: 303
diff changeset
542 l = []
804
af4826d8773d Default labelprops to id.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 757
diff changeset
543 k = linkcl.labelprop(1)
835
255bdcf39e8c added sorting of checklist HTML display
Richard Jones <richard@users.sourceforge.net>
parents: 829
diff changeset
544
255bdcf39e8c added sorting of checklist HTML display
Richard Jones <richard@users.sourceforge.net>
parents: 829
diff changeset
545 # build list of options and then sort it, either
255bdcf39e8c added sorting of checklist HTML display
Richard Jones <richard@users.sourceforge.net>
parents: 829
diff changeset
546 # by id + label or <sortby>-value + label;
255bdcf39e8c added sorting of checklist HTML display
Richard Jones <richard@users.sourceforge.net>
parents: 829
diff changeset
547 # a minus reverses the sort order, while + or no
255bdcf39e8c added sorting of checklist HTML display
Richard Jones <richard@users.sourceforge.net>
parents: 829
diff changeset
548 # prefix sort in increasing order
255bdcf39e8c added sorting of checklist HTML display
Richard Jones <richard@users.sourceforge.net>
parents: 829
diff changeset
549 reversed = 0
255bdcf39e8c added sorting of checklist HTML display
Richard Jones <richard@users.sourceforge.net>
parents: 829
diff changeset
550 if sortby:
255bdcf39e8c added sorting of checklist HTML display
Richard Jones <richard@users.sourceforge.net>
parents: 829
diff changeset
551 if sortby[0] == '-':
255bdcf39e8c added sorting of checklist HTML display
Richard Jones <richard@users.sourceforge.net>
parents: 829
diff changeset
552 reversed = 1
255bdcf39e8c added sorting of checklist HTML display
Richard Jones <richard@users.sourceforge.net>
parents: 829
diff changeset
553 sortby = sortby[1:]
255bdcf39e8c added sorting of checklist HTML display
Richard Jones <richard@users.sourceforge.net>
parents: 829
diff changeset
554 elif sortby[0] == '+':
255bdcf39e8c added sorting of checklist HTML display
Richard Jones <richard@users.sourceforge.net>
parents: 829
diff changeset
555 sortby = sortby[1:]
255bdcf39e8c added sorting of checklist HTML display
Richard Jones <richard@users.sourceforge.net>
parents: 829
diff changeset
556 options = []
306
36ae7ffb8a42 Fixed Checklist function - wasn't always working on a list.
Richard Jones <richard@users.sourceforge.net>
parents: 303
diff changeset
557 for optionid in linkcl.list():
835
255bdcf39e8c added sorting of checklist HTML display
Richard Jones <richard@users.sourceforge.net>
parents: 829
diff changeset
558 if sortby:
255bdcf39e8c added sorting of checklist HTML display
Richard Jones <richard@users.sourceforge.net>
parents: 829
diff changeset
559 sortval = linkcl.get(optionid, sortby)
255bdcf39e8c added sorting of checklist HTML display
Richard Jones <richard@users.sourceforge.net>
parents: 829
diff changeset
560 else:
255bdcf39e8c added sorting of checklist HTML display
Richard Jones <richard@users.sourceforge.net>
parents: 829
diff changeset
561 sortval = int(optionid)
678
9fe50036e8df Fix for date properties as labels.
Richard Jones <richard@users.sourceforge.net>
parents: 676
diff changeset
562 option = cgi.escape(str(linkcl.get(optionid, k)))
835
255bdcf39e8c added sorting of checklist HTML display
Richard Jones <richard@users.sourceforge.net>
parents: 829
diff changeset
563 options.append((sortval, option, optionid))
255bdcf39e8c added sorting of checklist HTML display
Richard Jones <richard@users.sourceforge.net>
parents: 829
diff changeset
564 options.sort()
255bdcf39e8c added sorting of checklist HTML display
Richard Jones <richard@users.sourceforge.net>
parents: 829
diff changeset
565 if reversed:
255bdcf39e8c added sorting of checklist HTML display
Richard Jones <richard@users.sourceforge.net>
parents: 829
diff changeset
566 options.reverse()
255bdcf39e8c added sorting of checklist HTML display
Richard Jones <richard@users.sourceforge.net>
parents: 829
diff changeset
567
255bdcf39e8c added sorting of checklist HTML display
Richard Jones <richard@users.sourceforge.net>
parents: 829
diff changeset
568 # build checkboxes
255bdcf39e8c added sorting of checklist HTML display
Richard Jones <richard@users.sourceforge.net>
parents: 829
diff changeset
569 for sortval, option, optionid in options:
306
36ae7ffb8a42 Fixed Checklist function - wasn't always working on a list.
Richard Jones <richard@users.sourceforge.net>
parents: 303
diff changeset
570 if optionid in value or option in value:
36ae7ffb8a42 Fixed Checklist function - wasn't always working on a list.
Richard Jones <richard@users.sourceforge.net>
parents: 303
diff changeset
571 checked = 'checked'
36ae7ffb8a42 Fixed Checklist function - wasn't always working on a list.
Richard Jones <richard@users.sourceforge.net>
parents: 303
diff changeset
572 else:
36ae7ffb8a42 Fixed Checklist function - wasn't always working on a list.
Richard Jones <richard@users.sourceforge.net>
parents: 303
diff changeset
573 checked = ''
36ae7ffb8a42 Fixed Checklist function - wasn't always working on a list.
Richard Jones <richard@users.sourceforge.net>
parents: 303
diff changeset
574 l.append('%s:<input type="checkbox" %s name="%s" value="%s">'%(
36ae7ffb8a42 Fixed Checklist function - wasn't always working on a list.
Richard Jones <richard@users.sourceforge.net>
parents: 303
diff changeset
575 option, checked, property, option))
312
5a2c43891c20 [SF#473124]: UI inconsistency with Link fields.
Richard Jones <richard@users.sourceforge.net>
parents: 307
diff changeset
576
5a2c43891c20 [SF#473124]: UI inconsistency with Link fields.
Richard Jones <richard@users.sourceforge.net>
parents: 307
diff changeset
577 # for Links, allow the "unselected" option too
5a2c43891c20 [SF#473124]: UI inconsistency with Link fields.
Richard Jones <richard@users.sourceforge.net>
parents: 307
diff changeset
578 if isinstance(propclass, hyperdb.Link):
5a2c43891c20 [SF#473124]: UI inconsistency with Link fields.
Richard Jones <richard@users.sourceforge.net>
parents: 307
diff changeset
579 if value is None or '-1' in value:
5a2c43891c20 [SF#473124]: UI inconsistency with Link fields.
Richard Jones <richard@users.sourceforge.net>
parents: 307
diff changeset
580 checked = 'checked'
5a2c43891c20 [SF#473124]: UI inconsistency with Link fields.
Richard Jones <richard@users.sourceforge.net>
parents: 307
diff changeset
581 else:
5a2c43891c20 [SF#473124]: UI inconsistency with Link fields.
Richard Jones <richard@users.sourceforge.net>
parents: 307
diff changeset
582 checked = ''
488
ab9e236cd524 I18N'ification
Richard Jones <richard@users.sourceforge.net>
parents: 467
diff changeset
583 l.append(_('[unselected]:<input type="checkbox" %s name="%s" '
ab9e236cd524 I18N'ification
Richard Jones <richard@users.sourceforge.net>
parents: 467
diff changeset
584 'value="-1">')%(checked, property))
306
36ae7ffb8a42 Fixed Checklist function - wasn't always working on a list.
Richard Jones <richard@users.sourceforge.net>
parents: 303
diff changeset
585 return '\n'.join(l)
25
4cf1daf2f2eb More Grande Splite
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
586
318
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
587 def do_note(self, rows=5, cols=80):
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
588 ''' display a "note" field, which is a text area for entering a note to
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
589 go along with a change.
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
590 '''
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
591 # TODO: pull the value from the form
342
0b7d62e414b6 Added the wrap="hard" attribute to the textarea of the note field...
Richard Jones <richard@users.sourceforge.net>
parents: 340
diff changeset
592 return '<textarea name="__note" wrap="hard" rows=%s cols=%s>'\
0b7d62e414b6 Added the wrap="hard" attribute to the textarea of the note field...
Richard Jones <richard@users.sourceforge.net>
parents: 340
diff changeset
593 '</textarea>'%(rows, cols)
25
4cf1daf2f2eb More Grande Splite
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
594
318
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
595 # XXX new function
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
596 def do_list(self, property, reverse=0):
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
597 ''' list the items specified by property using the standard index for
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
598 the class
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
599 '''
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
600 propcl = self.properties[property]
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
601 if not isinstance(propcl, hyperdb.Multilink):
488
ab9e236cd524 I18N'ification
Richard Jones <richard@users.sourceforge.net>
parents: 467
diff changeset
602 return _('[List: not a Multilink]')
577
334ae707ebfc more HTML template cleanup and unit tests
Richard Jones <richard@users.sourceforge.net>
parents: 576
diff changeset
603
334ae707ebfc more HTML template cleanup and unit tests
Richard Jones <richard@users.sourceforge.net>
parents: 576
diff changeset
604 value = self.determine_value(property)
581
137d7fc5234d real (non-string, duh) sorting of lists by node id
Richard Jones <richard@users.sourceforge.net>
parents: 577
diff changeset
605 if not value:
137d7fc5234d real (non-string, duh) sorting of lists by node id
Richard Jones <richard@users.sourceforge.net>
parents: 577
diff changeset
606 return ''
577
334ae707ebfc more HTML template cleanup and unit tests
Richard Jones <richard@users.sourceforge.net>
parents: 576
diff changeset
607
581
137d7fc5234d real (non-string, duh) sorting of lists by node id
Richard Jones <richard@users.sourceforge.net>
parents: 577
diff changeset
608 # sort, possibly revers and then re-stringify
137d7fc5234d real (non-string, duh) sorting of lists by node id
Richard Jones <richard@users.sourceforge.net>
parents: 577
diff changeset
609 value = map(int, value)
576
f98f37697f4c More HTML template cleanup and unit tests.
Richard Jones <richard@users.sourceforge.net>
parents: 575
diff changeset
610 value.sort()
244
6bf584784e31 Fixed missing import in mailgw :(
Richard Jones <richard@users.sourceforge.net>
parents: 231
diff changeset
611 if reverse:
6bf584784e31 Fixed missing import in mailgw :(
Richard Jones <richard@users.sourceforge.net>
parents: 231
diff changeset
612 value.reverse()
581
137d7fc5234d real (non-string, duh) sorting of lists by node id
Richard Jones <richard@users.sourceforge.net>
parents: 577
diff changeset
613 value = map(str, value)
318
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
614
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
615 # render the sub-index into a string
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
616 fp = StringIO.StringIO()
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
617 try:
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
618 write_save = self.client.write
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
619 self.client.write = fp.write
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
620 index = IndexTemplate(self.client, self.templates, propcl.classname)
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
621 index.render(nodeids=value, show_display_form=0)
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
622 finally:
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
623 self.client.write = write_save
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
624
25
4cf1daf2f2eb More Grande Splite
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
625 return fp.getvalue()
4cf1daf2f2eb More Grande Splite
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
626
318
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
627 # XXX new function
552
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
628 def do_history(self, direction='descending'):
318
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
629 ''' list the history of the item
552
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
630
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
631 If "direction" is 'descending' then the most recent event will
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
632 be displayed first. If it is 'ascending' then the oldest event
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
633 will be displayed first.
318
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
634 '''
141
5e8da9d010bd Handles new node display now.
Richard Jones <richard@users.sourceforge.net>
parents: 131
diff changeset
635 if self.nodeid is None:
488
ab9e236cd524 I18N'ification
Richard Jones <richard@users.sourceforge.net>
parents: 467
diff changeset
636 return _("[History: node doesn't exist]")
141
5e8da9d010bd Handles new node display now.
Richard Jones <richard@users.sourceforge.net>
parents: 131
diff changeset
637
25
4cf1daf2f2eb More Grande Splite
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
638 l = ['<table width=100% border=0 cellspacing=0 cellpadding=2>',
4cf1daf2f2eb More Grande Splite
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
639 '<tr class="list-header">',
552
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
640 _('<th align=left><span class="list-item">Date</span></th>'),
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
641 _('<th align=left><span class="list-item">User</span></th>'),
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
642 _('<th align=left><span class="list-item">Action</span></th>'),
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
643 _('<th align=left><span class="list-item">Args</span></th>'),
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
644 '</tr>']
25
4cf1daf2f2eb More Grande Splite
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
645
552
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
646 comments = {}
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
647 history = self.cl.history(self.nodeid)
576
f98f37697f4c More HTML template cleanup and unit tests.
Richard Jones <richard@users.sourceforge.net>
parents: 575
diff changeset
648 history.sort()
552
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
649 if direction == 'descending':
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
650 history.reverse()
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
651 for id, evt_date, user, action, args in history:
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
652 date_s = str(evt_date).replace("."," ")
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
653 arg_s = ''
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
654 if action == 'link' and type(args) == type(()):
547
e4ef6df2345c display links a html link in history.
Engelbert Gruber <grubert@users.sourceforge.net>
parents: 538
diff changeset
655 if len(args) == 3:
552
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
656 linkcl, linkid, key = args
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
657 arg_s += '<a href="%s%s">%s%s %s</a>'%(linkcl, linkid,
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
658 linkcl, linkid, key)
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
659 else:
651
6257d4e49d2a Ran it through pychecker, made fixes
Richard Jones <richard@users.sourceforge.net>
parents: 640
diff changeset
660 arg_s = str(args)
552
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
661
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
662 elif action == 'unlink' and type(args) == type(()):
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
663 if len(args) == 3:
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
664 linkcl, linkid, key = args
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
665 arg_s += '<a href="%s%s">%s%s %s</a>'%(linkcl, linkid,
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
666 linkcl, linkid, key)
547
e4ef6df2345c display links a html link in history.
Engelbert Gruber <grubert@users.sourceforge.net>
parents: 538
diff changeset
667 else:
651
6257d4e49d2a Ran it through pychecker, made fixes
Richard Jones <richard@users.sourceforge.net>
parents: 640
diff changeset
668 arg_s = str(args)
552
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
669
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
670 elif type(args) == type({}):
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
671 cell = []
547
e4ef6df2345c display links a html link in history.
Engelbert Gruber <grubert@users.sourceforge.net>
parents: 538
diff changeset
672 for k in args.keys():
552
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
673 # try to get the relevant property and treat it
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
674 # specially
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
675 try:
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
676 prop = self.properties[k]
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
677 except:
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
678 prop = None
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
679 if prop is not None:
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
680 if args[k] and (isinstance(prop, hyperdb.Multilink) or
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
681 isinstance(prop, hyperdb.Link)):
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
682 # figure what the link class is
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
683 classname = prop.classname
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
684 try:
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
685 linkcl = self.db.classes[classname]
651
6257d4e49d2a Ran it through pychecker, made fixes
Richard Jones <richard@users.sourceforge.net>
parents: 640
diff changeset
686 except KeyError:
552
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
687 labelprop = None
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
688 comments[classname] = _('''The linked class
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
689 %(classname)s no longer exists''')%locals()
804
af4826d8773d Default labelprops to id.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 757
diff changeset
690 labelprop = linkcl.labelprop(1)
af4826d8773d Default labelprops to id.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 757
diff changeset
691 hrefable = os.path.exists(
af4826d8773d Default labelprops to id.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 757
diff changeset
692 os.path.join(self.templates, classname+'.item'))
552
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
693
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
694 if isinstance(prop, hyperdb.Multilink) and \
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
695 len(args[k]) > 0:
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
696 ml = []
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
697 for linkid in args[k]:
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
698 label = classname + linkid
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
699 # if we have a label property, try to use it
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
700 # TODO: test for node existence even when
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
701 # there's no labelprop!
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
702 try:
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
703 if labelprop is not None:
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
704 label = linkcl.get(linkid, labelprop)
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
705 except IndexError:
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
706 comments['no_link'] = _('''<strike>The
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
707 linked node no longer
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
708 exists</strike>''')
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
709 ml.append('<strike>%s</strike>'%label)
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
710 else:
804
af4826d8773d Default labelprops to id.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 757
diff changeset
711 if hrefable:
af4826d8773d Default labelprops to id.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 757
diff changeset
712 ml.append('<a href="%s%s">%s</a>'%(
af4826d8773d Default labelprops to id.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 757
diff changeset
713 classname, linkid, label))
af4826d8773d Default labelprops to id.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 757
diff changeset
714 else:
af4826d8773d Default labelprops to id.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 757
diff changeset
715 ml.append(label)
552
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
716 cell.append('%s:\n %s'%(k, ',\n '.join(ml)))
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
717 elif isinstance(prop, hyperdb.Link) and args[k]:
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
718 label = classname + args[k]
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
719 # if we have a label property, try to use it
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
720 # TODO: test for node existence even when
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
721 # there's no labelprop!
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
722 if labelprop is not None:
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
723 try:
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
724 label = linkcl.get(args[k], labelprop)
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
725 except IndexError:
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
726 comments['no_link'] = _('''<strike>The
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
727 linked node no longer
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
728 exists</strike>''')
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
729 cell.append(' <strike>%s</strike>,\n'%label)
556
50359de2800b Fixed up the HTML display of history so valid links are actually displayed.
Richard Jones <richard@users.sourceforge.net>
parents: 554
diff changeset
730 # "flag" this is done .... euwww
50359de2800b Fixed up the HTML display of history so valid links are actually displayed.
Richard Jones <richard@users.sourceforge.net>
parents: 554
diff changeset
731 label = None
50359de2800b Fixed up the HTML display of history so valid links are actually displayed.
Richard Jones <richard@users.sourceforge.net>
parents: 554
diff changeset
732 if label is not None:
804
af4826d8773d Default labelprops to id.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 757
diff changeset
733 if hrefable:
af4826d8773d Default labelprops to id.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 757
diff changeset
734 cell.append('%s: <a href="%s%s">%s</a>\n'%(k,
af4826d8773d Default labelprops to id.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 757
diff changeset
735 classname, args[k], label))
af4826d8773d Default labelprops to id.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 757
diff changeset
736 else:
af4826d8773d Default labelprops to id.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 757
diff changeset
737 cell.append('%s: %s' % (k,label))
552
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
738
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
739 elif isinstance(prop, hyperdb.Date) and args[k]:
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
740 d = date.Date(args[k])
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
741 cell.append('%s: %s'%(k, str(d)))
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
742
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
743 elif isinstance(prop, hyperdb.Interval) and args[k]:
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
744 d = date.Interval(args[k])
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
745 cell.append('%s: %s'%(k, str(d)))
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
746
804
af4826d8773d Default labelprops to id.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 757
diff changeset
747 elif isinstance(prop, hyperdb.String) and args[k]:
af4826d8773d Default labelprops to id.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 757
diff changeset
748 cell.append('%s: %s'%(k, cgi.escape(args[k])))
af4826d8773d Default labelprops to id.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 757
diff changeset
749
552
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
750 elif not args[k]:
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
751 cell.append('%s: (no value)\n'%k)
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
752
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
753 else:
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
754 cell.append('%s: %s\n'%(k, str(args[k])))
548
3f25182ed425 display superseder as html link in history.
Engelbert Gruber <grubert@users.sourceforge.net>
parents: 547
diff changeset
755 else:
552
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
756 # property no longer exists
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
757 comments['no_exist'] = _('''<em>The indicated property
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
758 no longer exists</em>''')
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
759 cell.append('<em>%s: %s</em>\n'%(k, str(args[k])))
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
760 arg_s = '<br />'.join(cell)
547
e4ef6df2345c display links a html link in history.
Engelbert Gruber <grubert@users.sourceforge.net>
parents: 538
diff changeset
761 else:
552
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
762 # unkown event!!
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
763 comments['unknown'] = _('''<strong><em>This event is not
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
764 handled by the history display!</em></strong>''')
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
765 arg_s = '<strong><em>' + str(args) + '</em></strong>'
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
766 date_s = date_s.replace(' ', '&nbsp;')
554
7e7b4183a8bd add nowrap to history table date cell i.e. <td nowrap ...
Engelbert Gruber <grubert@users.sourceforge.net>
parents: 552
diff changeset
767 l.append('<tr><td nowrap valign=top>%s</td><td valign=top>%s</td>'
552
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
768 '<td valign=top>%s</td><td valign=top>%s</td></tr>'%(date_s,
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
769 user, action, arg_s))
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
770 if comments:
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
771 l.append(_('<tr><td colspan=4><strong>Note:</strong></td></tr>'))
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
772 for entry in comments.values():
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
773 l.append('<tr><td colspan=4>%s</td></tr>'%entry)
25
4cf1daf2f2eb More Grande Splite
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
774 l.append('</table>')
4cf1daf2f2eb More Grande Splite
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
775 return '\n'.join(l)
4cf1daf2f2eb More Grande Splite
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
776
318
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
777 # XXX new function
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
778 def do_submit(self):
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
779 ''' add a submit button for the item
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
780 '''
25
4cf1daf2f2eb More Grande Splite
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
781 if self.nodeid:
526
523b22a2c021 The submit buttons need a name attribute...
Richard Jones <richard@users.sourceforge.net>
parents: 525
diff changeset
782 return _('<input type="submit" name="submit" value="Submit Changes">')
25
4cf1daf2f2eb More Grande Splite
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
783 elif self.form is not None:
526
523b22a2c021 The submit buttons need a name attribute...
Richard Jones <richard@users.sourceforge.net>
parents: 525
diff changeset
784 return _('<input type="submit" name="submit" value="Submit New Entry">')
25
4cf1daf2f2eb More Grande Splite
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
785 else:
488
ab9e236cd524 I18N'ification
Richard Jones <richard@users.sourceforge.net>
parents: 467
diff changeset
786 return _('[Submit: not called from item]')
829
37ce3f2e05b2 added email display function
Richard Jones <richard@users.sourceforge.net>
parents: 826
diff changeset
787
639
Richard Jones <richard@users.sourceforge.net>
parents: 638
diff changeset
788 def do_classhelp(self, classname, properties, label='?', width='400',
Richard Jones <richard@users.sourceforge.net>
parents: 638
diff changeset
789 height='400'):
634
53549c6a7b33 *** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents: 627
diff changeset
790 '''pop up a javascript window with class help
639
Richard Jones <richard@users.sourceforge.net>
parents: 638
diff changeset
791
Richard Jones <richard@users.sourceforge.net>
parents: 638
diff changeset
792 This generates a link to a popup window which displays the
Richard Jones <richard@users.sourceforge.net>
parents: 638
diff changeset
793 properties indicated by "properties" of the class named by
Richard Jones <richard@users.sourceforge.net>
parents: 638
diff changeset
794 "classname". The "properties" should be a comma-separated list
Richard Jones <richard@users.sourceforge.net>
parents: 638
diff changeset
795 (eg. 'id,name,description').
Richard Jones <richard@users.sourceforge.net>
parents: 638
diff changeset
796
Richard Jones <richard@users.sourceforge.net>
parents: 638
diff changeset
797 You may optionally override the label displayed, the width and
Richard Jones <richard@users.sourceforge.net>
parents: 638
diff changeset
798 height. The popup window will be resizable and scrollable.
634
53549c6a7b33 *** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents: 627
diff changeset
799 '''
53549c6a7b33 *** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents: 627
diff changeset
800 return '<a href="javascript:help_window(\'classhelp?classname=%s&' \
638
21b3cfa7d99a ... and label, width and height control for extra flavour!
Richard Jones <richard@users.sourceforge.net>
parents: 635
diff changeset
801 'properties=%s\', \'%s\', \'%s\')"><b>(%s)</b></a>'%(classname,
21b3cfa7d99a ... and label, width and height control for extra flavour!
Richard Jones <richard@users.sourceforge.net>
parents: 635
diff changeset
802 properties, width, height, label)
829
37ce3f2e05b2 added email display function
Richard Jones <richard@users.sourceforge.net>
parents: 826
diff changeset
803
37ce3f2e05b2 added email display function
Richard Jones <richard@users.sourceforge.net>
parents: 826
diff changeset
804 def do_email(self, property, escape=0):
37ce3f2e05b2 added email display function
Richard Jones <richard@users.sourceforge.net>
parents: 826
diff changeset
805 '''display the property as one or more "fudged" email addrs
37ce3f2e05b2 added email display function
Richard Jones <richard@users.sourceforge.net>
parents: 826
diff changeset
806 '''
37ce3f2e05b2 added email display function
Richard Jones <richard@users.sourceforge.net>
parents: 826
diff changeset
807 if not self.nodeid and self.form is None:
37ce3f2e05b2 added email display function
Richard Jones <richard@users.sourceforge.net>
parents: 826
diff changeset
808 return _('[Email: not called from item]')
37ce3f2e05b2 added email display function
Richard Jones <richard@users.sourceforge.net>
parents: 826
diff changeset
809 propclass = self.properties[property]
37ce3f2e05b2 added email display function
Richard Jones <richard@users.sourceforge.net>
parents: 826
diff changeset
810 if self.nodeid:
37ce3f2e05b2 added email display function
Richard Jones <richard@users.sourceforge.net>
parents: 826
diff changeset
811 # get the value for this property
37ce3f2e05b2 added email display function
Richard Jones <richard@users.sourceforge.net>
parents: 826
diff changeset
812 try:
37ce3f2e05b2 added email display function
Richard Jones <richard@users.sourceforge.net>
parents: 826
diff changeset
813 value = self.cl.get(self.nodeid, property)
37ce3f2e05b2 added email display function
Richard Jones <richard@users.sourceforge.net>
parents: 826
diff changeset
814 except KeyError:
37ce3f2e05b2 added email display function
Richard Jones <richard@users.sourceforge.net>
parents: 826
diff changeset
815 # a KeyError here means that the node doesn't have a value
37ce3f2e05b2 added email display function
Richard Jones <richard@users.sourceforge.net>
parents: 826
diff changeset
816 # for the specified property
37ce3f2e05b2 added email display function
Richard Jones <richard@users.sourceforge.net>
parents: 826
diff changeset
817 value = ''
37ce3f2e05b2 added email display function
Richard Jones <richard@users.sourceforge.net>
parents: 826
diff changeset
818 else:
37ce3f2e05b2 added email display function
Richard Jones <richard@users.sourceforge.net>
parents: 826
diff changeset
819 value = ''
37ce3f2e05b2 added email display function
Richard Jones <richard@users.sourceforge.net>
parents: 826
diff changeset
820 if isinstance(propclass, hyperdb.String):
37ce3f2e05b2 added email display function
Richard Jones <richard@users.sourceforge.net>
parents: 826
diff changeset
821 if value is None: value = ''
37ce3f2e05b2 added email display function
Richard Jones <richard@users.sourceforge.net>
parents: 826
diff changeset
822 else: value = str(value)
37ce3f2e05b2 added email display function
Richard Jones <richard@users.sourceforge.net>
parents: 826
diff changeset
823 value = value.replace('@', ' at ')
37ce3f2e05b2 added email display function
Richard Jones <richard@users.sourceforge.net>
parents: 826
diff changeset
824 value = value.replace('.', ' ')
37ce3f2e05b2 added email display function
Richard Jones <richard@users.sourceforge.net>
parents: 826
diff changeset
825 else:
37ce3f2e05b2 added email display function
Richard Jones <richard@users.sourceforge.net>
parents: 826
diff changeset
826 value = _('[Email: not a string]')%locals()
37ce3f2e05b2 added email display function
Richard Jones <richard@users.sourceforge.net>
parents: 826
diff changeset
827 if escape:
37ce3f2e05b2 added email display function
Richard Jones <richard@users.sourceforge.net>
parents: 826
diff changeset
828 value = cgi.escape(value)
37ce3f2e05b2 added email display function
Richard Jones <richard@users.sourceforge.net>
parents: 826
diff changeset
829 return value
37ce3f2e05b2 added email display function
Richard Jones <richard@users.sourceforge.net>
parents: 826
diff changeset
830
872
bd6211d39328 Saving, running & editing queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 835
diff changeset
831 def do_filterspec(self, classprop, urlprop):
bd6211d39328 Saving, running & editing queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 835
diff changeset
832 cl = self.db.getclass(self.classname)
bd6211d39328 Saving, running & editing queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 835
diff changeset
833 qs = cl.get(self.nodeid, urlprop)
bd6211d39328 Saving, running & editing queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 835
diff changeset
834 classname = cl.get(self.nodeid, classprop)
bd6211d39328 Saving, running & editing queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 835
diff changeset
835 all_columns = self.db.getclass(classname).getprops().keys()
bd6211d39328 Saving, running & editing queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 835
diff changeset
836 filterspec = {}
bd6211d39328 Saving, running & editing queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 835
diff changeset
837 query = cgi.parse_qs(qs)
bd6211d39328 Saving, running & editing queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 835
diff changeset
838 for k,v in query.items():
bd6211d39328 Saving, running & editing queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 835
diff changeset
839 query[k] = v[0].split(',')
bd6211d39328 Saving, running & editing queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 835
diff changeset
840 pagesize = query.get(':pagesize',['25'])[0]
926
3216c4f06ec4 Fixes to the search form and saving queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 915
diff changeset
841 search_text = query.get('search_text', [''])[0]
3216c4f06ec4 Fixes to the search form and saving queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 915
diff changeset
842 search_text = urllib.unquote(search_text)
872
bd6211d39328 Saving, running & editing queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 835
diff changeset
843 for k,v in query.items():
bd6211d39328 Saving, running & editing queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 835
diff changeset
844 if k[0] != ':':
bd6211d39328 Saving, running & editing queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 835
diff changeset
845 filterspec[k] = v
bd6211d39328 Saving, running & editing queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 835
diff changeset
846 ixtmplt = IndexTemplate(self.client, self.templates, classname)
902
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
847 qform = '<form onSubmit="return submit_once()" action="%s%s">\n'%(
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
848 self.classname,self.nodeid)
926
3216c4f06ec4 Fixes to the search form and saving queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 915
diff changeset
849 qform += ixtmplt.filter_form(search_text,
872
bd6211d39328 Saving, running & editing queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 835
diff changeset
850 query.get(':filter', []),
bd6211d39328 Saving, running & editing queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 835
diff changeset
851 query.get(':columns', []),
bd6211d39328 Saving, running & editing queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 835
diff changeset
852 query.get(':group', []),
bd6211d39328 Saving, running & editing queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 835
diff changeset
853 all_columns,
bd6211d39328 Saving, running & editing queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 835
diff changeset
854 query.get(':sort',[]),
bd6211d39328 Saving, running & editing queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 835
diff changeset
855 filterspec,
bd6211d39328 Saving, running & editing queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 835
diff changeset
856 pagesize)
bd6211d39328 Saving, running & editing queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 835
diff changeset
857 ixtmplt.clear()
bd6211d39328 Saving, running & editing queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 835
diff changeset
858 return qform + '</table>\n'
902
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
859
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
860 #
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
861 # templating subtitution methods
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
862 #
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
863 def execute_template(self, text):
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
864 ''' do the replacement of the template stuff with useful
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
865 information
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
866 '''
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
867 replace = re.compile(
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
868 r'((<require\s+(?P<cond>.+?)>(?P<ok>.+?)'
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
869 r'(<else>(?P<fail>.*?))?</require>)|'
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
870 r'(<property\s+name="(?P<name>[^>]+)">(?P<text>.+?)</property>)|'
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
871 r'(?P<display><display\s+call="(?P<command>[^"]+)">))', re.I|re.S)
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
872 return replace.sub(self.subfunc, text)
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
873
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
874 #
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
875 # secutiry <require> tag handling
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
876 #
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
877 condre = re.compile('(\w+?)\s*=\s*"([^"]+?)"')
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
878 def handle_require(self, condition, ok, fail):
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
879 userid = self.db.user.lookup(self.client.user)
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
880 security = self.db.security
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
881
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
882 # get the conditions
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
883 l = self.condre.findall(condition)
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
884 d = {}
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
885 for k,v in l:
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
886 d[k] = v
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
887
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
888 # see if one of the permissions are available
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
889 if d.has_key('permission'):
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
890 l.remove(('permission', d['permission']))
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
891 for value in d['permission'].split(','):
905
502a5ae11cc5 Very close now. The cgi and mailgw now use the new security API.
Richard Jones <richard@users.sourceforge.net>
parents: 902
diff changeset
892 if security.hasPermission(value, userid, self.classname):
902
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
893 # just passing the permission is OK
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
894 return self.execute_template(ok)
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
895
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
896 # try the attr conditions until one is met
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
897 for propname, value in d.items():
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
898 if propname == 'permission':
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
899 continue
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
900 if not security.hasNodePermission(self.classname, self.nodeid,
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
901 **{value: userid}):
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
902 break
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
903 else:
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
904 if l:
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
905 # there were tests, and we didn't fail any of them so we're OK
915
930b57864dc8 nicer error messages, and a bugfix
Richard Jones <richard@users.sourceforge.net>
parents: 913
diff changeset
906 if ok:
930b57864dc8 nicer error messages, and a bugfix
Richard Jones <richard@users.sourceforge.net>
parents: 913
diff changeset
907 return self.execute_template(ok)
930b57864dc8 nicer error messages, and a bugfix
Richard Jones <richard@users.sourceforge.net>
parents: 913
diff changeset
908 else:
930b57864dc8 nicer error messages, and a bugfix
Richard Jones <richard@users.sourceforge.net>
parents: 913
diff changeset
909 return ''
902
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
910
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
911 # nope, fail
915
930b57864dc8 nicer error messages, and a bugfix
Richard Jones <richard@users.sourceforge.net>
parents: 913
diff changeset
912 if fail:
930b57864dc8 nicer error messages, and a bugfix
Richard Jones <richard@users.sourceforge.net>
parents: 913
diff changeset
913 return self.execute_template(fail)
930b57864dc8 nicer error messages, and a bugfix
Richard Jones <richard@users.sourceforge.net>
parents: 913
diff changeset
914 else:
930b57864dc8 nicer error messages, and a bugfix
Richard Jones <richard@users.sourceforge.net>
parents: 913
diff changeset
915 return ''
829
37ce3f2e05b2 added email display function
Richard Jones <richard@users.sourceforge.net>
parents: 826
diff changeset
916
25
4cf1daf2f2eb More Grande Splite
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
917 #
4cf1daf2f2eb More Grande Splite
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
918 # INDEX TEMPLATES
4cf1daf2f2eb More Grande Splite
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
919 #
318
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
920 class IndexTemplate(TemplateFunctions):
651
6257d4e49d2a Ran it through pychecker, made fixes
Richard Jones <richard@users.sourceforge.net>
parents: 640
diff changeset
921 '''Templating functionality specifically for index pages
6257d4e49d2a Ran it through pychecker, made fixes
Richard Jones <richard@users.sourceforge.net>
parents: 640
diff changeset
922 '''
318
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
923 def __init__(self, client, templates, classname):
651
6257d4e49d2a Ran it through pychecker, made fixes
Richard Jones <richard@users.sourceforge.net>
parents: 640
diff changeset
924 TemplateFunctions.__init__(self)
902
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
925 self.globals['handle_require'] = self.handle_require
318
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
926 self.client = client
524
dce4c75bef5a changed all config accesses...
Richard Jones <richard@users.sourceforge.net>
parents: 515
diff changeset
927 self.instance = client.instance
318
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
928 self.templates = templates
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
929 self.classname = classname
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
930
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
931 # derived
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
932 self.db = self.client.db
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
933 self.cl = self.db.classes[self.classname]
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
934 self.properties = self.cl.getprops()
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
935
821
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
936 def clear(self):
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
937 self.db = self.cl = self.properties = None
930
3c344e942055 Use same regex to split search terms as used to index text.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 926
diff changeset
938 del self.globals['handle_require']
821
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
939 TemplateFunctions.clear(self)
902
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
940
821
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
941 def buildurl(self, filterspec, search_text, filter, columns, sort, group, pagesize):
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
942 d = {'pagesize':pagesize, 'pagesize':pagesize, 'classname':self.classname}
926
3216c4f06ec4 Fixes to the search form and saving queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 915
diff changeset
943 if search_text:
3216c4f06ec4 Fixes to the search form and saving queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 915
diff changeset
944 d['searchtext'] = 'search_text=%s&' % search_text
3216c4f06ec4 Fixes to the search form and saving queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 915
diff changeset
945 else:
3216c4f06ec4 Fixes to the search form and saving queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 915
diff changeset
946 d['searchtext'] = ''
821
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
947 d['filter'] = ','.join(map(urllib.quote,filter))
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
948 d['columns'] = ','.join(map(urllib.quote,columns))
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
949 d['sort'] = ','.join(map(urllib.quote,sort))
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
950 d['group'] = ','.join(map(urllib.quote,group))
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
951 tmp = []
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
952 for col, vals in filterspec.items():
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
953 vals = ','.join(map(urllib.quote,vals))
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
954 tmp.append('%s=%s' % (col, vals))
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
955 d['filters'] = '&'.join(tmp)
926
3216c4f06ec4 Fixes to the search form and saving queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 915
diff changeset
956 return '%(classname)s?%(searchtext)s%(filters)s&:sort=%(sort)s&:filter=%(filter)s&:group=%(group)s&:columns=%(columns)s&:pagesize=%(pagesize)s' % d
821
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
957
318
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
958 col_re=re.compile(r'<property\s+name="([^>]+)">')
749
51c425129b35 Merged search_indexing-branch with HEAD
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 721
diff changeset
959 def render(self, filterspec={}, search_text='', filter=[], columns=[],
51c425129b35 Merged search_indexing-branch with HEAD
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 721
diff changeset
960 sort=[], group=[], show_display_form=1, nodeids=None,
821
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
961 show_customization=1, show_nodes=1, pagesize=50, startwith=0):
804
af4826d8773d Default labelprops to id.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 757
diff changeset
962
318
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
963 self.filterspec = filterspec
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
964
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
965 w = self.client.write
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
966
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
967 # XXX deviate from spec here ...
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
968 # load the index section template and figure the default columns from it
627
952679be9e2c Added simple editing for classes that don't define a templated interface.
Richard Jones <richard@users.sourceforge.net>
parents: 623
diff changeset
969 try:
952679be9e2c Added simple editing for classes that don't define a templated interface.
Richard Jones <richard@users.sourceforge.net>
parents: 623
diff changeset
970 template = open(os.path.join(self.templates,
952679be9e2c Added simple editing for classes that don't define a templated interface.
Richard Jones <richard@users.sourceforge.net>
parents: 623
diff changeset
971 self.classname+'.index')).read()
952679be9e2c Added simple editing for classes that don't define a templated interface.
Richard Jones <richard@users.sourceforge.net>
parents: 623
diff changeset
972 except IOError, error:
952679be9e2c Added simple editing for classes that don't define a templated interface.
Richard Jones <richard@users.sourceforge.net>
parents: 623
diff changeset
973 if error.errno not in (errno.ENOENT, errno.ESRCH): raise
952679be9e2c Added simple editing for classes that don't define a templated interface.
Richard Jones <richard@users.sourceforge.net>
parents: 623
diff changeset
974 raise MissingTemplateError, self.classname+'.index'
318
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
975 all_columns = self.col_re.findall(template)
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
976 if not columns:
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
977 columns = []
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
978 for name in all_columns:
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
979 columns.append(name)
25
4cf1daf2f2eb More Grande Splite
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
980 else:
318
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
981 # re-sort columns to be the same order as all_columns
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
982 l = []
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
983 for name in all_columns:
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
984 if name in columns:
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
985 l.append(name)
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
986 columns = l
25
4cf1daf2f2eb More Grande Splite
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
987
902
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
988 # TODO this is for the RE replacer func, and could probably be done
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
989 # better
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
990 self.props = columns
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
991
320
61c42790c3f1 Bugfix in filter "widget" placement, thanks Roch'e
Richard Jones <richard@users.sourceforge.net>
parents: 318
diff changeset
992 # display the filter section
524
dce4c75bef5a changed all config accesses...
Richard Jones <richard@users.sourceforge.net>
parents: 515
diff changeset
993 if (show_display_form and
dce4c75bef5a changed all config accesses...
Richard Jones <richard@users.sourceforge.net>
parents: 515
diff changeset
994 self.instance.FILTER_POSITION in ('top and bottom', 'top')):
614
5fdf95e6c20a . All forms now have "double-submit" protection...
Richard Jones <richard@users.sourceforge.net>
parents: 581
diff changeset
995 w('<form onSubmit="return submit_once()" action="%s">\n'%self.classname)
902
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
996 self.filter_section(search_text, filter, columns, group,
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
997 all_columns, sort, filterspec, pagesize, startwith)
320
61c42790c3f1 Bugfix in filter "widget" placement, thanks Roch'e
Richard Jones <richard@users.sourceforge.net>
parents: 318
diff changeset
998
318
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
999 # now display the index section
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
1000 w('<table width=100% border=0 cellspacing=0 cellpadding=2>\n')
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
1001 w('<tr class="list-header">\n')
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
1002 for name in columns:
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
1003 cname = name.capitalize()
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
1004 if show_display_form:
926
3216c4f06ec4 Fixes to the search form and saving queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 915
diff changeset
1005 sb = self.sortby(name, search_text, filterspec, columns, filter,
3216c4f06ec4 Fixes to the search form and saving queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 915
diff changeset
1006 group, sort, pagesize)
318
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
1007 anchor = "%s?%s"%(self.classname, sb)
902
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
1008 w('<td><span class="list-header"><a href="%s">%s</a>'
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
1009 '</span></td>\n'%(anchor, cname))
318
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
1010 else:
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
1011 w('<td><span class="list-header">%s</span></td>\n'%cname)
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
1012 w('</tr>\n')
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
1013
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
1014 # this stuff is used for group headings - optimise the group names
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
1015 old_group = None
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
1016 group_names = []
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
1017 if group:
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
1018 for name in group:
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
1019 if name[0] == '-': group_names.append(name[1:])
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
1020 else: group_names.append(name)
25
4cf1daf2f2eb More Grande Splite
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
1021
318
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
1022 # now actually loop through all the nodes we get from the filter and
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
1023 # apply the template
749
51c425129b35 Merged search_indexing-branch with HEAD
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 721
diff changeset
1024 if show_nodes:
51c425129b35 Merged search_indexing-branch with HEAD
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 721
diff changeset
1025 matches = None
51c425129b35 Merged search_indexing-branch with HEAD
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 721
diff changeset
1026 if nodeids is None:
51c425129b35 Merged search_indexing-branch with HEAD
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 721
diff changeset
1027 if search_text != '':
826
6d7a45c8464a Added reindex command to roundup-admin.
Richard Jones <richard@users.sourceforge.net>
parents: 821
diff changeset
1028 matches = self.db.indexer.search(
930
3c344e942055 Use same regex to split search terms as used to index text.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 926
diff changeset
1029 re.findall(r'\b\w{2,25}\b', search_text), self.cl)
3c344e942055 Use same regex to split search terms as used to index text.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 926
diff changeset
1030 #search_text.split(' '), self.cl)
749
51c425129b35 Merged search_indexing-branch with HEAD
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 721
diff changeset
1031 nodeids = self.cl.filter(matches, filterspec, sort, group)
821
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
1032 for nodeid in nodeids[startwith:startwith+pagesize]:
749
51c425129b35 Merged search_indexing-branch with HEAD
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 721
diff changeset
1033 # check for a group heading
51c425129b35 Merged search_indexing-branch with HEAD
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 721
diff changeset
1034 if group_names:
51c425129b35 Merged search_indexing-branch with HEAD
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 721
diff changeset
1035 this_group = [self.cl.get(nodeid, name, _('[no value]'))
51c425129b35 Merged search_indexing-branch with HEAD
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 721
diff changeset
1036 for name in group_names]
51c425129b35 Merged search_indexing-branch with HEAD
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 721
diff changeset
1037 if this_group != old_group:
51c425129b35 Merged search_indexing-branch with HEAD
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 721
diff changeset
1038 l = []
51c425129b35 Merged search_indexing-branch with HEAD
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 721
diff changeset
1039 for name in group_names:
51c425129b35 Merged search_indexing-branch with HEAD
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 721
diff changeset
1040 prop = self.properties[name]
51c425129b35 Merged search_indexing-branch with HEAD
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 721
diff changeset
1041 if isinstance(prop, hyperdb.Link):
51c425129b35 Merged search_indexing-branch with HEAD
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 721
diff changeset
1042 group_cl = self.db.classes[prop.classname]
51c425129b35 Merged search_indexing-branch with HEAD
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 721
diff changeset
1043 key = group_cl.getkey()
821
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
1044 if key is None:
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
1045 key = group_cl.labelprop()
749
51c425129b35 Merged search_indexing-branch with HEAD
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 721
diff changeset
1046 value = self.cl.get(nodeid, name)
51c425129b35 Merged search_indexing-branch with HEAD
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 721
diff changeset
1047 if value is None:
51c425129b35 Merged search_indexing-branch with HEAD
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 721
diff changeset
1048 l.append(_('[unselected %(classname)s]')%{
51c425129b35 Merged search_indexing-branch with HEAD
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 721
diff changeset
1049 'classname': prop.classname})
51c425129b35 Merged search_indexing-branch with HEAD
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 721
diff changeset
1050 else:
821
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
1051 l.append(group_cl.get(value, key))
749
51c425129b35 Merged search_indexing-branch with HEAD
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 721
diff changeset
1052 elif isinstance(prop, hyperdb.Multilink):
51c425129b35 Merged search_indexing-branch with HEAD
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 721
diff changeset
1053 group_cl = self.db.classes[prop.classname]
51c425129b35 Merged search_indexing-branch with HEAD
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 721
diff changeset
1054 key = group_cl.getkey()
51c425129b35 Merged search_indexing-branch with HEAD
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 721
diff changeset
1055 for value in self.cl.get(nodeid, name):
51c425129b35 Merged search_indexing-branch with HEAD
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 721
diff changeset
1056 l.append(group_cl.get(value, key))
318
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
1057 else:
749
51c425129b35 Merged search_indexing-branch with HEAD
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 721
diff changeset
1058 value = self.cl.get(nodeid, name,
51c425129b35 Merged search_indexing-branch with HEAD
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 721
diff changeset
1059 _('[no value]'))
51c425129b35 Merged search_indexing-branch with HEAD
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 721
diff changeset
1060 if value is None:
51c425129b35 Merged search_indexing-branch with HEAD
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 721
diff changeset
1061 value = _('[empty %(name)s]')%locals()
51c425129b35 Merged search_indexing-branch with HEAD
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 721
diff changeset
1062 else:
51c425129b35 Merged search_indexing-branch with HEAD
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 721
diff changeset
1063 value = str(value)
51c425129b35 Merged search_indexing-branch with HEAD
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 721
diff changeset
1064 l.append(value)
51c425129b35 Merged search_indexing-branch with HEAD
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 721
diff changeset
1065 w('<tr class="section-bar">'
51c425129b35 Merged search_indexing-branch with HEAD
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 721
diff changeset
1066 '<td align=middle colspan=%s>'
872
bd6211d39328 Saving, running & editing queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 835
diff changeset
1067 '<strong>%s</strong></td></tr>\n'%(
749
51c425129b35 Merged search_indexing-branch with HEAD
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 721
diff changeset
1068 len(columns), ', '.join(l)))
51c425129b35 Merged search_indexing-branch with HEAD
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 721
diff changeset
1069 old_group = this_group
318
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
1070
749
51c425129b35 Merged search_indexing-branch with HEAD
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 721
diff changeset
1071 # display this node's row
905
502a5ae11cc5 Very close now. The cgi and mailgw now use the new security API.
Richard Jones <richard@users.sourceforge.net>
parents: 902
diff changeset
1072 self.nodeid = nodeid
502a5ae11cc5 Very close now. The cgi and mailgw now use the new security API.
Richard Jones <richard@users.sourceforge.net>
parents: 902
diff changeset
1073 w(self.execute_template(template))
749
51c425129b35 Merged search_indexing-branch with HEAD
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 721
diff changeset
1074 if matches:
51c425129b35 Merged search_indexing-branch with HEAD
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 721
diff changeset
1075 self.node_matches(matches[nodeid], len(columns))
51c425129b35 Merged search_indexing-branch with HEAD
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 721
diff changeset
1076 self.nodeid = None
318
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
1077
872
bd6211d39328 Saving, running & editing queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 835
diff changeset
1078 w('</table>\n')
821
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
1079 # the previous and next links
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
1080 if nodeids:
902
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
1081 baseurl = self.buildurl(filterspec, search_text, filter,
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
1082 columns, sort, group, pagesize)
821
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
1083 if startwith > 0:
902
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
1084 prevurl = '<a href="%s&:startwith=%s">&lt;&lt; '\
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
1085 'Previous page</a>'%(baseurl, max(0, startwith-pagesize))
821
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
1086 else:
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
1087 prevurl = ""
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
1088 if startwith + pagesize < len(nodeids):
902
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
1089 nexturl = '<a href="%s&:startwith=%s">Next page '\
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
1090 '&gt;&gt;</a>'%(baseurl, startwith+pagesize)
821
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
1091 else:
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
1092 nexturl = ""
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
1093 if prevurl or nexturl:
902
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
1094 w('''<table width="100%%"><tr>
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
1095 <td width="50%%" align="center">%s</td>
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
1096 <td width="50%%" align="center">%s</td>
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
1097 </tr></table>\n'''%(prevurl, nexturl))
128
ce36f2962b94 Fixed handling of passed-in values in form elements (ie. during a drill-down)
Richard Jones <richard@users.sourceforge.net>
parents: 127
diff changeset
1098
318
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
1099 # display the filter section
524
dce4c75bef5a changed all config accesses...
Richard Jones <richard@users.sourceforge.net>
parents: 515
diff changeset
1100 if (show_display_form and hasattr(self.instance, 'FILTER_POSITION') and
dce4c75bef5a changed all config accesses...
Richard Jones <richard@users.sourceforge.net>
parents: 515
diff changeset
1101 self.instance.FILTER_POSITION in ('top and bottom', 'bottom')):
902
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
1102 w('<form onSubmit="return submit_once()" action="%s">\n'%
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
1103 self.classname)
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
1104 self.filter_section(search_text, filter, columns, group,
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
1105 all_columns, sort, filterspec, pagesize, startwith)
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
1106 self.clear()
316
c0ca7f35e0c5 Added configuration for:
Richard Jones <richard@users.sourceforge.net>
parents: 313
diff changeset
1107
902
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
1108 def subfunc(self, m, search_text=None, filter=None, columns=None,
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
1109 sort=None, group=None):
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
1110 ''' called as part of the template replacement
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
1111 '''
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
1112 if m.group('cond'):
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
1113 # call the template handler for require
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
1114 require = self.globals['handle_require']
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
1115 return self.handle_require(m.group('cond'), m.group('ok'),
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
1116 m.group('fail'))
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
1117 if m.group('name'):
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
1118 if m.group('name') in self.props:
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
1119 text = m.group('text')
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
1120 return self.execute_template(text)
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
1121 else:
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
1122 return ''
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
1123 if m.group('display'):
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
1124 command = m.group('command')
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
1125 return eval(command, self.globals, {})
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
1126 return '*** unhandled match: %s'%str(m.groupdict())
804
af4826d8773d Default labelprops to id.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 757
diff changeset
1127
749
51c425129b35 Merged search_indexing-branch with HEAD
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 721
diff changeset
1128 def node_matches(self, match, colspan):
51c425129b35 Merged search_indexing-branch with HEAD
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 721
diff changeset
1129 ''' display the files and messages for a node that matched a
51c425129b35 Merged search_indexing-branch with HEAD
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 721
diff changeset
1130 full text search
51c425129b35 Merged search_indexing-branch with HEAD
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 721
diff changeset
1131 '''
51c425129b35 Merged search_indexing-branch with HEAD
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 721
diff changeset
1132 w = self.client.write
312
5a2c43891c20 [SF#473124]: UI inconsistency with Link fields.
Richard Jones <richard@users.sourceforge.net>
parents: 307
diff changeset
1133
749
51c425129b35 Merged search_indexing-branch with HEAD
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 721
diff changeset
1134 message_links = []
51c425129b35 Merged search_indexing-branch with HEAD
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 721
diff changeset
1135 file_links = []
51c425129b35 Merged search_indexing-branch with HEAD
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 721
diff changeset
1136 if match.has_key('messages'):
51c425129b35 Merged search_indexing-branch with HEAD
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 721
diff changeset
1137 for msgid in match['messages']:
804
af4826d8773d Default labelprops to id.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 757
diff changeset
1138 k = self.db.msg.labelprop(1)
749
51c425129b35 Merged search_indexing-branch with HEAD
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 721
diff changeset
1139 lab = self.db.msg.get(msgid, k)
51c425129b35 Merged search_indexing-branch with HEAD
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 721
diff changeset
1140 msgpath = 'msg%s'%msgid
51c425129b35 Merged search_indexing-branch with HEAD
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 721
diff changeset
1141 message_links.append('<a href="%(msgpath)s">%(lab)s</a>'
51c425129b35 Merged search_indexing-branch with HEAD
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 721
diff changeset
1142 %locals())
51c425129b35 Merged search_indexing-branch with HEAD
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 721
diff changeset
1143 w(_('<tr class="row-hilite"><td colspan="%s">'
872
bd6211d39328 Saving, running & editing queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 835
diff changeset
1144 '&nbsp;&nbsp;Matched messages: %s</td></tr>\n')%(
749
51c425129b35 Merged search_indexing-branch with HEAD
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 721
diff changeset
1145 colspan, ', '.join(message_links)))
51c425129b35 Merged search_indexing-branch with HEAD
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 721
diff changeset
1146
51c425129b35 Merged search_indexing-branch with HEAD
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 721
diff changeset
1147 if match.has_key('files'):
51c425129b35 Merged search_indexing-branch with HEAD
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 721
diff changeset
1148 for fileid in match['files']:
51c425129b35 Merged search_indexing-branch with HEAD
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 721
diff changeset
1149 filename = self.db.file.get(fileid, 'name')
51c425129b35 Merged search_indexing-branch with HEAD
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 721
diff changeset
1150 filepath = 'file%s/%s'%(fileid, filename)
51c425129b35 Merged search_indexing-branch with HEAD
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 721
diff changeset
1151 file_links.append('<a href="%(filepath)s">%(filename)s</a>'
51c425129b35 Merged search_indexing-branch with HEAD
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 721
diff changeset
1152 %locals())
51c425129b35 Merged search_indexing-branch with HEAD
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 721
diff changeset
1153 w(_('<tr class="row-hilite"><td colspan="%s">'
872
bd6211d39328 Saving, running & editing queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 835
diff changeset
1154 '&nbsp;&nbsp;Matched files: %s</td></tr>\n')%(
749
51c425129b35 Merged search_indexing-branch with HEAD
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 721
diff changeset
1155 colspan, ', '.join(file_links)))
51c425129b35 Merged search_indexing-branch with HEAD
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 721
diff changeset
1156
902
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
1157 def filter_form(self, search_text, filter, columns, group, all_columns,
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
1158 sort, filterspec, pagesize):
821
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
1159 sortspec = {}
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
1160 for i in range(len(sort)):
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
1161 mod = ''
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
1162 colnm = sort[i]
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
1163 if colnm[0] == '-':
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
1164 mod = '-'
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
1165 colnm = colnm[1:]
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
1166 sortspec[colnm] = '%d%s' % (i+1, mod)
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
1167
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
1168 startwith = 0
872
bd6211d39328 Saving, running & editing queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 835
diff changeset
1169 rslt = []
bd6211d39328 Saving, running & editing queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 835
diff changeset
1170 w = rslt.append
318
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
1171
821
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
1172 # display the filter section
872
bd6211d39328 Saving, running & editing queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 835
diff changeset
1173 w( '<br>')
bd6211d39328 Saving, running & editing queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 835
diff changeset
1174 w( '<table border=0 cellspacing=0 cellpadding=1>')
bd6211d39328 Saving, running & editing queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 835
diff changeset
1175 w( '<tr class="list-header">')
bd6211d39328 Saving, running & editing queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 835
diff changeset
1176 w(_(' <th align="left" colspan="7">Filter specification...</th>'))
bd6211d39328 Saving, running & editing queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 835
diff changeset
1177 w( '</tr>')
821
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
1178 # see if we have any indexed properties
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
1179 if self.classname in self.db.config.HEADER_SEARCH_LINKS:
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
1180 #if self.properties.has_key('messages') or self.properties.has_key('files'):
872
bd6211d39328 Saving, running & editing queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 835
diff changeset
1181 w( '<tr class="location-bar">')
bd6211d39328 Saving, running & editing queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 835
diff changeset
1182 w( ' <td align="right" class="form-label"><b>Search Terms</b></td>')
bd6211d39328 Saving, running & editing queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 835
diff changeset
1183 w( ' <td colspan=6 class="form-text">&nbsp;&nbsp;&nbsp;<input type="text" name="search_text" value="%s" size="50"></td>' % search_text)
bd6211d39328 Saving, running & editing queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 835
diff changeset
1184 w( '</tr>')
bd6211d39328 Saving, running & editing queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 835
diff changeset
1185 w( '<tr class="location-bar">')
bd6211d39328 Saving, running & editing queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 835
diff changeset
1186 w( ' <th align="center" width="20%">&nbsp;</th>')
bd6211d39328 Saving, running & editing queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 835
diff changeset
1187 w(_(' <th align="center" width="10%">Show</th>'))
bd6211d39328 Saving, running & editing queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 835
diff changeset
1188 w(_(' <th align="center" width="10%">Group</th>'))
bd6211d39328 Saving, running & editing queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 835
diff changeset
1189 w(_(' <th align="center" width="10%">Sort</th>'))
bd6211d39328 Saving, running & editing queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 835
diff changeset
1190 w(_(' <th colspan="3" align="center">Condition</th>'))
bd6211d39328 Saving, running & editing queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 835
diff changeset
1191 w( '</tr>')
821
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
1192
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
1193 for nm in all_columns:
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
1194 propdescr = self.properties.get(nm, None)
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
1195 if not propdescr:
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
1196 print "hey sysadmin - %s is not a property of %r" % (nm, self.classname)
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
1197 continue
872
bd6211d39328 Saving, running & editing queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 835
diff changeset
1198 w( '<tr class="location-bar">')
bd6211d39328 Saving, running & editing queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 835
diff changeset
1199 w(_(' <td align="right" class="form-label"><b>%s</b></td>' % nm.capitalize()))
821
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
1200 # show column - can't show multilinks
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
1201 if isinstance(propdescr, hyperdb.Multilink):
872
bd6211d39328 Saving, running & editing queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 835
diff changeset
1202 w(' <td></td>')
821
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
1203 else:
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
1204 checked = columns and nm in columns or 0
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
1205 checked = ('', 'checked')[checked]
872
bd6211d39328 Saving, running & editing queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 835
diff changeset
1206 w(' <td align="center" class="form-text"><input type="checkbox" name=":columns" value="%s" %s></td>' % (nm, checked) )
821
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
1207 # can only group on Link
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
1208 if isinstance(propdescr, hyperdb.Link):
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
1209 checked = group and nm in group or 0
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
1210 checked = ('', 'checked')[checked]
872
bd6211d39328 Saving, running & editing queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 835
diff changeset
1211 w(' <td align="center" class="form-text"><input type="checkbox" name=":group" value="%s" %s></td>' % (nm, checked) )
821
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
1212 else:
872
bd6211d39328 Saving, running & editing queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 835
diff changeset
1213 w(' <td></td>')
821
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
1214 # sort - no sort on Multilinks
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
1215 if isinstance(propdescr, hyperdb.Multilink):
872
bd6211d39328 Saving, running & editing queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 835
diff changeset
1216 w('<td></td>')
821
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
1217 else:
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
1218 val = sortspec.get(nm, '')
872
bd6211d39328 Saving, running & editing queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 835
diff changeset
1219 w('<td align="center" class="form-text"><input type="text" name=":%s_ss" size="3" value="%s"></td>' % (nm,val))
821
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
1220 # condition
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
1221 val = ''
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
1222 if isinstance(propdescr, hyperdb.Link):
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
1223 op = "is in&nbsp;"
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
1224 xtra = '<a href="javascript:help_window(\'classhelp?classname=%s&properties=id,%s\', \'200\', \'400\')"><b>(list)</b></a>'\
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
1225 % (propdescr.classname, self.db.getclass(propdescr.classname).labelprop())
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
1226 val = ','.join(filterspec.get(nm, ''))
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
1227 elif isinstance(propdescr, hyperdb.Multilink):
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
1228 op = "contains&nbsp;"
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
1229 xtra = '<a href="javascript:help_window(\'classhelp?classname=%s&properties=id,%s\', \'200\', \'400\')"><b>(list)</b></a>'\
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
1230 % (propdescr.classname, self.db.getclass(propdescr.classname).labelprop())
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
1231 val = ','.join(filterspec.get(nm, ''))
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
1232 elif isinstance(propdescr, hyperdb.String) and nm != 'id':
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
1233 op = "equals&nbsp;"
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
1234 xtra = ""
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
1235 val = filterspec.get(nm, '')
880
de3da99a7c02 Add Number and Boolean types to hyperdb.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 878
diff changeset
1236 elif isinstance(propdescr, hyperdb.Boolean):
de3da99a7c02 Add Number and Boolean types to hyperdb.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 878
diff changeset
1237 op = "is&nbsp;"
de3da99a7c02 Add Number and Boolean types to hyperdb.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 878
diff changeset
1238 xtra = ""
de3da99a7c02 Add Number and Boolean types to hyperdb.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 878
diff changeset
1239 val = filterspec.get(nm, None)
de3da99a7c02 Add Number and Boolean types to hyperdb.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 878
diff changeset
1240 if val is not None:
de3da99a7c02 Add Number and Boolean types to hyperdb.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 878
diff changeset
1241 val = 'True' and val or 'False'
de3da99a7c02 Add Number and Boolean types to hyperdb.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 878
diff changeset
1242 else:
de3da99a7c02 Add Number and Boolean types to hyperdb.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 878
diff changeset
1243 val = ''
de3da99a7c02 Add Number and Boolean types to hyperdb.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 878
diff changeset
1244 elif isinstance(propdescr, hyperdb.Number):
de3da99a7c02 Add Number and Boolean types to hyperdb.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 878
diff changeset
1245 op = "equals&nbsp;"
de3da99a7c02 Add Number and Boolean types to hyperdb.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 878
diff changeset
1246 xtra = ""
de3da99a7c02 Add Number and Boolean types to hyperdb.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 878
diff changeset
1247 val = str(filterspec.get(nm, ''))
821
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
1248 else:
872
bd6211d39328 Saving, running & editing queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 835
diff changeset
1249 w('<td></td><td></td><td></td></tr>')
821
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
1250 continue
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
1251 checked = filter and nm in filter or 0
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
1252 checked = ('', 'checked')[checked]
872
bd6211d39328 Saving, running & editing queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 835
diff changeset
1253 w( ' <td class="form-text"><input type="checkbox" name=":filter" value="%s" %s></td>' % (nm, checked))
bd6211d39328 Saving, running & editing queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 835
diff changeset
1254 w(_(' <td class="form-label" nowrap>%s</td><td class="form-text" nowrap><input type="text" name=":%s_fs" value="%s" size=50>%s</td>' % (op, nm, val, xtra)))
bd6211d39328 Saving, running & editing queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 835
diff changeset
1255 w( '</tr>')
bd6211d39328 Saving, running & editing queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 835
diff changeset
1256 w('<tr class="location-bar">')
bd6211d39328 Saving, running & editing queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 835
diff changeset
1257 w(' <td colspan=7><hr></td>')
bd6211d39328 Saving, running & editing queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 835
diff changeset
1258 w('</tr>')
bd6211d39328 Saving, running & editing queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 835
diff changeset
1259 w('<tr class="location-bar">')
bd6211d39328 Saving, running & editing queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 835
diff changeset
1260 w(_(' <td align="right" class="form-label">Pagesize</td>'))
bd6211d39328 Saving, running & editing queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 835
diff changeset
1261 w(' <td colspan=2 align="center" class="form-text"><input type="text" name=":pagesize" size="3" value="%s"></td>' % pagesize)
bd6211d39328 Saving, running & editing queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 835
diff changeset
1262 w(' <td colspan=4></td>')
bd6211d39328 Saving, running & editing queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 835
diff changeset
1263 w('</tr>')
bd6211d39328 Saving, running & editing queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 835
diff changeset
1264 w('<tr class="location-bar">')
bd6211d39328 Saving, running & editing queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 835
diff changeset
1265 w(_(' <td align="right" class="form-label">Start With</td>'))
bd6211d39328 Saving, running & editing queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 835
diff changeset
1266 w(' <td colspan=2 align="center" class="form-text"><input type="text" name=":startwith" size="3" value="%s"></td>' % startwith)
bd6211d39328 Saving, running & editing queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 835
diff changeset
1267 w(' <td colspan=3></td>')
bd6211d39328 Saving, running & editing queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 835
diff changeset
1268 w(' <td></td>')
bd6211d39328 Saving, running & editing queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 835
diff changeset
1269 w('</tr>')
bd6211d39328 Saving, running & editing queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 835
diff changeset
1270
bd6211d39328 Saving, running & editing queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 835
diff changeset
1271 return '\n'.join(rslt)
bd6211d39328 Saving, running & editing queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 835
diff changeset
1272
902
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
1273 def filter_section(self, search_text, filter, columns, group, all_columns,
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
1274 sort, filterspec, pagesize, startwith):
872
bd6211d39328 Saving, running & editing queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 835
diff changeset
1275 w = self.client.write
bd6211d39328 Saving, running & editing queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 835
diff changeset
1276 w(self.filter_form(search_text, filter, columns, group, all_columns,
bd6211d39328 Saving, running & editing queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 835
diff changeset
1277 sort, filterspec, pagesize))
bd6211d39328 Saving, running & editing queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 835
diff changeset
1278 w(' <tr class="location-bar">\n')
bd6211d39328 Saving, running & editing queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 835
diff changeset
1279 w(' <td colspan=7><hr></td>\n')
bd6211d39328 Saving, running & editing queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 835
diff changeset
1280 w(' </tr>\n')
bd6211d39328 Saving, running & editing queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 835
diff changeset
1281 w(' <tr class="location-bar">\n')
bd6211d39328 Saving, running & editing queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 835
diff changeset
1282 w(' <td>&nbsp;</td>\n')
bd6211d39328 Saving, running & editing queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 835
diff changeset
1283 w(' <td colspan=6><input type="submit" name="Query" value="Redisplay"></td>\n')
bd6211d39328 Saving, running & editing queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 835
diff changeset
1284 w(' </tr>\n')
893
897425e40859 Fixes/improvements to the search form & saved queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 890
diff changeset
1285 if (self.db.getclass('user').getprops().has_key('queries')
897425e40859 Fixes/improvements to the search form & saved queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 890
diff changeset
1286 and not self.client.user in (None, "anonymous")):
872
bd6211d39328 Saving, running & editing queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 835
diff changeset
1287 w(' <tr class="location-bar">\n')
bd6211d39328 Saving, running & editing queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 835
diff changeset
1288 w(' <td colspan=7><hr></td>\n')
bd6211d39328 Saving, running & editing queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 835
diff changeset
1289 w(' </tr>\n')
bd6211d39328 Saving, running & editing queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 835
diff changeset
1290 w(' <tr class="location-bar">\n')
bd6211d39328 Saving, running & editing queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 835
diff changeset
1291 w(' <td align=right class="form-label">Name</td>\n')
893
897425e40859 Fixes/improvements to the search form & saved queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 890
diff changeset
1292 w(' <td colspan=2 class="form-text"><input type="text" name=":name" value=""></td>\n')
897425e40859 Fixes/improvements to the search form & saved queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 890
diff changeset
1293 w(' <td colspan=4 rowspan=2 class="form-help">If you give the query a name '
897425e40859 Fixes/improvements to the search form & saved queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 890
diff changeset
1294 'and click <b>Save</b>, it will appear on your menu. Saved queries may be '
897425e40859 Fixes/improvements to the search form & saved queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 890
diff changeset
1295 'edited by going to <b>My Details</b> and clicking on the query name.</td>')
872
bd6211d39328 Saving, running & editing queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 835
diff changeset
1296 w(' </tr>\n')
bd6211d39328 Saving, running & editing queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 835
diff changeset
1297 w(' <tr class="location-bar">\n')
bd6211d39328 Saving, running & editing queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 835
diff changeset
1298 w(' <td>&nbsp;</td><input type="hidden" name=":classname" value="%s">\n' % self.classname)
893
897425e40859 Fixes/improvements to the search form & saved queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 890
diff changeset
1299 w(' <td colspan=2><input type="submit" name="Query" value="Save"></td>\n')
872
bd6211d39328 Saving, running & editing queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 835
diff changeset
1300 w(' </tr>\n')
351
6932067a8f31 More HTML compliance fixes.
Richard Jones <richard@users.sourceforge.net>
parents: 350
diff changeset
1301 w('</table>\n')
307
dac78e092228 CGI interface view customisation section may now be hidden
Richard Jones <richard@users.sourceforge.net>
parents: 306
diff changeset
1302
926
3216c4f06ec4 Fixes to the search form and saving queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 915
diff changeset
1303 def sortby(self, sort_name, search_text, filterspec, columns, filter, group, sort,
3216c4f06ec4 Fixes to the search form and saving queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 915
diff changeset
1304 pagesize):
913
50363eaed280 Removed the confusing, ugly two-column sorting stuff.
Richard Jones <richard@users.sourceforge.net>
parents: 905
diff changeset
1305 ''' Figure the link for a column heading so we can sort by that
50363eaed280 Removed the confusing, ugly two-column sorting stuff.
Richard Jones <richard@users.sourceforge.net>
parents: 905
diff changeset
1306 column
50363eaed280 Removed the confusing, ugly two-column sorting stuff.
Richard Jones <richard@users.sourceforge.net>
parents: 905
diff changeset
1307 '''
318
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
1308 l = []
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
1309 w = l.append
926
3216c4f06ec4 Fixes to the search form and saving queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 915
diff changeset
1310 if search_text:
3216c4f06ec4 Fixes to the search form and saving queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 915
diff changeset
1311 w('search_text=%s' % search_text)
318
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
1312 for k, v in filterspec.items():
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
1313 k = urllib.quote(k)
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
1314 if type(v) == type([]):
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
1315 w('%s=%s'%(k, ','.join(map(urllib.quote, v))))
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
1316 else:
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
1317 w('%s=%s'%(k, urllib.quote(v)))
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
1318 if columns:
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
1319 w(':columns=%s'%','.join(map(urllib.quote, columns)))
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
1320 if filter:
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
1321 w(':filter=%s'%','.join(map(urllib.quote, filter)))
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
1322 if group:
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
1323 w(':group=%s'%','.join(map(urllib.quote, group)))
821
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
1324 w(':pagesize=%s' % pagesize)
926
3216c4f06ec4 Fixes to the search form and saving queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 915
diff changeset
1325 w(':startwith=0')
913
50363eaed280 Removed the confusing, ugly two-column sorting stuff.
Richard Jones <richard@users.sourceforge.net>
parents: 905
diff changeset
1326
50363eaed280 Removed the confusing, ugly two-column sorting stuff.
Richard Jones <richard@users.sourceforge.net>
parents: 905
diff changeset
1327 # handle the sorting - if we're already sorting by this column,
50363eaed280 Removed the confusing, ugly two-column sorting stuff.
Richard Jones <richard@users.sourceforge.net>
parents: 905
diff changeset
1328 # then reverse the sorting, otherwise set the sorting to be this
50363eaed280 Removed the confusing, ugly two-column sorting stuff.
Richard Jones <richard@users.sourceforge.net>
parents: 905
diff changeset
1329 # column only
50363eaed280 Removed the confusing, ugly two-column sorting stuff.
Richard Jones <richard@users.sourceforge.net>
parents: 905
diff changeset
1330 sorting = None
50363eaed280 Removed the confusing, ugly two-column sorting stuff.
Richard Jones <richard@users.sourceforge.net>
parents: 905
diff changeset
1331 if len(sort) == 1:
50363eaed280 Removed the confusing, ugly two-column sorting stuff.
Richard Jones <richard@users.sourceforge.net>
parents: 905
diff changeset
1332 name = sort[0]
318
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
1333 dir = name[0]
913
50363eaed280 Removed the confusing, ugly two-column sorting stuff.
Richard Jones <richard@users.sourceforge.net>
parents: 905
diff changeset
1334 if dir == '-' and name[1:] == sort_name:
50363eaed280 Removed the confusing, ugly two-column sorting stuff.
Richard Jones <richard@users.sourceforge.net>
parents: 905
diff changeset
1335 sorting = ':sort=%s'%sort_name
50363eaed280 Removed the confusing, ugly two-column sorting stuff.
Richard Jones <richard@users.sourceforge.net>
parents: 905
diff changeset
1336 elif name == sort_name:
50363eaed280 Removed the confusing, ugly two-column sorting stuff.
Richard Jones <richard@users.sourceforge.net>
parents: 905
diff changeset
1337 sorting = ':sort=-%s'%sort_name
50363eaed280 Removed the confusing, ugly two-column sorting stuff.
Richard Jones <richard@users.sourceforge.net>
parents: 905
diff changeset
1338 if sorting is None:
50363eaed280 Removed the confusing, ugly two-column sorting stuff.
Richard Jones <richard@users.sourceforge.net>
parents: 905
diff changeset
1339 sorting = ':sort=%s'%sort_name
50363eaed280 Removed the confusing, ugly two-column sorting stuff.
Richard Jones <richard@users.sourceforge.net>
parents: 905
diff changeset
1340 w(sorting)
50363eaed280 Removed the confusing, ugly two-column sorting stuff.
Richard Jones <richard@users.sourceforge.net>
parents: 905
diff changeset
1341
318
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
1342 return '&'.join(l)
307
dac78e092228 CGI interface view customisation section may now be hidden
Richard Jones <richard@users.sourceforge.net>
parents: 306
diff changeset
1343
318
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
1344 class ItemTemplate(TemplateFunctions):
651
6257d4e49d2a Ran it through pychecker, made fixes
Richard Jones <richard@users.sourceforge.net>
parents: 640
diff changeset
1345 '''Templating functionality specifically for item (node) display
6257d4e49d2a Ran it through pychecker, made fixes
Richard Jones <richard@users.sourceforge.net>
parents: 640
diff changeset
1346 '''
318
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
1347 def __init__(self, client, templates, classname):
651
6257d4e49d2a Ran it through pychecker, made fixes
Richard Jones <richard@users.sourceforge.net>
parents: 640
diff changeset
1348 TemplateFunctions.__init__(self)
902
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
1349 self.globals['handle_require'] = self.handle_require
318
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
1350 self.client = client
524
dce4c75bef5a changed all config accesses...
Richard Jones <richard@users.sourceforge.net>
parents: 515
diff changeset
1351 self.instance = client.instance
318
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
1352 self.templates = templates
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
1353 self.classname = classname
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
1354
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
1355 # derived
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
1356 self.db = self.client.db
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
1357 self.cl = self.db.classes[self.classname]
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
1358 self.properties = self.cl.getprops()
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
1359
821
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
1360 def clear(self):
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
1361 self.db = self.cl = self.properties = None
930
3c344e942055 Use same regex to split search terms as used to index text.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 926
diff changeset
1362 del self.globals['handle_require']
821
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
1363 TemplateFunctions.clear(self)
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
1364
318
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
1365 def render(self, nodeid):
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
1366 self.nodeid = nodeid
872
bd6211d39328 Saving, running & editing queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 835
diff changeset
1367
318
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
1368 if (self.properties.has_key('type') and
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
1369 self.properties.has_key('content')):
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
1370 pass
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
1371 # XXX we really want to return this as a downloadable...
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
1372 # currently I handle this at a higher level by detecting 'file'
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
1373 # designators...
25
4cf1daf2f2eb More Grande Splite
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
1374
318
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
1375 w = self.client.write
614
5fdf95e6c20a . All forms now have "double-submit" protection...
Richard Jones <richard@users.sourceforge.net>
parents: 581
diff changeset
1376 w('<form onSubmit="return submit_once()" action="%s%s" method="POST" enctype="multipart/form-data">'%(
411
a6088556e9ba Features and fixes.
Richard Jones <richard@users.sourceforge.net>
parents: 408
diff changeset
1377 self.classname, nodeid))
318
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
1378 s = open(os.path.join(self.templates, self.classname+'.item')).read()
915
930b57864dc8 nicer error messages, and a bugfix
Richard Jones <richard@users.sourceforge.net>
parents: 913
diff changeset
1379 try:
930b57864dc8 nicer error messages, and a bugfix
Richard Jones <richard@users.sourceforge.net>
parents: 913
diff changeset
1380 w(self.execute_template(s))
930b57864dc8 nicer error messages, and a bugfix
Richard Jones <richard@users.sourceforge.net>
parents: 913
diff changeset
1381 except:
930b57864dc8 nicer error messages, and a bugfix
Richard Jones <richard@users.sourceforge.net>
parents: 913
diff changeset
1382 etype = sys.exc_type
930b57864dc8 nicer error messages, and a bugfix
Richard Jones <richard@users.sourceforge.net>
parents: 913
diff changeset
1383 if type(etype) is types.ClassType:
930b57864dc8 nicer error messages, and a bugfix
Richard Jones <richard@users.sourceforge.net>
parents: 913
diff changeset
1384 etype = etype.__name__
930b57864dc8 nicer error messages, and a bugfix
Richard Jones <richard@users.sourceforge.net>
parents: 913
diff changeset
1385 w('<p class="system-msg">%s: %s</p>'%(etype, sys.exc_value))
930b57864dc8 nicer error messages, and a bugfix
Richard Jones <richard@users.sourceforge.net>
parents: 913
diff changeset
1386 # make sure we don't commit any changes
930b57864dc8 nicer error messages, and a bugfix
Richard Jones <richard@users.sourceforge.net>
parents: 913
diff changeset
1387 self.db.rollback()
318
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
1388 w('</form>')
821
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
1389
806
83becf3faa2f Fix the cycles (a clear method, called after render...
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 804
diff changeset
1390 self.clear()
25
4cf1daf2f2eb More Grande Splite
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
1391
902
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
1392 def subfunc(self, m, search_text=None, filter=None, columns=None,
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
1393 sort=None, group=None):
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
1394 ''' called as part of the template replacement
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
1395 '''
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
1396 if m.group('cond'):
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
1397 # call the template handler for require
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
1398 require = self.globals['handle_require']
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
1399 return self.handle_require(m.group('cond'), m.group('ok'),
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
1400 m.group('fail'))
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
1401 if m.group('name'):
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
1402 if self.nodeid and self.cl.get(self.nodeid, m.group('name')):
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
1403 return self.execute_template(m.group('text'))
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
1404 else:
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
1405 return ''
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
1406 if m.group('display'):
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
1407 command = m.group('command')
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
1408 return eval(command, self.globals, {})
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
1409 return '*** unhandled match: %s'%str(m.groupdict())
25
4cf1daf2f2eb More Grande Splite
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
1410
902
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
1411 class NewItemTemplate(ItemTemplate):
651
6257d4e49d2a Ran it through pychecker, made fixes
Richard Jones <richard@users.sourceforge.net>
parents: 640
diff changeset
1412 '''Templating functionality specifically for NEW item (node) display
6257d4e49d2a Ran it through pychecker, made fixes
Richard Jones <richard@users.sourceforge.net>
parents: 640
diff changeset
1413 '''
318
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
1414 def __init__(self, client, templates, classname):
651
6257d4e49d2a Ran it through pychecker, made fixes
Richard Jones <richard@users.sourceforge.net>
parents: 640
diff changeset
1415 TemplateFunctions.__init__(self)
902
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
1416 self.globals['handle_require'] = self.handle_require
318
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
1417 self.client = client
524
dce4c75bef5a changed all config accesses...
Richard Jones <richard@users.sourceforge.net>
parents: 515
diff changeset
1418 self.instance = client.instance
318
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
1419 self.templates = templates
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
1420 self.classname = classname
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
1421
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
1422 # derived
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
1423 self.db = self.client.db
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
1424 self.cl = self.db.classes[self.classname]
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
1425 self.properties = self.cl.getprops()
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
1426
821
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
1427 def clear(self):
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
1428 self.db = self.cl = None
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
1429 TemplateFunctions.clear(self)
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
1430
318
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
1431 def render(self, form):
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
1432 self.form = form
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
1433 w = self.client.write
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
1434 c = self.classname
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
1435 try:
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
1436 s = open(os.path.join(self.templates, c+'.newitem')).read()
408
424bfccd4118 "except:" is bad, bad , bad!
Jürgen Hermann <jhermann@users.sourceforge.net>
parents: 406
diff changeset
1437 except IOError:
318
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
1438 s = open(os.path.join(self.templates, c+'.item')).read()
614
5fdf95e6c20a . All forms now have "double-submit" protection...
Richard Jones <richard@users.sourceforge.net>
parents: 581
diff changeset
1439 w('<form onSubmit="return submit_once()" action="new%s" method="POST" enctype="multipart/form-data">'%c)
318
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
1440 for key in form.keys():
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
1441 if key[0] == ':':
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
1442 value = form[key].value
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
1443 if type(value) != type([]): value = [value]
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
1444 for value in value:
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
1445 w('<input type="hidden" name="%s" value="%s">'%(key, value))
902
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
1446 w(self.execute_template(s))
318
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
1447 w('</form>')
821
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
1448
806
83becf3faa2f Fix the cycles (a clear method, called after render...
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 804
diff changeset
1449 self.clear()
25
4cf1daf2f2eb More Grande Splite
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
1450
4cf1daf2f2eb More Grande Splite
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
1451 #
4cf1daf2f2eb More Grande Splite
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
1452 # $Log: not supported by cvs2svn $
930
3c344e942055 Use same regex to split search terms as used to index text.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 926
diff changeset
1453 # Revision 1.108 2002/07/31 22:40:50 gmcm
3c344e942055 Use same regex to split search terms as used to index text.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 926
diff changeset
1454 # Fixes to the search form and saving queries.
3c344e942055 Use same regex to split search terms as used to index text.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 926
diff changeset
1455 # Fixes to sorting in back_metakit.py.
3c344e942055 Use same regex to split search terms as used to index text.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 926
diff changeset
1456 #
926
3216c4f06ec4 Fixes to the search form and saving queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 915
diff changeset
1457 # Revision 1.107 2002/07/30 05:27:30 richard
3216c4f06ec4 Fixes to the search form and saving queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 915
diff changeset
1458 # nicer error messages, and a bugfix
3216c4f06ec4 Fixes to the search form and saving queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 915
diff changeset
1459 #
915
930b57864dc8 nicer error messages, and a bugfix
Richard Jones <richard@users.sourceforge.net>
parents: 913
diff changeset
1460 # Revision 1.106 2002/07/30 02:41:04 richard
930b57864dc8 nicer error messages, and a bugfix
Richard Jones <richard@users.sourceforge.net>
parents: 913
diff changeset
1461 # Removed the confusing, ugly two-column sorting stuff. Column heading clicks
930b57864dc8 nicer error messages, and a bugfix
Richard Jones <richard@users.sourceforge.net>
parents: 913
diff changeset
1462 # now only sort on one column. Nice and simple and obvious.
930b57864dc8 nicer error messages, and a bugfix
Richard Jones <richard@users.sourceforge.net>
parents: 913
diff changeset
1463 #
913
50363eaed280 Removed the confusing, ugly two-column sorting stuff.
Richard Jones <richard@users.sourceforge.net>
parents: 905
diff changeset
1464 # Revision 1.105 2002/07/26 08:26:59 richard
50363eaed280 Removed the confusing, ugly two-column sorting stuff.
Richard Jones <richard@users.sourceforge.net>
parents: 905
diff changeset
1465 # Very close now. The cgi and mailgw now use the new security API. The two
50363eaed280 Removed the confusing, ugly two-column sorting stuff.
Richard Jones <richard@users.sourceforge.net>
parents: 905
diff changeset
1466 # templates have been migrated to that setup. Lots of unit tests. Still some
50363eaed280 Removed the confusing, ugly two-column sorting stuff.
Richard Jones <richard@users.sourceforge.net>
parents: 905
diff changeset
1467 # issue in the web form for editing Roles assigned to users.
50363eaed280 Removed the confusing, ugly two-column sorting stuff.
Richard Jones <richard@users.sourceforge.net>
parents: 905
diff changeset
1468 #
905
502a5ae11cc5 Very close now. The cgi and mailgw now use the new security API.
Richard Jones <richard@users.sourceforge.net>
parents: 902
diff changeset
1469 # Revision 1.104 2002/07/25 07:14:05 richard
502a5ae11cc5 Very close now. The cgi and mailgw now use the new security API.
Richard Jones <richard@users.sourceforge.net>
parents: 902
diff changeset
1470 # Bugger it. Here's the current shape of the new security implementation.
502a5ae11cc5 Very close now. The cgi and mailgw now use the new security API.
Richard Jones <richard@users.sourceforge.net>
parents: 902
diff changeset
1471 # Still to do:
502a5ae11cc5 Very close now. The cgi and mailgw now use the new security API.
Richard Jones <richard@users.sourceforge.net>
parents: 902
diff changeset
1472 # . call the security funcs from cgi and mailgw
502a5ae11cc5 Very close now. The cgi and mailgw now use the new security API.
Richard Jones <richard@users.sourceforge.net>
parents: 902
diff changeset
1473 # . change shipped templates to include correct initialisation and remove
502a5ae11cc5 Very close now. The cgi and mailgw now use the new security API.
Richard Jones <richard@users.sourceforge.net>
parents: 902
diff changeset
1474 # the old config vars
502a5ae11cc5 Very close now. The cgi and mailgw now use the new security API.
Richard Jones <richard@users.sourceforge.net>
parents: 902
diff changeset
1475 # ... that seems like a lot. The bulk of the work has been done though. Honest :)
502a5ae11cc5 Very close now. The cgi and mailgw now use the new security API.
Richard Jones <richard@users.sourceforge.net>
parents: 902
diff changeset
1476 #
902
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
1477 # Revision 1.103 2002/07/20 19:29:10 gmcm
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
1478 # Fixes/improvements to the search form & saved queries.
b0d3d3535998 Bugger it. Here's the current shape of the new security implementation.
Richard Jones <richard@users.sourceforge.net>
parents: 893
diff changeset
1479 #
893
897425e40859 Fixes/improvements to the search form & saved queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 890
diff changeset
1480 # Revision 1.102 2002/07/18 23:07:08 richard
897425e40859 Fixes/improvements to the search form & saved queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 890
diff changeset
1481 # Unit tests and a few fixes.
897425e40859 Fixes/improvements to the search form & saved queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 890
diff changeset
1482 #
890
a568596dbea7 Unit tests and a few fixes.
Richard Jones <richard@users.sourceforge.net>
parents: 880
diff changeset
1483 # Revision 1.101 2002/07/18 11:17:30 gmcm
a568596dbea7 Unit tests and a few fixes.
Richard Jones <richard@users.sourceforge.net>
parents: 880
diff changeset
1484 # Add Number and Boolean types to hyperdb.
a568596dbea7 Unit tests and a few fixes.
Richard Jones <richard@users.sourceforge.net>
parents: 880
diff changeset
1485 # Add conversion cases to web, mail & admin interfaces.
a568596dbea7 Unit tests and a few fixes.
Richard Jones <richard@users.sourceforge.net>
parents: 880
diff changeset
1486 # Add storage/serialization cases to back_anydbm & back_metakit.
a568596dbea7 Unit tests and a few fixes.
Richard Jones <richard@users.sourceforge.net>
parents: 880
diff changeset
1487 #
880
de3da99a7c02 Add Number and Boolean types to hyperdb.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 878
diff changeset
1488 # Revision 1.100 2002/07/18 07:01:54 richard
de3da99a7c02 Add Number and Boolean types to hyperdb.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 878
diff changeset
1489 # minor bugfix
de3da99a7c02 Add Number and Boolean types to hyperdb.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 878
diff changeset
1490 #
878
8828f0f2e825 minor bugfix
Richard Jones <richard@users.sourceforge.net>
parents: 872
diff changeset
1491 # Revision 1.99 2002/07/17 12:39:10 gmcm
8828f0f2e825 minor bugfix
Richard Jones <richard@users.sourceforge.net>
parents: 872
diff changeset
1492 # Saving, running & editing queries.
8828f0f2e825 minor bugfix
Richard Jones <richard@users.sourceforge.net>
parents: 872
diff changeset
1493 #
872
bd6211d39328 Saving, running & editing queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 835
diff changeset
1494 # Revision 1.98 2002/07/10 00:17:46 richard
bd6211d39328 Saving, running & editing queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 835
diff changeset
1495 # . added sorting of checklist HTML display
bd6211d39328 Saving, running & editing queries.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 835
diff changeset
1496 #
835
255bdcf39e8c added sorting of checklist HTML display
Richard Jones <richard@users.sourceforge.net>
parents: 829
diff changeset
1497 # Revision 1.97 2002/07/09 05:20:09 richard
255bdcf39e8c added sorting of checklist HTML display
Richard Jones <richard@users.sourceforge.net>
parents: 829
diff changeset
1498 # . added email display function - mangles email addrs so they're not so easily
255bdcf39e8c added sorting of checklist HTML display
Richard Jones <richard@users.sourceforge.net>
parents: 829
diff changeset
1499 # scraped from the web
255bdcf39e8c added sorting of checklist HTML display
Richard Jones <richard@users.sourceforge.net>
parents: 829
diff changeset
1500 #
829
37ce3f2e05b2 added email display function
Richard Jones <richard@users.sourceforge.net>
parents: 826
diff changeset
1501 # Revision 1.96 2002/07/09 04:19:09 richard
37ce3f2e05b2 added email display function
Richard Jones <richard@users.sourceforge.net>
parents: 826
diff changeset
1502 # Added reindex command to roundup-admin.
37ce3f2e05b2 added email display function
Richard Jones <richard@users.sourceforge.net>
parents: 826
diff changeset
1503 # Fixed reindex on first access.
37ce3f2e05b2 added email display function
Richard Jones <richard@users.sourceforge.net>
parents: 826
diff changeset
1504 # Also fixed reindexing of entries that change.
37ce3f2e05b2 added email display function
Richard Jones <richard@users.sourceforge.net>
parents: 826
diff changeset
1505 #
826
6d7a45c8464a Added reindex command to roundup-admin.
Richard Jones <richard@users.sourceforge.net>
parents: 821
diff changeset
1506 # Revision 1.95 2002/07/08 15:32:06 gmcm
6d7a45c8464a Added reindex command to roundup-admin.
Richard Jones <richard@users.sourceforge.net>
parents: 821
diff changeset
1507 # Pagination of index pages.
6d7a45c8464a Added reindex command to roundup-admin.
Richard Jones <richard@users.sourceforge.net>
parents: 821
diff changeset
1508 # New search form.
6d7a45c8464a Added reindex command to roundup-admin.
Richard Jones <richard@users.sourceforge.net>
parents: 821
diff changeset
1509 #
821
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
1510 # Revision 1.94 2002/06/27 15:38:53 gmcm
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
1511 # Fix the cycles (a clear method, called after render, that removes
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
1512 # the bound methods from the globals dict).
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
1513 # Use cl.filter instead of cl.list followed by sortfunc. For some
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
1514 # backends (Metakit), filter can sort at C speeds, cutting >10 secs
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
1515 # off of filling in the <select...> box for assigned_to when you
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
1516 # have 600+ users.
fda182844206 Pagination of index pages.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 806
diff changeset
1517 #
806
83becf3faa2f Fix the cycles (a clear method, called after render...
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 804
diff changeset
1518 # Revision 1.93 2002/06/27 12:05:25 gmcm
83becf3faa2f Fix the cycles (a clear method, called after render...
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 804
diff changeset
1519 # Default labelprops to id.
83becf3faa2f Fix the cycles (a clear method, called after render...
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 804
diff changeset
1520 # In history, make sure there's a .item before making a link / multilink into an href.
83becf3faa2f Fix the cycles (a clear method, called after render...
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 804
diff changeset
1521 # Also in history, cgi.escape String properties.
83becf3faa2f Fix the cycles (a clear method, called after render...
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 804
diff changeset
1522 # Clean up some of the reference cycles.
83becf3faa2f Fix the cycles (a clear method, called after render...
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 804
diff changeset
1523 #
804
af4826d8773d Default labelprops to id.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 757
diff changeset
1524 # Revision 1.92 2002/06/11 04:57:04 richard
af4826d8773d Default labelprops to id.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 757
diff changeset
1525 # Added optional additional property to display in a Multilink form menu.
af4826d8773d Default labelprops to id.
Gordon B. McMillan <gmcm@users.sourceforge.net>
parents: 757
diff changeset
1526 #
757
00d360a4978a Added optional additional property to display in a Multilink form menu.
Richard Jones <richard@users.sourceforge.net>
parents: 755
diff changeset
1527 # Revision 1.91 2002/05/31 00:08:02 richard
00d360a4978a Added optional additional property to display in a Multilink form menu.
Richard Jones <richard@users.sourceforge.net>
parents: 755
diff changeset
1528 # can now just display a link/multilink id - useful for stylesheet stuff
00d360a4978a Added optional additional property to display in a Multilink form menu.
Richard Jones <richard@users.sourceforge.net>
parents: 755
diff changeset
1529 #
755
49c9522675b9 can now just display a link/multilink id - useful for stylesheet stuff
Richard Jones <richard@users.sourceforge.net>
parents: 749
diff changeset
1530 # Revision 1.90 2002/05/25 07:16:24 rochecompaan
49c9522675b9 can now just display a link/multilink id - useful for stylesheet stuff
Richard Jones <richard@users.sourceforge.net>
parents: 749
diff changeset
1531 # Merged search_indexing-branch with HEAD
49c9522675b9 can now just display a link/multilink id - useful for stylesheet stuff
Richard Jones <richard@users.sourceforge.net>
parents: 749
diff changeset
1532 #
749
51c425129b35 Merged search_indexing-branch with HEAD
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 721
diff changeset
1533 # Revision 1.89 2002/05/15 06:34:47 richard
51c425129b35 Merged search_indexing-branch with HEAD
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 721
diff changeset
1534 # forgot to fix the templating for last change
51c425129b35 Merged search_indexing-branch with HEAD
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 721
diff changeset
1535 #
721
c63b71a949a8 forgot to fix the templating for last change
Richard Jones <richard@users.sourceforge.net>
parents: 696
diff changeset
1536 # Revision 1.88 2002/04/24 08:34:35 rochecompaan
c63b71a949a8 forgot to fix the templating for last change
Richard Jones <richard@users.sourceforge.net>
parents: 696
diff changeset
1537 # Sorting was applied to all nodes of the MultiLink class instead of
c63b71a949a8 forgot to fix the templating for last change
Richard Jones <richard@users.sourceforge.net>
parents: 696
diff changeset
1538 # the nodes that are actually linked to in the "field" template
c63b71a949a8 forgot to fix the templating for last change
Richard Jones <richard@users.sourceforge.net>
parents: 696
diff changeset
1539 # function. This adds about 20+ seconds in the display of an issue if
c63b71a949a8 forgot to fix the templating for last change
Richard Jones <richard@users.sourceforge.net>
parents: 696
diff changeset
1540 # your database has a 1000 or more issue in it.
c63b71a949a8 forgot to fix the templating for last change
Richard Jones <richard@users.sourceforge.net>
parents: 696
diff changeset
1541 #
696
709f8f1d5661 Sorting was applied to all nodes of the MultiLink class...
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 678
diff changeset
1542 # Revision 1.87 2002/04/03 06:12:46 richard
709f8f1d5661 Sorting was applied to all nodes of the MultiLink class...
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 678
diff changeset
1543 # Fix for date properties as labels.
709f8f1d5661 Sorting was applied to all nodes of the MultiLink class...
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 678
diff changeset
1544 #
678
9fe50036e8df Fix for date properties as labels.
Richard Jones <richard@users.sourceforge.net>
parents: 676
diff changeset
1545 # Revision 1.86 2002/04/03 05:54:31 richard
9fe50036e8df Fix for date properties as labels.
Richard Jones <richard@users.sourceforge.net>
parents: 676
diff changeset
1546 # Fixed serialisation problem by moving the serialisation step out of the
9fe50036e8df Fix for date properties as labels.
Richard Jones <richard@users.sourceforge.net>
parents: 676
diff changeset
1547 # hyperdb.Class (get, set) into the hyperdb.Database.
9fe50036e8df Fix for date properties as labels.
Richard Jones <richard@users.sourceforge.net>
parents: 676
diff changeset
1548 #
9fe50036e8df Fix for date properties as labels.
Richard Jones <richard@users.sourceforge.net>
parents: 676
diff changeset
1549 # Also fixed htmltemplate after the showid changes I made yesterday.
9fe50036e8df Fix for date properties as labels.
Richard Jones <richard@users.sourceforge.net>
parents: 676
diff changeset
1550 #
9fe50036e8df Fix for date properties as labels.
Richard Jones <richard@users.sourceforge.net>
parents: 676
diff changeset
1551 # Unit tests for all of the above written.
9fe50036e8df Fix for date properties as labels.
Richard Jones <richard@users.sourceforge.net>
parents: 676
diff changeset
1552 #
676
bc46480e2a2b Fixed serialisation problem...
Richard Jones <richard@users.sourceforge.net>
parents: 673
diff changeset
1553 # Revision 1.85 2002/04/02 01:40:58 richard
bc46480e2a2b Fixed serialisation problem...
Richard Jones <richard@users.sourceforge.net>
parents: 673
diff changeset
1554 # . link() htmltemplate function now has a "showid" option for links and
bc46480e2a2b Fixed serialisation problem...
Richard Jones <richard@users.sourceforge.net>
parents: 673
diff changeset
1555 # multilinks. When true, it only displays the linked node id as the anchor
bc46480e2a2b Fixed serialisation problem...
Richard Jones <richard@users.sourceforge.net>
parents: 673
diff changeset
1556 # text. The link value is displayed as a tooltip using the title anchor
bc46480e2a2b Fixed serialisation problem...
Richard Jones <richard@users.sourceforge.net>
parents: 673
diff changeset
1557 # attribute.
bc46480e2a2b Fixed serialisation problem...
Richard Jones <richard@users.sourceforge.net>
parents: 673
diff changeset
1558 #
749
51c425129b35 Merged search_indexing-branch with HEAD
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 721
diff changeset
1559 # Revision 1.84.2.2 2002/04/20 13:23:32 rochecompaan
51c425129b35 Merged search_indexing-branch with HEAD
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 721
diff changeset
1560 # We now have a separate search page for nodes. Search links for
51c425129b35 Merged search_indexing-branch with HEAD
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 721
diff changeset
1561 # different classes can be customized in instance_config similar to
51c425129b35 Merged search_indexing-branch with HEAD
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 721
diff changeset
1562 # index links.
51c425129b35 Merged search_indexing-branch with HEAD
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 721
diff changeset
1563 #
51c425129b35 Merged search_indexing-branch with HEAD
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 721
diff changeset
1564 # Revision 1.84.2.1 2002/04/19 19:54:42 rochecompaan
51c425129b35 Merged search_indexing-branch with HEAD
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 721
diff changeset
1565 # cgi_client.py
51c425129b35 Merged search_indexing-branch with HEAD
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 721
diff changeset
1566 # removed search link for the time being
51c425129b35 Merged search_indexing-branch with HEAD
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 721
diff changeset
1567 # moved rendering of matches to htmltemplate
51c425129b35 Merged search_indexing-branch with HEAD
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 721
diff changeset
1568 # hyperdb.py
51c425129b35 Merged search_indexing-branch with HEAD
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 721
diff changeset
1569 # filtering of nodes on full text search incorporated in filter method
51c425129b35 Merged search_indexing-branch with HEAD
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 721
diff changeset
1570 # roundupdb.py
51c425129b35 Merged search_indexing-branch with HEAD
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 721
diff changeset
1571 # added paramater to call of filter method
51c425129b35 Merged search_indexing-branch with HEAD
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 721
diff changeset
1572 # roundup_indexer.py
51c425129b35 Merged search_indexing-branch with HEAD
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 721
diff changeset
1573 # added search method to RoundupIndexer class
51c425129b35 Merged search_indexing-branch with HEAD
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 721
diff changeset
1574 #
673
604c84696461 link() htmltemplate function now has a "showid" option for links & multilinks.
Richard Jones <richard@users.sourceforge.net>
parents: 672
diff changeset
1575 # Revision 1.84 2002/03/29 19:41:48 rochecompaan
604c84696461 link() htmltemplate function now has a "showid" option for links & multilinks.
Richard Jones <richard@users.sourceforge.net>
parents: 672
diff changeset
1576 # . Fixed display of mutlilink properties when using the template
604c84696461 link() htmltemplate function now has a "showid" option for links & multilinks.
Richard Jones <richard@users.sourceforge.net>
parents: 672
diff changeset
1577 # functions, menu and plain.
604c84696461 link() htmltemplate function now has a "showid" option for links & multilinks.
Richard Jones <richard@users.sourceforge.net>
parents: 672
diff changeset
1578 #
672
d92e06a3a56e Fixed display of mutlilink properties...
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 651
diff changeset
1579 # Revision 1.83 2002/02/27 04:14:31 richard
d92e06a3a56e Fixed display of mutlilink properties...
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 651
diff changeset
1580 # Ran it through pychecker, made fixes
d92e06a3a56e Fixed display of mutlilink properties...
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 651
diff changeset
1581 #
651
6257d4e49d2a Ran it through pychecker, made fixes
Richard Jones <richard@users.sourceforge.net>
parents: 640
diff changeset
1582 # Revision 1.82 2002/02/21 23:11:45 richard
6257d4e49d2a Ran it through pychecker, made fixes
Richard Jones <richard@users.sourceforge.net>
parents: 640
diff changeset
1583 # . fixed some problems in date calculations (calendar.py doesn't handle over-
6257d4e49d2a Ran it through pychecker, made fixes
Richard Jones <richard@users.sourceforge.net>
parents: 640
diff changeset
1584 # and under-flow). Also, hour/minute/second intervals may now be more than
6257d4e49d2a Ran it through pychecker, made fixes
Richard Jones <richard@users.sourceforge.net>
parents: 640
diff changeset
1585 # 99 each.
6257d4e49d2a Ran it through pychecker, made fixes
Richard Jones <richard@users.sourceforge.net>
parents: 640
diff changeset
1586 #
640
7dd13fd5d8ea fixed some problems in date calculations
Richard Jones <richard@users.sourceforge.net>
parents: 639
diff changeset
1587 # Revision 1.81 2002/02/21 07:21:38 richard
7dd13fd5d8ea fixed some problems in date calculations
Richard Jones <richard@users.sourceforge.net>
parents: 639
diff changeset
1588 # docco
7dd13fd5d8ea fixed some problems in date calculations
Richard Jones <richard@users.sourceforge.net>
parents: 639
diff changeset
1589 #
639
Richard Jones <richard@users.sourceforge.net>
parents: 638
diff changeset
1590 # Revision 1.80 2002/02/21 07:19:08 richard
Richard Jones <richard@users.sourceforge.net>
parents: 638
diff changeset
1591 # ... and label, width and height control for extra flavour!
Richard Jones <richard@users.sourceforge.net>
parents: 638
diff changeset
1592 #
638
21b3cfa7d99a ... and label, width and height control for extra flavour!
Richard Jones <richard@users.sourceforge.net>
parents: 635
diff changeset
1593 # Revision 1.79 2002/02/21 06:57:38 richard
21b3cfa7d99a ... and label, width and height control for extra flavour!
Richard Jones <richard@users.sourceforge.net>
parents: 635
diff changeset
1594 # . Added popup help for classes using the classhelp html template function.
21b3cfa7d99a ... and label, width and height control for extra flavour!
Richard Jones <richard@users.sourceforge.net>
parents: 635
diff changeset
1595 # - add <display call="classhelp('priority', 'id,name,description')">
21b3cfa7d99a ... and label, width and height control for extra flavour!
Richard Jones <richard@users.sourceforge.net>
parents: 635
diff changeset
1596 # to an item page, and it generates a link to a popup window which displays
21b3cfa7d99a ... and label, width and height control for extra flavour!
Richard Jones <richard@users.sourceforge.net>
parents: 635
diff changeset
1597 # the id, name and description for the priority class. The description
21b3cfa7d99a ... and label, width and height control for extra flavour!
Richard Jones <richard@users.sourceforge.net>
parents: 635
diff changeset
1598 # field won't exist in most installations, but it will be added to the
21b3cfa7d99a ... and label, width and height control for extra flavour!
Richard Jones <richard@users.sourceforge.net>
parents: 635
diff changeset
1599 # default templates.
21b3cfa7d99a ... and label, width and height control for extra flavour!
Richard Jones <richard@users.sourceforge.net>
parents: 635
diff changeset
1600 #
635
3d61b5d2243e Added popup help for classes using the classhelp html template function.
Richard Jones <richard@users.sourceforge.net>
parents: 634
diff changeset
1601 # Revision 1.78 2002/02/21 06:23:00 richard
3d61b5d2243e Added popup help for classes using the classhelp html template function.
Richard Jones <richard@users.sourceforge.net>
parents: 634
diff changeset
1602 # *** empty log message ***
3d61b5d2243e Added popup help for classes using the classhelp html template function.
Richard Jones <richard@users.sourceforge.net>
parents: 634
diff changeset
1603 #
634
53549c6a7b33 *** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents: 627
diff changeset
1604 # Revision 1.77 2002/02/20 05:05:29 richard
53549c6a7b33 *** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents: 627
diff changeset
1605 # . Added simple editing for classes that don't define a templated interface.
53549c6a7b33 *** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents: 627
diff changeset
1606 # - access using the admin "class list" interface
53549c6a7b33 *** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents: 627
diff changeset
1607 # - limited to admin-only
53549c6a7b33 *** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents: 627
diff changeset
1608 # - requires the csv module from object-craft (url given if it's missing)
53549c6a7b33 *** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents: 627
diff changeset
1609 #
627
952679be9e2c Added simple editing for classes that don't define a templated interface.
Richard Jones <richard@users.sourceforge.net>
parents: 623
diff changeset
1610 # Revision 1.76 2002/02/16 09:10:52 richard
952679be9e2c Added simple editing for classes that don't define a templated interface.
Richard Jones <richard@users.sourceforge.net>
parents: 623
diff changeset
1611 # oops
952679be9e2c Added simple editing for classes that don't define a templated interface.
Richard Jones <richard@users.sourceforge.net>
parents: 623
diff changeset
1612 #
623
Richard Jones <richard@users.sourceforge.net>
parents: 622
diff changeset
1613 # Revision 1.75 2002/02/16 08:43:23 richard
Richard Jones <richard@users.sourceforge.net>
parents: 622
diff changeset
1614 # . #517906 ] Attribute order in "View customisation"
Richard Jones <richard@users.sourceforge.net>
parents: 622
diff changeset
1615 #
622
1b16ddd69f31 [SF#517906] Attribute order in "View customisation"
Richard Jones <richard@users.sourceforge.net>
parents: 621
diff changeset
1616 # Revision 1.74 2002/02/16 08:39:42 richard
1b16ddd69f31 [SF#517906] Attribute order in "View customisation"
Richard Jones <richard@users.sourceforge.net>
parents: 621
diff changeset
1617 # . #516854 ] "My Issues" and redisplay
1b16ddd69f31 [SF#517906] Attribute order in "View customisation"
Richard Jones <richard@users.sourceforge.net>
parents: 621
diff changeset
1618 #
621
f333f6decdc2 [SF#516854] "My Issues" and redisplay
Richard Jones <richard@users.sourceforge.net>
parents: 617
diff changeset
1619 # Revision 1.73 2002/02/15 07:08:44 richard
f333f6decdc2 [SF#516854] "My Issues" and redisplay
Richard Jones <richard@users.sourceforge.net>
parents: 617
diff changeset
1620 # . Alternate email addresses are now available for users. See the MIGRATION
f333f6decdc2 [SF#516854] "My Issues" and redisplay
Richard Jones <richard@users.sourceforge.net>
parents: 617
diff changeset
1621 # file for info on how to activate the feature.
f333f6decdc2 [SF#516854] "My Issues" and redisplay
Richard Jones <richard@users.sourceforge.net>
parents: 617
diff changeset
1622 #
617
edd210915e64 Alternate email addresses are now available for users.
Richard Jones <richard@users.sourceforge.net>
parents: 614
diff changeset
1623 # Revision 1.72 2002/02/14 23:39:18 richard
edd210915e64 Alternate email addresses are now available for users.
Richard Jones <richard@users.sourceforge.net>
parents: 614
diff changeset
1624 # . All forms now have "double-submit" protection when Javascript is enabled
edd210915e64 Alternate email addresses are now available for users.
Richard Jones <richard@users.sourceforge.net>
parents: 614
diff changeset
1625 # on the client-side.
edd210915e64 Alternate email addresses are now available for users.
Richard Jones <richard@users.sourceforge.net>
parents: 614
diff changeset
1626 #
614
5fdf95e6c20a . All forms now have "double-submit" protection...
Richard Jones <richard@users.sourceforge.net>
parents: 581
diff changeset
1627 # Revision 1.71 2002/01/23 06:15:24 richard
5fdf95e6c20a . All forms now have "double-submit" protection...
Richard Jones <richard@users.sourceforge.net>
parents: 581
diff changeset
1628 # real (non-string, duh) sorting of lists by node id
5fdf95e6c20a . All forms now have "double-submit" protection...
Richard Jones <richard@users.sourceforge.net>
parents: 581
diff changeset
1629 #
581
137d7fc5234d real (non-string, duh) sorting of lists by node id
Richard Jones <richard@users.sourceforge.net>
parents: 577
diff changeset
1630 # Revision 1.70 2002/01/23 05:47:57 richard
137d7fc5234d real (non-string, duh) sorting of lists by node id
Richard Jones <richard@users.sourceforge.net>
parents: 577
diff changeset
1631 # more HTML template cleanup and unit tests
137d7fc5234d real (non-string, duh) sorting of lists by node id
Richard Jones <richard@users.sourceforge.net>
parents: 577
diff changeset
1632 #
577
334ae707ebfc more HTML template cleanup and unit tests
Richard Jones <richard@users.sourceforge.net>
parents: 576
diff changeset
1633 # Revision 1.69 2002/01/23 05:10:27 richard
334ae707ebfc more HTML template cleanup and unit tests
Richard Jones <richard@users.sourceforge.net>
parents: 576
diff changeset
1634 # More HTML template cleanup and unit tests.
334ae707ebfc more HTML template cleanup and unit tests
Richard Jones <richard@users.sourceforge.net>
parents: 576
diff changeset
1635 # - download() now implemented correctly, replacing link(is_download=1) [fixed in the
334ae707ebfc more HTML template cleanup and unit tests
Richard Jones <richard@users.sourceforge.net>
parents: 576
diff changeset
1636 # templates, but link(is_download=1) will still work for existing templates]
334ae707ebfc more HTML template cleanup and unit tests
Richard Jones <richard@users.sourceforge.net>
parents: 576
diff changeset
1637 #
576
f98f37697f4c More HTML template cleanup and unit tests.
Richard Jones <richard@users.sourceforge.net>
parents: 575
diff changeset
1638 # Revision 1.68 2002/01/22 22:55:28 richard
f98f37697f4c More HTML template cleanup and unit tests.
Richard Jones <richard@users.sourceforge.net>
parents: 575
diff changeset
1639 # . htmltemplate list() wasn't sorting...
f98f37697f4c More HTML template cleanup and unit tests.
Richard Jones <richard@users.sourceforge.net>
parents: 575
diff changeset
1640 #
575
2df17627528d htmltemplate list() wasn't sorting...
Richard Jones <richard@users.sourceforge.net>
parents: 574
diff changeset
1641 # Revision 1.67 2002/01/22 22:46:22 richard
2df17627528d htmltemplate list() wasn't sorting...
Richard Jones <richard@users.sourceforge.net>
parents: 574
diff changeset
1642 # more htmltemplate cleanups and unit tests
2df17627528d htmltemplate list() wasn't sorting...
Richard Jones <richard@users.sourceforge.net>
parents: 574
diff changeset
1643 #
574
d41d94511170 more htmltemplate cleanups and unit tests
Richard Jones <richard@users.sourceforge.net>
parents: 568
diff changeset
1644 # Revision 1.66 2002/01/22 06:35:40 richard
d41d94511170 more htmltemplate cleanups and unit tests
Richard Jones <richard@users.sourceforge.net>
parents: 568
diff changeset
1645 # more htmltemplate tests and cleanup
d41d94511170 more htmltemplate cleanups and unit tests
Richard Jones <richard@users.sourceforge.net>
parents: 568
diff changeset
1646 #
568
c7ead967db85 more htmltemplate tests and cleanup
Richard Jones <richard@users.sourceforge.net>
parents: 563
diff changeset
1647 # Revision 1.65 2002/01/22 00:12:06 richard
c7ead967db85 more htmltemplate tests and cleanup
Richard Jones <richard@users.sourceforge.net>
parents: 563
diff changeset
1648 # Wrote more unit tests for htmltemplate, and while I was at it, I polished
c7ead967db85 more htmltemplate tests and cleanup
Richard Jones <richard@users.sourceforge.net>
parents: 563
diff changeset
1649 # off the implementation of some of the functions so they behave sanely.
c7ead967db85 more htmltemplate tests and cleanup
Richard Jones <richard@users.sourceforge.net>
parents: 563
diff changeset
1650 #
563
0f58d6a35a8b Wrote more unit tests for htmltemplate...
Richard Jones <richard@users.sourceforge.net>
parents: 558
diff changeset
1651 # Revision 1.64 2002/01/21 03:25:59 richard
0f58d6a35a8b Wrote more unit tests for htmltemplate...
Richard Jones <richard@users.sourceforge.net>
parents: 558
diff changeset
1652 # oops
0f58d6a35a8b Wrote more unit tests for htmltemplate...
Richard Jones <richard@users.sourceforge.net>
parents: 558
diff changeset
1653 #
558
Richard Jones <richard@users.sourceforge.net>
parents: 556
diff changeset
1654 # Revision 1.63 2002/01/21 02:59:10 richard
Richard Jones <richard@users.sourceforge.net>
parents: 556
diff changeset
1655 # Fixed up the HTML display of history so valid links are actually displayed.
Richard Jones <richard@users.sourceforge.net>
parents: 556
diff changeset
1656 # Oh for some unit tests! :(
Richard Jones <richard@users.sourceforge.net>
parents: 556
diff changeset
1657 #
556
50359de2800b Fixed up the HTML display of history so valid links are actually displayed.
Richard Jones <richard@users.sourceforge.net>
parents: 554
diff changeset
1658 # Revision 1.62 2002/01/18 08:36:12 grubert
50359de2800b Fixed up the HTML display of history so valid links are actually displayed.
Richard Jones <richard@users.sourceforge.net>
parents: 554
diff changeset
1659 # . add nowrap to history table date cell i.e. <td nowrap ...
50359de2800b Fixed up the HTML display of history so valid links are actually displayed.
Richard Jones <richard@users.sourceforge.net>
parents: 554
diff changeset
1660 #
554
7e7b4183a8bd add nowrap to history table date cell i.e. <td nowrap ...
Engelbert Gruber <grubert@users.sourceforge.net>
parents: 552
diff changeset
1661 # Revision 1.61 2002/01/17 23:04:53 richard
7e7b4183a8bd add nowrap to history table date cell i.e. <td nowrap ...
Engelbert Gruber <grubert@users.sourceforge.net>
parents: 552
diff changeset
1662 # . much nicer history display (actualy real handling of property types etc)
7e7b4183a8bd add nowrap to history table date cell i.e. <td nowrap ...
Engelbert Gruber <grubert@users.sourceforge.net>
parents: 552
diff changeset
1663 #
552
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
1664 # Revision 1.60 2002/01/17 08:48:19 grubert
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
1665 # . display superseder as html link in history.
0f8734a5a004 much nicer history display (actualy real handling of property types etc)
Richard Jones <richard@users.sourceforge.net>
parents: 548
diff changeset
1666 #
548
3f25182ed425 display superseder as html link in history.
Engelbert Gruber <grubert@users.sourceforge.net>
parents: 547
diff changeset
1667 # Revision 1.59 2002/01/17 07:58:24 grubert
3f25182ed425 display superseder as html link in history.
Engelbert Gruber <grubert@users.sourceforge.net>
parents: 547
diff changeset
1668 # . display links a html link in history.
3f25182ed425 display superseder as html link in history.
Engelbert Gruber <grubert@users.sourceforge.net>
parents: 547
diff changeset
1669 #
547
e4ef6df2345c display links a html link in history.
Engelbert Gruber <grubert@users.sourceforge.net>
parents: 538
diff changeset
1670 # Revision 1.58 2002/01/15 00:50:03 richard
e4ef6df2345c display links a html link in history.
Engelbert Gruber <grubert@users.sourceforge.net>
parents: 538
diff changeset
1671 # #502949 ] index view for non-issues and redisplay
e4ef6df2345c display links a html link in history.
Engelbert Gruber <grubert@users.sourceforge.net>
parents: 538
diff changeset
1672 #
538
67379bcc5da4 [SF#502949] index view for non-issues and redisplay
Richard Jones <richard@users.sourceforge.net>
parents: 535
diff changeset
1673 # Revision 1.57 2002/01/14 23:31:21 richard
67379bcc5da4 [SF#502949] index view for non-issues and redisplay
Richard Jones <richard@users.sourceforge.net>
parents: 535
diff changeset
1674 # reverted the change that had plain() hyperlinking the link displays -
67379bcc5da4 [SF#502949] index view for non-issues and redisplay
Richard Jones <richard@users.sourceforge.net>
parents: 535
diff changeset
1675 # that's what link() is for!
67379bcc5da4 [SF#502949] index view for non-issues and redisplay
Richard Jones <richard@users.sourceforge.net>
parents: 535
diff changeset
1676 #
535
78711b29c746 reverted the change that had plain() hyperlinking the link displays
Richard Jones <richard@users.sourceforge.net>
parents: 531
diff changeset
1677 # Revision 1.56 2002/01/14 07:04:36 richard
78711b29c746 reverted the change that had plain() hyperlinking the link displays
Richard Jones <richard@users.sourceforge.net>
parents: 531
diff changeset
1678 # . plain rendering of links in the htmltemplate now generate a hyperlink to
78711b29c746 reverted the change that had plain() hyperlinking the link displays
Richard Jones <richard@users.sourceforge.net>
parents: 531
diff changeset
1679 # the linked node's page.
78711b29c746 reverted the change that had plain() hyperlinking the link displays
Richard Jones <richard@users.sourceforge.net>
parents: 531
diff changeset
1680 # ... this allows a display very similar to bugzilla's where you can actually
78711b29c746 reverted the change that had plain() hyperlinking the link displays
Richard Jones <richard@users.sourceforge.net>
parents: 531
diff changeset
1681 # find out information about the linked node.
78711b29c746 reverted the change that had plain() hyperlinking the link displays
Richard Jones <richard@users.sourceforge.net>
parents: 531
diff changeset
1682 #
531
32c1dd156605 plain rendering of links in the htmltemplate now generate a hyperlink...
Richard Jones <richard@users.sourceforge.net>
parents: 528
diff changeset
1683 # Revision 1.55 2002/01/14 06:45:03 richard
32c1dd156605 plain rendering of links in the htmltemplate now generate a hyperlink...
Richard Jones <richard@users.sourceforge.net>
parents: 528
diff changeset
1684 # . #502953 ] nosy-like treatment of other multilinks
32c1dd156605 plain rendering of links in the htmltemplate now generate a hyperlink...
Richard Jones <richard@users.sourceforge.net>
parents: 528
diff changeset
1685 # ... had to revert most of the previous change to the multilink field
32c1dd156605 plain rendering of links in the htmltemplate now generate a hyperlink...
Richard Jones <richard@users.sourceforge.net>
parents: 528
diff changeset
1686 # display... not good.
32c1dd156605 plain rendering of links in the htmltemplate now generate a hyperlink...
Richard Jones <richard@users.sourceforge.net>
parents: 528
diff changeset
1687 #
528
72fe808ff5b8 [SF#502953] nosy-like treatment of other multilinks
Richard Jones <richard@users.sourceforge.net>
parents: 526
diff changeset
1688 # Revision 1.54 2002/01/14 05:16:51 richard
72fe808ff5b8 [SF#502953] nosy-like treatment of other multilinks
Richard Jones <richard@users.sourceforge.net>
parents: 526
diff changeset
1689 # The submit buttons need a name attribute or mozilla won't submit without a
72fe808ff5b8 [SF#502953] nosy-like treatment of other multilinks
Richard Jones <richard@users.sourceforge.net>
parents: 526
diff changeset
1690 # file upload. Yeah, that's bloody obscure. Grr.
72fe808ff5b8 [SF#502953] nosy-like treatment of other multilinks
Richard Jones <richard@users.sourceforge.net>
parents: 526
diff changeset
1691 #
526
523b22a2c021 The submit buttons need a name attribute...
Richard Jones <richard@users.sourceforge.net>
parents: 525
diff changeset
1692 # Revision 1.53 2002/01/14 04:03:32 richard
523b22a2c021 The submit buttons need a name attribute...
Richard Jones <richard@users.sourceforge.net>
parents: 525
diff changeset
1693 # How about that ... date fields have never worked ...
523b22a2c021 The submit buttons need a name attribute...
Richard Jones <richard@users.sourceforge.net>
parents: 525
diff changeset
1694 #
525
d046cc4ba7d3 How about that ... date fields have never worked ...
Richard Jones <richard@users.sourceforge.net>
parents: 524
diff changeset
1695 # Revision 1.52 2002/01/14 02:20:14 richard
d046cc4ba7d3 How about that ... date fields have never worked ...
Richard Jones <richard@users.sourceforge.net>
parents: 524
diff changeset
1696 # . changed all config accesses so they access either the instance or the
d046cc4ba7d3 How about that ... date fields have never worked ...
Richard Jones <richard@users.sourceforge.net>
parents: 524
diff changeset
1697 # config attriubute on the db. This means that all config is obtained from
d046cc4ba7d3 How about that ... date fields have never worked ...
Richard Jones <richard@users.sourceforge.net>
parents: 524
diff changeset
1698 # instance_config instead of the mish-mash of classes. This will make
d046cc4ba7d3 How about that ... date fields have never worked ...
Richard Jones <richard@users.sourceforge.net>
parents: 524
diff changeset
1699 # switching to a ConfigParser setup easier too, I hope.
d046cc4ba7d3 How about that ... date fields have never worked ...
Richard Jones <richard@users.sourceforge.net>
parents: 524
diff changeset
1700 #
d046cc4ba7d3 How about that ... date fields have never worked ...
Richard Jones <richard@users.sourceforge.net>
parents: 524
diff changeset
1701 # At a minimum, this makes migration a _little_ easier (a lot easier in the
d046cc4ba7d3 How about that ... date fields have never worked ...
Richard Jones <richard@users.sourceforge.net>
parents: 524
diff changeset
1702 # 0.5.0 switch, I hope!)
d046cc4ba7d3 How about that ... date fields have never worked ...
Richard Jones <richard@users.sourceforge.net>
parents: 524
diff changeset
1703 #
524
dce4c75bef5a changed all config accesses...
Richard Jones <richard@users.sourceforge.net>
parents: 515
diff changeset
1704 # Revision 1.51 2002/01/10 10:02:15 grubert
dce4c75bef5a changed all config accesses...
Richard Jones <richard@users.sourceforge.net>
parents: 515
diff changeset
1705 # In do_history: replace "." in date by " " so html wraps more sensible.
dce4c75bef5a changed all config accesses...
Richard Jones <richard@users.sourceforge.net>
parents: 515
diff changeset
1706 # Should this be done in date's string converter ?
dce4c75bef5a changed all config accesses...
Richard Jones <richard@users.sourceforge.net>
parents: 515
diff changeset
1707 #
515
59e721a72a30 In do_history: replace "." in date by " " so html wraps more sensible.
Engelbert Gruber <grubert@users.sourceforge.net>
parents: 488
diff changeset
1708 # Revision 1.50 2002/01/05 02:35:10 richard
59e721a72a30 In do_history: replace "." in date by " " so html wraps more sensible.
Engelbert Gruber <grubert@users.sourceforge.net>
parents: 488
diff changeset
1709 # I18N'ification
59e721a72a30 In do_history: replace "." in date by " " so html wraps more sensible.
Engelbert Gruber <grubert@users.sourceforge.net>
parents: 488
diff changeset
1710 #
488
ab9e236cd524 I18N'ification
Richard Jones <richard@users.sourceforge.net>
parents: 467
diff changeset
1711 # Revision 1.49 2001/12/20 15:43:01 rochecompaan
ab9e236cd524 I18N'ification
Richard Jones <richard@users.sourceforge.net>
parents: 467
diff changeset
1712 # Features added:
ab9e236cd524 I18N'ification
Richard Jones <richard@users.sourceforge.net>
parents: 467
diff changeset
1713 # . Multilink properties are now displayed as comma separated values in
ab9e236cd524 I18N'ification
Richard Jones <richard@users.sourceforge.net>
parents: 467
diff changeset
1714 # a textbox
ab9e236cd524 I18N'ification
Richard Jones <richard@users.sourceforge.net>
parents: 467
diff changeset
1715 # . The add user link is now only visible to the admin user
ab9e236cd524 I18N'ification
Richard Jones <richard@users.sourceforge.net>
parents: 467
diff changeset
1716 # . Modified the mail gateway to reject submissions from unknown
ab9e236cd524 I18N'ification
Richard Jones <richard@users.sourceforge.net>
parents: 467
diff changeset
1717 # addresses if ANONYMOUS_ACCESS is denied
ab9e236cd524 I18N'ification
Richard Jones <richard@users.sourceforge.net>
parents: 467
diff changeset
1718 #
467
103f521810f7 Features added:
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 466
diff changeset
1719 # Revision 1.48 2001/12/20 06:13:24 rochecompaan
103f521810f7 Features added:
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 466
diff changeset
1720 # Bugs fixed:
103f521810f7 Features added:
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 466
diff changeset
1721 # . Exception handling in hyperdb for strings-that-look-like numbers got
103f521810f7 Features added:
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 466
diff changeset
1722 # lost somewhere
103f521810f7 Features added:
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 466
diff changeset
1723 # . Internet Explorer submits full path for filename - we now strip away
103f521810f7 Features added:
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 466
diff changeset
1724 # the path
103f521810f7 Features added:
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 466
diff changeset
1725 # Features added:
103f521810f7 Features added:
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 466
diff changeset
1726 # . Link and multilink properties are now displayed sorted in the cgi
103f521810f7 Features added:
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 466
diff changeset
1727 # interface
103f521810f7 Features added:
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 466
diff changeset
1728 #
466
a3548136f7bb Two bug fixes and a feature.
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 411
diff changeset
1729 # Revision 1.47 2001/11/26 22:55:56 richard
a3548136f7bb Two bug fixes and a feature.
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 411
diff changeset
1730 # Feature:
a3548136f7bb Two bug fixes and a feature.
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 411
diff changeset
1731 # . Added INSTANCE_NAME to configuration - used in web and email to identify
a3548136f7bb Two bug fixes and a feature.
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 411
diff changeset
1732 # the instance.
a3548136f7bb Two bug fixes and a feature.
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 411
diff changeset
1733 # . Added EMAIL_SIGNATURE_POSITION to indicate where to place the roundup
a3548136f7bb Two bug fixes and a feature.
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 411
diff changeset
1734 # signature info in e-mails.
a3548136f7bb Two bug fixes and a feature.
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 411
diff changeset
1735 # . Some more flexibility in the mail gateway and more error handling.
a3548136f7bb Two bug fixes and a feature.
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 411
diff changeset
1736 # . Login now takes you to the page you back to the were denied access to.
a3548136f7bb Two bug fixes and a feature.
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 411
diff changeset
1737 #
a3548136f7bb Two bug fixes and a feature.
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 411
diff changeset
1738 # Fixed:
a3548136f7bb Two bug fixes and a feature.
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 411
diff changeset
1739 # . Lots of bugs, thanks Roché and others on the devel mailing list!
a3548136f7bb Two bug fixes and a feature.
Roche Compaan <rochecompaan@users.sourceforge.net>
parents: 411
diff changeset
1740 #
411
a6088556e9ba Features and fixes.
Richard Jones <richard@users.sourceforge.net>
parents: 408
diff changeset
1741 # Revision 1.46 2001/11/24 00:53:12 jhermann
a6088556e9ba Features and fixes.
Richard Jones <richard@users.sourceforge.net>
parents: 408
diff changeset
1742 # "except:" is bad, bad , bad!
a6088556e9ba Features and fixes.
Richard Jones <richard@users.sourceforge.net>
parents: 408
diff changeset
1743 #
408
424bfccd4118 "except:" is bad, bad , bad!
Jürgen Hermann <jhermann@users.sourceforge.net>
parents: 406
diff changeset
1744 # Revision 1.45 2001/11/22 15:46:42 jhermann
424bfccd4118 "except:" is bad, bad , bad!
Jürgen Hermann <jhermann@users.sourceforge.net>
parents: 406
diff changeset
1745 # Added module docstrings to all modules.
424bfccd4118 "except:" is bad, bad , bad!
Jürgen Hermann <jhermann@users.sourceforge.net>
parents: 406
diff changeset
1746 #
406
bdc2ea127ae9 Added module docstrings to all modules.
Jürgen Hermann <jhermann@users.sourceforge.net>
parents: 401
diff changeset
1747 # Revision 1.44 2001/11/21 23:35:45 jhermann
bdc2ea127ae9 Added module docstrings to all modules.
Jürgen Hermann <jhermann@users.sourceforge.net>
parents: 401
diff changeset
1748 # Added globbing for win32, and sample marking in a 2nd file to test it
bdc2ea127ae9 Added module docstrings to all modules.
Jürgen Hermann <jhermann@users.sourceforge.net>
parents: 401
diff changeset
1749 #
401
a930feb07dc4 Added globbing for win32, and sample marking in a 2nd file to test it
Jürgen Hermann <jhermann@users.sourceforge.net>
parents: 398
diff changeset
1750 # Revision 1.43 2001/11/21 04:04:43 richard
a930feb07dc4 Added globbing for win32, and sample marking in a 2nd file to test it
Jürgen Hermann <jhermann@users.sourceforge.net>
parents: 398
diff changeset
1751 # *sigh* more missing value handling
a930feb07dc4 Added globbing for win32, and sample marking in a 2nd file to test it
Jürgen Hermann <jhermann@users.sourceforge.net>
parents: 398
diff changeset
1752 #
398
bbbcdee47762 *sigh* more missing value handling
Richard Jones <richard@users.sourceforge.net>
parents: 397
diff changeset
1753 # Revision 1.42 2001/11/21 03:40:54 richard
bbbcdee47762 *sigh* more missing value handling
Richard Jones <richard@users.sourceforge.net>
parents: 397
diff changeset
1754 # more new property handling
bbbcdee47762 *sigh* more missing value handling
Richard Jones <richard@users.sourceforge.net>
parents: 397
diff changeset
1755 #
397
d47818b09265 more new property handling
Richard Jones <richard@users.sourceforge.net>
parents: 392
diff changeset
1756 # Revision 1.41 2001/11/15 10:26:01 richard
d47818b09265 more new property handling
Richard Jones <richard@users.sourceforge.net>
parents: 392
diff changeset
1757 # . missing "return" in filter_section (thanks Roch'e Compaan)
d47818b09265 more new property handling
Richard Jones <richard@users.sourceforge.net>
parents: 392
diff changeset
1758 #
392
a9edec536e0a missing "return" in filter_section (thanks Roch'e Compaan)
Richard Jones <richard@users.sourceforge.net>
parents: 351
diff changeset
1759 # Revision 1.40 2001/11/03 01:56:51 richard
a9edec536e0a missing "return" in filter_section (thanks Roch'e Compaan)
Richard Jones <richard@users.sourceforge.net>
parents: 351
diff changeset
1760 # More HTML compliance fixes. This will probably fix the Netscape problem
a9edec536e0a missing "return" in filter_section (thanks Roch'e Compaan)
Richard Jones <richard@users.sourceforge.net>
parents: 351
diff changeset
1761 # too.
a9edec536e0a missing "return" in filter_section (thanks Roch'e Compaan)
Richard Jones <richard@users.sourceforge.net>
parents: 351
diff changeset
1762 #
351
6932067a8f31 More HTML compliance fixes.
Richard Jones <richard@users.sourceforge.net>
parents: 350
diff changeset
1763 # Revision 1.39 2001/11/03 01:43:47 richard
6932067a8f31 More HTML compliance fixes.
Richard Jones <richard@users.sourceforge.net>
parents: 350
diff changeset
1764 # Ahah! Fixed the lynx problem - there was a hidden input field misplaced.
6932067a8f31 More HTML compliance fixes.
Richard Jones <richard@users.sourceforge.net>
parents: 350
diff changeset
1765 #
350
e8d244a98ffd Ahah! Fixed the lynx problem - there was a hidden input field misplaced.
Richard Jones <richard@users.sourceforge.net>
parents: 342
diff changeset
1766 # Revision 1.38 2001/10/31 06:58:51 richard
e8d244a98ffd Ahah! Fixed the lynx problem - there was a hidden input field misplaced.
Richard Jones <richard@users.sourceforge.net>
parents: 342
diff changeset
1767 # Added the wrap="hard" attribute to the textarea of the note field so the
e8d244a98ffd Ahah! Fixed the lynx problem - there was a hidden input field misplaced.
Richard Jones <richard@users.sourceforge.net>
parents: 342
diff changeset
1768 # messages wrap sanely.
e8d244a98ffd Ahah! Fixed the lynx problem - there was a hidden input field misplaced.
Richard Jones <richard@users.sourceforge.net>
parents: 342
diff changeset
1769 #
342
0b7d62e414b6 Added the wrap="hard" attribute to the textarea of the note field...
Richard Jones <richard@users.sourceforge.net>
parents: 340
diff changeset
1770 # Revision 1.37 2001/10/31 06:24:35 richard
0b7d62e414b6 Added the wrap="hard" attribute to the textarea of the note field...
Richard Jones <richard@users.sourceforge.net>
parents: 340
diff changeset
1771 # Added do_stext to htmltemplate, thanks Brad Clements.
0b7d62e414b6 Added the wrap="hard" attribute to the textarea of the note field...
Richard Jones <richard@users.sourceforge.net>
parents: 340
diff changeset
1772 #
340
9311fa91f478 Added do_stext to htmltemplate, thanks Brad Clements.
Richard Jones <richard@users.sourceforge.net>
parents: 332
diff changeset
1773 # Revision 1.36 2001/10/28 22:51:38 richard
9311fa91f478 Added do_stext to htmltemplate, thanks Brad Clements.
Richard Jones <richard@users.sourceforge.net>
parents: 332
diff changeset
1774 # Fixed ENOENT/WindowsError thing, thanks Juergen Hermann
9311fa91f478 Added do_stext to htmltemplate, thanks Brad Clements.
Richard Jones <richard@users.sourceforge.net>
parents: 332
diff changeset
1775 #
332
1fe356fc3d3e Fixed ENOENT/WindowsError thing, thanks Juergen Hermann
Richard Jones <richard@users.sourceforge.net>
parents: 327
diff changeset
1776 # Revision 1.35 2001/10/24 00:04:41 richard
1fe356fc3d3e Fixed ENOENT/WindowsError thing, thanks Juergen Hermann
Richard Jones <richard@users.sourceforge.net>
parents: 327
diff changeset
1777 # Removed the "infinite authentication loop", thanks Roch'e
1fe356fc3d3e Fixed ENOENT/WindowsError thing, thanks Juergen Hermann
Richard Jones <richard@users.sourceforge.net>
parents: 327
diff changeset
1778 #
327
ee8882029150 Removed the "infinite authentication loop", thanks Roch'e
Richard Jones <richard@users.sourceforge.net>
parents: 320
diff changeset
1779 # Revision 1.34 2001/10/23 22:56:36 richard
ee8882029150 Removed the "infinite authentication loop", thanks Roch'e
Richard Jones <richard@users.sourceforge.net>
parents: 320
diff changeset
1780 # Bugfix in filter "widget" placement, thanks Roch'e
ee8882029150 Removed the "infinite authentication loop", thanks Roch'e
Richard Jones <richard@users.sourceforge.net>
parents: 320
diff changeset
1781 #
320
61c42790c3f1 Bugfix in filter "widget" placement, thanks Roch'e
Richard Jones <richard@users.sourceforge.net>
parents: 318
diff changeset
1782 # Revision 1.33 2001/10/23 01:00:18 richard
61c42790c3f1 Bugfix in filter "widget" placement, thanks Roch'e
Richard Jones <richard@users.sourceforge.net>
parents: 318
diff changeset
1783 # Re-enabled login and registration access after lopping them off via
61c42790c3f1 Bugfix in filter "widget" placement, thanks Roch'e
Richard Jones <richard@users.sourceforge.net>
parents: 318
diff changeset
1784 # disabling access for anonymous users.
61c42790c3f1 Bugfix in filter "widget" placement, thanks Roch'e
Richard Jones <richard@users.sourceforge.net>
parents: 318
diff changeset
1785 # Major re-org of the htmltemplate code, cleaning it up significantly. Fixed
61c42790c3f1 Bugfix in filter "widget" placement, thanks Roch'e
Richard Jones <richard@users.sourceforge.net>
parents: 318
diff changeset
1786 # a couple of bugs while I was there. Probably introduced a couple, but
61c42790c3f1 Bugfix in filter "widget" placement, thanks Roch'e
Richard Jones <richard@users.sourceforge.net>
parents: 318
diff changeset
1787 # things seem to work OK at the moment.
61c42790c3f1 Bugfix in filter "widget" placement, thanks Roch'e
Richard Jones <richard@users.sourceforge.net>
parents: 318
diff changeset
1788 #
318
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
1789 # Revision 1.32 2001/10/22 03:25:01 richard
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
1790 # Added configuration for:
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
1791 # . anonymous user access and registration (deny/allow)
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
1792 # . filter "widget" location on index page (top, bottom, both)
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
1793 # Updated some documentation.
e18dd7227780 Re-enabled login and registration access...
Richard Jones <richard@users.sourceforge.net>
parents: 316
diff changeset
1794 #
316
c0ca7f35e0c5 Added configuration for:
Richard Jones <richard@users.sourceforge.net>
parents: 313
diff changeset
1795 # Revision 1.31 2001/10/21 07:26:35 richard
c0ca7f35e0c5 Added configuration for:
Richard Jones <richard@users.sourceforge.net>
parents: 313
diff changeset
1796 # feature #473127: Filenames. I modified the file.index and htmltemplate
c0ca7f35e0c5 Added configuration for:
Richard Jones <richard@users.sourceforge.net>
parents: 313
diff changeset
1797 # source so that the filename is used in the link and the creation
c0ca7f35e0c5 Added configuration for:
Richard Jones <richard@users.sourceforge.net>
parents: 313
diff changeset
1798 # information is displayed.
c0ca7f35e0c5 Added configuration for:
Richard Jones <richard@users.sourceforge.net>
parents: 313
diff changeset
1799 #
313
489b70c37f32 feature [SF#473127]: Filenames.
Richard Jones <richard@users.sourceforge.net>
parents: 312
diff changeset
1800 # Revision 1.30 2001/10/21 04:44:50 richard
489b70c37f32 feature [SF#473127]: Filenames.
Richard Jones <richard@users.sourceforge.net>
parents: 312
diff changeset
1801 # bug #473124: UI inconsistency with Link fields.
489b70c37f32 feature [SF#473127]: Filenames.
Richard Jones <richard@users.sourceforge.net>
parents: 312
diff changeset
1802 # This also prompted me to fix a fairly long-standing usability issue -
489b70c37f32 feature [SF#473127]: Filenames.
Richard Jones <richard@users.sourceforge.net>
parents: 312
diff changeset
1803 # that of being able to turn off certain filters.
489b70c37f32 feature [SF#473127]: Filenames.
Richard Jones <richard@users.sourceforge.net>
parents: 312
diff changeset
1804 #
312
5a2c43891c20 [SF#473124]: UI inconsistency with Link fields.
Richard Jones <richard@users.sourceforge.net>
parents: 307
diff changeset
1805 # Revision 1.29 2001/10/21 00:17:56 richard
5a2c43891c20 [SF#473124]: UI inconsistency with Link fields.
Richard Jones <richard@users.sourceforge.net>
parents: 307
diff changeset
1806 # CGI interface view customisation section may now be hidden (patch from
5a2c43891c20 [SF#473124]: UI inconsistency with Link fields.
Richard Jones <richard@users.sourceforge.net>
parents: 307
diff changeset
1807 # Roch'e Compaan.)
5a2c43891c20 [SF#473124]: UI inconsistency with Link fields.
Richard Jones <richard@users.sourceforge.net>
parents: 307
diff changeset
1808 #
307
dac78e092228 CGI interface view customisation section may now be hidden
Richard Jones <richard@users.sourceforge.net>
parents: 306
diff changeset
1809 # Revision 1.28 2001/10/21 00:00:16 richard
dac78e092228 CGI interface view customisation section may now be hidden
Richard Jones <richard@users.sourceforge.net>
parents: 306
diff changeset
1810 # Fixed Checklist function - wasn't always working on a list.
dac78e092228 CGI interface view customisation section may now be hidden
Richard Jones <richard@users.sourceforge.net>
parents: 306
diff changeset
1811 #
306
36ae7ffb8a42 Fixed Checklist function - wasn't always working on a list.
Richard Jones <richard@users.sourceforge.net>
parents: 303
diff changeset
1812 # Revision 1.27 2001/10/20 12:13:44 richard
36ae7ffb8a42 Fixed Checklist function - wasn't always working on a list.
Richard Jones <richard@users.sourceforge.net>
parents: 303
diff changeset
1813 # Fixed grouping of non-str properties (thanks Roch'e Compaan)
36ae7ffb8a42 Fixed Checklist function - wasn't always working on a list.
Richard Jones <richard@users.sourceforge.net>
parents: 303
diff changeset
1814 #
303
3d5031f834f0 Fixed grouping of non-str properties (thanks Roch'e Compaan)
Richard Jones <richard@users.sourceforge.net>
parents: 292
diff changeset
1815 # Revision 1.26 2001/10/14 10:55:00 richard
3d5031f834f0 Fixed grouping of non-str properties (thanks Roch'e Compaan)
Richard Jones <richard@users.sourceforge.net>
parents: 292
diff changeset
1816 # Handle empty strings in HTML template Link function
3d5031f834f0 Fixed grouping of non-str properties (thanks Roch'e Compaan)
Richard Jones <richard@users.sourceforge.net>
parents: 292
diff changeset
1817 #
292
4340cdc694d4 Handle empty strings in HTML template Link function
Richard Jones <richard@users.sourceforge.net>
parents: 270
diff changeset
1818 # Revision 1.25 2001/10/09 07:25:59 richard
4340cdc694d4 Handle empty strings in HTML template Link function
Richard Jones <richard@users.sourceforge.net>
parents: 270
diff changeset
1819 # Added the Password property type. See "pydoc roundup.password" for
4340cdc694d4 Handle empty strings in HTML template Link function
Richard Jones <richard@users.sourceforge.net>
parents: 270
diff changeset
1820 # implementation details. Have updated some of the documentation too.
4340cdc694d4 Handle empty strings in HTML template Link function
Richard Jones <richard@users.sourceforge.net>
parents: 270
diff changeset
1821 #
270
a4241ddd22d7 Added the Password property type.
Richard Jones <richard@users.sourceforge.net>
parents: 250
diff changeset
1822 # Revision 1.24 2001/09/27 06:45:58 richard
a4241ddd22d7 Added the Password property type.
Richard Jones <richard@users.sourceforge.net>
parents: 250
diff changeset
1823 # *gak* ... xmp is Old Skool apparently. Am using pre again by have the option
a4241ddd22d7 Added the Password property type.
Richard Jones <richard@users.sourceforge.net>
parents: 250
diff changeset
1824 # on the plain() template function to escape the text for HTML.
a4241ddd22d7 Added the Password property type.
Richard Jones <richard@users.sourceforge.net>
parents: 250
diff changeset
1825 #
250
1d428068485c *gak* ... xmp is Old Skool apparently.
Richard Jones <richard@users.sourceforge.net>
parents: 245
diff changeset
1826 # Revision 1.23 2001/09/10 09:47:18 richard
1d428068485c *gak* ... xmp is Old Skool apparently.
Richard Jones <richard@users.sourceforge.net>
parents: 245
diff changeset
1827 # Fixed bug in the generation of links to Link/Multilink in indexes.
1d428068485c *gak* ... xmp is Old Skool apparently.
Richard Jones <richard@users.sourceforge.net>
parents: 245
diff changeset
1828 # (thanks Hubert Hoegl)
1d428068485c *gak* ... xmp is Old Skool apparently.
Richard Jones <richard@users.sourceforge.net>
parents: 245
diff changeset
1829 # Added AssignedTo to the "classic" schema's item page.
1d428068485c *gak* ... xmp is Old Skool apparently.
Richard Jones <richard@users.sourceforge.net>
parents: 245
diff changeset
1830 #
245
8a0d548c07a1 Fixed bug in the generation of links to Link/Multilink in indexes.
Richard Jones <richard@users.sourceforge.net>
parents: 244
diff changeset
1831 # Revision 1.22 2001/08/30 06:01:17 richard
8a0d548c07a1 Fixed bug in the generation of links to Link/Multilink in indexes.
Richard Jones <richard@users.sourceforge.net>
parents: 244
diff changeset
1832 # Fixed missing import in mailgw :(
8a0d548c07a1 Fixed bug in the generation of links to Link/Multilink in indexes.
Richard Jones <richard@users.sourceforge.net>
parents: 244
diff changeset
1833 #
244
6bf584784e31 Fixed missing import in mailgw :(
Richard Jones <richard@users.sourceforge.net>
parents: 231
diff changeset
1834 # Revision 1.21 2001/08/16 07:34:59 richard
6bf584784e31 Fixed missing import in mailgw :(
Richard Jones <richard@users.sourceforge.net>
parents: 231
diff changeset
1835 # better CGI text searching - but hidden filter fields are disappearing...
6bf584784e31 Fixed missing import in mailgw :(
Richard Jones <richard@users.sourceforge.net>
parents: 231
diff changeset
1836 #
231
afd428ba6523 better CGI text searching - but hidden filter fields are disappearing...
Richard Jones <richard@users.sourceforge.net>
parents: 228
diff changeset
1837 # Revision 1.20 2001/08/15 23:43:18 richard
afd428ba6523 better CGI text searching - but hidden filter fields are disappearing...
Richard Jones <richard@users.sourceforge.net>
parents: 228
diff changeset
1838 # Fixed some isFooTypes that I missed.
afd428ba6523 better CGI text searching - but hidden filter fields are disappearing...
Richard Jones <richard@users.sourceforge.net>
parents: 228
diff changeset
1839 # Refactored some code in the CGI code.
afd428ba6523 better CGI text searching - but hidden filter fields are disappearing...
Richard Jones <richard@users.sourceforge.net>
parents: 228
diff changeset
1840 #
228
1d1848c99abe Fixed some isFooTypes that I missed.
Richard Jones <richard@users.sourceforge.net>
parents: 224
diff changeset
1841 # Revision 1.19 2001/08/12 06:32:36 richard
1d1848c99abe Fixed some isFooTypes that I missed.
Richard Jones <richard@users.sourceforge.net>
parents: 224
diff changeset
1842 # using isinstance(blah, Foo) now instead of isFooType
1d1848c99abe Fixed some isFooTypes that I missed.
Richard Jones <richard@users.sourceforge.net>
parents: 224
diff changeset
1843 #
224
ad2c98faec97 using isinstance(blah, Foo) now instead of isFooType
Richard Jones <richard@users.sourceforge.net>
parents: 214
diff changeset
1844 # Revision 1.18 2001/08/07 00:24:42 richard
ad2c98faec97 using isinstance(blah, Foo) now instead of isFooType
Richard Jones <richard@users.sourceforge.net>
parents: 214
diff changeset
1845 # stupid typo
ad2c98faec97 using isinstance(blah, Foo) now instead of isFooType
Richard Jones <richard@users.sourceforge.net>
parents: 214
diff changeset
1846 #
214
18134bffab37 stupid typo
Richard Jones <richard@users.sourceforge.net>
parents: 213
diff changeset
1847 # Revision 1.17 2001/08/07 00:15:51 richard
18134bffab37 stupid typo
Richard Jones <richard@users.sourceforge.net>
parents: 213
diff changeset
1848 # Added the copyright/license notice to (nearly) all files at request of
18134bffab37 stupid typo
Richard Jones <richard@users.sourceforge.net>
parents: 213
diff changeset
1849 # Bizar Software.
18134bffab37 stupid typo
Richard Jones <richard@users.sourceforge.net>
parents: 213
diff changeset
1850 #
213
d45384bc6420 Added the copyright/license notice to (nearly) all files...
Richard Jones <richard@users.sourceforge.net>
parents: 171
diff changeset
1851 # Revision 1.16 2001/08/01 03:52:23 richard
d45384bc6420 Added the copyright/license notice to (nearly) all files...
Richard Jones <richard@users.sourceforge.net>
parents: 171
diff changeset
1852 # Checklist was using wrong name.
d45384bc6420 Added the copyright/license notice to (nearly) all files...
Richard Jones <richard@users.sourceforge.net>
parents: 171
diff changeset
1853 #
171
3c19bc818711 Checklist was using wrong name.
Richard Jones <richard@users.sourceforge.net>
parents: 167
diff changeset
1854 # Revision 1.15 2001/07/30 08:12:17 richard
3c19bc818711 Checklist was using wrong name.
Richard Jones <richard@users.sourceforge.net>
parents: 167
diff changeset
1855 # Added time logging and file uploading to the templates.
3c19bc818711 Checklist was using wrong name.
Richard Jones <richard@users.sourceforge.net>
parents: 167
diff changeset
1856 #
167
a49c8a2ddd26 Added time logging and file uploading to the templates.
Richard Jones <richard@users.sourceforge.net>
parents: 162
diff changeset
1857 # Revision 1.14 2001/07/30 06:17:45 richard
a49c8a2ddd26 Added time logging and file uploading to the templates.
Richard Jones <richard@users.sourceforge.net>
parents: 162
diff changeset
1858 # Features:
a49c8a2ddd26 Added time logging and file uploading to the templates.
Richard Jones <richard@users.sourceforge.net>
parents: 162
diff changeset
1859 # . Added ability for cgi newblah forms to indicate that the new node
a49c8a2ddd26 Added time logging and file uploading to the templates.
Richard Jones <richard@users.sourceforge.net>
parents: 162
diff changeset
1860 # should be linked somewhere.
a49c8a2ddd26 Added time logging and file uploading to the templates.
Richard Jones <richard@users.sourceforge.net>
parents: 162
diff changeset
1861 # Fixed:
a49c8a2ddd26 Added time logging and file uploading to the templates.
Richard Jones <richard@users.sourceforge.net>
parents: 162
diff changeset
1862 # . Fixed the agument handling for the roundup-admin find command.
a49c8a2ddd26 Added time logging and file uploading to the templates.
Richard Jones <richard@users.sourceforge.net>
parents: 162
diff changeset
1863 # . Fixed handling of summary when no note supplied for newblah. Again.
a49c8a2ddd26 Added time logging and file uploading to the templates.
Richard Jones <richard@users.sourceforge.net>
parents: 162
diff changeset
1864 # . Fixed detection of no form in htmltemplate Field display.
a49c8a2ddd26 Added time logging and file uploading to the templates.
Richard Jones <richard@users.sourceforge.net>
parents: 162
diff changeset
1865 #
162
717f12e6ccf2 Features and fixes.
Richard Jones <richard@users.sourceforge.net>
parents: 155
diff changeset
1866 # Revision 1.13 2001/07/30 02:37:53 richard
717f12e6ccf2 Features and fixes.
Richard Jones <richard@users.sourceforge.net>
parents: 155
diff changeset
1867 # Temporary measure until we have decent schema migration.
717f12e6ccf2 Features and fixes.
Richard Jones <richard@users.sourceforge.net>
parents: 155
diff changeset
1868 #
155
03bdef2d645b Temporary measure until we have decent schema migration.
Richard Jones <richard@users.sourceforge.net>
parents: 141
diff changeset
1869 # Revision 1.12 2001/07/30 01:24:33 richard
03bdef2d645b Temporary measure until we have decent schema migration.
Richard Jones <richard@users.sourceforge.net>
parents: 141
diff changeset
1870 # Handles new node display now.
03bdef2d645b Temporary measure until we have decent schema migration.
Richard Jones <richard@users.sourceforge.net>
parents: 141
diff changeset
1871 #
141
5e8da9d010bd Handles new node display now.
Richard Jones <richard@users.sourceforge.net>
parents: 131
diff changeset
1872 # Revision 1.11 2001/07/29 09:31:35 richard
5e8da9d010bd Handles new node display now.
Richard Jones <richard@users.sourceforge.net>
parents: 131
diff changeset
1873 # oops
5e8da9d010bd Handles new node display now.
Richard Jones <richard@users.sourceforge.net>
parents: 131
diff changeset
1874 #
131
Richard Jones <richard@users.sourceforge.net>
parents: 130
diff changeset
1875 # Revision 1.10 2001/07/29 09:28:23 richard
Richard Jones <richard@users.sourceforge.net>
parents: 130
diff changeset
1876 # Fixed sorting by clicking on column headings.
Richard Jones <richard@users.sourceforge.net>
parents: 130
diff changeset
1877 #
130
204f99944de0 Fixed sorting by clicking on column headings.
Richard Jones <richard@users.sourceforge.net>
parents: 128
diff changeset
1878 # Revision 1.9 2001/07/29 08:27:40 richard
204f99944de0 Fixed sorting by clicking on column headings.
Richard Jones <richard@users.sourceforge.net>
parents: 128
diff changeset
1879 # Fixed handling of passed-in values in form elements (ie. during a
204f99944de0 Fixed sorting by clicking on column headings.
Richard Jones <richard@users.sourceforge.net>
parents: 128
diff changeset
1880 # drill-down)
204f99944de0 Fixed sorting by clicking on column headings.
Richard Jones <richard@users.sourceforge.net>
parents: 128
diff changeset
1881 #
128
ce36f2962b94 Fixed handling of passed-in values in form elements (ie. during a drill-down)
Richard Jones <richard@users.sourceforge.net>
parents: 127
diff changeset
1882 # Revision 1.8 2001/07/29 07:01:39 richard
ce36f2962b94 Fixed handling of passed-in values in form elements (ie. during a drill-down)
Richard Jones <richard@users.sourceforge.net>
parents: 127
diff changeset
1883 # Added vim command to all source so that we don't get no steenkin' tabs :)
ce36f2962b94 Fixed handling of passed-in values in form elements (ie. during a drill-down)
Richard Jones <richard@users.sourceforge.net>
parents: 127
diff changeset
1884 #
127
0791d13baea7 Added vim command to all source so that we don't get no steenkin' tabs :)
Richard Jones <richard@users.sourceforge.net>
parents: 123
diff changeset
1885 # Revision 1.7 2001/07/29 05:36:14 richard
0791d13baea7 Added vim command to all source so that we don't get no steenkin' tabs :)
Richard Jones <richard@users.sourceforge.net>
parents: 123
diff changeset
1886 # Cleanup of the link label generation.
0791d13baea7 Added vim command to all source so that we don't get no steenkin' tabs :)
Richard Jones <richard@users.sourceforge.net>
parents: 123
diff changeset
1887 #
123
51cce9671db0 Cleanup of the link label generation.
Richard Jones <richard@users.sourceforge.net>
parents: 119
diff changeset
1888 # Revision 1.6 2001/07/29 04:06:42 richard
51cce9671db0 Cleanup of the link label generation.
Richard Jones <richard@users.sourceforge.net>
parents: 119
diff changeset
1889 # Fixed problem in link display when Link value is None.
51cce9671db0 Cleanup of the link label generation.
Richard Jones <richard@users.sourceforge.net>
parents: 119
diff changeset
1890 #
119
ad64dade1769 Fixed problem in link display when Link value is None.
Richard Jones <richard@users.sourceforge.net>
parents: 116
diff changeset
1891 # Revision 1.5 2001/07/28 08:17:09 richard
ad64dade1769 Fixed problem in link display when Link value is None.
Richard Jones <richard@users.sourceforge.net>
parents: 116
diff changeset
1892 # fixed use of stylesheet
ad64dade1769 Fixed problem in link display when Link value is None.
Richard Jones <richard@users.sourceforge.net>
parents: 116
diff changeset
1893 #
116
c73f727208b0 fixed use of stylesheet
Richard Jones <richard@users.sourceforge.net>
parents: 113
diff changeset
1894 # Revision 1.4 2001/07/28 07:59:53 richard
c73f727208b0 fixed use of stylesheet
Richard Jones <richard@users.sourceforge.net>
parents: 113
diff changeset
1895 # Replaced errno integers with their module values.
c73f727208b0 fixed use of stylesheet
Richard Jones <richard@users.sourceforge.net>
parents: 113
diff changeset
1896 # De-tabbed templatebuilder.py
c73f727208b0 fixed use of stylesheet
Richard Jones <richard@users.sourceforge.net>
parents: 113
diff changeset
1897 #
113
2ab86442799a Replaced errno integers with their module values.
Richard Jones <richard@users.sourceforge.net>
parents: 72
diff changeset
1898 # Revision 1.3 2001/07/25 03:39:47 richard
2ab86442799a Replaced errno integers with their module values.
Richard Jones <richard@users.sourceforge.net>
parents: 72
diff changeset
1899 # Hrm - displaying links to classes that don't specify a key property. I've
2ab86442799a Replaced errno integers with their module values.
Richard Jones <richard@users.sourceforge.net>
parents: 72
diff changeset
1900 # got it defaulting to 'name', then 'title' and then a "random" property (first
2ab86442799a Replaced errno integers with their module values.
Richard Jones <richard@users.sourceforge.net>
parents: 72
diff changeset
1901 # one returned by getprops().keys().
2ab86442799a Replaced errno integers with their module values.
Richard Jones <richard@users.sourceforge.net>
parents: 72
diff changeset
1902 # Needs to be moved onto the Class I think...
2ab86442799a Replaced errno integers with their module values.
Richard Jones <richard@users.sourceforge.net>
parents: 72
diff changeset
1903 #
72
c186b637fee0 Hrm - displaying links to classes that don't specify a key property.
Richard Jones <richard@users.sourceforge.net>
parents: 26
diff changeset
1904 # Revision 1.2 2001/07/22 12:09:32 richard
c186b637fee0 Hrm - displaying links to classes that don't specify a key property.
Richard Jones <richard@users.sourceforge.net>
parents: 26
diff changeset
1905 # Final commit of Grande Splite
c186b637fee0 Hrm - displaying links to classes that don't specify a key property.
Richard Jones <richard@users.sourceforge.net>
parents: 26
diff changeset
1906 #
26
c7c14960f413 Final commit of Grande Splite
Richard Jones <richard@users.sourceforge.net>
parents: 25
diff changeset
1907 # Revision 1.1 2001/07/22 11:58:35 richard
c7c14960f413 Final commit of Grande Splite
Richard Jones <richard@users.sourceforge.net>
parents: 25
diff changeset
1908 # More Grande Splite
25
4cf1daf2f2eb More Grande Splite
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
1909 #
127
0791d13baea7 Added vim command to all source so that we don't get no steenkin' tabs :)
Richard Jones <richard@users.sourceforge.net>
parents: 123
diff changeset
1910 #
0791d13baea7 Added vim command to all source so that we don't get no steenkin' tabs :)
Richard Jones <richard@users.sourceforge.net>
parents: 123
diff changeset
1911 # vim: set filetype=python ts=4 sw=4 et si

Roundup Issue Tracker: http://roundup-tracker.org/