aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--src/sledjchisl/sledjchisl.c33
1 files changed, 19 insertions, 14 deletions
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)
2226 reply->addstr(reply, " </form>\n"); 2226 reply->addstr(reply, " </form>\n");
2227} 2227}
2228 2228
2229static void HTMLcheckBox(qgrow_t *reply, char *name, char *title, boolean checked) 2229static void HTMLcheckBox(qgrow_t *reply, char *name, char *title, boolean checked, boolean required)
2230{ 2230{
2231 reply->addstrf(reply, " <p>");
2232 reply->addstrf(reply, "<label><input type=\"checkbox\" name=\"%s\"", name);
2231 if (checked) 2233 if (checked)
2232 reply->addstrf(reply, " <p><label for=\"%s\">%s</label> : <input type=\"checkbox\" name=\"%s\" checked></p>\n", name, title, name); 2234 reply->addstrf(reply, " checked", name);
2233 else 2235// if (required)
2234 reply->addstrf(reply, " <p><input type=\"checkbox\" name=\"%s\"><label for=\"%s\">%s</label></p>\n", name, name, title); 2236// reply->addstr(reply, " required");
2237 reply->addstrf(reply, "> %s </label>", title);
2238// reply->addstrf(reply, "> %s ⛝ □ 🞐 🞎 🞎 ☐ ▣️ ◉ ○ </label>", title);
2239 reply->addstrf(reply, "</p>\n");
2235} 2240}
2236 2241
2237static 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) 2242static 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)
2238{ 2243{
2239 reply->addstrf(reply, " <p><label for=\"%s\">%s</label> : <textarea name=\"%s\"", name, title, name); 2244 reply->addstrf(reply, " <p><label>%s : <textarea name=\"%s\"", title, name);
2240 if (0 < rows) 2245 if (0 < rows)
2241 reply->addstrf(reply, " rows=\"%d\"", rows); 2246 reply->addstrf(reply, " rows=\"%d\"", rows);
2242 if (0 < cols) 2247 if (0 < cols)
@@ -2255,12 +2260,12 @@ static void HTMLtextArea(qgrow_t *reply, char *name, char *title, int rows, int
2255 reply->addstrf(reply, " spellcheck=\"%s\"", spell); 2260 reply->addstrf(reply, " spellcheck=\"%s\"", spell);
2256 if ("" != wrap) 2261 if ("" != wrap)
2257 reply->addstrf(reply, " wrap=\"%s\"", wrap); 2262 reply->addstrf(reply, " wrap=\"%s\"", wrap);
2258 reply->addstr(reply, "></textarea></p>\n"); 2263 reply->addstrf(reply, ">%s</textarea></label></p>\n", value);
2259} 2264}
2260 2265
2261static void HTMLtext(qgrow_t *reply, char *type, char *title, char *name, char *val, int size, int max, boolean required) 2266static void HTMLtext(qgrow_t *reply, char *type, char *title, char *name, char *val, int size, int max, boolean required)
2262{ 2267{
2263 reply->addstrf(reply, " <p><label for=\"%s\">%s</label> : <input type=\"%s\" name=\"%s\"", name, title, type, name); 2268 reply->addstrf(reply, " <p><label>%s : <input type=\"%s\" name=\"%s\"", title, type, name);
2264 if ("" != val) 2269 if ("" != val)
2265 reply->addstrf(reply, "value=\"%s\"", val); 2270 reply->addstrf(reply, "value=\"%s\"", val);
2266 if (0 < size) 2271 if (0 < size)
@@ -2269,7 +2274,7 @@ static void HTMLtext(qgrow_t *reply, char *type, char *title, char *name, char *
2269 reply->addstrf(reply, " maxlength=\"%d\"", max); 2274 reply->addstrf(reply, " maxlength=\"%d\"", max);
2270 if (required) 2275 if (required)
2271 reply->addstr(reply, " required"); 2276 reply->addstr(reply, " required");
2272 reply->addstr(reply, "></p>\n"); 2277 reply->addstr(reply, "></label></p>\n");
2273} 2278}
2274 2279
2275static void HTMLselect(qgrow_t *reply, char *title, char *name) 2280static void HTMLselect(qgrow_t *reply, char *title, char *name)
@@ -4027,8 +4032,8 @@ void accountCreationPage(reqData *Rd, char *message)
4027 Rd->reply->addstr(Rd->reply, "<p>Warning, the limit on password length is set by your viewer, some can't handle longer than 16 characters.</p>\n"); 4032 Rd->reply->addstr(Rd->reply, "<p>Warning, the limit on password length is set by your viewer, some can't handle longer than 16 characters.</p>\n");
4028 Rd->reply->addstr(Rd->reply, "<p>While viewers will usually remember your name and password for you, you'll need to remember it for this web site to. &nbsp; " 4033 Rd->reply->addstr(Rd->reply, "<p>While viewers will usually remember your name and password for you, you'll need to remember it for this web site to. &nbsp; "
4029 "I highly recommend using a password manager. &nbsp; KeePass and it's variations is a great password manager.</p>\n"); 4034 "I highly recommend using a password manager. &nbsp; KeePass and it's variations is a great password manager.</p>\n");
4030 HTMLtext(Rd->reply, "email", "email", "email", getStrH(Rd->stuff, "email"), 42, 254, FALSE); 4035 HTMLtext(Rd->reply, "email", "email", "email", getStrH(Rd->body, "email"), 42, 254, FALSE);
4031 HTMLtext(Rd->reply, "email", "Repeat your email, to be sure you got it correct", "emayl", getStrH(Rd->stuff, "emayl"), 42, 254, FALSE); 4036 HTMLtext(Rd->reply, "email", "Repeat your email, to be sure you got it correct", "emayl", getStrH(Rd->body, "emayl"), 42, 254, FALSE);
4032 Rd->reply->addstr(Rd->reply, "<p>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.</p>\n"); 4037 Rd->reply->addstr(Rd->reply, "<p>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.</p>\n");
4033 Rd->reply->addstr(Rd->reply, "<table><tr><td>\n"); 4038 Rd->reply->addstr(Rd->reply, "<table><tr><td>\n");
4034 HTMLselect(Rd->reply, "Date of birth", "year"); 4039 HTMLselect(Rd->reply, "Date of birth", "year");
@@ -4062,14 +4067,14 @@ void accountCreationPage(reqData *Rd, char *message)
4062 } 4067 }
4063 HTMLselectEnd(Rd->reply); 4068 HTMLselectEnd(Rd->reply);
4064 Rd->reply->addstr(Rd->reply, "</td></tr></table>\n"); 4069 Rd->reply->addstr(Rd->reply, "</td></tr></table>\n");
4065 HTMLcheckBox(Rd->reply, "adult", "I'm allegedly an adult in my country.", !strcmp("on", getStrH(Rd->stuff, "adult"))); 4070 HTMLcheckBox(Rd->reply, "adult", "I'm allegedly an adult in my country.", !strcmp("on", getStrH(Rd->body, "adult")), TRUE);
4066 HTMLcheckBox(Rd->reply, "agree", "I accept the Terms of Service.", !strcmp("on", getStrH(Rd->stuff, "agree"))); 4071 HTMLcheckBox(Rd->reply, "agree", "I accept the Terms of Service.", !strcmp("on", getStrH(Rd->body, "agree")), TRUE);
4067 Rd->reply->addstrf(Rd->reply, "<h2>Terms of Service</h2><pre>%s</pre>\n", getStrH(Rd->configs, "ToS")); 4072 Rd->reply->addstrf(Rd->reply, "<h2>Terms of Service</h2><pre>%s</pre>\n", getStrH(Rd->configs, "ToS"));
4068 // 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. 4073 // 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.
4069 // 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 4074 // 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
4070// TODO - check against the limit for in world profiles, coz this will become that. 4075// TODO - check against the limit for in world profiles, coz this will become that.
4071// TODO - validate aboutMe, it should not be empty, and should not be longer than 64 kilobytes. 4076// TODO - validate aboutMe, it should not be empty, and should not be longer than 64 kilobytes.
4072 HTMLtextArea(Rd->reply, "aboutMe", "About me", 7, 50, 4, 16384, "Describe yourself here.", "off", "true", "soft", FALSE); 4077 HTMLtextArea(Rd->reply, "aboutMe", "About me", 7, 50, 4, 16384, "Describe yourself here.", "off", "true", "soft", getStrH(Rd->body, "aboutMe"), FALSE);
4073 Rd->reply->addstrf(Rd->reply, "<input type='submit' disabled style='display: none' aria-hidden='true' />\n"); // Stop Enter key on text fields triggering the first submit button. 4078 Rd->reply->addstrf(Rd->reply, "<input type='submit' disabled style='display: none' aria-hidden='true' />\n"); // Stop Enter key on text fields triggering the first submit button.
4074 HTMLbutton(Rd->reply, "confirm"); 4079 HTMLbutton(Rd->reply, "confirm");
4075 HTMLbutton(Rd->reply, "cancel"); 4080 HTMLbutton(Rd->reply, "cancel");