Skip to content

Commit

Permalink
Merge pull request #154 from Lordede/BugFix
Browse files Browse the repository at this point in the history
Vallah gut diese
  • Loading branch information
cem-dev authored Jun 30, 2022
2 parents 4e01cfc + 1f5c1bc commit ad188d0
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 50 deletions.
29 changes: 0 additions & 29 deletions WebContent/JavaScript/Administration.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,32 +189,3 @@ function listAllExercises(jsonString) {
//exercise.image = exercise.image;
});
}
/**
* Zur erstellung von neuen Exercises können hier Parameter ausgewählt werden, welche dann in die Datenbank übernommen werden.
* Dabei wir die FormData methode verwendet, welche in der lage ist verschiedene Input-Typen an den Server zu übermitteln.
*/
function createNewExercise() {

let inputImage = document.querySelector("#image");
let buttonSubmission = document.querySelector("#submitExercise");
let inputName = document.querySelector(".nameExercise");
let idListOfRadioBox = ['c1', 'c2', 'c3', 'c4', 'c5'];
idListOfRadioBox.forEach(listItem => {
let radioBox = document.getElementById(listItem);
if (!inputName) {
alert("keine gültige Eingaben");
}

if (!radioBox.value) {
let formData = new FormData();
formData.append("exerciseName=", inputName.value);
formData.append("muscleGroup", radioBox.value);
formData.append("image", inputImage.files[0]);
fetch("ExerciseServlet",
{
method: "POST",
body: formData
});
}
});
}
10 changes: 1 addition & 9 deletions WebContent/JavaScript/TrainingSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ function onExerciseClick(exercise) {
var check = document.getElementsByName(exercise.name);
if (check.length === 0) {
addExercise(exercise, false); // HTML DOM Manipulation

var headerElement = document.getElementsByTagName("header");
var trainingId = headerElement[0].id;
console.log(trainingId);
Expand All @@ -74,15 +75,6 @@ function onExerciseClick(exercise) {
);
xmlhttpExerciseToTraining.send();
}
// var xmlhttp = new XMLHttpRequest();
// xmlhttp.open("GET", "../ExerciseServlet?selectedExercise="+exercise.id, true);
// xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
// xmlhttp.send();

// var insertableSearchbar = document.getElementById("searchBar");
// insertableSearchbar.setAttribute("type", "hidden");
// var searchItems = document.getElementById("searchResultContainer");
// searchItems.style.display = "none";
}

// Laden der zum Training hinterlegten Übungen zur Ansicht als json
Expand Down
10 changes: 5 additions & 5 deletions WebContent/html/accountSetting.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
method="post" accept-charset="utf-8">
<p>Ihr aktueller Username ist:</p>
<p>${userData.username}</p>
<input type="text" name="changeUsername" size="30" maxlength="35" minlength="3"><br>
<input type="text" name="changeUsername" size="30" maxlength="35" minlength="3" required><br>
<Button type="submit" value="changeUsername">Benutzernamen
ändern</Button>
</form>
Expand All @@ -50,7 +50,7 @@
accept-charset="utf-8">
<label for="changeFirstName"> Vorname: ${userData.firstName}</label><br>
<input type="text" size="30" id="changeFirstName"
name="changeFirstName" maxlength="35" minlength="3"><br>
name="changeFirstName" maxlength="35" minlength="3" required><br>
<Button value="changeFirstName" type="submit">Vornamen
ändern</Button>
<br>
Expand All @@ -59,7 +59,7 @@
accept-charset="utf-8">
<label for="changeLastName">Nachname: ${userData.lastName}</label><br>
<input type="text" size="30" id="changeLastName"
name="changeLastName" maxlength="35" minlength="3"><br>
name="changeLastName" maxlength="35" minlength="3" required><br>
<Button value="changeLastName" type="submit">Nachnamen
ändern</Button>
</form>
Expand All @@ -69,7 +69,7 @@
accept-charset="utf-8">
<label for="password">Passwort: </label><br> <input
type="password" id="password" name="password" size="30"
maxlength="35" minlength="3"><br>
maxlength="35" minlength="3" required><br>
<Button type="submit" name="password" value="password"
formaction="../UserUpdateServlet" formmethod="post">
Passwort ändern</Button>
Expand All @@ -80,7 +80,7 @@
accept-charset="utf-8">
<label for="changeMail"> E-Mail: ${userData.eMail}</label><br>
<input type="email" id="changeMail" name="changeMail" size="30"
maxlength="35" minlength="5"><br>
maxlength="35" minlength="5" required><br>
<Button type="submit" value="changeMail">
<!-- formaction="../UserUpdateServlet" formmethod="post"> -->
E-Mail ändern
Expand Down
11 changes: 4 additions & 7 deletions WebContent/html/administrationInterface.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@
accept-charset="utf-8" enctype="multipart/form-data">
<div class="nameExercise">
<p>Name der Übung:</p>
<input type="text" name="exerciseName" size="30" maxlength="50"><br>
<input type="text" name="exerciseName" size="30" maxlength="50" required><br>
</div>
<div>
<fieldset>
<legend>Muskelgruppe wählen: </legend>
<input type="radio" name="muscleGroup" value="Beinmuskulatur" id="c1">
<input type="radio" name="muscleGroup" value="Beinmuskulatur" id="c1" required>
<label for="c1">Beinmuskulatur</label>
<input type="radio" name="muscleGroup" value="Rückenmuskulatur" id="c2">
<label for="c2">Rückenmuskulatur</label>
Expand Down Expand Up @@ -93,13 +93,10 @@
</div>
<script>
document.addEventListener("DOMContentLoaded", init);
window.onload = function(){
function init() {
readExercises();
readUsers();
};
function init() {
}
Expand Down
3 changes: 3 additions & 0 deletions WebContent/html/success.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
alt="Bild der Übung" width="180" height="180">
</div>

<form>
<button formaction="administrationInterface.jsp">Zurück zur Adminverwaltung</button>
</form>
</body>
</html>

0 comments on commit ad188d0

Please sign in to comment.