r130 - 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-service/src/main/java/com/franciaflex/faxtomail/services/service/imports faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web faxt
Author: echatellier Date: 2014-06-04 16:43:27 +0200 (Wed, 04 Jun 2014) New Revision: 130 Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/130 Log: Mise ?\195?\160 jour topia/eugene. ref #4662: Rectaring etatAttente, action, type de document, champs obligatoires Added: trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/EmailProtocol.java trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/FolderAction.java Modified: trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/MailAction.java trunk/faxtomail-persistence/src/main/xmi/faxtomail.properties trunk/faxtomail-persistence/src/main/xmi/faxtomail.zargo trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ConfigurationService.java trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ReferentielService.java trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/imports/EmailAccountImportModel.java trunk/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/AbstractFaxToMailServiceTest.java trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/FaxToMailApplicationContext.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/FaxToMailInterceptor.java trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ConfigurationAction.java trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/job/MailFilterJob.java trunk/faxtomail-ui-web/src/main/resources/i18n/faxtomail-ui-web_fr_FR.properties trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp trunk/faxtomail-ui-web/src/main/webapp/css/faxtomail.css trunk/faxtomail-ui-web/src/main/webapp/js/configuration.js trunk/pom.xml Added: trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/EmailProtocol.java =================================================================== --- trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/EmailProtocol.java (rev 0) +++ trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/EmailProtocol.java 2014-06-04 14:43:27 UTC (rev 130) @@ -0,0 +1,44 @@ +package com.franciaflex.faxtomail.persistence.entities; + +/* + * #%L + * FaxToMail :: Persistence + * $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% + */ + +public enum EmailProtocol { + + POP3(110), + POP3S(995), + IMAP(143), + IMAPS(993); + + private int port; + + private EmailProtocol(int port) { + this.port = port; + } + + public int getDefaultPort() { + return port; + } + +} Property changes on: trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/EmailProtocol.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/FolderAction.java =================================================================== --- trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/FolderAction.java (rev 0) +++ trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/FolderAction.java 2014-06-04 14:43:27 UTC (rev 130) @@ -0,0 +1,35 @@ +package com.franciaflex.faxtomail.persistence.entities; + +/* + * #%L + * FaxToMail :: Persistence + * $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% + */ + +/** + * @author Kevin Morin (Code Lutin) + * @since x.x + */ +public enum FolderAction { + + COMPUTE_RANGE, + NEW_DEMANDE +} Property changes on: trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/FolderAction.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Modified: trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/MailAction.java =================================================================== --- trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/MailAction.java 2014-06-04 08:08:56 UTC (rev 129) +++ trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/MailAction.java 2014-06-04 14:43:27 UTC (rev 130) @@ -30,20 +30,10 @@ */ public enum MailAction { - SAVE(false), - TRANSMIT(false), - PRINT(true), - ARCHIVE(true), - REPLY(true), - GROUP(false); - - protected boolean contextuable; - - private MailAction(boolean contextuable) { - this.contextuable = contextuable; - } - - public boolean isContextuable() { - return contextuable; - } + SAVE, + TRANSMIT, + PRINT, + ARCHIVE, + REPLY, + GROUP } Modified: trunk/faxtomail-persistence/src/main/xmi/faxtomail.properties =================================================================== --- trunk/faxtomail-persistence/src/main/xmi/faxtomail.properties 2014-06-04 08:08:56 UTC (rev 129) +++ trunk/faxtomail-persistence/src/main/xmi/faxtomail.properties 2014-06-04 14:43:27 UTC (rev 130) @@ -48,7 +48,10 @@ com.franciaflex.faxtomail.persistence.entities.EmailAccount.attribute.host.tagvalue.naturalId=true com.franciaflex.faxtomail.persistence.entities.EmailAccount.attribute.login.tagvalue.naturalId=true +# ExtensionCommand +com.franciaflex.faxtomail.persistence.entities.ExtensionCommand.attribute.extension.tagvalue.naturalId=true + # Attachment com.franciaflex.faxtomail.persistence.entities.Attachment.attribute.originalFile.tagvalue.notNull=true Modified: trunk/faxtomail-persistence/src/main/xmi/faxtomail.zargo =================================================================== (Binary files differ) 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-04 08:08:56 UTC (rev 129) +++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ConfigurationService.java 2014-06-04 14:43:27 UTC (rev 130) @@ -77,7 +77,7 @@ /** * Save configuration. * - * @param config cufiguration to save + * @param config configuration to save */ public void saveConfiguration(Configuration config) { ConfigurationTopiaDao dao = getPersistenceContext().getConfigurationDao(); Modified: trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ReferentielService.java =================================================================== --- trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ReferentielService.java 2014-06-04 08:08:56 UTC (rev 129) +++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ReferentielService.java 2014-06-04 14:43:27 UTC (rev 130) @@ -45,6 +45,7 @@ import com.franciaflex.faxtomail.persistence.entities.Client; import com.franciaflex.faxtomail.persistence.entities.ClientTopiaDao; import com.franciaflex.faxtomail.persistence.entities.DemandType; +import com.franciaflex.faxtomail.persistence.entities.DemandTypeImpl; import com.franciaflex.faxtomail.persistence.entities.DemandTypeTopiaDao; import com.franciaflex.faxtomail.persistence.entities.EmailAccount; import com.franciaflex.faxtomail.persistence.entities.EmailAccountTopiaDao; @@ -129,6 +130,38 @@ getPersistenceContext().commit(); } + public void saveDemandTypes(List<DemandType> demandTypes) { + Binder<DemandType, DemandType> binderDemandType = BinderFactory.newBinder(DemandType.class); + DemandTypeTopiaDao demandTypeDAO = getPersistenceContext().getDemandTypeDao(); + + List<DemandType> allDemandType = getAllDemandType(); + Map<String, DemandType> allDemandTypeIndex = new HashMap<>(Maps.uniqueIndex(allDemandType, TopiaEntities.getTopiaIdFunction())); + for (DemandType demandType : demandTypes) { + // get current etat attente + DemandType currentDemandType; + if (StringUtils.isBlank(demandType.getTopiaId()) || demandType.getTopiaId().startsWith("new_")) { + currentDemandType = new DemandTypeImpl(); + } else { + currentDemandType = allDemandTypeIndex.remove(demandType.getTopiaId()); + } + + // copy + binderDemandType.copyExcluding(demandType, currentDemandType, + EtatAttente.PROPERTY_TOPIA_ID, + EtatAttente.PROPERTY_TOPIA_CREATE_DATE, + EtatAttente.PROPERTY_TOPIA_VERSION); + + // persist + if (currentDemandType.isPersisted()) { + demandTypeDAO.update(currentDemandType); + } else { + demandTypeDAO.create(currentDemandType); + } + } + + getPersistenceContext().commit(); + } + public List<Client> getAllClients() { ClientTopiaDao dao = getPersistenceContext().getClientDao(); return new ArrayList<>(dao.findAll()); Modified: trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/imports/EmailAccountImportModel.java =================================================================== --- trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/imports/EmailAccountImportModel.java 2014-06-04 08:08:56 UTC (rev 129) +++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/imports/EmailAccountImportModel.java 2014-06-04 14:43:27 UTC (rev 130) @@ -24,8 +24,13 @@ * #L% */ +import java.text.ParseException; + import com.franciaflex.faxtomail.persistence.entities.EmailAccount; import com.franciaflex.faxtomail.persistence.entities.EmailAccountImpl; +import com.franciaflex.faxtomail.persistence.entities.EmailProtocol; + +import org.nuiton.csv.ValueParser; import org.nuiton.csv.ext.AbstractImportModel; /** @@ -37,8 +42,25 @@ public EmailAccountImportModel(char separator) { super(separator); - newMandatoryColumn("protocol", EmailAccount.PROPERTY_PROTOCOL); + newMandatoryColumn("protocol", EmailAccount.PROPERTY_PROTOCOL, new ValueParser<EmailProtocol>() { + + @Override + public EmailProtocol parse(String value) throws ParseException { + EmailProtocol protocol = EmailProtocol.valueOf(value.toUpperCase()); + return protocol; + } + + }); newMandatoryColumn("host", EmailAccount.PROPERTY_HOST); + newMandatoryColumn("port", EmailAccount.PROPERTY_PORT, new ValueParser<Integer>() { + + @Override + public Integer parse(String value) throws ParseException { + Integer result = Integer.valueOf(value); + return result; + } + + }); newMandatoryColumn("user", EmailAccount.PROPERTY_LOGIN); newMandatoryColumn("password", EmailAccount.PROPERTY_PASSWORD); } Modified: trunk/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/AbstractFaxToMailServiceTest.java =================================================================== --- trunk/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/AbstractFaxToMailServiceTest.java 2014-06-04 08:08:56 UTC (rev 129) +++ trunk/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/AbstractFaxToMailServiceTest.java 2014-06-04 14:43:27 UTC (rev 130) @@ -148,13 +148,13 @@ log.trace("closing transaction " + persistenceContext); } - persistenceContext.closeContext(); + persistenceContext.close(); if (log.isTraceEnabled()) { log.trace("closing transaction " + applicationContext); } - applicationContext.closeContext(); + applicationContext.close(); File lockFile = new File(databaseRefFile, "h2data.lock.db"); @@ -226,7 +226,7 @@ log.trace("closing transaction " + openedTransaction); } - openedTransaction.closeContext(); + openedTransaction.close(); } @@ -236,7 +236,7 @@ log.trace("closing transaction " + applicationContext); } - applicationContext.closeContext(); + applicationContext.close(); } Modified: trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/FaxToMailApplicationContext.java =================================================================== --- trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/FaxToMailApplicationContext.java 2014-06-04 08:08:56 UTC (rev 129) +++ trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/FaxToMailApplicationContext.java 2014-06-04 14:43:27 UTC (rev 130) @@ -91,7 +91,7 @@ public void close() { if (topiaApplicationContext != null) { - topiaApplicationContext.closeContext(); + topiaApplicationContext.close(); } } @@ -142,7 +142,7 @@ initExtranetService.init(); - persistenceContext.closeContext(); + persistenceContext.close(); } 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-04 08:08:56 UTC (rev 129) +++ trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/FaxToMailApplicationListener.java 2014-06-04 14:43:27 UTC (rev 130) @@ -52,6 +52,8 @@ protected FaxToMailApplicationContext applicationContext; + protected Scheduler scheduler; + @Override public void contextInitialized(ServletContextEvent sce) { @@ -88,11 +90,6 @@ .withIdentity("faxToMailJobs", "ediManagementJob") .build(); - JobDetail ldapJob = JobBuilder.newJob(EDIManagementJob.class) - .usingJobData(data) - .withIdentity("faxToMailJobs", "ldapJob") - .build(); - try { // schedule mail job (toutes les 20 minutes) @@ -103,7 +100,7 @@ .build(); Scheduler scheduler = new StdSchedulerFactory().getScheduler(); - scheduler.start(); + //scheduler.start(); scheduler.scheduleJob(mailFilteringJob, trigger); // schedule EDI job (toutes les 5 heures)s @@ -113,20 +110,12 @@ .withSchedule(CronScheduleBuilder.cronSchedule("* 0/5 * * * ?")) .build(); - scheduler = new StdSchedulerFactory().getScheduler(); - scheduler.start(); + //scheduler = new StdSchedulerFactory().getScheduler(); + //scheduler.start(); scheduler.scheduleJob(ediManagementJob, trigger); - // schedule ldap job (toutes les heures à 0 minute) - trigger = TriggerBuilder - .newTrigger() - .withIdentity("ldapManagement", "ldapManagementTrigger") - .withSchedule(CronScheduleBuilder.cronSchedule("0 * * * * ?")) - .build(); - - scheduler = new StdSchedulerFactory().getScheduler(); + // start scheduler scheduler.start(); - scheduler.scheduleJob(ldapJob, trigger); log.debug("schedulers launched"); @@ -140,9 +129,23 @@ public void contextDestroyed(ServletContextEvent sce) { if (log.isInfoEnabled()) { - log.info("stop FaxToMail web ui"); + if (log.isInfoEnabled()) { + log.info("Stopping quartz sheduler"); + } } + try { + scheduler.shutdown(); + } catch (SchedulerException e) { + if (log.isWarnEnabled()) { + log.warn("Can't stop quartz", e); + } + } + + if (log.isInfoEnabled()) { + log.info("Closing web ui application context"); + } + applicationContext.close(); } Modified: trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/FaxToMailInterceptor.java =================================================================== --- trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/FaxToMailInterceptor.java 2014-06-04 08:08:56 UTC (rev 129) +++ trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/FaxToMailInterceptor.java 2014-06-04 14:43:27 UTC (rev 130) @@ -139,7 +139,7 @@ } finally { - serviceContext.getPersistenceContext().closeContext(); + serviceContext.getPersistenceContext().close(); } Modified: trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ConfigurationAction.java =================================================================== --- trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ConfigurationAction.java 2014-06-04 08:08:56 UTC (rev 129) +++ trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ConfigurationAction.java 2014-06-04 14:43:27 UTC (rev 130) @@ -33,10 +33,11 @@ import org.apache.struts2.convention.annotation.Result; import com.franciaflex.faxtomail.persistence.entities.Configuration; -import com.franciaflex.faxtomail.persistence.entities.ConfigurationImpl; +import com.franciaflex.faxtomail.persistence.entities.DemandType; import com.franciaflex.faxtomail.persistence.entities.EmailAccount; import com.franciaflex.faxtomail.persistence.entities.EtatAttente; import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser; +import com.franciaflex.faxtomail.persistence.entities.FolderAction; import com.franciaflex.faxtomail.persistence.entities.MailField; import com.franciaflex.faxtomail.persistence.entities.MailFilter; import com.franciaflex.faxtomail.persistence.entities.MailFolder; @@ -66,6 +67,8 @@ protected List<EtatAttente> etatAttentes; + protected List<DemandType> demandTypes; + protected List<MailFolder> mailFolders; protected List<MailFilter> mailFilters; @@ -76,17 +79,19 @@ @Override public void prepare() throws Exception { - configuration = configurationService.getConfiguration(); + } @Override @org.apache.struts2.convention.annotation.Action("configuration-input") public String input() throws Exception { etatAttentes = referentielService.getAllEtatAttente(); + demandTypes = referentielService.getAllDemandType(); mailFolders = mailFolderService.getRootMailFolders(); users = configurationService.getAllUsers(); emailAccounts = configurationService.getEmailAccounts(); mailFilters = configurationService.getMailFilters(); + configuration = configurationService.getConfiguration(); return INPUT; } @@ -98,6 +103,7 @@ configurationService.saveConfiguration(configuration); referentielService.saveEtatAttente(etatAttentes); + referentielService.saveDemandTypes(demandTypes); mailFolderService.saveMailFolders(mailFolders); configurationService.saveMailFilters(mailFilters); configurationService.saveEmailAccounts(emailAccounts); @@ -118,12 +124,13 @@ } public Configuration getConfiguration() { - if (configuration == null) { - return new ConfigurationImpl(); // just pour eviter les traces struts - } return configuration; } + public void setConfigurationJson(String json) { + this.configuration = getGson().fromJson(json, Configuration.class); + } + public List<EtatAttente> getEtatAttentes() { return etatAttentes; } @@ -133,18 +140,14 @@ this.etatAttentes = getGson().fromJson(json, type); } - public Map<MailAction, String> getMailActions() { - return getEnumAsMap(MailAction.values()); + public List<DemandType> getDemandTypes() { + return demandTypes; } - - public Map<MailAction, String> getContextMailActions() { - // FIXME add filter on isContextual - return getEnumAsMap(MailAction.ARCHIVE, MailAction.PRINT, MailAction.REPLY); + + public void setDemandTypesJson(String json) { + Type type = new TypeToken<List<DemandType>>() {}.getType(); + this.demandTypes = getGson().fromJson(json, type); } - - public Map<MailField, String> getMailFields() { - return getEnumAsMap(MailField.values()); - } public List<MailFolder> getMailFolders() { return mailFolders; @@ -176,4 +179,16 @@ Type type = new TypeToken<List<EmailAccount>>() {}.getType(); this.emailAccounts = getGson().fromJson(json, type); } + + public Map<MailAction, String> getMailActions() { + return getEnumAsMap(MailAction.values()); + } + + public Map<FolderAction, String> getFolderActions() { + return getEnumAsMap(FolderAction.values()); + } + + public Map<MailField, String> getMailFields() { + return getEnumAsMap(MailField.values()); + } } 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-04 08:08:56 UTC (rev 129) +++ trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/job/MailFilterJob.java 2014-06-04 14:43:27 UTC (rev 130) @@ -57,6 +57,7 @@ import com.franciaflex.faxtomail.persistence.entities.Client; import com.franciaflex.faxtomail.services.service.ClientService; + import org.apache.commons.io.Charsets; import org.apache.commons.io.FileUtils; import org.apache.commons.io.IOUtils; @@ -73,6 +74,7 @@ import com.franciaflex.faxtomail.persistence.entities.Email; import com.franciaflex.faxtomail.persistence.entities.EmailAccount; import com.franciaflex.faxtomail.persistence.entities.EmailImpl; +import com.franciaflex.faxtomail.persistence.entities.EmailProtocol; import com.franciaflex.faxtomail.persistence.entities.MailFolder; import com.franciaflex.faxtomail.services.DecoratorService; import com.franciaflex.faxtomail.services.FaxToMailServiceContext; @@ -99,7 +101,7 @@ Collection<EmailAccount> emailAccounts = configurationService.getEmailAccounts(); for (EmailAccount account : emailAccounts) { - if ("pop3".equals(account.getProtocol().toLowerCase())) { + if (account.getProtocol() == EmailProtocol.POP3) { checkEmailsOnPop3(account); } } @@ -114,6 +116,7 @@ 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())); Session session = Session.getInstance(properties); Store store = null; Modified: trunk/faxtomail-ui-web/src/main/resources/i18n/faxtomail-ui-web_fr_FR.properties =================================================================== --- trunk/faxtomail-ui-web/src/main/resources/i18n/faxtomail-ui-web_fr_FR.properties 2014-06-04 08:08:56 UTC (rev 129) +++ trunk/faxtomail-ui-web/src/main/resources/i18n/faxtomail-ui-web_fr_FR.properties 2014-06-04 14:43:27 UTC (rev 130) @@ -1,3 +1,5 @@ +com.franciaflex.faxtomail.persistence.entities.FolderAction.COMPUTE_RANGE=Calculer les quantités par gamme +com.franciaflex.faxtomail.persistence.entities.FolderAction.NEW_DEMANDE=Créer une nouvelle demande com.franciaflex.faxtomail.persistence.entities.MailAction.ARCHIVE=Archiver com.franciaflex.faxtomail.persistence.entities.MailAction.GROUP=Grouper com.franciaflex.faxtomail.persistence.entities.MailAction.PRINT=Imprimer 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-04 08:08:56 UTC (rev 129) +++ trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp 2014-06-04 14:43:27 UTC (rev 130) @@ -46,10 +46,12 @@ ConfigurationModule.value('ConfigurationData', { // enums 'mailActions': <s:property value="toJson(mailActions)" escapeHtml="false"/>, - 'contextMailActions': <s:property value="toJson(contextMailActions)" escapeHtml="false"/>, + 'folderActions': <s:property value="toJson(folderActions)" escapeHtml="false"/>, 'mailFields': <s:property value="toJson(mailFields)" escapeHtml="false"/>, // datas + 'configuration': <s:property value="toJson(configuration)" escapeHtml="false"/>, 'etatAttentes' : <s:property value="toJson(etatAttentes)" escapeHtml="false"/>, + 'demandTypes' : <s:property value="toJson(demandTypes)" escapeHtml="false"/>, 'mailFolders': <s:property value="toJson(mailFolders)" escapeHtml="false"/>, 'searchDisplayColumns': <s:property value="toJson(configuration.searchDisplayColumns)" escapeHtml="false"/>, 'users': <s:property value="toJson(users)" escapeHtml="false"/>, @@ -65,13 +67,14 @@ <h1 class="page-header">Configuration</h1> - <s:form id="main_form" action="configuration" ng-controller="ConfigurationController"> + <s:form id="main_form" action="configuration" method="post" ng-controller="ConfigurationController"> <s:hidden name="activeTab"/> <ul id="tabs" class="nav nav-tabs"> <li class="active"><a href="#tabs-general" data-toggle="tab">Général</a></li> - <li><a href="#tabs-wait" data-toggle="tab">États d'attente</a></li> + <li><a href="#tabs-etatAttente" data-toggle="tab">États d'attente</a></li> + <li><a href="#tabs-demandType" data-toggle="tab">Types de demandes</a></li> <li><a href="#tabs-tree" data-toggle="tab">Arborescence</a></li> <li><a href="#tabs-filters" data-toggle="tab">Filtres de mail</a></li> <li><a href="#tabs-search" data-toggle="tab">Recherche</a></li> @@ -79,25 +82,62 @@ </ul> <div class="tab-content active" ng-controller="ConfigurationMiscController"> + <input type="hidden" name="configurationJson" value="{{configuration}}" /> <div id="tabs-general" class="tab-pane active"> <!-- Général --> - - <s:textfield name="configuration.convertToPdfCommand" - label="Ligne de commande de conversion de fichier X en pdf"/> - - <s:textfield name="configuration.openAttachmentCommand" - label="Ligne de commande d'ouverture de fichier non TXT, TIFF, JPEG, PDF"/> - - <s:textfield name="configuration.emailMaxSize" - label="Taille maximale des email (en bits)"/> - - <!-- Il faut pouvoir configurer le dossier par défaut de déplacement en fonction des champs saisis sur la fiche (configuration sur statut, type de fiche, ...). - Ce dossier n'est qu'une proposition que l'utilisateur peut modifier)--> - + <div class="form-group"> + <label class="control-label" for="configurationEmailMaxSizeField">Taille maximale des email (en bits)</label> + <input type="text" id="configurationEmailMaxSizeField" class="form-control" ng-model="configuration.emailMaxSize" /> + </div> + + <table class="table table-bordered"> + <caption>Commande de traitement des extensions de pièces jointes</caption> + <thead> + <tr> + <th>Extension</th> + <th>Commandes</th> + <th>Suppr.</th> + </tr> + </thead> + <tbody> + <tr ng-repeat="extensionCommand in configuration.extensionCommands"> + <td class="col-xs-2"> + <div class="form-group"> + <input type="text" class="form-control" ng-model="extensionCommand.extension" size="5" placeholder="jpg" required> + </div> + </td> + <td> + <div class="form-group"> + <label for="convertToToPdfField">Conversion en pdf :</label> + <input id="convertToToPdfField" type="email" class="form-control" ng-model="extensionCommand.convertToPdfCommand" placeholder="" /> + </div> + <div class="form-group"> + <label for="openAttachmentCommandField">Ouverture :</label> + <input id="openAttachmentCommandField" type="email" class="form-control" ng-model="extensionCommand.openAttachmentCommand" placeholder="" /> + </div> + </td> + <td> + <a class="pull-right btn btn-danger btn-xs " ng-click="deleteExtensionRow($index)" title="Supprimer l'extension"> + <span class="glyphicon glyphicon-remove"></span></a> + </td> + </tr> + <tr ng-if="!configuration.extensionCommands || configuration.extensionCommands.length == 0"> + <td colspan="3" class="emptyTable">Aucune extension définie</td> + </tr> + </tbody> + <tfoot> + <tr> + <td colspan="3"> + <a class="pull-right btn btn-success btn-xs" ng-click="addExtensionRow()" > + <span class="glyphicon glyphicon-plus"></span> Ajouter une ligne</a> + </td> + </tr> + </tfoot> + </table> </div> - <div id="tabs-wait" class="tab-pane" ng-controller="ConfigurationWaitController"> + <div id="tabs-etatAttente" class="tab-pane" ng-controller="ConfigurationEtatAttenteController"> <input type="hidden" name="etatAttentesJson" value="{{etatAttentes}}" /> <div class="row"> @@ -116,15 +156,16 @@ <div class="col-md-7" ng-if="selectedEtatAttente"> <h3>Édition de l'état d'attente {{selectedEtatAttente.label}}</h3> - Champs obligatoires pour l'état d'attente : - <label class="checkbox" ng-repeat="(mailField,label) in mailFields"> - <input type="checkbox" ng-checked="selectedEtatAttente.fields.indexOf(mailField) != -1" - ng-click="changeEtatAttenteField(mailField)"> {{label}} + Actions autorisées lorsque la demande est <strong>valide</strong> : + <label class="checkbox" ng-repeat="(mailAction,label) in mailActions"> + <input type="checkbox" ng-checked="selectedEtatAttente.validFormDisabledActions.indexOf(mailAction) == -1" + ng-click="changeEtatAttenteValidAction(mailAction)"> {{label}} </label> - Actions autorisées pour l'état d'attente : + + Actions autorisées lorsque la demande est <strong>invalide</strong> : <label class="checkbox" ng-repeat="(mailAction,label) in mailActions"> - <input type="checkbox" ng-checked="selectedEtatAttente.mailActions.indexOf(mailAction) != -1" - ng-click="changeEtatAttenteAction(mailAction)"> {{label}} + <input type="checkbox" ng-checked="selectedEtatAttente.invalidFormDisabledActions.indexOf(mailAction) == -1" + ng-click="changeEtatAttenteInvalidAction(mailAction)"> {{label}} </label> </div> <div class="col-md-7" ng-if="!selectedEtatAttente"> @@ -133,6 +174,38 @@ </div> </div> + + <div id="tabs-demandType" class="tab-pane" ng-controller="ConfigurationDemandTypeController"> + <input type="hidden" name="demandTypesJson" value="{{demandTypes}}" /> + + <div class="row"> + <div class="col-md-4"> + <h3>Type de document <input type="button" class="btn btn-success btn-xs pull-right" value="Nouveau" ng-click="newDemandType()" /></h3> + <table class="table table-hover"> + <tbody> + <tr ng-repeat="demandType in demandTypes" + ng-class="{'info' : demandType == selectedDemandType}" + ng-click="editDemandType(demandType)"> + <td>{{demandType.label}}</td> + </tr> + </tbody> + </table> + </div> + + <div class="col-md-7" ng-if="selectedDemandType"> + <h3>Édition du type de document {{selectedDemandType.label}}</h3> + Champs obligatoires pour le type de document : + <label class="checkbox" ng-repeat="(mailField,label) in mailFields"> + <input type="checkbox" ng-checked="selectedDemandType.fields.indexOf(mailField) != -1" + ng-click="changeDemandTypeField(mailField)"> {{label}} + </label> + </div> + <div class="col-md-7" ng-if="!selectedDemandType"> + <em>Sélectionnez un type de document.</em> + </div> + </div> + + </div> <div id="tabs-tree" class="tab-pane" ng-controller="ConfigurationTreeController"> <input type="hidden" name="mailFoldersJson" value="{{mailFolders}}" /> Modified: trunk/faxtomail-ui-web/src/main/webapp/css/faxtomail.css =================================================================== --- trunk/faxtomail-ui-web/src/main/webapp/css/faxtomail.css 2014-06-04 08:08:56 UTC (rev 129) +++ trunk/faxtomail-ui-web/src/main/webapp/css/faxtomail.css 2014-06-04 14:43:27 UTC (rev 130) @@ -34,6 +34,11 @@ margin-bottom: 25px; } +.emptyTable { + text-align: center; + font-style: italic; +} + .angular-ui-tree-handle { background: #f8faff; border: 1px solid #dae2ea; Modified: trunk/faxtomail-ui-web/src/main/webapp/js/configuration.js =================================================================== --- trunk/faxtomail-ui-web/src/main/webapp/js/configuration.js 2014-06-04 08:08:56 UTC (rev 129) +++ trunk/faxtomail-ui-web/src/main/webapp/js/configuration.js 2014-06-04 14:43:27 UTC (rev 130) @@ -34,9 +34,11 @@ //{Map} les champs obligatoires possibles $scope.mailFields = ConfigurationData.mailFields; //{Map} les actions contextuelles possibles pour les dossiers - $scope.contextMailActions = ConfigurationData.contextMailActions; + $scope.folderActions = ConfigurationData.folderActions; //{Array} les etats d'attentes disponibles $scope.etatAttentes = ConfigurationData.etatAttentes; + //{Array} les types de documents + $scope.demandTypes = ConfigurationData.demandTypes; //{Array} mail folders $scope.mailFolders = ConfigurationData.mailFolders; @@ -61,15 +63,31 @@ /** * Misc tab controller. */ -ConfigurationModule.controller('ConfigurationMiscController', ['$scope', '$http', 'ConfigurationData', - function($scope, $http, ConfigurationData) { +ConfigurationModule.controller('ConfigurationMiscController', ['$scope', '$http', '$window', 'ConfigurationData', + function($scope, $http, $window, ConfigurationData) { + //{Object} L'object configuration + $scope.configuration = ConfigurationData.configuration; + + // Ajout d'une nouvelle ligne vide d'extension + $scope.addExtensionRow = function() { + if (!$scope.configuration.extensionCommands) { + $scope.configuration.extensionCommands = []; + } + $scope.configuration.extensionCommands.push({}); + }; + // suppression d'un ligne + $scope.deleteExtensionRow = function(index) { + if ($window.confirm("Êtes-vous sûr de vouloir supprimer cette extension ?")) { + $scope.configuration.extensionCommands.splice(index, 1); + } + }; }]); /** * Etat attente tab controller. */ -ConfigurationModule.controller('ConfigurationWaitController', ['$scope', '$http', '$window', 'ConfigurationData', +ConfigurationModule.controller('ConfigurationEtatAttenteController', ['$scope', '$http', '$window', 'ConfigurationData', function($scope, $http, $window, ConfigurationData) { //{Object} etat d'attente selectionné @@ -80,11 +98,11 @@ $scope.selectedEtatAttente = etatAttente; // initialize le tableau d'action si vide - if (!$scope.selectedEtatAttente.mainActions) { - $scope.selectedEtatAttente.mainActions = []; + if (!$scope.selectedEtatAttente.invalidFormDisabledActions) { + $scope.selectedEtatAttente.invalidFormDisabledActions = []; } - if (!$scope.selectedEtatAttente.fields) { - $scope.selectedEtatAttente.fields = []; + if (!$scope.selectedEtatAttente.validFormDisabledActions) { + $scope.selectedEtatAttente.validFormDisabledActions = []; } }; @@ -105,28 +123,74 @@ }; // selection/deselection d'une action - $scope.changeEtatAttenteAction = function(action) { - - var index = $scope.selectedEtatAttente.mailActions.indexOf(action); + $scope.changeEtatAttenteValidAction = function(action) { + var index = $scope.selectedEtatAttente.validFormDisabledActions.indexOf(action); if (index != -1) { - $scope.selectedEtatAttente.mailActions.splice(index, 1); + $scope.selectedEtatAttente.validFormDisabledActions.splice(index, 1); } else { - $scope.selectedEtatAttente.mailActions.push(action); + $scope.selectedEtatAttente.validFormDisabledActions.push(action); } }; + // selection/deselection d'une action + $scope.changeEtatAttenteInvalidAction = function(action) { + var index = $scope.selectedEtatAttente.invalidFormDisabledActions.indexOf(action); + if (index != -1) { + $scope.selectedEtatAttente.invalidFormDisabledActions.splice(index, 1); + } else { + $scope.selectedEtatAttente.invalidFormDisabledActions.push(action); + } + }; +}]); + + +/** + * Demand type tab controller. + */ +ConfigurationModule.controller('ConfigurationDemandTypeController', ['$scope', '$http', '$window', 'ConfigurationData', + function($scope, $http, $window, ConfigurationData) { + //{Object} demand type selectionné + $scope.selectedDemandType; + + // edition d'un type de demande + $scope.editDemandType = function(demandType) { + $scope.selectedDemandType = demandType; + + // initialize le tableau d'action si vide + if (!$scope.selectedDemandType.fields) { + $scope.selectedDemandType.fields = []; + } + }; + + // ajout d'un nouvel etat d'attente + $scope.newDemandType = function() { + var label = $window.prompt("Nom du nouveau type de document ?"); + if (label) { + // auto select new etat + var newDemandType = { + topiaId : "new_" + guid(), + label: label + }; + $scope.demandTypes.push(newDemandType); + + // auto select + $scope.editDemandType(newDemandType); + } + }; + // selection/deselection d'un champ - $scope.changeEtatAttenteField = function(mailField) { + $scope.changeDemandTypeField = function(mailField) { - var index = $scope.selectedEtatAttente.fields.indexOf(mailField); + var index = $scope.selectedDemandType.fields.indexOf(mailField); if (index != -1) { - $scope.selectedEtatAttente.fields.splice(index, 1); + $scope.selectedDemandType.fields.splice(index, 1); } else { - $scope.selectedEtatAttente.fields.push(mailField); + $scope.selectedDemandType.fields.push(mailField); } }; }]); + /** * Mail folder tab controller. */ Modified: trunk/pom.xml =================================================================== --- trunk/pom.xml 2014-06-04 08:08:56 UTC (rev 129) +++ trunk/pom.xml 2014-06-04 14:43:27 UTC (rev 130) @@ -100,12 +100,12 @@ <nuitonCsvVersion>3.0-rc-2</nuitonCsvVersion> <nuitonDecoratorVersion>3.0-alpha-3</nuitonDecoratorVersion> <nuitonUpdaterVersion>3.0-alpha-2</nuitonUpdaterVersion> - <nuitonUtilsVersion>3.0-SNAPSHOT</nuitonUtilsVersion> + <nuitonUtilsVersion>3.0-rc-3</nuitonUtilsVersion> <nuitonValidatorVersion>3.0-rc-1</nuitonValidatorVersion> <nuitonWebVersion>1.16</nuitonWebVersion> - <eugeneVersion>2.9</eugeneVersion> - <topiaVersion>3.0-SNAPSHOT</topiaVersion> + <eugeneVersion>2.10</eugeneVersion> + <topiaVersion>3.0-beta-5</topiaVersion> <hibernateVersion>4.3.5.Final</hibernateVersion> <h2Version>1.3.176</h2Version>
participants (1)
-
echatellier@users.forge.codelutin.com