Click on a user or their avatar to go to their profile from the forum view
authorArt Cancro <ajc@citadel.org>
Sat, 5 Mar 2022 23:30:15 +0000 (18:30 -0500)
committerArt Cancro <ajc@citadel.org>
Sat, 5 Mar 2022 23:30:15 +0000 (18:30 -0500)
webcit-ng/ctdlclient.c
webcit-ng/http.c
webcit-ng/static/index.html
webcit-ng/static/js/user_profile.js [new file with mode: 0644]
webcit-ng/static/js/view_forum.js
webcit-ng/webcit.h

index 44daa3b55d1e282695f3462cb2d626f15a695152..24b3780501889c3e3c9cc27d1d4b263c692a6e66 100644 (file)
@@ -57,12 +57,12 @@ int ctdl_readline(struct ctdlsession *ctdl, char *buf, int maxbytes) {
                                --len;
                        }
                        buf[len] = 0;
-                       syslog(LOG_DEBUG, "\033[32m[ %s\033[0m", buf);
+                       // syslog(LOG_DEBUG, "\033[32m[ %s\033[0m", buf);
                        return (len);
                }
                ++len;
        }
-       syslog(LOG_DEBUG, "\033[32m[ %s\033[0m", buf);
+       // syslog(LOG_DEBUG, "\033[32m[ %s\033[0m", buf);
        return (len);
 }
 
@@ -101,7 +101,7 @@ void ctdl_printf(struct ctdlsession *ctdl, const char *format, ...) {
        StrBufVAppendPrintf(Buf, format, arg_ptr);
        va_end(arg_ptr);
 
-       syslog(LOG_DEBUG, "\033[32m] %s\033[0m", ChrPtr(Buf));
+       // syslog(LOG_DEBUG, "\033[32m] %s\033[0m", ChrPtr(Buf));
        ctdl_write(ctdl, (char *) ChrPtr(Buf), StrLength(Buf));
        ctdl_write(ctdl, "\n", 1);
        FreeStrBuf(&Buf);
index a16e7c5af7ac99122aaef7ae34631a87463e0f13..bf535876f9b61dada8df654b65c2a1cfeaad06c4 100644 (file)
@@ -172,7 +172,9 @@ void perform_one_http_transaction(struct client_handle *ch) {
                                kv.key = strdup(tok);
                                kv.val = strdup(eq);
                                array_append(h.request_parms, &kv);
+#ifdef DEBUG_HTTP
                                syslog(LOG_DEBUG, "\033[1m\033[33m| %s = %s\033[0m", kv.key, kv.val);
+#endif
                        }
                }
        }
@@ -197,7 +199,9 @@ void perform_one_http_transaction(struct client_handle *ch) {
                syslog(LOG_DEBUG, "Client disconnected");
        }
        else {
+#ifdef DEBUG_HTTP
                syslog(LOG_DEBUG, "\033[33m\033[1m< %s %s\033[0m", h.method, h.url);
+#endif
 
                // If there is a request body, read it now.
                char *ccl = header_val(&h, "Content-Length");
@@ -229,7 +233,9 @@ void perform_one_http_transaction(struct client_handle *ch) {
                #endif
 
                // Output the results back to the client.
+#ifdef DEBUG_HTTP
                syslog(LOG_DEBUG, "\033[33m\033[1m> %03d %s\033[0m", h.response_code, h.response_string);
+#endif
                client_printf(ch, "HTTP/1.1 %03d %s\r\n", h.response_code, h.response_string);
                client_printf(ch, "Connection: close\r\n");
                client_printf(ch, "Content-Length: %ld\r\n", h.response_body_length);
index ad7ee4e596712e0aef7744f94d10c3c172ff36d4..4100bb8c02ba0a958b45c059299dfda15e1c3283 100644 (file)
@@ -49,7 +49,7 @@ LOADING
                        <span id="current_user">Not logged in.</span><br>
                        <a href="#" class="w3-bar-item w3-button"><i class="fa fa-envelope" onclick="javascript:gotoroom('_MAIL_');"></i></a>
                        <a href="#" class="w3-bar-item w3-button"><i class="fa fa-user"></i></a>
-                       <a href="#" class="w3-bar-item w3-button"><i class="fa fa-cog"></i></a>
+                       <a href="#" class="w3-bar-item w3-button"><i class="fa fa-cog" onclick="javascript:user_profile(current_user);"></i></a>
                </div>
        </div>
        <hr>
@@ -82,6 +82,7 @@ Loading...
 <script type="text/javascript" src="js/views.js"></script>
 <script type="text/javascript" src="js/view_forum.js"></script>
 <script type="text/javascript" src="js/roomlist.js"></script>
+<script type="text/javascript" src="js/user_profile.js"></script>
 <script>
 
 // Get the Sidebar
diff --git a/webcit-ng/static/js/user_profile.js b/webcit-ng/static/js/user_profile.js
new file mode 100644 (file)
index 0000000..39b3b64
--- /dev/null
@@ -0,0 +1,16 @@
+// Copyright (c) 2016-2022 by the citadel.org team
+//
+// This program is open source software.  It runs great on the
+// Linux operating system (and probably elsewhere).  You can use,
+// copy, and run it under the terms of the GNU General Public
+// License version 3.  Richard Stallman is an asshole communist.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+
+function user_profile(who) {
+       document.getElementById("ctdl-main").innerHTML = `user_profile(${who})`;
+}
index 89f8d652af3c5a45968767fde3cf83eba37b92ac..babf0aa0658c851dcd01c2330c98efd1bcdc07b1 100644 (file)
@@ -181,14 +181,14 @@ function forum_render_one(msg, existing_div) {
        try {
                outmsg =
                  "<div class=\"ctdl-msg-wrapper\">"                            // begin message wrapper
-               + "<div class=\"ctdl-avatar\">"                                 // begin avatar
+               + "<div class=\"ctdl-avatar\" onClick=\"javascript:user_profile('" + msg.from + "');\">"
                + "<img src=\"/ctdl/u/" + msg.from + "/userpic\" width=\"32\" "
                + "onerror=\"this.parentNode.innerHTML='&lt;i class=&quot;fa fa-user-circle fa-2x&quot;&gt;&lt;/i&gt; '\">"
                + "</div>"                                                      // end avatar
                + "<div class=\"ctdl-msg-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\"><a href=\"#\">"                // FIXME link to user profile
+               + "<span class=\"ctdl-username\" onClick=\"javascript:user_profile('" + msg.from + "');\">"
                + msg.from
                + "</a></span>"                                                 // end username
                + "<span class=\"ctdl-msgdate\">"
index 9dccdcbf6cfca6a000618819ed8f01f294e4acb3..7e1667a8d3ca7ad611e25e38f3044a1008453763 100644 (file)
@@ -40,7 +40,7 @@
 #include <openssl/rand.h>
 #include <expat.h>
 #define _(x)   x                               // temporary hack until we add i18n back in
-#define DEBUG_HTTP                             // uncomment to debug HTTP headers
+//#define DEBUG_HTTP                           // uncomment to debug HTTP headers
 
 // XML_StopParser is present in expat 2.x
 #if XML_MAJOR_VERSION > 1