Compare commits

...

8 Commits

22 changed files with 1029 additions and 153 deletions

View File

@ -1,6 +1,5 @@
package fr.geoffrey.medical_training_tracker;
import fr.geoffrey.medical_training_tracker.config.encoder.Encoder;
import fr.geoffrey.medical_training_tracker.dao.IAnimalDao;
import fr.geoffrey.medical_training_tracker.dao.ICareDao;
import fr.geoffrey.medical_training_tracker.dao.IConsentBehaviorDao;
@ -35,8 +34,6 @@ public class Servlet implements ServletContextListener {
@Override
public void contextInitialized(ServletContextEvent sce) {
Encoder.setEncoder(Encoder.ENCODER_CLEAR);
AutowireCapableBeanFactory autowireCapableBeanFactory = WebApplicationContextUtils.getRequiredWebApplicationContext(sce.getServletContext()).getAutowireCapableBeanFactory();
autowireCapableBeanFactory.autowireBean(this);

View File

@ -87,6 +87,7 @@ public class SecSecurityConfig extends WebSecurityConfigurerAdapter {
.antMatchers(IndexController.URL_INDEX).permitAll()
.antMatchers(IndexController.URL_LOGIN).permitAll()
.antMatchers(IndexController.URL_REGISTER).permitAll()
.antMatchers(IndexController.URL_CHANGE_PASSWORD).hasAnyRole(ROLE_ADMIN, ROLE_USER)
.antMatchers(IndexController.URL_LOGOUT).hasAnyRole(ROLE_ADMIN, ROLE_USER)
.anyRequest().authenticated()
.and()

View File

@ -28,13 +28,16 @@ public class AnimalController {
public static final String MODEL_MAP_PROGRESSION = "MODEL_MAP_PROGRESSION";
public static final String MODEL_MAP_LIST_REMAINING_CONSENT_BEHAVIORS = "MODEL_MAP_LIST_REMAINING_CONSENT_BEHAVIORS";
public static final String MODEL_MAP_LIST_REMAINING_CARES = "MODEL_MAP_LIST_REMAINING_CARES";
public static final String MODEL_MAP_PROGRESSION_TYPE = "MODEL_MAP_PROGRESSION_TYPE";
@Autowired
IServiceAnimal serviceAnimal;
//<editor-fold defaultstate="collapsed" desc="Animal">
@RequestMapping(value = IndexController.URL_ANIMAL_LIST, method = RequestMethod.GET)
public String doGetAnimal(final ModelMap pModel, HttpSession httpSession) {
public String doGetAnimal(final ModelMap pModel, HttpSession httpSession,
@RequestParam(value = LoginController.MODEL_MAP_CHANGE_PASSWORD_SUCCESS_MESSAGE, required = false, defaultValue = "false") final boolean changePasswordSuccessMessage,
@RequestParam(value = LoginController.MODEL_MAP_CHANGE_PASSWORD_ERROR_MESSAGE, required = false, defaultValue = "false") final String changePasswordErrorMessage) {
String ret;
if (LoginController.isUserAlreadyAuth(httpSession)) {
@ -47,6 +50,8 @@ public class AnimalController {
pModel.addAttribute(MODEL_MAP_NAVBAR_PAGE, IndexController.MODEL_MAP_NAVBAR_PAGE_VALUE_MY_ANIMALS);
}
pModel.addAttribute(LoginController.MODEL_MAP_CHANGE_PASSWORD_SUCCESS_MESSAGE, changePasswordSuccessMessage);
pModel.addAttribute(LoginController.MODEL_MAP_CHANGE_PASSWORD_ERROR_MESSAGE, changePasswordErrorMessage);
ret = IndexController.PAGE_ANIMAL_LIST;
} else {
@ -223,7 +228,8 @@ public class AnimalController {
public String doPostAddProgression(final ModelMap pModel, HttpSession httpSession,
@PathVariable(value = "animal_id") final int animalId,
@RequestParam(name = "care_id", required = true) int careId,
@RequestParam(name = "consent_behavior_id", required = true) int consentBehaviorId) {
@RequestParam(name = "consent_behavior_id", required = true) int consentBehaviorId,
@RequestParam(value = "page", required = true) final String pageFrom) {
String ret;
if (LoginController.isUserAlreadyAuth(httpSession)) {
@ -235,8 +241,16 @@ public class AnimalController {
serviceAnimal.addProgression(animalId, careId, consentBehaviorId);
}
// TODO Where do redirection ?
ret = IndexController.URL_REDIRECT + IndexController.URL_ANIMAL_CARES_AND_BEHAVIORS_LIST.replaceAll("\\{animal_id\\}", animalId + "");
if (pageFrom.equals("care")) {
ret = IndexController.URL_REDIRECT + IndexController.URL_ANIMAL_CARE
.replaceAll("\\{care_id\\}", careId + "");
} else if (pageFrom.equals("consent_behavior")) {
ret = IndexController.URL_REDIRECT + IndexController.URL_ANIMAL_BEHAVIOR
.replaceAll("\\{consent_behavior_id\\}", consentBehaviorId + "");
} else {
ret = IndexController.URL_REDIRECT + IndexController.URL_ANIMAL_CARES_AND_BEHAVIORS_LIST;
}
ret = ret.replaceAll("\\{animal_id\\}", animalId + "");
} else {
ret = IndexController.URL_REDIRECT + IndexController.URL_LOGIN;
}
@ -247,7 +261,9 @@ public class AnimalController {
@RequestMapping(value = IndexController.URL_ANIMAL_PROGRESSION_DELETE, method = RequestMethod.POST)
public String doPostDeleteProgression(final ModelMap pModel, HttpSession httpSession,
@PathVariable(value = "animal_id") final int animalId,
@PathVariable(value = "progression_id") final int progressionId) {
@PathVariable(value = "progression_id") final int progressionId,
@RequestParam(value = "page", required = true) final String pageFrom,
@RequestParam(value = "redirect_id", required = true) final int redirectId) {
String ret;
if (LoginController.isUserAlreadyAuth(httpSession)) {
@ -259,8 +275,16 @@ public class AnimalController {
serviceAnimal.deleteAnimalProgression(animalId, userDetails.getUsername(), progressionId);
}
// TODO Where do redirection ?
ret = IndexController.URL_REDIRECT + IndexController.URL_ANIMAL_CARES_AND_BEHAVIORS_LIST.replaceAll("\\{animal_id\\}", animalId + "");
if (pageFrom.equals("care")) {
ret = IndexController.URL_REDIRECT + IndexController.URL_ANIMAL_CARE
.replaceAll("\\{care_id\\}", redirectId + "");
} else if (pageFrom.equals("consent_behavior")) {
ret = IndexController.URL_REDIRECT + IndexController.URL_ANIMAL_BEHAVIOR
.replaceAll("\\{consent_behavior_id\\}", redirectId + "");
} else {
ret = IndexController.URL_REDIRECT + IndexController.URL_ANIMAL_CARES_AND_BEHAVIORS_LIST;
}
ret = ret.replaceAll("\\{animal_id\\}", animalId + "");
} else {
ret = IndexController.URL_REDIRECT + IndexController.URL_LOGIN;
}
@ -358,6 +382,67 @@ public class AnimalController {
pModel.addAttribute(MODEL_MAP_ANIMAL_LIST, animals);
pModel.addAttribute(MODEL_MAP_PROGRESSION, progressionByMeValue);
pModel.addAttribute(MODEL_MAP_PROGRESSION_TYPE, "by_me");
}
ret = IndexController.PAGE_ANIMAL_PROGRESSION;
} else {
ret = IndexController.URL_REDIRECT + IndexController.URL_LOGIN;
}
return ret;
}
@RequestMapping(value = IndexController.URL_ANIMAL_PROGRESSION_BY_SOMEONE_ELSE, method = RequestMethod.GET)
public String doGetAnimalProgressionBySomeoneElse(final ModelMap pModel, HttpSession httpSession,
@PathVariable(value = "animal_id") final int animalId,
@PathVariable(value = "progression_value") final String progressionByMeValue) {
String ret;
if (LoginController.isUserAlreadyAuth(httpSession)) {
Authentication authentication = (Authentication) httpSession.getAttribute(IndexController.SESSION_ATTRIBUTE_AUTHENTICATION);
Object oUserDetails = authentication.getPrincipal();
if (oUserDetails instanceof UserDetails) {
UserDetails userDetails = (UserDetails) oUserDetails;
Animal animal = serviceAnimal.getAnimalProgressionBySomeoneElse(userDetails.getUsername(), animalId, progressionByMeValue);
pModel.addAttribute(MODEL_MAP_ANIMAL, animal);
List<Animal> animals = serviceAnimal.getAnimals(userDetails.getUsername());
pModel.addAttribute(MODEL_MAP_ANIMAL_LIST, animals);
pModel.addAttribute(MODEL_MAP_PROGRESSION, progressionByMeValue);
pModel.addAttribute(MODEL_MAP_PROGRESSION_TYPE, "by_someone_else");
}
ret = IndexController.PAGE_ANIMAL_PROGRESSION;
} else {
ret = IndexController.URL_REDIRECT + IndexController.URL_LOGIN;
}
return ret;
}
@RequestMapping(value = IndexController.URL_ANIMAL_PROGRESSION_BY_VETERINARY, method = RequestMethod.GET)
public String doGetAnimalProgressionByVeterinary(final ModelMap pModel, HttpSession httpSession,
@PathVariable(value = "animal_id") final int animalId,
@PathVariable(value = "progression_value") final String progressionByMeValue) {
String ret;
if (LoginController.isUserAlreadyAuth(httpSession)) {
Authentication authentication = (Authentication) httpSession.getAttribute(IndexController.SESSION_ATTRIBUTE_AUTHENTICATION);
Object oUserDetails = authentication.getPrincipal();
if (oUserDetails instanceof UserDetails) {
UserDetails userDetails = (UserDetails) oUserDetails;
Animal animal = serviceAnimal.getAnimalProgressionByVeterinary(userDetails.getUsername(), animalId, progressionByMeValue);
pModel.addAttribute(MODEL_MAP_ANIMAL, animal);
List<Animal> animals = serviceAnimal.getAnimals(userDetails.getUsername());
pModel.addAttribute(MODEL_MAP_ANIMAL_LIST, animals);
pModel.addAttribute(MODEL_MAP_PROGRESSION, progressionByMeValue);
pModel.addAttribute(MODEL_MAP_PROGRESSION_TYPE, "by_veterinary");
}
ret = IndexController.PAGE_ANIMAL_PROGRESSION;

View File

@ -38,6 +38,7 @@ public class IndexController {
public static final String URL_LOGIN = "/login";
public static final String URL_LOGOUT = "/logout";
public static final String URL_REGISTER = "/register";
public static final String URL_CHANGE_PASSWORD = "/change_password";
public static final String URL_INDEX = "/";
public static final String URL_ANIMAL_LIST = "/animal";
@ -45,6 +46,8 @@ public class IndexController {
public static final String URL_ANIMAL_CARE = "/animal/{animal_id}/care/{care_id}";
public static final String URL_ANIMAL_BEHAVIOR = "/animal/{animal_id}/consent_behavior/{consent_behavior_id}";
public static final String URL_ANIMAL_PROGRESSION_BY_ME = "/animal/{animal_id}/progression_by_me/{progression_value}";
public static final String URL_ANIMAL_PROGRESSION_BY_SOMEONE_ELSE = "/animal/{animal_id}/progression_by_someone_else/{progression_value}";
public static final String URL_ANIMAL_PROGRESSION_BY_VETERINARY = "/animal/{animal_id}/progression_by_veterinary/{progression_value}";
public static final String URL_ANIMAL_PROGRESSIONS_LIST = "/animal/{animal_id}/progressions";
// Add URL

View File

@ -8,13 +8,13 @@ import javax.servlet.http.HttpSessionListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
@Controller
public class LoginController implements HttpSessionListener {
@ -22,6 +22,9 @@ public class LoginController implements HttpSessionListener {
public static final String MODEL_MAP_REGISTER_NAME = "MODEL_MAP_REGISTER_NAME";
public static final String MODEL_MAP_REGISTER_ERROR_MESSAGE = "MODEL_MAP_REGISTER_ERROR_MESSAGE";
public static final String MODEL_MAP_CHANGE_PASSWORD_ERROR_MESSAGE = "MODEL_MAP_CHANGE_PASSWORD_ERROR_MESSAGE";
public static final String MODEL_MAP_CHANGE_PASSWORD_SUCCESS_MESSAGE = "MODEL_MAP_CHANGE_PASSWORD_SUCCESS_MESSAGE";
@Autowired
IServiceRegister serviceRegister;
@ -35,7 +38,7 @@ public class LoginController implements HttpSessionListener {
String page = IndexController.PAGE_LOGIN;
if (isUserAlreadyAuth(httpSession)) {
// Deja authentifie, redirection sur le viewer photo
page = IndexController.URL_REDIRECT+IndexController.URL_INDEX;
page = IndexController.URL_REDIRECT + IndexController.URL_INDEX;
} else if (errAuth) {
pModel.addAttribute("isErrorAuth", true);
}
@ -71,6 +74,34 @@ public class LoginController implements HttpSessionListener {
pModel.addAttribute(MODEL_MAP_REGISTER_ERROR_MESSAGE, "Le login existe déjà.");
}
return page;
}
@RequestMapping(value = IndexController.URL_CHANGE_PASSWORD, method = RequestMethod.POST)
public String doPostChangePassword(final ModelMap pModel, HttpSession httpSession,
@RequestParam(name = "old_password", required = true) String oldPassword,
@RequestParam(name = "password", required = true) String newPassword,
@RequestParam(name = "password_check", required = true) String newPasswordCheck) {
String page;
if (LoginController.isUserAlreadyAuth(httpSession)) {
Authentication authentication = (Authentication) httpSession.getAttribute(IndexController.SESSION_ATTRIBUTE_AUTHENTICATION);
Object oUserDetails = authentication.getPrincipal();
if (oUserDetails instanceof UserDetails) {
UserDetails userDetails = (UserDetails) oUserDetails;
boolean changed = serviceRegister.changePassword(userDetails.getUsername(), oldPassword, newPassword, newPasswordCheck);
if (changed) {
pModel.addAttribute(MODEL_MAP_CHANGE_PASSWORD_SUCCESS_MESSAGE, "true");
pModel.addAttribute(MODEL_MAP_CHANGE_PASSWORD_ERROR_MESSAGE, "false");
} else {
pModel.addAttribute(MODEL_MAP_CHANGE_PASSWORD_SUCCESS_MESSAGE, "false");
pModel.addAttribute(MODEL_MAP_CHANGE_PASSWORD_ERROR_MESSAGE, "true");
}
}
page = IndexController.URL_REDIRECT + IndexController.URL_ANIMAL_LIST;
} else {
page = IndexController.URL_REDIRECT + IndexController.URL_LOGIN;
}
return page;
}

View File

@ -7,4 +7,6 @@ public interface IUserDao extends CommonDao {
public User getUser(String login);
public boolean addUser(String login, String hashPassword, String name) throws UserAlreadyExistException;
public boolean updatePassword(String username, String hashedPassword);
}

View File

@ -341,10 +341,170 @@ public class ProgressionDao extends PostgresSqlDao implements IProgressionDao {
@Override
public void fillAnimalProgressionBySomeoneElse(Animal animal, String progressionBySomeoneElse) {
Connection conn = null;
PreparedStatement statement = null;
ResultSet resultSet = null;
try {
conn = mDataSource.getConnection();
statement = conn.prepareStatement("select "
+ AnimalDao.TABLE_NAME+".id as animal_id, "+AnimalDao.TABLE_NAME+".name as animal_name, "+AnimalDao.TABLE_NAME+".owner as animal_owner, "
+ TABLE_NAME+".id as progression_id, "+TABLE_NAME+".progression_by_me as prog_by_me, "+TABLE_NAME+".progression_by_someone_else as prog_by_someone_else, "+TABLE_NAME+".progression_by_veterinary as prog_by_vet, "
+ TABLE_NAME+".care as care_id, "+TABLE_NAME+".consent_behavior as consent_behavior_id, "
+ CareDao.TABLE_NAME+".name as care_name, "+CareDao.TABLE_NAME+".description as care_desc, "
+ ConsentBehaviorDao.TABLE_NAME+".name as consent_behavior_name, "+ConsentBehaviorDao.TABLE_NAME+".description as consent_behavior_desc "
+ "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 "
+ "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+".progression_by_someone_else = ?;");
statement.setString(1, animal.getOwner());
statement.setInt(2, animal.getId());
statement.setString(3, progressionBySomeoneElse);
System.out.println(IndexController.LOG_TAG + " SQL -> " + statement.toString());
resultSet = statement.executeQuery();
if (resultSet != null) {
while (resultSet.next()) {
Progression progression = new Progression();
progression.setId(resultSet.getInt("progression_id"));
progression.setProgressionByMe(resultSet.getString("prog_by_me"));
progression.setProgressionBySomeoneElse(resultSet.getString("prog_by_someone_else"));
progression.setProgressionByVeterinary(resultSet.getString("prog_by_vet"));
int careId = resultSet.getInt("care_id");
if (!animal.containsCareKey(careId)) {
Care care = new Care();
care.setId(careId);
care.setName(resultSet.getString("care_name"));
care.setDescription(resultSet.getString("care_desc"));
animal.addCare(care);
}
progression.setCare(animal.getCareById(careId));
int consentBehaviorId = resultSet.getInt("consent_behavior_id");
if (!animal.containsConsentBehaviorKey(consentBehaviorId)) {
ConsentBehavior consentBehavior = new ConsentBehavior();
consentBehavior.setId(consentBehaviorId);
consentBehavior.setName(resultSet.getString("consent_behavior_name"));
consentBehavior.setDescription(resultSet.getString("consent_behavior_desc"));
animal.addConsentBehavior(consentBehavior);
}
progression.setConsentBehavior(animal.getConsentBehaviorById(consentBehaviorId));
animal.addProgression(progression);
}
resultSet.close();
}
} catch (SQLException ex) {
System.err.println(IndexController.LOG_TAG + " SQLException -> fillAnimalProgressionBySomeoneElse() - " + ex.getMessage());
ex.printStackTrace();
} finally {
if (resultSet != null) {
try {
resultSet.close();
} catch (SQLException ex) {
System.err.println(IndexController.LOG_TAG + " Failed close ResultSet -> fillAnimalProgressionBySomeoneElse()");
}
}
if (statement != null) {
try {
statement.close();
} catch (SQLException ex) {
System.err.println(IndexController.LOG_TAG + " Failed close statement -> fillAnimalProgressionBySomeoneElse()");
}
}
if (conn != null) {
try {
conn.close();
} catch (SQLException ex) {
System.err.println(IndexController.LOG_TAG + " Failed close connection -> fillAnimalProgressionBySomeoneElse()");
}
}
}
}
@Override
public void fillAnimalProgressionByVeterinary(Animal animal, String progressionByVeterinary) {
Connection conn = null;
PreparedStatement statement = null;
ResultSet resultSet = null;
try {
conn = mDataSource.getConnection();
statement = conn.prepareStatement("select "
+ AnimalDao.TABLE_NAME+".id as animal_id, "+AnimalDao.TABLE_NAME+".name as animal_name, "+AnimalDao.TABLE_NAME+".owner as animal_owner, "
+ TABLE_NAME+".id as progression_id, "+TABLE_NAME+".progression_by_me as prog_by_me, "+TABLE_NAME+".progression_by_someone_else as prog_by_someone_else, "+TABLE_NAME+".progression_by_veterinary as prog_by_vet, "
+ TABLE_NAME+".care as care_id, "+TABLE_NAME+".consent_behavior as consent_behavior_id, "
+ CareDao.TABLE_NAME+".name as care_name, "+CareDao.TABLE_NAME+".description as care_desc, "
+ ConsentBehaviorDao.TABLE_NAME+".name as consent_behavior_name, "+ConsentBehaviorDao.TABLE_NAME+".description as consent_behavior_desc "
+ "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 "
+ "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+".progression_by_veterinary = ?;");
statement.setString(1, animal.getOwner());
statement.setInt(2, animal.getId());
statement.setString(3, progressionByVeterinary);
System.out.println(IndexController.LOG_TAG + " SQL -> " + statement.toString());
resultSet = statement.executeQuery();
if (resultSet != null) {
while (resultSet.next()) {
Progression progression = new Progression();
progression.setId(resultSet.getInt("progression_id"));
progression.setProgressionByMe(resultSet.getString("prog_by_me"));
progression.setProgressionBySomeoneElse(resultSet.getString("prog_by_someone_else"));
progression.setProgressionByVeterinary(resultSet.getString("prog_by_vet"));
int careId = resultSet.getInt("care_id");
if (!animal.containsCareKey(careId)) {
Care care = new Care();
care.setId(careId);
care.setName(resultSet.getString("care_name"));
care.setDescription(resultSet.getString("care_desc"));
animal.addCare(care);
}
progression.setCare(animal.getCareById(careId));
int consentBehaviorId = resultSet.getInt("consent_behavior_id");
if (!animal.containsConsentBehaviorKey(consentBehaviorId)) {
ConsentBehavior consentBehavior = new ConsentBehavior();
consentBehavior.setId(consentBehaviorId);
consentBehavior.setName(resultSet.getString("consent_behavior_name"));
consentBehavior.setDescription(resultSet.getString("consent_behavior_desc"));
animal.addConsentBehavior(consentBehavior);
}
progression.setConsentBehavior(animal.getConsentBehaviorById(consentBehaviorId));
animal.addProgression(progression);
}
resultSet.close();
}
} catch (SQLException ex) {
System.err.println(IndexController.LOG_TAG + " SQLException -> fillAnimalProgressionByVeterinary() - " + ex.getMessage());
ex.printStackTrace();
} finally {
if (resultSet != null) {
try {
resultSet.close();
} catch (SQLException ex) {
System.err.println(IndexController.LOG_TAG + " Failed close ResultSet -> fillAnimalProgressionByVeterinary()");
}
}
if (statement != null) {
try {
statement.close();
} catch (SQLException ex) {
System.err.println(IndexController.LOG_TAG + " Failed close statement -> fillAnimalProgressionByVeterinary()");
}
}
if (conn != null) {
try {
conn.close();
} catch (SQLException ex) {
System.err.println(IndexController.LOG_TAG + " Failed close connection -> fillAnimalProgressionByVeterinary()");
}
}
}
}
//</editor-fold>
@ -464,7 +624,7 @@ public class ProgressionDao extends PostgresSqlDao implements IProgressionDao {
conn = mDataSource.getConnection();
statement = conn.prepareStatement("DELETE FROM "+TABLE_NAME+" WHERE animal = ("
+ "SELECT id FROM "+AnimalDao.TABLE_NAME+" WHERE owner = ? AND id = ?) "
+ "AND care = (SELECT id FROM "+ConsentBehaviorDao.TABLE_NAME+" WHERE animal = ? AND id = ?)");
+ "AND consent_behavior = (SELECT id FROM "+ConsentBehaviorDao.TABLE_NAME+" WHERE animal = ? AND id = ?)");
statement.setString(1, owner);
statement.setInt(2, animalId);
statement.setInt(3, animalId);

View File

@ -114,4 +114,38 @@ public class UserBddDao extends PostgresSqlDao implements IUserDao {
}
return ret;
}
@Override
public boolean updatePassword(String username, String hashedPassword) {
boolean ret = false;
Connection conn = null;
PreparedStatement statement = null;
try {
conn = mDataSource.getConnection();
statement = conn.prepareStatement("UPDATE "+TABLE_NAME+" SET password = ? WHERE login = ?;");
statement.setString(1, hashedPassword);
statement.setString(2, username);
System.out.println(IndexController.LOG_TAG + " SQL -> " + statement.toString());
statement.executeUpdate();
ret = true;
} catch (SQLException ex) {
System.err.println(IndexController.LOG_TAG + " SQLException -> updatePassword()");
} finally {
if (statement != null) {
try {
statement.close();
} catch (SQLException ex) {
System.err.println(IndexController.LOG_TAG + " Failed close statement -> updatePassword()");
}
}
if (conn != null) {
try {
conn.close();
} catch (SQLException ex) {
System.err.println(IndexController.LOG_TAG + " Failed close connection -> updatePassword()");
}
}
}
return ret;
}
}

View File

@ -12,6 +12,8 @@ public interface IServiceAnimal {
public Animal getAnimalCareProgression(String owner, int animalId, int careId);
public Animal getAnimalConsentBehaviorProgression(String owner, int animalId, int consentBehaviorId);
public Animal getAnimalProgressionByMe(String username, int animalId, String progressionValue);
public Animal getAnimalProgressionBySomeoneElse(String username, int animalId, String progressionValue);
public Animal getAnimalProgressionByVeterinary(String username, int animalId, String progressionValue);
public List<ConsentBehavior> getAnimalConsentBehaviors(String username, int animalId);
public List<Care> getAnimalCares(String username, int animalId);

View File

@ -8,4 +8,5 @@ import fr.geoffrey.medical_training_tracker.dao.UserAlreadyExistException;
*/
public interface IServiceRegister {
public boolean register(String username, String password, String passwordCheck, String name) throws UserAlreadyExistException;
public boolean changePassword(String username, String oldPassword, String newPassword, String newPasswordCheck);
}

View File

@ -118,6 +118,24 @@ public class ServiceAnimal implements IServiceAnimal {
return animal;
}
@Override
public Animal getAnimalProgressionBySomeoneElse(String username, int animalId, String progressionValue) {
Animal animal = animalDao.getAnimal(username, animalId);
if (animal != null) {
progressionDao.fillAnimalProgressionBySomeoneElse(animal, progressionValue);
}
return animal;
}
@Override
public Animal getAnimalProgressionByVeterinary(String username, int animalId, String progressionValue) {
Animal animal = animalDao.getAnimal(username, animalId);
if (animal != null) {
progressionDao.fillAnimalProgressionByVeterinary(animal, progressionValue);
}
return animal;
}
@Override
public List<ConsentBehavior> getAnimalConsentBehaviors(String username, int animalId) {
return consentBehaviorDao.getAllAnialConsentBehavior(username, animalId);

View File

@ -3,6 +3,8 @@ package fr.geoffrey.medical_training_tracker.services;
import fr.geoffrey.medical_training_tracker.config.encoder.Encoder;
import fr.geoffrey.medical_training_tracker.dao.IUserDao;
import fr.geoffrey.medical_training_tracker.dao.UserAlreadyExistException;
import fr.geoffrey.medical_training_tracker.dao.bean.User;
import org.springframework.security.crypto.password.PasswordEncoder;
public class ServiceRegister implements IServiceRegister {
@ -26,4 +28,18 @@ public class ServiceRegister implements IServiceRegister {
return ret;
}
@Override
public boolean changePassword(String username, String oldPassword, String newPassword, String newPasswordCheck) {
boolean ret = false;
PasswordEncoder encoder = Encoder.getInstance();
User user = userDao.getUser(username);
if (encoder.matches(oldPassword, user.getPassword())) {
if (!newPassword.equals("") && newPassword.equals(newPasswordCheck)) {
String hashedPassword = encoder.encode(newPassword);
ret = userDao.updatePassword(username, hashedPassword);
}
}
return ret;
}
}

View File

@ -7,3 +7,85 @@ navbar.cares_and_behaviors = Care and Behaviors
footer.license = Application under {0} license
footer.source_code = Source code
progression.value.NOT_TRAINED=Not trained
progression.value.CURRENTLY_TRAINING=Currently training
progression.value.TRAINED=Done
progression.by_me=Progression by me
progression.by_someone_else=Progression by someone else
progression.by_veterinary=Done by veterinary
register.title=Sign up
register.label.login=Username:
register.placeholder.login=Username
register.label.password=Password:
register.placeholder.password=Password
register.label.password_check=Check password:
register.placeholder.password_check=Password
register.button.submit=Create
authentication.title=Authentication
authentication.label.login=Username:
authentication.placeholder.login=Username
authentication.label.password=Password:
authentication.placeholder.password=Password
authentication.button.submit=Login
animal_list.delete.modal_body=Do you want to delete this animal?
modal_button.delete=Delete
modal_button.cancel=Cancel
animal_cares_and_behaviors.delete.modal_body.behavior=Do you want to delete this behavior?
animal_cares_and_behaviors.delete.modal_body.care=Do you want to delete this care?
animal_list.title=Your animals' list
animal_list.animal_list.title=Your animals' list
animal_list.animal.delete.tooltip=Delete
animal_list.animal.add.title=Add an animal
animal_list.animal.add.label=Animal's name:
animal_list.animal.add.placeholder=Name
animal_list.animal.add.tooltip=Add
animal_list.change_password.title=Change password
animal_list.change_password.old_password.label=Old password:
animal_list.change_password.old_password.placeholder=Old password
animal_list.change_password.new_password.label=New password:
animal_list.change_password.new_password.placeholder=New password
animal_list.change_password.new_password_check.label=New password:
animal_list.change_password.new_password_check.placeholder=Check new password
animal_list.change_password.submit=Change password
progression.title={0} sheet
progression.table.column.care=Care
progression.table.column.behavior=Consent behavior
animal_care_and_behavior.title={0} sheet
animal_care_and_behavior.care_list=Cares list
animal_care_and_behavior.add_care=Add care
animal_care_and_behavior.add_care.care_name.placeholder=Care name
animal_care_and_behavior.add_care.care_description.placeholder=Care description (optional)
animal_care_and_behavior.add_care.button.submit=Add
animal_care_and_behavior.behavior_list=Consent behaviors list
animal_care_and_behavior.add_behavior=Add consent behavior
animal_care_and_behavior.add_behavior.care_name.placeholder=Consent behavior
animal_care_and_behavior.add_behavior.care_description.placeholder=Consent behavior description (optional)
animal_care_and_behavior.add_behavior.button.submit=Add
animal_care_and_behavior.button.delete.tooltip=Delete
animal_care.title={0} sheet
animal_care.subtitle=Progression of "{0}"
animal_care.table.behavior=Consent behavior
animal_care.table.executed_by_me=Execute by me
animal_care.table.executed_by_someone_else=Execute by someone else
animal_care.table.executed_by_veterinary=Execute by veterinary
animal_care.button.delete.tooltip=Delete
animal_care.button.add.tooltip=Add
animal_care.add_behavior=Add a consent behavior to this care
animal_care.add_behavior.empty_list=No more consent behaviors to add
animal_behavior.title={0} sheet
animal_behavior.subtitle=Progression of "{0}"
animal_behavior.table.care=Care
animal_behavior.table.executed_by_me=Execute by me
animal_behavior.table.executed_by_someone_else=Execute by someone else
animal_behavior.table.executed_by_veterinary=Execute by veterinary
animal_behavior.button.delete.tooltip=Delete
animal_behavior.button.add.tooltip=Add
animal_behavior.add_care=Add care to this consent behavior
animal_behavior.add_care.empty_list=No more cares to add

View File

@ -7,3 +7,81 @@ navbar.cares_and_behaviors = Care and Behaviors
footer.source_code=Source code
footer.license=Application under {0} license
progression.value.NOT_TRAINED=Not trained
progression.value.CURRENTLY_TRAINING=Currently training
progression.value.TRAINED=Done
progression.by_me=Progression by me
progression.by_someone_else=Progression by someone else
progression.by_veterinary=Done by veterinary
register.title=Sign up
register.label.login=Username:
register.placeholder.login=Username
register.label.password=Password:
register.placeholder.password=Password
register.label.password_check=Check password:
register.placeholder.password_check=Password
register.button.submit=Create
authentication.title=Authentication
authentication.label.login=Username:
authentication.placeholder.login=Username
authentication.label.password=Password:
authentication.placeholder.password=Password
authentication.button.submit=Login
animal_list.delete.modal_body=Do you want to delete this animal?
modal_button.delete=Delete
modal_button.cancel=Cancel
animal_cares_and_behaviors.delete.modal_body.behavior=Do you want to delete this behavior?
animal_cares_and_behaviors.delete.modal_body.care=Do you want to delete this care?
animal_list.title=Your animals' list
animal_list.animal_list.title=Your animals' list
animal_list.animal.add.title=Add an animal
animal_list.animal.add.label=Animal's name:
animal_list.animal.add.placeholder=Name
animal_list.animal.add.tooltip=Add
animal_list.change_password.title=Change password
animal_list.change_password.old_password.label=Old password:
animal_list.change_password.old_password.placeholder=Old password
animal_list.change_password.new_password.label=New password:
animal_list.change_password.new_password.placeholder=New password
animal_list.change_password.new_password_check.label=New password:
animal_list.change_password.new_password_check.placeholder=Check new password
animal_list.change_password.submit=Change password
progression.title={0} sheet
progression.table.column.care=Care
progression.table.column.behavior=Consent behavior
animal_care_and_behavior.title={0} sheet
animal_care_and_behavior.care_list=Cares list
animal_care_and_behavior.add_care=Add care
animal_care_and_behavior.add_care.care_name.placeholder=Care name
animal_care_and_behavior.add_care.care_description.placeholder=Care description (optional)
animal_care_and_behavior.add_care.button.submit=Add
animal_care_and_behavior.behavior_list=Consent behaviors list
animal_care_and_behavior.add_behavior=Add consent behavior
animal_care_and_behavior.add_behavior.care_name.placeholder=Consent behavior
animal_care_and_behavior.add_behavior.care_description.placeholder=Consent behavior description (optional)
animal_care_and_behavior.add_behavior.button.submit=Add
animal_care_and_behavior.button.delete.tooltip=Delete
animal_care.title={0} sheet
animal_care.subtitle=Progression of "{0}"
animal_behavior.title={0} sheet
animal_list.animal.delete.tooltip=Delete
animal_care.add_behavior.empty_list=No more consent behaviors to add
animal_care.add_behavior=Add a consent behavior to this care
animal_care.button.delete.tooltip=Delete
animal_care.button.add.tooltip=Add
animal_care.table.executed_by_veterinary=Execute by veterinary
animal_care.table.executed_by_someone_else=Execute by someone else
animal_care.table.executed_by_me=Execute by me
animal_care.table.behavior=Consent behavior
animal_behavior.subtitle=Progression of "{0}"
animal_behavior.table.care=Care
animal_behavior.table.executed_by_me=Execute by me
animal_behavior.table.executed_by_someone_else=Execute by someone else
animal_behavior.table.executed_by_veterinary=Execute by veterinary
animal_behavior.button.delete.tooltip=Delete
animal_behavior.button.add.tooltip=Add
animal_behavior.add_care=Add care to this consent behavior
animal_behavior.add_care.empty_list=No more cares to add

View File

@ -7,3 +7,81 @@ navbar.cares_and_behaviors = Soins et Comportements
footer.source_code=Code source
footer.license=Application sous licence {0}
progression.value.NOT_TRAINED=Non entrainn\u00e9
progression.value.CURRENTLY_TRAINING=En cours
progression.value.TRAINED=Fait
progression.by_me=Progression par moi
progression.by_someone_else=Progression par quelqu'un d'autre
progression.by_veterinary=R\u00e9alis\u00e9 par le v\u00e9t\u00e9rinaire
register.title=Cr\u00e9ation du compte
register.label.login=Nom d'utilisateur :
register.placeholder.login=Nom d'utilisateur
register.label.password=Mot de passe :
register.placeholder.password=Mot de passe
register.label.password_check=V\u00e9rification du mot de passe :
register.placeholder.password_check=Mot de passe
register.button.submit=Cr\u00e9er
authentication.title=Authentification
authentication.label.login=Nom d'utilisateur :
authentication.placeholder.login=Nom d'utilisateur
authentication.label.password=Mot de passe :
authentication.placeholder.password=Mot de passe
authentication.button.submit=Connexion
animal_list.delete.modal_body=Voulez-vous vraiment supprimer cet animal ?
modal_button.delete=Supprimer
modal_button.cancel=Annuler
animal_cares_and_behaviors.delete.modal_body.behavior=Voulez-vous vraiment supprimer ce comportement ?
animal_cares_and_behaviors.delete.modal_body.care=Voulez-vous vraiment supprimer ce soin ?
animal_list.title=Liste de vos animaux
animal_list.animal_list.title=Liste de vos animaux
animal_list.animal.add.title=Ajouter un animal
animal_list.animal.add.label=Nom de l'animal :
animal_list.animal.add.placeholder=Nom
animal_list.animal.add.tooltip=Ajouter
animal_list.change_password.title=Changer de mot de passe
animal_list.change_password.old_password.label=Ancien mot de passe :
animal_list.change_password.old_password.placeholder=Ancien mot de passe
animal_list.change_password.new_password.label=Nouveau mot de passe :
animal_list.change_password.new_password.placeholder=Nouveau mot de passe
animal_list.change_password.new_password_check.label=Nouveau mot de passe :
animal_list.change_password.new_password_check.placeholder=V\u00e9rification nouveau mot de passe
animal_list.change_password.submit=Changer le mot de passe
progression.title=Feuille de {0}
progression.table.column.care=Soin
progression.table.column.behavior=Comportement de consentement
animal_care_and_behavior.title=Feuille de {0}
animal_care_and_behavior.care_list=Liste des soins
animal_care_and_behavior.add_care=Ajouter un soin
animal_care_and_behavior.add_care.care_name.placeholder=Nom du soin
animal_care_and_behavior.add_care.care_description.placeholder=Description du soin (optionelle)
animal_care_and_behavior.add_care.button.submit=Ajouter
animal_care_and_behavior.behavior_list=Liste des comportements de consentements
animal_care_and_behavior.add_behavior=Ajouter un comportement de consentement
animal_care_and_behavior.add_behavior.care_name.placeholder=Comportement de consentement
animal_care_and_behavior.add_behavior.care_description.placeholder=Description du comportement de consentement (optionelle)
animal_care_and_behavior.add_behavior.button.submit=Ajouter
animal_care_and_behavior.button.delete.tooltip=Supprimer
animal_care.title=Feuille de {0}
animal_behavior.title=Feuille de {0}
animal_care.subtitle=Progression de "{0}"
animal_list.animal.delete.tooltip=Supprimer
animal_care.table.behavior=Comportement de consentement
animal_care.table.executed_by_me=Ex\u00e9cut\u00e9 par moi
animal_care.table.executed_by_someone_else=Ex\u00e9cut\u00e9 par quelqu'un d'autre
animal_care.table.executed_by_veterinary=Ex\u00e9cut\u00e9 par le v\u00e9t\u00e9rinaire
animal_care.button.delete.tooltip=Supptimer
animal_care.button.add.tooltip=Ajouter
animal_care.add_behavior=Ajouter un comportement de consentement \u00e0 ce soin
animal_care.add_behavior.empty_list=Aucun comportements de consentement \u00e0 ajouter
animal_behavior.subtitle=Progression de "{0}"
animal_behavior.table.care=Soin
animal_behavior.table.executed_by_me=Ex\u00e9cut\u00e9 par moi
animal_behavior.table.executed_by_someone_else=Ex\u00e9cut\u00e9 par quelqu'un d'autre
animal_behavior.table.executed_by_veterinary=Ex\u00e9cut\u00e9 par le v\u00e9t\u00e9rinaire
animal_behavior.button.delete.tooltip=Supprimer
animal_behavior.button.add.tooltip=Ajouter
animal_behavior.add_care=Ajouter un soin \u00e0 ce comportement de consentement
animal_behavior.add_care.empty_list=Aucun soins \u00e0 ajouter

View File

@ -32,18 +32,25 @@
<body>
<div class="container">
<%@ include file="base/navbar.jsp" %>
<center><h1>Feuille de ${MODEL_MAP_ANIMAL.getName()}</h1></center>
<h4>${MODEL_MAP_ANIMAL.getConsentBehaviorById(MODEL_MAP_ANIMAL_CONSENT_BEHAVIOR_ID).getName()}</h4>
<center><h1>
<fmt:message key="animal_behavior.title">
<fmt:param value="${MODEL_MAP_ANIMAL.getName()}" />
</fmt:message>
</h1></center>
<h3>
<fmt:message key="animal_behavior.subtitle">
<fmt:param value="${MODEL_MAP_ANIMAL.getConsentBehaviorById(MODEL_MAP_ANIMAL_CONSENT_BEHAVIOR_ID).getName()}" />
</fmt:message>
</h3>
<p>${MODEL_MAP_ANIMAL.getConsentBehaviorById(MODEL_MAP_ANIMAL_CONSENT_BEHAVIOR_ID).getDescription()}</p>
<h4>Progression</h4>
<table class="table table-hover">
<thead>
<tr>
<th>Soins</th>
<th>Réalisé par moi</th>
<th>Réalisé par quelqu'un d'autre</th>
<th>Réalisé par le vétérinaire</th>
<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>
@ -55,21 +62,37 @@
<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>
">${progression.getProgressionByMe()}</td>
">
<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>
">${progression.getProgressionBySomeoneElse()}</td>
">
<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>
">${progression.getProgressionByVeterinary()}</td>
">
<a href="${animalURL}/${MODEL_MAP_ANIMAL.getId()}/progression_by_veterinary/${progression.getProgressionByVeterinary()}">
<fmt:message key="progression.value.${progression.getProgressionByVeterinary()}"></fmt:message>
</a>
</td>
<td>
<!--TODO MODIFICATION-->
<form class="pull-right" action="${animalDeleteProgressionURL}/${progression.getId()}" method="POST">
<button class="btn btn-danger" type="submit" data-toggle="tooltip" data-placement="bottom" title="Suppression"><span class="glyphicon glyphicon-trash" aria-hidden="true"></span></button>
<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>
</td>
</tr>
@ -78,8 +101,14 @@
</table>
<hr/>
<h4>Ajouter un soins pour ce comportement de consentement</h4>
<h4><fmt:message key="animal_behavior.add_care"></fmt:message></h4>
<c:if test="${MODEL_MAP_LIST_REMAINING_CARES.size() == 0}" >
<p><fmt:message key="animal_behavior.add_care.empty_list"></fmt:message></p>
</c:if>
<c:if test="${MODEL_MAP_LIST_REMAINING_CARES.size() != 0}" >
<form class="form-inline" action="${animalAddProgressionURL}" method="POST">
<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="consent_behavior_id" value="${MODEL_MAP_ANIMAL_CONSENT_BEHAVIOR_ID}" hidden />
<label class="sr-only" for="form_care_id">Care ID</label>
@ -89,10 +118,59 @@
</c:forEach>
</select>
<input id="form_care_id" name="care_id" value="${MODEL_MAP_ANIMAL_CONSENT_BEHAVIOR_ID}" hidden />
<button class="btn btn-success" type="submit" data-toggle="tooltip" data-placement="bottom" title="Ajouter"><span class="glyphicon glyphicon-plus" aria-hidden="true"></span></button>
<button class="btn btn-success" type="submit" data-toggle="tooltip" data-placement="bottom" title="<fmt:message key="animal_behavior.button.add.tooltip"></fmt:message>"><span class="glyphicon glyphicon-plus" aria-hidden="true"></span></button>
</form>
</c:if>
<%@ include file="base/footer.jsp" %>
</div>
<div id="modal_delete_animal_progression" 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_delete_animal_progression_title" class="modal-title"></h4>
</div>
<div class="modal-body">
<p id="modal_delete_animal_progression_body"><fmt:message key="animal_cares_and_behaviors.delete.modal_body.care"></fmt:message></p>
</div>
<div class="modal-footer">
<form id="modal_delete_animal_progression_validate_delete" class="pull-right" action="" method="POST">
<button type="button" class="btn btn-default" data-dismiss="modal"><fmt:message key="modal_button.cancel"></fmt:message></button>
<button type="submit" class="btn btn-danger"><fmt:message key="modal_button.delete"></fmt:message></button>
<input id="form_page" name="page" value="consent_behavior" hidden />
<input id="form_consent_behavior_id" name="redirect_id" value="${MODEL_MAP_ANIMAL_CONSENT_BEHAVIOR_ID}" hidden />
</form>
</div>
</div>
</div>
</div>
</body>
<script type="text/javascript">
$(document).ready(function () {
$('[data-toggle="tooltip"]').tooltip();
$("form").submit(function (event) {
if ($(this).attr('id') !== 'modal_delete_animal_progression_validate_delete') {
var formUrl = $(this).attr('action');
if (formUrl.startsWith('${animalDeleteProgressionURL}')) {
// Only for deleting care or behavior forms
var behaviorName = $(this).find('input')[0].value;
$('#modal_delete_animal_progression_title').text(behaviorName);
$('#modal_delete_animal_progression_validate_delete').attr('action', formUrl);
$('#modal_delete_animal_progression').modal({
show: true
});
event.preventDefault();
}
}
});
});
</script>
</html>

View File

@ -32,18 +32,25 @@
<body>
<div class="container">
<%@ include file="base/navbar.jsp" %>
<center><h1>Feuille de ${MODEL_MAP_ANIMAL.getName()}</h1></center>
<h4>${MODEL_MAP_ANIMAL.getCareById(MODEL_MAP_ANIMAL_CARE_ID).getName()}</h4>
<center><h1>
<fmt:message key="animal_care.title">
<fmt:param value="${MODEL_MAP_ANIMAL.getName()}" />
</fmt:message>
</h1></center>
<h3>
<fmt:message key="animal_care.subtitle">
<fmt:param value="${MODEL_MAP_ANIMAL.getCareById(MODEL_MAP_ANIMAL_CARE_ID).getName()}" />
</fmt:message>
</h3>
<p>${MODEL_MAP_ANIMAL.getCareById(MODEL_MAP_ANIMAL_CARE_ID).getDescription()}</p>
<h4>Progression</h4>
<table class="table table-hover">
<thead>
<tr>
<th>Comportement de consentement</th>
<th>Réalisé par moi</th>
<th>Réalisé par quelqu'un d'autre</th>
<th>Réalisé par le vétérinaire</th>
<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>
@ -57,23 +64,35 @@
<c:if test="${progression.getProgressionByMe() == 'NOT_TRAINED'}">active</c:if>
">
<a href="${animalURL}/${MODEL_MAP_ANIMAL.getId()}/progression_by_me/${progression.getProgressionByMe()}">
${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>
">${progression.getProgressionBySomeoneElse()}</td>
">
<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>
">${progression.getProgressionByVeterinary()}</td>
">
<a href="${animalURL}/${MODEL_MAP_ANIMAL.getId()}/progression_by_veterinary/${progression.getProgressionByVeterinary()}">
<fmt:message key="progression.value.${progression.getProgressionByVeterinary()}"></fmt:message>
</a>
</td>
<td>
<!--TODO MODIFICATION-->
<form class="pull-right" action="${animalDeleteProgressionURL}/${progression.getId()}" method="POST">
<button class="btn btn-danger" type="submit" data-toggle="tooltip" data-placement="bottom" title="Suppression"><span class="glyphicon glyphicon-trash" aria-hidden="true"></span></button>
<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>
</td>
</tr>
@ -82,8 +101,14 @@
</table>
<hr/>
<h4>Ajouter un comportement de consentement pour ce soin</h4>
<h4><fmt:message key="animal_care.add_behavior"></fmt:message></h4>
<c:if test="${MODEL_MAP_LIST_REMAINING_CONSENT_BEHAVIORS.size() == 0}" >
<p><fmt:message key="animal_care.add_behavior.empty_list"></fmt:message></p>
</c:if>
<c:if test="${MODEL_MAP_LIST_REMAINING_CONSENT_BEHAVIORS.size() != 0}" >
<form class="form-inline" action="${animalAddProgressionURL}" method="POST">
<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="care_id" value="${MODEL_MAP_ANIMAL_CARE_ID}" hidden />
<label class="sr-only" for="form_consent_behavior_id">Consent Behavior ID</label>
@ -92,10 +117,59 @@
<option value="${consent_behavior.getId()}">${consent_behavior.getName()}</option>
</c:forEach>
</select>
<button class="btn btn-success" type="submit" data-toggle="tooltip" data-placement="bottom" title="Ajouter"><span class="glyphicon glyphicon-plus" aria-hidden="true"></span></button>
<button class="btn btn-success" type="submit" data-toggle="tooltip" data-placement="bottom" title="<fmt:message key="animal_care.button.add.tooltip"></fmt:message>"><span class="glyphicon glyphicon-plus" aria-hidden="true"></span></button>
</form>
</c:if>
<%@ include file="base/footer.jsp" %>
</div>
<div id="modal_delete_animal_progression" 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_delete_animal_progression_title" class="modal-title"></h4>
</div>
<div class="modal-body">
<p id="modal_delete_animal_progression_body"><fmt:message key="animal_cares_and_behaviors.delete.modal_body.behavior"></fmt:message></p>
</div>
<div class="modal-footer">
<form id="modal_delete_animal_progression_validate_delete" class="pull-right" action="" method="POST">
<button type="button" class="btn btn-default" data-dismiss="modal"><fmt:message key="modal_button.cancel"></fmt:message></button>
<button type="submit" class="btn btn-danger"><fmt:message key="modal_button.delete"></fmt:message></button>
<input id="form_page" name="page" value="care" hidden />
<input id="form_care_id" name="redirect_id" value="${MODEL_MAP_ANIMAL_CARE_ID}" hidden />
</form>
</div>
</div>
</div>
</div>
</body>
<script type="text/javascript">
$(document).ready(function () {
$('[data-toggle="tooltip"]').tooltip();
$("form").submit(function (event) {
if ($(this).attr('id') !== 'modal_delete_animal_progression_validate_delete') {
var formUrl = $(this).attr('action');
if (formUrl.startsWith('${animalDeleteProgressionURL}')) {
// Only for deleting care or behavior forms
var careName = $(this).find('input')[0].value;
$('#modal_delete_animal_progression_title').text(careName);
$('#modal_delete_animal_progression_validate_delete').attr('action', formUrl);
$('#modal_delete_animal_progression').modal({
show: true
});
event.preventDefault();
}
}
});
});
</script>
</html>

View File

@ -35,13 +35,17 @@
<body>
<div class="container">
<%@ include file="base/navbar.jsp" %>
<center><h1>Feuille de ${MODEL_MAP_ANIMAL.getName()}</h1></center>
<center><h1>
<fmt:message key="animal_care_and_behavior.title">
<fmt:param value="${MODEL_MAP_ANIMAL.getName()}" />
</fmt:message>
</h1></center>
<div class="row">
<div class="col-lg-1">
</div>
<div class="col-lg-5">
<h4>Liste des soins</h4>
<h4><fmt:message key="animal_care_and_behavior.care_list"></fmt:message></h4>
<div class="list-group">
<c:forEach items="${MODEL_MAP_ANIMAL.getListCares()}" var="care">
<a href="${animalURL}/${MODEL_MAP_ANIMAL.getId()}/care/${care.getId()}" class="list-group-item">
@ -49,7 +53,8 @@
<div class="col-lg-12">
${care.getName()}
<form class="pull-right" action="${animalDeleteCareURL}/${care.getId()}" method="POST">
<button class="btn btn-danger" type="submit" data-toggle="tooltip" data-placement="bottom" title="Suppression"><span class="glyphicon glyphicon-trash" aria-hidden="true"></span></button>
<input value="${care.getName()}" hidden />
<button class="btn btn-danger" type="submit" data-toggle="tooltip" data-placement="bottom" title="<fmt:message key="animal_care_and_behavior.button.delete.tooltip"></fmt:message>"><span class="glyphicon glyphicon-trash" aria-hidden="true"></span></button>
</form>
</div>
</div>
@ -61,11 +66,11 @@
</c:forEach>
</div>
<hr/>
<h4>Ajouter un soin</h4>
<h4><fmt:message key="animal_care_and_behavior.add_care"></fmt:message></h4>
<form id="addCareForm" action="${animalAddCareURL}" method="POST">
<input type="text" id="form_care_name" name="name" class="form-control" placeholder="Soin" required />
<textarea id="form_care_description_name" name="description" class="form-control" placeholder="Description du soin (optionel)" ></textarea>
<button class="btn btn btn-primary" type="submit">Ajouter</button>
<input type="text" id="form_care_name" name="name" class="form-control" placeholder="<fmt:message key="animal_care_and_behavior.add_care.care_name.placeholder"></fmt:message>" required />
<textarea id="form_care_description_name" name="description" class="form-control" placeholder="<fmt:message key="animal_care_and_behavior.add_care.care_description.placeholder"></fmt:message>" ></textarea>
<button class="btn btn btn-primary" type="submit"><fmt:message key="animal_care_and_behavior.add_care.button.submit"></fmt:message></button>
</form>
</div>
@ -73,7 +78,7 @@
</div>
<div class="col-lg-5">
<h4>Liste des comportements de consentements</h4>
<h4><fmt:message key="animal_care_and_behavior.behavior_list"></fmt:message></h4>
<div class="list-group">
<c:forEach items="${MODEL_MAP_ANIMAL.getListConsentBehavior()}" var="consentBehavior">
<a href="${animalURL}/${MODEL_MAP_ANIMAL.getId()}/consent_behavior/${consentBehavior.getId()}" class="list-group-item">
@ -81,7 +86,8 @@
<div class="col-lg-12">
${consentBehavior.getName()}
<form class="pull-right" action="${animalDeleteConsentBehaviorURL}/${consentBehavior.getId()}" method="POST">
<button class="btn btn-danger" type="submit" data-toggle="tooltip" data-placement="bottom" title="Suppression"><span class="glyphicon glyphicon-trash" aria-hidden="true"></span></button>
<input value="${consentBehavior.getName()}" hidden />
<button class="btn btn-danger" type="submit" data-toggle="tooltip" data-placement="bottom" title="<fmt:message key="animal_care_and_behavior.button.delete.tooltip"></fmt:message>"><span class="glyphicon glyphicon-trash" aria-hidden="true"></span></button>
</form>
</div>
</div>
@ -93,16 +99,67 @@
</c:forEach>
</div>
<hr/>
<h4>Ajouter un comportement de consentement</h4>
<h4><fmt:message key="animal_care_and_behavior.add_behavior"></fmt:message></h4>
<form id="addCareForm" action="${animalAddConsentBehaviorURL}" method="POST">
<input type="text" id="form_consent_behavior_name" name="name" class="form-control" placeholder="Comportement de consentement" required />
<textarea id="form_consent_behavior_description_name" name="description" class="form-control" placeholder="Description du comportement de consentement (optionel)" ></textarea>
<button class="btn btn btn-primary" type="submit">Ajouter</button>
<input type="text" id="form_consent_behavior_name" name="name" class="form-control" placeholder="<fmt:message key="animal_care_and_behavior.add_behavior.care_name.placeholder"></fmt:message>" required />
<textarea id="form_consent_behavior_description_name" name="description" class="form-control" placeholder="<fmt:message key="animal_care_and_behavior.add_behavior.care_description.placeholder"></fmt:message>" ></textarea>
<button class="btn btn btn-primary" type="submit"><fmt:message key="animal_care_and_behavior.add_behavior.button.submit"></fmt:message></button>
</form>
</div>
</div>
<%@ include file="base/footer.jsp" %>
</div>
<div id="modal_delete_animal_care_or_behavior" 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_delete_animal_care_or_behavior_title" class="modal-title"></h4>
</div>
<div class="modal-body">
<p id="modal_delete_animal_care_or_behavior_body"></p>
</div>
<div class="modal-footer">
<form id="modal_delete_animal_care_or_behavior_validate_delete" class="pull-right" action="" method="POST">
<button type="button" class="btn btn-default" data-dismiss="modal"><fmt:message key="modal_button.cancel"></fmt:message></button>
<button type="submit" class="btn btn-danger"><fmt:message key="modal_button.delete"></fmt:message></button>
</form>
</div>
</div>
</div>
</div>
</body>
<script type="text/javascript">
$(document).ready(function () {
$('[data-toggle="tooltip"]').tooltip();
$("form").submit(function (event) {
if ($(this).attr('id') !== 'modal_delete_animal_care_or_behavior_validate_delete') {
var formUrl = $(this).attr('action');
if (formUrl.startsWith('${animalDeleteCareURL}') || formUrl.startsWith('${animalDeleteConsentBehaviorURL}')) {
// Only for deleting care or behavior forms
var careOrBehaviorName = $(this).find('input')[0].value;
$('#modal_delete_animal_care_or_behavior_title').text(careOrBehaviorName);
$('#modal_delete_animal_care_or_behavior_validate_delete').attr('action', formUrl);
if (formUrl.startsWith('${animalDeleteCareURL}')) {
$('#modal_delete_animal_care_or_behavior_body').text('<fmt:message key="animal_cares_and_behaviors.delete.modal_body.care"></fmt:message>');
} else if (formUrl.startsWith('${animalDeleteConsentBehaviorURL}')) {
$('#modal_delete_animal_care_or_behavior_body').text('<fmt:message key="animal_cares_and_behaviors.delete.modal_body.behavior"></fmt:message>');
}
$('#modal_delete_animal_care_or_behavior').modal({
show: true
});
event.preventDefault();
}
}
});
});
</script>
</html>

View File

@ -4,6 +4,7 @@
<%@ taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<%@ page isELIgnored="false" %>
<spring:url value="/animal/delete" var="animalDeleteURL" />
<spring:url value="/change_password" var="changePasswordURL" />
<%@ include file="base/language.jsp" %>
@ -31,19 +32,20 @@
<body>
<div class="container">
<%@ include file="base/navbar.jsp" %>
<center><h1><fmt:message key="animal_list.title"></fmt:message></h1></center>
<div class="row">
<div class="col-lg-3">
<h4>List de vos animaux</h4>
<div class="col-lg-5">
<h4><fmt:message key="animal_list.animal_list.title"></fmt:message></h4>
<div class="list-group">
<c:forEach items="${MODEL_MAP_ANIMAL_LIST}" var="animal">
<a class="list-group-item" href="${animalURL}/${animal.getId()}/cares_and_behaviors">
${animal.getName()}
<form class="pull-right" action="${animalDeleteURL}/${animal.getId()}" method="POST">
<button class="btn btn-xs btn-danger" type="submit" data-toggle="tooltip" data-placement="bottom" title="Suppression"><span class="glyphicon glyphicon-trash" aria-hidden="true"></span></button>
<input value="${animal.getName()}" hidden />
<button class="btn btn-xs btn-danger" type="submit" data-toggle="tooltip" data-placement="bottom" title="<fmt:message key="animal_list.animal.delete.tooltip"></fmt:message>"><span class="glyphicon glyphicon-trash" aria-hidden="true"></span></button>
</form>
</a>
<!-- <div class="list-group-item">
<!-- <div class="list-group-item">
${animal.getName()}
<form class="pull-right" action="${animalDeleteURL}/${animal.getId()}" method="POST">
<button class="btn btn-sm btn-danger" type="submit" data-toggle="tooltip" data-placement="bottom" title="Suppression"><span class="glyphicon glyphicon-trash" aria-hidden="true"></span></button>
@ -51,28 +53,93 @@
</div>-->
</c:forEach>
</div>
</div>
<div class="col-lg-3">
</div>
<div class="col-lg-6">
<h4>Ajouter un animal</h4>
<hr/>
<h4><fmt:message key="animal_list.animal.add.title"></fmt:message></h4>
<form id="addAnimalForm" class="form-inline" action="${animalURL}" method="POST">
<div class="form-group">
<label for="form_animal_name">Nom de l'animal :</label>
<input type="text" id="form_animal_name" name="name" class="form-control" placeholder="Nom" />
<label for="form_animal_name"><fmt:message key="animal_list.animal.add.label"></fmt:message></label>
<input type="text" id="form_animal_name" name="name" class="form-control" placeholder="<fmt:message key="animal_list.animal.add.placeholder"></fmt:message>" />
</div>
<button class="btn btn btn-primary" type="submit">Ajouter</button>
<button class="btn btn btn-success" type="submit" data-toggle="tooltip" data-placement="bottom" title="<fmt:message key="animal_list.animal.add.tooltip"></fmt:message>"><span class="glyphicon glyphicon-plus" aria-hidden="true"></span></button>
</form>
</div>
<div class="col-lg-2">
</div>
<div class="col-lg-5">
<h4><fmt:message key="animal_list.change_password.title"></fmt:message></h4>
<form id="changePasswordForm" action="${changePasswordURL}" method="POST">
<div class="form-group">
<label for="old_password"><fmt:message key="animal_list.change_password.old_password.label"></fmt:message></label>
<input type="password" id="old_password" name="old_password" class="form-control" placeholder="<fmt:message key="animal_list.change_password.old_password.placeholder"></fmt:message>" required/>
<label for="password"><fmt:message key="animal_list.change_password.new_password.label"></fmt:message></label>
<input type="password" id="password" name="password" class="form-control" placeholder="<fmt:message key="animal_list.change_password.new_password.placeholder"></fmt:message>" required/>
<label for="password_check"><fmt:message key="animal_list.change_password.new_password_check.label"></fmt:message></label>
<input type="password" id="password_check" name="password_check" class="form-control" placeholder="<fmt:message key="animal_list.change_password.new_password_check.placeholder"></fmt:message>" required/>
</div>
<button class="btn btn btn-primary" type="submit"><fmt:message key="animal_list.change_password.submit"></fmt:message></button>
</form>
<c:if test="${MODEL_MAP_CHANGE_PASSWORD_ERROR_MESSAGE == 'true'}">
<div class="list-group">
<h5 class="list-group-item list-group-item-danger" style="border-radius: 5px;">Erreur lors de la mise à jour du mot de passe</h5>
</div>
</c:if>
<c:if test="${MODEL_MAP_CHANGE_PASSWORD_SUCCESS_MESSAGE == 'true'}">
<div class="list-group">
<h5 class="list-group-item list-group-item-success" style="border-radius: 5px;">Mot de passe mit à jour avec succès</h5>
</div>
</c:if>
</div>
</div>
<%@ include file="base/footer.jsp" %>
</div>
<div id="modal_delete_animal" 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_delete_animal_title" class="modal-title">Animal name</h4>
</div>
<div class="modal-body">
<p id="modal_delete_animal_body"><fmt:message key="animal_list.delete.modal_body"></fmt:message></p>
</div>
<div class="modal-footer">
<form id="modal_delete_animal_validate_delete" class="pull-right" action="" method="POST">
<button type="button" class="btn btn-default" data-dismiss="modal"><fmt:message key="modal_button.cancel"></fmt:message></button>
<button type="submit" class="btn btn-danger"><fmt:message key="modal_button.delete"></fmt:message></button>
</form>
</div>
</div>
</div>
</div>
</body>
<script>
<script type="text/javascript">
$(document).ready(function () {
$('[data-toggle="tooltip"]').tooltip();
$("form").submit(function (event) {
if ($(this).attr('id') !== 'modal_delete_animal_validate_delete') {
var formUrl = $(this).attr('action');
if (formUrl.startsWith('${animalDeleteURL}')) {
// Only for deleting animal forms
var animalName = $(this).find('input')[0].value;
$('#modal_delete_animal_title').text(animalName);
$('#modal_delete_animal_validate_delete').attr('action', formUrl);
$('#modal_delete_animal').modal({
show: true
});
event.preventDefault();
}
}
});
});
</script>
</html>

View File

@ -30,13 +30,17 @@
<body>
<div class="container">
<%@ include file="base/navbar.jsp" %>
<center><h1>Feuille de ${MODEL_MAP_ANIMAL.getName()}</h1></center>
<h4>Progression par moi ${MODEL_MAP_PROGRESSION}</h4>
<center><h1>
<fmt:message key="progression.title">
<fmt:param value="${MODEL_MAP_ANIMAL.getName()}" />
</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>Soin</th>
<th>Comportement de consentement</th>
<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>
@ -55,4 +59,10 @@
<%@ include file="base/footer.jsp" %>
</div>
</body>
<script type="text/javascript">
$(document).ready(function () {
$('[data-toggle="tooltip"]').tooltip();
});
</script>
</html>

View File

@ -18,16 +18,15 @@
<spring:url value="/login" var="loginURL_POST" />
<form id="loginForm" class="form-signin" action="${loginURL_POST}" method="POST">
<h2 class="form-signin-heading">Authentification</h2>
<h2 class="form-signin-heading"><fmt:message key="authentication.title"></fmt:message></h2>
<!--
<input type="text" id="inputLogin" name="inputLogin" class="form-control" placeholder="Login" required autofocus />
<input type="password" id="inputPassword" name="inputPassword" class="form-control" placeholder="Mot de passe" required />
-->
<input type="text" id="inputLogin" name="username" class="form-control" placeholder="Login" required autofocus />
<input type="password" id="inputPassword" name="password" class="form-control" placeholder="Mot de passe" required />
<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 />
<button class="btn btn-lg btn-primary btn-block" type="submit">Valider</button>
<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>
<br/>
<p id="errorAuth" style="color: red;" hidden>Erreur lors de l'authentification</p>

View File

@ -1,6 +1,5 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ page isELIgnored="false"%>
<%@ include file="base/language.jsp" %>
@ -18,14 +17,18 @@
<spring:url value="/register" var="registerURL_POST" />
<form id="loginForm" class="form-signin" action="${registerURL_POST}" method="POST">
<h2 class="form-signin-heading">Création d'un compte</h2>
<h2 class="form-signin-heading"><fmt:message key="register.title"></fmt:message></h2>
<input type="text" id="inputLogin" name="username" class="form-control" placeholder="Login" required autofocus value="${MODEL_MAP_REGISTER_USERNAME}" />
<input type="password" id="inputPassword" name="password" class="form-control" placeholder="Mot de passe" required />
<input type="password" id="inputPassword" name="password_check" class="form-control" placeholder="Vérification mot de passe" required />
<input type="text" id="inputLogin" name="name" class="form-control" placeholder="Nom" value="${MODEL_MAP_REGISTER_NAME}" />
<label for="username"><fmt:message key="register.label.login"></fmt:message></label>
<input type="text" id="username" name="username" class="form-control" placeholder="<fmt:message key="register.placeholder.login"></fmt:message>" required autofocus value="${MODEL_MAP_REGISTER_USERNAME}" />
<button class="btn btn-lg btn-primary btn-block" type="submit">Valider</button>
<label for="password"><fmt:message key="register.label.password"></fmt:message></label>
<input type="password" id="password" name="password" class="form-control" placeholder="<fmt:message key="register.placeholder.password"></fmt:message>" required />
<label for="password_check"><fmt:message key="register.label.password_check"></fmt:message></label>
<input type="password" id="password_check" name="password_check" class="form-control" placeholder="<fmt:message key="register.placeholder.password_check"></fmt:message>" required />
<button class="btn btn-lg btn-primary btn-block" type="submit"><fmt:message key="register.button.submit"></fmt:message></button>
<br/>
<p style="color: red;">${MODEL_MAP_REGISTER_ERROR_MESSAGE}</p>