@@ -368,6 +368,45 @@ define([
368
368
return url ;
369
369
} ,
370
370
371
+ /**
372
+ * Builds the form with fields containing the and submits
373
+ *
374
+ * @param {String } url
375
+ * @param {String } varName
376
+ * @param {String } varValue
377
+ * @private
378
+ */
379
+ _buildFormAndSubmit : function ( url , varName , varValue ) {
380
+ var re = new RegExp ( '\/(' + varName + '\/.*?\/)' ) ,
381
+ parts = url . split ( new RegExp ( '\\?' ) ) ,
382
+ form = jQuery ( '<form/>' ) ,
383
+ inputProps = [
384
+ { name : varName , value : varValue } ,
385
+ { name : 'form_key' , value : window . FORM_KEY }
386
+ ] ,
387
+ input ;
388
+
389
+ url = parts [ 0 ] . replace ( re , '/' ) ;
390
+
391
+ if ( parts . size ( ) > 1 ) {
392
+ url += '?' + parts [ 1 ] ;
393
+ }
394
+
395
+ form . attr ( 'action' , url ) ;
396
+ form . attr ( 'method' , 'POST' ) ;
397
+
398
+ inputProps . forEach ( function ( item ) {
399
+ input = jQuery ( '<input/>' ) ;
400
+ input . attr ( 'name' , item . name ) ;
401
+ input . attr ( 'type' , 'hidden' ) ;
402
+ input . val ( item . value ) ;
403
+ form . append ( input ) ;
404
+ } ) ;
405
+ jQuery ( '[data-container="body"]' ) . append ( form ) ;
406
+ form . submit ( ) ;
407
+ form . remove ( ) ;
408
+ } ,
409
+
371
410
/**
372
411
* @param {* } varName
373
412
* @param {* } varValue
@@ -389,13 +428,14 @@ define([
389
428
exportUrl = $ ( this . containerId + '_export' ) . value ;
390
429
391
430
if ( this . massaction && this . massaction . checkedString ) {
392
- exportUrl = this . _addVarToUrl (
431
+ this . _buildFormAndSubmit (
393
432
exportUrl ,
394
433
this . massaction . formFieldNameInternal ,
395
434
this . massaction . checkedString
396
435
) ;
436
+ } else {
437
+ location . href = exportUrl ;
397
438
}
398
- location . href = exportUrl ;
399
439
}
400
440
} ,
401
441
0 commit comments