Skip to content

Commit

Permalink
fixed remaining redirects and providing universal working path
Browse files Browse the repository at this point in the history
  • Loading branch information
panuozzo77 committed Jan 8, 2024
1 parent fbfb818 commit d75bc8e
Show file tree
Hide file tree
Showing 9 changed files with 177 additions and 17 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@
<dependency>
<groupId>info.debatty</groupId>
<artifactId>java-string-similarity</artifactId>
<version>RELEASE</version>
<version>LATEST</version>
</dependency>

</dependencies>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/controller/ExerciseController.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response)
String id = request.getParameter("exerciseID");
String insertionDate = request.getParameter("insertionDate");
request.getSession().setAttribute("insertionDate", Date.valueOf(insertionDate));
request.getSession().setAttribute("exerciseId", id);
request.getSession().setAttribute("exerciseID", Integer.parseInt(id));

ExerciseGlossary ex = em.getExercise(Integer.parseInt(id));
request.getSession().setAttribute("exercise", ex);
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/model/service/exercise/SpeechRecognition.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ public String generateFile(InputStream inputAudio) throws IOException {
}
}
//Ottieni il path dell'output basandoti sul file creato
Path outputPath = Paths.get(tempFile.getPath()).getParent();
String path = outputPath.toString() + "\\outputJava.wav";
Path outputPath = Paths.get(tempFile.getPath()).getParent().resolve("outputJava.wav");
String path = outputPath.toString();

//Controlla che non esista già un file
try {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/model/service/registration/Registration.java
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public boolean invitePatient(int therapistId, String patientEmail, String patien

String pin = la.generatePin(therapistId);
if(pin!=null){
String body = "Salve "+ patientSurname+ " " + patientName + ". Il tuo logopedista ti ha invitato a TalkAid! Ecco il tuo codice per registrarti a TalkAid: "+ pin;
String body = "Salve "+ patientSurname+ " " + patientName + "\n. il tuo logopedista ti ha invitato a TalkAID! Ecco il tuo codice per registrarti al sito: "+ pin;

tool.sendEmail(patientEmail, "Sei stato invitato a TalkAID!", body);
return true;
Expand Down
127 changes: 127 additions & 0 deletions src/main/webapp/CSS/invitePatient.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
* {
margin: 0;
padding: 0;
font-family: Georgia, sans-serif;
}

body {
height: 100%;
width: 100%;
display: flex;
flex-direction: column;
}

a {
color: #199a8e;
text-decoration: none;
font-size: 13px;
}

/* Aggiunta di stili per il pop-up */
#InvitePopupOverlay {
display: none;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.5);
z-index: 1000;
justify-content: center;
align-items: center;
}

#InvitePage {
width: 154px;
background-color: #fff;
padding: 80px;
border-radius: 10px;
text-align: center;
position: fixed;
top: 43%;
left: 50%;
transform: translate(-50%, -50%);
z-index: 1001;
border: 2px solid #000;
}


.homeTherapistOverlay {
transition: opacity 0.3s ease;
}

#InvitePopupOverlay.visible .homeTherapistOverlay {
opacity: 0.5;
}

#InviteTitle{
margin-top: -16%;
font-size: 20px;;
}


#InviteForm{
margin-top: 5%;
width: 70%;
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
}

.inputDiv{
width: 217%;
display: flex;
flex-direction: row;
justify-content: space-between;
background-color: #f9fafb;
border: 2px solid #e8eaed;
border-radius: 500px;
margin-bottom: -1%;
}

.icon{
display: flex;
justify-content: center;
align-items: center;
text-align: center;
width: 10%;
}

.iconLeft{
margin-left: 3%;
}



.icon > img{
width: 50%;
}

.formInput{
padding: 5% 7%;
height: 90%;
width: 80%;
border: none;
border-radius: 27px;
background-color: #f9fafb;
font-size: 15px;
}

.formInput:focus{
border: none;
outline: none;
}


#InviteButton{
color: white;
width: 100%;
background-color: #199a8e;
border: none;
padding: 5% 10%;
border-radius: 500px;
margin-bottom: 20px;
display: inline-block;
font-size: 21px;
}
11 changes: 7 additions & 4 deletions src/main/webapp/JS/exercise.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ const IMAGESINAROW = 2
const exerciseInfo = $("#exerciseInfo");

const EXERCISETYPE = exerciseInfo.data("type");
const EXERCISEID = exerciseInfo.data("exerciseId");
const USERTYPE = exerciseInfo.data("userType");
const USERID = exerciseInfo.data("userId");
const EXERCISEID = exerciseInfo.data("exerciseid");
const USERTYPE = exerciseInfo.data("usertype");
const USERID = exerciseInfo.data("userid");

const exerciseDiv = $("#exerciseDiv");

Expand Down Expand Up @@ -122,10 +122,13 @@ function parseJSON(json) {
//Gestione redirect
function redirect(where){
if (where === "home"){
console.log("sono a home"); //TODO rimuovi!!
if (USERTYPE === "patient"){
console.log("sono a patient"); //TODO rimuovi!!
window.location.href = "homePagePatient.jsp";
}else if (USERTYPE === "therapist"){
window.location.href = "homepagelogopedist.jsp";
console.log("sono a therapist"); //TODO rimuovi!!
window.location.href = "homeTherapist.jsp";
}
}
else{
Expand Down
35 changes: 35 additions & 0 deletions src/main/webapp/JS/homeTherapist.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
//search bar for name and surname
$(document).ready(function () {
var tableContainer = document.getElementById('tableContainer');

// Aggiungi un gestore di eventi all'input di ricerca
$('#searchInput').on('input', function () {
var searchText = $(this).val().toLowerCase();

// Nascondi tutte le righe
tableContainer.getElementsByTagName('tbody')[0].style.marginTop = '0';

// Filtra e mostra solo le righe che corrispondono alla ricerca
$('tbody tr').each(function () {
var name = $(this).find('td:eq(1)').text().toLowerCase();
var lastName = $(this).find('td:eq(2)').text().toLowerCase();

if (name.includes(searchText) || lastName.includes(searchText)) {
$(this).show();
} else {
$(this).hide();
}
});
});
});
/*POPUP INVITE PATIENT*/
function openInvitePopup() {
document.getElementById("invitePopup").style.display = "block";
}
function InvitePatient(){
window.location.href = "invitePatient.jsp";
}
/*VIEW PATIENT*/
function viewPatient(i){
window.location.href = "viewPatient.jsp?patientID="+i;
}
2 changes: 0 additions & 2 deletions src/main/webapp/JSP/homeTherapist.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@
<!-- </form> -->
<%
}
} else {
response.sendRedirect("../errorPage/403.html");
}
%>
</tbody>
Expand Down
9 changes: 3 additions & 6 deletions src/main/webapp/JSP/invitePatient.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
</head>
<body>
<%
if(session.getAttribute("type")!=null && session.getAttribute("type").equals("therapist")){
if(session.getAttribute("type")==null || !session.getAttribute("type").equals("therapist")) {
response.sendRedirect("../errorPage/403.html");
}
%>
<div id="InvitePage">
<div id="InviteTitle">
Expand Down Expand Up @@ -40,10 +42,5 @@
</form>
</div>
<link rel="stylesheet" href="../CSS/invitePatient.css">
<%
}else {
response.sendRedirect("../errorPage/403.html");
}
%>
</body>
</html>

0 comments on commit d75bc8e

Please sign in to comment.