+ /* If this is the initial page load (and not an update), supply the required JavaScript code */
+ if (!WC->is_ajax) {
+ StrBufAppendPrintf(WC->trailing_javascript,
+ " function moremsgs(target_div, gt_or_lt, gt_or_lt_value, maxmsgs, sortorder) { \n"
+ " $(target_div).innerHTML = '<div class=\"moreprompt\">%s ... <img src=\"static/throbber.gif\"><br><br><br></div>'; \n"
+ " p = gt_or_lt + '=' + gt_or_lt_value + '&maxmsgs=' + maxmsgs \n"
+ " + '&is_summary=0&SortOrder=' + sortorder + '&is_ajax=1' \n"
+ " + '>_or_lt=' + gt_or_lt \n"
+ " + '&r=' + CtdlRandomString(); \n"
+ " new Ajax.Updater(target_div, 'read' + gt_or_lt, \n"
+ " { method: 'get', parameters: p, evalScripts: true } ); \n"
+ " } \n"
+ "",
+ _("Loading")
+ );
+ }
+
+
+ /* Determine whether we are in the middle of a 'click for older messages' or 'click for
+ * newer messages' operation. If neither, then we are in the initial page load.
+ */
+ if (!strcasecmp(bstr("gt_or_lt"), "lt")) {
+ doing_older_messages = 1;
+ doing_newer_messages = 0;
+ lprintf(9, "\033[31m ** OLDER MESSAGES ** \033[0m\n");
+ }
+ else if (!strcasecmp(bstr("gt_or_lt"), "gt")) {
+ doing_older_messages = 0;
+ doing_newer_messages = 1;
+ lprintf(9, "\033[32m ** NEWER MESSAGES ** \033[0m\n");
+ }
+ else {
+ doing_older_messages = 0;
+ doing_newer_messages = 0;
+ lprintf(9, "\033[33m ** INITIAL PAGE LOAD ** \033[0m\n");
+ }
+
+
+ /* Supply the link to prepend the previous 20 messages */
+
+ if (doing_newer_messages == 0) {
+ wc_printf("<div id=\"%s\">", olderdiv);
+ /* if (Stat->nummsgs > 0) { */
+ if (Stat->nummsgs > 0) {
+ wc_printf("<a href=\"javascript:moremsgs('%s', 'lt', %ld, %ld, %d );\">",
+ olderdiv,
+ BBS->msgs[0],
+ Stat->maxmsgs,
+ (Stat->reverse ? 2 : 1)
+ );
+
+ wc_printf("<div class=\"moreprompt\">"
+ "↑ ↑ ↑ %s ↑ ↑ ↑"
+ "</div>", _("click here for older messages")
+ );
+ wc_printf("</a>");
+ }
+ wc_printf("<br></div>");
+ }
+
+
+