boardlist work part 1: boardname in subtitle; work to make js restyling feasible

This commit is contained in:
czaks 2013-08-17 22:41:40 -04:00
parent 7aaeb1fdf3
commit 946c49ac5a

View File

@ -19,19 +19,23 @@ function format_bytes($size) {
return round($size, 2).$units[$i]; return round($size, 2).$units[$i];
} }
function doBoardListPart($list, $root) { function doBoardListPart($list, $root, &$boards) {
global $config; global $config;
$body = ''; $body = '';
foreach ($list as $board) { foreach ($list as $key => $board) {
if (is_array($board)) if (is_array($board))
// $body .= ' [' . doBoardListPart($board, $root) . '] '; $body .= ' <span class="sub" data-description="' . $key . '">[' . doBoardListPart($board, $root, $boards) . ']</span> ';
$body .= ' <span class="sub">[' . doBoardListPart($board, $root) . ']</span> ';
else { else {
if (($key = array_search($board, $list)) && gettype($key) == 'string') { if (gettype($key) == 'string') {
$body .= ' <a href="' . $board . '">' . $key . '</a> /'; $body .= ' <a href="' . $board . '">' . $key . '</a> /';
} else { } else {
$body .= ' <a href="' . $root . $board . '/' . $config['file_index'] . '">' . $board . '</a> /'; $title = '';
if (isset ($boards[$board])) {
$title = ' title="'.$boards[$board].'"';
}
$body .= ' <a href="' . $root . $board . '/' . $config['file_index'] . '"'.$title.'>' . $board . '</a> /';
} }
} }
} }
@ -45,7 +49,13 @@ function createBoardlist($mod=false) {
if (!isset($config['boards'])) return array('top'=>'','bottom'=>''); if (!isset($config['boards'])) return array('top'=>'','bottom'=>'');
$body = doBoardListPart($config['boards'], $mod?'?/':$config['root']); $xboards = listBoards();
$boards = array();
foreach ($xboards as $val) {
$boards[$val['uri']] = $val['title'];
}
$body = doBoardListPart($config['boards'], $mod?'?/':$config['root'], $boards);
if ($config['boardlist_wrap_bracket'] && !preg_match('/\] $/', $body)) if ($config['boardlist_wrap_bracket'] && !preg_match('/\] $/', $body))
$body = '[' . $body . ']'; $body = '[' . $body . ']';