Changeset 5848 for trunk


Ignore:
Timestamp:
Apr 14, 2010, 4:08:19 PM (14 years ago)
Author:
plg
Message:

feature 1601: improve error feedback on multiple upload : use jGrowl jQuery
plugin to display individual state for each uploaded file.

Location:
trunk
Files:
2 added
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/themes/default/template/photos_add_direct.tpl

    r5744 r5848  
    11{known_script id="jquery" src=$ROOT_URL|@cat:"themes/default/js/jquery.packed.js"}
     2{known_script id="jquery.jgrowl" src=$ROOT_URL|@cat:"themes/default/js/plugins/jquery.jgrowl_minimized.js"}
    23
    34{if $upload_mode eq 'multiple'}
     
    56<script type="text/javascript" src="{$uploadify_path}/jquery.uploadify.v2.1.0.min.js"></script>
    67{/if}
     8
     9<link rel="stylesheet" type="text/css" href="{$ROOT_URL}admin/themes/default/uploadify.jGrowl.css">
    710
    811{literal}
     
    106109        $("input[name=submit_upload]").click();
    107110      }
     111    },
     112    onError: function (event, queueID ,fileObj, errorObj) {
     113      var msg;
     114      if (errorObj.status == 404) {
     115        alert('Could not find upload script.');
     116        msg = 'Could not find upload script.';
     117      }
     118      else if (errorObj.type === "HTTP") {
     119        msg = errorObj.type+": "+errorObj.status;
     120      }
     121      else if (errorObj.type ==="File Size") {
     122        msg = fileObj.name+'<br>'+errorObj.type+' Limit: '+Math.round(errorObj.sizeLimit/1024)+'KB';
     123      }
     124      else {
     125        msg = errorObj.type+": "+errorObj.text;
     126      }
     127
     128      $.jGrowl(
     129        '<p></p>'+msg,
     130        {
     131          theme:  'error',
     132          header: 'ERROR',
     133          sticky: true
     134        }
     135      );
     136
     137      $("#fileUploadgrowl" + queueID).fadeOut(
     138        250,
     139        function() {
     140          $("#fileUploadgrowl" + queueID).remove()
     141        }
     142      );
     143      return false;
     144    },
     145    onCancel: function (a, b, c, d) {
     146      var msg = "Cancelled uploading: "+c.name;
     147      $.jGrowl(
     148        '<p></p>'+msg,
     149        {
     150          theme:  'warning',
     151          header: 'Cancelled Upload',
     152          life:   4000,
     153          sticky: false
     154        }
     155      );
     156    },
     157    onClearQueue: function (a, b) {
     158      var msg = "Cleared "+b.fileCount+" files from queue";
     159      $.jGrowl(
     160        '<p></p>'+msg,
     161        {
     162          theme:  'warning',
     163          header: 'Cleared Queue',
     164          life:   4000,
     165          sticky: false
     166        }
     167      );
     168    },
     169    onComplete: function (a, b ,c, d, e) {
     170      var size = Math.round(c.size/1024);
     171      $.jGrowl(
     172        '<p></p>'+c.name+' - '+size+'KB',
     173        {
     174          theme:  'success',
     175          header: 'Upload Complete',
     176          life:   4000,
     177          sticky: false
     178        }
     179      );
    108180    }
    109181  });
Note: See TracChangeset for help on using the changeset viewer.