annotate app/model/Base.js @ 488:f7446ebfe5d0

Added and updated models.
author Raimund Renkert <raimund.renkert@intevation.de>
date Fri, 31 Oct 2014 21:10:35 +0100
parents debfcc7713e3
children 850ccfe5f3c4
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',
aeeb0f534411 Added Base model class
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
14 requires: ['Lada.lib.Helpers'],
aeeb0f534411 Added Base model class
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
15 /**
359
8bc067b5f9c5 Added helper function to get authorisation information for the current item.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 324
diff changeset
16 * 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
17 * 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
18 * @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
19 * @private
8bc067b5f9c5 Added helper function to get authorisation information for the current item.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 324
diff changeset
20 */
488
f7446ebfe5d0 Added and updated models.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 472
diff changeset
21 getAuthInfo: function(cb, probeId) {
f7446ebfe5d0 Added and updated models.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 472
diff changeset
22 if (!probeId) {
f7446ebfe5d0 Added and updated models.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 472
diff changeset
23 probeId = this.data.probeId;
f7446ebfe5d0 Added and updated models.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 472
diff changeset
24 }
359
8bc067b5f9c5 Added helper function to get authorisation information for the current item.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 324
diff changeset
25 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
26 scope: this,
488
f7446ebfe5d0 Added and updated models.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 472
diff changeset
27 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
28 success: function(response, opts) {
488
f7446ebfe5d0 Added and updated models.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 472
diff changeset
29 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
30 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
31 },
8bc067b5f9c5 Added helper function to get authorisation information for the current item.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 324
diff changeset
32 failure: function(response, opts) {
8bc067b5f9c5 Added helper function to get authorisation information for the current item.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 324
diff changeset
33 console.log('server-side failure with status code ' + response.status);
8bc067b5f9c5 Added helper function to get authorisation information for the current item.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 324
diff changeset
34 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
35 }
8bc067b5f9c5 Added helper function to get authorisation information for the current item.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 324
diff changeset
36 });
310
aeeb0f534411 Added Base model class
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
37 }
aeeb0f534411 Added Base model class
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
38 });

http://lada.wald.intevation.org