diff app.js @ 715:605bc34b45a0

Disable the Fertig-Flag Checkbox in a Messung when the User is not the owner. Do not enable Form-Children when readonly is set to true. Parse login-response in app.js
author Dustin Demuth <dustin@intevation.de>
date Wed, 08 Apr 2015 15:28:25 +0200
parents 60a3e9809ea4
children b400629a2575
line wrap: on
line diff
--- a/app.js	Wed Apr 08 12:45:37 2015 +0200
+++ b/app.js	Wed Apr 08 15:28:25 2015 +0200
@@ -19,6 +19,10 @@
     // references!
     name: 'Lada',
 
+    username: '',
+    userroles: '',
+    logintime: '',
+
     // Setting up translations. This is done using a ext-plgin which can be
     // found on https://github.com/elmasse/Ext.i18n.Bundle
     requires: [
@@ -98,13 +102,18 @@
                 'Es konnte keine erfolgreiche Verbindung zum lada server aufgebaut werden.');
     },
 
-    onLoginSuccess: function() {
+    onLoginSuccess: function(response) {
         /* Strip out the openid query params to look nicers. */
         window.history.pushState(this.name, this.name, window.location.pathname);
 
         Ext.create('Lada.view.Viewport');
 
-        /* Todo maybe parse username and such from login service response */
+        /* Parse Username and Timestamp */
+        var json = Ext.decode(response.responseText);
+        this.username = json.data.username;
+        this.userroles = json.data.roles;
+        this.logintime = json.data.servertime;
+
         Ext.create('Lada.store.Datenbasis', {
             storeId: 'datenbasis'
         });

http://lada.wald.intevation.org