Link mod Topics list support -
http://custom.simplemachines.org/mods/index.php?mod=1459Autor do Mod:T@by
Type: New Feature
Autor da Tradução: Candidosa2
/ Themes / default /
style.css?>
/* The tlist style */
.tlisttable
{
padding: 0px;
border: 1px solid #ADADAD;
background-color: white;
width: 100%;
}
.tlisttable th
{
background: url(images/catbg.jpg) #496D91 repeat-x;
border-bottom: solid 1px #375576;
color: white;
padding-left: 7px;
font-weight: bold;
font-size: x-large;
text-align: left;
vertical-align: middle;
white-space: nowrap;
}
.tlisttable td
{
}
.tlisttitleicon
{
background: url(images/topic/normal_post.gif) no-repeat center center;
width: 16px;
height: 20px;
}
.tlistcol1
{
width: 16px;
vertical-align: middle;
text-align: center;
}
.tlistfirsticon
{
margin: 0 5px 0 5px;
}
.tlistcol2
{
}
.tlistindex
{
text-align: right;
font-size: x-small;
}
/* End tlist style */
./Themes/default/languages/
Modifications.teuidioma.php?>
$txt['limitTListQuery'] = 'Máximo de tópicos listados em tlist<div class="smalltext">(0 para nenhum max.)</div>';
./Sources/
ManageServer.phparray('check', 'enableCompressedOutput'),
array('check', 'databaseSession_enable'),
array('check', 'databaseSession_loose'),
array('int', 'databaseSession_lifetime'),
'',
// TList Query Limit
array('int', 'limitTListQuery'),
./Themes/default/
index.template.php?>
function tlist_bits($element)
{
global $txt, $settings, $scripturl;
switch($element)
{
case 'container_open':
$answ = '<table cellspacing="1" border="0" class="tlisttable">';
break;
case 'header':
$answ ='<tr><th><div class="tlisttitleicon"><a name="tl_{JLABEL}"> </a></div></th><th>{TITLE}</th></tr>';
break;
case 'topic_row':
{
$answ = '<tr><td class="tlistcol1"><img class="tlistfirsticon" src="{ICON}" alt="" /></td>';
$answ .= '<td class="tlistcol2"><a href="'.$scripturl.'?topic={TOPIC_ID}">{TOPIC_TITLE}</a></td></tr>';
break;
}
case 'container_close':
$answ = '</table>';
break;
case 'no_topics':
{
$answ = '<tr><td class="tlistcol1"><img class="tlistfirsticon" src="'.$settings['images_url'].'/tlist_spacer.gif" alt="" width="20" /></td>';
$answ .= '<td class="tlistcol2">-</td></tr>';
break;
}
case 'index_container_open':
$answ = '<div class="tlistindex">'.$txt[160];
break;
case 'index_bit':
$answ = ' <a href="#tl_{TITLE}">{TITLE}</a>';
break;
case 'index_container_close':
$answ = '</div>';
break;
}
return $answ;
}
/Sources/
Subs-Post.php?>
function fixTListTag(&$message)
{
global $board;
// Find all the tlist tags - with or without boardid.
preg_match_all('~[tlist(s*=d*)?](.+?)[/tlist]~is', $message, $matches, PREG_PATTERN_ORDER);
$replaces = array();
foreach ($matches[0] as $match => $dummy)
{
$matches[1][$match] = (int) substr(trim($matches[1][$match]),1);
$desired_board = empty($matches[1][$match]) ? $board : $matches[1][$match];
$replaces[$matches[0][$match]]= '[tlist=' . $desired_board .']'. $matches[2][$match] . '[/tlist]';
}
// If any tlist tags were actually changed...
if (!empty($replaces))
$message = strtr($message, $replaces);
}
{
fixTags($parts[$i]);
fixTListTag($parts[$i]);
./Sources/Subs.php
array(
'tag' => 'white',
'before' => '<span style="color: white;">',
'after' => '</span>',
),
array(
'tag' => 'tlist',
'type' => 'unparsed_equals_content',
'content' => '$1',
'validate' => create_function('&$tag, &$data, $disabled', '$data[0] = topic_list($data[0], $data[1]);'),
),
array(
'tag' => 'tlistindex',
'type' => 'unparsed_content',
'content' => '$1',
'validate' => create_function('&$tag, &$data, $disabled', '$data = topic_list_index($data);'),
),
?>
function topic_list($parms, $board)
{
global $db_prefix, $settings, $modSettings;
if (empty($parms))
return '';
if (empty($board))
return '';
if (function_exists('tlist_bits')) {
$parms_array = explode ("|", $parms);
if (empty($parms_array[0]))
$parms_array[0] = '0';
if (empty($parms_array[1]))
$parms_array[1] = $parms_array[0];
$inizio = strtoupper($parms_array[0]);
$fine = strtoupper($parms_array[1]);
$rx_inizio = substr( $inizio, 0, 1 );
$rx_fine = substr( $fine, 0, 1 );
if ($rx_inizio == "#")
$rx_inizio = "0123456789";
if ($rx_fine == "#")
$rx_fine = "0123456789";
$filtro = $rx_inizio;
if ($rx_fine != $rx_inizio)
$filtro = "".$filtro."-".$rx_fine;
$my_regexp = "(^(([[.[.]][[:alnum:][:blank:][:graph:]]+[[.].]])*([[:space:]])*))([[:<:]][".$filtro."])";
$request = db_query( "
SELECT
t.ID_TOPIC, t.ID_FIRST_MSG, m.subject, m.ID_MSG, m.icon
FROM ({$db_prefix}topics AS t)
LEFT JOIN {$db_prefix}messages AS m ON (m.ID_MSG = t.ID_FIRST_MSG)
WHERE t.ID_BOARD = $board AND t.locked = 0 AND t.isSticky = 0 AND ( subject REGEXP "$my_regexp" )"
. (empty($modSettings['limitTListQuery']) ? '' : "
LIMIT ".$modSettings['limitTListQuery']), __FILE__, __LINE__);
$data = array();
while($th_row = mysql_fetch_assoc($request)){
$ctitle = preg_replace("#[(.*?)]#","",$th_row['subject']);
$ctitle = trim(strtoupper($ctitle));
$found = 0;
if ($rx_inizio == "0123456789" || $rx_fine == "0123456789"){
if ( preg_match("/^[0-9{1}]+/", substr($ctitle, 0, 1)) )
$found = 1;
} else {
if ( (substr($ctitle, 0, strlen($inizio)) >= $inizio) && (substr($ctitle,0,strlen($fine)) <= $fine) )
$found = 1;
}
if ($found)
$data[] = array('cleantitle' => $ctitle,'title' => $th_row['subject'], 'tid' => $th_row['ID_TOPIC'],'icon_id' => $th_row['icon']);
}
$ttitle = $inizio;
if ($fine != $inizio)
$ttitle.=" - ".$fine;
$ttitle = strtoupper($ttitle);
$icon_system = file_exists($settings['theme_dir'] . '/images/icons/folder_open.gif') ? 'images_url' : 'default_images_url';
$answ = tlist_bits('container_open');
$tmp = tlist_bits('header');
$tmp = str_replace("{TITLE}", $ttitle, $tmp);
$ttitle = str_replace(" ", "", $ttitle);
$answ .= str_replace("{JLABEL}", $ttitle, $tmp);
if (count($data) > 0){
foreach ($data as $key => $row) {
$cleantitle[$key] = $row['cleantitle'];
$title[$key] = $row['title'];
$tid[$key] = $row['tid'];
}
array_multisort($cleantitle, SORT_ASC, $title, SORT_ASC, $data);
//Drawing!
foreach ($data as $key => $row) {
$icon = file_exists($settings['theme_dir'] . '/images/post/' . $row['icon_id'] . '.gif') ? 'images_url' : 'default_images_url';
$icon = $settings[$icon] . '/post/' . $row['icon_id'] . '.gif';
$tmp = tlist_bits('topic_row');
$tmp = str_replace("{ICON}", $icon, $tmp);
$tmp = str_replace("{TOPIC_ID}", $row['tid'], $tmp);
$answ .= str_replace("{TOPIC_TITLE}", $row['title'], $tmp);
}
}
else
$answ .= tlist_bits('no_topics');
$answ .= tlist_bits('container_close');
}else
$answ = $parms;
return $answ;
}
function topic_list_index($parms)
{
if (empty($parms))
$parms = "0|";
if (function_exists('tlist_bits')) {
$parms_array = explode ("|", $parms);
$answ = tlist_bits('index_container_open');
foreach ($parms_array as $key => $row) {
$tmp = tlist_bits('index_bit');
$row = str_replace(" ", "", $row);
$answ .= str_replace("{TITLE}", $row, $tmp);
}
$answ .= tlist_bits('index_container_close');
}else
$answ = $parms;
return $answ;
}