dustin@920: /* Copyrighte(C) 2015 by Bundesamt fuer Strahlenschutz
andre@608:  * Software engineering by Intevation GmbH
andre@608:  *
andre@608:  * This file is Free Software under the GNU GPL (v>=3)
andre@608:  * and comes with ABSOLUTELY NO WARRANTY! Check out
andre@608:  * the documentation coming with IMIS-Labordaten-Application for details.
andre@608:  */
andre@608: 
andre@608: Ext.define('Lada.override.RestProxy', {
andre@608:     override: 'Ext.data.proxy.Rest',
raimund@913: /*
andre@608:     buildRequest: function (operation) {
andre@608:         this.headers = { 'X-OPENID-PARAMS': Lada.openIDParams };
andre@608:         return this.callParent(arguments);
andre@608:     },
rrenkert@917: */
andre@608:     processResponse: function (success, operation, request, response, callback, scope) {
dustin@920:         /*
dustin@920:            SSO will send a 302 if the Client is not authenticated
dustin@920:            unfortunately this seems to be filtered by the browser.
dustin@920:            We assume that a 302 was send when the follwing statement
dustin@920:            is true.
dustin@920:         */
dustin@920:         if (!success && response.status == 0 && response.responseText === "") {
dustin@920:             Ext.MessageBox.confirm('Erneutes Login erforderlich',
dustin@920:                 'Ihre Session ist abgelaufen.<br/>'+
dustin@920:                 'Für ein erneutes Login muss die Anwendung neu geladen werden.<br/>' +
dustin@920:                 'Alle ungesicherten Daten gehen dabei verloren.<br/>' +
dustin@920:                 'Soll die Anwendung jetzt neu geladen werden?', this.reload);
dustin@920:         }
dustin@920:         this.callParent(arguments);
dustin@920:     },
andre@608: 
dustin@920: 
dustin@920:     parseStatus: function(status) {
dustin@920:         console.log(status);
andre@608:         this.callParent(arguments);
andre@618:     },
rrenkert@917: 
andre@618:     reload: function(btn) {
andre@618:         if (btn === 'yes') {
andre@618:             location.reload();
andre@618:         }
andre@608:     }
andre@608: });