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
May 2014
- 3 participants
- 78 discussions
r91 - in trunk: . faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply faxtomail-ui-swing/src/main/resources faxtomail-ui-swing/src/main/resources/i18n
by kmorin@users.forge.codelutin.com 23 May '14
by kmorin@users.forge.codelutin.com 23 May '14
23 May '14
Author: kmorin
Date: 2014-05-23 10:39:41 +0200 (Fri, 23 May 2014)
New Revision: 91
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/91
Log:
downgrade swingx version
Modified:
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUI.jaxx
trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_fr_FR.properties
trunk/faxtomail-ui-swing/src/main/resources/log4j.properties
trunk/pom.xml
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUI.jaxx
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUI.jaxx 2014-05-22 16:02:33 UTC (rev 90)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUI.jaxx 2014-05-23 08:39:41 UTC (rev 91)
@@ -28,11 +28,10 @@
java.awt.CardLayout
java.awt.Color
+ java.awt.FlowLayout
jaxx.runtime.swing.CardLayout2Ext
- org.jdesktop.swingx.WrapLayout
-
static org.nuiton.i18n.I18n.t
</import>
@@ -108,7 +107,7 @@
<JLabel id="attachmentsLabel" constraints='BorderLayout.NORTH'/>
<JScrollPane id="attachmentsContainer"
constraints='BorderLayout.CENTER'>
- <JPanel id="attachmentsPanel" layout="{new WrapLayout(WrapLayout.LEFT)}"/>
+ <JPanel id="attachmentsPanel" layout="{new FlowLayout(FlowLayout.LEADING)}"/>
</JScrollPane>
<Table fill="both"
id="addAttachmentForm"
Modified: trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_fr_FR.properties
===================================================================
--- trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_fr_FR.properties 2014-05-22 16:02:33 UTC (rev 90)
+++ trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_fr_FR.properties 2014-05-23 08:39:41 UTC (rev 91)
@@ -198,22 +198,22 @@
faxtomail.historyList.title=Historique
faxtomail.i18n.deleteCache.error=
faxtomail.i18n.mkDir.error=
-faxtomail.main.action.configuration=
+faxtomail.main.action.configuration=Configuration
faxtomail.main.action.configuration.mnemonic=
-faxtomail.main.action.configuration.tip=
-faxtomail.main.action.demandeList=
-faxtomail.main.action.demandeList.tip=
-faxtomail.main.action.exit=
-faxtomail.main.action.exit.tip=
-faxtomail.main.action.recherche=
-faxtomail.main.action.recherche.tip=
-faxtomail.main.menu.file=
-faxtomail.main.menu.file.tip=
+faxtomail.main.action.configuration.tip=Menu configuration
+faxtomail.main.action.demandeList=Gestion des fax
+faxtomail.main.action.demandeList.tip=Gestion des fax
+faxtomail.main.action.exit=Quitter
+faxtomail.main.action.exit.tip=Quitter l'application
+faxtomail.main.action.goto.previousScreen.tip=
+faxtomail.main.action.recherche=Recherche
+faxtomail.main.action.recherche.tip=Recherche de demandes archivées
+faxtomail.main.action.reloadFaxToMail=
+faxtomail.main.menu.file=Fichier
+faxtomail.main.menu.file.tip=Menu fichier
faxtomail.main.title.application=FaxToMail
faxtomail.main.title.applicationName=FaxToMail
faxtomail.main.title.nodb=
-faxtomail.menu.file=Fichier
-faxtomail.menu.file.tip=Menu fichier
faxtomail.pdfEditor.action.cancel=Annuler
faxtomail.pdfEditor.action.cancel.tip=Ne pas enregistrer les changements et fermer
faxtomail.pdfEditor.action.validate=Enregistrer
Modified: trunk/faxtomail-ui-swing/src/main/resources/log4j.properties
===================================================================
--- trunk/faxtomail-ui-swing/src/main/resources/log4j.properties 2014-05-22 16:02:33 UTC (rev 90)
+++ trunk/faxtomail-ui-swing/src/main/resources/log4j.properties 2014-05-23 08:39:41 UTC (rev 91)
@@ -19,7 +19,7 @@
# <http://www.gnu.org/licenses/gpl-3.0.html>.
# #L%
###
-log4j.rootCategory=DEBUG, console
+log4j.rootCategory=WARN, console
log4j.appender.console=org.apache.log4j.ConsoleAppender
log4j.appender.console.layout=org.apache.log4j.PatternLayout
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2014-05-22 16:02:33 UTC (rev 90)
+++ trunk/pom.xml 2014-05-23 08:39:41 UTC (rev 91)
@@ -110,7 +110,8 @@
<h2Version>1.3.176</h2Version>
<jaxxVersion>2.8.6-SNAPSHOT</jaxxVersion>
- <swingXVersion>1.6.5-1</swingXVersion>
+ <!-- do not upgrade to 1.6.5-1 -->
+ <swingXVersion>1.6.4</swingXVersion>
<xworkVersion>2.3.15.1</xworkVersion>
<struts2Version>2.3.16.3</struts2Version>
1
0
r90 - in trunk: faxtomail-persistence/src/main/xmi faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande 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/css faxtomail-ui-web/src/main/webapp/js
by echatellier@users.forge.codelutin.com 22 May '14
by echatellier@users.forge.codelutin.com 22 May '14
22 May '14
Author: echatellier
Date: 2014-05-22 18:02:33 +0200 (Thu, 22 May 2014)
New Revision: 90
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/90
Log:
refs #4662: Sauvegarde de l'ordre des colonnes de l'interface de recherche
Added:
trunk/faxtomail-ui-web/src/main/webapp/js/select2sortable.js
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-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/css/configuration.css
trunk/faxtomail-ui-web/src/main/webapp/js/configuration.js
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-05-22 13:25:20 UTC (rev 89)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUIHandler.java 2014-05-22 16:02:33 UTC (rev 90)
@@ -284,7 +284,7 @@
@Override
protected Collection<String> getColumns() {
MailFolder selectedFolder = getModel().getSelectedFolder();
- return selectedFolder != null ? selectedFolder.getTableColumns() : null;
+ return selectedFolder != null ? selectedFolder.getFolderDisplayColumn() : null;
}
@Override
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-05-22 13:25:20 UTC (rev 89)
+++ trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ConfigurationAction.java 2014-05-22 16:02:33 UTC (rev 90)
@@ -34,6 +34,7 @@
import com.franciaflex.faxtomail.persistence.entities.Action;
import com.franciaflex.faxtomail.persistence.entities.Configuration;
+import com.franciaflex.faxtomail.persistence.entities.ConfigurationImpl;
import com.franciaflex.faxtomail.persistence.entities.EtatAttente;
import com.franciaflex.faxtomail.persistence.entities.Field;
import com.franciaflex.faxtomail.persistence.entities.MailFolder;
@@ -116,6 +117,9 @@
}
public Configuration getConfiguration() {
+ if (configuration == null) {
+ return new ConfigurationImpl(); // just pour eviter les traces struts
+ }
return configuration;
}
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-05-22 13:25:20 UTC (rev 89)
+++ trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp 2014-05-22 16:02:33 UTC (rev 90)
@@ -35,17 +35,19 @@
<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>
<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='/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'])
+ angular.module('ConfigurationModule', ['FaxToMail', 'ui.tree', 'ui.select2.sortable'])
.value('ConfigurationData', {
'etatAttentes' : <s:property value="toJson(etatAttentes)" escapeHtml="false"/>,
'etatAttenteActions': <s:property value="toJson(etatAttenteActions)" escapeHtml="false"/>,
'etatAttenteFields': <s:property value="toJson(etatAttenteFields)" escapeHtml="false"/>,
- 'mailFolders': <s:property value="toJson(mailFolders)" escapeHtml="false"/>
+ 'mailFolders': <s:property value="toJson(mailFolders)" escapeHtml="false"/>,
+ 'searchDisplayColumns': <s:property value="toJson(configuration.searchDisplayColumns)" escapeHtml="false"/>,
});
</script>
</head>
@@ -76,8 +78,8 @@
<li><a href="#tabs-wait" data-toggle="tab">États d'attente</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-rights" data-toggle="tab">Droits</a></li>
- <li><a href="#tabs-email-accounts" data-toggle="tab">Comptes mails</a></li> -->
+ <li><a href="#tabs-search" data-toggle="tab">Recherche</a></li>
+ <!-- <li><a href="#tabs-email-accounts" data-toggle="tab">Comptes mails</a></li> -->
</ul>
<div class="tab-content active" ng-controller="ConfigurationMiscController">
@@ -324,9 +326,28 @@
</button>
</div>
- <!-- <div class="container form-actions">
- <button type="submit" class="btn btn-primary pull-right">Valider</button>
- </div> -->
+ <div id="tabs-search" class="tab-pane" ng-controller="ConfigurationSearchController">
+ <input type="hidden" name="configuration.searchDisplayColumns" value="{{searchDisplayColumn.id}}" ng-repeat="searchDisplayColumn in searchDisplayColumns"/>
+
+ <div class="control-group">
+ <label class="control-label" for="tableColumns">Champs à afficher dans le tableau (l'ordre peut être changé en faisant un glisser/déposer sur les champs)</label>
+
+ <div class="controls">
+ <input type="hidden" ui-select2-sortable ng-model="searchDisplayColumns" simple-query="getObjectsData" multiple sortable>
+ </div>
+
+ <div>
+ <table id='table-snapshot' class="table table-bordered">
+ <caption>Aperçu</caption>
+ <thead>
+ <tr>
+ <th ng-repeat="etatAttenteField in searchDisplayColumns">{{etatAttenteFields[etatAttenteField.id]}}</th>
+ </tr>
+ </thead>
+ </table>
+ </div>
+ </div>
+ </div>
<nav class="navbar navbar-default navbar-fixed-bottom">
<div class="container">
Modified: trunk/faxtomail-ui-web/src/main/webapp/css/configuration.css
===================================================================
--- trunk/faxtomail-ui-web/src/main/webapp/css/configuration.css 2014-05-22 13:25:20 UTC (rev 89)
+++ trunk/faxtomail-ui-web/src/main/webapp/css/configuration.css 2014-05-22 16:02:33 UTC (rev 90)
@@ -41,6 +41,11 @@
padding: 10px 10px;
cursor:default;
}
+
+.select2-container {
+ width: 100%;
+}
+
.angular-ui-tree-handle.bg-warning {
background: #fcf8e3;
}
Modified: trunk/faxtomail-ui-web/src/main/webapp/js/configuration.js
===================================================================
--- trunk/faxtomail-ui-web/src/main/webapp/js/configuration.js 2014-05-22 13:25:20 UTC (rev 89)
+++ trunk/faxtomail-ui-web/src/main/webapp/js/configuration.js 2014-05-22 16:02:33 UTC (rev 90)
@@ -4,8 +4,12 @@
*/
FaxToMailModule.controller('ConfigurationController', ['$scope', '$http', 'ConfigurationData',
function($scope, $http, ConfigurationData) {
- //mail folders
+ //{Array} mail folders
$scope.mailFolders = ConfigurationData.mailFolders;
+ //{Map} les actions possibles pour les etats d'attentes
+ $scope.etatAttenteActions = ConfigurationData.etatAttenteActions;
+ //{Map} les champs obligatoires possibles
+ $scope.etatAttenteFields = ConfigurationData.etatAttenteFields;
}]);
/**
@@ -23,10 +27,6 @@
function($scope, $http, ConfigurationData) {
//{Array} les etats d'attentes disponibles
$scope.etatAttentes = ConfigurationData.etatAttentes;
- //{Array} les actions possibles pour les etats d'attentes
- $scope.etatAttenteActions = ConfigurationData.etatAttenteActions;
- //{Array} les champs obligatoires possibles
- $scope.etatAttenteFields = ConfigurationData.etatAttenteFields;
//{Object} etat d'attente selectionné
$scope.selectedEtatAttente;
@@ -141,3 +141,35 @@
delete $scope.selectedFolder;
};
}]);
+
+
+/**
+ * Search tab controller.
+ */
+FaxToMailModule.controller('ConfigurationSearchController', ['$scope', '$http', 'ConfigurationData',
+ function($scope, $http, ConfigurationData) {
+ //{Object} Option select2
+ $scope.searchSelectOptions = {
+ 'multiple': true/*,
+ 'tags': Object.keys($scope.etatAttenteFields)*/
+ };
+ //{Array} Options actuelle
+ $scope.searchDisplayColumns = [];
+ angular.forEach(ConfigurationData.searchDisplayColumns, function(searchDisplayColumn) {
+ $scope.searchDisplayColumns.push({
+ id: searchDisplayColumn,
+ label: $scope.etatAttenteFields[searchDisplayColumn]
+ });
+ });
+
+ $scope.getObjectsData = function(term, result) {
+ var result2 = [];
+ angular.forEach($scope.etatAttenteFields, function(v, k) {
+ result2.push({
+ id: k,
+ label: v
+ });
+ });
+ result(result2);
+ };
+}]);
Added: trunk/faxtomail-ui-web/src/main/webapp/js/select2sortable.js
===================================================================
--- trunk/faxtomail-ui-web/src/main/webapp/js/select2sortable.js (rev 0)
+++ trunk/faxtomail-ui-web/src/main/webapp/js/select2sortable.js 2014-05-22 16:02:33 UTC (rev 90)
@@ -0,0 +1,254 @@
+/**
+ * Enhanced Select2 Dropmenus
+ *
+ * @AJAX Mode - When in this mode, your value will be an object (or array of objects) of the data used by Select2
+ * This change is so that you do not have to do an additional query yourself on top of Select2's own query
+ * @params [options] {object} The configuration options passed to $.fn.select2(). Refer to the documentation
+ */
+angular.module('ui.select2.sortable', []).directive('uiSelect2Sortable', ['$timeout', '$filter', function ($timeout, $filter) {
+ return {
+ require: 'ngModel',
+ restrict: 'A',
+ transclude: true,
+ scope: {
+ ngModel: '=',
+ allowClear: '=?',
+ simpleQuery: '=?',
+ simpleData: '=?',
+ query: '=?',
+ toId: '=?',
+ toText: '=?',
+ sortResults: '=?',
+ minimumInputLength: '=?',
+ onSelect: '=?'
+ },
+ link: function (scope, element, attrs, ngModel) {
+ //create a function to find an id into object
+ if (!scope.toId) {
+ scope.toId = function (item) {
+ if (item._id) {
+ return item._id;
+ }
+ if (item.id) {
+ return item.id;
+ }
+ if (item.uri) {
+ return item.uri;
+ }
+ if (item.href) {
+ return item.href;
+ }
+ if (item.resource) {
+ return item.resource;
+ }
+ return item;
+ };
+ }
+
+ //create a function to find display value into object
+ if (!scope.toText) {
+ scope.toText = function (item) {
+ if (item.text) {
+ return item.text;
+ }
+ if (item.name) {
+ return item.name;
+ }
+ if (item.label) {
+ return item.label;
+ }
+ return item;
+ };
+ }
+
+ //create a function to find display value into object
+ //this js function is slower than the underscoreJS function below.
+ //I recommand you to override this function by the underscoreJS one
+
+// $scope.sortResults = function (results, container, query) {
+// return _.sortBy(results, function(item) {
+// return item.text;
+// });
+// };
+
+ if (!scope.sortResults) {
+ scope.sortResults = function (results, container, query) {
+ // use the built in javascript sort function
+ return results.sort(function (a, b) {
+ if (a.text > b.text) {
+ return 1;
+ } else if (a.text < b.text) {
+ return -1;
+ } else {
+ return 0;
+ }
+ });
+ };
+ }
+
+ //prepare options for the select2 element
+ scope.opts = {
+ multiple: angular.isDefined(attrs.multiple) || false,
+ sortable: angular.isDefined(attrs.sortable) || false,
+ minimumInputLength: scope.minimumInputLength || 0,
+ query: scope.query,
+ sortResults: scope.sortResults,
+ allowClear: scope.allowClear || false
+ };
+
+ // Convert from Select2 view-model to Angular view-model.
+ scope.convertToAngularModel = function (select2_data) {
+ var model;
+ if (angular.isArray(select2_data)) {
+ model = [];
+ angular.forEach(select2_data, function (value) {
+ model.push(value._data);
+ });
+ } else {
+ if (select2_data && select2_data._data) {
+ model = select2_data._data;
+ } else {
+ model = select2_data;
+ }
+ }
+ return model;
+ };
+
+ // Convert from Angular view-model to Select2 view-model.
+ scope.convertToSelect2Model = function (angular_data) {
+ if (angular.isArray(angular_data)) {
+ var model = [];
+ angular.forEach(
+ angular_data,
+ function (value) {
+ model.push({
+ id: scope.toId(value),
+ text: scope.toText(value),
+ _data: value
+ });
+ });
+ return model;
+ } else if (angular.isObject(angular_data)) {
+ return {
+ id: scope.toId(angular_data),
+ text: scope.toText(angular_data),
+ _data: angular_data
+ };
+ } else if (angular.isString(angular_data)) {
+ return {
+ id: angular_data,
+ text: angular_data,
+ _data: angular_data
+ };
+ }
+
+ return angular_data;
+ };
+
+ //allow user to create a simple query
+ //just use simpleQuery : function(term, callback) { callback(array_of_dummy_objects; }
+ if (scope.simpleQuery) {
+ scope.opts.query = function (query) {
+ scope.simpleQuery(query.term, function (values) {
+ query.callback({ results: scope.convertToSelect2Model(values) });
+ });
+ };
+ } else if (scope.simpleData) {
+ //Use this if you want to filter on the text field without ajax query
+ //Just use data : [Object object] and the toText function
+ scope.opts.query = function (query) {
+ query.callback({
+ results: $filter('filter')(scope.convertToSelect2Model(scope.simpleData), {text: query.term}, 'text')
+ });
+ };
+ }
+
+ // call select2 function to set data and all properties
+ scope.render = function () {
+ if (scope.opts.multiple) {
+ element.select2('data', scope.convertToSelect2Model(ngModel.$viewValue));
+ } else {
+ if (angular.isObject(ngModel.$viewValue)) {
+ element.select2('data', scope.convertToSelect2Model(ngModel.$viewValue));
+ } else if (!ngModel.$viewValue) {
+ element.select2('data', null);
+ } else {
+ element.select2('data', scope.convertToSelect2Model(ngModel.$viewValue));
+ }
+ }
+ if (scope.opts.sortable) {
+ element.select2("container").find("ul.select2-choices").sortable({
+ containment: 'parent',
+ start: function () {
+ element.select2("onSortStart");
+ },
+ update: function () {
+ element.select2("onSortEnd");
+ element.trigger('change');
+ }
+ });
+ }
+ };
+
+ // Set the view and model value and update the angular template manually for the ajax/multiple select2.
+ element.bind("change", function (event) {
+ if (scope.$$phase) {
+ return;
+ }
+ var e = event;
+ scope.$apply(function () {
+ var values = element.select2('data');
+ if (e && e.removed && values) {
+ for (var i = 0; i < values.length; i++) {
+ if (values[i] === e.removed) {
+ values.splice(i, 1);
+ }
+ }
+ }
+ if (values && (angular.isArray(values) || values._data)) {
+ values = scope.convertToAngularModel(values);
+ }
+ ngModel.$setViewValue(values);
+ });
+ });
+
+ // Watch the model for programmatic changes
+ scope.$watch(function () {
+ return ngModel.$viewValue;
+ }, function (current, old) {
+ if (current === old) {
+ return;
+ }
+ scope.render();
+ }, true);
+
+ element.bind("$destroy", function () {
+ element.select2("destroy");
+ });
+
+ //watch disabled attrs to send event to select2
+ attrs.$observe('disabled', function (value) {
+ element.select2('enable', !value);
+ });
+
+ // add an onSelect element which retreive model object into e.added or e.removed
+ if (scope.onSelect) {
+ element.on("change", function (e) {
+ if (e.added) {
+ e.added = scope.convertToAngularModel(e.added);
+ }
+ if (e.removed) {
+ e.removed = scope.convertToAngularModel(e.removed);
+ }
+ scope.onSelect(e);
+ });
+ }
+
+ // Initialize the plugin late so that the injected DOM does not disrupt the template compiler
+ $timeout(function () {
+ element.select2(scope.opts);
+ scope.render();
+ });
+ }
+ };
+}]);
\ No newline at end of file
1
0
Build failed in Jenkins: faxtomail-ci » FaxToMail :: Web #66
by admin+ci-codelutin.com@codelutin.com 22 May '14
by admin+ci-codelutin.com@codelutin.com 22 May '14
22 May '14
See <http://ci.codelutin.com/jenkins/job/faxtomail-ci/com.franciaflex.faxtomail$…>
Changes:
[echatellier] refs #4662: Refactoring de la configuration
------------------------------------------
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building FaxToMail :: Web 0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] Downloading: http://nexus.nuiton.org/nexus/content/repositories/central-releases/com/jge…
[INFO] Downloading: http://nexus.nuiton.org/nexus/content/groups/faxtomail-group/com/jgeppert/s…
[INFO] Downloading: http://repo.maven.apache.org/maven2/com/jgeppert/struts2/bootstrap/struts2-…
[INFO] Downloaded: http://repo.maven.apache.org/maven2/com/jgeppert/struts2/bootstrap/struts2-… (4 KB at 73.8 KB/sec)
[INFO] Downloading: http://nexus.nuiton.org/nexus/content/repositories/central-releases/com/jge…
[INFO] Downloading: http://nexus.nuiton.org/nexus/content/groups/faxtomail-group/com/jgeppert/s…
[INFO] Downloading: http://repo.maven.apache.org/maven2/com/jgeppert/struts2/bootstrap/bootstra…
[INFO] Downloaded: http://repo.maven.apache.org/maven2/com/jgeppert/struts2/bootstrap/bootstra… (5 KB at 65.4 KB/sec)
[INFO] Downloading: http://nexus.nuiton.org/nexus/content/groups/faxtomail-group/org/nuiton/js/…
[INFO] Downloading: http://nexus.nuiton.org/nexus/content/repositories/snapshots/org/nuiton/js/…
[INFO] Downloading: http://nexus.nuiton.org/nexus/content/repositories/snapshots/org/nuiton/js/…
[INFO] Downloading: http://nexus.nuiton.org/nexus/content/groups/faxtomail-group/org/nuiton/js/…
[WARNING] The POM for org.nuiton.js:nuiton-js-angular-ui-tree:jar:2.0.6-1-SNAPSHOT is missing, no dependency information available
[INFO] Downloading: http://nexus.nuiton.org/nexus/content/repositories/central-releases/com/jge…
[INFO] Downloading: http://nexus.nuiton.org/nexus/content/groups/faxtomail-group/com/jgeppert/s…
[INFO] Downloading: http://repo.maven.apache.org/maven2/com/jgeppert/struts2/bootstrap/struts2-…
[INFO] Downloaded: http://repo.maven.apache.org/maven2/com/jgeppert/struts2/bootstrap/struts2-… (248 KB at 2331.2 KB/sec)
[INFO] Downloading: http://nexus.nuiton.org/nexus/content/repositories/snapshots/org/nuiton/js/…
[INFO] Downloading: http://nexus.nuiton.org/nexus/content/groups/faxtomail-group/org/nuiton/js/…
[JENKINS] Archiving disabled
1
3
22 May '14
Author: echatellier
Date: 2014-05-22 15:25:20 +0200 (Thu, 22 May 2014)
New Revision: 89
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/89
Log:
refs #4662: Sauvegarde de la configuration et des etats d'attente
Added:
trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/json/
trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/json/HibernateProxyTypeAdapter.java
trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/json/TopiaEntityAdapter.java
trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp
Removed:
trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/HibernateProxyTypeAdapter.java
trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration.jsp
Modified:
trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/Field.java
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-ui-web/src/main/java/com/franciaflex/faxtomail/web/FaxToMailActionSupport.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/resources/struts.properties
Modified: 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-05-22 13:24:24 UTC (rev 88)
+++ trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/Field.java 2014-05-22 13:25:20 UTC (rev 89)
@@ -31,23 +31,25 @@
*/
public enum Field {
+ SENDER,
RECEPTION_DATE,
EDI_CODE_NUMBER,
+ OBJECT,
PROJECT_REFERENCE,
- SENDER,
- FAX,
- RECIPIENT,
- OBJECT,
- ARCHIVE_DATE,
- COMPANY_REFERENCE,
- ORIGINAL_EMAIL,
- COMMENT,
- DEMAND_TYPE,
PRIORITY,
- ETAT_ATTENTE,
- TAKEN_BY,
RANGE_ROW,
+ MAIL_FOLDER,
CLIENT,
- DEMANDE_STATUS
-
+ DEMANDE_STATUS,
+ DEMAND_TYPE,
+ TAKEN_BY,
+ ETAT_ATTENTE,
+ ATTACHMENT
+
+ //FAX,
+ //RECIPIENT,
+ //ARCHIVE_DATE,
+ //COMPANY_REFERENCE,
+ //ORIGINAL_EMAIL,
+ //COMMENT
}
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-05-22 13:24:24 UTC (rev 88)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ConfigurationService.java 2014-05-22 13:25:20 UTC (rev 89)
@@ -41,7 +41,7 @@
*/
public class ConfigurationService extends FaxToMailServiceSupport {
- private static final Log log = LogFactory.getLog(CompanyService.class);
+ private static final Log log = LogFactory.getLog(ConfigurationService.class);
public List<Configuration> getAllConfigurations() {
ConfigurationTopiaDao dao = getPersistenceContext().getConfigurationDao();
@@ -70,6 +70,7 @@
} else {
config = dao.create(config);
}
+ getPersistenceContext().commit();
return config;
}
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-05-22 13:24:24 UTC (rev 88)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ReferentielService.java 2014-05-22 13:25:20 UTC (rev 89)
@@ -24,6 +24,24 @@
* #L%
*/
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.commons.io.IOUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.nuiton.csv.Import;
+import org.nuiton.csv.ImportRuntimeException;
+import org.nuiton.jaxx.application.ApplicationTechnicalException;
+import org.nuiton.topia.persistence.TopiaEntities;
+import org.nuiton.util.beans.Binder;
+import org.nuiton.util.beans.BinderFactory;
+
import com.franciaflex.faxtomail.persistence.entities.Client;
import com.franciaflex.faxtomail.persistence.entities.ClientTopiaDao;
import com.franciaflex.faxtomail.persistence.entities.DemandType;
@@ -31,6 +49,7 @@
import com.franciaflex.faxtomail.persistence.entities.EmailAccount;
import com.franciaflex.faxtomail.persistence.entities.EmailAccountTopiaDao;
import com.franciaflex.faxtomail.persistence.entities.EtatAttente;
+import com.franciaflex.faxtomail.persistence.entities.EtatAttenteImpl;
import com.franciaflex.faxtomail.persistence.entities.EtatAttenteTopiaDao;
import com.franciaflex.faxtomail.persistence.entities.MailFilter;
import com.franciaflex.faxtomail.persistence.entities.MailFilterTopiaDao;
@@ -43,25 +62,8 @@
import com.franciaflex.faxtomail.services.service.imports.ClientImportModel;
import com.franciaflex.faxtomail.services.service.imports.EmailAccountImportModel;
import com.franciaflex.faxtomail.services.service.imports.EmailFilterImportModel;
-import com.google.common.base.Charsets;
-import com.google.common.io.Files;
-import org.apache.commons.io.IOUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.nuiton.csv.Import;
-import org.nuiton.csv.ImportRuntimeException;
-import org.nuiton.jaxx.application.ApplicationTechnicalException;
+import com.google.common.collect.Maps;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.Reader;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-import static org.nuiton.i18n.I18n.t;
-
/**
* @author kmorin <kmorin(a)codelutin.com>
* @since x.x
@@ -90,6 +92,36 @@
return new ArrayList<>(dao.findAll());
}
+ public void saveEtatAttente(Collection<EtatAttente> etatAttentes) {
+
+ Binder<EtatAttente, EtatAttente> binderEtatAttente = BinderFactory.newBinder(EtatAttente.class);
+ EtatAttenteTopiaDao etatAttenteDAO = getPersistenceContext().getEtatAttenteDao();
+
+ List<EtatAttente> allEtatAttente = getAllEtatAttente();
+ Map<String, EtatAttente> allEtatAttenteIndex = new HashMap<>(Maps.uniqueIndex(allEtatAttente, TopiaEntities.getTopiaIdFunction()));
+ for (EtatAttente etatAttente : etatAttentes) {
+ // get current etat attente
+ EtatAttente currentEtatAttente;
+ if (StringUtils.isNoneBlank(etatAttente.getTopiaId())) {
+ currentEtatAttente = allEtatAttenteIndex.remove(etatAttente.getTopiaId());
+ } else {
+ currentEtatAttente = new EtatAttenteImpl();
+ }
+
+ // copy
+ binderEtatAttente.copy(etatAttente, currentEtatAttente);
+
+ // persist
+ if (currentEtatAttente.isPersisted()) {
+ etatAttenteDAO.create(currentEtatAttente);
+ } else {
+ etatAttenteDAO.update(currentEtatAttente);
+ }
+ }
+
+ getPersistenceContext().commit();
+ }
+
public List<Client> getAllClients() {
ClientTopiaDao dao = getPersistenceContext().getClientDao();
return new ArrayList<>(dao.findAll());
Deleted: trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/HibernateProxyTypeAdapter.java
===================================================================
--- trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/HibernateProxyTypeAdapter.java 2014-05-22 13:24:24 UTC (rev 88)
+++ trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/HibernateProxyTypeAdapter.java 2014-05-22 13:25:20 UTC (rev 89)
@@ -1,58 +0,0 @@
-package com.franciaflex.faxtomail;
-
-import java.io.IOException;
-
-import org.hibernate.Hibernate;
-import org.hibernate.proxy.HibernateProxy;
-
-import com.google.gson.Gson;
-import com.google.gson.TypeAdapter;
-import com.google.gson.TypeAdapterFactory;
-import com.google.gson.reflect.TypeToken;
-import com.google.gson.stream.JsonReader;
-import com.google.gson.stream.JsonWriter;
-
-/**
- * This TypeAdapter unproxies Hibernate proxied objects, and serializes them
- * through the registered (or default) TypeAdapter of the base class.
- *
- * Voir : http://stackoverflow.com/a/13525550/2038100
- */
-public class HibernateProxyTypeAdapter extends TypeAdapter<HibernateProxy> {
-
- public static final TypeAdapterFactory FACTORY = new TypeAdapterFactory() {
- @Override
- @SuppressWarnings("unchecked")
- public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) {
- return (HibernateProxy.class.isAssignableFrom(type.getRawType()) ? (TypeAdapter<T>) new HibernateProxyTypeAdapter(gson) : null);
- }
- };
- private final Gson context;
-
- private HibernateProxyTypeAdapter(Gson context) {
- this.context = context;
- }
-
- @Override
- public HibernateProxy read(JsonReader in) throws IOException {
- throw new UnsupportedOperationException("Not supported");
- }
-
- @SuppressWarnings({"rawtypes", "unchecked"})
- @Override
- public void write(JsonWriter out, HibernateProxy value) throws IOException {
- if (value == null) {
- out.nullValue();
- return;
- }
- // Retrieve the original (not proxy) class
- Class<?> baseType = Hibernate.getClass(value);
- // Get the TypeAdapter of the original class, to delegate the serialization
- TypeAdapter delegate = context.getAdapter(TypeToken.get(baseType));
- // Get a filled instance of the original class
- Object unproxiedValue = value.getHibernateLazyInitializer().getImplementation();
- // Serialize the value
- delegate.write(out, unproxiedValue);
- }
-
-}
Modified: trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/FaxToMailActionSupport.java
===================================================================
--- trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/FaxToMailActionSupport.java 2014-05-22 13:24:24 UTC (rev 88)
+++ trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/FaxToMailActionSupport.java 2014-05-22 13:25:20 UTC (rev 89)
@@ -33,11 +33,13 @@
import org.nuiton.topia.persistence.TopiaEntity;
import com.franciaflex.faxtomail.FaxToMailConfiguration;
-import com.franciaflex.faxtomail.HibernateProxyTypeAdapter;
+import com.franciaflex.faxtomail.persistence.entities.FaxToMailEntityEnum;
import com.franciaflex.faxtomail.persistence.entities.MailFilter;
import com.franciaflex.faxtomail.persistence.entities.MailFilterAbstract;
import com.franciaflex.faxtomail.persistence.entities.MailFolder;
import com.franciaflex.faxtomail.persistence.entities.MailFolderAbstract;
+import com.franciaflex.faxtomail.web.json.HibernateProxyTypeAdapter;
+import com.franciaflex.faxtomail.web.json.TopiaEntityAdapter;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.Maps;
import com.google.common.collect.Multimap;
@@ -145,6 +147,15 @@
}
});
+ // Renseigne a gson comment instancier les Impl à partir des interfaces Topia
+ FaxToMailEntityEnum[] classes = FaxToMailEntityEnum.getContracts();
+ for (FaxToMailEntityEnum clazz : classes) {
+ Class<? extends TopiaEntity> type = clazz.getContract();
+ Class<? extends TopiaEntity> implementationClass = clazz.getImplementation();
+ TopiaEntityAdapter adapter = new TopiaEntityAdapter(implementationClass);
+ builder.registerTypeAdapter(type, adapter);
+ }
+
// Type adapters : Hibernate proxies
builder.registerTypeAdapterFactory(HibernateProxyTypeAdapter.FACTORY);
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-05-22 13:24:24 UTC (rev 88)
+++ trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ConfigurationAction.java 2014-05-22 13:25:20 UTC (rev 89)
@@ -24,11 +24,13 @@
* #L%
*/
+import java.lang.reflect.Type;
import java.util.List;
import java.util.Map;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.apache.struts2.convention.annotation.Result;
import com.franciaflex.faxtomail.persistence.entities.Action;
import com.franciaflex.faxtomail.persistence.entities.Configuration;
@@ -39,6 +41,7 @@
import com.franciaflex.faxtomail.services.service.MailFolderService;
import com.franciaflex.faxtomail.services.service.ReferentielService;
import com.franciaflex.faxtomail.web.FaxToMailActionSupport;
+import com.google.gson.reflect.TypeToken;
import com.opensymphony.xwork2.Preparable;
/**
@@ -81,6 +84,7 @@
}
@Override
+ @org.apache.struts2.convention.annotation.Action("configuration-input")
public String input() throws Exception {
etatAttentes = referentielService.getAllEtatAttente();
mailFolders = mailFolderService.getRootMailFolders();
@@ -88,19 +92,13 @@
}
@Override
+ @org.apache.struts2.convention.annotation.Action(results = {
+ @Result(type = "redirectAction", params = {"actionName", "configuration-input"})})
public String execute() throws Exception {
String result = super.execute();
- /*Map<MailFilter, String> folderIdByFilter = new HashMap<>();
- if (mailFilters != null) {
- for (MailFilterUIBean filter : mailFilters) {
- String folderId = filter.getMailFolderId();
- folderIdByFilter.put(filter, folderId);
- }
- }
- configurationService.saveCompany(company, mailFolders, folderIdByFilter);*/
-
configurationService.saveConfiguration(configuration);
+ referentielService.saveEtatAttente(etatAttentes);
return result;
}
@@ -125,8 +123,9 @@
return etatAttentes;
}
- public void setEtatAttentes(List<EtatAttente> etatAttentes) {
- this.etatAttentes = etatAttentes;
+ public void setEtatAttentesJson(String json) {
+ Type type = new TypeToken<List<EtatAttente>>() {}.getType();
+ this.etatAttentes = getGson().fromJson(json, type);
}
public Map<Action, String> getEtatAttenteActions() {
Copied: trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/json/HibernateProxyTypeAdapter.java (from rev 84, trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/HibernateProxyTypeAdapter.java)
===================================================================
--- trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/json/HibernateProxyTypeAdapter.java (rev 0)
+++ trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/json/HibernateProxyTypeAdapter.java 2014-05-22 13:25:20 UTC (rev 89)
@@ -0,0 +1,58 @@
+package com.franciaflex.faxtomail.web.json;
+
+import java.io.IOException;
+
+import org.hibernate.Hibernate;
+import org.hibernate.proxy.HibernateProxy;
+
+import com.google.gson.Gson;
+import com.google.gson.TypeAdapter;
+import com.google.gson.TypeAdapterFactory;
+import com.google.gson.reflect.TypeToken;
+import com.google.gson.stream.JsonReader;
+import com.google.gson.stream.JsonWriter;
+
+/**
+ * This TypeAdapter unproxies Hibernate proxied objects, and serializes them
+ * through the registered (or default) TypeAdapter of the base class.
+ *
+ * Voir : http://stackoverflow.com/a/13525550/2038100
+ */
+public class HibernateProxyTypeAdapter extends TypeAdapter<HibernateProxy> {
+
+ public static final TypeAdapterFactory FACTORY = new TypeAdapterFactory() {
+ @Override
+ @SuppressWarnings("unchecked")
+ public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) {
+ return (HibernateProxy.class.isAssignableFrom(type.getRawType()) ? (TypeAdapter<T>) new HibernateProxyTypeAdapter(gson) : null);
+ }
+ };
+ private final Gson context;
+
+ private HibernateProxyTypeAdapter(Gson context) {
+ this.context = context;
+ }
+
+ @Override
+ public HibernateProxy read(JsonReader in) throws IOException {
+ throw new UnsupportedOperationException("Not supported");
+ }
+
+ @SuppressWarnings({"rawtypes", "unchecked"})
+ @Override
+ public void write(JsonWriter out, HibernateProxy value) throws IOException {
+ if (value == null) {
+ out.nullValue();
+ return;
+ }
+ // Retrieve the original (not proxy) class
+ Class<?> baseType = Hibernate.getClass(value);
+ // Get the TypeAdapter of the original class, to delegate the serialization
+ TypeAdapter delegate = context.getAdapter(TypeToken.get(baseType));
+ // Get a filled instance of the original class
+ Object unproxiedValue = value.getHibernateLazyInitializer().getImplementation();
+ // Serialize the value
+ delegate.write(out, unproxiedValue);
+ }
+
+}
Added: trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/json/TopiaEntityAdapter.java
===================================================================
--- trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/json/TopiaEntityAdapter.java (rev 0)
+++ trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/json/TopiaEntityAdapter.java 2014-05-22 13:25:20 UTC (rev 89)
@@ -0,0 +1,38 @@
+package com.franciaflex.faxtomail.web.json;
+
+import java.lang.reflect.Type;
+
+import org.nuiton.topia.persistence.TopiaEntity;
+
+import com.google.gson.JsonDeserializationContext;
+import com.google.gson.JsonDeserializer;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonParseException;
+import com.google.gson.JsonSerializationContext;
+import com.google.gson.JsonSerializer;
+
+/**
+ * Gson topia entity adaptor that use a specific implementationClass to deserialize a topia entity interface.
+ *
+ * @author Eric Chatellier
+ */
+public class TopiaEntityAdapter implements JsonSerializer<TopiaEntity>, JsonDeserializer<TopiaEntity> {
+
+ protected Class<? extends TopiaEntity> implementationClass;
+
+ public TopiaEntityAdapter(Class<? extends TopiaEntity> implementationClass) {
+ this.implementationClass = implementationClass;
+ }
+
+ @Override
+ public TopiaEntity deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext jsonDeserializationContext) throws JsonParseException {
+ TopiaEntity result = jsonDeserializationContext.deserialize(jsonElement, implementationClass);
+ return result;
+ }
+
+ @Override
+ public JsonElement serialize(TopiaEntity object, Type type, JsonSerializationContext jsonSerializationContext) {
+ JsonElement result = jsonSerializationContext.serialize(object, object.getClass());
+ return result;
+ }
+}
Property changes on: trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/json/TopiaEntityAdapter.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
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-05-22 13:24:24 UTC (rev 88)
+++ trunk/faxtomail-ui-web/src/main/resources/i18n/faxtomail-ui-web_fr_FR.properties 2014-05-22 13:25:20 UTC (rev 89)
@@ -5,6 +5,7 @@
com.franciaflex.faxtomail.persistence.entities.Action.SAVE=Sauver
com.franciaflex.faxtomail.persistence.entities.Action.TRANSMIT=Transfer
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
@@ -13,6 +14,7 @@
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é
Modified: trunk/faxtomail-ui-web/src/main/resources/struts.properties
===================================================================
--- trunk/faxtomail-ui-web/src/main/resources/struts.properties 2014-05-22 13:24:24 UTC (rev 88)
+++ trunk/faxtomail-ui-web/src/main/resources/struts.properties 2014-05-22 13:25:20 UTC (rev 89)
@@ -38,15 +38,3 @@
struts.freemarker.templatesCache=true
struts.convention.package.locators.basePackage=com.franciaflex.faxtomail.web.action
-
-# FIXME bleny 06/12/2013 définir à true ouvre une faille de sécurité,
-# voir http://struts.apache.org/release/2.3.x/docs/s2-019.html
-# si on laisse la valeur par défaut, l'appli mouline dès qu'on appel une action autre que execute,
-# on attend que convention-plugin soit adapté pour pouvoir poser une anot sur les méthodes inputs
-struts.enable.DynamicMethodInvocation=true
-
-# FIXME bleny 09/12/2013 définir à true ouvre une faille de sécurité,
-# voir http://struts.apache.org/release/2.3.x/docs/s2-018.html
-# ne pas surcharger cette valeur empêche de définir l'action!methode à appeller au submit et on passe toujours le execute,
-# ça casse le formulaire de déclaration (quand on veut passer à l'étape suivante (!next) on se retrouve dans le résumé (!execute))
-struts.mapper.action.prefix.enabled=true
Copied: trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp (from rev 84, trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration.jsp)
===================================================================
--- trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp (rev 0)
+++ trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp 2014-05-22 13:25:20 UTC (rev 89)
@@ -0,0 +1,341 @@
+<%--
+ #%L
+ FaxToMail :: Web
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2014 Franciaflex, Code Lutin
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as
+ published by the Free Software Foundation, either version 3 of the
+ License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public
+ License along with this program. If not, see
+ <http://www.gnu.org/licenses/gpl-3.0.html>.
+ #L%
+ --%>
+<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
+<!DOCTYPE html>
+<%@taglib uri="/struts-tags" prefix="s" %>
+
+<html>
+ <head>
+ <title>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/configuration.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='/nuiton-js-angular-ui-tree/angular-ui-tree.js' />"></script>
+ <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'])
+ .value('ConfigurationData', {
+ 'etatAttentes' : <s:property value="toJson(etatAttentes)" escapeHtml="false"/>,
+ 'etatAttenteActions': <s:property value="toJson(etatAttenteActions)" escapeHtml="false"/>,
+ 'etatAttenteFields': <s:property value="toJson(etatAttenteFields)" escapeHtml="false"/>,
+ 'mailFolders': <s:property value="toJson(mailFolders)" escapeHtml="false"/>
+ });
+ </script>
+ </head>
+
+ <body>
+ <div ng-app="ConfigurationModule">
+ <!-- navbar -->
+ <header class="navbar navbar-inverse navbar-static-top bs-docs-nav" id="top" role="banner">
+ <div class="container">
+ <div class="navbar-header">
+ <a href="<s:url value='/' />" class="navbar-brand">FaxToMail</a>
+ </div>
+
+ </div>
+ </header>
+
+ <div id="main-container" class="container">
+
+ <h1 class="page-header">Configuration</h1>
+
+ <s:form id="main_form" action="configuration" ng-controller="ConfigurationController">
+
+ <s:hidden name="companyId"/>
+ <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-tree" data-toggle="tab">Arborescence</a></li>
+ <li><a href="#tabs-filters" data-toggle="tab">Filtres de mail</a></li>
+ <!-- <li><a href="#tabs-rights" data-toggle="tab">Droits</a></li>
+ <li><a href="#tabs-email-accounts" data-toggle="tab">Comptes mails</a></li> -->
+ </ul>
+
+ <div class="tab-content active" ng-controller="ConfigurationMiscController">
+
+ <div id="tabs-general" class="tab-pane active">
+ <!-- Général -->
+
+ <s:checkbox name="configuration.sendAknowledgement"
+ label="Envoyer directement l'accusé de réception si demandé par l'expéditeur"/>
+
+ <s:checkbox name="configuration.rejectUnknownSender"
+ label="Refuser les mails dont l'email est inconnu de la base client"
+ cssClass="margin-bottom25"/>
+
+ <s:textfield name="configuration.ediFolder"
+ label="Dossier de dépôt du fichier pour l'EDI"
+ cssClass="span12"/>
+
+ <s:textfield name="configuration.convertToPdfCommand"
+ label="Ligne de commande de conversion de fichier X en pdf"
+ cssClass="span12"/>
+
+ <s:textfield name="configuration.openAttachmentCommand"
+ label="Ligne de commande d'ouverture de fichier non TXT, TIFF, JPEG, PDF"
+ cssClass="span12"/>
+
+ <!-- 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>
+
+ <div id="tabs-wait" class="tab-pane" ng-controller="ConfigurationWaitController">
+ <input type="hidden" name="etatAttentesJson" value="{{etatAttentes}}" />
+
+ <div class="row">
+ <div class="col-md-4">
+ <table class="table table-hover">
+ <thead>
+ <tr>
+ <th>État d'attente</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr ng-repeat="etatAttente in etatAttentes"
+ ng-class="{'info' : etatAttente == selectedEtatAttente}"
+ ng-click="editEtatAttente(etatAttente)">
+ <td>{{etatAttente.label}}</td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+
+ <div class="col-md-7" ng-if="selectedEtatAttente">
+ Champs obligatoires pour l'état d'attente <strong>{{selectedEtatAttente.label}}</strong>:
+ <label class="checkbox" ng-repeat="(etatAttenteField,label) in etatAttenteFields">
+ <input type="checkbox" ng-checked="selectedEtatAttente.fields.indexOf(etatAttenteField) != -1"
+ ng-click="changeEtatAttenteField(etatAttenteField)"> {{label}}
+ </label>
+ Actions autorisées pour l'état d'attente <strong>{{selectedEtatAttente.label}}</strong>:
+ <label class="checkbox" ng-repeat="(etatAttenteAction,label) in etatAttenteActions">
+ <input type="checkbox" ng-checked="selectedEtatAttente.actions.indexOf(etatAttenteAction) != -1"
+ ng-click="changeEtatAttenteAction(etatAttenteAction)"> {{label}}
+ </label>
+ </div>
+ <div class="col-md-7" ng-if="!selectedEtatAttente">
+ <em>Sélectionnez un état d'attente.</em>
+ </div>
+ </div>
+
+ </div>
+
+ <div id="tabs-tree" class="tab-pane" ng-controller="ConfigurationTreeController">
+
+ <div class="row">
+ <div class="col-md-4">
+ <script type="text/ng-template" id="nodes_renderer.html">
+ <div ui-tree-handle ng-click="editMailFolder(mailFolder)" ng-class="{'bg-warning' : mailFolder == selectedMailFolder}">
+ <a class="btn btn-success btn-xs" data-nodrag ng-click="toggle(this)">
+ <span class="glyphicon" ng-class="{'glyphicon-chevron-right': collapsed, 'glyphicon-chevron-down': !collapsed}"></span>
+ </a>
+ {{mailFolder.name}}
+ <a class="pull-right btn btn-danger btn-xs" data-nodrag ng-click="remove(this)"><span class="glyphicon glyphicon-remove"></span></a>
+ <a class="pull-right btn btn-primary btn-xs" data-nodrag ng-click="newSubItem(this)" style="margin-right: 8px;"><span class="glyphicon glyphicon-plus"></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'">
+ </li>
+ </ol>
+ </script>
+ <div ui-tree="options" data-drag-enabled="false">
+ <ol ui-tree-nodes="" ng-model="mailFolders" id="tree-root">
+ <li ng-repeat="mailFolder in mailFolders" ui-tree-node ng-include="'nodes_renderer.html'"></li>
+ </ol>
+ </div>
+ </div>
+
+ <div class="col-md-8" ng-if="selectedMailFolder">
+ <div class="panel-group" id="accordion">
+
+ <!-- Liste des chargés de clientèle -->
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ <h4 class="panel-title">
+ <a data-toggle="collapse" data-parent="#accordion" href="#collapse1">
+ Liste des chargés de clientèle {{selectedMailFolder.name}}
+ </a>
+ </h4>
+ </div>
+ <div id="collapse1" class="panel-collapse collapse">
+ <div class="panel-body">
+ Toto
+ </div>
+ </div>
+ </div>
+
+ <!-- Liste des emails expéditeur -->
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ <h4 class="panel-title">
+ <a data-toggle="collapse" data-parent="#accordion" href="#collapse2">
+ liste des emails expéditeur
+ </a>
+ </h4>
+ </div>
+ <div id="collapse2" class="panel-collapse collapse">
+ <div class="panel-body">
+ Toto
+ </div>
+ </div>
+ </div>
+
+ <!-- Liste des emails expéditeur -->
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ <h4 class="panel-title">
+ <a data-toggle="collapse" data-parent="#accordion" href="#collapse3">
+ sélection des états d'attentes possibles pour ce dossier
+ </a>
+ </h4>
+ </div>
+ <div id="collapse3" class="panel-collapse collapse">
+ <div class="panel-body">
+ Toto
+ </div>
+ </div>
+ </div>
+
+ <!-- Liste des emails expéditeur -->
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ <h4 class="panel-title">
+ <a data-toggle="collapse" data-parent="#accordion" href="#collapse4">
+ groupes/personnes ayant droit d'écriture sur le dossier
+ </a>
+ </h4>
+ </div>
+ <div id="collapse4" class="panel-collapse collapse">
+ <div class="panel-body">
+ Toto
+ </div>
+ </div>
+ </div>
+
+ <!-- Liste des emails expéditeur -->
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ <h4 class="panel-title">
+ <a data-toggle="collapse" data-parent="#accordion" href="#collapse5">
+ actions possibles du menu contextuel pour ce dossier
+ </a>
+ </h4>
+ </div>
+ <div id="collapse5" class="panel-collapse collapse">
+ <div class="panel-body">
+ Toto
+ </div>
+ </div>
+ </div>
+
+ <!-- configuration des colonnes a afficher -->
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ <h4 class="panel-title">
+ <a data-toggle="collapse" data-parent="#accordion" href="#collapse6">
+ configuration des colonnes a afficher
+ </a>
+ </h4>
+ </div>
+ <div id="collapse6" class="panel-collapse collapse">
+ <div class="panel-body">
+ Toto
+ </div>
+ </div>
+ </div>
+
+ </div>
+
+ <div class="checkbox">
+ <label for="printActionEqualTakeActionField">action imprimer est-elle équivalente à "prendre"</label>
+ <input type="checkbox" id="printActionEqualTakeActionField" ng-model="selectedMailFolder.printActionEqualTakeAction">
+ </div>
+
+ <div class="checkbox">
+ <label for="openAttachmentReportNoTakenField">ouvrir une pièce jointe sans prendre, met-il la ligne en orange ou non</label>
+ <input type="checkbox" id="openAttachmentReportNoTakenField" ng-model="selectedMailFolder.openAttachmentReportNoTaken">
+ </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>
+ </div>
+ </div>
+
+ <div id="tabs-filters" class="tab-pane" ng-controller="ConfigurationFilterController">
+ <table class="table table-hover table-bordered">
+ <thead>
+ <tr>
+ <th>Filtre</th>
+ <th>Dossier</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr ng-repeat="mailFilter in allMailFilters()">
+ <td>{{mailFilter.expression}}</td>
+ <td>{{mailFilter.fmMailFolder.name}}</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="selectedFilter">
+ </div>
+ <div class="form-group">
+ <label for="folderField">Dossier</label>
+ <select class="form-control" ng-model="selectedFolder" ng-options="mailFolder.name for mailFolder in flatMailFolders()"></select>
+ </div>
+ </div>
+ <button type="button" class="btn btn-success" ng-disabled="!selectedFilter || !selectedFolder" ng-click="addNewFilter()">
+ <i class="glyphicon glyphicon-plus"></i>Ajouter
+ </button>
+ </div>
+
+ <!-- <div class="container form-actions">
+ <button type="submit" class="btn btn-primary pull-right">Valider</button>
+ </div> -->
+
+ <nav class="navbar navbar-default navbar-fixed-bottom">
+ <div class="container">
+ <button type="submit" class="btn btn-primary navbar-btn pull-right">Valider</button>
+ </div>
+ </nav>
+ </div>
+ </s:form>
+ </div>
+ </div>
+ </body>
+</html>
Deleted: trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration.jsp
===================================================================
--- trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration.jsp 2014-05-22 13:24:24 UTC (rev 88)
+++ trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration.jsp 2014-05-22 13:25:20 UTC (rev 89)
@@ -1,340 +0,0 @@
-<%--
- #%L
- FaxToMail :: Web
- $Id$
- $HeadURL$
- %%
- Copyright (C) 2014 Franciaflex, Code Lutin
- %%
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as
- published by the Free Software Foundation, either version 3 of the
- License, or (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public
- License along with this program. If not, see
- <http://www.gnu.org/licenses/gpl-3.0.html>.
- #L%
- --%>
-<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
-<!DOCTYPE html>
-<%@taglib uri="/struts-tags" prefix="s" %>
-
-<html>
- <head>
- <title>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/configuration.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='/nuiton-js-angular-ui-tree/angular-ui-tree.js' />"></script>
- <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'])
- .value('ConfigurationData', {
- 'etatAttentes' : <s:property value="toJson(etatAttentes)" escapeHtml="false"/>,
- 'etatAttenteActions': <s:property value="toJson(etatAttenteActions)" escapeHtml="false"/>,
- 'etatAttenteFields': <s:property value="toJson(etatAttenteFields)" escapeHtml="false"/>,
- 'mailFolders': <s:property value="toJson(mailFolders)" escapeHtml="false"/>
- });
- </script>
- </head>
-
- <body>
- <div ng-app="ConfigurationModule">
- <!-- navbar -->
- <header class="navbar navbar-inverse navbar-static-top bs-docs-nav" id="top" role="banner">
- <div class="container">
- <div class="navbar-header">
- <a href="<s:url value='/' />" class="navbar-brand">FaxToMail</a>
- </div>
-
- </div>
- </header>
-
- <div id="main-container" class="container">
-
- <h1 class="page-header">Configuration</h1>
-
- <s:form id="main_form" ng-controller="ConfigurationController">
-
- <s:hidden name="companyId"/>
- <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-tree" data-toggle="tab">Arborescence</a></li>
- <li><a href="#tabs-filters" data-toggle="tab">Filtres de mail</a></li>
- <!-- <li><a href="#tabs-rights" data-toggle="tab">Droits</a></li>
- <li><a href="#tabs-email-accounts" data-toggle="tab">Comptes mails</a></li> -->
- </ul>
-
- <div class="tab-content active" ng-controller="ConfigurationMiscController">
-
- <div id="tabs-general" class="tab-pane active">
- <!-- Général -->
-
- <s:checkbox name="configuration.sendAknowledgement"
- label="Envoyer directement l'accusé de réception si demandé par l'expéditeur"/>
-
- <s:checkbox name="configuration.rejectUnknownSender"
- label="Refuser les mails dont l'email est inconnu de la base client"
- cssClass="margin-bottom25"/>
-
- <s:textfield name="configuration.ediFolder"
- label="Dossier de dépôt du fichier pour l'EDI"
- cssClass="span12"/>
-
- <s:textfield name="configuration.convertToPdfCommand"
- label="Ligne de commande de conversion de fichier X en pdf"
- cssClass="span12"/>
-
- <s:textfield name="configuration.openAttachmentCommand"
- label="Ligne de commande d'ouverture de fichier non TXT, TIFF, JPEG, PDF"
- cssClass="span12"/>
-
- <!-- 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>
-
- <div id="tabs-wait" class="tab-pane" ng-controller="ConfigurationWaitController">
-
- <div class="row">
- <div class="col-md-4">
- <table class="table table-hover">
- <thead>
- <tr>
- <th>État d'attente</th>
- </tr>
- </thead>
- <tbody>
- <tr ng-repeat="etatAttente in etatAttentes"
- ng-class="{'info' : etatAttente == selectedEtatAttente}"
- ng-click="editEtatAttente(etatAttente)">
- <td>{{etatAttente.label}}</td>
- </tr>
- </tbody>
- </table>
- </div>
-
- <div class="col-md-7" ng-if="selectedEtatAttente">
- Champs obligatoires pour l'état d'attente <strong>{{selectedEtatAttente.label}}</strong>:
- <label class="checkbox" ng-repeat="(etatAttenteField,label) in etatAttenteFields">
- <input type="checkbox" ng-checked="selectedEtatAttente.fields.indexOf(etatAttenteField) != -1"
- ng-click="changeEtatAttenteField(etatAttenteAction)"> {{label}}
- </label>
- Actions autorisées pour l'état d'attente <strong>{{selectedEtatAttente.label}}</strong>:
- <label class="checkbox" ng-repeat="(etatAttenteAction,label) in etatAttenteActions">
- <input type="checkbox" ng-checked="selectedEtatAttente.actions.indexOf(etatAttenteAction) != -1"
- ng-click="changeEtatAttenteAction(etatAttenteAction)"> {{label}}
- </label>
- </div>
- <div class="col-md-7" ng-if="!selectedEtatAttente">
- <em>Sélectionnez un état d'attente.</em>
- </div>
- </div>
-
- </div>
-
- <div id="tabs-tree" class="tab-pane" ng-controller="ConfigurationTreeController">
-
- <div class="row">
- <div class="col-md-4">
- <script type="text/ng-template" id="nodes_renderer.html">
- <div ui-tree-handle ng-click="editMailFolder(mailFolder)" ng-class="{'bg-warning' : mailFolder == selectedMailFolder}">
- <a class="btn btn-success btn-xs" data-nodrag ng-click="toggle(this)">
- <span class="glyphicon" ng-class="{'glyphicon-chevron-right': collapsed, 'glyphicon-chevron-down': !collapsed}"></span>
- </a>
- {{mailFolder.name}}
- <a class="pull-right btn btn-danger btn-xs" data-nodrag ng-click="remove(this)"><span class="glyphicon glyphicon-remove"></span></a>
- <a class="pull-right btn btn-primary btn-xs" data-nodrag ng-click="newSubItem(this)" style="margin-right: 8px;"><span class="glyphicon glyphicon-plus"></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'">
- </li>
- </ol>
- </script>
- <div ui-tree="options" data-drag-enabled="false">
- <ol ui-tree-nodes="" ng-model="mailFolders" id="tree-root">
- <li ng-repeat="mailFolder in mailFolders" ui-tree-node ng-include="'nodes_renderer.html'"></li>
- </ol>
- </div>
- </div>
-
- <div class="col-md-8" ng-if="selectedMailFolder">
- <div class="panel-group" id="accordion">
-
- <!-- Liste des chargés de clientèle -->
- <div class="panel panel-default">
- <div class="panel-heading">
- <h4 class="panel-title">
- <a data-toggle="collapse" data-parent="#accordion" href="#collapse1">
- Liste des chargés de clientèle {{selectedMailFolder.name}}
- </a>
- </h4>
- </div>
- <div id="collapse1" class="panel-collapse collapse">
- <div class="panel-body">
- Toto
- </div>
- </div>
- </div>
-
- <!-- Liste des emails expéditeur -->
- <div class="panel panel-default">
- <div class="panel-heading">
- <h4 class="panel-title">
- <a data-toggle="collapse" data-parent="#accordion" href="#collapse2">
- liste des emails expéditeur
- </a>
- </h4>
- </div>
- <div id="collapse2" class="panel-collapse collapse">
- <div class="panel-body">
- Toto
- </div>
- </div>
- </div>
-
- <!-- Liste des emails expéditeur -->
- <div class="panel panel-default">
- <div class="panel-heading">
- <h4 class="panel-title">
- <a data-toggle="collapse" data-parent="#accordion" href="#collapse3">
- sélection des états d'attentes possibles pour ce dossier
- </a>
- </h4>
- </div>
- <div id="collapse3" class="panel-collapse collapse">
- <div class="panel-body">
- Toto
- </div>
- </div>
- </div>
-
- <!-- Liste des emails expéditeur -->
- <div class="panel panel-default">
- <div class="panel-heading">
- <h4 class="panel-title">
- <a data-toggle="collapse" data-parent="#accordion" href="#collapse4">
- groupes/personnes ayant droit d'écriture sur le dossier
- </a>
- </h4>
- </div>
- <div id="collapse4" class="panel-collapse collapse">
- <div class="panel-body">
- Toto
- </div>
- </div>
- </div>
-
- <!-- Liste des emails expéditeur -->
- <div class="panel panel-default">
- <div class="panel-heading">
- <h4 class="panel-title">
- <a data-toggle="collapse" data-parent="#accordion" href="#collapse5">
- actions possibles du menu contextuel pour ce dossier
- </a>
- </h4>
- </div>
- <div id="collapse5" class="panel-collapse collapse">
- <div class="panel-body">
- Toto
- </div>
- </div>
- </div>
-
- <!-- configuration des colonnes a afficher -->
- <div class="panel panel-default">
- <div class="panel-heading">
- <h4 class="panel-title">
- <a data-toggle="collapse" data-parent="#accordion" href="#collapse6">
- configuration des colonnes a afficher
- </a>
- </h4>
- </div>
- <div id="collapse6" class="panel-collapse collapse">
- <div class="panel-body">
- Toto
- </div>
- </div>
- </div>
-
- </div>
-
- <div class="checkbox">
- <label for="printActionEqualTakeActionField">action imprimer est-elle équivalente à "prendre"</label>
- <input type="checkbox" id="printActionEqualTakeActionField" ng-model="selectedMailFolder.printActionEqualTakeAction">
- </div>
-
- <div class="checkbox">
- <label for="openAttachmentReportNoTakenField">ouvrir une pièce jointe sans prendre, met-il la ligne en orange ou non</label>
- <input type="checkbox" id="openAttachmentReportNoTakenField" ng-model="selectedMailFolder.openAttachmentReportNoTaken">
- </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>
- </div>
- </div>
-
- <div id="tabs-filters" class="tab-pane" ng-controller="ConfigurationFilterController">
- <table class="table table-hover table-bordered">
- <thead>
- <tr>
- <th>Filtre</th>
- <th>Dossier</th>
- </tr>
- </thead>
- <tbody>
- <tr ng-repeat="mailFilter in allMailFilters()">
- <td>{{mailFilter.expression}}</td>
- <td>{{mailFilter.fmMailFolder.name}}</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="selectedFilter">
- </div>
- <div class="form-group">
- <label for="folderField">Dossier</label>
- <select class="form-control" ng-model="selectedFolder" ng-options="mailFolder.name for mailFolder in flatMailFolders()"></select>
- </div>
- </div>
- <button type="button" class="btn btn-success" ng-disabled="!selectedFilter || !selectedFolder" ng-click="addNewFilter()">
- <i class="glyphicon glyphicon-plus"></i>Ajouter
- </button>
- </div>
-
- <!-- <div class="container form-actions">
- <button type="submit" class="btn btn-primary pull-right">Valider</button>
- </div> -->
-
- <nav class="navbar navbar-default navbar-fixed-bottom">
- <div class="container">
- <button type="submit" class="btn btn-primary navbar-btn pull-right">Valider</button>
- </div>
- </nav>
- </div>
- </s:form>
- </div>
- </div>
- </body>
-</html>
1
0
r88 - in trunk: . faxtomail-persistence/src/main/xmi
by echatellier@users.forge.codelutin.com 22 May '14
by echatellier@users.forge.codelutin.com 22 May '14
22 May '14
Author: echatellier
Date: 2014-05-22 15:24:24 +0200 (Thu, 22 May 2014)
New Revision: 88
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/88
Log:
Update libs
Modified:
trunk/faxtomail-persistence/src/main/xmi/faxtomail.properties
trunk/pom.xml
Modified: trunk/faxtomail-persistence/src/main/xmi/faxtomail.properties
===================================================================
--- trunk/faxtomail-persistence/src/main/xmi/faxtomail.properties 2014-05-21 19:52:19 UTC (rev 87)
+++ trunk/faxtomail-persistence/src/main/xmi/faxtomail.properties 2014-05-22 13:24:24 UTC (rev 88)
@@ -23,8 +23,8 @@
###
model.tagValue.notGenerateToString=true
model.tagValue.constantPrefix=PROPERTY_
-model.tagValue.java.lang.String=text
-#model.tagvalue.java.sql.Blob=blob
+model.tagValue.hibernateAttributeType.java.lang.String=text
+#model.tagValue.hibernateAttributeType.java.sql.Blob=blob
model.tagValue.useEnumerationName=true
model.tagValue.doNotGenerateBooleanGetMethods=true
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2014-05-21 19:52:19 UTC (rev 87)
+++ trunk/pom.xml 2014-05-22 13:24:24 UTC (rev 88)
@@ -27,7 +27,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>mavenpom4redmine</artifactId>
- <version>5.0.6</version>
+ <version>5.0.7</version>
</parent>
<groupId>com.franciaflex</groupId>
@@ -104,8 +104,8 @@
<nuitonValidatorVersion>3.0-rc-1</nuitonValidatorVersion>
<nuitonWebVersion>1.16</nuitonWebVersion>
- <eugeneVersion>2.8</eugeneVersion>
- <topiaVersion>3.0-beta-3</topiaVersion>
+ <eugeneVersion>2.9</eugeneVersion>
+ <topiaVersion>3.0-beta-4</topiaVersion>
<hibernateVersion>4.3.5.Final</hibernateVersion>
<h2Version>1.3.176</h2Version>
1
0
r87 - in trunk: faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande faxtomail-ui-swing/src/main/resources/i18n faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/job
by kmorin@users.forge.codelutin.com 21 May '14
by kmorin@users.forge.codelutin.com 21 May '14
21 May '14
Author: kmorin
Date: 2014-05-21 21:52:19 +0200 (Wed, 21 May 2014)
New Revision: 87
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/87
Log:
refs #4657 [TECH] Int?\195?\169gration EDI
transfert du fichier par un cron (?\195?\160 tester)
ajout de la colonne quantit?\195?\169 de devis dans la popup de calcul des quantit?\195?\169s
Added:
trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/job/
trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/job/EDIManagementJob.java
trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/job/MailFilterJob.java
Removed:
trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/MailFilterJob.java
Modified:
trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailService.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/QuantitiesByRangeUIHandler.java
trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_fr_FR.properties
trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/FaxToMailApplicationListener.java
Modified: trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailService.java
===================================================================
--- trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailService.java 2014-05-21 19:30:41 UTC (rev 86)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailService.java 2014-05-21 19:52:19 UTC (rev 87)
@@ -204,8 +204,8 @@
&& email.getClient() != null
&& email.getDemandType() != null
&& email.getProjectReference() != null) {
- email.setDemandStatus(DemandStatus.IN_PROGRESS);
- transmitDemandToEdi(email);
+ email.setDemandStatus(DemandStatus.TRANSMITTED_TO_EDI);
+// transmitDemandToEdi(email);
}
History history;
@@ -239,18 +239,29 @@
return result;
}
+ public void transmitPendingDemandsToEdi() {
+ EmailTopiaDao dao = getPersistenceContext().getEmailDao();
+
+ List<Email> toTransmitToEdi = dao.forDemandStatusEquals(DemandStatus.TRANSMITTED_TO_EDI).findAll();
+ for (Email email : toTransmitToEdi) {
+ transmitDemandToEdi(email);
+ }
+ }
+
/**
* Generate txt file to send demand to EDI system.
*
* @param email email to send
*/
protected void transmitDemandToEdi(Email email) {
- Preconditions.checkArgument(email.getDemandStatus() == DemandStatus.IN_PROGRESS);
+ Preconditions.checkArgument(email.getDemandStatus() == DemandStatus.TRANSMITTED_TO_EDI);
if (CollectionUtils.isEmpty(email.getRangeRow())) {
return;
}
+ //TODO kmorin 20140521 maybe check if the file is not being read
+
// get output file with pattern name depending on date
Date now = serviceContext.getNow();
File ediDirectory = getApplicationConfig().getEdiDirectory();
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/QuantitiesByRangeUIHandler.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/QuantitiesByRangeUIHandler.java 2014-05-21 19:30:41 UTC (rev 86)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/QuantitiesByRangeUIHandler.java 2014-05-21 19:52:19 UTC (rev 87)
@@ -67,6 +67,10 @@
newTableCellRender(Range.class),
RangeTableModel.RANGE_COLUMN);
addIntegerColumnToModel(columnModel,
+ RangeTableModel.QUOTATION_QUANTITY_COLUMN,
+ null,
+ table);
+ addIntegerColumnToModel(columnModel,
RangeTableModel.PRODUCT_QUANTITY_COLUMN,
null,
table);
Modified: trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_fr_FR.properties
===================================================================
--- trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_fr_FR.properties 2014-05-21 19:30:41 UTC (rev 86)
+++ trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_fr_FR.properties 2014-05-21 19:52:19 UTC (rev 87)
@@ -1,3 +1,5 @@
+\ |\ =
+\:=
X=
application.action.create.error=
application.error.ui.business.warning=
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-05-21 19:30:41 UTC (rev 86)
+++ trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/FaxToMailApplicationListener.java 2014-05-21 19:52:19 UTC (rev 87)
@@ -27,6 +27,8 @@
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
+import com.franciaflex.faxtomail.web.job.EDIManagementJob;
+import com.franciaflex.faxtomail.web.job.MailFilterJob;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.quartz.CronScheduleBuilder;
@@ -76,25 +78,40 @@
data.put(MailFilterJob.SERVICE_CONTEXT, serviceContext);
- JobDetail job = JobBuilder.newJob(MailFilterJob.class)
- .usingJobData(data)
- .withIdentity("faxToMailJobs", "job1")
- .build();
+ JobDetail mailFilteringJob = JobBuilder.newJob(MailFilterJob.class)
+ .usingJobData(data)
+ .withIdentity("faxToMailJobs", "mailFilteringJob")
+ .build();
+ JobDetail ediManagementJob = JobBuilder.newJob(EDIManagementJob.class)
+ .usingJobData(data)
+ .withIdentity("faxToMailJobs", "ediManagementJob")
+ .build();
+
try {
Trigger trigger = TriggerBuilder
- .newTrigger()
- .withIdentity("mailFiltering", "trigger1")
-// .withSchedule(CronScheduleBuilder.cronSchedule("* 0/1 * * * ?"))
- .withSchedule(CronScheduleBuilder.cronSchedule("0/20 * * * * ?"))
- .build();
+ .newTrigger()
+ .withIdentity("mailFiltering", "mailFilteringTrigger")
+// .withSchedule(CronScheduleBuilder.cronSchedule("* 0/1 * * * ?"))
+ .withSchedule(CronScheduleBuilder.cronSchedule("0/20 * * * * ?"))
+ .build();
Scheduler scheduler = new StdSchedulerFactory().getScheduler();
scheduler.start();
- scheduler.scheduleJob(job, trigger);
+ scheduler.scheduleJob(mailFilteringJob, trigger);
- log.debug("scheduler launched");
+ trigger = TriggerBuilder
+ .newTrigger()
+ .withIdentity("ediManagement", "ediManagementTrigger")
+ .withSchedule(CronScheduleBuilder.cronSchedule("* 0/5 * * * ?"))
+ .build();
+ scheduler = new StdSchedulerFactory().getScheduler();
+ scheduler.start();
+ scheduler.scheduleJob(ediManagementJob, trigger);
+
+ log.debug("schedulers launched");
+
} catch (SchedulerException e) {
log.error("Error while launching the mail filter job", e);
}
Deleted: trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/MailFilterJob.java
===================================================================
--- trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/MailFilterJob.java 2014-05-21 19:30:41 UTC (rev 86)
+++ trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/MailFilterJob.java 2014-05-21 19:52:19 UTC (rev 87)
@@ -1,350 +0,0 @@
-package com.franciaflex.faxtomail.web;
-
-/*
- * #%L
- * FaxToMail :: Web
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2014 Franciaflex, Code Lutin
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import static org.nuiton.i18n.I18n.t;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.UnsupportedEncodingException;
-import java.nio.charset.Charset;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Date;
-import java.util.Enumeration;
-import java.util.List;
-import java.util.Properties;
-
-import javax.activation.DataHandler;
-import javax.activation.DataSource;
-import javax.mail.Address;
-import javax.mail.BodyPart;
-import javax.mail.Flags;
-import javax.mail.Folder;
-import javax.mail.Message;
-import javax.mail.MessagingException;
-import javax.mail.Part;
-import javax.mail.Session;
-import javax.mail.Store;
-import javax.mail.URLName;
-import javax.mail.internet.ContentType;
-import javax.mail.internet.MimeMessage;
-import javax.mail.internet.MimeMultipart;
-import javax.mail.internet.MimeUtility;
-
-import org.apache.commons.io.Charsets;
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.io.IOUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.nuiton.decorator.Decorator;
-import org.quartz.Job;
-import org.quartz.JobExecutionContext;
-import org.quartz.JobExecutionException;
-
-import com.franciaflex.faxtomail.persistence.entities.Attachment;
-import com.franciaflex.faxtomail.persistence.entities.AttachmentFile;
-import com.franciaflex.faxtomail.persistence.entities.AttachmentImpl;
-import com.franciaflex.faxtomail.persistence.entities.DemandStatus;
-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.MailFolder;
-import com.franciaflex.faxtomail.services.DecoratorService;
-import com.franciaflex.faxtomail.services.FaxToMailServiceContext;
-import com.franciaflex.faxtomail.services.service.CompanyService;
-import com.franciaflex.faxtomail.services.service.EmailService;
-import com.franciaflex.faxtomail.services.service.MailFolderService;
-
-/**
- * @author Kevin Morin (Code Lutin)
- * @since x.x
- */
-public class MailFilterJob implements Job {
-
- private static final Log log = LogFactory.getLog(MailFilterJob.class);
-
- public static final String SERVICE_CONTEXT = "serviceContext";
-
- protected FaxToMailServiceContext serviceContext;
-
- //TODO kmorin 20140414 handle imap protocol
- @Override
- public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
- serviceContext = (FaxToMailServiceContext) jobExecutionContext.getMergedJobDataMap().get(SERVICE_CONTEXT);
-
- CompanyService companyService = serviceContext.newService(CompanyService.class);
- Collection<EmailAccount> emailAccounts = companyService.getEmailAccounts();
-
- for (EmailAccount account : emailAccounts) {
- if ("pop3".equals(account.getProtocol().toLowerCase())) {
- checkEmailsOnPop3(account);
- }
- }
- }
-
- /**
- * Checks the emails of the account
- * @param account
- */
- public void checkEmailsOnPop3(EmailAccount account) {
- Properties properties = new Properties();
- properties.setProperty("mail.store.protocol", "pop3");
- properties.setProperty("mail.pop3.host", account.getHost());
- properties.setProperty("mail.pop3.user", account.getLogin());
-
- Session session = Session.getInstance(properties);
- Store store = null;
- Folder defaultFolder = null;
- Folder inbox = null;
-
- try {
- store = session.getStore(new URLName("pop3://" + account.getHost()));
- store.connect(account.getLogin(), account.getPassword());
- defaultFolder = store.getDefaultFolder();
- inbox = defaultFolder.getFolder("INBOX");
- checkEmailsOfFolder(inbox);
-
- } catch (Exception e) {
- log.error("Error while getting emails from the mailbox", e);
-
- } finally {
- close(inbox);
- close(defaultFolder);
- try {
- if (store != null && store.isConnected()) {
- store.close();
- }
- } catch (MessagingException e) {
- log.error("Error while closing the store", e);
- }
- }
-
- }
-
- protected void close(Folder folder) {
- if (folder != null && folder.isOpen()) {
- try {
- // TODO 20140414 kmorin close(true) in production
- folder.close(false); // false -> On n'efface pas les messages marqués DELETED
-
- } catch (Exception e) {
- log.error("Error while closing the folder", e);
- }
- }
- }
-
- /**
- * Check the emails of teh folder, create the emails in the database and delete the email in the folder
- * @param folder the folder to check
- */
- protected void checkEmailsOfFolder(Folder folder) {
- try {
- folder.open(Folder.READ_WRITE);
-
- int count = folder.getMessageCount();
- int unread = folder.getUnreadMessageCount();
-
- log.debug(count + " messages, " + unread + " unread");
-
- EmailService emailService = serviceContext.newService(EmailService.class);
-
- for (int i = 0 ; i < count ; i++) {
- Email email = new EmailImpl();
- emailService.saveEmail(email, null);
-
- int messageNumber = count - i;
- Message message = folder.getMessage(messageNumber);
-
- Charset charset = getCharset(message);
-
- List<String> modifiedProperties = new ArrayList<>();
-
-// log.debug("Object: " + message.getSubject());
-// email.s(message.getSubject());
-// modifiedProperties.add(Email.PROPERTY_OBJECT);
-
- Address[] addresses = message.getFrom();
- if (addresses != null && addresses.length > 0) {
- email.setSender(addresses[0].toString());
- modifiedProperties.add(Email.PROPERTY_SENDER);
- }
-
- List<Address> recipients = new ArrayList<>();
- Address[] toRecipients = message.getRecipients(Message.RecipientType.TO);
- if (toRecipients != null) {
- recipients.addAll(Arrays.asList(toRecipients));
- }
- Address[] ccRecipients = message.getRecipients(Message.RecipientType.CC);
- if (ccRecipients != null) {
- recipients.addAll(Arrays.asList(ccRecipients));
- }
-
- for (Address address : recipients) {
- String recipient = address.toString();
- MailFolder mailFolder = serviceContext.newService(MailFolderService.class).getFolderForRecipient(recipient);
-
- log.debug("\tTo : " + address + " -> " + (mailFolder != null ? mailFolder.getName() : "none"));
-
- if (mailFolder != null) {
- email.setRecipient(recipient);
- email.setMailFolder(mailFolder);
- modifiedProperties.add(Email.PROPERTY_RECIPIENT);
- modifiedProperties.add(Email.PROPERTY_MAIL_FOLDER);
- break;
- }
- }
-
- Date receivedDate = message.getReceivedDate();
- if (receivedDate == null) {
- receivedDate = message.getSentDate();
- }
- email.setReceptionDate(receivedDate);
- modifiedProperties.add(Email.PROPERTY_RECEPTION_DATE);
-
- Date now = new Date();
-
- DecoratorService decoratorService = serviceContext.newService(DecoratorService.class);
- Decorator<Date> dateDecorator = decoratorService.getDecoratorByType(Date.class, DecoratorService.DATE);
- String projectRef = t("faxtomail.email.projectReference.default", dateDecorator.toString(now));
- email.setProjectReference(projectRef);
- modifiedProperties.add(Email.PROPERTY_PROJECT_REFERENCE);
-
- email.setDemandStatus(DemandStatus.UNTREATED);
- modifiedProperties.add(Email.PROPERTY_DEMAND_STATUS);
-
- StringBuilder emailSource = new StringBuilder();
- Enumeration<String> headerLines = ((MimeMessage)message).getAllHeaderLines();
- while (headerLines.hasMoreElements()) {
- String headerLine = headerLines.nextElement();
- emailSource.append(headerLine).append("\n");
- }
- String originalContent = IOUtils.toString(message.getInputStream(), charset);
- emailSource.append("\n").append(originalContent);
- email.setOriginalEmail(emailSource.toString());
-
- if (message.isMimeType("multipart/*")) {
- decomposeMultipartEmail(message, email, emailService);
-// } else {
-// String content = IOUtils.toString(message.getInputStream(), charset);
-// email.setPlainContent(content);
- }
-
- emailService.saveEmail(email, null, modifiedProperties.toArray(new String[modifiedProperties.size()]));
-
- message.setFlag(Flags.Flag.DELETED, true);
- }
- log.debug("End of emails");
-
- } catch (Exception e) {
- log.error("Error while reading the emails", e);
- }
- }
-
- /**
- * Decompose a multipart part.
- * - sets the email content if the part contains a text bodypart
- * - adds attachments to the email
- *
- * @param part the part to decompose
- * @param email the email object to fill with the attachments or content
- * @param emailService email service
- * @throws Exception
- */
- protected void decomposeMultipartEmail(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);
-
- // if it is a text part, the,n this is the email content
- String disposition = bp.getDisposition();
- if (bp.isMimeType("text/*") && !Part.ATTACHMENT.equals(disposition)) {
-// String content = IOUtils.toString(bp.getInputStream(), charset);
-// if (bp.isMimeType("text/plain")) {
-// email.setPlainContent(content);
-// } else {
-// email.setHtmlContent(content);
-// }
-
- // if it is multipart part, decompose it
- } else if (bp.isMimeType("multipart/*")) {
- decomposeMultipartEmail(bp, email, emailService);
-
- // else, this is an attachment
- } else {
- String fileName = bp.getFileName();
- if (fileName == null) {
- String[] headers = bp.getHeader("Content-ID");
- if (headers == null) {
- break;
- }
- fileName = headers[0];
- // remove the guillemets between the id
- fileName = fileName.replaceFirst("^<(.*)>$", "$1");
- }
-
- try {
- fileName = MimeUtility.decodeText(fileName);
- log.debug("FileName : " + fileName);
- } catch (UnsupportedEncodingException ex) {
- // don't care, use filename raw value
- if (log.isWarnEnabled()) {
- log.warn("Can't debug email file name", ex);
- }
- }
-
- File dir = new File(FileUtils.getTempDirectory(), email.getTopiaId());
- if (!dir.exists()) {
- dir.mkdir();
- }
- File file = new File(dir, fileName);
- FileOutputStream fos = new FileOutputStream(file);
-
- DataHandler dh = bp.getDataHandler();
- dh.writeTo(fos);
-
- Attachment attachment = new AttachmentImpl();
- attachment.setAddedByUser(false);
- AttachmentFile attachmentFile = emailService.getAttachmentFileFromStream(dh.getInputStream());
- attachmentFile.setFilename(dh.getName());
- attachment.setOriginalFile(attachmentFile);
-
- email.addAttachment(attachment);
- }
- }
- }
-
- protected Charset getCharset(Part part) throws MessagingException {
- ContentType contentType = new ContentType(part.getContentType());
- String charsetName = contentType.getParameter("charset");
- Charset charset = Charsets.toCharset(charsetName);
- return charset;
- }
-}
Added: trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/job/EDIManagementJob.java
===================================================================
--- trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/job/EDIManagementJob.java (rev 0)
+++ trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/job/EDIManagementJob.java 2014-05-21 19:52:19 UTC (rev 87)
@@ -0,0 +1,57 @@
+package com.franciaflex.faxtomail.web.job;
+
+/*
+ * #%L
+ * FaxToMail :: Web
+ * $Id: MailFilterJob.java 82 2014-05-20 14:25:32Z echatellier $
+ * $HeadURL: https://svn.codelutin.com/faxtomail/trunk/faxtomail-ui-web/src/main/java/co… $
+ * %%
+ * Copyright (C) 2014 Franciaflex, Code Lutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import com.franciaflex.faxtomail.services.FaxToMailServiceContext;
+import com.franciaflex.faxtomail.services.service.EmailService;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.quartz.Job;
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
+
+/**
+ * @author Kevin Morin (Code Lutin)
+ * @since x.x
+ */
+public class EDIManagementJob implements Job {
+
+ private static final Log log = LogFactory.getLog(EDIManagementJob.class);
+
+ public static final String SERVICE_CONTEXT = "serviceContext";
+
+ protected FaxToMailServiceContext serviceContext;
+
+ @Override
+ public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
+ serviceContext = (FaxToMailServiceContext) jobExecutionContext.getMergedJobDataMap().get(SERVICE_CONTEXT);
+
+ EmailService emailService = serviceContext.newService(EmailService.class);
+ emailService.transmitPendingDemandsToEdi();
+
+ //TODO kmorin 20140521 check in the transfert table if new command number arrived
+ }
+
+}
Copied: trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/job/MailFilterJob.java (from rev 84, trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/MailFilterJob.java)
===================================================================
--- trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/job/MailFilterJob.java (rev 0)
+++ trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/job/MailFilterJob.java 2014-05-21 19:52:19 UTC (rev 87)
@@ -0,0 +1,350 @@
+package com.franciaflex.faxtomail.web.job;
+
+/*
+ * #%L
+ * FaxToMail :: Web
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2014 Franciaflex, Code Lutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import static org.nuiton.i18n.I18n.t;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.UnsupportedEncodingException;
+import java.nio.charset.Charset;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Date;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.Properties;
+
+import javax.activation.DataHandler;
+import javax.activation.DataSource;
+import javax.mail.Address;
+import javax.mail.BodyPart;
+import javax.mail.Flags;
+import javax.mail.Folder;
+import javax.mail.Message;
+import javax.mail.MessagingException;
+import javax.mail.Part;
+import javax.mail.Session;
+import javax.mail.Store;
+import javax.mail.URLName;
+import javax.mail.internet.ContentType;
+import javax.mail.internet.MimeMessage;
+import javax.mail.internet.MimeMultipart;
+import javax.mail.internet.MimeUtility;
+
+import org.apache.commons.io.Charsets;
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.IOUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.nuiton.decorator.Decorator;
+import org.quartz.Job;
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
+
+import com.franciaflex.faxtomail.persistence.entities.Attachment;
+import com.franciaflex.faxtomail.persistence.entities.AttachmentFile;
+import com.franciaflex.faxtomail.persistence.entities.AttachmentImpl;
+import com.franciaflex.faxtomail.persistence.entities.DemandStatus;
+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.MailFolder;
+import com.franciaflex.faxtomail.services.DecoratorService;
+import com.franciaflex.faxtomail.services.FaxToMailServiceContext;
+import com.franciaflex.faxtomail.services.service.CompanyService;
+import com.franciaflex.faxtomail.services.service.EmailService;
+import com.franciaflex.faxtomail.services.service.MailFolderService;
+
+/**
+ * @author Kevin Morin (Code Lutin)
+ * @since x.x
+ */
+public class MailFilterJob implements Job {
+
+ private static final Log log = LogFactory.getLog(MailFilterJob.class);
+
+ public static final String SERVICE_CONTEXT = "serviceContext";
+
+ protected FaxToMailServiceContext serviceContext;
+
+ //TODO kmorin 20140414 handle imap protocol
+ @Override
+ public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
+ serviceContext = (FaxToMailServiceContext) jobExecutionContext.getMergedJobDataMap().get(SERVICE_CONTEXT);
+
+ CompanyService companyService = serviceContext.newService(CompanyService.class);
+ Collection<EmailAccount> emailAccounts = companyService.getEmailAccounts();
+
+ for (EmailAccount account : emailAccounts) {
+ if ("pop3".equals(account.getProtocol().toLowerCase())) {
+ checkEmailsOnPop3(account);
+ }
+ }
+ }
+
+ /**
+ * Checks the emails of the account
+ * @param account
+ */
+ public void checkEmailsOnPop3(EmailAccount account) {
+ Properties properties = new Properties();
+ properties.setProperty("mail.store.protocol", "pop3");
+ properties.setProperty("mail.pop3.host", account.getHost());
+ properties.setProperty("mail.pop3.user", account.getLogin());
+
+ Session session = Session.getInstance(properties);
+ Store store = null;
+ Folder defaultFolder = null;
+ Folder inbox = null;
+
+ try {
+ store = session.getStore(new URLName("pop3://" + account.getHost()));
+ store.connect(account.getLogin(), account.getPassword());
+ defaultFolder = store.getDefaultFolder();
+ inbox = defaultFolder.getFolder("INBOX");
+ checkEmailsOfFolder(inbox);
+
+ } catch (Exception e) {
+ log.error("Error while getting emails from the mailbox", e);
+
+ } finally {
+ close(inbox);
+ close(defaultFolder);
+ try {
+ if (store != null && store.isConnected()) {
+ store.close();
+ }
+ } catch (MessagingException e) {
+ log.error("Error while closing the store", e);
+ }
+ }
+
+ }
+
+ protected void close(Folder folder) {
+ if (folder != null && folder.isOpen()) {
+ try {
+ // TODO 20140414 kmorin close(true) in production
+ folder.close(false); // false -> On n'efface pas les messages marqués DELETED
+
+ } catch (Exception e) {
+ log.error("Error while closing the folder", e);
+ }
+ }
+ }
+
+ /**
+ * Check the emails of teh folder, create the emails in the database and delete the email in the folder
+ * @param folder the folder to check
+ */
+ protected void checkEmailsOfFolder(Folder folder) {
+ try {
+ folder.open(Folder.READ_WRITE);
+
+ int count = folder.getMessageCount();
+ int unread = folder.getUnreadMessageCount();
+
+ log.debug(count + " messages, " + unread + " unread");
+
+ EmailService emailService = serviceContext.newService(EmailService.class);
+
+ for (int i = 0 ; i < count ; i++) {
+ Email email = new EmailImpl();
+ emailService.saveEmail(email, null);
+
+ int messageNumber = count - i;
+ Message message = folder.getMessage(messageNumber);
+
+ Charset charset = getCharset(message);
+
+ List<String> modifiedProperties = new ArrayList<>();
+
+// log.debug("Object: " + message.getSubject());
+// email.s(message.getSubject());
+// modifiedProperties.add(Email.PROPERTY_OBJECT);
+
+ Address[] addresses = message.getFrom();
+ if (addresses != null && addresses.length > 0) {
+ email.setSender(addresses[0].toString());
+ modifiedProperties.add(Email.PROPERTY_SENDER);
+ }
+
+ List<Address> recipients = new ArrayList<>();
+ Address[] toRecipients = message.getRecipients(Message.RecipientType.TO);
+ if (toRecipients != null) {
+ recipients.addAll(Arrays.asList(toRecipients));
+ }
+ Address[] ccRecipients = message.getRecipients(Message.RecipientType.CC);
+ if (ccRecipients != null) {
+ recipients.addAll(Arrays.asList(ccRecipients));
+ }
+
+ for (Address address : recipients) {
+ String recipient = address.toString();
+ MailFolder mailFolder = serviceContext.newService(MailFolderService.class).getFolderForRecipient(recipient);
+
+ log.debug("\tTo : " + address + " -> " + (mailFolder != null ? mailFolder.getName() : "none"));
+
+ if (mailFolder != null) {
+ email.setRecipient(recipient);
+ email.setMailFolder(mailFolder);
+ modifiedProperties.add(Email.PROPERTY_RECIPIENT);
+ modifiedProperties.add(Email.PROPERTY_MAIL_FOLDER);
+ break;
+ }
+ }
+
+ Date receivedDate = message.getReceivedDate();
+ if (receivedDate == null) {
+ receivedDate = message.getSentDate();
+ }
+ email.setReceptionDate(receivedDate);
+ modifiedProperties.add(Email.PROPERTY_RECEPTION_DATE);
+
+ Date now = new Date();
+
+ DecoratorService decoratorService = serviceContext.newService(DecoratorService.class);
+ Decorator<Date> dateDecorator = decoratorService.getDecoratorByType(Date.class, DecoratorService.DATE);
+ String projectRef = t("faxtomail.email.projectReference.default", dateDecorator.toString(now));
+ email.setProjectReference(projectRef);
+ modifiedProperties.add(Email.PROPERTY_PROJECT_REFERENCE);
+
+ email.setDemandStatus(DemandStatus.UNTREATED);
+ modifiedProperties.add(Email.PROPERTY_DEMAND_STATUS);
+
+ StringBuilder emailSource = new StringBuilder();
+ Enumeration<String> headerLines = ((MimeMessage)message).getAllHeaderLines();
+ while (headerLines.hasMoreElements()) {
+ String headerLine = headerLines.nextElement();
+ emailSource.append(headerLine).append("\n");
+ }
+ String originalContent = IOUtils.toString(message.getInputStream(), charset);
+ emailSource.append("\n").append(originalContent);
+ email.setOriginalEmail(emailSource.toString());
+
+ if (message.isMimeType("multipart/*")) {
+ decomposeMultipartEmail(message, email, emailService);
+// } else {
+// String content = IOUtils.toString(message.getInputStream(), charset);
+// email.setPlainContent(content);
+ }
+
+ emailService.saveEmail(email, null, modifiedProperties.toArray(new String[modifiedProperties.size()]));
+
+ message.setFlag(Flags.Flag.DELETED, true);
+ }
+ log.debug("End of emails");
+
+ } catch (Exception e) {
+ log.error("Error while reading the emails", e);
+ }
+ }
+
+ /**
+ * Decompose a multipart part.
+ * - sets the email content if the part contains a text bodypart
+ * - adds attachments to the email
+ *
+ * @param part the part to decompose
+ * @param email the email object to fill with the attachments or content
+ * @param emailService email service
+ * @throws Exception
+ */
+ protected void decomposeMultipartEmail(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);
+
+ // if it is a text part, the,n this is the email content
+ String disposition = bp.getDisposition();
+ if (bp.isMimeType("text/*") && !Part.ATTACHMENT.equals(disposition)) {
+// String content = IOUtils.toString(bp.getInputStream(), charset);
+// if (bp.isMimeType("text/plain")) {
+// email.setPlainContent(content);
+// } else {
+// email.setHtmlContent(content);
+// }
+
+ // if it is multipart part, decompose it
+ } else if (bp.isMimeType("multipart/*")) {
+ decomposeMultipartEmail(bp, email, emailService);
+
+ // else, this is an attachment
+ } else {
+ String fileName = bp.getFileName();
+ if (fileName == null) {
+ String[] headers = bp.getHeader("Content-ID");
+ if (headers == null) {
+ break;
+ }
+ fileName = headers[0];
+ // remove the guillemets between the id
+ fileName = fileName.replaceFirst("^<(.*)>$", "$1");
+ }
+
+ try {
+ fileName = MimeUtility.decodeText(fileName);
+ log.debug("FileName : " + fileName);
+ } catch (UnsupportedEncodingException ex) {
+ // don't care, use filename raw value
+ if (log.isWarnEnabled()) {
+ log.warn("Can't debug email file name", ex);
+ }
+ }
+
+ File dir = new File(FileUtils.getTempDirectory(), email.getTopiaId());
+ if (!dir.exists()) {
+ dir.mkdir();
+ }
+ File file = new File(dir, fileName);
+ FileOutputStream fos = new FileOutputStream(file);
+
+ DataHandler dh = bp.getDataHandler();
+ dh.writeTo(fos);
+
+ Attachment attachment = new AttachmentImpl();
+ attachment.setAddedByUser(false);
+ AttachmentFile attachmentFile = emailService.getAttachmentFileFromStream(dh.getInputStream());
+ attachmentFile.setFilename(dh.getName());
+ attachment.setOriginalFile(attachmentFile);
+
+ email.addAttachment(attachment);
+ }
+ }
+ }
+
+ protected Charset getCharset(Part part) throws MessagingException {
+ ContentType contentType = new ContentType(part.getContentType());
+ String charsetName = contentType.getParameter("charset");
+ Charset charset = Charsets.toCharset(charsetName);
+ return charset;
+ }
+}
Property changes on: trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/job/MailFilterJob.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
1
0
r86 - in trunk/faxtomail-ui-swing/src/main: java/com/franciaflex/faxtomail/ui/swing/actions java/com/franciaflex/faxtomail/ui/swing/content/transmit resources/i18n
by kmorin@users.forge.codelutin.com 21 May '14
by kmorin@users.forge.codelutin.com 21 May '14
21 May '14
Author: kmorin
Date: 2014-05-21 21:30:41 +0200 (Wed, 21 May 2014)
New Revision: 86
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/86
Log:
ajout des descriptions des actions
Modified:
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ArchiveAction.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ArchiveFromListAction.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/CloseApplicationAction.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ComputeQuantitiesByRangeAction.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/GenerateAnnotatedAttachmentAction.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/GoToPreviousScreenAction.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/GroupAction.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ReloadFaxToMailAction.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ReplyAction.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/SaveDemandeAction.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/SearchAction.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/SearchToGroupAction.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ShowDemandeAction.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ShowDemandeListAction.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ShowRechercheAction.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/StartAction.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/TransmitAction.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/transmit/MailFolderChooserUIHandler.java
trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_fr_FR.properties
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ArchiveAction.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ArchiveAction.java 2014-05-21 18:23:57 UTC (rev 85)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ArchiveAction.java 2014-05-21 19:30:41 UTC (rev 86)
@@ -43,6 +43,7 @@
public ArchiveAction(DemandeUIHandler handler) {
super(handler);
+ setActionDescription(t("faxtomail.action.archive.tip"));
}
@Override
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ArchiveFromListAction.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ArchiveFromListAction.java 2014-05-21 18:23:57 UTC (rev 85)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ArchiveFromListAction.java 2014-05-21 19:30:41 UTC (rev 86)
@@ -43,6 +43,7 @@
public ArchiveFromListAction(DemandeListUIHandler handler) {
super(handler);
+ setActionDescription(t("faxtomail.action.archive.tip"));
}
@Override
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/CloseApplicationAction.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/CloseApplicationAction.java 2014-05-21 18:23:57 UTC (rev 85)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/CloseApplicationAction.java 2014-05-21 19:30:41 UTC (rev 86)
@@ -40,7 +40,7 @@
public CloseApplicationAction(MainUIHandler handler) {
super(handler, false, null);
setSkipCheckCurrentScreen(true);
- setActionDescription(t("faxtomail.main.action.exit.tip"));
+ setActionDescription(t("faxtomail.action.exit.tip"));
}
public void setExitCode(int exitCode) {
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ComputeQuantitiesByRangeAction.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ComputeQuantitiesByRangeAction.java 2014-05-21 18:23:57 UTC (rev 85)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ComputeQuantitiesByRangeAction.java 2014-05-21 19:30:41 UTC (rev 86)
@@ -54,6 +54,7 @@
public ComputeQuantitiesByRangeAction(QuantitiesByRangeUIHandler handler) {
super(handler, false);
+ setActionDescription(t("faxtomail.action.computeQuantitiesByRange.tip"));
}
@Override
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/GenerateAnnotatedAttachmentAction.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/GenerateAnnotatedAttachmentAction.java 2014-05-21 18:23:57 UTC (rev 85)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/GenerateAnnotatedAttachmentAction.java 2014-05-21 19:30:41 UTC (rev 86)
@@ -74,6 +74,8 @@
import org.apache.commons.logging.LogFactory;
import org.w3c.dom.css.Rect;
+import static org.nuiton.i18n.I18n.t;
+
/**
* @author Kevin Morin (Code Lutin)
* @since x.x
@@ -84,6 +86,7 @@
public GenerateAnnotatedAttachmentAction(PDFEditorUIHandler handler) {
super(handler, true);
+ setActionDescription(t("faxtomail.action.generateAnnotatedAttachment.tip"));
}
@Override
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/GoToPreviousScreenAction.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/GoToPreviousScreenAction.java 2014-05-21 18:23:57 UTC (rev 85)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/GoToPreviousScreenAction.java 2014-05-21 19:30:41 UTC (rev 86)
@@ -39,6 +39,6 @@
true,
PREVIOUS_SCREEN.getContextValue(handler.getUI())
);
- setActionDescription(t("faxtomail.main.action.goto.previousScreen.tip"));
+ setActionDescription(t("faxtomail.action.goto.previousScreen.tip"));
}
}
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/GroupAction.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/GroupAction.java 2014-05-21 18:23:57 UTC (rev 85)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/GroupAction.java 2014-05-21 19:30:41 UTC (rev 86)
@@ -50,6 +50,7 @@
public GroupAction(SearchToGroupUIHandler handler) {
super(handler, false);
+ setActionDescription(t("faxtomail.action.group.tip"));
}
protected DemandeUIModel currentEmail;
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ReloadFaxToMailAction.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ReloadFaxToMailAction.java 2014-05-21 18:23:57 UTC (rev 85)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ReloadFaxToMailAction.java 2014-05-21 19:30:41 UTC (rev 86)
@@ -37,7 +37,7 @@
public ReloadFaxToMailAction(MainUIHandler handler) {
super(handler, true, null);
- setActionDescription(t("faxtomail.main.action.reloadFaxToMail"));
+ setActionDescription(t("faxtomail.action.reloadFaxToMail"));
}
@Override
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ReplyAction.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ReplyAction.java 2014-05-21 18:23:57 UTC (rev 85)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ReplyAction.java 2014-05-21 19:30:41 UTC (rev 86)
@@ -33,6 +33,8 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import static org.nuiton.i18n.I18n.t;
+
/**
* @author Kevin Morin (Code Lutin)
* @since x.x
@@ -44,6 +46,7 @@
public ReplyAction(ReplyFormUIHandler handler) {
super(handler, false);
+ setActionDescription(t("faxtomail.action.reply.tip"));
}
@Override
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/SaveDemandeAction.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/SaveDemandeAction.java 2014-05-21 18:23:57 UTC (rev 85)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/SaveDemandeAction.java 2014-05-21 19:30:41 UTC (rev 86)
@@ -47,6 +47,8 @@
import com.franciaflex.faxtomail.ui.swing.content.demande.RangeTableModel;
import com.google.common.collect.Maps;
+import static org.nuiton.i18n.I18n.t;
+
/**
* @author Kevin Morin (Code Lutin)
* @since x.x
@@ -55,6 +57,7 @@
public SaveDemandeAction(DemandeUIHandler handler) {
super(handler, false);
+ setActionDescription(t("faxtomail.action.save.tip"));
}
@Override
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/SearchAction.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/SearchAction.java 2014-05-21 18:23:57 UTC (rev 85)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/SearchAction.java 2014-05-21 19:30:41 UTC (rev 86)
@@ -34,6 +34,8 @@
import com.franciaflex.faxtomail.ui.swing.content.search.SearchUIHandler;
import com.franciaflex.faxtomail.ui.swing.content.search.SearchUIModel;
+import static org.nuiton.i18n.I18n.t;
+
/**
* @author Kevin Morin (Code Lutin)
* @since x.x
@@ -42,6 +44,7 @@
public SearchAction(SearchUIHandler handler) {
super(handler, false);
+ setActionDescription(t("faxtomail.action.search.tip"));
}
@Override
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/SearchToGroupAction.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/SearchToGroupAction.java 2014-05-21 18:23:57 UTC (rev 85)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/SearchToGroupAction.java 2014-05-21 19:30:41 UTC (rev 86)
@@ -34,6 +34,8 @@
import java.util.ArrayList;
import java.util.List;
+import static org.nuiton.i18n.I18n.t;
+
/**
* @author Kevin Morin (Code Lutin)
* @since x.x
@@ -42,6 +44,7 @@
public SearchToGroupAction(SearchToGroupUIHandler handler) {
super(handler, false);
+ setActionDescription(t("faxtomail.action.search.tip"));
}
@Override
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ShowDemandeAction.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ShowDemandeAction.java 2014-05-21 18:23:57 UTC (rev 85)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ShowDemandeAction.java 2014-05-21 19:30:41 UTC (rev 86)
@@ -47,6 +47,7 @@
public ShowDemandeAction(MainUIHandler handler) {
super(handler, true, FaxToMailScreen.DEMANDE);
+ setActionDescription(t("faxtomail.action.goto.demand.tip"));
}
@Override
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ShowDemandeListAction.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ShowDemandeListAction.java 2014-05-21 18:23:57 UTC (rev 85)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ShowDemandeListAction.java 2014-05-21 19:30:41 UTC (rev 86)
@@ -25,6 +25,8 @@
import com.franciaflex.faxtomail.ui.swing.FaxToMailScreen;
import com.franciaflex.faxtomail.ui.swing.content.MainUIHandler;
+import static org.nuiton.i18n.I18n.t;
+
/**
* To show demande screen.
*
@@ -35,6 +37,7 @@
public ShowDemandeListAction(MainUIHandler handler) {
super(handler, true, FaxToMailScreen.LIST);
+ setActionDescription(t("faxtomail.action.goto.demandList.tip"));
}
@Override
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ShowRechercheAction.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ShowRechercheAction.java 2014-05-21 18:23:57 UTC (rev 85)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ShowRechercheAction.java 2014-05-21 19:30:41 UTC (rev 86)
@@ -25,6 +25,8 @@
import com.franciaflex.faxtomail.ui.swing.FaxToMailScreen;
import com.franciaflex.faxtomail.ui.swing.content.MainUIHandler;
+import static org.nuiton.i18n.I18n.t;
+
/**
* To show demande screen.
*
@@ -35,6 +37,7 @@
public ShowRechercheAction(MainUIHandler handler) {
super(handler, true, FaxToMailScreen.SEARCH);
+ setActionDescription(t("faxtomail.action.goto.search.tip"));
}
}
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/StartAction.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/StartAction.java 2014-05-21 18:23:57 UTC (rev 85)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/StartAction.java 2014-05-21 19:30:41 UTC (rev 86)
@@ -26,6 +26,8 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import static org.nuiton.i18n.I18n.t;
+
/**
* Start action (when the start action file is present when
* starting application).
@@ -42,6 +44,7 @@
public StartAction(MainUIHandler handler) {
super(handler, true);
+ setActionDescription(t("faxtomail.action.start.tip"));
}
@Override
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/TransmitAction.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/TransmitAction.java 2014-05-21 18:23:57 UTC (rev 85)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/TransmitAction.java 2014-05-21 19:30:41 UTC (rev 86)
@@ -33,6 +33,8 @@
import jaxx.runtime.JAXXContext;
import jaxx.runtime.JAXXUtil;
+import static org.nuiton.i18n.I18n.t;
+
/**
* @author Kevin Morin (Code Lutin)
* @since x.x
@@ -41,6 +43,7 @@
public TransmitAction(MailFolderChooserUIHandler handler) {
super(handler, false);
+ setActionDescription(t("faxtomail.action.transmit.tip"));
}
@Override
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/transmit/MailFolderChooserUIHandler.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/transmit/MailFolderChooserUIHandler.java 2014-05-21 18:23:57 UTC (rev 85)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/transmit/MailFolderChooserUIHandler.java 2014-05-21 19:30:41 UTC (rev 86)
@@ -69,8 +69,8 @@
}
// init tree
- Company franciaflex = getContext().getCurrentCompany();
- Collection<MailFolder> folders = franciaflex.getMailFolder();
+// Company franciaflex = getContext().getCurrentCompany();
+ Collection<MailFolder> folders = getContext().getMailFolderService().getRootMailFolders();
JTree navigationTree = ui.getNavigationTree();
Map<MailFolder, DefaultMutableTreeNode> nodesByFolder =
Modified: trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_fr_FR.properties
===================================================================
--- trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_fr_FR.properties 2014-05-21 18:23:57 UTC (rev 85)
+++ trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_fr_FR.properties 2014-05-21 19:30:41 UTC (rev 86)
@@ -1,11 +1,27 @@
-\ |\ =
-%=
-+=
--=
-\:=
X=
application.action.create.error=
application.error.ui.business.warning=
+faxtomail.action.archive.tip=Archiver l'élément
+faxtomail.action.computeQuantitiesByRange.tip=Calculer les quantités par gamme
+faxtomail.action.configuration=Configuration
+faxtomail.action.configuration.mnemonic=
+faxtomail.action.configuration.tip=Menu configuration
+faxtomail.action.demandeList=Gestion des fax
+faxtomail.action.demandeList.tip=Gestion des fax
+faxtomail.action.exit=Quitter
+faxtomail.action.exit.tip=Quitter l'application
+faxtomail.action.generateAnnotatedAttachment.tip=Générer le pdf annoté
+faxtomail.action.goto.demand.tip=Aller au détail de l'élément
+faxtomail.action.goto.demandList.tip=Aller à la liste des éléments
+faxtomail.action.goto.previousScreen.tip=Retourner à l'écran précédent
+faxtomail.action.goto.search.tip=Aller à l'écran de recherche
+faxtomail.action.group.tip=Grouper l'élément
+faxtomail.action.reloadFaxToMail=Recharger FaxToMail
+faxtomail.action.reply.tip=Envoyer la réponse
+faxtomail.action.save.tip=Enregistrer
+faxtomail.action.search.tip=Rechercher
+faxtomail.action.start.tip=Démarrer FaxToMail
+faxtomail.action.transmit.tip=Déplacer l'élément
faxtomail.alert.alreadyTakenBy.button.quit=Quitter
faxtomail.alert.alreadyTakenBy.button.take=Prendre
faxtomail.alert.alreadyTakenBy.button.view=Visualiser
@@ -180,22 +196,22 @@
faxtomail.historyList.title=Historique
faxtomail.i18n.deleteCache.error=
faxtomail.i18n.mkDir.error=
-faxtomail.main.action.configuration=Configuration
+faxtomail.main.action.configuration=
faxtomail.main.action.configuration.mnemonic=
-faxtomail.main.action.configuration.tip=Menu configuration
-faxtomail.main.action.demandeList=Gestion des fax
-faxtomail.main.action.demandeList.tip=Gestion des fax
-faxtomail.main.action.exit=Quitter
-faxtomail.main.action.exit.tip=Quitter l'application
-faxtomail.main.action.goto.previousScreen.tip=
-faxtomail.main.action.recherche=Recherche
-faxtomail.main.action.recherche.tip=Recherche de demandes archivées
-faxtomail.main.action.reloadFaxToMail=
-faxtomail.main.menu.file=Fichier
-faxtomail.main.menu.file.tip=Menu fichier
+faxtomail.main.action.configuration.tip=
+faxtomail.main.action.demandeList=
+faxtomail.main.action.demandeList.tip=
+faxtomail.main.action.exit=
+faxtomail.main.action.exit.tip=
+faxtomail.main.action.recherche=
+faxtomail.main.action.recherche.tip=
+faxtomail.main.menu.file=
+faxtomail.main.menu.file.tip=
faxtomail.main.title.application=FaxToMail
faxtomail.main.title.applicationName=FaxToMail
faxtomail.main.title.nodb=
+faxtomail.menu.file=Fichier
+faxtomail.menu.file.tip=Menu fichier
faxtomail.pdfEditor.action.cancel=Annuler
faxtomail.pdfEditor.action.cancel.tip=Ne pas enregistrer les changements et fermer
faxtomail.pdfEditor.action.validate=Enregistrer
1
0
r85 - in trunk/faxtomail-ui-swing/src/main: java/com/franciaflex/faxtomail/ui/swing java/com/franciaflex/faxtomail/ui/swing/actions java/com/franciaflex/faxtomail/ui/swing/content/attachment java/com/franciaflex/faxtomail/ui/swing/content/demande java/com/franciaflex/faxtomail/ui/swing/content/search java/com/franciaflex/faxtomail/ui/swing/util resources/i18n
by kmorin@users.forge.codelutin.com 21 May '14
by kmorin@users.forge.codelutin.com 21 May '14
21 May '14
Author: kmorin
Date: 2014-05-21 20:23:57 +0200 (Wed, 21 May 2014)
New Revision: 85
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/85
Log:
refs #4662 prise en compte des colonnes de chaque dossier
diff?\195?\169renciation de la modif et de l'ouverture des versions modifi?\195?\169es des pi?\195?\168ces jointes
visualisation des pi?\195?\168ces jointes modifi?\195?\169es depuis la liste principale
Modified:
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/FaxToMailUIContext.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/GenerateAnnotatedAttachmentAction.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentCellEditor.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentEditorUIHandler.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentEditorUIModel.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentItem.css
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUIHandler.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIHandler.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchToGroupUIHandler.java
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/util/AbstractFaxToMailDemandListHandler.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FaxToMailUIUtil.java
trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_fr_FR.properties
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/FaxToMailUIContext.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/FaxToMailUIContext.java 2014-05-21 16:53:25 UTC (rev 84)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/FaxToMailUIContext.java 2014-05-21 18:23:57 UTC (rev 85)
@@ -24,7 +24,7 @@
import com.franciaflex.faxtomail.FaxToMailConfiguration;
import com.franciaflex.faxtomail.persistence.entities.Company;
-import com.franciaflex.faxtomail.persistence.entities.Email;
+import com.franciaflex.faxtomail.persistence.entities.Configuration;
import com.franciaflex.faxtomail.persistence.entities.FaxToMailTopiaApplicationContext;
import com.franciaflex.faxtomail.persistence.entities.FaxToMailTopiaPersistenceContext;
import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser;
@@ -72,8 +72,6 @@
import org.nuiton.util.converter.ConverterUtil;
import javax.swing.*;
-import javax.swing.event.RowSorterEvent;
-import javax.swing.tree.TreePath;
import java.awt.*;
import java.beans.PropertyChangeEvent;
@@ -81,7 +79,6 @@
import java.io.Closeable;
import java.io.File;
import java.util.ArrayList;
-import java.util.Enumeration;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
@@ -218,7 +215,7 @@
private final ApplicationActionEngine faxToMailActionEngine;
- protected Company currentCompany;
+ protected Configuration faxToMailConfiguration;
protected FaxToMailUser currentUser;
@@ -455,8 +452,8 @@
// }
//
- Company franciaflex = getCompanyService().getCompanyByName("Franciaflex");
- setCurrentCompany(franciaflex);
+// Company franciaflex = getCompanyService().getCompanyByName("Franciaflex");
+// setCurrentCompany(franciaflex);
FaxToMailUser currentUser = getUserService().getUserByLogin("cbaillet");
setCurrentUser(currentUser);
@@ -697,12 +694,12 @@
firePropertyChange(PROPERTY_LOCALE, null, locale);
}
- public Company getCurrentCompany() {
- return currentCompany;
+ public Configuration getFaxToMailConfiguration() {
+ return faxToMailConfiguration;
}
- public void setCurrentCompany(Company currentCompany) {
- this.currentCompany = currentCompany;
+ public void setFaxToMailConfiguration(Configuration faxToMailConfiguration) {
+ this.faxToMailConfiguration = faxToMailConfiguration;
}
public FaxToMailUser getCurrentUser() {
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/GenerateAnnotatedAttachmentAction.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/GenerateAnnotatedAttachmentAction.java 2014-05-21 16:53:25 UTC (rev 84)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/GenerateAnnotatedAttachmentAction.java 2014-05-21 18:23:57 UTC (rev 85)
@@ -34,6 +34,7 @@
import javax.swing.JTextArea;
+import com.franciaflex.faxtomail.ui.swing.util.FaxToMailUIUtil;
import jaxx.runtime.JAXXContext;
import jaxx.runtime.JAXXUtil;
import jaxx.runtime.SwingUtil;
@@ -246,7 +247,7 @@
// convert content to blob
InputStream is = new BufferedInputStream(new FileInputStream(target));
AttachmentFile attachmentFileNew = getContext().getEmailService().getAttachmentFileFromStream(is);
- attachmentFileNew.setFilename(getModel().getOriginalFile().getFilename() + "-annoté.pdf");
+ attachmentFileNew.setFilename(FaxToMailUIUtil.getEditedFileName(getModel().getOriginalFile()));
getModel().setEditedFile(attachmentFileNew);
}
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentCellEditor.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentCellEditor.java 2014-05-21 16:53:25 UTC (rev 84)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentCellEditor.java 2014-05-21 18:23:57 UTC (rev 85)
@@ -31,6 +31,7 @@
import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel;
import com.franciaflex.faxtomail.ui.swing.util.AbstractFaxToMailBeanUIModel;
import com.franciaflex.faxtomail.ui.swing.util.FaxToMailUI;
+import com.franciaflex.faxtomail.ui.swing.util.FaxToMailUIUtil;
import com.google.common.base.Preconditions;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -105,14 +106,20 @@
listener = new AttachmentEditorUIModel.AttachmentListener() {
@Override
- public void onAttachmentOpened(Attachment attachment) {
+ public void onAttachmentOpened(Attachment attachment, boolean original) {
String topiaId = model.getTopiaId();
if (topiaId != null) {
+ String filename;
+ if (original) {
+ filename = attachment.getOriginalFile().getFilename();
+ } else {
+ filename = FaxToMailUIUtil.getEditedFileName(attachment.getOriginalFile());
+ }
Email email = context.getEmailService().addToHistory(topiaId,
HistoryType.ATTACHMENT_OPENING,
context.getCurrentUser(),
new Date(),
- attachment.getOriginalFile().getFilename());
+ filename);
model.fromEntity(email);
}
}
@@ -124,7 +131,7 @@
HistoryType.ATTACHMENT_MODIFICATION,
context.getCurrentUser(),
new Date(),
- attachment.getOriginalFile().getFilename());
+ FaxToMailUIUtil.getEditedFileName(attachment.getOriginalFile()));
model.fromEntity(email);
}
};
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentEditorUIHandler.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentEditorUIHandler.java 2014-05-21 16:53:25 UTC (rev 84)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentEditorUIHandler.java 2014-05-21 18:23:57 UTC (rev 85)
@@ -178,7 +178,7 @@
public void openAttachment(Attachment attachment) {
- getModel().fireAttachmentOpened(attachment);
+ getModel().fireAttachmentOpened(attachment, true);
File file = attachment.getOriginalFile().getFile();
Desktop desktop = FaxToMailUIUtil.getDesktopForBrowse();
@@ -190,27 +190,41 @@
}
public void editAttachment(Attachment attachment) {
+ AttachmentEditorUIModel model = getModel();
+
AttachmentFile attachmentFile = attachment.getEditedFile();
if (attachmentFile == null) {
+ model.fireAttachmentOpened(attachment, true);
attachmentFile = attachment.getOriginalFile();
+
+ } else {
+ model.fireAttachmentOpened(attachment, false);
}
-
File file = attachmentFile.getFile();
- getModel().fireAttachmentEdited(attachment);
- String extension = FileUtil.extension(attachmentFile.getFilename());
- if (getModel().isEditable() && EDITABLE_EXTENSIONS.contains(extension.toUpperCase())) {
+ if (model.isEditable()) {
+ String extension = FileUtil.extension(attachmentFile.getFilename());
+ if (model.isEditable() && EDITABLE_EXTENSIONS.contains(extension.toUpperCase())) {
- MainUI mainUI = getContext().getMainUI();
- mainUI.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
- PDFEditorUI dialogContent = new PDFEditorUI(ui);
- dialogContent.getModel().fromEntity(attachment);
- mainUI.setCursor(Cursor.getDefaultCursor());
- openDialog(dialogContent, file.getName(), mainUI.getSize());
- dialogContent.getModel().toEntity(attachment);
+ MainUI mainUI = getContext().getMainUI();
+ mainUI.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
+ PDFEditorUI dialogContent = new PDFEditorUI(ui);
+ dialogContent.getModel().fromEntity(attachment);
+ mainUI.setCursor(Cursor.getDefaultCursor());
+ openDialog(dialogContent, file.getName(), mainUI.getSize());
+ dialogContent.getModel().toEntity(attachment);
+ } else {
+ Desktop desktop = FaxToMailUIUtil.getDesktopForOpen();
+ try {
+ desktop.open(file);
+ } catch (IOException e) {
+ getContext().getErrorHelper().showErrorDialog(t("swing.error.cannot.open.file"));
+ }
+ }
+
} else {
- Desktop desktop = FaxToMailUIUtil.getDesktopForOpen();
+ Desktop desktop = FaxToMailUIUtil.getDesktopForBrowse();
try {
desktop.open(file);
} catch (IOException e) {
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentEditorUIModel.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentEditorUIModel.java 2014-05-21 16:53:25 UTC (rev 84)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentEditorUIModel.java 2014-05-21 18:23:57 UTC (rev 85)
@@ -125,9 +125,9 @@
openingListeners.remove(listener);
}
- public void fireAttachmentOpened(Attachment attachment) {
+ public void fireAttachmentOpened(Attachment attachment, boolean original) {
for (AttachmentListener listener : openingListeners) {
- listener.onAttachmentOpened(attachment);
+ listener.onAttachmentOpened(attachment, original);
}
}
@@ -139,7 +139,7 @@
public static interface AttachmentListener {
- public void onAttachmentOpened(Attachment attachment);
+ public void onAttachmentOpened(Attachment attachment, boolean original);
public void onAttachmentEdited(Attachment attachment);
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentItem.css
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentItem.css 2014-05-21 16:53:25 UTC (rev 84)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentItem.css 2014-05-21 18:23:57 UTC (rev 85)
@@ -43,7 +43,7 @@
actionIcon: "edit";
toolTipText: "faxtomail.attachmentEditor.action.edit.tip";
enabled: { handler != null && handler.isAttachmentEditable(getAttachment()) };
- visible: { isEditable() };
+ // visible: { isEditable() };
}
#removeAttachmentButton {
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-05-21 16:53:25 UTC (rev 84)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUIHandler.java 2014-05-21 18:23:57 UTC (rev 85)
@@ -44,9 +44,11 @@
import com.franciaflex.faxtomail.ui.swing.util.FaxToMailUIUtil;
import com.franciaflex.faxtomail.ui.swing.util.FolderTreeNode;
import jaxx.runtime.validator.swing.SwingValidator;
+import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jdesktop.swingx.JXTable;
+import org.jdesktop.swingx.table.TableColumnModelExt;
import org.nuiton.jaxx.application.swing.table.AbstractApplicationTableModel;
import javax.swing.*;
@@ -107,8 +109,7 @@
super.beforeInit(ui);
DemandeListUIModel model = new DemandeListUIModel();
- Company franciaflex = getContext().getCurrentCompany();
- Collection<MailFolder> folders = franciaflex.getMailFolder();
+ Collection<MailFolder> folders = getContext().getMailFolderService().getRootMailFolders();
model.setFolders(new ArrayList<MailFolder>(folders));
model.addPropertyChangeListener(DemandeListUIModel.PROPERTY_SELECTED_FOLDER, new PropertyChangeListener() {
@@ -116,6 +117,9 @@
public void propertyChange(PropertyChangeEvent evt) {
DemandeListUIModel model = (DemandeListUIModel) evt.getSource();
MailFolder folder = (MailFolder) evt.getNewValue();
+
+ populateColumnModel(getUI().getDataTable(), false);
+
List<Email> emails = getContext().getEmailService().getEmailForFolder(folder);
log.info(emails.size() + " emails in folder " + folder.getName());
List<DemandeUIModel> demands = new ArrayList<DemandeUIModel>();
@@ -142,7 +146,7 @@
// init table
final JXTable dataTable = getUI().getDataTable();
- final AbstractApplicationTableModel<DemandeUIModel> tableModel = initDemandeTable(dataTable, false);
+ initDemandeTable(dataTable, false);
final ITableFilter<JTable> tableFilter = new JTableFilter(dataTable) {
@@ -150,9 +154,10 @@
protected boolean execute(int col, Collection<DistinctColumnItem> items) {
boolean b = super.execute(col, items);
List<DemandeUIModel> filteredEmails = new ArrayList<DemandeUIModel>();
+ AbstractApplicationTableModel<DemandeUIModel> dataTableModel = (AbstractApplicationTableModel<DemandeUIModel>) dataTable.getModel();
for (int i = 0; i < dataTable.getRowCount(); i++) {
int modelIndex = dataTable.convertRowIndexToModel(i);
- filteredEmails.add(tableModel.getEntry(modelIndex));
+ filteredEmails.add(dataTableModel.getEntry(modelIndex));
}
getModel().setFilteredEmails(filteredEmails);
return b;
@@ -178,9 +183,10 @@
model.setCurrentEmails(null);
} else {
List<DemandeUIModel> selectedRows = new ArrayList<DemandeUIModel>();
+ AbstractApplicationTableModel<DemandeUIModel> dataTableModel = (AbstractApplicationTableModel<DemandeUIModel>) dataTable.getModel();
for (int i = source.getMinSelectionIndex() ; i <= source.getMaxSelectionIndex() ; i++) {
if (source.isSelectedIndex(i)) {
- selectedRows.add(tableModel.getEntry(i));
+ selectedRows.add(dataTableModel.getEntry(i));
}
}
model.setCurrentEmails(selectedRows);
@@ -192,7 +198,8 @@
@Override
public void propertyChange(PropertyChangeEvent evt) {
List<DemandeUIModel> emails = (List<DemandeUIModel>) evt.getNewValue();
- tableModel.setRows(emails);
+ AbstractApplicationTableModel<DemandeUIModel> dataTableModel = (AbstractApplicationTableModel<DemandeUIModel>) dataTable.getModel();
+ dataTableModel.setRows(emails);
tableFilter.clear();
}
});
@@ -252,7 +259,8 @@
DemandeUIModel currentEmail = getContext().getCurrentEmail();
if (currentEmail != null) {
- int row = tableModel.getRowIndex(currentEmail);
+ AbstractApplicationTableModel<DemandeUIModel> dataTableModel = (AbstractApplicationTableModel<DemandeUIModel>) dataTable.getModel();
+ int row = dataTableModel.getRowIndex(currentEmail);
if (row > 0) {
dataTable.setRowSelectionInterval(row, row);
}
@@ -274,6 +282,12 @@
}
@Override
+ protected Collection<String> getColumns() {
+ MailFolder selectedFolder = getModel().getSelectedFolder();
+ return selectedFolder != null ? selectedFolder.getTableColumns() : null;
+ }
+
+ @Override
protected String[] getEditableTableProperties() {
return new String[] { Email.PROPERTY_PRIORITY, Email.PROPERTY_ATTACHMENT, Email.PROPERTY_REPLIES };
}
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIHandler.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIHandler.java 2014-05-21 16:53:25 UTC (rev 84)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIHandler.java 2014-05-21 18:23:57 UTC (rev 85)
@@ -323,14 +323,20 @@
new AttachmentEditorUIModel.AttachmentListener() {
@Override
- public void onAttachmentOpened(Attachment attachment) {
+ public void onAttachmentOpened(Attachment attachment, boolean original) {
String topiaId = getModel().getTopiaId();
if (topiaId != null) {
+ String filename;
+ if (original) {
+ filename = attachment.getOriginalFile().getFilename();
+ } else {
+ filename = FaxToMailUIUtil.getEditedFileName(attachment.getOriginalFile());
+ }
Email email = getContext().getEmailService().addToHistory(topiaId,
HistoryType.ATTACHMENT_OPENING,
getContext().getCurrentUser(),
new Date(),
- attachment.getOriginalFile().getFilename());
+ filename);
getModel().setHistory(email.getHistory());
}
}
@@ -343,7 +349,7 @@
HistoryType.ATTACHMENT_MODIFICATION,
getContext().getCurrentUser(),
new Date(),
- attachment.getOriginalFile().getFilename());
+ FaxToMailUIUtil.getEditedFileName(attachment.getOriginalFile()));
getModel().setHistory(email.getHistory());
}
}
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-05-21 16:53:25 UTC (rev 84)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchToGroupUIHandler.java 2014-05-21 18:23:57 UTC (rev 85)
@@ -59,6 +59,7 @@
import java.beans.PropertyChangeListener;
import java.util.Arrays;
import java.util.Calendar;
+import java.util.Collection;
import java.util.Date;
import java.util.List;
@@ -160,18 +161,19 @@
final JXTable dataTable = getUI().getDataTable();
dataTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
- final AbstractApplicationTableModel<DemandeUIModel> tableModel = initDemandeTable(dataTable, true);
+ initDemandeTable(dataTable, true);
model.addPropertyChangeListener(SearchUIModel.PROPERTY_RESULTS, new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
List<DemandeUIModel> emails = (List<DemandeUIModel>) evt.getNewValue();
- tableModel.setRows(emails);
+ AbstractApplicationTableModel<DemandeUIModel> dataTableModel = (AbstractApplicationTableModel<DemandeUIModel>) dataTable.getModel();
+ dataTableModel.setRows(emails);
showInformationMessage(t("faxtomail.search.resultNb", emails.size()));
DemandeUIModel currentEmail = getContext().getCurrentEmail();
if (currentEmail != null) {
- int row = tableModel.getRowIndex(currentEmail);
+ int row = dataTableModel.getRowIndex(currentEmail);
if (row > 0) {
dataTable.setRowSelectionInterval(row, row);
}
@@ -199,7 +201,8 @@
ListSelectionModel selectionModel = (ListSelectionModel) e.getSource();
SearchUIModel model = getModel();
int selectedIndex = selectionModel.getLeadSelectionIndex();
- DemandeUIModel selectedModel = selectedIndex < 0 ? null : tableModel.getEntry(selectedIndex);
+ AbstractApplicationTableModel<DemandeUIModel> dataTableModel = (AbstractApplicationTableModel<DemandeUIModel>) dataTable.getModel();
+ DemandeUIModel selectedModel = selectedIndex < 0 ? null : dataTableModel.getEntry(selectedIndex);
model.setGroupEnabled(!selectionModel.isSelectionEmpty() && isDemandSelectable(selectedModel));
}
}
@@ -210,7 +213,8 @@
public boolean isHighlighted(Component renderer, ComponentAdapter adapter) {
int viewRow = adapter.row;
int modelRow = adapter.convertRowIndexToModel(viewRow);
- DemandeUIModel row = tableModel.getEntry(modelRow);
+ AbstractApplicationTableModel<DemandeUIModel> dataTableModel = (AbstractApplicationTableModel<DemandeUIModel>) dataTable.getModel();
+ DemandeUIModel row = dataTableModel.getEntry(modelRow);
return !isDemandSelectable(row);
}
};
@@ -218,6 +222,12 @@
}
+ @Override
+ protected Collection<String> getColumns() {
+ //TODO kmorin 20140521 get the real search columns
+ return null;
+ }
+
protected boolean isDemandSelectable(DemandeUIModel demand) {
DemandeUIModel currentDemand = getContext().getCurrentEmail();
return !currentDemand.equals(demand) && !currentDemand.getGroupedDemandes().contains(demand);
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-05-21 16:53:25 UTC (rev 84)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUIHandler.java 2014-05-21 18:23:57 UTC (rev 85)
@@ -60,6 +60,7 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
+import java.util.Collection;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
@@ -160,18 +161,19 @@
final JXTable dataTable = getUI().getDataTable();
dataTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
- final AbstractApplicationTableModel<DemandeUIModel> tableModel = initDemandeTable(dataTable, true);
+ initDemandeTable(dataTable, true);
model.addPropertyChangeListener(SearchUIModel.PROPERTY_RESULTS, new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
List<DemandeUIModel> emails = (List<DemandeUIModel>) evt.getNewValue();
- tableModel.setRows(emails);
+ AbstractApplicationTableModel<DemandeUIModel> dataTableModel = (AbstractApplicationTableModel<DemandeUIModel>) dataTable.getModel();
+ dataTableModel.setRows(emails);
showInformationMessage(t("faxtomail.search.resultNb", emails.size()));
DemandeUIModel currentEmail = getContext().getCurrentEmail();
if (currentEmail != null) {
- int row = tableModel.getRowIndex(currentEmail);
+ int row = dataTableModel.getRowIndex(currentEmail);
if (row > 0) {
dataTable.setRowSelectionInterval(row, row);
}
@@ -192,8 +194,12 @@
}
}
+ }
-
+ @Override
+ protected Collection<String> getColumns() {
+ //TODO kmorin 20140521 get the real search columns
+ return null;
}
@Override
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractFaxToMailDemandListHandler.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractFaxToMailDemandListHandler.java 2014-05-21 16:53:25 UTC (rev 84)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractFaxToMailDemandListHandler.java 2014-05-21 18:23:57 UTC (rev 85)
@@ -26,6 +26,7 @@
import com.franciaflex.faxtomail.persistence.entities.Attachment;
import com.franciaflex.faxtomail.persistence.entities.Company;
+import com.franciaflex.faxtomail.persistence.entities.Configuration;
import com.franciaflex.faxtomail.persistence.entities.DemandStatus;
import com.franciaflex.faxtomail.persistence.entities.Email;
import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser;
@@ -42,6 +43,8 @@
import com.franciaflex.faxtomail.ui.swing.content.demande.replies.RepliesCellEditor;
import com.franciaflex.faxtomail.ui.swing.content.demande.replies.RepliesCellRenderer;
import com.google.common.base.Function;
+import com.google.common.collect.Lists;
+import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
@@ -80,39 +83,107 @@
private static final Log log = LogFactory.getLog(AbstractFaxToMailDemandListHandler.class);
- public AbstractApplicationTableModel<DemandeUIModel> initDemandeTable(JXTable table, boolean sortable) {
+ public void initDemandeTable(final JXTable table, boolean sortable) {
// table.setAutoResizeMode(JTable.AUTO_RESIZE_NEXT_COLUMN);
+ populateColumnModel(table, sortable);
+
+ table.getTableHeader().setReorderingAllowed(false);
+
+ Highlighter highlighter = new Highlighter() {
+ @Override
+ public Component highlight(Component renderer, ComponentAdapter adapter) {
+ int viewRow = adapter.row;
+ int modelRow = adapter.convertRowIndexToModel(viewRow);
+ DemandeUIModel row = ((AbstractApplicationTableModel<DemandeUIModel>) table.getModel()).getEntry(modelRow);
+ boolean highlight = row.getTakenBy() == null;
+ if (highlight) {
+ Font font = renderer.getFont();
+ renderer.setFont(font.deriveFont(Font.BOLD));
+ }
+ highlight = row.getArchiveDate() != null;
+ if (highlight) {
+ Font font = renderer.getFont();
+ renderer.setFont(font.deriveFont(Font.ITALIC));
+ renderer.setForeground(adapter.isSelected() ? Color.WHITE : new Color(96, 96, 96));
+ }
+ return renderer;
+ }
+
+ @Override
+ public void addChangeListener(ChangeListener l) {
+ }
+
+ @Override
+ public void removeChangeListener(ChangeListener l) {
+ }
+
+ @Override
+ public ChangeListener[] getChangeListeners() {
+ return new ChangeListener[0];
+ }
+ };
+ table.addHighlighter(highlighter);
+
+ HighlightPredicate rowIsInvalidPredicate = new HighlightPredicate() {
+ @Override
+ public boolean isHighlighted(Component renderer, ComponentAdapter adapter) {
+ int viewRow = adapter.row;
+ int modelRow = adapter.convertRowIndexToModel(viewRow);
+ DemandeUIModel row = ((AbstractApplicationTableModel<DemandeUIModel>) table.getModel()).getEntry(modelRow);
+ return !row.isValid() && row.getTakenBy()!= null;
+ }
+ };
+ Color color = new Color(255, 51, 51);
+ table.addHighlighter(new ColorHighlighter(rowIsInvalidPredicate, color, Color.WHITE, color.darker(), Color.WHITE));
+
+ HighlightPredicate testPredicate = new HighlightPredicate() {
+ @Override
+ public boolean isHighlighted(Component renderer, ComponentAdapter adapter) {
+ int viewRow = adapter.row;
+ int modelRow = adapter.convertRowIndexToModel(viewRow);
+ DemandeUIModel row = ((AbstractApplicationTableModel<DemandeUIModel>) table.getModel()).getEntry(modelRow);
+ return row.getLastAttachmentOpeningInThisFolderUser() != null
+ && !row.getLastAttachmentOpeningInThisFolderUser().equals(row.getTakenBy());
+ }
+ };
+ color = Color.ORANGE;
+ table.addHighlighter(new ColorHighlighter(testPredicate, color, Color.WHITE, color.darker(), Color.WHITE));
+
+ table.addMouseListener(getDataTableMouseListener());
+ }
+
+ protected abstract Collection<String> getColumns();
+
+ protected void populateColumnModel(JXTable table, boolean sortable) {
+ Collection<String> columns = getColumns();
+
TableColumnModelExt columnModel = new DefaultTableColumnModelExt();
- Company franciaflex = getContext().getCurrentCompany();
- String columns = franciaflex.getConfiguration().getTableColumns();
- if (columns == null) {
- columns = StringUtils.join(new String[]{
- Email.PROPERTY_PRIORITY,
- Email.PROPERTY_DEMAND_TYPE,
- Email.PROPERTY_OBJECT,
- DemandeUIModel.PROPERTY_CLIENT_CODE,
- DemandeUIModel.PROPERTY_CLIENT_BRAND,
- Email.PROPERTY_SENDER,
- Email.PROPERTY_PROJECT_REFERENCE,
- Email.PROPERTY_COMPANY_REFERENCE,
- DemandeUIModel.PROPERTY_REFERENCE,
- Email.PROPERTY_RECEPTION_DATE,
- Email.PROPERTY_RECIPIENT,
- Email.PROPERTY_DEMAND_STATUS,
- Email.PROPERTY_ETAT_ATTENTE,
- DemandeUIModel.PROPERTY_PF_NB,
- DemandeUIModel.PROPERTY_SAV_NB,
- Email.PROPERTY_TAKEN_BY,
- DemandeUIModel.PROPERTY_LAST_ATTACHMENT_OPENING_IN_THIS_FOLDER_USER,
- Email.PROPERTY_REPLIES,
- Email.PROPERTY_ATTACHMENT
- }, ',');
+ if (CollectionUtils.isEmpty(columns)) {
+ columns = Lists.newArrayList(Email.PROPERTY_PRIORITY,
+ Email.PROPERTY_DEMAND_TYPE,
+ Email.PROPERTY_OBJECT,
+ DemandeUIModel.PROPERTY_CLIENT_CODE,
+ DemandeUIModel.PROPERTY_CLIENT_BRAND,
+ Email.PROPERTY_SENDER,
+ Email.PROPERTY_PROJECT_REFERENCE,
+ Email.PROPERTY_COMPANY_REFERENCE,
+ DemandeUIModel.PROPERTY_REFERENCE,
+ Email.PROPERTY_RECEPTION_DATE,
+ Email.PROPERTY_RECIPIENT,
+ Email.PROPERTY_DEMAND_STATUS,
+ Email.PROPERTY_ETAT_ATTENTE,
+ DemandeUIModel.PROPERTY_PF_NB,
+ DemandeUIModel.PROPERTY_SAV_NB,
+ Email.PROPERTY_TAKEN_BY,
+ DemandeUIModel.PROPERTY_LAST_ATTACHMENT_OPENING_IN_THIS_FOLDER_USER,
+ Email.PROPERTY_REPLIES,
+ Email.PROPERTY_ATTACHMENT);
}
- String[] columnNames = columns.split(",");
- for (String columnName : columnNames) {
+ for (String columnName : columns) {
+
if (Email.PROPERTY_PRIORITY.equals(columnName)) {
addComboDataColumnToModel(columnModel,
DemandeTableModel.COLUMN_IDENTIFIERS.get(columnName),
@@ -188,71 +259,6 @@
getEditableTableProperties());
table.setModel(tableModel);
table.setColumnModel(columnModel);
- table.getTableHeader().setReorderingAllowed(false);
-
- Highlighter highlighter = new Highlighter() {
- @Override
- public Component highlight(Component renderer, ComponentAdapter adapter) {
- int viewRow = adapter.row;
- int modelRow = adapter.convertRowIndexToModel(viewRow);
- DemandeUIModel row = tableModel.getEntry(modelRow);
- boolean highlight = row.getTakenBy() == null;
- if (highlight) {
- Font font = renderer.getFont();
- renderer.setFont(font.deriveFont(Font.BOLD));
- }
- highlight = row.getArchiveDate() != null;
- if (highlight) {
- Font font = renderer.getFont();
- renderer.setFont(font.deriveFont(Font.ITALIC));
- renderer.setForeground(adapter.isSelected() ? Color.WHITE : new Color(96, 96, 96));
- }
- return renderer;
- }
-
- @Override
- public void addChangeListener(ChangeListener l) {
- }
-
- @Override
- public void removeChangeListener(ChangeListener l) {
- }
-
- @Override
- public ChangeListener[] getChangeListeners() {
- return new ChangeListener[0];
- }
- };
- table.addHighlighter(highlighter);
-
- HighlightPredicate rowIsInvalidPredicate = new HighlightPredicate() {
- @Override
- public boolean isHighlighted(Component renderer, ComponentAdapter adapter) {
- int viewRow = adapter.row;
- int modelRow = adapter.convertRowIndexToModel(viewRow);
- DemandeUIModel row = tableModel.getEntry(modelRow);
- return !row.isValid() && row.getTakenBy()!= null;
- }
- };
- Color color = new Color(255, 51, 51);
- table.addHighlighter(new ColorHighlighter(rowIsInvalidPredicate, color, Color.WHITE, color.darker(), Color.WHITE));
-
- HighlightPredicate testPredicate = new HighlightPredicate() {
- @Override
- public boolean isHighlighted(Component renderer, ComponentAdapter adapter) {
- int viewRow = adapter.row;
- int modelRow = adapter.convertRowIndexToModel(viewRow);
- DemandeUIModel row = tableModel.getEntry(modelRow);
- return row.getLastAttachmentOpeningInThisFolderUser() != null
- && !row.getLastAttachmentOpeningInThisFolderUser().equals(row.getTakenBy());
- }
- };
- color = Color.ORANGE;
- table.addHighlighter(new ColorHighlighter(testPredicate, color, Color.WHITE, color.darker(), Color.WHITE));
-
- table.addMouseListener(getDataTableMouseListener());
-
- return tableModel;
}
protected MouseListener getDataTableMouseListener() {
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FaxToMailUIUtil.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FaxToMailUIUtil.java 2014-05-21 16:53:25 UTC (rev 84)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FaxToMailUIUtil.java 2014-05-21 18:23:57 UTC (rev 85)
@@ -270,4 +270,7 @@
}
}
+ public static String getEditedFileName(AttachmentFile originalFile) {
+ return t("faxtomail.attachment.editedFile.name", originalFile.getFilename()) + "-.pdf";
+ }
}
Modified: trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_fr_FR.properties
===================================================================
--- trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_fr_FR.properties 2014-05-21 16:53:25 UTC (rev 84)
+++ trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_fr_FR.properties 2014-05-21 18:23:57 UTC (rev 85)
@@ -16,6 +16,7 @@
faxtomail.alert.archiveConfirmation.title=Confirmation de l'archivage
faxtomail.alert.groupConfirmation.message=<html>Êtes vous sûr de vouloir grouper les éléments<br/>%1$s et<br/>%2$s ?<br/>Le groupement est définitif.</html>
faxtomail.alert.groupConfirmation.title=Confirmation du groupement
+faxtomail.attachment.editedFile.name=%s-annoté
faxtomail.attachmentCellRenderer.text=(%s)
faxtomail.attachmentEditor.action.add.tip=Ajouter une pièce jointe
faxtomail.attachmentEditor.action.closeAttachment.tip=Fermer la fenêtre des pièces-jointes
1
0
21 May '14
Author: echatellier
Date: 2014-05-21 18:53:25 +0200 (Wed, 21 May 2014)
New Revision: 84
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/84
Log:
refs #4662: Refactoring de la configuration
Added:
trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/Field.java
trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/HibernateProxyTypeAdapter.java
trunk/faxtomail-ui-web/src/main/webapp/js/faxtomail.js
Modified:
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/CompanyService.java
trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ConfigurationService.java
trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/InitFaxToMailService.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/FaxToMailActionSupport.java
trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/FaxToMailApplicationListener.java
trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/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.jsp
trunk/faxtomail-ui-web/src/main/webapp/css/configuration.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/Field.java
===================================================================
--- trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/Field.java (rev 0)
+++ trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/Field.java 2014-05-21 16:53:25 UTC (rev 84)
@@ -0,0 +1,53 @@
+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 {
+
+ RECEPTION_DATE,
+ EDI_CODE_NUMBER,
+ PROJECT_REFERENCE,
+ SENDER,
+ FAX,
+ RECIPIENT,
+ OBJECT,
+ ARCHIVE_DATE,
+ COMPANY_REFERENCE,
+ ORIGINAL_EMAIL,
+ COMMENT,
+ DEMAND_TYPE,
+ PRIORITY,
+ ETAT_ATTENTE,
+ TAKEN_BY,
+ RANGE_ROW,
+ CLIENT,
+ DEMANDE_STATUS
+
+}
Property changes on: trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/Field.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: trunk/faxtomail-persistence/src/main/xmi/faxtomail.properties
===================================================================
--- trunk/faxtomail-persistence/src/main/xmi/faxtomail.properties 2014-05-20 21:03:58 UTC (rev 83)
+++ trunk/faxtomail-persistence/src/main/xmi/faxtomail.properties 2014-05-21 16:53:25 UTC (rev 84)
@@ -25,7 +25,6 @@
model.tagValue.constantPrefix=PROPERTY_
model.tagValue.java.lang.String=text
#model.tagvalue.java.sql.Blob=blob
-#model.tagvalue.byte=binary
model.tagValue.useEnumerationName=true
model.tagValue.doNotGenerateBooleanGetMethods=true
@@ -35,3 +34,24 @@
# AttachmentFile
com.franciaflex.faxtomail.persistence.entities.AttachmentFile.attribute.filename.tagvalue.notNull=true
com.franciaflex.faxtomail.persistence.entities.AttachmentFile.attribute.content.tagvalue.notNull=true
+
+# Company
+com.franciaflex.faxtomail.persistence.entities.Company.attribute.name.tagvalue.naturalId=true
+
+# MailFolder
+com.franciaflex.faxtomail.persistence.entities.MailFolder.attribute.parent.tagvalue.naturalId=true
+com.franciaflex.faxtomail.persistence.entities.MailFolder.attribute.parent.tagvalue.notNull=false
+com.franciaflex.faxtomail.persistence.entities.MailFolder.attribute.name.tagvalue.naturalId=true
+
+# EtatAttente
+com.franciaflex.faxtomail.persistence.entities.EtatAttente.attribute.label.tagvalue.naturalId=true
+
+# Priority
+com.franciaflex.faxtomail.persistence.entities.Priority.attribute.label.tagvalue.naturalId=true
+
+# Range
+com.franciaflex.faxtomail.persistence.entities.Range.attribute.label.tagvalue.naturalId=true
+
+# DemandType
+com.franciaflex.faxtomail.persistence.entities.DemandType.attribute.label.tagvalue.naturalId=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/CompanyService.java
===================================================================
--- trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/CompanyService.java 2014-05-20 21:03:58 UTC (rev 83)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/CompanyService.java 2014-05-21 16:53:25 UTC (rev 84)
@@ -73,7 +73,7 @@
return company;
}
- public Company saveCompany(Company company, Collection<MailFolder> mailFolders, Map<MailFilter, String> mailFilters) {
+ /*public Company saveCompany(Company company, Collection<MailFolder> mailFolders, Map<MailFilter, String> mailFilters) {
Preconditions.checkNotNull(company);
ConfigurationService configurationService = getConfigurationService();
@@ -99,7 +99,7 @@
getPersistenceContext().commit();
return company;
- }
+ }*/
public Collection<MailFilter> saveMailFilters(Collection<MailFilter> mailFilters) {
MailFilterTopiaDao dao = getPersistenceContext().getMailFilterDao();
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-05-20 21:03:58 UTC (rev 83)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ConfigurationService.java 2014-05-21 16:53:25 UTC (rev 84)
@@ -24,21 +24,17 @@
* #L%
*/
-import com.franciaflex.faxtomail.persistence.entities.CompanyTopiaDao;
+import java.util.List;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
import com.franciaflex.faxtomail.persistence.entities.Configuration;
+import com.franciaflex.faxtomail.persistence.entities.ConfigurationImpl;
import com.franciaflex.faxtomail.persistence.entities.ConfigurationTopiaDao;
-import com.franciaflex.faxtomail.persistence.entities.MailFilter;
-import com.franciaflex.faxtomail.persistence.entities.MailFilterTopiaDao;
import com.franciaflex.faxtomail.services.FaxToMailServiceSupport;
import com.google.common.collect.Lists;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.nuiton.topia.persistence.TopiaIdFactory;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
/**
* @author kmorin <kmorin(a)codelutin.com>
* @since x.x
@@ -53,15 +49,27 @@
return configs;
}
- public Configuration getConfiguration(String id) {
+ /**
+ * Return unique database configuration.
+ *
+ * @return configuration (not {@code null}, created on not found in database)
+ */
+ public Configuration getConfiguration() {
ConfigurationTopiaDao dao = getPersistenceContext().getConfigurationDao();
- Configuration config = dao.findByTopiaId(id);
+ Configuration config = dao.forAll().findUniqueOrNull();
+ if (config == null) {
+ config = new ConfigurationImpl();
+ }
return config;
}
public Configuration saveConfiguration(Configuration config) {
ConfigurationTopiaDao dao = getPersistenceContext().getConfigurationDao();
- config = dao.update(config);
+ if (config.isPersisted()) {
+ config = dao.update(config);
+ } else {
+ config = dao.create(config);
+ }
return config;
}
Modified: trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/InitFaxToMailService.java
===================================================================
--- trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/InitFaxToMailService.java 2014-05-20 21:03:58 UTC (rev 83)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/InitFaxToMailService.java 2014-05-21 16:53:25 UTC (rev 84)
@@ -260,12 +260,12 @@
// "lastAttachmentOpeningUser," +
// Email.PROPERTY_ATTACHMENT
// );
- Configuration configuration = configurationTopiaDao.create();
- Company fx = companyTopiaDao.create(Company.PROPERTY_NAME, "Franciaflex",
+ //Configuration configuration = configurationTopiaDao.create();
+ Company fx = companyTopiaDao.create(Company.PROPERTY_NAME, "Franciaflex"/*,
Company.PROPERTY_CONFIGURATION, configuration,
- Company.PROPERTY_MAIL_FOLDER, folders.values());
- companyTopiaDao.create(Company.PROPERTY_NAME, "Faber", Company.PROPERTY_CONFIGURATION, configurationTopiaDao.create());
- companyTopiaDao.create(Company.PROPERTY_NAME, "France Fermeture", Company.PROPERTY_CONFIGURATION, configurationTopiaDao.create());
+ Company.PROPERTY_MAIL_FOLDER, folders.values()*/);
+ companyTopiaDao.create(Company.PROPERTY_NAME, "Faber"/*, Company.PROPERTY_CONFIGURATION, configurationTopiaDao.create()*/);
+ companyTopiaDao.create(Company.PROPERTY_NAME, "France Fermeture"/*, Company.PROPERTY_CONFIGURATION, configurationTopiaDao.create()*/);
// user folders
Collections.shuffle(etatAttentes);
@@ -324,8 +324,8 @@
if (emailFiltersPropertiesStream != null) {
List<MailFilter> mailFilters = getReferentielService().importEmailFilters(emailFiltersPropertiesStream, folders);
- fx.addAllMailFilter(mailFilters);
- companyTopiaDao.update(fx);
+ //fx.addAllMailFilter(mailFilters);
+ //companyTopiaDao.update(fx);
}
} catch(Exception e) {
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-05-20 21:03:58 UTC (rev 83)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/MailFolderService.java 2014-05-21 16:53:25 UTC (rev 84)
@@ -79,6 +79,12 @@
MailFolderTopiaDao dao = getPersistenceContext().getMailFolderDao();
return new ArrayList<MailFolder>(dao.findAll());
}
+
+ public List<MailFolder> getRootMailFolders() {
+ MailFolderTopiaDao dao = getPersistenceContext().getMailFolderDao();
+ List<MailFolder> result = dao.forParentEquals(null).findAll();
+ return result;
+ }
public List<MailFolder> getMailFolders(Collection<String> ids) {
MailFolderTopiaDao dao = getPersistenceContext().getMailFolderDao();
Modified: trunk/faxtomail-ui-web/pom.xml
===================================================================
--- trunk/faxtomail-ui-web/pom.xml 2014-05-20 21:03:58 UTC (rev 83)
+++ trunk/faxtomail-ui-web/pom.xml 2014-05-21 16:53:25 UTC (rev 84)
@@ -238,6 +238,10 @@
<artifactId>select2</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.nuiton.js</groupId>
+ <artifactId>nuiton-js-angular-ui-tree</artifactId>
+ </dependency>
</dependencies>
<build>
Added: trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/HibernateProxyTypeAdapter.java
===================================================================
--- trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/HibernateProxyTypeAdapter.java (rev 0)
+++ trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/HibernateProxyTypeAdapter.java 2014-05-21 16:53:25 UTC (rev 84)
@@ -0,0 +1,58 @@
+package com.franciaflex.faxtomail;
+
+import java.io.IOException;
+
+import org.hibernate.Hibernate;
+import org.hibernate.proxy.HibernateProxy;
+
+import com.google.gson.Gson;
+import com.google.gson.TypeAdapter;
+import com.google.gson.TypeAdapterFactory;
+import com.google.gson.reflect.TypeToken;
+import com.google.gson.stream.JsonReader;
+import com.google.gson.stream.JsonWriter;
+
+/**
+ * This TypeAdapter unproxies Hibernate proxied objects, and serializes them
+ * through the registered (or default) TypeAdapter of the base class.
+ *
+ * Voir : http://stackoverflow.com/a/13525550/2038100
+ */
+public class HibernateProxyTypeAdapter extends TypeAdapter<HibernateProxy> {
+
+ public static final TypeAdapterFactory FACTORY = new TypeAdapterFactory() {
+ @Override
+ @SuppressWarnings("unchecked")
+ public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) {
+ return (HibernateProxy.class.isAssignableFrom(type.getRawType()) ? (TypeAdapter<T>) new HibernateProxyTypeAdapter(gson) : null);
+ }
+ };
+ private final Gson context;
+
+ private HibernateProxyTypeAdapter(Gson context) {
+ this.context = context;
+ }
+
+ @Override
+ public HibernateProxy read(JsonReader in) throws IOException {
+ throw new UnsupportedOperationException("Not supported");
+ }
+
+ @SuppressWarnings({"rawtypes", "unchecked"})
+ @Override
+ public void write(JsonWriter out, HibernateProxy value) throws IOException {
+ if (value == null) {
+ out.nullValue();
+ return;
+ }
+ // Retrieve the original (not proxy) class
+ Class<?> baseType = Hibernate.getClass(value);
+ // Get the TypeAdapter of the original class, to delegate the serialization
+ TypeAdapter delegate = context.getAdapter(TypeToken.get(baseType));
+ // Get a filled instance of the original class
+ Object unproxiedValue = value.getHibernateLazyInitializer().getImplementation();
+ // Serialize the value
+ delegate.write(out, unproxiedValue);
+ }
+
+}
Property changes on: trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/HibernateProxyTypeAdapter.java
___________________________________________________________________
Added: svn:eol-style
+ native
Added: svn:keywords
+ Author Date Id Revision HeadURL
Modified: trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/FaxToMailActionSupport.java
===================================================================
--- trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/FaxToMailActionSupport.java 2014-05-20 21:03:58 UTC (rev 83)
+++ trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/FaxToMailActionSupport.java 2014-05-21 16:53:25 UTC (rev 84)
@@ -24,17 +24,36 @@
* #L%
*/
-import com.franciaflex.faxtomail.FaxToMailConfiguration;
+import java.util.Map;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.apache.struts2.convention.annotation.Result;
import org.apache.struts2.convention.annotation.Results;
import org.nuiton.topia.persistence.TopiaEntity;
-import org.nuiton.web.struts2.BaseAction;
+import com.franciaflex.faxtomail.FaxToMailConfiguration;
+import com.franciaflex.faxtomail.HibernateProxyTypeAdapter;
+import com.franciaflex.faxtomail.persistence.entities.MailFilter;
+import com.franciaflex.faxtomail.persistence.entities.MailFilterAbstract;
+import com.franciaflex.faxtomail.persistence.entities.MailFolder;
+import com.franciaflex.faxtomail.persistence.entities.MailFolderAbstract;
+import com.google.common.collect.HashMultimap;
+import com.google.common.collect.Maps;
+import com.google.common.collect.Multimap;
+import com.google.gson.ExclusionStrategy;
+import com.google.gson.FieldAttributes;
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+import com.opensymphony.xwork2.ActionSupport;
+
@Results({
@Result(name="login", type="redirectAction", params = { "actionName", "login!input", "namespace", "/authentication"})
})
-public class FaxToMailActionSupport extends BaseAction {
+public class FaxToMailActionSupport extends ActionSupport {
+ private static final Log log = LogFactory.getLog(FaxToMailActionSupport.class);
+
public static final String SAVE = "save";
public static final String NEXT = "next";
@@ -43,6 +62,8 @@
private FaxToMailSession session;
+ protected Gson gson;
+
public void setApplicationConfig(FaxToMailConfiguration applicationConfig) {
this.applicationConfig = applicationConfig;
}
@@ -63,22 +84,19 @@
return true;
}
- public String translateEnum(Class cl, String name) {
+ /*public String translateEnum(Class cl, String name) {
return t(cl.getName() + "." + name);
}
public String translateEnum(Enum en) {
return translateEnum(en.getClass(), en.name());
- }
+ }*/
public String getId(TopiaEntity entity) {
- // XXX brendan 19/08/13 hashCode may return a non-unique value
String id = "";
if (entity.getTopiaId() != null) {
-
id = Integer.toString(entity.getTopiaId().hashCode());
-
}
return id;
@@ -89,25 +107,67 @@
return applicationConfig.getInstanceDisclaimer();
}
-// public String getUserName() {
-// ExtranetUser extranetUser = session.getExtranetUser();
-// String userName = "";
-// if (extranetUser != null) {
-// userName = extranetUser.getFirstName() + " " + extranetUser.getLastName();
-// }
-// return userName;
-// }
-
-// public boolean isConnected() {
-// ExtranetUser extranetUser = session.getExtranetUser();
-// return extranetUser != null;
-// }
-
public void setSession(FaxToMailSession session) {
this.session = session;
}
-// public String getSupportEmail() {
-// return getApplicationConfig().getSupportEmail();
-// }
+ public String toJson(Object element) {
+ String result = null;
+ try {
+ result = getGson().toJson(element);
+ } catch (Exception e) {
+ log.warn("Can't convert object to json", e);
+ }
+ return result;
+ }
+
+ public Gson getGson() {
+ if (gson == null) {
+ GsonBuilder builder = new GsonBuilder();
+
+ // exclusion
+ final Multimap<Class<?>, String> gsonExclusions = HashMultimap.create();
+ gsonExclusions.put(MailFolderAbstract.class, MailFolder.PROPERTY_PARENT);
+ gsonExclusions.put(MailFilterAbstract.class, MailFilter.PROPERTY_MAIL_FOLDER);
+ builder.addSerializationExclusionStrategy(new ExclusionStrategy() {
+ @Override
+ public boolean shouldSkipField(FieldAttributes f) {
+ // TODO AThimel 06/08/13 Maybe another Multimap implementation will do the job ?
+ Class<?> declaringClass = f.getDeclaringClass();
+ String attributeName = f.getName();
+ boolean result = gsonExclusions.containsEntry(declaringClass, attributeName);
+ return result;
+ }
+
+ @Override
+ public boolean shouldSkipClass(Class<?> clazz) {
+ return false;
+ }
+ });
+
+ // Type adapters : Hibernate proxies
+ builder.registerTypeAdapterFactory(HibernateProxyTypeAdapter.FACTORY);
+
+ gson = builder.create();
+ }
+ return gson;
+ }
+
+ /**
+ * Transform enumeration values into map with i18n value for each enum value.
+ *
+ * i18n key is fqn.NAME
+ *
+ * @param values values to transform
+ * @return map (enum value > i18n text)
+ */
+ protected <T> Map<T, String> getEnumAsMap(T... values) {
+ Map<T, String> valuesMap = Maps.newLinkedHashMap();
+ for (T value : values) {
+ String i18n = value.getClass().getName() + "." + value.toString();
+ String trans = getText(i18n);
+ valuesMap.put(value, trans);
+ }
+ return valuesMap;
+ }
}
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-05-20 21:03:58 UTC (rev 83)
+++ trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/FaxToMailApplicationListener.java 2014-05-21 16:53:25 UTC (rev 84)
@@ -24,9 +24,9 @@
* #L%
*/
-import com.franciaflex.faxtomail.FaxToMailApplicationContext;
-import com.franciaflex.faxtomail.persistence.entities.FaxToMailTopiaPersistenceContext;
-import com.franciaflex.faxtomail.services.FaxToMailServiceContext;
+import javax.servlet.ServletContextEvent;
+import javax.servlet.ServletContextListener;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.quartz.CronScheduleBuilder;
@@ -39,8 +39,10 @@
import org.quartz.TriggerBuilder;
import org.quartz.impl.StdSchedulerFactory;
-import javax.servlet.ServletContextEvent;
-import javax.servlet.ServletContextListener;
+import com.franciaflex.faxtomail.FaxToMailApplicationContext;
+import com.franciaflex.faxtomail.persistence.entities.FaxToMailTopiaPersistenceContext;
+import com.franciaflex.faxtomail.services.FaxToMailServiceContext;
+import com.franciaflex.faxtomail.services.service.InitFaxToMailService;
public class FaxToMailApplicationListener implements ServletContextListener {
@@ -69,6 +71,9 @@
FaxToMailTopiaPersistenceContext persistenceContext = applicationContext.newPersistenceContext();
FaxToMailServiceContext serviceContext = applicationContext.newServiceContext(persistenceContext);
+
+ serviceContext.newService(InitFaxToMailService.class).init();
+
data.put(MailFilterJob.SERVICE_CONTEXT, serviceContext);
JobDetail job = JobBuilder.newJob(MailFilterJob.class)
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-05-20 21:03:58 UTC (rev 83)
+++ trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ConfigurationAction.java 2014-05-21 16:53:25 UTC (rev 84)
@@ -24,40 +24,23 @@
* #L%
*/
-import com.franciaflex.faxtomail.persistence.entities.Company;
-import com.franciaflex.faxtomail.persistence.entities.Email;
-import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser;
-import com.franciaflex.faxtomail.persistence.entities.FaxToMailUserGroup;
-import com.franciaflex.faxtomail.persistence.entities.MailFilter;
-import com.franciaflex.faxtomail.persistence.entities.MailFilterImpl;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import com.franciaflex.faxtomail.persistence.entities.Action;
+import com.franciaflex.faxtomail.persistence.entities.Configuration;
+import com.franciaflex.faxtomail.persistence.entities.EtatAttente;
+import com.franciaflex.faxtomail.persistence.entities.Field;
import com.franciaflex.faxtomail.persistence.entities.MailFolder;
-import com.franciaflex.faxtomail.persistence.entities.MailFolderImpl;
-import com.franciaflex.faxtomail.services.service.CompanyService;
+import com.franciaflex.faxtomail.services.service.ConfigurationService;
import com.franciaflex.faxtomail.services.service.MailFolderService;
-import com.franciaflex.faxtomail.services.service.UserService;
+import com.franciaflex.faxtomail.services.service.ReferentielService;
import com.franciaflex.faxtomail.web.FaxToMailActionSupport;
-import com.google.gson.GsonBuilder;
-import com.google.gson.JsonDeserializationContext;
-import com.google.gson.JsonDeserializer;
-import com.google.gson.JsonElement;
-import com.google.gson.JsonObject;
-import com.google.gson.JsonParseException;
import com.opensymphony.xwork2.Preparable;
-import org.apache.commons.collections4.ComparatorUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import java.lang.reflect.Type;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-
/**
* @author kmorin <kmorin(a)codelutin.com>
* @since x.x
@@ -66,35 +49,41 @@
private static final Log log = LogFactory.getLog(ConfigurationAction.class);
- protected CompanyService companyService;
+ protected ConfigurationService configurationService;
+ protected ReferentielService referentielService;
+
protected MailFolderService mailFolderService;
- protected UserService userService;
+ protected Configuration configuration;
- protected List<Company> companies;
+ protected List<EtatAttente> etatAttentes;
- protected Company company;
-
protected List<MailFolder> mailFolders;
- protected Map<String, String> mailFoldersFlat;
+ //protected UserService userService;
- protected List<MailFilterUIBean> mailFilters;
+ //protected List<MailFolder> mailFolders;
- protected List<FaxToMailUser> allUsers;
+ //protected Map<String, String> mailFoldersFlat;
- protected List<FaxToMailUserGroup> allUserGroups;
+ //protected List<MailFilterUIBean> mailFilters;
- protected String activeTab;
+ //protected List<FaxToMailUser> allUsers;
+ //protected List<FaxToMailUserGroup> allUserGroups;
+
+ //protected String activeTab;
+
@Override
public void prepare() throws Exception {
- companies = companyService.getAllCompanies();
+ configuration = configurationService.getConfiguration();
}
@Override
public String input() throws Exception {
+ etatAttentes = referentielService.getAllEtatAttente();
+ mailFolders = mailFolderService.getRootMailFolders();
return INPUT;
}
@@ -102,69 +91,77 @@
public String execute() throws Exception {
String result = super.execute();
- if (!ERROR.equals(result)) {
- if (company != null) {
- log.debug(company.getMailFilter());
- Map<MailFilter, String> folderIdByFilter = new HashMap<>();
- if (mailFilters != null) {
- for (MailFilterUIBean filter : mailFilters) {
- String folderId = filter.getMailFolderId();
- folderIdByFilter.put(filter, folderId);
- }
- }
- companyService.saveCompany(company, mailFolders, folderIdByFilter);
+ /*Map<MailFilter, String> folderIdByFilter = new HashMap<>();
+ if (mailFilters != null) {
+ for (MailFilterUIBean filter : mailFilters) {
+ String folderId = filter.getMailFolderId();
+ folderIdByFilter.put(filter, folderId);
}
- result = INPUT;
}
+ configurationService.saveCompany(company, mailFolders, folderIdByFilter);*/
+
+ configurationService.saveConfiguration(configuration);
+
return result;
}
- public void setCompanyService(CompanyService companyService) {
- this.companyService = companyService;
+ public void setConfigurationService(ConfigurationService configurationService) {
+ this.configurationService = configurationService;
}
+ public void setReferentielService(ReferentielService referentielService) {
+ this.referentielService = referentielService;
+ }
+
public void setMailFolderService(MailFolderService mailFolderService) {
this.mailFolderService = mailFolderService;
}
- public void setUserService(UserService userService) {
- this.userService = userService;
+ public Configuration getConfiguration() {
+ return configuration;
}
- public void setCompanyId(String companyId) {
- if (StringUtils.isNotEmpty(companyId)) {
- this.company = companyService.getCompany(companyId);
- }
+ public List<EtatAttente> getEtatAttentes() {
+ return etatAttentes;
}
- public String getCompanyId() {
- if (company == null) {
- return null;
- }
- return company.getTopiaId();
+ public void setEtatAttentes(List<EtatAttente> etatAttentes) {
+ this.etatAttentes = etatAttentes;
}
- public void setCompany(Company company) {
- this.company = company;
+ public Map<Action, String> getEtatAttenteActions() {
+ return getEnumAsMap(Action.values());
}
+
+ public Map<Field, String> getEtatAttenteFields() {
+ return getEnumAsMap(Field.values());
+ }
- public Company getCompany() {
- return company;
+ public List<MailFolder> getMailFolders() {
+ return mailFolders;
}
- public List<Company> getCompanies() {
- return companies;
+ public void setMailFolders(List<MailFolder> mailFolders) {
+ this.mailFolders = mailFolders;
}
- public String getActiveTab() {
+ /*public void setMailFolderService(MailFolderService mailFolderService) {
+ this.mailFolderService = mailFolderService;
+ }
+
+ public void setUserService(UserService userService) {
+ this.userService = userService;
+ }*/
+
+ /*public String getActiveTab() {
return activeTab;
}
public void setActiveTab(String activeTab) {
this.activeTab = activeTab;
- }
+ }*/
- public Map<String, String> getEmailFields() {
+ /*public Map<String, String> getEmailFields() {
Map<String, String> result = new HashMap<>();
result.put(Email.PROPERTY_SENDER, "Adresse email");
result.put(Email.PROPERTY_RECEPTION_DATE, "Date de réception");
@@ -295,5 +292,5 @@
public void setMailFolderId(String mailFolderId) {
this.mailFolderId = mailFolderId;
}
- }
+ }*/
}
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-05-20 21:03:58 UTC (rev 83)
+++ trunk/faxtomail-ui-web/src/main/resources/i18n/faxtomail-ui-web_fr_FR.properties 2014-05-21 16:53:25 UTC (rev 84)
@@ -1 +1,25 @@
+com.franciaflex.faxtomail.persistence.entities.Action.ARCHIVE=Archiver
+com.franciaflex.faxtomail.persistence.entities.Action.GROUP=Grouper
+com.franciaflex.faxtomail.persistence.entities.Action.PRINT=Imprimer
+com.franciaflex.faxtomail.persistence.entities.Action.REPLY=Repondre
+com.franciaflex.faxtomail.persistence.entities.Action.SAVE=Sauver
+com.franciaflex.faxtomail.persistence.entities.Action.TRANSMIT=Transfer
+com.franciaflex.faxtomail.persistence.entities.Field.ARCHIVE_DATE=Date d'archive
+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.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
faxtomail.email.projectReference.default=
Modified: trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration.jsp
===================================================================
--- trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration.jsp 2014-05-20 21:03:58 UTC (rev 83)
+++ trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration.jsp 2014-05-21 16:53:25 UTC (rev 84)
@@ -29,339 +29,312 @@
<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='/webjars/jstree/3.0.0/themes/default/style.min.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/configuration.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/jstree/3.0.0/jstree.min.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='/nuiton-js-angular-ui-tree/angular-ui-tree.js' />"></script>
+ <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>
- var emailFields = {};
- <s:iterator value="emailFields">
- emailFields["<s:property value='key'/>"] = "<s:property value='value' escapeHtml='false'/>";
- </s:iterator>
-
- var folderData = JSON.parse('<s:property value="foldersTreeAsJson" escapeHtml="false"/>');
+ <script type="text/javascript">
+ angular.module('ConfigurationModule', ['FaxToMail', 'ui.tree'])
+ .value('ConfigurationData', {
+ 'etatAttentes' : <s:property value="toJson(etatAttentes)" escapeHtml="false"/>,
+ 'etatAttenteActions': <s:property value="toJson(etatAttenteActions)" escapeHtml="false"/>,
+ 'etatAttenteFields': <s:property value="toJson(etatAttenteFields)" escapeHtml="false"/>,
+ 'mailFolders': <s:property value="toJson(mailFolders)" escapeHtml="false"/>
+ });
</script>
-
- <script type="text/javascript" src="<s:url value='/js/configuration.js' />"></script>
</head>
- <body>
- <!-- navbar -->
- <div class="navbar navbar-inverse navbar-fixed-top">
- <div class="navbar-inner">
+ <body>
+ <div ng-app="ConfigurationModule">
+ <!-- navbar -->
+ <header class="navbar navbar-inverse navbar-static-top bs-docs-nav" id="top" role="banner">
<div class="container">
- <s:a cssClass="brand">FaxToMail</s:a>
+ <div class="navbar-header">
+ <a href="<s:url value='/' />" class="navbar-brand">FaxToMail</a>
+ </div>
+
</div>
- </div>
- </div>
-
- <div id="main-container" class="container">
-
- <h1 class="margin-bottom25">Configuration</h1>
-
- <s:form action='configuration!input' method="get" theme="simple">
-
- <div class="input-append">
-
- <s:select name="companyId"
- label="Société"
- emptyOption="true"
- list="companies"
- listKey="topiaId"
- listValue="name"
- value="company.topiaId"
- cssClass="input-xxlarge"/>
-
- <button class="btn" type="submit">OK</button>
-
- </div>
-
- </s:form>
-
- <s:if test="company">
-
- <s:form id="main_form">
-
+ </header>
+
+ <div id="main-container" class="container">
+
+ <h1 class="page-header">Configuration</h1>
+
+ <s:form id="main_form" ng-controller="ConfigurationController">
+
<s:hidden name="companyId"/>
<s:hidden name="activeTab"/>
-
+
<ul id="tabs" class="nav nav-tabs">
- <li><a href="#tabs-general" data-toggle="tab">Général</a></li>
- <li><a href="#tabs-table" data-toggle="tab">Champs du tableau</a></li>
+ <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-tree" data-toggle="tab">Arborescence</a></li>
<li><a href="#tabs-filters" data-toggle="tab">Filtres de mail</a></li>
- <li><a href="#tabs-rights" data-toggle="tab">Droits</a></li>
- <li><a href="#tabs-email-accounts" data-toggle="tab">Comptes mails</a></li>
+ <!-- <li><a href="#tabs-rights" data-toggle="tab">Droits</a></li>
+ <li><a href="#tabs-email-accounts" data-toggle="tab">Comptes mails</a></li> -->
</ul>
-
- <div class="tab-content">
-
- <div id="tabs-general" class="tab-pane">
+
+ <div class="tab-content active" ng-controller="ConfigurationMiscController">
+
+ <div id="tabs-general" class="tab-pane active">
<!-- Général -->
-
- <s:checkbox name="company.configuration.sendAknowledgement"
+
+ <s:checkbox name="configuration.sendAknowledgement"
label="Envoyer directement l'accusé de réception si demandé par l'expéditeur"/>
-
- <s:checkbox name="company.configuration.rejectUnknownSender"
+
+ <s:checkbox name="configuration.rejectUnknownSender"
label="Refuser les mails dont l'email est inconnu de la base client"
cssClass="margin-bottom25"/>
-
- <s:textfield name="company.configuration.ediFolder"
+
+ <s:textfield name="configuration.ediFolder"
label="Dossier de dépôt du fichier pour l'EDI"
cssClass="span12"/>
-
+
+ <s:textfield name="configuration.convertToPdfCommand"
+ label="Ligne de commande de conversion de fichier X en pdf"
+ cssClass="span12"/>
+
+ <s:textfield name="configuration.openAttachmentCommand"
+ label="Ligne de commande d'ouverture de fichier non TXT, TIFF, JPEG, PDF"
+ cssClass="span12"/>
+
<!-- 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>
-
- <div id="tabs-table" class="tab-pane">
- <!-- Champs du tableau -->
-
- <div class="control-group ">
- <label class="control-label" for="tableColumns">Champs à afficher dans le tableau (l'ordre peut être changé en faisant un glisser/déposer sur les champs)</label>
-
- <div class="controls">
-
- <s:hidden name="company.configuration.tableColumns"
- id="tableColumns" cssClass="full-width margin-bottom25"/>
-
- </div>
-
- <div>
- <table id='table-snapshot' class="table table-bordered">
- <caption>Aperçu</caption>
- <thead><tr></tr></thead>
+
+ <div id="tabs-wait" class="tab-pane" ng-controller="ConfigurationWaitController">
+
+ <div class="row">
+ <div class="col-md-4">
+ <table class="table table-hover">
+ <thead>
+ <tr>
+ <th>État d'attente</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr ng-repeat="etatAttente in etatAttentes"
+ ng-class="{'info' : etatAttente == selectedEtatAttente}"
+ ng-click="editEtatAttente(etatAttente)">
+ <td>{{etatAttente.label}}</td>
+ </tr>
+ </tbody>
</table>
</div>
+ <div class="col-md-7" ng-if="selectedEtatAttente">
+ Champs obligatoires pour l'état d'attente <strong>{{selectedEtatAttente.label}}</strong>:
+ <label class="checkbox" ng-repeat="(etatAttenteField,label) in etatAttenteFields">
+ <input type="checkbox" ng-checked="selectedEtatAttente.fields.indexOf(etatAttenteField) != -1"
+ ng-click="changeEtatAttenteField(etatAttenteAction)"> {{label}}
+ </label>
+ Actions autorisées pour l'état d'attente <strong>{{selectedEtatAttente.label}}</strong>:
+ <label class="checkbox" ng-repeat="(etatAttenteAction,label) in etatAttenteActions">
+ <input type="checkbox" ng-checked="selectedEtatAttente.actions.indexOf(etatAttenteAction) != -1"
+ ng-click="changeEtatAttenteAction(etatAttenteAction)"> {{label}}
+ </label>
+ </div>
+ <div class="col-md-7" ng-if="!selectedEtatAttente">
+ <em>Sélectionnez un état d'attente.</em>
+ </div>
</div>
-
+
</div>
-
- <div id="tabs-tree" class="tab-pane">
- <!-- Tree Diagram -->
-
- <div id="treeDiagram" class="jstree margin-bottom25">
- </div>
-
- <button class="btn" type="button" onClick="createNewNode()">
- <i class="icon-plus"></i> Nouvelle racine
- </button>
- </div>
-
-
- <div id="tabs-filters" class="tab-pane">
- <!-- Filtres de mail -->
- <table id="filters" class="table table-bordered">
- <thead>
- <tr>
- <th>Filtre</th>
- <th>Dossier</th>
- </tr>
- </thead>
- <tbody>
- <s:iterator value="company.mailFilter" status="rowStatus" var="filter">
- <tr>
- <td>
- <s:property value='expression'/>
- <s:hidden name="mailFilters[%{#rowStatus.index}].expression"
- value="%{#filter.expression}"/>
- </td>
- <td>
- <s:property value='allFoldersFlat.get(mailFolder.topiaId)'/>
- <s:hidden name="mailFilters[%{#rowStatus.index}].mailFolderId"
- value="%{#filter.mailFolder.topiaId}"/>
- </td>
- <s:hidden name="mailFilters[%{#rowStatus.index}].topiaId"
- value="%{#filter.topiaId}"/>
- </tr>
- </s:iterator>
- </tbody>
- </table>
-
- <fieldset class="margin-bottom25">
- <legend>Nouveau filtre</legend>
-
- <div id="newFilterExpression-group" class="control-group">
- <label for="newFilterExpression">Expression</label>
- <div class="controls">
- <input type="text"
- id="newFilterExpression"
- class="input-xxlarge"
- <s:if test="allFoldersFlat.isEmpty()">disabled</s:if>/>
- <span id="newFilterExpression-help" class="help-inline"></span>
+
+ <div id="tabs-tree" class="tab-pane" ng-controller="ConfigurationTreeController">
+
+ <div class="row">
+ <div class="col-md-4">
+ <script type="text/ng-template" id="nodes_renderer.html">
+ <div ui-tree-handle ng-click="editMailFolder(mailFolder)" ng-class="{'bg-warning' : mailFolder == selectedMailFolder}">
+ <a class="btn btn-success btn-xs" data-nodrag ng-click="toggle(this)">
+ <span class="glyphicon" ng-class="{'glyphicon-chevron-right': collapsed, 'glyphicon-chevron-down': !collapsed}"></span>
+ </a>
+ {{mailFolder.name}}
+ <a class="pull-right btn btn-danger btn-xs" data-nodrag ng-click="remove(this)"><span class="glyphicon glyphicon-remove"></span></a>
+ <a class="pull-right btn btn-primary btn-xs" data-nodrag ng-click="newSubItem(this)" style="margin-right: 8px;"><span class="glyphicon glyphicon-plus"></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'">
+ </li>
+ </ol>
+ </script>
+ <div ui-tree="options" data-drag-enabled="false">
+ <ol ui-tree-nodes="" ng-model="mailFolders" id="tree-root">
+ <li ng-repeat="mailFolder in mailFolders" ui-tree-node ng-include="'nodes_renderer.html'"></li>
+ </ol>
</div>
</div>
+
+ <div class="col-md-8" ng-if="selectedMailFolder">
+ <div class="panel-group" id="accordion">
- <div id="newFilterFolder-group" class="control-group">
- <label for="newFilterFolder">Dossier de destination</label>
- <div class="controls">
- <select id="newFilterFolder"
- class="input-xxlarge"
- <s:if test="allFoldersFlat.isEmpty()">disabled</s:if>>
- <s:iterator value="allFoldersFlat">
- <option value="<s:property value='key'/>"><s:property value='value'/></option>
- </s:iterator>
- </select>
- <span id="newFilterFolder-help" class="help-inline"></span>
+ <!-- Liste des chargés de clientèle -->
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ <h4 class="panel-title">
+ <a data-toggle="collapse" data-parent="#accordion" href="#collapse1">
+ Liste des chargés de clientèle {{selectedMailFolder.name}}
+ </a>
+ </h4>
+ </div>
+ <div id="collapse1" class="panel-collapse collapse">
+ <div class="panel-body">
+ Toto
+ </div>
+ </div>
</div>
- </div>
- <div>
- <button class="btn" type="button" onClick="createNewFilter()" <s:if test="allFoldersFlat.isEmpty()">disabled</s:if>>
- <i class="icon-plus"></i> Ajouter
- </button>
- </div>
+ <!-- Liste des emails expéditeur -->
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ <h4 class="panel-title">
+ <a data-toggle="collapse" data-parent="#accordion" href="#collapse2">
+ liste des emails expéditeur
+ </a>
+ </h4>
+ </div>
+ <div id="collapse2" class="panel-collapse collapse">
+ <div class="panel-body">
+ Toto
+ </div>
+ </div>
+ </div>
- </fieldset>
- </div>
-
- <div id="tabs-rights" class="tab-pane">
- <!-- Droits d'accès -->
- <table id="rights" class="table table-bordered">
- <thead>
- <tr>
- <th>Utilisateur ou groupe</th>
- <th>Dossier</th>
- <th>Type</th>
- </tr>
- </thead>
- <tbody></tbody>
- </table>
-
- <fieldset class="margin-bottom25">
-
- <legend>Nouveau droit</legend>
-
- <div id="newRightUser-group" class="control-group">
- <label for="newRightUser">Utilisateur ou groupe</label>
- <div class="controls">
- <select id="newRightUser"
- class="input-xxlarge"
- <s:if test="allUsers.isEmpty() && allUserGroups.isEmpty()">disabled</s:if>>
- <optgroup label="Utilisateurs">
- <s:iterator value="allUsers">
- <option value="<s:property value='topiaId'/>"><s:property value='name'/></option>
- </s:iterator>
- </optgroup>
- <optgroup label="Groupes">
- <s:iterator value="allUserGroups">
- <option value="<s:property value='topiaId'/>"><s:property value='name'/></option>
- </s:iterator>
- </optgroup>
- </select>
- <span id="newRightUser-help" class="help-inline"></span>
+ <!-- Liste des emails expéditeur -->
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ <h4 class="panel-title">
+ <a data-toggle="collapse" data-parent="#accordion" href="#collapse3">
+ sélection des états d'attentes possibles pour ce dossier
+ </a>
+ </h4>
+ </div>
+ <div id="collapse3" class="panel-collapse collapse">
+ <div class="panel-body">
+ Toto
+ </div>
+ </div>
</div>
- </div>
+
+ <!-- Liste des emails expéditeur -->
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ <h4 class="panel-title">
+ <a data-toggle="collapse" data-parent="#accordion" href="#collapse4">
+ groupes/personnes ayant droit d'écriture sur le dossier
+ </a>
+ </h4>
+ </div>
+ <div id="collapse4" class="panel-collapse collapse">
+ <div class="panel-body">
+ Toto
+ </div>
+ </div>
+ </div>
+
+ <!-- Liste des emails expéditeur -->
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ <h4 class="panel-title">
+ <a data-toggle="collapse" data-parent="#accordion" href="#collapse5">
+ actions possibles du menu contextuel pour ce dossier
+ </a>
+ </h4>
+ </div>
+ <div id="collapse5" class="panel-collapse collapse">
+ <div class="panel-body">
+ Toto
+ </div>
+ </div>
+ </div>
- <div id="newRightFolder-group" class="control-group">
- <label for="newRightFolder">Dossier de destination</label>
- <div class="controls">
- <select id="newRightFolder"
- class="input-xxlarge"
- <s:if test="allFoldersFlat.isEmpty()">disabled</s:if>>
- <s:iterator value="allFoldersFlat">
- <option value="<s:property value='key'/>"><s:property value='value'/></option>
- </s:iterator>
- </select>
- <span id="newRightFolder-help" class="help-inline"></span>
+ <!-- configuration des colonnes a afficher -->
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ <h4 class="panel-title">
+ <a data-toggle="collapse" data-parent="#accordion" href="#collapse6">
+ configuration des colonnes a afficher
+ </a>
+ </h4>
+ </div>
+ <div id="collapse6" class="panel-collapse collapse">
+ <div class="panel-body">
+ Toto
+ </div>
+ </div>
</div>
- </div>
- <div id="newRightTypes-group" class="control-group">
- <label>Types</label>
- <div class="controls">
- <label class="checkbox inline">
- <input type="checkbox" id="newRightType-read" value="READ"/> lecture
- </label>
- <label class="checkbox inline">
- <input type="checkbox" id="newRightType-write" value="WRITE"/> écriture
- </label>
- <label class="checkbox inline">
- <input type="checkbox" id="newRightType-archive" value="ARCHIVE"/> archives
- </label>
- <span id="newRightType-help" class="help-inline"></span>
- </div>
</div>
-
- <div>
- <button class="btn" type="button" onClick="createNewRight()" <s:if test="allFoldersFlat.isEmpty()">disabled</s:if>>
- <i class="icon-plus"></i> Ajouter
- </button>
+
+ <div class="checkbox">
+ <label for="printActionEqualTakeActionField">action imprimer est-elle équivalente à "prendre"</label>
+ <input type="checkbox" id="printActionEqualTakeActionField" ng-model="selectedMailFolder.printActionEqualTakeAction">
</div>
-
- </fieldset>
-
- </div>
-
- <div id="tabs-email-accounts" class="tab-pane">
- <!-- Comptes email -->
- <table id="emailAccounts" class="table table-bordered">
- <thead>
- <tr>
- <th>Nom d'utilisateur</th>
- <th>Serveur</th>
- <th>Port</th>
- </tr>
- </thead>
- <tbody></tbody>
- </table>
-
- <fieldset class="margin-bottom25">
- <legend>Nouveau compte mail</legend>
-
- <div id="newEmailAccountUsername-group" class="control-group">
- <label for="newEmailAccountUsername">Nom d'utilisateur</label>
- <div class="controls">
- <input type="text"
- id="newEmailAccountUsername"
- class="input-xxlarge"/>
- <span id="newEmailAccountUsername-help" class="help-inline"></span>
- </div>
- </div>
-
- <div id="newEmailAccountServer-group" class="control-group">
- <label for="newEmailAccountServer">Serveur</label>
- <div class="controls">
- <input type="text"
- id="newEmailAccountServer"
- class="input-xxlarge"/>
- <span id="newEmailAccountServer-help" class="help-inline"></span>
- </div>
- </div>
-
- <div id="newEmailAccountPort-group" class="control-group">
- <label for="newEmailAccountPort">Port</label>
- <div class="controls">
- <input type="number"
- id="newEmailAccountPort"
- class="input-xxlarge"/>
- <span id="newEmailAccountPort-help" class="help-inline"></span>
+
+ <div class="checkbox">
+ <label for="openAttachmentReportNoTakenField">ouvrir une pièce jointe sans prendre, met-il la ligne en orange ou non</label>
+ <input type="checkbox" id="openAttachmentReportNoTakenField" ng-model="selectedMailFolder.openAttachmentReportNoTaken">
</div>
- </div>
-
- <div>
- <button class="btn" type="button" onClick="createNewEmailAccount()">
- <i class="icon-plus"></i> Ajouter
- </button>
- </div>
-
- </fieldset>
-
+
+ <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>
</div>
-
</div>
- <div class="form-actions">
- <button type="submit" class="btn btn-primary">Valider</button>
+ <div id="tabs-filters" class="tab-pane" ng-controller="ConfigurationFilterController">
+ <table class="table table-hover table-bordered">
+ <thead>
+ <tr>
+ <th>Filtre</th>
+ <th>Dossier</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr ng-repeat="mailFilter in allMailFilters()">
+ <td>{{mailFilter.expression}}</td>
+ <td>{{mailFilter.fmMailFolder.name}}</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="selectedFilter">
+ </div>
+ <div class="form-group">
+ <label for="folderField">Dossier</label>
+ <select class="form-control" ng-model="selectedFolder" ng-options="mailFolder.name for mailFolder in flatMailFolders()"></select>
+ </div>
+ </div>
+ <button type="button" class="btn btn-success" ng-disabled="!selectedFilter || !selectedFolder" ng-click="addNewFilter()">
+ <i class="glyphicon glyphicon-plus"></i>Ajouter
+ </button>
</div>
- </s:form>
- </s:if>
+ <!-- <div class="container form-actions">
+ <button type="submit" class="btn btn-primary pull-right">Valider</button>
+ </div> -->
+
+ <nav class="navbar navbar-default navbar-fixed-bottom">
+ <div class="container">
+ <button type="submit" class="btn btn-primary navbar-btn pull-right">Valider</button>
+ </div>
+ </nav>
+ </div>
+ </s:form>
</div>
+ </div>
</body>
</html>
Modified: trunk/faxtomail-ui-web/src/main/webapp/css/configuration.css
===================================================================
--- trunk/faxtomail-ui-web/src/main/webapp/css/configuration.css 2014-05-20 21:03:58 UTC (rev 83)
+++ trunk/faxtomail-ui-web/src/main/webapp/css/configuration.css 2014-05-21 16:53:25 UTC (rev 84)
@@ -21,14 +21,7 @@
* <http://www.gnu.org/licenses/gpl-3.0.html>.
* #L%
*/
-#main-container {
- padding-top: 60px;
-}
-.margin-bottom25 {
- margin-bottom: 25px;
-}
-
.full-width {
width: 100%;
}
@@ -37,12 +30,26 @@
padding-bottom: 70px;
}
-.form-actions {
- position: fixed;
- bottom: 0;
- width: 900px;
+.page-header {
+ margin-bottom: 25px;
}
-#treeDiagram {
- background: #f0f0f0;
+.angular-ui-tree-handle {
+ background: #f8faff;
+ border: 1px solid #dae2ea;
+ color: #7c9eb2;
+ padding: 10px 10px;
+ cursor:default;
+}
+.angular-ui-tree-handle.bg-warning {
+ background: #fcf8e3;
+}
+
+.angular-ui-tree-handle:hover {
+ color: #438eb9;
+ background: #f4f6f7;
+ border-color: #dce2e8;
+}
+.angular-ui-tree-handle.bg-warning:hover {
+ background: #fcf8e3;
}
\ No newline at end of file
Modified: trunk/faxtomail-ui-web/src/main/webapp/js/configuration.js
===================================================================
--- trunk/faxtomail-ui-web/src/main/webapp/js/configuration.js 2014-05-20 21:03:58 UTC (rev 83)
+++ trunk/faxtomail-ui-web/src/main/webapp/js/configuration.js 2014-05-21 16:53:25 UTC (rev 84)
@@ -1,261 +1,143 @@
-/*
- * #%L
- * FaxToMail :: Web
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2014 Franciaflex, Code Lutin
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
+
/**
- * adds a new folder in the tree
+ * Global configuration controller.
*/
-var createNewNode = function() {
- $('.jstree').jstree(true).create_node('#', 'Nouvelle racine');
-}
+FaxToMailModule.controller('ConfigurationController', ['$scope', '$http', 'ConfigurationData',
+ function($scope, $http, ConfigurationData) {
+ //mail folders
+ $scope.mailFolders = ConfigurationData.mailFolders;
+}]);
/**
- * adds a new filter in the table
+ * Misc tab controller.
*/
-var createNewFilter = function() {
- var filterExpression = $("#newFilterExpression").val();
- if (!filterExpression) {
- $("#newFilterExpression-group").addClass("error");
- $("#newFilterExpression-group .help-inline").text("Veuillez entrer une valeur");
- return;
- }
- $("#newFilterExpression-group").removeClass("error");
- $("#newFilterExpression-group .help-inline").text("");
+FaxToMailModule.controller('ConfigurationMiscController', ['$scope', '$http', 'ConfigurationData',
+ function($scope, $http, ConfigurationData) {
+
+}]);
- var filterFolderId = $("#newFilterFolder :selected").val();
- var filterFolder = $("#newFilterFolder :selected").text();
- if (!filterFolder) {
- $("#newFilterFolder-group").addClass("error");
- $("#newFilterFolder-group .help-inline").text("Veuillez sélectionner un dossier");
- return;
- }
- $("#newFilterFolder-group").removeClass("error");
- $("#newFilterFolder-group .help-inline").text("");
-
- var index = $("#filters tbody tr").length;
- var row = "<tr>" +
- "<td>" +
- filterExpression +
- "<input type='hidden' name='mailFilters[" + index + "].expression' value='" + filterExpression + "'/>" +
- "</td>" +
- "<td>" +
- filterFolder +
- "<input type='hidden' name='mailFilters[" + index + "].mailFolderId' value='" + filterFolderId + "'/>" +
- "</td>" +
- "</tr>";
- $("#filters tbody").append(row);
-}
-
/**
- * adds a new right in the table
+ * Etat attente tab controller.
*/
-var createNewRight = function() {
- var rightUserId = $("#newRightUser :selected").val();
- var rightUser = $("#newRightUser :selected").text();
- if (!rightUser) {
- $("#newRightUser-group").addClass("error");
- $("#newRightUser-group .help-inline").text("Veuillez sélectionner au moins un utilisateur");
- return;
- }
- $("#newRightUser-group").removeClass("error");
- $("#newRightUser-group .help-inline").text("");
+FaxToMailModule.controller('ConfigurationWaitController', ['$scope', '$http', 'ConfigurationData',
+ function($scope, $http, ConfigurationData) {
+ //{Array} les etats d'attentes disponibles
+ $scope.etatAttentes = ConfigurationData.etatAttentes;
+ //{Array} les actions possibles pour les etats d'attentes
+ $scope.etatAttenteActions = ConfigurationData.etatAttenteActions;
+ //{Array} les champs obligatoires possibles
+ $scope.etatAttenteFields = ConfigurationData.etatAttenteFields;
+ //{Object} etat d'attente selectionné
+ $scope.selectedEtatAttente;
- var rightFolderId = $("#newRightFolder :selected").val();
- var rightFolder = $("#newRightFolder :selected").text();
- if (!rightFolder) {
- $("#newRightFolder-group").addClass("error");
- $("#newRightFolder-group .help-inline").text("Veuillez sélectionner un dossier");
- return;
- }
- $("#newRightFolder-group").removeClass("error");
- $("#newRightFolder-group .help-inline").text("");
+ // edition de l'etat d'attent cliqué
+ $scope.editEtatAttente = function(etatAttente) {
+ $scope.selectedEtatAttente = etatAttente;
- var rightTypeIds = new Array();
- var rightTypes = new Array();
- var checkedTypes = $("#newRightTypes-group :checked");
- if (checkedTypes.length == 0) {
- $("#newRightTypes-group").removeClass("error");
- $("#newRightTypes-group .help-inline").text("");
- return;
- }
- $("#newRightTypes-group").addClass("error");
- $("#newRightTypes-group .help-inline").text("Veuillez choisir au moins un type");
- checkedTypes.each(function() {
- rightTypeIds.push($(this).val());
- rightTypes.push($(this).parent().text().trim());
- });
+ // initialize le tableau d'action si vide
+ if (!$scope.selectedEtatAttente.actions) {
+ $scope.selectedEtatAttente.actions = [];
+ }
+ if (!$scope.selectedEtatAttente.fields) {
+ $scope.selectedEtatAttente.fields = [];
+ }
+ };
- var index = $("#rights tbody tr").length;
- var row = "<tr>" +
- "<td>" +
- rightUser +
- "<input type='hidden' name='rights[" + index + "].userId' value='" + rightUserId + "'/>" +
- "</td>" +
- "<td>" +
- rightFolder +
- "<input type='hidden' name='rights[" + index + "].mailFolderId' value='" + rightFolderId + "'/>" +
- "</td>" +
- "<td>" +
- rightTypes.join(", ") +
- "<input type='hidden' name='rights[" + index + "].types' value='" + rightTypeIds.join(",") + "'/>" +
- "</td>" +
- "</tr>";
- $("#rights tbody").append(row);
-}
+ // selection/deselection d'une action
+ $scope.changeEtatAttenteAction = function(etatAttenteAction) {
+
+ var index = $scope.selectedEtatAttente.actions.indexOf(etatAttenteAction);
+ if (index != -1) {
+ $scope.selectedEtatAttente.actions.splice(index, 1);
+ } else {
+ $scope.selectedEtatAttente.actions.push(etatAttenteAction);
+ }
+ };
+
+ // selection/deselection d'un champ
+ $scope.changeEtatAttenteField = function(etatAttenteField) {
+
+ var index = $scope.selectedEtatAttente.fields.indexOf(etatAttenteField);
+ if (index != -1) {
+ $scope.selectedEtatAttente.fields.splice(index, 1);
+ } else {
+ $scope.selectedEtatAttente.fields.push(etatAttenteField);
+ }
+ };
+}]);
-var createNewEmailAccount = function() {
- var emailAccountUsername = $("#newEmailAccountUsername").val();
- if (!emailAccountUsername) {
- $("#newEmailAccountUsername-group").addClass("error");
- $("#newEmailAccountUsername-group .help-inline").text("Veuillez entrer une valeur");
- return;
- }
- $("#newEmailAccountUsername-group").removeClass("error");
- $("#newEmailAccountUsername-group .help-inline").text("");
+/**
+ * Mail folder tab controller.
+ */
+FaxToMailModule.controller('ConfigurationTreeController', ['$scope', '$http', 'ConfigurationData',
+ function($scope, $http, ConfigurationData) {
+ // selected mail folder
+ $scope.selectedMailFolder;
- var emailAccountServer = $("#newEmailAccountServer").val();
- if (!emailAccountServer) {
- $("#newEmailAccountServer-group").addClass("error");
- $("#newEmailAccountServer-group .help-inline").text("Veuillez entrer une valeur");
- return;
- }
- $("#newEmailAccountServer-group").removeClass("error");
- $("#newEmailAccountServer-group .help-inline").text("");
+ // toggle node
+ $scope.toggle = function(scope) {
+ scope.toggle();
+ };
+
+ // edit mail folder
+ $scope.editMailFolder = function(mailFolder) {
+ $scope.selectedMailFolder = mailFolder;
+ };
+}]);
- var emailAccountPort = $("#newEmailAccountPort").val();
- if (!emailAccountPort) {
- $("#newEmailAccountPort-group").addClass("error");
- $("#newEmailAccountPort-group .help-inline").text("Veuillez entrer une valeur");
- return;
- }
- $("#newEmailAccountPort-group").removeClass("error");
- $("#newEmailAccountPort-group .help-inline").text("");
+/**
+ * Mail filter tab controller.
+ */
+FaxToMailModule.controller('ConfigurationFilterController', ['$scope', '$http', 'ConfigurationData',
+ function($scope, $http, ConfigurationData) {
+ //{String} input filter in add form
+ $scope.selectedFilter;
+ //{Object} selected folder in add form
+ $scope.selectedFolder;
+
+ // FIXME in binding sur une methode c'est pas terrible
+ $scope.allMailFilters = function() {
+ var mailFilters = [];
+ angular.forEach($scope.flatMailFolders(), function(mailFolder) {
+ if (mailFolder.filters) {
+ mailFilters = mailFilters.concat(mailFolder.filters);
+ angular.forEach($scope.mailFilters, function(mailFilter) {
+
+ // ca c'est pas propre, on modifie l'object original pour affichage
+ mailFilter.fmMailFolder = mailFolder;
- var index = $("#emailAccounts tbody tr").length;
- var row = "<tr>" +
- "<td>" +
- emailAccountUsername +
- "<input type='hidden' name='emailAccounts[" + index + "].username' value='" + emailAccountUsername + "'/>" +
- "</td>" +
- "<td>" +
- emailAccountServer +
- "<input type='hidden' name='emailAccounts[" + index + "].server' value='" + emailAccountServer + "'/>" +
- "</td>" +
- "<td>" +
- emailAccountPort +
- "<input type='hidden' name='emailAccounts[" + index + "].port' value='" + emailAccountPort + "'/>" +
- "</td>" +
- "</tr>";
- $("#emailAccounts tbody").append(row);
- console.log("debig")
-}
-
-var formatToSendData = function(mailFolders) {
- var result = [];
- for (var i = 0 ; i < mailFolders.length ; i++) {
- var mailFolder = mailFolders[i];
- var children = formatToSendData(mailFolder.children);
- result.push({ name: mailFolder.text, children: children, topiaId: mailFolder.id });
- }
- return result;
-}
-
-var formatReceivedData = function(mailFolders) {
- var result = [];
- for (var i = 0 ; i < mailFolders.length ; i++) {
- var mailFolder = mailFolders[i];
- var children = formatReceivedData(mailFolder.children);
- result.push({ text: mailFolder.name, children: children, id: mailFolder.topiaId });
- }
- return result;
-}
-
-var updateTableSnapshot = function() {
- var tableHeader = $("#table-snapshot thead tr");
- tableHeader.empty();
- var value = $("#tableColumns").val();
- if (value) {
- var columns = value.split(",");
- for (var i = 0 ; i < columns.length ; i++) {
- tableHeader.append("<th>" + emailFields[columns[i]] + "</th>");
+ mailFilters.push(mailFolder);
+ });
+ } else {
+ mailFolder.filters = [];
}
- }
-}
+ });
+ return mailFilters;
+ };
-$().ready(function() {
+ var recursiveAddMailFolder = function(result, mailFolders) {
+ if (mailFolders) {
+ angular.forEach(mailFolders, function(mailFolder) {
+ result.push(mailFolder);
+ recursiveAddMailFolder(result, mailFolder.children);
+ });
+ }
+ };
- $('a[data-toggle="tab"]').on('shown', function (e) {
- var hash = e.target.hash;
- $(":input[name='activeTab']").val(hash);
- });
+ // FIXME second binding sur une methode, pas top
+ $scope.flatMailFolders = function() {
+ var flatMailFolders = [];
+ recursiveAddMailFolder(flatMailFolders, $scope.mailFolders);
+ return flatMailFolders;
+ };
+
+ // add new filter action
+ $scope.addNewFilter = function() {
+ var filter = {expression: $scope.selectedFilter, fmMailFolder: $scope.selectedFolder};
+ $scope.selectedFolder.filters.push(filter);
- var hash = $(":input[name='activeTab']").val();
- if (!hash) {
- hash = "#tabs-general";
- }
- $('#tabs a[href="' + hash + '"]').tab('show');
-
- // table columns
-
- var tableColumnTags = new Array();
- for (var k in emailFields) {
- tableColumnTags.push({ id: k, text: emailFields[k] })
- }
- $('#tableColumns').select2({tags:tableColumnTags}).on("change", function(e) {
- updateTableSnapshot();
- });
-
- $("#tableColumns").select2("container").find("ul.select2-choices").sortable({
- containment: 'parent',
- start: function() { $("#tableColumns").select2("onSortStart"); },
- update: function() { $("#tableColumns").select2("onSortEnd"); }
- });
-
- updateTableSnapshot();
-
- // tree diagram
- folderData = formatReceivedData(folderData);
-
- $('#treeDiagram').jstree({
- core: {
- data: folderData,
- check_callback: true,
- multiple: false,
- themes: {
- variant: "large"
- }
- },
- state: { key: "faxtomail-treeDiagram" },
- plugins: [ "contextmenu", "sort", "state", "unique", "dnd" ]
- });
-
- $("#main_form").submit(function(event) {
- var mailFolders = $('#treeDiagram').jstree(true).get_json('#', {});
- var foldersAsJson = formatToSendData(mailFolders);
- console.log(foldersAsJson);
-
- var input = $("<input>")
- .attr("type", "hidden")
- .attr("name", "foldersTreeAsJson").val(JSON.stringify(foldersAsJson));
- $('#main_form').append($(input));
- });
-});
\ No newline at end of file
+ // clear form
+ delete $scope.selectedFilter;
+ delete $scope.selectedFolder;
+ };
+}]);
Added: trunk/faxtomail-ui-web/src/main/webapp/js/faxtomail.js
===================================================================
--- trunk/faxtomail-ui-web/src/main/webapp/js/faxtomail.js (rev 0)
+++ trunk/faxtomail-ui-web/src/main/webapp/js/faxtomail.js 2014-05-21 16:53:25 UTC (rev 84)
@@ -0,0 +1,2 @@
+
+var FaxToMailModule = angular.module('FaxToMail', []);
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2014-05-20 21:03:58 UTC (rev 83)
+++ trunk/pom.xml 2014-05-21 16:53:25 UTC (rev 84)
@@ -115,7 +115,7 @@
<struts2Version>2.3.16.3</struts2Version>
<jqueryPluginVersion>3.7.1</jqueryPluginVersion>
- <bootstrapPluginVersion>1.7.0</bootstrapPluginVersion>
+ <bootstrapPluginVersion>2.0.0</bootstrapPluginVersion>
<shiroVersion>1.2.3</shiroVersion>
<slf4jVersion>1.7.7</slf4jVersion>
<mockitoVersion>1.9.5</mockitoVersion>
@@ -281,7 +281,7 @@
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>itextpdf</artifactId>
- <version>5.5.0</version>
+ <version>5.5.1</version>
</dependency>
<!-- librairie Jaxx -->
@@ -548,6 +548,12 @@
<scope>runtime</scope>
</dependency>
+ <dependency>
+ <groupId>org.nuiton.js</groupId>
+ <artifactId>nuiton-js-angular-ui-tree</artifactId>
+ <version>2.0.6-1-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
</dependencies>
</dependencyManagement>
1
0
Build failed in Jenkins: faxtomail-ci » FaxToMail :: UI #42
by admin+ci-codelutin.com@codelutin.com 20 May '14
by admin+ci-codelutin.com@codelutin.com 20 May '14
20 May '14
See <http://ci.codelutin.com/jenkins/job/faxtomail-ci/com.franciaflex.faxtomail$…>
Changes:
[echatellier] refs #4657: Fix compilation
------------------------------------------
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building FaxToMail :: UI 0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] Downloading: http://nexus.nuiton.org/nexus/content/repositories/snapshots/org/nuiton/jax…
[INFO] Downloading: http://nexus.nuiton.org/nexus/content/groups/faxtomail-group/org/nuiton/jax…
[INFO] Downloaded: http://nexus.nuiton.org/nexus/content/groups/faxtomail-group/org/nuiton/jax… (2 KB at 40.7 KB/sec)
[INFO] Downloaded: http://nexus.nuiton.org/nexus/content/repositories/snapshots/org/nuiton/jax… (2 KB at 17.9 KB/sec)
[INFO] Downloading: http://repository.springsource.com/maven/bundles/external/org/nuiton/jaxx/j…
[INFO] Downloading: http://nexus.nuiton.org/nexus/content/repositories/snapshots/org/nuiton/jax…
[INFO] Downloading: http://nexus.nuiton.org/nexus/content/groups/faxtomail-group/org/nuiton/jax…
[INFO] Downloaded: http://nexus.nuiton.org/nexus/content/groups/faxtomail-group/org/nuiton/jax… (2 KB at 47.1 KB/sec)
[INFO] Downloaded: http://nexus.nuiton.org/nexus/content/repositories/snapshots/org/nuiton/jax… (2 KB at 45.3 KB/sec)
[INFO] Downloading: http://nexus.nuiton.org/nexus/content/repositories/snapshots/org/nuiton/jax…
[INFO] Downloading: http://nexus.nuiton.org/nexus/content/groups/faxtomail-group/org/nuiton/jax…
[INFO] Downloading: http://repository.springsource.com/maven/bundles/external/org/nuiton/jaxx/j…
[INFO] Downloaded: http://nexus.nuiton.org/nexus/content/repositories/snapshots/org/nuiton/jax… (2 KB at 53.3 KB/sec)
[INFO] Downloaded: http://nexus.nuiton.org/nexus/content/groups/faxtomail-group/org/nuiton/jax… (2 KB at 51.3 KB/sec)
[INFO] Downloading: http://nexus.nuiton.org/nexus/content/repositories/snapshots/org/nuiton/jax…
[INFO] Downloading: http://repository.springsource.com/maven/bundles/external/org/nuiton/jaxx/j…
[INFO] Downloading: http://nexus.nuiton.org/nexus/content/groups/faxtomail-group/org/nuiton/jax…
[INFO] Downloaded: http://nexus.nuiton.org/nexus/content/groups/faxtomail-group/org/nuiton/jax… (2 KB at 47.1 KB/sec)
[INFO] Downloaded: http://nexus.nuiton.org/nexus/content/repositories/snapshots/org/nuiton/jax… (2 KB at 32.7 KB/sec)
[INFO] Downloading: http://nexus.nuiton.org/nexus/content/repositories/snapshots/org/nuiton/jax…
[INFO] Downloading: http://nexus.nuiton.org/nexus/content/groups/faxtomail-group/org/nuiton/jax…
[INFO] Downloading: http://repository.springsource.com/maven/bundles/external/org/nuiton/jaxx/j…
[INFO] Downloaded: http://nexus.nuiton.org/nexus/content/groups/faxtomail-group/org/nuiton/jax… (2 KB at 42.4 KB/sec)
[INFO] Downloaded: http://nexus.nuiton.org/nexus/content/repositories/snapshots/org/nuiton/jax… (2 KB at 30.4 KB/sec)
[INFO] Downloading: http://nexus.nuiton.org/nexus/content/repositories/central-releases/com/ezw…
[INFO] Downloading: http://repository.springsource.com/maven/bundles/external/com/ezware/oxbow/…
[INFO] Downloading: http://nexus.nuiton.org/nexus/content/groups/faxtomail-group/com/ezware/oxb…
[INFO] Downloading: http://repo.maven.apache.org/maven2/com/ezware/oxbow/swing-bits/0.5.0/swing…
[WARNING] The POM for com.ezware.oxbow:swing-bits:jar:0.5.0 is missing, no dependency information available
[INFO] Downloading: http://repository.springsource.com/maven/bundles/external/org/nuiton/nuiton…
[INFO] Downloading: http://repository.springsource.com/maven/bundles/external/org/nuiton/jaxx/j…
[INFO] Downloading: http://nexus.nuiton.org/nexus/content/repositories/central-releases/com/ezw…
[INFO] Downloading: http://repository.springsource.com/maven/bundles/external/com/ezware/oxbow/…
[INFO] Downloading: http://nexus.nuiton.org/nexus/content/groups/faxtomail-group/com/ezware/oxb…
[INFO] Downloading: http://repo.maven.apache.org/maven2/com/ezware/oxbow/swing-bits/0.5.0/swing…
[JENKINS] Archiving disabled
1
23