diff --git a/admin-dev/themes/default/template/controllers/categories/helpers/form/form.tpl b/admin-dev/themes/default/template/controllers/categories/helpers/form/form.tpl index 38726a546..9ec8a6dcb 100644 --- a/admin-dev/themes/default/template/controllers/categories/helpers/form/form.tpl +++ b/admin-dev/themes/default/template/controllers/categories/helpers/form/form.tpl @@ -24,51 +24,6 @@ *} {extends file="helpers/form/form.tpl"} -{block name="input"} - {if $input.type == 'file'} - -
- - - - - -
- {if isset($input.desc)}

{$input.desc}

{/if} - {if isset($fields_value.image) && $fields_value.image} -
 
-
- {$fields_value.image} -
-

{l s='File size'} {$fields_value.size}kb

- - {l s='Delete'} - -
-
- {/if} - - {$displayBackOfficeCategory} - {else} - {$smarty.block.parent} - {/if} -{/block} {block name="input"} {if $input.name == "link_rewrite"} - - - {/if} + {if $key == 'hours'}

{l s='e.g. 10:00AM - 9:30PM'}

@@ -118,6 +72,5 @@
{/foreach} - {/foreach} {/if} {/block} \ No newline at end of file diff --git a/controllers/admin/AdminCategoriesController.php b/controllers/admin/AdminCategoriesController.php index a31a674a0..abe4b3916 100644 --- a/controllers/admin/AdminCategoriesController.php +++ b/controllers/admin/AdminCategoriesController.php @@ -388,6 +388,14 @@ class AdminCategoriesControllerCore extends AdminController $guest_group_information = sprintf($this->l('%s - Customer who placed an order with the guest checkout.'), ''.$guest->name[$this->context->language->id].''); $default_group_information = sprintf($this->l('%s - All people who have created an account on this site.'), ''.$default->name[$this->context->language->id].''); + 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( diff --git a/controllers/admin/AdminManufacturersController.php b/controllers/admin/AdminManufacturersController.php index 2e6bf5419..a2ca8f7c3 100644 --- a/controllers/admin/AdminManufacturersController.php +++ b/controllers/admin/AdminManufacturersController.php @@ -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( diff --git a/controllers/admin/AdminStoresController.php b/controllers/admin/AdminStoresController.php index 3ac5cf2d1..43941d21b 100644 --- a/controllers/admin/AdminStoresController.php +++ b/controllers/admin/AdminStoresController.php @@ -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 ); diff --git a/controllers/admin/AdminSuppliersController.php b/controllers/admin/AdminSuppliersController.php index eee84286f..bfc8d95dc 100644 --- a/controllers/admin/AdminSuppliersController.php +++ b/controllers/admin/AdminSuppliersController.php @@ -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() diff --git a/controllers/admin/AdminThemesController.php b/controllers/admin/AdminThemesController.php index cc62e062c..92d8d4397 100644 --- a/controllers/admin/AdminThemesController.php +++ b/controllers/admin/AdminThemesController.php @@ -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) ? ''.$this->l('Warning: No mobile logo has been defined. The header logo will be used instead.').'
' : ''). $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) ? ''.$this->l('Warning: No email logo has been indentified. The header logo will be used instead.').'
' : ''). $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) ? ''.$this->l('Warning: No invoice logo has been defined. The header logo will be used instead.').'
' : ''). $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).').'
'.$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(