Added a StrBuf that will eventually contain all of the
authorArt Cancro <ajc@citadel.org>
Fri, 3 Oct 2008 04:25:18 +0000 (04:25 +0000)
committerArt Cancro <ajc@citadel.org>
Fri, 3 Oct 2008 04:25:18 +0000 (04:25 +0000)
miscellaneous javascript that any page needs.  Callers should be appending
script code to the trailing_javascript strbuf instead of embedding it in the middle
of the page.  This will cause it all to be executed at once, which is
the recommended practice.  I haven't moved anything to this yet because
I think the script still isn't executing.

webcit/iconbar.c
webcit/webcit.c
webcit/webcit.h

index 99350602b47902378fcbcb91a73a42729b677b96..cab143b881924a60527adee89ea245bf0f76471c 100644 (file)
@@ -16,8 +16,8 @@
 void do_iconbar(void);
 void do_iconbar_roomlist(void);
 
-/**
- * \brief draw the icon bar?????
+/*
+ * Render the left side iconbar
  */
 void do_selected_iconbar(void) {
        if (WC->current_iconbar == current_iconbar_roomlist) {
index c14dacfdc101570710d3e637a4c6241300a2211a..f7bff4109bf8ce78d643bf301180582563e18f83 100644 (file)
@@ -382,6 +382,8 @@ void hprintf(const char *format,...)
 }
 
 
+
+
 /*
  * wrap up an HTTP session, closes tags, etc.
  *
@@ -394,6 +396,8 @@ void wDumpContent(int print_standard_html_footer)
 {
        if (print_standard_html_footer) {
                wprintf("</div>\n");    /* end of "text" div */
+               wprintf("<script type=\"text/javascript\">\n%s\n</script>\n",
+                       ChrPtr(WC->trailing_javascript));
                do_template("trailing", NULL);
        }
 
@@ -1368,6 +1372,7 @@ void session_loop(HashList *HTTPHeaders, StrBuf *ReqLine, StrBuf *request_method
        WCC->upload_length = 0;
        WCC->upload = NULL;
        WCC->is_mobile = 0;
+       WCC->trailing_javascript = NewStrBuf();
 
        /** Figure out the action */
        index[0] = action;
@@ -1768,6 +1773,7 @@ SKIP_ALL_THIS_CRAP:
                free(WCC->upload);
                WCC->upload_length = 0;
        }
+       FreeStrBuf(&WCC->trailing_javascript);
 }
 
 
index 0e9c1338c94d0e3177b09657453025aa2615cb51..3a3e0c333fb628aa880440a18252ffa83e9e26b3 100644 (file)
@@ -505,6 +505,8 @@ struct wcsession {
 
        HashList *ServCfg;                      /**< cache our server config for editing */
        HashList *InetCfg;                      /**< Our inet server config for editing */
+
+       StrBuf *trailing_javascript;            /**< extra javascript to be appended to page */
 };
 
 /** values for WC->current_iconbar */