@@ -2917,7 +2917,7 @@ void write_summary_indices(int amount_new)
2917
2917
2918
2918
void write_toplevel_indices (int amountmsgs )
2919
2919
{
2920
- int i , j , newfile ;
2920
+ int i , j , newfile , offset , k ;
2921
2921
bool first = TRUE;
2922
2922
struct emailsubdir * sd ;
2923
2923
char * subject = lang [MSG_FOLDERS_INDEX ];
@@ -2930,6 +2930,8 @@ void write_toplevel_indices(int amountmsgs)
2930
2930
char * abbr_dateformat = "%e %b %Y" ;
2931
2931
char * verbose_dateformat = "%A, %e %B %Y" ;
2932
2932
2933
+ char * tmpstr ;
2934
+
2933
2935
FILE * fp ;
2934
2936
2935
2937
filename = htmlfilename (index_name [0 ][FOLDERS_INDEX ], NULL , "" );
@@ -2949,6 +2951,19 @@ void write_toplevel_indices(int amountmsgs)
2949
2951
print_index_header_links (fp , FOLDERS_INDEX , firstdatenum , lastdatenum , amountmsgs , NULL );
2950
2952
fprintf (fp , "</div>\n" );
2951
2953
fprintf (fp , "<table>\n" );
2954
+
2955
+ /* find which element of index_name is the default index */
2956
+ offset = 0 ;
2957
+ if (set_defaultindex ) {
2958
+ tmpstr = setindex (INDEXNAME , INDEXNAME , set_htmlsuffix );
2959
+ for (j = 0 ; j <= ATTACHMENT_INDEX ; ++ j ) {
2960
+ if (0 == strcmp (tmpstr , index_name [1 ][j ])) {
2961
+ offset = j ;
2962
+ break ;
2963
+ }
2964
+ }
2965
+ }
2966
+
2952
2967
for (i = 0 , j = 0 ; j <= ATTACHMENT_INDEX ; ++ j ) {
2953
2968
if (show_index [1 ][j ])
2954
2969
i ++ ;
@@ -2957,10 +2972,10 @@ void write_toplevel_indices(int amountmsgs)
2957
2972
with all configurations. */
2958
2973
if (i > 0 )
2959
2974
i -- ;
2960
- fprintf (fp , "<thead><tr>\n"
2961
- "<th>%s</th><th colspan=\"%d\">%s</th>\n"
2962
- "<th align=\"right\">%s</th>\n"
2963
- "</tr></thead>\n"
2975
+ fprintf (fp , "<thead>\n <tr>\n"
2976
+ " <th>%s</th>\n <th colspan=\"%d\">%s</th>\n"
2977
+ " <th align=\"right\" class=\"count \">%s</th>\n"
2978
+ " </tr>\n </thead>\n"
2964
2979
"<tbody>\n" , lang [MSG_PERIOD ], i , lang [MSG_RESORTED ],
2965
2980
lang [MSG_ARTICLES ]);
2966
2981
}
@@ -2974,10 +2989,12 @@ void write_toplevel_indices(int amountmsgs)
2974
2989
if (!datelist -> data )
2975
2990
continue ;
2976
2991
for (j = 0 ; j <= ATTACHMENT_INDEX ; ++ j ) {
2977
- if (!show_index [1 ][j ])
2992
+ /* apply offset so the period column's href points to index.html */
2993
+ k = (j + offset ) % (ATTACHMENT_INDEX + 1 );
2994
+ if (!show_index [1 ][k ])
2978
2995
continue ;
2979
2996
set_dateformat = saved_set_dateformat ;
2980
- switch (j ) {
2997
+ switch (k ) {
2981
2998
case DATE_INDEX :
2982
2999
writedates (sd -> count , sd -> first_email );
2983
3000
index_title = lang [MSG_LTITLE_LISTED_BY_DATE ];
@@ -3029,37 +3046,37 @@ void write_toplevel_indices(int amountmsgs)
3029
3046
strcat (verbose_period_name , lang [MSG_TO ]);
3030
3047
strcat (verbose_period_name , end_date );
3031
3048
}
3032
- fprintf (fp , "<tr%s><th scope=\"row\" align=\"left\">%s" ,
3049
+ fprintf (fp , " <tr%s>\n <td scope=\"row\" class=\"period \" align=\"left\">%s" ,
3033
3050
(first ) ? " class=\"first\"" : "" ,
3034
3051
(first ) ? "<a name=\"first\" id=\"first\"></a>" : "" );
3035
3052
/* only add a link to the index if it is not empty */
3036
3053
if (sd -> count > 0 )
3037
3054
fprintf (fp , "<a title=\"%s %s\" href=\"%s%s\">" ,
3038
3055
verbose_period_name , index_title ,
3039
- sd -> subdir , index_name [1 ][j ]);
3056
+ sd -> subdir , index_name [1 ][k ]);
3040
3057
fprintf (fp , "%s" , abbr_period_name );
3041
3058
if (sd -> count > 0 )
3042
3059
fprintf (fp , "</a>" );
3043
- fprintf (fp , "</th> " );
3060
+ fprintf (fp , "</td>\n " );
3044
3061
if (first )
3045
3062
first = FALSE;
3046
3063
started_line = 1 ;
3047
3064
}
3048
3065
else {
3049
- fprintf (fp , "<td>" );
3066
+ fprintf (fp , " <td>" );
3050
3067
/* only add a link to the index if it is not empty */
3051
3068
if (sd -> count > 0 )
3052
3069
fprintf (fp , "<a title=\"%s %s\" href=\"%s%s\">" ,
3053
3070
verbose_period_name , index_title ,
3054
- sd -> subdir , index_name [1 ][j ]);
3055
- fprintf (fp , "%s" , indextypename [j ]);
3071
+ sd -> subdir , index_name [1 ][k ]);
3072
+ fprintf (fp , "%s" , indextypename [k ]);
3056
3073
if (sd -> count > 0 )
3057
3074
fprintf (fp , "</a>" );
3058
- fprintf (fp , "</td>" );
3075
+ fprintf (fp , "</td>\n " );
3059
3076
}
3060
3077
}
3061
3078
if (started_line && fp )
3062
- fprintf (fp , "<td align=\"center\">%d</td></tr>\n" , sd -> count );
3079
+ fprintf (fp , " <td align=\"center\" class=\"count\" >%d</td>\n </tr>\n" , sd -> count );
3063
3080
}
3064
3081
set_dateformat = saved_set_dateformat ;
3065
3082
0 commit comments