torsten@310: /** torsten@310: * Base class for models torsten@310: */ torsten@310: Ext.define('Lada.model.Base', { torsten@310: extend: 'Ext.data.Model', torsten@310: requires: ['Lada.lib.Helpers'], torsten@310: /** torsten@310: * Helper function to build an ID which is used in the proxy calls. This torsten@310: * function is a workaround for torsten@310: * https://roundup-intern.intevation.de/bfs/issue30 torsten@310: * as some items can not be identified with a singe id. torsten@310: */ torsten@310: getEidi: function() { rrenkert@385: return "/" + this.idProperty; torsten@359: }, torsten@359: /** torsten@359: * Helper function to make a AJAX request against the authinfo interface torsten@359: * of the server torsten@359: * @param callback function(model, readonly, isowner) torsten@359: * @private torsten@359: */ torsten@359: getAuthInfo: function(cb) { torsten@359: Ext.Ajax.request({ torsten@359: scope: this, torsten@359: url: 'server/rest/authinfo/' + this.data.probeId, torsten@359: success: function(response, opts) { torsten@359: var obj = Ext.decode(Ext.decode(response.responseText).data); torsten@359: cb(this, obj.readonly, obj.isOwner); torsten@359: }, torsten@359: failure: function(response, opts) { torsten@359: console.log('server-side failure with status code ' + response.status); torsten@359: cb(this, true, false); torsten@359: } torsten@359: }); torsten@310: } torsten@310: });