comparison app/view/window/DeleteProbe.js @ 920:f220ba587c89

Adopted Client to SSO, detect a Sessiontimeout and reload the application
author Dustin Demuth <dustin@intevation.de>
date Fri, 14 Aug 2015 13:27:50 +0200
parents 8054232535ba
children f73ca04d73a7
comparison
equal deleted inserted replaced
919:c8599a543f03 920:f220ba587c89
51 51
52 Ext.Ajax.request({ 52 Ext.Ajax.request({
53 //TODO Use correct URLs 53 //TODO Use correct URLs
54 url: 'lada-server/probe/'+me.record.get('id'), 54 url: 'lada-server/probe/'+me.record.get('id'),
55 method: 'DELETE', 55 method: 'DELETE',
56 headers: {
57 'X-OPENID-PARAMS': Lada.openIDParams
58 },
59 success: function(response) { 56 success: function(response) {
60 var json = Ext.JSON.decode(response.responseText); 57 var json = Ext.JSON.decode(response.responseText);
61 if (json.success && json.message === '200') { 58 if (json.success && json.message === '200') {
62 Ext.Msg.show({ 59 Ext.Msg.show({
63 title: i18n.getMsg('success'), 60 title: i18n.getMsg('success'),
86 } 83 }
87 if (json) { 84 if (json) {
88 if(json.errors.totalCount > 0 || json.warnings.totalCount > 0){ 85 if(json.errors.totalCount > 0 || json.warnings.totalCount > 0){
89 formPanel.setMessages(json.errors, json.warnings); 86 formPanel.setMessages(json.errors, json.warnings);
90 } 87 }
91 // TODO Move this handling of 699 and 698 to a more central place! 88 /*
92 // TODO i18n 89 SSO will send a 302 if the Client is not authenticated
93 if (json.message === "699" || json.message === "698") { 90 unfortunately this seems to be filtered by the browser.
94 /* This is the unauthorized message with the authentication 91 We assume that a 302 was send when the follwing statement
95 * redirect in the data */ 92 is true.
96 93 */
97 /* We decided to handle this with a redirect to the identity 94 if (response.status == 0 && response.responseText === "") {
98 * provider. In which case we have no other option then to
99 * handle it here with relaunch. */
100 Ext.MessageBox.confirm('Erneutes Login erforderlich', 95 Ext.MessageBox.confirm('Erneutes Login erforderlich',
101 'Der Server konnte die Anfrage nicht authentifizieren.<br/>'+ 96 'Ihre Session ist abgelaufen.<br/>'+
102 'Für ein erneutes Login muss die Anwendung neu geladen werden.<br/>' + 97 'Für ein erneutes Login muss die Anwendung neu geladen werden.<br/>' +
103 'Alle ungesicherten Daten gehen dabei verloren.<br/>' + 98 'Alle ungesicherten Daten gehen dabei verloren.<br/>' +
104 'Soll die Anwendung jetzt neu geladen werden?', me.reload); 99 'Soll die Anwendung jetzt neu geladen werden?', this.reload);
105 } 100 }
106 else if(json.message){ 101 // further error handling
102 if(json.message){
107 Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.generic.title') 103 Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.generic.title')
108 +' #'+json.message, 104 +' #'+json.message,
109 Lada.getApplication().bundle.getMsg(json.message)); 105 Lada.getApplication().bundle.getMsg(json.message));
110 } else { 106 } else {
111 Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.generic.title'), 107 Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.generic.title'),

http://lada.wald.intevation.org