// Some changes to integrate uploader helper
This commit is contained in:
@@ -24,51 +24,6 @@
|
||||
*}
|
||||
{extends file="helpers/form/form.tpl"}
|
||||
|
||||
{block name="input"}
|
||||
{if $input.type == 'file'}
|
||||
<input id="{$input.name}" type="file" name="{$input.name}" class="hide" />
|
||||
<div class="dummyfile input-group">
|
||||
<span class="input-group-addon"><i class="icon-file"></i></span>
|
||||
<input id="{$input.name}-name" type="text" class="disabled" name="filename" readonly />
|
||||
<span class="input-group-btn">
|
||||
<button id="{$input.name}-selectbutton" type="button" name="submitAddAttachments" class="btn btn-default">
|
||||
<i class="icon-folder-open"></i> {l s='Choose a file'}
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
{if isset($input.desc)}<p>{$input.desc}</p>{/if}
|
||||
{if isset($fields_value.image) && $fields_value.image}
|
||||
<div class="clearfix"> </div>
|
||||
<div id="image" class="thumbnail">
|
||||
{$fields_value.image}
|
||||
<div class="text-center">
|
||||
<p>{l s='File size'} {$fields_value.size}kb</p>
|
||||
<a class="btn btn-default" href="{$current}&{$identifier}={$form_id}&token={$token}&deleteImage=1">
|
||||
<i class="icon-remove text-danger"></i> {l s='Delete'}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
$('#{$input.name}-selectbutton').click(function(e){
|
||||
$('#{$input.name}').trigger('click');
|
||||
});
|
||||
$('#{$input.name}-name').click(function(e){
|
||||
$('#{$input.name}').trigger('click');
|
||||
});
|
||||
$('#{$input.name}').change(function(e){
|
||||
var val = $(this).val();
|
||||
var file = val.split(/[\\/]/);
|
||||
$('#{$input.name}-name').val(file[file.length-1]);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{$displayBackOfficeCategory}
|
||||
{else}
|
||||
{$smarty.block.parent}
|
||||
{/if}
|
||||
{/block}
|
||||
{block name="input"}
|
||||
{if $input.name == "link_rewrite"}
|
||||
<script type="text/javascript">
|
||||
@@ -82,6 +37,10 @@
|
||||
{else}
|
||||
{$smarty.block.parent}
|
||||
{/if}
|
||||
|
||||
{if $input.name == 'image'}
|
||||
{$displayBackOfficeCategory}
|
||||
{/if}
|
||||
{/block}
|
||||
{block name="description"}
|
||||
{$smarty.block.parent}
|
||||
|
||||
@@ -61,53 +61,7 @@
|
||||
{/block}
|
||||
|
||||
{block name="other_input"}
|
||||
{if $key == 'rightCols'}
|
||||
{foreach $field as $input}
|
||||
{if $input.type == 'file'}
|
||||
<div class="form-group">
|
||||
<label class="control-label col-lg-3">{$input.label} </label>
|
||||
<div class="col-lg-7">
|
||||
<input id="{$input.name}" type="file" name="{$input.name}" class="hide" />
|
||||
<div class="dummyfile input-group">
|
||||
<span class="input-group-addon"><i class="icon-file"></i></span>
|
||||
<input id="{$input.name}-name" type="text" class="disabled" name="filename" readonly />
|
||||
<span class="input-group-btn">
|
||||
<button id="{$input.name}-selectbutton" type="button" name="submitAddAttachments" class="btn btn-default">
|
||||
<i class="icon-folder-open"></i> {l s='Choose a file'}
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
{if isset($input.desc)}<p>{$input.desc}</p>{/if}
|
||||
{if isset($fields_value.image) && $fields_value.image}
|
||||
<div class="clearfix"> </div>
|
||||
<div id="image" class="img-thumbnail">
|
||||
{$fields_value.image}
|
||||
<div class="text-center">
|
||||
<p>{l s='File size'} {$fields_value.size}kb</p>
|
||||
<a class="btn btn-default" href="{$current}&{$identifier}={$form_id}&token={$token}&deleteImage=1">
|
||||
<i class="icon-trash"></i> {l s='Delete'}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
$('#{$input.name}-selectbutton').click(function(e){
|
||||
$('#{$input.name}').trigger('click');
|
||||
});
|
||||
$('#{$input.name}-name').click(function(e){
|
||||
$('#{$input.name}').trigger('click');
|
||||
});
|
||||
$('#{$input.name}').change(function(e){
|
||||
var val = $(this).val();
|
||||
var file = val.split(/[\\/]/);
|
||||
$('#{$input.name}-name').val(file[file.length-1]);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
{if $key == 'hours'}
|
||||
<div class="form-group">
|
||||
<label class="control-label col-lg-3">{l s='Hours:'}</label>
|
||||
<div class="col-lg-9"><p class="form-control-static">{l s='e.g. 10:00AM - 9:30PM'}</p></div>
|
||||
@@ -118,6 +72,5 @@
|
||||
<div class="col-lg-9"><input type="text" size="25" name="hours_{$k}" value="{if isset($fields_value.hours[$k-1])}{$fields_value.hours[$k-1]|escape:'htmlall'}{/if}" /></div>
|
||||
</div>
|
||||
{/foreach}
|
||||
{/foreach}
|
||||
{/if}
|
||||
{/block}
|
||||
@@ -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