diff --git a/src/www_msgs.c b/src/www_msgs.c
index ab21e22..a2f769c 100644
--- a/src/www_msgs.c
+++ b/src/www_msgs.c
@@ -96,7 +96,6 @@ char *www_msgs_arealist(struct user_record *user) {
char *www_msgs_messagelist(struct user_record *user, int conference, int area, int skip) {
struct msg_headers *mhrs;
- stralloc page = EMPTY_STRALLOC;
char buffer[4096];
int i;
struct tm msg_date;
@@ -108,7 +107,17 @@ char *www_msgs_messagelist(struct user_record *user, int conference, int area, i
char *to;
char *from;
char *subject;
+ char datebuf[32];
+
+ stralloc url;
+ struct www_tag *page;
+ struct www_tag *cur_tag;
+ struct www_tag *child_tag;
+ struct www_tag *child_child_tag;
+ struct www_tag *child_child_child_tag;
+ struct www_tag *child_child_child_child_tag;
+
if (conference < 0 || conference >= ptr_vector_len(&conf.mail_conferences))
return NULL;
struct mail_conference *mc = get_conf(conference);
@@ -116,32 +125,62 @@ char *www_msgs_messagelist(struct user_record *user, int conference, int area, i
return NULL;
struct mail_area *ma = get_area(conference, area);
- stralloc_copys(&page, "
\n");
+ page = www_tag_new(NULL, "");
+ cur_tag = www_tag_new("div", NULL);
+ www_tag_add_attrib(cur_tag, "class", "content-header");
+ www_tag_add_child(page, cur_tag);
+
+ child_tag = www_tag_new("h2", NULL);
+ www_tag_add_child(cur_tag, child_tag);
+
+ child_child_tag = www_tag_new(NULL, mc->name);
+ www_tag_add_child(child_tag, child_child_tag);
+
+ child_child_tag = www_tag_new(NULL, " - ");
+ www_tag_add_child(child_tag, child_child_tag);
+
+ child_child_tag = www_tag_new(NULL, ma->name);
+ www_tag_add_child(child_tag, child_child_tag);
if (ma->type != TYPE_NETMAIL_AREA) {
- stralloc_cats(&page, "\n");
+ cur_tag = www_tag_new("div", NULL);
+ www_tag_add_attrib(cur_tag, "class", "div-table");
+ www_tag_add_child(page, cur_tag);
jb = open_jam_base(ma->path);
if (!jb) {
- free(page.s);
+ www_tag_destroy(page);
free_message_headers(mhrs);
return NULL;
}
@@ -163,53 +202,143 @@ char *www_msgs_messagelist(struct user_record *user, int conference, int area, i
to = www_sanitize(mhrs->msgs[i]->to);
from = www_sanitize(mhrs->msgs[i]->from);
subject = www_sanitize(mhrs->msgs[i]->subject);
- if (msgbase_is_flagged(user, conference, area, mhrs->msgs[i]->msg_h->MsgNum)) {
- if (conf.date_style == 1) {
- snprintf(buffer, sizeof buffer, "
%d
%s
%s
%.2d:%.2d %.2d-%.2d-%.2d
\n", mhrs->msgs[i]->msg_no + 1, conf.www_url, conference, area, mhrs->msgs[i]->msg_h->MsgNum, subject, from, to, msg_date.tm_hour, msg_date.tm_min, msg_date.tm_mon + 1, msg_date.tm_mday, msg_date.tm_year - 100);
- } else {
- snprintf(buffer, sizeof buffer, "
%d
%s
%s
%.2d:%.2d %.2d-%.2d-%.2d
\n", mhrs->msgs[i]->msg_no + 1, conf.www_url, conference, area, mhrs->msgs[i]->msg_h->MsgNum, subject, from, to, msg_date.tm_hour, msg_date.tm_min, msg_date.tm_mday, msg_date.tm_mon + 1, msg_date.tm_year - 100);
- }
- } else if (mhrs->msgs[i]->msg_h->MsgNum > jlr.HighReadMsg) {
- if (conf.date_style == 1) {
- snprintf(buffer, sizeof buffer, "
%d
%s
%s
%.2d:%.2d %.2d-%.2d-%.2d
\n", mhrs->msgs[i]->msg_no + 1, conf.www_url, conference, area, mhrs->msgs[i]->msg_h->MsgNum, subject, from, to, msg_date.tm_hour, msg_date.tm_min, msg_date.tm_mon + 1, msg_date.tm_mday, msg_date.tm_year - 100);
- } else {
- snprintf(buffer, sizeof buffer, "
%d
%s
%s
%.2d:%.2d %.2d-%.2d-%.2d
\n", mhrs->msgs[i]->msg_no + 1, conf.www_url, conference, area, mhrs->msgs[i]->msg_h->MsgNum, subject, from, to, msg_date.tm_hour, msg_date.tm_min, msg_date.tm_mday, msg_date.tm_mon + 1, msg_date.tm_year - 100);
- }
- } else {
- if (conf.date_style == 1) {
- snprintf(buffer, sizeof buffer, "
%d
%s
%s
%.2d:%.2d %.2d-%.2d-%.2d
\n", mhrs->msgs[i]->msg_no + 1, conf.www_url, conference, area, mhrs->msgs[i]->msg_h->MsgNum, subject, from, to, msg_date.tm_hour, msg_date.tm_min, msg_date.tm_mon + 1, msg_date.tm_mday, msg_date.tm_year - 100);
- } else {
- snprintf(buffer, sizeof buffer, "
%d
%s
%s
%.2d:%.2d %.2d-%.2d-%.2d
\n", mhrs->msgs[i]->msg_no + 1, conf.www_url, conference, area, mhrs->msgs[i]->msg_h->MsgNum, subject, from, to, msg_date.tm_hour, msg_date.tm_min, msg_date.tm_mday, msg_date.tm_mon + 1, msg_date.tm_year - 100);
- }
- }
+ child_tag = www_tag_new("div", NULL);
+
+ if (msgbase_is_flagged(user, conference, area, mhrs->msgs[i]->msg_h->MsgNum)) {
+ www_tag_add_attrib(child_tag, "class", "msg-summary-flag");
+ } else if (mhrs->msgs[i]->msg_h->MsgNum > jlr.HighReadMsg) {
+ www_tag_add_attrib(child_tag, "class", "msg-summary");
+ } else {
+ www_tag_add_attrib(child_tag, "class", "msg-summary-seen");
+ }
+ www_tag_add_child(cur_tag, child_tag);
+
+
+ child_child_tag = www_tag_new("div", NULL);
+ www_tag_add_attrib(child_child_tag, "class", "msg-summary-id");
+ www_tag_add_child(child_tag, child_child_tag);
+
+ url = EMPTY_STRALLOC;
+ stralloc_cat_long(&url, mhrs->msgs[i]->msg_no + 1);
+ stralloc_0(&url);
+
+ child_child_child_tag = www_tag_new(NULL, url.s);
+ free(url.s);
+ www_tag_add_child(child_child_tag, child_child_child_tag);
+
+ child_child_tag = www_tag_new("div", NULL);
+ www_tag_add_attrib(child_child_tag, "class", "msg-summary-subject");
+ www_tag_add_child(child_tag, child_child_tag);
+
+ url = EMPTY_STRALLOC;
+ stralloc_cats(&url, conf.www_url);
+ stralloc_cats(&url, "msgs/");
+ stralloc_cat_long(&url, conference);
+ stralloc_append1(&url, '/');
+ stralloc_cat_long(&url, area);
+ stralloc_append1(&url, '/');
+ stralloc_cat_long(&url, mhrs->msgs[i]->msg_h->MsgNum);
+ stralloc_0(&url);
+
+ child_child_child_tag = www_tag_new("a", NULL);
+ www_tag_add_attrib(child_child_child_tag, "href", url.s);
+ free(url.s);
+ www_tag_add_child(child_child_tag, child_child_child_tag);
+
+ child_child_child_child_tag = www_tag_new(NULL, subject);
+ www_tag_add_child(child_child_child_tag, child_child_child_child_tag);
+
+ child_child_tag = www_tag_new("div", NULL);
+ www_tag_add_attrib(child_child_tag, "class", "msg-summary-from");
+ www_tag_add_child(child_tag, child_child_tag);
+
+ child_child_child_tag = www_tag_new(NULL, from);
+ www_tag_add_child(child_child_tag, child_child_child_tag);
+
+ child_child_tag = www_tag_new("div", NULL);
+ www_tag_add_attrib(child_child_tag, "class", "msg-summary-to");
+ www_tag_add_child(child_tag, child_child_tag);
+
+ child_child_child_tag = www_tag_new(NULL, to);
+ www_tag_add_child(child_child_tag, child_child_child_tag);
+
+ child_child_tag = www_tag_new("div", NULL);
+ www_tag_add_attrib(child_child_tag, "class", "msg-summary-date");
+ www_tag_add_child(child_tag, child_child_tag);
+
+ if (conf.date_style == 1)
+ strftime(datebuf, sizeof datebuf, "%H:%M %m-%d-%y", &msg_date);
+ else
+ strftime(datebuf, sizeof datebuf, "%H:%M %d-%m-%y", &msg_date);
+
+ child_child_child_tag = www_tag_new(NULL, datebuf);
+ www_tag_add_child(child_child_tag, child_child_child_tag);
+
free(to);
free(from);
free(subject);
- stralloc_cats(&page, buffer);
}
- stralloc_cats(&page, "
\n");
if (skip + 50 <= mhrs->msg_count) {
- snprintf(buffer, sizeof buffer,
- "