diff options
author | jcid <devnull@localhost> | 2008-05-05 21:48:23 +0200 |
---|---|---|
committer | jcid <devnull@localhost> | 2008-05-05 21:48:23 +0200 |
commit | aca71dc1724ce0e27a933e841d3b202c677768ca (patch) | |
tree | 32ac39de4aaf2f85dec870c0a2e8facda1626cf6 /src | |
parent | d62124610cffb469f7b867a82fd20eb25cf63353 (diff) |
- Implemented MULTIPLE SELECT in FORMS.
Diffstat (limited to 'src')
-rw-r--r-- | src/html.cc | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/src/html.cc b/src/html.cc index 8ae59c86..946ecd54 100644 --- a/src/html.cc +++ b/src/html.cc @@ -4191,7 +4191,8 @@ static char *Html_make_multipart_boundary(DilloHtmlForm *form, iconv_t encoder, dStr_free(dstr, 1); } } - for (int i = 0; i < dList_length(values); i++) { + int length = dList_length(values); + for (int i = 0; i < length; i++) { dstr = (Dstr *) dList_nth_data(values, 0); dList_remove(values, dstr); if (input->type != DILLO_HTML_INPUT_FILE) @@ -4283,8 +4284,8 @@ static Dstr *Html_build_query_data(DilloHtmlForm *form, int active_submit, Html_urlencode_append(DataStr, val->str); dStr_free(val, 1); } else { - int i; - for (i = 0; i < dList_length(values); i++) { + 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); @@ -4879,8 +4880,16 @@ static void Html_tag_open_select(DilloHtml *html, const char *tag, int tagsize) DilloHtmlForm *form = html->forms->getRef (html->forms->size() - 1); char *name = Html_get_attr_wdef(html, tag, tagsize, "name", NULL); - OptionMenuResource *res = - HT2LT(html)->getResourceFactory()->createOptionMenuResource (); + ResourceFactory *factory = HT2LT(html)->getResourceFactory (); + DilloHtmlInputType type; + SelectionResource *res; + if (Html_get_attr(html, tag, tagsize, "multiple")) { + type = DILLO_HTML_INPUT_SEL_LIST; + res = factory->createListResource (ListResource::SELECTION_MULTIPLE); + } else { + type = DILLO_HTML_INPUT_SELECT; + res = factory->createOptionMenuResource (); + } Widget *widget; Embed *embed; widget = embed = new Embed(res); @@ -4912,8 +4921,7 @@ static void Html_tag_open_select(DilloHtml *html, const char *tag, int tagsize) DilloHtmlSelect *select = new DilloHtmlSelect; select->options = new misc::SimpleVector<DilloHtmlOption *> (4); - Html_add_input(form, DILLO_HTML_INPUT_SELECT, widget, embed, name, - NULL, select, false); + Html_add_input(form, type, widget, embed, name, NULL, select, false); Html_stash_init(html); dFree(name); } |