r313 - in trunk: . faxtomail-ui-web faxtomail-ui-web/src/main/webapp/js
Author: echatellier Date: 2014-07-02 15:26:03 +0200 (Wed, 02 Jul 2014) New Revision: 313 Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/313 Log: Ajout de check sur les doublons Modified: trunk/faxtomail-ui-web/pom.xml trunk/faxtomail-ui-web/src/main/webapp/js/configuration.js trunk/faxtomail-ui-web/src/main/webapp/js/faxtomail.js trunk/pom.xml Modified: trunk/faxtomail-ui-web/pom.xml =================================================================== --- trunk/faxtomail-ui-web/pom.xml 2014-07-02 12:00:40 UTC (rev 312) +++ trunk/faxtomail-ui-web/pom.xml 2014-07-02 13:26:03 UTC (rev 313) @@ -296,8 +296,19 @@ <dependency> <groupId>gui.ava</groupId> <artifactId>html2image</artifactId> + <exclusions> + <exclusion> + <artifactId>core-renderer</artifactId> + <groupId>org.xhtmlrenderer</groupId> + </exclusion> + </exclusions> </dependency> + <dependency> + <groupId>org.xhtmlrenderer</groupId> + <artifactId>flying-saucer-core</artifactId> + <version>9.0.6</version> + </dependency> </dependencies> <build> Modified: trunk/faxtomail-ui-web/src/main/webapp/js/configuration.js =================================================================== --- trunk/faxtomail-ui-web/src/main/webapp/js/configuration.js 2014-07-02 12:00:40 UTC (rev 312) +++ trunk/faxtomail-ui-web/src/main/webapp/js/configuration.js 2014-07-02 13:26:03 UTC (rev 313) @@ -205,10 +205,16 @@ topiaId : "new_" + guid(), label: label }; - $scope.etatAttentes.push(newEtatAttente); - // auto select - $scope.editEtatAttente(newEtatAttente); + // check if already exists + if ($scope.etatAttentes.indexOfBy('label', newEtatAttente) != -1) { + $window.alert("Cet état d'attente existe déjà !"); + } else { + $scope.etatAttentes.push(newEtatAttente); + + // auto select + $scope.editEtatAttente(newEtatAttente); + } } }; @@ -287,10 +293,16 @@ topiaId : "new_" + guid(), label: label }; - $scope.demandTypes.push(newDemandType); - - // auto select - $scope.editDemandType(newDemandType); + + // check if already exists + if ($scope.demandTypes.indexOfBy('label', newDemandType) != -1) { + $window.alert("Ce type de demande existe déjà !"); + } else { + $scope.demandTypes.push(newDemandType); + + // auto select + $scope.editDemandType(newDemandType); + } } }; @@ -341,13 +353,20 @@ useCurrentLevelEdiFolder: true, useCurrentLevelRejectResponseMessage: true, useCurrentLevelRejectResponseMailAddress: true, - archiveContainer: false + archiveFolder: false }; - $scope.mailFolders.push(newRoot); - $scope._updateFlatMailFolders(); // update flat map - // edition automatique - $scope.editMailFolder(newRoot); + // check if already exists + if ($scope.mailFolders.indexOfBy('name', newRoot) != -1) { + $window.alert("Un noeud de même nom existe déjà à ce niveau !"); + } else { + // add node + $scope.mailFolders.push(newRoot); + // update flat map + $scope._updateFlatMailFolders(); + // edition automatique + $scope.editMailFolder(newRoot); + } }; }; @@ -366,16 +385,22 @@ useCurrentLevelEdiFolder: false, useCurrentLevelRejectResponseMessage: false, useCurrentLevelRejectResponseMailAddress: false, - archiveContainer: false + archiveFolder: false }; - // extend node (in faxtomail collapsed = extended) - scope.collapse(); - // append new node - nodeData.children.push(newNode); - // edition automatique - $scope.editMailFolder(newNode); - // update flat map - $scope._updateFlatMailFolders(); + + // check if already exists + if (nodeData.children.indexOfBy('name', newNode) != -1) { + $window.alert("Un noeud de même nom existe déjà à ce niveau !"); + } else { + // extend node (in faxtomail collapsed = extended) + scope.collapse(); + // append new node + nodeData.children.push(newNode); + // update flat map + $scope._updateFlatMailFolders(); + // edition automatique + $scope.editMailFolder(newNode); + } } }; @@ -397,15 +422,21 @@ useCurrentLevelRejectResponseMailAddress: false, archiveFolder: true }; - // extend node (in faxtomail collapsed = extended) - scope.collapse(); - // append new node - nodeData.hasArchiveFolder = true; - nodeData.children.push(newNode); - // edition automatique - //$scope.editMailFolder(newNode); - // update flat map - $scope._updateFlatMailFolders(); + + // check if already exists + if (nodeData.children.indexOfBy('name', newNode) != -1) { + $window.alert("Un noeud de même nom existe déjà à ce niveau !"); + } else { + // extend node (in faxtomail collapsed = extended) + scope.collapse(); + // append new node + nodeData.hasArchiveFolder = true; + nodeData.children.push(newNode); + // update flat map + $scope._updateFlatMailFolders(); + // edition automatique + $scope.editMailFolder(newNode); + } } } }; @@ -883,7 +914,7 @@ } } }; - + // change le droit de lecture du groupe $scope.changeReadRightGroup = function(group) { var index = $scope.selectedMailFolder.readRightGroups.indexOfByTopiaId(group); Modified: trunk/faxtomail-ui-web/src/main/webapp/js/faxtomail.js =================================================================== --- trunk/faxtomail-ui-web/src/main/webapp/js/faxtomail.js 2014-07-02 12:00:40 UTC (rev 312) +++ trunk/faxtomail-ui-web/src/main/webapp/js/faxtomail.js 2014-07-02 13:26:03 UTC (rev 313) @@ -38,12 +38,12 @@ } /** - * Même fonction que indexOf mais qui compare par topiaId au lieu des références. + * Cherche un element par egalité de champ sur le champ spécifié. */ -Array.prototype.indexOfByTopiaId = function(obj) { +Array.prototype.indexOfBy = function(field, obj) { var i = this.length; while (i--) { - if (this[i].topiaId == obj.topiaId) { + if (this[i][field] == obj[field]) { return i; } } @@ -51,6 +51,13 @@ }; /** + * Même fonction que indexOf mais qui compare par topiaId au lieu des références. + */ +Array.prototype.indexOfByTopiaId = function(obj) { + return this.indexOfBy('topiaId', obj); +}; + +/** * Method contains par topiaId. */ Array.prototype.containsByTopiaId = function(obj) { Modified: trunk/pom.xml =================================================================== --- trunk/pom.xml 2014-07-02 12:00:40 UTC (rev 312) +++ trunk/pom.xml 2014-07-02 13:26:03 UTC (rev 313) @@ -520,7 +520,7 @@ <dependency> <groupId>ro.isdc.wro4j</groupId> <artifactId>wro4j-core</artifactId> - <version>1.7.6</version> + <version>1.7.5</version> <!-- pb de cache dans la v 1.7.6 --> <scope>runtime</scope> </dependency>
participants (1)
-
echatellier@users.forge.codelutin.com