From deefa284d138d4c45d52966079b9cf6c9877c083 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Fri, 3 Oct 2008 04:25:18 +0000 Subject: [PATCH] Added a StrBuf that will eventually contain all of the 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 | 4 ++-- webcit/webcit.c | 6 ++++++ webcit/webcit.h | 2 ++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/webcit/iconbar.c b/webcit/iconbar.c index 99350602b..cab143b88 100644 --- a/webcit/iconbar.c +++ b/webcit/iconbar.c @@ -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) { diff --git a/webcit/webcit.c b/webcit/webcit.c index c14dacfdc..f7bff4109 100644 --- a/webcit/webcit.c +++ b/webcit/webcit.c @@ -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("\n"); /* end of "text" div */ + wprintf("\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); } diff --git a/webcit/webcit.h b/webcit/webcit.h index 0e9c1338c..3a3e0c333 100644 --- a/webcit/webcit.h +++ b/webcit/webcit.h @@ -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 */ -- 2.39.2