// Some changes to integrate uploader helper
This commit is contained in:
@@ -388,6 +388,14 @@ class AdminCategoriesControllerCore extends AdminController
|
||||
$guest_group_information = sprintf($this->l('%s - Customer who placed an order with the guest checkout.'), '<b>'.$guest->name[$this->context->language->id].'</b>');
|
||||
$default_group_information = sprintf($this->l('%s - All people who have created an account on this site.'), '<b>'.$default->name[$this->context->language->id].'</b>');
|
||||
|
||||
if (!($obj = $this->loadObject(true)))
|
||||
return;
|
||||
|
||||
$image = _PS_CAT_IMG_DIR_.$obj->id.'.jpg';
|
||||
$image_url = ImageManager::thumbnail($image, $this->table.'_'.(int)$obj->id.'.'.$this->imageType, 350,
|
||||
$this->imageType, true, true);
|
||||
$image_size = file_exists($image) ? filesize($image) / 1000 : false;
|
||||
|
||||
$this->fields_form = array(
|
||||
'tinymce' => true,
|
||||
'legend' => array(
|
||||
@@ -446,6 +454,9 @@ class AdminCategoriesControllerCore extends AdminController
|
||||
'label' => $this->l('Image:'),
|
||||
'name' => 'image',
|
||||
'display_image' => true,
|
||||
'image' => $image_url ? $image_url : false,
|
||||
'size' => $image_size,
|
||||
'delete_url' => self::$currentIndex.'&'.$this->identifier.'='.$this->id.'&token='.$this->token.'&deleteImage=1',
|
||||
'hint' => $this->l('Upload a category logo from your computer.')
|
||||
),
|
||||
array(
|
||||
|
||||
@@ -268,6 +268,14 @@ class AdminManufacturersControllerCore extends AdminController
|
||||
|
||||
public function renderForm()
|
||||
{
|
||||
if (!($manufacturer = $this->loadObject(true)))
|
||||
return;
|
||||
|
||||
$image = _PS_MANU_IMG_DIR_.$manufacturer->id.'.jpg';
|
||||
$image_url = ImageManager::thumbnail($image, $this->table.'_'.(int)$manufacturer->id.'.'.$this->imageType, 350,
|
||||
$this->imageType, true, true);
|
||||
$image_size = file_exists($image) ? filesize($image) / 1000 : false;
|
||||
|
||||
$this->fields_form = array(
|
||||
'tinymce' => true,
|
||||
'legend' => array(
|
||||
@@ -306,6 +314,8 @@ class AdminManufacturersControllerCore extends AdminController
|
||||
'type' => 'file',
|
||||
'label' => $this->l('Logo:'),
|
||||
'name' => 'logo',
|
||||
'image' => $image_url ? $image_url : false,
|
||||
'size' => $image_size,
|
||||
'display_image' => true,
|
||||
'hint' => $this->l('Upload a manufacturer logo from your computer.')
|
||||
),
|
||||
@@ -373,13 +383,6 @@ class AdminManufacturersControllerCore extends AdminController
|
||||
'class' => 'button'
|
||||
);
|
||||
|
||||
$image = ImageManager::thumbnail(_PS_MANU_IMG_DIR_.'/'.$manufacturer->id.'.jpg', $this->table.'_'.(int)$manufacturer->id.'.'.$this->imageType, 350, $this->imageType, true);
|
||||
|
||||
$this->fields_value = array(
|
||||
'image' => $image ? $image : false,
|
||||
'size' => $image ? filesize(_PS_MANU_IMG_DIR_.'/'.$manufacturer->id.'.jpg') / 1000 : false
|
||||
);
|
||||
|
||||
foreach ($this->_languages as $language)
|
||||
{
|
||||
$this->fields_value['short_description_'.$language['id_lang']] = htmlentities(stripslashes($this->getFieldValue(
|
||||
|
||||
@@ -163,6 +163,14 @@ class AdminStoresControllerCore extends AdminController
|
||||
|
||||
public function renderForm()
|
||||
{
|
||||
if (!($obj = $this->loadObject(true)))
|
||||
return;
|
||||
|
||||
$image = _PS_STORE_IMG_DIR_.$obj->id.'.jpg';
|
||||
$image_url = ImageManager::thumbnail($image, $this->table.'_'.(int)$obj->id.'.'.$this->imageType, 350,
|
||||
$this->imageType, true, true);
|
||||
$image_size = file_exists($image) ? filesize($image) / 1000 : false;
|
||||
|
||||
$this->fields_form = array(
|
||||
'legend' => array(
|
||||
'title' => $this->l('Stores'),
|
||||
@@ -274,16 +282,19 @@ class AdminStoresControllerCore extends AdminController
|
||||
)
|
||||
),
|
||||
'hint' => $this->l('Whether or not to display this store')
|
||||
)
|
||||
),
|
||||
'rightCols' => array (
|
||||
'input' => array(
|
||||
),
|
||||
array(
|
||||
'type' => 'file',
|
||||
'label' => $this->l('Picture'),
|
||||
'name' => 'image',
|
||||
'display_image' => true,
|
||||
'image' => $image_url ? $image_url : false,
|
||||
'size' => $image_size,
|
||||
'hint' => $this->l('Storefront picture')
|
||||
)
|
||||
),
|
||||
'hours' => array(
|
||||
),
|
||||
'submit' => array(
|
||||
'title' => $this->l(' Save '),
|
||||
'class' => 'btn btn-default'
|
||||
@@ -299,15 +310,6 @@ class AdminStoresControllerCore extends AdminController
|
||||
);
|
||||
}
|
||||
|
||||
if (!($obj = $this->loadObject(true)))
|
||||
return;
|
||||
|
||||
if (file_exists(_PS_TMP_IMG_DIR_.$this->table.'_'.(int)$obj->id.'.'.$this->imageType)) {
|
||||
@unlink(_PS_TMP_IMG_DIR_.$this->table.'_'.(int)$obj->id.'.'.$this->imageType);
|
||||
}
|
||||
|
||||
$image = ImageManager::thumbnail(_PS_STORE_IMG_DIR_.DIRECTORY_SEPARATOR.$obj->id.'.jpg', $this->table.'_'.(int)$obj->id.'.'.$this->imageType, 350, $this->imageType, true, true);
|
||||
|
||||
$days = array();
|
||||
$days[1] = $this->l('Monday');
|
||||
$days[2] = $this->l('Tuesday');
|
||||
@@ -324,8 +326,6 @@ class AdminStoresControllerCore extends AdminController
|
||||
$this->fields_value = array(
|
||||
'latitude' => $this->getFieldValue($obj, 'latitude') ? $this->getFieldValue($obj, 'latitude') : Configuration::get('PS_STORES_CENTER_LAT'),
|
||||
'longitude' => $this->getFieldValue($obj, 'longitude') ? $this->getFieldValue($obj, 'longitude') : Configuration::get('PS_STORES_CENTER_LONG'),
|
||||
'image' => $image ? $image : false,
|
||||
'size' => $image ? filesize(_PS_STORE_IMG_DIR_.DIRECTORY_SEPARATOR.$obj->id.'.jpg') / 1000 : false,
|
||||
'days' => $days,
|
||||
'hours' => isset($hours_unserialized) ? $hours_unserialized : false
|
||||
);
|
||||
|
||||
@@ -88,6 +88,11 @@ class AdminSuppliersControllerCore extends AdminController
|
||||
if (!($obj = $this->loadObject(true)))
|
||||
return;
|
||||
|
||||
$image = _PS_SUPP_IMG_DIR_.$obj->id.'.jpg';
|
||||
$image_url = ImageManager::thumbnail($image, $this->table.'_'.(int)$obj->id.'.'.$this->imageType, 350,
|
||||
$this->imageType, true, true);
|
||||
$image_size = file_exists($image) ? filesize($image) / 1000 : false;
|
||||
|
||||
$this->fields_form = array(
|
||||
'legend' => array(
|
||||
'title' => $this->l('Suppliers'),
|
||||
@@ -177,6 +182,8 @@ class AdminSuppliersControllerCore extends AdminController
|
||||
'label' => $this->l('Logo:'),
|
||||
'name' => 'logo',
|
||||
'display_image' => true,
|
||||
'image' => $image_url ? $image_url : false,
|
||||
'size' => $image_size,
|
||||
'hint' => $this->l('Upload a supplier logo from your computer')
|
||||
),
|
||||
array(
|
||||
@@ -270,11 +277,6 @@ class AdminSuppliersControllerCore extends AdminController
|
||||
);
|
||||
}
|
||||
|
||||
// set logo image
|
||||
$image = ImageManager::thumbnail(_PS_SUPP_IMG_DIR_.'/'.$this->object->id.'.jpg', $this->table.'_'.(int)$this->object->id.'.'.$this->imageType, 350, $this->imageType, true);
|
||||
$this->fields_value['image'] = $image ? $image : false;
|
||||
$this->fields_value['size'] = $image ? filesize(_PS_SUPP_IMG_DIR_.'/'.$this->object->id.'.jpg') / 1000 : false;
|
||||
|
||||
return parent::renderForm();
|
||||
}
|
||||
|
||||
@@ -285,15 +287,13 @@ class AdminSuppliersControllerCore extends AdminController
|
||||
*/
|
||||
public function initToolbar()
|
||||
{
|
||||
switch ($this->display)
|
||||
{
|
||||
default:
|
||||
parent::initToolbar();
|
||||
$this->toolbar_btn['import'] = array(
|
||||
'href' => $this->context->link->getAdminLink('AdminImport', true).'&import_type=suppliers',
|
||||
'desc' => $this->l('Import')
|
||||
);
|
||||
}
|
||||
parent::initToolbar();
|
||||
|
||||
if (empty($this->display))
|
||||
$this->toolbar_btn['import'] = array(
|
||||
'href' => $this->context->link->getAdminLink('AdminImport', true).'&import_type=suppliers',
|
||||
'desc' => $this->l('Import')
|
||||
);
|
||||
}
|
||||
|
||||
public function renderView()
|
||||
|
||||
@@ -133,6 +133,7 @@ class AdminThemesControllerCore extends AdminController
|
||||
'title' => $this->l('Header logo'),
|
||||
'hint' => $this->l('Will appear on main page. Recommended height: 52px. Maximum height on default theme: 65px.'),
|
||||
'type' => 'file',
|
||||
'name' => 'PS_LOGO',
|
||||
'thumb' => _PS_IMG_.Configuration::get('PS_LOGO').'?date='.time()
|
||||
),
|
||||
'PS_LOGO_MOBILE' => array(
|
||||
@@ -141,6 +142,7 @@ class AdminThemesControllerCore extends AdminController
|
||||
((Configuration::get('PS_LOGO_MOBILE') === false) ? '<span class="light-warning">'.$this->l('Warning: No mobile logo has been defined. The header logo will be used instead.').'</span><br />' : '').
|
||||
$this->l('Will appear on the main page of your mobile template. If left undefined, the header logo will be used.'),
|
||||
'type' => 'file',
|
||||
'name' => 'PS_LOGO_MOBILE',
|
||||
'thumb' => (Configuration::get('PS_LOGO_MOBILE') !== false && file_exists(_PS_IMG_DIR_.Configuration::get('PS_LOGO_MOBILE'))) ? _PS_IMG_.Configuration::get('PS_LOGO_MOBILE').'?date='.time() : _PS_IMG_.Configuration::get('PS_LOGO').'?date='.time()
|
||||
),
|
||||
'PS_LOGO_MAIL' => array(
|
||||
@@ -149,6 +151,7 @@ class AdminThemesControllerCore extends AdminController
|
||||
((Configuration::get('PS_LOGO_MAIL') === false) ? '<span class="light-warning">'.$this->l('Warning: No email logo has been indentified. The header logo will be used instead.').'</span><br />' : '').
|
||||
$this->l('Will appear on email headers. If undefined, the header logo will be used.'),
|
||||
'type' => 'file',
|
||||
'name' => 'PS_LOGO_MAIL',
|
||||
'thumb' => (Configuration::get('PS_LOGO_MAIL') !== false && file_exists(_PS_IMG_DIR_.Configuration::get('PS_LOGO_MAIL'))) ? _PS_IMG_.Configuration::get('PS_LOGO_MAIL').'?date='.time() : _PS_IMG_.Configuration::get('PS_LOGO').'?date='.time()
|
||||
),
|
||||
'PS_LOGO_INVOICE' => array(
|
||||
@@ -157,6 +160,7 @@ class AdminThemesControllerCore extends AdminController
|
||||
((Configuration::get('PS_LOGO_INVOICE') === false) ? '<span class="light-warning">'.$this->l('Warning: No invoice logo has been defined. The header logo will be used instead.').'</span><br />' : '').
|
||||
$this->l('Will appear on invoice headers. If undefined, the header logo will be used.'),
|
||||
'type' => 'file',
|
||||
'name' => 'PS_LOGO_INVOICE',
|
||||
'thumb' => (Configuration::get('PS_LOGO_INVOICE') !== false && file_exists(_PS_IMG_DIR_.Configuration::get('PS_LOGO_INVOICE'))) ? _PS_IMG_.Configuration::get('PS_LOGO_INVOICE').'?date='.time() : _PS_IMG_.Configuration::get('PS_LOGO').'?date='.time()
|
||||
),
|
||||
'PS_FAVICON' => array(
|
||||
@@ -164,6 +168,7 @@ class AdminThemesControllerCore extends AdminController
|
||||
'hint' => $this->l('Only ICO format allowed'),
|
||||
'hint' => $this->l('Will appear in the address bar of your web browser.'),
|
||||
'type' => 'file',
|
||||
'name' => 'PS_FAVICON',
|
||||
'thumb' => _PS_IMG_.Configuration::get('PS_FAVICON').'?date='.time()
|
||||
),
|
||||
'PS_STORES_ICON' => array(
|
||||
@@ -171,6 +176,7 @@ class AdminThemesControllerCore extends AdminController
|
||||
'hint' => $this->l('Only GIF format allowed.'),
|
||||
'hint' => $this->l('Will appear on the store locator (inside Google Maps).').'<br />'.$this->l('Suggested size: 30x30, Transparent GIF'),
|
||||
'type' => 'file',
|
||||
'name' => 'PS_STORES_ICON',
|
||||
'thumb' => _PS_IMG_.Configuration::get('PS_STORES_ICON').'?date='.time()
|
||||
),
|
||||
'PS_NAVIGATION_PIPE' => array(
|
||||
|
||||
Reference in New Issue
Block a user