Faxtomail-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
June 2014
- 6 participants
- 194 discussions
18 Jun '14
Author: kmorin
Date: 2014-06-18 10:26:11 +0200 (Wed, 18 Jun 2014)
New Revision: 211
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/211
Log:
tentative de chargement des fichiers seulement au moment ou on en a besoin
Added:
trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/AttachmentImpl.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/EditAttachmentAction.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/OpenAttachmentAction.java
Modified:
trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/AttachmentFileImpl.java
trunk/faxtomail-persistence/src/main/resources/faxToMail.properties
trunk/faxtomail-persistence/src/main/xmi/faxtomail.properties
trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailService.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/GenerateAnnotatedAttachmentAction.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentCellEditor.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentEditorUIHandler.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUIHandler.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIHandler.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIModel.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/print/AttachmentToPrintChooserUIHandler.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FaxToMailUIUtil.java
trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_fr_FR.properties
trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/job/MailFilterJob.java
Modified: trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/AttachmentFileImpl.java
===================================================================
--- trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/AttachmentFileImpl.java 2014-06-17 17:01:10 UTC (rev 210)
+++ trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/AttachmentFileImpl.java 2014-06-18 08:26:11 UTC (rev 211)
@@ -65,9 +65,9 @@
// if the file already exists, then add a number to the name
int i = 1;
String extension = "." + FileUtil.extension(fileName);
- String name = FileUtil.basename(extension);
+ String name = FileUtil.basename(fileName);
while (tmpLocalFile.exists()) {
- tmpLocalFile = new File(tempFolder, name + "-" + i + extension);
+ tmpLocalFile = new File(tempFolder, name + "-" + i++ + extension);
}
if (log.isDebugEnabled()) {
Added: trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/AttachmentImpl.java
===================================================================
--- trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/AttachmentImpl.java (rev 0)
+++ trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/AttachmentImpl.java 2014-06-18 08:26:11 UTC (rev 211)
@@ -0,0 +1,20 @@
+package com.franciaflex.faxtomail.persistence.entities;
+
+/**
+ * @author Kevin Morin (Code Lutin)
+ * @since x.x
+ */
+public class AttachmentImpl extends AttachmentAbstract {
+
+ @Override
+ public void setOriginalFile(AttachmentFile originalFile) {
+ super.setOriginalFile(originalFile);
+ setOriginalFileName(originalFile != null ? originalFile.getFilename() : null);
+ }
+
+ @Override
+ public void setEditedFile(AttachmentFile editedFile) {
+ super.setEditedFile(editedFile);
+ setEditedFileName(editedFile != null ? editedFile.getFilename() : null);
+ }
+}
Modified: trunk/faxtomail-persistence/src/main/resources/faxToMail.properties
===================================================================
--- trunk/faxtomail-persistence/src/main/resources/faxToMail.properties 2014-06-17 17:01:10 UTC (rev 210)
+++ trunk/faxtomail-persistence/src/main/resources/faxToMail.properties 2014-06-18 08:26:11 UTC (rev 211)
@@ -34,7 +34,8 @@
#hibernate.connection.username=fx
#hibernate.connection.password=FX2013!
-hibernate.hbm2ddl.auto=validate
+#hibernate.hbm2ddl.auto=validate
+hibernate.hbm2ddl.auto=
#hibernate.show_sql=true
#hibernate.format_sql=true
#hibernate.ejb.naming_strategy=org.hibernate.cfg.ImprovedNamingStrategy
Modified: trunk/faxtomail-persistence/src/main/xmi/faxtomail.properties
===================================================================
--- trunk/faxtomail-persistence/src/main/xmi/faxtomail.properties 2014-06-17 17:01:10 UTC (rev 210)
+++ trunk/faxtomail-persistence/src/main/xmi/faxtomail.properties 2014-06-18 08:26:11 UTC (rev 211)
@@ -53,11 +53,11 @@
# Attachment
-com.franciaflex.faxtomail.persistence.entities.Attachment.attribute.originalFile.tagvalue.notNull=true
+#com.franciaflex.faxtomail.persistence.entities.Attachment.attribute.originalFile.tagvalue.notNull=true
# AttachmentFile
com.franciaflex.faxtomail.persistence.entities.AttachmentFile.attribute.filename.tagvalue.notNull=true
-com.franciaflex.faxtomail.persistence.entities.AttachmentFile.attribute.content.tagvalue.notNull=true
+#com.franciaflex.faxtomail.persistence.entities.AttachmentFile.attribute.content.tagvalue.notNull=true
# MailFolder
com.franciaflex.faxtomail.persistence.entities.MailFolder.class.tagvalue.naturalIdMutable=true
Modified: trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailService.java
===================================================================
--- trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailService.java 2014-06-17 17:01:10 UTC (rev 210)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailService.java 2014-06-18 08:26:11 UTC (rev 211)
@@ -46,6 +46,7 @@
import javax.activation.FileDataSource;
import javax.mail.MessagingException;
+import com.franciaflex.faxtomail.persistence.entities.AttachmentTopiaDao;
import com.franciaflex.faxtomail.persistence.entities.MailField;
import org.apache.commons.collections4.CollectionUtils;
@@ -155,19 +156,28 @@
attachmentBinder.copy(attachment, currentAttachment);
// persist
- if (currentAttachment.getEditedFile() != null) {
- if (!currentAttachment.getEditedFile().isPersisted()) {
- attachementFileTopiaDao.create(currentAttachment.getEditedFile());
+ AttachmentFile editedFile = currentAttachment.getEditedFile();
+ if (editedFile != null) {
+ if (!editedFile.isPersisted()) {
+ attachementFileTopiaDao.create(editedFile);
} else {
- attachementFileTopiaDao.update(currentAttachment.getEditedFile());
+ attachementFileTopiaDao.update(editedFile);
}
+ } else if (attachment.isPersisted()) {
+ AttachmentFile attachmentFile = getAttachmentFile(attachment.getTopiaId(), false);
+ currentAttachment.setEditedFile(attachmentFile);
}
- if (currentAttachment.getOriginalFile() != null) {
- if (!currentAttachment.getOriginalFile().isPersisted()) {
- attachementFileTopiaDao.create(currentAttachment.getOriginalFile());
+
+ AttachmentFile originalFile = currentAttachment.getOriginalFile();
+ if (originalFile != null) {
+ if (!originalFile.isPersisted()) {
+ attachementFileTopiaDao.create(originalFile);
} else {
- attachementFileTopiaDao.update(currentAttachment.getOriginalFile());
+ attachementFileTopiaDao.update(originalFile);
}
+ } else if (attachment.isPersisted()) {
+ AttachmentFile attachmentFile = getAttachmentFile(attachment.getTopiaId(), true);
+ currentAttachment.setOriginalFile(attachmentFile);
}
if (!attachment.isPersisted()) {
@@ -577,6 +587,13 @@
return attachmentFile;
}
+ public AttachmentFile getAttachmentFile(String attachmentId, boolean original) {
+ AttachmentTopiaDao dao = getPersistenceContext().getAttachmentDao();
+ Attachment attachment = dao.findByTopiaId(attachmentId);
+ return original ? attachment.getOriginalFile() : attachment.getEditedFile();
+ }
+
+
/**
* Retourne la liste des email ayant un verrouillage actif.
*
Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/EditAttachmentAction.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/EditAttachmentAction.java (rev 0)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/EditAttachmentAction.java 2014-06-18 08:26:11 UTC (rev 211)
@@ -0,0 +1,59 @@
+package com.franciaflex.faxtomail.ui.swing.actions;
+
+import com.franciaflex.faxtomail.persistence.entities.Attachment;
+import com.franciaflex.faxtomail.persistence.entities.AttachmentFile;
+import com.franciaflex.faxtomail.ui.swing.content.MainUI;
+import com.franciaflex.faxtomail.ui.swing.content.attachment.AttachmentEditorUI;
+import com.franciaflex.faxtomail.ui.swing.content.attachment.AttachmentEditorUIHandler;
+import com.franciaflex.faxtomail.ui.swing.content.attachment.AttachmentEditorUIModel;
+import com.franciaflex.faxtomail.ui.swing.content.pdfeditor.PDFEditorUI;
+import com.franciaflex.faxtomail.ui.swing.util.FaxToMailUIUtil;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.awt.*;
+import java.io.IOException;
+
+import static org.nuiton.i18n.I18n.t;
+
+/**
+ * @author Kevin Morin (Code Lutin)
+ * @since x.x
+ */
+public class EditAttachmentAction extends AbstractFaxToMailAction<AttachmentEditorUIModel, AttachmentEditorUI, AttachmentEditorUIHandler> {
+
+ private static final Log log = LogFactory.getLog(EditAttachmentAction.class);
+
+ protected Attachment attachment;
+
+ public EditAttachmentAction(AttachmentEditorUIHandler handler) {
+ super(handler, false);
+ }
+
+ public void setAttachment(Attachment attachment) {
+ this.attachment = attachment;
+ String attachmentName = attachment.getEditedFileName() != null ? attachment.getEditedFileName() : attachment.getOriginalFileName();
+ setActionDescription(t("faxtomail.action.attachment.edit.tip", attachmentName));
+ }
+
+ @Override
+ public void doAction() throws Exception {
+ MainUI mainUI = getContext().getMainUI();
+ PDFEditorUI dialogContent = new PDFEditorUI(getUI());
+
+ boolean editedNull = attachment.getEditedFileName() == null;
+ AttachmentFile attachmentFile = editedNull ? attachment.getOriginalFile() : attachment.getEditedFile();
+ if (attachmentFile == null) {
+ attachmentFile = getContext().getEmailService().getAttachmentFile(attachment.getTopiaId(), editedNull);
+ }
+
+ if (editedNull) {
+ attachment.setOriginalFile(attachmentFile);
+ } else {
+ attachment.setEditedFile(attachmentFile);
+ }
+ dialogContent.getModel().fromEntity(attachment);
+ getHandler().openDialog(dialogContent, attachment.getOriginalFileName(), mainUI.getSize());
+ dialogContent.getModel().toEntity(attachment);
+ }
+}
\ No newline at end of file
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/GenerateAnnotatedAttachmentAction.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/GenerateAnnotatedAttachmentAction.java 2014-06-17 17:01:10 UTC (rev 210)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/GenerateAnnotatedAttachmentAction.java 2014-06-18 08:26:11 UTC (rev 211)
@@ -250,7 +250,8 @@
// convert content to blob
InputStream is = new BufferedInputStream(new FileInputStream(target));
AttachmentFile attachmentFileNew = getContext().getEmailService().getAttachmentFileFromStream(is);
- attachmentFileNew.setFilename(FaxToMailUIUtil.getEditedFileName(getModel().getOriginalFile()));
+ String fileName = getModel().getNotNullFile().getFilename();
+ attachmentFileNew.setFilename(FaxToMailUIUtil.getEditedFileName(fileName));
getModel().setEditedFile(attachmentFileNew);
}
Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/OpenAttachmentAction.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/OpenAttachmentAction.java (rev 0)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/OpenAttachmentAction.java 2014-06-18 08:26:11 UTC (rev 211)
@@ -0,0 +1,63 @@
+package com.franciaflex.faxtomail.ui.swing.actions;
+
+import com.franciaflex.faxtomail.persistence.entities.Attachment;
+import com.franciaflex.faxtomail.persistence.entities.AttachmentFile;
+import com.franciaflex.faxtomail.ui.swing.content.attachment.AttachmentEditorUI;
+import com.franciaflex.faxtomail.ui.swing.content.attachment.AttachmentEditorUIHandler;
+import com.franciaflex.faxtomail.ui.swing.content.attachment.AttachmentEditorUIModel;
+import com.franciaflex.faxtomail.ui.swing.content.attachment.AttachmentItem;
+import com.franciaflex.faxtomail.ui.swing.util.FaxToMailUIUtil;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.awt.*;
+import java.io.File;
+import java.io.IOException;
+
+import static org.nuiton.i18n.I18n.t;
+
+/**
+ * @author Kevin Morin (Code Lutin)
+ * @since x.x
+ */
+public class OpenAttachmentAction extends AbstractFaxToMailAction<AttachmentEditorUIModel, AttachmentEditorUI, AttachmentEditorUIHandler> {
+
+ private static final Log log = LogFactory.getLog(OpenAttachmentAction.class);
+
+ protected Attachment attachment;
+ protected boolean original;
+
+ public OpenAttachmentAction(AttachmentEditorUIHandler handler) {
+ super(handler, false);
+ }
+
+ public void setAttachment(Attachment attachment, boolean original) {
+ this.attachment = attachment;
+ this.original = original;
+ String attachmentName = original ? attachment.getOriginalFileName() : attachment.getEditedFileName();
+ setActionDescription(t("faxtomail.action.attachment.open.tip", attachmentName));
+ }
+
+ @Override
+ public void doAction() throws Exception {
+ getModel().fireAttachmentOpened(attachment, original);
+ AttachmentFile attachmentFile = original ? attachment.getOriginalFile() : attachment.getEditedFile();
+ if (attachmentFile == null) {
+ attachmentFile = getContext().getEmailService().getAttachmentFile(attachment.getTopiaId(), original);
+ if (original) {
+ attachment.setOriginalFile(attachmentFile);
+ } else {
+ attachment.setEditedFile(attachmentFile);
+ }
+ }
+// AttachmentFile attachmentFile = original ? attachment.getOriginalFile() : attachment.getEditedFile();
+
+ Desktop desktop = FaxToMailUIUtil.getDesktopForOpen();
+ try {
+ File file = attachmentFile.getFile();
+ desktop.open(file);
+ } catch (IOException e) {
+ getContext().getErrorHelper().showErrorDialog(t("swing.error.cannot.open.file"));
+ }
+ }
+}
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentCellEditor.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentCellEditor.java 2014-06-17 17:01:10 UTC (rev 210)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentCellEditor.java 2014-06-18 08:26:11 UTC (rev 211)
@@ -113,7 +113,7 @@
if (original) {
filename = attachment.getOriginalFileName();
} else {
- filename = FaxToMailUIUtil.getEditedFileName(attachment.getOriginalFile());
+ filename = FaxToMailUIUtil.getEditedFileName(attachment.getOriginalFileName());
}
Email email = context.getEmailService().addToHistory(topiaId,
HistoryType.ATTACHMENT_OPENING,
@@ -131,7 +131,7 @@
HistoryType.ATTACHMENT_MODIFICATION,
context.getCurrentUser(),
new Date(),
- FaxToMailUIUtil.getEditedFileName(attachment.getOriginalFile()));
+ FaxToMailUIUtil.getEditedFileName(attachment.getOriginalFileName()));
model.fromEntity(email);
}
};
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentEditorUIHandler.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentEditorUIHandler.java 2014-06-17 17:01:10 UTC (rev 210)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentEditorUIHandler.java 2014-06-18 08:26:11 UTC (rev 211)
@@ -26,6 +26,8 @@
import com.franciaflex.faxtomail.persistence.entities.Attachment;
import com.franciaflex.faxtomail.persistence.entities.AttachmentImpl;
+import com.franciaflex.faxtomail.ui.swing.actions.EditAttachmentAction;
+import com.franciaflex.faxtomail.ui.swing.actions.OpenAttachmentAction;
import com.franciaflex.faxtomail.ui.swing.content.MainUI;
import com.franciaflex.faxtomail.ui.swing.content.pdfeditor.PDFEditorUI;
import com.franciaflex.faxtomail.ui.swing.util.AbstractToolbarPopupHandler;
@@ -88,6 +90,9 @@
public static final List<String> EDITABLE_EXTENSIONS = Lists.newArrayList("PDF", "PNG", "JPG", "JPEG", "GIF",
"TIF", "BMP", "TXT");
+ protected OpenAttachmentAction openAttachmentAction = new OpenAttachmentAction(this);
+ protected EditAttachmentAction editAttachmentAction = new EditAttachmentAction(this);
+
@Override
public void afterInit(AttachmentEditorUI ui) {
@@ -171,9 +176,8 @@
InputStream is = new BufferedInputStream(new FileInputStream(file));
AttachmentFile attachmentFile = getContext().getEmailService().getAttachmentFileFromStream(is);
attachmentFile.setFilename(file.getName());
- //TODO 20140612 put in the impl
- attachment.setOriginalFileName(file.getName());
attachment.setOriginalFile(attachmentFile);
+
} catch (Exception e) {
getContext().getErrorHelper().showErrorDialog(t("swing.error.cannot.copy.file"), e);
}
@@ -187,61 +191,22 @@
}
public void openAttachment(Attachment attachment) {
-
- getModel().fireAttachmentOpened(attachment, true);
- log.info("before get file");
- File file = attachment.getOriginalFile().getFile();
- log.info("after get file");
-
- Desktop desktop = FaxToMailUIUtil.getDesktopForOpen();
- try {
- desktop.open(file);
- } catch (IOException e) {
- getContext().getErrorHelper().showErrorDialog(t("swing.error.cannot.open.file"));
- }
+ openAttachmentAction.setAttachment(attachment, true);
+ getContext().getActionFactory().createUIAction(null, openAttachmentAction).actionPerformed(null);
}
public void editAttachment(Attachment attachment) {
AttachmentEditorUIModel model = getModel();
- AttachmentFile attachmentFile = attachment.getEditedFile();
- if (attachmentFile == null) {
- model.fireAttachmentOpened(attachment, true);
- attachmentFile = attachment.getOriginalFile();
+ String extension = FileUtil.extension(attachment.getOriginalFileName());
+ if (model.isEditable() && EDITABLE_EXTENSIONS.contains(extension.toUpperCase())) {
- } else {
- model.fireAttachmentOpened(attachment, false);
- }
- File file = attachmentFile.getFile();
+ editAttachmentAction.setAttachment(attachment);
+ getContext().getActionFactory().createUIAction(null, editAttachmentAction).actionPerformed(null);
- if (model.isEditable()) {
- String extension = FileUtil.extension(attachmentFile.getFilename());
- if (model.isEditable() && EDITABLE_EXTENSIONS.contains(extension.toUpperCase())) {
-
- MainUI mainUI = getContext().getMainUI();
- mainUI.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
- PDFEditorUI dialogContent = new PDFEditorUI(ui);
- dialogContent.getModel().fromEntity(attachment);
- mainUI.setCursor(Cursor.getDefaultCursor());
- openDialog(dialogContent, file.getName(), mainUI.getSize());
- dialogContent.getModel().toEntity(attachment);
-
- } else {
- Desktop desktop = FaxToMailUIUtil.getDesktopForOpen();
- try {
- desktop.open(file);
- } catch (IOException e) {
- getContext().getErrorHelper().showErrorDialog(t("swing.error.cannot.open.file"));
- }
- }
-
- } else {
- Desktop desktop = FaxToMailUIUtil.getDesktopForBrowse();
- try {
- desktop.open(file);
- } catch (IOException e) {
- getContext().getErrorHelper().showErrorDialog(t("swing.error.cannot.open.file"));
- }
+ } else if (attachment.getEditedFileName() != null) {
+ openAttachmentAction.setAttachment(attachment, false);
+ getContext().getActionFactory().createUIAction(null, openAttachmentAction).actionPerformed(null);
}
}
@@ -273,7 +238,7 @@
public boolean isAttachmentEditable(Attachment attachment) {
String extension = FileUtil.extension(attachment.getOriginalFileName());
- return EDITABLE_EXTENSIONS.contains(extension.toUpperCase());
+ return EDITABLE_EXTENSIONS.contains(extension.toUpperCase()) && (getModel().isEditable() || attachment.getEditedFileName() != null);
}
public boolean isAttachmentRemovable(Attachment attachment) {
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUIHandler.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUIHandler.java 2014-06-17 17:01:10 UTC (rev 210)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUIHandler.java 2014-06-18 08:26:11 UTC (rev 211)
@@ -454,6 +454,7 @@
for (Attachment attachment : demandeUIModel.getAttachment()) {
AttachmentFile attachmentFile = attachment.getEditedFile();
if (attachmentFile == null) {
+ // TODO kmorin 20140617 put it in action and check if file is null
attachmentFile = attachment.getOriginalFile();
}
FaxToMailUIUtil.print(attachmentFile, true);
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIHandler.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIHandler.java 2014-06-17 17:01:10 UTC (rev 210)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIHandler.java 2014-06-18 08:26:11 UTC (rev 211)
@@ -339,7 +339,7 @@
if (original) {
filename = attachment.getOriginalFileName();
} else {
- filename = FaxToMailUIUtil.getEditedFileName(attachment.getOriginalFile());
+ filename = FaxToMailUIUtil.getEditedFileName(attachment.getOriginalFileName());
}
Email email = getContext().getEmailService().addToHistory(topiaId,
HistoryType.ATTACHMENT_OPENING,
@@ -358,7 +358,7 @@
HistoryType.ATTACHMENT_MODIFICATION,
getContext().getCurrentUser(),
new Date(),
- FaxToMailUIUtil.getEditedFileName(attachment.getOriginalFile()));
+ FaxToMailUIUtil.getEditedFileName(attachment.getOriginalFileName()));
getModel().setHistory(email.getHistory());
}
}
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIModel.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIModel.java 2014-06-17 17:01:10 UTC (rev 210)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIModel.java 2014-06-18 08:26:11 UTC (rev 211)
@@ -23,6 +23,8 @@
*/
import com.franciaflex.faxtomail.persistence.entities.Attachment;
+import com.franciaflex.faxtomail.persistence.entities.AttachmentFile;
+import com.franciaflex.faxtomail.persistence.entities.AttachmentFileImpl;
import com.franciaflex.faxtomail.persistence.entities.AttachmentImpl;
import com.franciaflex.faxtomail.persistence.entities.Client;
import com.franciaflex.faxtomail.persistence.entities.DemandStatus;
@@ -200,18 +202,17 @@
*/
public void fromEntity(Email entity, boolean full) {
//super.fromEntity(entity);
-
- fromBeanBinder.copyExcluding(entity, this);
+ fromBeanBinder.copyExcluding(entity, this, Email.PROPERTY_ATTACHMENT);
// specific attachment copy
Collection<Attachment> attachmentCopy = new ArrayList<Attachment>();
-// if (entity.getAttachment() != null) {
-// for (Attachment attachment : entity.getAttachment()) {
-// Attachment clone = new AttachmentImpl();
-// fromAttachmentBinder.copyExcluding(attachment, clone, Attachment.PROPERTY_ORIGINAL_FILE, Attachment.PROPERTY_EDITED_FILE_NAME);
-// attachmentCopy.add(clone);
-// }
-// }
-// setAttachment(attachmentCopy);
+ if (entity.getAttachment() != null) {
+ for (Attachment attachment : entity.getAttachment()) {
+ Attachment clone = new AttachmentImpl();
+ fromAttachmentBinder.copyExcluding(attachment, clone, Attachment.PROPERTY_EDITED_FILE, Attachment.PROPERTY_ORIGINAL_FILE);
+ attachmentCopy.add(clone);
+ }
+ }
+ setAttachment(attachmentCopy);
}
@Override
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/print/AttachmentToPrintChooserUIHandler.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/print/AttachmentToPrintChooserUIHandler.java 2014-06-17 17:01:10 UTC (rev 210)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/print/AttachmentToPrintChooserUIHandler.java 2014-06-18 08:26:11 UTC (rev 211)
@@ -65,6 +65,7 @@
attachmentPanel.add(checkBox);
for (Attachment attachment : demand.getAttachment()) {
+ //TODO kmorin 20140617 check if not null
createCheckBox(attachment.getOriginalFile());
final AttachmentFile file = attachment.getEditedFile();
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FaxToMailUIUtil.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FaxToMailUIUtil.java 2014-06-17 17:01:10 UTC (rev 210)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FaxToMailUIUtil.java 2014-06-18 08:26:11 UTC (rev 211)
@@ -225,9 +225,9 @@
content = content.replaceAll("<meta (.*?)>(</meta>)?", "");
for (Attachment attachment : demandeUIModel.getAttachment()) {
- AttachmentFile file = attachment.getOriginalFile();
- log.info("file " + file.getFilename());
- String key = file.getFilename();
+ String fileName = attachment.getOriginalFileName();
+ log.info("file " + fileName);
+ String key = fileName;
// replace the inline attachments with the extracted attachment file url
//content = content.replaceAll("<img src=\"cid:" + key + "\"(.*?>)", "<img src=\"file://" + file.getAbsolutePath() + "\"$1");
throw new RuntimeException("Fix it");
@@ -315,7 +315,7 @@
}
- public static String getEditedFileName(AttachmentFile originalFile) {
- return t("faxtomail.attachment.editedFile.name", originalFile.getFilename()) + "-.pdf";
+ public static String getEditedFileName(String originalFileName) {
+ return t("faxtomail.attachment.editedFile.name", originalFileName) + "-.pdf";
}
}
Modified: trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_fr_FR.properties
===================================================================
--- trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_fr_FR.properties 2014-06-17 17:01:10 UTC (rev 210)
+++ trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_fr_FR.properties 2014-06-18 08:26:11 UTC (rev 211)
@@ -4,6 +4,8 @@
application.action.create.error=
application.error.ui.business.warning=
faxtomail.action.archive.tip=Archiver l'élément
+faxtomail.action.attachment.edit.tip=Edition du fichier %s
+faxtomail.action.attachment.open.tip=Ouverture du fichier %s
faxtomail.action.computeQuantitiesByRange.tip=Calculer les quantités par gamme
faxtomail.action.configuration=Configuration
faxtomail.action.configuration.mnemonic=
Modified: trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/job/MailFilterJob.java
===================================================================
--- trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/job/MailFilterJob.java 2014-06-17 17:01:10 UTC (rev 210)
+++ trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/job/MailFilterJob.java 2014-06-18 08:26:11 UTC (rev 211)
@@ -381,7 +381,6 @@
AttachmentFile attachmentFile = emailService.getAttachmentFileFromStream(dh.getInputStream());
attachmentFile.setFilename(fileName);
attachment.setOriginalFile(attachmentFile);
- attachment.setOriginalFileName(fileName);
//email.addAttachment(attachment);
attachments.add(attachment);
1
0
17 Jun '14
Author: kmorin
Date: 2014-06-17 19:01:10 +0200 (Tue, 17 Jun 2014)
New Revision: 210
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/210
Log:
use filename directly instead of file.name
Modified:
trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/AttachmentFileImpl.java
trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/DecoratorService.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentCellEditor.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentEditorUIHandler.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentItem.css
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIHandler.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIModel.java
trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/job/MailFilterJob.java
trunk/faxtomail-ui-web/src/main/webapp/js/configuration.js
Modified: trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/AttachmentFileImpl.java
===================================================================
--- trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/AttachmentFileImpl.java 2014-06-17 08:05:56 UTC (rev 209)
+++ trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/AttachmentFileImpl.java 2014-06-17 17:01:10 UTC (rev 210)
@@ -47,12 +47,18 @@
@Override
public File getFile() {
- if (tmpLocalFile == null && getContent() != null) {
+
+ log.info("get content");
+ byte[] content = getContent();
+
+ if (tmpLocalFile == null && content != null) {
try {
+ log.info("create temp file");
// create temp file
File tempFolder = new File(FileUtils.getTempDirectory(), "faxtomail");
tempFolder.mkdir();
+ log.info("new file");
String fileName = getFilename();
tmpLocalFile = new File(tempFolder, fileName);
@@ -70,10 +76,11 @@
tmpLocalFile.deleteOnExit();
+ log.info("copy blob content");
// copy blob content
// be sure that "is" is not closed because is can be a local fileinputstream
// that hibernate must read to put in database
- InputStream is = new ByteArrayInputStream(getContent());
+ InputStream is = new ByteArrayInputStream(content);
OutputStream fos = new BufferedOutputStream(new FileOutputStream(tmpLocalFile));
IOUtils.copy(is, fos);
fos.close();
Modified: trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/DecoratorService.java
===================================================================
--- trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/DecoratorService.java 2014-06-17 08:05:56 UTC (rev 209)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/DecoratorService.java 2014-06-17 17:01:10 UTC (rev 210)
@@ -145,7 +145,7 @@
if (bean == null) {
return "";
}
- return ((Attachment) bean).getOriginalFile().getFilename();
+ return ((Attachment) bean).getOriginalFileName();
}
});
registerDecorator(new Decorator<AttachmentFile>(AttachmentFile.class) {
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentCellEditor.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentCellEditor.java 2014-06-17 08:05:56 UTC (rev 209)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentCellEditor.java 2014-06-17 17:01:10 UTC (rev 210)
@@ -111,7 +111,7 @@
if (topiaId != null) {
String filename;
if (original) {
- filename = attachment.getOriginalFile().getFilename();
+ filename = attachment.getOriginalFileName();
} else {
filename = FaxToMailUIUtil.getEditedFileName(attachment.getOriginalFile());
}
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentEditorUIHandler.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentEditorUIHandler.java 2014-06-17 08:05:56 UTC (rev 209)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentEditorUIHandler.java 2014-06-17 17:01:10 UTC (rev 210)
@@ -37,6 +37,8 @@
import jaxx.runtime.validator.swing.SwingValidator;
import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.jdesktop.swingx.JXTable;
import org.jdesktop.swingx.decorator.HighlighterFactory;
import org.nuiton.util.DesktopUtil;
@@ -81,6 +83,8 @@
*/
public class AttachmentEditorUIHandler extends AbstractToolbarPopupHandler<AttachmentEditorUIModel, AttachmentEditorUI> {
+ private static final Log log = LogFactory.getLog(AttachmentEditorUIHandler.class);
+
public static final List<String> EDITABLE_EXTENSIONS = Lists.newArrayList("PDF", "PNG", "JPG", "JPEG", "GIF",
"TIF", "BMP", "TXT");
@@ -167,6 +171,8 @@
InputStream is = new BufferedInputStream(new FileInputStream(file));
AttachmentFile attachmentFile = getContext().getEmailService().getAttachmentFileFromStream(is);
attachmentFile.setFilename(file.getName());
+ //TODO 20140612 put in the impl
+ attachment.setOriginalFileName(file.getName());
attachment.setOriginalFile(attachmentFile);
} catch (Exception e) {
getContext().getErrorHelper().showErrorDialog(t("swing.error.cannot.copy.file"), e);
@@ -183,7 +189,9 @@
public void openAttachment(Attachment attachment) {
getModel().fireAttachmentOpened(attachment, true);
+ log.info("before get file");
File file = attachment.getOriginalFile().getFile();
+ log.info("after get file");
Desktop desktop = FaxToMailUIUtil.getDesktopForOpen();
try {
@@ -245,7 +253,7 @@
}
int answer = JOptionPane.showConfirmDialog(ui,
t("faxtomail.attachmentEditor.deleteAttachment.message",
- attachment.getOriginalFile().getFilename()),
+ attachment.getOriginalFileName()),
t("faxtomail.attachmentEditor.deleteAttachment.title"),
JOptionPane.YES_NO_OPTION
);
@@ -264,7 +272,7 @@
}
public boolean isAttachmentEditable(Attachment attachment) {
- String extension = FileUtil.extension(attachment.getOriginalFile().getFilename());
+ String extension = FileUtil.extension(attachment.getOriginalFileName());
return EDITABLE_EXTENSIONS.contains(extension.toUpperCase());
}
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentItem.css
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentItem.css 2014-06-17 08:05:56 UTC (rev 209)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentItem.css 2014-06-17 17:01:10 UTC (rev 210)
@@ -26,7 +26,7 @@
}
#attachmentNameLabel {
- text: { attachment != null ? getAttachment().getOriginalFile().getFilename() : null };
+ text: { attachment != null ? getAttachment().getOriginalFileName() : null };
}
#toolbar {
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIHandler.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIHandler.java 2014-06-17 08:05:56 UTC (rev 209)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIHandler.java 2014-06-17 17:01:10 UTC (rev 210)
@@ -337,7 +337,7 @@
if (topiaId != null) {
String filename;
if (original) {
- filename = attachment.getOriginalFile().getFilename();
+ filename = attachment.getOriginalFileName();
} else {
filename = FaxToMailUIUtil.getEditedFileName(attachment.getOriginalFile());
}
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIModel.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIModel.java 2014-06-17 08:05:56 UTC (rev 209)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIModel.java 2014-06-17 17:01:10 UTC (rev 210)
@@ -201,17 +201,17 @@
public void fromEntity(Email entity, boolean full) {
//super.fromEntity(entity);
- fromBeanBinder.copyExcluding(entity, this, Email.PROPERTY_ATTACHMENT);
+ fromBeanBinder.copyExcluding(entity, this);
// specific attachment copy
Collection<Attachment> attachmentCopy = new ArrayList<Attachment>();
- if (entity.getAttachment() != null) {
- for (Attachment attachment : entity.getAttachment()) {
- Attachment clone = new AttachmentImpl();
- fromAttachmentBinder.copy(attachment, clone);
- attachmentCopy.add(clone);
- }
- }
- setAttachment(attachmentCopy);
+// if (entity.getAttachment() != null) {
+// for (Attachment attachment : entity.getAttachment()) {
+// Attachment clone = new AttachmentImpl();
+// fromAttachmentBinder.copyExcluding(attachment, clone, Attachment.PROPERTY_ORIGINAL_FILE, Attachment.PROPERTY_EDITED_FILE_NAME);
+// attachmentCopy.add(clone);
+// }
+// }
+// setAttachment(attachmentCopy);
}
@Override
Modified: trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/job/MailFilterJob.java
===================================================================
--- trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/job/MailFilterJob.java 2014-06-17 08:05:56 UTC (rev 209)
+++ trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/job/MailFilterJob.java 2014-06-17 17:01:10 UTC (rev 210)
@@ -381,6 +381,7 @@
AttachmentFile attachmentFile = emailService.getAttachmentFileFromStream(dh.getInputStream());
attachmentFile.setFilename(fileName);
attachment.setOriginalFile(attachmentFile);
+ attachment.setOriginalFileName(fileName);
//email.addAttachment(attachment);
attachments.add(attachment);
Modified: trunk/faxtomail-ui-web/src/main/webapp/js/configuration.js
===================================================================
--- trunk/faxtomail-ui-web/src/main/webapp/js/configuration.js 2014-06-17 08:05:56 UTC (rev 209)
+++ trunk/faxtomail-ui-web/src/main/webapp/js/configuration.js 2014-06-17 17:01:10 UTC (rev 210)
@@ -104,7 +104,7 @@
function($scope, $window, ConfigurationData) {
// initialisation de la configuration
- if ($scope.configuration.invalidFormDisabledActions) {
+ if (!$scope.configuration.invalidFormDisabledActions) {
$scope.configuration.invalidFormDisabledActions = [];
}
1
0
r209 - trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment
by echatellier@users.forge.codelutin.com 17 Jun '14
by echatellier@users.forge.codelutin.com 17 Jun '14
17 Jun '14
Author: echatellier
Date: 2014-06-17 10:05:56 +0200 (Tue, 17 Jun 2014)
New Revision: 209
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/209
Log:
Add another buffer
Modified:
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentEditorUIHandler.java
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentEditorUIHandler.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentEditorUIHandler.java 2014-06-16 21:28:48 UTC (rev 208)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentEditorUIHandler.java 2014-06-17 08:05:56 UTC (rev 209)
@@ -47,6 +47,7 @@
import java.awt.Desktop;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
+import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
@@ -163,7 +164,7 @@
if (file != null) {
try {
// warning, this not NOT be closed (will be by blob on commit)
- InputStream is = new FileInputStream(file);
+ InputStream is = new BufferedInputStream(new FileInputStream(file));
AttachmentFile attachmentFile = getContext().getEmailService().getAttachmentFileFromStream(is);
attachmentFile.setFilename(file.getName());
attachment.setOriginalFile(attachmentFile);
1
0
r208 - trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities
by echatellier@users.forge.codelutin.com 16 Jun '14
by echatellier@users.forge.codelutin.com 16 Jun '14
16 Jun '14
Author: echatellier
Date: 2014-06-16 23:28:48 +0200 (Mon, 16 Jun 2014)
New Revision: 208
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/208
Log:
Add buffer to speed up file writing on disk
Modified:
trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/AttachmentFileImpl.java
Modified: trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/AttachmentFileImpl.java
===================================================================
--- trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/AttachmentFileImpl.java 2014-06-16 09:14:38 UTC (rev 207)
+++ trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/AttachmentFileImpl.java 2014-06-16 21:28:48 UTC (rev 208)
@@ -24,11 +24,13 @@
* #L%
*/
+import java.io.BufferedOutputStream;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
+import java.io.OutputStream;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
@@ -72,7 +74,7 @@
// be sure that "is" is not closed because is can be a local fileinputstream
// that hibernate must read to put in database
InputStream is = new ByteArrayInputStream(getContent());
- FileOutputStream fos = new FileOutputStream(tmpLocalFile);
+ OutputStream fos = new BufferedOutputStream(new FileOutputStream(tmpLocalFile));
IOUtils.copy(is, fos);
fos.close();
1
0
r207 - in trunk: faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/job faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin faxtomail-ui-web/src/main/webapp/js
by echatellier@users.forge.codelutin.com 16 Jun '14
by echatellier@users.forge.codelutin.com 16 Jun '14
16 Jun '14
Author: echatellier
Date: 2014-06-16 11:14:38 +0200 (Mon, 16 Jun 2014)
New Revision: 207
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/207
Log:
Ajout du test pour la connexion au serveur mail.
Ajout du support imap, imaps, pop3, pop3s
Modified:
trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ConfigurationService.java
trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/FaxToMailApplicationListener.java
trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ConfigurationJsonAction.java
trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/job/MailFilterJob.java
trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp
trunk/faxtomail-ui-web/src/main/webapp/js/configuration.js
Modified: trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ConfigurationService.java
===================================================================
--- trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ConfigurationService.java 2014-06-15 10:41:28 UTC (rev 206)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ConfigurationService.java 2014-06-16 09:14:38 UTC (rev 207)
@@ -30,7 +30,13 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.Properties;
+import javax.mail.MessagingException;
+import javax.mail.Session;
+import javax.mail.Store;
+import javax.mail.URLName;
+
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -44,6 +50,7 @@
import com.franciaflex.faxtomail.persistence.entities.EmailAccount;
import com.franciaflex.faxtomail.persistence.entities.EmailAccountImpl;
import com.franciaflex.faxtomail.persistence.entities.EmailAccountTopiaDao;
+import com.franciaflex.faxtomail.persistence.entities.EmailProtocol;
import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser;
import com.franciaflex.faxtomail.persistence.entities.FaxToMailUserGroup;
import com.franciaflex.faxtomail.persistence.entities.FaxToMailUserGroupTopiaDao;
@@ -205,7 +212,7 @@
emailAccountTopiaDao.create(emailAccount);
}
}
-
+
emailAccountTopiaDao.deleteAll(emailAccountMap.values());
getPersistenceContext().commit();
}
@@ -219,7 +226,7 @@
log.warn("user folders = " + userFolders);
FaxToMailUserTopiaDao faxToMailUserTopiaDao = getPersistenceContext().getFaxToMailUserDao();
-
+
for (Map.Entry<String, Collection<MailFolder>> entry : userFolders.entrySet()) {
String userId = entry.getKey();
Collection<MailFolder> mailFolders = entry.getValue();
@@ -231,7 +238,7 @@
}
faxToMailUserTopiaDao.update(user);
}
-
+
getPersistenceContext().commit();
}
@@ -256,7 +263,7 @@
// recuperation de tout les groupes chef dont l'utilsateur est membre
GroupChefTopiaDao groupChefTopiaDao = getPersistenceContext().getGroupChefDao();
List<GroupChef> groupChefs = groupChefTopiaDao.forUserGroupIn(user.getUserGroups()).findAll();
-
+
// recuperation de tous les users des groups gérés
FaxToMailUserTopiaDao faxToMailUserTopiaDao = getPersistenceContext().getFaxToMailUserDao();
for (GroupChef groupChef : groupChefs) {
@@ -283,7 +290,7 @@
* @param path path
* @return file info
*/
- public Object checkDirectory(String path) {
+ public Map<String, Object> checkDirectory(String path) {
Map<String, Object> result = new HashMap<>();
File file = new File(path);
result.put("path", path);
@@ -294,4 +301,76 @@
result.put("canExecute", file.canExecute());
return result;
}
+
+ /**
+ * Verification de la connexion à un serveur de mail.
+ *
+ * @param account email account to check
+ * @return
+ */
+ public Map<String, Object> checkMailaccount(EmailAccount account) {
+ Map<String, Object> result = new HashMap<>();
+
+ long before = System.currentTimeMillis();
+ if (log.isDebugEnabled()) {
+ log.debug("Check account " + account.getProtocol() + " : " + account.getHost());
+ }
+
+ Properties properties = new Properties();
+
+ if (account.getProtocol() == EmailProtocol.POP3S) {
+ properties.setProperty("mail.pop3.ssl.enable", "true");
+ }
+
+ switch (account.getProtocol()) {
+ case IMAPS:
+ properties.setProperty("mail.imap.ssl.enable", "true");
+ case IMAP:
+ properties.setProperty("mail.store.protocol", "imap");
+ properties.setProperty("mail.imap.host", account.getHost());
+ properties.setProperty("mail.imap.port", String.valueOf(account.getPort()));
+ properties.setProperty("mail.imap.connectiontimeout", "2000");
+ break;
+ case POP3S:
+ properties.setProperty("mail.pop3.ssl.enable", "true");
+ case POP3:
+ properties.setProperty("mail.store.protocol", "pop3");
+ properties.setProperty("mail.pop3.host", account.getHost());
+ properties.setProperty("mail.pop3.port", String.valueOf(account.getPort()));
+ properties.setProperty("mail.pop3.connectiontimeout", "2000");
+ break;
+ }
+
+ Session session = Session.getInstance(properties);
+ Store store = null;
+
+ try {
+ store = session.getStore();
+ store.connect(account.getLogin(), account.getPassword());
+ store.close();
+
+ // set result map
+ result.put("ok", true);
+ } catch (MessagingException e) {
+ log.error("Error while getting emails from the mailbox", e);
+
+ // set result map
+ result.put("ok", false);
+ result.put("error", e.getMessage());
+ } finally {
+ if (store != null) {
+ try {
+ store.close();
+ } catch (MessagingException ex) {
+ // silent close
+ }
+ }
+ }
+
+ if (log.isDebugEnabled()) {
+ long after = System.currentTimeMillis();
+ log.debug("Checked in " + (after - before) + " ms");
+ }
+ return result;
+ }
}
Modified: trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/FaxToMailApplicationListener.java
===================================================================
--- trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/FaxToMailApplicationListener.java 2014-06-15 10:41:28 UTC (rev 206)
+++ trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/FaxToMailApplicationListener.java 2014-06-16 09:14:38 UTC (rev 207)
@@ -96,7 +96,7 @@
Trigger trigger = TriggerBuilder
.newTrigger()
.withIdentity("mailFiltering", "mailFilteringTrigger")
- .withSchedule(CronScheduleBuilder.cronSchedule("0 0/5 * * * ?"))
+ .withSchedule(CronScheduleBuilder.cronSchedule("0 */5 * * * ?"))
.build();
Scheduler scheduler = new StdSchedulerFactory().getScheduler();
@@ -107,7 +107,7 @@
trigger = TriggerBuilder
.newTrigger()
.withIdentity("ediManagement", "ediManagementTrigger")
- .withSchedule(CronScheduleBuilder.cronSchedule("0 0/5 * * * ?"))
+ .withSchedule(CronScheduleBuilder.cronSchedule("0 */5 * * * ?"))
.build();
scheduler = new StdSchedulerFactory().getScheduler();
Modified: trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ConfigurationJsonAction.java
===================================================================
--- trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ConfigurationJsonAction.java 2014-06-15 10:41:28 UTC (rev 206)
+++ trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ConfigurationJsonAction.java 2014-06-16 09:14:38 UTC (rev 207)
@@ -24,13 +24,9 @@
* #L%
*/
-import java.util.HashMap;
-import java.util.Map;
-
import org.apache.struts2.convention.annotation.Action;
import com.franciaflex.faxtomail.persistence.entities.EmailAccount;
-import com.franciaflex.faxtomail.persistence.entities.EmailAccountImpl;
import com.franciaflex.faxtomail.services.service.ConfigurationService;
import com.franciaflex.faxtomail.web.FaxToMailJsonAction;
@@ -52,12 +48,9 @@
public void setPath(String path) {
this.path = path;
}
-
- public EmailAccount getEmailAccount() {
- if (emailAccount == null) {
- emailAccount = new EmailAccountImpl();
- }
- return emailAccount;
+
+ public void setEmailAccount(String json) {
+ this.emailAccount = getGson().fromJson(json, EmailAccount.class);
}
@Action("configuration-check-directory-json")
@@ -66,9 +59,9 @@
return SUCCESS;
}
- @Action("configuration-check-mail-json")
+ @Action("configuration-check-mailaccount-json")
public String checkMail() {
-
+ jsonData = configurationService.checkMailaccount(emailAccount);
return SUCCESS;
}
Modified: trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/job/MailFilterJob.java
===================================================================
--- trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/job/MailFilterJob.java 2014-06-15 10:41:28 UTC (rev 206)
+++ trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/job/MailFilterJob.java 2014-06-16 09:14:38 UTC (rev 207)
@@ -102,9 +102,9 @@
Collection<EmailAccount> emailAccounts = configurationService.getEmailAccounts();
for (EmailAccount account : emailAccounts) {
- if (account.getProtocol() == EmailProtocol.POP3) {
- checkEmailsOnPop3(account);
- }
+ //if (account.getProtocol() == EmailProtocol.POP3) {
+ checkEmails(account);
+ //}
}
}
@@ -112,12 +112,27 @@
* Checks the emails of the account
* @param account
*/
- public void checkEmailsOnPop3(EmailAccount account) {
+ public void checkEmails(EmailAccount account) {
Properties properties = new Properties();
- properties.setProperty("mail.store.protocol", "pop3");
- properties.setProperty("mail.pop3.host", account.getHost());
- properties.setProperty("mail.pop3.user", account.getLogin());
- properties.setProperty("mail.pop3.port", String.valueOf(account.getPort()));
+
+ switch (account.getProtocol()) {
+ case IMAPS:
+ properties.setProperty("mail.imap.ssl.enable", "true");
+ case IMAP:
+ properties.setProperty("mail.store.protocol", "imap");
+ properties.setProperty("mail.imap.host", account.getHost());
+ properties.setProperty("mail.imap.port", String.valueOf(account.getPort()));
+ properties.setProperty("mail.imap.connectiontimeout", "2000");
+ break;
+ case POP3S:
+ properties.setProperty("mail.pop3.ssl.enable", "true");
+ case POP3:
+ properties.setProperty("mail.store.protocol", "pop3");
+ properties.setProperty("mail.pop3.host", account.getHost());
+ properties.setProperty("mail.pop3.port", String.valueOf(account.getPort()));
+ properties.setProperty("mail.pop3.connectiontimeout", "2000");
+ break;
+ }
Session session = Session.getInstance(properties);
Store store = null;
@@ -125,7 +140,7 @@
Folder inbox = null;
try {
- store = session.getStore(new URLName("pop3://" + account.getHost()));
+ store = session.getStore(/*new URLName("pop3://" + account.getHost())*/);
store.connect(account.getLogin(), account.getPassword());
defaultFolder = store.getDefaultFolder();
inbox = defaultFolder.getFolder("INBOX");
Modified: trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp
===================================================================
--- trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp 2014-06-15 10:41:28 UTC (rev 206)
+++ trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp 2014-06-16 09:14:38 UTC (rev 207)
@@ -28,7 +28,7 @@
<html>
<head>
<title>Configuration</title>
-
+
<link rel="stylesheet" type="text/css" href="<s:url value='/nuiton-js/faxtomail-configuration.css' />" />
<script type="text/javascript" src="<s:url value='/nuiton-js/faxtomail-configuration.js' />"></script>
@@ -53,7 +53,8 @@
'users': <s:property value="toJson(users)" escapeHtml="false"/>,
'groups': <s:property value="toJson(groups)" escapeHtml="false"/>,
// remote service urls
- 'remoteCheckFolder': "<s:url action="configuration-check-directory-json" />"
+ 'remoteCheckFolder': "<s:url action="configuration-check-directory-json" />",
+ 'remoteCheckEmailAccount': "<s:url action="configuration-check-mailaccount-json" />"
});
</script>
</head>
@@ -889,7 +890,7 @@
<div class="form-group col-xs-2">
<br />
<button type="button" class="btn btn-info" ng-disabled="!newAccount.protocol || !newAccount.host || !newAccount.port || !newAccount.login || addEmailAccountForm.$invalid"
- tooltip="Fonctionnalité à venir">
+ ng-click="checkEmailAccount()">
<i class="fa fa-cogs"></i> Test
</button>
<button type="button" class="btn btn-success" ng-disabled="!newAccount.protocol || !newAccount.host || !newAccount.port || !newAccount.login || addEmailAccountForm.$invalid" ng-click="addEmailAccount()">
Modified: trunk/faxtomail-ui-web/src/main/webapp/js/configuration.js
===================================================================
--- trunk/faxtomail-ui-web/src/main/webapp/js/configuration.js 2014-06-15 10:41:28 UTC (rev 206)
+++ trunk/faxtomail-ui-web/src/main/webapp/js/configuration.js 2014-06-16 09:14:38 UTC (rev 207)
@@ -547,6 +547,7 @@
}
};
+ // vérifie sur le serveur que le répertoire existe et a les droits d'écriture
$scope.checkRemotePath = function() {
$http.get(ConfigurationData.remoteCheckFolder +
"?path=" + encodeURIComponent($scope.selectedMailFolder.ediFolder), {cache:true})
@@ -926,8 +927,8 @@
/**
* Email accounts controller.
*/
-ConfigurationModule.controller('ConfigurationEmailAccountsController', ['$scope', '$window', 'ConfigurationData',
- function($scope, $window, ConfigurationData) {
+ConfigurationModule.controller('ConfigurationEmailAccountsController', ['$scope', '$window', '$http', 'ConfigurationData',
+ function($scope, $window, $http, ConfigurationData) {
//{Array} Email accounts
$scope.emailAccounts = ConfigurationData.emailAccounts;
//{Array} Port par défaut des protocols
@@ -941,7 +942,7 @@
$scope.newAccount = {};
$scope.addEmailAccountForm.$setPristine();
};
-
+
// suppression d'un compte
$scope.removeEmailAccount = function(index) {
if ($window.confirm("Êtes-vous sûr de vouloir supprimer ce compte email ?")) {
@@ -949,6 +950,20 @@
}
};
+ // test de connexion au serveur de mail
+ $scope.checkEmailAccount = function() {
+ $http.post(ConfigurationData.remoteCheckEmailAccount, "emailAccount=" + angular.toJson($scope.newAccount),
+ {headers: {'Content-Type': 'application/x-www-form-urlencoded'}})
+ .success(function(data, status, headers, config) {
+ console.log(data, status, headers, config);
+ if (data.ok) {
+ $window.alert("Le test de connexion est passé avec succès.");
+ } else {
+ $window.alert("Impossible de se connecter au serveur : " + data.error);
+ }
+ });
+ };
+
// selection d'un protocol
$scope.$watch("newAccount.protocol", function(newValue, oldValue) {
// auto remplissage du port par defaut
1
0
r206 - in trunk: faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities faxtomail-persistence/src/main/xmi faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin faxtomail-ui-web/src/main/webapp/WEB-INF faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin faxtomail-ui-web/src/main/webapp/WEB-INF/decorators
by echatellier@users.forge.codelutin.com 15 Jun '14
by echatellier@users.forge.codelutin.com 15 Jun '14
15 Jun '14
Author: echatellier
Date: 2014-06-15 12:41:28 +0200 (Sun, 15 Jun 2014)
New Revision: 206
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/206
Log:
Ajout des v?\195?\169rrouillages de mail dans le mod?\195?\168le (et d?\195?\169verrouillage dans l'admin)
Added:
trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/LockAction.java
trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/lock-input.jsp
Modified:
trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/EmailTopiaDao.java
trunk/faxtomail-persistence/src/main/xmi/faxtomail.zargo
trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailService.java
trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/decorators/layout.jsp
trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/wro.xml
Modified: trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/EmailTopiaDao.java
===================================================================
--- trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/EmailTopiaDao.java 2014-06-12 20:00:25 UTC (rev 205)
+++ trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/EmailTopiaDao.java 2014-06-15 10:41:28 UTC (rev 206)
@@ -362,4 +362,16 @@
}
return result;
}
+
+ /**
+ * Retourne les email vérrouillés.
+ *
+ * @return email list
+ */
+ public List<Email> getLockedEmail() {
+ String query = "FROM " + Email.class.getName() + " where " + Email.PROPERTY_LOCKED_BY + " is not null";
+
+ List<Email> results = findAll(query);
+ return results;
+ }
}
Modified: trunk/faxtomail-persistence/src/main/xmi/faxtomail.zargo
===================================================================
(Binary files differ)
Modified: trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailService.java
===================================================================
--- trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailService.java 2014-06-12 20:00:25 UTC (rev 205)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailService.java 2014-06-15 10:41:28 UTC (rev 206)
@@ -47,6 +47,7 @@
import javax.mail.MessagingException;
import com.franciaflex.faxtomail.persistence.entities.MailField;
+
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.Predicate;
import org.apache.commons.io.IOUtils;
@@ -575,4 +576,31 @@
}
return attachmentFile;
}
+
+ /**
+ * Retourne la liste des email ayant un verrouillage actif.
+ *
+ * @return email list
+ */
+ public List<Email> getLockedMail() {
+ EmailTopiaDao emailDao = getPersistenceContext().getEmailDao();
+ List<Email> result = emailDao.getLockedEmail();
+ return result;
+ }
+
+ /**
+ * Dévérrouille les mails specifié.
+ *
+ * @param unlockMails
+ */
+ public void unlockMails(List<String> unlockMails) {
+ EmailTopiaDao emailDao = getPersistenceContext().getEmailDao();
+ for (String unlockMail : unlockMails) {
+ Email mail = emailDao.findByTopiaId(unlockMail);
+ mail.setLockedBy(null);
+ emailDao.update(mail);
+ }
+
+ getPersistenceContext().commit();
+ }
}
Added: trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/LockAction.java
===================================================================
--- trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/LockAction.java (rev 0)
+++ trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/LockAction.java 2014-06-15 10:41:28 UTC (rev 206)
@@ -0,0 +1,99 @@
+package com.franciaflex.faxtomail.web.action.admin;
+
+/*
+ * #%L
+ * FaxToMail :: Web
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2014 Franciaflex, Code Lutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import java.lang.reflect.Type;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.struts2.convention.annotation.Action;
+import org.apache.struts2.convention.annotation.InterceptorRef;
+import org.apache.struts2.convention.annotation.InterceptorRefs;
+import org.apache.struts2.convention.annotation.Result;
+
+import com.franciaflex.faxtomail.persistence.entities.Email;
+import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser;
+import com.franciaflex.faxtomail.persistence.entities.MailFolder;
+import com.franciaflex.faxtomail.services.service.ConfigurationService;
+import com.franciaflex.faxtomail.services.service.EmailService;
+import com.franciaflex.faxtomail.services.service.MailFolderService;
+import com.franciaflex.faxtomail.web.FaxToMailActionSupport;
+import com.google.gson.reflect.TypeToken;
+import com.opensymphony.xwork2.Preparable;
+
+@InterceptorRefs({
+ @InterceptorRef("faxToMailInterceptor"),
+ @InterceptorRef("loginInterceptor"),
+ @InterceptorRef("paramsPrepareParamsStack")
+})
+public class LockAction extends FaxToMailActionSupport implements Preparable {
+
+ private static final Log log = LogFactory.getLog(LockAction.class);
+
+ protected EmailService emailService;
+
+ protected List<Email> lockedMails;
+
+ protected List<String> unlockMails;
+
+ public void setEmailService(EmailService emailService) {
+ this.emailService = emailService;
+ }
+
+ @Override
+ public void prepare() throws Exception {
+ // check authorization
+ if (!getSession().isAdmin()) {
+ throw new RuntimeException("Not authorized");
+ }
+ }
+
+ @Override
+ @Action("lock-input")
+ public String input() throws Exception {
+ lockedMails = emailService.getLockedMail();
+ return INPUT;
+ }
+
+ @Override
+ @Action(results = {@Result(type = "redirectAction", params = {"actionName", "lock-input"})})
+ public String execute() throws Exception {
+ emailService.unlockMails(unlockMails);
+ return SUCCESS;
+ }
+
+ public List<Email> getLockedMails() {
+ return lockedMails;
+ }
+
+ public void setUnlockMails(List<String> unlockMails) {
+ this.unlockMails = unlockMails;
+ }
+}
Property changes on: trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/LockAction.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/lock-input.jsp
===================================================================
--- trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/lock-input.jsp (rev 0)
+++ trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/lock-input.jsp 2014-06-15 10:41:28 UTC (rev 206)
@@ -0,0 +1,76 @@
+<%--
+ #%L
+ FaxToMail :: Web
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2014 Franciaflex, Code Lutin
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as
+ published by the Free Software Foundation, either version 3 of the
+ License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public
+ License along with this program. If not, see
+ <http://www.gnu.org/licenses/gpl-3.0.html>.
+ #L%
+ --%>
+<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
+<!DOCTYPE html>
+<%@taglib uri="/struts-tags" prefix="s" %>
+
+<html>
+ <head>
+ <title>Vérrouillages</title>
+ <link rel="stylesheet" type="text/css" href="<s:url value='/nuiton-js/faxtomail-lock.css' />" />
+ </head>
+
+ <body>
+
+ <div id="main-container" class="container">
+
+ <h1 class="page-header">Liste des verrous actifs sur les demandes</h1>
+
+ <s:form id="main_form" action="lock" method="post">
+
+ <table id='table-snapshot' class="table table-bordered">
+ <thead>
+ <tr>
+ <th></th>
+ <th>Demande</th>
+ <th>Vérrouillé par</th>
+ </tr>
+ </thead>
+ <tbody>
+ <s:iterator value="lockedMails">
+ <tr>
+ <td><input type="checkbox" name="unlockMails" value="<s:property value="topiaId" />" />
+ <td><s:property value="object" /></td>
+ <td>
+ <s:property value="lockedBy.firstName" /> <s:property value="lockedBy.lastName" />
+ </td>
+ </tr>
+ </s:iterator>
+ <s:if test="lockedMails == null || lockedMails.empty">
+ <tr class="emptyTable">
+ <td colspan="3">Aucune demande n'est actuellement vérrouillée.</td>
+ </tr>
+ </s:if>
+ </tbody>
+ </table>
+
+ <nav class="navbar navbar-default navbar-fixed-bottom">
+ <div class="container">
+ <button type="submit" class="btn btn-primary navbar-btn pull-right">Valider</button>
+ </div>
+ </nav>
+ </s:form>
+ </div>
+ </body>
+</html>
Property changes on: trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/lock-input.jsp
___________________________________________________________________
Added: svn:eol-style
+ native
Added: svn:keywords
+ Author Date Id Revision HeadURL
Modified: trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/decorators/layout.jsp
===================================================================
--- trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/decorators/layout.jsp 2014-06-12 20:00:25 UTC (rev 205)
+++ trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/decorators/layout.jsp 2014-06-15 10:41:28 UTC (rev 206)
@@ -63,6 +63,8 @@
<span class="fa fa-cog"></span> Configuration</a></li>
<li><a href="<s:url action='import-input' namespace="/admin" />">
<span class="fa fa-upload"></span> Import</a></li>
+ <li><a href="<s:url action='lock-input' namespace="/admin" />">
+ <span class="fa fa-unlock-alt"></span> Vérrouillages</a></li>
</s:if>
<li><a href="<s:url action='user-folder-input' namespace="/admin" />">
Modified: trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/wro.xml
===================================================================
--- trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/wro.xml 2014-06-12 20:00:25 UTC (rev 205)
+++ trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/wro.xml 2014-06-15 10:41:28 UTC (rev 206)
@@ -94,4 +94,8 @@
<js>/js/user-folder.js</js>
<css>/css/faxtomail.css</css>
</group>
+
+ <group name='faxtomail-lock'>
+ <css>/css/faxtomail.css</css>
+ </group>
</groups>
\ No newline at end of file
1
0
r205 - in trunk: faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande
by kmorin@users.forge.codelutin.com 12 Jun '14
by kmorin@users.forge.codelutin.com 12 Jun '14
12 Jun '14
Author: kmorin
Date: 2014-06-12 22:00:25 +0200 (Thu, 12 Jun 2014)
New Revision: 205
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/205
Log:
- etat des boutons en fonction de la validit?\195?\169 et de l'etat d'attente
- ajout du trigramme ?\195?\160 l'utilisateur
Modified:
trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/LdapService.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandesUI.css
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandesUIHandler.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandesUIModel.java
Modified: trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/LdapService.java
===================================================================
--- trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/LdapService.java 2014-06-12 17:00:35 UTC (rev 204)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/LdapService.java 2014-06-12 20:00:25 UTC (rev 205)
@@ -298,6 +298,9 @@
user.setLastName(fullName);
}
+ String trigraph = searchEntry.getAttributeValue("sAMAccountName");
+ user.setTrigraph(StringUtils.upperCase(trigraph));
+
// manage user groups
user.clearUserGroups();
String[] groups = searchEntry.getAttributeValues("memberOf");
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandesUI.css
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandesUI.css 2014-06-12 17:00:35 UTC (rev 204)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandesUI.css 2014-06-12 20:00:25 UTC (rev 205)
@@ -48,21 +48,22 @@
#printButton {
text: "faxtomail.demande.print.button.label";
actionIcon: print;
+ enabled: { model.isPrintEnabled() };
}
#archiveButton {
text: "faxtomail.demande.archive.button.label";
- enabled: { model.getCurrentDemand().isEditable() };
+ enabled: { model.isArchiveEnabled() };
}
#replyButton {
text: "faxtomail.demande.reply.button.label";
actionIcon: reply;
- enabled: { model.getCurrentDemand().isEditable() || model.getCurrentDemand().getArchiveDate() != null };
+ enabled: { model.isReplyEnabled() };
}
#groupButton {
text: "faxtomail.demande.group.button.label";
actionIcon: group;
- enabled: { model.getCurrentDemand().isEditable() || model.getCurrentDemand().getArchiveDate() != null };
+ enabled: { model.isGroupEnabled() };
}
\ No newline at end of file
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandesUIHandler.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandesUIHandler.java 2014-06-12 17:00:35 UTC (rev 204)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandesUIHandler.java 2014-06-12 20:00:25 UTC (rev 205)
@@ -24,6 +24,8 @@
* #L%
*/
+import com.franciaflex.faxtomail.FaxToMailConfiguration;
+import com.franciaflex.faxtomail.persistence.entities.Configuration;
import com.franciaflex.faxtomail.persistence.entities.DemandType;
import com.franciaflex.faxtomail.persistence.entities.Email;
import com.franciaflex.faxtomail.persistence.entities.EtatAttente;
@@ -79,7 +81,6 @@
currentEmail.setCloseable(false);
DemandesUIModel model = new DemandesUIModel();
-// model.addDemand(currentEmail);
this.ui.setContextValue(model);
}
@@ -109,15 +110,10 @@
}
if (evt.getPropertyName().equals(DemandeUIModel.PROPERTY_VALID)
+ || evt.getPropertyName().equals(DemandeUIModel.PROPERTY_EDITABLE)
|| evt.getPropertyName().equals(Email.PROPERTY_ETAT_ATTENTE)) {
- DemandeUIModel model = (DemandeUIModel) evt.getSource();
- EtatAttente etatAttente = model.getEtatAttente();
- boolean transmitEnabled = model.isEditable()
- && (etatAttente == null
- || model.isValid() && !etatAttente.containsValidFormDisabledActions(MailAction.TRANSMIT)
- || !model.isValid() && !etatAttente.containsInvalidFormDisabledActions(MailAction.TRANSMIT));
- getModel().setTransmitEnabled(transmitEnabled);
+ updateButtonEnability();
}
}
};
@@ -149,6 +145,42 @@
model.addDemand(currentEmail);
}
+ protected boolean isActionEnabled(DemandeUIModel model, MailAction action) {
+ Configuration config = getContext().getFaxToMailConfiguration();
+
+ EtatAttente etatAttente = model.getEtatAttente();
+ boolean valid = model.isValid();
+
+ boolean enabled =
+ etatAttente == null && (valid || !config.containsInvalidFormDisabledActions(action))
+ || etatAttente != null &&
+ (valid && !etatAttente.containsValidFormDisabledActions(action)
+ || !valid && !etatAttente.containsInvalidFormDisabledActions(action));
+
+ return enabled;
+ }
+
+ protected void updateButtonEnability() {
+ DemandeUIModel model = getModel().getCurrentDemand();
+ boolean editable = model.isEditable();
+ boolean archived = model.getArchiveDate() != null;
+
+ boolean transmitEnabled = editable && isActionEnabled(model, MailAction.TRANSMIT);
+ getModel().setTransmitEnabled(transmitEnabled);
+
+ boolean archiveEnabled = editable && isActionEnabled(model, MailAction.ARCHIVE);
+ getModel().setArchiveEnabled(archiveEnabled);
+
+ boolean groupEnabled = isActionEnabled(model, MailAction.GROUP);
+ getModel().setGroupEnabled(groupEnabled);
+
+ boolean printEnabled = isActionEnabled(model, MailAction.PRINT);
+ getModel().setPrintEnabled(printEnabled);
+
+ boolean replyEnabled = (editable || archived) && isActionEnabled(model, MailAction.REPLY);
+ getModel().setReplyEnabled(replyEnabled);
+ }
+
@Override
public boolean quitUI() {
closeButtonPopups();
@@ -199,8 +231,8 @@
if (index >= 0 && index < tabPanel.getTabCount()) {
Component tab = tabPanel.getComponentAt(index);
if (ApplicationUI.class.isInstance(tab)) {
- ApplicationUI tuttiTab = (ApplicationUI) tabPanel.getComponentAt(index);
- AbstractApplicationUIHandler handler = tuttiTab.getHandler();
+ ApplicationUI faxToMailTab = (ApplicationUI) tabPanel.getComponentAt(index);
+ AbstractApplicationUIHandler handler = faxToMailTab.getHandler();
if (TabHandler.class.isInstance(handler)) {
tabHandler = (TabHandler) handler;
}
@@ -251,6 +283,7 @@
if (mustChangeTab) {
super.setSelectedIndex(index);
}
+ updateButtonEnability();
}
});
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandesUIModel.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandesUIModel.java 2014-06-12 17:00:35 UTC (rev 204)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandesUIModel.java 2014-06-12 20:00:25 UTC (rev 205)
@@ -44,8 +44,16 @@
public static final String PROPERTY_CURRENT_DEMAND = "currentDemand";
public static final String PROPERTY_TRANSMIT_ENABLED = "transmitEnabled";
+ public static final String PROPERTY_ARCHIVE_ENABLED = "archiveEnabled";
+ public static final String PROPERTY_GROUP_ENABLED = "groupEnabled";
+ public static final String PROPERTY_PRINT_ENABLED = "printEnabled";
+ public static final String PROPERTY_REPLY_ENABLED = "replyEnabled";
protected boolean transmitEnabled;
+ protected boolean archiveEnabled;
+ protected boolean groupEnabled;
+ protected boolean printEnabled;
+ protected boolean replyEnabled;
protected List<DemandeUIModel> demands = new ArrayList<DemandeUIModel>();
@@ -60,9 +68,49 @@
public void setTransmitEnabled(boolean transmitEnabled) {
Object oldValue = isTransmitEnabled();
this.transmitEnabled = transmitEnabled;
- firePropertyChange(PROPERTY_TRANSMIT_ENABLED,oldValue, transmitEnabled);
+ firePropertyChange(PROPERTY_TRANSMIT_ENABLED, oldValue, transmitEnabled);
}
+ public boolean isArchiveEnabled() {
+ return archiveEnabled;
+ }
+
+ public void setArchiveEnabled(boolean archiveEnabled) {
+ Object oldValue = isArchiveEnabled();
+ this.archiveEnabled = archiveEnabled;
+ firePropertyChange(PROPERTY_ARCHIVE_ENABLED, oldValue, archiveEnabled);
+ }
+
+ public boolean isGroupEnabled() {
+ return groupEnabled;
+ }
+
+ public void setGroupEnabled(boolean groupEnabled) {
+ Object oldValue = isGroupEnabled();
+ this.groupEnabled = groupEnabled;
+ firePropertyChange(PROPERTY_GROUP_ENABLED, oldValue, groupEnabled);
+ }
+
+ public boolean isPrintEnabled() {
+ return printEnabled;
+ }
+
+ public void setPrintEnabled(boolean printEnabled) {
+ Object oldValue = isPrintEnabled();
+ this.printEnabled = printEnabled;
+ firePropertyChange(PROPERTY_PRINT_ENABLED, oldValue, printEnabled);
+ }
+
+ public boolean isReplyEnabled() {
+ return replyEnabled;
+ }
+
+ public void setReplyEnabled(boolean replyEnabled) {
+ Object oldValue = isReplyEnabled();
+ this.replyEnabled = replyEnabled;
+ firePropertyChange(PROPERTY_REPLY_ENABLED, oldValue, replyEnabled);
+ }
+
protected List<DemandeUIModel> getDemands() {
return demands;
}
1
0
r204 - in trunk: faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin faxtomail-ui-web/src/main/webapp/js
by echatellier@users.forge.codelutin.com 12 Jun '14
by echatellier@users.forge.codelutin.com 12 Jun '14
12 Jun '14
Author: echatellier
Date: 2014-06-12 19:00:35 +0200 (Thu, 12 Jun 2014)
New Revision: 204
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/204
Log:
Ajout d'un check pour les droits d'?\195?\169criture sur le dossier EDI
Added:
trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ConfigurationJsonAction.java
Modified:
trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ConfigurationService.java
trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp
trunk/faxtomail-ui-web/src/main/webapp/js/configuration.js
Modified: trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ConfigurationService.java
===================================================================
--- trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ConfigurationService.java 2014-06-12 16:30:47 UTC (rev 203)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ConfigurationService.java 2014-06-12 17:00:35 UTC (rev 204)
@@ -24,6 +24,7 @@
* #L%
*/
+import java.io.File;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
@@ -275,4 +276,22 @@
return result;
}
+
+ /**
+ * Return file information on file path.
+ *
+ * @param path path
+ * @return file info
+ */
+ public Object checkDirectory(String path) {
+ Map<String, Object> result = new HashMap<>();
+ File file = new File(path);
+ result.put("path", path);
+ result.put("exist", file.exists());
+ result.put("isDirectory", file.isDirectory());
+ result.put("canRead", file.canRead());
+ result.put("canWrite", file.canWrite());
+ result.put("canExecute", file.canExecute());
+ return result;
+ }
}
Added: trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ConfigurationJsonAction.java
===================================================================
--- trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ConfigurationJsonAction.java (rev 0)
+++ trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ConfigurationJsonAction.java 2014-06-12 17:00:35 UTC (rev 204)
@@ -0,0 +1,80 @@
+package com.franciaflex.faxtomail.web.action.admin;
+
+/*
+ * #%L
+ * FaxToMail :: Web
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2014 Franciaflex, Code Lutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.struts2.convention.annotation.Action;
+
+import com.franciaflex.faxtomail.persistence.entities.EmailAccount;
+import com.franciaflex.faxtomail.persistence.entities.EmailAccountImpl;
+import com.franciaflex.faxtomail.services.service.ConfigurationService;
+import com.franciaflex.faxtomail.web.FaxToMailJsonAction;
+
+public class ConfigurationJsonAction extends FaxToMailJsonAction {
+
+ protected ConfigurationService configurationService;
+
+ /** Directory path to check existence and writability. */
+ protected String path;
+
+ protected EmailAccount emailAccount;
+
+ protected Object jsonData;
+
+ public void setConfigurationService(ConfigurationService configurationService) {
+ this.configurationService = configurationService;
+ }
+
+ public void setPath(String path) {
+ this.path = path;
+ }
+
+ public EmailAccount getEmailAccount() {
+ if (emailAccount == null) {
+ emailAccount = new EmailAccountImpl();
+ }
+ return emailAccount;
+ }
+
+ @Action("configuration-check-directory-json")
+ public String checkDirectory() {
+ jsonData = configurationService.checkDirectory(path);
+ return SUCCESS;
+ }
+
+ @Action("configuration-check-mail-json")
+ public String checkMail() {
+
+ return SUCCESS;
+ }
+
+ @Override
+ public Object getJsonData() {
+ return jsonData;
+ }
+
+}
Property changes on: trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ConfigurationJsonAction.java
___________________________________________________________________
Added: svn:eol-style
+ native
Added: svn:keywords
+ Author Date Id Revision HeadURL
Modified: trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp
===================================================================
--- trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp 2014-06-12 16:30:47 UTC (rev 203)
+++ trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp 2014-06-12 17:00:35 UTC (rev 204)
@@ -51,7 +51,9 @@
'emailAccounts': <s:property value="toJson(emailAccounts)" escapeHtml="false"/>,
// referentiels
'users': <s:property value="toJson(users)" escapeHtml="false"/>,
- 'groups': <s:property value="toJson(groups)" escapeHtml="false"/>
+ 'groups': <s:property value="toJson(groups)" escapeHtml="false"/>,
+ // remote service urls
+ 'remoteCheckFolder': "<s:url action="configuration-check-directory-json" />"
});
</script>
</head>
@@ -354,8 +356,7 @@
Définir le dossier de dépôt des demandes EDI sur le serveur :</label>
<div class="input-group" ng-if="selectedMailFolder.useCurrentLevelEdiFolder || !selectedMailFolder.$parent">
<input type="text" class="form-control" ng-model="selectedMailFolder.ediFolder">
- <span class="input-group-addon btn btn-info" ng-disabled="!selectedMailFolder.ediFolder"
- tooltip="Fonctionnalité à venir">
+ <span class="input-group-addon btn btn-info" ng-disabled="!selectedMailFolder.ediFolder" ng-click="checkRemotePath()">
<i class="fa fa-cogs"></i> Test
</span>
</div>
Modified: trunk/faxtomail-ui-web/src/main/webapp/js/configuration.js
===================================================================
--- trunk/faxtomail-ui-web/src/main/webapp/js/configuration.js 2014-06-12 16:30:47 UTC (rev 203)
+++ trunk/faxtomail-ui-web/src/main/webapp/js/configuration.js 2014-06-12 17:00:35 UTC (rev 204)
@@ -252,8 +252,8 @@
/**
* Mail folder tab controller.
*/
-ConfigurationModule.controller('ConfigurationTreeController', ['$scope', '$window', 'ConfigurationData',
- function($scope, $window, ConfigurationData) {
+ConfigurationModule.controller('ConfigurationTreeController', ['$scope', '$window', '$http', 'ConfigurationData',
+ function($scope, $window, $http, ConfigurationData) {
// {Object} selected mail folder
$scope.selectedMailFolder;
// {String} add new customer responsible form value
@@ -547,6 +547,22 @@
}
};
+ $scope.checkRemotePath = function() {
+ $http.get(ConfigurationData.remoteCheckFolder +
+ "?path=" + encodeURIComponent($scope.selectedMailFolder.ediFolder), {cache:true})
+ .success(function(data, status, headers, config) {
+ if (data.isDirectory) {
+ if (data.canWrite) {
+ $window.alert("Le dossier existe et dispose des droits d'écriture.");
+ } else {
+ $window.alert("Le dossier existe, mais ne dispose pas des droits d'écriture !");
+ }
+ } else {
+ $window.alert("Le dossier n'existe pas !");
+ }
+ });
+ };
+
// utilisé pour mettre à jour $scope.selectedMailFolder.folderTableColumns si $scope.folderTableColumns change
$scope.$watch("folderTableColumns", function(newValue, oldValue) {
if (newValue != oldValue) {
1
0
r203 - in trunk/faxtomail-ui-web/src/main: java/com/franciaflex/faxtomail/web resources webapp/WEB-INF
by echatellier@users.forge.codelutin.com 12 Jun '14
by echatellier@users.forge.codelutin.com 12 Jun '14
12 Jun '14
Author: echatellier
Date: 2014-06-12 18:30:47 +0200 (Thu, 12 Jun 2014)
New Revision: 203
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/203
Log:
Ajout du support des actions de type json
Added:
trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/FaxToMailJsonAction.java
trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/FaxToMailJsonResultSupport.java
Modified:
trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/FaxToMailActionSupport.java
trunk/faxtomail-ui-web/src/main/resources/struts.xml
trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/decorators.xml
Modified: trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/FaxToMailActionSupport.java
===================================================================
--- trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/FaxToMailActionSupport.java 2014-06-12 16:12:04 UTC (rev 202)
+++ trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/FaxToMailActionSupport.java 2014-06-12 16:30:47 UTC (rev 203)
@@ -63,7 +63,7 @@
protected FaxToMailSession session;
- protected Gson gson;
+ protected static Gson gson;
public void setApplicationConfig(FaxToMailConfiguration applicationConfig) {
this.applicationConfig = applicationConfig;
@@ -103,7 +103,7 @@
return result;
}
- public Gson getGson() {
+ public static Gson getGson() {
if (gson == null) {
GsonBuilder builder = new GsonBuilder();
Added: trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/FaxToMailJsonAction.java
===================================================================
--- trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/FaxToMailJsonAction.java (rev 0)
+++ trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/FaxToMailJsonAction.java 2014-06-12 16:30:47 UTC (rev 203)
@@ -0,0 +1,49 @@
+package com.franciaflex.faxtomail.web;
+
+/*
+ * #%L
+ * FaxToMail :: Web
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2014 Franciaflex, Code Lutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import org.apache.struts2.convention.annotation.Result;
+import org.apache.struts2.convention.annotation.Results;
+
+
+/**
+ * Abstract action used to render custom objects as json string using gson directly in response output stream.
+ *
+ * @author Eric Chatellier
+ */
+@Results({
+ @Result(type = "faxtomail-json", name = "success")
+})
+public abstract class FaxToMailJsonAction extends FaxToMailActionSupport {
+
+ /**
+ * Method to override to get object data to render as json. Method HAS to be public because result support will use
+ * this method.
+ *
+ * @return object to render as json
+ */
+ public abstract Object getJsonData();
+
+}
Property changes on: trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/FaxToMailJsonAction.java
___________________________________________________________________
Added: svn:eol-style
+ native
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/FaxToMailJsonResultSupport.java
===================================================================
--- trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/FaxToMailJsonResultSupport.java (rev 0)
+++ trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/FaxToMailJsonResultSupport.java 2014-06-12 16:30:47 UTC (rev 203)
@@ -0,0 +1,74 @@
+package com.franciaflex.faxtomail.web;
+
+/*
+ * #%L
+ * FaxToMail :: Web
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2014 Franciaflex, Code Lutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import java.io.IOException;
+
+import javax.servlet.ServletOutputStream;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.struts2.dispatcher.StrutsResultSupport;
+
+import com.google.common.base.Charsets;
+import com.opensymphony.xwork2.ActionInvocation;
+
+public class FaxToMailJsonResultSupport extends StrutsResultSupport {
+
+ private static final Log log = LogFactory.getLog(FaxToMailJsonResultSupport.class);
+
+ @Override
+ protected void doExecute(String finalLocation, ActionInvocation invocation) throws Exception {
+ Object jsonData = invocation.getStack().findValue("jsonData");
+
+ String json = FaxToMailActionSupport.getGson().toJson(jsonData);
+
+ // Work-arround for IE to not display download dialog for json result
+ // see https://github.com/blueimp/jQuery-File-Upload/issues/1795
+ HttpServletRequest servletRequest = (HttpServletRequest) invocation.getInvocationContext().get(HTTP_REQUEST);
+ HttpServletResponse servletResponse = (HttpServletResponse) invocation.getInvocationContext().get(HTTP_RESPONSE);
+ servletResponse.setCharacterEncoding(Charsets.UTF_8.name());
+ if (servletRequest.getHeader("accept").indexOf("application/json") != -1) {
+ servletResponse.setContentType("application/json");
+ } else {
+ // IE workaround
+ servletResponse.setContentType("text/plain");
+ }
+
+ try {
+ ServletOutputStream outputStream = servletResponse.getOutputStream();
+ byte[] jsonBytes = json.getBytes(Charsets.UTF_8); // On transforme en bytes pour assurer l'encodage
+ outputStream.write(jsonBytes);
+ } catch (IOException e) {
+ if (log.isErrorEnabled()) {
+ log.error("Unable to write JSON output into Servlet Response");
+ }
+ }
+
+ }
+
+}
Property changes on: trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/FaxToMailJsonResultSupport.java
___________________________________________________________________
Added: svn:eol-style
+ native
Added: svn:keywords
+ Author Date Id Revision HeadURL
Modified: trunk/faxtomail-ui-web/src/main/resources/struts.xml
===================================================================
--- trunk/faxtomail-ui-web/src/main/resources/struts.xml 2014-06-12 16:12:04 UTC (rev 202)
+++ trunk/faxtomail-ui-web/src/main/resources/struts.xml 2014-06-12 16:30:47 UTC (rev 203)
@@ -35,6 +35,11 @@
<package name="faxtomail" namespace="/" extends="struts-default">
+ <result-types>
+ <result-type name="faxtomail-json" default="false"
+ class="com.franciaflex.faxtomail.web.FaxToMailJsonResultSupport" />
+ </result-types>
+
<interceptors>
<interceptor name="faxToMailInterceptor" class="com.franciaflex.faxtomail.web.FaxToMailInterceptor"/>
<interceptor name="loginInterceptor" class="com.franciaflex.faxtomail.web.FaxToMailLoginInterceptor" />
Modified: trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/decorators.xml
===================================================================
--- trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/decorators.xml 2014-06-12 16:12:04 UTC (rev 202)
+++ trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/decorators.xml 2014-06-12 16:30:47 UTC (rev 203)
@@ -1,10 +1,10 @@
<!--
#%L
- Extranet ENC-AHI :: Web
+ FaxToMail :: Web
$Id$
$HeadURL$
%%
- Copyright (C) 2013 Ministère des Affaires sociales et de la Santé
+ Copyright (C) 2014 Franciaflex, Code Lutin
%%
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as
@@ -24,13 +24,10 @@
<decorators defaultdir="/WEB-INF/decorators">
<excludes>
<pattern>/css/*</pattern>
- <pattern>/img/*</pattern>
+ <pattern>/js/*</pattern>
+ <pattern>*-json*</pattern>
</excludes>
- <!--<decorator name="layout-login" page="layout-login.jsp">-->
- <!--<pattern>/authentication/login*</pattern>-->
- <!--</decorator>-->
-
<decorator name="layout" page="layout.jsp">
<pattern>/*</pattern>
</decorator>
1
0
r202 - in trunk: . faxtomail-ui-web faxtomail-ui-web/src/main/webapp/WEB-INF faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin faxtomail-ui-web/src/main/webapp/css faxtomail-ui-web/src/main/webapp/js
by echatellier@users.forge.codelutin.com 12 Jun '14
by echatellier@users.forge.codelutin.com 12 Jun '14
12 Jun '14
Author: echatellier
Date: 2014-06-12 18:12:04 +0200 (Thu, 12 Jun 2014)
New Revision: 202
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/202
Log:
Test chosen pour le filtrage (mais fonctionne pas :()
Added:
trunk/faxtomail-ui-web/src/main/webapp/css/chosen-spinner.css
trunk/faxtomail-ui-web/src/main/webapp/css/spinner.gif
trunk/faxtomail-ui-web/src/main/webapp/js/chosen.js
Modified:
trunk/faxtomail-ui-web/pom.xml
trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp
trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/wro.xml
trunk/faxtomail-ui-web/src/main/webapp/css/faxtomail.css
trunk/faxtomail-ui-web/src/main/webapp/js/configuration.js
trunk/faxtomail-ui-web/src/main/webapp/js/user-folder.js
trunk/pom.xml
Modified: trunk/faxtomail-ui-web/pom.xml
===================================================================
--- trunk/faxtomail-ui-web/pom.xml 2014-06-12 15:23:11 UTC (rev 201)
+++ trunk/faxtomail-ui-web/pom.xml 2014-06-12 16:12:04 UTC (rev 202)
@@ -235,6 +235,11 @@
</exclusion>
</exclusions>
</dependency>
+
+ <dependency>
+ <groupId>org.webjars</groupId>
+ <artifactId>chosen</artifactId>
+ </dependency>
<dependency>
<groupId>org.nuiton.js</groupId>
Modified: trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp
===================================================================
--- trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp 2014-06-12 15:23:11 UTC (rev 201)
+++ trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp 2014-06-12 16:12:04 UTC (rev 202)
@@ -961,7 +961,7 @@
<div class="form-group">
<label for="newManagedGroupField" class="control-label">Nouveau groupe :</label>
<select id="newManagedGroupField" class="form-control"
- ng-model="newManagedGroup" ng-options="group as group.fullPath for group in groups">
+ ng-model="newManagedGroup" ng-options="group as group.fullPath for group in groups" width="'100%'" searchContains="true">
</select>
<a class="btn btn-success btn-xs" ng-click="addManagedGroup()" ng-disabled="!newManagedGroup">
<span class="glyphicon glyphicon-plus"></span>
Modified: trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/wro.xml
===================================================================
--- trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/wro.xml 2014-06-12 15:23:11 UTC (rev 201)
+++ trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/wro.xml 2014-06-12 16:12:04 UTC (rev 202)
@@ -28,6 +28,11 @@
<js>classpath:META-INF/resources/webjars/select2/3.4.8/select2.js</js>
<js>classpath:META-INF/resources/webjars/select2/3.4.8/select2_locale_fr.js</js>
</group>
+
+ <group name='webjar-chosen' abstract="true">
+ <css>classpath:META-INF/resources/webjars/chosen/1.1.0/chosen.css</css>
+ <js>classpath:META-INF/resources/webjars/chosen/1.1.0/chosen.jquery.js</js>
+ </group>
<group name='webjar-angular-ui-sortable' abstract="true">
<js>classpath:META-INF/resources/webjars/angular-ui-sortable/0.12.7/sortable.min.js</js>
@@ -45,6 +50,12 @@
<js>/js/select2sortable.js</js>
</group>
+ <group name='angular-chosen' abstract="true">
+ <group-ref>webjar-chosen</group-ref>
+ <js>/js/chosen.js</js>
+ <css>/css/chosen-spinner.css</css>
+ </group>
+
<group name='webjar-respond' abstract="true">
<js>classpath:META-INF/resources/webjars/respond/1.4.2/src/respond.js</js>
</group>
@@ -69,6 +80,7 @@
<group name='faxtomail-configuration'>
<group-ref>select2sortable</group-ref>
+ <group-ref>angular-chosen</group-ref>
<group-ref>webjar-angular-ui-sortable</group-ref>
<group-ref>font-awesome</group-ref>
<js>/js/configuration.js</js>
@@ -77,6 +89,7 @@
<group name='faxtomail-user-folder'>
<group-ref>select2sortable</group-ref>
+ <group-ref>angular-chosen</group-ref>
<group-ref>font-awesome</group-ref>
<js>/js/user-folder.js</js>
<css>/css/faxtomail.css</css>
Added: trunk/faxtomail-ui-web/src/main/webapp/css/chosen-spinner.css
===================================================================
--- trunk/faxtomail-ui-web/src/main/webapp/css/chosen-spinner.css (rev 0)
+++ trunk/faxtomail-ui-web/src/main/webapp/css/chosen-spinner.css 2014-06-12 16:12:04 UTC (rev 202)
@@ -0,0 +1,12 @@
+/* %%Ignore-License Additional styles to display a spinner image while options are loading */
+.localytics-chosen.loading+.chosen-container-multi .chosen-choices {
+ background-image: url('spinner.gif');
+ background-repeat: no-repeat;
+ background-position: 95%;
+}
+.localytics-chosen.loading+.chosen-container-single .chosen-single span {
+ background: url('spinner.gif') no-repeat right;
+}
+.localytics-chosen.loading+.chosen-container-single .chosen-single .search-choice-close {
+ display: none;
+}
\ No newline at end of file
Property changes on: trunk/faxtomail-ui-web/src/main/webapp/css/chosen-spinner.css
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: trunk/faxtomail-ui-web/src/main/webapp/css/faxtomail.css
===================================================================
--- trunk/faxtomail-ui-web/src/main/webapp/css/faxtomail.css 2014-06-12 15:23:11 UTC (rev 201)
+++ trunk/faxtomail-ui-web/src/main/webapp/css/faxtomail.css 2014-06-12 16:12:04 UTC (rev 202)
@@ -76,3 +76,7 @@
content:"*";
color:red;
}
+
+/*.chosen-container {
+ width:100%;
+}*/
\ No newline at end of file
Added: trunk/faxtomail-ui-web/src/main/webapp/css/spinner.gif
===================================================================
(Binary files differ)
Property changes on: trunk/faxtomail-ui-web/src/main/webapp/css/spinner.gif
___________________________________________________________________
Added: svn:mime-type
+ image/gif
Added: trunk/faxtomail-ui-web/src/main/webapp/js/chosen.js
===================================================================
--- trunk/faxtomail-ui-web/src/main/webapp/js/chosen.js (rev 0)
+++ trunk/faxtomail-ui-web/src/main/webapp/js/chosen.js 2014-06-12 16:12:04 UTC (rev 202)
@@ -0,0 +1,109 @@
+// %%Ignore-License Generated by CoffeeScript 1.6.2
+(function() {
+ var __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
+
+ angular.module('localytics.directives', []);
+
+ angular.module('localytics.directives').directive('chosen', function() {
+ var CHOSEN_OPTION_WHITELIST, NG_OPTIONS_REGEXP, isEmpty, snakeCase;
+
+ NG_OPTIONS_REGEXP = /^\s*(.*?)(?:\s+as\s+(.*?))?(?:\s+group\s+by\s+(.*))?\s+for\s+(?:([\$\w][\$\w]*)|(?:\(\s*([\$\w][\$\w]*)\s*,\s*([\$\w][\$\w]*)\s*\)))\s+in\s+(.*?)(?:\s+track\s+by\s+(.*?))?$/;
+ CHOSEN_OPTION_WHITELIST = ['noResultsText', 'allowSingleDeselect', 'disableSearchThreshold', 'disableSearch', 'enableSplitWordSearch', 'inheritSelectClasses', 'maxSelectedOptions', 'placeholderTextMultiple', 'placeholderTextSingle', 'searchContains', 'singleBackstrokeDelete', 'displayDisabledOptions', 'displaySelectedOptions', 'width'];
+ snakeCase = function(input) {
+ return input.replace(/[A-Z]/g, function($1) {
+ return "_" + ($1.toLowerCase());
+ });
+ };
+ isEmpty = function(value) {
+ var key;
+
+ if (angular.isArray(value)) {
+ return value.length === 0;
+ } else if (angular.isObject(value)) {
+ for (key in value) {
+ if (value.hasOwnProperty(key)) {
+ return false;
+ }
+ }
+ }
+ return true;
+ };
+ return {
+ restrict: 'A',
+ require: '?ngModel',
+ terminal: true,
+ link: function(scope, element, attr, ngModel) {
+ var chosen, defaultText, disableWithMessage, empty, initOrUpdate, match, options, origRender, removeEmptyMessage, startLoading, stopLoading, valuesExpr, viewWatch;
+
+ element.addClass('localytics-chosen');
+ options = scope.$eval(attr.chosen) || {};
+ angular.forEach(attr, function(value, key) {
+ if (__indexOf.call(CHOSEN_OPTION_WHITELIST, key) >= 0) {
+ return options[snakeCase(key)] = scope.$eval(value);
+ }
+ });
+ startLoading = function() {
+ return element.addClass('loading').attr('disabled', true).trigger('chosen:updated');
+ };
+ stopLoading = function() {
+ return element.removeClass('loading').attr('disabled', false).trigger('chosen:updated');
+ };
+ chosen = null;
+ defaultText = null;
+ empty = false;
+ initOrUpdate = function() {
+ if (chosen) {
+ return element.trigger('chosen:updated');
+ } else {
+ chosen = element.chosen(options).data('chosen');
+ return defaultText = chosen.default_text;
+ }
+ };
+ removeEmptyMessage = function() {
+ empty = false;
+ return element.attr('data-placeholder', defaultText);
+ };
+ disableWithMessage = function() {
+ empty = true;
+ return element.attr('data-placeholder', chosen.results_none_found).attr('disabled', true).trigger('chosen:updated');
+ };
+ if (ngModel) {
+ origRender = ngModel.$render;
+ ngModel.$render = function() {
+ origRender();
+ return initOrUpdate();
+ };
+ if (attr.multiple) {
+ viewWatch = function() {
+ return ngModel.$viewValue;
+ };
+ scope.$watch(viewWatch, ngModel.$render, true);
+ }
+ } else {
+ initOrUpdate();
+ }
+ attr.$observe('disabled', function() {
+ return element.trigger('chosen:updated');
+ });
+ if (attr.ngOptions && ngModel) {
+ match = attr.ngOptions.match(NG_OPTIONS_REGEXP);
+ valuesExpr = match[7];
+ return scope.$watchCollection(valuesExpr, function(newVal, oldVal) {
+ if (angular.isUndefined(newVal)) {
+ return startLoading();
+ } else {
+ if (empty) {
+ removeEmptyMessage();
+ }
+ stopLoading();
+ if (isEmpty(newVal)) {
+ return disableWithMessage();
+ }
+ }
+ });
+ }
+ }
+ };
+ });
+
+}).call(this);
Modified: trunk/faxtomail-ui-web/src/main/webapp/js/configuration.js
===================================================================
--- trunk/faxtomail-ui-web/src/main/webapp/js/configuration.js 2014-06-12 15:23:11 UTC (rev 201)
+++ trunk/faxtomail-ui-web/src/main/webapp/js/configuration.js 2014-06-12 16:12:04 UTC (rev 202)
@@ -22,7 +22,7 @@
* #L%
*/
-var ConfigurationModule = angular.module('ConfigurationModule', ['FaxToMail', 'ui.tree', 'ui.sortable', 'ui.select2.sortable']);
+var ConfigurationModule = angular.module('ConfigurationModule', ['FaxToMail', 'ui.tree', 'localytics.directives', 'ui.select2.sortable']);
/**
* Global configuration controller.
@@ -832,7 +832,6 @@
console.log("Udpate MetaFilter");
$scope.rootFolderMailFilters = {};
updateMetaFilter();
- console.log($scope.rootFolderMailFilters);
});
// option de la configuration 'sortable'
Modified: trunk/faxtomail-ui-web/src/main/webapp/js/user-folder.js
===================================================================
--- trunk/faxtomail-ui-web/src/main/webapp/js/user-folder.js 2014-06-12 15:23:11 UTC (rev 201)
+++ trunk/faxtomail-ui-web/src/main/webapp/js/user-folder.js 2014-06-12 16:12:04 UTC (rev 202)
@@ -22,7 +22,7 @@
* #L%
*/
-var UserFolderModule = angular.module('UserFolderModule', ['FaxToMail', 'ui.select2.sortable']);
+var UserFolderModule = angular.module('UserFolderModule', ['FaxToMail', 'localytics.directives', 'ui.select2.sortable']);
/**
* Global configuration controller.
@@ -39,7 +39,7 @@
$scope.userFolders = UserFolderData.userFolders;
//{Array} Group list
$scope.groups = UserFolderData.groups;
-
+
// method privée recursive pour retourner l'ensemble des dossiers en les modifiant pour ajouter
// des metadata (full path from root, and root node instance)
var recursiveAddMailFolder = function(result, mailFolders, rootFolder, prefix, parent) {
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2014-06-12 15:23:11 UTC (rev 201)
+++ trunk/pom.xml 2014-06-12 16:12:04 UTC (rev 202)
@@ -576,6 +576,13 @@
<version>3.4.8-1</version>
<scope>runtime</scope>
</dependency>
+
+ <dependency>
+ <groupId>org.webjars</groupId>
+ <artifactId>chosen</artifactId>
+ <version>1.1.0</version>
+ <scope>runtime</scope>
+ </dependency>
<dependency>
<groupId>org.nuiton.js</groupId>
1
0