Script for correctly displaying all [Spacers]
Hey,
I really do Like this Plugin, but for me the [spacers] are shown in a really ugly way, so i wrote a kinda replacement.
So first of all upload this file: https://upload.wikimedia.org/wikipedia/commons/8/8c/Transparent.png to your images folder ( TSServer/design/images/transparent.png)
After that open TSServer/views/statusmodule.php and replace the function:
private function renderChannels($parentId, $show = false)
` private function renderChannels($parentId, $show = false)
{
$out = "";
foreach ($this->_channelDatas as $channel)
{
if($channel["pid"] == $parentId)
{
$icon = "16x16_channel_green.png";
if( $channel["channel_maxclients"] > -1 && ($channel["total_clients"] >= $channel["channel_maxclients"])) $icon = "16x16_channel_red.png";
else if( $channel["channel_maxfamilyclients"] > -1 && ($channel["total_clients_family"] >= $channel["channel_maxfamilyclients"])) $icon = "16x16_channel_red.png";
else if($channel["channel_flag_password"] == 1) $icon = "16x16_channel_yellow.png";
$flags = array(); if($channel["channel_flag_default"] == 1) $flags[] = '16x16_default.png'; if($channel["channel_needed_talk_power"] > 0) $flags[] = '16x16_moderated.png'; if($channel["channel_flag_password"] == 1) $flags[] = '16x16_register.png'; $link = "javascript:tsstatusconnect('" . $this->_host . "','" . $this->_serverDatas["virtualserver_port"] . "','" . htmlentities($channel["channel_name"]) . "')"; $showCurrent = $show || count($this->_limitedChannels) == 0 || in_array($channel["cid"], $this->_limitedChannels); if($showCurrent) $out .= ' <div class="tsstatusItem"> <div class="tsstatusLabel"> <a href="' . $link . '"> <img src="' . $this->imagePath . $icon . '" />' . $channel["channel_name"] . ' </a> </div> <div class="tsstatusFlags"> ' . $this->renderFlags($flags) . ' </div> ' . (count($this->_userDatas) > 0 ? $this->renderUsers($channel["cid"]) : ''); $out .= $this->renderChannels($channel["cid"], $showCurrent); if($showCurrent) $out .= '</div>'; } } return $out; } `
With this:
`private function SpacerEscape($name, $icon){
$suchmuster_special = '/[\[].*[\]]./'; $suchmuster = '/[\[].*[\]]/'; preg_match($suchmuster, $name, $treffer); preg_match($suchmuster_special, $name, $treffer_special); $rep = ""; if(sizeof($treffer) > 0) { if(sizeof($treffer_special) > 0){ $rep = str_replace($treffer[0], "", $treffer_special[0]); if(strcmp($name, $treffer_special[0]) == 0) { for ($i=0; $i < 8 ; $i++) { $rep.=$rep; } } } else{ $rep = " "; } $name = str_replace($treffer[0], $rep, $name); $icon = "transparent.png"; } return '<img src="' . $this->imagePath . $icon . '" />' . $name; } private function renderChannels($parentId, $show = false) { $out = ""; foreach ($this->_channelDatas as $channel) { if($channel["pid"] == $parentId) { $icon = "16x16_channel_green.png"; if( $channel["channel_maxclients"] > -1 && ($channel["total_clients"] >= $channel["channel_maxclients"])) $icon = "16x16_channel_red.png"; else if( $channel["channel_maxfamilyclients"] > -1 && ($channel["total_clients_family"] >= $channel["channel_maxfamilyclients"])) $icon = "16x16_channel_red.png"; else if($channel["channel_flag_password"] == 1) $icon = "16x16_channel_yellow.png"; $flags = array(); if($channel["channel_flag_default"] == 1) $flags[] = '16x16_default.png'; if($channel["channel_needed_talk_power"] > 0) $flags[] = '16x16_moderated.png'; if($channel["channel_flag_password"] == 1) $flags[] = '16x16_register.png'; $link = "javascript:tsstatusconnect('" . $this->_host . "','" . $this->_serverDatas["virtualserver_port"] . "','" . htmlentities($channel["channel_name"]) . "')"; $showCurrent = $show || count($this->_limitedChannels) == 0 || in_array($channel["cid"], $this->_limitedChannels); if($showCurrent) $out .= ' <div class="tsstatusItem"> <div class="tsstatusLabel"> <a href="' . $link . '"> '. $this->SpacerEscape($channel["channel_name"], $icon) .' </a> </div> <div class="tsstatusFlags"> ' . $this->renderFlags($flags) . ' </div> ' . (count($this->_userDatas) > 0 ? $this->renderUsers($channel["cid"]) : ''); $out .= $this->renderChannels($channel["cid"], $showCurrent); if($showCurrent) $out .= '</div>'; } } return $out; }`
Comments
I would upload the fork to the repo, instead of giving instruction on how to modify an existing plugin. Or put it on github at least.
grep is your friend.