Autor Tópico: Tidy Child Boards - SubQuadros  (Lida 9082 vezes)

0 Membros e 1 Visitante estão a ver este tópico.

Online candidosa2

  • Suporte Tecnico
  • Fundador
  • *
  • Mensagens: 5073
  • Rank: 1658
  • Sexo: Masculino
  • Suporte
    • Hosting Moçambique
Tidy Child Boards - SubQuadros
« em: 26 de Setembro de 2010, 19:07 »

sourcedir/Subs-BoardIndex.php

Código: [Seleccione]
//For tidying boards; examine the children and realign into groups for tidying
function tidyBoards(&$board) {
global $modSettings, $context, $settings;

$limit = ceil(count($board['children']) / $modSettings['tidy_child_boards']);
$children = array();
$this_count = $limit + 1;
$this_division = 0;
foreach($board['children'] as $child) {
if($this_count >= $limit) {
$this_division++;
$this_count = 0;
}
$children[$this_division][] = $child;
$this_count++;
}

$board['tidy_children'] = $children;

// We don't need the original children (plus this means way less mess in templates)
unset($board['children']);
}


sourcedir/BoardIndex.php

Código: [Seleccione]
// Do not let search engines index anything if there is a random thing in $_GET.
Código: [Seleccione]
if(empty($context['added_tidy_header']) && !empty($modSettings['tidy_child_boards']) && $modSettings['tidy_child_boards'] > 1) {
if(empty($context['html_headers']))
$context['html_headers'] = '';
$context['html_headers'] .= '
<link rel="stylesheet" type="text/css" href="' . $settings['default_theme_url'] . '/css/tidyboards.css?rc2" />
<style type="text/css">.tidy_child { width:' . floor(100/$modSettings['tidy_child_boards']) . '%; }</style>';
$context['added_tidy_header'] = 1;
}


$sourcedir/MessageIndex.php

Código: [Seleccione]
// If we can view unapproved
Código: [Seleccione]
if(empty($context['added_tidy_header']) && !empty($modSettings['tidy_child_boards']) && $modSettings['tidy_child_boards'] > 1) {
if(empty($context['html_headers']))
$context['html_headers'] = '';
$context['html_headers'] .= '
<link rel="stylesheet" type="text/css" href="' . $settings['default_theme_url'] . '/css/tidyboards.css?rc2" />
<style type="text/css">.tidy_child { width:' . floor(100/$modSettings['tidy_child_boards']) . '%; }</style>';
$context['added_tidy_header'] = 1;
}

$sourcedir/ManageSettings.php

Código: [Seleccione]
array('check', 'enableVBStyleLogin'),
Código: [Seleccione]
'',
array('select', 'tidy_child_boards', array(1 => $txt['tidy_child_boards_no'], 2 => $txt['tidy_child_boards_2col'], 3 => $txt['tidy_child_boards_3col'], 4 => $txt['tidy_child_boards_4col'])),
array('check', 'tidy_child_boards_bold'),
array('check', 'tidy_child_boards_icon'),
array('check', 'tidy_child_boards_new'),



$themedir/BoardIndex.template.php

Código: [Seleccione]
foreach ($category['boards'] as $board)
{

Código: [Seleccione]
if(!empty($board['children']) && !empty($modSettings['tidy_child_boards']) && $modSettings['tidy_child_boards'] > 1)
tidyBoards($board);

Código: [Seleccione]
// Show some basic
Código: [Seleccione]
if(!empty($board['tidy_children'])) {
$context['tidy_board'] = $board;
template_tidy_children();
}


Código: [Seleccione]
function template_tidy_children() {
global $context, $settings, $txt, $modSettings;
echo '
<div class="board_children">';
foreach($context['tidy_board']['tidy_children'] as $key => $child_block) {
echo '
<div class="tidy_child">
<ul>';
foreach($child_block as $child) {
echo '
<li>';
 
if(!empty($modSettings['tidy_child_boards_icon']))
echo '<img src="', $settings['images_url'], '/', ($child['new'] ? 'on' : 'off'), '.png" width="12" height="12" alt=""> ';
 
if (!$child['is_redirect'])
$child['link'] = '<a href="' . $child['href'] . '" ' . ($child['new'] ? 'class="new_posts" ' : '') . 'title="' . ($child['new'] ? $txt['new_posts'] : $txt['old_posts']) . ' (' . $txt['board_topics'] . ': ' . comma_format($child['topics']) . ', ' . $txt['posts'] . ': ' . comma_format($child['posts']) . ')">' . $child['name'] . '</a>';
else
$child['link'] = '<a href="' . $child['href'] . '" title="' . comma_format($child['posts']) . ' ' . $txt['redirects'] . '">' . $child['name'] . '</a>';
 
if (!empty($modSettings['tidy_child_boards_new']) && $child['new'])
$child['link'] .= ' <a href="' . $child['href'] . '" title="' . $txt['new_posts'] . ' (' . $txt['board_topics'] . ': ' . comma_format($child['topics']) . ', ' . $txt['posts'] . ': ' . comma_format($child['posts']) . ')"><img src="' . $settings['lang_images_url'] . '/new.gif" class="new_posts" alt="" /></a>';
 
// Has it posts awaiting approval?
if ($child['can_approve_posts'] && ($child['unapproved_posts'] | $child['unapproved_topics']))
$child['link'] .= ' <a href="' . $scripturl . '?action=moderate;area=postmod;sa=' . ($child['unapproved_topics'] > $child['unapproved_posts'] ? 'topics' : 'posts') . ';brd=' . $child['id'] . ';' . $context['session_var'] . '=' . $context['session_id'] . '" title="' . sprintf($txt['unapproved_posts'], $child['unapproved_topics'], $child['unapproved_posts']) . '" class="moderation_link">(!)</a>';
 
if(!empty($modSettings['tidy_child_boards_bold']) && $child['new'])
$child['link'] = '<strong>' . $child['link'] . '</strong>';
 
echo $child['link'], '</li>';
}
echo '
</ul>
</div>';
}
echo '
</div>';
}



$themedir/MessageIndex.template.php

Código: [Seleccione]
foreach ($context['boards'] as $board)
{

Código: [Seleccione]
if(!empty($board['children']) && !empty($modSettings['tidy_child_boards']) && $modSettings['tidy_child_boards'] > 1)
tidyBoards($board);


Código: [Seleccione]
// Show some basic
Código: [Seleccione]
if(!empty($board['tidy_children'])) {
$context['tidy_board'] = $board;
template_tidy_children();
}


Código: [Seleccione]
function template_tidy_children() {
global $context, $settings, $txt, $modSettings;
echo '
<div class="board_children">';
foreach($context['tidy_board']['tidy_children'] as $key => $child_block) {
echo '
<div class="tidy_child">
<ul>';
foreach($child_block as $child) {
echo '
<li>';
 
if(!empty($modSettings['tidy_child_boards_icon']))
echo '<img src="', $settings['images_url'], '/', ($child['new'] ? 'on' : 'off'), '.png" width="12" height="12" alt=""> ';
 
if (!$child['is_redirect'])
$child['link'] = '<a href="' . $child['href'] . '" ' . ($child['new'] ? 'class="new_posts" ' : '') . 'title="' . ($child['new'] ? $txt['new_posts'] : $txt['old_posts']) . ' (' . $txt['board_topics'] . ': ' . comma_format($child['topics']) . ', ' . $txt['posts'] . ': ' . comma_format($child['posts']) . ')">' . $child['name'] . '</a>';
else
$child['link'] = '<a href="' . $child['href'] . '" title="' . comma_format($child['posts']) . ' ' . $txt['redirects'] . '">' . $child['name'] . '</a>';
 
if (!empty($modSettings['tidy_child_boards_new']) && $child['new'])
$child['link'] .= ' <a href="' . $child['href'] . '" title="' . $txt['new_posts'] . ' (' . $txt['board_topics'] . ': ' . comma_format($child['topics']) . ', ' . $txt['posts'] . ': ' . comma_format($child['posts']) . ')"><img src="' . $settings['lang_images_url'] . '/new.gif" class="new_posts" alt="" /></a>';
 
// Has it posts awaiting approval?
if ($child['can_approve_posts'] && ($child['unapproved_posts'] | $child['unapproved_topics']))
$child['link'] .= ' <a href="' . $scripturl . '?action=moderate;area=postmod;sa=' . ($child['unapproved_topics'] > $child['unapproved_posts'] ? 'topics' : 'posts') . ';brd=' . $child['id'] . ';' . $context['session_var'] . '=' . $context['session_id'] . '" title="' . sprintf($txt['unapproved_posts'], $child['unapproved_topics'], $child['unapproved_posts']) . '" class="moderation_link">(!)</a>';
 
if(!empty($modSettings['tidy_child_boards_bold']) && $child['new'])
$child['link'] = '<strong>' . $child['link'] . '</strong>';
 
echo $child['link'], '</li>';
}
echo '
</ul>
</div>';
}
echo '
</div>';
}


$themes_dir/core/BoardIndex.template.php

Código: [Seleccione]
foreach ($category['boards'] as $board)
{

Código: [Seleccione]
if(!empty($board['children']) && !empty($modSettings['tidy_child_boards']) && $modSettings['tidy_child_boards'] > 1)
tidyBoards($board);

Código: [Seleccione]
// Show some basic
Código: [Seleccione]
if(!empty($board['tidy_children'])) {
$context['tidy_board'] = $board;
template_tidy_children();
}


Código: [Seleccione]
function template_tidy_children() {
global $context, $settings, $txt, $modSettings;
echo '
<div class="board_children">';
foreach($context['tidy_board']['tidy_children'] as $key => $child_block) {
echo '
<div class="tidy_child">
<ul>';
foreach($child_block as $child) {
echo '
<li>';
 
if(!empty($modSettings['tidy_child_boards_icon']))
echo '<img src="', $settings['images_url'], '/', ($child['new'] ? 'on' : 'off'), '.gif" width="12" height="12" alt=""> ';
 
if (!$child['is_redirect'])
$child['link'] = '<a href="' . $child['href'] . '" ' . ($child['new'] ? 'class="new_posts" ' : '') . 'title="' . ($child['new'] ? $txt['new_posts'] : $txt['old_posts']) . ' (' . $txt['board_topics'] . ': ' . comma_format($child['topics']) . ', ' . $txt['posts'] . ': ' . comma_format($child['posts']) . ')">' . $child['name'] . '</a>';
else
$child['link'] = '<a href="' . $child['href'] . '" title="' . comma_format($child['posts']) . ' ' . $txt['redirects'] . '">' . $child['name'] . '</a>';
 
if (!empty($modSettings['tidy_child_boards_new']) && $child['new'])
$child['link'] .= ' <a href="' . $child['href'] . '" title="' . $txt['new_posts'] . ' (' . $txt['board_topics'] . ': ' . comma_format($child['topics']) . ', ' . $txt['posts'] . ': ' . comma_format($child['posts']) . ')"><img src="' . $settings['lang_images_url'] . '/new.gif" class="new_posts" alt="" /></a>';
 
// Has it posts awaiting approval?
if ($child['can_approve_posts'] && ($child['unapproved_posts'] | $child['unapproved_topics']))
$child['link'] .= ' <a href="' . $scripturl . '?action=moderate;area=postmod;sa=' . ($child['unapproved_topics'] > $child['unapproved_posts'] ? 'topics' : 'posts') . ';brd=' . $child['id'] . ';' . $context['session_var'] . '=' . $context['session_id'] . '" title="' . sprintf($txt['unapproved_posts'], $child['unapproved_topics'], $child['unapproved_posts']) . '" class="moderation_link">(!)</a>';
 
if(!empty($modSettings['tidy_child_boards_bold']) && $child['new'])
$child['link'] = '<strong>' . $child['link'] . '</strong>';
 
echo $child['link'], '</li>';
}
echo '
</ul>
</div>';
}
echo '
</div>';
}

$themes_dir/core/MessageIndex.template.php

Código: [Seleccione]
foreach ($context['boards'] as $board)
{

Código: [Seleccione]
if(!empty($board['children']) && !empty($modSettings['tidy_child_boards']) && $modSettings['tidy_child_boards'] > 1)
tidyBoards($board);

Código: [Seleccione]
// Show some basic
Código: [Seleccione]
if(!empty($board['tidy_children'])) {
$context['tidy_board'] = $board;
template_tidy_children();
}


Código: [Seleccione]
function template_tidy_children() {
global $context, $settings, $txt, $modSettings;
echo '
<div class="board_children">';
foreach($context['tidy_board']['tidy_children'] as $key => $child_block) {
echo '
<div class="tidy_child">
<ul>';
foreach($child_block as $child) {
echo '
<li>';
 
if(!empty($modSettings['tidy_child_boards_icon']))
echo '<img src="', $settings['images_url'], '/', ($child['new'] ? 'on' : 'off'), '.gif" width="12" height="12" alt=""> ';
 
if (!$child['is_redirect'])
$child['link'] = '<a href="' . $child['href'] . '" ' . ($child['new'] ? 'class="new_posts" ' : '') . 'title="' . ($child['new'] ? $txt['new_posts'] : $txt['old_posts']) . ' (' . $txt['board_topics'] . ': ' . comma_format($child['topics']) . ', ' . $txt['posts'] . ': ' . comma_format($child['posts']) . ')">' . $child['name'] . '</a>';
else
$child['link'] = '<a href="' . $child['href'] . '" title="' . comma_format($child['posts']) . ' ' . $txt['redirects'] . '">' . $child['name'] . '</a>';
 
if (!empty($modSettings['tidy_child_boards_new']) && $child['new'])
$child['link'] .= ' <a href="' . $child['href'] . '" title="' . $txt['new_posts'] . ' (' . $txt['board_topics'] . ': ' . comma_format($child['topics']) . ', ' . $txt['posts'] . ': ' . comma_format($child['posts']) . ')"><img src="' . $settings['lang_images_url'] . '/new.gif" class="new_posts" alt="" /></a>';
 
// Has it posts awaiting approval?
if ($child['can_approve_posts'] && ($child['unapproved_posts'] | $child['unapproved_topics']))
$child['link'] .= ' <a href="' . $scripturl . '?action=moderate;area=postmod;sa=' . ($child['unapproved_topics'] > $child['unapproved_posts'] ? 'topics' : 'posts') . ';brd=' . $child['id'] . ';' . $context['session_var'] . '=' . $context['session_id'] . '" title="' . sprintf($txt['unapproved_posts'], $child['unapproved_topics'], $child['unapproved_posts']) . '" class="moderation_link">(!)</a>';
 
if(!empty($modSettings['tidy_child_boards_bold']) && $child['new'])
$child['link'] = '<strong>' . $child['link'] . '</strong>';
 
echo $child['link'], '</li>';
}
echo '
</ul>
</div>';
}
echo '
</div>';
}


$languagedir/Modifications.teuidioma.php

Código: [Seleccione]
// Smfpt Suporte translate candidosa2
$txt['tidy_child_boards'] = 'Organizar os Sub-quadros em colunas';
$txt['tidy_child_boards_no'] = 'Não coloque nas colunas';
$txt['tidy_child_boards_2col'] = 'Duas colunas';
$txt['tidy_child_boards_3col'] = 'Três colunas';
$txt['tidy_child_boards_4col'] = 'Quatro coluna';
$txt['tidy_child_boards_icon'] = 'Exibe o ícone de pequena do quadro ao lado do Sub-quadro';
$txt['tidy_child_boards_bold'] = 'Mostrar os sub-quadro não lidas em negrito';
$txt['tidy_child_boards_new'] = 'Mostrar imagem [novo] ao lado de sub-quadro  não lida.';