aboutsummaryrefslogtreecommitdiff
path: root/src/form.cc
diff options
context:
space:
mode:
authorjcid <devnull@localhost>2008-06-08 03:35:20 +0200
committerjcid <devnull@localhost>2008-06-08 03:35:20 +0200
commitb4a644b05a46099e9227b8250a091ae54d07cd2d (patch)
tree2e3626ea8b10022dc4262984beb2d865bba939fb /src/form.cc
parent74b1783cb3d3d5fc3f535e92072c725d13c2071f (diff)
- Fix for image coordinate submition.
Diffstat (limited to 'src/form.cc')
-rw-r--r--src/form.cc95
1 files changed, 47 insertions, 48 deletions
diff --git a/src/form.cc b/src/form.cc
index bf6e4ea8..8f34b023 100644
--- a/src/form.cc
+++ b/src/form.cc
@@ -1164,55 +1164,59 @@ Dstr *DilloHtmlForm::buildQueryData(DilloHtmlInput *active_submit,
bool is_active_submit = (input == active_submit);
name = Html_encode_text(encoder, &name);
- Html_get_input_values(input, is_active_submit, values);
-
- if (input->type == DILLO_HTML_INPUT_FILE &&
- dList_length(values) > 0) {
- if (dList_length(values) > 1)
- MSG_WARN("multiple files per form control not supported\n");
- Dstr *file = (Dstr *) dList_nth_data(values, 0);
- dList_remove(values, file);
-
- /* Get filename and encode it. Do not encode file contents. */
- dw::core::ui::LabelButtonResource *lbr =
- (dw::core::ui::LabelButtonResource*)input->embed->getResource();
- const char *filename = lbr->getLabel();
- if (filename[0] && strcmp(filename, input->init_str)) {
- char *p = strrchr(filename, '/');
- if (p)
- filename = p + 1; /* don't reveal path */
- Dstr *dfilename = dStr_new(filename);
- dfilename = Html_encode_text(encoder, &dfilename);
- Html_append_input_multipart_files(DataStr, boundary,
- name->str, file, dfilename->str);
- dStr_free(dfilename, 1);
+
+ if (input->type == DILLO_HTML_INPUT_IMAGE) {
+ if (is_active_submit){
+ if (enc == DILLO_HTML_ENC_URLENCODING)
+ Html_append_clickpos_urlencode(DataStr, name, x, y);
+ else if (enc == DILLO_HTML_ENC_MULTIPART)
+ Html_append_clickpos_multipart(DataStr, boundary, name, x,y);
}
- dStr_free(file, 1);
- } else if (input->type == DILLO_HTML_INPUT_INDEX) {
- Dstr *val = (Dstr *) dList_nth_data(values, 0);
- dList_remove(values, val);
- val = Html_encode_text(encoder, &val);
- Html_urlencode_append(DataStr, val->str);
- dStr_free(val, 1);
} else {
- int length = dList_length(values), i;
- for (i = 0; i < length; i++) {
+ Html_get_input_values(input, is_active_submit, values);
+
+ if (input->type == DILLO_HTML_INPUT_FILE &&
+ dList_length(values) > 0) {
+ if (dList_length(values) > 1)
+ MSG_WARN("multiple files per form control not supported\n");
+ Dstr *file = (Dstr *) dList_nth_data(values, 0);
+ dList_remove(values, file);
+
+ /* Get filename and encode it. Do not encode file contents. */
+ dw::core::ui::LabelButtonResource *lbr =
+ (dw::core::ui::LabelButtonResource*)
+ input->embed->getResource();
+ const char *filename = lbr->getLabel();
+ if (filename[0] && strcmp(filename, input->init_str)) {
+ char *p = strrchr(filename, '/');
+ if (p)
+ filename = p + 1; /* don't reveal path */
+ Dstr *dfilename = dStr_new(filename);
+ dfilename = Html_encode_text(encoder, &dfilename);
+ Html_append_input_multipart_files(DataStr, boundary,
+ name->str, file, dfilename->str);
+ dStr_free(dfilename, 1);
+ }
+ dStr_free(file, 1);
+ } else if (input->type == DILLO_HTML_INPUT_INDEX) {
Dstr *val = (Dstr *) dList_nth_data(values, 0);
dList_remove(values, val);
val = Html_encode_text(encoder, &val);
- if (enc == DILLO_HTML_ENC_URLENCODING)
- Html_append_input_urlencode(DataStr, name->str, val->str);
- else if (enc == DILLO_HTML_ENC_MULTIPART)
- Html_append_input_multipart(DataStr, boundary, name->str,
- val->str);
+ Html_urlencode_append(DataStr, val->str);
dStr_free(val, 1);
- }
- if (i && input->type == DILLO_HTML_INPUT_IMAGE) {
- /* clickpos to accompany the value just appended */
- if (enc == DILLO_HTML_ENC_URLENCODING)
- Html_append_clickpos_urlencode(DataStr, name, x, y);
- else if (enc == DILLO_HTML_ENC_MULTIPART)
- Html_append_clickpos_multipart(DataStr, boundary, name, x,y);
+ } else {
+ int length = dList_length(values), i;
+ for (i = 0; i < length; i++) {
+ Dstr *val = (Dstr *) dList_nth_data(values, 0);
+ dList_remove(values, val);
+ val = Html_encode_text(encoder, &val);
+ if (enc == DILLO_HTML_ENC_URLENCODING)
+ Html_append_input_urlencode(DataStr, name->str, val->str);
+ else if (enc == DILLO_HTML_ENC_MULTIPART)
+ Html_append_input_multipart(DataStr, boundary, name->str,
+ val->str);
+ dStr_free(val, 1);
+ }
}
}
dStr_free(name, 1);
@@ -1720,11 +1724,6 @@ static void Html_get_input_values(const DilloHtmlInput *input,
}
}
break;
- case DILLO_HTML_INPUT_IMAGE:
- if (is_active_submit) {
- dList_append(values, dStr_new(input->init_str));
- }
- break;
case DILLO_HTML_INPUT_FILE:
{
dw::core::ui::LabelButtonResource *lbr =