// Fix products attachments uploader
This commit is contained in:
@@ -40,6 +40,7 @@ class HelperUploaderCore extends Uploader
|
||||
private $_name;
|
||||
private $_max_files;
|
||||
private $_multiple;
|
||||
private $_post_max_size;
|
||||
protected $_template;
|
||||
private $_template_directory;
|
||||
private $_title;
|
||||
@@ -119,12 +120,6 @@ class HelperUploaderCore extends Uploader
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setTemplate($value)
|
||||
{
|
||||
$this->_template = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setName($value)
|
||||
{
|
||||
$this->_name = (string)$value;
|
||||
@@ -136,6 +131,26 @@ class HelperUploaderCore extends Uploader
|
||||
return $this->_name;
|
||||
}
|
||||
|
||||
public function setPostMaxSize($value)
|
||||
{
|
||||
$this->_post_max_size = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getPostMaxSize()
|
||||
{
|
||||
if (!isset($this->_post_max_size))
|
||||
$this->_post_max_size = parent::getPostMaxSize();
|
||||
|
||||
return $this->_post_max_size;
|
||||
}
|
||||
|
||||
public function setTemplate($value)
|
||||
{
|
||||
$this->_template = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getTemplate()
|
||||
{
|
||||
if (!isset($this->_template))
|
||||
@@ -240,37 +255,20 @@ class HelperUploaderCore extends Uploader
|
||||
.'template'))
|
||||
$bo_theme = 'default';
|
||||
|
||||
if ($this->getContext()->controller->ajax)
|
||||
{
|
||||
$html = '<script type="text/javascript" src="'.__PS_BASE_URI__.$admin_webpath
|
||||
.'/themes/'.$bo_theme.'/js/vendor/jquery.ui.widget.js"></script>';
|
||||
$html .= '<script type="text/javascript" src="'.__PS_BASE_URI__.$admin_webpath
|
||||
.'/themes/'.$bo_theme.'/js/jquery.iframe-transport.js"></script>';
|
||||
$html .= '<script type="text/javascript" src="'.__PS_BASE_URI__.$admin_webpath
|
||||
.'/themes/'.$bo_theme.'/js/jquery.fileupload.js"></script>';
|
||||
$html .= '<script type="text/javascript" src="'.__PS_BASE_URI__.$admin_webpath
|
||||
.'/themes/'.$bo_theme.'/js/jquery.fileupload-process.js"></script>';
|
||||
$html .= '<script type="text/javascript" src="'.__PS_BASE_URI__.$admin_webpath
|
||||
.'/themes/'.$bo_theme.'/js/jquery.fileupload-validate.js"></script>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$html = '';
|
||||
$this->getContext()->controller->addJs(__PS_BASE_URI__.$admin_webpath
|
||||
.'/themes/'.$bo_theme.'/js/vendor/jquery.ui.widget.js');
|
||||
$this->getContext()->controller->addJs(__PS_BASE_URI__.$admin_webpath
|
||||
.'/themes/'.$bo_theme.'/js/jquery.iframe-transport.js');
|
||||
$this->getContext()->controller->addJs(__PS_BASE_URI__.$admin_webpath
|
||||
.'/themes/'.$bo_theme.'/js/jquery.fileupload.js');
|
||||
$this->getContext()->controller->addJs(__PS_BASE_URI__.$admin_webpath
|
||||
.'/themes/'.$bo_theme.'/js/jquery.fileupload-process.js');
|
||||
$this->getContext()->controller->addJs(__PS_BASE_URI__.$admin_webpath
|
||||
.'/themes/'.$bo_theme.'/js/jquery.fileupload-validate.js');
|
||||
$this->getContext()->controller->addJs(__PS_BASE_URI__.'js/vendor/spin.js');
|
||||
$this->getContext()->controller->addJs(__PS_BASE_URI__.'js/vendor/ladda.js');
|
||||
}
|
||||
$this->getContext()->controller->addJs(__PS_BASE_URI__.$admin_webpath
|
||||
.'/themes/'.$bo_theme.'/js/vendor/jquery.ui.widget.js');
|
||||
$this->getContext()->controller->addJs(__PS_BASE_URI__.$admin_webpath
|
||||
.'/themes/'.$bo_theme.'/js/jquery.iframe-transport.js');
|
||||
$this->getContext()->controller->addJs(__PS_BASE_URI__.$admin_webpath
|
||||
.'/themes/'.$bo_theme.'/js/jquery.fileupload.js');
|
||||
$this->getContext()->controller->addJs(__PS_BASE_URI__.$admin_webpath
|
||||
.'/themes/'.$bo_theme.'/js/jquery.fileupload-process.js');
|
||||
$this->getContext()->controller->addJs(__PS_BASE_URI__.$admin_webpath
|
||||
.'/themes/'.$bo_theme.'/js/jquery.fileupload-validate.js');
|
||||
$this->getContext()->controller->addJs(__PS_BASE_URI__.'js/vendor/spin.js');
|
||||
$this->getContext()->controller->addJs(__PS_BASE_URI__.'js/vendor/ladda.js');
|
||||
|
||||
if ($this->useAjax())
|
||||
if ($this->useAjax() && !isset($this->_template))
|
||||
$this->setTemplate(self::DEFAULT_AJAX_TEMPLATE);
|
||||
|
||||
$template = $this->getContext()->smarty->createTemplate(
|
||||
@@ -289,8 +287,7 @@ class HelperUploaderCore extends Uploader
|
||||
'drop_zone' => $this->getDropZone()
|
||||
));
|
||||
|
||||
$html .= $template->fetch();
|
||||
return $html;
|
||||
return $template->fetch();
|
||||
}
|
||||
|
||||
public function useAjax()
|
||||
|
||||
Reference in New Issue
Block a user