Commit 4ad5d5e9 authored by Romain Loth's avatar Romain Loth

modernize index and re-add search filters in topbar

parent 05866d75
......@@ -53,12 +53,7 @@ border: 1px solid #eee;
-moz-box-shadow: 0 0 3px #000;
box-shadow: 0 0 3px #000;
}
.filter {
/*position:relative;
display: block;
top:50%;
margin-top:20px;*/
}
.filterselect {
background: rgba(220,220,220, 0.70);
border-color: rgba(0,0,0,0.2);
......@@ -161,3 +156,70 @@ input.name {
width: 250px;
}
.nav > li > a.topbarlink:hover {
/* prevents white of hover bg (ugly on black topbar) */
background-color: inherit !important;
color: #fff;
}
.nav-legend {
vertical-align: middle;
font-size: 13px;
color: #fff ;
padding: 7px 0 ;
margin: .3em 0 0 0 ;
}
/* dropdown buttons should look like just menu select (based on select.small) */
.nav-inline-selectable {
display: inline-block;
align-items: center;
cursor: default;
line-height: 18px;
vertical-align: middle;
color: #000 !important;
background-color: #fff;
/*font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;*/
text-shadow: none !important ;
font-weight: normal;
padding: 4px !important ;
margin: .4em 1em .3em 1em;
box-sizing: border-box;
border: 2px solid #fff ;
border-radius: 3px;
}
.nav-inline-selectable .caret {
opacity: 1;
}
.nav-inline-selectable:hover .caret, .nav-inline-selectable:active .caret {
background-color: rgb(220,255,220) ;
}
.nav-inline-selectable:hover, .nav-inline-selectable:active {
display: inline-block;
cursor: pointer;
background-color: #fff ;
border: 2px solid rgb(170,255,120) ;
border-radius: 3px;
text-shadow: none !important ;
}
.filter {
line-height: 18px;
vertical-align: middle;
font-size: 13px;
padding: 0 !important ;
padding: 0 !important;
margin: .25em 0 0 0 !important;
}
.filter > span {
padding 0 0 1em 0 !important ;
/*margin: 0 0 1em 0 !important;*/
}
......@@ -85,28 +85,30 @@ $(function(){
}(document, 'script', 'facebook-jssdk'));
</script>
<script type="text/javascript" src="js/whoswho.js"/></script>
<div class="topbar" data-dropdown="dropdown">
<div class="topbar">
<div class="topbar-inner">
<div class="container-fluid">
<a class="brand" href="index.html">
<i class="icon-home icon-white"></i></a>
<ul class="nav">
<li id="mapping" style="margin-top:5px;">
<span style="color: #fff;"> <strong>SELECT</strong> </span>
<select id="categorya" class="small" style="background: rgb(220,255,220, 0.8);">
<!-- MAIN NAVBAR -->
<ul class="nav" style="margin-top:5px;">
<li>
<a class="topbarlink" href="index.html"><span class="icon-home icon-white"></i></a>
</li>
<li id="mapping" class="nav-legend">
<span> <strong>SELECT Keywords</strong> </span>
<!-- <select id="categorya" class="small" style="background: rgb(220,255,220, 0.8);">
<option selected="true">Keywords</option>
<!--<option>Scholars</option>
<option>Scholars</option>
<option>Labs</option>
<option>Organizations</option>
<option>Countries</option>-->
</select>
<span style="color: #fff;"> <strong>AND</strong> </span>
<select id="categoryb" class="small" style="background: rgb(255,220,220, 0.8);">
<option>Countries</option>
</select> -->
<span> <strong>AND Scholars</strong> </span>
<!-- <select id="categoryb" class="small" style="background: rgb(255,220,220, 0.8);">
<option selected="true">Scholars</option>
<!--<option>Labs</option>
<option>Labs</option>
<option>Organizations</option>
<option>Countries</option>-->
</select>
<option>Countries</option>
</select> -->
</li>
<!--
<li class="dropdown">
......@@ -122,37 +124,40 @@ $(function(){
</li>
-->
<li id="refine" class="dropdown">
<a class="dropdown-toggle">refine</a>
<a class="btn-default nav-inline-selectable"
onclick='$(this).next(".dropdown-menu").toggle();'
>refine<i class="caret"></i></a>
<ul class="dropdown-menu">
<li>
<a id="addfiltercountry" href="#">Filter by country</a>
<a id="addfiltercountry" href="#">Filter by country</a>
</li>
<!--<li>
<a id="addcolor" href="#">Color by</a>
</li>-->
<li>
<a id="addfilterkeyword" href="#">Filter by keyword</a>
</li>
<li>
<a id="addfiltertag" href="#">Filter by community tags</a>
<li>
<a id="addfiltertag" href="#">Filter by community tags</a>
</li>
<li>
<a id="addfilterorganization" href="#">Filter by organization</a>
<a id="addfilterorganization" href="#">Filter by organization</a>
</li>
<li>
<a id="addfilterlaboratory" href="#">Filter by laboratory</a>
<a id="addfilterlaboratory" href="#">Filter by laboratory</a>
</li>
<!--<li>
<a id="addcolor" href="#">Color by</a>
</li>-->
</ul>
</li>
<li>
<a id="print" href="#"> <strong>CREATE DIRECTORY</strong></a>
<a class="topbarlink" id="print" href="#"> <i class="icon-arrow-right icon-white"></i> <strong>CREATE DIRECTORY</strong></a>
</li>
<li style="margin-top: 10px;">
<span style="color: #fff;"> <strong>&nbsp;OR&nbsp;</strong> </span>
</li>
<li>
<a id="generate" href="#"> <strong>MAP</strong></a>
<li>
<a class="topbarlink" id="generate" href="#"> <i class="icon-arrow-right icon-white"></i> <strong>MAP</strong></a>
</li>
</ul>
......@@ -215,12 +220,7 @@ $(function(){
<i class="icon-info-sign"></i> View our <a href="tips.html">tips</a> for best experience. This directory is <strong>open</strong> to everybody working in the field of Complex Systems science and Complexity science. Map and explore communities or generate a printable version of their directory.
Updated every few minutes.
<br/>
<i class="icon-exclamation-sign"></i> You must have a <strong>recent browser</strong> (e.g. <img src=img/firefox_logo.png width=20> Firefox 10+ or <img src=img/chrome.png width=20> Chrome 17+) with a <strong>java plug-in</strong> see the maps. If this is not the case, you can still print the communities directories unless your browser is really outdated. In that case, you can still consult the <a href="http://main.csregistry.org/tiki-index.php?page=Complex%20Systems%20Scholars"> pure html version</a>.
<!-- <i class="icon-list-alt"></i> Personal data are given on a voluntary basis and people are responsible for the validity and integrity of their data. <br/>
<i class="icon-repeat"></i> Suggestions or comments ? <a href="http://moma.csregistry.org/feedback" target="BLANK">Please feedback.</a> <br/>
......
<?php
/*
* Génère le gexf des scholars à partir de la base sqlite
*/
include("parametres.php");
//include("../common/library/fonctions_php.php");
include("normalize.php");
$base = new PDO("sqlite:" . $dbname);
$category = trim(strtolower($_GET['category']));
$term = trim(strtolower($_GET['term']));
$q = "%".sanitize_input($term)."%";
$cat = '';
$query = '';
if ($category == 'country' || $category == 'countries') {
$cat = "country";
$query = 'LIKE upper(\''.strtoupper($q).'\')';
} elseif ($category == 'organization' || $category == 'organizations') {
$cat = "affiliation";
$query = 'LIKE upper(\''.strtoupper($q).'\')';
} elseif ($category == 'keyword' || $category == 'keywords') {
$cat = "keywords";
$query = 'LIKE upper(\''.strtoupper($q).'\')';
} elseif ($category == 'tag' || $category == 'tags') {
$cat = "tags";
$query = 'LIKE upper(\''.strtoupper($q).'\')';
} elseif ($category == 'labs' || $category == 'laboratories' || $category == 'laboratory') {
$cat = "lab";
$query = 'LIKE upper(\''.strtoupper($q).'\')';
} else {
echo ("ERROR");
exit();
}
$filtered = array (
"yes", "1", "0", "nvgfpmeilym", "no", "mr", "ms", "", " ", " "
);
function filter_word($value) {
if ($value == null) return true;
return ! in_array(strtolower($value),$filtered);
}
$req = "SELECT ".$cat." AS key, count(".$cat.") AS value FROM scholars WHERE ".$cat." ".$query." GROUP BY ".$cat." ORDER BY value DESC";
$results = array();
$i = 0;
foreach ($base->query($req) as $row) {
$nb = $row['value'];
if ($cat == "keywords" || $cat == "tags") {
//echo "in keywords\n";
$words = explode(",", $row["key"]);
foreach ($words as $word) {
$pos = strpos($word,$term);
if($pos === false) {
continue;
}
//echo "match found\n";
// echo "(".$value." contains ".$term." ?)";
if (filter_word($word)) {
if (array_key_exists($word, $results)) {
$results[ $word ] += intval($nb);
} else {
$results[ $word ] = intval($nb);
}
}
}
} else {
$word = $row["key"];
if ($cat == "country") {
$word = normalize_country($word);
}
if (filter_word($word)) {
if (array_key_exists($word, $results)) {
$results[ $word ] += intval($nb);
} else {
$results[ $word ] = intval($nb);
}
}
}
}
$nbresults = sizeof($results);
$results = array_slice($results,0,20);
$nbresults2 = sizeof($results);
$completion = array(
"results" => array()
);
foreach($results as $key => $value) {
array_push($completion["results"], array(
'id' => $key,
'label' => $key,
// 'value' => $value,
'score' => $value,
// F*** it, I'll put the meta data here...
'category' => $cat,
"term" => $term,
"size" => $nbresults2,
"total" => $nbresults,
"remaining" => ($nbresults - $nbresults2)
));
}
$i = 0;
echo json_encode($completion);
?>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment