diff options
| -rwxr-xr-x | archives/bin/generate-list-descriptions | 37 | ||||
| -rwxr-xr-x | archives/bin/list_dates.pl | 31 | ||||
| -rwxr-xr-x | archives/bin/mk-mhonarc | 16 | ||||
| -rw-r--r-- | archives/templates/bottom | 3 | ||||
| -rw-r--r-- | archives/templates/html/list_index.html | 43 | ||||
| -rw-r--r-- | archives/templates/html/top_config.html | 16 | ||||
| -rw-r--r-- | archives/templates/top | 26 |
7 files changed, 89 insertions, 83 deletions
diff --git a/archives/bin/generate-list-descriptions b/archives/bin/generate-list-descriptions index 28f78bb4..d9423d15 100755 --- a/archives/bin/generate-list-descriptions +++ b/archives/bin/generate-list-descriptions @@ -3,6 +3,23 @@ # $Id$ # # Script to generate text files with descriptions of each list and group. +# +# We generate five families of files: +# <list>.descr -- contains the description of each list +# <list>.group -- contains the group "id" that each list belongs to +# (note: not the group ID on database; it's generated here) +# group.<id> -- contains the name of each group, and the name of each list +# on the group +# groups -- contains the list of all groups, with its "id", the +# name of the "first" list on the group, and the group name +# groups.complete +# a listing of all groups, with its name and the names +# and descriptions of lists on it +# +# The various files are used in several places, both in the PHP templates and +# in the Perl program that calls Mhonarc. Probably it'd be possible to get rid +# of most of the files and keep just "groups.complete", but I'm feeling lazy +# today. . $HOME/etc/archives.conf @@ -10,18 +27,9 @@ psql_exec() { $PSQL -tA -U $DBUSER -h $DBHOST $DBNAME -c "$1" } -psql_exec "select name, description from lists" | -while read line; do - # strip backslashes from description. Note: quoting below ensure - # that " and ' do not need escaping. - line=${line//\\/} - description=${line##[a-zA-Z-]*\|} - list=${line%%\|$description} - echo "$description" > $ARCHIVES_TEMPLATES/$list.descr -done - prevgrp= curr=0 +printedfirst= > $ARCHIVES_TEMPLATES/groups.new > $ARCHIVES_TEMPLATES/groups.complete.new psql_exec "select lg.id, lg.name, l.name, l.description from listgroups lg join lists l on (lg.id = l.grp) order by sortkey, l.name" | @@ -37,13 +45,20 @@ while read line; do if [ "$grp" != "$prevgrp" ]; then curr=$(($curr+1)) filename=$ARCHIVES_TEMPLATES/group.$curr - echo "group.$curr" >> $ARCHIVES_TEMPLATES/groups.new + echo -n "group.$curr " >> $ARCHIVES_TEMPLATES/groups.new + printedfirst= echo "groupname: $grp" > $filename echo "groupname: $grp" >> $ARCHIVES_TEMPLATES/groups.complete.new prevgrp=$grp fi echo "list: $list" >> $filename echo "list: $list $descr" >> $ARCHIVES_TEMPLATES/groups.complete.new + if [ -z $printedfirst ]; then + echo "$list $grp" >> $ARCHIVES_TEMPLATES/groups.new + printedfirst=42 + fi + echo "$curr" > $ARCHIVES_TEMPLATES/$list.group + echo "$descr" > $ARCHIVES_TEMPLATES/$list.descr done mv $ARCHIVES_TEMPLATES/groups.new $ARCHIVES_TEMPLATES/groups mv $ARCHIVES_TEMPLATES/groups.complete.new $ARCHIVES_TEMPLATES/groups.complete diff --git a/archives/bin/list_dates.pl b/archives/bin/list_dates.pl index 9b138214..dc93cbee 100755 --- a/archives/bin/list_dates.pl +++ b/archives/bin/list_dates.pl @@ -2,24 +2,11 @@ use File::Find; -@months = qw( Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec ); - $listdir = shift; $list = shift; -$year_holder = 0; - -print <<EOT; -<center> -<table border="0"> -EOT find({ wanted => \&wanted, preprocess => \&sortfiles }, $listdir); -print <<EOT; -</table> -</center> -EOT - exit; sub sortfiles { @@ -30,19 +17,7 @@ sub sortfiles { sub wanted { return unless /^$list/; /$list.(\d{4})(\d{2})/; - $year = $1; $month = $2; - $date = "$year-$month"; - if ($year ne $year_holder) { - print " <tr><td height=\"10\"></td></tr>\n"; - $year_holder = $year; - } else { - $year = ""; - } - print <<EOT; - <tr> - <td>$year</td> - <td>$months[$month - 1]</td> - <td>[<a href="$date/index.php">by date</a>][<a href="$date/threads.php">by thread</a>][<a href="mbox/$list.$date.gz">mbox</a>]</td> - </tr> -EOT + $year = $1; + $month = $2; + print "$year $month\n"; } diff --git a/archives/bin/mk-mhonarc b/archives/bin/mk-mhonarc index 3cc73968..05cf9090 100755 --- a/archives/bin/mk-mhonarc +++ b/archives/bin/mk-mhonarc @@ -135,14 +135,14 @@ for list in `ls $MAJORDOMO_FILES`; do if [ ! -r $descrfile ]; then echo "WARNING: description not found for list $list" fi - # Warning: we trust generate-list-descriptions to strip backslashes. We only - # need to worry about forward-slashes, which would confuse sed below. - description=$(cat $descrfile | sed -e 's/\([\/]\)/\\\1/g') - (sed -e "s/LISTNAME/$list/g" \ - -e "s/DESCRIPTION/$description/" \ - $ARCHIVES_TEMPLATES/top ; \ - $ARCHIVES_BIN/list_dates.pl $listdir $list ; \ - cat $ARCHIVES_TEMPLATES/bottom) > index.php + + # XXX maybe this can be done better with mod_rewrite? + # Ensure that index.php exists and is a symlink + test -f index.php && rm index.php + test ! -e index.php && ln -s ../list_index.php index.php + + # create the list of extant months + $ARCHIVES_BIN/list_dates.pl $listdir $list > months date > last-updated done diff --git a/archives/templates/bottom b/archives/templates/bottom deleted file mode 100644 index ad21ae70..00000000 --- a/archives/templates/bottom +++ /dev/null @@ -1,3 +0,0 @@ - -<? require($_SERVER['DOCUMENT_ROOT'] . "/includes/bottom_config.php"); ?> - diff --git a/archives/templates/html/list_index.html b/archives/templates/html/list_index.html new file mode 100644 index 00000000..c5c0c681 --- /dev/null +++ b/archives/templates/html/list_index.html @@ -0,0 +1,43 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en" dir="ltr"> + +<head> + <title>PostgreSQL Mailing Lists: {list}</title> + +<!-- INCLUDE top_config.html --> + +<h1>{list}</h1> + +<ul> + <li>{description}</li> + + <li>To post, send mail to <a href="mailto:{list}@postgresql.org">{list}@postgresql.org</a>.</li> + + <li>To subscribe or unsubscribe from the list, + <a href="http://www.postgresql.org/mailpref/{list}">click here</a>.</li> + + <li>If you hate getting many mail messages per day then you should consider a + digest (where you receive multiple messages to the list as one message to + you). To subscribe or unsubscribe from the digested list, send mail to + majordomo@postgresql.org. The body of the message should + contain the single line <i>subscribe-set {list} digest</i> or + <i>unsubscribe {list}</i>.</li> +</ul> +<center> +<table border="0"> + <tr><td height="10"></td></tr> + + <!-- BEGIN month --> + <tr> + <td>{year_text}</td> + <td>{month_text}</td> + <td>[<a href="{year}-{month}/index.php">by date</a>][<a href="{year}-{month}/threads.php">by thread</a>][<a href="mbox/{list}.{year}-{month}.gz">mbox</a>]</td> + </tr> + <!-- END month --> + +</table> +</center> + +<!-- INCLUDE bottom_config.html --> + diff --git a/archives/templates/html/top_config.html b/archives/templates/html/top_config.html index eaa75935..36157195 100644 --- a/archives/templates/html/top_config.html +++ b/archives/templates/html/top_config.html @@ -92,13 +92,15 @@ <ul> <li><a href="http://www.postgresql.org/community/lists/subscribe">Subscribe</a></li> - <!-- BEGIN top_listgroup --> <li><a href="/{top_group_firstlist}/">{top_groupname}</a></li> - <ul> - <!-- BEGIN top_list --> - <li><a href="/{top_name}/">{top_name}</a> - <!-- END top_list --> - </ul> - <!-- END top_listgroup --> + <!-- BEGIN top_listgroup --> + <li><a href="/{top_group_firstlist}/">{top_groupname}</a> + <ul> + <!-- BEGIN top_list --> + <li><a href="/{top_name}/">{top_name}</a></li> + <!-- END top_list --> + </ul> + </li> + <!-- END top_listgroup --> </ul> </li> diff --git a/archives/templates/top b/archives/templates/top deleted file mode 100644 index 320a9175..00000000 --- a/archives/templates/top +++ /dev/null @@ -1,26 +0,0 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" - "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en" dir="ltr"> - -<head> - <title>PostgreSQL Mailing Lists: LISTNAME</title> - -<? require($_SERVER['DOCUMENT_ROOT']. "/includes/top_config.php"); ?> - -<h1>LISTNAME</h1> - -<ul> - <li>DESCRIPTION</li> - - <li>To post, send mail to <a href="mailto:LISTNAME@postgresql.org">LISTNAME@postgresql.org</a>.</li> - - <li>To subscribe or unsubscribe from the list, - <a href="http://www.postgresql.org/mailpref/LISTNAME">click here</a>.</li> - - <li>If you hate getting many mail messages per day then you should consider a - digest (where you receive multiple messages to the list as one message to - you). To subscribe or unsubscribe from the digested list, send mail to - majordomo@postgresql.org. The body of the message should - contain the single line <i>subscribe-set LISTNAME digest</i> or - <i>unsubscribe LISTNAME</i>.</li> -</ul> |
