Ignore:
Timestamp:
05/04/12 18:00:28 (12 years ago)
Author:
gustavo
Message:

Ticket #2676 - Falha ao anexar arquivo no expresso mail

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/prototype/plugins/fileupload/jquery.iframe-transport.js

    r5341 r6107  
    11/* 
    2  * jQuery Iframe Transport Plugin 1.2.2 
     2 * jQuery Iframe Transport Plugin 1.4 
    33 * https://github.com/blueimp/jQuery-File-Upload 
    44 * 
     
    77 * 
    88 * Licensed under the MIT license: 
    9  * http://creativecommons.org/licenses/MIT/ 
     9 * http://www.opensource.org/licenses/MIT 
    1010 */ 
    1111 
    12 /*jslint unparam: true */ 
    13 /*global jQuery */ 
     12/*jslint unparam: true, nomen: true */ 
     13/*global define, window, document */ 
    1414 
    15 (function ($) { 
     15(function (factory) { 
     16    'use strict'; 
     17    if (typeof define === 'function' && define.amd) { 
     18        // Register as an anonymous AMD module: 
     19        define(['jquery'], factory); 
     20    } else { 
     21        // Browser globals: 
     22        factory(window.jQuery); 
     23    } 
     24}(function ($) { 
    1625    'use strict'; 
    1726 
     
    2231    // options.fileInput: a jQuery collection of file input fields 
    2332    // options.paramName: the parameter name for the file form data, 
    24     //  overrides the name property of the file input field(s) 
     33    //  overrides the name property of the file input field(s), 
     34    //  can be a string or an array of strings. 
    2535    // options.formData: an array of objects with name and value properties, 
    2636    //  equivalent to the return data of .serializeArray(), e.g.: 
    27     //  [{name: a, value: 1}, {name: b, value: 2}] 
    28     $.ajaxTransport('iframe', function (options, originalOptions, jqXHR) { 
    29         if (options.type === 'POST' || options.type === 'GET') { 
     37    //  [{name: 'a', value: 1}, {name: 'b', value: 2}] 
     38    $.ajaxTransport('iframe', function (options) { 
     39        if (options.async && (options.type === 'POST' || options.type === 'GET')) { 
    3040            var form, 
    3141                iframe; 
    3242            return { 
    33                 send: function (headers, completeCallback) { 
     43                send: function (_, completeCallback) { 
    3444                    form = $('<form style="display:none;"></form>'); 
    3545                    // javascript:false as initial iframe src 
     
    4252                            (counter += 1) + '"></iframe>' 
    4353                    ).bind('load', function () { 
    44                         var fileInputClones; 
     54                        var fileInputClones, 
     55                            paramNames = $.isArray(options.paramName) ? 
     56                                    options.paramName : [options.paramName]; 
    4557                        iframe 
    4658                            .unbind('load') 
     
    93105                            }); 
    94106                            if (options.paramName) { 
    95                                 options.fileInput.each(function () { 
    96                                     $(this).prop('name', options.paramName); 
     107                                options.fileInput.each(function (index) { 
     108                                    $(this).prop( 
     109                                        'name', 
     110                                        paramNames[index] || options.paramName 
     111                                    ); 
    97112                                }); 
    98113                            } 
     
    116131                        } 
    117132                    }); 
    118                     form.append(iframe).appendTo('body'); 
     133                    form.append(iframe).appendTo(document.body); 
    119134                }, 
    120135                abort: function () { 
     
    140155        converters: { 
    141156            'iframe text': function (iframe) { 
    142                 return iframe.text(); 
     157                return $(iframe[0].body).text(); 
    143158            }, 
    144159            'iframe json': function (iframe) { 
    145                 return $.parseJSON(iframe.text()); 
     160                return $.parseJSON($(iframe[0].body).text()); 
    146161            }, 
    147162            'iframe html': function (iframe) { 
    148                 return iframe.find('body').html(); 
     163                return $(iframe[0].body).html(); 
    149164            }, 
    150165            'iframe script': function (iframe) { 
    151                 return $.globalEval(iframe.text()); 
     166                return $.globalEval($(iframe[0].body).text()); 
    152167            } 
    153168        } 
    154169    }); 
    155170 
    156 }(jQuery)); 
     171})); 
Note: See TracChangeset for help on using the changeset viewer.