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
r135 - in trunk: . faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service faxtomail-ui-web 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 05 Jun '14
by echatellier@users.forge.codelutin.com 05 Jun '14
05 Jun '14
Author: echatellier
Date: 2014-06-05 14:42:57 +0200 (Thu, 05 Jun 2014)
New Revision: 135
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/135
Log:
refs #4662: Suppression des dossiers vides
Modified:
trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/EmailTopiaDao.java
trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/MailFolderService.java
trunk/faxtomail-ui-web/pom.xml
trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ConfigurationAction.java
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/user-folder-input.jsp
trunk/faxtomail-ui-web/src/main/webapp/js/configuration.js
trunk/faxtomail-ui-web/src/main/webapp/js/faxtomail.js
trunk/pom.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-05 10:03:08 UTC (rev 134)
+++ trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/EmailTopiaDao.java 2014-06-05 12:42:57 UTC (rev 135)
@@ -343,4 +343,23 @@
return findAll(query.toString(), args);
}
+
+ /**
+ * Retounre le nombre d'email par dossier.
+ *
+ * @return le nombre d'email par dossier
+ */
+ public Map<String, Long> getMailCountByFolder() {
+ String query = "SELECT mailFolder.topiaId, count(*) FROM " + Email.class.getName() + " group by mailFolder.topiaId";
+
+ Map<String, Long> result = new HashMap<>();
+
+ List<Object[]> queryResuts = findAll(query);
+ for (Object[] queryResut : queryResuts) {
+ String mailFolder = (String)queryResut[0];
+ Long count = (Long)queryResut[1];
+ result.put(mailFolder, count);
+ }
+ return result;
+ }
}
Modified: trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/MailFolderService.java
===================================================================
--- trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/MailFolderService.java 2014-06-05 10:03:08 UTC (rev 134)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/MailFolderService.java 2014-06-05 12:42:57 UTC (rev 135)
@@ -35,11 +35,11 @@
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.nuiton.topia.persistence.TopiaIdFactory;
import org.nuiton.util.beans.Binder;
import org.nuiton.util.beans.BinderFactory;
import org.nuiton.util.pagination.PaginationParameter;
+import com.franciaflex.faxtomail.persistence.entities.EmailTopiaDao;
import com.franciaflex.faxtomail.persistence.entities.EtatAttente;
import com.franciaflex.faxtomail.persistence.entities.MailFilter;
import com.franciaflex.faxtomail.persistence.entities.MailFilterTopiaDao;
@@ -157,7 +157,6 @@
Collection<EtatAttente> etatAttentes = folder.getEtatAttente();
if (CollectionUtils.isEmpty(etatAttentes)) {
etatAttentes = parentEtatAttente;
-
} else {
parentEtatAttente = etatAttentes;
}
@@ -178,4 +177,17 @@
}
+ /**
+ * Retourne une map avec les identifiants des {@code mailFolder}s et le nombre de mails qu'ils
+ * contiennent pour pouvoir empecher la suppression.
+ * Seulement pour les dossiers qui ont au moins un email.
+ *
+ * @return le nombre de mail par dossier
+ */
+ public Map<String, Long> getMailFoldersUsage() {
+ EmailTopiaDao dao = getPersistenceContext().getEmailDao();
+ Map<String, Long> result = dao.getMailCountByFolder();
+ return result;
+ }
+
}
Modified: trunk/faxtomail-ui-web/pom.xml
===================================================================
--- trunk/faxtomail-ui-web/pom.xml 2014-06-05 10:03:08 UTC (rev 134)
+++ trunk/faxtomail-ui-web/pom.xml 2014-06-05 12:42:57 UTC (rev 135)
@@ -237,6 +237,11 @@
<groupId>org.nuiton.js</groupId>
<artifactId>nuiton-js-angular-ui-tree</artifactId>
</dependency>
+
+ <dependency>
+ <groupId>org.webjars</groupId>
+ <artifactId>angular-ui-bootstrap</artifactId>
+ </dependency>
<dependency>
<groupId>org.webjars</groupId>
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-05 10:03:08 UTC (rev 134)
+++ trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ConfigurationAction.java 2014-06-05 12:42:57 UTC (rev 135)
@@ -71,6 +71,8 @@
protected List<MailFolder> mailFolders;
+ protected Map<String, Long> mailFoldersUsage;
+
protected List<MailFilter> mailFilters;
protected List<FaxToMailUser> users;
@@ -88,6 +90,7 @@
etatAttentes = referentielService.getAllEtatAttente();
demandTypes = referentielService.getAllDemandType();
mailFolders = mailFolderService.getRootMailFolders();
+ mailFoldersUsage = mailFolderService.getMailFoldersUsage();
users = configurationService.getAllUsers();
emailAccounts = configurationService.getEmailAccounts();
mailFilters = configurationService.getMailFilters();
@@ -170,7 +173,11 @@
Type type = new TypeToken<List<MailFilter>>() {}.getType();
this.mailFilters = getGson().fromJson(json, type);
}
-
+
+ public Map<String, Long> getMailFoldersUsage() {
+ return mailFoldersUsage;
+ }
+
public List<EmailAccount> getEmailAccounts() {
return emailAccounts;
}
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-05 10:03:08 UTC (rev 134)
+++ trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp 2014-06-05 12:42:57 UTC (rev 135)
@@ -37,6 +37,8 @@
<script type="text/javascript" src="<s:url value='/js/select2sortable.js' />"></script>
<script type="text/javascript" src="<s:url value='/nuiton-js-angular-ui-tree/angular-ui-tree.js' />"></script>
<script type="text/javascript" src="<s:url value='/webjars/angular-ui-sortable/0.12.2/sortable.min.js' />"></script>
+ <script type="text/javascript" src="<s:url value='/webjars/angular-ui-bootstrap/0.11.0/ui-bootstrap.min.js' />"></script>
+ <script type="text/javascript" src="<s:url value='/webjars/angular-ui-bootstrap/0.11.0/ui-bootstrap-tpls.min.js' />"></script>
<link rel="stylesheet" type="text/css" href="<s:url value='/css/faxtomail.css' />" />
<script type="text/javascript" src="<s:url value='/js/faxtomail.js' />"></script>
@@ -53,6 +55,7 @@
'etatAttentes': <s:property value="toJson(etatAttentes)" escapeHtml="false"/>,
'demandTypes': <s:property value="toJson(demandTypes)" escapeHtml="false"/>,
'mailFolders': <s:property value="toJson(mailFolders)" escapeHtml="false"/>,
+ 'mailFoldersUsage': <s:property value="toJson(mailFoldersUsage)" escapeHtml="false"/>,
'searchDisplayColumns': <s:property value="toJson(configuration.searchDisplayColumns)" escapeHtml="false"/>,
'users': <s:property value="toJson(users)" escapeHtml="false"/>,
'mailFilters': <s:property value="toJson(mailFilters)" escapeHtml="false"/>,
@@ -218,9 +221,11 @@
<a class="btn btn-success btn-xs" data-nodrag ng-click="toggle(this)" ng-disabled="!mailFolder.children || mailFolder.children.length == 0">
<span class="glyphicon" ng-class="{'glyphicon-chevron-right': !collapsed, 'glyphicon-chevron-down': collapsed}"></span>
</a>
- {{mailFolder.name}}
+ {{mailFolder.name}} <span class="badge">{{mailFolder.$cumulativeCount}}</span>
<a class="pull-right btn btn-primary btn-xs" data-nodrag ng-click="newSubFolder(this)" style="margin-left: 8px;"><span class="glyphicon glyphicon-plus"></span></a>
- <a class="pull-right btn btn-danger btn-xs" data-nodrag ng-click="remove(this)" ng-if="!mailFolder.topiaId"><span class="glyphicon glyphicon-remove"></span></a>
+ <a class="pull-right btn btn-danger btn-xs" data-nodrag ng-click="deleteFolder(this)" ng-disabled="mailFolder.$cumulativeCount > 0"
+ tooltip="{{mailFolder.$cumulativeCount > 0 && 'Ce dossier contient ' + mailFolder.$cumulativeCount + ' demandes !'|| 'Supprimer ce dossier'}}">
+ <span class="glyphicon glyphicon-remove"></span></a>
</div>
<ol ui-tree-nodes="options" ng-model="mailFolder.children" ng-class="{hidden: !collapsed}">
<li ng-repeat="mailFolder in mailFolder.children" ui-tree-node ng-include="'nodes_renderer.html'">
Modified: trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/user-folder-input.jsp
===================================================================
--- trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/user-folder-input.jsp 2014-06-05 10:03:08 UTC (rev 134)
+++ trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/user-folder-input.jsp 2014-06-05 12:42:57 UTC (rev 135)
@@ -34,6 +34,7 @@
<script type="text/javascript" src="<s:url value='/webjars/select2/3.4.8/select2_locale_fr.js' />"></script>
<script type="text/javascript" src="<s:url value='/webjars/angularjs/1.2.16/angular.min.js' />"></script>
<script type="text/javascript" src="<s:url value='/js/select2sortable.js' />"></script>
+ <script type="text/javascript" src="<s:url value='/webjars/angular-ui-bootstrap/0.11.0/ui-bootstrap.min.js' />"></script>
<link rel="stylesheet" type="text/css" href="<s:url value='/css/faxtomail.css' />" />
<script type="text/javascript" src="<s:url value='/js/faxtomail.js' />"></script>
Modified: trunk/faxtomail-ui-web/src/main/webapp/js/configuration.js
===================================================================
--- trunk/faxtomail-ui-web/src/main/webapp/js/configuration.js 2014-06-05 10:03:08 UTC (rev 134)
+++ trunk/faxtomail-ui-web/src/main/webapp/js/configuration.js 2014-06-05 12:42:57 UTC (rev 135)
@@ -41,12 +41,15 @@
$scope.demandTypes = ConfigurationData.demandTypes;
//{Array} mail folders
$scope.mailFolders = ConfigurationData.mailFolders;
+ // {Map} Mail folder usage
+ $scope.mailFoldersUsage = ConfigurationData.mailFoldersUsage;
//{Map<MailFolder id, Array<MailFolder>>} liste des
$scope.flatMailFolders;
// 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) {
+ var cumulativeCount = 0;
if (mailFolders) {
angular.forEach(mailFolders, function(mailFolder) {
@@ -56,11 +59,22 @@
// ha la la, modify input object again :(
// use $ from this, even not recommended because angular exlude those fields when jsonify
mailFolder.$rootFolder = rootFolder;
+
+ //
+ var folderCount = 0;
+ if ($scope.mailFoldersUsage.hasOwnProperty(mailFolder.topiaId)) {
+ folderCount += $scope.mailFoldersUsage[mailFolder.topiaId];
+ }
result.push(mailFolder);
- recursiveAddMailFolder(result, mailFolder.children, rootFolder, mailFolder.$fullPath);
+ folderCount += recursiveAddMailFolder(result, mailFolder.children, rootFolder, mailFolder.$fullPath);
+
+ // et on modifie encore (tant qu'on a commencé !!!)
+ mailFolder.$cumulativeCount = folderCount;
+ cumulativeCount += folderCount;
});
}
+ return cumulativeCount;
};
// update $scope.flatMailFolders when $scope.mailFolders changes
@@ -69,7 +83,8 @@
$scope.flatMailFolders = {};
angular.forEach($scope.mailFolders, function(mailFolder) {
$scope.flatMailFolders[mailFolder.topiaId] = [];
- recursiveAddMailFolder($scope.flatMailFolders[mailFolder.topiaId], mailFolder.children, mailFolder, mailFolder.name);
+ var cumulativeCount = recursiveAddMailFolder($scope.flatMailFolders[mailFolder.topiaId], mailFolder.children, mailFolder, mailFolder.name);
+ mailFolder.$cumulativeCount = cumulativeCount;
});
};
$scope._updateFlatMailFolders();
@@ -209,8 +224,10 @@
/**
* Mail folder tab controller.
*/
-ConfigurationModule.controller('ConfigurationTreeController', ['$scope', '$http', '$window', 'ConfigurationData',
- function($scope, $http, $window, ConfigurationData) {
+ConfigurationModule.controller('ConfigurationTreeController', ['$scope', '$window', 'ConfigurationData',
+ function($scope, $window, ConfigurationData) {
+ // {Array} Users
+ $scope.users = ConfigurationData.users;
// {Object} selected mail folder
$scope.selectedMailFolder;
// {String} add new customer responsible form value
@@ -219,8 +236,6 @@
$scope.newReplyAddress;
// {Array} Colonnes selectionnées pour le dossier courant
$scope.folderTableColumns;
- // {Array} Users
- $scope.users = ConfigurationData.users;
// creation d'un nouveau noeud racine
$scope.newRoot = function() {
@@ -253,6 +268,13 @@
}
};
+ // suppression d'un dossier
+ $scope.deleteFolder = function(scope) {
+ if ($window.confirm("Êtes-vous sûr de vouloir supprimer ce dossier ?")) {
+ scope.remove(scope);
+ }
+ };
+
// edit mail folder
$scope.editMailFolder = function(mailFolder) {
$scope.selectedMailFolder = mailFolder;
Modified: trunk/faxtomail-ui-web/src/main/webapp/js/faxtomail.js
===================================================================
--- trunk/faxtomail-ui-web/src/main/webapp/js/faxtomail.js 2014-06-05 10:03:08 UTC (rev 134)
+++ trunk/faxtomail-ui-web/src/main/webapp/js/faxtomail.js 2014-06-05 12:42:57 UTC (rev 135)
@@ -38,4 +38,4 @@
}
/** Mail faxtomail application module. */
-var FaxToMailModule = angular.module('FaxToMail', []);
+var FaxToMailModule = angular.module('FaxToMail', ['ui.bootstrap']);
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2014-06-05 10:03:08 UTC (rev 134)
+++ trunk/pom.xml 2014-06-05 12:42:57 UTC (rev 135)
@@ -535,9 +535,16 @@
<version>0.12.2</version>
<scope>runtime</scope>
</dependency>
-
+
<dependency>
<groupId>org.webjars</groupId>
+ <artifactId>angular-ui-bootstrap</artifactId>
+ <version>0.11.0-2</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.webjars</groupId>
<artifactId>bootstrap</artifactId>
<version>3.1.1-1</version>
<scope>runtime</scope>
1
0
r134 - trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin
by echatellier@users.forge.codelutin.com 05 Jun '14
by echatellier@users.forge.codelutin.com 05 Jun '14
05 Jun '14
Author: echatellier
Date: 2014-06-05 12:03:08 +0200 (Thu, 05 Jun 2014)
New Revision: 134
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/134
Log:
Ajout des cases d?\195?\169placement et cr?\195?\169ation dans le dossier
Modified:
trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp
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-05 09:43:43 UTC (rev 133)
+++ trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp 2014-06-05 10:03:08 UTC (rev 134)
@@ -238,6 +238,108 @@
<h3>Édition du dossier {{selectedMailFolder.name}}</h3>
<div class="panel-group" id="accordion">
+ <!-- Général -->
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ <h4 class="panel-title">
+ <a data-toggle="collapse" data-parent="#accordion" href="#collapse0">
+ Liste des chargés de clientèle
+ </a>
+ </h4>
+ </div>
+ <div id="collapse0" class="panel-collapse collapse in">
+ <div class="panel-body">
+ <div class="form-group">
+ <label class="control-label">Autoriser le déplacement de demandes vers ce dossier ?</label><br />
+ <label class="radio-inline">
+ <input type="radio"
+ ng-model="selectedMailFolder.allowMoveDemandIntoFolder" ng-value="true"> oui
+ </label>
+ <label class="radio-inline">
+ <input type="radio"
+ ng-model="selectedMailFolder.allowMoveDemandIntoFolder" ng-value="false"> non
+ </label>
+ <label class="radio-inline">
+ <input type="radio"
+ ng-model="selectedMailFolder.allowMoveDemandIntoFolder" ng-value="undefined"> valeur du noeud parent
+ </label>
+ </div>
+ <div class="form-group">
+ <label class="control-label">Autoriser la création de demandes dans ce dossier ?</label><br />
+ <label class="radio-inline">
+ <input type="radio"
+ ng-model="selectedMailFolder.allowCreateDemandIntoFolder" ng-value="true"> oui
+ </label>
+ <label class="radio-inline">
+ <input type="radio"
+ ng-model="selectedMailFolder.allowCreateDemandIntoFolder" ng-value="false"> non
+ </label>
+ <label class="radio-inline">
+ <input type="radio"
+ ng-model="selectedMailFolder.allowCreateDemandIntoFolder" ng-value="undefined"> valeur du noeud parent
+ </label>
+ </div>
+ <div class="form-group">
+ <label class="control-label">L'action imprimer est-elle équivalente à "prendre"</label><br />
+ <label class="radio-inline">
+ <input type="radio"
+ ng-model="selectedMailFolder.printActionEqualTakeAction" ng-value="true"> oui
+ </label>
+ <label class="radio-inline">
+ <input type="radio"
+ ng-model="selectedMailFolder.printActionEqualTakeAction" ng-value="false"> non
+ </label>
+ <label class="radio-inline">
+ <input type="radio"
+ ng-model="selectedMailFolder.printActionEqualTakeAction" ng-value="undefined"> valeur du noeud parent
+ </label>
+ </div>
+
+ <div class="form-group">
+ <label class="control-label">Ouvrir une pièce jointe sans prendre, met-il la ligne en orange ?</label><br />
+ <label class="radio-inline">
+ <input type="radio"
+ ng-model="selectedMailFolder.openAttachmentReportNoTaken" ng-value="true"> oui
+ </label>
+ <label class="radio-inline">
+ <input type="radio"
+ ng-model="selectedMailFolder.openAttachmentReportNoTaken" ng-value="false"> non
+ </label>
+ <label class="radio-inline">
+ <input type="radio"
+ ng-model="selectedMailFolder.openAttachmentReportNoTaken" ng-value="undefined"> valeur du noeud parent
+ </label>
+ </div>
+
+ <div class="form-group">
+ <label class="control-label">Refuser les mails dont l'email est inconnu de la base client</label><br />
+ <label class="radio-inline">
+ <input type="radio"
+ ng-model="selectedMailFolder.rejectUnknownSender" ng-value="true"> oui
+ </label>
+ <label class="radio-inline">
+ <input type="radio"
+ ng-model="selectedMailFolder.rejectUnknownSender" ng-value="false"> non
+ </label>
+ <label class="radio-inline">
+ <input type="radio"
+ ng-model="selectedMailFolder.rejectUnknownSender" ng-value="undefined"> valeur du noeud parent
+ </label>
+ </div>
+
+ <div class="form-group">
+ <label for="ediFolderField">Dossier (FS) de dépôt des demandes EDI</label>
+ <input type="text" class="form-control" id="ediFolderField" ng-model="selectedMailFolder.ediFolder">
+ </div>
+
+ <div class="form-group">
+ <label for="faxDomainField">Domaines des fax</label>
+ <input type="text" class="form-control" id="faxDomainField" ng-model="selectedMailFolder.faxDomain">
+ </div>
+ </div>
+ </div>
+ </div>
+
<!-- Liste des chargés de clientèle -->
<div class="panel panel-default">
<div class="panel-heading">
@@ -447,64 +549,6 @@
</div>
</div>
</div>
-
- <div class="form-group">
- <label class="control-label">L'action imprimer est-elle équivalente à "prendre"</label><br />
- <label class="radio-inline">
- <input type="radio" name="printActionEqualTakeActionField"
- ng-model="selectedMailFolder.printActionEqualTakeAction" ng-value="true"> oui
- </label>
- <label class="radio-inline">
- <input type="radio" name="printActionEqualTakeActionField"
- ng-model="selectedMailFolder.printActionEqualTakeAction" ng-value="false"> non
- </label>
- <label class="radio-inline">
- <input type="radio" name="printActionEqualTakeActionField"
- ng-model="selectedMailFolder.printActionEqualTakeAction" ng-value="undefined"> valeur du noeud parent
- </label>
- </div>
-
- <div class="form-group">
- <label class="control-label">Ouvrir une pièce jointe sans prendre, met-il la ligne en orange ?</label><br />
- <label class="radio-inline">
- <input type="radio" name="openAttachmentReportNoTakenField"
- ng-model="selectedMailFolder.openAttachmentReportNoTaken" ng-value="true"> oui
- </label>
- <label class="radio-inline">
- <input type="radio" name="openAttachmentReportNoTakenField"
- ng-model="selectedMailFolder.openAttachmentReportNoTaken" ng-value="false"> non
- </label>
- <label class="radio-inline">
- <input type="radio" name="openAttachmentReportNoTakenField"
- ng-model="selectedMailFolder.openAttachmentReportNoTaken" ng-value="undefined"> valeur du noeud parent
- </label>
- </div>
-
- <div class="form-group">
- <label class="control-label">Refuser les mails dont l'email est inconnu de la base client</label><br />
- <label class="radio-inline">
- <input type="radio" name="rejectUnknownSenderField"
- ng-model="selectedMailFolder.rejectUnknownSender" ng-value="true"> oui
- </label>
- <label class="radio-inline">
- <input type="radio" name="rejectUnknownSenderField"
- ng-model="selectedMailFolder.rejectUnknownSender" ng-value="false"> non
- </label>
- <label class="radio-inline">
- <input type="radio" name="rejectUnknownSenderField"
- ng-model="selectedMailFolder.rejectUnknownSender" ng-value="undefined"> valeur du noeud parent
- </label>
- </div>
-
- <div class="form-group">
- <label for="ediFolderField">Dossier (FS) de dépôt des demandes EDI</label>
- <input type="text" class="form-control" id="ediFolderField" ng-model="selectedMailFolder.ediFolder">
- </div>
-
- <div class="form-group">
- <label for="faxDomainField">Domaines des fax</label>
- <input type="text" class="form-control" id="faxDomainField" ng-model="selectedMailFolder.faxDomain">
- </div>
</div>
</div>
</div>
1
0
r133 - in trunk/faxtomail-ui-web/src/main/webapp: WEB-INF/content/admin js
by echatellier@users.forge.codelutin.com 05 Jun '14
by echatellier@users.forge.codelutin.com 05 Jun '14
05 Jun '14
Author: echatellier
Date: 2014-06-05 11:43:43 +0200 (Thu, 05 Jun 2014)
New Revision: 133
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/133
Log:
Display full node path in select.
Remove binding on methods.
Filter mail filters by root mail folders.
Modified:
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-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-05 07:32:18 UTC (rev 132)
+++ trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp 2014-06-05 09:43:43 UTC (rev 133)
@@ -50,14 +50,14 @@
'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"/>,
+ '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"/>,
'mailFilters': <s:property value="toJson(mailFilters)" escapeHtml="false"/>,
'emailAccounts': <s:property value="toJson(emailAccounts)" escapeHtml="false"/>
- });
+ });
</script>
</head>
@@ -69,7 +69,7 @@
<s:form id="main_form" action="configuration" method="post" ng-controller="ConfigurationController">
- <s:hidden name="activeTab"/>
+ <!--<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>
@@ -512,38 +512,52 @@
<div id="tabs-filters" class="tab-pane" ng-controller="ConfigurationFilterController">
<input type="hidden" name="mailFiltersJson" value="{{mailFilters}}" />
- <table class="table table-hover table-bordered">
- <thead>
- <tr>
- <th>Filtre</th>
- <th>Dossier</th>
- <th/>
- </tr>
- </thead>
- <tbody ui-sortable ng-model="mailFilters">
- <tr ng-repeat="mailFilter in mailFilters">
- <td>{{mailFilter.expression}}</td>
- <td>{{mailFilter.mailFolder.name}}</td>
- <td><a class="btn btn-danger btn-xs" ng-click="removeFilter($index)">
- <span class="glyphicon glyphicon-remove"></span>
- </a></td>
- </tr>
- </tbody>
- </table>
- <div role="form">
- <div class="form-group">
- <label for="filterField">Filtre</label>
- <input type="text" class="form-control" id="folderField" ng-model="newFilter.expression">
+ <div class="panel panel-default">
+ <div class="panel-heading" ng-repeat-start="mailFolder in mailFolders">
+ <h4 class="panel-title">
+ <a data-toggle="collapse" data-parent="#accordion" href="#mailFilerAccordion{{$index}}">
+ Filtre du dossier {{mailFolder.name}}
+ </a>
+ </h4>
</div>
- <div class="form-group">
- <label for="folderField">Dossier</label>
- <select class="form-control" ng-model="newFilter.mailFolder" ng-options="mailFolder.name for mailFolder in flatMailFolders()"></select>
+ <div id="mailFilerAccordion{{$index}}" class="panel-collapse collapse" ng-repeat-end>
+ <div class="panel-body">
+ <table class="table table-hover table-bordered">
+ <thead>
+ <tr>
+ <th>Filtre</th>
+ <th>Dossier</th>
+ <th/>
+ </tr>
+ </thead>
+ <tbody ui-sortable ng-model="mailFilters">
+ <tr ng-repeat="mailFilter in mailFilters|filter:subFolderFilter(mailFolder)">
+ <td>{{mailFilter.expression}}</td>
+ <td>{{mailFilter.mailFolder.$fullPath}}</td>
+ <td><a class="btn btn-danger btn-xs" ng-click="removeFilter(mailFilter)">
+ <span class="glyphicon glyphicon-remove"></span>
+ </a></td>
+ </tr>
+ </tbody>
+ </table>
+
+ <div role="form">
+ <div class="form-group">
+ <label for="filterField">Filtre</label>
+ <input type="text" class="form-control" id="folderField" ng-model="newFilter.expression">
+ </div>
+ <div class="form-group">
+ <label for="folderField">Dossier</label>
+ <select class="form-control" ng-model="newFilter.mailFolder" ng-options="mailFolder.$fullPath for mailFolder in flatMailFolders[mailFolder.topiaId]"></select>
+ </div>
+ </div>
+ <button type="button" class="btn btn-success" ng-disabled="!newFilter.expression || !newFilter.mailFolder" ng-click="addNewFilter()">
+ <i class="glyphicon glyphicon-plus"></i> Ajouter
+ </button>
+ </div>
</div>
</div>
- <button type="button" class="btn btn-success" ng-disabled="!newFilter.expression || !newFilter.mailFolder" ng-click="addNewFilter()">
- <i class="glyphicon glyphicon-plus"></i> Ajouter
- </button>
</div>
<div id="tabs-search" class="tab-pane" ng-controller="ConfigurationSearchController">
@@ -561,7 +575,7 @@
<caption>Aperçu</caption>
<thead>
<tr>
- <th ng-repeat="etatAttenteField in searchDisplayColumns">{{etatAttenteFields[etatAttenteField.id]}}</th>
+ <th ng-repeat="etatAttenteField in searchDisplayColumns">{{mailFields[etatAttenteField.id]}}</th>
</tr>
</thead>
</table>
Modified: trunk/faxtomail-ui-web/src/main/webapp/js/configuration.js
===================================================================
--- trunk/faxtomail-ui-web/src/main/webapp/js/configuration.js 2014-06-05 07:32:18 UTC (rev 132)
+++ trunk/faxtomail-ui-web/src/main/webapp/js/configuration.js 2014-06-05 09:43:43 UTC (rev 133)
@@ -41,23 +41,38 @@
$scope.demandTypes = ConfigurationData.demandTypes;
//{Array} mail folders
$scope.mailFolders = ConfigurationData.mailFolders;
+ //{Map<MailFolder id, Array<MailFolder>>} liste des
+ $scope.flatMailFolders;
- // method privée recursive pour retourner l'ensemble des dossiers
- var recursiveAddMailFolder = function(result, mailFolders) {
+ // 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) {
if (mailFolders) {
angular.forEach(mailFolders, function(mailFolder) {
+
+ // warning modify input object :(
+ // use $ from this, even not recommended because angular exlude those fields when jsonify
+ mailFolder.$fullPath = prefix + "/" + mailFolder.name;
+ // ha la la, modify input object again :(
+ // use $ from this, even not recommended because angular exlude those fields when jsonify
+ mailFolder.$rootFolder = rootFolder;
+
result.push(mailFolder);
- recursiveAddMailFolder(result, mailFolder.children);
+ recursiveAddMailFolder(result, mailFolder.children, rootFolder, mailFolder.$fullPath);
});
}
};
- // Retourne l'ensemble de l'arbre des dossiers "à plat"
- $scope.flatMailFolders = function() {
- var flatMailFolders = [];
- recursiveAddMailFolder(flatMailFolders, $scope.mailFolders);
- return flatMailFolders;
+ // update $scope.flatMailFolders when $scope.mailFolders changes
+ $scope._updateFlatMailFolders = function() {
+ console.log("Update flatMailFolders map");
+ $scope.flatMailFolders = {};
+ angular.forEach($scope.mailFolders, function(mailFolder) {
+ $scope.flatMailFolders[mailFolder.topiaId] = [];
+ recursiveAddMailFolder($scope.flatMailFolders[mailFolder.topiaId], mailFolder.children, mailFolder, mailFolder.name);
+ });
};
+ $scope._updateFlatMailFolders();
}]);
/**
@@ -217,12 +232,27 @@
children: []
};
$scope.mailFolders.push(newRoot);
+ $scope._updateFlatMailFolders(); // update flat map
// edition automatique
$scope.editMailFolder(newRoot);
};
};
+ // new sub folder
+ $scope.newSubFolder = function(scope) {
+ var nodeData = scope.$modelValue;
+ var name = $window.prompt("Nom du nouveau noeud ? ");
+ if (name) {
+ nodeData.children.push({
+ topiaId: "new_" + guid(),
+ name: name,
+ children: []
+ });
+ $scope._updateFlatMailFolders(); // update flat map
+ }
+ };
+
// edit mail folder
$scope.editMailFolder = function(mailFolder) {
$scope.selectedMailFolder = mailFolder;
@@ -264,19 +294,6 @@
}
}, true);
- // new sub folder
- $scope.newSubFolder = function(scope) {
- var nodeData = scope.$modelValue;
- var name = $window.prompt("Nom du nouveau noeud ? ");
- if (name) {
- nodeData.children.push({
- topiaId: "new_" + guid(),
- name: name,
- children: []
- });
- }
- };
-
// fonction retournant l'ensemble des options disponibles
$scope.getObjectsData = function(term, result) {
var resultArray = [];
@@ -346,13 +363,29 @@
/**
* Mail filter tab controller.
*/
-ConfigurationModule.controller('ConfigurationFilterController', ['$scope', '$http', 'ConfigurationData',
- function($scope, $http, ConfigurationData) {
+ConfigurationModule.controller('ConfigurationFilterController', ['$scope', '$window', 'ConfigurationData',
+ function($scope, $window, ConfigurationData) {
//{Array} Current mail filter list
$scope.mailFilters = ConfigurationData.mailFilters;
//{Object} New accout empty filter
$scope.newFilter = {};
+ // replace filter instance with mailFolder filter instance to use same objects
+ angular.forEach($scope.mailFilters, function(filter) {
+ // root folder
+ angular.forEach($scope.mailFolders, function(mailFolder) {
+ if (mailFolder.topiaId == filter.mailFolder.topiaId) {
+ filter.mailFolder = mailFolder;
+ } else {
+ angular.forEach($scope.flatMailFolders[mailFolder.topiaId], function(subFolder) {
+ if (subFolder.topiaId == filter.mailFolder.topiaId) {
+ filter.mailFolder = subFolder;
+ }
+ });
+ }
+ });
+ });
+
// add new filter action
$scope.addNewFilter = function() {
$scope.mailFilters.push($scope.newFilter);
@@ -360,19 +393,29 @@
// clear form
$scope.newFilter = {};
};
-
+
// remove filter
- $scope.removeFilter = function(index) {
- $scope.mailFilters.splice(index, 1);
+ $scope.removeFilter = function(filter) {
+ if ($window.confirm("Êtes-vous sûr de vouloir supprimer ce filter ?")) {
+ var index = $scope.mailFilters.indexOf(filter);
+ $scope.mailFilters.splice(index, 1);
+ }
};
+
+ // define angular filter used to group mailFilters by rootFolders
+ $scope.subFolderFilter = function(mailFolder) {
+ return function(item) {
+ return item.mailFolder == mailFolder || item.mailFolder.$rootFolder == mailFolder;
+ };
+ };
}]);
/**
* Search tab controller.
*/
-ConfigurationModule.controller('ConfigurationSearchController', ['$scope', '$http', 'ConfigurationData',
- function($scope, $http, ConfigurationData) {
+ConfigurationModule.controller('ConfigurationSearchController', ['$scope', 'ConfigurationData',
+ function($scope, ConfigurationData) {
//{Array} Options actuelle
$scope.searchDisplayColumns = [];
angular.forEach(ConfigurationData.searchDisplayColumns, function(searchDisplayColumn) {
1
0
Author: echatellier
Date: 2014-06-05 09:32:18 +0200 (Thu, 05 Jun 2014)
New Revision: 132
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/132
Log:
Update angular ui tree
Modified:
trunk/pom.xml
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2014-06-04 14:53:59 UTC (rev 131)
+++ trunk/pom.xml 2014-06-05 07:32:18 UTC (rev 132)
@@ -560,7 +560,7 @@
<dependency>
<groupId>org.nuiton.js</groupId>
<artifactId>nuiton-js-angular-ui-tree</artifactId>
- <version>2.0.6-1</version>
+ <version>2.1.4-1</version>
<scope>runtime</scope>
<exclusions>
<exclusion>
1
0
r131 - in trunk/faxtomail-ui-web/src/main/webapp: WEB-INF/content/admin js
by echatellier@users.forge.codelutin.com 04 Jun '14
by echatellier@users.forge.codelutin.com 04 Jun '14
04 Jun '14
Author: echatellier
Date: 2014-06-04 16:53:59 +0200 (Wed, 04 Jun 2014)
New Revision: 131
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/131
Log:
refs #4662: Correction des actions contextuel des dossiers
Modified:
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-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 14:43:27 UTC (rev 130)
+++ trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp 2014-06-04 14:53:59 UTC (rev 131)
@@ -406,9 +406,9 @@
</div>
<div id="collapse5" class="panel-collapse collapse">
<div class="panel-body">
- <label class="checkbox" ng-repeat="(contextMailAction,label) in contextMailActions">
- <input type="checkbox" ng-checked="selectedMailFolder.contextActions.indexOf(contextMailAction) != -1"
- ng-click="changeFolderAction(contextMailAction)"> {{label}}
+ <label class="checkbox" ng-repeat="(folderAction,label) in folderActions">
+ <input type="checkbox" ng-checked="selectedMailFolder.folderActions.indexOf(folderAction) != -1"
+ ng-click="changeFolderAction(folderAction)"> {{label}}
</label>
</div>
</div>
Modified: trunk/faxtomail-ui-web/src/main/webapp/js/configuration.js
===================================================================
--- trunk/faxtomail-ui-web/src/main/webapp/js/configuration.js 2014-06-04 14:43:27 UTC (rev 130)
+++ trunk/faxtomail-ui-web/src/main/webapp/js/configuration.js 2014-06-04 14:53:59 UTC (rev 131)
@@ -249,7 +249,7 @@
angular.forEach($scope.selectedMailFolder.folderTableColumns, function(folderTableColumn) {
$scope.folderTableColumns.push({
id: folderTableColumn,
- label: $scope.fields[folderTableColumn]
+ label: $scope.mailFields[folderTableColumn]
});
});
};
@@ -333,12 +333,12 @@
};
// selection/deselection d'une action possible du menu contextuel pour ce dossier
- $scope.changeFolderAction = function(mailAction) {
- var index = $scope.selectedMailFolder.contextActions.indexOf(mailAction);
+ $scope.changeFolderAction = function(folderAction) {
+ var index = $scope.selectedMailFolder.folderActions.indexOf(folderAction);
if (index != -1) {
- $scope.selectedMailFolder.contextActions.splice(index, 1);
+ $scope.selectedMailFolder.folderActions.splice(index, 1);
} else {
- $scope.selectedMailFolder.contextActions.push(mailAction);
+ $scope.selectedMailFolder.folderActions.push(folderAction);
}
};
}]);
1
0
04 Jun '14
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>
1
0
r129 - 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 04 Jun '14
by echatellier@users.forge.codelutin.com 04 Jun '14
04 Jun '14
Author: echatellier
Date: 2014-06-04 10:08:56 +0200 (Wed, 04 Jun 2014)
New Revision: 129
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/129
Log:
Refactoring angularjs.
Affichage des groupes ldap dans l'interface
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/action/admin/UserFolderAction.java
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/ldap-input.jsp
trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/user-folder-input.jsp
trunk/faxtomail-ui-web/src/main/webapp/js/configuration.js
trunk/faxtomail-ui-web/src/main/webapp/js/user-folder.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-03 15:42:28 UTC (rev 128)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ConfigurationService.java 2014-06-04 08:08:56 UTC (rev 129)
@@ -43,11 +43,12 @@
import com.franciaflex.faxtomail.persistence.entities.EmailAccountImpl;
import com.franciaflex.faxtomail.persistence.entities.EmailAccountTopiaDao;
import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser;
+import com.franciaflex.faxtomail.persistence.entities.FaxToMailUserGroup;
+import com.franciaflex.faxtomail.persistence.entities.FaxToMailUserGroupTopiaDao;
import com.franciaflex.faxtomail.persistence.entities.FaxToMailUserTopiaDao;
import com.franciaflex.faxtomail.persistence.entities.MailFilter;
import com.franciaflex.faxtomail.persistence.entities.MailFilterTopiaDao;
import com.franciaflex.faxtomail.persistence.entities.MailFolder;
-import com.franciaflex.faxtomail.persistence.entities.MailFolderTopiaDao;
import com.franciaflex.faxtomail.services.FaxToMailServiceSupport;
import com.google.common.collect.Maps;
@@ -177,7 +178,7 @@
public List<FaxToMailUser> getAllUsers() {
FaxToMailUserTopiaDao faxToMailUserDao = getPersistenceContext().getFaxToMailUserDao();
- return faxToMailUserDao.forAll().setOrderByArguments(FaxToMailUser.PROPERTY_FIRST_NAME, FaxToMailUser.PROPERTY_LAST_NAME).findAll();
+ return faxToMailUserDao.forAll().setOrderByArguments(FaxToMailUser.PROPERTY_FIRST_NAME, FaxToMailUser.PROPERTY_LAST_NAME).find(0, 50);
}
public void saveUserFolders(Map<String, Collection<MailFolder>> userFolders) {
@@ -200,4 +201,9 @@
getPersistenceContext().commit();
}
+
+ public List<FaxToMailUserGroup> getAllGroups() {
+ FaxToMailUserGroupTopiaDao faxToMailUserGroupDao = getPersistenceContext().getFaxToMailUserGroupDao();
+ return faxToMailUserGroupDao.forAll().setOrderByArguments(FaxToMailUserGroup.PROPERTY_FULL_PATH).findAll();
+ }
}
Modified: trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/UserFolderAction.java
===================================================================
--- trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/UserFolderAction.java 2014-06-03 15:42:28 UTC (rev 128)
+++ trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/UserFolderAction.java 2014-06-04 08:08:56 UTC (rev 129)
@@ -36,6 +36,7 @@
import org.apache.struts2.convention.annotation.Result;
import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser;
+import com.franciaflex.faxtomail.persistence.entities.FaxToMailUserGroup;
import com.franciaflex.faxtomail.persistence.entities.MailFolder;
import com.franciaflex.faxtomail.services.service.ConfigurationService;
import com.franciaflex.faxtomail.services.service.MailFolderService;
@@ -54,6 +55,8 @@
protected List<FaxToMailUser> users;
+ protected List<FaxToMailUserGroup> groups;
+
protected Map<String, Collection<MailFolder>> userFolders;
public void setConfigurationService(ConfigurationService configurationService) {
@@ -69,11 +72,12 @@
public String input() throws Exception {
mailFolders = mailFolderService.getAllMailFolders();
users = configurationService.getAllUsers();
-
- userFolders = new HashMap<>();
+ groups = configurationService.getAllGroups();
+
+ /*userFolders = new HashMap<>();
for (FaxToMailUser user : users) {
userFolders.put(user.getTopiaId(), CollectionUtils.emptyIfNull(user.getAffectedFolders()));
- }
+ }*/
return INPUT;
}
@@ -85,15 +89,19 @@
configurationService.saveUserFolders(userFolders);
return SUCCESS;
}
-
+
public List<MailFolder> getMailFolders() {
return mailFolders;
}
-
+
public List<FaxToMailUser> getUsers() {
return users;
}
-
+
+ public List<FaxToMailUserGroup> getGroups() {
+ return groups;
+ }
+
public Map<String, Collection<MailFolder>> getUserFolders() {
return userFolders;
}
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-03 15:42:28 UTC (rev 128)
+++ trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp 2014-06-04 08:08:56 UTC (rev 129)
@@ -28,11 +28,9 @@
<html>
<head>
<title>Configuration</title>
+
<link rel="stylesheet" type="text/css" href="<s:url value='/webjars/select2/3.4.8/select2.css' />" />
<link rel="stylesheet" type="text/css" href="<s:url value='/nuiton-js-angular-ui-tree/angular-ui-tree.css' />" />
-
- <link rel="stylesheet" type="text/css" href="<s:url value='/css/faxtomail.css' />" />
-
<script type="text/javascript" src="<s:url value='/webjars/select2/3.4.8/select2.min.js' />"></script>
<script type="text/javascript" src="<s:url value='/webjars/select2/3.4.8/select2_locale_fr.js' />"></script>
<script type="text/javascript" src="<s:url value='/webjars/angularjs/1.2.16/angular.min.js' />"></script>
@@ -40,12 +38,12 @@
<script type="text/javascript" src="<s:url value='/nuiton-js-angular-ui-tree/angular-ui-tree.js' />"></script>
<script type="text/javascript" src="<s:url value='/webjars/angular-ui-sortable/0.12.2/sortable.min.js' />"></script>
+ <link rel="stylesheet" type="text/css" href="<s:url value='/css/faxtomail.css' />" />
<script type="text/javascript" src="<s:url value='/js/faxtomail.js' />"></script>
<script type="text/javascript" src="<s:url value='/js/configuration.js' />"></script>
<script type="text/javascript">
- angular.module('ConfigurationModule', ['FaxToMail', 'ui.tree', 'ui.sortable', 'ui.select2.sortable'])
- .value('ConfigurationData', {
+ ConfigurationModule.value('ConfigurationData', {
// enums
'mailActions': <s:property value="toJson(mailActions)" escapeHtml="false"/>,
'contextMailActions': <s:property value="toJson(contextMailActions)" escapeHtml="false"/>,
@@ -367,7 +365,7 @@
<caption>Aperçu</caption>
<thead>
<tr>
- <th ng-repeat="etatAttenteField in folderTableColumns">{{etatAttenteFields[etatAttenteField.id]}}</th>
+ <th ng-repeat="etatAttenteField in folderTableColumns">{{mailFields[etatAttenteField.id]}}</th>
</tr>
</thead>
</table>
Modified: trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/ldap-input.jsp
===================================================================
--- trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/ldap-input.jsp 2014-06-03 15:42:28 UTC (rev 128)
+++ trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/ldap-input.jsp 2014-06-04 08:08:56 UTC (rev 129)
@@ -29,8 +29,6 @@
<head>
<title>Ldap</title>
<link rel="stylesheet" type="text/css" href="<s:url value='/css/faxtomail.css' />" />
-
- <script type="text/javascript" src="<s:url value='/js/faxtomail.js' />"></script>
</head>
<body>
Modified: trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/user-folder-input.jsp
===================================================================
--- trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/user-folder-input.jsp 2014-06-03 15:42:28 UTC (rev 128)
+++ trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/user-folder-input.jsp 2014-06-04 08:08:56 UTC (rev 129)
@@ -28,22 +28,22 @@
<html>
<head>
<title>Dossiers mis en avant par utilisateur</title>
+
<link rel="stylesheet" type="text/css" href="<s:url value='/webjars/select2/3.4.8/select2.css' />" />
- <link rel="stylesheet" type="text/css" href="<s:url value='/css/faxtomail.css' />" />
-
<script type="text/javascript" src="<s:url value='/webjars/select2/3.4.8/select2.min.js' />"></script>
<script type="text/javascript" src="<s:url value='/webjars/select2/3.4.8/select2_locale_fr.js' />"></script>
<script type="text/javascript" src="<s:url value='/webjars/angularjs/1.2.16/angular.min.js' />"></script>
<script type="text/javascript" src="<s:url value='/js/select2sortable.js' />"></script>
+ <link rel="stylesheet" type="text/css" href="<s:url value='/css/faxtomail.css' />" />
<script type="text/javascript" src="<s:url value='/js/faxtomail.js' />"></script>
<script type="text/javascript" src="<s:url value='/js/user-folder.js' />"></script>
<script type="text/javascript">
- angular.module('UserFolderModule', ['FaxToMail', 'ui.select2.sortable'])
- .value('UserFolderData', {
+ UserFolderModule.value('UserFolderData', {
'mailFolders': <s:property value="toJson(mailFolders)" escapeHtml="false"/>,
'users': <s:property value="toJson(users)" escapeHtml="false"/>,
+ 'groups': <s:property value="toJson(groups)" escapeHtml="false"/>,
'userFolders': <s:property value="toJson(userFolders)" escapeHtml="false"/>
});
</script>
@@ -58,6 +58,12 @@
<s:form id="main_form" action="user-folder" method="post" ng-controller="UserFolderController">
<s:hidden name="userFoldersJson" value="{{userFolders}}" />
+ <div class="form-group">
+ <label>Groupe :
+ <select ng-model="selectedGroup" ng-options="group as group.fullPath for group in groups"></select>
+ </label>
+ </div>
+
<table id='table-snapshot' class="table table-bordered">
<thead>
<tr>
Modified: trunk/faxtomail-ui-web/src/main/webapp/js/configuration.js
===================================================================
--- trunk/faxtomail-ui-web/src/main/webapp/js/configuration.js 2014-06-03 15:42:28 UTC (rev 128)
+++ trunk/faxtomail-ui-web/src/main/webapp/js/configuration.js 2014-06-04 08:08:56 UTC (rev 129)
@@ -22,10 +22,12 @@
* #L%
*/
+var ConfigurationModule = angular.module('ConfigurationModule', ['FaxToMail', 'ui.tree', 'ui.sortable', 'ui.select2.sortable']);
+
/**
* Global configuration controller.
*/
-FaxToMailModule.controller('ConfigurationController', ['$scope', '$http', 'ConfigurationData',
+ConfigurationModule.controller('ConfigurationController', ['$scope', '$http', 'ConfigurationData',
function($scope, $http, ConfigurationData) {
//{Map} les actions possibles pour les etats d'attentes
$scope.mailActions = ConfigurationData.mailActions;
@@ -59,7 +61,7 @@
/**
* Misc tab controller.
*/
-FaxToMailModule.controller('ConfigurationMiscController', ['$scope', '$http', 'ConfigurationData',
+ConfigurationModule.controller('ConfigurationMiscController', ['$scope', '$http', 'ConfigurationData',
function($scope, $http, ConfigurationData) {
}]);
@@ -67,7 +69,7 @@
/**
* Etat attente tab controller.
*/
-FaxToMailModule.controller('ConfigurationWaitController', ['$scope', '$http', '$window', 'ConfigurationData',
+ConfigurationModule.controller('ConfigurationWaitController', ['$scope', '$http', '$window', 'ConfigurationData',
function($scope, $http, $window, ConfigurationData) {
//{Object} etat d'attente selectionné
@@ -128,7 +130,7 @@
/**
* Mail folder tab controller.
*/
-FaxToMailModule.controller('ConfigurationTreeController', ['$scope', '$http', '$window', 'ConfigurationData',
+ConfigurationModule.controller('ConfigurationTreeController', ['$scope', '$http', '$window', 'ConfigurationData',
function($scope, $http, $window, ConfigurationData) {
// {Object} selected mail folder
$scope.selectedMailFolder;
@@ -214,7 +216,7 @@
// fonction retournant l'ensemble des options disponibles
$scope.getObjectsData = function(term, result) {
var resultArray = [];
- angular.forEach($scope.fields, function(label, field) {
+ angular.forEach($scope.mailFields, function(label, field) {
resultArray.push({
id: field,
label: label
@@ -280,7 +282,7 @@
/**
* Mail filter tab controller.
*/
-FaxToMailModule.controller('ConfigurationFilterController', ['$scope', '$http', 'ConfigurationData',
+ConfigurationModule.controller('ConfigurationFilterController', ['$scope', '$http', 'ConfigurationData',
function($scope, $http, ConfigurationData) {
//{Array} Current mail filter list
$scope.mailFilters = ConfigurationData.mailFilters;
@@ -305,7 +307,7 @@
/**
* Search tab controller.
*/
-FaxToMailModule.controller('ConfigurationSearchController', ['$scope', '$http', 'ConfigurationData',
+ConfigurationModule.controller('ConfigurationSearchController', ['$scope', '$http', 'ConfigurationData',
function($scope, $http, ConfigurationData) {
//{Array} Options actuelle
$scope.searchDisplayColumns = [];
@@ -333,7 +335,7 @@
/**
* Email accounts controller.
*/
-FaxToMailModule.controller('ConfigurationEmailAccountsController', ['$scope', '$http', 'ConfigurationData',
+ConfigurationModule.controller('ConfigurationEmailAccountsController', ['$scope', '$http', 'ConfigurationData',
function($scope, $http, ConfigurationData) {
//{Array} Email accounts
$scope.emailAccounts = ConfigurationData.emailAccounts;
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-03 15:42:28 UTC (rev 128)
+++ trunk/faxtomail-ui-web/src/main/webapp/js/user-folder.js 2014-06-04 08:08:56 UTC (rev 129)
@@ -22,10 +22,12 @@
* #L%
*/
+var UserFolderModule = angular.module('UserFolderModule', ['FaxToMail', 'ui.select2.sortable']);
+
/**
* Global configuration controller.
*/
-FaxToMailModule.controller('UserFolderController', ['$scope', '$http', 'UserFolderData',
+UserFolderModule.controller('UserFolderController', ['$scope', '$http', 'UserFolderData',
function($scope, $http, UserFolderData) {
//{Array} mail folders
$scope.mailFolders = UserFolderData.mailFolders;
@@ -33,6 +35,8 @@
$scope.users = UserFolderData.users;
//{Map} Topia id : mailFolders
$scope.userFolders = UserFolderData.userFolders;
+ //{Array} Group list
+ $scope.groups = UserFolderData.groups;
// method privée recursive pour retourner l'ensemble des dossiers
var recursiveAddMailFolder = function(result, mailFolders) {
1
0
r128 - in trunk: faxtomail-persistence/src/main/xmi faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment
by echatellier@users.forge.codelutin.com 03 Jun '14
by echatellier@users.forge.codelutin.com 03 Jun '14
03 Jun '14
Author: echatellier
Date: 2014-06-03 17:42:28 +0200 (Tue, 03 Jun 2014)
New Revision: 128
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/128
Log:
refs #4662: Import des utilisateurs et groupes depuis le serveur LDAP
Added:
trunk/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/LdapServiceTest.java
Modified:
trunk/faxtomail-persistence/src/main/xmi/faxtomail.zargo
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/attachment/AttachmentEditorUIHandler.java
Modified: trunk/faxtomail-persistence/src/main/xmi/faxtomail.zargo
===================================================================
(Binary files differ)
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-03 07:31:14 UTC (rev 127)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/LdapService.java 2014-06-03 15:42:28 UTC (rev 128)
@@ -4,6 +4,7 @@
import java.util.Collection;
import java.util.List;
+import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -52,23 +53,58 @@
// ldapsearch -h ldap.codelutin.home -b "ou=People,DC=codelutin,DC=home" "objectClass=posixGroup"
// ldapsearch -h ldap.codelutin.home -b "ou=People,DC=codelutin,DC=home" "objectClass=account"
- String baseDN = "ou=People,DC=codelutin,DC=home";
- String filter = "(objectClass=account)";
+ String[] baseDNs = {
+ "OU=Utilisateurs,OU=Faber,OU=Utilisateurs,OU=Mac-Groupe,DC=mac-groupe,DC=net",
+ "OU=OU Informatique,OU=France-Fermetures,OU=Utilisateurs,OU=Mac-Groupe,DC=mac-groupe,DC=net",
+ // OU=Franciaflex,OU=Utilisateurs,OU=Mac-Groupe,DC=mac-groupe,DC=net
+ "OU=Utilisateurs,OU=Carros,OU=Franciaflex,OU=Utilisateurs,OU=Mac-Groupe,DC=mac-groupe,DC=net",
+ "OU=Utilisateurs,OU=Checy,OU=Franciaflex,OU=Utilisateurs,OU=Mac-Groupe,DC=mac-groupe,DC=net",
+ "OU=Utilisateurs,OU=Guipry,OU=Franciaflex,OU=Utilisateurs,OU=Mac-Groupe,DC=mac-groupe,DC=net",
+ "OU=Utilisateurs,OU=LeRheu,OU=Franciaflex,OU=Utilisateurs,OU=Mac-Groupe,DC=mac-groupe,DC=net",
+ "OU=Utilisateurs,OU=Luzech,OU=Franciaflex,OU=Utilisateurs,OU=Mac-Groupe,DC=mac-groupe,DC=net",
+ "OU=Utilisateurs,OU=MaisonAlfort,OU=Franciaflex,OU=Utilisateurs,OU=Mac-Groupe,DC=mac-groupe,DC=net",
+ "OU=Utilisateurs,OU=Mauguio,OU=Franciaflex,OU=Utilisateurs,OU=Mac-Groupe,DC=mac-groupe,DC=net",
+ "OU=Utilisateurs,OU=Migennes,OU=Franciaflex,OU=Utilisateurs,OU=Mac-Groupe,DC=mac-groupe,DC=net",
+ "OU=Utilisateurs,OU=Nomades,OU=Franciaflex,OU=Utilisateurs,OU=Mac-Groupe,DC=mac-groupe,DC=net",
+ "OU=Utilisateurs,OU=RocheToirin,OU=Franciaflex,OU=Utilisateurs,OU=Mac-Groupe,DC=mac-groupe,DC=net"
+ };
+ String filter = "(objectClass=user)";
+
LDAPConnection connection = null;
try {
connection = getLDAPConnection();
if (connection.isConnected()) {
- SearchResult searchResult = connection.search(baseDN, SearchScope.ONE, filter);
-
- List<SearchResultEntry> searchEntries = searchResult.getSearchEntries();
- for (SearchResultEntry searchEntry : searchEntries) {
- LdapUser user = new LdapUser();
- user.setLogin(searchEntry.getAttributeValue("uid"));
- user.setLogin(searchEntry.getAttributeValue("uid"));
- user.setLogin(searchEntry.getAttributeValue("uid"));
+ for (String baseDN : baseDNs) {
+ SearchResult searchResult = connection.search(baseDN, SearchScope.ONE, filter);
- results.add(user);
+ List<SearchResultEntry> searchEntries = searchResult.getSearchEntries();
+ for (SearchResultEntry searchEntry : searchEntries) {
+ LdapUser user = new LdapUser();
+ user.setLogin(searchEntry.getAttributeValue("userPrincipalName"));
+
+ // Parse name
+ String fullName = searchEntry.getAttributeValue("name");
+ if (fullName.indexOf(' ') != -1) {
+ String lastName = fullName.substring(0, fullName.indexOf(' '));
+ String firstName = fullName.substring(fullName.indexOf(' ') + 1);
+ user.setFirstName(firstName);
+ user.setLastName(lastName);
+ } else {
+ user.setFirstName("");
+ user.setLastName(fullName);
+ }
+
+ // parse groups
+ String[] groups = searchEntry.getAttributeValues("memberOf");
+ if (ArrayUtils.isNotEmpty(groups)) {
+ for (String group : groups) {
+ user.addGroup(group);
+ }
+ }
+
+ results.add(user);
+ }
}
}
} catch (LDAPException ex) {
@@ -121,9 +157,13 @@
Collection<String> groups = ldapUser.getGroups();
user.clearFaxToMailUserGroup();
for (String group : groups) {
- FaxToMailUserGroup userGroup = faxToMailUserGroupDao.forNameEquals(group).findUniqueOrNull();
+ String groupPath = getGroupFullPath(group);
+ String groupName = StringUtils.substringAfterLast(groupPath, "/");
+ FaxToMailUserGroup userGroup = faxToMailUserGroupDao.forNameEquals(groupName).findUniqueOrNull();
if (userGroup == null) {
- userGroup = faxToMailUserGroupDao.create(FaxToMailUserGroup.PROPERTY_NAME, group);
+ userGroup = faxToMailUserGroupDao.create(
+ FaxToMailUserGroup.PROPERTY_NAME, groupName,
+ FaxToMailUserGroup.PROPERTY_FULL_PATH, groupPath);
}
user.addFaxToMailUserGroup(userGroup);
}
@@ -135,7 +175,24 @@
faxtomailUserDao.create(user);
}
}
-
+
getPersistenceContext().commit();
}
+
+ /**
+ * Transform group CN to group path.
+ *
+ * Example:
+ * CN=Tout Franciaflex,OU=Listes de distribution,OU=Comptes Spéciaux,OU=Mac-Groupe,DC=mac-groupe,DC=net
+ * net/mac-groupe/Mac-Groupe/Comptes Spéciaux/Listes de distribution/Tout Franciaflex
+ *
+ * @param groupCN
+ * @return
+ */
+ protected String getGroupFullPath(String groupCN) {
+ String[] part = groupCN.split(",");
+ ArrayUtils.reverse(part);
+ String result = StringUtils.join(part, '/');
+ return result;
+ }
}
Added: trunk/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/LdapServiceTest.java
===================================================================
--- trunk/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/LdapServiceTest.java (rev 0)
+++ trunk/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/LdapServiceTest.java 2014-06-03 15:42:28 UTC (rev 128)
@@ -0,0 +1,42 @@
+package com.franciaflex.faxtomail.services.service;
+
+import java.io.IOException;
+import java.util.Collection;
+import java.util.HashSet;
+
+import org.apache.commons.lang3.StringUtils;
+import org.junit.Assume;
+import org.junit.Before;
+import org.junit.Test;
+
+import com.franciaflex.faxtomail.FaxToMailConfigurationOption;
+import com.franciaflex.faxtomail.services.service.ldap.LdapUser;
+
+public class LdapServiceTest extends AbstractFaxToMailServiceTest {
+
+ protected LdapService ldapService;
+
+ @Before
+ public void setUp() throws IOException {
+ ldapService = newService(LdapService.class);
+
+ // n'effectue pas les tests si la connexion n'est pas possible
+ Assume.assumeTrue(StringUtils.isNotBlank(getApplicationConfig().getLdapHost()));
+ }
+
+ @Test
+ public void testGetUsers() {
+
+ Collection<LdapUser> ldapUsers = ldapService.getAllLdapUsers();
+ Collection<String> groups = new HashSet<>();
+ int user = 0;
+ for (LdapUser ldapUser : ldapUsers) {
+ System.out.println("User : " + ldapUser.getLogin());
+ for (String group : ldapUser.getGroups()) {
+ groups.add(group);
+ }
+ user++;
+ }
+ System.out.println(String.format("%d users, %d groups", user, groups.size()));
+ }
+}
Property changes on: trunk/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/LdapServiceTest.java
___________________________________________________________________
Added: svn:eol-style
+ native
Added: svn:keywords
+ Author Date Id Revision HeadURL
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-03 07:31:14 UTC (rev 127)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentEditorUIHandler.java 2014-06-03 15:42:28 UTC (rev 128)
@@ -32,11 +32,14 @@
import com.franciaflex.faxtomail.ui.swing.util.FaxToMailUIUtil;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
+
import jaxx.runtime.SwingUtil;
import jaxx.runtime.validator.swing.SwingValidator;
+
import org.apache.commons.collections4.CollectionUtils;
import org.jdesktop.swingx.JXTable;
import org.jdesktop.swingx.decorator.HighlighterFactory;
+import org.nuiton.util.DesktopUtil;
import org.nuiton.util.FileUtil;
import java.awt.Component;
@@ -181,7 +184,7 @@
getModel().fireAttachmentOpened(attachment, true);
File file = attachment.getOriginalFile().getFile();
- Desktop desktop = FaxToMailUIUtil.getDesktopForBrowse();
+ Desktop desktop = FaxToMailUIUtil.getDesktopForOpen();
try {
desktop.open(file);
} catch (IOException e) {
1
0
03 Jun '14
Author: echatellier
Date: 2014-06-03 09:31:14 +0200 (Tue, 03 Jun 2014)
New Revision: 127
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/127
Log:
Refactoring des actions et actions contextuelles.
Added:
trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/MailAction.java
trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/MailField.java
Removed:
trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/ContextAction.java
trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/Field.java
trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/MainAction.java
Modified:
trunk/faxtomail-persistence/src/main/xmi/faxtomail.zargo
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/search/SearchToGroupUIHandler.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUIHandler.java
trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ConfigurationAction.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/js/configuration.js
Deleted: trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/ContextAction.java
===================================================================
--- trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/ContextAction.java 2014-06-03 07:30:29 UTC (rev 126)
+++ trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/ContextAction.java 2014-06-03 07:31:14 UTC (rev 127)
@@ -1,36 +0,0 @@
-package com.franciaflex.faxtomail.persistence.entities;
-
-/*
- * #%L
- * FaxToMail :: Persistence
- * $Id: Action.java 48 2014-04-25 13:43:04Z echatellier $
- * $HeadURL: https://svn.codelutin.com/faxtomail/trunk/faxtomail-persistence/src/main/ja… $
- * %%
- * 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 ContextAction {
-
- CHANGE_PRIORITY,
- AUTO_SAVE
-
-}
Deleted: trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/Field.java
===================================================================
--- trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/Field.java 2014-06-03 07:30:29 UTC (rev 126)
+++ trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/Field.java 2014-06-03 07:31:14 UTC (rev 127)
@@ -1,55 +0,0 @@
-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%
- */
-
-/**
- * Required email fields for specific {@link EtatAttente}.
- *
- * @author Eric Chatellier
- */
-public enum Field {
-
- SENDER,
- RECEPTION_DATE,
- EDI_CODE_NUMBER,
- OBJECT,
- PROJECT_REFERENCE,
- PRIORITY,
- RANGE_ROW,
- MAIL_FOLDER,
- CLIENT,
- DEMANDE_STATUS,
- DEMAND_TYPE,
- TAKEN_BY,
- ETAT_ATTENTE,
- ATTACHMENT
-
- //FAX,
- //RECIPIENT,
- //ARCHIVE_DATE,
- //COMPANY_REFERENCE,
- //ORIGINAL_EMAIL,
- //COMMENT
-}
Copied: trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/MailAction.java (from rev 125, trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/MainAction.java)
===================================================================
--- trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/MailAction.java (rev 0)
+++ trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/MailAction.java 2014-06-03 07:31:14 UTC (rev 127)
@@ -0,0 +1,49 @@
+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 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;
+ }
+}
Copied: trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/MailField.java (from rev 125, trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/Field.java)
===================================================================
--- trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/MailField.java (rev 0)
+++ trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/MailField.java 2014-06-03 07:31:14 UTC (rev 127)
@@ -0,0 +1,55 @@
+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%
+ */
+
+/**
+ * Required email fields for specific {@link EtatAttente}.
+ *
+ * @author Eric Chatellier
+ */
+public enum MailField {
+
+ SENDER,
+ RECEPTION_DATE,
+ EDI_CODE_NUMBER,
+ OBJECT,
+ PROJECT_REFERENCE,
+ PRIORITY,
+ RANGE_ROW,
+ MAIL_FOLDER,
+ CLIENT,
+ DEMANDE_STATUS,
+ DEMAND_TYPE,
+ TAKEN_BY,
+ ETAT_ATTENTE,
+ ATTACHMENT
+
+ //FAX,
+ //RECIPIENT,
+ //ARCHIVE_DATE,
+ //COMPANY_REFERENCE,
+ //ORIGINAL_EMAIL,
+ //COMMENT
+}
Deleted: trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/MainAction.java
===================================================================
--- trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/MainAction.java 2014-06-03 07:30:29 UTC (rev 126)
+++ trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/MainAction.java 2014-06-03 07:31:14 UTC (rev 127)
@@ -1,40 +0,0 @@
-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 MainAction {
-
- SAVE,
- TRANSMIT,
- PRINT,
- ARCHIVE,
- REPLY,
- GROUP
-
-}
Modified: trunk/faxtomail-persistence/src/main/xmi/faxtomail.zargo
===================================================================
(Binary files differ)
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-03 07:30:29 UTC (rev 126)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUIHandler.java 2014-06-03 07:31:14 UTC (rev 127)
@@ -29,7 +29,7 @@
import com.franciaflex.faxtomail.persistence.entities.DemandStatus;
import com.franciaflex.faxtomail.persistence.entities.Email;
import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser;
-import com.franciaflex.faxtomail.persistence.entities.Field;
+import com.franciaflex.faxtomail.persistence.entities.MailField;
import com.franciaflex.faxtomail.persistence.entities.History;
import com.franciaflex.faxtomail.persistence.entities.HistoryImpl;
import com.franciaflex.faxtomail.persistence.entities.HistoryType;
@@ -285,11 +285,11 @@
Collection<String> columns = null;
MailFolder selectedFolder = getModel().getSelectedFolder();
if (selectedFolder != null) {
- List<Field> tableColumns = selectedFolder.getFolderTableColumns();
+ List<MailField> tableColumns = selectedFolder.getFolderTableColumns();
if (tableColumns != null) {
- Collections2.transform(tableColumns, new Function<Field, String>() {
+ Collections2.transform(tableColumns, new Function<MailField, String>() {
@Override
- public String apply(Field field) {
+ public String apply(MailField field) {
return field.toString();
}
});
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchToGroupUIHandler.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchToGroupUIHandler.java 2014-06-03 07:30:29 UTC (rev 126)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchToGroupUIHandler.java 2014-06-03 07:31:14 UTC (rev 127)
@@ -28,7 +28,7 @@
import com.franciaflex.faxtomail.persistence.entities.Email;
import com.franciaflex.faxtomail.persistence.entities.EmailFilter;
import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser;
-import com.franciaflex.faxtomail.persistence.entities.Field;
+import com.franciaflex.faxtomail.persistence.entities.MailField;
import com.franciaflex.faxtomail.persistence.entities.MailFolder;
import com.franciaflex.faxtomail.services.service.EmailService;
import com.franciaflex.faxtomail.services.service.ReferentielService;
@@ -230,11 +230,11 @@
@Override
protected Collection<String> getColumns() {
Collection<String> columns = null;
- List<Field> tableColumns = getContext().getFaxToMailConfiguration().getSearchDisplayColumns();
+ List<MailField> tableColumns = getContext().getFaxToMailConfiguration().getSearchDisplayColumns();
if (tableColumns != null) {
- Collections2.transform(tableColumns, new Function<Field, String>() {
+ Collections2.transform(tableColumns, new Function<MailField, String>() {
@Override
- public String apply(Field field) {
+ public String apply(MailField field) {
return field.toString();
}
});
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUIHandler.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUIHandler.java 2014-06-03 07:30:29 UTC (rev 126)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUIHandler.java 2014-06-03 07:31:14 UTC (rev 127)
@@ -26,7 +26,7 @@
import com.franciaflex.faxtomail.persistence.entities.Email;
import com.franciaflex.faxtomail.persistence.entities.EmailFilter;
import com.franciaflex.faxtomail.persistence.entities.EtatAttente;
-import com.franciaflex.faxtomail.persistence.entities.Field;
+import com.franciaflex.faxtomail.persistence.entities.MailField;
import com.franciaflex.faxtomail.persistence.entities.HasLabel;
import com.franciaflex.faxtomail.services.service.ReferentielService;
import com.franciaflex.faxtomail.ui.swing.actions.SearchAction;
@@ -201,11 +201,11 @@
@Override
protected Collection<String> getColumns() {
Collection<String> columns = null;
- List<Field> tableColumns = getContext().getFaxToMailConfiguration().getSearchDisplayColumns();
+ List<MailField> tableColumns = getContext().getFaxToMailConfiguration().getSearchDisplayColumns();
if (tableColumns != null) {
- Collections2.transform(tableColumns, new Function<Field, String>() {
+ Collections2.transform(tableColumns, new Function<MailField, String>() {
@Override
- public String apply(Field field) {
+ public String apply(MailField field) {
return field.toString();
}
});
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-03 07:30:29 UTC (rev 126)
+++ trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ConfigurationAction.java 2014-06-03 07:31:14 UTC (rev 127)
@@ -34,14 +34,13 @@
import com.franciaflex.faxtomail.persistence.entities.Configuration;
import com.franciaflex.faxtomail.persistence.entities.ConfigurationImpl;
-import com.franciaflex.faxtomail.persistence.entities.ContextAction;
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.Field;
+import com.franciaflex.faxtomail.persistence.entities.MailField;
import com.franciaflex.faxtomail.persistence.entities.MailFilter;
import com.franciaflex.faxtomail.persistence.entities.MailFolder;
-import com.franciaflex.faxtomail.persistence.entities.MainAction;
+import com.franciaflex.faxtomail.persistence.entities.MailAction;
import com.franciaflex.faxtomail.services.service.ConfigurationService;
import com.franciaflex.faxtomail.services.service.MailFolderService;
import com.franciaflex.faxtomail.services.service.ReferentielService;
@@ -134,16 +133,17 @@
this.etatAttentes = getGson().fromJson(json, type);
}
- public Map<MainAction, String> getMainActions() {
- return getEnumAsMap(MainAction.values());
+ public Map<MailAction, String> getMailActions() {
+ return getEnumAsMap(MailAction.values());
}
- public Map<ContextAction, String> getContextActions() {
- return getEnumAsMap(ContextAction.values());
+ public Map<MailAction, String> getContextMailActions() {
+ // FIXME add filter on isContextual
+ return getEnumAsMap(MailAction.ARCHIVE, MailAction.PRINT, MailAction.REPLY);
}
- public Map<Field, String> getFields() {
- return getEnumAsMap(Field.values());
+ public Map<MailField, String> getMailFields() {
+ return getEnumAsMap(MailField.values());
}
public List<MailFolder> getMailFolders() {
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-03 07:30:29 UTC (rev 126)
+++ trunk/faxtomail-ui-web/src/main/resources/i18n/faxtomail-ui-web_fr_FR.properties 2014-06-03 07:31:14 UTC (rev 127)
@@ -1,29 +1,27 @@
-com.franciaflex.faxtomail.persistence.entities.ContextAction.AUTO_SAVE=Sauver automatiquement
-com.franciaflex.faxtomail.persistence.entities.ContextAction.CHANGE_PRIORITY=Changer la priorité
-com.franciaflex.faxtomail.persistence.entities.Field.ARCHIVE_DATE=Date d'archive
-com.franciaflex.faxtomail.persistence.entities.Field.ATTACHMENT=Pièces jointes
-com.franciaflex.faxtomail.persistence.entities.Field.CLIENT=Client
-com.franciaflex.faxtomail.persistence.entities.Field.COMMENT=Commentaire
-com.franciaflex.faxtomail.persistence.entities.Field.COMPANY_REFERENCE=Référence
-com.franciaflex.faxtomail.persistence.entities.Field.DEMANDE_STATUS=Statut de demande
-com.franciaflex.faxtomail.persistence.entities.Field.DEMAND_TYPE=Type de demande
-com.franciaflex.faxtomail.persistence.entities.Field.EDI_CODE_NUMBER=Code EDI
-com.franciaflex.faxtomail.persistence.entities.Field.ETAT_ATTENTE=État d'attente
-com.franciaflex.faxtomail.persistence.entities.Field.FAX=Fax
-com.franciaflex.faxtomail.persistence.entities.Field.MAIL_FOLDER=Dossier
-com.franciaflex.faxtomail.persistence.entities.Field.OBJECT=Objet
-com.franciaflex.faxtomail.persistence.entities.Field.ORIGINAL_EMAIL=Email original
-com.franciaflex.faxtomail.persistence.entities.Field.PRIORITY=Priorité
-com.franciaflex.faxtomail.persistence.entities.Field.PROJECT_REFERENCE=Réference projet
-com.franciaflex.faxtomail.persistence.entities.Field.RANGE_ROW=Gamme
-com.franciaflex.faxtomail.persistence.entities.Field.RECEPTION_DATE=Date de réception
-com.franciaflex.faxtomail.persistence.entities.Field.RECIPIENT=Destinataire
-com.franciaflex.faxtomail.persistence.entities.Field.SENDER=Expéditeur
-com.franciaflex.faxtomail.persistence.entities.Field.TAKEN_BY=Pris par
-com.franciaflex.faxtomail.persistence.entities.MainAction.ARCHIVE=Archiver
-com.franciaflex.faxtomail.persistence.entities.MainAction.GROUP=Grouper
-com.franciaflex.faxtomail.persistence.entities.MainAction.PRINT=Imprimer
-com.franciaflex.faxtomail.persistence.entities.MainAction.REPLY=Repondre
-com.franciaflex.faxtomail.persistence.entities.MainAction.SAVE=Sauver
-com.franciaflex.faxtomail.persistence.entities.MainAction.TRANSMIT=Déplacer
+com.franciaflex.faxtomail.persistence.entities.MailAction.ARCHIVE=Archiver
+com.franciaflex.faxtomail.persistence.entities.MailAction.GROUP=Grouper
+com.franciaflex.faxtomail.persistence.entities.MailAction.PRINT=Imprimer
+com.franciaflex.faxtomail.persistence.entities.MailAction.REPLY=Repondre
+com.franciaflex.faxtomail.persistence.entities.MailAction.SAVE=Sauver
+com.franciaflex.faxtomail.persistence.entities.MailAction.TRANSMIT=Déplacer
+com.franciaflex.faxtomail.persistence.entities.MailField.ARCHIVE_DATE=Date d'archive
+com.franciaflex.faxtomail.persistence.entities.MailField.ATTACHMENT=Pièces jointes
+com.franciaflex.faxtomail.persistence.entities.MailField.CLIENT=Client
+com.franciaflex.faxtomail.persistence.entities.MailField.COMMENT=Commentaire
+com.franciaflex.faxtomail.persistence.entities.MailField.COMPANY_REFERENCE=Référence
+com.franciaflex.faxtomail.persistence.entities.MailField.DEMANDE_STATUS=Statut de demande
+com.franciaflex.faxtomail.persistence.entities.MailField.DEMAND_TYPE=Type de demande
+com.franciaflex.faxtomail.persistence.entities.MailField.EDI_CODE_NUMBER=Code EDI
+com.franciaflex.faxtomail.persistence.entities.MailField.ETAT_ATTENTE=État d'attente
+com.franciaflex.faxtomail.persistence.entities.MailField.FAX=Fax
+com.franciaflex.faxtomail.persistence.entities.MailField.MAIL_FOLDER=Dossier
+com.franciaflex.faxtomail.persistence.entities.MailField.OBJECT=Objet
+com.franciaflex.faxtomail.persistence.entities.MailField.ORIGINAL_EMAIL=Email original
+com.franciaflex.faxtomail.persistence.entities.MailField.PRIORITY=Priorité
+com.franciaflex.faxtomail.persistence.entities.MailField.PROJECT_REFERENCE=Réference projet
+com.franciaflex.faxtomail.persistence.entities.MailField.RANGE_ROW=Gamme
+com.franciaflex.faxtomail.persistence.entities.MailField.RECEPTION_DATE=Date de réception
+com.franciaflex.faxtomail.persistence.entities.MailField.RECIPIENT=Destinataire
+com.franciaflex.faxtomail.persistence.entities.MailField.SENDER=Expéditeur
+com.franciaflex.faxtomail.persistence.entities.MailField.TAKEN_BY=Pris par
faxtomail.email.projectReference.default=
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-03 07:30:29 UTC (rev 126)
+++ trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp 2014-06-03 07:31:14 UTC (rev 127)
@@ -47,9 +47,9 @@
angular.module('ConfigurationModule', ['FaxToMail', 'ui.tree', 'ui.sortable', 'ui.select2.sortable'])
.value('ConfigurationData', {
// enums
- 'mainActions': <s:property value="toJson(mainActions)" escapeHtml="false"/>,
- 'contextActions': <s:property value="toJson(contextActions)" escapeHtml="false"/>,
- 'fields': <s:property value="toJson(fields)" escapeHtml="false"/>,
+ 'mailActions': <s:property value="toJson(mailActions)" escapeHtml="false"/>,
+ 'contextMailActions': <s:property value="toJson(contextMailActions)" escapeHtml="false"/>,
+ 'mailFields': <s:property value="toJson(mailFields)" escapeHtml="false"/>,
// datas
'etatAttentes' : <s:property value="toJson(etatAttentes)" escapeHtml="false"/>,
'mailFolders': <s:property value="toJson(mailFolders)" escapeHtml="false"/>,
@@ -119,14 +119,14 @@
<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="(field,label) in fields">
- <input type="checkbox" ng-checked="selectedEtatAttente.fields.indexOf(field) != -1"
- ng-click="changeEtatAttenteField(field)"> {{label}}
+ <label class="checkbox" ng-repeat="(mailField,label) in mailFields">
+ <input type="checkbox" ng-checked="selectedEtatAttente.fields.indexOf(mailField) != -1"
+ ng-click="changeEtatAttenteField(mailField)"> {{label}}
</label>
Actions autorisées pour l'état d'attente :
- <label class="checkbox" ng-repeat="(mainAction,label) in mainActions">
- <input type="checkbox" ng-checked="selectedEtatAttente.mainActions.indexOf(mainAction) != -1"
- ng-click="changeEtatAttenteAction(mainAction)"> {{label}}
+ <label class="checkbox" ng-repeat="(mailAction,label) in mailActions">
+ <input type="checkbox" ng-checked="selectedEtatAttente.mailActions.indexOf(mailAction) != -1"
+ ng-click="changeEtatAttenteAction(mailAction)"> {{label}}
</label>
</div>
<div class="col-md-7" ng-if="!selectedEtatAttente">
@@ -335,9 +335,9 @@
</div>
<div id="collapse5" class="panel-collapse collapse">
<div class="panel-body">
- <label class="checkbox" ng-repeat="(contextAction,label) in contextActions">
- <input type="checkbox" ng-checked="selectedMailFolder.contextActions.indexOf(contextAction) != -1"
- ng-click="changeFolderAction(contextAction)"> {{label}}
+ <label class="checkbox" ng-repeat="(contextMailAction,label) in contextMailActions">
+ <input type="checkbox" ng-checked="selectedMailFolder.contextActions.indexOf(contextMailAction) != -1"
+ ng-click="changeFolderAction(contextMailAction)"> {{label}}
</label>
</div>
</div>
Modified: trunk/faxtomail-ui-web/src/main/webapp/js/configuration.js
===================================================================
--- trunk/faxtomail-ui-web/src/main/webapp/js/configuration.js 2014-06-03 07:30:29 UTC (rev 126)
+++ trunk/faxtomail-ui-web/src/main/webapp/js/configuration.js 2014-06-03 07:31:14 UTC (rev 127)
@@ -28,11 +28,11 @@
FaxToMailModule.controller('ConfigurationController', ['$scope', '$http', 'ConfigurationData',
function($scope, $http, ConfigurationData) {
//{Map} les actions possibles pour les etats d'attentes
- $scope.mainActions = ConfigurationData.mainActions;
+ $scope.mailActions = ConfigurationData.mailActions;
//{Map} les champs obligatoires possibles
- $scope.fields = ConfigurationData.fields;
+ $scope.mailFields = ConfigurationData.mailFields;
//{Map} les actions contextuelles possibles pour les dossiers
- $scope.contextActions = ConfigurationData.contextActions;
+ $scope.contextMailActions = ConfigurationData.contextMailActions;
//{Array} les etats d'attentes disponibles
$scope.etatAttentes = ConfigurationData.etatAttentes;
//{Array} mail folders
@@ -105,22 +105,22 @@
// selection/deselection d'une action
$scope.changeEtatAttenteAction = function(action) {
- var index = $scope.selectedEtatAttente.mainActions.indexOf(action);
+ var index = $scope.selectedEtatAttente.mailActions.indexOf(action);
if (index != -1) {
- $scope.selectedEtatAttente.mainActions.splice(index, 1);
+ $scope.selectedEtatAttente.mailActions.splice(index, 1);
} else {
- $scope.selectedEtatAttente.mainActions.push(action);
+ $scope.selectedEtatAttente.mailActions.push(action);
}
};
// selection/deselection d'un champ
- $scope.changeEtatAttenteField = function(field) {
+ $scope.changeEtatAttenteField = function(mailField) {
- var index = $scope.selectedEtatAttente.fields.indexOf(field);
+ var index = $scope.selectedEtatAttente.fields.indexOf(mailField);
if (index != -1) {
$scope.selectedEtatAttente.fields.splice(index, 1);
} else {
- $scope.selectedEtatAttente.fields.push(field);
+ $scope.selectedEtatAttente.fields.push(mailField);
}
};
}]);
@@ -267,12 +267,12 @@
};
// selection/deselection d'une action possible du menu contextuel pour ce dossier
- $scope.changeFolderAction = function(contextAction) {
- var index = $scope.selectedMailFolder.contextActions.indexOf(contextAction);
+ $scope.changeFolderAction = function(mailAction) {
+ var index = $scope.selectedMailFolder.contextActions.indexOf(mailAction);
if (index != -1) {
$scope.selectedMailFolder.contextActions.splice(index, 1);
} else {
- $scope.selectedMailFolder.contextActions.push(contextAction);
+ $scope.selectedMailFolder.contextActions.push(mailAction);
}
};
}]);
@@ -319,9 +319,9 @@
// fonction retournant l'ensemble des options disponibles
$scope.getObjectsData = function(term, result) {
var resultArray = [];
- angular.forEach($scope.fields, function(label, field) {
+ angular.forEach($scope.mailFields, function(label, mailField) {
resultArray.push({
- id: field,
+ id: mailField,
label: label
});
});
1
0
r126 - trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/job
by echatellier@users.forge.codelutin.com 03 Jun '14
by echatellier@users.forge.codelutin.com 03 Jun '14
03 Jun '14
Author: echatellier
Date: 2014-06-03 09:30:29 +0200 (Tue, 03 Jun 2014)
New Revision: 126
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/126
Log:
Correction d'une erreur sur la gestion des pieces jointes lors de la reception des mails.
Modified:
trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/job/MailFilterJob.java
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-02 21:06:54 UTC (rev 125)
+++ trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/job/MailFilterJob.java 2014-06-03 07:30:29 UTC (rev 126)
@@ -257,14 +257,19 @@
emailSource.append("\n").append(originalContent);
email.setOriginalEmail(emailSource.toString());
+ List<Attachment> attachements = new ArrayList<>();
if (message.isMimeType("multipart/*")) {
- decomposeMultipartEmail(message, email, emailService);
+ decomposeMultipartEmail(attachements, message, email, emailService);
// } else {
// String content = IOUtils.toString(message.getInputStream(), charset);
// email.setPlainContent(content);
}
- emailService.saveEmail(email, null, modifiedProperties.toArray(new String[modifiedProperties.size()]));
+ emailService.saveEmail(email,
+ attachements,
+ email.getClient() != null ? email.getClient().getCode() : null,
+ null,
+ modifiedProperties.toArray(new String[modifiedProperties.size()]));
message.setFlag(Flags.Flag.DELETED, true);
}
@@ -285,11 +290,12 @@
* @param emailService email service
* @throws Exception
*/
- protected void decomposeMultipartEmail(Part part, Email email, EmailService emailService) throws Exception {
+ protected void decomposeMultipartEmail(List<Attachment> attachments, Part part, Email email, EmailService emailService) throws Exception {
DataSource dataSource = part.getDataHandler().getDataSource();
MimeMultipart mimeMultipart = new MimeMultipart(dataSource);
int multiPartCount = mimeMultipart.getCount();
+
for (int j = 0; j < multiPartCount; j++) {
BodyPart bp = mimeMultipart.getBodyPart(j);
Charset charset = getCharset(bp);
@@ -306,7 +312,7 @@
// if it is multipart part, decompose it
} else if (bp.isMimeType("multipart/*")) {
- decomposeMultipartEmail(bp, email, emailService);
+ decomposeMultipartEmail(attachments, bp, email, emailService);
// else, this is an attachment
} else {
@@ -347,7 +353,8 @@
attachmentFile.setFilename(dh.getName());
attachment.setOriginalFile(attachmentFile);
- email.addAttachment(attachment);
+ //email.addAttachment(attachment);
+ attachments.add(attachment);
}
}
}
1
0