summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 203ada2)
raw | patch | inline | side by side (parent: 203ada2)
author | Florian Forster <ff@octo.it> | |
Mon, 21 Jun 2010 08:52:26 +0000 (10:52 +0200) | ||
committer | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Mon, 21 Jun 2010 08:52:26 +0000 (10:52 +0200) |
src/action_list_graphs.c | patch | blob | history | |
src/utils_cgi.c | patch | blob | history | |
src/utils_cgi.h | patch | blob | history |
index dad436720e3830610e185bbd7c2860ea47dc307d..a2365173ac43bd0d68d11affff2c828843075241 100644 (file)
--- a/src/action_list_graphs.c
+++ b/src/action_list_graphs.c
};
typedef struct page_data_s page_data_t;
-static int print_search_box (void *user_data) /* {{{ */
-{
- page_data_t *data = user_data;
- char *term_html;
-
- if (data == NULL)
- {
- fprintf (stderr, "print_search_box: data == NULL\n");
- return (EINVAL);
- }
-
- term_html = html_escape (data->search_term);
-
- printf ("<form action=\"%s\" method=\"get\">\n"
- " <input type=\"hidden\" name=\"action\" value=\"list_graphs\" />\n"
- " <input type=\"text\" name=\"search\" value=\"%s\" id=\"search-input\" />\n"
- " <input type=\"submit\" name=\"button\" value=\"Search\" />\n"
- "</form>\n",
- script_name (),
- (term_html != NULL) ? term_html : "");
-
- free (term_html);
-
- return (0);
-} /* }}} int print_search_box */
-
static int print_search_result (void *user_data) /* {{{ */
{
page_data_t *pg_data = user_data;
memset (&pg_data, 0, sizeof (pg_data));
pg_data.search_term = term;
- pg_callbacks.top_right = print_search_box;
+ pg_callbacks.top_right = html_print_search_box;
pg_callbacks.middle_left = print_host_list;
pg_callbacks.middle_center = print_search_result;
diff --git a/src/utils_cgi.c b/src/utils_cgi.c
index daf97651519f1e461d014816938f3f85b9f69a21..9030eb8b31a5354f8d0ff8ba45db2e4eef44de95 100644 (file)
--- a/src/utils_cgi.c
+++ b/src/utils_cgi.c
return (0);
} /* }}} int html_print_page */
+int html_print_search_box (__attribute__((unused)) void *user_data) /* {{{ */
+{
+ char *term_html;
+
+ term_html = html_escape (param ("search"));
+
+ printf ("<form action=\"%s\" method=\"get\">\n"
+ " <input type=\"hidden\" name=\"action\" value=\"list_graphs\" />\n"
+ " <input type=\"text\" name=\"search\" value=\"%s\" id=\"search-input\" />\n"
+ " <input type=\"submit\" name=\"button\" value=\"Search\" />\n"
+ "</form>\n",
+ script_name (),
+ (term_html != NULL) ? term_html : "");
+
+ free (term_html);
+
+ return (0);
+} /* }}} int html_print_search_box */
+
/* vim: set sw=2 sts=2 et fdm=marker : */
diff --git a/src/utils_cgi.h b/src/utils_cgi.h
index 20f806cfba592ef1a3594d1998fa10ec1d57d565..e8e847ec430e39f4e0748c42c0c6235ed2aed4e9 100644 (file)
--- a/src/utils_cgi.h
+++ b/src/utils_cgi.h
int html_print_page (const char *title,
const page_callbacks_t *cb, void *user_data);
+int html_print_search_box (void *user_data);
+
/* vim: set sw=2 sts=2 et fdm=marker : */
#endif /* UTILS_CGI_H */