Faxtomail-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
June 2014
- 6 participants
- 194 discussions
r161 - in trunk: faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin faxtomail-ui-web/src/main/webapp/js
by echatellier@users.forge.codelutin.com 09 Jun '14
by echatellier@users.forge.codelutin.com 09 Jun '14
09 Jun '14
Author: echatellier
Date: 2014-06-09 19:07:41 +0200 (Mon, 09 Jun 2014)
New Revision: 161
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/161
Log:
Suppression des ?\195?\169tats d'attente
Added:
trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/EtatAttenteTopiaDao.java
Modified:
trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ReferentielService.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/js/configuration.js
Added: trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/EtatAttenteTopiaDao.java
===================================================================
--- trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/EtatAttenteTopiaDao.java (rev 0)
+++ trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/EtatAttenteTopiaDao.java 2014-06-09 17:07:41 UTC (rev 161)
@@ -0,0 +1,46 @@
+package com.franciaflex.faxtomail.persistence.entities;
+
+/*
+ * #%L
+ * FaxToMail :: Persistence
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2014 Franciaflex
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class EtatAttenteTopiaDao extends AbstractEtatAttenteTopiaDao<EtatAttente> {
+
+ public Map<String, Long> getEtatAttenteCountByFolder() {
+ String query = "SELECT etatAttente.topiaId, count(*) FROM " + Email.class.getName() + " group by etatAttente.topiaId";
+
+ Map<String, Long> result = new HashMap<>();
+
+ List<Object[]> queryResuts = findAll(query);
+ for (Object[] queryResut : queryResuts) {
+ String etatAttente = (String)queryResut[0];
+ Long count = (Long)queryResut[1];
+ result.put(etatAttente, count);
+ }
+ return result;
+ }
+} //EtatAttenteTopiaDao
Property changes on: trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/EtatAttenteTopiaDao.java
___________________________________________________________________
Added: svn:eol-style
+ native
Added: svn:keywords
+ Author Date Id Revision HeadURL
Modified: trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ReferentielService.java
===================================================================
--- trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ReferentielService.java 2014-06-09 16:41:07 UTC (rev 160)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ReferentielService.java 2014-06-09 17:07:41 UTC (rev 161)
@@ -49,6 +49,7 @@
import com.franciaflex.faxtomail.persistence.entities.DemandTypeTopiaDao;
import com.franciaflex.faxtomail.persistence.entities.EmailAccount;
import com.franciaflex.faxtomail.persistence.entities.EmailAccountTopiaDao;
+import com.franciaflex.faxtomail.persistence.entities.EmailTopiaDao;
import com.franciaflex.faxtomail.persistence.entities.EtatAttente;
import com.franciaflex.faxtomail.persistence.entities.EtatAttenteImpl;
import com.franciaflex.faxtomail.persistence.entities.EtatAttenteTopiaDao;
@@ -97,6 +98,12 @@
return new ArrayList<>(dao.findAll());
}
+ public Map<String, Long> getEtatAttentesUsage() {
+ EtatAttenteTopiaDao dao = getPersistenceContext().getEtatAttenteDao();
+ Map<String, Long> result = dao.getEtatAttenteCountByFolder();
+ return result;
+ }
+
public void saveEtatAttente(Collection<EtatAttente> etatAttentes) {
Binder<EtatAttente, EtatAttente> binderEtatAttente = BinderFactory.newBinder(EtatAttente.class);
@@ -126,6 +133,9 @@
etatAttenteDAO.create(currentEtatAttente);
}
}
+
+ // delete remaining
+ etatAttenteDAO.deleteAll(allEtatAttenteIndex.values());
getPersistenceContext().commit();
}
Modified: trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ConfigurationAction.java
===================================================================
--- trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ConfigurationAction.java 2014-06-09 16:41:07 UTC (rev 160)
+++ trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ConfigurationAction.java 2014-06-09 17:07:41 UTC (rev 161)
@@ -77,6 +77,8 @@
protected List<EtatAttente> etatAttentes;
+ protected Map<String, Long> etatAttentesUsage;
+
protected List<DemandType> demandTypes;
protected List<MailFolder> mailFolders;
@@ -100,6 +102,7 @@
@Action("configuration-input")
public String input() throws Exception {
etatAttentes = referentielService.getAllEtatAttente();
+ etatAttentesUsage = referentielService.getEtatAttentesUsage();
demandTypes = referentielService.getAllDemandType();
mailFolders = mailFolderService.getRootMailFolders();
mailFoldersUsage = mailFolderService.getMailFoldersUsage();
@@ -155,6 +158,10 @@
this.etatAttentes = getGson().fromJson(json, type);
}
+ public Map<String, Long> getEtatAttentesUsage() {
+ return etatAttentesUsage;
+ }
+
public List<DemandType> getDemandTypes() {
return demandTypes;
}
Modified: trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp
===================================================================
--- trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp 2014-06-09 16:41:07 UTC (rev 160)
+++ trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp 2014-06-09 17:07:41 UTC (rev 161)
@@ -42,6 +42,7 @@
// datas
'configuration': <s:property value="toJson(configuration)" escapeHtml="false"/>,
'etatAttentes': <s:property value="toJson(etatAttentes)" escapeHtml="false"/>,
+ 'etatAttentesUsage': <s:property value="toJson(etatAttentesUsage)" escapeHtml="false"/>,
'demandTypes': <s:property value="toJson(demandTypes)" escapeHtml="false"/>,
'mailFolders': <s:property value="toJson(mailFolders)" escapeHtml="false"/>,
'mailFoldersUsage': <s:property value="toJson(mailFoldersUsage)" escapeHtml="false"/>,
@@ -140,7 +141,13 @@
<tr ng-repeat="etatAttente in etatAttentes"
ng-class="{'info' : etatAttente == selectedEtatAttente}"
ng-click="editEtatAttente(etatAttente)">
- <td>{{etatAttente.label}}</td>
+ <td>{{etatAttente.label}}
+
+ <a class="pull-right btn btn-danger btn-xs" data-nodrag ng-click="deleteEtatAttente($index)"
+ ng-disabled="etatAttentesUsage[etatAttente.topiaId] > 0"
+ tooltip="{{etatAttentesUsage[etatAttente.topiaId] > 0 && 'Cet état d\'attente est utilisé et ne peut pas être supprimé'|| 'Supprimer cet état d\'attente'}}">
+ <span class="glyphicon glyphicon-remove"></span></a>
+ </td>
</tr>
</tbody>
</table>
Modified: trunk/faxtomail-ui-web/src/main/webapp/js/configuration.js
===================================================================
--- trunk/faxtomail-ui-web/src/main/webapp/js/configuration.js 2014-06-09 16:41:07 UTC (rev 160)
+++ trunk/faxtomail-ui-web/src/main/webapp/js/configuration.js 2014-06-09 17:07:41 UTC (rev 161)
@@ -124,7 +124,8 @@
*/
ConfigurationModule.controller('ConfigurationEtatAttenteController', ['$scope', '$window', 'ConfigurationData',
function($scope, $window, ConfigurationData) {
-
+ //{Map} Usage des états d'attente
+ $scope.etatAttentesUsage = ConfigurationData.etatAttentesUsage;
//{Object} etat d'attente selectionné
$scope.selectedEtatAttente;
@@ -157,6 +158,13 @@
}
};
+ // suppression d'un etat d'attente non utilisé
+ $scope.deleteEtatAttente = function(index) {
+ if ($window.confirm("Êtes-vous sûr de vouloir supprimer cet état d'attente ?")) {
+ $scope.etatAttentes.splice(index, 1);
+ }
+ };
+
// selection/deselection d'une action
$scope.changeEtatAttenteValidAction = function(action) {
var index = $scope.selectedEtatAttente.validFormDisabledActions.indexOf(action);
1
0
r160 - in trunk: faxtomail-persistence/src/main/xmi faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service
by echatellier@users.forge.codelutin.com 09 Jun '14
by echatellier@users.forge.codelutin.com 09 Jun '14
09 Jun '14
Author: echatellier
Date: 2014-06-09 18:41:07 +0200 (Mon, 09 Jun 2014)
New Revision: 160
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/160
Log:
Remove rangeRowNeeded.
Modified:
trunk/faxtomail-persistence/src/main/xmi/faxtomail.zargo
trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/InitFaxToMailService.java
Modified: trunk/faxtomail-persistence/src/main/xmi/faxtomail.zargo
===================================================================
(Binary files differ)
Modified: trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/InitFaxToMailService.java
===================================================================
--- trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/InitFaxToMailService.java 2014-06-09 16:20:09 UTC (rev 159)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/InitFaxToMailService.java 2014-06-09 16:41:07 UTC (rev 160)
@@ -142,15 +142,15 @@
if (count == 0) {
List<DemandType> types = Lists.newArrayList(
- demandTypeDao.create(DemandType.PROPERTY_LABEL, "Commande", DemandType.PROPERTY_RANGE_NEEDED, true),
- demandTypeDao.create(DemandType.PROPERTY_LABEL, "Commande Réponse", DemandType.PROPERTY_RANGE_NEEDED, false),
- demandTypeDao.create(DemandType.PROPERTY_LABEL, "Commande Annulation/Modification", DemandType.PROPERTY_RANGE_NEEDED, false),
- demandTypeDao.create(DemandType.PROPERTY_LABEL, "Devis Diffus", DemandType.PROPERTY_RANGE_NEEDED, true),
- demandTypeDao.create(DemandType.PROPERTY_LABEL, "Devis Chantier", DemandType.PROPERTY_RANGE_NEEDED, true),
- demandTypeDao.create(DemandType.PROPERTY_LABEL, "Devis Gros Chantier", DemandType.PROPERTY_RANGE_NEEDED, true),
- demandTypeDao.create(DemandType.PROPERTY_LABEL, "Devis Réponse/Modification", DemandType.PROPERTY_RANGE_NEEDED, false),
- demandTypeDao.create(DemandType.PROPERTY_LABEL, "Réclamation", DemandType.PROPERTY_RANGE_NEEDED, false),
- demandTypeDao.create(DemandType.PROPERTY_LABEL, "Autres", DemandType.PROPERTY_RANGE_NEEDED, false)
+ demandTypeDao.create(DemandType.PROPERTY_LABEL, "Commande"),
+ demandTypeDao.create(DemandType.PROPERTY_LABEL, "Commande Réponse"),
+ demandTypeDao.create(DemandType.PROPERTY_LABEL, "Commande Annulation/Modification"),
+ demandTypeDao.create(DemandType.PROPERTY_LABEL, "Devis Diffus"),
+ demandTypeDao.create(DemandType.PROPERTY_LABEL, "Devis Chantier"),
+ demandTypeDao.create(DemandType.PROPERTY_LABEL, "Devis Gros Chantier"),
+ demandTypeDao.create(DemandType.PROPERTY_LABEL, "Devis Réponse/Modification"),
+ demandTypeDao.create(DemandType.PROPERTY_LABEL, "Réclamation"),
+ demandTypeDao.create(DemandType.PROPERTY_LABEL, "Autres")
);
EtatAttenteTopiaDao etatAttenteDao = getPersistenceContext().getEtatAttenteDao();
1
0
r159 - in trunk: faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service faxtomail-ui-web/src/main/webapp/js
by echatellier@users.forge.codelutin.com 09 Jun '14
by echatellier@users.forge.codelutin.com 09 Jun '14
09 Jun '14
Author: echatellier
Date: 2014-06-09 18:20:09 +0200 (Mon, 09 Jun 2014)
New Revision: 159
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/159
Log:
Verification qu'un charg?\195?\169 de clientelle n'est pas d?\195?\169j?\195?\160 responsable d'un autre dossier
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/LdapService.java
trunk/faxtomail-ui-web/src/main/webapp/js/configuration.js
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-06-09 16:11:24 UTC (rev 158)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/InitFaxToMailService.java 2014-06-09 16:20:09 UTC (rev 159)
@@ -196,9 +196,9 @@
FaxToMailUserGroupTopiaDao userGroupDao = getPersistenceContext().getFaxToMailUserGroupDao();
userGroupDao.create(FaxToMailUserGroup.PROPERTY_NAME, "Chargés de clientèle",
FaxToMailUserGroup.PROPERTY_FULL_PATH, "Franciaflex/Chargés de clientèle");
- FaxToMailUserGroup commerciaux = userGroupDao.create(FaxToMailUserGroup.PROPERTY_NAME, "Commerciaux",
+ FaxToMailUserGroup commerciauxGroup = userGroupDao.create(FaxToMailUserGroup.PROPERTY_NAME, "Commerciaux",
FaxToMailUserGroup.PROPERTY_FULL_PATH, "Franciaflex/Commerciaux");
- userGroupDao.create(FaxToMailUserGroup.PROPERTY_NAME, "SAV",
+ FaxToMailUserGroup savGroup = userGroupDao.create(FaxToMailUserGroup.PROPERTY_NAME, "SAV",
FaxToMailUserGroup.PROPERTY_FULL_PATH, "Franciaflex/SAV");
userGroupDao.create(FaxToMailUserGroup.PROPERTY_NAME, "Administrateurs",
FaxToMailUserGroup.PROPERTY_FULL_PATH, "Franciaflex/Administrateurs");
@@ -208,7 +208,7 @@
FaxToMailUser.PROPERTY_FIRST_NAME, "Marc",
FaxToMailUser.PROPERTY_LOGIN, "mlefebvre",
FaxToMailUser.PROPERTY_TRIGRAPH, "MLE",
- FaxToMailUser.PROPERTY_USER_GROUPS, Collections.singletonList(commerciaux));
+ FaxToMailUser.PROPERTY_USER_GROUPS, Collections.singletonList(commerciauxGroup));
FaxToMailUser cyril = userDao.create(FaxToMailUser.PROPERTY_LAST_NAME, "Baillet",
FaxToMailUser.PROPERTY_FIRST_NAME, "Cyril",
FaxToMailUser.PROPERTY_LOGIN, "cbaillet",
@@ -217,7 +217,7 @@
FaxToMailUser.PROPERTY_FIRST_NAME, "Frédéric",
FaxToMailUser.PROPERTY_LOGIN, "fviala",
FaxToMailUser.PROPERTY_TRIGRAPH, "FVI",
- FaxToMailUser.PROPERTY_USER_GROUPS, Collections.singletonList(commerciaux));
+ FaxToMailUser.PROPERTY_USER_GROUPS, Collections.singletonList(commerciauxGroup));
FaxToMailUser claire = userDao.create(FaxToMailUser.PROPERTY_LAST_NAME, "Marquis",
FaxToMailUser.PROPERTY_FIRST_NAME, "Claire",
FaxToMailUser.PROPERTY_LOGIN, "cmarquis",
@@ -225,12 +225,13 @@
FaxToMailUser agathe = userDao.create(FaxToMailUser.PROPERTY_LAST_NAME, "Borde",
FaxToMailUser.PROPERTY_FIRST_NAME, "Agathe",
FaxToMailUser.PROPERTY_LOGIN, "aborde",
- FaxToMailUser.PROPERTY_TRIGRAPH, "ABO");
+ FaxToMailUser.PROPERTY_TRIGRAPH, "ABO",
+ FaxToMailUser.PROPERTY_USER_GROUPS, Collections.singletonList(savGroup));
FaxToMailUser jeanne = userDao.create(FaxToMailUser.PROPERTY_LAST_NAME, "Bourgoin",
FaxToMailUser.PROPERTY_FIRST_NAME, "Jeanne",
FaxToMailUser.PROPERTY_LOGIN, "jbourgoin",
FaxToMailUser.PROPERTY_TRIGRAPH, "JBO",
- FaxToMailUser.PROPERTY_USER_GROUPS, Collections.singletonList(commerciaux));
+ FaxToMailUser.PROPERTY_USER_GROUPS, Collections.singletonList(commerciauxGroup));
MailFolderTopiaDao folderDao = getPersistenceContext().getMailFolderDao();
Map<String, MailFolder> folders = new HashMap<>();
Modified: trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/LdapService.java
===================================================================
--- trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/LdapService.java 2014-06-09 16:11:24 UTC (rev 158)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/LdapService.java 2014-06-09 16:20:09 UTC (rev 159)
@@ -230,7 +230,7 @@
FaxToMailUser result = null;
FaxToMailUserTopiaDao faxtomailUserDao = getPersistenceContext().getFaxToMailUserDao();
- FaxToMailUser user = faxtomailUserDao.findByTopiaId(userTopiaId);
+ FaxToMailUser user = faxtomailUserDao.forTopiaIdEquals(userTopiaId).findUniqueOrNull();
if (user != null) {
Binder<FaxToMailUser, FaxToMailUser> faxToMailUserBinder = BinderFactory.newBinder(FaxToMailUser.class);
result = new FaxToMailUserImpl();
Modified: trunk/faxtomail-ui-web/src/main/webapp/js/configuration.js
===================================================================
--- trunk/faxtomail-ui-web/src/main/webapp/js/configuration.js 2014-06-09 16:11:24 UTC (rev 158)
+++ trunk/faxtomail-ui-web/src/main/webapp/js/configuration.js 2014-06-09 16:20:09 UTC (rev 159)
@@ -421,10 +421,45 @@
result(resultArray);
};
+ // recursive find folder where user is already responsible
+ var checkUserResponsible = function(folders, user) {
+ var result;
+ angular.forEach(folders, function(folder) {
+ if (folder.customerResponsibles) {
+ angular.forEach(folder.customerResponsibles, function(responsible) {
+ if (responsible.topiaId == user.topiaId) {
+ result = folder;
+ }
+ });
+ }
+ if (!result && folder.children) {
+ result = checkUserResponsible(folder.children, user);
+ }
+ });
+ return result;
+ };
+
// add customer responsible
$scope.addCustomerResponsible = function() {
- $scope.selectedMailFolder.customerResponsibles.push($scope.newCustomerResponsible);
- delete $scope.newCustomerResponsible;
+
+ // check it user is already responsible of another folder
+ var otherFolder = checkUserResponsible($scope.mailFolders, $scope.newCustomerResponsible);
+ if (angular.isDefined(otherFolder)) {
+ if ($window.confirm("Cet utilisateur est déjà reponsable du dossier '" + otherFolder.$fullPath +
+ "'. Voulez-vous continuer et changer son dossier de responsabilité ?")) {
+
+ // remove from previous
+ var index = otherFolder.customerResponsibles.indexOf($scope.newCustomerResponsible);
+ otherFolder.customerResponsibles.splice(index, 1);
+
+ // add to current
+ $scope.selectedMailFolder.customerResponsibles.push($scope.newCustomerResponsible);
+ delete $scope.newCustomerResponsible;
+ }
+ } else {
+ $scope.selectedMailFolder.customerResponsibles.push($scope.newCustomerResponsible);
+ delete $scope.newCustomerResponsible;
+ }
};
// remove customer responsible
1
0
r158 - trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities
by echatellier@users.forge.codelutin.com 09 Jun '14
by echatellier@users.forge.codelutin.com 09 Jun '14
09 Jun '14
Author: echatellier
Date: 2014-06-09 18:11:24 +0200 (Mon, 09 Jun 2014)
New Revision: 158
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/158
Log:
Remove save action.
Modified:
trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/MailAction.java
Modified: trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/MailAction.java
===================================================================
--- trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/MailAction.java 2014-06-09 15:52:02 UTC (rev 157)
+++ trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/MailAction.java 2014-06-09 16:11:24 UTC (rev 158)
@@ -30,7 +30,6 @@
*/
public enum MailAction {
- SAVE,
TRANSMIT,
PRINT,
ARCHIVE,
1
0
r157 - in trunk/faxtomail-ui-web/src/main/webapp: WEB-INF/content/admin css
by echatellier@users.forge.codelutin.com 09 Jun '14
by echatellier@users.forge.codelutin.com 09 Jun '14
09 Jun '14
Author: echatellier
Date: 2014-06-09 17:52:02 +0200 (Mon, 09 Jun 2014)
New Revision: 157
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/157
Log:
Add required field
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/import-input.jsp
trunk/faxtomail-ui-web/src/main/webapp/css/faxtomail.css
Modified: trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp
===================================================================
--- trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp 2014-06-09 15:26:32 UTC (rev 156)
+++ trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp 2014-06-09 15:52:02 UTC (rev 157)
@@ -834,10 +834,13 @@
<h3>Édition du chef de groupe</h3>
<div class="form-inline">
- <div class="form-group">
+ <div class="form-group required">
<label for="groupChefUserGroupField" class="control-label">Chef du groupe : </label>
- <select id="groupChefUserGroupField" class="form-control" ng-model="selectedGroupChef.userGroup"
- ng-options="group as group.fullPath for group in groups"></select>
+ <select id="groupChefUserGroupField" class="form-control" ng-required="selectedGroupChef"
+ ng-model="selectedGroupChef.userGroup"
+ ng-options="group as group.fullPath for group in groups">
+ <option value="" ng-if="!selectedGroupChef.userGroup"></option>
+ </select>
</div>
</div>
Modified: trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/import-input.jsp
===================================================================
--- trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/import-input.jsp 2014-06-09 15:26:32 UTC (rev 156)
+++ trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/import-input.jsp 2014-06-09 15:52:02 UTC (rev 157)
@@ -38,7 +38,7 @@
<s:form id="main_form" action="import" method="post" enctype="multipart/form-data">
- <div class="form-group form-inline">
+ <div class="form-group">
<label for="clientField" class="control-label">Fichier client :</label>
<input type="file" id="clientField" name="clientFile" class="form-control">
<p class="help-block">Format du fichier csv : <code>Id_Correspondance;Societe;Nom;Caracteristique1;Caracteristique2;Caracteristique3;Client_Top;Numero_Fax;Adresse_Mail;Code_Client;Objet_Message;Destination</code></p>
Modified: trunk/faxtomail-ui-web/src/main/webapp/css/faxtomail.css
===================================================================
--- trunk/faxtomail-ui-web/src/main/webapp/css/faxtomail.css 2014-06-09 15:26:32 UTC (rev 156)
+++ trunk/faxtomail-ui-web/src/main/webapp/css/faxtomail.css 2014-06-09 15:52:02 UTC (rev 157)
@@ -70,4 +70,9 @@
.ui-sortable {
cursor:move;
-}
\ No newline at end of file
+}
+
+.form-group.required .control-label:after {
+ content:"*";
+ color:red;
+}
1
0
r156 - in trunk: faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin
by echatellier@users.forge.codelutin.com 09 Jun '14
by echatellier@users.forge.codelutin.com 09 Jun '14
09 Jun '14
Author: echatellier
Date: 2014-06-09 17:26:32 +0200 (Mon, 09 Jun 2014)
New Revision: 156
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/156
Log:
Affichage des utilsateurs suivant la configuration des chefs de groupe
Modified:
trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ConfigurationService.java
trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/UserFolderAction.java
trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/user-folder-input.jsp
Modified: trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ConfigurationService.java
===================================================================
--- trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ConfigurationService.java 2014-06-09 14:52:18 UTC (rev 155)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ConfigurationService.java 2014-06-09 15:26:32 UTC (rev 156)
@@ -24,6 +24,7 @@
* #L%
*/
+import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
@@ -46,6 +47,8 @@
import com.franciaflex.faxtomail.persistence.entities.FaxToMailUserGroup;
import com.franciaflex.faxtomail.persistence.entities.FaxToMailUserGroupTopiaDao;
import com.franciaflex.faxtomail.persistence.entities.FaxToMailUserTopiaDao;
+import com.franciaflex.faxtomail.persistence.entities.GroupChef;
+import com.franciaflex.faxtomail.persistence.entities.GroupChefTopiaDao;
import com.franciaflex.faxtomail.persistence.entities.MailFilter;
import com.franciaflex.faxtomail.persistence.entities.MailFilterTopiaDao;
import com.franciaflex.faxtomail.persistence.entities.MailFolder;
@@ -205,7 +208,6 @@
public void saveUserFolders(Map<String, Collection<MailFolder>> userFolders) {
log.warn("user folders = " + userFolders);
- //MailFolderTopiaDao mailFolderTopiaDao = getPersistenceContext().getMailFolderDao();
FaxToMailUserTopiaDao faxToMailUserTopiaDao = getPersistenceContext().getFaxToMailUserDao();
for (Map.Entry<String, Collection<MailFolder>> entry : userFolders.entrySet()) {
@@ -227,4 +229,41 @@
FaxToMailUserGroupTopiaDao faxToMailUserGroupDao = getPersistenceContext().getFaxToMailUserGroupDao();
return faxToMailUserGroupDao.forAll().setOrderByArguments(FaxToMailUserGroup.PROPERTY_FULL_PATH).findAll();
}
+
+ /**
+ * Retourne l'ensemble des utilisateurs appartenant aux groupes gérés par les groupes chef.
+ *
+ * @param user current user
+ * @return all managed users
+ */
+ public List<FaxToMailUser> getUserManagedUsers(FaxToMailUser user) {
+
+ List<FaxToMailUser> result = new ArrayList<>();
+
+ // s'il n'y a pas de group, il ne peut pas y avoir de droits
+ if (user.getUserGroups() != null) {
+
+ // recuperation de tout les groupes chef dont l'utilsateur est membre
+ GroupChefTopiaDao groupChefTopiaDao = getPersistenceContext().getGroupChefDao();
+ List<GroupChef> groupChefs = groupChefTopiaDao.forUserGroupIn(user.getUserGroups()).findAll();
+
+ // recuperation de tous les users des groups gérés
+ FaxToMailUserTopiaDao faxToMailUserTopiaDao = getPersistenceContext().getFaxToMailUserDao();
+ for (GroupChef groupChef : groupChefs) {
+ // groups
+ if (groupChef.getManagedGroups() != null) {
+ for (FaxToMailUserGroup group : groupChef.getManagedGroups()) {
+ List<FaxToMailUser> users = faxToMailUserTopiaDao.forUserGroupsContains(group).findAll();
+ result.addAll(users);
+ }
+ }
+ // users
+ if (groupChef.getManagedUsers() != null) {
+ result.addAll(groupChef.getManagedUsers());
+ }
+ }
+ }
+
+ return result;
+ }
}
Modified: trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/UserFolderAction.java
===================================================================
--- trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/UserFolderAction.java 2014-06-09 14:52:18 UTC (rev 155)
+++ trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/UserFolderAction.java 2014-06-09 15:26:32 UTC (rev 156)
@@ -26,9 +26,11 @@
import java.lang.reflect.Type;
import java.util.Collection;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.struts2.convention.annotation.Action;
@@ -37,7 +39,6 @@
import org.apache.struts2.convention.annotation.Result;
import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser;
-import com.franciaflex.faxtomail.persistence.entities.FaxToMailUserGroup;
import com.franciaflex.faxtomail.persistence.entities.MailFolder;
import com.franciaflex.faxtomail.services.service.ConfigurationService;
import com.franciaflex.faxtomail.services.service.MailFolderService;
@@ -60,8 +61,6 @@
protected List<FaxToMailUser> users;
- protected List<FaxToMailUserGroup> groups;
-
protected Map<String, Collection<MailFolder>> userFolders;
public void setConfigurationService(ConfigurationService configurationService) {
@@ -76,8 +75,13 @@
@Action("user-folder-input")
public String input() throws Exception {
mailFolders = mailFolderService.getAllMailFolders();
- users = configurationService.getAllUsers();
- groups = configurationService.getAllGroups();
+ users = configurationService.getUserManagedUsers(getSession().getAuthenticatedFaxToMailUser());
+
+ // build display map
+ userFolders = new HashMap<>();
+ for (FaxToMailUser user : users) {
+ userFolders.put(user.getTopiaId(), CollectionUtils.emptyIfNull(user.getAffectedFolders()));
+ }
return INPUT;
}
@@ -97,10 +101,6 @@
return users;
}
- public List<FaxToMailUserGroup> getGroups() {
- return groups;
- }
-
public Map<String, Collection<MailFolder>> getUserFolders() {
return userFolders;
}
Modified: trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/user-folder-input.jsp
===================================================================
--- trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/user-folder-input.jsp 2014-06-09 14:52:18 UTC (rev 155)
+++ trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/user-folder-input.jsp 2014-06-09 15:26:32 UTC (rev 156)
@@ -36,10 +36,16 @@
UserFolderModule.value('UserFolderData', {
'mailFolders': <s:property value="toJson(mailFolders)" escapeHtml="false"/>,
'users': <s:property value="toJson(users)" escapeHtml="false"/>,
- 'groups': <s:property value="toJson(groups)" escapeHtml="false"/>,
'userFolders': <s:property value="toJson(userFolders)" escapeHtml="false"/>
});
</script>
+
+ <!--
+ Current user groups :
+ <s:iterator value="authenticatedUser.userGroups">
+ - <s:property value="fullPath" />
+ </s:iterator>
+ -->
</head>
<body>
@@ -51,11 +57,8 @@
<s:form id="main_form" action="user-folder" method="post" ng-controller="UserFolderController">
<s:hidden name="userFoldersJson" value="{{userFolders}}" />
- <div class="form-group">
- <label>Groupe :
- <select ng-model="selectedGroup" ng-options="group as group.fullPath for group in groups"></select>
- </label>
- </div>
+ Voici la liste des utilisateurs dont vous avez la gestion car vous faites partit d'un groupe
+ capable de gérer les utilisateurs suivants :
<table id='table-snapshot' class="table table-bordered">
<thead>
@@ -73,6 +76,9 @@
</div>
</td>
</tr>
+ <tr ng-if="!users || users.length == 0">
+ <td class="emptyTable" colspan="2">Aucun utilisateur trouvé</td>
+ </tr>
</tbody>
</table>
1
0
r155 - trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin
by echatellier@users.forge.codelutin.com 09 Jun '14
by echatellier@users.forge.codelutin.com 09 Jun '14
09 Jun '14
Author: echatellier
Date: 2014-06-09 16:52:18 +0200 (Mon, 09 Jun 2014)
New Revision: 155
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/155
Log:
Ajout d'un bouton valider par type d'import
Modified:
trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/import-input.jsp
Modified: trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/import-input.jsp
===================================================================
--- trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/import-input.jsp 2014-06-09 14:45:04 UTC (rev 154)
+++ trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/import-input.jsp 2014-06-09 14:52:18 UTC (rev 155)
@@ -38,41 +38,45 @@
<s:form id="main_form" action="import" method="post" enctype="multipart/form-data">
- <div class="form-group">
- <label for="clientField">Fichier client</label>
- <input type="file" id="clientField" name="clientFile">
+ <div class="form-group form-inline">
+ <label for="clientField" class="control-label">Fichier client :</label>
+ <input type="file" id="clientField" name="clientFile" class="form-control">
<p class="help-block">Format du fichier csv : <code>Id_Correspondance;Societe;Nom;Caracteristique1;Caracteristique2;Caracteristique3;Client_Top;Numero_Fax;Adresse_Mail;Code_Client;Objet_Message;Destination</code></p>
</div>
-
+ <button type="submit" class="btn btn-primary navbar-btn">Valider</button>
+ <hr />
+
<div class="form-group">
- <label for="etatAttenteField">Fichier état d'attente</label>
- <input type="file" id="etatAttenteField" name="etatAttenteFile">
+ <label for="etatAttenteField" class="control-label">Fichier état d'attente :</label>
+ <input type="file" id="etatAttenteField" name="etatAttenteFile" class="form-control">
<p class="help-block">Format du fichier csv : <code>etatattente</code></p>
</div>
-
+ <button type="submit" class="btn btn-primary navbar-btn">Valider</button>
+ <hr />
+
<div class="form-group">
- <label for="demandTypeField">Fichier types de demande</label>
- <input type="file" id="demandTypeField" name="demandTypeFile">
+ <label for="demandTypeField" class="control-label">Fichier types de demande :</label>
+ <input type="file" id="demandTypeField" name="demandTypeFile" class="form-control">
<p class="help-block">Format du fichier csv : <code>demandetype</code></p>
</div>
-
+ <button type="submit" class="btn btn-primary navbar-btn">Valider</button>
+ <hr />
+
<div class="form-group">
- <label for="rangeField">Fichier gamme</label>
- <input type="file" id="rangeField" name="rangeFile">
+ <label for="rangeField" class="control-label">Fichier gamme :</label>
+ <input type="file" id="rangeField" name="rangeFile" class="form-control">
<p class="help-block">Format du fichier csv : <code>gamme</code></p>
</div>
-
+ <button type="submit" class="btn btn-primary navbar-btn">Valider</button>
+ <hr />
+
<div class="form-group">
- <label for="priorityField">Fichier priorite</label>
- <input type="file" id="priorityField" name="priorityFile">
+ <label for="priorityField" class="control-label">Fichier priorite :</label>
+ <input type="file" id="priorityField" name="priorityFile" class="form-control">
<p class="help-block">Format du fichier csv : <code>priorite</code></p>
</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>
+ <button type="submit" class="btn btn-primary navbar-btn">Valider</button>
+
</s:form>
</div>
</body>
1
0
r154 - trunk/faxtomail-ui-web/src/main/webapp/WEB-INF
by echatellier@users.forge.codelutin.com 09 Jun '14
by echatellier@users.forge.codelutin.com 09 Jun '14
09 Jun '14
Author: echatellier
Date: 2014-06-09 16:45:04 +0200 (Mon, 09 Jun 2014)
New Revision: 154
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/154
Log:
Update angular-ui-sortable
Modified:
trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/wro.xml
Modified: trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/wro.xml
===================================================================
--- trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/wro.xml 2014-06-09 14:38:49 UTC (rev 153)
+++ trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/wro.xml 2014-06-09 14:45:04 UTC (rev 154)
@@ -30,7 +30,7 @@
</group>
<group name='webjar-angular-ui-sortable' abstract="true">
- <js>classpath:META-INF/resources/webjars/angular-ui-sortable/0.12.2/sortable.min.js</js>
+ <js>classpath:META-INF/resources/webjars/angular-ui-sortable/0.12.7/sortable.min.js</js>
</group>
<group name='webjar-angular-ui-bootstrap' abstract="true">
1
0
09 Jun '14
Author: echatellier
Date: 2014-06-09 16:38:49 +0200 (Mon, 09 Jun 2014)
New Revision: 153
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/153
Log:
Add authentication form
Added:
trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ldap/AuthenticationException.java
trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/FaxToMailLoginInterceptor.java
trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/LoginAction.java
trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/LogoutAction.java
trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/login-input.jsp
Modified:
trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/LdapService.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/FaxToMailInterceptor.java
trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/FaxToMailSession.java
trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/IndexAction.java
trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ConfigurationAction.java
trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ImportAction.java
trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/LdapAction.java
trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/UserFolderAction.java
trunk/faxtomail-ui-web/src/main/resources/struts.xml
trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/index.jsp
trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/decorators/layout.jsp
trunk/pom.xml
Modified: trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/LdapService.java
===================================================================
--- trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/LdapService.java 2014-06-08 20:44:39 UTC (rev 152)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/LdapService.java 2014-06-09 14:38:49 UTC (rev 153)
@@ -35,13 +35,13 @@
import org.nuiton.util.beans.Binder;
import org.nuiton.util.beans.BinderFactory;
-import com.franciaflex.faxtomail.FaxToMailConfiguration;
import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser;
import com.franciaflex.faxtomail.persistence.entities.FaxToMailUserGroup;
import com.franciaflex.faxtomail.persistence.entities.FaxToMailUserGroupTopiaDao;
import com.franciaflex.faxtomail.persistence.entities.FaxToMailUserImpl;
import com.franciaflex.faxtomail.persistence.entities.FaxToMailUserTopiaDao;
import com.franciaflex.faxtomail.services.FaxToMailServiceSupport;
+import com.franciaflex.faxtomail.services.service.ldap.AuthenticationException;
import com.franciaflex.faxtomail.services.service.ldap.LdapUser;
import com.unboundid.ldap.sdk.LDAPConnection;
import com.unboundid.ldap.sdk.LDAPException;
@@ -219,4 +219,43 @@
String result = StringUtils.join(part, '/');
return result;
}
+
+ /**
+ * Return user for given user id.
+ *
+ * @param userTopiaId userTopiaId
+ * @return user bean (without password)
+ */
+ public FaxToMailUser getUserBean(String userTopiaId) {
+ FaxToMailUser result = null;
+
+ FaxToMailUserTopiaDao faxtomailUserDao = getPersistenceContext().getFaxToMailUserDao();
+ FaxToMailUser user = faxtomailUserDao.findByTopiaId(userTopiaId);
+ if (user != null) {
+ Binder<FaxToMailUser, FaxToMailUser> faxToMailUserBinder = BinderFactory.newBinder(FaxToMailUser.class);
+ result = new FaxToMailUserImpl();
+ faxToMailUserBinder.copyExcluding(user, result);
+ }
+ return result;
+ }
+
+ /**
+ * Authenticate user.
+ *
+ * @param login login
+ * @param password password
+ * @return authenticated user
+ * @throws AuthenticationException if authentication fails
+ */
+ public FaxToMailUser authenticateUser(String login, String password) throws AuthenticationException {
+ FaxToMailUserTopiaDao faxtomailUserDao = getPersistenceContext().getFaxToMailUserDao();
+ FaxToMailUser user = faxtomailUserDao.forAll().findAnyOrNull();
+ FaxToMailUser result = null;
+ if (user != null) {
+ Binder<FaxToMailUser, FaxToMailUser> faxToMailUserBinder = BinderFactory.newBinder(FaxToMailUser.class);
+ result = new FaxToMailUserImpl();
+ faxToMailUserBinder.copyExcluding(user, result);
+ }
+ return result;
+ }
}
Added: trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ldap/AuthenticationException.java
===================================================================
--- trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ldap/AuthenticationException.java (rev 0)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ldap/AuthenticationException.java 2014-06-09 14:38:49 UTC (rev 153)
@@ -0,0 +1,36 @@
+package com.franciaflex.faxtomail.services.service.ldap;
+
+/*
+ * #%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%
+ */
+
+public class AuthenticationException extends Exception {
+
+ public AuthenticationException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public AuthenticationException(String message) {
+ super(message);
+ }
+}
Property changes on: trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ldap/AuthenticationException.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-06-08 20:44:39 UTC (rev 152)
+++ trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/FaxToMailActionSupport.java 2014-06-09 14:38:49 UTC (rev 153)
@@ -34,6 +34,7 @@
import com.franciaflex.faxtomail.FaxToMailConfiguration;
import com.franciaflex.faxtomail.persistence.entities.FaxToMailEntityEnum;
+import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser;
import com.franciaflex.faxtomail.persistence.entities.MailFolder;
import com.franciaflex.faxtomail.persistence.entities.MailFolderAbstract;
import com.franciaflex.faxtomail.web.json.HibernateProxyTypeAdapter;
@@ -76,29 +77,18 @@
return session;
}
- public boolean needAuthentication() {
- return true;
+ public void setSession(FaxToMailSession session) {
+ this.session = session;
}
- public boolean rememberAsLastAction() {
- return true;
+ public boolean isAuthenticated() {
+ return session.getAuthenticatedUserId() != null;
}
- public String getId(TopiaEntity entity) {
- String id = "";
-
- if (entity.getTopiaId() != null) {
- id = Integer.toString(entity.getTopiaId().hashCode());
- }
-
- return id;
-
+ public FaxToMailUser getAuthenticatedUser() {
+ return session.getAuthenticatedFaxToMailUser();
}
- public void setSession(FaxToMailSession session) {
- this.session = session;
- }
-
public String toJson(Object element) {
String result = null;
try {
Modified: trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/FaxToMailInterceptor.java
===================================================================
--- trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/FaxToMailInterceptor.java 2014-06-08 20:44:39 UTC (rev 152)
+++ trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/FaxToMailInterceptor.java 2014-06-09 14:38:49 UTC (rev 153)
@@ -24,24 +24,28 @@
* #L%
*/
+import java.beans.PropertyDescriptor;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.nuiton.util.beans.BeanUtil;
+
import com.franciaflex.faxtomail.FaxToMailApplicationContext;
import com.franciaflex.faxtomail.FaxToMailConfiguration;
import com.franciaflex.faxtomail.persistence.entities.FaxToMailTopiaPersistenceContext;
+import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser;
import com.franciaflex.faxtomail.services.FaxToMailService;
import com.franciaflex.faxtomail.services.FaxToMailServiceContext;
+import com.franciaflex.faxtomail.services.service.LdapService;
import com.google.common.base.Preconditions;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.ActionProxy;
import com.opensymphony.xwork2.interceptor.Interceptor;
-import org.apache.commons.collections4.CollectionUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.nuiton.util.beans.BeanUtil;
-import java.beans.PropertyDescriptor;
-import java.util.Map;
-import java.util.Set;
-
public class FaxToMailInterceptor implements Interceptor {
private static final Log log = LogFactory.getLog(FaxToMailInterceptor.class);
@@ -69,29 +73,20 @@
FaxToMailServiceContext serviceContext = newServiceContext(invocation);
FaxToMailSession faxToMailSession = getFaxToMailSession(invocation);
+ populateUser(faxToMailSession, serviceContext);
if (CollectionUtils.isNotEmpty(faxToMailSession.getMessages())) {
-
for (String message : faxToMailSession.getMessages()) {
-
faxToMailAction.addActionMessage(message);
-
}
-
faxToMailSession.getMessages().clear();
-
}
if (CollectionUtils.isNotEmpty(faxToMailSession.getErrorMessages())) {
-
for (String message : faxToMailSession.getErrorMessages()) {
-
faxToMailAction.addActionError(message);
-
}
-
faxToMailSession.getErrorMessages().clear();
-
}
Set<PropertyDescriptor> descriptors =
@@ -102,45 +97,32 @@
for (PropertyDescriptor propertyDescriptor : descriptors) {
Class<?> propertyType = propertyDescriptor.getPropertyType();
-
Object toInject = null;
if (FaxToMailService.class.isAssignableFrom(propertyType)) {
-
Class<? extends FaxToMailService> serviceClass =
(Class<? extends FaxToMailService>) propertyType;
-
toInject = serviceContext.newService(serviceClass);
} else if (FaxToMailSession.class.isAssignableFrom(propertyType)) {
-
toInject = faxToMailSession;
} else if (FaxToMailConfiguration.class.isAssignableFrom(propertyType)) {
-
toInject = getFaxToMailApplicationContext(invocation).getApplicationConfig();
-
}
if (toInject != null) {
-
if (log.isTraceEnabled()) {
log.trace("injecting " + toInject + " in action " + action);
}
-
propertyDescriptor.getWriteMethod().invoke(action, toInject);
-
}
}
try {
-
return invocation.invoke();
-
} finally {
-
serviceContext.getPersistenceContext().close();
-
}
} else {
@@ -153,6 +135,15 @@
}
+ protected void populateUser(FaxToMailSession faxToMailSession, FaxToMailServiceContext serviceContext) {
+ if (StringUtils.isNotBlank(faxToMailSession.getAuthenticatedUserId())) {
+ LdapService ldapService = serviceContext.newService(LdapService.class);
+ FaxToMailUser user = ldapService.getUserBean(faxToMailSession.getAuthenticatedUserId());
+ faxToMailSession.setAuthenticatedFaxToMailUser(user);
+ }
+
+ }
+
protected void saveLastAction(ActionInvocation invocation) {
Map<String, Object> session = invocation.getInvocationContext().getSession();
ActionProxy proxy = invocation.getProxy();
@@ -170,11 +161,8 @@
FaxToMailSession session = (FaxToMailSession) invocation.getInvocationContext().getSession().get(FaxToMailSession.SESSION_PARAMETER);
if (session == null) {
-
session = new FaxToMailSession();
-
invocation.getInvocationContext().getSession().put(FaxToMailSession.SESSION_PARAMETER, session);
-
}
return session;
@@ -199,23 +187,17 @@
protected FaxToMailServiceContext newServiceContext(ActionInvocation invocation) {
FaxToMailApplicationContext extranetEncAhiApplicationContext = getFaxToMailApplicationContext(invocation);
-
FaxToMailTopiaPersistenceContext persistenceContext = extranetEncAhiApplicationContext.newPersistenceContext();
-
FaxToMailServiceContext serviceContext =
extranetEncAhiApplicationContext.newServiceContext(persistenceContext);
return serviceContext;
-
}
@Override
public void destroy() {
-
if (log.isInfoEnabled()) {
log.info("destroy " + this);
}
-
}
-
}
Added: trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/FaxToMailLoginInterceptor.java
===================================================================
--- trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/FaxToMailLoginInterceptor.java (rev 0)
+++ trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/FaxToMailLoginInterceptor.java 2014-06-09 14:38:49 UTC (rev 153)
@@ -0,0 +1,44 @@
+package com.franciaflex.faxtomail.web;
+
+import org.apache.commons.lang3.StringUtils;
+
+import com.opensymphony.xwork2.ActionContext;
+import com.opensymphony.xwork2.ActionInvocation;
+import com.opensymphony.xwork2.interceptor.Interceptor;
+
+/**
+ * Authentication interceptor.
+ *
+ * @author Eric Chatellier
+ */
+public class FaxToMailLoginInterceptor implements Interceptor {
+
+ /** serialVersionUID. */
+ private static final long serialVersionUID = -5760224375232019437L;
+
+ /*
+ * @see com.opensymphony.xwork2.interceptor.Interceptor#init()
+ */
+ @Override
+ public void init() {
+
+ }
+
+ public String intercept(ActionInvocation invocation) throws Exception {
+ ActionContext context = invocation.getInvocationContext();
+ FaxToMailSession session = (FaxToMailSession) context.getSession().get(FaxToMailSession.SESSION_PARAMETER);
+ if (session == null || StringUtils.isBlank(session.getAuthenticatedUserId())) {
+ return "redirect-to-login";
+ } else {
+ return invocation.invoke();
+ }
+ }
+
+ /*
+ * @see com.opensymphony.xwork2.interceptor.Interceptor#destroy()
+ */
+ @Override
+ public void destroy() {
+
+ }
+}
Property changes on: trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/FaxToMailLoginInterceptor.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/FaxToMailSession.java
===================================================================
--- trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/FaxToMailSession.java 2014-06-08 20:44:39 UTC (rev 152)
+++ trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/FaxToMailSession.java 2014-06-09 14:38:49 UTC (rev 153)
@@ -24,6 +24,7 @@
* #L%
*/
+import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser;
import com.google.common.collect.Lists;
import java.io.Serializable;
@@ -37,8 +38,10 @@
protected Collection<String> errorMessages;
-// protected AuthenticatedExtranetUser authenticatedExtranetUser;
+ protected String authenticatedUserId;
+ protected transient FaxToMailUser authenticatedFaxToMailUser;
+
public Collection<String> getMessages() {
if (messages == null) {
messages = Lists.newLinkedList();
@@ -61,16 +64,24 @@
getErrorMessages().add(errorMessage);
}
- public void logout() {
-// authenticatedExtranetUser.logout();
-// authenticatedExtranetUser = null;
+ public String getAuthenticatedUserId() {
+ return authenticatedUserId;
}
-// public AuthenticatedExtranetUser getAuthenticatedExtranetUser() {
-// return authenticatedExtranetUser;
-// }
+ public void setAuthenticatedUserId(String authenticatedUserId) {
+ this.authenticatedUserId = authenticatedUserId;
+ }
-// public void setAuthenticatedExtranetUser(AuthenticatedExtranetUser authenticatedExtranetUser) {
-// this.authenticatedExtranetUser = authenticatedExtranetUser;
-// }
+ public FaxToMailUser getAuthenticatedFaxToMailUser() {
+ return authenticatedFaxToMailUser;
+ }
+
+ public void setAuthenticatedFaxToMailUser(FaxToMailUser authenticatedFaxToMailUser) {
+ this.authenticatedFaxToMailUser = authenticatedFaxToMailUser;
+ }
+
+ public void logout() {
+ setAuthenticatedUserId(null);
+ setAuthenticatedFaxToMailUser(null);
+ }
}
Modified: trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/IndexAction.java
===================================================================
--- trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/IndexAction.java 2014-06-08 20:44:39 UTC (rev 152)
+++ trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/IndexAction.java 2014-06-09 14:38:49 UTC (rev 153)
@@ -25,44 +25,23 @@
*/
import com.franciaflex.faxtomail.web.FaxToMailActionSupport;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.apache.struts2.convention.annotation.InterceptorRef;
+import org.apache.struts2.convention.annotation.InterceptorRefs;
+@InterceptorRefs({
+ @InterceptorRef("loginInterceptor"),
+ @InterceptorRef("faxToMailStack")
+})
public class IndexAction extends FaxToMailActionSupport {
private static final Log log = LogFactory.getLog(IndexAction.class);
-// protected ApplicationSettingsService service;
-//
-// protected ApplicationSettings applicationSettings;
-
-// public void setService(ApplicationSettingsService service) {
-// this.service = service;
-// }
-
@Override
public String execute() {
-
-// applicationSettings = service.getApplicationSettings();
-
return SUCCESS;
}
-// public ApplicationSettings getApplicationSettings() {
-// return applicationSettings;
-// }
-
- public String getWelcomeText() {
-
-// String text = applicationSettings.getWelcomeText();
- String text = "Hello world";
-
- text = "<p>" + text.replaceAll("\\r?\\n\\r?\\n", "</p><p>") + "</p>";
-
- text = text.replaceAll("\\r?\\n", "<br/>");
-
- return text;
-
- }
-
}
Added: trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/LoginAction.java
===================================================================
--- trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/LoginAction.java (rev 0)
+++ trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/LoginAction.java 2014-06-09 14:38:49 UTC (rev 153)
@@ -0,0 +1,80 @@
+package com.franciaflex.faxtomail.web.action;
+
+/*
+ * #%L
+ * FaxToMail :: Web
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2014 Franciaflex, Code Lutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.struts2.convention.annotation.Action;
+import org.apache.struts2.convention.annotation.Result;
+
+import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser;
+import com.franciaflex.faxtomail.services.service.LdapService;
+import com.franciaflex.faxtomail.services.service.ldap.AuthenticationException;
+import com.franciaflex.faxtomail.web.FaxToMailActionSupport;
+
+public class LoginAction extends FaxToMailActionSupport {
+
+ private static final Log log = LogFactory.getLog(LoginAction.class);
+
+ protected LdapService ldapService;
+
+ protected String login;
+
+ protected String password;
+
+ public void setLdapService(LdapService ldapService) {
+ this.ldapService = ldapService;
+ }
+
+ public void setLogin(String login) {
+ this.login = login;
+ }
+
+ public void setPassword(String password) {
+ this.password = password;
+ }
+
+ @Override
+ @Action("login-input")
+ public String input() throws Exception {
+ return super.input();
+ }
+
+ @Override
+ @Action(results = {
+ @Result(type = "redirectAction", params = {"actionName", "configuration-input", "namespace", "/admin"})})
+ public String execute() {
+
+ String result = SUCCESS;
+ try {
+ FaxToMailUser user = ldapService.authenticateUser(login, password);
+ getSession().setAuthenticatedUserId(user.getTopiaId());
+ } catch (AuthenticationException ex) {
+ result = ERROR;
+ addActionError("Can't login");
+ }
+ return result;
+ }
+}
Property changes on: trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/LoginAction.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/LogoutAction.java
===================================================================
--- trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/LogoutAction.java (rev 0)
+++ trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/LogoutAction.java 2014-06-09 14:38:49 UTC (rev 153)
@@ -0,0 +1,48 @@
+package com.franciaflex.faxtomail.web.action;
+
+/*
+ * #%L
+ * FaxToMail :: Web
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2014 Franciaflex, Code Lutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.struts2.convention.annotation.Action;
+import org.apache.struts2.convention.annotation.Result;
+
+import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser;
+import com.franciaflex.faxtomail.services.service.LdapService;
+import com.franciaflex.faxtomail.services.service.ldap.AuthenticationException;
+import com.franciaflex.faxtomail.web.FaxToMailActionSupport;
+
+public class LogoutAction extends FaxToMailActionSupport {
+
+ private static final Log log = LogFactory.getLog(LogoutAction.class);
+
+ @Override
+ @Action(results = {
+ @Result(type = "redirectAction", params = {"actionName", "index", "namespace", "/"})})
+ public String execute() {
+ getSession().logout();
+ return SUCCESS;
+ }
+}
Property changes on: trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/LogoutAction.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/action/admin/ConfigurationAction.java
===================================================================
--- trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ConfigurationAction.java 2014-06-08 20:44:39 UTC (rev 152)
+++ trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ConfigurationAction.java 2014-06-09 14:38:49 UTC (rev 153)
@@ -31,6 +31,9 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.apache.struts2.convention.annotation.Action;
+import org.apache.struts2.convention.annotation.InterceptorRef;
+import org.apache.struts2.convention.annotation.InterceptorRefs;
import org.apache.struts2.convention.annotation.Result;
import com.franciaflex.faxtomail.persistence.entities.Configuration;
@@ -41,7 +44,6 @@
import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser;
import com.franciaflex.faxtomail.persistence.entities.FaxToMailUserGroup;
import com.franciaflex.faxtomail.persistence.entities.FolderAction;
-import com.franciaflex.faxtomail.persistence.entities.GroupChef;
import com.franciaflex.faxtomail.persistence.entities.MailAction;
import com.franciaflex.faxtomail.persistence.entities.MailField;
import com.franciaflex.faxtomail.persistence.entities.MailFilter;
@@ -57,6 +59,10 @@
* @author kmorin <kmorin(a)codelutin.com>
* @since x.x
*/
+@InterceptorRefs({
+ @InterceptorRef("loginInterceptor"),
+ @InterceptorRef("faxToMailStack")
+})
public class ConfigurationAction extends FaxToMailActionSupport implements Preparable {
private static final Log log = LogFactory.getLog(ConfigurationAction.class);
@@ -91,7 +97,7 @@
}
@Override
- @org.apache.struts2.convention.annotation.Action("configuration-input")
+ @Action("configuration-input")
public String input() throws Exception {
etatAttentes = referentielService.getAllEtatAttente();
demandTypes = referentielService.getAllDemandType();
@@ -106,8 +112,7 @@
}
@Override
- @org.apache.struts2.convention.annotation.Action(results = {
- @Result(type = "redirectAction", params = {"actionName", "configuration-input"})})
+ @Action(results = {@Result(type = "redirectAction", params = {"actionName", "configuration-input"})})
public String execute() throws Exception {
String result = super.execute();
Modified: trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ImportAction.java
===================================================================
--- trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ImportAction.java 2014-06-08 20:44:39 UTC (rev 152)
+++ trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ImportAction.java 2014-06-09 14:38:49 UTC (rev 153)
@@ -30,11 +30,18 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.apache.struts2.convention.annotation.Action;
+import org.apache.struts2.convention.annotation.InterceptorRef;
+import org.apache.struts2.convention.annotation.InterceptorRefs;
import org.apache.struts2.convention.annotation.Result;
import com.franciaflex.faxtomail.services.service.ReferentielService;
import com.franciaflex.faxtomail.web.FaxToMailActionSupport;
+@InterceptorRefs({
+ @InterceptorRef("loginInterceptor"),
+ @InterceptorRef("faxToMailStack")
+})
public class ImportAction extends FaxToMailActionSupport {
private static final Log log = LogFactory.getLog(ImportAction.class);
@@ -72,14 +79,13 @@
}
@Override
- @org.apache.struts2.convention.annotation.Action("import-input")
+ @Action("import-input")
public String input() throws Exception {
return INPUT;
}
@Override
- @org.apache.struts2.convention.annotation.Action(results = {
- @Result(type = "redirectAction", params = {"actionName", "import-input"})})
+ @Action(results = {@Result(type = "redirectAction", params = {"actionName", "import-input"})})
public String execute() throws Exception {
String result = super.execute();
Modified: trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/LdapAction.java
===================================================================
--- trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/LdapAction.java 2014-06-08 20:44:39 UTC (rev 152)
+++ trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/LdapAction.java 2014-06-09 14:38:49 UTC (rev 153)
@@ -26,11 +26,18 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.apache.struts2.convention.annotation.Action;
+import org.apache.struts2.convention.annotation.InterceptorRef;
+import org.apache.struts2.convention.annotation.InterceptorRefs;
import org.apache.struts2.convention.annotation.Result;
import com.franciaflex.faxtomail.services.service.LdapService;
import com.franciaflex.faxtomail.web.FaxToMailActionSupport;
+@InterceptorRefs({
+ @InterceptorRef("loginInterceptor"),
+ @InterceptorRef("faxToMailStack")
+})
public class LdapAction extends FaxToMailActionSupport {
private static final Log log = LogFactory.getLog(LdapAction.class);
@@ -42,14 +49,13 @@
}
@Override
- @org.apache.struts2.convention.annotation.Action("ldap-input")
+ @Action("ldap-input")
public String input() throws Exception {
return INPUT;
}
@Override
- @org.apache.struts2.convention.annotation.Action(results = {
- @Result(type = "redirectAction", params = {"actionName", "ldap-input"})})
+ @Action(results = {@Result(type = "redirectAction", params = {"actionName", "ldap-input"})})
public String execute() throws Exception {
ldapService.updateLdapData();
return SUCCESS;
Modified: trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/UserFolderAction.java
===================================================================
--- trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/UserFolderAction.java 2014-06-08 20:44:39 UTC (rev 152)
+++ trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/UserFolderAction.java 2014-06-09 14:38:49 UTC (rev 153)
@@ -26,13 +26,14 @@
import java.lang.reflect.Type;
import java.util.Collection;
-import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.apache.struts2.convention.annotation.Action;
+import org.apache.struts2.convention.annotation.InterceptorRef;
+import org.apache.struts2.convention.annotation.InterceptorRefs;
import org.apache.struts2.convention.annotation.Result;
import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser;
@@ -43,6 +44,10 @@
import com.franciaflex.faxtomail.web.FaxToMailActionSupport;
import com.google.gson.reflect.TypeToken;
+@InterceptorRefs({
+ @InterceptorRef("loginInterceptor"),
+ @InterceptorRef("faxToMailStack")
+})
public class UserFolderAction extends FaxToMailActionSupport {
private static final Log log = LogFactory.getLog(UserFolderAction.class);
@@ -68,22 +73,16 @@
}
@Override
- @org.apache.struts2.convention.annotation.Action("user-folder-input")
+ @Action("user-folder-input")
public String input() throws Exception {
mailFolders = mailFolderService.getAllMailFolders();
users = configurationService.getAllUsers();
groups = configurationService.getAllGroups();
-
- /*userFolders = new HashMap<>();
- for (FaxToMailUser user : users) {
- userFolders.put(user.getTopiaId(), CollectionUtils.emptyIfNull(user.getAffectedFolders()));
- }*/
return INPUT;
}
@Override
- @org.apache.struts2.convention.annotation.Action(results = {
- @Result(type = "redirectAction", params = {"actionName", "user-folder-input"})})
+ @Action(results = {@Result(type = "redirectAction", params = {"actionName", "user-folder-input"})})
public String execute() throws Exception {
configurationService.saveUserFolders(userFolders);
Modified: trunk/faxtomail-ui-web/src/main/resources/struts.xml
===================================================================
--- trunk/faxtomail-ui-web/src/main/resources/struts.xml 2014-06-08 20:44:39 UTC (rev 152)
+++ trunk/faxtomail-ui-web/src/main/resources/struts.xml 2014-06-09 14:38:49 UTC (rev 153)
@@ -22,72 +22,41 @@
#L%
-->
<!DOCTYPE struts PUBLIC
- "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
- "http://struts.apache.org/dtds/struts-2.0.dtd">
+ "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
+ "http://struts.apache.org/dtds/struts-2.3.dtd">
<struts>
- <constant name="struts.convention.default.parent.package" value="faxtomail" />
-
<bean class="org.nuiton.web.struts2.I18nTextProvider" name="i18nTextProvider" type="com.opensymphony.xwork2.TextProvider" />
-
+
+ <constant name="struts.convention.default.parent.package" value="faxtomail" />
<constant name="struts.objectFactory" value="com.franciaflex.faxtomail.web.FaxToMailStrutsObjectFactory" />
-
<constant name="struts.xworkTextProvider" value="i18nTextProvider" />
-
<constant name="struts.multipart.maxSize" value="10485760" />
<package name="faxtomail" namespace="/" extends="struts-default">
<interceptors>
-
<interceptor name="faxToMailInterceptor" class="com.franciaflex.faxtomail.web.FaxToMailInterceptor"/>
+ <interceptor name="loginInterceptor" class="com.franciaflex.faxtomail.web.FaxToMailLoginInterceptor" />
<interceptor-stack name="faxToMailStack">
<interceptor-ref name="faxToMailInterceptor" />
-
- <interceptor-ref name="exception"/>
- <interceptor-ref name="alias"/>
- <interceptor-ref name="i18n"/>
- <interceptor-ref name="checkbox"/>
- <interceptor-ref name="multiselect"/>
- <interceptor-ref name="params">
- <param name="excludeParams">dojo\..*,^struts\..*,^session\..*,^request\..*,^application\..*,^servlet(Request|Response)\..*,parameters\...*</param>
- <param name="acceptParamNames">(\w|\(|\)|\[|\]|\.|'|-|\s|\u002C|\||")+</param>
- </interceptor-ref>
- <interceptor-ref name="servletConfig"/>
- <interceptor-ref name="prepare"/>
- <interceptor-ref name="chain"/>
- <interceptor-ref name="modelDriven"/>
- <interceptor-ref name="fileUpload"/>
- <interceptor-ref name="staticParams"/>
- <interceptor-ref name="actionMappingParams"/>
- <interceptor-ref name="params">
- <param name="excludeParams">dojo\..*,^struts\..*,^session\..*,^request\..*,^application\..*,^servlet(Request|Response)\..*,parameters\...*</param>
- <param name="acceptParamNames">(\w|\(|\)|\[|\]|\.|'|-|_|\s|\u002C|\||")+</param>
- </interceptor-ref>
- <interceptor-ref name="conversionError"/>
- <interceptor-ref name="validation">
- <param name="excludeMethods">input,back,cancel,browse</param>
- </interceptor-ref>
- <interceptor-ref name="workflow">
- <param name="excludeMethods">input,back,cancel,browse</param>
- </interceptor-ref>
+ <interceptor-ref name="paramsPrepareParamsStack" />
</interceptor-stack>
</interceptors>
<default-interceptor-ref name="faxToMailStack"/>
<global-results>
- <result name="redirect-to-login" type="redirect">/</result>
+ <result name="redirect-to-login" type="redirect">/login-input</result>
</global-results>
-
- <global-exception-mappings>
+
+ <!-- <global-exception-mappings>
<exception-mapping exception="com.franciaflex.faxtomail.web.FaxToMailNoIdException" result="NoIdException"></exception-mapping>
<exception-mapping exception="com.franciaflex.faxtomail.web.FaxToMailEntityNotFoundException" result="EntityNotFoundException"></exception-mapping>
<exception-mapping exception="com.franciaflex.faxtomail.web.FaxToMailIllegalAccessException" result="IllegalAccessException"></exception-mapping>
- </global-exception-mappings>
+ </global-exception-mappings>-->
</package>
-
</struts>
Modified: trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/index.jsp
===================================================================
--- trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/index.jsp 2014-06-08 20:44:39 UTC (rev 152)
+++ trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/index.jsp 2014-06-09 14:38:49 UTC (rev 153)
@@ -27,15 +27,21 @@
<html>
<head>
<title>Accueil</title>
- <content tag="categorie-accueil">current</content>
</head>
<body>
- <h1>Administration FaxToMail</h1>
+ <div id="main-container" class="container" ng-app="ConfigurationModule">
+ <h1 class="page-header">Administration FaxToMail</h1>
- <div class="content info-zone">
-
- <s:property value="welcomeText" escapeHtml="false"/>
-
- </div>
+ <ul>
+ <li><a href="<s:url action='ldap-input' namespace="/admin" />">
+ <span class="fa fa-database"></span> Ldap</a></li>
+ <li><a href="<s:url action='configuration-input' namespace="/admin" />">
+ <span class="fa fa-cog"></span> Configuration</a></li>
+ <li><a href="<s:url action='import-input' namespace="/admin" />">
+ <span class="fa fa-upload"></span> Import</a></li>
+ <li><a href="<s:url action='user-folder-input' namespace="/admin" />">
+ <span class="fa fa-folder-open"></span> Dossiers utilisateur</a></li>
+ </ul>
+ </div>
</body>
</html>
Added: trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/login-input.jsp
===================================================================
--- trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/login-input.jsp (rev 0)
+++ trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/login-input.jsp 2014-06-09 14:38:49 UTC (rev 153)
@@ -0,0 +1,72 @@
+<%--
+ #%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>Connexion</title>
+ </head>
+ <body>
+
+ <div id="main-container" class="container" ng-app="ConfigurationModule">
+ <h1 class="page-header">Connexion</h1>
+
+ <s:form id="main_form" action="login" method="post" role="form" class="form-horizontal">
+
+ <div class="alert alert-warning">
+ <strong>Attention!</strong> Le formulaire de connexion n'est pas encore branché sur le serveur LDAP.
+ Entrez n'importe quelles informations de connexion pour le moment.
+ </div>
+
+ <div class="form-group">
+ <label for="loginField" class="col-sm-2 control-label">Identifiant LDAP :</label>
+ <div class="col-sm-10">
+ <input type="email" class="form-control" id="loginField" placeholder="nom.prenom(a)franciaflex.fr">
+ </div>
+ </div>
+ <div class="form-group">
+ <label for="passwordField" class="col-sm-2 control-label">Mot de passe :</label>
+ <div class="col-sm-10">
+ <input type="password" class="form-control" id="passwordField" placeholder="password">
+ </div>
+ </div>
+ <!-- <div class="form-group">
+ <div class="col-sm-offset-2 col-sm-10">
+ <div class="checkbox">
+ <label>
+ <input type="checkbox"> Remember me
+ </label>
+ </div>
+ </div>
+ </div> -->
+ <div class="form-group">
+ <div class="col-sm-offset-2 col-sm-10">
+ <button type="submit" class="btn btn-primary">Connexion</button>
+ </div>
+ </div>
+ </s:form>
+ </div>
+ </body>
+</html>
Property changes on: trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/login-input.jsp
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/decorators/layout.jsp
===================================================================
--- trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/decorators/layout.jsp 2014-06-08 20:44:39 UTC (rev 152)
+++ trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/decorators/layout.jsp 2014-06-09 14:38:49 UTC (rev 153)
@@ -55,18 +55,27 @@
<div class="navbar-header">
<a href="<s:url value='/' />" class="navbar-brand">FaxToMail</a>
</div>
- <nav class="collapse navbar-collapse" role="navigation">
- <ul class="nav navbar-nav">
- <li><a href="<s:url action='ldap-input' namespace="/admin" />">
- <span class="fa fa-database"></span> Ldap</a></li>
- <li><a href="<s:url action='configuration-input' namespace="/admin" />">
- <span class="fa fa-cog"></span> Configuration</a></li>
- <li><a href="<s:url action='import-input' namespace="/admin" />">
- <span class="fa fa-upload"></span> Import</a></li>
- <li><a href="<s:url action='user-folder-input' namespace="/admin" />">
- <span class="fa fa-folder-open"></span> Dossiers utilisateur</a></li>
- </ul>
- </nav>
+ <s:if test="authenticated">
+ <nav class="collapse navbar-collapse" role="navigation">
+ <ul class="nav navbar-nav">
+ <li><a href="<s:url action='ldap-input' namespace="/admin" />">
+ <span class="fa fa-database"></span> Ldap</a></li>
+ <li><a href="<s:url action='configuration-input' namespace="/admin" />">
+ <span class="fa fa-cog"></span> Configuration</a></li>
+ <li><a href="<s:url action='import-input' namespace="/admin" />">
+ <span class="fa fa-upload"></span> Import</a></li>
+ <li><a href="<s:url action='user-folder-input' namespace="/admin" />">
+ <span class="fa fa-folder-open"></span> Dossiers utilisateur</a></li>
+ </ul>
+
+ <ul class="nav navbar-nav navbar-right">
+ <li><a><span class="fa fa-user"></span>
+ <s:property value="authenticatedUser.firstName" /> <s:property value="authenticatedUser.lastName" /></a></li>
+ <li><a href="<s:url action='logout' namespace="/" />">
+ <span class="fa fa-power-off"></span> Déconnexion</a></li>
+ </ul>
+ </nav>
+ </s:if>
</div>
</header>
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2014-06-08 20:44:39 UTC (rev 152)
+++ trunk/pom.xml 2014-06-09 14:38:49 UTC (rev 153)
@@ -539,14 +539,14 @@
<dependency>
<groupId>org.nuiton.js</groupId>
<artifactId>nuiton-js-bootstrap</artifactId>
- <version>3.1.1-2-SNAPSHOT</version>
+ <version>3.1.1-1</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>angular-ui-sortable</artifactId>
- <version>0.12.2</version>
+ <version>0.12.7</version>
<scope>runtime</scope>
</dependency>
@@ -580,14 +580,14 @@
<dependency>
<groupId>org.nuiton.js</groupId>
<artifactId>nuiton-js-angularjs</artifactId>
- <version>1.2.17-1-SNAPSHOT</version>
+ <version>1.2.17-1</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.nuiton.js</groupId>
<artifactId>nuiton-js-font-awesome</artifactId>
- <version>4.1.0-1-SNAPSHOT</version>
+ <version>4.1.0-1</version>
<scope>runtime</scope>
</dependency>
1
0
r152 - in trunk: faxtomail-persistence/src/main/xmi faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin faxtomail-ui-web/src/main/webapp/js
by echatellier@users.forge.codelutin.com 08 Jun '14
by echatellier@users.forge.codelutin.com 08 Jun '14
08 Jun '14
Author: echatellier
Date: 2014-06-08 22:44:39 +0200 (Sun, 08 Jun 2014)
New Revision: 152
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/152
Log:
Ajout des chefs de groupes
Modified:
trunk/faxtomail-persistence/src/main/xmi/faxtomail.properties
trunk/faxtomail-persistence/src/main/xmi/faxtomail.zargo
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/js/configuration.js
Modified: trunk/faxtomail-persistence/src/main/xmi/faxtomail.properties
===================================================================
--- trunk/faxtomail-persistence/src/main/xmi/faxtomail.properties 2014-06-08 14:30:45 UTC (rev 151)
+++ trunk/faxtomail-persistence/src/main/xmi/faxtomail.properties 2014-06-08 20:44:39 UTC (rev 152)
@@ -94,3 +94,6 @@
# FaxToMailUserGroup
com.franciaflex.faxtomail.persistence.entities.FaxToMailUserGroup.attribute.name.tagvalue.naturalId=true
+
+# GroupChef
+com.franciaflex.faxtomail.persistence.entities.GroupChef.attribute.userGroup.tagvalue.notNull=true
Modified: trunk/faxtomail-persistence/src/main/xmi/faxtomail.zargo
===================================================================
(Binary files differ)
Modified: trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ConfigurationAction.java
===================================================================
--- trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ConfigurationAction.java 2014-06-08 14:30:45 UTC (rev 151)
+++ trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ConfigurationAction.java 2014-06-08 20:44:39 UTC (rev 152)
@@ -41,6 +41,7 @@
import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser;
import com.franciaflex.faxtomail.persistence.entities.FaxToMailUserGroup;
import com.franciaflex.faxtomail.persistence.entities.FolderAction;
+import com.franciaflex.faxtomail.persistence.entities.GroupChef;
import com.franciaflex.faxtomail.persistence.entities.MailAction;
import com.franciaflex.faxtomail.persistence.entities.MailField;
import com.franciaflex.faxtomail.persistence.entities.MailFilter;
Modified: trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp
===================================================================
--- trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp 2014-06-08 14:30:45 UTC (rev 151)
+++ trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp 2014-06-08 20:44:39 UTC (rev 152)
@@ -73,6 +73,7 @@
<li><a href="#tabs-filters" data-toggle="tab">Filtres de mail</a></li>
<li><a href="#tabs-search" data-toggle="tab">Recherche</a></li>
<li><a href="#tabs-mailaccounts" data-toggle="tab">Comptes mail</a></li>
+ <li><a href="#tabs-chefgroup" data-toggle="tab">Chef de groupe</a></li>
</ul>
<div class="tab-content active" ng-controller="ConfigurationMiscController">
@@ -145,7 +146,7 @@
</table>
</div>
- <div class="col-md-7" ng-if="selectedEtatAttente">
+ <div class="col-md-8" ng-if="selectedEtatAttente">
<h3>Édition de l'état d'attente {{selectedEtatAttente.label}}</h3>
Actions autorisées lorsque la demande est <strong>valide</strong> :
<label class="checkbox" ng-repeat="(mailAction,label) in mailActions">
@@ -159,7 +160,7 @@
ng-click="changeEtatAttenteInvalidAction(mailAction)"> {{label}}
</label>
</div>
- <div class="col-md-7" ng-if="!selectedEtatAttente">
+ <div class="col-md-8" ng-if="!selectedEtatAttente">
<em>Sélectionnez un état d'attente.</em>
</div>
</div>
@@ -183,7 +184,7 @@
</table>
</div>
- <div class="col-md-7" ng-if="selectedDemandType">
+ <div class="col-md-8" ng-if="selectedDemandType">
<h3>Édition du type de document {{selectedDemandType.label}}</h3>
Champs obligatoires pour le type de document :
<label class="checkbox" ng-repeat="(mailField,label) in mailFields">
@@ -191,7 +192,7 @@
ng-click="changeDemandTypeField(mailField)"> {{label}}
</label>
</div>
- <div class="col-md-7" ng-if="!selectedDemandType">
+ <div class="col-md-8" ng-if="!selectedDemandType">
<em>Sélectionnez un type de document.</em>
</div>
</div>
@@ -805,6 +806,78 @@
</div>
</div>
</div>
+
+ <div id="tabs-chefgroup" class="tab-pane" ng-controller="ConfigurationChefGroupController">
+
+ <div class="row">
+ <div class="col-md-4">
+ <h3>Chef de groupe <input type="button" class="btn btn-success btn-xs pull-right" value="Nouveau" ng-click="newGroupChef()" /></h3>
+ <table class="table table-hover">
+ <tbody>
+ <tr ng-repeat="groupChef in configuration.chefs"
+ ng-class="{'info' : groupChef == selectedGroupChef}"
+ ng-click="editGroupChef(groupChef)">
+ <td>{{groupChef.userGroup ? groupChef.userGroup.fullPath : '(aucun groupe)'}}
+ <a class="btn btn-danger btn-xs pull-right" ng-click="removeGroupChef(groupChef, $index)">
+ <span class="glyphicon glyphicon-remove"></span>
+ </a>
+ </td>
+ </tr>
+ <tr ng-if="!configuration.chefs || configuration.chefs.length == 0">
+ <td class="emptyTable">Aucun chef de groupe</td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+
+ <div class="col-md-8" ng-show="selectedGroupChef">
+ <h3>Édition du chef de groupe</h3>
+
+ <div class="form-inline">
+ <div class="form-group">
+ <label for="groupChefUserGroupField" class="control-label">Chef du groupe : </label>
+ <select id="groupChefUserGroupField" class="form-control" ng-model="selectedGroupChef.userGroup"
+ ng-options="group as group.fullPath for group in groups"></select>
+ </div>
+ </div>
+
+ <hr />
+ <table class="table table-hover">
+ <thead>
+ <tr>
+ <th>Groupes gérés par le chef de groupe</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr ng-repeat="group in selectedGroupChef.managedGroups">
+ <td>
+ <span class="fa fa-users"></span>
+ {{group.fullPath}}
+ <a class="btn btn-danger btn-xs pull-right" ng-click="removeManagedGroup($index)">
+ <span class="glyphicon glyphicon-remove"></span>
+ </a>
+ </td>
+ </tr>
+ <tr ng-if="!selectedGroupChef.managedGroups || selectedGroupChef.managedGroups.length == 0">
+ <td class="emptyTable">Aucun groupe gérés</td>
+ </tr>
+ </tbody>
+ </table>
+ <div class="form-inline">
+ <div class="form-group">
+ <label for="newManagedGroupField" class="control-label">Nouveau groupe :</label>
+ <select id="newManagedGroupField" class="form-control"
+ ng-model="newManagedGroup" ng-options="group as group.fullPath for group in groups">
+ </select>
+ <a class="btn btn-success btn-xs" ng-click="addManagedGroup()" ng-disabled="!newManagedGroup">
+ <span class="glyphicon glyphicon-plus"></span>
+ </a>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+
</div>
<nav class="navbar navbar-default navbar-fixed-bottom">
<div class="container">
Modified: trunk/faxtomail-ui-web/src/main/webapp/js/configuration.js
===================================================================
--- trunk/faxtomail-ui-web/src/main/webapp/js/configuration.js 2014-06-08 14:30:45 UTC (rev 151)
+++ trunk/faxtomail-ui-web/src/main/webapp/js/configuration.js 2014-06-08 20:44:39 UTC (rev 152)
@@ -29,6 +29,8 @@
*/
ConfigurationModule.controller('ConfigurationController', ['$scope', 'ConfigurationData',
function($scope, ConfigurationData) {
+ //{Object} L'object configuration
+ $scope.configuration = ConfigurationData.configuration;
//{Map} les actions possibles pour les etats d'attentes
$scope.mailActions = ConfigurationData.mailActions;
//{Map} les champs obligatoires possibles
@@ -45,6 +47,10 @@
$scope.mailFoldersUsage = ConfigurationData.mailFoldersUsage;
//{Map<MailFolder id, Array<MailFolder>>} liste des
$scope.flatMailFolders;
+ //{Array} All application users
+ $scope.users = ConfigurationData.users;
+ // {Array} All application groups
+ $scope.groups = ConfigurationData.groups;
// method privée recursive pour retourner l'ensemble des dossiers en les modifiant pour ajouter
// des metadata (full path from root, and root node instance)
@@ -96,8 +102,6 @@
*/
ConfigurationModule.controller('ConfigurationMiscController', ['$scope', '$window', 'ConfigurationData',
function($scope, $window, ConfigurationData) {
- //{Object} L'object configuration
- $scope.configuration = ConfigurationData.configuration;
// Ajout d'une nouvelle ligne vide d'extension
$scope.addExtensionRow = function() {
@@ -227,10 +231,6 @@
*/
ConfigurationModule.controller('ConfigurationTreeController', ['$scope', '$window', 'ConfigurationData',
function($scope, $window, ConfigurationData) {
- //{Array} All application users
- $scope.users = ConfigurationData.users;
- // {Array} All application groups
- $scope.groups = ConfigurationData.groups;
// {Object} selected mail folder
$scope.selectedMailFolder;
// {String} add new customer responsible form value
@@ -575,13 +575,6 @@
$scope.rootFolderMailFilters[rootMailFolder.topiaId].splice(index2, 1);
}
};
-
- // define angular filter used to group mailFilters by rootFolders
- /*$scope.subFolderFilter = function(mailFolder) {
- return function(item) {
- return item.mailFolder == mailFolder || item.mailFolder.$rootFolder == mailFolder;
- };
- };*/
}]);
@@ -647,3 +640,65 @@
}
});
}]);
+
+
+/**
+ * Chef de groupe controller.
+ */
+ConfigurationModule.controller('ConfigurationChefGroupController', ['$scope', '$window', 'ConfigurationData',
+ function($scope, $window, ConfigurationData) {
+ //{Object} Chef de group en cours d'edition
+ $scope.selectedGroupChef;
+ //{Object} Nouveau group selectionné
+ $scope.newManagedGroup;
+
+ // change instances
+ if (!$scope.configuration.chefs) {
+ $scope.configuration.chefs = [];
+ }
+ angular.forEach($scope.groups, function(group) {
+ angular.forEach($scope.configuration.chefs, function(chef) {
+ if (chef.userGroup.topiaId == group.topiaId) {
+ chef.userGroup = group;
+ }
+ // managedGroups is not necessary to change here
+ });
+ });
+
+ // ajout d'un nouveau chef de groupe
+ $scope.newGroupChef = function() {
+ var groupChef = {
+ managedGroups : []
+ };
+ $scope.configuration.chefs.push(groupChef);
+ $scope.editGroupChef(groupChef);
+ };
+
+ // edition d'un chef de groupe
+ $scope.editGroupChef = function(groupChef) {
+ $scope.selectedGroupChef = groupChef;
+ };
+
+ // suppression d'un chef de groupe
+ $scope.removeGroupChef = function(groupChef, index) {
+ if ($window.confirm("Êtes-vous sûr de vouloir supprimer ce chef de groupe ?")) {
+ $scope.configuration.chefs.splice(index, 1);
+ if (groupChef == $scope.selectedGroupChef) {
+ delete $scope.selectedGroupChef;
+ }
+ }
+ };
+
+ // Ajout d'un nouveau group géré
+ $scope.addManagedGroup = function() {
+ $scope.selectedGroupChef.managedGroups.push($scope.newManagedGroup);
+ delete $scope.newManagedGroup;
+ };
+
+ // Suppression d'un group gérés
+ $scope.removeManagedGroup = function(index) {
+ if ($window.confirm("Êtes-vous sûr de vouloir supprimer ce groupe gérés ?")) {
+ $scope.selectedGroupChef.managedGroups.splice(index, 1);
+ }
+ };
+}]);
1
0