List choices = f.getChoices();
if (choices.size() == 1) {
Choice c2 = new Choice(-1, new Formation(-1, "AUCUN"));
choices.add(1, c2);
Choice c3 = new Choice(-1, new Formation(-1, "AUCUN"));
choices.add(2, c3);
} else if (choices.size() == 2) {
Choice c3 = new Choice(-1, new Formation(-1, "AUCUN"));
choices.add(2, c3);
}
}
model.put("folders", finalizedByCandidate);
link = "wait";
/* The page of a secretary displaying folders with a paper version received but the version is incomplete, there are some attached documents missing */
} else if (action.equals("incomplete")) {
page.add("Secr�tariat : Liste des dossiers papiers incomplets.");
model.put("page", page);
/*
* Liste des dossier ayant recu une version papier mais
* incomplete
*/
List<Folder> incomplete = foldermanager.findPersonalInfoByState(Folder.FOLDER_INCOMPLETE);
for (Folder f : incomplete) {
List choices = f.getChoices();
if (choices.size() == 1) {
Choice c2 = new Choice(-1, new Formation(-1, "AUCUN"));
choices.add(1, c2);
Choice c3 = new Choice(-1, new Formation(-1, "AUCUN"));
choices.add(2, c3);
} else if (choices.size() == 2) {
Choice c3 = new Choice(-1, new Formation(-1, "AUCUN"));
choices.add(2, c3);
}
}
model.put("folders", incomplete);
link = "incomplete";
/* The page of a secretary displaying folders with a paper version received */
} else if (action.equals("complete")) {
page.add("Secr�tariat : Liste des dossiers papiers complets.");
model.put("page", page);
/* Liste des dossier ayant recu une version papier complete */
List<Folder> complete = foldermanager.findPersonalInfoByState(Folder.FOLDER_COMPLETE);
for (Folder f : complete) {
List choices = f.getChoices();
if (choices.size() == 1) {
Choice c2 = new Choice(-1, new Formation(-1, "AUCUN"));
choices.add(1, c2);
Choice c3 = new Choice(-1, new Formation(-1, "AUCUN"));
choices.add(2, c3);
} else if (choices.size() == 2) {
Choice c3 = new Choice(-1, new Formation(-1, "AUCUN"));
choices.add(2, c3);
}
}
model.put("folders", complete);
link = "complete";
/* The action of a secretary to marque a folder complete */
} else if (action.endsWith("completed")) {
id = Integer.parseInt(sId);
Folder folder = foldermanager.findFolderById(id);
int update = this.foldermanager.updatePersonalInfoState(id, Folder.FOLDER_COMPLETE);
/*Si update non reussit*/
if(update==0){
page.add("Echec");
message = "Le dossier de " + folder.getPi().getLastname() +" "+folder.getPi().getFirstname()+ " n\'a pas �t� transf�r� aux responsables.";
}else{
String path = request.getSession().getServletContext().getRealPath("/");
MailSenDer msd = new MailSenDer(path + "mail.properties");
boolean send = msd.sendAccuseDossierPapier(folder.getPi().getEmail(), folder.getPi().getLastname()
+ " " + folder.getPi().getFirstname());
if(send){
page.add("Confirmation");
message = "Le dossier de " + folder.getPi().getLastname() +" "+folder.getPi().getFirstname()+ " a �t� transf�r� aux responsables. Le candidat a �t� notifi�. Vous le trouverez dans la liste des dossiers complets.";
}else{
page.add("Confirmation et Echec");
message = "Le dossier de " + folder.getPi().getLastname() +" "+folder.getPi().getFirstname()+ " a �t� transf�r� aux responsables. Mais le candidat n'a pas �t� notifi�. Vous le trouverez dans la liste des dossiers complets.";
}
link = "complete";
}
model.put("page", page);
model.put("message", message);
/* The action of a secretary to notify a person of the state incomplete of his folder */
} else if (action.endsWith("notify")) {
String idtonotif = request.getParameter("id");
page.add("Choisissez les pieces manquantes");
model.put("idFolderToNotify", idtonotif);
model.put("page", page);
return new ModelAndView("secretary-notify", model);
/* The page of a secretary displaying folders which are accepted for a formation */
} else if (action.equals("admis")) {
page.add("Listes principales des candidats");
model.put("page", page);
List formations = foldermanager.getAllFormations();
model.put("formations", formations);
for (Iterator iterFormations = formations.iterator(); iterFormations
.hasNext();) {
Formation formation = (Formation) iterFormations.next();
List admis = foldermanager.findByStateAndFormation(Folder.FOLDER_ACCEPTED, formation);
model.put(formation.getLabel(), admis);
filename="ListePrincipale"+formation.getLabel();
model.put(filename, filename);
}
model.put("title", "Action");
link = "linkAccepted";
//filename = "Admis";
/* The page of a secretary displaying folders which are accepted on a complementary liste for a formation */
}else if (action.equals("complement")) {
page.add("Listes complementaire de candidats");
model.put("page", page);
List formations = foldermanager.getAllFormations();
model.put("formations", formations);
for (Iterator iterFormations = formations.iterator(); iterFormations
.hasNext();) {
Formation formation = (Formation) iterFormations.next();
List admis = foldermanager.findByStateAndFormation(Folder.FOLDER_COMPLEMENTARY, formation);
model.put(formation.getLabel(), admis);
filename="ListeComplementaire"+formation.getLabel();
model.put(filename, filename);
}
model.put("title", "Position");
link = "linkComplementary";
//filename = "Admis";
/* The page of notification of all candidates */
}else if(action.equals("finalmail")){
page.add("Notification finale des candidats par mail");
model.put("page", page);
model.put("confirmfinalmail", "confirmfinalmail");
return new ModelAndView("secretary-notify", model);
/* The page of a secretary displaying the processus of change of the password */
} else if (action.equals("changepass")) {
page.add("Changement du mot de passe");
model.put("page", page);
model.put("personnel", p);
return new ModelAndView("secretary-notify", model);
/* The page of a secretary displaying a detail of a folder */
} else if (action.equals("edit")) {
id = new Integer(sId);
Folder folder = foldermanager.findFolderById(id);
page.add("Secr�tariat : D�tails pour "
+ folder.getPi().getLastname() + " "
+ folder.getPi().getFirstname());
model.put("page", page);
model.put("folder", folder);
/* The action of a secretary which refuses a candidat from a principal list
* and accepts the first on a complementary list */
} else if(action.equals("desiste")){
id = new Integer(sId);
Advancement desiste = foldermanager.findAdvancementByPersonalInfoIdAndState(id,Folder.FOLDER_ACCEPTED);
if(desiste!=null){
page.add("Veuillez choisir la formation pour le d�sistement");
message = "Vous pouvez d�sister le candidat de plusieurs formations. Attention, le candidat sera refus� pour les formations choisies.";
model.put("page", page);
model.put("message", message);
List formations = new ArrayList();
for (Iterator iterFormations = desiste.getAdvancement().keySet().iterator(); iterFormations.hasNext();) {
Formation formation = (Formation) iterFormations.next();
formations.add(formation);
}
model.put("formationsdesistement", formations);