From xanni@kira.glasswings.com.au Tue May 20 16:09:12 2003 Return-Path: Delivered-To: guy-ezmlm@rucus.ru.ac.za Received: (qmail 98840 invoked from network); 20 May 2003 14:09:12 -0000 Received: from mail011.syd.optusnet.com.au (210.49.20.139) by server.rucus.ru.ac.za with SMTP; 20 May 2003 14:09:12 -0000 Received: from kira.glasswings.com.au (c16443.eburwd3.vic.optusnet.com.au [210.49.192.62]) by mail011.syd.optusnet.com.au (8.11.6p2/8.11.6) with ESMTP id h4KE93X08963 for ; Wed, 21 May 2003 00:09:03 +1000 Received: (from xanni@localhost) by kira.glasswings.com.au (8.9.3/8.9.3) id AAA18521 for guy-ezmlm@rucus.ru.ac.za; Wed, 21 May 2003 00:18:02 +1000 Date: Wed, 21 May 2003 00:18:01 +1000 From: Andrew Pam To: guy-ezmlm@rucus.ru.ac.za Subject: Bug fixes for ezmlm-web Message-ID: <20030520141801.GM599@kira.glasswings.com.au> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4i Status: RO Content-Length: 24092 I found the following problems when installing ezmlm-web v2.1: * Many browsers do not provide any visible display of alt tags, so the help icons are not usable without some JavaScript * There were several HTML errors in the output of the script, such as mismatched tags, misspelled attributes and missing quotes around attributes * The CGI module now outputs XHTML, which requires that all tags be lowercase Here is a patch which addresses all these issues: --- ezmlm-web.cgi Tue Sep 26 06:58:08 2000 +++ /usr/local/bin/ezmlm-web.cgi Wed May 21 00:07:32 2003 @@ -1,6 +1,9 @@ -#!/usr/bin/perl -T +#!/usr/bin/perl -Tw #=========================================================================== # ezmlm-web.cgi - version 2.1 - 25/09/2000 +# 20/05/2003 Andrew Pam +# Fixed HTML errors, changed all HTML to lowercase for XHTML +# Added sub help_icon and sub help_option for non-tooltip browsers # $Id: ezmlm-web.cgi,v 1.3 2000/09/25 19:58:07 guy Exp $ # # Copyright (C) 1999/2000, Guy Antony Halse, All Rights Reserved. @@ -239,7 +242,7 @@ &list_text; } else { - print "

$Q::action

$LANGUAGE{'nop'}


"; + print "

$Q::action

$LANGUAGE{'nop'}


"; } # Print HTML footer and exit :) ... @@ -280,15 +283,15 @@ $q->delete_all; print $q->startform; print $q->hidden(-name=>'state', -default=>'select'); - print '
'; + print '
'; print $q->scrolling_list(-name=>'list', -size=>$scrollsize, -values=>\@lists) if defined(@lists); - print '', $LANGUAGE{'chooselistinfo'}; + print '', $LANGUAGE{'chooselistinfo'}; print $q->submit(-name=>'action', -value=>"[$BUTTON{'create'}]"), ' ' if (!defined($opt_c)); print $q->submit(-name=>'action', -value=>"[$BUTTON{'edit'}]"), ' ' if(defined(@lists)); print $q->submit(-name=>'action', -value=>"[$BUTTON{'delete'}]") if(defined(@lists)); - print '
'; + print '
'; print $q->endform; } @@ -302,9 +305,9 @@ print $q->startform; print $q->hidden(-name=>'state', -default=>'confirm_delete'); print $q->hidden(-name=>'list', -default=>$q->param('list')); - print '

', $LANGUAGE{'confirmdelete'}, ' ', $q->param('list'), '


'; + print '

', $LANGUAGE{'confirmdelete'}, ' ', $q->param('list'), '


'; print $q->submit(-name=>'confirm', -value=>"[$BUTTON{'no'}]"), ' '; - print $q->submit(-name=>'confirm', -value=>"[$BUTTON{'yes'}]"), '
'; + print $q->submit(-name=>'confirm', -value=>"[$BUTTON{'yes'}]"), '
'; } # ------------------------------------------------------------------------ @@ -327,28 +330,28 @@ # Print out a form of options ... $q->delete('state'); - print "

$LANGUAGE{'subscribersto'} $Q::list ($listaddress)


"; + print "

$LANGUAGE{'subscribersto'} $Q::list ($listaddress)


"; print $q->start_multipart_form; - print '
'; + print '
'; print $q->hidden(-name=>'state', -default=>'edit'); print $q->hidden(-name=>'list', -default=>$Q::list); print $q->scrolling_list(-name=>'delsubscriber', -size=>$scrollsize, -values=>\@subscribers, -labels=>&pretty_names, -multiple=>'true') if defined(@subscribers); - print ''; - print ' ', ($#subscribers + 1), ' ', $LANGUAGE{'subscribers'}, '
' if defined(@subscribers); - print $q->submit(-name=>'action', -value=>"[$BUTTON{'deleteaddress'}]"), '

' if defined(@subscribers); - print $q->textfield(-name=>'addsubscriber', -size=>'40'), ' ', $HELPER{'addaddress'}, '
'; - print $q->filefield(-name=>'addfile', -size=>20, -maxlength=>100), ' ', $HELPER{'addaddressfile'}, '
' if ($FILE_UPLOAD); - print $q->submit(-name=>'action', -value=>"[$BUTTON{'addaddress'}]"), '

'; - print '', $LANGUAGE{'additionalparts'}, ':
' if($list->ismodpost || $list->ismodsub || $list->isremote || $list->isdeny || $list->isallow || $list->isdigest); - print $q->submit(-name=>'action', -value=>"[$BUTTON{'moderators'}]"), '', $HELPER{'moderator'}, ' ' if ($list->ismodpost || $list->ismodsub || $list->isremote); - print $q->submit(-name=>'action', -value=>"[$BUTTON{'denylist'}]"), '', $HELPER{'deny'}, ' ' if ($list->isdeny); - print $q->submit(-name=>'action', -value=>"[$BUTTON{'allowlist'}]"), '', $HELPER{'allow'}, ' ' if ($list->isallow); - print $q->submit(-name=>'action', -value=>"[$BUTTON{'digestsubscribers'}]"), '', $HELPER{'digest'}, ' ' if ($list->isdigest); - print '

'; - print $q->submit(-name=>'action', -value=>"[$BUTTON{'webarchive'}]"), '', $HELPER{'webarch'}, ' ' if(&ezmlmcgirc); - print $q->submit(-name=>'action', -value=>"[$BUTTON{'configuration'}]"), '', $HELPER{'config'}, '   '; + print '

'; + print ' ', ($#subscribers + 1), ' ', $LANGUAGE{'subscribers'}, '
' if defined(@subscribers); + print $q->submit(-name=>'action', -value=>"[$BUTTON{'deleteaddress'}]"), '

' if defined(@subscribers); + print $q->textfield(-name=>'addsubscriber', -size=>'40'), help_icon('addaddress'), '
'; + print $q->filefield(-name=>'addfile', -size=>20, -maxlength=>100), help_icon('addaddressfile'), '
' if ($FILE_UPLOAD); + print $q->submit(-name=>'action', -value=>"[$BUTTON{'addaddress'}]"), '

'; + print '', $LANGUAGE{'additionalparts'}, ':
' if($list->ismodpost || $list->ismodsub || $list->isremote || $list->isdeny || $list->isallow || $list->isdigest); + print $q->submit(-name=>'action', -value=>"[$BUTTON{'moderators'}]"), help_icon('moderator'), ' ' if ($list->ismodpost || $list->ismodsub || $list->isremote); + print $q->submit(-name=>'action', -value=>"[$BUTTON{'denylist'}]"), help_icon('deny'), ' ' if ($list->isdeny); + print $q->submit(-name=>'action', -value=>"[$BUTTON{'allowlist'}]"), help_icon('allow'), ' ' if ($list->isallow); + print $q->submit(-name=>'action', -value=>"[$BUTTON{'digestsubscribers'}]"), help_icon('digest'), ' ' if ($list->isdigest); + print '

'; + print $q->submit(-name=>'action', -value=>"[$BUTTON{'webarchive'}]"), help_icon('webarch'), ' ' if(&ezmlmcgirc); + print $q->submit(-name=>'action', -value=>"[$BUTTON{'configuration'}]"), help_icon('config'), '   '; print $q->submit(-name=>'action', -value=>"[$BUTTON{'selectlist'}]"); - print '

'; + print '
'; print $q->endform; } @@ -534,15 +537,15 @@ my($subpath) = $config =~ m{8\s*'([^']+)'}; my($remotepath) = $config =~ m{9\s*'([^']+)'}; - $moderated = '' if ($postpath); + $moderated = '' if ($postpath); $moderated .= "[$LANGUAGE{'posting'}]" if ($list->ismodpost); - $moderated .= 'Posting Moderators are stored in a non-standard location (' . $postpath . '). You will have to edit them manually.' if ($postpath); - $moderated .= '' if ($subpath); + $moderated .= 'Posting Moderators are stored in a non-standard location (' . $postpath . '). You will have to edit them manually.' if ($postpath); + $moderated .= '' if ($subpath); $moderated .= " [$LANGUAGE{'subscription'}]" if($list->ismodsub); - $moderated .= 'Subscriber Moderators are stored in a non-standard location (' . $subpath . '). You will have to edit them manually' if ($subpath); - $moderated .= '' if ($remotepath); + $moderated .= 'Subscriber Moderators are stored in a non-standard location (' . $subpath . '). You will have to edit them manually' if ($subpath); + $moderated .= '' if ($remotepath); $moderated .= " [$LANGUAGE{'remoteadmin'}]" if($list->isremote); - $moderated .= 'Remote Administrators are stored in a non-standard location (' . $remotepath . '). You will have to edit them manually' if ($remotepath); + $moderated .= 'Remote Administrators are stored in a non-standard location (' . $remotepath . '). You will have to edit them manually' if ($remotepath); } @@ -557,20 +560,20 @@ # Print out a form of options ... $q->delete('state'); - print "

$type $LANGUAGE{'for'} $listaddress


"; - print "
$moderated

" if(defined($moderated)); + print "

$type $LANGUAGE{'for'} $listaddress


"; + print "
$moderated

" if(defined($moderated)); print $q->start_multipart_form; - print '

'; + print '
'; print $q->hidden(-name=>'state', -default=>$part); print $q->hidden(-name=>'list', -default=>$Q::list), "\n"; print $q->scrolling_list(-name=>'delsubscriber', -size=>$scrollsize, -values=>\@subscribers, -multiple=>'true', -labels=>&pretty_names) if defined(@subscribers); - print '
'; - print $q->submit(-name=>'action', -value=>"[$BUTTON{'deleteaddress'}]"), '

' if defined(@subscribers); - print $q->textfield(-name=>'addsubscriber', -size=>'40'), ' ', $HELPER{'addaddress'}, '
'; - print $q->filefield(-name=>'addfile', -size=>20, -maxlength=>100), ' ', $HELPER{'addaddressfile'}, '
' if ($FILE_UPLOAD); - print $q->submit(-name=>'action', -value=>"[$BUTTON{'addaddress'}]"), '

'; + print '

'; + print $q->submit(-name=>'action', -value=>"[$BUTTON{'deleteaddress'}]"), '

' if defined(@subscribers); + print $q->textfield(-name=>'addsubscriber', -size=>'40'), help_icon('addaddreess'), '
'; + print $q->filefield(-name=>'addfile', -size=>20, -maxlength=>100), help_icon('addaddressfile'), '
' if ($FILE_UPLOAD); + print $q->submit(-name=>'action', -value=>"[$BUTTON{'addaddress'}]"), '

'; print $q->submit(-name=>'action', -value=>"[$BUTTON{'subscribers'}]"); - print '

'; + print '
'; print $q->endform; } @@ -598,27 +601,26 @@ # Print a form of options ... $q->delete_all; - print '

', $LANGUAGE{'createnew'}, '


'; + print '

', $LANGUAGE{'createnew'}, '


'; print $q->startform; print $q->hidden(-name=>'state', -value=>'create'); - print '', $LANGUAGE{'listname'}, ': ', $q->textfield(-name=>'list', -size=>'20'), ' ', $HELPER{'listname'}, '

'; - print '', $LANGUAGE{'listaddress'}, ': '; + print '', $LANGUAGE{'listname'}, ': ', $q->textfield(-name=>'list', -size=>'20'), help_icon('listname'), '

'; + print '', $LANGUAGE{'listaddress'}, ': '; print $q->textfield(-name=>'inlocal', -default=>$username, -size=>'10'); - print ' @ ', $q->textfield(-name=>'inhost', -default=>$hostname, -size=>'30'), ' ', $HELPER{'listadd'}, '

'; + print ' @ ', $q->textfield(-name=>'inhost', -default=>$hostname, -size=>'30'), help_icon('listadd'), '

'; - print '

', $LANGUAGE{'listoptions'}, ':'; + print '

', $LANGUAGE{'listoptions'}, ':'; &display_options($DEFAULT_OPTIONS); # Allow creation of mysql table if the module allows it if($Mail::Ezmlm::MYSQL_BASE) { - print '

', $q->checkbox(-name=>'sql', -label=>$LANGUAGE{'mysqlcreate'}, -on=>1); - print ' ', $HELPER{'mysqlcreate'}, ''; + print '

', $q->checkbox(-name=>'sql', -label=>$LANGUAGE{'mysqlcreate'}, -on=>1), help_icon('mysqlcreate'); } - print '

', $LANGUAGE{'allowedtoedit'}, ': ', - $q->textfield(-name=>'webusers', -value=>$ENV{'REMOTE_USER'}||'ALL', -size=>'30'), ' ', $HELPER{'webusers'}, '', - '
', $HELPER{'allowedit'}, '' + print '

', $LANGUAGE{'allowedtoedit'}, ': ', + $q->textfield(-name=>'webusers', -value=>$ENV{'REMOTE_USER'}||'ALL', -size=>'30'), help_icon('webusers'), + '
', $HELPER{'allowedit'}, '' if(-e "$LIST_DIR/webusers"); print '

', $q->submit(-name=>'action', -value=>"[$BUTTON{'createlist'}]"), ' '; @@ -647,7 +649,7 @@ # Sanity Checks ... return 1 if ($listname eq '' || $qmail eq ''); if(-e ("$LIST_DIR/$listname/lock") || -e ("$HOME_DIR/.qmail-$qmail")) { - print "

List '$listname' already exists :(

"; + print "

List '$listname' already exists :(

"; return 1; } @@ -710,13 +712,13 @@ # Print a form of options ... $q->delete_all; - print '

', $LANGUAGE{'editconfiguration'}, '


'; + print '

', $LANGUAGE{'editconfiguration'}, '


'; print $q->startform; print $q->hidden(-name=>'state', -value=>'configuration'); print $q->hidden(-name=>'list', -value=>$listname); - print '', $LANGUAGE{'listname'}, ": $listname
"; - print "$LANGUAGE{'listaddress'}: $listaddress

"; - print '', $LANGUAGE{'listoptions'}, ':
'; + print '', $LANGUAGE{'listname'}, ": $listname
"; + print "$LANGUAGE{'listaddress'}: $listaddress

"; + print '', $LANGUAGE{'listoptions'}, ':
'; # Print a list of options, selecting the ones that apply to this list ... &display_options($list->getconfig); @@ -727,10 +729,10 @@ $mimeremove = $list->getpart('mimeremove'); $prefix = $list->getpart('prefix'); - print '

', $LANGUAGE{'prefix'}, ': ', $q->textfield(-name=>'prefix', -default=>$prefix, -size=>12), ' ', $HELPER{'prefix'}, '' if defined($prefix); - print '

', $LANGUAGE{'headerremove'}, ': ', $HELPER{'headerremove'}, '
', $q->textarea(-name=>'headerremove', -default=>$headerremove, -rows=>5, -columns=>70); - print '

', $LANGUAGE{'headeradd'}, ': ', $HELPER{'headeradd'}, '
', $q->textarea(-name=>'headeradd', -default=>$headeradd, -rows=>5, -columns=>70); - print '

', $LANGUAGE{'mimeremove'}, ': ', $HELPER{'mimeremove'}, '
', $q->textarea(-name=>'mimeremove', -default=>$mimeremove, -rows=>5, -columns=>70) if defined($mimeremove); + print '

', $LANGUAGE{'prefix'}, ': ', $q->textfield(-name=>'prefix', -default=>$prefix, -size=>12), help_icon('prefix') if defined($prefix); + print '

', $LANGUAGE{'headerremove'}, ': ', help_icon('headerremove'), '
', $q->textarea(-name=>'headerremove', -default=>$headerremove, -rows=>5, -columns=>70); + print '

', $LANGUAGE{'headeradd'}, ': ', help_icon('headeradd'), '
', $q->textarea(-name=>'headeradd', -default=>$headeradd, -rows=>5, -columns=>70); + print '

', $LANGUAGE{'mimeremove'}, ': ', help_icon('mimeremove'), '
', $q->textarea(-name=>'mimeremove', -default=>$mimeremove, -rows=>5, -columns=>70) if defined($mimeremove); if(open(WEBUSER, "<$LIST_DIR/webusers")) { my($webusers); @@ -740,13 +742,13 @@ close WEBUSER; $webusers ||= $ENV{'REMOTE_USER'} || 'ALL'; - print '

', $LANGUAGE{'allowedtoedit'}, ': ', - $q->textfield(-name=>'webusers', -value=>$webusers, -size=>'30'), ' ', $HELPER{'webusers'}, '', - '
', $HELPER{'allowedit'}, ''; + print '

', $LANGUAGE{'allowedtoedit'}, ': ', + $q->textfield(-name=>'webusers', -value=>$webusers, -size=>'30'), help_icon('webusers'), + '
', $HELPER{'allowedit'}, ''; } - print '

', $q->submit(-name=>'action', -value=>"[$BUTTON{'updateconfiguration'}]"), ' '; + print '

', $q->submit(-name=>'action', -value=>"[$BUTTON{'updateconfiguration'}]"), ' '; print $q->reset(-value=>"[$BUTTON{'resetform'}]"), ' '; print $q->submit(-name=>'action', -value=>"[$BUTTON{'cancel'}]"), ' '; print $q->submit(-name=>'action', -value=>"[$BUTTON{'edittexts'}]"); @@ -841,12 +843,12 @@ print $q->startform; print $q->hidden(-name=>'state', -default=>'list_text'); print $q->hidden(-name=>'list', -default=>$q->param('list')); - print '

'; + print '
'; print $q->scrolling_list(-name=>'file', -values=>\@files); - print ''; + print ''; print $q->submit(-name=>'action', -value=>"[$BUTTON{'editfile'}]"), ' '; print $q->submit(-name=>'action', -value=>"[$BUTTON{'cancel'}]"); - print '

', $LANGUAGE{'edittextinfo'}, '

'; + print '

', $LANGUAGE{'edittextinfo'}, '

'; print $q->endform; } @@ -862,20 +864,20 @@ # Print a form ... $q->delete('state'); - print '

', $LANGUAGE{'editingfile'}, ': ', $Q::file, '

'; - print '
'; + print '

', $LANGUAGE{'editingfile'}, ': ', $Q::file, '

'; + print '
'; print $q->startform; print $q->hidden(-name=>'state', -default=>'edit_text'); print $q->hidden(-name=>'list', -default=>$q->param('list')); print $q->hidden(-name=>'file', -default=>$q->param('file')); print $q->textarea(-name=>'content', -default=>$content, -rows=>'25', -columns=>'72'); - print ''; + print ''; print $q->submit(-name=>'action', -value=>"[$BUTTON{'savefile'}]"), ' '; print $q->reset(-value=>"[$BUTTON{'resetform'}]"), ' '; print $q->submit(-name=>'action', -value=>"[$BUTTON{'cancel'}]"); - print '

', $LANGUAGE{'editfileinfo'}; + print '

', $LANGUAGE{'editfileinfo'}; print $q->endform; - print '

' + print '
' } @@ -915,37 +917,35 @@ my($i, $j); print ""; - print '
'; + print ''; $j++; + print help_option($i), ''; $j++; if ($j >= 3) { - $j = 0; print ''; + $j = 0; print ''; } - print '
'; foreach $i (grep {/\D/} keys %EZMLM_LABELS) { if ($opts =~ /^\w*$i\w*\s*/) { print $q->checkbox(-name=>$i, -value=>$i, -label=>$EZMLM_LABELS{$i}[0], -on=>'1'); } else { print $q->checkbox(-name=>$i, -value=>$i, -label=>$EZMLM_LABELS{$i}[0]); } - print '', $EZMLM_LABELS{$i}[1] , ''; - print '
'; + print ''; } - print '
'; + print '
'; - print ''; + print '
'; foreach $i (grep {/\d/} keys %EZMLM_LABELS) { - print ''; + print ''; } - print '
'; + print '
'; if ($opts =~ /$i (?:'(.+?)')/) { print $q->checkbox(-name=>$i, -value=>$i, -label=>$EZMLM_LABELS{$i}[0], -on=>'1'); } else { print $q->checkbox(-name=>$i, -value=>$i, -label=>$EZMLM_LABELS{$i}[0]); } - print '', $EZMLM_LABELS{$i}[1] , ''; - print ''; + print help_option($i), ''; print $q->textfield(-name=>"$i-value", -value=>$1||$EZMLM_LABELS{$i}[2], -size=>30); - print '
'; + print ''; } @@ -976,6 +976,7 @@ } # ------------------------------------------------------------------------- + sub rmtree { # A subroutine to recursively delete a directory (like rm -f). # Based on the one in the perl cookbook :) @@ -995,6 +996,28 @@ } # ------------------------------------------------------------------------ + +sub help_icon($) { + # Generate HTML for help icons + # Written 20 May 2003 by Andrew Pam + + my $msg = $HELPER{$_[0]}; + return '' . $msg . 
+          ''; +} + +# ------------------------------------------------------------------------ + +sub help_option($) { + # Generate HTML for option help icons + # Written 20 May 2003 by Andrew Pam + + my $msg = $EZMLM_LABELS{$_[0]}[1]; + return '' . $msg .
+          ''; +} + +# ------------------------------------------------------------------------ BEGIN { sub handle_errors { Hope that helps, Andrew Pam -- mailto:xanni@xanadu.net Andrew Pam http://www.xanadu.com.au/ Chief Scientist, Xanadu http://www.glasswings.com.au/ Technology Manager, Glass Wings http://www.sericyb.com.au/ Manager, Serious Cybernetics