// disclosure are subject to the GNU General Public License v3.
+// Display the author of a message. This can be called from many different views.
+// For messages originating locally, it renders the display name linked to their profile.
+// For messages originating locally, it renders the display name and their email address.
+function render_msg_author(msg) {
+ if (msg.locl) {
+ return(
+ "<span class=\"ctdl-username\" onClick=\"javascript:user_profile('" + msg.from + "');\">"
+ + msg.from
+ + "</span>"
+ );
+ }
+ else {
+ return("<span class=\"ctdl-username\">" + msg.from + " <" + msg.rfca + "></span>");
+ }
+}
+
+
+// Display the user profile for a user
function user_profile(who) {
document.getElementById("ctdl-main").innerHTML = `user_profile(${who})`;
}
+ "<div class=\"ctdl-fmsg-content\">" // begin content
+ "<div class=\"ctdl-msg-header\">" // begin header
+ "<span class=\"ctdl-msg-header-info\">" // begin header info on left side
- + "<span class=\"ctdl-username\" onClick=\"javascript:user_profile('" + msg.from + "');\">"
- + msg.from
- + "</a></span>" // end username
+ + render_msg_author(msg) // author
+ "<span class=\"ctdl-msgdate\">"
+ string_timestamp(msg.time,0)
+ "</span>" // end msgdate
// Render a message into the mailbox view
function mail_render_one(msg, target_div) {
let div = "FIXME";
- console.log(msg);
+ console.log(render_msg_author(msg));
try {
outmsg =
"<div class=\"ctdl-mmsg-wrapper\">" // begin message wrapper
+ "<div class=\"ctdl-mmsg-content\">" // begin content
+ "<div class=\"ctdl-msg-header\">" // begin header
+ "<span class=\"ctdl-msg-header-info\">" // begin header info on left side
- + "<span class=\"ctdl-username\" onClick=\"javascript:user_profile('" + msg.from + "');\">"
- + msg.from
- + "</a></span>" // end username
+ + render_msg_author(msg)
+ "<span class=\"ctdl-msgdate\">"
+ string_timestamp(msg.time,0)
+ "</span>" // end msgdate