[-] MO : fix bug #PSTEST-1178 - block CMS position drag and drop was not implemented

This commit is contained in:
tDidierjean
2012-04-19 14:34:51 +00:00
parent bc881650fa
commit 0c0b412971
3 changed files with 29 additions and 22 deletions
+7 -18
View File
@@ -50,24 +50,12 @@ function initTableDnD(table)
var tableDrag = table; var tableDrag = table;
var params = ''; var params = '';
if (table.id == 'cms_block_0') if (table.id == 'cms_block_0' || table.id == 'cms_block_1')
params = { params = {
ajaxCMSBlockPositions: true, updatePositions: true,
id_cms_block: ids[1], configure: 'blockcms'
position: ids[2],
way: way,
token: token
}; };
if (table.id == 'cms_block_1') else if (table.id == 'category')
params = {
ajaxCMSBlockPositions: true,
id_cms_block: ids[1],
position: ids[2],
way: way,
token: token
};
if (table.id == 'category')
params = { params = {
action: 'updatePositions', action: 'updatePositions',
id_category_parent: ids[1], id_category_parent: ids[1],
@@ -118,8 +106,9 @@ function initTableDnD(table)
way: way way: way
}; };
} }
// default
if (!params) { else
{
params = { params = {
action : 'updatePositions', action : 'updatePositions',
id : ids[2], id : ids[2],
+21 -3
View File
@@ -436,7 +436,7 @@ class BlockCms extends Module
return $helper; return $helper;
} }
private function changePosition() protected function changePosition()
{ {
if (!Validate::isInt(Tools::getValue('position')) || if (!Validate::isInt(Tools::getValue('position')) ||
(Tools::getValue('location') != BlockCMSModel::LEFT_COLUMN && (Tools::getValue('location') != BlockCMSModel::LEFT_COLUMN &&
@@ -638,8 +638,9 @@ class BlockCms extends Module
else if (Tools::isSubmit('deleteBlockCMSConfirmation')) else if (Tools::isSubmit('deleteBlockCMSConfirmation'))
$this->_html .= $this->displayConfirmation($this->l('Deletion successful')); $this->_html .= $this->displayConfirmation($this->l('Deletion successful'));
else if (Tools::isSubmit('id_cms_block') && Tools::isSubmit('way') && Tools::isSubmit('position') && Tools::isSubmit('location')) else if (Tools::isSubmit('id_cms_block') && Tools::isSubmit('way') && Tools::isSubmit('position') && Tools::isSubmit('location'))
$this->changePosition() $this->changePosition();
; else if (Tools::isSubmit('updatePositions'))
$this->updatePositionsDnd();
if (count($this->_errors)) if (count($this->_errors))
{ {
foreach ($this->_errors as $err) foreach ($this->_errors as $err)
@@ -727,4 +728,21 @@ class BlockCms extends Module
return $this->display(__FILE__, 'blockmobilecms.tpl'); return $this->display(__FILE__, 'blockmobilecms.tpl');
} }
protected function updatePositionsDnd()
{
if (Tools::getValue('cms_block_0'))
$positions = Tools::getValue('cms_block_0');
elseif (Tools::getValue('cms_block_1'))
$positions = Tools::getValue('cms_block_1');
else
$positions = array();
foreach ($positions as $position => $value)
{
$pos = explode('_', $value);
if (isset($pos[2]))
BlockCMSModel::updateCMSBlockPosition($pos[2], $position);
}
}
} }
+1 -1
View File
@@ -9,7 +9,7 @@ $_MODULE['<{blockcms}prestashop>blockcms_ea4788705e6873b424c65e91c2846b19'] = 'A
$_MODULE['<{blockcms}prestashop>blockcms_ef61fb324d729c341ea8ab9901e23566'] = 'Ajouter un bloc'; $_MODULE['<{blockcms}prestashop>blockcms_ef61fb324d729c341ea8ab9901e23566'] = 'Ajouter un bloc';
$_MODULE['<{blockcms}prestashop>blockcms_c9cc8cce247e49bae79f15173ce97354'] = 'Enregistrer'; $_MODULE['<{blockcms}prestashop>blockcms_c9cc8cce247e49bae79f15173ce97354'] = 'Enregistrer';
$_MODULE['<{blockcms}prestashop>blockcms_97390dd0b5ba7867120aee2ff22bfa38'] = 'Configuration du bloc CMS'; $_MODULE['<{blockcms}prestashop>blockcms_97390dd0b5ba7867120aee2ff22bfa38'] = 'Configuration du bloc CMS';
$_MODULE['<{blockcms}prestashop>blockcms_790dde5207c6635d6d743102c85395c0'] = 'Blocs CNS'; $_MODULE['<{blockcms}prestashop>blockcms_790dde5207c6635d6d743102c85395c0'] = 'Blocs CMS';
$_MODULE['<{blockcms}prestashop>blockcms_965be994da393e5aa15bd3a2444c6ccf'] = 'Configuration des liens CMS en pied de page'; $_MODULE['<{blockcms}prestashop>blockcms_965be994da393e5aa15bd3a2444c6ccf'] = 'Configuration des liens CMS en pied de page';
$_MODULE['<{blockcms}prestashop>blockcms_2a2dc7b7f184468f25c0504a0998be51'] = 'Lien de pied de page'; $_MODULE['<{blockcms}prestashop>blockcms_2a2dc7b7f184468f25c0504a0998be51'] = 'Lien de pied de page';
$_MODULE['<{blockcms}prestashop>blockcms_0b31e765f1e9cb451319b32e84a75a9e'] = 'Sélectionnez les pages que vous souhaitez afficher dans le bloc CMS de pied de page'; $_MODULE['<{blockcms}prestashop>blockcms_0b31e765f1e9cb451319b32e84a75a9e'] = 'Sélectionnez les pages que vous souhaitez afficher dans le bloc CMS de pied de page';