From 3ae45e04a18d2675d28120424d6a701005d89261 Mon Sep 17 00:00:00 2001 From: onefang Date: Wed, 18 Mar 2020 23:33:23 +1000 Subject: Style the HTML better, and tweak other HTML things. HTML sucks, and there's no decent small simple way to style checkboxen. --- src/sledjchisl/sledjchisl.c | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) (limited to 'src/sledjchisl') diff --git a/src/sledjchisl/sledjchisl.c b/src/sledjchisl/sledjchisl.c index b6e4cd0..5446381 100644 --- a/src/sledjchisl/sledjchisl.c +++ b/src/sledjchisl/sledjchisl.c @@ -2226,17 +2226,22 @@ static void HTMLformEnd(qgrow_t *reply) reply->addstr(reply, " \n"); } -static void HTMLcheckBox(qgrow_t *reply, char *name, char *title, boolean checked) +static void HTMLcheckBox(qgrow_t *reply, char *name, char *title, boolean checked, boolean required) { + reply->addstrf(reply, "

"); + reply->addstrf(reply, "

:

\n", name, title, name); - else - reply->addstrf(reply, "

\n", name, name, title); + reply->addstrf(reply, " checked", name); +// if (required) +// reply->addstr(reply, " required"); + reply->addstrf(reply, "> %s ", title); +// reply->addstrf(reply, "> %s ⛝ □ 🞐 🞎 🞎 ☐ ▣️ ◉ ○ ", title); + reply->addstrf(reply, "

\n"); } -static void HTMLtextArea(qgrow_t *reply, char *name, char *title, int rows, int cols, int min, int max, char *holder, char *comp, char *spell, char *wrap, boolean required) +static void HTMLtextArea(qgrow_t *reply, char *name, char *title, int rows, int cols, int min, int max, char *holder, char *comp, char *spell, char *wrap, char *value, boolean required) { - reply->addstrf(reply, "

:

\n"); + reply->addstrf(reply, ">%s

\n", value); } static void HTMLtext(qgrow_t *reply, char *type, char *title, char *name, char *val, int size, int max, boolean required) { - reply->addstrf(reply, "

: addstrf(reply, "

\n"); + reply->addstr(reply, ">

\n"); } static void HTMLselect(qgrow_t *reply, char *title, char *name) @@ -4027,8 +4032,8 @@ void accountCreationPage(reqData *Rd, char *message) Rd->reply->addstr(Rd->reply, "

Warning, the limit on password length is set by your viewer, some can't handle longer than 16 characters.

\n"); Rd->reply->addstr(Rd->reply, "

While viewers will usually remember your name and password for you, you'll need to remember it for this web site to.   " "I highly recommend using a password manager.   KeePass and it's variations is a great password manager.

\n"); - HTMLtext(Rd->reply, "email", "email", "email", getStrH(Rd->stuff, "email"), 42, 254, FALSE); - HTMLtext(Rd->reply, "email", "Repeat your email, to be sure you got it correct", "emayl", getStrH(Rd->stuff, "emayl"), 42, 254, FALSE); + HTMLtext(Rd->reply, "email", "email", "email", getStrH(Rd->body, "email"), 42, 254, FALSE); + HTMLtext(Rd->reply, "email", "Repeat your email, to be sure you got it correct", "emayl", getStrH(Rd->body, "emayl"), 42, 254, FALSE); Rd->reply->addstr(Rd->reply, "

A validation email will be sent to this email address, you will need to click on the link in it to continue your account creation.

\n"); Rd->reply->addstr(Rd->reply, "
\n"); HTMLselect(Rd->reply, "Date of birth", "year"); @@ -4062,14 +4067,14 @@ void accountCreationPage(reqData *Rd, char *message) } HTMLselectEnd(Rd->reply); Rd->reply->addstr(Rd->reply, "
\n"); - HTMLcheckBox(Rd->reply, "adult", "I'm allegedly an adult in my country.", !strcmp("on", getStrH(Rd->stuff, "adult"))); - HTMLcheckBox(Rd->reply, "agree", "I accept the Terms of Service.", !strcmp("on", getStrH(Rd->stuff, "agree"))); + HTMLcheckBox(Rd->reply, "adult", "I'm allegedly an adult in my country.", !strcmp("on", getStrH(Rd->body, "adult")), TRUE); + HTMLcheckBox(Rd->reply, "agree", "I accept the Terms of Service.", !strcmp("on", getStrH(Rd->body, "agree")), TRUE); Rd->reply->addstrf(Rd->reply, "

Terms of Service

%s
\n", getStrH(Rd->configs, "ToS")); // For maxlength - the MySQL database field is type text, which has a max length of 64 Kilobytes byets, but characters might take up 1 - 4 bytes, and maxlength is in characters. // For rows and cols, seems a bit broken, I ask for 5/42, I get 6,36. In world it seems to be 7,46 // TODO - check against the limit for in world profiles, coz this will become that. // TODO - validate aboutMe, it should not be empty, and should not be longer than 64 kilobytes. - HTMLtextArea(Rd->reply, "aboutMe", "About me", 7, 50, 4, 16384, "Describe yourself here.", "off", "true", "soft", FALSE); + HTMLtextArea(Rd->reply, "aboutMe", "About me", 7, 50, 4, 16384, "Describe yourself here.", "off", "true", "soft", getStrH(Rd->body, "aboutMe"), FALSE); Rd->reply->addstrf(Rd->reply, "\n"); // Stop Enter key on text fields triggering the first submit button. HTMLbutton(Rd->reply, "confirm"); HTMLbutton(Rd->reply, "cancel"); -- cgit v1.1