diff --git a/admin-dev/themes/template/form.tpl b/admin-dev/themes/template/form.tpl index 3d6b09e2b..b11a3994b 100644 --- a/admin-dev/themes/template/form.tpl +++ b/admin-dev/themes/template/form.tpl @@ -140,7 +140,17 @@ id="{$value.id}" value="{$value.value|escape:'htmlall':'UTF-8'}" {if $fields_value[$input.name] == $value.value}checked="checked"{/if} /> - + {/foreach} {elseif $input.type == 'textarea'} {if isset($input.lang) && isset($input.attributeLang)} diff --git a/controllers/admin/AdminImagesController.php b/controllers/admin/AdminImagesController.php index c5719bbca..735dc4f2b 100644 --- a/controllers/admin/AdminImagesController.php +++ b/controllers/admin/AdminImagesController.php @@ -64,6 +64,171 @@ class AdminImagesController extends AdminController ) ); + $this->fields_form = array( + 'legend' => array( + 'title' => $this->l('Images'), + 'image' => '../img/admin/picture.gif' + ), + 'input' => array( + array( + 'type' => 'text', + 'label' => $this->l('Type name:'), + 'name' => 'name', + 'required' => true, + 'p' => $this->l('Letters only (e.g., small, medium, large, extra-large)') + ), + array( + 'type' => 'text', + 'label' => $this->l('Width:'), + 'name' => 'width', + 'required' => true, + 'size' => 4, + 'maxlength' => 5, + 'p' => $this->l('Maximum image width in pixels') + ), + array( + 'type' => 'text', + 'label' => $this->l('Height:'), + 'name' => 'height', + 'required' => true, + 'size' => 4, + 'maxlength' => 5, + 'p' => $this->l('Maximum image height in pixels') + ), + array( + 'type' => 'radio', + 'label' => $this->l('Products:'), + 'name' => 'products', + 'required' => false, + 'class' => 't', + 'is_bool' => true, + 'p' => $this->l('This type will be applied to product images'), + 'values' => array( + array( + 'id' => 'products_on', + 'value' => 1, + 'label' => $this->l('Enabled') + ), + array( + 'id' => 'products_off', + 'value' => 0, + 'label' => $this->l('Disabled') + ), + ) + ), + array( + 'type' => 'radio', + 'label' => $this->l('Categories:'), + 'name' => 'categories', + 'required' => false, + 'class' => 't', + 'is_bool' => true, + 'p' => $this->l('This type will be applied to categories images'), + 'values' => array( + array( + 'id' => 'categories_on', + 'value' => 1, + 'label' => $this->l('Enabled') + ), + array( + 'id' => 'categories_off', + 'value' => 0, + 'label' => $this->l('Disabled') + ), + ) + ), + array( + 'type' => 'radio', + 'label' => $this->l('Manufacturers:'), + 'name' => 'manufacturers', + 'required' => false, + 'class' => 't', + 'is_bool' => true, + 'p' => $this->l('This type will be applied to manufacturers images'), + 'values' => array( + array( + 'id' => 'manufacturers_on', + 'value' => 1, + 'label' => $this->l('Enabled') + ), + array( + 'id' => 'manufacturers_off', + 'value' => 0, + 'label' => $this->l('Disabled') + ), + ) + ), + array( + 'type' => 'radio', + 'label' => $this->l('Suppliers:'), + 'name' => 'suppliers', + 'required' => false, + 'class' => 't', + 'is_bool' => true, + 'p' => $this->l('This type will be applied to suppliers images'), + 'values' => array( + array( + 'id' => 'suppliers_on', + 'value' => 1, + 'label' => $this->l('Enabled') + ), + array( + 'id' => 'suppliers_off', + 'value' => 0, + 'label' => $this->l('Disabled') + ), + ) + ), + array( + 'type' => 'radio', + 'label' => $this->l('Scenes:'), + 'name' => 'scenes', + 'required' => false, + 'class' => 't', + 'is_bool' => true, + 'p' => $this->l('This type will be applied to scenes images'), + 'values' => array( + array( + 'id' => 'scenes_on', + 'value' => 1, + 'label' => $this->l('Enabled') + ), + array( + 'id' => 'scenes_off', + 'value' => 0, + 'label' => $this->l('Disabled') + ), + ) + ), + array( + 'type' => 'radio', + 'label' => $this->l('stores:'), + 'name' => 'stores', + 'required' => false, + 'class' => 't', + 'is_bool' => true, + 'p' => $this->l('This type will be applied to stores images'), + 'values' => array( + array( + 'id' => 'stores_on', + 'value' => 1, + 'label' => $this->l('Enabled') + ), + array( + 'id' => 'stores_off', + 'value' => 0, + 'label' => $this->l('Disabled') + ), + ) + ), + ), + 'submit' => array( + 'title' => $this->l(' Save '), + 'class' => 'button' + ) + ); + + parent::__construct(); } @@ -117,91 +282,6 @@ class AdminImagesController extends AdminController $this->_errors[] = Tools::displayError('This name already exists.'); } - public function displayForm($isMainTab = true) - { - parent::displayForm(); - - if (!($obj = $this->loadObject(true))) - return; - - echo $obj->id ? $this->displayWarning($this->l('After modification, do not forget to regenerate thumbnails')) : ''; - - echo ' -
- '.($obj->id ? '' : '').' -
- '.$this->l('Images').'
- -
- * -

'.$this->l('Letters only (e.g., small, medium, large, extra-large)').'

-
- -
- * -

'.$this->l('Maximum image width in pixels').'

-
- -
- * -

'.$this->l('Maximum image height in pixels').'

-
- -
- getFieldValue($obj, 'products') ? 'checked="checked" ' : '').'/> - - getFieldValue($obj, 'products') ? 'checked="checked" ' : '').'/> - -

'.$this->l('This type will be applied to product images').'

-
- -
- getFieldValue($obj, 'categories') ? 'checked="checked" ' : '').'/> - - getFieldValue($obj, 'categories') ? 'checked="checked" ' : '').'/> - -

'.$this->l('This type will be applied to category images').'

-
- -
- getFieldValue($obj, 'manufacturers') ? 'checked="checked" ' : '').'/> - - getFieldValue($obj, 'manufacturers') ? 'checked="checked" ' : '').'/> - -

'.$this->l('This type will be applied to manufacturer images').'

-
- -
- getFieldValue($obj, 'suppliers') ? 'checked="checked" ' : '').'/> - - getFieldValue($obj, 'suppliers') ? 'checked="checked" ' : '').'/> - -

'.$this->l('This type will be applied to suppliers images').'

-
- -
- getFieldValue($obj, 'scenes') ? 'checked="checked" ' : '').'/> - - getFieldValue($obj, 'scenes') ? 'checked="checked" ' : '').'/> - -

'.$this->l('This type will be applied to scenes images').'

-
- -
- getFieldValue($obj, 'stores') ? 'checked="checked" ' : '').'/> - - getFieldValue($obj, 'stores') ? 'checked="checked" ' : '').'/> - -

'.$this->l('This type will be applied to stores images').'

-
-
- -
-
* '.$this->l('Required field').'
-
-
'; - } - /** * Display form for thumbnails regeneration */ @@ -218,7 +298,7 @@ class AdminImagesController extends AdminController $this->content .= '

'.$this->l('Regenerate thumbnails').'

'.$this->l('Regenerates thumbnails for all existing product images').'.

'; - $this->displayWarning($this->l('Please be patient, as this can take several minutes').'
'.$this->l('Be careful! Manually generated thumbnails will be erased by automatically generated thumbnails.')); + $this->content .= '
'.$this->l('Please be patient, as this can take several minutes').'
'.$this->l('Be careful! Manually generated thumbnails will be erased by automatically generated thumbnails.').'
'; $this->content .= '
@@ -502,47 +582,6 @@ class AdminImagesController extends AdminController return (sizeof($this->_errors) > 0 ? false : true); } - /** - * Display the block for moving images - */ - public function displayImagePreferences() - { - $this->content .= '
- -
- '.$this->l('Images').''.' -

'.$this->l('JPEG images have a small file size and standard quality. PNG images have a bigger file size, a higher quality and support transparency. Note that in all cases the image files will have the .jpg extension.').' -

'.$this->l('WARNING: This feature may not be compatible with your theme or with some modules. In particular, PNG mode is not compatible with the Watermark module. If you encounter any issue, turn it off by selecting "Use JPEG".').'

-
- -
- - -
- - -
- - -
-
- -
- -

'.$this->l('Ranges from 0 (worst quality, smallest file) to 100 (best quality, biggest file)').'

-
- -
- -

'.$this->l('Ranges from 9 (worst quality, smallest file) to 0 (best quality, biggest file)').'

-
-
- -
-
-
'; - } - public function initContent() { if ($this->display != 'edit' && $this->display != 'add') @@ -550,7 +589,7 @@ class AdminImagesController extends AdminController parent::initContent(); - if ($this->display = 'list') + if ($this->display == 'list') { $this->context->smarty->assign('list', true); @@ -559,9 +598,11 @@ class AdminImagesController extends AdminController $helper->currentIndex = self::$currentIndex; $this->content .= $helper->generateOptions($this->form_list['options_image_pref']); - //$this->displayImagePreferences(); $this->displayRegenerate(); $this->displayMoveImages(); } + + if ($this->display == 'edit') + $this->warnings[] = $this->l('After modification, do not forget to regenerate thumbnails'); } }