Mercurial > hg > batmud > misc
changeset 279:269ecedff518 misc
Various improvements to the material browser.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sun, 08 Mar 2015 12:52:26 +0200 |
parents | 5e9f8b76d494 |
children | bff5e42a630c |
files | materials/index.php |
diffstat | 1 files changed, 38 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/materials/index.php Sun Mar 08 10:52:33 2015 +0200 +++ b/materials/index.php Sun Mar 08 12:52:26 2015 +0200 @@ -47,11 +47,11 @@ } -function stGetURLStr($cfilters, $col, $dir, $mfilters) +function stGetURLStr($cfilters, $col, $dir, $domfilter, $mfilters) { - global $sortDirs, $hideColumns; + global $sortDirs, $hideColumns, $doMatFilter; - $str = "s=".$col."&d=".$sortDirs[$dir]; + $str = "s=".$col."&d=".$sortDirs[$dir]."&mf=".$domfilter; foreach ($cfilters as $fkey => $fval) $str .= "&f%5B".$fkey."%5D=".$fval; @@ -95,8 +95,33 @@ uasort($matTable, "stSortMatFunc"); -cmPrintPageHeader($pageTitle, - "<meta name=\"robots\" content=\"nofollow\" />\n"); +cmPrintPageHeader($pageTitle, " + <meta name=\"robots\" content=\"nofollow\" /> + <style type=\"text/css\"> + td a.matToggle { + display: inline-block; + background: black; + width: 1em; + font-size: 1.2em; + padding: 0.1em; + text-align: center; + margin-right: 0.3em; + } + + td a.matToggle:hover { + text-decoration: none; + background: white; + } + + td a.matToggle.active { + color: green !important; + } + + td a.matToggle.inactive { + color: red !important; + } + </style> +"); ?> <h1><? echo $pageTitle; ?></h1> <form action="<? echo $pageIndex; ?>" method="get"> @@ -190,8 +215,8 @@ { echo "<p>Material filter: ".implode(", ", array_keys($matFilters))." ". - "<a href=\"?".stGetURLStr($attrFilters, $sortColumn, $sortDirection, $matFilters). - "&mf=".($doMatFilter ? "0" : "1")."\">[".($doMatFilter ? "Deactivate" : "Activate")."]</a></p>\n"; + "<a href=\"?".stGetURLStr($attrFilters, $sortColumn, $sortDirection, !$doMatFilter, $matFilters). + "\">[".($doMatFilter ? "Deactivate" : "Activate")."]</a></p>\n"; } ?> <div class="matTable"> @@ -207,7 +232,7 @@ "<a href=\"?". stGetURLStr($attrFilters, $key, ($key == $sortColumn) ? !$sortDirection : $sortDirection, - $matFilters). + $doMatFilter, $matFilters). "\">".chentities($value)."</a></th>\n"; } } @@ -239,8 +264,10 @@ echo " <tr>".stGetTC("td", $col++). - "<a href=\"/mat/".urlencode($key)."\">".chentities($key)."</a> ". - "<a href=\"?".stGetURLStr($attrFilters, $sortColumn, $sortDirection, $tmpFilters)."\">•</a>". + "<a class=\"matToggle ".(isset($matFilters[$key]) ? "active" : "inactive"). + "\" href=\"?".stGetURLStr($attrFilters, $sortColumn, $sortDirection, $doMatFilter, $tmpFilters). + "\">".(isset($matFilters[$key]) ? "-" : "+")."</a>". + "<a href=\"/mat/".urlencode($key)."\">".chentities($key)."</a>". "</td>"; foreach ($value as $kkey => $kvalue) @@ -269,7 +296,7 @@ $tmpFilters[$kkey] = $kvalue; echo "<a href=\"?". - stGetURLStr($tmpFilters, $sortColumn, $sortDirection, $matFilters). + stGetURLStr($tmpFilters, $sortColumn, $sortDirection, $doMatFilter, $matFilters). "\">".chentities($transTable[$kkey][$kvalue])."</a>"; } echo "</td>";