diff --git a/YACOSWeb/WebContent/WEB-INF/jsp/submissionArticle.jsp b/YACOSWeb/WebContent/WEB-INF/jsp/submissionArticle.jsp
index 1a8a99d..3ac9077 100644
--- a/YACOSWeb/WebContent/WEB-INF/jsp/submissionArticle.jsp
+++ b/YACOSWeb/WebContent/WEB-INF/jsp/submissionArticle.jsp
@@ -49,7 +49,7 @@
*
-
+
@@ -85,7 +85,7 @@
*
-
+
diff --git a/YACOSWeb/WebContent/WEB-INF/yacos-servlet.xml b/YACOSWeb/WebContent/WEB-INF/yacos-servlet.xml
index 4007d33..37770e7 100644
--- a/YACOSWeb/WebContent/WEB-INF/yacos-servlet.xml
+++ b/YACOSWeb/WebContent/WEB-INF/yacos-servlet.xml
@@ -41,7 +41,7 @@
LogonController
ListEvaluationController
ArticleDownloadController
- ArticleDeleteController
+ ArticleDeleteController
ListReportController
ForgotPasswordController
DetailArticleController
diff --git a/YACOSWeb/src/org/yacos/web/author/controller/SArticleController.java b/YACOSWeb/src/org/yacos/web/author/controller/SArticleController.java
index 72fdc6d..00389c9 100644
--- a/YACOSWeb/src/org/yacos/web/author/controller/SArticleController.java
+++ b/YACOSWeb/src/org/yacos/web/author/controller/SArticleController.java
@@ -69,9 +69,58 @@ public class SArticleController extends SimpleFormController {
} catch (Exception e) {
e.printStackTrace();
}
- }
+ }
else {
+ String extension = file.getOriginalFilename().substring(file.getOriginalFilename().length() - 4).toLowerCase();
+ logger.info("The file extension is: " + extension);
+
+ boolean typePDF = conf.isTypePDF();
+ boolean typeLatec = conf.isTypeLatec();
+ boolean typeWord = conf.isTypeWord();
+ boolean typeODT = conf.isTypeODT();
+ boolean isOneSelected = false;
+ boolean extensionTrue = false;
+ String acceptedExt = "";
+
+ if (typePDF || typeLatec || typeWord || typeODT)
+ isOneSelected = true;
+
+ if (isOneSelected) {
+ if (typePDF) {
+ acceptedExt = acceptedExt + ".pdf ";
+ if (extension.equals(".pdf"))
+ extensionTrue = true;
+ }
+ if (typeLatec) {
+ acceptedExt = acceptedExt + ".tex ";
+ if (extension.equals(".tex"))
+ extensionTrue = true;
+ }
+ if (typeWord) {
+ acceptedExt = acceptedExt + ".doc .docx ";
+ String extension1 = file.getOriginalFilename().substring(file.getOriginalFilename().length() - 4).toLowerCase();
+ String extension2 = file.getOriginalFilename().substring(file.getOriginalFilename().length() - 5).toLowerCase();
+ if (extension1.equals(".doc"))
+ extensionTrue = true;
+ if (extension2.equals(".docx"))
+ extensionTrue = true;
+ }
+ if (typeODT) {
+ acceptedExt = acceptedExt + ".odt";
+ if (extension.equals(".odt"))
+ extensionTrue = true;
+ }
+ if (! extensionTrue) {
+ errors.rejectValue("file", null, "The file's extensions allowed are the following: " + acceptedExt);
+ try {
+ return showForm(request, response, errors);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
// Creates the article
Article newArticle = articleManager.addArticle(
title, theme, abstractText, nomFile, user.getLogin(),
@@ -102,6 +151,7 @@ public class SArticleController extends SimpleFormController {
articleManager.updateArticle(newArticle);
}
}
+
catch (FileNotFoundException e) {
System.out.println(e);
} catch (IOException e) {
@@ -130,6 +180,56 @@ public class SArticleController extends SimpleFormController {
articleManager.updateArticle(old);
}
else {
+
+ String extension = file.getOriginalFilename().substring(file.getOriginalFilename().length() - 4).toLowerCase();
+ logger.info("The file extension is: " + extension);
+
+ boolean typePDF = conf.isTypePDF();
+ boolean typeLatec = conf.isTypeLatec();
+ boolean typeWord = conf.isTypeWord();
+ boolean typeODT = conf.isTypeODT();
+ boolean isOneSelected = false;
+ boolean extensionTrue = false;
+ String acceptedExt = "";
+
+ if (typePDF || typeLatec || typeWord || typeODT)
+ isOneSelected = true;
+
+ if (isOneSelected) {
+ if (typePDF) {
+ acceptedExt = acceptedExt + ".pdf ";
+ if (extension.equals(".pdf"))
+ extensionTrue = true;
+ }
+ if (typeLatec) {
+ acceptedExt = acceptedExt + ".tex ";
+ if (extension.equals(".tex"))
+ extensionTrue = true;
+ }
+ if (typeWord) {
+ acceptedExt = acceptedExt + ".doc .docx ";
+ String extension1 = file.getOriginalFilename().substring(file.getOriginalFilename().length() - 4).toLowerCase();
+ String extension2 = file.getOriginalFilename().substring(file.getOriginalFilename().length() - 5).toLowerCase();
+ if (extension1.equals(".doc"))
+ extensionTrue = true;
+ if (extension2.equals(".docx"))
+ extensionTrue = true;
+ }
+ if (typeODT) {
+ acceptedExt = acceptedExt + ".odt";
+ if (extension.equals(".odt"))
+ extensionTrue = true;
+ }
+ if (! extensionTrue) {
+ errors.rejectValue("file", null, "The file's extensions allowed are the following: " + acceptedExt);
+ try {
+ return showForm(request, response, errors);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
byte b[] = file.getBytes();
String path = "conference"+conf.getId()+"/";
@@ -144,6 +244,7 @@ public class SArticleController extends SimpleFormController {
old.setURL_article(path);
articleManager.updateArticle(old);
+
}
} catch (NumberFormatException e) {
throw new ModelAndViewDefiningException(new ModelAndView("404error"));
@@ -183,7 +284,7 @@ public class SArticleController extends SimpleFormController {
throw new ModelAndViewDefiningException(new ModelAndView("denied", "message", getMessageSourceAccessor().getMessage("submission.modify.denied")));
FormSubmission myArticle = new FormSubmission();
-
+
myArticle.setAbstractText(a.getAbstractText());
myArticle.setTitle(a.getTitle());
//myArticle.setListe(a.getSecondaryAuthors());
diff --git a/YACOSWeb/src/org/yacos/web/author/validator/ValidateSubmission.java b/YACOSWeb/src/org/yacos/web/author/validator/ValidateSubmission.java
index bc70832..3f2830f 100644
--- a/YACOSWeb/src/org/yacos/web/author/validator/ValidateSubmission.java
+++ b/YACOSWeb/src/org/yacos/web/author/validator/ValidateSubmission.java
@@ -4,7 +4,6 @@ import org.springframework.validation.Errors;
import org.springframework.validation.Validator;
import org.yacos.web.author.form.FormSubmission;
-
public class ValidateSubmission implements Validator {
@SuppressWarnings("unchecked")
@@ -14,30 +13,22 @@ public class ValidateSubmission implements Validator {
public void validate(Object arg0, Errors arg1) {
- FormSubmission sub=(FormSubmission)arg0;
+ FormSubmission sub = (FormSubmission)arg0;
- String title=sub.getTitle();
- String theme=sub.getTheme();
- String abs=sub.getAbstractText();
+ String title = sub.getTitle();
+ String theme = sub.getTheme();
+ String abs = sub.getAbstractText();
- if (title== null || title.trim().length() == 0) {
- arg1.rejectValue("title",
- "submissionArticle.title",
- "Le title est n��cessaire !");
+ if (title == null || title.trim().length() == 0) {
+ arg1.rejectValue("title", "submissionArticle.title", "The title should not be null");
}
-
- if (theme==null|theme.trim().length()==0)
-
- {
- arg1.rejectValue("theme", "submissionArticle.theme");
+ if (theme == null || theme.trim().length()==0) {
+ arg1.rejectValue("theme", "submissionArticle.theme", "The theme should not be null");
}
-
- if (abs==null|abs.trim().length()==0)
-
- { arg1.rejectValue("abstractText", "submissionArticle.abstractText", "text is not nullable");
-
+ if (abs == null || abs.trim().length()==0) {
+ arg1.rejectValue("abstractText", "submissionArticle.abstractText", "The abstract should not be null");
}
}
}
diff --git a/YACOSWeb/src/org/yacos/web/chairman/controller/AddConferenceController.java b/YACOSWeb/src/org/yacos/web/chairman/controller/AddConferenceController.java
index f1c96be..3f29d97 100644
--- a/YACOSWeb/src/org/yacos/web/chairman/controller/AddConferenceController.java
+++ b/YACOSWeb/src/org/yacos/web/chairman/controller/AddConferenceController.java
@@ -243,6 +243,7 @@ public class AddConferenceController extends AbstractWizardFormController {
setPages(new String[] {"addConference", "addConference2", "addConference3", "addConference4", "addConference5"});
}
+ // TODO : comment modifier la conf ?
@Secured({"ROLE_CONFERENCE_CREATOR"})
protected Object formBackingObject(HttpServletRequest request) throws ModelAndViewDefiningException {
logger.info(this.getClass().toString() + " dans le formBackingObject");
@@ -384,14 +385,13 @@ 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);
- conference.setTypeLatec(typeLatec);
- conference.setTypeODT(typeODT);
- conference.setTypePDF(typePDF);
- conference.setTypeWord(typeWord);*/
+ conference.setPageNumberChecked(conf.getPageNumber());
+ conference.setPageNumber(conf.getPageNumber().toString());
+ conference.setTypePDF(conf.isTypePDF());
+ conference.setTypeLatec(conf.isTypeLatec());
+ conference.setTypeWord(conf.isTypeWord());
+ conference.setTypeODT(conf.isTypeODT());
+ conference.setSendInfo(conf.getSendInfo());
return conference;
@@ -439,7 +439,13 @@ public class AddConferenceController extends AbstractWizardFormController {
conference.getDateArticleParsed(),
conference.getDateEvaluationParsed(),
conference.getDateStartParsed(),
- conference.getDateEndParsed());
+ conference.getDateEndParsed(),
+ conference.getPageNumberChecked(),
+ conference.isTypePDF(),
+ conference.isTypeLatec(),
+ conference.isTypeWord(),
+ conference.isTypeODT(),
+ conference.getSendInfo());
} catch (NoConferenceCreationTokenLeftException e1) {
return new ModelAndView("denied","message",getMessageSourceAccessor().getMessage("conference.error.noTokenLeft"));
}
diff --git a/YACOSWeb/src/org/yacos/web/chairman/validation/ConferenceValidator.java b/YACOSWeb/src/org/yacos/web/chairman/validation/ConferenceValidator.java
index 193a81e..aaeadf4 100644
--- a/YACOSWeb/src/org/yacos/web/chairman/validation/ConferenceValidator.java
+++ b/YACOSWeb/src/org/yacos/web/chairman/validation/ConferenceValidator.java
@@ -40,7 +40,7 @@ public class ConferenceValidator implements Validator {
dateStart = format.parse(conference.getDateStart());
conference.setDateStartParsed(dateStart);
} catch (ParseException e) {
- errors.rejectValue("dateStart", "conference.errors.dateStartNonValid");
+ errors.reject("dateStart", "conference.errors.dateStartNonValid");
}
try {
dateEnd = format.parse(conference.getDateEnd());