comparison 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
comparison
equal deleted inserted replaced
487:a05cbc6e63cb 488:f7446ebfe5d0
11 */ 11 */
12 Ext.define('Lada.model.Base', { 12 Ext.define('Lada.model.Base', {
13 extend: 'Ext.data.Model', 13 extend: 'Ext.data.Model',
14 requires: ['Lada.lib.Helpers'], 14 requires: ['Lada.lib.Helpers'],
15 /** 15 /**
16 * Helper function to build an ID which is used in the proxy calls. This
17 * function is a workaround for
18 * https://roundup-intern.intevation.de/bfs/issue30
19 * as some items can not be identified with a singe id.
20 */
21 getEidi: function() {
22 return "/" + this.idProperty;
23 },
24 /**
25 * Helper function to make a AJAX request against the authinfo interface 16 * Helper function to make a AJAX request against the authinfo interface
26 * of the server 17 * of the server
27 * @param callback function(model, readonly, isowner) 18 * @param callback function(model, readonly, isowner)
28 * @private 19 * @private
29 */ 20 */
30 getAuthInfo: function(cb) { 21 getAuthInfo: function(cb, probeId) {
22 if (!probeId) {
23 probeId = this.data.probeId;
24 }
31 Ext.Ajax.request({ 25 Ext.Ajax.request({
32 scope: this, 26 scope: this,
33 url: 'server/rest/authinfo/' + this.data.probeId, 27 url: 'server/rest/authinfo/' + probeId,
34 success: function(response, opts) { 28 success: function(response, opts) {
35 var obj = Ext.decode(Ext.decode(response.responseText).data); 29 var obj = Ext.decode(response.responseText).data;
36 cb(this, obj.readonly, obj.isOwner); 30 cb(this, obj.readonly, obj.isOwner);
37 }, 31 },
38 failure: function(response, opts) { 32 failure: function(response, opts) {
39 console.log('server-side failure with status code ' + response.status); 33 console.log('server-side failure with status code ' + response.status);
40 cb(this, true, false); 34 cb(this, true, false);

http://lada.wald.intevation.org