<li><button id="ctdl-ungoto-button" style="display:none" onClick="gotonext(0);">ungoto</button></li>
<li><button id="ctdl-skip-button" style="display:none" onClick="gotonext(1);">skip</button></li>
<li><button id="ctdl-goto-button" style="display:none" onClick="gotonext(2);">goto</button></li>
- <li><button id="lilo">Login</button><br>
- <span id="current_user">Not logged in.</span>
- <li><i class="fa fa-user-circle fa-3x"></i></li>
+ <li>
+ <span id="current_user">Not logged in.</span><br>
+ <button id="lilo">Login</button>
+ </li>
+ <li><span id="current_user_avatar"><i class="fa fa-user-circle fa-3x"></i></span></li>
</ul>
</div>
document.getElementById("current_user").innerHTML = current_user ;
if (logged_in) {
document.getElementById("lilo").innerHTML = "<a href=\"/ctdl/a/logout\"><i class=\"fa fa-right-from-bracket\"></i>" + _("Log off") + "</a>" ;
+ document.getElementById("current_user_avatar").innerHTML = render_userpic(current_user);
}
else {
document.getElementById("lilo").innerHTML = "<a href=\"javascript:display_login_screen('')\"><i class=\"fa fa-right-to-bracket\"></i>" + _("Log in") + "</a>" ;
+ document.getElementById("current_user_avatar").innerHTML = "<i class=\"fa fa-user-circle fa-3x\"></i>";
}
}
// disclosure are subject to the GNU General Public License v3.
-// Display the author of a message. This can be called from many different views.
+// Inline 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) {
}
-// Display the user profile for a user
+// Inline display the profile picture for a user. This can be called from anywhere.
+function render_userpic(username) {
+ return(
+ "<div class=\"ctdl-avatar\" onClick=\"javascript:user_profile('" + username + "');\">"
+ + "<img src=\"/ctdl/u/" + username + "/userpic\" width=\"32\""
+ + "onerror=\"this.parentNode.innerHTML='<i class="fa fa-user-circle fa-2x"></i>'\">"
+ + "</div>" // end avatar
+ );
+}
+
+
+// Display the user profile page for a user
function user_profile(who) {
- document.getElementById("ctdl-main").innerHTML = `user_profile(${who})`;
+ document.getElementById("ctdl-main").innerHTML =
+ render_userpic(who)
+ + "This is the user profile page for " + who + ".<br>"
+ + "FIXME finish this";
}
try {
outmsg =
"<div class=\"ctdl-fmsg-wrapper\">" // begin message wrapper
- + "<div class=\"ctdl-avatar\" onClick=\"javascript:user_profile('" + msg.from + "');\">"
- + "<img src=\"/ctdl/u/" + msg.from + "/userpic\" width=\"32\" "
- + "onerror=\"this.parentNode.innerHTML='<i class="fa fa-user-circle fa-2x"></i> '\">"
- + "</div>" // end avatar
+ + render_userpic(msg.from) // user avatar
+ "<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
try {
outmsg =
"<div class=\"ctdl-mmsg-wrapper\">" // begin message wrapper
- + "<div class=\"ctdl-avatar\" onClick=\"javascript:user_profile('" + msg.from + "');\">"
- + "<img src=\"/ctdl/u/" + msg.from + "/userpic\" width=\"32\" "
- + "onerror=\"this.parentNode.innerHTML='<i class="fa fa-user-circle fa-2x"></i> '\">"
- + "</div>" // end avatar
+ + render_userpic(msg.from) // user avatar
+ "<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