From: richard Date: Thu, 21 Feb 2002 06:57:39 +0000 (+0000) Subject: . Added popup help for classes using the classhelp html template function. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=766d9fd3275405ca4ebf5558485c7091b31593ac;p=roundup.git . Added popup help for classes using the classhelp html template function. - add to an item page, and it generates a link to a popup window which displays the id, name and description for the priority class. The description field won't exist in most installations, but it will be added to the default templates. git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@647 57a73879-2fb5-44c3-a270-3262357dd7e2 --- diff --git a/CHANGES.txt b/CHANGES.txt index 0a64305..ac1f47e 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -14,6 +14,12 @@ Feature: - access using the admin "class list" interface - limited to admin-only - requires the csv module from object-craft (url given if it's missing) + . Added popup help for classes using the classhelp html template function. + - add + to an item page, and it generates a link to a popup window which displays + the id, name and description for the priority class. The description + field won't exist in most installations, but it will be added to the + default templates. Fixed: . Clean up mail handling, multipart handling. diff --git a/roundup/cgi_client.py b/roundup/cgi_client.py index f816a47..b06b3b8 100644 --- a/roundup/cgi_client.py +++ b/roundup/cgi_client.py @@ -15,7 +15,7 @@ # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. # -# $Id: cgi_client.py,v 1.106 2002-02-21 06:23:00 richard Exp $ +# $Id: cgi_client.py,v 1.107 2002-02-21 06:57:38 richard Exp $ __doc__ = """ WWW request handler (also used in the stand-alone server). @@ -52,11 +52,12 @@ class Client: self.env = env self.path = env['PATH_INFO'] self.split_path = self.path.split('/') + self.instance_path_name = env['INSTANCE_NAME'] url = self.env['SCRIPT_NAME'] + '/' machine = self.env['SERVER_NAME'] port = self.env['SERVER_PORT'] if port != '80': machine = machine + ':' + port - self.base = urlparse.urlunparse(('http', machine, url, None,None,None)) + self.base = urlparse.urlunparse(('http', env['HOST'], url, None,None,None)) if form is None: self.form = cgi.FieldStorage(environ=env) @@ -96,10 +97,11 @@ function submit_once() { submitted = true; return 1; } + function help_window(helpurl) { - helpwin = window.open(%(base)s + helpurl, 'HelpWindow', - 'scrollbars=yes,resizable=yes,toolbar=no,height=400,width=400'); + HelpWin = window.open('%(base)s%(instance_path_name)s/' + helpurl, 'HelpWindow', 'scrollbars=yes,resizable=yes,toolbar=no,height=400,width=400'); } + ''' @@ -396,6 +398,27 @@ function help_window(helpurl) { w(_('
')) + def classhelp(self): + '''Display a table of class info + ''' + w = self.write + cn = self.form['classname'].value + cl = self.db.classes[cn] + props = self.form['columns'].value.split(',') + + w('') + w('') + for name in props: + w(''%name) + w('') + for nodeid in cl.list(): + w('') + for name in props: + value = cgi.escape(str(cl.get(nodeid, name))) + w(''%value) + w('') + w('
%s
%s
') + def shownode(self, message=None): ''' display an item ''' @@ -1101,6 +1124,9 @@ function help_window(helpurl) { if action == 'list_classes': self.classes() return + if action == 'classhelp': + self.classhelp() + return if action == 'login': self.login() return @@ -1298,6 +1324,9 @@ def parsePropsFromForm(db, cl, form, nodeid=0): # # $Log: not supported by cvs2svn $ +# Revision 1.106 2002/02/21 06:23:00 richard +# *** empty log message *** +# # Revision 1.105 2002/02/20 05:52:10 richard # better error handling # diff --git a/roundup/htmltemplate.py b/roundup/htmltemplate.py index bd28ddc..fbb21f5 100644 --- a/roundup/htmltemplate.py +++ b/roundup/htmltemplate.py @@ -15,7 +15,7 @@ # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. # -# $Id: htmltemplate.py,v 1.78 2002-02-21 06:23:00 richard Exp $ +# $Id: htmltemplate.py,v 1.79 2002-02-21 06:57:38 richard Exp $ __doc__ = """ Template engine. @@ -655,11 +655,11 @@ class TemplateFunctions: else: return _('[Submit: not called from item]') - def do_classhelp(self, classname, colums): + def do_classhelp(self, classname, properties): '''pop up a javascript window with class help ''' return '(?)'%(classname, columns) + 'properties=%s\')">(?)'%(classname, properties) # # INDEX TEMPLATES # @@ -1081,6 +1081,9 @@ class NewItemTemplate(TemplateFunctions): # # $Log: not supported by cvs2svn $ +# Revision 1.78 2002/02/21 06:23:00 richard +# *** empty log message *** +# # Revision 1.77 2002/02/20 05:05:29 richard # . Added simple editing for classes that don't define a templated interface. # - access using the admin "class list" interface diff --git a/roundup/scripts/roundup_server.py b/roundup/scripts/roundup_server.py index 60d32e0..1d6a80b 100644 --- a/roundup/scripts/roundup_server.py +++ b/roundup/scripts/roundup_server.py @@ -18,7 +18,7 @@ # """ HTTP Server that serves roundup. -$Id: roundup_server.py,v 1.2 2002-01-29 20:07:15 jhermann Exp $ +$Id: roundup_server.py,v 1.3 2002-02-21 06:57:39 richard Exp $ """ # python version check @@ -158,6 +158,7 @@ class RoundupRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler): env['SCRIPT_NAME'] = '' env['SERVER_NAME'] = self.server.server_name env['SERVER_PORT'] = str(self.server.server_port) + env['HOST'] = self.headers['host'] decoded_query = query.replace('+', ' ') @@ -248,6 +249,9 @@ if __name__ == '__main__': # # $Log: not supported by cvs2svn $ +# Revision 1.2 2002/01/29 20:07:15 jhermann +# Conversion to generated script stubs +# # Revision 1.1 2002/01/29 19:53:08 jhermann # Moved scripts from top-level dir to roundup.scripts subpackage # diff --git a/test/test_dates.py b/test/test_dates.py index 624b312..cedc2d3 100644 --- a/test/test_dates.py +++ b/test/test_dates.py @@ -15,7 +15,7 @@ # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. # -# $Id: test_dates.py,v 1.8 2002-01-16 07:02:57 richard Exp $ +# $Id: test_dates.py,v 1.9 2002-02-21 06:57:39 richard Exp $ import unittest, time @@ -70,6 +70,8 @@ class DateTestCase(unittest.TestCase): ae(str(date), '%s-%02d-%02d.19:25:00'%(y, m, d)) date = Date("8:47:11", -5) ae(str(date), '%s-%02d-%02d.13:47:11'%(y, m, d)) + # TODO: assert something + Date() + Interval('- 2y 2m') def testInterval(self): ae = self.assertEqual @@ -87,6 +89,10 @@ def suite(): # # $Log: not supported by cvs2svn $ +# Revision 1.8 2002/01/16 07:02:57 richard +# . lots of date/interval related changes: +# - more relaxed date format for input +# # Revision 1.7 2001/08/13 23:01:53 richard # fixed a 2.1-ism # diff --git a/test/test_htmltemplate.py b/test/test_htmltemplate.py index 80506f3..29bb6f3 100644 --- a/test/test_htmltemplate.py +++ b/test/test_htmltemplate.py @@ -8,7 +8,7 @@ # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # -# $Id: test_htmltemplate.py,v 1.9 2002-02-15 07:08:45 richard Exp $ +# $Id: test_htmltemplate.py,v 1.10 2002-02-21 06:57:39 richard Exp $ import unittest, cgi, time @@ -24,7 +24,7 @@ class Class: elif attribute == 'filename': return 'file.foo' elif attribute == 'date': - return date.Date('2000-01-01') + return date.Date() + date.Interval('- 2y 2m') elif attribute == 'interval': return date.Interval('-3d') elif attribute == 'link': @@ -330,12 +330,21 @@ the key2:''') #self.assertEqual(self.tf.do_list('multilink'),'') pass + def testClasshelp(self): + self.assertEqual(self.tf.do_classhelp('theclass', 'prop1,prop2'), + '(?)') + def suite(): return unittest.makeSuite(NodeCase, 'test') # # $Log: not supported by cvs2svn $ +# Revision 1.9 2002/02/15 07:08:45 richard +# . Alternate email addresses are now available for users. See the MIGRATION +# file for info on how to activate the feature. +# # Revision 1.8 2002/02/06 03:47:16 richard # . #511586 ] unittest FAIL: testReldate_date #