// Add Drag and Drop to uploader helper
This commit is contained in:
@@ -109,7 +109,8 @@
|
||||
dataType: 'json',
|
||||
autoUpload: false,
|
||||
singleFileUploads: true,
|
||||
maxFileSize: {$post_max_size},
|
||||
{if isset($post_max_size)}maxFileSize: {$post_max_size},{/if}
|
||||
{if isset($drop_zone)}dropZone: {$drop_zone},{/if}
|
||||
start: function (e) {
|
||||
{$id}_upload_button.start();
|
||||
$('#{$id}-upload-button').unbind('click'); //Important as we bind it for every elements in add function
|
||||
|
||||
@@ -110,6 +110,9 @@ class UploaderCore
|
||||
case 'k': $bytes *= 1024;
|
||||
}
|
||||
|
||||
if ($bytes == '')
|
||||
$bytes = null;
|
||||
|
||||
return $bytes;
|
||||
}
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@ class HelperUploaderCore extends Uploader
|
||||
const TYPE_FILE = 'file';
|
||||
|
||||
private $_context;
|
||||
private $_drop_zone;
|
||||
private $_id;
|
||||
private $_files;
|
||||
private $_name;
|
||||
@@ -59,6 +60,20 @@ class HelperUploaderCore extends Uploader
|
||||
return $this->_context;
|
||||
}
|
||||
|
||||
public function setDropZone($value)
|
||||
{
|
||||
$this->_drop_zone = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getDropZone()
|
||||
{
|
||||
if (!isset($this->_drop_zone))
|
||||
$this->setDropZone('$(document)');
|
||||
|
||||
return $this->_drop_zone;
|
||||
}
|
||||
|
||||
public function setId($value)
|
||||
{
|
||||
$this->_id = (string)$value;
|
||||
@@ -270,7 +285,8 @@ class HelperUploaderCore extends Uploader
|
||||
'files' => $this->getFiles(),
|
||||
'title' => $this->getTitle(),
|
||||
'max_files' => $this->getMaxFiles(),
|
||||
'post_max_size' => $this->getPostMaxSizeBytes()
|
||||
'post_max_size' => $this->getPostMaxSizeBytes(),
|
||||
'drop_zone' => $this->getDropZone()
|
||||
));
|
||||
|
||||
$html .= $template->fetch();
|
||||
|
||||
Reference in New Issue
Block a user