Dotclear


Ignore:
Timestamp:
06/04/13 22:51:35 (12 years ago)
Author:
Nicolas <nikrou77@…>
Branch:
default
Message:

Remplacement de l'upload utilisant swfupload par le plugin jQuery-File-Upload

Todo:

  • Gestion des suppressions
  • Gestion des annulations
  • Gestion des mises de l'interface sans rechargement de la page
  • Simplification (moins de javascript) ?
File:
1 edited

Legend:

Unmodified
Added
Removed
  • inc/admin/lib.dc.page.php

    r1142 r1144  
    5252     { 
    5353          global $core; 
    54            
     54 
    5555          # List of user's blogs 
    5656          if ($core->auth->blog_count == 1 || $core->auth->blog_count > 20) 
     
    673673     } 
    674674      
    675      public static function jsCandyUpload($params=array(),$base_url=null) 
     675     public static function jsUpload($params=array(),$base_url=null) 
    676676     { 
    677677          if (!$base_url) { 
     
    686686           
    687687          return 
    688           '<link rel="stylesheet" type="text/css" href="style/candyUpload/style.css" />'."\n". 
    689           self::jsLoad('js/jquery/jquery.candyUpload.js'). 
     688          '<link rel="stylesheet" type="text/css" href="style/jsUpload/style.css" />'."\n". 
     689 
     690    '<script id="template-upload" type="text/x-tmpl"> 
     691{% for (var i=0, file; file=o.files[i]; i++) { %} 
     692    <tr class="template-upload fade"> 
     693        <td> 
     694            <span class="preview"></span> 
     695        </td> 
     696        <td> 
     697            <p class="name">{%=file.name%}</p> 
     698            {% if (file.error) { %} 
     699                <div><span class="label label-important">'.__('Error:').'</span> {%=file.error%}</div> 
     700            {% } %} 
     701        </td> 
     702        <td> 
     703            <p class="size">{%=o.formatFileSize(file.size)%}</p> 
     704            {% if (!o.files.error) { %} 
     705                <div class="progress progress-success progress-striped active" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0"><div class="bar" style="width:0%;"></div></div> 
     706            {% } %} 
     707        </td> 
     708        <td> 
     709            {% if (!o.files.error && !i && !o.options.autoUpload) { %} 
     710                <button class="btn btn-primary start"> 
     711                    <i class="icon-upload icon-white"></i> 
     712                    <span>'.__('Send').'</span> 
     713                </button> 
     714            {% } %} 
     715        </td> 
     716    </tr> 
     717{% } %} 
     718</script> 
     719<!-- The template to display files available for download --> 
     720<script id="template-download" type="text/x-tmpl"> 
     721{% for (var i=0, file; file=o.files[i]; i++) { %} 
     722    <tr class="template-download fade"> 
     723        <td> 
     724            <span class="preview"> 
     725                {% if (file.thumbnail_url) { %} 
     726                    <a href="{%=file.url%}" title="{%=file.name%}" data-gallery="gallery" download="{%=file.name%}"><img src="{%=file.thumbnail_url%}"></a> 
     727                {% } %} 
     728            </span> 
     729        </td> 
     730        <td> 
     731            <p class="name">{%=file.name%}</p> 
     732            {% if (file.error) { %} 
     733                <div><span class="label label-important">'.__('Error:').'</span> {%=file.error%}</div> 
     734            {% } %} 
     735        </td> 
     736        <td> 
     737            <span class="size">{%=o.formatFileSize(file.size)%}</span> 
     738        </td> 
     739    </tr> 
     740{% } %} 
     741</script>'. 
     742 
     743          self::jsLoad('js/jsUpload/vendor/jquery.ui.widget.js'). 
     744    self::jsLoad('js/jsUpload/tmpl.js'). 
     745    self::jsLoad('js/jsUpload/load-image.js'). 
     746          self::jsLoad('js/jsUpload/jquery.iframe-transport.js'). 
     747          self::jsLoad('js/jsUpload/jquery.fileupload.js'). 
     748          self::jsLoad('js/jsUpload/jquery.fileupload-process.js'). 
     749          self::jsLoad('js/jsUpload/jquery.fileupload-resize.js'). 
     750          self::jsLoad('js/jsUpload/jquery.fileupload-ui.js'). 
    690751           
    691752          '<script type="text/javascript">'."\n". 
    692753          "//<![CDATA[\n". 
    693           "dotclear.candyUpload = {};\n". 
    694           self::jsVar('dotclear.msg.activate_enhanced_uploader',__('Temporarily activate enhanced uploader')). 
    695           self::jsVar('dotclear.msg.disable_enhanced_uploader',__('Temporarily disable enhanced uploader')). 
    696           self::jsVar('$._candyUpload.prototype.locales.file_uploaded',__('File successfully uploaded.')). 
    697           self::jsVar('$._candyUpload.prototype.locales.max_file_size',__('Maximum file size allowed:')). 
    698           self::jsVar('$._candyUpload.prototype.locales.limit_exceeded',__('Limit exceeded.')). 
    699           self::jsVar('$._candyUpload.prototype.locales.size_limit_exceeded',__('File size exceeds allowed limit.')). 
    700           self::jsVar('$._candyUpload.prototype.locales.canceled',__('Canceled.')). 
    701           self::jsVar('$._candyUpload.prototype.locales.http_error',__('HTTP Error:')). 
    702           self::jsVar('$._candyUpload.prototype.locales.error',__('Error:')). 
    703           self::jsVar('$._candyUpload.prototype.locales.choose_file',__('Choose file')). 
    704           self::jsVar('$._candyUpload.prototype.locales.choose_files',__('Choose files')). 
    705           self::jsVar('$._candyUpload.prototype.locales.cancel',__('Cancel')). 
    706           self::jsVar('$._candyUpload.prototype.locales.clean',__('Clean')). 
    707           self::jsVar('$._candyUpload.prototype.locales.upload',__('Upload')). 
    708           self::jsVar('$._candyUpload.prototype.locales.no_file_in_queue',__('No file in queue.')). 
    709           self::jsVar('$._candyUpload.prototype.locales.file_in_queue',__('1 file in queue.')). 
    710           self::jsVar('$._candyUpload.prototype.locales.files_in_queue',__('%d files in queue.')). 
    711           self::jsVar('$._candyUpload.prototype.locales.queue_error',__('Queue error:')). 
    712           self::jsVar('dotclear.candyUpload.base_url',$base_url). 
    713           self::jsVar('dotclear.candyUpload.movie_url',$base_url.'index.php?pf=swfupload.swf'). 
    714           self::jsVar('dotclear.candyUpload.params',implode('&',$params)). 
     754          "dotclear.jsUpload = {};\n". 
     755          "dotclear.jsUpload.msg = {};\n". 
     756          self::jsVar('dotclear.jsUpload.msg.limit_exceeded',__('Limit exceeded.')). 
     757          self::jsVar('dotclear.jsUpload.msg.size_limit_exceeded',__('File size exceeds allowed limit.')). 
     758          self::jsVar('dotclear.jsUpload.msg.canceled',__('Canceled.')). 
     759          self::jsVar('dotclear.jsUpload.msg.http_error',__('HTTP Error:')). 
     760          self::jsVar('dotclear.jsUpload.msg.error',__('Error:')). 
     761          self::jsVar('dotclear.jsUpload.msg.choose_file',__('Choose file')). 
     762          self::jsVar('dotclear.jsUpload.msg.choose_files',__('Choose files')). 
     763          self::jsVar('dotclear.jsUpload.msg.cancel',__('Cancel')). 
     764          self::jsVar('dotclear.jsUpload.msg.clean',__('Clean')). 
     765          self::jsVar('dotclear.jsUpload.msg.upload',__('Upload')). 
     766          self::jsVar('dotclear.jsUpload.msg.no_file_in_queue',__('No file in queue.')). 
     767          self::jsVar('dotclear.jsUpload.msg.file_in_queue',__('1 file in queue.')). 
     768          self::jsVar('dotclear.jsUpload.msg.files_in_queue',__('%d files in queue.')). 
     769          self::jsVar('dotclear.jsUpload.msg.queue_error',__('Queue error:')). 
     770          self::jsVar('dotclear.jsUpload.base_url',$base_url). 
    715771          "\n//]]>\n". 
    716772          "</script>\n"; 
Note: See TracChangeset for help on using the changeset viewer.

Sites map