1515# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1616# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1717#
18- # $Id: htmltemplate.py,v 1.39 2001-11-03 01:43:47 richard Exp $
18+ # $Id: htmltemplate.py,v 1.40 2001-11-03 01:56:51 richard Exp $
1919
2020import os , re , StringIO , urllib , cgi , errno
2121
@@ -521,11 +521,11 @@ def render(self, filterspec={}, filter=[], columns=[], sort=[], group=[],
521521 columns = l
522522
523523 # display the filter section
524- if (hasattr (self .client , 'FILTER_POSITION' ) and
524+ if (show_display_form and hasattr (self .client , 'FILTER_POSITION' ) and
525525 self .client .FILTER_POSITION in ('top and bottom' , 'top' )):
526526 w ('<form action="index">\n ' )
527527 self .filter_section (filter_template , filter , columns , group ,
528- all_filters , all_columns , show_display_form , show_customization )
528+ all_filters , all_columns , show_customization )
529529 # make sure that the sorting doesn't get lost either
530530 if sort :
531531 w ('<input type="hidden" name=":sort" value="%s">' %
@@ -602,11 +602,11 @@ def render(self, filterspec={}, filter=[], columns=[], sort=[], group=[],
602602 w ('</table>' )
603603
604604 # display the filter section
605- if (hasattr (self .client , 'FILTER_POSITION' ) and
605+ if (show_display_form and hasattr (self .client , 'FILTER_POSITION' ) and
606606 self .client .FILTER_POSITION in ('top and bottom' , 'bottom' )):
607607 w ('<form action="index">\n ' )
608608 self .filter_section (filter_template , filter , columns , group ,
609- all_filters , all_columns , show_display_form , show_customization )
609+ all_filters , all_columns , show_customization )
610610 # make sure that the sorting doesn't get lost either
611611 if sort :
612612 w ('<input type="hidden" name=":sort" value="%s">' %
@@ -615,7 +615,7 @@ def render(self, filterspec={}, filter=[], columns=[], sort=[], group=[],
615615
616616
617617 def filter_section (self , template , filter , columns , group , all_filters ,
618- all_columns , show_display_form , show_customization ):
618+ all_columns , show_customization ):
619619
620620 w = self .client .write
621621
@@ -639,7 +639,6 @@ def filter_section(self, template, filter, columns, group, all_filters,
639639 for name in self .properties .keys ():
640640 if name in all_filters or name in all_columns :
641641 names .append (name )
642- w ('<tr class="location-bar">' )
643642 if show_customization :
644643 action = '-'
645644 else :
@@ -654,69 +653,71 @@ def filter_section(self, template, filter, columns, group, all_filters,
654653 if all_columns and name in group :
655654 w ('<input type="hidden" name=":group" value="%s">' % name )
656655
657- if show_display_form :
658- # TODO: The widget style can go into the stylesheet
659- w ('<th align="left" colspan=%s>'
660- '<input style="height : 1em; width : 1em; font-size: 12pt" type="submit" name="action" value="%s"> View '
661- 'customisation...</th></tr>\n ' % (len (names )+ 1 , action ))
662- if show_customization :
663- w ('<tr class="location-bar"><th> </th>' )
664- for name in names :
665- w ('<th>%s</th>' % name .capitalize ())
666- w ('</tr>\n ' )
667-
668- # Filter
669- if all_filters :
670- w ('<tr><th width="1%" align=right class="location-bar">'
671- 'Filters</th>\n ' )
672- for name in names :
673- if name not in all_filters :
674- w ('<td> </td>' )
675- continue
676- if name in filter : checked = ' checked'
677- else : checked = ''
678- w ('<td align=middle>\n ' )
679- w (' <input type="checkbox" name=":filter" value="%s" '
680- '%s></td>\n ' % (name , checked ))
681- w ('</tr>\n ' )
682-
683- # Columns
684- if all_columns :
685- w ('<tr><th width="1%" align=right class="location-bar">'
686- 'Columns</th>\n ' )
687- for name in names :
688- if name not in all_columns :
689- w ('<td> </td>' )
690- continue
691- if name in columns : checked = ' checked'
692- else : checked = ''
693- w ('<td align=middle>\n ' )
694- w (' <input type="checkbox" name=":columns" value="%s"'
695- '%s></td>\n ' % (name , checked ))
696- w ('</tr>\n ' )
697-
698- # Grouping
699- w ('<tr><th width="1%" align=right class="location-bar">'
700- 'Grouping</th>\n ' )
701- for name in names :
702- prop = self .properties [name ]
703- if name not in all_columns :
704- w ('<td> </td>' )
705- continue
706- if name in group : checked = ' checked'
707- else : checked = ''
708- w ('<td align=middle>\n ' )
709- w (' <input type="checkbox" name=":group" value="%s"'
710- '%s></td>\n ' % (name , checked ))
711- w ('</tr>\n ' )
712-
713- w ('<tr class="location-bar"><td width="1%"> </td>' )
714- w ('<td colspan="%s">' % len (names ))
715- w ('<input type="submit" name="action" value="Redisplay"></td>' )
716- w ('</tr>\n ' )
656+ # TODO: The widget style can go into the stylesheet
657+ w ('<th align="left" colspan=%s>'
658+ '<input style="height : 1em; width : 1em; font-size: 12pt" type="submit" name="action" value="%s"> View '
659+ 'customisation...</th></tr>\n ' % (len (names )+ 1 , action ))
717660
661+ if not show_customization :
718662 w ('</table>\n ' )
719663
664+ w ('<tr class="location-bar"><th> </th>' )
665+ for name in names :
666+ w ('<th>%s</th>' % name .capitalize ())
667+ w ('</tr>\n ' )
668+
669+ # Filter
670+ if all_filters :
671+ w ('<tr><th width="1%" align=right class="location-bar">'
672+ 'Filters</th>\n ' )
673+ for name in names :
674+ if name not in all_filters :
675+ w ('<td> </td>' )
676+ continue
677+ if name in filter : checked = ' checked'
678+ else : checked = ''
679+ w ('<td align=middle>\n ' )
680+ w (' <input type="checkbox" name=":filter" value="%s" '
681+ '%s></td>\n ' % (name , checked ))
682+ w ('</tr>\n ' )
683+
684+ # Columns
685+ if all_columns :
686+ w ('<tr><th width="1%" align=right class="location-bar">'
687+ 'Columns</th>\n ' )
688+ for name in names :
689+ if name not in all_columns :
690+ w ('<td> </td>' )
691+ continue
692+ if name in columns : checked = ' checked'
693+ else : checked = ''
694+ w ('<td align=middle>\n ' )
695+ w (' <input type="checkbox" name=":columns" value="%s"'
696+ '%s></td>\n ' % (name , checked ))
697+ w ('</tr>\n ' )
698+
699+ # Grouping
700+ w ('<tr><th width="1%" align=right class="location-bar">'
701+ 'Grouping</th>\n ' )
702+ for name in names :
703+ prop = self .properties [name ]
704+ if name not in all_columns :
705+ w ('<td> </td>' )
706+ continue
707+ if name in group : checked = ' checked'
708+ else : checked = ''
709+ w ('<td align=middle>\n ' )
710+ w (' <input type="checkbox" name=":group" value="%s"'
711+ '%s></td>\n ' % (name , checked ))
712+ w ('</tr>\n ' )
713+
714+ w ('<tr class="location-bar"><td width="1%"> </td>' )
715+ w ('<td colspan="%s">' % len (names ))
716+ w ('<input type="submit" name="action" value="Redisplay"></td>' )
717+ w ('</tr>\n ' )
718+ w ('</table>\n ' )
719+
720+
720721 def sortby (self , sort_name , filterspec , columns , filter , group , sort ):
721722 l = []
722723 w = l .append
@@ -848,6 +849,9 @@ def render(self, form):
848849
849850#
850851# $Log: not supported by cvs2svn $
852+ # Revision 1.39 2001/11/03 01:43:47 richard
853+ # Ahah! Fixed the lynx problem - there was a hidden input field misplaced.
854+ #
851855# Revision 1.38 2001/10/31 06:58:51 richard
852856# Added the wrap="hard" attribute to the textarea of the note field so the
853857# messages wrap sanely.
0 commit comments