Replace some links with buttons, for aesthetic reasons.

This commit is contained in:
Jacob 2024-05-25 17:51:17 +02:00
parent 9c52c241c1
commit 08249aaaf6
6 changed files with 31 additions and 32 deletions

View file

@ -90,9 +90,9 @@ if ($allowPasswordChange || $IsCurrentUser) {
$html .= "\t\t\t\t\t\t<br><br>\n";
$html .= "\t\t\t\t\t\t<label for=\"newpass\">New password</label>\n";
$html .= "\t\t\t\t\t\t<input type=\"password\" name=\"newpass\" placeholder=\"New password\">\n";
$html .= "\t\t\t\t\t\t<input type=\"password\" name=\"newpass\" placeholder=\"New password\"><br><br>\n";
$html .= "\t\t\t\t\t\t<label for=\"newpassc\">Confirm</label>\n";
$html .= "\t\t\t\t\t\t<input type=\"password\" name=\"newpassc\" placeholder=\"Confirm\">\n";
$html .= "\t\t\t\t\t\t<input type=\"password\" name=\"newpassc\" placeholder=\"Confirm\"><br><br>\n";
$html .= "\t\t\t\t\t\t<input type=\"hidden\" name=\"action\" value=\"pass\">\n";
$html .= "\t\t\t\t\t\t<input type=\"hidden\" name=\"id\"\" value=\"$ID\">\n";
$html .= "\t\t\t\t\t\t<input type=\"hidden\" name=\"redir\" value=\"$Redirect\">\n";
@ -116,11 +116,11 @@ if ($allowUsernameChange || !$IsCurrentUser) {
if ($IsCurrentUser) {
$html .= "\t\t\t\t\t\t<label for=\"curusername\">Current username</label>\n";
$html .= "\t\t\t\t\t\t<input type=\"text\" name=\"curusername\" placeholder=\"Current username\">\n";
$html .= "\t\t\t\t\t\t<input type=\"text\" name=\"curusername\" placeholder=\"Current username\"><br><br>\n";
}
$html .= "\t\t\t\t\t\t<label for=\"newusername\">New username</label>\n";
$html .= "\t\t\t\t\t\t<input type=\"text\" name=\"newusername\" placeholder=\"New username\">\n";
$html .= "\t\t\t\t\t\t<input type=\"text\" name=\"newusername\" placeholder=\"New username\"><br><br>\n";
$html .= "\t\t\t\t\t\t<input type=\"hidden\" name=\"action\" value=\"username\">\n";
$html .= "\t\t\t\t\t\t<input type=\"hidden\" name=\"id\"\" value=\"$ID\">\n";
$html .= "\t\t\t\t\t\t<input type=\"hidden\" name=\"redir\" value=\"$Redirect\">\n";
@ -148,7 +148,7 @@ if (!$IsCurrentUser) {
$html .= "\t\t\t\t\t\t<select name=\"type\" required>\n";
if ($Primary == 1) $html .= "\t\t\t\t\t\t\t<option value=\"2\">Administrator</option>\n";
$html .= "\t\t\t\t\t\t\t<option value=\"1\" selected=\"selected\">User</option>\n";
$html .= "\t\t\t\t\t\t</select>\n";
$html .= "\t\t\t\t\t\t</select><br><br>\n";
$html .= "\t\t\t\t\t\t<input type=\"hidden\" name=\"action\" value=\"type\">\n";
$html .= "\t\t\t\t\t\t<input type=\"hidden\" name=\"id\"\" value=\"$ID\">\n";
$html .= "\t\t\t\t\t\t<input type=\"hidden\" name=\"redir\" value=\"$Redirect\">\n";

View file

@ -120,6 +120,10 @@ if ($Action == "comments") {
$html .= "\t\t\t\t</table>\n";
} else if ($Action == "create") {
$html .= "\t\t\t\t<form method=\"POST\" class=\"admin_create_form\" action=\"create-user.php?redir=admin\" method=\"post\">\n";
$html .= "\t\t\t\t\t<label for=\"username\">Username</label>\n";
$html .= "\t\t\t\t\t<input type=\"text\" name=\"username\" placeholder=\"Username\"><br><br>\n";
$html .= "\t\t\t\t\t<label for=\"password\">Password</label>\n";
$html .= "\t\t\t\t\t<input type=\"password\" name=\"password\" placeholder=\"Password\"><br><br>\n";
$html .= "\t\t\t\t\t<label for=\"type\">User type</label>\n";
$html .= "\t\t\t\t\t<select name=\"type\" required>\n";
@ -128,12 +132,7 @@ if ($Action == "comments") {
}
$html .= "\t\t\t\t\t\t<option value=\"User\" selected=\"selected\">User</option>\n";
$html .= "\t\t\t\t\t</select>\n";
$html .= "\t\t\t\t\t<label for=\"username\">Username</label>\n";
$html .= "\t\t\t\t\t<input type=\"text\" name=\"username\" placeholder=\"Username\">\n";
$html .= "\t\t\t\t\t<label for=\"password\">Password</label>\n";
$html .= "\t\t\t\t\t<input type=\"password\" name=\"password\" placeholder=\"Password\">\n";
$html .= "\t\t\t\t\t<br><br>\n";
$html .= "\t\t\t\t\t</select><br><br>\n";
$html .= "\t\t\t\t\t<input type=\"submit\" value=\"Create user\" name=\"create\">\n";
$html .= "\t\t\t\t</form>\n";

View file

@ -676,11 +676,11 @@ function printHeader($html, $printpage) {
$html .= "\t\t\t\t$ret->data\n";
if ($ret->displaySource == "true") {
$html .= "\t\t\t\t<a id=\"source\" href=\"/$sourceFile\">Source</a>\n";
$html .= "\t\t\t\t<button id=\"source\" onclick=\"window.location.href='/$sourceFile'\">Source</button>\n";
}
if (isset($_SESSION['type'])) {
$html .= "\t\t\t\t<a id=\"modify\" href=\"/edit-page.php?id=$pid\">Request changes</a>\n";
$html .= "\t\t\t\t<button id=\"modify\" onclick=\"window.location.href='/edit-page.php?id=$pid'\">Request changes</button>\n";
}
if ($ret->displayLicense == "true" && $License != '') {

View file

@ -153,6 +153,21 @@ if ($Action == "write") {
}
$html .= "\t\t\t\t<p class=\"pageWarning\"><strong>Switching tab will delete changes made to the Markdown document. Press 'Save' to avoid this.</strong></p>\n";
// handle errors
if ($Error == "endpoint") {
$html .= "\t\t\t\t<p class=\"pageError\">You must specify a valid endpoint (e.g. /blog/article1)</p>\n";
} else if ($Error == "file") {
$html .= "\t\t\t\t<p class=\"pageError\">Failed to upload file.</p>\n";
} else if ($Error == "ofile") {
$html .= "\t\t\t\t<p class=\"pageError\">Failed to back up file, aborting.</p>\n";
} else if ($Error == "exists") {
$html .= "\t\t\t\t<p class=\"pageError\">A file with this endpoint already exists.</p>\n";
} else if ($Error == "saved") { // not actually an error but i don't want to make this too complicated
$Date = date($dateFormat) . " at " . date($timeFormat);
$html .= "\t\t\t\t<p class=\"pageSuccess\">$Date: Your changes have been saved.</p>\n";
}
$html .= "\t\t\t\t<form method=\"POST\" class=\"new_form\" action=\"/edit.php\"><input type=\"submit\" value=\"New\"></form>\n";
if ($postID == -1) {
@ -175,25 +190,10 @@ if ($Action == "write") {
$html .= "\t\t\t\t\t<input type=\"text\" name=\"endpoint\" placeholder=\"/blog/unicorns-and-lollipops\"><br>\n";
}
$html .= "\t\t\t\t\t<br><input class=\"saveForm\" type=\"submit\" value=\"Save\">\n";
$html .= "\t\t\t\t</form>\n";
// add history button if we're editing an existing page
if ($defaultEndpoint != "") {
$html .= "\t\t\t\t\t\t<a href=\"/edit.php?action=history&id=$postID\">History</a>\n";
}
// handle errors
if ($Error == "endpoint") {
$html .= "\t\t\t\t<p class=\"pageError\">You must specify a valid endpoint (e.g. /blog/article1)</p>\n";
} else if ($Error == "file") {
$html .= "\t\t\t\t<p class=\"pageError\">Failed to upload file.</p>\n";
} else if ($Error == "ofile") {
$html .= "\t\t\t\t<p class=\"pageError\">Failed to back up file, aborting.</p>\n";
} else if ($Error == "exists") {
$html .= "\t\t\t\t<p class=\"pageError\">A file with this endpoint already exists.</p>\n";
} else if ($Error == "saved") { // not actually an error but i don't want to make this too complicated
$Date = date($dateFormat) . " at " . date($timeFormat);
$html .= "\t\t\t\t<p class=\"pageSuccess\">$Date: Your changes have been saved.</p>\n";
$html .= "\t\t\t\t\t\t<br><br><button onclick=\"window.location.href='/edit.php?action=history&id=$postID'\">History</button>\n";
}
} else if ($Action == "attachments") {
$html .= "\t\t\t\t<form method=\"POST\" class=\"pageFileUploadForm\" action=\"/upload.php?redir=edit\" method=\"post\" enctype=\"multipart/form-data\">\n";

View file

@ -21,7 +21,7 @@
background-color: #363636;
}
input, select, textarea {
input, select, textarea, button {
font-size: 12pt;
font-family: Noto Sans;
font-weight: normal;
@ -178,7 +178,7 @@ footer {
background-color: #ececec;
}
input, select, textarea {
input, select, textarea, button {
font-size: 12pt;
font-family: Noto Sans;
font-weight: normal;

View file

@ -41,7 +41,7 @@
padding-right: 10px;
}
input, select, textarea {
input, select, textarea, button {
font-size: 12pt;
font-family: Noto Sans;
font-weight: normal;