Compare commits

...

6 Commits

18 changed files with 352 additions and 186 deletions

View File

@ -30,6 +30,8 @@ import fr.geoffrey.medical_training_tracker.config.encoder.Encoder;
import fr.geoffrey.medical_training_tracker.controller.IndexController;
import fr.geoffrey.medical_training_tracker.dao.bean.User;
import fr.geoffrey.medical_training_tracker.dao.IUserDao;
import org.springframework.security.web.authentication.rememberme.InMemoryTokenRepositoryImpl;
import org.springframework.security.web.authentication.rememberme.PersistentTokenRepository;
@Configuration
@EnableWebSecurity
@ -103,16 +105,7 @@ public class SecSecurityConfig extends WebSecurityConfigurerAdapter {
public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response,
Authentication authentication) throws IOException, ServletException {
HttpSession httpSession = request.getSession();
httpSession.setAttribute(IndexController.SESSION_ATTRIBUTE_AUTHENTICATION, authentication);
// Object oUserDetails = authentication.getPrincipal();
// if (oUserDetails instanceof UserDetails) {
// UserDetails userDetails = (UserDetails) oUserDetails;
// }
response.setStatus(HttpServletResponse.SC_FOUND);
response.setHeader("Location", request.getRequestURL().toString().replaceAll(IndexController.URL_LOGIN, IndexController.URL_ANIMAL_LIST));
_onAuthenticationSuccess(request, response, authentication);
}
})
.failureHandler(new AuthenticationFailureHandler() {
@ -131,6 +124,7 @@ public class SecSecurityConfig extends WebSecurityConfigurerAdapter {
.and()
// Logout authentification interne
.logout()
.deleteCookies("JSESSIONID")
.logoutUrl(IndexController.URL_LOGOUT)
.logoutSuccessHandler(new LogoutSuccessHandler() {
@Override
@ -138,13 +132,23 @@ public class SecSecurityConfig extends WebSecurityConfigurerAdapter {
throws IOException, ServletException {
// HttpSession httpSession = request.getSession();
response.setStatus(HttpServletResponse.SC_FOUND);
response.setHeader("Location", request.getRequestURL().toString().replaceAll(IndexController.URL_LOGOUT.substring(1), ""));
}
})
.invalidateHttpSession(true)
.and()
.rememberMe().key("uniqueAndSecret")
.tokenValiditySeconds(86400)
.authenticationSuccessHandler(new AuthenticationSuccessHandler() {
@Override
public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response,
Authentication authentication) throws IOException, ServletException {
_onAuthenticationSuccess(request, response, authentication);
}
})
.and()
.exceptionHandling();
}
@ -152,4 +156,14 @@ public class SecSecurityConfig extends WebSecurityConfigurerAdapter {
public PasswordEncoder passwordEncoder() {
return Encoder.getInstance();
}
private void _onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response,
Authentication authentication) {
HttpSession httpSession = request.getSession();
httpSession.setAttribute(IndexController.SESSION_ATTRIBUTE_AUTHENTICATION, authentication);
response.setStatus(HttpServletResponse.SC_FOUND);
response.setHeader("Location", request.getRequestURL().toString().replaceAll(IndexController.URL_LOGIN, IndexController.URL_ANIMAL_LIST));
}
}

View File

@ -91,7 +91,7 @@ public class AnimalDao extends PostgresSqlDao implements IAnimalDao {
ResultSet resultSet = null;
try {
conn = mDataSource.getConnection();
statement = conn.prepareStatement("SELECT * FROM "+TABLE_NAME+" WHERE owner = ?;");
statement = conn.prepareStatement("SELECT * FROM "+TABLE_NAME+" WHERE owner = ? ORDER BY name ASC;");
statement.setString(1, owner);
System.out.println(IndexController.LOG_TAG + " SQL -> " + statement.toString());
resultSet = statement.executeQuery();

View File

@ -43,7 +43,7 @@ public class CareDao extends PostgresSqlDao implements ICareDao {
+ TABLE_NAME+".id as care_id, "+TABLE_NAME+".name as care_name, "+TABLE_NAME+".description as care_desc "
+ "from "+TABLE_NAME+" "
+ "left join "+AnimalDao.TABLE_NAME+" on "+TABLE_NAME+".animal = "+AnimalDao.TABLE_NAME+".id "
+ "where "+AnimalDao.TABLE_NAME+".owner = ? and "+AnimalDao.TABLE_NAME+".id = ?;");
+ "where "+AnimalDao.TABLE_NAME+".owner = ? and "+AnimalDao.TABLE_NAME+".id = ? ORDER BY "+TABLE_NAME+".name ASC;");
statement.setString(1, owner);
statement.setInt(2, animalId);
System.out.println(IndexController.LOG_TAG + " SQL -> " + statement.toString());

View File

@ -43,7 +43,7 @@ public class ConsentBehaviorDao extends PostgresSqlDao implements IConsentBehavi
+ TABLE_NAME+".id as cb_id, "+TABLE_NAME+".name as cb_name, "+TABLE_NAME+".description as cb_desc "
+ "from "+TABLE_NAME+" "
+ "left join "+AnimalDao.TABLE_NAME+" on "+TABLE_NAME+".animal = "+AnimalDao.TABLE_NAME+".id "
+ "where "+AnimalDao.TABLE_NAME+".owner = ? and "+AnimalDao.TABLE_NAME+".id = ?;");
+ "where "+AnimalDao.TABLE_NAME+".owner = ? and "+AnimalDao.TABLE_NAME+".id = ? ORDER BY "+TABLE_NAME+".name ASC;");
statement.setString(1, owner);
statement.setInt(2, animalId);
System.out.println(IndexController.LOG_TAG + " SQL -> " + statement.toString());

View File

@ -116,7 +116,7 @@ public class ProgressionDao extends PostgresSqlDao implements IProgressionDao {
+ "from "+TABLE_NAME+" "
+ "left join "+AnimalDao.TABLE_NAME+" on "+TABLE_NAME+".animal = "+AnimalDao.TABLE_NAME+".id "
+ "left join "+ConsentBehaviorDao.TABLE_NAME+" on "+TABLE_NAME+".consent_behavior = "+ConsentBehaviorDao.TABLE_NAME+".id "
+ "where "+AnimalDao.TABLE_NAME+".owner = ? and "+AnimalDao.TABLE_NAME+".id = ? and "+TABLE_NAME+".care = ?;");
+ "where "+AnimalDao.TABLE_NAME+".owner = ? and "+AnimalDao.TABLE_NAME+".id = ? and "+TABLE_NAME+".care = ? ORDER BY "+ConsentBehaviorDao.TABLE_NAME+".name ASC;");
statement.setString(1, animal.getOwner());
statement.setInt(2, animal.getId());
statement.setInt(3, careId);
@ -193,7 +193,7 @@ public class ProgressionDao extends PostgresSqlDao implements IProgressionDao {
+ "from "+TABLE_NAME+" "
+ "left join "+AnimalDao.TABLE_NAME+" on "+TABLE_NAME+".animal = "+AnimalDao.TABLE_NAME+".id "
+ "left join "+CareDao.TABLE_NAME+" on "+TABLE_NAME+".care = "+CareDao.TABLE_NAME+".id "
+ "where "+AnimalDao.TABLE_NAME+".owner = ? and "+AnimalDao.TABLE_NAME+".id = ? and "+TABLE_NAME+".consent_behavior = ?;");
+ "where "+AnimalDao.TABLE_NAME+".owner = ? and "+AnimalDao.TABLE_NAME+".id = ? and "+TABLE_NAME+".consent_behavior = ? ORDER BY "+CareDao.TABLE_NAME+".name ASC;");
statement.setString(1, animal.getOwner());
statement.setInt(2, animal.getId());
statement.setInt(3, consentBehaviorId);

View File

@ -5,6 +5,7 @@ import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
import java.util.TreeSet;
/**
*
@ -89,11 +90,13 @@ public class Animal {
}
public Collection<Care> getListCares() {
return mapCares.values();
return new TreeSet<>(mapCares.values());
// return mapCares.values();
}
public Collection<ConsentBehavior> getListConsentBehavior() {
return mapConsentBehavior.values();
return new TreeSet<>(mapConsentBehavior.values());
// return mapConsentBehavior.values();
}
public void addProgression(Progression progression) {

View File

@ -4,7 +4,7 @@ package fr.geoffrey.medical_training_tracker.dao.bean;
*
* @author Geoffrey
*/
public class Care {
public class Care implements Comparable<Care>{
private int id;
private String name;
@ -58,4 +58,9 @@ public class Care {
}
return true;
}
@Override
public int compareTo(Care o) {
return name.compareTo(o.name);
}
}

View File

@ -4,7 +4,7 @@ package fr.geoffrey.medical_training_tracker.dao.bean;
*
* @author Geoffrey
*/
public class ConsentBehavior {
public class ConsentBehavior implements Comparable<ConsentBehavior> {
private int id;
private String name;
@ -58,4 +58,9 @@ public class ConsentBehavior {
}
return true;
}
@Override
public int compareTo(ConsentBehavior o) {
return name.compareTo(o.name);
}
}

View File

@ -9,6 +9,7 @@ public class Progression {
public static final String PROGRESSION_VALUE_NOT_TRAINED = "NOT_TRAINED";
public static final String PROGRESSION_VALUE_CURRENTLY_TRAINING = "CURRENTLY_TRAINING";
public static final String PROGRESSION_VALUE_TRAINED = "TRAINED";
public static final String PROGRESSION_VALUE_NOT_USED = "NOT_USED";
private int id;
private ConsentBehavior consentBehavior;
@ -54,6 +55,9 @@ public class Progression {
case PROGRESSION_VALUE_TRAINED:
progressionByMe = PROGRESSION_VALUE_TRAINED;
break;
case PROGRESSION_VALUE_NOT_USED:
progressionByMe = PROGRESSION_VALUE_NOT_USED;
break;
default:
progressionByMe = PROGRESSION_VALUE_NOT_TRAINED;
break;
@ -74,6 +78,9 @@ public class Progression {
case PROGRESSION_VALUE_TRAINED:
progressionBySomeoneElse = PROGRESSION_VALUE_TRAINED;
break;
case PROGRESSION_VALUE_NOT_USED:
progressionBySomeoneElse = PROGRESSION_VALUE_NOT_USED;
break;
default:
progressionBySomeoneElse = PROGRESSION_VALUE_NOT_TRAINED;
break;
@ -94,6 +101,9 @@ public class Progression {
case PROGRESSION_VALUE_TRAINED:
progressionByVeterinary = PROGRESSION_VALUE_TRAINED;
break;
case PROGRESSION_VALUE_NOT_USED:
progressionByVeterinary = PROGRESSION_VALUE_NOT_USED;
break;
default:
progressionByVeterinary = PROGRESSION_VALUE_NOT_TRAINED;
break;

View File

@ -112,3 +112,17 @@ register.placeholder.login=Username
register.placeholder.password=Password
register.placeholder.password_check=Password
register.title=Sign up
progression.value.NOT_USED=Not usefull
authentication.remember_me=Remember me
navbar.progression.by_me.NOT_TRAINED=By me - Not trained
navbar.progression.by_me.CURRENTLY_TRAINING=By me - Currently training
navbar.progression.by_me.TRAINED=By me - Done
navbar.progression.by_me.NOT_USED=By me - Not usefull
navbar.progression.by_someone_else.NOT_TRAINED=By someone else - Not trained
navbar.progression.by_someone_else.CURRENTLY_TRAINING=By someone else - Currently training
navbar.progression.by_someone_else.TRAINED=By someone else - Done
navbar.progression.by_someone_else.NOT_USED=By someone else - Not usefull
navbar.progression.by_veterinary.NOT_TRAINED=By veterinary - Not trained
navbar.progression.by_veterinary.CURRENTLY_TRAINING=By veterinary - Currently training
navbar.progression.by_veterinary.TRAINED=By veterinary - Done
navbar.progression.by_veterinary.NOT_USED=By veterinary - Not usefull

View File

@ -112,3 +112,17 @@ register.placeholder.login=Username
register.placeholder.password=Password
register.placeholder.password_check=Password
register.title=Sign up
progression.value.NOT_USED=Not usefull
authentication.remember_me=Remember me
navbar.progression.by_me.NOT_TRAINED=By me - Not trained
navbar.progression.by_me.CURRENTLY_TRAINING=By me - Currently training
navbar.progression.by_me.TRAINED=By me - Done
navbar.progression.by_me.NOT_USED=By me - Not usefull
navbar.progression.by_someone_else.NOT_TRAINED=By someone else - Not trained
navbar.progression.by_someone_else.CURRENTLY_TRAINING=By someone else - Currently training
navbar.progression.by_someone_else.TRAINED=By someone else - Done
navbar.progression.by_someone_else.NOT_USED=By someone else - Not usefull
navbar.progression.by_veterinary.NOT_TRAINED=By veterinary - Not trained
navbar.progression.by_veterinary.CURRENTLY_TRAINING=By veterinary - Currently training
navbar.progression.by_veterinary.TRAINED=By veterinary - Done
navbar.progression.by_veterinary.NOT_USED=By veterinary - Not usefull

View File

@ -112,3 +112,17 @@ register.placeholder.login=Nom d'utilisateur
register.placeholder.password=Mot de passe
register.placeholder.password_check=Mot de passe
register.title=Cr\u00e9ation du compte
progression.value.NOT_USED=Non utile
authentication.remember_me=Se souvenir de moi
navbar.progression.by_me.NOT_TRAINED=Par moi - Non entrainn\u00e9
navbar.progression.by_me.CURRENTLY_TRAINING=Par moi - En cours
navbar.progression.by_me.TRAINED=Par moi - Fait
navbar.progression.by_me.NOT_USED=Par moi - Non utile
navbar.progression.by_someone_else.NOT_TRAINED=Par quelqu'un d'autre - Non entrainn\u00e9
navbar.progression.by_someone_else.CURRENTLY_TRAINING=Par quelqu'un d'autre - En cours
navbar.progression.by_someone_else.TRAINED=Par quelqu'un d'autre - Fait
navbar.progression.by_someone_else.NOT_USED=Par quelqu'un d'autre - Non utile
navbar.progression.by_veterinary.NOT_TRAINED=Par le v\u00e9t\u00e9rinaire - Non entrainn\u00e9
navbar.progression.by_veterinary.CURRENTLY_TRAINING=Par le v\u00e9t\u00e9rinaire - En cours
navbar.progression.by_veterinary.TRAINED=Par le v\u00e9t\u00e9rinaire - Fait
navbar.progression.by_veterinary.NOT_USED=Par le v\u00e9t\u00e9rinaire - Non utile

View File

@ -45,70 +45,72 @@
</h3>
<p>${MODEL_MAP_ANIMAL.getConsentBehaviorById(MODEL_MAP_ANIMAL_CONSENT_BEHAVIOR_ID).getDescription()}</p>
<table class="table table-hover">
<thead>
<tr>
<th><fmt:message key="animal_behavior.table.care"></fmt:message></th>
<th><fmt:message key="animal_behavior.table.executed_by_me"></fmt:message></th>
<th><fmt:message key="animal_behavior.table.executed_by_someone_else"></fmt:message></th>
<th><fmt:message key="animal_behavior.table.executed_by_veterinary"></fmt:message></th>
<th></th>
</tr>
</thead>
<tbody>
<c:forEach items="${MODEL_MAP_ANIMAL.getProgressionList()}" var="progression">
<div class="table-responsive">
<table class="table table-hover">
<thead>
<tr>
<td><a href="${animalURL}/${MODEL_MAP_ANIMAL.getId()}/care/${progression.getCare().getId()}">${progression.getCare().getName()}</a></td>
<td class="
<c:if test="${progression.getProgressionByMe() == 'TRAINED'}">success</c:if>
<c:if test="${progression.getProgressionByMe() == 'CURRENTLY_TRAINING'}">info</c:if>
<c:if test="${progression.getProgressionByMe() == 'NOT_TRAINED'}">active</c:if>
">
<a href="${animalURL}/${MODEL_MAP_ANIMAL.getId()}/progression_by_me/${progression.getProgressionByMe()}">
<fmt:message key="progression.value.${progression.getProgressionByMe()}"></fmt:message>
</a>
</td>
<td class="
<c:if test="${progression.getProgressionBySomeoneElse() == 'TRAINED'}">success</c:if>
<c:if test="${progression.getProgressionBySomeoneElse() == 'CURRENTLY_TRAINING'}">info</c:if>
<c:if test="${progression.getProgressionBySomeoneElse() == 'NOT_TRAINED'}">active</c:if>
">
<a href="${animalURL}/${MODEL_MAP_ANIMAL.getId()}/progression_by_someone_else/${progression.getProgressionBySomeoneElse()}">
<fmt:message key="progression.value.${progression.getProgressionBySomeoneElse()}"></fmt:message>
</a>
</td>
<td class="
<c:if test="${progression.getProgressionByVeterinary() == 'TRAINED'}">success</c:if>
<c:if test="${progression.getProgressionByVeterinary() == 'CURRENTLY_TRAINING'}">info</c:if>
<c:if test="${progression.getProgressionByVeterinary() == 'NOT_TRAINED'}">active</c:if>
">
<a href="${animalURL}/${MODEL_MAP_ANIMAL.getId()}/progression_by_veterinary/${progression.getProgressionByVeterinary()}">
<fmt:message key="progression.value.${progression.getProgressionByVeterinary()}"></fmt:message>
</a>
</td>
<td>
<form class="pull-right" action="${animalDeleteProgressionURL}/${progression.getId()}" method="POST">
<input value="${progression.getCare().getName()}" hidden />
<label class="sr-only" for="form_page">Page</label>
<input id="form_page" name="page" value="consent_behavior" hidden />
<label class="sr-only" for="form_consent_behavior_id">Consent behavior ID</label>
<input id="form_consent_behavior_id" name="redirect_id" value="${MODEL_MAP_ANIMAL_CONSENT_BEHAVIOR_ID}" hidden />
<button class="btn btn-danger" type="submit" data-toggle="tooltip" data-placement="bottom" title="<fmt:message key="animal_behavior.button.delete.tooltip"></fmt:message>"><span class="glyphicon glyphicon-trash" aria-hidden="true"></span></button>
</form>
<form class="pull-right" action="${animalEditProgressionURL}/${progression.getId()}" method="GET">
<input value="${progression.getCare().getId()}" hidden />
<input value="${progression.getCare().getName()}" hidden />
<input value="${progression.getProgressionByMe()}" hidden />
<input value="${progression.getProgressionBySomeoneElse()}" hidden />
<input value="${progression.getProgressionByVeterinary()}" hidden />
<button class="btn btn-default" type="submit" data-toggle="tooltip" data-placement="bottom" title="<fmt:message key="animal_consent_behavior.button.edit.tooltip"></fmt:message>"><span class="glyphicon glyphicon-edit" aria-hidden="true"></span></button>
</form>
</td>
<th><fmt:message key="animal_behavior.table.care"></fmt:message></th>
<th><fmt:message key="animal_behavior.table.executed_by_me"></fmt:message></th>
<th><fmt:message key="animal_behavior.table.executed_by_someone_else"></fmt:message></th>
<th><fmt:message key="animal_behavior.table.executed_by_veterinary"></fmt:message></th>
<th></th>
</tr>
</c:forEach>
</tbody>
</table>
</thead>
<tbody>
<c:forEach items="${MODEL_MAP_ANIMAL.getProgressionList()}" var="progression">
<tr>
<td><a href="${animalURL}/${MODEL_MAP_ANIMAL.getId()}/care/${progression.getCare().getId()}">${progression.getCare().getName()}</a></td>
<td class="
<c:if test="${progression.getProgressionByMe() == 'TRAINED'}">success</c:if>
<c:if test="${progression.getProgressionByMe() == 'CURRENTLY_TRAINING'}">info</c:if>
<c:if test="${progression.getProgressionByMe() == 'NOT_TRAINED'}">active</c:if>
">
<a href="${animalURL}/${MODEL_MAP_ANIMAL.getId()}/progression_by_me/${progression.getProgressionByMe()}">
<fmt:message key="progression.value.${progression.getProgressionByMe()}"></fmt:message>
</a>
</td>
<td class="
<c:if test="${progression.getProgressionBySomeoneElse() == 'TRAINED'}">success</c:if>
<c:if test="${progression.getProgressionBySomeoneElse() == 'CURRENTLY_TRAINING'}">info</c:if>
<c:if test="${progression.getProgressionBySomeoneElse() == 'NOT_TRAINED'}">active</c:if>
">
<a href="${animalURL}/${MODEL_MAP_ANIMAL.getId()}/progression_by_someone_else/${progression.getProgressionBySomeoneElse()}">
<fmt:message key="progression.value.${progression.getProgressionBySomeoneElse()}"></fmt:message>
</a>
</td>
<td class="
<c:if test="${progression.getProgressionByVeterinary() == 'TRAINED'}">success</c:if>
<c:if test="${progression.getProgressionByVeterinary() == 'CURRENTLY_TRAINING'}">info</c:if>
<c:if test="${progression.getProgressionByVeterinary() == 'NOT_TRAINED'}">active</c:if>
">
<a href="${animalURL}/${MODEL_MAP_ANIMAL.getId()}/progression_by_veterinary/${progression.getProgressionByVeterinary()}">
<fmt:message key="progression.value.${progression.getProgressionByVeterinary()}"></fmt:message>
</a>
</td>
<td>
<form class="pull-right" action="${animalDeleteProgressionURL}/${progression.getId()}" method="POST">
<input value="${progression.getCare().getName()}" hidden />
<label class="sr-only" for="form_page">Page</label>
<input id="form_page" name="page" value="consent_behavior" hidden />
<label class="sr-only" for="form_consent_behavior_id">Consent behavior ID</label>
<input id="form_consent_behavior_id" name="redirect_id" value="${MODEL_MAP_ANIMAL_CONSENT_BEHAVIOR_ID}" hidden />
<button class="btn btn-danger" type="submit" data-toggle="tooltip" data-placement="bottom" title="<fmt:message key="animal_behavior.button.delete.tooltip"></fmt:message>"><span class="glyphicon glyphicon-trash" aria-hidden="true"></span></button>
</form>
<form class="pull-right" action="${animalEditProgressionURL}/${progression.getId()}" method="GET">
<input value="${progression.getCare().getId()}" hidden />
<input value="${progression.getCare().getName()}" hidden />
<input value="${progression.getProgressionByMe()}" hidden />
<input value="${progression.getProgressionBySomeoneElse()}" hidden />
<input value="${progression.getProgressionByVeterinary()}" hidden />
<button class="btn btn-default" type="submit" data-toggle="tooltip" data-placement="bottom" title="<fmt:message key="animal_consent_behavior.button.edit.tooltip"></fmt:message>"><span class="glyphicon glyphicon-edit" aria-hidden="true"></span></button>
</form>
</td>
</tr>
</c:forEach>
</tbody>
</table>
</div>
<hr/>
<h4><fmt:message key="animal_behavior.add_care"></fmt:message></h4>
@ -178,6 +180,7 @@
<option value="NOT_TRAINED"><fmt:message key="progression.value.NOT_TRAINED"></fmt:message></option>
<option value="CURRENTLY_TRAINING"><fmt:message key="progression.value.CURRENTLY_TRAINING"></fmt:message></option>
<option value="TRAINED"><fmt:message key="progression.value.TRAINED"></fmt:message></option>
<option value="NOT_USED"><fmt:message key="progression.value.NOT_USED"></fmt:message></option>
</select>
<label for="modal_edit_consent_behavior_form_progression_by_someone_else"><fmt:message key="animal_behavior.table.executed_by_someone_else"></fmt:message></label>
@ -185,6 +188,7 @@
<option value="NOT_TRAINED"><fmt:message key="progression.value.NOT_TRAINED"></fmt:message></option>
<option value="CURRENTLY_TRAINING"><fmt:message key="progression.value.CURRENTLY_TRAINING"></fmt:message></option>
<option value="TRAINED"><fmt:message key="progression.value.TRAINED"></fmt:message></option>
<option value="NOT_USED"><fmt:message key="progression.value.NOT_USED"></fmt:message></option>
</select>
<label for="modal_edit_consent_behavior_form_progression_by_veterinary"><fmt:message key="animal_behavior.table.executed_by_veterinary"></fmt:message></label>
@ -192,6 +196,7 @@
<option value="NOT_TRAINED"><fmt:message key="progression.value.NOT_TRAINED"></fmt:message></option>
<option value="CURRENTLY_TRAINING"><fmt:message key="progression.value.CURRENTLY_TRAINING"></fmt:message></option>
<option value="TRAINED"><fmt:message key="progression.value.TRAINED"></fmt:message></option>
<option value="NOT_USED"><fmt:message key="progression.value.NOT_USED"></fmt:message></option>
</select>
<input name="page" value="consent_behavior" hidden />

View File

@ -45,70 +45,72 @@
</h3>
<p>${MODEL_MAP_ANIMAL.getCareById(MODEL_MAP_ANIMAL_CARE_ID).getDescription()}</p>
<table class="table table-hover">
<thead>
<tr>
<th><fmt:message key="animal_care.table.behavior"></fmt:message></th>
<th><fmt:message key="animal_care.table.executed_by_me"></fmt:message></th>
<th><fmt:message key="animal_care.table.executed_by_someone_else"></fmt:message></th>
<th><fmt:message key="animal_care.table.executed_by_veterinary"></fmt:message></th>
<th></th>
</tr>
</thead>
<tbody>
<c:forEach items="${MODEL_MAP_ANIMAL.getProgressionList()}" var="progression">
<div class="table-responsive">
<table class="table table-hover">
<thead>
<tr>
<td><a href="${animalURL}/${MODEL_MAP_ANIMAL.getId()}/consent_behavior/${progression.getConsentBehavior().getId()}">${progression.getConsentBehavior().getName()}</a></td>
<td class="
<c:if test="${progression.getProgressionByMe() == 'TRAINED'}">success</c:if>
<c:if test="${progression.getProgressionByMe() == 'CURRENTLY_TRAINING'}">info</c:if>
<c:if test="${progression.getProgressionByMe() == 'NOT_TRAINED'}">active</c:if>
">
<a href="${animalURL}/${MODEL_MAP_ANIMAL.getId()}/progression_by_me/${progression.getProgressionByMe()}">
<fmt:message key="progression.value.${progression.getProgressionByMe()}"></fmt:message>
</a>
</td>
<td class="
<c:if test="${progression.getProgressionBySomeoneElse() == 'TRAINED'}">success</c:if>
<c:if test="${progression.getProgressionBySomeoneElse() == 'CURRENTLY_TRAINING'}">info</c:if>
<c:if test="${progression.getProgressionBySomeoneElse() == 'NOT_TRAINED'}">active</c:if>
">
<a href="${animalURL}/${MODEL_MAP_ANIMAL.getId()}/progression_by_someone_else/${progression.getProgressionBySomeoneElse()}">
<fmt:message key="progression.value.${progression.getProgressionBySomeoneElse()}"></fmt:message>
</a>
</td>
<td class="
<c:if test="${progression.getProgressionByVeterinary() == 'TRAINED'}">success</c:if>
<c:if test="${progression.getProgressionByVeterinary() == 'CURRENTLY_TRAINING'}">info</c:if>
<c:if test="${progression.getProgressionByVeterinary() == 'NOT_TRAINED'}">active</c:if>
">
<a href="${animalURL}/${MODEL_MAP_ANIMAL.getId()}/progression_by_veterinary/${progression.getProgressionByVeterinary()}">
<fmt:message key="progression.value.${progression.getProgressionByVeterinary()}"></fmt:message>
</a>
</td>
<td>
<form class="pull-right" action="${animalDeleteProgressionURL}/${progression.getId()}" method="POST">
<input value="${progression.getConsentBehavior().getName()}" hidden />
<label class="sr-only" for="form_page">Page</label>
<input id="form_page" name="page" value="care" hidden />
<label class="sr-only" for="form_care_id">Care ID</label>
<input id="form_care_id" name="redirect_id" value="${MODEL_MAP_ANIMAL_CARE_ID}" hidden />
<button class="btn btn-danger" type="submit" data-toggle="tooltip" data-placement="bottom" title="<fmt:message key="animal_care.button.delete.tooltip"></fmt:message>"><span class="glyphicon glyphicon-trash" aria-hidden="true"></span></button>
</form>
<form class="pull-right" action="${animalEditProgressionURL}/${progression.getId()}" method="GET">
<input value="${progression.getConsentBehavior().getId()}" hidden />
<input value="${progression.getConsentBehavior().getName()}" hidden />
<input value="${progression.getProgressionByMe()}" hidden />
<input value="${progression.getProgressionBySomeoneElse()}" hidden />
<input value="${progression.getProgressionByVeterinary()}" hidden />
<button class="btn btn-default" type="submit" data-toggle="tooltip" data-placement="bottom" title="<fmt:message key="animal_care.button.edit.tooltip"></fmt:message>"><span class="glyphicon glyphicon-edit" aria-hidden="true"></span></button>
</form>
</td>
<th><fmt:message key="animal_care.table.behavior"></fmt:message></th>
<th><fmt:message key="animal_care.table.executed_by_me"></fmt:message></th>
<th><fmt:message key="animal_care.table.executed_by_someone_else"></fmt:message></th>
<th><fmt:message key="animal_care.table.executed_by_veterinary"></fmt:message></th>
<th></th>
</tr>
</c:forEach>
</tbody>
</table>
</thead>
<tbody>
<c:forEach items="${MODEL_MAP_ANIMAL.getProgressionList()}" var="progression">
<tr>
<td><a href="${animalURL}/${MODEL_MAP_ANIMAL.getId()}/consent_behavior/${progression.getConsentBehavior().getId()}">${progression.getConsentBehavior().getName()}</a></td>
<td class="
<c:if test="${progression.getProgressionByMe() == 'TRAINED'}">success</c:if>
<c:if test="${progression.getProgressionByMe() == 'CURRENTLY_TRAINING'}">info</c:if>
<c:if test="${progression.getProgressionByMe() == 'NOT_TRAINED'}">active</c:if>
">
<a href="${animalURL}/${MODEL_MAP_ANIMAL.getId()}/progression_by_me/${progression.getProgressionByMe()}">
<fmt:message key="progression.value.${progression.getProgressionByMe()}"></fmt:message>
</a>
</td>
<td class="
<c:if test="${progression.getProgressionBySomeoneElse() == 'TRAINED'}">success</c:if>
<c:if test="${progression.getProgressionBySomeoneElse() == 'CURRENTLY_TRAINING'}">info</c:if>
<c:if test="${progression.getProgressionBySomeoneElse() == 'NOT_TRAINED'}">active</c:if>
">
<a href="${animalURL}/${MODEL_MAP_ANIMAL.getId()}/progression_by_someone_else/${progression.getProgressionBySomeoneElse()}">
<fmt:message key="progression.value.${progression.getProgressionBySomeoneElse()}"></fmt:message>
</a>
</td>
<td class="
<c:if test="${progression.getProgressionByVeterinary() == 'TRAINED'}">success</c:if>
<c:if test="${progression.getProgressionByVeterinary() == 'CURRENTLY_TRAINING'}">info</c:if>
<c:if test="${progression.getProgressionByVeterinary() == 'NOT_TRAINED'}">active</c:if>
">
<a href="${animalURL}/${MODEL_MAP_ANIMAL.getId()}/progression_by_veterinary/${progression.getProgressionByVeterinary()}">
<fmt:message key="progression.value.${progression.getProgressionByVeterinary()}"></fmt:message>
</a>
</td>
<td>
<form class="pull-right" action="${animalDeleteProgressionURL}/${progression.getId()}" method="POST">
<input value="${progression.getConsentBehavior().getName()}" hidden />
<label class="sr-only" for="form_page">Page</label>
<input id="form_page" name="page" value="care" hidden />
<label class="sr-only" for="form_care_id">Care ID</label>
<input id="form_care_id" name="redirect_id" value="${MODEL_MAP_ANIMAL_CARE_ID}" hidden />
<button class="btn btn-danger" type="submit" data-toggle="tooltip" data-placement="bottom" title="<fmt:message key="animal_care.button.delete.tooltip"></fmt:message>"><span class="glyphicon glyphicon-trash" aria-hidden="true"></span></button>
</form>
<form class="pull-right" action="${animalEditProgressionURL}/${progression.getId()}" method="GET">
<input value="${progression.getConsentBehavior().getId()}" hidden />
<input value="${progression.getConsentBehavior().getName()}" hidden />
<input value="${progression.getProgressionByMe()}" hidden />
<input value="${progression.getProgressionBySomeoneElse()}" hidden />
<input value="${progression.getProgressionByVeterinary()}" hidden />
<button class="btn btn-default" type="submit" data-toggle="tooltip" data-placement="bottom" title="<fmt:message key="animal_care.button.edit.tooltip"></fmt:message>"><span class="glyphicon glyphicon-edit" aria-hidden="true"></span></button>
</form>
</td>
</tr>
</c:forEach>
</tbody>
</table>
</div>
<hr/>
<h4><fmt:message key="animal_care.add_behavior"></fmt:message></h4>
@ -177,6 +179,7 @@
<option value="NOT_TRAINED"><fmt:message key="progression.value.NOT_TRAINED"></fmt:message></option>
<option value="CURRENTLY_TRAINING"><fmt:message key="progression.value.CURRENTLY_TRAINING"></fmt:message></option>
<option value="TRAINED"><fmt:message key="progression.value.TRAINED"></fmt:message></option>
<option value="NOT_USED"><fmt:message key="progression.value.NOT_USED"></fmt:message></option>
</select>
<label for="modal_edit_consent_behavior_form_progression_by_someone_else"><fmt:message key="animal_care.table.executed_by_someone_else"></fmt:message></label>
@ -184,6 +187,7 @@
<option value="NOT_TRAINED"><fmt:message key="progression.value.NOT_TRAINED"></fmt:message></option>
<option value="CURRENTLY_TRAINING"><fmt:message key="progression.value.CURRENTLY_TRAINING"></fmt:message></option>
<option value="TRAINED"><fmt:message key="progression.value.TRAINED"></fmt:message></option>
<option value="NOT_USED"><fmt:message key="progression.value.NOT_USED"></fmt:message></option>
</select>
<label for="modal_edit_consent_behavior_form_progression_by_veterinary"><fmt:message key="animal_care.table.executed_by_veterinary"></fmt:message></label>
@ -191,6 +195,7 @@
<option value="NOT_TRAINED"><fmt:message key="progression.value.NOT_TRAINED"></fmt:message></option>
<option value="CURRENTLY_TRAINING"><fmt:message key="progression.value.CURRENTLY_TRAINING"></fmt:message></option>
<option value="TRAINED"><fmt:message key="progression.value.TRAINED"></fmt:message></option>
<option value="NOT_USED"><fmt:message key="progression.value.NOT_USED"></fmt:message></option>
</select>
<input name="page" value="care" hidden />

View File

@ -36,26 +36,28 @@
</fmt:message>
</h1></center>
<h4><fmt:message key="progression.${MODEL_MAP_PROGRESSION_TYPE}"></fmt:message> - <fmt:message key="progression.value.${MODEL_MAP_PROGRESSION}"></fmt:message></h4>
<table class="table table-hover">
<thead>
<tr>
<th><fmt:message key="progression.table.column.care"></fmt:message></th>
<th><fmt:message key="progression.table.column.behavior"></fmt:message></th>
</tr>
</thead>
<tbody>
<c:forEach items="${MODEL_MAP_ANIMAL.getProgressionList()}" var="progression">
<tr class="
<c:if test="${MODEL_MAP_PROGRESSION == 'TRAINED'}">success</c:if>
<c:if test="${MODEL_MAP_PROGRESSION == 'CURRENTLY_TRAINING'}">info</c:if>
<c:if test="${MODEL_MAP_PROGRESSION == 'NOT_TRAINED'}">active</c:if>
">
<td><a href="${animalURL}/${MODEL_MAP_ANIMAL.getId()}/care/${progression.getCare().getId()}">${progression.getCare().getName()}</a></td>
<td><a href="${animalURL}/${MODEL_MAP_ANIMAL.getId()}/consent_behavior/${progression.getConsentBehavior().getId()}">${progression.getConsentBehavior().getName()}</a></td>
</tr>
</c:forEach>
</tbody>
</table>
<div class="table-responsive">
<table class="table table-hover">
<thead>
<tr>
<th><fmt:message key="progression.table.column.care"></fmt:message></th>
<th><fmt:message key="progression.table.column.behavior"></fmt:message></th>
</tr>
</thead>
<tbody>
<c:forEach items="${MODEL_MAP_ANIMAL.getProgressionList()}" var="progression">
<tr class="
<c:if test="${MODEL_MAP_PROGRESSION == 'TRAINED'}">success</c:if>
<c:if test="${MODEL_MAP_PROGRESSION == 'CURRENTLY_TRAINING'}">info</c:if>
<c:if test="${MODEL_MAP_PROGRESSION == 'NOT_TRAINED'}">active</c:if>
">
<td><a href="${animalURL}/${MODEL_MAP_ANIMAL.getId()}/care/${progression.getCare().getId()}">${progression.getCare().getName()}</a></td>
<td><a href="${animalURL}/${MODEL_MAP_ANIMAL.getId()}/consent_behavior/${progression.getConsentBehavior().getId()}">${progression.getConsentBehavior().getName()}</a></td>
</tr>
</c:forEach>
</tbody>
</table>
</div>
<%@ include file="base/footer.jsp" %>
</div>
</body>

View File

@ -1,10 +1,5 @@
<spring:url value="/static/js/jquery.js" var="jQueryJS" />
<spring:url value="/static/bootstrap/js/bootstrap.min.js" var="bootstrapJS" />
<spring:url value="/static/img/logo.svg" var="logo" />
<script src="${jQueryJS}"></script>
<script src="${bootstrapJS}"></script>
<!-- Bootstrap core JavaScript
================================================== -->

View File

@ -5,6 +5,9 @@
<spring:url value="/static/img/logo.svg" var="logo" />
<spring:url value="/static/img/multiple-species-paw-solid.svg" var="pawsSVG" />
<spring:url value="/static/js/jquery.js" var="jQueryJS" />
<spring:url value="/static/bootstrap/js/bootstrap.min.js" var="bootstrapJS" />
<spring:url value="/" var="indexURL" />
<spring:url value="/animal" var="animalURL" />
<spring:url value="/login" var="loginURL" />
@ -30,20 +33,34 @@
<ul class="nav navbar-nav">
<% if (authentication != null) { %>
<c:forEach items="${MODEL_MAP_ANIMAL_LIST}" var="animal">
<li <c:if test="${MODEL_MAP_ANIMAL.getId() == animal.getId()}">class="active"</c:if>><a href="${animalURL}/${animal.getId()}/cares_and_behaviors">${animal.getName()}</a></li>
<!-- <li class="dropdown <c:if test="${MODEL_MAP_ANIMAL.getId() == animal.getId()}">active</c:if>" >
<!--<li <c:if test="${MODEL_MAP_ANIMAL.getId() == animal.getId()}">class="active"</c:if>><a href="${animalURL}/${animal.getId()}/cares_and_behaviors">${animal.getName()}</a></li>-->
<li class="dropdown <c:if test="${MODEL_MAP_ANIMAL.getId() == animal.getId()}">active</c:if>" >
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">${animal.getName()} <span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="${animalURL}/${animal.getId()}/cares_and_behaviors"><fmt:message key="navbar.cares_and_behaviors"></fmt:message></a></li>
<li><a href="${animalURL}/${animal.getId()}/progressions">Progressions</a></li>
<li><a href="${animalURL}/${animal.getId()}/cares_and_behaviors">Soins et comportements</a></li>
<li role="separator" class="divider"></li>
<li><a href="${animalURL}/${animal.getId()}/progression_by_me/NOT_TRAINED"><fmt:message key="navbar.progression.by_me.NOT_TRAINED"></fmt:message></a></li>
<li><a href="${animalURL}/${animal.getId()}/progression_by_me/CURRENTLY_TRAINING"><fmt:message key="navbar.progression.by_me.CURRENTLY_TRAINING"></fmt:message></a></li>
<li><a href="${animalURL}/${animal.getId()}/progression_by_me/TRAINED"><fmt:message key="navbar.progression.by_me.TRAINED"></fmt:message></a></li>
<li><a href="${animalURL}/${animal.getId()}/progression_by_me/NOT_USED"><fmt:message key="navbar.progression.by_me.NOT_USED"></fmt:message></a></li>
<li role="separator" class="divider"></li>
<li><a href="${animalURL}/${animal.getId()}/progression_by_someone_else/NOT_TRAINED"><fmt:message key="navbar.progression.by_someone_else.NOT_TRAINED"></fmt:message></a></li>
<li><a href="${animalURL}/${animal.getId()}/progression_by_someone_else/CURRENTLY_TRAINING"><fmt:message key="navbar.progression.by_someone_else.CURRENTLY_TRAINING"></fmt:message></a></li>
<li><a href="${animalURL}/${animal.getId()}/progression_by_someone_else/TRAINED"><fmt:message key="navbar.progression.by_someone_else.TRAINED"></fmt:message></a></li>
<li><a href="${animalURL}/${animal.getId()}/progression_by_someone_else/NOT_USED"><fmt:message key="navbar.progression.by_someone_else.NOT_USED"></fmt:message></a></li>
<li role="separator" class="divider"></li>
<li><a href="${animalURL}/${animal.getId()}/progression_by_veterinary/NOT_TRAINED"><fmt:message key="navbar.progression.by_veterinary.NOT_TRAINED"></fmt:message></a></li>
<li><a href="${animalURL}/${animal.getId()}/progression_by_veterinary/CURRENTLY_TRAINING"><fmt:message key="navbar.progression.by_veterinary.CURRENTLY_TRAINING"></fmt:message></a></li>
<li><a href="${animalURL}/${animal.getId()}/progression_by_veterinary/TRAINED"><fmt:message key="navbar.progression.by_veterinary.TRAINED"></fmt:message></a></li>
<li><a href="${animalURL}/${animal.getId()}/progression_by_veterinary/NOT_USED"><fmt:message key="navbar.progression.by_veterinary.NOT_USED"></fmt:message></a></li>
</ul>
</li>-->
</li>
</c:forEach>
<% }%>
</ul>
<ul class="nav navbar-nav navbar-right">
<% if (authentication == null) { %>
<li><a href="${loginURL}"><span class="glyphicon glyphicon-log-in"></span> <fmt:message key="navbar.signin"></fmt:message></a></li>
<li><a id="navbar_button_signin" href="${loginURL}"><span class="glyphicon glyphicon-log-in"></span> <fmt:message key="navbar.signin"></fmt:message></a></li>
<li><a href="${registerURL}"><span class="glyphicon glyphicon-user"></span> <fmt:message key="navbar.signup"></fmt:message></a></li>
<% } else { %>
<li <c:if test="${MODEL_MAP_NAVBAR_PAGE == 'MODEL_MAP_NAVBAR_PAGE_VALUE_MY_ANIMALS'}">class="active"</c:if>>
@ -62,3 +79,60 @@
</div>
</div>
</nav>
<div id="modal_navbar_signin" class="modal fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 id="modal_edit_animal_title" class="modal-title"><fmt:message key="authentication.title"></fmt:message></h4>
</div>
<div class="modal-body">
<form id="modal_navbar_signin_form" class="form-signin" action="${loginURL}" method="POST">
<label for="username"><fmt:message key="authentication.label.login"></fmt:message></label>
<input type="text" id="username" name="username" class="form-control" placeholder="<fmt:message key="authentication.placeholder.login"></fmt:message>" required autofocus />
<label for="username"><fmt:message key="authentication.label.password"></fmt:message></label>
<input type="password" id="inputPassword" name="password" class="form-control" placeholder="<fmt:message key="authentication.placeholder.password"></fmt:message>" required />
<div class="checkbox">
<label>
<input type="checkbox" name="remember-me" /> <fmt:message key="authentication.remember_me"></fmt:message>
</label>
</div>
</form>
</div>
<div class="modal-footer">
<button form="modal_navbar_signin_form" class="btn btn-lg btn-primary btn-block" type="submit"><fmt:message key="authentication.button.submit"></fmt:message></button>
</div>
</div>
</div>
</div>
<script src="${jQueryJS}"></script>
<script src="${bootstrapJS}"></script>
<script type="text/javascript">
$(document).ready(function () {
try {
$('#navbar_button_signin').click(function () {
$('#modal_navbar_signin').modal({
show: true
});
setTimeout(function () {
$('#username').focus();
}, 200);
return false;
});
} catch (err) {
console.log("Signin button not found");
console.log(err);
}
});
</script>

View File

@ -20,20 +20,26 @@
<form id="loginForm" class="form-signin" action="${loginURL_POST}" method="POST">
<h2 class="form-signin-heading"><fmt:message key="authentication.title"></fmt:message></h2>
<label for="username"><fmt:message key="authentication.label.login"></fmt:message></label>
<label for="username"><fmt:message key="authentication.label.login"></fmt:message></label>
<input type="text" id="username" name="username" class="form-control" placeholder="<fmt:message key="authentication.placeholder.login"></fmt:message>" required autofocus />
<label for="username"><fmt:message key="authentication.label.password"></fmt:message></label>
<label for="username"><fmt:message key="authentication.label.password"></fmt:message></label>
<input type="password" id="inputPassword" name="password" class="form-control" placeholder="<fmt:message key="authentication.placeholder.password"></fmt:message>" required />
<button class="btn btn-lg btn-primary btn-block" type="submit"><fmt:message key="authentication.button.submit"></fmt:message></button>
<div class="checkbox">
<label>
<input type="checkbox" name="remember-me" /> <fmt:message key="authentication.remember_me"></fmt:message>
</label>
</div>
<br/>
<p id="errorAuth" style="color: red;" hidden>Erreur lors de l'authentification</p>
<p id="errorBDD" style="color: red;" hidden></p>
</form>
<button class="btn btn-lg btn-primary btn-block" type="submit"><fmt:message key="authentication.button.submit"></fmt:message></button>
</div>
<br/>
<p id="errorAuth" style="color: red;" hidden>Erreur lors de l'authentification</p>
<p id="errorBDD" style="color: red;" hidden></p>
</form>
</div>
<%@ include file="base/footer.jsp"%>