|
From: <ssc...@us...> - 2003-04-15 05:30:23
|
Update of /cvsroot/popfile/engine/UI
In directory sc8-pr-cvs1:/tmp/cvs-serv12825
Modified Files:
HTML.pm
Log Message:
add ascending and descending sort to columns, compact column header code some
Index: HTML.pm
===================================================================
RCS file: /cvsroot/popfile/engine/UI/HTML.pm,v
retrieving revision 1.126
retrieving revision 1.127
diff -C2 -d -r1.126 -r1.127
*** HTML.pm 12 Apr 2003 21:16:53 -0000 1.126
--- HTML.pm 15 Apr 2003 05:30:19 -0000 1.127
***************
*** 2010,2013 ****
--- 2010,2020 ----
# field we ignore all punctuation characters so that "John and 'John and John
# all sort next to each other
+
+ # Ascending or Descending? Ascending is noted by /-field/
+
+ my $descending = 0;
+ if ($sort =~ s/^\-//) {
+ $descending = 1;
+ }
if ( $sort ne ''
***************
*** 2015,2025 ****
# and there are no ways to sort nothing
&& defined @{$self->{history_keys__}}) {
! @{$self->{history_keys__}} = sort {
! my ($a1,$b1) = ($self->{history__}{$a}{$sort},
! $self->{history__}{$b}{$sort});
! $a1 =~ s/[^A-Z0-9]//ig;
! $b1 =~ s/[^A-Z0-9]//ig;
! return ( $a1 cmp $b1 );
! } @{$self->{history_keys__}};
} else {
# Here's a quick shortcut so that we don't have to iterate
--- 2022,2038 ----
# and there are no ways to sort nothing
&& defined @{$self->{history_keys__}}) {
!
!
!
! if ($sort ne '') {
! @{$self->{history_keys__}} = sort {
! my ($a1,$b1) = ($self->{history__}{$a}{$sort},
! $self->{history__}{$b}{$sort});
! $a1 =~ s/[^A-Z0-9]//ig;
! $b1 =~ s/[^A-Z0-9]//ig;
! return ( $a1 cmp $b1 );
! } @{$self->{history_keys__}};
! }
!
} else {
# Here's a quick shortcut so that we don't have to iterate
***************
*** 2030,2033 ****
--- 2043,2048 ----
}
}
+
+ @{$self->{history_keys__}} = reverse @{$self->{history_keys__}} if ($descending);
}
***************
*** 2682,2724 ****
$body .= "<table class=\"historyTable\" width=\"100%\" summary=\"$self->{language__}{History_MainTableSummary}\">\n";
# column headers
$body .= "<tr valign=\"bottom\">\n";
! $body .= "<th class=\"historyLabel\" scope=\"col\">\n";
! $body .= "<a href=\"/history?session=$self->{session_key__}&filter=$self->{form_}{filter}&setsort=\">";
! if ( $self->{form_}{sort} eq '' ) {
! $body .= "<em class=\"historyLabelSort\">ID</em>";
! } else {
! $body .= "ID";
! }
! $body .= "</a>\n</th>\n";
! $body .= "<th class=\"historyLabel\" scope=\"col\">\n";
! $body .= "<a href=\"/history?session=$self->{session_key__}&filter=$self->{form_}{filter}&setsort=from\">";
!
! if ( $self->{form_}{sort} eq 'from' ) {
! $body .= "<em class=\"historyLabelSort\">$self->{language__}{From}</em>";
! } else {
! $body .= "$self->{language__}{From}";
! }
!
! $body .= "</a>\n</th>\n";
! $body .= "<th class=\"historyLabel\" scope=\"col\">\n";
! $body .= "<a href=\"/history?session=$self->{session_key__}&filter=$self->{form_}{filter}&setsort=subject\">";
! if ( $self->{form_}{sort} eq 'subject' ) {
! $body .= "<em class=\"historyLabelSort\">$self->{language__}{Subject}</em>";
! } else {
! $body .= "$self->{language__}{Subject}";
}
- $body .= "</a>\n</th>\n";
- $body .= "<th class=\"historyLabel\" scope=\"col\">\n";
- $body .= "<a href=\"/history?session=$self->{session_key__}&filter=$self->{form_}{filter}&setsort=bucket\">";
- if ( $self->{form_}{sort} eq 'bucket' ) {
- $body .= "<em class=\"historyLabelSort\">$self->{language__}{Classification}</em>";
- } else {
- $body .= "$self->{language__}{Classification}";
- }
-
- $body .= "</a>\n</th>\n";
$body .= "<th class=\"historyLabel\" scope=\"col\">$self->{language__}{History_ShouldBe}</th>\n";
$body .= "<th class=\"historyLabel\" scope=\"col\">$self->{language__}{Remove}</th>\n</tr>\n";
--- 2697,2730 ----
$body .= "<table class=\"historyTable\" width=\"100%\" summary=\"$self->{language__}{History_MainTableSummary}\">\n";
# column headers
+
+ my %headers_table = ( '', 'ID',
+ 'from', 'From',
+ 'subject', 'Subject',
+ 'bucket', 'Classification');
+
+
$body .= "<tr valign=\"bottom\">\n";
!
! foreach my $header (keys %headers_table) {
! $body .= "<th class=\"historyLabel\" scope=\"col\">\n";
! $body .= "<a href=\"/history?session=$self->{session_key__}&filter=$self->{form_}{filter}&setsort=" . ($self->{form_}{sort} eq "$header"?"-":"");
! $body .= "$header\">";
!
! my $label = '';
! if ( defined $self->{language__}{ $headers_table{$header} }) {
! $label = $self->{language__}{ $headers_table{$header} };
! } else {
! $label = $headers_table{$header};
! }
! if ( $self->{form_}{sort} =~ /^\-?\Q$header\E$/ ) {
! $body .= "<em class=\"historyLabelSort\">$label" . ($self->{form_}{sort} =~ /^-/ ? "-" : "+") . "</em>";
! } else {
! $body .= "$label";
! }
! $body .= "</a>\n</th>\n";
}
$body .= "<th class=\"historyLabel\" scope=\"col\">$self->{language__}{History_ShouldBe}</th>\n";
$body .= "<th class=\"historyLabel\" scope=\"col\">$self->{language__}{Remove}</th>\n</tr>\n";
|