DataObjects/Core_event_audit.php
[Pman.Core] / Pman.Download.js
index 93e97d5..6ca8ce4 100644 (file)
@@ -21,8 +21,9 @@ var t = new Pman.Download({
 * @cfg {String} method     GET or POST (default GET), POST will create a form, and post that into the hidden frame.
 * @cfg {Boolean} newWindow (optional) download to new window
 * @cfg {Function} success (optional) MAY fire on download completed (fails on attachments)..
-     
+* @cfg {Number} timeout (optional) in milliseconds before it gives up (default 30000 = 30s)
 */
+
 Pman.Download = function(cfg)
 {
  
@@ -47,23 +48,24 @@ Pman.Download = function(cfg)
     //--- simple method..
     cfg.method = cfg.method || 'GET';
     
-    if (cfg.method == 'GET') {
+    if (cfg.method == 'GET' && !cfg.params) {
         (function() {
             submit = true;
             this.csvFrame.src = cfg.url;
-            this.cleanup.defer(30000,this);
+            this.cleanup.defer(cfg.timeout || 30000,this);
         }).defer(100, this);
         
        
         return;
     }
     
+    
     Roo.log("creating form?");
     
     var b = Roo.get(document.body);
     this.form = b.createChild({
         tag: 'form',
-        method : 'POST',
+        method : cfg.method,
         action : cfg.url,
         target : this.csvFrame.id,
         enctype : 'multipart/form-data'
@@ -89,7 +91,7 @@ Pman.Download = function(cfg)
     (function() {
         submit = true;
         this.form.dom.submit();
-        this.cleanup.defer(30000,this);
+        this.cleanup.defer(cfg.timeout || 30000,this);
     }).defer(100, this);