Merge branch 'bootstrap' of https://github.com/PrestaShop/PrestaShop into bootstrap

This commit is contained in:
Kevin Granger
2013-10-02 13:59:04 +02:00
7 changed files with 147 additions and 138 deletions
@@ -22,7 +22,8 @@
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
<div id="ajax_confirmation" class="alert alert-success" style="display:none"></div>
{* ajaxBox allows*} <div id="ajaxBox" style="display:none"></div>
{if isset($content)}
{if isset($show_page_header_toolbar) && $show_page_header_toolbar}
<div class="leadin">
@@ -172,7 +172,7 @@
{include file="toolbar.tpl" toolbar_btn=$toolbar_btn toolbar_scroll=$toolbar_scroll title=$title}
<div class="leadin">{block name="leadin"}{/block}</div>
{/if}
<div class="row">
<div class="productTabs col-lg-2">
<div class="tab list-group">
{foreach $profiles as $profile}
@@ -416,11 +416,14 @@
</fieldset>
</div>
{else}
<fieldset>
{l s='Administrator permissions cannot be modified.'}
</fieldset>
<div class="col-lg-12">
<fieldset>
{l s='Administrator permissions cannot be modified.'}
</fieldset>
</div>
{/if}
</div>
</div>
{/foreach}
</form>
</form>
</div>
@@ -66,8 +66,6 @@
});
</script>
</div>
<div id="ajax_confirmation" style="display:none"></div>
{* ajaxBox allows*} <div id="ajaxBox" style="display:none"></div>
{/if}
</body>
</html>
@@ -23,6 +23,6 @@
* International Registered Trademark & Property of PrestaShop SA
*}
<a href="#" id="details_{$params.action}_{$id}" title="{$action}" onclick="display_action_details('{$id}', '{$controller}', '{$token}', '{$params.action}', {$json_params|escape}); return false" class="">
<i class="icon-collapse"></i> {$action}
<a href="{$href}" id="details_{$params.action}_{$id}" title="{$action}" class="">
<i class="icon-tasks"></i> {$action}
</a>
+23 -1
View File
@@ -1528,7 +1528,7 @@ class AdminControllerCore extends Controller
$this->errors[] = Tools::displayError('You do not have permission to view this.');
return;
}
$this->getLanguages();
// toolbar (save, cancel, new, ..)
$this->initToolbar();
@@ -1547,6 +1547,10 @@ class AdminControllerCore extends Controller
$this->loadObject(true);
$this->content .= $this->renderView();
}
elseif ($this->display == 'details')
{
$this->content .= $this->renderDetails();
}
elseif (!$this->ajax)
{
$this->content .= $this->renderModulesList();
@@ -1722,6 +1726,14 @@ class AdminControllerCore extends Controller
return $view;
}
/**
* Override to render the view page
*/
public function renderDetails()
{
return $this->renderList();
}
/**
* Function used to render the form for this controller
*/
@@ -2147,6 +2159,16 @@ class AdminControllerCore extends Controller
else
$this->errors[] = Tools::displayError('You do not have permission to view this.');
}
elseif (isset($_GET['details'.$this->table]))
{
if ($this->tabAccess['view'] === '1')
{
$this->display = 'details';
$this->action = 'details';
}
else
$this->errors[] = Tools::displayError('You do not have permission to view this.');
}
elseif (isset($_GET['export'.$this->table]))
{
if ($this->tabAccess['view'] === '1')
+1
View File
@@ -388,6 +388,7 @@ class HelperListCore extends Helper
$tpl->assign(array(
'id' => Tools::safeOutput($id),
'href' => Tools::safeOutput($this->currentIndex.'&'.$this->identifier.'='.$id.'&details'.$this->table.'&token='.($token != null ? $token : $this->token)),
'controller' => str_replace('Controller', '', get_class($this->context->controller)),
'token' => Tools::safeOutput($token != null ? $token : $this->token),
'action' => self::$cache_lang['Details'],
@@ -34,6 +34,7 @@ class AdminStockManagementControllerCore extends AdminController
$this->bootstrap = true;
$this->context = Context::getContext();
$this->table = 'product';
$this->list_id = 'product';
$this->className = 'Product';
$this->lang = true;
$this->multishop_context = Shop::CONTEXT_ALL;
@@ -41,17 +42,14 @@ class AdminStockManagementControllerCore extends AdminController
$this->fields_list = array(
'reference' => array(
'title' => $this->l('Product reference'),
'align' => 'center',
'filter_key' => 'a!reference'
),
'ean13' => array(
'title' => $this->l('EAN13'),
'align' => 'center',
'filter_key' => 'a!ean13'
),
'upc' => array(
'title' => $this->l('UPC'),
'align' => 'center',
'filter_key' => 'a!upc'
),
'name' => array(
@@ -80,7 +78,15 @@ class AdminStockManagementControllerCore extends AdminController
public function initPageHeaderToolbar()
{
$this->page_header_toolbar_title = $this->l('Stock management');
$this->page_header_toolbar_title = $this->l('Stock management');
if ($this->display == 'details')
$this->page_header_toolbar_btn['back_to_list'] = array(
'href' => Context::getContext()->link->getAdminLink('AdminStockManagement'),
'desc' => $this->l('Back to list'),
'icon' => 'process-icon-back'
);
parent::initPageHeaderToolbar();
}
@@ -94,7 +100,9 @@ class AdminStockManagementControllerCore extends AdminController
$this->addRowAction('details');
$this->addRowAction('addstock');
$this->addRowAction('removestock');
$this->addRowAction('transferstock');
if (count(Warehouse::getWarehouses()) > 1)
$this->addRowAction('transferstock');
// no link on list rows
$this->list_no_link = true;
@@ -793,109 +801,76 @@ class AdminStockManagementControllerCore extends AdminController
}
}
public function renderView()
public function renderDetails()
{
if (Tools::isSubmit('id'))
if (Tools::isSubmit('id_product'))
{
// override attributes
$this->identifier = 'id_product_attribute';
$this->display = 'list';
$this->list_id = 'product_attribute';
$this->lang = false;
$this->addRowAction('addstock');
$this->addRowAction('removestock');
$this->addRowAction('transferstock');
if (count(Warehouse::getWarehouses()) > 1)
$this->addRowAction('transferstock');
// no link on list rows
$this->list_no_link = true;
// inits toolbar
$this->toolbar_btn = array();
// get current lang id
$lang_id = (int)$this->context->language->id;
// Get product id
$product_id = (int)Tools::getValue('id');
$product_id = (int)Tools::getValue('id_product');
// Load product attributes with sql override
$this->table = 'product_attribute';
$this->list_id = 'product_attribute';
$this->_select = 'a.id_product_attribute as id, a.id_product, a.reference, a.ean13, a.upc';
$this->_where = 'AND a.id_product = '.$product_id;
$this->_group = 'GROUP BY a.id_product_attribute';
// get list and force no limit clause in the request
$this->getList($this->context->language->id, null, null, 0, false);
$this->fields_list = array(
'reference' => array(
'title' => $this->l('Product reference'),
'filter_key' => 'a!reference'
),
'ean13' => array(
'title' => $this->l('EAN13'),
'filter_key' => 'a!ean13'
),
'upc' => array(
'title' => $this->l('UPC'),
'filter_key' => 'a!upc'
),
'name' => array(
'title' => $this->l('Name'),
'orderby' => false,
'filter' => false,
'search' => false
),
'stock' => array(
'title' => $this->l('Quantity'),
'orderby' => false,
'filter' => false,
'search' => false,
'class' => 'fixed-width-sm',
'align' => 'center',
'hint' => $this->l('Quantitity total for all warehouses.')
),
);
// Render list
$helper = new HelperList();
$helper->bulk_actions = array();
$helper->toolbar_scroll = $this->toolbar_scroll;
$helper->show_toolbar = false;
$helper->actions = $this->actions;
$helper->list_skip_actions = $this->list_skip_actions;
$helper->no_link = true;
$helper->shopLinkType = '';
$helper->identifier = $this->identifier;
// Force render - no filter, form, js, sorting ...
$helper->simple_header = true;
$content = $helper->generateList($this->_list, $this->fields_list);
return parent::renderView();
self::$currentIndex = self::$currentIndex.'&id_product='.(int)$product_id.'&detailsproduct';
$this->processFilter();
return parent::renderList();
}
}
/**
* method call when ajax request is made with the details row action
* @see AdminController::postProcess()
*/
public function ajaxProcess()
{
// test if an id is submit
if (Tools::isSubmit('id'))
{
// override attributes
$this->identifier = 'id_product_attribute';
$this->display = 'list';
$this->lang = false;
$this->addRowAction('addstock');
$this->addRowAction('removestock');
$this->addRowAction('transferstock');
// get current lang id
$lang_id = (int)$this->context->language->id;
// Get product id
$product_id = (int)Tools::getValue('id');
// Load product attributes with sql override
$this->table = 'product_attribute';
$this->_select = 'a.id_product_attribute as id, a.id_product, a.reference, a.ean13, a.upc';
$this->_where = 'AND a.id_product = '.$product_id;
$this->_group = 'GROUP BY a.id_product_attribute';
// get list and force no limit clause in the request
$this->getList($this->context->language->id, null, null, 0, false);
// Render list
$helper = new HelperList();
$helper->bulk_actions = array();
$helper->toolbar_scroll = $this->toolbar_scroll;
$helper->show_toolbar = false;
$helper->actions = $this->actions;
$helper->list_skip_actions = $this->list_skip_actions;
$helper->no_link = true;
$helper->shopLinkType = '';
$helper->identifier = $this->identifier;
// Force render - no filter, form, js, sorting ...
$helper->simple_header = true;
$content = $helper->generateList($this->_list, $this->fields_list);
echo Tools::jsonEncode(array('use_parent_structure' => false, 'data' => $content));
}
die;
}
/**
* AdminController::getList() override
* @see AdminController::getList()
@@ -904,54 +879,52 @@ class AdminStockManagementControllerCore extends AdminController
{
parent::getList($id_lang, $order_by, $order_way, $start, $limit, $id_lang_shop);
if ($this->display == 'list')
// Check each row to see if there are combinations and get the correct action in consequence
$nb_items = count($this->_list);
for ($i = 0; $i < $nb_items; $i++)
{
// Check each row to see if there are combinations and get the correct action in consequence
$nb_items = count($this->_list);
$item = &$this->_list[$i];
for ($i = 0; $i < $nb_items; $i++)
// if it's an ajax request we have to consider manipulating a product variation
if (Tools::isSubmit('id_product'))
{
$item = &$this->_list[$i];
$item['name'] = Product::getProductName($item['id_product'], $item['id']);
// no details for this row
$this->addRowActionSkipList('details', array($item['id']));
// if it's an ajax request we have to consider manipulating a product variation
if ($this->ajax == '1')
{
$item['name'] = Product::getProductName($item['id_product'], $item['id']);
// no details for this row
$this->addRowActionSkipList('details', array($item['id']));
// specify actions in function of stock
$this->skipActionByStock($item, true);
// specify actions in function of stock
$this->skipActionByStock($item, true);
}
// If current product has variations
else if ((int)$item['variations'] > 0)
{
// we have to desactivate stock actions on current row
$this->addRowActionSkipList('addstock', array($item['id']));
$this->addRowActionSkipList('removestock', array($item['id']));
$this->addRowActionSkipList('transferstock', array($item['id']));
// does not display these informaions because this product has combinations
$item['reference'] = '--';
$item['ean13'] = '--';
$item['upc'] = '--';
}
else
{
//there are no variations of current product, so we don't want to show details action
$this->addRowActionSkipList('details', array($item['id']));
// specify actions in function of stock
$this->skipActionByStock($item, false);
}
// Checks access
if (!($this->tabAccess['add'] === '1'))
$this->addRowActionSkipList('addstock', array($item['id']));
if (!($this->tabAccess['delete'] === '1'))
$this->addRowActionSkipList('removestock', array($item['id']));
if (!($this->tabAccess['edit'] === '1'))
$this->addRowActionSkipList('transferstock', array($item['id']));
}
// If current product has variations
else if (array_key_exists('variations', $item) && (int)$item['variations'] > 0)
{
// we have to desactivate stock actions on current row
$this->addRowActionSkipList('addstock', array($item['id']));
$this->addRowActionSkipList('removestock', array($item['id']));
$this->addRowActionSkipList('transferstock', array($item['id']));
// does not display these informaions because this product has combinations
$item['reference'] = '--';
$item['ean13'] = '--';
$item['upc'] = '--';
}
else
{
//there are no variations of current product, so we don't want to show details action
$this->addRowActionSkipList('details', array($item['id']));
// specify actions in function of stock
$this->skipActionByStock($item, false);
}
// Checks access
if (!($this->tabAccess['add'] === '1'))
$this->addRowActionSkipList('addstock', array($item['id']));
if (!($this->tabAccess['delete'] === '1'))
$this->addRowActionSkipList('removestock', array($item['id']));
if (!($this->tabAccess['edit'] === '1'))
$this->addRowActionSkipList('transferstock', array($item['id']));
}
}
@@ -1115,7 +1088,7 @@ class AdminStockManagementControllerCore extends AdminController
}
else
{
$this->display = 'list';
//$this->display = 'list';
parent::initContent();
}
}
@@ -1190,6 +1163,17 @@ class AdminStockManagementControllerCore extends AdminController
$this->warnings[md5('PS_ADVANCED_STOCK_MANAGEMENT')] = $this->l('You need to activate advanced stock management prior to using this feature.');
return false;
}
if (Tools::getIsset('detailsproduct'))
{
$this->list_id = 'product_attribute';
if (isset($_POST['submitReset'.$this->list_id]))
$this->processResetFilters();
}
else
$this->list_id = 'product';
parent::initProcess();
}
}