branch develop updated (c5572fb -> b4673c3)
This is an automated email from the git hooks/post-receive script. New change to branch develop in repository coselmar. See http://git.codelutin.com/coselmar.git from c5572fb fix homepage when no user connected new e95c74a begin reflexion about error/sucess messages new f4bee9f merge with develop new 37703e1 review user error and success on operation : add notifications new a58eecb manage notification for questions/projects new a0b7bc2 manage notification for documents new c3068dd fix duplication on documents list with restricted access new 6d1bd05 fix usage of defaultFailOnCall service for error new b4673c3 Merge branch 'feature/add-messages' into develop The 8 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: commit b4673c37fbcf58d7857465a0a86f6774d3e81b05 Merge: c5572fb 6d1bd05 Author: Yannick Martel <martel@©odelutin.com> Date: Tue Feb 17 18:17:54 2015 +0100 Merge branch 'feature/add-messages' into develop commit 6d1bd0560634886115c8b8973dd1c277756eb4ac Author: Yannick Martel <martel@©odelutin.com> Date: Tue Feb 17 18:17:38 2015 +0100 fix usage of defaultFailOnCall service for error commit c3068dd3b6581aeaa000158d304ac766a3b9c74b Author: Yannick Martel <martel@©odelutin.com> Date: Tue Feb 17 18:17:03 2015 +0100 fix duplication on documents list with restricted access commit a0b7bc28e7343bf1c5002d5b3d0090951cd96e58 Author: Yannick Martel <martel@©odelutin.com> Date: Tue Feb 17 16:16:28 2015 +0100 manage notification for documents commit a58eecbdb5e4e2e19dd80ee9bf1d06e2bdb8270b Author: Yannick Martel <martel@©odelutin.com> Date: Tue Feb 17 15:28:17 2015 +0100 manage notification for questions/projects commit 37703e1869ddacfd3d51e6f99a58da81d8b8a6a0 Author: Yannick Martel <martel@©odelutin.com> Date: Mon Feb 16 17:38:25 2015 +0100 review user error and success on operation : add notifications commit f4bee9f8559e08665a402537448d76014029011e Merge: e95c74a c5572fb Author: Yannick Martel <martel@©odelutin.com> Date: Mon Feb 16 14:20:34 2015 +0100 merge with develop commit e95c74afb1047d1d387cc318f957ac4b98bb3269 Author: Yannick Martel <martel@©odelutin.com> Date: Fri Feb 13 10:18:47 2015 +0100 begin reflexion about error/sucess messages Summary of changes: .../persistence/entity/DocumentTopiaDao.java | 2 +- .../services/CoselmarWebServiceSupport.java | 16 ++ ...tion.java => MailAlreadyExistingException.java} | 6 +- .../ifremer/coselmar/services/v1/ErrorAction.java | 9 + .../coselmar/services/v1/QuestionsWebService.java | 2 +- .../coselmar/services/v1/UsersWebService.java | 15 +- coselmar-rest/src/main/resources/mapping | 5 +- coselmar-ui/pom.xml | 6 + coselmar-ui/src/main/webapp/css/coselmar.css | 65 +++++ coselmar-ui/src/main/webapp/i18n/en.js | 15 + coselmar-ui/src/main/webapp/i18n/fr.js | 16 ++ coselmar-ui/src/main/webapp/index.html | 9 +- .../src/main/webapp/js/coselmar-controllers.js | 308 +++++++++++++++------ .../src/main/webapp/js/coselmar-error-services.js | 67 +++++ .../src/main/webapp/js/coselmar-services.js | 12 +- coselmar-ui/src/main/webapp/js/coselmar.js | 34 +-- .../main/webapp/views/notificationTemplate.html | 16 ++ .../src/main/webapp/views/users/newPassword.html | 9 +- pom.xml | 8 + 19 files changed, 493 insertions(+), 127 deletions(-) copy coselmar-rest/src/main/java/fr/ifremer/coselmar/services/errors/{InvalidCredentialException.java => MailAlreadyExistingException.java} (83%) create mode 100644 coselmar-ui/src/main/webapp/js/coselmar-error-services.js create mode 100644 coselmar-ui/src/main/webapp/views/notificationTemplate.html -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository coselmar. See http://git.codelutin.com/coselmar.git commit e95c74afb1047d1d387cc318f957ac4b98bb3269 Author: Yannick Martel <martel@©odelutin.com> Date: Fri Feb 13 10:18:47 2015 +0100 begin reflexion about error/sucess messages --- coselmar-ui/src/main/webapp/css/coselmar.css | 64 ++++++++++++++++++++++ coselmar-ui/src/main/webapp/index.html | 1 + coselmar-ui/src/main/webapp/js/coselmar.js | 32 +++++------ .../src/main/webapp/views/users/newPassword.html | 9 ++- 4 files changed, 89 insertions(+), 17 deletions(-) diff --git a/coselmar-ui/src/main/webapp/css/coselmar.css b/coselmar-ui/src/main/webapp/css/coselmar.css index 2634bce..746f42c 100644 --- a/coselmar-ui/src/main/webapp/css/coselmar.css +++ b/coselmar-ui/src/main/webapp/css/coselmar.css @@ -429,3 +429,67 @@ a.dropdown-toggle:hover .caret { input[type="file"] { height: auto; } + +/** + * Animation + */ +/* + We're using CSS transitions for when + the enter and move events are triggered + for the element that has the .repeated-item + class +*/ +.repeated-item.ng-enter, .repeated-item.ng-move { + -webkit-transition:0.5s linear all; + -moz-transition:0.5s linear all; + -o-transition:0.5s linear all; + transition:0.5s linear all; + opacity:0; +} + +/* + The ng-enter-active and ng-move-active + are where the transition destination properties + are set so that the animation knows what to + animate. +*/ +.repeated-item.ng-enter.ng-enter-active, +.repeated-item.ng-move.ng-move-active { + opacity:1; +} + +/* + We're using CSS keyframe animations for when + the leave event is triggered for the element + that has the .repeated-item class +*/ +.repeated-item.ng-leave { + -webkit-animation:0.5s my_animation; + -moz-animation:0.5s my_animation; + -o-animation:0.5s my_animation; + animation:0.5s my_animation; +} + +@keyframes my_animation { + from { opacity:1; } + to { opacity:0; } +} + +/* + Unfortunately each browser vendor requires + its own definition of keyframe animation code... +*/ +@-webkit-keyframes my_animation { + from { opacity:1; } + to { opacity:0; } +} + +@-moz-keyframes my_animation { + from { opacity:1; } + to { opacity:0; } +} + +@-o-keyframes my_animation { + from { opacity:1; } + to { opacity:0; } +} \ No newline at end of file diff --git a/coselmar-ui/src/main/webapp/index.html b/coselmar-ui/src/main/webapp/index.html index ae22b95..adecda5 100644 --- a/coselmar-ui/src/main/webapp/index.html +++ b/coselmar-ui/src/main/webapp/index.html @@ -35,6 +35,7 @@ <script src="webjars/angularjs/1.3.6/angular-route.js"></script> <script src="webjars/angularjs/1.3.6/angular-resource.js"></script> <script src="webjars/angularjs/1.3.6/angular-messages.js"></script> + <script src="webjars/angularjs/1.3.6/angular-animate.js"></script> <!--<script src="nuiton-js/angular-ui-bootstrap.js"></script>--> <script src="webjars/bootstrap/3.3.1/js/bootstrap.js"></script> <script src="webjars/angular-translate/2.5.2/angular-translate.js"></script> diff --git a/coselmar-ui/src/main/webapp/js/coselmar.js b/coselmar-ui/src/main/webapp/js/coselmar.js index a444191..33eb7e7 100644 --- a/coselmar-ui/src/main/webapp/js/coselmar.js +++ b/coselmar-ui/src/main/webapp/js/coselmar.js @@ -21,7 +21,7 @@ * <http://www.gnu.org/licenses/gpl-3.0.html>. * #L% */ -var coselmarApp = angular.module("coselmarApp", ['ngRoute', 'ngResource', 'ngMessages', +var coselmarApp = angular.module("coselmarApp", ['ngRoute', 'ngResource', 'ngMessages', 'ngAnimate', 'pascalprecht.translate', 'tmh.dynamicLocale', 'angular-jwt', 'coselmarControllers', 'coselmarServices']); @@ -113,21 +113,21 @@ coselmarApp.config(function($httpProvider) { return { 'responseError': function(rejection) { - if (rejection.status == 401) { - // create return to path wanted - var returnTo = $location.path(); - $location.path("/401").search('returnTo', returnTo); - - } else if (rejection.status == 403) { - $location.path("/403"); - - } else if (rejection.status == 404) { -// $location.path("/404"); - - } else { - $location.path("/"); - - } +// if (rejection.status == 401) { +// // create return to path wanted +// var returnTo = $location.path(); +// $location.path("/401").search('returnTo', returnTo); +// +// } else if (rejection.status == 403) { +// $location.path("/403"); +// +// } else if (rejection.status == 404) { +//// $location.path("/404"); +// +// } else { +// $location.path("/"); +// +// } return $q.reject(rejection); } }; diff --git a/coselmar-ui/src/main/webapp/views/users/newPassword.html b/coselmar-ui/src/main/webapp/views/users/newPassword.html index faa2d31..4904b2f 100644 --- a/coselmar-ui/src/main/webapp/views/users/newPassword.html +++ b/coselmar-ui/src/main/webapp/views/users/newPassword.html @@ -29,7 +29,14 @@ </div> <div class="text-center"> - <alert ng-repeat="alert in alerts" type="{{alert.type}}" close="closeAlert($index)">{{alert.msg | translate}}</alert> + <!--<alert ng-repeat="alert in alerts" type="{{alert.type}}" close="closeAlert($index)">{{alert.msg | translate}}</alert>--> + <alert class="repeated-item" ng-repeat="alert in alerts" type="{{alert.type}}" close="closeAlert($index)">{{alert.msg | translate}}</alert> + + Sinon : + <ul> + <li class="repeated-item" ng-repeat="alert in alerts">{{alert.msg | translate}}</li> + </ul> + </div> <div class="text-center"> -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository coselmar. See http://git.codelutin.com/coselmar.git commit f4bee9f8559e08665a402537448d76014029011e Merge: e95c74a c5572fb Author: Yannick Martel <martel@©odelutin.com> Date: Mon Feb 16 14:20:34 2015 +0100 merge with develop .../ifremer/coselmar/beans/QuestionSearchBean.java | 19 +++ .../persistence/entity/QuestionTopiaDao.java | 47 +++++-- .../coselmar/converter/BeanEntityConverter.java | 8 -- .../services/CoselmarWebServiceSupport.java | 20 ++- .../coselmar/services/v1/DocumentsWebService.java | 7 +- .../coselmar/services/v1/QuestionsWebService.java | 63 +++++----- .../coselmar/services/v1/UsersWebService.java | 5 +- .../coselmar/services/UsersWebServiceTest.java | 5 +- coselmar-ui/pom.xml | 2 - coselmar-ui/src/main/webapp/css/coselmar.css | 74 ++++++++++- coselmar-ui/src/main/webapp/i18n/en.js | 4 + coselmar-ui/src/main/webapp/i18n/fr.js | 4 + coselmar-ui/src/main/webapp/index.html | 36 +++--- .../src/main/webapp/js/coselmar-controllers.js | 40 +++++- coselmar-ui/src/main/webapp/js/coselmar.js | 1 + .../webapp/views/documents/modalDocumentEdit.html | 138 +++++++++++---------- coselmar-ui/src/main/webapp/views/home.html | 59 ++++++++- .../main/webapp/views/questions/editquestion.html | 4 +- .../src/main/webapp/views/questions/questions.html | 7 +- .../src/main/webapp/views/users/edituser.html | 20 ++- pom.xml | 52 +++++--- 21 files changed, 431 insertions(+), 184 deletions(-) diff --cc coselmar-ui/src/main/webapp/css/coselmar.css index 746f42c,f43e553..71b86fe --- a/coselmar-ui/src/main/webapp/css/coselmar.css +++ b/coselmar-ui/src/main/webapp/css/coselmar.css @@@ -430,66 -437,64 +437,129 @@@ input[type="file"] height: auto; } + + /* Media queries + -------------------------------------------------- */ + + @media screen and (max-width: 1080px) { + body .container { + width: 90%; + } + + + .navbar .navbar-brand .logo { + height: 30px; + padding-top: 3px; + } + .navbar .navbar-brand span.title { + font-size: 11px; + } + .navbar .navbar-nav > li > a { + padding-left: 6px; + padding-right: 6px; + } + } + + @media screen and (max-width: 900px) { + .navbar .navbar-brand { + padding-right: 5px; + } + .navbar .navbar-nav > li > a { + padding-left: 3px; + padding-right: 3px; + } + .navbar .navbar-nav > li { + border-color: #ddd; + } + .navbar .navbar-nav > li:last-child { + border-color: #ddd; + } + .navbar .navbar-form.navbar-right .user-info { + font-size: 12px; + } + .navbar .navbar-form .btn { + font-size: 11px; + margin: 0 0 0 5px; + } + } + + @media screen and (min-width: 769px) and (max-width: 900px) { + .navbar .navbar-brand .logo { + display: block; + float: none; + height: 24px; + padding-top: 0; + } + .navbar .navbar-brand span.title { + display: block; + float: left; + font-size: 11px; + padding: 4px 0 0; + transform: none; + } ++} ++ ++ +/** + * Animation + */ +/* + We're using CSS transitions for when + the enter and move events are triggered + for the element that has the .repeated-item + class +*/ +.repeated-item.ng-enter, .repeated-item.ng-move { + -webkit-transition:0.5s linear all; + -moz-transition:0.5s linear all; + -o-transition:0.5s linear all; + transition:0.5s linear all; + opacity:0; +} + +/* + The ng-enter-active and ng-move-active + are where the transition destination properties + are set so that the animation knows what to + animate. +*/ +.repeated-item.ng-enter.ng-enter-active, +.repeated-item.ng-move.ng-move-active { + opacity:1; +} + +/* + We're using CSS keyframe animations for when + the leave event is triggered for the element + that has the .repeated-item class +*/ +.repeated-item.ng-leave { + -webkit-animation:0.5s my_animation; + -moz-animation:0.5s my_animation; + -o-animation:0.5s my_animation; + animation:0.5s my_animation; +} + +@keyframes my_animation { + from { opacity:1; } + to { opacity:0; } +} + +/* + Unfortunately each browser vendor requires + its own definition of keyframe animation code... +*/ +@-webkit-keyframes my_animation { + from { opacity:1; } + to { opacity:0; } +} + +@-moz-keyframes my_animation { + from { opacity:1; } + to { opacity:0; } +} + +@-o-keyframes my_animation { + from { opacity:1; } + to { opacity:0; } } diff --cc coselmar-ui/src/main/webapp/index.html index adecda5,2439101..9c20739 --- a/coselmar-ui/src/main/webapp/index.html +++ b/coselmar-ui/src/main/webapp/index.html @@@ -25,25 -25,25 +25,26 @@@ <head> <meta charset="utf-8" /> - - <link rel="stylesheet" href="webjars/bootstrap/3.3.1/css/bootstrap.css"> - <link rel="stylesheet" href="webjars/font-awesome/4.2.0/css/font-awesome.css"> + <title>Coselmar {{ 'application.title' | translate}}</title> + + <link rel="stylesheet" href="webjars/bootstrap/3.3.2/css/bootstrap.css"> + <link rel="stylesheet" href="webjars/font-awesome/4.3.0/css/font-awesome.css"> <link rel="stylesheet" href="css/coselmar.css"> - <script src="webjars/jquery/2.1.1/jquery.js"></script> - <script src="webjars/angularjs/1.3.6/angular.js"></script> - <script src="webjars/angularjs/1.3.6/angular-route.js"></script> - <script src="webjars/angularjs/1.3.6/angular-resource.js"></script> - <script src="webjars/angularjs/1.3.6/angular-messages.js"></script> - <script src="webjars/angularjs/1.3.6/angular-animate.js"></script> + <script src="webjars/jquery/2.1.3/jquery.js"></script> + <script src="webjars/angularjs/1.3.13/angular.js"></script> + <script src="webjars/angularjs/1.3.13/angular-route.js"></script> + <script src="webjars/angularjs/1.3.13/angular-resource.js"></script> + <script src="webjars/angularjs/1.3.13/angular-messages.js"></script> ++ <script src="webjars/angularjs/1.3.13/angular-animate.js"></script> <!--<script src="nuiton-js/angular-ui-bootstrap.js"></script>--> - <script src="webjars/bootstrap/3.3.1/js/bootstrap.js"></script> - <script src="webjars/angular-translate/2.5.2/angular-translate.js"></script> - <script src="webjars/angular-dynamic-locale/0.1.24/src/tmhDynamicLocale.js"></script> + <script src="webjars/bootstrap/3.3.2/js/bootstrap.js"></script> + <script src="webjars/angular-translate/2.6.0/angular-translate.js"></script> + <script src="webjars/angular-dynamic-locale/0.1.27/src/tmhDynamicLocale.js"></script> <!--TODO ymartel 20141203 : extract version, or use wro --> - <script src="webjars/angular-ui-select/0.9.0/select.js"></script> - <link rel="stylesheet" href="webjars/angular-ui-select/0.9.0/select.css"> + <script src="webjars/angular-ui-select/0.9.6/select.js"></script> + <link rel="stylesheet" href="webjars/angular-ui-select/0.9.6/select.css"> <script src="webjars/angular-ui-bootstrap/0.12.0/ui-bootstrap.js"></script> <script src="webjars/angular-ui-bootstrap/0.12.0/ui-bootstrap-tpls.js"></script> -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository coselmar. See http://git.codelutin.com/coselmar.git commit 37703e1869ddacfd3d51e6f99a58da81d8b8a6a0 Author: Yannick Martel <martel@©odelutin.com> Date: Mon Feb 16 17:38:25 2015 +0100 review user error and success on operation : add notifications --- .../services/CoselmarWebServiceSupport.java | 8 ++ .../errors/MailAlreadyExistingException.java | 37 +++++++ .../ifremer/coselmar/services/v1/ErrorAction.java | 9 ++ .../coselmar/services/v1/UsersWebService.java | 15 +-- coselmar-rest/src/main/resources/mapping | 5 +- coselmar-ui/pom.xml | 6 ++ coselmar-ui/src/main/webapp/i18n/en.js | 5 + coselmar-ui/src/main/webapp/i18n/fr.js | 6 ++ coselmar-ui/src/main/webapp/index.html | 8 +- .../src/main/webapp/js/coselmar-controllers.js | 117 ++++++++++++++++++--- .../src/main/webapp/js/coselmar-error-services.js | 62 +++++++++++ coselmar-ui/src/main/webapp/js/coselmar.js | 2 +- .../main/webapp/views/notificationTemplate.html | 16 +++ pom.xml | 8 ++ 14 files changed, 277 insertions(+), 27 deletions(-) diff --git a/coselmar-rest/src/main/java/fr/ifremer/coselmar/services/CoselmarWebServiceSupport.java b/coselmar-rest/src/main/java/fr/ifremer/coselmar/services/CoselmarWebServiceSupport.java index 079560d..5fdb1c1 100644 --- a/coselmar-rest/src/main/java/fr/ifremer/coselmar/services/CoselmarWebServiceSupport.java +++ b/coselmar-rest/src/main/java/fr/ifremer/coselmar/services/CoselmarWebServiceSupport.java @@ -176,6 +176,14 @@ public abstract class CoselmarWebServiceSupport extends WebMotionController impl log.error("Error during JWT verification : bad claims!", e); } throw new InvalidCredentialException("Error with claims"); + + } catch (IllegalStateException e) { + // No token set + if (log.isErrorEnabled()) { + log.error("Error during JWT verification : no token!", e); + } + throw new InvalidCredentialException("Seems no user connected"); + } } diff --git a/coselmar-rest/src/main/java/fr/ifremer/coselmar/services/errors/MailAlreadyExistingException.java b/coselmar-rest/src/main/java/fr/ifremer/coselmar/services/errors/MailAlreadyExistingException.java new file mode 100644 index 0000000..a18c0d6 --- /dev/null +++ b/coselmar-rest/src/main/java/fr/ifremer/coselmar/services/errors/MailAlreadyExistingException.java @@ -0,0 +1,37 @@ +package fr.ifremer.coselmar.services.errors; + +/* + * #%L + * Coselmar :: Rest Services + * $Id:$ + * $HeadURL:$ + * %% + * Copyright (C) 2014 Ifremer, 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 java.security.InvalidParameterException; + +/** + * @author ymartel (martel@codelutin.com) + */ +public class MailAlreadyExistingException extends InvalidParameterException { + + public MailAlreadyExistingException(String message) { + super(message); + } +} diff --git a/coselmar-rest/src/main/java/fr/ifremer/coselmar/services/v1/ErrorAction.java b/coselmar-rest/src/main/java/fr/ifremer/coselmar/services/v1/ErrorAction.java index b98e642..24d34e6 100644 --- a/coselmar-rest/src/main/java/fr/ifremer/coselmar/services/v1/ErrorAction.java +++ b/coselmar-rest/src/main/java/fr/ifremer/coselmar/services/v1/ErrorAction.java @@ -71,4 +71,13 @@ public class ErrorAction extends WebMotionController { return render; } + + public Render on409(HttpContext context, Exception e) { + + CoselmarRestUtil.prepareResponse(context); + + Render render = renderError(HttpServletResponse.SC_CONFLICT, e.getMessage()); + return render; + + } } diff --git a/coselmar-rest/src/main/java/fr/ifremer/coselmar/services/v1/UsersWebService.java b/coselmar-rest/src/main/java/fr/ifremer/coselmar/services/v1/UsersWebService.java index afaf5cc..d3fb0d6 100644 --- a/coselmar-rest/src/main/java/fr/ifremer/coselmar/services/v1/UsersWebService.java +++ b/coselmar-rest/src/main/java/fr/ifremer/coselmar/services/v1/UsersWebService.java @@ -53,6 +53,7 @@ import fr.ifremer.coselmar.persistence.entity.CoselmarUser; import fr.ifremer.coselmar.persistence.entity.CoselmarUserRole; import fr.ifremer.coselmar.services.CoselmarWebServiceSupport; import fr.ifremer.coselmar.services.errors.InvalidCredentialException; +import fr.ifremer.coselmar.services.errors.MailAlreadyExistingException; import fr.ifremer.coselmar.services.errors.UnauthorizedException; import org.apache.commons.io.Charsets; import org.apache.commons.lang3.StringUtils; @@ -199,23 +200,23 @@ public class UsersWebService extends CoselmarWebServiceSupport { return result; } - public void addUser(UserBean user) throws InvalidParameterException, InvalidCredentialException, UnauthorizedException { + public void addUser(UserBean user) throws MailAlreadyExistingException, InvalidCredentialException, UnauthorizedException { Preconditions.checkNotNull(user); // Check authentication String authorization = getContext().getHeader("Authorization"); UserWebToken userWebToken = checkAuthentication(authorization); - // Who is allowed here ? Admin and user himself + // Who is allowed here ? Admin and Superviseur if (!StringUtils.equals(userWebToken.getRole(), CoselmarUserRole.ADMIN.name()) && (StringUtils.equals(userWebToken.getRole(), CoselmarUserRole.SUPERVISOR.name()) && !StringUtils.equals(user.getRole(), CoselmarUserRole.CLIENT.name())) ) { if (log.isDebugEnabled()) { - String message = String.format("A non admin, non supervisor user is trying to access users list"); + String message = String.format("A non admin, non supervisor user is trying to create user"); log.debug(message); } - throw new UnauthorizedException("Not allowed to see users"); + throw new UnauthorizedException("Not allowed to add user"); } CoselmarUser userEntity = getCoselmarUserDao().create(); @@ -258,7 +259,7 @@ public class UsersWebService extends CoselmarWebServiceSupport { } } - public void modifyUser(UserBean user) throws InvalidCredentialException, UnauthorizedException, InvalidParameterException, TopiaNoResultException { + public void modifyUser(UserBean user) throws InvalidCredentialException, UnauthorizedException, InvalidParameterException, TopiaNoResultException, MailAlreadyExistingException { // Check authentication String authorization = getContext().getHeader("Authorization"); @@ -456,7 +457,7 @@ public class UsersWebService extends CoselmarWebServiceSupport { * @param userId : the current user#id : this parameter is needed to exclude from the search this user, cause it could already have this mail * @throws InvalidParameterException if the mail is already used. */ - protected void checkMailUniqueness(String mail, String userId) throws InvalidParameterException { + protected void checkMailUniqueness(String mail, String userId) throws MailAlreadyExistingException { boolean mailAlreadyUsed; if (StringUtils.isNotBlank(userId)) { @@ -468,7 +469,7 @@ public class UsersWebService extends CoselmarWebServiceSupport { if (mailAlreadyUsed) { String msg = String.format("mail '%s' is already used", mail); - throw new InvalidParameterException(msg); + throw new MailAlreadyExistingException(msg); } } diff --git a/coselmar-rest/src/main/resources/mapping b/coselmar-rest/src/main/resources/mapping index 3d166f2..ec66430 100644 --- a/coselmar-rest/src/main/resources/mapping +++ b/coselmar-rest/src/main/resources/mapping @@ -16,8 +16,9 @@ default.render=fr.ifremer.coselmar.services.CoselmarRender fr.ifremer.coselmar.services.errors.InvalidCredentialException ErrorAction.on401 fr.ifremer.coselmar.services.errors.UnauthorizedException ErrorAction.on403 -fr.ifremer.coselmar.services.errors.NoResultException ErrorAction.on404 -fr.ifremer.coselmar.exceptions.CoselmarTechnicalException ErrorAction.on500 +fr.ifremer.coselmar.services.errors.NoResultException ErrorAction.on404 +fr.ifremer.coselmar.services.errors.MailAlreadyExistingException ErrorAction.on409 +fr.ifremer.coselmar.exceptions.CoselmarTechnicalException ErrorAction.on500 org.nuiton.topia.persistence.TopiaNoResultException ErrorAction.on404 [actions] diff --git a/coselmar-ui/pom.xml b/coselmar-ui/pom.xml index 0bde332..f23f090 100644 --- a/coselmar-ui/pom.xml +++ b/coselmar-ui/pom.xml @@ -87,6 +87,12 @@ <scope>runtime</scope> </dependency> + <dependency> + <groupId>org.webjars</groupId> + <artifactId>angular-notify</artifactId> + <scope>runtime</scope> + </dependency> + </dependencies> <build> diff --git a/coselmar-ui/src/main/webapp/i18n/en.js b/coselmar-ui/src/main/webapp/i18n/en.js index 0721a06..6bcfa7d 100644 --- a/coselmar-ui/src/main/webapp/i18n/en.js +++ b/coselmar-ui/src/main/webapp/i18n/en.js @@ -221,6 +221,11 @@ var translateEN = { "user.message.newPasswordSent" : "A new password has been sent.", "user.message.wannaSimpleLogin" : "Use simple login, not a mail (Warning : no password could be sent)", "user.message.invalidLogin" : "Login is mandatory.", +"user.message.created" : "User well created.", +"user.message.deleted" : "User well deleted.", +"user.message.disable" : "User well disable.", +"user.message.enable" : "User well enable.", +"user.message.mail.alreadyExisting" : "The provided mail (or login) already exists.", "user.button.add" : "Add an user", "user.button.add.client" : "Add a client", diff --git a/coselmar-ui/src/main/webapp/i18n/fr.js b/coselmar-ui/src/main/webapp/i18n/fr.js index 29f4708..61534f1 100644 --- a/coselmar-ui/src/main/webapp/i18n/fr.js +++ b/coselmar-ui/src/main/webapp/i18n/fr.js @@ -221,6 +221,11 @@ var translateFR = { "user.message.newPasswordSent" : "Un nouveau mot de passe a été envoyé.", "user.message.wannaSimpleLogin" : "Utiliser un simple identifiant et non un courriel (Attention : aucun mot de passe ne pourra être envoyé.)", "user.message.invalidLogin" : "L'identifiant est obligatoire.", +"user.message.created" : "Utilisateur créé.", +"user.message.deleted" : "Utilisateur supprimé.", +"user.message.disable" : "Utilisateur désactivé.", +"user.message.enable" : "Utilisateur réactivé.", +"user.message.mail.alreadyExisting" : "Le courriel (ou identifiant) saisi est déjà attribué.", "user.button.add" : "Ajouter un utilisateur", "user.button.add.client" : "Ajouter un client", @@ -295,4 +300,5 @@ var translateFR = { <li>faire une recherche globale sur le référentiel document/question et d'extraire le résultat sous un format exploitable</li>\ </p>", "home.connected.lastProjects" : "Derniers projets", + } \ No newline at end of file diff --git a/coselmar-ui/src/main/webapp/index.html b/coselmar-ui/src/main/webapp/index.html index 9c20739..53ef995 100644 --- a/coselmar-ui/src/main/webapp/index.html +++ b/coselmar-ui/src/main/webapp/index.html @@ -26,7 +26,8 @@ <head> <meta charset="utf-8" /> <title>Coselmar {{ 'application.title' | translate}}</title> - + + <link rel="stylesheet" href="webjars/angular-notify/2.0.2/angular-notify.min.css"> <link rel="stylesheet" href="webjars/bootstrap/3.3.2/css/bootstrap.css"> <link rel="stylesheet" href="webjars/font-awesome/4.3.0/css/font-awesome.css"> <link rel="stylesheet" href="css/coselmar.css"> @@ -42,7 +43,9 @@ <script src="webjars/angular-translate/2.6.0/angular-translate.js"></script> <script src="webjars/angular-dynamic-locale/0.1.27/src/tmhDynamicLocale.js"></script> - <!--TODO ymartel 20141203 : extract version, or use wro --> + <script src="webjars/angular-notify/2.0.2/angular-notify.min.js"></script> + + <script src="webjars/angular-ui-select/0.9.6/select.js"></script> <link rel="stylesheet" href="webjars/angular-ui-select/0.9.6/select.css"> <script src="webjars/angular-ui-bootstrap/0.12.0/ui-bootstrap.js"></script> @@ -58,6 +61,7 @@ <script src="js/coselmar-user-services.js"></script> <script src="js/coselmar-questions-services.js"></script> <script src="js/coselmar-admin-services.js"></script> + <script src="js/coselmar-error-services.js"></script> </head> <body> diff --git a/coselmar-ui/src/main/webapp/js/coselmar-controllers.js b/coselmar-ui/src/main/webapp/js/coselmar-controllers.js index 76057ac..c76d677 100644 --- a/coselmar-ui/src/main/webapp/js/coselmar-controllers.js +++ b/coselmar-ui/src/main/webapp/js/coselmar-controllers.js @@ -435,7 +435,7 @@ coselmarControllers.directive('ngFileModel', ['$parse', function ($parse) { ///////////////////////////////////////////////// // Controller for All User View -coselmarControllers.controller("UsersCtrl", ['$scope', '$route', '$routeParams', '$location', 'userService', function($scope, $route, $routeParams, $location, userService){ +coselmarControllers.controller("UsersCtrl", ['$scope', '$route', '$routeParams', '$location', 'userService', 'notify', function($scope, $route, $routeParams, $location, userService, notify){ //manage keywords if given $scope.search = { searchKeywords : []}; @@ -461,6 +461,12 @@ coselmarControllers.controller("UsersCtrl", ['$scope', '$route', '$routeParams', $scope.deleteUser = function(userId){ userService.deleteUser(userId, $scope, function() { + // Notification + notify({ + message: "user.message.delete", + classes: "alert-success", + templateUrl: "views/notificationTemplate.html" + }); // Go back to documents list $route.reload(); }); @@ -470,6 +476,12 @@ coselmarControllers.controller("UsersCtrl", ['$scope', '$route', '$routeParams', user.active = false; userService.saveUser(user, function() { + // Notification + notify({ + message: "user.message.disable", + classes: "alert-success", + templateUrl: "views/notificationTemplate.html" + }); // Go back to users list $location.path("/users"); }); @@ -480,6 +492,12 @@ coselmarControllers.controller("UsersCtrl", ['$scope', '$route', '$routeParams', user.active = true; userService.saveUser(user, function() { + // Notification + notify({ + message: "user.message.enable", + classes: "alert-success", + templateUrl: "views/notificationTemplate.html" + }); // Go back to users list $location.path("/users"); }); @@ -497,7 +515,6 @@ coselmarControllers.controller("UsersCtrl", ['$scope', '$route', '$routeParams', // Because "ALL" role is just a hack to select no role, remove it from example delete $scope.example.role; }; - console.log($scope.example); userService.getAdvancedUsers($scope.example, function(users){ $scope.users = users; @@ -511,9 +528,12 @@ coselmarControllers.controller("UsersCtrl", ['$scope', '$route', '$routeParams', // Controller for new user View -coselmarControllers.controller("NewUserCtrl", ['$scope', '$route', '$location', 'userService', function($scope, $route, $location, userService){ +coselmarControllers.controller("NewUserCtrl", ['$scope', '$route', '$location', 'userService', 'notify', 'errorService', + function($scope, $route, $location, userService, notify, errorService) { - if ($scope.currentUser.role == 'ADMIN') { + if (!$scope.currentUser) { + errorService.reject401(); + } else if ($scope.currentUser.role == 'ADMIN') { $scope.user = {'role' : 'EXPERT'}; } else if ($scope.currentUser.role == 'SUPERVISOR') { $scope.user = {'role' : 'CLIENT'}; @@ -526,11 +546,35 @@ coselmarControllers.controller("NewUserCtrl", ['$scope', '$route', '$location', // Call service to create a new user if(isValidForm) { userService.saveUser($scope.user, function() { + notify({ + message: "user.message.created", + classes: "alert-success", + templateUrl: "views/notificationTemplate.html" + }); $location.path("/users"); - },function(error) { - //TODO ymartel 20141118 : deal with error.status or statusText - console.log("error occurs"); - console.log(error.s); + + }, function(error) { + if (error.status == 409) { + // Mail already existing + notify({ + message: "user.message.mail.alreadyExisting", + classes: "alert-danger", + templateUrl: "views/notificationTemplate.html" + }); + } else if (error.status == 403) { + errorService.reject403(); + + } else if (error.status == 401) { + errorService.reject401(); + + } else { + notify({ + message: "common.message.internalError", + classes: "alert-danger", + templateUrl: "views/notificationTemplate.html" + }); + + } }); } @@ -539,7 +583,8 @@ coselmarControllers.controller("NewUserCtrl", ['$scope', '$route', '$location', // Controller for single User View & Edit coselmarControllers.controller("UserViewCtrl", - ['$scope', '$route', '$location', 'userService', '$routeParams', function($scope, $route, $location, userService, $routeParams) { + ['$scope', '$route', '$location', 'userService', '$routeParams', 'notify', 'errorService', + function($scope, $route, $location, userService, $routeParams, notify, errorService) { $scope.editMode = $routeParams.edit; if ($scope.editMode) { @@ -552,9 +597,16 @@ coselmarControllers.controller("UserViewCtrl", $scope.deleteUser = function(userId){ userService.deleteUser(userId, $scope, function() { + // Notification + notify({ + message: "user.message.deleted", + classes: "alert-success", + templateUrl: "views/notificationTemplate.html" + }); // Go back to users list $location.path("/users"); - }); + + }, errorService.defaultFailOnCall(error)); }; @@ -563,9 +615,16 @@ coselmarControllers.controller("UserViewCtrl", var user = $scope.user; user.active = false; userService.saveUser(user, function() { + // Notification + notify({ + message: "user.message.disable", + classes: "alert-success", + templateUrl: "views/notificationTemplate.html" + }); // Go back to users list $route.reload(); - }); + + }, errorService.defaultFailOnCall(error)); }; @@ -574,9 +633,16 @@ coselmarControllers.controller("UserViewCtrl", var user = $scope.user; user.active = true; userService.saveUser(user, function() { + // Notification + notify({ + message: "user.message.enable", + classes: "alert-success", + templateUrl: "views/notificationTemplate.html" + }); // Go back to users list $route.reload(); - }); + + }, errorService.defaultFailOnCall(error)); }; @@ -598,9 +664,30 @@ coselmarControllers.controller("UserViewCtrl", } },function(error) { - //TODO ymartel 20141118 : deal with error.status or statusText - console.log("error occurs"); - console.log(error.s); + if (error.status == 409) { + // Mail already existing + notify({ + message: "user.message.mail.alreadyExisting", + classes: "alert-danger", + templateUrl: "views/notificationTemplate.html" + }); + } else if (error.status = 403) { + errorService.reject403(); + + } else if (error.status = 401) { + errorService.reject401(); + + } else if (error.status = 404) { + errorService.reject404(); + + } else { + notify({ + message: "common.message.internalError", + classes: "alert-danger", + templateUrl: "views/notificationTemplate.html" + }); + + } }); } }; diff --git a/coselmar-ui/src/main/webapp/js/coselmar-error-services.js b/coselmar-ui/src/main/webapp/js/coselmar-error-services.js new file mode 100644 index 0000000..c86de65 --- /dev/null +++ b/coselmar-ui/src/main/webapp/js/coselmar-error-services.js @@ -0,0 +1,62 @@ +/* + * #%L + * Coselmar :: UI + * $Id:$ + * $HeadURL:$ + * %% + * Copyright (C) 2014 Ifremer, 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% + */ +coselmarServices.factory('errorService', ['$location', 'notify', function($location, notify){ + return { + reject401 : function() { + // create return to path wanted + var returnTo = $location.path(); + $location.path("/401").search('returnTo', returnTo); + }, + reject403 : function() { + // create return to path wanted + $location.path("/403"); + }, + reject404 : function() { + // create return to path wanted + $location.path("/404"); + }, + + // Default function for error during call processing + defaultFailOnCall : function(error) { + + if (error.status == 403) { + errorService.reject403(); + + } else if (error.status == 401) { + errorService.reject401(); + + } else if (error.status == 404) { + errorService.reject404(); + + } else { + notify({ + message: "common.message.internalError", + classes: "alert-danger", + templateUrl: "views/notificationTemplate.html" + }); + + } + } + }; +}]); \ No newline at end of file diff --git a/coselmar-ui/src/main/webapp/js/coselmar.js b/coselmar-ui/src/main/webapp/js/coselmar.js index 988f22e..d5b7b22 100644 --- a/coselmar-ui/src/main/webapp/js/coselmar.js +++ b/coselmar-ui/src/main/webapp/js/coselmar.js @@ -22,7 +22,7 @@ * #L% */ var coselmarApp = angular.module("coselmarApp", ['ngRoute', 'ngResource', 'ngMessages', 'ngAnimate', - 'pascalprecht.translate', 'tmh.dynamicLocale', + 'pascalprecht.translate', 'tmh.dynamicLocale', 'cgNotify', 'angular-jwt', 'coselmarControllers', 'coselmarServices']); coselmarApp.config(['$routeProvider', function($routeProvider) { diff --git a/coselmar-ui/src/main/webapp/views/notificationTemplate.html b/coselmar-ui/src/main/webapp/views/notificationTemplate.html new file mode 100644 index 0000000..67722cc --- /dev/null +++ b/coselmar-ui/src/main/webapp/views/notificationTemplate.html @@ -0,0 +1,16 @@ +<div class="cg-notify-message" ng-class="$classes"> + + <div ng-show="!$messageTemplate"> + {{$message | translate}} + </div> + + <div ng-show="$messageTemplate" class="cg-notify-message-template"> + + </div> + + <button type="button" class="cg-notify-close" ng-click="$close()"> + <span aria-hidden="true">×</span> + <span class="cg-notify-sr-only">Close</span> + </button> + +</div> \ No newline at end of file diff --git a/pom.xml b/pom.xml index f1ce828..84ca883 100644 --- a/pom.xml +++ b/pom.xml @@ -148,6 +148,7 @@ <angularUiBootstrapVersion>0.12.0</angularUiBootstrapVersion> <angularTranslateVersion>2.6.0</angularTranslateVersion> <angularDynamicLocaleVersion>0.1.27</angularDynamicLocaleVersion> + <angularNotifyVersion>2.0.2</angularNotifyVersion> <jqueryVersion>2.1.3</jqueryVersion> <fontAwesomeVersion>4.3.0-1</fontAwesomeVersion> @@ -428,6 +429,13 @@ <dependency> <groupId>org.webjars</groupId> + <artifactId>angular-notify</artifactId> + <version>${angularNotifyVersion}</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.webjars</groupId> <artifactId>jquery</artifactId> <version>${jqueryVersion}</version> <scope>runtime</scope> -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository coselmar. See http://git.codelutin.com/coselmar.git commit a58eecbdb5e4e2e19dd80ee9bf1d06e2bdb8270b Author: Yannick Martel <martel@©odelutin.com> Date: Tue Feb 17 15:28:17 2015 +0100 manage notification for questions/projects --- .../services/CoselmarWebServiceSupport.java | 8 ++ .../coselmar/services/v1/QuestionsWebService.java | 2 +- coselmar-ui/src/main/webapp/i18n/en.js | 7 ++ coselmar-ui/src/main/webapp/i18n/fr.js | 7 ++ .../src/main/webapp/js/coselmar-controllers.js | 119 ++++++++++++--------- .../src/main/webapp/js/coselmar-error-services.js | 37 ++++--- 6 files changed, 111 insertions(+), 69 deletions(-) diff --git a/coselmar-rest/src/main/java/fr/ifremer/coselmar/services/CoselmarWebServiceSupport.java b/coselmar-rest/src/main/java/fr/ifremer/coselmar/services/CoselmarWebServiceSupport.java index 5fdb1c1..1d52f0a 100644 --- a/coselmar-rest/src/main/java/fr/ifremer/coselmar/services/CoselmarWebServiceSupport.java +++ b/coselmar-rest/src/main/java/fr/ifremer/coselmar/services/CoselmarWebServiceSupport.java @@ -242,6 +242,14 @@ public abstract class CoselmarWebServiceSupport extends WebMotionController impl log.error("Error during authorization check : user does not exist !", e); } throw new InvalidCredentialException("User not known"); + + } catch (IllegalStateException e) { + // No token set + if (log.isErrorEnabled()) { + log.error("Error during JWT verification : no token!", e); + } + throw new InvalidCredentialException("Seems no user connected"); + } } diff --git a/coselmar-rest/src/main/java/fr/ifremer/coselmar/services/v1/QuestionsWebService.java b/coselmar-rest/src/main/java/fr/ifremer/coselmar/services/v1/QuestionsWebService.java index cac8102..4c7e21c 100644 --- a/coselmar-rest/src/main/java/fr/ifremer/coselmar/services/v1/QuestionsWebService.java +++ b/coselmar-rest/src/main/java/fr/ifremer/coselmar/services/v1/QuestionsWebService.java @@ -306,10 +306,10 @@ public class QuestionsWebService extends CoselmarWebServiceSupport { for (Document document : documents) { document.removeRestrictedList(participantGroup); } + question.addAllContributors(participantGroup.getMembers()); } // Question become unavailable - question.addAllContributors(participantGroup.getMembers()); question.setUnavailable(true); getPersistenceContext().getCoselmarUserGroupDao().delete(participantGroup); diff --git a/coselmar-ui/src/main/webapp/i18n/en.js b/coselmar-ui/src/main/webapp/i18n/en.js index 6bcfa7d..d391cda 100644 --- a/coselmar-ui/src/main/webapp/i18n/en.js +++ b/coselmar-ui/src/main/webapp/i18n/en.js @@ -150,6 +150,12 @@ var translateEN = { "question.message.requiredType" : "Type is required.", "question.message.requiredSummary" : "A summary is required.", "question.message.requiredThemes" : "At least one theme is required.", +"question.message.saved" : "Project well saved.", +"question.message.deleted" : "Project well deleted.", +"question.message.closed" : "Project has been closed.", +"question.message.reopened" : "Project has been reopened.", +"question.message.adjourned" : "Project has been adjourned.", +"question.message.newDocuments.added" : "New documents has been added.", "question.button.add" : "Add a project", "question.button.reopen" : "Reopen", @@ -222,6 +228,7 @@ var translateEN = { "user.message.wannaSimpleLogin" : "Use simple login, not a mail (Warning : no password could be sent)", "user.message.invalidLogin" : "Login is mandatory.", "user.message.created" : "User well created.", +"user.message.updated" : "User well modified.", "user.message.deleted" : "User well deleted.", "user.message.disable" : "User well disable.", "user.message.enable" : "User well enable.", diff --git a/coselmar-ui/src/main/webapp/i18n/fr.js b/coselmar-ui/src/main/webapp/i18n/fr.js index 61534f1..f16d7b5 100644 --- a/coselmar-ui/src/main/webapp/i18n/fr.js +++ b/coselmar-ui/src/main/webapp/i18n/fr.js @@ -150,6 +150,12 @@ var translateFR = { "question.message.requiredType" : "Le type est requis..", "question.message.requiredSummary" : "Un résumé est requis.", "question.message.requiredThemes" : "Au moins un thème est requis.", +"question.message.saved" : "Projet enregistré.", +"question.message.deleted" : "Projet supprimé.", +"question.message.closed" : "Le projet a été fermé.", +"question.message.reopened" : "Le projet a été rouvert.", +"question.message.adjourned" : "Le projet a été ajourné.", +"question.message.newDocuments.added" : "Les nouveaux documents ont été ajoutés au projet", "question.button.add" : "Ajouter un projet", "question.button.reopen" : "Réouvrir", @@ -222,6 +228,7 @@ var translateFR = { "user.message.wannaSimpleLogin" : "Utiliser un simple identifiant et non un courriel (Attention : aucun mot de passe ne pourra être envoyé.)", "user.message.invalidLogin" : "L'identifiant est obligatoire.", "user.message.created" : "Utilisateur créé.", +"user.message.updated" : "Utilisateur modifié.", "user.message.deleted" : "Utilisateur supprimé.", "user.message.disable" : "Utilisateur désactivé.", "user.message.enable" : "Utilisateur réactivé.", diff --git a/coselmar-ui/src/main/webapp/js/coselmar-controllers.js b/coselmar-ui/src/main/webapp/js/coselmar-controllers.js index c76d677..58949cc 100644 --- a/coselmar-ui/src/main/webapp/js/coselmar-controllers.js +++ b/coselmar-ui/src/main/webapp/js/coselmar-controllers.js @@ -464,7 +464,7 @@ coselmarControllers.controller("UsersCtrl", ['$scope', '$route', '$routeParams', // Notification notify({ message: "user.message.delete", - classes: "alert-success", + classes: "alert-warning", templateUrl: "views/notificationTemplate.html" }); // Go back to documents list @@ -479,7 +479,7 @@ coselmarControllers.controller("UsersCtrl", ['$scope', '$route', '$routeParams', // Notification notify({ message: "user.message.disable", - classes: "alert-success", + classes: "alert-warning", templateUrl: "views/notificationTemplate.html" }); // Go back to users list @@ -600,7 +600,7 @@ coselmarControllers.controller("UserViewCtrl", // Notification notify({ message: "user.message.deleted", - classes: "alert-success", + classes: "alert-warning", templateUrl: "views/notificationTemplate.html" }); // Go back to users list @@ -618,7 +618,7 @@ coselmarControllers.controller("UserViewCtrl", // Notification notify({ message: "user.message.disable", - classes: "alert-success", + classes: "alert-warning", templateUrl: "views/notificationTemplate.html" }); // Go back to users list @@ -656,6 +656,12 @@ coselmarControllers.controller("UserViewCtrl", if(isValidForm) { userService.saveUser($scope.user, function() { + // Notification + notify({ + message: "user.message.updated", + classes: "alert-success", + templateUrl: "views/notificationTemplate.html" + }); // On success, back on users list for admin or supervisor if ($scope.currentUser.role == 'ADMIN' || $scope.currentUser.role == 'SUPERVISOR') { $location.path("/users"); @@ -745,8 +751,8 @@ coselmarControllers.directive('identicalCheck', [function () { ///////////////////////////////////////////////// // Controller for All Question View -coselmarControllers.controller("QuestionsCtrl", ['$scope', '$route', '$routeParams', '$location', 'questionsService', - function($scope, $route, $routeParams, $location, questionsService){ +coselmarControllers.controller("QuestionsCtrl", ['$scope', '$route', '$routeParams', '$location', 'questionsService', 'notify', 'errorService', + function($scope, $route, $routeParams, $location, questionsService, notify, errorService){ $scope.searchOptions = { 'privacy' : '', 'status' : '', 'keywords' : []}; @@ -754,15 +760,12 @@ coselmarControllers.controller("QuestionsCtrl", ['$scope', '$route', '$routePara // success : just get the questions $scope.questions = questions; - }, function(error) { - // Fail function : TODO - console.log(error); - }); + }, errorService.defaultFailOnCall); $scope.searchQuestions = function() { questionsService.getQuestions($scope.searchOptions, function(questions) { $scope.questions = questions; - }); + }, errorService.defaultFailOnCall(error)); }; @@ -770,13 +773,16 @@ coselmarControllers.controller("QuestionsCtrl", ['$scope', '$route', '$routePara $scope.deleteQuestion = function(questionId) { questionsService.deleteQuestion(questionId, function(questions) { - // success : just get the questions + // Notification + notify({ + message: "question.message.deleted", + classes: "alert-warning", + templateUrl: "views/notificationTemplate.html" + }); + // success : just reload the questions $route.reload(); - }, function(error) { - // Fail function : TODO - console.log(error); - }); + }, errorService.defaultFailOnCall); }; $scope.getUserNames = function(users) { @@ -803,8 +809,8 @@ coselmarControllers.controller("QuestionsCtrl", ['$scope', '$route', '$routePara }]); // Controller for Question View -coselmarControllers.controller("QuestionCtrl", ['$scope', '$route', '$routeParams', '$location', '$modal', 'questionsService', - function($scope, $route, $routeParams, $location, $modal, questionsService){ +coselmarControllers.controller("QuestionCtrl", ['$scope', '$route', '$routeParams', '$location', '$modal', 'notify', 'questionsService', 'errorService', + function($scope, $route, $routeParams, $location, $modal, notify, questionsService, errorService){ $scope.editSession = $routeParams.edit ? $routeParams.edit : false; $scope.isCurrentParticipant = false; @@ -942,23 +948,21 @@ coselmarControllers.controller("QuestionCtrl", ['$scope', '$route', '$routeParam bindUsers($scope.question.supervisors, $scope.supervisorsIndex); } - }, function(error) { - // Fail function : TODO - console.log("error during request"); - console.log(error); - }); + }, errorService.defaultFailOnCall); }; //Deletion $scope.deleteQuestion = function(){ questionsService.deleteQuestion($routeParams.questionId, function() { + notify({ + message: "question.message.deleted", + classes: "alert-warning", + templateUrl: "views/notificationTemplate.html" + }); // success : goto questions list - $location('#/questions'); + $location.path('/questions'); - }, function(error) { - // Fail function : TODO - console.log(error); - }); + }, errorService.defaultFailOnCall); }; $scope.saveQuestion = function() { @@ -972,16 +976,18 @@ coselmarControllers.controller("QuestionCtrl", ['$scope', '$route', '$routeParam } else { // Call service to create a new question questionsService.saveQuestion($scope.question, function() { + // Notification + notify({ + message: "question.message.saved", + classes: "alert-success", + templateUrl: "views/notificationTemplate.html" + }); if ($routeParams.questionId) { $location.search(""); } else { $location.path("/questions"); } - },function(error) { - //TODO ymartel 20141118 : deal with error.status or statusText - console.log("error occurs"); - console.log(error.s); - }); + }, errorService.defaultFailOnCall); } }; @@ -994,12 +1000,14 @@ coselmarControllers.controller("QuestionCtrl", ['$scope', '$route', '$routeParam } questionsService.saveQuestion($scope.question, function() { + // Notification + notify({ + message: "question.message.closed", + classes: "alert-success", + templateUrl: "views/notificationTemplate.html" + }); $route.reload(); - },function(error) { - //TODO ymartel 20141118 : deal with error.status or statusText - console.log("error occurs"); - console.log(error.s); - }); + },errorService.defaultFailOnCall); }; $scope.openCloseQuestionSession = function(){ @@ -1019,12 +1027,14 @@ coselmarControllers.controller("QuestionCtrl", ['$scope', '$route', '$routeParam } questionsService.saveQuestion($scope.question, function() { + // Notification + notify({ + message: "question.message.reopened", + classes: "alert-success", + templateUrl: "views/notificationTemplate.html" + }); $route.reload(); - },function(error) { - //TODO ymartel 20141118 : deal with error.status or statusText - console.log("error occurs"); - console.log(error.s); - }); + },errorService.defaultFailOnCall); }; $scope.adjournQuestion = function(){ @@ -1036,12 +1046,14 @@ coselmarControllers.controller("QuestionCtrl", ['$scope', '$route', '$routeParam } questionsService.saveQuestion($scope.question, function() { + // Notification + notify({ + message: "question.message.adjourned", + classes: "alert-warning", + templateUrl: "views/notificationTemplate.html" + }); $route.reload(); - },function(error) { - //TODO ymartel 20141118 : deal with error.status or statusText - console.log("error occurs"); - console.log(error.s); - }); + },errorService.defaultFailOnCall); }; // New documents added @@ -1051,12 +1063,15 @@ coselmarControllers.controller("QuestionCtrl", ['$scope', '$route', '$routeParam && $scope.question.newRelatedDocuments.length > 0) { questionsService.addNewDocuments($routeParams.questionId, $scope.question.newRelatedDocuments, function() { + // Notification + notify({ + message: "question.message.newDocuments.added", + classes: "alert-success", + templateUrl: "views/notificationTemplate.html" + }); $route.reload(); - }, function(error) { - // Fail function : TODO - console.log(error); - }); + }, errorService.defaultFailOnCall); } }; diff --git a/coselmar-ui/src/main/webapp/js/coselmar-error-services.js b/coselmar-ui/src/main/webapp/js/coselmar-error-services.js index c86de65..aca69b4 100644 --- a/coselmar-ui/src/main/webapp/js/coselmar-error-services.js +++ b/coselmar-ui/src/main/webapp/js/coselmar-error-services.js @@ -22,32 +22,37 @@ * #L% */ coselmarServices.factory('errorService', ['$location', 'notify', function($location, notify){ + + var reject401 = function() { + // create return to path wanted + var returnTo = $location.path(); + $location.path("/401").search('returnTo', returnTo); + }; + var reject403 = function() { + // create return to path wanted + $location.path("/403"); + }; + var reject404 = function() { + // create return to path wanted + $location.path("/404"); + }; + return { - reject401 : function() { - // create return to path wanted - var returnTo = $location.path(); - $location.path("/401").search('returnTo', returnTo); - }, - reject403 : function() { - // create return to path wanted - $location.path("/403"); - }, - reject404 : function() { - // create return to path wanted - $location.path("/404"); - }, + reject401 : reject401, + reject403 : reject403, + reject404 : reject404, // Default function for error during call processing defaultFailOnCall : function(error) { if (error.status == 403) { - errorService.reject403(); + reject403(); } else if (error.status == 401) { - errorService.reject401(); + reject401(); } else if (error.status == 404) { - errorService.reject404(); + reject404(); } else { notify({ -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository coselmar. See http://git.codelutin.com/coselmar.git commit a0b7bc28e7343bf1c5002d5b3d0090951cd96e58 Author: Yannick Martel <martel@©odelutin.com> Date: Tue Feb 17 16:16:28 2015 +0100 manage notification for documents --- coselmar-ui/src/main/webapp/i18n/en.js | 3 + coselmar-ui/src/main/webapp/i18n/fr.js | 3 + .../src/main/webapp/js/coselmar-controllers.js | 68 ++++++++++++++++------ .../src/main/webapp/js/coselmar-services.js | 12 ++-- 4 files changed, 61 insertions(+), 25 deletions(-) diff --git a/coselmar-ui/src/main/webapp/i18n/en.js b/coselmar-ui/src/main/webapp/i18n/en.js index d391cda..8a6e6d1 100644 --- a/coselmar-ui/src/main/webapp/i18n/en.js +++ b/coselmar-ui/src/main/webapp/i18n/en.js @@ -110,6 +110,9 @@ var translateEN = { "document.message.requiredSummary" : "A summary is required.", "document.privacy.questionRestricted" : "Restricted to Project participants", "document.privacy.restricted.info" : "Restricted to selected experts and to projects using document", +"document.message.created" : "Document well created.", +"document.message.updated" : "Document well modified.", +"document.message.deleted" : "Document well deleted.", "document.button.download" : "Download", "document.button.openLink" : "Open link", diff --git a/coselmar-ui/src/main/webapp/i18n/fr.js b/coselmar-ui/src/main/webapp/i18n/fr.js index f16d7b5..bff7778 100644 --- a/coselmar-ui/src/main/webapp/i18n/fr.js +++ b/coselmar-ui/src/main/webapp/i18n/fr.js @@ -110,6 +110,9 @@ var translateFR = { "document.message.requiredSummary" : "Un résumé est requis.", "document.privacy.questionRestricted" : "Restreint aux participants de projet.", "document.privacy.restricted.info" : "Restreint aux experts indiqués et aux projets incluant le document", +"document.message.created" : "Document créé.", +"document.message.updated" : "Document modifié.", +"document.message.deleted" : "Document supprimé.", "document.button.download" : "Télécharger", "document.button.openLink" : "Ouvrir le lien", diff --git a/coselmar-ui/src/main/webapp/js/coselmar-controllers.js b/coselmar-ui/src/main/webapp/js/coselmar-controllers.js index 58949cc..2188170 100644 --- a/coselmar-ui/src/main/webapp/js/coselmar-controllers.js +++ b/coselmar-ui/src/main/webapp/js/coselmar-controllers.js @@ -124,7 +124,8 @@ coselmarControllers.controller("homeConnectedCtrl", ['$scope', 'questionsService ///////////////////////////////////////////////// // Controller for All Documents View -coselmarControllers.controller("DocumentsCtrl", ['$scope', '$route', '$routeParams', '$location', 'documentService', function($scope, $route, $routeParams, $location, documentService){ +coselmarControllers.controller("DocumentsCtrl", ['$scope', '$route', '$routeParams', '$location', 'notify', 'documentService', 'errorService', + function($scope, $route, $routeParams, $location, notify, documentService, errorService){ //manage keywords if given $scope.searchKeywords = []; @@ -137,27 +138,32 @@ coselmarControllers.controller("DocumentsCtrl", ['$scope', '$route', '$routePara documentService.getDocuments($scope.searchKeywords, function(documents) { $scope.documents = documents; - }); + }, errorService.defaultFailOnCall); $scope.deleteDocument = function(documentId){ // Call service to create a new document documentService.deleteDocument(documentId, $scope, function() { + // Notification + notify({ + message: "document.message.deleted", + classes: "alert-warning", + templateUrl: "views/notificationTemplate.html" + }); // Go back to documents list $route.reload(); - }); + }, errorService.defaultFailOnCall); }; $scope.searchDocuments = function(){ -// $route.current.params.keywords = $scope.searchKeywords; -// $route.reload(); $location.search('keywords', $scope.searchKeywords); - } + }; }]); // Controller for new document View -coselmarControllers.controller("NewDocumentCtrl", ['$scope', '$location', 'documentService', function($scope, $location, documentService){ +coselmarControllers.controller("NewDocumentCtrl", ['$scope', '$location', 'notify', 'documentService', 'errorService', + function($scope, $location, notify, documentService, errorService){ $scope.document = {'type' : 'PERIODICAL_PUBLICATION', 'privacy': 'PUBLIC', 'keywords': [], 'authorizedUsers' : []}; $scope.upload = {}; @@ -217,15 +223,24 @@ coselmarControllers.controller("NewDocumentCtrl", ['$scope', '$location', 'docum if ($scope.upload.file) { var documentId = document.id; documentService.saveDocumentFile(documentId, $scope.upload.file, function() { + // Notification + notify({ + message: "document.message.created", + classes: "alert-success", + templateUrl: "views/notificationTemplate.html" + }); $location.path("/documents"); }); } else { + // Notification + notify({ + message: "document.message.created", + classes: "alert-success", + templateUrl: "views/notificationTemplate.html" + }); $location.path("/documents"); } - }, function(error) { - console.log("error occurs"); - } - ); + }, errorService.defaultFailOnCall); } @@ -253,8 +268,8 @@ coselmarControllers.controller("NewDocumentCtrl", ['$scope', '$location', 'docum // Controller for single document View coselmarControllers.controller("DocumentViewCtrl", - ['$scope', '$route', '$location', 'documentService', '$routeParams', 'coselmar-config', - function($scope, $route, $location, documentService, $routeParams, coselmarConfig) { + ['$scope', '$route', '$location', '$routeParams', 'coselmar-config', 'notify', 'documentService', 'errorService', + function($scope, $route, $location, $routeParams, coselmarConfig, notify, documentService, errorService) { $scope.container = {baseUrl : coselmarConfig.BASE_URL}; $scope.upload = {}; @@ -274,15 +289,21 @@ coselmarControllers.controller("DocumentViewCtrl", $scope.users = document.authorizedUsers; bindUsers($scope.document.authorizedUsers, $scope.usersIndex); } - }); + }, errorService.defaultFailOnCall); $scope.deleteDocument = function(documentId){ // Call service to create a new document documentService.deleteDocument(documentId, $scope, function() { + // Notification + notify({ + message: "document.message.deleted", + classes: "alert-warning", + templateUrl: "views/notificationTemplate.html" + }); // Go back to documents list $location.path("/documents"); - }); + }, errorService.defaultFailOnCall); }; @@ -341,15 +362,24 @@ coselmarControllers.controller("DocumentViewCtrl", if ($scope.upload.file) { var documentId = $scope.document.id; documentService.saveDocumentFile(documentId, $scope.upload.file, function() { + // Notification + notify({ + message: "document.message.updated", + classes: "alert-success", + templateUrl: "views/notificationTemplate.html" + }); $location.search(""); }); } else { + // Notification + notify({ + message: "document.message.updated", + classes: "alert-success", + templateUrl: "views/notificationTemplate.html" + }); $location.search(""); } - }, function(error) { - console.log("error occurs"); - } - ); + }, errorService.defaultFailOnCall); } else { $scope.hasErrors = true; diff --git a/coselmar-ui/src/main/webapp/js/coselmar-services.js b/coselmar-ui/src/main/webapp/js/coselmar-services.js index 815cfc0..0dc895b 100644 --- a/coselmar-ui/src/main/webapp/js/coselmar-services.js +++ b/coselmar-ui/src/main/webapp/js/coselmar-services.js @@ -92,17 +92,17 @@ function Document(resource, config){ docResource.upload(null, formData, successFunction, failFunction); }; - this.getDocument = function(id, successFunction){ + this.getDocument = function(id, successFunction, failFunction){ // Load the document var docResource = resource(baseURL + '/:documentId', {documentId:'@documentId'}); - docResource.get({documentId:id}, successFunction); + docResource.get({documentId:id}, successFunction, failFunction); }; - this.deleteDocument = function(id, scope, successFunction){ + this.deleteDocument = function(id, scope, successFunction, failFunction){ // Load the document var docResource = resource(baseURL + '/:documentId', {documentId:'@id'}); - docResource.delete({documentId:id}, successFunction); + docResource.delete({documentId:id}, successFunction, failFunction); }; this.getDocumentFile = function(id, scope){ @@ -113,11 +113,11 @@ function Document(resource, config){ }); }; - this.getDocuments = function(searchKeywords, successFunction){ + this.getDocuments = function(searchKeywords, successFunction, failFunction){ // Load all documents var docResource = resource(baseURL, {searchKeywords : searchKeywords}); - docResource.query(successFunction); + docResource.query(successFunction, failFunction); }; this.findAllTypes = function(successFunction){ -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository coselmar. See http://git.codelutin.com/coselmar.git commit c3068dd3b6581aeaa000158d304ac766a3b9c74b Author: Yannick Martel <martel@©odelutin.com> Date: Tue Feb 17 18:17:03 2015 +0100 fix duplication on documents list with restricted access --- .../java/fr/ifremer/coselmar/persistence/entity/DocumentTopiaDao.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coselmar-persistence/src/main/java/fr/ifremer/coselmar/persistence/entity/DocumentTopiaDao.java b/coselmar-persistence/src/main/java/fr/ifremer/coselmar/persistence/entity/DocumentTopiaDao.java index acbcd41..4a0bb09 100644 --- a/coselmar-persistence/src/main/java/fr/ifremer/coselmar/persistence/entity/DocumentTopiaDao.java +++ b/coselmar-persistence/src/main/java/fr/ifremer/coselmar/persistence/entity/DocumentTopiaDao.java @@ -59,7 +59,7 @@ public class DocumentTopiaDao extends AbstractDocumentTopiaDao<Document> { public List<Document> findAllFilterByUser(CoselmarUser currentUser, List<String> keywords) { - StringBuilder hqlBuilder = new StringBuilder("SELECT D FROM " + Document.class.getName() + " D" + StringBuilder hqlBuilder = new StringBuilder("SELECT DISTINCT(D) FROM " + Document.class.getName() + " D" + " LEFT OUTER JOIN D." + Document.PROPERTY_RESTRICTED_LIST + " CUG "); Map<String, Object> args = new HashMap<>(); -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository coselmar. See http://git.codelutin.com/coselmar.git commit 6d1bd0560634886115c8b8973dd1c277756eb4ac Author: Yannick Martel <martel@©odelutin.com> Date: Tue Feb 17 18:17:38 2015 +0100 fix usage of defaultFailOnCall service for error --- .../src/main/webapp/js/coselmar-controllers.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/coselmar-ui/src/main/webapp/js/coselmar-controllers.js b/coselmar-ui/src/main/webapp/js/coselmar-controllers.js index 2188170..7b64073 100644 --- a/coselmar-ui/src/main/webapp/js/coselmar-controllers.js +++ b/coselmar-ui/src/main/webapp/js/coselmar-controllers.js @@ -636,7 +636,7 @@ coselmarControllers.controller("UserViewCtrl", // Go back to users list $location.path("/users"); - }, errorService.defaultFailOnCall(error)); + }, errorService.defaultFailOnCall); }; @@ -654,7 +654,7 @@ coselmarControllers.controller("UserViewCtrl", // Go back to users list $route.reload(); - }, errorService.defaultFailOnCall(error)); + }, errorService.defaultFailOnCall); }; @@ -672,7 +672,7 @@ coselmarControllers.controller("UserViewCtrl", // Go back to users list $route.reload(); - }, errorService.defaultFailOnCall(error)); + }, errorService.defaultFailOnCall); }; @@ -795,7 +795,7 @@ coselmarControllers.controller("QuestionsCtrl", ['$scope', '$route', '$routePara $scope.searchQuestions = function() { questionsService.getQuestions($scope.searchOptions, function(questions) { $scope.questions = questions; - }, errorService.defaultFailOnCall(error)); + }, errorService.defaultFailOnCall); }; @@ -1229,18 +1229,18 @@ coselmarControllers.controller("QuestionCtrl", ['$scope', '$route', '$routeParam }]); -coselmarControllers.controller('ModalSearchDocumentsCtrl', function ($scope, $modalInstance, documentService) { +coselmarControllers.controller('ModalSearchDocumentsCtrl', function ($scope, $modalInstance, documentService, errorService) { $scope.searchKeywords = []; documentService.getDocuments($scope.searchKeywords, function(documents) { $scope.documents = documents; - }); + }, errorService.defaultFailOnCall); $scope.searchDocuments = function(searchKeywords) { documentService.getDocuments(searchKeywords, function(documents) { $scope.documents = documents; - }); + }, errorService.defaultFailOnCall); }; $scope.select = function (document) { @@ -1253,7 +1253,7 @@ coselmarControllers.controller('ModalSearchDocumentsCtrl', function ($scope, $mo }); -coselmarControllers.controller('ModalSearchQuestionsCtrl', function ($scope, $modalInstance, currentQuestionId, questionsService) { +coselmarControllers.controller('ModalSearchQuestionsCtrl', function ($scope, $modalInstance, currentQuestionId, questionsService, errorService) { $scope.searchKeywords = []; $scope.searchOptions = { 'type' : 'PERIODICAL_PUBLICATION', 'privacy' : '', 'status' : '', 'keywords' : []}; @@ -1261,13 +1261,13 @@ coselmarControllers.controller('ModalSearchQuestionsCtrl', function ($scope, $mo questionsService.getQuestions($scope.searchOptions, function(questions) { $scope.questions = questions; - }); + }, errorService.defaultFailOnCall); $scope.searchQuestions = function(searchKeywords) { $scope.searchOptions = { 'privacy' : '', 'status' : '', 'keywords' : searchKeywords}; questionsService.getQuestions($scope.searchOptions, function(questions) { $scope.questions = questions; - }); + }, errorService.defaultFailOnCall); }; -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository coselmar. See http://git.codelutin.com/coselmar.git commit b4673c37fbcf58d7857465a0a86f6774d3e81b05 Merge: c5572fb 6d1bd05 Author: Yannick Martel <martel@©odelutin.com> Date: Tue Feb 17 18:17:54 2015 +0100 Merge branch 'feature/add-messages' into develop .../persistence/entity/DocumentTopiaDao.java | 2 +- .../services/CoselmarWebServiceSupport.java | 16 ++ .../errors/MailAlreadyExistingException.java | 37 +++ .../ifremer/coselmar/services/v1/ErrorAction.java | 9 + .../coselmar/services/v1/QuestionsWebService.java | 2 +- .../coselmar/services/v1/UsersWebService.java | 15 +- coselmar-rest/src/main/resources/mapping | 5 +- coselmar-ui/pom.xml | 6 + coselmar-ui/src/main/webapp/css/coselmar.css | 65 +++++ coselmar-ui/src/main/webapp/i18n/en.js | 15 + coselmar-ui/src/main/webapp/i18n/fr.js | 16 ++ coselmar-ui/src/main/webapp/index.html | 9 +- .../src/main/webapp/js/coselmar-controllers.js | 308 +++++++++++++++------ .../src/main/webapp/js/coselmar-error-services.js | 67 +++++ .../src/main/webapp/js/coselmar-services.js | 12 +- coselmar-ui/src/main/webapp/js/coselmar.js | 34 +-- .../main/webapp/views/notificationTemplate.html | 16 ++ .../src/main/webapp/views/users/newPassword.html | 9 +- pom.xml | 8 + 19 files changed, 526 insertions(+), 125 deletions(-) -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
participants (1)
-
codelutin.com scm