[ Index ]

PHP Cross Reference of phpwcms V1.5.0 _r431 (28.01.12)

title

Body

[close]

/include/inc_tmpl/ -> files.multipleupload.tmpl.php (source)

   1  <?php
   2  /*************************************************************************************
   3     Copyright notice
   4     
   5     (c) 2002-2012 Oliver Georgi <oliver@phpwcms.de> // All rights reserved.
   6   
   7     This script is part of PHPWCMS. The PHPWCMS web content management system is
   8     free software; you can redistribute it and/or modify it under the terms of
   9     the GNU General Public License as published by the Free Software Foundation;
  10     either version 2 of the License, or (at your option) any later version.
  11    
  12     The GNU General Public License can be found at http://www.gnu.org/copyleft/gpl.html
  13     A copy is found in the textfile GPL.txt and important notices to the license 
  14     from the author is found in LICENSE.txt distributed with these scripts.
  15    
  16     This script is distributed in the hope that it will be useful, but WITHOUT ANY 
  17     WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
  18     PARTICULAR PURPOSE.  See the GNU General Public License for more details.
  19   
  20     This copyright notice MUST APPEAR in all copies of the script!
  21  *************************************************************************************/
  22  
  23  // ----------------------------------------------------------------
  24  // obligate check for phpwcms constants
  25  if (!defined('PHPWCMS_ROOT')) {
  26     die("You Cannot Access This Script Directly, Have a Nice Day.");
  27  }
  28  // ----------------------------------------------------------------
  29  
  30  
  31  // initialize Mootools
  32  initMultipleUpload();
  33  
  34  ?>
  35  <h1 class="title" id="swiffStore"><?php echo $BL['be_file_multiple_upload'] ?></h1>
  36  
  37  <form action="<?php echo PHPWCMS_URL?>include/inc_act/ajax_uploader.php?<?php echo session_name().'='.session_id(); ?>" method="post" enctype="multipart/form-data" id="upload-form">
  38  
  39  <table border="0" cellpadding="0" cellspacing="0" summary="" class="width440 tdbottom10">
  40  <tr>
  41      <td>
  42  
  43      <div id="upload-buttons" style="display:none;">
  44          <p>
  45              <a href="#" id="upload-browse" class="grey_button"><?php echo $BL['be_files_browse']; ?></a>
  46              <a href="#" id="upload-clear" class="grey_button"><?php echo $BL['fancyupload_clear_list'] ?></a>
  47              <a href="#" id="upload-start" class="grey_button"><?php echo $BL['be_files_upload']; ?></a>
  48          </p>
  49          <div class="upload-title">
  50              <strong class="overall-title">&nbsp;</strong><br /><img src="img/ajax/bar.gif" class="progress overall-progress" alt="" />
  51          </div>
  52          <div class="upload-title">
  53              <strong class="current-title">&nbsp;</strong><br /><img src="img/ajax/bar.gif" class="progress current-progress" alt="" />
  54          </div>
  55          <div class="current-text"></div>
  56      </div>
  57      <ul class="upload-queue" id="upload-queue"><li style="display:none">&nbsp;</li></ul>
  58      
  59      </td>
  60      </tr>
  61  </table>
  62  
  63  <div id="upload-fallback">
  64      this text should not be shown...
  65      <input type="file" name="Filedata" />
  66  </div>
  67  </form>
  68  <script type="text/javascript">
  69  window.addEvent('domready', function(){
  70  
  71      var up = new FancyUpload2( $('upload-buttons'), $('upload-queue'), {
  72                                       
  73          verbose: true,
  74          path: '<?php echo PHPWCMS_URL; ?>include/inc_js/mootools/FancyUpload/Swiff.Uploader.swf',
  75          url: $('upload-form').action,
  76          typeFilter: {
  77              '<?php echo $BL['be_ctype_images']; ?> (*.jpg, *.jpeg, *.gif, *.png)': '*.jpg; *.jpeg; *.gif; *.png;',
  78              '<?php echo $BL['be_ftptakeover_all']; ?> (*.*)': '*.*;'
  79              },
  80          target: 'upload-browse',
  81          fileSizeMax: <?php echo $phpwcms['file_maxsize']; ?>,
  82          onLoad: function() {
  83              $('upload-buttons').style.display = 'block';
  84              $('upload-fallback').destroy();
  85              
  86              this.target.addEvents({
  87                  click: function() {
  88                      return false;
  89                  },
  90                  mouseenter: function() {
  91                      this.addClass('hover');
  92                  },
  93                  mouseleave: function() {
  94                      this.removeClass('hover');
  95                      this.blur();
  96                  },
  97                  mousedown: function() {
  98                      this.focus();
  99                  }
 100              });
 101              
 102              $('upload-clear').addEvent('click', function() {
 103                  up.remove();
 104                  return false;
 105              });
 106  
 107              $('upload-start').addEvent('click', function() {
 108                  up.start(); 
 109                  return false;
 110              });
 111          },
 112  
 113          onSelectFail: function(files) {
 114              files.each(function(file) {
 115                  new Element('li', {
 116                      'class': 'validation-error',
 117                      html: file.validationErrorMessage || file.validationError,
 118                      title: MooTools.lang.get('FancyUpload', 'removeTitle'),
 119                      events: {
 120                          click: function() {
 121                              this.destroy();
 122                          }
 123                      }
 124                  }).inject(this.list, 'top');
 125              }, this);
 126          },
 127  
 128          onFileSuccess: function(file, response) {
 129              var json = new Hash(JSON.decode(response, true) || {});
 130              
 131              if (json.get('status') == '1') {
 132                  file.element.addClass('file-success');
 133                  file.info.set('html', '<strong><?php echo $BL['fancyupload_file_uploaded'] ?><'+'/strong>');
 134              } else {
 135                  file.element.addClass('file-failed');
 136                  file.info.set('html', '<strong><?php echo $BL['fancyupload_file_error'] ?>:<'+'/strong> ' + (json.get('error') ? (json.get('error') + ' (' + json.get('code') + ')') : response));
 137              }
 138          },
 139      
 140          
 141          /**
 142           * onFail is called when the Flash movie got bashed by some browser plugin
 143           * like Adblock or Flashblock.
 144           */
 145          onFail: function(error) {
 146              switch (error) {
 147                  case 'hidden': // works after enabling the movie and clicking refresh
 148                      alert('<?php echo $BL['fancyupload_adblock_error'] ?>');
 149                      break;
 150                  case 'blocked': // This no *full* fail, it works after the user clicks the button
 151                      alert('<?php echo $BL['fancyupload_flashblock_error'] ?>');
 152                      break;
 153                  case 'empty': // Oh oh, wrong path
 154                      alert('<?php echo $BL['fancyupload_required_error'] ?>');
 155                      break;
 156                  case 'flash': // no flash 9+ :(
 157                      alert('<?php echo $BL['fancyupload_flash_error'] ?>')
 158              }
 159          }
 160  
 161      });
 162  
 163  });
 164  
 165  //-->
 166  </script>


Generated: Sun Jan 29 16:31:14 2012 Cross-referenced by PHPXref 0.7.1