Web-UI: Added multi line input

This commit is contained in:
Malte Bublitz 2023-11-08 19:58:13 +01:00
parent 2aff11395c
commit 5f218f6d40
Signed by: malte70
GPG key ID: 605DA5C729F9C184
3 changed files with 52 additions and 23 deletions

View file

@ -9,7 +9,10 @@ if (!file_exists(FIFO))
$f = fopen(FIFO, "w+"); $f = fopen(FIFO, "w+");
switch ($_POST["cmd"]) { if (count($_POST) == 0)
$_POST = json_decode(file_get_contents('php://input'), true);
switch (@$_POST["cmd"]) {
case "getty": case "getty":
fwrite($f, "GETTY"); fwrite($f, "GETTY");
break; break;
@ -36,6 +39,16 @@ switch ($_POST["cmd"]) {
fwrite($f, "ECHO "); fwrite($f, "ECHO ");
fwrite($f, $_POST["text"]); fwrite($f, $_POST["text"]);
break; break;
case "echo2":
fwrite($f, "CLS\n");
fwrite($f, "LINE 1\n");
fwrite($f, "ECHO ");
fwrite($f, $_POST["line1"]);
fwrite($f, "\n");
fwrite($f, "LINE 2\n");
fwrite($f, "ECHO ");
fwrite($f, $_POST["line2"]);
break;
} }
fwrite($f, "\n"); fwrite($f, "\n");

View file

@ -15,18 +15,21 @@ $Title = "MAPID-FIFO Web-UI";
</header> </header>
<main> <main>
<section> <section>
<h3>Welcome message</h3>
<form action="command.php" method="POST"> <form action="command.php" method="POST">
<input type="hidden" name="cmd" value="getty"> <input type="hidden" name="cmd" value="getty">
<button type="submit">Getty</button> <button type="submit">Getty</button>
</form> </form>
</section> </section>
<section> <section>
<h3>Clear screen</h3>
<form action="command.php" method="POST"> <form action="command.php" method="POST">
<input type="hidden" name="cmd" value="cls"> <input type="hidden" name="cmd" value="cls">
<button type="submit">Clear</button> <button type="submit">Clear</button>
</form> </form>
</section> </section>
<section> <section>
<h3>Control LED</h3>
<form action="command.php" method="POST"> <form action="command.php" method="POST">
<input type="hidden" name="cmd" value="on"> <input type="hidden" name="cmd" value="on">
<button type="submit">LED On</button> <button type="submit">LED On</button>
@ -37,6 +40,7 @@ $Title = "MAPID-FIFO Web-UI";
</form> </form>
</section> </section>
<section> <section>
<h3>Control display</h3>
<form action="command.php" method="POST"> <form action="command.php" method="POST">
<input type="hidden" name="cmd" value="lcdon"> <input type="hidden" name="cmd" value="lcdon">
<button type="submit">Display On</button> <button type="submit">Display On</button>
@ -47,6 +51,7 @@ $Title = "MAPID-FIFO Web-UI";
</form> </form>
</section> </section>
<section> <section>
<h3>Line selection for output</h3>
<form action="command.php" method="POST"> <form action="command.php" method="POST">
<input type="hidden" name="cmd" value="line"> <input type="hidden" name="cmd" value="line">
<select name="line" height="1"> <select name="line" height="1">
@ -57,12 +62,22 @@ $Title = "MAPID-FIFO Web-UI";
</form> </form>
</section> </section>
<section> <section>
<h3>Single line output</h3>
<form action="command.php" method="POST"> <form action="command.php" method="POST">
<input type="hidden" name="cmd" value="echo"> <input type="hidden" name="cmd" value="echo">
<input type="text" name="text" placeholder="Text"> <input type="text" name="text" placeholder="Text">
<button type="submit">Output</button> <button type="submit">Output</button>
</form> </form>
</section> </section>
<section>
<h3>Multi line output</h3>
<form action="command.php" method="POST">
<input type="hidden" name="cmd" value="echo2">
<input type="text" name="line1" placeholder="Text line 1"><br>
<input type="text" name="line2" placeholder="Text line 2">
<button type="submit">Output</button>
</form>
</section>
</main> </main>
<footer> <footer>
<p><a href="https://git.un-hack-bar.de/malte70/mapid">mapid Git-Repo</a></p> <p><a href="https://git.un-hack-bar.de/malte70/mapid">mapid Git-Repo</a></p>

View file

@ -29,35 +29,36 @@ input, select {
border-radius: 6px; border-radius: 6px;
padding: 6px 14px; padding: 6px 14px;
/*background: #DFDEDF;*/ /*background: #DFDEDF;*/
background: #efefef; background: #efefef;
/*box-shadow: 0px 0.5px 1px rgba(0, 0, 0, 0.1), inset 0px 0.5px 0.5px rgba(255, 255, 255, 0.5), 0px 0px 0px 0.5px rgba(0, 0, 0, 0.12);*/ /*box-shadow: 0px 0.5px 1px rgba(0, 0, 0, 0.1), inset 0px 0.5px 0.5px rgba(255, 255, 255, 0.5), 0px 0px 0px 0.5px rgba(0, 0, 0, 0.12);*/
color: #6E6D70; color: #6E6D70;
display: inline-block; display: inline-block;
margin-right: .5em; margin-right: .5em;
margin-bottom: .5em;
} }
/* https://getcssscan.com/css-buttons-examples */ /* https://getcssscan.com/css-buttons-examples */
button { button {
/*display: flex; /*display: flex;
flex-direction: column; flex-direction: column;
align-items: center;*/ align-items: center;*/
padding: 6px 14px; padding: 6px 14px;
font-family: -apple-system, BlinkMacSystemFont, 'Roboto', sans-serif; font-family: -apple-system, BlinkMacSystemFont, 'Roboto', sans-serif;
border-radius: 6px; border-radius: 6px;
border: none; border: none;
background: #6E6D70; background: #6E6D70;
box-shadow: 0px 0.5px 1px rgba(0, 0, 0, 0.1), inset 0px 0.5px 0.5px rgba(255, 255, 255, 0.5), 0px 0px 0px 0.5px rgba(0, 0, 0, 0.12); box-shadow: 0px 0.5px 1px rgba(0, 0, 0, 0.1), inset 0px 0.5px 0.5px rgba(255, 255, 255, 0.5), 0px 0px 0px 0.5px rgba(0, 0, 0, 0.12);
color: #DFDEDF; color: #DFDEDF;
user-select: none; user-select: none;
-webkit-user-select: none; -webkit-user-select: none;
touch-action: manipulation; touch-action: manipulation;
} }
button:focus { button:focus {
box-shadow: inset 0px 0.8px 0px -0.25px rgba(255, 255, 255, 0.2), 0px 0.5px 1px rgba(0, 0, 0, 0.1), 0px 0px 0px 3.5px rgba(58, 108, 217, 0.5); box-shadow: inset 0px 0.8px 0px -0.25px rgba(255, 255, 255, 0.2), 0px 0.5px 1px rgba(0, 0, 0, 0.1), 0px 0px 0px 3.5px rgba(58, 108, 217, 0.5);
outline: 0; outline: 0;
} }
a:link, a:visited { a:link, a:visited {