Skip to content

Commit 78e97e1

Browse files
author
Peter McCluskey
committed
changes from Vincent McIntyre to date-range column of index of folders, whitespace changes
1 parent cfd2d71 commit 78e97e1

File tree

5 files changed

+45
-24
lines changed

5 files changed

+45
-24
lines changed

src/hypermail.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ static char *expand_contents(char *variable)
9898
return return_value;
9999
}
100100

101-
static char *setindex(char *dfltindex, char *indextype, char *suffix)
101+
char *setindex(char *dfltindex, char *indextype, char *suffix)
102102
{
103103
char *p, *rp;
104104

@@ -469,10 +469,10 @@ int main(int argc, char **argv)
469469
* Which index file will be called "index.html"?
470470
*/
471471

472-
index_name[1][DATE_INDEX] = setindex(set_defaultindex, "date", set_htmlsuffix);
473-
index_name[1][THREAD_INDEX] = setindex(set_defaultindex, "thread", set_htmlsuffix);
474-
index_name[1][SUBJECT_INDEX] = setindex(set_defaultindex, "subject", set_htmlsuffix);
475-
index_name[1][AUTHOR_INDEX] = setindex(set_defaultindex, "author", set_htmlsuffix);
472+
index_name[1][DATE_INDEX] = setindex(set_defaultindex, "date", set_htmlsuffix);
473+
index_name[1][THREAD_INDEX] = setindex(set_defaultindex, "thread", set_htmlsuffix);
474+
index_name[1][SUBJECT_INDEX] = setindex(set_defaultindex, "subject", set_htmlsuffix);
475+
index_name[1][AUTHOR_INDEX] = setindex(set_defaultindex, "author", set_htmlsuffix);
476476
if (set_attachmentsindex) {
477477
index_name[1][ATTACHMENT_INDEX]
478478
= setindex(set_defaultindex, "attachment", set_htmlsuffix);
@@ -494,7 +494,9 @@ int main(int argc, char **argv)
494494
index_name[0][SUBJECT_INDEX] = index_name[1][SUBJECT_INDEX];
495495
index_name[0][ATTACHMENT_INDEX] = index_name[1][ATTACHMENT_INDEX];
496496
}
497+
497498
init_index_names();
499+
498500
if (set_msgsperfolder && set_folder_by_date) {
499501
progerr("msgsperfolder and folder_by_date may not be used at the same time!");
500502
}

src/print.c

Lines changed: 32 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2917,7 +2917,7 @@ void write_summary_indices(int amount_new)
29172917

29182918
void write_toplevel_indices(int amountmsgs)
29192919
{
2920-
int i, j, newfile;
2920+
int i, j, newfile, offset, k;
29212921
bool first = TRUE;
29222922
struct emailsubdir *sd;
29232923
char *subject = lang[MSG_FOLDERS_INDEX];
@@ -2930,6 +2930,8 @@ void write_toplevel_indices(int amountmsgs)
29302930
char *abbr_dateformat = "%e %b %Y";
29312931
char *verbose_dateformat = "%A, %e %B %Y";
29322932

2933+
char *tmpstr;
2934+
29332935
FILE *fp;
29342936

29352937
filename = htmlfilename(index_name[0][FOLDERS_INDEX], NULL, "");
@@ -2949,6 +2951,19 @@ void write_toplevel_indices(int amountmsgs)
29492951
print_index_header_links(fp, FOLDERS_INDEX, firstdatenum, lastdatenum, amountmsgs, NULL);
29502952
fprintf (fp, "</div>\n");
29512953
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+
29522967
for (i = 0, j = 0; j <= ATTACHMENT_INDEX; ++j) {
29532968
if (show_index[1][j])
29542969
i++;
@@ -2957,10 +2972,10 @@ void write_toplevel_indices(int amountmsgs)
29572972
with all configurations. */
29582973
if (i > 0)
29592974
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"
29642979
"<tbody>\n", lang[MSG_PERIOD], i, lang[MSG_RESORTED],
29652980
lang[MSG_ARTICLES]);
29662981
}
@@ -2974,10 +2989,12 @@ void write_toplevel_indices(int amountmsgs)
29742989
if (!datelist->data)
29752990
continue;
29762991
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])
29782995
continue;
29792996
set_dateformat = saved_set_dateformat;
2980-
switch (j) {
2997+
switch (k) {
29812998
case DATE_INDEX:
29822999
writedates(sd->count, sd->first_email);
29833000
index_title = lang[MSG_LTITLE_LISTED_BY_DATE];
@@ -3029,37 +3046,37 @@ void write_toplevel_indices(int amountmsgs)
30293046
strcat (verbose_period_name, lang[MSG_TO]);
30303047
strcat (verbose_period_name, end_date);
30313048
}
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",
30333050
(first) ? " class=\"first\"" : "",
30343051
(first) ? "<a name=\"first\" id=\"first\"></a>" : "");
30353052
/* only add a link to the index if it is not empty */
30363053
if (sd->count > 0)
30373054
fprintf (fp, "<a title=\"%s %s\" href=\"%s%s\">",
30383055
verbose_period_name, index_title,
3039-
sd->subdir, index_name[1][j]);
3056+
sd->subdir, index_name[1][k]);
30403057
fprintf (fp, "%s", abbr_period_name);
30413058
if (sd->count > 0)
30423059
fprintf (fp, "</a>");
3043-
fprintf (fp, "</th>");
3060+
fprintf (fp, "</td>\n");
30443061
if (first)
30453062
first = FALSE;
30463063
started_line = 1;
30473064
}
30483065
else {
3049-
fprintf(fp, "<td>");
3066+
fprintf(fp, " <td>");
30503067
/* only add a link to the index if it is not empty */
30513068
if (sd->count > 0)
30523069
fprintf (fp, "<a title=\"%s %s\" href=\"%s%s\">",
30533070
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]);
30563073
if (sd->count > 0)
30573074
fprintf (fp, "</a>");
3058-
fprintf (fp, "</td>");
3075+
fprintf (fp, "</td>\n");
30593076
}
30603077
}
30613078
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);
30633080
}
30643081
set_dateformat = saved_set_dateformat;
30653082

src/printfile.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,7 @@ void print_main_header(FILE *fp, bool index_header, char *label, char *name,
333333
fprintf(fp, ".quotelev2 {color : #ff7700}\n");
334334
fprintf(fp, ".quotelev3 {color : #007799}\n");
335335
fprintf(fp, ".quotelev4 {color : #95c500}\n");
336+
fprintf (fp, ".period {font-weight: bold}\n");
336337
fprintf (fp, "</style>\n");
337338
}
338339

src/proto.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ void version(void);
6565
void progerr(char *);
6666
void cmderr(char *);
6767
void usage(void);
68+
char *setindex(char *dfltindex, char *indextype, char *suffix);
6869

6970
/*
7071
** lang.c function

src/setup.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,11 +149,11 @@ int set_delete_level;
149149

150150
struct Config cfg[] = {
151151
{"antispam_at", &set_antispam_at, ANTISPAM_AT, CFG_STRING,
152-
"# replace any @ sign with this string, if spam flags enabled\n", FALSE},
152+
"# replace any @ sign with this string, if spam flags enabled.\n", FALSE},
153153

154154
{"language", &set_language, LANGUAGE, CFG_STRING,
155155
"# A two-letter string specifying the language to use!\n"
156-
"# For example 'en' for English\n", FALSE},
156+
"# For example 'en' for English.\n", FALSE},
157157

158158
{"htmlsuffix", &set_htmlsuffix, HTMLSUFFIX, CFG_STRING,
159159
"# Use this to specify the html file suffix to be used\n"
@@ -638,7 +638,7 @@ struct Config cfg[] = {
638638
"# a symbolic link by this name to the most recently created\n"
639639
"# subdirectory. Note that many web servers are configured to\n"
640640
"# not follow symbolic links for security reasons. The link will\n"
641-
"# be created in the directory specified by the 'dir' or '-d' option.",
641+
"# be created in the directory specified by the 'dir' or '-d' option.\n",
642642
FALSE},
643643

644644
{"base_url", &set_base_url, NULL, CFG_STRING,
@@ -744,7 +744,7 @@ struct Config cfg[] = {
744744
{"href_detection", &set_href_detection, BTRUE, CFG_SWITCH,
745745
"# Set this to On to assume that any string on the body of the message\n"
746746
"# that says <A HREF=\" ... </A> is a URL, together with its markup\n"
747-
"# and treat it as such.", TRUE},
747+
"# and treat it as such.\n", TRUE},
748748

749749
{"mbox_shortened", &set_mbox_shortened, BFALSE, CFG_SWITCH,
750750
"# Set this to On to enable use of mbox that has had some of its\n"

0 commit comments

Comments
 (0)