diff options
Diffstat (limited to 'src/utils/html.c')
-rw-r--r-- | src/utils/html.c | 71 |
1 files changed, 60 insertions, 11 deletions
diff --git a/src/utils/html.c b/src/utils/html.c index 0549457..35e6e65 100644 --- a/src/utils/html.c +++ b/src/utils/html.c @@ -673,7 +673,8 @@ mq_html_notebook(gboolean vertical, const gchar *name, guint current_page, ...) } gchar * -mq_html_form(const gchar *submit_label, const gchar *reset_label, ...) +mq_html_form(const gchar *submit_name, const gchar *submit_label, + const gchar *reset_name, const gchar *reset_label, ...) { gsize len; va_list ap; @@ -690,12 +691,24 @@ mq_html_form(const gchar *submit_label, const gchar *reset_label, ...) va_end(ap); len += strlen("<div class=\"dialog-buttonbox\">\n"); if (reset_label && reset_label[0]) { - len += strlen("<input type=\"reset\" value=\""); + len += strlen("<input type=\"reset\" "); + if (reset_name && reset_name[0]) { + len += strlen("name=\""); + len += strlen(reset_name); + len += strlen("\" "); + } + len += strlen("value=\""); len += strlen(reset_label); len += strlen("\">\n"); } if (submit_label && submit_label[0]) { - len += strlen("<input type=\"submit\" value=\""); + len += strlen("<input type=\"submit\" "); + if (submit_name && submit_name[0]) { + len += strlen("name=\""); + len += strlen(submit_name); + len += strlen("\" "); + } + len += strlen("value=\""); len += strlen(submit_label); len += strlen("\">\n"); } @@ -714,12 +727,24 @@ mq_html_form(const gchar *submit_label, const gchar *reset_label, ...) va_end(ap); ptr = g_stpcpy(ptr, "<div class=\"dialog-buttonbox\">\n"); if (reset_label && reset_label[0]) { - ptr = g_stpcpy(ptr, "<input type=\"reset\" value=\""); + ptr = g_stpcpy(ptr, "<input type=\"reset\" "); + if (reset_name && reset_name[0]) { + ptr = g_stpcpy(ptr, "name=\""); + ptr = g_stpcpy(ptr, reset_name); + ptr = g_stpcpy(ptr, "\" "); + } + ptr = g_stpcpy(ptr, "value=\""); ptr = g_stpcpy(ptr, reset_label); ptr = g_stpcpy(ptr, "\">\n"); } if (submit_label && submit_label[0]) { - ptr = g_stpcpy(ptr, "<input type=\"submit\" value=\""); + ptr = g_stpcpy(ptr, "<input type=\"submit\" "); + if (submit_name && submit_name[0]) { + ptr = g_stpcpy(ptr, "name=\""); + ptr = g_stpcpy(ptr, submit_name); + ptr = g_stpcpy(ptr, "\" "); + } + ptr = g_stpcpy(ptr, "value=\""); ptr = g_stpcpy(ptr, submit_label); ptr = g_stpcpy(ptr, "\">\n"); } @@ -730,8 +755,8 @@ mq_html_form(const gchar *submit_label, const gchar *reset_label, ...) } gchar * -mq_html_form_v(const gchar *submit_label, const gchar *reset_label, - gchar **children) +mq_html_form_v(const gchar *submit_name, const gchar *submit_label, + const gchar *reset_name, const gchar *reset_label, gchar **children) { gsize len; gsize i; @@ -745,12 +770,24 @@ mq_html_form_v(const gchar *submit_label, const gchar *reset_label, } len += strlen("<div class=\"dialog-buttonbox\">\n"); if (reset_label && reset_label[0]) { - len += strlen("<input type=\"reset\" value=\""); + len += strlen("<input type=\"reset\" "); + if (reset_name && reset_name[0]) { + len += strlen("name=\""); + len += strlen(reset_name); + len += strlen("\" "); + } + len += strlen("value=\""); len += strlen(reset_label); len += strlen("\">\n"); } if (submit_label && submit_label[0]) { - len += strlen("<input type=\"submit\" value=\""); + len += strlen("<input type=\"submit\" "); + if (submit_name && submit_name[0]) { + len += strlen("name=\""); + len += strlen(submit_name); + len += strlen("\" "); + } + len += strlen("value=\""); len += strlen(submit_label); len += strlen("\">\n"); } @@ -766,12 +803,24 @@ mq_html_form_v(const gchar *submit_label, const gchar *reset_label, } ptr = g_stpcpy(ptr, "<div class=\"dialog-buttonbox\">\n"); if (reset_label && reset_label[0]) { - ptr = g_stpcpy(ptr, "<input type=\"reset\" value=\""); + ptr = g_stpcpy(ptr, "<input type=\"reset\" "); + if (reset_name && reset_name[0]) { + ptr = g_stpcpy(ptr, "name=\""); + ptr = g_stpcpy(ptr, reset_name); + ptr = g_stpcpy(ptr, "\" "); + } + ptr = g_stpcpy(ptr, "value=\""); ptr = g_stpcpy(ptr, reset_label); ptr = g_stpcpy(ptr, "\">\n"); } if (submit_label && submit_label[0]) { - ptr = g_stpcpy(ptr, "<input type=\"submit\" value=\""); + ptr = g_stpcpy(ptr, "<input type=\"submit\" "); + if (submit_name && submit_name[0]) { + ptr = g_stpcpy(ptr, "name=\""); + ptr = g_stpcpy(ptr, submit_name); + ptr = g_stpcpy(ptr, "\" "); + } + ptr = g_stpcpy(ptr, "value=\""); ptr = g_stpcpy(ptr, submit_label); ptr = g_stpcpy(ptr, "\">\n"); } |