From: richard Date: Sun, 21 Oct 2001 00:17:56 +0000 (+0000) Subject: CGI interface view customisation section may now be hidden (patch from X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=ce0b839017be714df484d8b0a804b45e4569fa1f;p=roundup.git CGI interface view customisation section may now be hidden (patch from Roch'e Compaan.) git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@317 57a73879-2fb5-44c3-a270-3262357dd7e2 --- diff --git a/CHANGES.txt b/CHANGES.txt index 686d30f..95b3484 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -4,6 +4,8 @@ are given with the most recent entry first. 2001-10-?? - 0.3.0 Feature: . Hyperdatabase sorts strings-that-look-like-numbers as numbers now. + . CGI interface view customisation section may now be hidden (patch from + Roch'e Compaan.) Admin Tool (roundup-admin): . Interactive mode for running multiple (independant at present) commands. . Tabular display of nodes. diff --git a/roundup/cgi_client.py b/roundup/cgi_client.py index 21af9a2..55ced04 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.34 2001-10-20 11:58:48 richard Exp $ +# $Id: cgi_client.py,v 1.35 2001-10-21 00:17:54 richard Exp $ import os, cgi, pprint, StringIO, urlparse, re, traceback, mimetypes import base64, Cookie, time @@ -156,6 +156,21 @@ class Client: filterspec[key] = value.value return filterspec + def customization_widget(self): + ''' The customization widget is visible by default. The widget + visibility is remembered by show_customization. Visibility + is not toggled if the action value is "Redisplay" + ''' + if not self.form.has_key('show_customization'): + visible = 1 + else: + visible = int(self.form['show_customization'].value) + if self.form.has_key('action'): + if self.form['action'].value != 'Redisplay': + visible = self.form['action'].value == '+' + + return visible + default_index_sort = ['-activity'] default_index_group = ['priority'] default_index_filter = [] @@ -182,7 +197,7 @@ class Client: # XXX deviates from spec - loses the '+' (that's a reserved character # in URLS def list(self, sort=None, group=None, filter=None, columns=None, - filterspec=None): + filterspec=None, show_customization=None): ''' call the template index with the args :sort - sort by prop name, optionally preceeded with '-' @@ -202,9 +217,12 @@ class Client: if filter is None: filter = self.index_arg(':filter') if columns is None: columns = self.index_arg(':columns') if filterspec is None: filterspec = self.index_filterspec() + if show_customization is None: + show_customization = self.customization_widget() htmltemplate.index(self, self.TEMPLATES, self.db, cn, filterspec, - filter, columns, sort, group) + filter, columns, sort, group, + show_customization=show_customization) self.pagefoot() def shownode(self, message=None): @@ -681,8 +699,8 @@ class ExtendedClient(Client): if self.user not in (None, 'anonymous'): userid = self.db.user.lookup(self.user) user_info = ''' -My Issues | -My Support | +My Issues | +My Support | My Details | Logout '''%(userid, userid, userid) else: @@ -707,11 +725,11 @@ class ExtendedClient(Client): %s All -Issues, -Support +Issues, +Support | Unassigned -Issues, -Support +Issues, +Support %s %s %s @@ -776,6 +794,10 @@ def parsePropsFromForm(db, cl, form, nodeid=0): # # $Log: not supported by cvs2svn $ +# Revision 1.34 2001/10/20 11:58:48 richard +# Catch errors in login - no username or password supplied. +# Fixed editing of password (Password property type) thanks Roch'e Compaan. +# # Revision 1.33 2001/10/17 00:18:41 richard # Manually constructing cookie headers now. # diff --git a/roundup/htmltemplate.py b/roundup/htmltemplate.py index 6a37e43..c65ef4d 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.28 2001-10-21 00:00:16 richard Exp $ +# $Id: htmltemplate.py,v 1.29 2001-10-21 00:17:56 richard Exp $ import os, re, StringIO, urllib, cgi, errno @@ -312,7 +312,7 @@ class Checklist(Base): # get our current checkbox state if self.nodeid: # get the info from the node - make sure it's a list - if isinstance(propclass, hyperdb.Link: + if isinstance(propclass, hyperdb.Link): value = [self.cl.get(self.nodeid, property)] else: value = self.cl.get(self.nodeid, property) @@ -462,6 +462,7 @@ def sortby(sort_name, columns, filter, sort, group, filterspec): def index(client, templates, db, classname, filterspec={}, filter=[], columns=[], sort=[], group=[], show_display_form=1, nodeids=None, + show_customization=1, col_re=re.compile(r']+)">')): globals = { 'plain': Plain(db, templates, classname, filterspec=filterspec), @@ -498,7 +499,7 @@ def index(client, templates, db, classname, filterspec={}, filter=[], replace = IndexTemplateReplace(globals, locals(), filter) w(replace.go(template)) w(' ') - w('') + w('') w('') # If the filters aren't being displayed, then hide their current @@ -528,6 +529,93 @@ def index(client, templates, db, classname, filterspec={}, filter=[], l.append(name) columns = l + # now add in the filter/columns/group/etc config table form + w('' % + show_customization ) + w('\n') + names = [] + for name in cl.getprops().keys(): + if name in all_filters or name in all_columns: + names.append(name) + w('') + if show_customization: + action = '-' + else: + action = '+' + # hide the values for filters, columns and grouping in the form + # if the customization widget is not visible + for name in names: + if all_filters and name in filter: + w('' % name) + if all_columns and name in columns: + w('' % name) + if all_columns and name in group: + w('' % name) + + if show_display_form: + # TODO: The widget style can go into the stylesheet + w('\n'%(len(names)+1, action)) + if show_customization: + w('') + for name in names: + w(''%name.capitalize()) + w('\n') + + # Filter + if all_filters: + w('\n') + for name in names: + if name not in all_filters: + w('') + continue + if name in filter: checked=' checked' + else: checked='' + w('\n'%(name, checked)) + w('\n') + + # Columns + if all_columns: + w('\n') + for name in names: + if name not in all_columns: + w('') + continue + if name in columns: checked=' checked' + else: checked='' + w('\n'%(name, checked)) + w('\n') + + # Grouping + w('\n') + for name in names: + prop = properties[name] + if name not in all_columns: + w('') + continue + if name in group: checked=' checked' + else: checked='' + w('\n'%(name, checked)) + w('\n') + + w('') + w('') + w('\n') + + w('
' + ' View ' + 'customisation...
 %s
' + 'Filters \n') + w('
' + 'Columns \n') + w('
' + 'Grouping \n') + w('
 '%len(names)) + w('
\n') + w('\n') + # now display the index section w('\n') w('\n') @@ -596,72 +684,6 @@ def index(client, templates, db, classname, filterspec={}, filter=[], w('
') - if not show_display_form: - return - - # now add in the filter/columns/group/etc config table form - w('

') - w('\n') - names = [] - for name in cl.getprops().keys(): - if name in all_filters or name in all_columns: - names.append(name) - w('') - w('\n'% - (len(names)+1)) - w('') - for name in names: - w(''%name.capitalize()) - w('\n') - - # filter - if all_filters: - w('\n') - for name in names: - if name not in all_filters: - w('') - continue - if name in filter: checked=' checked' - else: checked='' - w('\n'%( - name, checked)) - w('\n') - - # columns - if all_columns: - w('\n') - for name in names: - if name not in all_columns: - w('') - continue - if name in columns: checked=' checked' - else: checked='' - w('\n'%( - name, checked)) - w('\n') - - # group - w('\n') - for name in names: - prop = properties[name] - if name not in all_columns: - w('') - continue - if name in group: checked=' checked' - else: checked='' - w('\n'%( - name, checked)) - w('\n') - - w('') - w('\n') - w('
View customisation...
 %s
Filters \n') - w('
Columns \n') - w('
Grouping \n') - w('
 '%len(names)) - w('
\n') - w('\n') - # # ITEM TEMPLATES @@ -768,6 +790,9 @@ def newitem(client, templates, db, classname, form, replace=re.compile( # # $Log: not supported by cvs2svn $ +# Revision 1.28 2001/10/21 00:00:16 richard +# Fixed Checklist function - wasn't always working on a list. +# # Revision 1.27 2001/10/20 12:13:44 richard # Fixed grouping of non-str properties (thanks Roch'e Compaan) #