Mercurial > lada > lada-client
changeset 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 | a8da0a5bacf9 |
children | b400629a2575 |
files | app.js app/controller/form/Messung.js app/view/form/Messung.js |
diffstat | 3 files changed, 19 insertions(+), 3 deletions(-) [+] |
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' });
--- a/app/controller/form/Messung.js Wed Apr 08 12:45:37 2015 +0200 +++ b/app/controller/form/Messung.js Wed Apr 08 15:28:25 2015 +0200 @@ -104,7 +104,10 @@ else { form.owner.down('button[action=save]').setDisabled(true); form.owner.down('button[action=discard]').setDisabled(true); - form.owner.up('window').enableChildren(); + //Only enable children if the form was not readOnly + if (!form.getRecord().get('readonly')) { + form.owner.up('window').enableChildren(); + } } } });
--- a/app/view/form/Messung.js Wed Apr 08 12:45:37 2015 +0200 +++ b/app/view/form/Messung.js Wed Apr 08 15:28:25 2015 +0200 @@ -172,5 +172,9 @@ this.down('datetime[name=messzeitpunkt]').setReadOnly(value); this.down('numberfield[name=messdauer]').setReadOnly(value); this.down('chkbox[name=geplant]').setReadOnly(value); + if (!this.getForm().getRecord().get('owner')) { + //Only set this Field to Readonly when the User is NOT the Owner of the Record. + this.down('chkbox[name=fertig]').setReadOnly(value); + } } });