diff --git a/YACOSWeb/WebContent/WEB-INF/jsp/manageArticle.jsp b/YACOSWeb/WebContent/WEB-INF/jsp/manageArticle.jsp
index ed1c8b4..1261e7f 100644
--- a/YACOSWeb/WebContent/WEB-INF/jsp/manageArticle.jsp
+++ b/YACOSWeb/WebContent/WEB-INF/jsp/manageArticle.jsp
@@ -33,7 +33,7 @@
"> |
- "> |
+ "> |
 |
diff --git a/YACOSWeb/WebContent/WEB-INF/jsp/submissionArticle.jsp b/YACOSWeb/WebContent/WEB-INF/jsp/submissionArticle.jsp
index e9cf92e..06f82cc 100644
--- a/YACOSWeb/WebContent/WEB-INF/jsp/submissionArticle.jsp
+++ b/YACOSWeb/WebContent/WEB-INF/jsp/submissionArticle.jsp
@@ -1,75 +1,79 @@
-<%@ include file="/WEB-INF/decorators/include.jsp"%>
-
-
-
-
-
-
-
-
-
-
-
-
+<%@ include file="/WEB-INF/decorators/include.jsp"%>
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
-
-">Home
-
-
-
-
+
+">Home
+
+
+
+
diff --git a/YACOSWeb/WebContent/images/cc-kedit-128x128.png b/YACOSWeb/WebContent/images/cc-kedit-128x128.png
new file mode 100644
index 0000000..e2f2cc2
Binary files /dev/null and b/YACOSWeb/WebContent/images/cc-kedit-128x128.png differ
diff --git a/YACOSWeb/src/org/yacos/web/author/controller/SArticleController.java b/YACOSWeb/src/org/yacos/web/author/controller/SArticleController.java
index 22ac994..9638dd9 100644
--- a/YACOSWeb/src/org/yacos/web/author/controller/SArticleController.java
+++ b/YACOSWeb/src/org/yacos/web/author/controller/SArticleController.java
@@ -41,9 +41,10 @@ public class SArticleController extends SimpleFormController {
Conference conf = SessionService.getInstance().getCurrentConference();
// Fetching user
User user = SessionService.getInstance().getCurrentUser();
-
+
String title = ((FormSubmission) command).getTitle();
String theme = ((FormSubmission) command).getTheme();
+ String abstractText = ((FormSubmission) command).getAbstractText();
ArrayList listSecondaryAuthor = new ArrayList();
// Removes null entries from the list
@@ -52,63 +53,114 @@ public class SArticleController extends SimpleFormController {
listSecondaryAuthor.add(sAuthor);
}
}
-
- String nomFile="";
-
- try {
- MultipartFile file = ((FormSubmission) command).getFile();
- if (file == null || file.isEmpty()) {
- errors.rejectValue("file", "form.submitArticle.noFile");
- try {
- return showForm(request, response, errors);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- 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");
+
+ String action = request.getParameter("action");
+ if (action == null || action.equals(""))
+ {
+
+ String nomFile="";
+
+ try {
+ MultipartFile file = ((FormSubmission) command).getFile();
+ if (file == null || file.isEmpty()) {
+ errors.rejectValue("file", "form.submitArticle.noFile");
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);
+ else {
- fos.write(b);
- fos.close();
-
- newArticle.setURL_article(path);
- articleManager.updateArticle(newArticle);
+ // Creates the article
+ Article newArticle = articleManager.addArticle(
+ title, theme, abstractText, nomFile, user.getLogin(),
+ listSecondaryAuthor, Article.State.SUBMITED, conf.getId());
+
+ 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) {
- System.out.println(e);
- } catch (IOException e) {
- System.out.println(e);
+ else if (action.equals("modify")) {
+ String articleID = request.getParameter("articleID");
+
+ try {
+ Integer id = new Integer(articleID);
+
+ // TODO : vérifier que l'id de l'article appartient à 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);
+ }
+
}
-
- // The role author might have been added, refresh the credentials
- SessionService.getInstance().refreshAuthentication();
-
+ else {
+ throw new ModelAndViewDefiningException(new ModelAndView("404error"));
+ }
+
return new ModelAndView(new RedirectView(getSuccessView()));
}
-
+
protected Object formBackingObject(HttpServletRequest request) throws ModelAndViewDefiningException {
String action = request.getParameter("action");
if (action == null || action.equals(""))
@@ -117,44 +169,41 @@ public class SArticleController extends SimpleFormController {
return myArticle;
}
else if (action.equals("modify")) {
-
+
String articleID = request.getParameter("articleID");
-
+
try {
Integer id = new Integer(articleID);
-
+
// TODO : vérifier que l'id de l'article appartient à l'auteur... vive les GET...
-
+
Article a = articleManager.getArticle(id);
-
+
if (a == null)
throw new ModelAndViewDefiningException(new ModelAndView("denied", "message", getMessageSourceAccessor().getMessage("submission.modify.denied")));
+
+ FormSubmission myArticle = new FormSubmission();
- FormSubmission myArticle = new FormSubmission();
-
-
- // FIXME : stocker l'abstract texte ds la BDD... et le récup après...
- //myArticle.setAbstractText();
-
+ myArticle.setAbstractText(a.getAbstractText());
myArticle.setTitle(a.getTitle());
myArticle.setListe(a.getSecondaryAuthors());
myArticle.setTheme(a.getTopic());
-
+
request.getSession().setAttribute("listSecondaryAuthors", a.getSecondaryAuthors());
-
+
return myArticle;
-
+
}
catch (NumberFormatException e) {
throw new ModelAndViewDefiningException(new ModelAndView("404error"));
}
-
+
}
else {
throw new ModelAndViewDefiningException(new ModelAndView("404error"));
}
-
+
}
public IArticleManager getArticleManager() {
@@ -164,11 +213,11 @@ public class SArticleController extends SimpleFormController {
public void setArticleManager(IArticleManager articleManager) {
this.articleManager = articleManager;
}
-
+
public String getDownloadDirPath() {
return downloadDirPath;
}
-
+
public void setDownloadDirPath(String downloadDirPath) {
this.downloadDirPath = downloadDirPath;
}
diff --git a/YACOSWeb/src/org/yacos/web/chairman/controller/AddConferenceController.java b/YACOSWeb/src/org/yacos/web/chairman/controller/AddConferenceController.java
index b6a23bc..791087f 100644
--- a/YACOSWeb/src/org/yacos/web/chairman/controller/AddConferenceController.java
+++ b/YACOSWeb/src/org/yacos/web/chairman/controller/AddConferenceController.java
@@ -41,7 +41,7 @@ public class AddConferenceController extends AbstractWizardFormController {
private IConferenceManager conferenceManager;
private IUserManager userManager;
-
+
private IEvaluationManager evaluationManager;
public IEvaluationManager getEvaluationManager() {
@@ -139,7 +139,7 @@ public class AddConferenceController extends AbstractWizardFormController {
public List getUsersAdded() {
return listPersonAdded;
}
-
+
public List getInvitation(){
return listInvitations;
}
@@ -148,16 +148,16 @@ public class AddConferenceController extends AbstractWizardFormController {
email = email.toLowerCase();
Pattern emailPattern = Pattern.compile("^[a-z0-9._-]+@[a-z0-9._-]{2,}[.][a-z]{2,4}$"); // Regex
Matcher emailMatcher = emailPattern.matcher(email);
-
+
if(!emailMatcher.matches()){
return false;
}
-
+
listInvitations.add(email);
-
+
return true;
}
-
+
public void removeInvitations(List emailList){
for(String email : emailList){
listInvitations.remove(email);
@@ -172,7 +172,7 @@ public class AddConferenceController extends AbstractWizardFormController {
private Set criteria;
private Set criteriaAll;
-
+
public Set getCriteriaAll() {
return criteriaAll;
}
@@ -180,7 +180,7 @@ public class AddConferenceController extends AbstractWizardFormController {
public Set getCriteriaAdded() {
return criteria;
}
-
+
public CriterionBean getTrueCriteria(int id) {
for (CriterionBean cb : criteriaAll) {
if (cb.getId() == id){
@@ -193,15 +193,15 @@ public class AddConferenceController extends AbstractWizardFormController {
return cb;
}
}
-
+
return null;
}
-
+
public void setCriterionClick(CriterionBean c) {
if (c.getId() == -1) {
c.setId(getNextId());
}
-
+
criteria.remove(c);
criteria.add(c);
}
@@ -212,18 +212,18 @@ public class AddConferenceController extends AbstractWizardFormController {
}
CriterionBean trueCriteria = getTrueCriteria(c.getId());
-
+
criteria.remove(trueCriteria);
criteria.add(trueCriteria);
criteriaAll.remove(trueCriteria);
}
public void deleteCriterion(CriterionBean c) {
-
+
CriterionBean trueCriteria = getTrueCriteria(c.getId());
-
-
-
+
+
+
criteria.remove(trueCriteria);
criteriaAll.add(trueCriteria);
}
@@ -243,28 +243,28 @@ public class AddConferenceController extends AbstractWizardFormController {
protected Object formBackingObject(HttpServletRequest request) throws ModelAndViewDefiningException {
logger.info(this.getClass().toString() + " dans le formBackingObject");
-
+
FormConference conference = new FormConference();
-
+
String action = request.getParameter("action");
if (action == null || action.equals(""))
{
// TODO : tester ici si le gars a le droit d'�tre ici
// a-t-il le droit de cr�er une conf�rence ?
-
+
criteria = new HashSet();
criteriaAll = new HashSet();
List listCriterion = evaluationManager.getCriterions();
-
-
+
+
int maxNext = 0;
for (Criterion crit : listCriterion) {
if (maxNext <= crit.getId())
maxNext = crit.getId();
}
-
+
nextId = maxNext + 1;
-
+
for (Criterion crit : listCriterion) {
CriterionBean cb = new CriterionBean();
cb.setId(crit.getId());
@@ -274,7 +274,7 @@ public class AddConferenceController extends AbstractWizardFormController {
criteriaAll.add(cb);
getNextId();
}
-
+
listPersonBean = new ArrayList();
listPersonAdded = new ArrayList();
listInvitations = new ArrayList();
@@ -288,26 +288,26 @@ public class AddConferenceController extends AbstractWizardFormController {
pb.setLogin(user.getLogin());
listPersonBean.add(pb);
}
-
+
return conference;
}
else if (action.equals("modify")) {
Conference conf = SessionService.getInstance().getCurrentConference();
-
+
criteria = new HashSet();
criteriaAll = new HashSet();
List listCriterionForConf = evaluationManager.getCriterions(conf.getId());
List listCriterion = evaluationManager.getCriterions();
-
+
int maxNext = 0;
for (Criterion crit : listCriterion) {
if (maxNext <= crit.getId())
maxNext = crit.getId();
}
-
+
nextId = maxNext + 1;
-
+
for (Criterion crit : listCriterionForConf) {
CriterionBean cb = new CriterionBean();
cb.setId(crit.getId());
@@ -369,7 +369,7 @@ public class AddConferenceController extends AbstractWizardFormController {
listPersonBean.remove(person);
DateFormat format = new SimpleDateFormat("yyyy-MM-dd");
-
+
conference.setTitle(conf.getTitle());
conference.setDateArticleParsed(conf.getDateArticle());
conference.setDateArticle(format.format(conf.getDateArticle()));
@@ -381,7 +381,7 @@ public class AddConferenceController extends AbstractWizardFormController {
conference.setDateStart(format.format(conf.getDateStart()));
conference.setDescription(conf.getDescription());
conference.setOtherInformations(conf.getOtherInformations());
-
+
// TODO : ajouter ca ds conf ejb...
/*conference.setPageNumber(pageNumber);
conference.setSendInfo(sendInfo);
@@ -389,18 +389,18 @@ public class AddConferenceController extends AbstractWizardFormController {
conference.setTypeODT(typeODT);
conference.setTypePDF(typePDF);
conference.setTypeWord(typeWord);*/
-
+
return conference;
-
+
}
else {
throw new ModelAndViewDefiningException(new ModelAndView("404error"));
}
-
+
}
-
-
+
+
protected void validatePage(Object command, Errors errors, int page) {
FormConference conference = (FormConference) command;
ConferenceValidator conferenceValidator = (ConferenceValidator) getValidator();
@@ -424,67 +424,66 @@ public class AddConferenceController extends AbstractWizardFormController {
String action = request.getParameter("action");
if (action == null || action.equals("")) {
-
- 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){
+ Conference conf = null;
+
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();
+ 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"));
}
- }
-
- conferenceManager.addRole(RoleType.CHAIRMAN, SessionService.getInstance().getCurrentUserLogin(), conf.getId());
- // Refresh the roles to take into account the chairman credentials
- SessionService.getInstance().refreshAuthentication();
- } else {
+
+ 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 {
+ 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();
conf.setTitle(conference.getTitle());
conf.setDescription(conference.getDescription());
@@ -494,11 +493,11 @@ public class AddConferenceController extends AbstractWizardFormController {
conf.setDateEnd(conference.getDateEndParsed());
conf.setDateStart(conference.getDateStartParsed());
conf.setDateEvaluation(conference.getDateEvaluationParsed());
-
+
conferenceManager.update(conf);
-
+
conferenceManager.removeCriterionToConference(conf.getId());
-
+
for(CriterionBean criterion : criteria){
conferenceManager.addCriterionToConference(
conf.getId(),
@@ -506,7 +505,7 @@ public class AddConferenceController extends AbstractWizardFormController {
criterion.getMin(),
criterion.getMax());
}
-
+
conferenceManager.removePCMemberForConf(conf.getId());
for(PersonBean personBean : listPersonAdded){
@@ -515,7 +514,7 @@ public class AddConferenceController extends AbstractWizardFormController {
personBean.getLogin());
}
}
-
+
return new ModelAndView("main");
}