Problem with display table

Moderators: vni, NADEO

BaBiDi
Posts: 21
Joined: 18 Sep 2012, 18:52

Problem with display table

Post by BaBiDi » 12 Jan 2013, 23:26

Hello,

i have a small problem display table with my server.

Screen : Image

Same with any table.

Have you any idea where it can come ?

Sorry for my bad english.

User avatar
askuri
Posts: 278
Joined: 18 Oct 2011, 15:01
Location: Germany

Re: Problem with display table

Post by askuri » 13 Jan 2013, 08:33

No. But do it like me and build your own window and make an own list. You can better extend it later and yoh don't have this probelm ;)
ManiaCDN.net: the new free hoster for your custom content

Specs: i5 6600K; MSI Z170A Gaming Pro; 2x8GB Crucial DDR4 2133MHz; Intel HD Graphics 530; Windows 10 Home 64 Bit

BaBiDi
Posts: 21
Joined: 18 Sep 2012, 18:52

Re: Problem with display table

Post by BaBiDi » 13 Jan 2013, 13:41

Ok, but i'm haven't got knowledge to create my own windows and make my own list.

I think it just problem with php extention or suhosin but i don't see any thing in log.

User avatar
killer606
Posts: 459
Joined: 19 Jul 2011, 09:15
Contact:

Re: Problem with display table

Post by killer606 » 13 Jan 2013, 15:12

BaBiDi wrote:Ok, but i'm haven't got knowledge to create my own windows and make my own list.

I think it just problem with php extention or suhosin but i don't see any thing in log.
I have suhosin too but I dont get the error, so I think suhosin is not the reason.

User avatar
askuri
Posts: 278
Joined: 18 Oct 2011, 15:01
Location: Germany

Re: Problem with display table

Post by askuri » 14 Jan 2013, 15:30

If you mean only one map i listed, try to use the $smart->sql->get_list_assoc method/function. I'm not sury this is exactly the right name, maybe it stands in the wiki. Else look in the smart core and the sql class file both in includes folder.
My Smartsats could be a good example plugin ;)
ManiaCDN.net: the new free hoster for your custom content

Specs: i5 6600K; MSI Z170A Gaming Pro; 2x8GB Crucial DDR4 2133MHz; Intel HD Graphics 530; Windows 10 Home 64 Bit

BaBiDi
Posts: 21
Joined: 18 Sep 2012, 18:52

Re: Problem with display table

Post by BaBiDi » 14 Jan 2013, 16:17

All the map are listed. But Smart write all the row in one row. :?

User avatar
askuri
Posts: 278
Joined: 18 Oct 2011, 15:01
Location: Germany

Re: Problem with display table

Post by askuri » 17 Jan 2013, 07:27

I'm not familar with this, but did you made $row++ and $item++?
ManiaCDN.net: the new free hoster for your custom content

Specs: i5 6600K; MSI Z170A Gaming Pro; 2x8GB Crucial DDR4 2133MHz; Intel HD Graphics 530; Windows 10 Home 64 Bit

BaBiDi
Posts: 21
Joined: 18 Sep 2012, 18:52

Re: Problem with display table

Post by BaBiDi » 17 Jan 2013, 19:43

I don't touch anything in plugin/include file, "/list" is a default command. I take a look in "plugins.jukebox.php" :

Code: Select all

$mapid=0;
		$maps = array_slice($allmaps,$start,$max);
		foreach ($maps as $map)
		{
			$mapid++;
			$cell_number = 0;
			$row_number++;
			
			$row[$row_number][$cell_number]['text'] = ($mapid+$start).'.';
			$row[$row_number][$cell_number]['color'] = ($map['FileName'] == $smart->currentmap['FileName'] ? 'F00F':'FFFF');
			$row[$row_number][$cell_number]['width'] = '2';
			$cell_number++;
		
			$row[$row_number][$cell_number]['text'] = $smart->remove_sizes($map['Name']).($map['FileName'] == $smart->currentmap['FileName'] ? ' $F00(current)':'');;
			$row[$row_number][$cell_number]['color'] = 'FFFF';
			$row[$row_number][$cell_number]['width'] = '15';
			$cell_number++;
			
			$row[$row_number][$cell_number]['text'] = $map['Author'];
			$row[$row_number][$cell_number]['color'] = 'FFFF';
			$row[$row_number][$cell_number]['width'] = '10';
			$cell_number++;
			
			$row[$row_number][$cell_number]['text'] = $map['Environnement'];
			$row[$row_number][$cell_number]['color'] = 'FFFF';
			$row[$row_number][$cell_number]['width'] = '6';
			$cell_number++;
			
			$row[$row_number][$cell_number]['text'] = 'Juke';
			$row[$row_number][$cell_number]['action'] = $smart->register_manialink_answer('jukeboxmap', 'plugin_jukebox_list_addmap').($map['FileName']);
			$row[$row_number][$cell_number]['color'] = 'F90F';
			$row[$row_number][$cell_number]['width'] = '3';
			$cell_number++;
			
			if ($smart->is_operator($login))
			{
				$row[$row_number][$cell_number]['text'] = 'Next';
				$row[$row_number][$cell_number]['action'] = $smart->register_manialink_answer('jukenextmap', 'plugin_jukebox_list_selectnextmap').($map['FileName']);
				$row[$row_number][$cell_number]['color'] = 'F90F';
				$row[$row_number][$cell_number]['width'] = '5';
				$cell_number++;
			}
			
			if ($smart->is_admin($login))
			{
				$row[$row_number][$cell_number]['text'] = 'Remove';
				$row[$row_number][$cell_number]['action'] = $smart->register_manialink_answer('jukeremovemap', 'plugin_jukebox_list_removemap').($map['FileName']);
				$row[$row_number][$cell_number]['color'] = 'F90F';
				$row[$row_number][$cell_number]['width'] = '4';
				$cell_number++;
			}
			
			if ($smart->is_admin($login))
			{
				$row[$row_number][$cell_number]['text'] = 'Erase';
				$row[$row_number][$cell_number]['action'] = $smart->register_manialink_answer('jukeerasemap', 'plugin_jukebox_list_erasemap').($map['FileName']);
				$row[$row_number][$cell_number]['color'] = 'F90F';
				$row[$row_number][$cell_number]['width'] = '4';
				$cell_number++;
			}
			
		}
		$window->rows = $row;
No problem for me... but i have always this bug.

User avatar
askuri
Posts: 278
Joined: 18 Oct 2011, 15:01
Location: Germany

Re: Problem with display table

Post by askuri » 17 Jan 2013, 20:44

$row_number is nit initialized. And check everything relating to the row_number. Printing out the value of row_number at the end of the foreach loop might be helpful ;)
ManiaCDN.net: the new free hoster for your custom content

Specs: i5 6600K; MSI Z170A Gaming Pro; 2x8GB Crucial DDR4 2133MHz; Intel HD Graphics 530; Windows 10 Home 64 Bit

BaBiDi
Posts: 21
Joined: 18 Sep 2012, 18:52

Re: Problem with display table

Post by BaBiDi » 17 Jan 2013, 21:26

Code: Select all

function plugin_jukebox_list($smart, $login, $page)
{
	$max = 40;
	if (strtolower($smart->settings['general']->enable_sb_hiding) == 'false') $max = 10;
	
	$start = 1;
	if (!$page) $page = 1;
	$start = ($page-1)*$max;
	
	$smart->connection->client->query('GetMapList',9999,0);
	$allmaps = $smart->connection->client->getResponse();
	
	
		if ($smart->get_playervar($login,'JUKEBOXSORTING')) $allmaps = $smart->array_sort_by_key($allmaps, $smart->get_playervar($login,'JUKEBOXSORTING'));
	
		$window = new ManiaLinkWindow($smart, $smart->get_manialink_id('listwindow'));
		$window->closefunction = 'plugin_jukebox_list_close';
		$window->windowtitle = 'Map-List / Jukebox';
		$window->pos_y = 45;
		if (strtolower($smart->settings['general']->enable_sb_hiding) == 'true') $window->height = 74;
		
		$window->nextpagebuttonfunction = 'plugin_jukebox_list';
		$window->nextpagenumber = $page+1;
		
		$window->prevpagebuttonfunction = 'plugin_jukebox_list';
		$window->prevpagenumber = $page-1;
		
		$window->currentpage = $page;
		$window->maxpages = ceil(count($allmaps)/$max);
		
		$row_number = 0;
		$cell_number = 0;
		
		//Column Heads
		
		$row[$row_number][$cell_number]['text'] = '#';
		$row[$row_number][$cell_number]['color'] = '0CFF';
		$row[$row_number][$cell_number]['width'] = '2';
		$cell_number++;
		
		$row[$row_number][$cell_number]['text'] = 'Map-Name';
		$row[$row_number][$cell_number]['color'] = '0CFF';
		$row[$row_number][$cell_number]['width'] = '15';
		$row[$row_number][$cell_number]['action'] = $smart->register_manialink_answer('maplistsorting', 'plugin_jukebox_list_sorting').'Name';
		$cell_number++;
		
		$row[$row_number][$cell_number]['text'] = 'Author';
		$row[$row_number][$cell_number]['color'] = '0CFF';
		$row[$row_number][$cell_number]['width'] = '10';
		$row[$row_number][$cell_number]['action'] = $smart->register_manialink_answer('maplistsorting', 'plugin_jukebox_list_sorting').'Author';
		$cell_number++;
		
		$row[$row_number][$cell_number]['text'] = 'Environment';
		$row[$row_number][$cell_number]['color'] = '0CFF';
		$row[$row_number][$cell_number]['width'] = '6';
		$row[$row_number][$cell_number]['action'] = $smart->register_manialink_answer('maplistsorting', 'plugin_jukebox_list_sorting').'Environnement';
		$cell_number++;
		
		$row[$row_number][$cell_number]['text'] = 'Options';
		$row[$row_number][$cell_number]['color'] = '0CFF';
		$row[$row_number][$cell_number]['width'] = '3';
		$cell_number++;
		
		$mapid=0;
		$maps = array_slice($allmaps,$start,$max);
		foreach ($maps as $map)
		{
			$mapid++;
			$cell_number = 0;
			$row_number++;
			
			$row[$row_number][$cell_number]['text'] = ($mapid+$start).'.';
			$row[$row_number][$cell_number]['color'] = ($map['FileName'] == $smart->currentmap['FileName'] ? 'F00F':'FFFF');
			$row[$row_number][$cell_number]['width'] = '2';
			$cell_number++;
		
			$row[$row_number][$cell_number]['text'] = $smart->remove_sizes($map['Name']).($map['FileName'] == $smart->currentmap['FileName'] ? ' $F00(current)':'');;
			$row[$row_number][$cell_number]['color'] = 'FFFF';
			$row[$row_number][$cell_number]['width'] = '15';
			$cell_number++;
			
			$row[$row_number][$cell_number]['text'] = $map['Author'];
			$row[$row_number][$cell_number]['color'] = 'FFFF';
			$row[$row_number][$cell_number]['width'] = '10';
			$cell_number++;
			
			$row[$row_number][$cell_number]['text'] = $map['Environnement'];
			$row[$row_number][$cell_number]['color'] = 'FFFF';
			$row[$row_number][$cell_number]['width'] = '6';
			$cell_number++;
			
			$row[$row_number][$cell_number]['text'] = 'Juke';
			$row[$row_number][$cell_number]['action'] = $smart->register_manialink_answer('jukeboxmap', 'plugin_jukebox_list_addmap').($map['FileName']);
			$row[$row_number][$cell_number]['color'] = 'F90F';
			$row[$row_number][$cell_number]['width'] = '3';
			$cell_number++;
			
			if ($smart->is_operator($login))
			{
				$row[$row_number][$cell_number]['text'] = 'Next';
				$row[$row_number][$cell_number]['action'] = $smart->register_manialink_answer('jukenextmap', 'plugin_jukebox_list_selectnextmap').($map['FileName']);
				$row[$row_number][$cell_number]['color'] = 'F90F';
				$row[$row_number][$cell_number]['width'] = '5';
				$cell_number++;
			}
			
			if ($smart->is_admin($login))
			{
				$row[$row_number][$cell_number]['text'] = 'Remove';
				$row[$row_number][$cell_number]['action'] = $smart->register_manialink_answer('jukeremovemap', 'plugin_jukebox_list_removemap').($map['FileName']);
				$row[$row_number][$cell_number]['color'] = 'F90F';
				$row[$row_number][$cell_number]['width'] = '4';
				$cell_number++;
			}
			
			if ($smart->is_admin($login))
			{
				$row[$row_number][$cell_number]['text'] = 'Erase';
				$row[$row_number][$cell_number]['action'] = $smart->register_manialink_answer('jukeerasemap', 'plugin_jukebox_list_erasemap').($map['FileName']);
				$row[$row_number][$cell_number]['color'] = 'F90F';
				$row[$row_number][$cell_number]['width'] = '4';
				$cell_number++;
			}
			
		}
		$window->rows = $row;
		
		$smart->showManiaLink($window->create(), 0, $login, false,true);
	

	
}

function plugin_jukebox_list_sorting($smart, $login, $sortvar)
{
	$smart->set_playervar($login,'JUKEBOXSORTING',$sortvar);
	plugin_jukebox_list($smart, $login, 1);
}

function plugin_jukebox_list_close($smart, $login)
{
	$smart->hideManiaLink('listwindow', $login);
}

function plugin_jukebox_list_nextpage($smart, $login)
{
	if (isset($smart->settings['plugin.jukebox.pages'][$login]))
	{
		$currentpage = $smart->settings['plugin.jukebox.pages'][$login];
	}
	else
	{
		$currentpage = 1;
	}
	$currentpage++;
	$smart->settings['plugin.jukebox.pages'][$login] = $currentpage;
	plugin_jukebox_list($smart, $login, $currentpage);
}

function plugin_jukebox_list_previouspage($smart, $login)
{
	if (isset($smart->settings['plugin.jukebox.pages'][$login]))
	{
		$currentpage = $smart->settings['plugin.jukebox.pages'][$login];
	}
	else
	{
		$currentpage = 1;
	}
	$currentpage--;
	if ($currentpage < 1) $currentpage=1;
	
	$smart->settings['plugin.jukebox.pages'][$login] = $currentpage;
	plugin_jukebox_list($smart, $login, $currentpage);
}

function plugin_jukebox_list_addmap($smart, $login, $filename)
{
	if (strtolower($smart->settings['plugin.jukebox']->enabled) != 'true') 
	{
		$smart->chat('Sorry, the jukebox is disabled',$login);
		return;
	}
	
	if ((strtolower($smart->settings['plugin.jukebox']->adminsonly) == 'true') && (!$smart->is_operator($login)))
	{
		$smart->chat('Sorry, the jukebox is only available to admins',$login);
		return;
	}
	
	if (in_array($filename,$smart->settings['plugin.jukebox.jukedmaps']))
	{
		$smart->chat('This map was already juked by another player!',$login);
	}
	else
	{
		$smart->connection->client->query('GetMapInfo',$filename);
		$jukedmap = $smart->connection->client->getResponse();
		
		$smart->settings['plugin.jukebox.jukedmaps'][] = $filename;
		$smart->chat($smart->players[$login]['data']['nickname'].'$z added this map to the JukeBox: '.$jukedmap['Name']);
		$smart->connection->client->query('ChooseNextMapList', $smart->settings['plugin.jukebox.jukedmaps']);
		
		$smart->connection->client->query('GetNextMapInfo');
		$smart->nextmap = $smart->connection->client->getResponse();
		$smart->trigger_event('JukeBoxMapAdded');
	}
}
I copy-past entirely function. As you can see, $row_number is initialized.

Post Reply

Return to “SMART Servercontroller”

Who is online

Users browsing this forum: No registered users and 1 guest