You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by il...@apache.org on 2016/05/13 15:02:49 UTC

syncope git commit: [SYNCOPE-783] date and time fields management added in Syncope-enduser - this closes #17

Repository: syncope
Updated Branches:
  refs/heads/master fa7def88f -> af21e8010


[SYNCOPE-783] date and time fields management added in Syncope-enduser - this closes #17


Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/af21e801
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/af21e801
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/af21e801

Branch: refs/heads/master
Commit: af21e80106538f12c0c0ed2e2b94bf3344823f9c
Parents: fa7def8
Author: Matteo Di Carlo <ma...@tirasa.net>
Authored: Fri May 13 12:38:09 2016 +0200
Committer: Francesco Chicchiricc� <il...@apache.org>
Committed: Fri May 13 17:02:38 2016 +0200

----------------------------------------------------------------------
 .../console/rest/AbstractAnyRestClient.java     |  2 -
 client/enduser/pom.xml                          |  8 ---
 .../client/enduser/SyncopeEnduserSession.java   | 52 ++++++++-------
 .../enduser/resources/SchemaResource.java       |  4 --
 .../enduser/resources/UserSelfReadResource.java | 37 +++++++----
 .../resources/UserSelfUpdateResource.java       | 44 ++++++++-----
 .../META-INF/resources/app/css/editUser.css     | 21 ++++++
 .../resources/META-INF/resources/app/index.html |  2 -
 .../app/js/directives/dynamicPlainAttribute.js  | 69 ++++++++++++--------
 .../app/views/dynamicPlainAttribute.html        | 43 ++++++++----
 deb/enduser/LICENSE                             |  9 ---
 deb/enduser/NOTICE                              | 10 ---
 pom.xml                                         | 17 -----
 standalone/LICENSE                              | 10 ---
 standalone/NOTICE                               | 10 ---
 15 files changed, 174 insertions(+), 164 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/af21e801/client/console/src/main/java/org/apache/syncope/client/console/rest/AbstractAnyRestClient.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/rest/AbstractAnyRestClient.java b/client/console/src/main/java/org/apache/syncope/client/console/rest/AbstractAnyRestClient.java
index 231a909..e0ea1eb 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/rest/AbstractAnyRestClient.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/rest/AbstractAnyRestClient.java
@@ -18,8 +18,6 @@
  */
 package org.apache.syncope.client.console.rest;
 
-import static org.apache.syncope.client.console.rest.BaseRestClient.getService;
-
 import java.util.List;
 import javax.ws.rs.core.GenericType;
 import javax.ws.rs.core.Response;

http://git-wip-us.apache.org/repos/asf/syncope/blob/af21e801/client/enduser/pom.xml
----------------------------------------------------------------------
diff --git a/client/enduser/pom.xml b/client/enduser/pom.xml
index 21aa1aa..2195248 100644
--- a/client/enduser/pom.xml
+++ b/client/enduser/pom.xml
@@ -142,14 +142,6 @@ under the License.
       <groupId>org.webjars.bower</groupId>
       <artifactId>FileSaver.js</artifactId>
     </dependency>
-    <dependency>
-      <groupId>org.webjars.npm</groupId>
-      <artifactId>moment</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.webjars.npm</groupId>
-      <artifactId>moment-jdateformatparser</artifactId>
-    </dependency>
 
     <!--Jquery-->
     <dependency>

http://git-wip-us.apache.org/repos/asf/syncope/blob/af21e801/client/enduser/src/main/java/org/apache/syncope/client/enduser/SyncopeEnduserSession.java
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/java/org/apache/syncope/client/enduser/SyncopeEnduserSession.java b/client/enduser/src/main/java/org/apache/syncope/client/enduser/SyncopeEnduserSession.java
index ed05718..74cf6b3 100644
--- a/client/enduser/src/main/java/org/apache/syncope/client/enduser/SyncopeEnduserSession.java
+++ b/client/enduser/src/main/java/org/apache/syncope/client/enduser/SyncopeEnduserSession.java
@@ -19,18 +19,25 @@
 package org.apache.syncope.client.enduser;
 
 import java.text.DateFormat;
+import java.util.List;
 import java.util.Locale;
 import java.util.Map;
 import java.util.Set;
 import javax.ws.rs.core.EntityTag;
 import javax.ws.rs.core.MediaType;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.Predicate;
 import org.apache.commons.lang3.tuple.Pair;
 import org.apache.cxf.jaxrs.client.WebClient;
 import org.apache.syncope.client.lib.SyncopeClient;
-import org.apache.syncope.client.lib.SyncopeClientFactoryBean;
 import org.apache.syncope.common.lib.SyncopeConstants;
 import org.apache.syncope.common.lib.info.PlatformInfo;
+import org.apache.syncope.common.lib.to.PlainSchemaTO;
 import org.apache.syncope.common.lib.to.UserTO;
+import org.apache.syncope.common.lib.types.AttrSchemaType;
+import org.apache.syncope.common.lib.types.SchemaType;
+import org.apache.syncope.common.rest.api.beans.SchemaQuery;
+import org.apache.syncope.common.rest.api.service.SchemaService;
 import org.apache.syncope.common.rest.api.service.SyncopeService;
 import org.apache.wicket.Session;
 import org.apache.wicket.protocol.http.WebSession;
@@ -58,6 +65,8 @@ public class SyncopeEnduserSession extends WebSession {
 
     private final PlatformInfo platformInfo;
 
+    private final List<PlainSchemaTO> datePlainSchemas;
+
     private UserTO selfTO;
 
     private final CookieUtils cookieUtils;
@@ -77,6 +86,16 @@ public class SyncopeEnduserSession extends WebSession {
                 SyncopeEnduserApplication.get().getAnonymousUser(),
                 SyncopeEnduserApplication.get().getAnonymousKey());
         platformInfo = anonymousClient.getService(SyncopeService.class).platform();
+
+        datePlainSchemas = anonymousClient.getService(SchemaService.class).
+                list(new SchemaQuery.Builder().type(SchemaType.PLAIN).build());
+        CollectionUtils.filter(datePlainSchemas, new Predicate<PlainSchemaTO>() {
+
+            @Override
+            public boolean evaluate(final PlainSchemaTO object) {
+                return object.getType() == AttrSchemaType.Date;
+            }
+        });
     }
 
     public boolean authenticate(final String username, final String password) {
@@ -102,14 +121,10 @@ public class SyncopeEnduserSession extends WebSession {
         return authenticated;
     }
 
-    public <T> void resetClient(final Class<T> service) {
-        T serviceInstance = getService(service);
-        WebClient.client(serviceInstance).reset();
-    }
-
     public <T> T getService(final Class<T> serviceClass) {
-        return (client == null || !isAuthenticated()) ? anonymousClient.getService(serviceClass) : client.
-                getService(serviceClass);
+        return (client == null || !isAuthenticated())
+                ? anonymousClient.getService(serviceClass)
+                : client.getService(serviceClass);
     }
 
     public <T> T getService(final String etag, final Class<T> serviceClass) {
@@ -120,23 +135,6 @@ public class SyncopeEnduserSession extends WebSession {
         return serviceInstance;
     }
 
-    public <T> T getService(final MediaType mediaType, final Class<T> serviceClass) {
-        T service;
-
-        synchronized (SyncopeEnduserApplication.get().getClientFactory()) {
-            SyncopeClientFactoryBean.ContentType preType = SyncopeEnduserApplication.get().getClientFactory().
-                    getContentType();
-
-            SyncopeEnduserApplication.get().getClientFactory().
-                    setContentType(SyncopeClientFactoryBean.ContentType.fromString(mediaType.toString()));
-            service = SyncopeEnduserApplication.get().getClientFactory().
-                    create(username, password).getService(serviceClass);
-            SyncopeEnduserApplication.get().getClientFactory().setContentType(preType);
-        }
-
-        return service;
-    }
-
     public String getUsername() {
         return username;
     }
@@ -149,6 +147,10 @@ public class SyncopeEnduserSession extends WebSession {
         return platformInfo;
     }
 
+    public List<PlainSchemaTO> getDatePlainSchemas() {
+        return datePlainSchemas;
+    }
+
     public UserTO getSelfTO() {
         return selfTO;
     }

http://git-wip-us.apache.org/repos/asf/syncope/blob/af21e801/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/SchemaResource.java
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/SchemaResource.java b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/SchemaResource.java
index 3b32d05..a46e953 100644
--- a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/SchemaResource.java
+++ b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/SchemaResource.java
@@ -36,13 +36,9 @@ import org.apache.syncope.common.rest.api.service.AnyTypeService;
 import org.apache.syncope.common.rest.api.service.SchemaService;
 import org.apache.wicket.request.resource.AbstractResource;
 import org.apache.wicket.request.resource.IResource;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 public class SchemaResource extends AbstractBaseResource {
 
-    private static final Logger LOG = LoggerFactory.getLogger(SchemaResource.class);
-
     private static final long serialVersionUID = 6453101466981543020L;
 
     private final AnyTypeService anyTypeService;

http://git-wip-us.apache.org/repos/asf/syncope/blob/af21e801/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfReadResource.java
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfReadResource.java b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfReadResource.java
index 2411adf..b609118 100644
--- a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfReadResource.java
+++ b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfReadResource.java
@@ -19,27 +19,24 @@
 package org.apache.syncope.client.enduser.resources;
 
 import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
 import javax.servlet.http.HttpServletRequest;
 import javax.ws.rs.core.Response;
+import org.apache.commons.lang3.SerializationUtils;
+import org.apache.commons.lang3.time.FastDateFormat;
 import org.apache.syncope.client.enduser.SyncopeEnduserSession;
+import org.apache.syncope.common.lib.to.AttrTO;
+import org.apache.syncope.common.lib.to.PlainSchemaTO;
+import org.apache.syncope.common.lib.to.UserTO;
 import org.apache.wicket.request.resource.AbstractResource;
 import org.apache.wicket.request.resource.IResource;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 public class UserSelfReadResource extends AbstractBaseResource {
 
     private static final long serialVersionUID = -9184809392631523912L;
 
-    /**
-     * Logger.
-     */
-    private static final Logger LOG = LoggerFactory.getLogger(UserSelfReadResource.class);
-
-    public UserSelfReadResource() {
-    
-    }
-
     @Override
     protected ResourceResponse newResourceResponse(final IResource.Attributes attributes) {
 
@@ -55,8 +52,24 @@ public class UserSelfReadResource extends AbstractBaseResource {
                 return response;
             }
 
-            final String selfTOJson = MAPPER.writeValueAsString(SyncopeEnduserSession.get().getSelfTO());
+            UserTO userTO = SerializationUtils.clone(SyncopeEnduserSession.get().getSelfTO());
+            Map<String, AttrTO> userPlainAttrMap = userTO.getPlainAttrMap();
+
+            for (PlainSchemaTO plainSchema : SyncopeEnduserSession.get().getDatePlainSchemas()) {
+                if (userPlainAttrMap.containsKey(plainSchema.getKey())) {
+                    FastDateFormat fmt = FastDateFormat.getInstance(plainSchema.getConversionPattern());
+
+                    AttrTO dateAttr = userPlainAttrMap.get(plainSchema.getKey());
+                    List<String> milliValues = new ArrayList<>(dateAttr.getValues().size());
+                    for (String value : dateAttr.getValues()) {
+                        milliValues.add(String.valueOf(fmt.parse(value).getTime()));
+                    }
+                    dateAttr.getValues().clear();
+                    dateAttr.getValues().addAll(milliValues);
+                }
+            }
 
+            final String selfTOJson = MAPPER.writeValueAsString(userTO);
             response.setWriteCallback(new WriteCallback() {
 
                 @Override

http://git-wip-us.apache.org/repos/asf/syncope/blob/af21e801/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfUpdateResource.java
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfUpdateResource.java b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfUpdateResource.java
index 04c89af..119b697 100644
--- a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfUpdateResource.java
+++ b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfUpdateResource.java
@@ -19,29 +19,25 @@
 package org.apache.syncope.client.enduser.resources;
 
 import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
 import javax.servlet.http.HttpServletRequest;
 import javax.ws.rs.core.Response;
+import org.apache.commons.lang3.time.FastDateFormat;
 import org.apache.syncope.client.enduser.SyncopeEnduserConstants;
 import org.apache.syncope.client.enduser.SyncopeEnduserSession;
+import org.apache.syncope.common.lib.to.AttrTO;
+import org.apache.syncope.common.lib.to.PlainSchemaTO;
 import org.apache.syncope.common.lib.to.UserTO;
 import org.apache.syncope.common.rest.api.service.UserSelfService;
 import org.apache.wicket.request.resource.AbstractResource;
 import org.apache.wicket.request.resource.IResource;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 public class UserSelfUpdateResource extends AbstractBaseResource {
 
     private static final long serialVersionUID = -2721621682300247583L;
 
-    private static final Logger LOG = LoggerFactory.getLogger(UserSelfUpdateResource.class);
-
-    private final UserSelfService userSelfService;
-
-    public UserSelfUpdateResource() {
-        userSelfService = SyncopeEnduserSession.get().getService(UserSelfService.class);
-    }
-
     @Override
     protected ResourceResponse newResourceResponse(final IResource.Attributes attributes) {
         AbstractResource.ResourceResponse response = new AbstractResource.ResourceResponse();
@@ -54,10 +50,6 @@ public class UserSelfUpdateResource extends AbstractBaseResource {
                 return response;
             }
 
-            String jsonString = request.getReader().readLine();
-
-            final UserTO userTO = MAPPER.readValue(jsonString, UserTO.class);
-
             if (!captchaCheck(
                     request.getHeader("captcha"),
                     request.getSession().getAttribute(SyncopeEnduserConstants.CAPTCHA_SESSION_KEY))) {
@@ -65,10 +57,32 @@ public class UserSelfUpdateResource extends AbstractBaseResource {
                 throw new IllegalArgumentException("Entered captcha is not matching");
             }
 
+            UserTO userTO = MAPPER.readValue(request.getReader().readLine(), UserTO.class);
             LOG.debug("User {} id self-updating", userTO.getUsername());
 
+            Map<String, AttrTO> userPlainAttrMap = userTO.getPlainAttrMap();
+
+            for (PlainSchemaTO plainSchema : SyncopeEnduserSession.get().getDatePlainSchemas()) {
+                if (userPlainAttrMap.containsKey(plainSchema.getKey())) {
+                    FastDateFormat fmt = FastDateFormat.getInstance(plainSchema.getConversionPattern());
+
+                    AttrTO dateAttr = userPlainAttrMap.get(plainSchema.getKey());
+                    List<String> formattedValues = new ArrayList<>(dateAttr.getValues().size());
+                    for (String value : dateAttr.getValues()) {
+                        try {
+                            formattedValues.add(fmt.format(Long.valueOf(value)));
+                        } catch (NumberFormatException e) {
+                            throw new IllegalArgumentException("Invalid format value for " + value);
+                        }
+                    }
+                    dateAttr.getValues().clear();
+                    dateAttr.getValues().addAll(formattedValues);
+                }
+            }
+
             // update user
-            Response res = userSelfService.update(userTO);
+            Response res = SyncopeEnduserSession.get().
+                    getService(userTO.getETagValue(), UserSelfService.class).update(userTO);
 
             final String responseMessage = res.getStatusInfo().getFamily().equals(Response.Status.Family.SUCCESSFUL)
                     ? new StringBuilder().

http://git-wip-us.apache.org/repos/asf/syncope/blob/af21e801/client/enduser/src/main/resources/META-INF/resources/app/css/editUser.css
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/resources/META-INF/resources/app/css/editUser.css b/client/enduser/src/main/resources/META-INF/resources/app/css/editUser.css
index 878b2c9..16bb79c 100644
--- a/client/enduser/src/main/resources/META-INF/resources/app/css/editUser.css
+++ b/client/enduser/src/main/resources/META-INF/resources/app/css/editUser.css
@@ -162,6 +162,27 @@ under the License.
   animation:slideOutLeft 0.5s both ease;   
 }
 
+
+#datetime{
+  line-height: 34px;
+  float: left;
+  margin-top:35px;
+  padding: 0 3px 0px 0px;
+  display: inline-block !important;
+}
+
+#date{
+  position: relative;
+  display: table; 
+  border-collapse: separate;
+}
+
+#timepicker{
+  line-height: 34px; 
+  float: left; 
+  padding: 0 3px 0px 0px;
+}
+
 /** Button breadcrumb **/
 .btn-breadcrumb .btn:not(:last-child):after {
   content: " ";

http://git-wip-us.apache.org/repos/asf/syncope/blob/af21e801/client/enduser/src/main/resources/META-INF/resources/app/index.html
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/resources/META-INF/resources/app/index.html b/client/enduser/src/main/resources/META-INF/resources/app/index.html
index 022105b..d191570 100644
--- a/client/enduser/src/main/resources/META-INF/resources/app/index.html
+++ b/client/enduser/src/main/resources/META-INF/resources/app/index.html
@@ -77,8 +77,6 @@ under the License.
     <script type="text/javascript" src="../webjars/bootstrap-select/${bootstrap-select.version}/js/bootstrap-select.min.js"></script>
     <script src="../webjars/FileSaver.js/${fileSaver.version}/FileSaver.js"></script>
     <script src="../webjars/lodash/${lodash.version}/lodash.min.js"></script>
-    <script src="../webjars/moment/${momentjs.version}/moment.js"></script>
-    <script src="../webjars/moment-jdateformatparser/${moment-jdateformatparser.version}/moment-jdateformatparser.js"></script>
     <!--main angular application-->
     <script src="js/app.js"></script>
     <!--services-->

http://git-wip-us.apache.org/repos/asf/syncope/blob/af21e801/client/enduser/src/main/resources/META-INF/resources/app/js/directives/dynamicPlainAttribute.js
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/resources/META-INF/resources/app/js/directives/dynamicPlainAttribute.js b/client/enduser/src/main/resources/META-INF/resources/app/js/directives/dynamicPlainAttribute.js
index ee533d3..7d09286 100644
--- a/client/enduser/src/main/resources/META-INF/resources/app/js/directives/dynamicPlainAttribute.js
+++ b/client/enduser/src/main/resources/META-INF/resources/app/js/directives/dynamicPlainAttribute.js
@@ -16,6 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
+
 'use strict';
 
 angular.module('self')
@@ -34,8 +35,8 @@ angular.module('self')
                 switch (schema.type) {
                   case "Long":
                   case "Double":
-                    $scope.user.plainAttrs[schema.key].values[index] = Number($scope.user.plainAttrs[schema.key].values[index])
-                            || undefined;
+                    $scope.user.plainAttrs[schema.key].values[index] = Number($scope.user.plainAttrs[schema.key]
+                            .values[index]) || undefined;
                     break;
                   case "Enum":
                     $scope.enumerationValues = [];
@@ -49,9 +50,6 @@ angular.module('self')
                   case "Binary":
 
                     $scope.userFile = $scope.userFile || '';
-                    //for multivalue fields 
-//                    $scope.fileInputId = "fileInputId_" + index;
-
                     $element.bind("change", function (changeEvent) {
                       $scope.$apply(function () {
                         var reader = new FileReader();
@@ -84,25 +82,28 @@ angular.module('self')
                       $("#fileInput").replaceWith($("#fileInput").clone(true));
                     };
                     break;
+
                   case "Date":
-                    $scope.format = $scope.schema.conversionPattern;
-                    var temporaryDate = moment($scope.user.plainAttrs[schema.key].values[index], moment().toMomentFormatString($scope.format));
-                    if(temporaryDate.isValid()){
-                      $scope.selectedDate = temporaryDate.toDate();  
+                    var dateInMs = $scope.user.plainAttrs[schema.key].values[index];
+                    console.debug("received date in milliseconds", dateInMs);
+                    if (dateInMs) {
+                      var temporaryDate = new Date(dateInMs * 1);
+                      console.debug("date-time", temporaryDate);
+                      $scope.selectedDate = temporaryDate;
+                      $scope.selectedTime = temporaryDate;
                     }
-                    else{
-                      $scope.selectedDate = $scope.user.plainAttrs[schema.key].values[index];
-                    }                    
-                    $scope.includeTimezone = false;
-
-                    $scope.bindDateToModel = function (selectedDate, format) {                                       
-                      if (selectedDate) {
-                        selectedDate = moment(selectedDate).format(moment().toMomentFormatString(format));
-                        //removing from selectedDate existing quotes, since moment doesn't remove the from the pattern
-                        var dateGood = selectedDate.toString().replace(/'/g, "");
-                        $scope.user.plainAttrs[schema.key].values[index] = dateGood;
-                      } else {
-                        $scope.user.plainAttrs[schema.key].values[index] = selectedDate;                        
+
+                    $scope.bindDateToModel = function (selectedDate, selectedTime) {
+                      if (selectedDate && selectedTime) {
+                        var extractedDate = selectedDate.toString().substring(0, 15);
+                        console.debug("selectedDate: ", extractedDate);
+                        var extractedTime = selectedTime.toString().substring(16);
+                        console.debug("selectedTime: ", extractedTime);
+                        var resultDate = extractedDate + ' ' + extractedTime;
+                        var tmpdate = new Date(resultDate);
+                        var milliseconds = tmpdate.getTime();
+                        console.debug("resultDate in milliseconds", milliseconds);
+                        $scope.user.plainAttrs[schema.key].values[index] = milliseconds;
                       }
                     };
 
@@ -124,11 +125,11 @@ angular.module('self')
                     $scope.maxDate = new Date(2050, 5, 22);
 
                     $scope.open = function ($event) {
-                      $scope.status.opened = true;                      
+                      $scope.status.opened = true;
                     };
 
                     $scope.setDate = function (year, month, day) {
-                      $scope.user.plainAttrs[schema.key].values[index] = new Date(year, month, day);                      
+                      $scope.user.plainAttrs[schema.key].values[index] = new Date(year, month, day);
                     };
 
                     $scope.dateOptions = {
@@ -168,12 +169,27 @@ angular.module('self')
                         }
                       }
 
-                    };                    
+                    };
+
+                    //TIME PICKER
+                    $scope.selectedTime = $scope.selectedDate;
+                    $scope.hstep = 1;
+                    $scope.mstep = 1;
+
+                    $scope.options = {
+                      hstep: [1, 2, 3],
+                      mstep: [1, 5, 10, 15, 25, 30]
+                    };
+
+                    $scope.ismeridian = true;
+                    $scope.toggleMode = function () {
+                      $scope.ismeridian = !$scope.ismeridian;
+                    };
                     break;
 
                   case "Boolean":
                     $scope.user.plainAttrs[schema.key].values[index] =
-                           $scope.user.plainAttrs[schema.key].values[index] == "true" ? true : false;
+                            $scope.user.plainAttrs[schema.key].values[index] == "true" ? true : false;
                     break;
 
                 }
@@ -188,6 +204,5 @@ angular.module('self')
                         });
               });
             },
-            //replace: true
           };
         });

http://git-wip-us.apache.org/repos/asf/syncope/blob/af21e801/client/enduser/src/main/resources/META-INF/resources/app/views/dynamicPlainAttribute.html
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/resources/META-INF/resources/app/views/dynamicPlainAttribute.html b/client/enduser/src/main/resources/META-INF/resources/app/views/dynamicPlainAttribute.html
index b3ffa7b..d278730 100644
--- a/client/enduser/src/main/resources/META-INF/resources/app/views/dynamicPlainAttribute.html
+++ b/client/enduser/src/main/resources/META-INF/resources/app/views/dynamicPlainAttribute.html
@@ -16,6 +16,7 @@ KIND, either express or implied.  See the License for the
 specific language governing permissions and limitations
 under the License.
 -->
+
 <div ng-switch="schema.type" >
   <input ng-switch-when="String" class="form-control" type="text"
          ng-model="user.plainAttrs[schema.key].values[index]"
@@ -36,29 +37,45 @@ under the License.
   <input ng-switch-when="Double" class="form-control" type="number" ng-model="user.plainAttrs[schema.key].values[index]"
          ng-required="{{schema.mandatoryCondition}}" validate="true"
          ng-init="initAttribute(schema, index)" name="{{schema.key}}"/>
-  <p ng-switch-when="Date" class="input-group" >
-    <input type="text" class="form-control" 
-           uib-datepicker-popup
-           ng-model="selectedDate"
-           ng-change="bindDateToModel(selectedDate, format)"
-           min-date="minDate" max-date="maxDate"
-           is-open="status.opened" datepicker-options="dateOptions"
-           ng-required="{{schema.mandatoryCondition}}" close-text="Close" ng-init="initAttribute(schema, index)"/>
-    <span class="input-group-btn">
-      <button type="button" class="btn btn-default" ng-click="open($event)"><i class="glyphicon glyphicon-calendar"></i></button>
+
+  <div ng-switch-when="Date" id="date">
+    <span id="datetime">
+      <input type="text" class="form-control" 
+             uib-datepicker-popup
+             ng-model="selectedDate"
+             ng-change="bindDateToModel(selectedDate, selectedTime)"
+             min-date="minDate" max-date="maxDate"
+             is-open="status.opened" datepicker-options="dateOptions"
+             ng-required="{{schema.mandatoryCondition}}" close-text="Close"
+             ng-init="initAttribute(schema, index)"/>
+    </span>
+    <span>
+      <button type="button" class="btn btn-default" style="margin-top:35px;" ng-click="open($event)" >
+        <i class="glyphicon glyphicon-calendar"></i>
+      </button>
+    </span>
+    <span id="timepicker" ng-if="(schema.conversionPattern.indexOf('H') > -1 ||
+                schema.conversionPattern.indexOf('h') > -1)">
+      <uib-timepicker ng-model="selectedTime" 
+                      ng-change="bindDateToModel(selectedDate, selectedTime)"
+                      hour-step="hstep" minute-step="mstep" show-meridian="ismeridian">
+      </uib-timepicker>
     </span>
-  </p>
+  </div>
 
   <div ng-switch-when="Enum" ng-init="initAttribute(schema, index)">
     <select class="form-control"
             ng-model="user.plainAttrs[schema.key].values[index]"
             ng-required="{{schema.mandatoryCondition}}">
-      <option ng-repeat="value in enumerationValues" value="{{value}}">{{schema.enumerationKeys[$index]|| value}}</option>
+      <option ng-repeat="value in enumerationValues" value="{{value}}">
+        {{schema.enumerationKeys[$index]|| value}}
+      </option>
     </select>
   </div>
 
   <div ng-switch-when="Binary" ng-init="initAttribute(schema, index)">
-    <div enctype="multipart/form-data" accept-charset="UTF-8">
+    <!--<div enctype="multipart/form-data" accept-charset="UTF-8">-->
+    <div >
       <input id="fileInput" type="file" ng-required="{{schema.mandatoryCondition}}"/>
       <button type="button" title="Download file" class="fileButton btn btn-default btn-sm" ng-click="download()">
         <i class="glyphicon glyphicon-download" ></i>

http://git-wip-us.apache.org/repos/asf/syncope/blob/af21e801/deb/enduser/LICENSE
----------------------------------------------------------------------
diff --git a/deb/enduser/LICENSE b/deb/enduser/LICENSE
index 6a00321..e30e921 100644
--- a/deb/enduser/LICENSE
+++ b/deb/enduser/LICENSE
@@ -763,15 +763,6 @@ This is licensed under the MIT license, see above.
 
 ==
 
-For Moment.js (http://momentjs.com/):
-This is licensed under the MIT license, see above.
-
-==
-
-For moment-jdateformatparser (https://github.com/MadMG/moment-jdateformatparser):
-This is licensed under the MIT license, see above.
-
-==
 
 For Web Services Description Language for Java (http://wsdl4j.sourceforge.net/):
 This is licensed under the CPL:

http://git-wip-us.apache.org/repos/asf/syncope/blob/af21e801/deb/enduser/NOTICE
----------------------------------------------------------------------
diff --git a/deb/enduser/NOTICE b/deb/enduser/NOTICE
index 99a7f22..0b62425 100644
--- a/deb/enduser/NOTICE
+++ b/deb/enduser/NOTICE
@@ -134,16 +134,6 @@ Copyright (c) 2012-2015 Kevin Brown, Igor Vaynberg, and Select2 contributors
 
 ==
 
-This product includes software developed by the Moment.js project.
-Copyright (c) 2011-2016 Tim Wood, Iskren Chernev, Moment.js contributors
-
-==
-
-This product includes software developed by the moment-jdateformatparser project.
-Copyright (c) 2013 MadMG
-
-==
-
 This product includes software developed by the Web Services Description Language for Java project.
 Copyright (c) Dice.
 All Rights Reserved.

http://git-wip-us.apache.org/repos/asf/syncope/blob/af21e801/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 2e87e14..41c27e6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -409,8 +409,6 @@ under the License.
     <kendo-ui-core.version>2014.2.716</kendo-ui-core.version>
     <select2.version>3.4.8</select2.version>
     <fileSaver.version>0.0.2</fileSaver.version>
-    <momentjs.version>2.12.0</momentjs.version>
-    <moment-jdateformatparser.version>1.0.0</moment-jdateformatparser.version>
     
     <izpack.version>5.0.8</izpack.version>
     <httpclient.version>4.3.6</httpclient.version>
@@ -985,10 +983,6 @@ under the License.
           </exclusion>
           <exclusion>
             <groupId>org.webjars</groupId>
-            <artifactId>momentjs</artifactId>
-          </exclusion>
-          <exclusion>
-            <groupId>org.webjars</groupId>
             <artifactId>Eonasdan-bootstrap-datetimepicker</artifactId>
           </exclusion>
         </exclusions>
@@ -1219,17 +1213,6 @@ under the License.
         <version>${fileSaver.version}</version>
       </dependency>
       <dependency>
-        <groupId>org.webjars.npm</groupId>
-        <artifactId>moment</artifactId>
-        <version>${momentjs.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.webjars.npm</groupId>
-        <artifactId>moment-jdateformatparser</artifactId>
-        <version>${moment-jdateformatparser.version}</version>
-      </dependency>
-
-      <dependency>
         <groupId>com.beust</groupId>
         <artifactId>jcommander</artifactId>
         <version>1.48</version>

http://git-wip-us.apache.org/repos/asf/syncope/blob/af21e801/standalone/LICENSE
----------------------------------------------------------------------
diff --git a/standalone/LICENSE b/standalone/LICENSE
index a143104..746fb50 100644
--- a/standalone/LICENSE
+++ b/standalone/LICENSE
@@ -1117,16 +1117,6 @@ This is licensed under the MIT license, see above.
 
 ==
 
-For Moment.js (http://momentjs.com/):
-This is licensed under the MIT license, see above.
-
-==
-
-For moment-jdateformatparser (https://github.com/MadMG/moment-jdateformatparser):
-This is licensed under the MIT license, see above.
-
-==
-
 For SnakeYAML (http://www.snakeyaml.org/):
 This is licensed under the AL 2.0, see above.
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/af21e801/standalone/NOTICE
----------------------------------------------------------------------
diff --git a/standalone/NOTICE b/standalone/NOTICE
index 03762ef..5d9afb6 100644
--- a/standalone/NOTICE
+++ b/standalone/NOTICE
@@ -252,16 +252,6 @@ Copyright (c) 2012-2015 Kevin Brown, Igor Vaynberg, and Select2 contributors
 
 ==
 
-This product includes software developed by the Moment.js project.
-Copyright (c) 2011-2016 Tim Wood, Iskren Chernev, Moment.js contributors
-
-==
-
-This product includes software developed by the moment-jdateformatparser project.
-Copyright (c) 2013 MadMG
-
-==
-
 This product includes software developed by the SnakeYAML project.
 
 ==