implement flagging on www
This commit is contained in:
parent
f9b13fa515
commit
00703ab5e0
15
dist/www-bootstrap/static/style-mobile.css
vendored
15
dist/www-bootstrap/static/style-mobile.css
vendored
@ -142,6 +142,14 @@
|
|||||||
background-color: #b2ffb0;
|
background-color: #b2ffb0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.msg-summary-flag {
|
||||||
|
background-color: #ff9696;
|
||||||
|
display: -webkit-box;
|
||||||
|
display: -ms-flexbox;
|
||||||
|
display: flex;
|
||||||
|
-ms-flex-wrap: wrap;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
.msg-summary-seen {
|
.msg-summary-seen {
|
||||||
background-color: #eee;
|
background-color: #eee;
|
||||||
display: -webkit-box;
|
display: -webkit-box;
|
||||||
@ -227,6 +235,13 @@
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.msg-view-header-flagged {
|
||||||
|
background-color: #ffc9c9;
|
||||||
|
border: 1px solid #9b1e1e;
|
||||||
|
padding: 5px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
.msg-view-header {
|
.msg-view-header {
|
||||||
background-color: #eee;
|
background-color: #eee;
|
||||||
border: 1px solid #666666;
|
border: 1px solid #666666;
|
||||||
|
7
dist/www-bootstrap/static/style.css
vendored
7
dist/www-bootstrap/static/style.css
vendored
@ -239,6 +239,13 @@
|
|||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.msg-view-header-flagged {
|
||||||
|
background-color: #ffc9c9;
|
||||||
|
border: 1px solid #9b1e1e;
|
||||||
|
padding: 5px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
.msg-view-subject {
|
.msg-view-subject {
|
||||||
font-size: xx-large;
|
font-size: xx-large;
|
||||||
}
|
}
|
||||||
|
53
src/www.c
53
src/www.c
@ -699,6 +699,59 @@ int www_handler(void * cls, struct MHD_Connection * connection, const char * url
|
|||||||
whole_page = (char *)malloc(strlen(header) + strlen(page) + strlen(footer) + 1);
|
whole_page = (char *)malloc(strlen(header) + strlen(page) + strlen(footer) + 1);
|
||||||
|
|
||||||
sprintf(whole_page, "%s%s%s", header, page, footer);
|
sprintf(whole_page, "%s%s%s", header, page, footer);
|
||||||
|
} else if (strncasecmp(url, "/msgs/flag/", 11) == 0) {
|
||||||
|
con_inf->user = www_auth_ok(connection, url_);
|
||||||
|
|
||||||
|
if (con_inf->user == NULL) {
|
||||||
|
www_401(header, footer, connection);
|
||||||
|
free(header);
|
||||||
|
free(footer);
|
||||||
|
return MHD_YES;
|
||||||
|
}
|
||||||
|
conference = -1;
|
||||||
|
area = -1;
|
||||||
|
msg = -1;
|
||||||
|
url_copy = strdup(&url[11]);
|
||||||
|
|
||||||
|
aptr = strtok(url_copy, "/");
|
||||||
|
if (aptr != NULL) {
|
||||||
|
conference = strtol(aptr, &endptr, 10);
|
||||||
|
if (endptr == aptr) {
|
||||||
|
conference = -1;
|
||||||
|
}
|
||||||
|
aptr = strtok(NULL, "/");
|
||||||
|
if (aptr != NULL) {
|
||||||
|
area = strtol(aptr, &endptr, 10);
|
||||||
|
if (endptr == aptr) {
|
||||||
|
area = -1;
|
||||||
|
}
|
||||||
|
aptr = strtok(NULL, "/");
|
||||||
|
if (aptr != NULL) {
|
||||||
|
msg = strtol(aptr, &endptr, 10);
|
||||||
|
if (endptr == aptr) {
|
||||||
|
msg = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
free(url_copy);
|
||||||
|
|
||||||
|
if (conference != -1 && area != -1 && msg != -1) {
|
||||||
|
msgbase_flag_unflag(con_inf->user, conference, area, msg);
|
||||||
|
response = MHD_create_response_from_buffer (0, (void*) "", MHD_RESPMEM_PERSISTENT);
|
||||||
|
snprintf(buffer, PATH_MAX, "%smsgs/%d/%d/%d", conf.www_url, conference, area, msg);
|
||||||
|
|
||||||
|
MHD_add_response_header (response, "Location", buffer);
|
||||||
|
MHD_queue_response (connection, MHD_HTTP_FOUND, response);
|
||||||
|
MHD_destroy_response(response);
|
||||||
|
free(header);
|
||||||
|
free(footer);
|
||||||
|
return MHD_YES;
|
||||||
|
}
|
||||||
|
www_404(header, footer, connection);
|
||||||
|
free(header);
|
||||||
|
free(footer);
|
||||||
|
return MHD_YES;
|
||||||
} else if (strncasecmp(url, "/msgs/new/", 10) == 0) {
|
} else if (strncasecmp(url, "/msgs/new/", 10) == 0) {
|
||||||
con_inf->user = www_auth_ok(connection, url_);
|
con_inf->user = www_auth_ok(connection, url_);
|
||||||
|
|
||||||
|
@ -437,8 +437,11 @@ char *www_msgs_messageview(struct user_record *user, int conference, int area, i
|
|||||||
strcat(page, buffer);
|
strcat(page, buffer);
|
||||||
len += strlen(buffer);
|
len += strlen(buffer);
|
||||||
|
|
||||||
|
if (msgbase_is_flagged(user, conference, area, msg)) {
|
||||||
sprintf(buffer, "<div class=\"msg-view-header\">\n");
|
sprintf(buffer, "<div class=\"msg-view-header-flagged\">\n");
|
||||||
|
} else {
|
||||||
|
sprintf(buffer, "<div class=\"msg-view-header\">\n");
|
||||||
|
}
|
||||||
if (len + strlen(buffer) > max_len - 1) {
|
if (len + strlen(buffer) > max_len - 1) {
|
||||||
max_len += 4096;
|
max_len += 4096;
|
||||||
page = (char *)realloc(page, max_len);
|
page = (char *)realloc(page, max_len);
|
||||||
@ -486,6 +489,8 @@ char *www_msgs_messageview(struct user_record *user, int conference, int area, i
|
|||||||
} else {
|
} else {
|
||||||
sprintf(buffer, "<div class=\"msg-view-date\">Date: %.2d:%.2d %.2d-%.2d-%.2d</div>\n", msg_date.tm_hour, msg_date.tm_min, msg_date.tm_mday, msg_date.tm_mon + 1, msg_date.tm_year - 100);
|
sprintf(buffer, "<div class=\"msg-view-date\">Date: %.2d:%.2d %.2d-%.2d-%.2d</div>\n", msg_date.tm_hour, msg_date.tm_min, msg_date.tm_mday, msg_date.tm_mon + 1, msg_date.tm_year - 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sprintf(buffer, "<div class=\"msg-view-options\"><a href=\"%smsgs/flag/%d/%d/%d\"><img src=\"%sstatic/flag.png\" /></a></div>", conf.www_url, conference, area, msg, conf.www_url);
|
||||||
if (len + strlen(buffer) > max_len - 1) {
|
if (len + strlen(buffer) > max_len - 1) {
|
||||||
max_len += 4096;
|
max_len += 4096;
|
||||||
page = (char *)realloc(page, max_len);
|
page = (char *)realloc(page, max_len);
|
||||||
|
Reference in New Issue
Block a user