YACOSTest: Correction du à l'ajout de abstractText dans article
YACOSWeb: Modification d'un article qui marche (réenvoie d'un fichier ou pas)
This commit is contained in:
@@ -33,7 +33,7 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</td>
|
</td>
|
||||||
<td><a id="articleURL${i.index}" title="Download" href="<c:url value="/download.htm"><c:param name="articleId" value="${article.id}"/></c:url>"><img src="./images/cc-download_manager-128x128.png" alt="Download" /></a></td>
|
<td><a id="articleURL${i.index}" title="Download" href="<c:url value="/download.htm"><c:param name="articleId" value="${article.id}"/></c:url>"><img src="./images/cc-download_manager-128x128.png" alt="Download" /></a></td>
|
||||||
<td><a id="modifyArticle${i.index}" title="Modify" href="<c:url value="/submissionArticle.htm"><c:param name="action" value="modify"/><c:param name="articleID" value="${article.id}"/></c:url>"><img src="./images/cc-button_ok-128x128.png" alt="Modify" /></a></td>
|
<td><a id="modifyArticle${i.index}" title="Modify" href="<c:url value="/submissionArticle.htm"><c:param name="action" value="modify"/><c:param name="articleID" value="${article.id}"/></c:url>"><img src="./images/cc-kedit-128x128.png" alt="Modify" /></a></td>
|
||||||
<td><a id="suppressArticle${i.index}" title="Delete" href="javascript:deleteArticle(${article.id});"><img src="./images/cc-button_cancel-128x128.png" alt="Delete"/></a></td>
|
<td><a id="suppressArticle${i.index}" title="Delete" href="javascript:deleteArticle(${article.id});"><img src="./images/cc-button_cancel-128x128.png" alt="Delete"/></a></td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|||||||
@@ -1,75 +1,79 @@
|
|||||||
<%@ include file="/WEB-INF/decorators/include.jsp"%>
|
<%@ include file="/WEB-INF/decorators/include.jsp"%>
|
||||||
|
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<script type='text/javascript' src='./javascripts/prototype.js'></script>
|
<script type='text/javascript' src='./javascripts/prototype.js'></script>
|
||||||
<script type='text/javascript' src='./javascripts/scriptaculous.js'></script>
|
<script type='text/javascript' src='./javascripts/scriptaculous.js'></script>
|
||||||
<script type='text/javascript' src='./javascripts/effects.js'></script>
|
<script type='text/javascript' src='./javascripts/effects.js'></script>
|
||||||
<script type='text/javascript' src='./javascripts/yacos/submissionArticle.js'></script>
|
<script type='text/javascript'
|
||||||
</head>
|
src='./javascripts/yacos/submissionArticle.js'></script>
|
||||||
<body>
|
</head>
|
||||||
|
<body>
|
||||||
<h4 class="title">
|
|
||||||
<c:choose>
|
<h4 class="title"><c:choose>
|
||||||
<c:when test="${param['action'] eq 'modify'}">
|
<c:when test="${param['action'] eq 'modify'}">
|
||||||
<fmt:message key="submission.modify" />
|
<fmt:message key="submission.modify" />
|
||||||
</c:when>
|
</c:when>
|
||||||
<c:otherwise>
|
<c:otherwise>
|
||||||
<fmt:message key="submission.title" />
|
<fmt:message key="submission.title" />
|
||||||
</c:otherwise>
|
</c:otherwise>
|
||||||
</c:choose>
|
</c:choose></h4>
|
||||||
</h4>
|
|
||||||
|
<form:form method="post" enctype="multipart/form-data" commandName="submissionArticle">
|
||||||
<form:form method="post" enctype="multipart/form-data" commandName="submissionArticle">
|
<table>
|
||||||
<fieldset>
|
<tbody>
|
||||||
|
<tr>
|
||||||
<form:label path="title"><fmt:message key="form.submission.article.title" /></form:label> <form:input path="title"/> <span class="formError"><form:errors path="title"/></span> <br/><br />
|
<td class="formLabel"><fmt:message key="form.submission.article.title" /></td>
|
||||||
|
<td><form:input path="title" /> <span class="formError"><form:errors path="title" /></span></td>
|
||||||
<form:label path="theme"><fmt:message key="form.submission.article.theme" /></form:label> <form:input path="theme"/> <span class="formError"><form:errors path="theme"/></span><br/><br />
|
</tr>
|
||||||
|
<tr>
|
||||||
<form:label path="abstractText"><fmt:message key="form.submission.article.abstractText" /></form:label> <form:textarea path="abstractText" /><span class="formError"><form:errors path="abstractText"/></span><br/><br/>
|
<td class="formLabel"><fmt:message key="form.submission.article.theme" /></td>
|
||||||
|
<td><form:input path="theme" /> <span class="formError"><form:errors path="theme" /></span></td>
|
||||||
<hr/> <br/>
|
</tr>
|
||||||
|
<tr>
|
||||||
</fieldset>
|
<td class="formLabel"><fmt:message key="form.submission.article.abstractText" /></td>
|
||||||
<fieldset>
|
<td><form:textarea path="abstractText" cols="60" rows="10" /><span class="formError"><form:errors path="abstractText" /></span></td>
|
||||||
|
</tr>
|
||||||
<label for="listauthor"><fmt:message key="form.submission.listauthor" /></label> <br /><br />
|
<tr>
|
||||||
<form:label path="mainauthor"><fmt:message key="form.submission.mainauthor" /></form:label>: <b>${currentUser.firstName} ${currentUser.lastName}</b>
|
<td class="formLabel"><fmt:message key="form.submission.mainauthor" />:</td>
|
||||||
<br/> <br/>
|
<td><b>${currentUser.firstName} ${currentUser.lastName}</b></td>
|
||||||
<label for="newSecondaryAuthor"><fmt:message key="form.submission.secondaryauthor" /></label>
|
</tr>
|
||||||
<input id="newSecondaryAuthorInput" type="text" name="newSecondaryAuthor" />
|
<tr>
|
||||||
<input type="button" id="addSecondaryButton" name="addSecondary" value="<fmt:message key="button.add" />">
|
<td class="formLabel"><fmt:message key="form.submission.secondaryauthor" /></td>
|
||||||
|
<td><input id="newSecondaryAuthorInput" type="text" name="newSecondaryAuthor" />
|
||||||
<div id="secondaryAuthorList" class="dynamicList">
|
<input type="button" id="addSecondaryButton" name="addSecondary" value="<fmt:message key="button.add" />">
|
||||||
<div class="dynamicListHeader">
|
|
||||||
<fmt:message key="form.submission.secondaryauthor" />
|
<div id="secondaryAuthorList" class="dynamicList">
|
||||||
</div>
|
<div class="dynamicListHeader"><fmt:message key="form.submission.secondaryauthor" /></div>
|
||||||
<c:if test="${param['action'] eq 'modify'}">
|
<c:if test="${param['action'] eq 'modify'}">
|
||||||
<c:forEach items="${listSecondaryAuthors}" var="secAuthor" varStatus="i">
|
<c:forEach items="${listSecondaryAuthors}" var="secAuthor" varStatus="i">
|
||||||
<div class="dynamicListItem" style="height: 0px; width: 0px;" id="liste[${i.index}]">${secAuthor}<input type="hidden" id="liste[${i.index}]" name="liste[${i.index}]" value="${secAuthor}"/></div>
|
<div class="dynamicListItem" style="height: 0px; width: 0px;"
|
||||||
</c:forEach>
|
id="liste[${i.index}]">${secAuthor}<input type="hidden"
|
||||||
</c:if>
|
id="liste[${i.index}]" name="liste[${i.index}]"
|
||||||
</div>
|
value="${secAuthor}" /></div>
|
||||||
<input type="button" id="removeSecondaryButton" name="removeSecondary" value="<fmt:message key="button.removeSelected" />"/>
|
</c:forEach>
|
||||||
|
</c:if>
|
||||||
<br /><br />
|
</div>
|
||||||
</fieldset>
|
<input type="button" id="removeSecondaryButton" name="removeSecondary" value="<fmt:message key="button.removeSelected" />" /></td>
|
||||||
<hr />
|
</tr>
|
||||||
<fieldset>
|
<tr>
|
||||||
<br />
|
<td class="formLabel">File</td>
|
||||||
<div class="formError"><form:errors path="file"/></div>
|
<td><input type="file" name="file" /><div class="formError"><form:errors path="file" /></div></td>
|
||||||
File <input type="file" name="file"/>
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
<tfoot>
|
||||||
<br /><br />
|
<tr>
|
||||||
<input type="reset" value="<fmt:message key="button.reset" />"/>
|
<td> </td>
|
||||||
<input type="submit" value="<fmt:message key="button.OK" />"/> <br/><br/>
|
<td><input type="reset" value="<fmt:message key="button.reset" />" />
|
||||||
</fieldset>
|
<input type="submit" value="<fmt:message key="button.OK" />" /></td>
|
||||||
|
</tr>
|
||||||
|
</tfoot>
|
||||||
|
</table>
|
||||||
|
|
||||||
</form:form>
|
</form:form>
|
||||||
|
|
||||||
<a href="<c:url value="main.htm"/>">Home</a>
|
<a href="<c:url value="main.htm"/>">Home</a>
|
||||||
|
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
BIN
YACOSWeb/WebContent/images/cc-kedit-128x128.png
Normal file
BIN
YACOSWeb/WebContent/images/cc-kedit-128x128.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.8 KiB |
@@ -41,9 +41,10 @@ public class SArticleController extends SimpleFormController {
|
|||||||
Conference conf = SessionService.getInstance().getCurrentConference();
|
Conference conf = SessionService.getInstance().getCurrentConference();
|
||||||
// Fetching user
|
// Fetching user
|
||||||
User user = SessionService.getInstance().getCurrentUser();
|
User user = SessionService.getInstance().getCurrentUser();
|
||||||
|
|
||||||
String title = ((FormSubmission) command).getTitle();
|
String title = ((FormSubmission) command).getTitle();
|
||||||
String theme = ((FormSubmission) command).getTheme();
|
String theme = ((FormSubmission) command).getTheme();
|
||||||
|
String abstractText = ((FormSubmission) command).getAbstractText();
|
||||||
|
|
||||||
ArrayList<String> listSecondaryAuthor = new ArrayList<String>();
|
ArrayList<String> listSecondaryAuthor = new ArrayList<String>();
|
||||||
// Removes null entries from the list
|
// Removes null entries from the list
|
||||||
@@ -52,63 +53,114 @@ public class SArticleController extends SimpleFormController {
|
|||||||
listSecondaryAuthor.add(sAuthor);
|
listSecondaryAuthor.add(sAuthor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String nomFile="";
|
String action = request.getParameter("action");
|
||||||
|
if (action == null || action.equals(""))
|
||||||
try {
|
{
|
||||||
MultipartFile file = ((FormSubmission) command).getFile();
|
|
||||||
if (file == null || file.isEmpty()) {
|
String nomFile="";
|
||||||
errors.rejectValue("file", "form.submitArticle.noFile");
|
|
||||||
try {
|
try {
|
||||||
return showForm(request, response, errors);
|
MultipartFile file = ((FormSubmission) command).getFile();
|
||||||
} catch (Exception e) {
|
if (file == null || file.isEmpty()) {
|
||||||
e.printStackTrace();
|
errors.rejectValue("file", "form.submitArticle.noFile");
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
|
|
||||||
// Creates the article
|
|
||||||
Article newArticle = articleManager.addArticle(
|
|
||||||
title, theme, nomFile, user.getLogin(),
|
|
||||||
listSecondaryAuthor, Article.State.SUBMITED, conf.getId());
|
|
||||||
|
|
||||||
if(newArticle==null){
|
|
||||||
errors.reject("article.errors.didNotSave");
|
|
||||||
try {
|
try {
|
||||||
return showForm(request, response, errors);
|
return showForm(request, response, errors);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
byte b[] = file.getBytes();
|
|
||||||
|
|
||||||
String path = "conference"+conf.getId()+"/";
|
|
||||||
(new File(downloadDirPath+path)).mkdirs();
|
|
||||||
path += newArticle.getId()+"_"+file.getOriginalFilename();
|
|
||||||
File uploadedFile = new File(downloadDirPath+path);
|
|
||||||
|
|
||||||
FileOutputStream fos = new FileOutputStream(uploadedFile);
|
|
||||||
|
|
||||||
fos.write(b);
|
// Creates the article
|
||||||
fos.close();
|
Article newArticle = articleManager.addArticle(
|
||||||
|
title, theme, abstractText, nomFile, user.getLogin(),
|
||||||
newArticle.setURL_article(path);
|
listSecondaryAuthor, Article.State.SUBMITED, conf.getId());
|
||||||
articleManager.updateArticle(newArticle);
|
|
||||||
|
if(newArticle==null){
|
||||||
|
errors.reject("article.errors.didNotSave");
|
||||||
|
try {
|
||||||
|
return showForm(request, response, errors);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
byte b[] = file.getBytes();
|
||||||
|
|
||||||
|
String path = "conference"+conf.getId()+"/";
|
||||||
|
(new File(downloadDirPath+path)).mkdirs();
|
||||||
|
path += newArticle.getId()+"_"+file.getOriginalFilename();
|
||||||
|
File uploadedFile = new File(downloadDirPath+path);
|
||||||
|
|
||||||
|
FileOutputStream fos = new FileOutputStream(uploadedFile);
|
||||||
|
|
||||||
|
fos.write(b);
|
||||||
|
fos.close();
|
||||||
|
|
||||||
|
newArticle.setURL_article(path);
|
||||||
|
articleManager.updateArticle(newArticle);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
catch (FileNotFoundException e) {
|
||||||
|
System.out.println(e);
|
||||||
|
} catch (IOException e) {
|
||||||
|
System.out.println(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
// The role author might have been added, refresh the credentials
|
||||||
|
SessionService.getInstance().refreshAuthentication();
|
||||||
}
|
}
|
||||||
catch (FileNotFoundException e) {
|
else if (action.equals("modify")) {
|
||||||
System.out.println(e);
|
String articleID = request.getParameter("articleID");
|
||||||
} catch (IOException e) {
|
|
||||||
System.out.println(e);
|
try {
|
||||||
|
Integer id = new Integer(articleID);
|
||||||
|
|
||||||
|
// TODO : v<>rifier que l'id de l'article appartient <20> l'auteur... vive les GET...
|
||||||
|
|
||||||
|
Article old = articleManager.getArticle(id);
|
||||||
|
old.setTitle(title);
|
||||||
|
old.setTopic(theme);
|
||||||
|
old.setSecondaryAuthors(listSecondaryAuthor);
|
||||||
|
old.setAbstractText(abstractText);
|
||||||
|
|
||||||
|
MultipartFile file = ((FormSubmission) command).getFile();
|
||||||
|
if (file == null || file.isEmpty()) {
|
||||||
|
articleManager.updateArticle(old);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
byte b[] = file.getBytes();
|
||||||
|
|
||||||
|
String path = "conference"+conf.getId()+"/";
|
||||||
|
(new File(downloadDirPath+path)).mkdirs();
|
||||||
|
path += old.getId()+"_"+file.getOriginalFilename();
|
||||||
|
File uploadedFile = new File(downloadDirPath+path);
|
||||||
|
|
||||||
|
FileOutputStream fos = new FileOutputStream(uploadedFile);
|
||||||
|
|
||||||
|
fos.write(b);
|
||||||
|
fos.close();
|
||||||
|
|
||||||
|
old.setURL_article(path);
|
||||||
|
articleManager.updateArticle(old);
|
||||||
|
}
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
throw new ModelAndViewDefiningException(new ModelAndView("404error"));
|
||||||
|
} catch (FileNotFoundException e) {
|
||||||
|
System.out.println(e);
|
||||||
|
} catch (IOException e) {
|
||||||
|
System.out.println(e);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
// The role author might have been added, refresh the credentials
|
throw new ModelAndViewDefiningException(new ModelAndView("404error"));
|
||||||
SessionService.getInstance().refreshAuthentication();
|
}
|
||||||
|
|
||||||
return new ModelAndView(new RedirectView(getSuccessView()));
|
return new ModelAndView(new RedirectView(getSuccessView()));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Object formBackingObject(HttpServletRequest request) throws ModelAndViewDefiningException {
|
protected Object formBackingObject(HttpServletRequest request) throws ModelAndViewDefiningException {
|
||||||
String action = request.getParameter("action");
|
String action = request.getParameter("action");
|
||||||
if (action == null || action.equals(""))
|
if (action == null || action.equals(""))
|
||||||
@@ -117,44 +169,41 @@ public class SArticleController extends SimpleFormController {
|
|||||||
return myArticle;
|
return myArticle;
|
||||||
}
|
}
|
||||||
else if (action.equals("modify")) {
|
else if (action.equals("modify")) {
|
||||||
|
|
||||||
String articleID = request.getParameter("articleID");
|
String articleID = request.getParameter("articleID");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Integer id = new Integer(articleID);
|
Integer id = new Integer(articleID);
|
||||||
|
|
||||||
// TODO : v<>rifier que l'id de l'article appartient <20> l'auteur... vive les GET...
|
// TODO : v<>rifier que l'id de l'article appartient <20> l'auteur... vive les GET...
|
||||||
|
|
||||||
Article a = articleManager.getArticle(id);
|
Article a = articleManager.getArticle(id);
|
||||||
|
|
||||||
if (a == null)
|
if (a == null)
|
||||||
throw new ModelAndViewDefiningException(new ModelAndView("denied", "message", getMessageSourceAccessor().getMessage("submission.modify.denied")));
|
throw new ModelAndViewDefiningException(new ModelAndView("denied", "message", getMessageSourceAccessor().getMessage("submission.modify.denied")));
|
||||||
|
|
||||||
|
FormSubmission myArticle = new FormSubmission();
|
||||||
|
|
||||||
FormSubmission myArticle = new FormSubmission();
|
myArticle.setAbstractText(a.getAbstractText());
|
||||||
|
|
||||||
|
|
||||||
// FIXME : stocker l'abstract texte ds la BDD... et le r<>cup apr<70>s...
|
|
||||||
//myArticle.setAbstractText();
|
|
||||||
|
|
||||||
myArticle.setTitle(a.getTitle());
|
myArticle.setTitle(a.getTitle());
|
||||||
myArticle.setListe(a.getSecondaryAuthors());
|
myArticle.setListe(a.getSecondaryAuthors());
|
||||||
myArticle.setTheme(a.getTopic());
|
myArticle.setTheme(a.getTopic());
|
||||||
|
|
||||||
request.getSession().setAttribute("listSecondaryAuthors", a.getSecondaryAuthors());
|
request.getSession().setAttribute("listSecondaryAuthors", a.getSecondaryAuthors());
|
||||||
|
|
||||||
return myArticle;
|
return myArticle;
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (NumberFormatException e) {
|
catch (NumberFormatException e) {
|
||||||
throw new ModelAndViewDefiningException(new ModelAndView("404error"));
|
throw new ModelAndViewDefiningException(new ModelAndView("404error"));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
throw new ModelAndViewDefiningException(new ModelAndView("404error"));
|
throw new ModelAndViewDefiningException(new ModelAndView("404error"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public IArticleManager getArticleManager() {
|
public IArticleManager getArticleManager() {
|
||||||
@@ -164,11 +213,11 @@ public class SArticleController extends SimpleFormController {
|
|||||||
public void setArticleManager(IArticleManager articleManager) {
|
public void setArticleManager(IArticleManager articleManager) {
|
||||||
this.articleManager = articleManager;
|
this.articleManager = articleManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDownloadDirPath() {
|
public String getDownloadDirPath() {
|
||||||
return downloadDirPath;
|
return downloadDirPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDownloadDirPath(String downloadDirPath) {
|
public void setDownloadDirPath(String downloadDirPath) {
|
||||||
this.downloadDirPath = downloadDirPath;
|
this.downloadDirPath = downloadDirPath;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ public class AddConferenceController extends AbstractWizardFormController {
|
|||||||
private IConferenceManager conferenceManager;
|
private IConferenceManager conferenceManager;
|
||||||
|
|
||||||
private IUserManager userManager;
|
private IUserManager userManager;
|
||||||
|
|
||||||
private IEvaluationManager evaluationManager;
|
private IEvaluationManager evaluationManager;
|
||||||
|
|
||||||
public IEvaluationManager getEvaluationManager() {
|
public IEvaluationManager getEvaluationManager() {
|
||||||
@@ -139,7 +139,7 @@ public class AddConferenceController extends AbstractWizardFormController {
|
|||||||
public List<PersonBean> getUsersAdded() {
|
public List<PersonBean> getUsersAdded() {
|
||||||
return listPersonAdded;
|
return listPersonAdded;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getInvitation(){
|
public List<String> getInvitation(){
|
||||||
return listInvitations;
|
return listInvitations;
|
||||||
}
|
}
|
||||||
@@ -148,16 +148,16 @@ public class AddConferenceController extends AbstractWizardFormController {
|
|||||||
email = email.toLowerCase();
|
email = email.toLowerCase();
|
||||||
Pattern emailPattern = Pattern.compile("^[a-z0-9._-]+@[a-z0-9._-]{2,}[.][a-z]{2,4}$"); // Regex
|
Pattern emailPattern = Pattern.compile("^[a-z0-9._-]+@[a-z0-9._-]{2,}[.][a-z]{2,4}$"); // Regex
|
||||||
Matcher emailMatcher = emailPattern.matcher(email);
|
Matcher emailMatcher = emailPattern.matcher(email);
|
||||||
|
|
||||||
if(!emailMatcher.matches()){
|
if(!emailMatcher.matches()){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
listInvitations.add(email);
|
listInvitations.add(email);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeInvitations(List<String> emailList){
|
public void removeInvitations(List<String> emailList){
|
||||||
for(String email : emailList){
|
for(String email : emailList){
|
||||||
listInvitations.remove(email);
|
listInvitations.remove(email);
|
||||||
@@ -172,7 +172,7 @@ public class AddConferenceController extends AbstractWizardFormController {
|
|||||||
|
|
||||||
private Set<CriterionBean> criteria;
|
private Set<CriterionBean> criteria;
|
||||||
private Set<CriterionBean> criteriaAll;
|
private Set<CriterionBean> criteriaAll;
|
||||||
|
|
||||||
public Set<CriterionBean> getCriteriaAll() {
|
public Set<CriterionBean> getCriteriaAll() {
|
||||||
return criteriaAll;
|
return criteriaAll;
|
||||||
}
|
}
|
||||||
@@ -180,7 +180,7 @@ public class AddConferenceController extends AbstractWizardFormController {
|
|||||||
public Set<CriterionBean> getCriteriaAdded() {
|
public Set<CriterionBean> getCriteriaAdded() {
|
||||||
return criteria;
|
return criteria;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CriterionBean getTrueCriteria(int id) {
|
public CriterionBean getTrueCriteria(int id) {
|
||||||
for (CriterionBean cb : criteriaAll) {
|
for (CriterionBean cb : criteriaAll) {
|
||||||
if (cb.getId() == id){
|
if (cb.getId() == id){
|
||||||
@@ -193,15 +193,15 @@ public class AddConferenceController extends AbstractWizardFormController {
|
|||||||
return cb;
|
return cb;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCriterionClick(CriterionBean c) {
|
public void setCriterionClick(CriterionBean c) {
|
||||||
if (c.getId() == -1) {
|
if (c.getId() == -1) {
|
||||||
c.setId(getNextId());
|
c.setId(getNextId());
|
||||||
}
|
}
|
||||||
|
|
||||||
criteria.remove(c);
|
criteria.remove(c);
|
||||||
criteria.add(c);
|
criteria.add(c);
|
||||||
}
|
}
|
||||||
@@ -212,18 +212,18 @@ public class AddConferenceController extends AbstractWizardFormController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
CriterionBean trueCriteria = getTrueCriteria(c.getId());
|
CriterionBean trueCriteria = getTrueCriteria(c.getId());
|
||||||
|
|
||||||
criteria.remove(trueCriteria);
|
criteria.remove(trueCriteria);
|
||||||
criteria.add(trueCriteria);
|
criteria.add(trueCriteria);
|
||||||
criteriaAll.remove(trueCriteria);
|
criteriaAll.remove(trueCriteria);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void deleteCriterion(CriterionBean c) {
|
public void deleteCriterion(CriterionBean c) {
|
||||||
|
|
||||||
CriterionBean trueCriteria = getTrueCriteria(c.getId());
|
CriterionBean trueCriteria = getTrueCriteria(c.getId());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
criteria.remove(trueCriteria);
|
criteria.remove(trueCriteria);
|
||||||
criteriaAll.add(trueCriteria);
|
criteriaAll.add(trueCriteria);
|
||||||
}
|
}
|
||||||
@@ -243,28 +243,28 @@ public class AddConferenceController extends AbstractWizardFormController {
|
|||||||
|
|
||||||
protected Object formBackingObject(HttpServletRequest request) throws ModelAndViewDefiningException {
|
protected Object formBackingObject(HttpServletRequest request) throws ModelAndViewDefiningException {
|
||||||
logger.info(this.getClass().toString() + " dans le formBackingObject");
|
logger.info(this.getClass().toString() + " dans le formBackingObject");
|
||||||
|
|
||||||
FormConference conference = new FormConference();
|
FormConference conference = new FormConference();
|
||||||
|
|
||||||
String action = request.getParameter("action");
|
String action = request.getParameter("action");
|
||||||
if (action == null || action.equals(""))
|
if (action == null || action.equals(""))
|
||||||
{
|
{
|
||||||
// TODO : tester ici si le gars a le droit d'<27>tre ici
|
// TODO : tester ici si le gars a le droit d'<27>tre ici
|
||||||
// a-t-il le droit de cr<63>er une conf<6E>rence ?
|
// a-t-il le droit de cr<63>er une conf<6E>rence ?
|
||||||
|
|
||||||
criteria = new HashSet<CriterionBean>();
|
criteria = new HashSet<CriterionBean>();
|
||||||
criteriaAll = new HashSet<CriterionBean>();
|
criteriaAll = new HashSet<CriterionBean>();
|
||||||
List<Criterion> listCriterion = evaluationManager.getCriterions();
|
List<Criterion> listCriterion = evaluationManager.getCriterions();
|
||||||
|
|
||||||
|
|
||||||
int maxNext = 0;
|
int maxNext = 0;
|
||||||
for (Criterion crit : listCriterion) {
|
for (Criterion crit : listCriterion) {
|
||||||
if (maxNext <= crit.getId())
|
if (maxNext <= crit.getId())
|
||||||
maxNext = crit.getId();
|
maxNext = crit.getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
nextId = maxNext + 1;
|
nextId = maxNext + 1;
|
||||||
|
|
||||||
for (Criterion crit : listCriterion) {
|
for (Criterion crit : listCriterion) {
|
||||||
CriterionBean cb = new CriterionBean();
|
CriterionBean cb = new CriterionBean();
|
||||||
cb.setId(crit.getId());
|
cb.setId(crit.getId());
|
||||||
@@ -274,7 +274,7 @@ public class AddConferenceController extends AbstractWizardFormController {
|
|||||||
criteriaAll.add(cb);
|
criteriaAll.add(cb);
|
||||||
getNextId();
|
getNextId();
|
||||||
}
|
}
|
||||||
|
|
||||||
listPersonBean = new ArrayList<PersonBean>();
|
listPersonBean = new ArrayList<PersonBean>();
|
||||||
listPersonAdded = new ArrayList<PersonBean>();
|
listPersonAdded = new ArrayList<PersonBean>();
|
||||||
listInvitations = new ArrayList<String>();
|
listInvitations = new ArrayList<String>();
|
||||||
@@ -288,26 +288,26 @@ public class AddConferenceController extends AbstractWizardFormController {
|
|||||||
pb.setLogin(user.getLogin());
|
pb.setLogin(user.getLogin());
|
||||||
listPersonBean.add(pb);
|
listPersonBean.add(pb);
|
||||||
}
|
}
|
||||||
|
|
||||||
return conference;
|
return conference;
|
||||||
}
|
}
|
||||||
else if (action.equals("modify")) {
|
else if (action.equals("modify")) {
|
||||||
Conference conf = SessionService.getInstance().getCurrentConference();
|
Conference conf = SessionService.getInstance().getCurrentConference();
|
||||||
|
|
||||||
criteria = new HashSet<CriterionBean>();
|
criteria = new HashSet<CriterionBean>();
|
||||||
criteriaAll = new HashSet<CriterionBean>();
|
criteriaAll = new HashSet<CriterionBean>();
|
||||||
|
|
||||||
List<Criterion> listCriterionForConf = evaluationManager.getCriterions(conf.getId());
|
List<Criterion> listCriterionForConf = evaluationManager.getCriterions(conf.getId());
|
||||||
List<Criterion> listCriterion = evaluationManager.getCriterions();
|
List<Criterion> listCriterion = evaluationManager.getCriterions();
|
||||||
|
|
||||||
int maxNext = 0;
|
int maxNext = 0;
|
||||||
for (Criterion crit : listCriterion) {
|
for (Criterion crit : listCriterion) {
|
||||||
if (maxNext <= crit.getId())
|
if (maxNext <= crit.getId())
|
||||||
maxNext = crit.getId();
|
maxNext = crit.getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
nextId = maxNext + 1;
|
nextId = maxNext + 1;
|
||||||
|
|
||||||
for (Criterion crit : listCriterionForConf) {
|
for (Criterion crit : listCriterionForConf) {
|
||||||
CriterionBean cb = new CriterionBean();
|
CriterionBean cb = new CriterionBean();
|
||||||
cb.setId(crit.getId());
|
cb.setId(crit.getId());
|
||||||
@@ -369,7 +369,7 @@ public class AddConferenceController extends AbstractWizardFormController {
|
|||||||
listPersonBean.remove(person);
|
listPersonBean.remove(person);
|
||||||
|
|
||||||
DateFormat format = new SimpleDateFormat("yyyy-MM-dd");
|
DateFormat format = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
|
|
||||||
conference.setTitle(conf.getTitle());
|
conference.setTitle(conf.getTitle());
|
||||||
conference.setDateArticleParsed(conf.getDateArticle());
|
conference.setDateArticleParsed(conf.getDateArticle());
|
||||||
conference.setDateArticle(format.format(conf.getDateArticle()));
|
conference.setDateArticle(format.format(conf.getDateArticle()));
|
||||||
@@ -381,7 +381,7 @@ public class AddConferenceController extends AbstractWizardFormController {
|
|||||||
conference.setDateStart(format.format(conf.getDateStart()));
|
conference.setDateStart(format.format(conf.getDateStart()));
|
||||||
conference.setDescription(conf.getDescription());
|
conference.setDescription(conf.getDescription());
|
||||||
conference.setOtherInformations(conf.getOtherInformations());
|
conference.setOtherInformations(conf.getOtherInformations());
|
||||||
|
|
||||||
// TODO : ajouter ca ds conf ejb...
|
// TODO : ajouter ca ds conf ejb...
|
||||||
/*conference.setPageNumber(pageNumber);
|
/*conference.setPageNumber(pageNumber);
|
||||||
conference.setSendInfo(sendInfo);
|
conference.setSendInfo(sendInfo);
|
||||||
@@ -389,18 +389,18 @@ public class AddConferenceController extends AbstractWizardFormController {
|
|||||||
conference.setTypeODT(typeODT);
|
conference.setTypeODT(typeODT);
|
||||||
conference.setTypePDF(typePDF);
|
conference.setTypePDF(typePDF);
|
||||||
conference.setTypeWord(typeWord);*/
|
conference.setTypeWord(typeWord);*/
|
||||||
|
|
||||||
return conference;
|
return conference;
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
throw new ModelAndViewDefiningException(new ModelAndView("404error"));
|
throw new ModelAndViewDefiningException(new ModelAndView("404error"));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
protected void validatePage(Object command, Errors errors, int page) {
|
protected void validatePage(Object command, Errors errors, int page) {
|
||||||
FormConference conference = (FormConference) command;
|
FormConference conference = (FormConference) command;
|
||||||
ConferenceValidator conferenceValidator = (ConferenceValidator) getValidator();
|
ConferenceValidator conferenceValidator = (ConferenceValidator) getValidator();
|
||||||
@@ -424,67 +424,66 @@ public class AddConferenceController extends AbstractWizardFormController {
|
|||||||
String action = request.getParameter("action");
|
String action = request.getParameter("action");
|
||||||
if (action == null || action.equals("")) {
|
if (action == null || action.equals("")) {
|
||||||
|
|
||||||
|
Conference conf = null;
|
||||||
Conference conf = null;
|
|
||||||
|
|
||||||
try {
|
|
||||||
conf = conferenceManager.addConference(
|
|
||||||
conference.getTitle(),
|
|
||||||
SessionService.getInstance().getCurrentUserLogin(),
|
|
||||||
conference.getDescription(),
|
|
||||||
conference.getOtherInformations(),
|
|
||||||
conference.getDateArticleParsed(),
|
|
||||||
conference.getDateArticleParsed(),
|
|
||||||
conference.getDateEvaluationParsed(),
|
|
||||||
conference.getDateStartParsed(),
|
|
||||||
conference.getDateEndParsed());
|
|
||||||
} catch (NoConferenceCreationTokenLeftException e1) {
|
|
||||||
return new ModelAndView("denied","message",getMessageSourceAccessor().getMessage("conference.error.noTokenLeft"));
|
|
||||||
}
|
|
||||||
|
|
||||||
conference.setConferenceId(conf.getId());
|
|
||||||
SessionService.getInstance().setCurrentConference(conf);
|
|
||||||
|
|
||||||
for(CriterionBean criterion : criteria){
|
|
||||||
conferenceManager.addCriterionToConference(
|
|
||||||
conf.getId(),
|
|
||||||
criterion.getLabel(),
|
|
||||||
criterion.getMin(),
|
|
||||||
criterion.getMax());
|
|
||||||
}
|
|
||||||
|
|
||||||
for(PersonBean personBean : listPersonAdded){
|
|
||||||
conferenceManager.addPCMemberToConference(
|
|
||||||
conf.getId(),
|
|
||||||
personBean.getLogin());
|
|
||||||
}
|
|
||||||
|
|
||||||
String mailSubject = "YACOS "+conf.getTitle()+" invitation";
|
|
||||||
String mailBody = "Greetings,\n";
|
|
||||||
mailBody += "You've been invited to join the program comity of the conference :\n";
|
|
||||||
mailBody += conf.getTitle()+"/n";
|
|
||||||
mailBody += "You can register on this page : \n";
|
|
||||||
String baseUrl = request.getSession().getServletContext().getContextPath();
|
|
||||||
mailBody += baseUrl+"/registerUser.htm /n";
|
|
||||||
mailBody += "Please note that you MUST use this eMail address in the registration form in order to get the appropriate credentials.";
|
|
||||||
// TODO : use a template
|
|
||||||
for(String invitationEmail : listInvitations){
|
|
||||||
try {
|
try {
|
||||||
conferenceManager.addInvitationToken(invitationEmail, RoleType.PCMEMBER, conf.getId());
|
conf = conferenceManager.addConference(
|
||||||
MailSenderService.getInstance().sendEMail(invitationEmail, mailSubject , mailBody);
|
conference.getTitle(),
|
||||||
} catch (ConferenceDoesntExistException e) {
|
SessionService.getInstance().getCurrentUserLogin(),
|
||||||
// Should never happen
|
conference.getDescription(),
|
||||||
e.printStackTrace();
|
conference.getOtherInformations(),
|
||||||
} catch (MailSendException e) {
|
conference.getDateArticleParsed(),
|
||||||
// TODO : see what we can do about this
|
conference.getDateArticleParsed(),
|
||||||
e.printStackTrace();
|
conference.getDateEvaluationParsed(),
|
||||||
|
conference.getDateStartParsed(),
|
||||||
|
conference.getDateEndParsed());
|
||||||
|
} catch (NoConferenceCreationTokenLeftException e1) {
|
||||||
|
return new ModelAndView("denied","message",getMessageSourceAccessor().getMessage("conference.error.noTokenLeft"));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
conference.setConferenceId(conf.getId());
|
||||||
conferenceManager.addRole(RoleType.CHAIRMAN, SessionService.getInstance().getCurrentUserLogin(), conf.getId());
|
SessionService.getInstance().setCurrentConference(conf);
|
||||||
// Refresh the roles to take into account the chairman credentials
|
|
||||||
SessionService.getInstance().refreshAuthentication();
|
for(CriterionBean criterion : criteria){
|
||||||
} else {
|
conferenceManager.addCriterionToConference(
|
||||||
|
conf.getId(),
|
||||||
|
criterion.getLabel(),
|
||||||
|
criterion.getMin(),
|
||||||
|
criterion.getMax());
|
||||||
|
}
|
||||||
|
|
||||||
|
for(PersonBean personBean : listPersonAdded){
|
||||||
|
conferenceManager.addPCMemberToConference(
|
||||||
|
conf.getId(),
|
||||||
|
personBean.getLogin());
|
||||||
|
}
|
||||||
|
|
||||||
|
String mailSubject = "YACOS "+conf.getTitle()+" invitation";
|
||||||
|
String mailBody = "Greetings,\n";
|
||||||
|
mailBody += "You've been invited to join the program comity of the conference :\n";
|
||||||
|
mailBody += conf.getTitle()+"/n";
|
||||||
|
mailBody += "You can register on this page : \n";
|
||||||
|
String baseUrl = request.getSession().getServletContext().getContextPath();
|
||||||
|
mailBody += baseUrl+"/registerUser.htm /n";
|
||||||
|
mailBody += "Please note that you MUST use this eMail address in the registration form in order to get the appropriate credentials.";
|
||||||
|
// TODO : use a template
|
||||||
|
for(String invitationEmail : listInvitations){
|
||||||
|
try {
|
||||||
|
conferenceManager.addInvitationToken(invitationEmail, RoleType.PCMEMBER, conf.getId());
|
||||||
|
MailSenderService.getInstance().sendEMail(invitationEmail, mailSubject , mailBody);
|
||||||
|
} catch (ConferenceDoesntExistException e) {
|
||||||
|
// Should never happen
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (MailSendException e) {
|
||||||
|
// TODO : see what we can do about this
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
conferenceManager.addRole(RoleType.CHAIRMAN, SessionService.getInstance().getCurrentUserLogin(), conf.getId());
|
||||||
|
// Refresh the roles to take into account the chairman credentials
|
||||||
|
SessionService.getInstance().refreshAuthentication();
|
||||||
|
} else if (action.equals("modify")) {
|
||||||
Conference conf = SessionService.getInstance().getCurrentConference();
|
Conference conf = SessionService.getInstance().getCurrentConference();
|
||||||
conf.setTitle(conference.getTitle());
|
conf.setTitle(conference.getTitle());
|
||||||
conf.setDescription(conference.getDescription());
|
conf.setDescription(conference.getDescription());
|
||||||
@@ -494,11 +493,11 @@ public class AddConferenceController extends AbstractWizardFormController {
|
|||||||
conf.setDateEnd(conference.getDateEndParsed());
|
conf.setDateEnd(conference.getDateEndParsed());
|
||||||
conf.setDateStart(conference.getDateStartParsed());
|
conf.setDateStart(conference.getDateStartParsed());
|
||||||
conf.setDateEvaluation(conference.getDateEvaluationParsed());
|
conf.setDateEvaluation(conference.getDateEvaluationParsed());
|
||||||
|
|
||||||
conferenceManager.update(conf);
|
conferenceManager.update(conf);
|
||||||
|
|
||||||
conferenceManager.removeCriterionToConference(conf.getId());
|
conferenceManager.removeCriterionToConference(conf.getId());
|
||||||
|
|
||||||
for(CriterionBean criterion : criteria){
|
for(CriterionBean criterion : criteria){
|
||||||
conferenceManager.addCriterionToConference(
|
conferenceManager.addCriterionToConference(
|
||||||
conf.getId(),
|
conf.getId(),
|
||||||
@@ -506,7 +505,7 @@ public class AddConferenceController extends AbstractWizardFormController {
|
|||||||
criterion.getMin(),
|
criterion.getMin(),
|
||||||
criterion.getMax());
|
criterion.getMax());
|
||||||
}
|
}
|
||||||
|
|
||||||
conferenceManager.removePCMemberForConf(conf.getId());
|
conferenceManager.removePCMemberForConf(conf.getId());
|
||||||
|
|
||||||
for(PersonBean personBean : listPersonAdded){
|
for(PersonBean personBean : listPersonAdded){
|
||||||
@@ -515,7 +514,7 @@ public class AddConferenceController extends AbstractWizardFormController {
|
|||||||
personBean.getLogin());
|
personBean.getLogin());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return new ModelAndView("main");
|
return new ModelAndView("main");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user