torsten@472: /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz torsten@472: * Software engineering by Intevation GmbH torsten@472: * torsten@472: * This file is Free Software under the GNU GPL (v>=3) torsten@472: * and comes with ABSOLUTELY NO WARRANTY! Check out torsten@472: * the documentation coming with IMIS-Labordaten-Application for details. torsten@472: */ torsten@472: torsten@310: /** torsten@310: * Base class for models torsten@310: */ torsten@310: Ext.define('Lada.model.Base', { torsten@310: extend: 'Ext.data.Model', raimund@491: torsten@310: requires: ['Lada.lib.Helpers'], raimund@491: torsten@310: /** 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: */ raimund@488: getAuthInfo: function(cb, probeId) { raimund@488: if (!probeId) { raimund@488: probeId = this.data.probeId; raimund@488: } torsten@359: Ext.Ajax.request({ torsten@359: scope: this, raimund@488: url: 'server/rest/authinfo/' + probeId, torsten@359: success: function(response, opts) { raimund@488: var obj = Ext.decode(response.responseText).data; torsten@359: cb(this, obj.readonly, obj.isOwner); torsten@359: }, torsten@359: failure: function(response, opts) { raimund@491: console.log('server-side failure with status code ' + raimund@491: response.status); torsten@359: cb(this, true, false); torsten@359: } torsten@359: }); torsten@310: } torsten@310: });