Dillo v3.1.1-91-g6d5b3ee3
|
#include "form.hh"
#include "html_common.hh"
#include <errno.h>
#include <iconv.h>
#include "lout/misc.hh"
#include "dw/core.hh"
#include "dw/textblock.hh"
#include "dlib/dlib.h"
#include "misc.h"
#include "msg.h"
#include "prefs.h"
#include "uicmd.hh"
#include "dialog.hh"
Go to the source code of this file.
Functions | |
static Embed * | Html_input_image (DilloHtml *html, const char *tag, int tagsize) |
Create input image for the form. | |
static void | Html_option_finish (DilloHtml *html) |
DilloHtmlForm * | a_Html_form_new (DilloHtml *html, DilloHtmlMethod method, const DilloUrl *action, DilloHtmlEnc content_type, const char *charset, bool enabled) |
void | a_Html_form_delete (DilloHtmlForm *form) |
void | a_Html_input_delete (DilloHtmlInput *input) |
void | a_Html_form_submit2 (void *vform) |
void | a_Html_form_reset2 (void *vform) |
void | a_Html_form_display_hiddens2 (void *vform, bool display) |
static void | Html_add_input (DilloHtml *html, DilloHtmlInputType type, Embed *embed, const char *name, const char *init_str, bool init_val) |
Add an HTML control. | |
static DilloHtmlInput * | Html_get_radio_input (DilloHtml *html, const char *name) |
Find radio input by name. | |
static DilloHtmlInput * | Html_get_current_input (DilloHtml *html) |
Get the current input if available. | |
void | Html_tag_open_form (DilloHtml *html, const char *tag, int tagsize) |
Handle <FORM> tag. | |
void | Html_tag_close_form (DilloHtml *html) |
static int | Html_input_get_size (DilloHtml *html, const char *attrbuf) |
get size, restrict it to reasonable value | |
void | Html_tag_open_input (DilloHtml *html, const char *tag, int tagsize) |
Add a new input to current form. | |
void | Html_tag_open_isindex (DilloHtml *html, const char *tag, int tagsize) |
The ISINDEX tag is just a deprecated form of <INPUT type=text>> with implied FORM, afaics. | |
void | Html_tag_open_textarea (DilloHtml *html, const char *tag, int tagsize) |
void | Html_tag_content_textarea (DilloHtml *html, const char *tag, int tagsize) |
The textarea tag. | |
void | Html_tag_close_textarea (DilloHtml *html) |
Close textarea. | |
void | Html_tag_open_select (DilloHtml *html, const char *tag, int tagsize) |
void | Html_tag_close_select (DilloHtml *html) |
void | Html_tag_open_optgroup (DilloHtml *html, const char *tag, int tagsize) |
void | Html_tag_close_optgroup (DilloHtml *html) |
void | Html_tag_open_option (DilloHtml *html, const char *tag, int tagsize) |
void | Html_tag_close_option (DilloHtml *html) |
void | Html_tag_open_button (DilloHtml *html, const char *tag, int tagsize) |
void | Html_tag_close_button (DilloHtml *html) |
Handle close <BUTTON> | |
static void | generate_boundary (Dstr *boundary) |
Generate a random boundary. | |
enum DilloHtmlInputType |
void a_Html_form_delete | ( | DilloHtmlForm * | form | ) |
Definition at line 244 of file form.cc.
Referenced by DilloHtml::~DilloHtml().
void a_Html_form_display_hiddens2 | ( | void * | vform, |
bool | display | ||
) |
Definition at line 264 of file form.cc.
Referenced by a_Html_form_display_hiddens().
DilloHtmlForm * a_Html_form_new | ( | DilloHtml * | html, |
DilloHtmlMethod | method, | ||
const DilloUrl * | action, | ||
DilloHtmlEnc | content_type, | ||
const char * | charset, | ||
bool | enabled | ||
) |
Definition at line 235 of file form.cc.
Referenced by DilloHtml::formNew().
void a_Html_form_reset2 | ( | void * | vform | ) |
Definition at line 259 of file form.cc.
Referenced by a_Html_form_reset().
void a_Html_form_submit2 | ( | void * | vform | ) |
Definition at line 254 of file form.cc.
Referenced by a_Html_form_submit().
void a_Html_input_delete | ( | DilloHtmlInput * | input | ) |
Definition at line 249 of file form.cc.
Referenced by DilloHtml::~DilloHtml().
|
static |
Generate a random boundary.
Using 70 random characters makes the probability that it collides with a 1 TiB random file less than 1e-117, so there is no need for checking for collisions.
Definition at line 1256 of file form.cc.
References dStr_append_c().
|
static |
Add an HTML control.
Definition at line 276 of file form.cc.
References _MSG, DilloHtml::bw, DilloHtml::getCurrentForm(), IN_FORM, lout::misc::SimpleVector< T >::increase(), DilloHtml::InFlags, DilloHtml::inputs_outside_form, BrowserWindow::NumPendingStyleSheets, lout::misc::SimpleVector< T >::set(), and lout::misc::SimpleVector< T >::size().
Referenced by Html_tag_content_textarea(), Html_tag_open_button(), Html_tag_open_input(), Html_tag_open_isindex(), and Html_tag_open_select().
|
static |
Get the current input if available.
Definition at line 322 of file form.cc.
References lout::misc::SimpleVector< T >::get(), DilloHtml::getCurrentForm(), IN_FORM, DilloHtml::InFlags, DilloHtml::inputs_outside_form, and lout::misc::SimpleVector< T >::size().
Referenced by Html_option_finish(), Html_tag_close_optgroup(), Html_tag_close_select(), Html_tag_close_textarea(), Html_tag_open_optgroup(), and Html_tag_open_option().
|
static |
Find radio input by name.
Definition at line 299 of file form.cc.
References DILLO_HTML_INPUT_RADIO, dStrAsciiCasecmp(), lout::misc::SimpleVector< T >::get(), DilloHtml::getCurrentForm(), IN_FORM, DilloHtml::InFlags, DilloHtml::inputs_outside_form, and lout::misc::SimpleVector< T >::size().
Referenced by Html_tag_open_input().
|
static |
get size, restrict it to reasonable value
Definition at line 413 of file form.cc.
References BUG_MSG.
Referenced by Html_tag_open_input().
Create input image for the form.
Definition at line 2026 of file form.cc.
References a_Html_common_image_attrs(), a_Html_image_new(), DilloHtml::backgroundStyle(), dw::core::ui::ResourceFactory::createComplexButtonResource(), HT2LT, HT2TB, MSG, StyleEngine::setPseudoLink(), dw::core::Widget::setStyle(), DilloHtml::style(), and DilloHtml::styleEngine.
Referenced by Html_tag_open_input().
|
static |
Definition at line 2055 of file form.cc.
References DILLO_HTML_INPUT_SEL_LIST, DILLO_HTML_INPUT_SELECT, Html_get_current_input(), Dstr::len, DilloHtml::Stash, and Dstr::str.
Referenced by Html_tag_close_optgroup(), Html_tag_close_option(), Html_tag_close_select(), Html_tag_open_optgroup(), and Html_tag_open_option().
void Html_tag_close_button | ( | DilloHtml * | html | ) |
void Html_tag_close_form | ( | DilloHtml * | html | ) |
Definition at line 402 of file form.cc.
References DilloHtml::InFlags.
void Html_tag_close_optgroup | ( | DilloHtml * | html | ) |
Definition at line 844 of file form.cc.
References DILLO_HTML_INPUT_SEL_LIST, DILLO_HTML_INPUT_SELECT, Html_get_current_input(), Html_option_finish(), IN_OPTGROUP, IN_OPTION, and DilloHtml::InFlags.
void Html_tag_close_option | ( | DilloHtml * | html | ) |
Definition at line 896 of file form.cc.
References Html_option_finish(), IN_OPTION, and DilloHtml::InFlags.
void Html_tag_close_select | ( | DilloHtml * | html | ) |
Definition at line 788 of file form.cc.
References DILLO_HTML_INPUT_SELECT, Html_get_current_input(), Html_option_finish(), IN_OPTION, IN_SELECT, and DilloHtml::InFlags.
void Html_tag_close_textarea | ( | DilloHtml * | html | ) |
Close textarea.
(TEXTAREA is parsed in VERBATIM mode, and entities are handled here)
Definition at line 695 of file form.cc.
References a_Html_parse_entities(), dStr_erase(), Html_get_current_input(), IN_TEXTAREA, DilloHtml::InFlags, Dstr::len, S_TOP, DilloHtml::Stash, and Dstr::str.
void Html_tag_content_textarea | ( | DilloHtml * | html, |
const char * | tag, | ||
int | tagsize | ||
) |
The textarea tag.
Definition at line 636 of file form.cc.
References a_Html_get_attr(), a_Html_stash_init(), DilloHtml::backgroundStyle(), BUG_MSG, dw::core::ui::ResourceFactory::createMultiLineTextResource(), dFree(), DILLO_HTML_INPUT_TEXTAREA, DILLO_HTML_PARSE_MODE_VERBATIM, DilloHtml::DocType, DilloHtml::DocTypeVersion, dStrdup(), DT_HTML, HT2LT, HT2TB, Html_add_input(), S_TOP, and dw::core::ui::TextResource::setEditable().
void Html_tag_open_button | ( | DilloHtml * | html, |
const char * | tag, | ||
int | tagsize | ||
) |
Definition at line 907 of file form.cc.
References a_Html_get_attr(), a_Html_get_attr_wdef(), DilloHtml::backgroundStyle(), BUG_MSG, dw::core::ui::ResourceFactory::createComplexButtonResource(), CSS_TYPE_STRING, dFree(), DILLO_HTML_INPUT_BUTTON, DILLO_HTML_INPUT_BUTTON_RESET, DILLO_HTML_INPUT_BUTTON_SUBMIT, DILLO_HTML_INPUT_UNKNOWN, dStrAsciiCasecmp(), DilloHtml::dw, FALSE, HT2LT, HT2TB, Html_add_input(), IN_BUTTON, IN_SELECT, IN_TEXTAREA, DilloHtml::InFlags, prefs, PROPERTY_X_TOOLTIP, S_TOP, StyleEngine::setNonCssHint(), dw::core::Widget::setStyle(), DilloPrefs::show_tooltip, and DilloHtml::styleEngine.
void Html_tag_open_form | ( | DilloHtml * | html, |
const char * | tag, | ||
int | tagsize | ||
) |
Handle <FORM> tag.
Definition at line 338 of file form.cc.
References a_Html_get_attr(), a_Html_url_new(), a_Url_dup(), a_Url_free(), DilloHtml::base_url, BUG_MSG, DilloHtml::charset, dFree(), DILLO_HTML_ENC_MULTIPART, DILLO_HTML_ENC_URLENCODED, DILLO_HTML_METHOD_GET, DILLO_HTML_METHOD_POST, DilloHtml::DocType, DilloHtml::DocTypeVersion, dStrAsciiCasecmp(), dStrdup(), dStrsep(), DT_HTML, DilloHtml::formNew(), HT2TB, IN_FORM, DilloHtml::InFlags, and DilloHtml::wordStyle().
void Html_tag_open_input | ( | DilloHtml * | html, |
const char * | tag, | ||
int | tagsize | ||
) |
Add a new input to current form.
Definition at line 432 of file form.cc.
References a_Html_get_attr(), a_Html_get_attr_wdef(), DilloHtml::backgroundStyle(), DilloHtml::base_url, BUG_MSG, dw::core::ui::ResourceFactory::createCheckButtonResource(), dw::core::ui::ResourceFactory::createEntryResource(), dw::core::ui::ResourceFactory::createLabelButtonResource(), dw::core::ui::ResourceFactory::createRadioButtonResource(), CSS_TYPE_STRING, dFree(), DILLO_HTML_ENC_MULTIPART, DILLO_HTML_INPUT_BUTTON, DILLO_HTML_INPUT_CHECKBOX, DILLO_HTML_INPUT_FILE, DILLO_HTML_INPUT_HIDDEN, DILLO_HTML_INPUT_IMAGE, DILLO_HTML_INPUT_PASSWORD, DILLO_HTML_INPUT_RADIO, DILLO_HTML_INPUT_RESET, DILLO_HTML_INPUT_SUBMIT, DILLO_HTML_INPUT_TEXT, DILLO_HTML_INPUT_UNKNOWN, DILLO_HTML_METHOD_POST, dStrAsciiCasecmp(), dStrdup(), DilloHtml::getCurrentForm(), HT2LT, HT2TB, Html_add_input(), Html_get_radio_input(), Html_input_get_size(), Html_input_image(), IN_BUTTON, IN_FORM, IN_SELECT, DilloHtml::InFlags, MSG, prefs, PROPERTY_X_TOOLTIP, dw::core::ui::Embed::setDisplayed(), StyleEngine::setNonCssHint(), DilloPrefs::show_tooltip, DilloHtml::styleEngine, URL_FLAGS, and URL_SpamSafe.
void Html_tag_open_isindex | ( | DilloHtml * | html, |
const char * | tag, | ||
int | tagsize | ||
) |
The ISINDEX tag is just a deprecated form of <INPUT type=text>> with implied FORM, afaics.
Definition at line 589 of file form.cc.
References a_Html_get_attr(), a_Html_url_new(), a_Url_dup(), a_Url_free(), DilloHtml::backgroundStyle(), DilloHtml::base_url, DilloHtml::charset, dw::core::ui::ResourceFactory::createEntryResource(), DILLO_HTML_ENC_URLENCODED, DILLO_HTML_INPUT_INDEX, DILLO_HTML_METHOD_GET, FALSE, DilloHtml::formNew(), HT2LT, HT2TB, Html_add_input(), IN_FORM, DilloHtml::InFlags, MSG, and DilloHtml::wordStyle().
void Html_tag_open_optgroup | ( | DilloHtml * | html, |
const char * | tag, | ||
int | tagsize | ||
) |
Definition at line 808 of file form.cc.
References a_Html_get_attr(), a_Html_get_attr_wdef(), BUG_MSG, DILLO_HTML_INPUT_SEL_LIST, DILLO_HTML_INPUT_SELECT, dStrdup(), Html_get_current_input(), Html_option_finish(), IN_OPTGROUP, IN_OPTION, IN_SELECT, and DilloHtml::InFlags.
void Html_tag_open_option | ( | DilloHtml * | html, |
const char * | tag, | ||
int | tagsize | ||
) |
Definition at line 868 of file form.cc.
References a_Html_get_attr(), a_Html_get_attr_wdef(), a_Html_stash_init(), BUG_MSG, DILLO_HTML_INPUT_SEL_LIST, DILLO_HTML_INPUT_SELECT, Html_get_current_input(), Html_option_finish(), IN_OPTION, IN_SELECT, and DilloHtml::InFlags.
void Html_tag_open_select | ( | DilloHtml * | html, |
const char * | tag, | ||
int | tagsize | ||
) |
Definition at line 735 of file form.cc.
References a_Html_get_attr(), a_Html_get_attr_wdef(), a_Html_stash_init(), DilloHtml::backgroundStyle(), dw::core::ui::ResourceFactory::createListResource(), dw::core::ui::ResourceFactory::createOptionMenuResource(), CSS_TYPE_STRING, dFree(), DILLO_HTML_INPUT_SEL_LIST, DILLO_HTML_INPUT_SELECT, HT2LT, HT2TB, Html_add_input(), IN_BUTTON, IN_SELECT, IN_TEXTAREA, DilloHtml::InFlags, prefs, PROPERTY_X_TOOLTIP, dw::core::ui::ListResource::SELECTION_AT_MOST_ONE, dw::core::ui::ListResource::SELECTION_MULTIPLE, StyleEngine::setNonCssHint(), DilloPrefs::show_tooltip, and DilloHtml::styleEngine.
void Html_tag_open_textarea | ( | DilloHtml * | html, |
const char * | tag, | ||
int | tagsize | ||
) |
Definition at line 626 of file form.cc.
References IN_BUTTON, IN_SELECT, IN_TEXTAREA, and DilloHtml::InFlags.