Merge branch 'bootstrap' of https://github.com/PrestaShop/PrestaShop into bootstrap
Conflicts: classes/helper/HelperForm.php classes/helper/HelperUploader.php
This commit is contained in:
@@ -1085,20 +1085,34 @@
|
||||
|
||||
<ul id="old_carts_orders_navtab" class="nav nav-tabs">
|
||||
<li class="active">
|
||||
<a href="#lastOrders" data-toggle="tab">
|
||||
<i class="icon-credit-card"></i>
|
||||
{l s='Orders'}
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#nonOrderedCarts" data-toggle="tab">
|
||||
<i class="icon-shopping-cart"></i>
|
||||
{l s='Carts'}
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#lastOrders" data-toggle="tab">
|
||||
<i class="icon-credit-card"></i>
|
||||
{l s='Orders'}
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<div id="old_carts_orders" class="tab-content panel collapse in">
|
||||
<div id="lastOrders" class="tab-pane active">
|
||||
<div id="nonOrderedCarts" class="tab-pane active">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><span class="title_box">{l s='ID'}</span></th>
|
||||
<th><span class="title_box">{l s='Date'}</span></th>
|
||||
<th><span class="title_box">{l s='Total'}</span></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div id="lastOrders" class="tab-pane">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -1115,20 +1129,6 @@
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div id="nonOrderedCarts" class="tab-pane">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><span class="title_box">{l s='ID'}</span></th>
|
||||
<th><span class="title_box">{l s='Date'}</span></th>
|
||||
<th><span class="title_box">{l s='Total'}</span></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+4
-2
@@ -22,8 +22,10 @@
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
{if isset($actions)}
|
||||
<div class="tree-actions col-lg-12">
|
||||
{if isset($actions)}
|
||||
{foreach from=$actions item=action}
|
||||
{$action->render()}
|
||||
{/foreach}
|
||||
{/if}
|
||||
{/if}
|
||||
</div>
|
||||
@@ -36,7 +36,7 @@
|
||||
{if $key == 'legend'}
|
||||
<h3>
|
||||
{if isset($field.image)}<img src="{$field.image}" alt="{$field.title|escape:'htmlall':'UTF-8'}" />{/if}
|
||||
{if isset($field.icon)}<i class="{$field.icon}"/></i>{/if}
|
||||
{if isset($field.icon)}<i class="{$field.icon}"></i>{/if}
|
||||
{$field.title}
|
||||
</h3>
|
||||
{elseif $key == 'description' && $field}
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
<div class="panel-heading">
|
||||
<div class="tree-panel-heading-controls">
|
||||
<!-- <i class="icon-tag"></i> {l s=$title} -->
|
||||
{if isset($toolbar)}{$toolbar}{/if}
|
||||
</div>
|
||||
@@ -26,27 +26,33 @@
|
||||
<div class="form-group">
|
||||
<div class="col-lg-12">
|
||||
{foreach $images as $image}
|
||||
{if isset($image.image)}
|
||||
<div class="img-thumbnail text-center">
|
||||
{$image}
|
||||
{if isset($size)}<p>{l s='File size'} {$size}kb</p>{/if}
|
||||
{if isset($delete_url)}
|
||||
<a class="btn btn-default" href="{$delete_url}">
|
||||
<p>{$image.image}</p>
|
||||
{if isset($image.size)}<p>{l s='File size'} {$image.size}kb</p>{/if}
|
||||
{if isset($image.delete_url)}
|
||||
<p>
|
||||
<a class="btn btn-default" href="{$image.delete_url}">
|
||||
<i class="icon-trash"></i> {l s='Delete'}
|
||||
</a>
|
||||
</a>
|
||||
</p>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
{/foreach}
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
<div class="form-group">
|
||||
<input id="{$id}" type="file" name="{$name}[]"{if isset($url)} data-url="{$url}"{/if}{if isset($multiple) && $multiple} multiple="multiple"{/if} class="hide" />
|
||||
<button class="btn btn-default" data-style="expand-right" data-size="s" type="button" id="{$id}-add-button">
|
||||
<i class="icon-plus-sign"></i> {if isset($multiple) && $multiple}{l s='Add files'}{else}{l s='Add file'}{/if}
|
||||
</button>
|
||||
<button class="ladda-button" data-style="expand-right" data-size="s" type="button" id="{$id}-upload-button" style="display:none;">
|
||||
<i class="icon-cloud-upload"></i> <span class="ladda-label">{if isset($multiple) && $multiple}{l s='Upload files'}{else}{l s='Upload file'}{/if}</span>
|
||||
</button>
|
||||
<div class="col-lg-12">
|
||||
<input id="{$id}" type="file" name="{$name}[]"{if isset($url)} data-url="{$url}"{/if}{if isset($multiple) && $multiple} multiple="multiple"{/if} class="hide" />
|
||||
<button class="btn btn-default" data-style="expand-right" data-size="s" type="button" id="{$id}-add-button">
|
||||
<i class="icon-plus-sign"></i> {if isset($multiple) && $multiple}{l s='Add files'}{else}{l s='Add file'}{/if}
|
||||
</button>
|
||||
<button class="ladda-button" data-style="expand-right" data-size="s" type="button" id="{$id}-upload-button" style="display:none;">
|
||||
<i class="icon-cloud-upload"></i> <span class="ladda-label">{if isset($multiple) && $multiple}{l s='Upload files'}{else}{l s='Upload file'}{/if}</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" style="display:none">
|
||||
<div class="alert alert-info" id="{$id}-files-list">
|
||||
@@ -81,6 +87,7 @@ $( document ).ready(function() {
|
||||
previewMaxWidth: 100,
|
||||
previewMaxHeight: 100,
|
||||
previewCrop: false,
|
||||
limitMultiFileUploads: 3,
|
||||
start: function () {
|
||||
upload_button.start();
|
||||
},
|
||||
|
||||
@@ -22,22 +22,26 @@
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
{if isset($display_image) && $display_image}
|
||||
{if isset($image) && $image}
|
||||
<div class="form-group">
|
||||
<div class="col-lg-12">
|
||||
<div class="img-thumbnail text-center">
|
||||
{$image}
|
||||
{if isset($size)}<p>{l s='File size'} {$size}kb</p>{/if}
|
||||
{if isset($delete_url)}
|
||||
<a class="btn btn-default" href="{$delete_url}">
|
||||
<i class="icon-trash"></i> {l s='Delete'}
|
||||
{if isset($images) && $images}
|
||||
<div class="form-group">
|
||||
<div class="col-lg-12">
|
||||
{foreach $images as $image}
|
||||
{if isset($image.image)}
|
||||
<div class="img-thumbnail text-center">
|
||||
<p>{$image.image}</p>
|
||||
{if isset($image.size)}<p>{l s='File size'} {$image.size}kb</p>{/if}
|
||||
{if isset($image.delete_url)}
|
||||
<p>
|
||||
<a class="btn btn-default" href="{$image.delete_url}">
|
||||
<i class="icon-trash"></i> {l s='Delete'}
|
||||
</a>
|
||||
{/if}
|
||||
</div>
|
||||
</p>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
{/foreach}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
{if isset($thumb) && $thumb}
|
||||
<div class="form-group">
|
||||
@@ -69,23 +73,33 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
$('#{$id}-selectbutton').click(function(e) {
|
||||
$('#{$id}').trigger('click');
|
||||
});
|
||||
|
||||
$('#{$id}-name').click(function(e) {
|
||||
$('#{$id}').trigger('click');
|
||||
});
|
||||
$('#{$id}').change(function(e) {
|
||||
var files = $(this)[0].files;
|
||||
var name = '';
|
||||
|
||||
$.each(files, function(index, value) {
|
||||
name += value.name+', ';
|
||||
});
|
||||
|
||||
$('#{$id}-name').val(name.slice(0, -2));
|
||||
$('#{$id}').change(function(e) {
|
||||
if ($(this)[0].files !== undefined)
|
||||
{
|
||||
var files = $(this)[0].files;
|
||||
var name = '';
|
||||
|
||||
$.each(files, function(index, value) {
|
||||
name += value.name+', ';
|
||||
});
|
||||
|
||||
$('#{$id}-name').val(name.slice(0, -2));
|
||||
}
|
||||
else // Internet Explorer 9 Compatibility
|
||||
{
|
||||
var name = $(this).val().split(/[\\/]/);
|
||||
$('#{$id}-name').val(name[name.length-1]);
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@@ -22,7 +22,7 @@
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
|
||||
{$header}
|
||||
{if isset($conf)}
|
||||
<div class="alert alert-success">
|
||||
{$conf}
|
||||
@@ -91,3 +91,4 @@
|
||||
{if !$bootstrap}<div id="nobootstrap">{/if}
|
||||
{$page}
|
||||
{if !$bootstrap}</div>{/if}
|
||||
{$footer}
|
||||
@@ -396,8 +396,10 @@ class DispatcherCore
|
||||
$this->default_routes[$route] = array_merge($this->default_routes[$route], $route_details);
|
||||
}
|
||||
|
||||
if (!in_array($context->language->id, $languages = Language::getLanguages()))
|
||||
$languages[] = (int)$context->language->id;
|
||||
// Set default routes
|
||||
foreach (Language::getLanguages() as $lang)
|
||||
foreach ($languages as $lang)
|
||||
foreach ($this->default_routes as $id => $route)
|
||||
$this->addRoute(
|
||||
$id,
|
||||
@@ -441,7 +443,10 @@ class DispatcherCore
|
||||
// Load custom routes
|
||||
foreach ($this->default_routes as $route_id => $route_data)
|
||||
if ($custom_route = Configuration::get('PS_ROUTE_'.$route_id, null, null, $id_shop))
|
||||
foreach (Language::getLanguages() as $lang)
|
||||
{
|
||||
if (!in_array($context->language->id, $languages = Language::getLanguages()))
|
||||
$languages[] = (int)$context->language->id;
|
||||
foreach ($languages as $lang)
|
||||
$this->addRoute(
|
||||
$route_id,
|
||||
$custom_route,
|
||||
@@ -451,6 +456,7 @@ class DispatcherCore
|
||||
isset($route_data['params']) ? $route_data['params'] : array(),
|
||||
$id_shop
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -593,7 +599,7 @@ class DispatcherCore
|
||||
$id_lang = (int)Context::getContext()->language->id;
|
||||
if ($id_shop === null)
|
||||
$id_shop = (int)Context::getContext()->shop->id;
|
||||
|
||||
|
||||
if (!isset($this->routes[$id_shop]))
|
||||
$this->loadRoutes($id_shop);
|
||||
|
||||
|
||||
@@ -682,6 +682,7 @@ class AdminControllerCore extends Controller
|
||||
'export_content' => $content
|
||||
)
|
||||
);
|
||||
|
||||
$this->layout = 'layout-export.tpl';
|
||||
}
|
||||
|
||||
@@ -1372,12 +1373,14 @@ class AdminControllerCore extends Controller
|
||||
foreach (array('errors', 'warnings', 'informations', 'confirmations') as $type)
|
||||
$this->context->smarty->assign($type, $this->json ? Tools::jsonEncode(array_unique($this->$type)) : array_unique($this->$type));
|
||||
|
||||
$this->context->smarty->assign('page', $this->json ? Tools::jsonEncode($page) : $page);
|
||||
|
||||
if (!$this->ajax)
|
||||
$this->smartyOutputContent(array($header_tpl, $this->layout, $footer_tpl));
|
||||
else
|
||||
$this->smartyOutputContent($this->layout);
|
||||
$this->context->smarty->assign(array(
|
||||
'page' => $this->json ? Tools::jsonEncode($page) : $page,
|
||||
'header' => $this->context->smarty->fetch($header_tpl),
|
||||
'footer' => $this->context->smarty->fetch($footer_tpl)
|
||||
)
|
||||
);
|
||||
|
||||
$this->smartyOutputContent($this->layout);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -118,13 +118,20 @@ class HelperFormCore extends Helper
|
||||
$uploader->setUrl(isset($params['url'])?$params['url']:null);
|
||||
$uploader->setMultiple(isset($params['multiple'])?$params['multiple']:false);
|
||||
$uploader->setUseAjax(isset($params['ajax'])?$params['ajax']:false);
|
||||
$uploader->setDisplayImage(isset($params['display_image'])?$params['display_image']:false);
|
||||
$uploader->setImage(isset($params['image'])?$params['image']:null);
|
||||
|
||||
if (isset($params['images']))
|
||||
$uploader->setImages($params['images']);
|
||||
elseif (isset($params['image'])) // Use for retrocompatibility
|
||||
$uploader->setImages(array(
|
||||
0 => array(
|
||||
'image' => isset($params['image'])?$params['image']:null,
|
||||
'size' => isset($params['size'])?$params['size']:null,
|
||||
'delete_url' => isset($params['delete_url'])?$params['delete_url']:null
|
||||
)));
|
||||
|
||||
$uploader->setThumb(isset($params['thumb'])?$params['thumb']:null);
|
||||
$uploader->setSize(isset($params['size'])?$params['size']:null);
|
||||
$uploader->setFile(isset($params['file'])?$params['file']:null);
|
||||
$uploader->setTitle(isset($params['title'])?$params['title']:null);
|
||||
$uploader->setDeleteUrl(isset($params['delete_url'])?$params['delete_url']:null);
|
||||
|
||||
$params['file'] = $uploader->render();
|
||||
break;
|
||||
|
||||
@@ -104,16 +104,22 @@ class HelperOptionsCore extends Helper
|
||||
$uploader->setUrl(isset($field['url'])?$field['url']:null);
|
||||
$uploader->setMultiple(isset($field['multiple'])?$field['multiple']:false);
|
||||
$uploader->setUseAjax(isset($field['ajax'])?$field['ajax']:false);
|
||||
$uploader->setDisplayImage(isset($field['display_image'])?$field['display_image']:false);
|
||||
$uploader->setImage(isset($field['image'])?$field['image']:null);
|
||||
$uploader->setThumb(isset($field['thumb'])?$field['thumb']:null);
|
||||
$uploader->setSize(isset($field['size'])?$field['size']:null);
|
||||
$uploader->setTitle(isset($field['title'])?$field['title']:null);
|
||||
$uploader->setDeleteUrl(isset($field['delete_url'])?$field['delete_url']:null);
|
||||
|
||||
if (isset($field['images']))
|
||||
$uploader->setImages($field['images']);
|
||||
elseif (isset($field['image'])) // Use for retrocompatibility
|
||||
$uploader->setImages(array(
|
||||
0 => array(
|
||||
'image' => isset($field['image'])?$field['image']:null,
|
||||
'size' => isset($field['size'])?$field['size']:null,
|
||||
'delete_url' => isset($field['delete_url'])?$field['delete_url']:null
|
||||
)));
|
||||
|
||||
$uploader->setThumb(isset($field['thumb'])?$field['thumb']:null);
|
||||
$uploader->setTitle(isset($field['title'])?$field['title']:null);
|
||||
$field['file'] = $uploader->render();
|
||||
}
|
||||
|
||||
|
||||
// Cast options values if specified
|
||||
if ($field['type'] == 'select' && isset($field['cast']))
|
||||
foreach ($field['list'] as $option_key => $option)
|
||||
|
||||
@@ -31,13 +31,10 @@ class HelperUploaderCore extends Uploader
|
||||
const DEFAULT_AJAX_TEMPLATE = 'ajax.tpl';
|
||||
|
||||
private $_context;
|
||||
private $_delete_url;
|
||||
private $_display_image;
|
||||
private $_id;
|
||||
private $_image;
|
||||
private $_images;
|
||||
private $_name;
|
||||
private $_multiple;
|
||||
private $_size;
|
||||
private $_file;
|
||||
protected $_template;
|
||||
private $_template_directory;
|
||||
@@ -60,23 +57,6 @@ class HelperUploaderCore extends Uploader
|
||||
return $this->_context;
|
||||
}
|
||||
|
||||
public function setDeleteUrl($value)
|
||||
{
|
||||
$this->_delete_url = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getDeleteUrl()
|
||||
{
|
||||
return $this->_delete_url;
|
||||
}
|
||||
|
||||
public function setDisplayImage($value)
|
||||
{
|
||||
$this->_display_image = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setId($value)
|
||||
{
|
||||
$this->_id = (string)$value;
|
||||
@@ -91,15 +71,18 @@ class HelperUploaderCore extends Uploader
|
||||
return $this->_id;
|
||||
}
|
||||
|
||||
public function setImage($value)
|
||||
public function setImages($value)
|
||||
{
|
||||
$this->_image = $value;
|
||||
$this->_images = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getImage()
|
||||
public function getImages()
|
||||
{
|
||||
return $this->_image;
|
||||
if (!isset($this->_images))
|
||||
$this->_images = array();
|
||||
|
||||
return $this->_images;
|
||||
}
|
||||
|
||||
public function setName($value)
|
||||
@@ -119,17 +102,6 @@ class HelperUploaderCore extends Uploader
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setSize($value)
|
||||
{
|
||||
$this->_size = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getSize()
|
||||
{
|
||||
return $this->_size;
|
||||
}
|
||||
|
||||
public function setTemplate($value)
|
||||
{
|
||||
$this->_template = $value;
|
||||
@@ -246,11 +218,6 @@ class HelperUploaderCore extends Uploader
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function displayImage()
|
||||
{
|
||||
return (isset($this->_display_image) && $this->_display_image);
|
||||
}
|
||||
|
||||
public function isMultiple()
|
||||
{
|
||||
return (isset($this->_multiple) && $this->_multiple);
|
||||
@@ -297,7 +264,6 @@ class HelperUploaderCore extends Uploader
|
||||
|
||||
$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())
|
||||
@@ -312,12 +278,9 @@ class HelperUploaderCore extends Uploader
|
||||
'name' => $this->getName(),
|
||||
'url' => $this->getUrl(),
|
||||
'multiple' => $this->isMultiple(),
|
||||
'display_image' => $this->displayImage(),
|
||||
'image' => $this->getImage(),
|
||||
'images' => $this->getImages(),
|
||||
'thumb' => $this->getThumb(),
|
||||
'file' => $this->getFile(),
|
||||
'size' => $this->getSize(),
|
||||
'delete_url' => $this->getDeleteUrl(),
|
||||
'title' => $this->getTitle()
|
||||
));
|
||||
|
||||
|
||||
@@ -70,26 +70,33 @@ class AdminCmsControllerCore extends AdminController
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function initPageHeaderToolbar()
|
||||
{
|
||||
$this->page_header_toolbar_btn['save-and-preview'] = array(
|
||||
'href' => '#',
|
||||
'desc' => $this->l('Save and preview')
|
||||
);
|
||||
$this->page_header_toolbar_btn['save-and-stay'] = array(
|
||||
'short' => 'SaveAndStay',
|
||||
'href' => '#',
|
||||
'desc' => $this->l('Save and stay'),
|
||||
);
|
||||
|
||||
return parent::initPageHeaderToolbar();
|
||||
}
|
||||
|
||||
public function renderForm()
|
||||
{
|
||||
if (!$this->loadObject(true))
|
||||
return;
|
||||
|
||||
|
||||
if (Validate::isLoadedObject($this->object))
|
||||
$this->display = 'edit';
|
||||
else
|
||||
$this->display = 'add';
|
||||
|
||||
$this->toolbar_btn['save-and-preview'] = array(
|
||||
'href' => '#',
|
||||
'desc' => $this->l('Save and preview')
|
||||
);
|
||||
$this->toolbar_btn['save-and-stay'] = array(
|
||||
'short' => 'SaveAndStay',
|
||||
'href' => '#',
|
||||
'desc' => $this->l('Save and stay'),
|
||||
);
|
||||
$this->initToolbar();
|
||||
$this->initPageHeaderToolbar();
|
||||
|
||||
$categories = CMSCategory::getCategories($this->context->language->id, false);
|
||||
$html_categories = CMSCategory::recurseCMSCategory($categories, $categories[0][1], 1, $this->getFieldValue($this->object, 'id_cms_category'), 1);
|
||||
@@ -226,16 +233,7 @@ class AdminCmsControllerCore extends AdminController
|
||||
public function postProcess()
|
||||
{
|
||||
if (Tools::isSubmit('viewcms') && ($id_cms = (int)Tools::getValue('id_cms')) && ($cms = new CMS($id_cms, $this->context->language->id)) && Validate::isLoadedObject($cms))
|
||||
{
|
||||
$redir = $this->context->link->getCMSLink($cms);
|
||||
if (!$cms->active)
|
||||
{
|
||||
$admin_dir = dirname($_SERVER['PHP_SELF']);
|
||||
$admin_dir = substr($admin_dir, strrpos($admin_dir, '/') + 1);
|
||||
$redir .= '?adtoken='.Tools::getAdminTokenLite('AdminCmsContent').'&ad='.$admin_dir.'&id_employee='.(int)$this->context->employee->id;
|
||||
}
|
||||
Tools::redirectAdmin($redir);
|
||||
}
|
||||
$this->redirect_after = $this->getPreviewUrl($cms);
|
||||
elseif (Tools::isSubmit('deletecms'))
|
||||
{
|
||||
if (Tools::getValue('id_cms') == Configuration::get('PS_CONDITIONS_CMS_ID'))
|
||||
@@ -301,27 +299,7 @@ class AdminCmsControllerCore extends AdminController
|
||||
$this->updateAssoShop($cms->id);
|
||||
}
|
||||
if (Tools::isSubmit('submitAddcmsAndPreview'))
|
||||
{
|
||||
$alias = $this->getFieldValue($cms, 'link_rewrite', $this->context->language->id);
|
||||
$preview_url = $this->context->link->getCMSLink($cms, $alias, $this->context->language->id);
|
||||
|
||||
if (!$cms->active)
|
||||
{
|
||||
$admin_dir = dirname($_SERVER['PHP_SELF']);
|
||||
$admin_dir = substr($admin_dir, strrpos($admin_dir, '/') + 1);
|
||||
$params = http_build_query(array(
|
||||
'adtoken' => Tools::getAdminTokenLite('AdminCmsContent'),
|
||||
'ad' => $admin_dir,
|
||||
'id_employee' => (int)$this->context->employee->id)
|
||||
);
|
||||
if (Configuration::get('PS_REWRITING_SETTINGS'))
|
||||
$params = '?'.$params;
|
||||
else
|
||||
$params = '&'.$params;
|
||||
$preview_url .= $cms->active ? '' : $params;
|
||||
}
|
||||
Tools::redirectAdmin($preview_url);
|
||||
}
|
||||
$this->redirect_after = $this->previewUrl($cms);
|
||||
elseif (Tools::isSubmit('submitAdd'.$this->table.'AndStay'))
|
||||
Tools::redirectAdmin(self::$currentIndex.'&'.$this->identifier.'='.$cms->id.'&conf=4&update'.$this->table.'&token='.Tools::getAdminTokenLite('AdminCmsContent'));
|
||||
else
|
||||
@@ -380,6 +358,23 @@ class AdminCmsControllerCore extends AdminController
|
||||
else
|
||||
parent::postProcess(true);
|
||||
}
|
||||
|
||||
public function getPreviewUrl(CMS $cms)
|
||||
{
|
||||
$preview_url = $this->context->link->getCMSLink($cms, null, null, $this->context->language->id);
|
||||
if (!$cms->active)
|
||||
{
|
||||
$params = http_build_query(array(
|
||||
'adtoken' => Tools::getAdminTokenLite('AdminCmsContent'),
|
||||
'ad' => substr(dirname($_SERVER['PHP_SELF']), strrpos(dirname($_SERVER['PHP_SELF']), '/') + 1),
|
||||
'id_employee' => (int)$this->context->employee->id
|
||||
)
|
||||
);
|
||||
$preview_url .= (strpos($preview_url, '?') === false ? '?' : '&').$params;
|
||||
}
|
||||
|
||||
return $preview_url;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -2430,11 +2430,58 @@ class AdminProductsControllerCore extends AdminController
|
||||
{
|
||||
if (empty($this->display))
|
||||
$this->page_header_toolbar_btn['new_product'] = array(
|
||||
'href' => self::$currentIndex.'&addproduct&token='.$this->token,
|
||||
'desc' => $this->l('Add new product'),
|
||||
'icon' => 'process-icon-new'
|
||||
);
|
||||
'href' => self::$currentIndex.'&addproduct&token='.$this->token,
|
||||
'desc' => $this->l('Add new product'),
|
||||
'icon' => 'process-icon-new'
|
||||
);
|
||||
if ($this->display == 'edit' || $this->display == 'add')
|
||||
{
|
||||
if (($product = $this->loadObject(true)))
|
||||
{
|
||||
// adding button for duplicate this product
|
||||
if ($this->tabAccess['add'] && $this->display != 'add')
|
||||
$this->page_header_toolbar_btn['duplicate'] = array(
|
||||
'short' => 'Duplicate',
|
||||
'desc' => $this->l('Duplicate'),
|
||||
'confirm' => 1,
|
||||
'js' => 'if (confirm(\''.$this->l('Also copy images').' ?\')) document.location = \''.$this->context->link->getAdminLink('AdminProducts').'&id_product='.(int)$product->id.'&duplicateproduct\'; else document.location = \''.$this->context->link->getAdminLink('AdminProducts').'&id_product='.(int)$product->id.'&duplicateproduct&noimage=1\';'
|
||||
);
|
||||
|
||||
// adding button for preview this product
|
||||
if ($url_preview = $this->getPreviewUrl($product))
|
||||
$this->page_header_toolbar_btn['preview'] = array(
|
||||
'short' => 'Preview',
|
||||
'href' => $url_preview,
|
||||
'desc' => $this->l('Preview'),
|
||||
'target' => true,
|
||||
'class' => 'previewUrl'
|
||||
);
|
||||
|
||||
// adding button for preview this product statistics
|
||||
if (file_exists(_PS_MODULE_DIR_.'statsproduct/statsproduct.php') && $this->display != 'add')
|
||||
$this->page_header_toolbar_btn['stats'] = array(
|
||||
'short' => 'Statistics',
|
||||
'href' => $this->context->link->getAdminLink('AdminStats').'&module=statsproduct&id_product='.(int)$product->id,
|
||||
'desc' => $this->l('Product sales'),
|
||||
);
|
||||
|
||||
// adding button for delete this product
|
||||
if ($this->tabAccess['delete'] && $this->display != 'add')
|
||||
$this->page_header_toolbar_btn['delete'] = array(
|
||||
'short' => 'Delete',
|
||||
'href' => $this->context->link->getAdminLink('AdminProducts').'&id_product='.(int)$product->id.'&deleteproduct',
|
||||
'desc' => $this->l('Delete this product'),
|
||||
'confirm' => 1,
|
||||
'js' => 'if (confirm(\''.$this->l('Delete product?').'\')){return true;}else{event.preventDefault();}'
|
||||
);
|
||||
|
||||
$this->page_header_toolbar_btn['save-and-stay'] = array(
|
||||
'short' => 'SaveAndStay',
|
||||
'href' => '#',
|
||||
'desc' => $this->l('Save and stay'),
|
||||
);
|
||||
}
|
||||
}
|
||||
parent::initPageHeaderToolbar();
|
||||
}
|
||||
|
||||
@@ -2443,76 +2490,25 @@ class AdminProductsControllerCore extends AdminController
|
||||
parent::initToolbar();
|
||||
if ($this->display == 'edit' || $this->display == 'add')
|
||||
{
|
||||
if ($product = $this->loadObject(true))
|
||||
{
|
||||
if ($this->tabAccess['edit'])
|
||||
{
|
||||
$this->toolbar_btn['save'] = array(
|
||||
'short' => 'Save',
|
||||
'href' => '#',
|
||||
'desc' => $this->l('Save'),
|
||||
);
|
||||
$this->toolbar_btn['save'] = array(
|
||||
'short' => 'Save',
|
||||
'href' => '#',
|
||||
'desc' => $this->l('Save'),
|
||||
);
|
||||
|
||||
$this->toolbar_btn['save-and-stay'] = array(
|
||||
'short' => 'SaveAndStay',
|
||||
'href' => '#',
|
||||
'desc' => $this->l('Save and stay'),
|
||||
);
|
||||
}
|
||||
$this->toolbar_btn['save-and-stay'] = array(
|
||||
'short' => 'SaveAndStay',
|
||||
'href' => '#',
|
||||
'desc' => $this->l('Save and stay'),
|
||||
);
|
||||
|
||||
if ((bool)$product->id)
|
||||
{
|
||||
// adding button for duplicate this product
|
||||
if ($this->tabAccess['add'] && $this->display != 'add')
|
||||
$this->toolbar_btn['duplicate'] = array(
|
||||
'short' => 'Duplicate',
|
||||
'desc' => $this->l('Duplicate'),
|
||||
'confirm' => 1,
|
||||
'js' => 'if (confirm(\''.$this->l('Also copy images').' ?\')) document.location = \''.$this->context->link->getAdminLink('AdminProducts').'&id_product='.(int)$product->id.'&duplicateproduct\'; else document.location = \''.$this->context->link->getAdminLink('AdminProducts').'&id_product='.(int)$product->id.'&duplicateproduct&noimage=1\';'
|
||||
);
|
||||
|
||||
// adding button for preview this product
|
||||
if ($url_preview = $this->getPreviewUrl($product))
|
||||
$this->toolbar_btn['preview'] = array(
|
||||
'short' => 'Preview',
|
||||
'href' => $url_preview,
|
||||
'desc' => $this->l('Preview'),
|
||||
'target' => true,
|
||||
'class' => 'previewUrl'
|
||||
);
|
||||
|
||||
// adding button for preview this product statistics
|
||||
if (file_exists(_PS_MODULE_DIR_.'statsproduct/statsproduct.php') && $this->display != 'add')
|
||||
$this->toolbar_btn['stats'] = array(
|
||||
'short' => 'Statistics',
|
||||
'href' => $this->context->link->getAdminLink('AdminStats').'&module=statsproduct&id_product='.(int)$product->id,
|
||||
'desc' => $this->l('Product sales'),
|
||||
);
|
||||
|
||||
// adding button for adding a new combination in Combination tab
|
||||
$this->toolbar_btn['newCombination'] = array(
|
||||
'short' => 'New combination',
|
||||
'desc' => $this->l('New combination'),
|
||||
'class' => 'toolbar-new'
|
||||
);
|
||||
|
||||
// adding button for delete this product
|
||||
if ($this->tabAccess['delete'] && $this->display != 'add')
|
||||
$this->toolbar_btn['delete'] = array(
|
||||
'short' => 'Delete',
|
||||
'href' => $this->context->link->getAdminLink('AdminProducts').'&id_product='.(int)$product->id.'&deleteproduct',
|
||||
'desc' => $this->l('Delete this product'),
|
||||
'confirm' => 1,
|
||||
'js' => 'if (confirm(\''.$this->l('Delete product?').'\')){return true;}else{event.preventDefault();}'
|
||||
);
|
||||
}
|
||||
}
|
||||
// adding button for adding a new combination in Combination tab
|
||||
$this->toolbar_btn['newCombination'] = array(
|
||||
'short' => 'New combination',
|
||||
'desc' => $this->l('New combination'),
|
||||
'class' => 'toolbar-new'
|
||||
);
|
||||
}
|
||||
else
|
||||
$this->toolbar_btn['import'] = array(
|
||||
'href' => $this->context->link->getAdminLink('AdminImport', true).'&import_type=products',
|
||||
'desc' => $this->l('Import')
|
||||
);
|
||||
|
||||
$this->context->smarty->assign('toolbar_scroll', 1);
|
||||
$this->context->smarty->assign('show_toolbar', 1);
|
||||
|
||||
Reference in New Issue
Block a user