Tinebase/js/editDialog - added exceptionHandlingMap
authorPaul Mehrer <p.mehrer@metaways.de>
Tue, 28 Jun 2016 13:34:44 +0000 (15:34 +0200)
committerPhilipp Schüle <p.schuele@metaways.de>
Tue, 5 Jul 2016 13:44:43 +0000 (15:44 +0200)
concrete editDialogs can now provide an exceptionHandlingMap
containing callbacks for specific exception codes
the generic editDialog now calls these callbacks if provided

Change-Id: Ib94ab1d0d8c8e2d338f7e4975a51db0d3b902d62
Reviewed-on: http://gerrit.tine20.com/customers/3307
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
Tested-by: Philipp Schüle <p.schuele@metaways.de>
tine20/Tinebase/js/widgets/dialog/EditDialog.js

index e7f4820..ee7b06d 100644 (file)
@@ -1113,12 +1113,17 @@ Tine.widgets.dialog.EditDialog = Ext.extend(Ext.FormPanel, {
      */
     onRequestFailed: function(exception) {
         this.saving = false;
-        
-        if (exception.code == 629) {
+
+        if (this.exceptionHandlingMap && this.exceptionHandlingMap[exception.code] && typeof this.exceptionHandlingMap[exception.code] === 'function') {
+            this.exceptionHandlingMap[exception.code](exception);
+
+        } else if (exception.code == 629) {
             this.onDuplicateException.apply(this, arguments);
+
         } else {
             Tine.Tinebase.ExceptionHandler.handleRequestException(exception);
         }
+
         this.loadMask.hide();
     },