Mercurial > lada > lada-client
annotate app/model/Base.js @ 492:fbcf6ef3b6f6
Added missing model for verwaltungseinheit.
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Sat, 01 Nov 2014 13:12:16 +0100 |
parents | 850ccfe5f3c4 |
children |
rev | line source |
---|---|
472
debfcc7713e3
Added license header to each file.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
385
diff
changeset
|
1 /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz |
debfcc7713e3
Added license header to each file.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
385
diff
changeset
|
2 * Software engineering by Intevation GmbH |
debfcc7713e3
Added license header to each file.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
385
diff
changeset
|
3 * |
debfcc7713e3
Added license header to each file.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
385
diff
changeset
|
4 * This file is Free Software under the GNU GPL (v>=3) |
debfcc7713e3
Added license header to each file.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
385
diff
changeset
|
5 * and comes with ABSOLUTELY NO WARRANTY! Check out |
debfcc7713e3
Added license header to each file.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
385
diff
changeset
|
6 * the documentation coming with IMIS-Labordaten-Application for details. |
debfcc7713e3
Added license header to each file.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
385
diff
changeset
|
7 */ |
debfcc7713e3
Added license header to each file.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
385
diff
changeset
|
8 |
310
aeeb0f534411
Added Base model class
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
9 /** |
aeeb0f534411
Added Base model class
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
10 * Base class for models |
aeeb0f534411
Added Base model class
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
11 */ |
aeeb0f534411
Added Base model class
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
12 Ext.define('Lada.model.Base', { |
aeeb0f534411
Added Base model class
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
13 extend: 'Ext.data.Model', |
491
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
488
diff
changeset
|
14 |
310
aeeb0f534411
Added Base model class
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
15 requires: ['Lada.lib.Helpers'], |
491
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
488
diff
changeset
|
16 |
310
aeeb0f534411
Added Base model class
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
17 /** |
359
8bc067b5f9c5
Added helper function to get authorisation information for the current item.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
324
diff
changeset
|
18 * Helper function to make a AJAX request against the authinfo interface |
8bc067b5f9c5
Added helper function to get authorisation information for the current item.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
324
diff
changeset
|
19 * of the server |
8bc067b5f9c5
Added helper function to get authorisation information for the current item.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
324
diff
changeset
|
20 * @param callback function(model, readonly, isowner) |
8bc067b5f9c5
Added helper function to get authorisation information for the current item.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
324
diff
changeset
|
21 * @private |
8bc067b5f9c5
Added helper function to get authorisation information for the current item.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
324
diff
changeset
|
22 */ |
488
f7446ebfe5d0
Added and updated models.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
472
diff
changeset
|
23 getAuthInfo: function(cb, probeId) { |
f7446ebfe5d0
Added and updated models.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
472
diff
changeset
|
24 if (!probeId) { |
f7446ebfe5d0
Added and updated models.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
472
diff
changeset
|
25 probeId = this.data.probeId; |
f7446ebfe5d0
Added and updated models.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
472
diff
changeset
|
26 } |
359
8bc067b5f9c5
Added helper function to get authorisation information for the current item.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
324
diff
changeset
|
27 Ext.Ajax.request({ |
8bc067b5f9c5
Added helper function to get authorisation information for the current item.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
324
diff
changeset
|
28 scope: this, |
488
f7446ebfe5d0
Added and updated models.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
472
diff
changeset
|
29 url: 'server/rest/authinfo/' + probeId, |
359
8bc067b5f9c5
Added helper function to get authorisation information for the current item.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
324
diff
changeset
|
30 success: function(response, opts) { |
488
f7446ebfe5d0
Added and updated models.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
472
diff
changeset
|
31 var obj = Ext.decode(response.responseText).data; |
359
8bc067b5f9c5
Added helper function to get authorisation information for the current item.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
324
diff
changeset
|
32 cb(this, obj.readonly, obj.isOwner); |
8bc067b5f9c5
Added helper function to get authorisation information for the current item.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
324
diff
changeset
|
33 }, |
8bc067b5f9c5
Added helper function to get authorisation information for the current item.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
324
diff
changeset
|
34 failure: function(response, opts) { |
491
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
488
diff
changeset
|
35 console.log('server-side failure with status code ' + |
850ccfe5f3c4
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
488
diff
changeset
|
36 response.status); |
359
8bc067b5f9c5
Added helper function to get authorisation information for the current item.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
324
diff
changeset
|
37 cb(this, true, false); |
8bc067b5f9c5
Added helper function to get authorisation information for the current item.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
324
diff
changeset
|
38 } |
8bc067b5f9c5
Added helper function to get authorisation information for the current item.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
324
diff
changeset
|
39 }); |
310
aeeb0f534411
Added Base model class
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
40 } |
aeeb0f534411
Added Base model class
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
41 }); |