Changeset 6555 in spip-zone


Ignore:
Timestamp:
Oct 23, 2006, 3:37:48 PM (13 years ago)
Author:
renato@…
Message:

different types of upload forms can be used on the same page;
send uploaded content to iframe as html and not xml

Location:
_plugins_/_dev_/_ze_laboratoire_/async_upload
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • _plugins_/_dev_/_ze_laboratoire_/async_upload/async_upload.js

    r6507 r6555  
    11// JavaScript Document
     2jQuery.async_upload_count = 0;
    23jQuery.fn.async_upload = function(add_function) {
    34  return this.submit(function(){
     
    56  });
    67 
    7   var iframe;
    88  function do_async_upload(form) {
     9    jQuery.async_upload_count++;
     10    var num = jQuery.async_upload_count;
    911    var jForm = $(form);
    1012    var par = $(jForm).parent();
     
    1416      form.async_init = true
    1517      jForm
    16       .attr("target","upload_frame")
     18      .attr("target","upload_frame"+num)
    1719      .append("<input type='hidden' name='iframe' value='iframe'>")
    1820      .find("input[@name='redirect']")
     
    2123    }
    2224 
    23     if (!iframe) {
    24       iframe = $("<iframe id='upload_frame' name='upload_frame' frameborder='0' marginwidth='0' marginheight='0' scrolling='yes' style='position:absolute' onload='this.iframeload()'></iframe>")
     25    if (!form.jFrame) {
     26      form.jFrame = $("<iframe id='upload_frame"+num+"' name='upload_frame"+num+"' frameborder='0' marginwidth='0' marginheight='0' scrolling='yes' style='position:absolute' onload='this.iframeload()'></iframe>")
    2527      .appendTo("body");
    2628    }
    2729   
    2830    //IE apparently do not write anything in an iframe onload event handler
    29     iframe[0].iframeload = function() {
     31    form.jFrame[0].iframeload = function() {
    3032        //remove the previous message
    3133        $("div.upload_message",par).remove();
    32         var res = $(".upload_answer",this.contentDocument || document.frames("upload_frame").document.body);
     34        var res = $(".upload_answer",this.contentDocument || document.frames(this.name).document.body);
    3335        //possible classes
    3436        //upload_document_added
  • _plugins_/_dev_/_ze_laboratoire_/async_upload/exec/iconifier.php

    r6522 r6555  
    5454        if(_request("iframe")=="iframe") {
    5555    $ret = "<div class='upload_answer upload_document_added'>$ret</div>";
     56    echo $ret;
     57    die;
    5658  }
    5759  ajax_retour($ret);
Note: See TracChangeset for help on using the changeset viewer.