comparison roundup/cgi/templating.py @ 5336:5a81a097a394

Allow grouping of classhelp items Needs a changed help template to make use of this.
author Ralf Schlatterbeck <rsc@runtux.com>
date Fri, 22 Jun 2018 18:23:07 +0200
parents 7c7f3faa5e10
children 66a17c80e035
comparison
equal deleted inserted replaced
5335:e7293df727dc 5336:5a81a097a394
704 return l 704 return l
705 705
706 def classhelp(self, properties=None, label=''"(list)", width='500', 706 def classhelp(self, properties=None, label=''"(list)", width='500',
707 height='600', property='', form='itemSynopsis', 707 height='600', property='', form='itemSynopsis',
708 pagesize=50, inputtype="checkbox", html_kwargs={}, 708 pagesize=50, inputtype="checkbox", html_kwargs={},
709 sort=None, filter=None): 709 group='', sort=None, filter=None):
710 """Pop up a javascript window with class help 710 """Pop up a javascript window with class help
711 711
712 This generates a link to a popup window which displays the 712 This generates a link to a popup window which displays the
713 properties indicated by "properties" of the class named by 713 properties indicated by "properties" of the class named by
714 "classname". The "properties" should be a comma-separated list 714 "classname". The "properties" should be a comma-separated list
745 if 'username' in properties.split( ',' ): 745 if 'username' in properties.split( ',' ):
746 sort = 'username' 746 sort = 'username'
747 else: 747 else:
748 sort = self._klass.orderprop() 748 sort = self._klass.orderprop()
749 sort = '&amp;@sort=' + sort 749 sort = '&amp;@sort=' + sort
750 if group :
751 group = '&amp;@group=' + group
750 if property: 752 if property:
751 property = '&amp;property=%s'%property 753 property = '&amp;property=%s'%property
752 if form: 754 if form:
753 form = '&amp;form=%s'%form 755 form = '&amp;form=%s'%form
754 if inputtype: 756 if inputtype:
763 filtervalues.append('&amp;%s=%s' % (name, urllib.quote(values))) 765 filtervalues.append('&amp;%s=%s' % (name, urllib.quote(values)))
764 filter = '&amp;@filter=%s%s' % (','.join(names), ''.join(filtervalues)) 766 filter = '&amp;@filter=%s%s' % (','.join(names), ''.join(filtervalues))
765 else: 767 else:
766 filter = '' 768 filter = ''
767 help_url = "%s?@startwith=0&amp;@template=help&amp;"\ 769 help_url = "%s?@startwith=0&amp;@template=help&amp;"\
768 "properties=%s%s%s%s%s&amp;@pagesize=%s%s" % \ 770 "properties=%s%s%s%s%s%s&amp;@pagesize=%s%s" % \
769 (self.classname, properties, property, form, type, 771 (self.classname, properties, property, form, type,
770 sort, pagesize, filter) 772 group, sort, pagesize, filter)
771 onclick = "javascript:help_window('%s', '%s', '%s');return false;" % \ 773 onclick = "javascript:help_window('%s', '%s', '%s');return false;" % \
772 (help_url, width, height) 774 (help_url, width, height)
773 return '<a class="classhelp" href="%s" onclick="%s" %s>%s</a>' % \ 775 return '<a class="classhelp" href="%s" onclick="%s" %s>%s</a>' % \
774 (help_url, onclick, cgi_escape_attrs(**html_kwargs), 776 (help_url, onclick, cgi_escape_attrs(**html_kwargs),
775 self._(label)) 777 self._(label))

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