Dillo v3.1.1-111-gd4f56d0d
Loading...
Searching...
No Matches
form.cc File Reference
#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"
Include dependency graph for form.cc:

Go to the source code of this file.

Enumerations

enum  DilloHtmlInputType {
  DILLO_HTML_INPUT_UNKNOWN , DILLO_HTML_INPUT_TEXT , DILLO_HTML_INPUT_PASSWORD , DILLO_HTML_INPUT_CHECKBOX ,
  DILLO_HTML_INPUT_RADIO , DILLO_HTML_INPUT_IMAGE , DILLO_HTML_INPUT_FILE , DILLO_HTML_INPUT_BUTTON ,
  DILLO_HTML_INPUT_HIDDEN , DILLO_HTML_INPUT_SUBMIT , DILLO_HTML_INPUT_RESET , DILLO_HTML_INPUT_BUTTON_SUBMIT ,
  DILLO_HTML_INPUT_BUTTON_RESET , DILLO_HTML_INPUT_SELECT , DILLO_HTML_INPUT_SEL_LIST , DILLO_HTML_INPUT_TEXTAREA ,
  DILLO_HTML_INPUT_INDEX
}
 

Functions

static EmbedHtml_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.
 

Enumeration Type Documentation

◆ DilloHtmlInputType

Enumerator
DILLO_HTML_INPUT_UNKNOWN 
DILLO_HTML_INPUT_TEXT 
DILLO_HTML_INPUT_PASSWORD 
DILLO_HTML_INPUT_CHECKBOX 
DILLO_HTML_INPUT_RADIO 
DILLO_HTML_INPUT_IMAGE 
DILLO_HTML_INPUT_FILE 
DILLO_HTML_INPUT_BUTTON 
DILLO_HTML_INPUT_HIDDEN 
DILLO_HTML_INPUT_SUBMIT 
DILLO_HTML_INPUT_RESET 
DILLO_HTML_INPUT_BUTTON_SUBMIT 
DILLO_HTML_INPUT_BUTTON_RESET 
DILLO_HTML_INPUT_SELECT 
DILLO_HTML_INPUT_SEL_LIST 
DILLO_HTML_INPUT_TEXTAREA 
DILLO_HTML_INPUT_INDEX 

Definition at line 51 of file form.cc.

Function Documentation

◆ a_Html_form_delete()

void a_Html_form_delete ( DilloHtmlForm *  form)

Definition at line 244 of file form.cc.

Referenced by DilloHtml::~DilloHtml().

◆ a_Html_form_display_hiddens2()

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().

◆ a_Html_form_new()

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().

◆ a_Html_form_reset2()

void a_Html_form_reset2 ( void *  vform)

Definition at line 259 of file form.cc.

Referenced by a_Html_form_reset().

◆ a_Html_form_submit2()

void a_Html_form_submit2 ( void *  vform)

Definition at line 254 of file form.cc.

Referenced by a_Html_form_submit().

◆ a_Html_input_delete()

void a_Html_input_delete ( DilloHtmlInput *  input)

Definition at line 249 of file form.cc.

Referenced by DilloHtml::~DilloHtml().

◆ generate_boundary()

static void generate_boundary ( Dstr boundary)
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().

◆ Html_add_input()

◆ Html_get_current_input()

◆ Html_get_radio_input()

static DilloHtmlInput * Html_get_radio_input ( DilloHtml html,
const char *  name 
)
static

◆ Html_input_get_size()

static int Html_input_get_size ( DilloHtml html,
const char *  attrbuf 
)
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().

◆ Html_input_image()

static Embed * Html_input_image ( DilloHtml html,
const char *  tag,
int  tagsize 
)
static

◆ Html_option_finish()

◆ Html_tag_close_button()

void Html_tag_close_button ( DilloHtml html)

Handle close <BUTTON>

Definition at line 974 of file form.cc.

References DilloHtml::InFlags.

◆ Html_tag_close_form()

void Html_tag_close_form ( DilloHtml html)

Definition at line 402 of file form.cc.

References DilloHtml::InFlags.

◆ Html_tag_close_optgroup()

void Html_tag_close_optgroup ( DilloHtml html)

◆ Html_tag_close_option()

void Html_tag_close_option ( DilloHtml html)

Definition at line 896 of file form.cc.

References Html_option_finish(), IN_OPTION, and DilloHtml::InFlags.

◆ Html_tag_close_select()

void Html_tag_close_select ( DilloHtml html)

◆ Html_tag_close_textarea()

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.

◆ Html_tag_content_textarea()

◆ Html_tag_open_button()

◆ Html_tag_open_form()

◆ Html_tag_open_input()

◆ Html_tag_open_isindex()

void Html_tag_open_isindex ( DilloHtml html,
const char *  tag,
int  tagsize 
)

◆ Html_tag_open_optgroup()

void Html_tag_open_optgroup ( DilloHtml html,
const char *  tag,
int  tagsize 
)

◆ Html_tag_open_option()

void Html_tag_open_option ( DilloHtml html,
const char *  tag,
int  tagsize 
)

◆ Html_tag_open_select()

◆ Html_tag_open_textarea()

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.