allow caller to pass in a pre-built edit dialog
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Sun, 1 Mar 2009 18:46:32 +0000 (18:46 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Sun, 1 Mar 2009 18:46:32 +0000 (18:46 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@12332 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/web/js/dojo/openils/widget/EditDialog.js

index 68f8434..7033c0b 100644 (file)
@@ -26,19 +26,21 @@ if(!dojo._hasResource['openils.widget.EditDialog']) {
             editPane : null, // reference to our EditPane object
 
             constructor : function(args) {
-                this.editPane = new openils.widget.EditPane(args);
+                args = args || {};
+                this.editPane = args.editPane || new openils.widget.EditPane(args);
                 var self = this;
 
+                var onCancel = args.onCancel || this.editPane.onCancel;
+                var onSubmit = args.onSubmit || this.editPane.onSubmit;
+
                 this.editPane.onCancel = function() { 
-                    if(args.onCancel)
-                        args.onCancel();
+                    if(onCancel) onCancel();
                     self.hide(); 
                 }
 
                 this.editPane.onPostSubmit = function(r) { 
                     self.hide(); 
-                    if(args.onPostSubmit)
-                        args.onPostSubmit(r);
+                    if(onSubmit) onSubmit(r);
                 }
             },