New: Adding a box add it on column with the less boxes.

This commit is contained in:
Laurent Destailleur 2012-08-27 14:47:20 +02:00
parent b57de4fbac
commit 426b3c2627

View File

@ -54,7 +54,12 @@ print '<!-- Ajax page called with url '.$_SERVER["PHP_SELF"].'?'.$_SERVER["QUERY
// Add a box
if ($boxid > 0 && $zone !='' && $userid > 0)
{
$boxorder=preg_replace('/^A:/','A:'.$boxid.',',$boxorder); // Insert id of new box into list
$tmp=explode('-',$boxorder);
$nbboxonleft=substr_count($tmp[0],',');
$nbboxonright=substr_count($tmp[1],',');
print $nbboxonleft.'-'.$nbboxonright;
if ($nbboxonleft > $nbboxonright) $boxorder=preg_replace('/B:/','B:'.$boxid.',',$boxorder); // Insert id of new box into list
else $boxorder=preg_replace('/^A:/','A:'.$boxid.',',$boxorder); // Insert id of new box into list
}
// Registering the location of boxes after a move