[-] BO : fix bug #PSTEST-913 - drag and drop position change for tabs broken in AdminTabsController

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@13757 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
tDidierjean
2012-02-29 17:04:20 +00:00
parent 8aba4e0878
commit 5fec2e36fd
2 changed files with 34 additions and 0 deletions
+25
View File
@@ -912,3 +912,28 @@ if (Tools::isSubmit('getZones'))
die(Tools::jsonEncode($html));
}
/* Modify carrier position */
if (Tools::isSubmit('ajaxTabsPositions'))
{
$way = (int)(Tools::getValue('way'));
$id_tab = (int)(Tools::getValue('id_tab'));
$positions = Tools::getValue('tab');
foreach ($positions as $position => $value)
{
$pos = explode('_', $value);
if (isset($pos[2]) && (int)$pos[2] === $id_tab)
{
if ($tab = new Tab((int)$pos[2]))
if (isset($position) && $tab->updatePosition($way, $position))
echo "ok position ".(int)$position." for tab ".(int)$pos[1]."\r\n";
else
echo '{"hasError" : true, "errors" : "Can not update tab '. (int)$id_tab . ' to position '.(int)$position.' "}';
else
echo '{"hasError" : true, "errors" : "This tab ('.(int)$id_tab.') can t be loaded"}';
break;
}
}
}
+9
View File
@@ -152,6 +152,15 @@ function initTableDnD(table)
}
}
if (table.id == 'tab') {
params = {
ajaxTabsPositions: true,
id_tab : ids[2],
way: way,
token: token
}
}
$.ajax({
type: 'POST',
async: false,