annotate app/model/Base.js @ 480:3ef95496cd28

Added more files to the ignore file
author Torsten Irländer <torsten.irlaender@intevation.de>
date Tue, 21 Jan 2014 17:00:25 +0100
parents debfcc7713e3
children f7446ebfe5d0
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 /**
aeeb0f534411 Added Base model class
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
16 * Helper function to build an ID which is used in the proxy calls. This
aeeb0f534411 Added Base model class
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
17 * function is a workaround for
aeeb0f534411 Added Base model class
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
18 * https://roundup-intern.intevation.de/bfs/issue30
aeeb0f534411 Added Base model class
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
19 * as some items can not be identified with a singe id.
aeeb0f534411 Added Base model class
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
20 */
aeeb0f534411 Added Base model class
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
21 getEidi: function() {
385
08bb418f31c9 Use 'this' reference for idProperty in model.
Raimund Renkert <rrenkert@intevation.de>
parents: 359
diff changeset
22 return "/" + this.idProperty;
359
8bc067b5f9c5 Added helper function to get authorisation information for the current item.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 324
diff changeset
23 },
8bc067b5f9c5 Added helper function to get authorisation information for the current item.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 324
diff changeset
24 /**
8bc067b5f9c5 Added helper function to get authorisation information for the current item.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 324
diff changeset
25 * 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
26 * 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
27 * @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
28 * @private
8bc067b5f9c5 Added helper function to get authorisation information for the current item.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 324
diff changeset
29 */
8bc067b5f9c5 Added helper function to get authorisation information for the current item.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 324
diff changeset
30 getAuthInfo: function(cb) {
8bc067b5f9c5 Added helper function to get authorisation information for the current item.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 324
diff changeset
31 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
32 scope: this,
8bc067b5f9c5 Added helper function to get authorisation information for the current item.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 324
diff changeset
33 url: 'server/rest/authinfo/' + this.data.probeId,
8bc067b5f9c5 Added helper function to get authorisation information for the current item.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 324
diff changeset
34 success: 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
35 var obj = Ext.decode(Ext.decode(response.responseText).data);
8bc067b5f9c5 Added helper function to get authorisation information for the current item.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 324
diff changeset
36 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
37 },
8bc067b5f9c5 Added helper function to get authorisation information for the current item.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 324
diff changeset
38 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
39 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
40 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
41 }
8bc067b5f9c5 Added helper function to get authorisation information for the current item.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 324
diff changeset
42 });
310
aeeb0f534411 Added Base model class
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
43 }
aeeb0f534411 Added Base model class
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
44 });

http://lada.wald.intevation.org