Skip to content

Commit

Permalink
Add bing as a search engine option. Search engine placement is random…
Browse files Browse the repository at this point in the history
… on each page load. Add randomization of the order of platinum supporter logos as in years past. Closes #120.
  • Loading branch information
mikehelmick committed Jan 28, 2012
1 parent ab3ec66 commit 59653df
Show file tree
Hide file tree
Showing 13 changed files with 131 additions and 41 deletions.
2 changes: 1 addition & 1 deletion authors/index.php
@@ -1,5 +1,5 @@
<?php
$title = "SIGCSE 2012 - Home";
$title = "SIGCSE 2012 - Call For Participation";
$onload = "pageLoad('authors', 'cfp');";
include("../parts/top.php");
?>
Expand Down
59 changes: 59 additions & 0 deletions bing.php
@@ -0,0 +1,59 @@
<?php
$title = "SIGCSE 2012 - Search Results";
$onload = "pageLoad(null, null);";
include("parts/top.php");
?>
<div class="SectionHeader"><div class="Full">
<h2>SIGCSE 2012 Search Results from Bing</h2>
</div></div>
<div class="searchResult">

<?php
$resultPerPage = 10;
$offsetNum = 0;
$offset = "web.offset=0";
if (isset($_GET['offset'])) {
$offsetNum = intval($_GET['offset']);
$offset = "web.offset=0" . $_GET['offset'];
}


if (isset($_GET['query'])) {
$request =
'http://api.bing.net/json.aspx?Appid=1EAAC8DFCA91DD8D0E442B4AFCAB8B641F7903E1&sources=web&' .
$offset . '&web.count=' . $resultPerPage . '&query=' . urlencode( $_GET["query"] ) . "+site%3Asigcse.org%2Fsigcse2012%2F";
$response = file_get_contents($request);
$jsonobj = json_decode($response);

echo('<p>Found ' . $jsonobj->SearchResponse->Web->Total . ' total results</p>');

foreach($jsonobj->SearchResponse->Web->Results as $value)
{
echo('<p><strong><a href="' . $value->Url . '" style="color: blue;">' . $value->Title . '</a></strong><br/>');
echo( $value->Description . "<br/>");
echo( '<span class="searchUrl">' . $value->DisplayUrl . '</span>');
echo('</p>');
}

$page = 1;
$pages = ceil($jsonobj->SearchResponse->Web->Total / floatval($resultPerPage));
$curPage = floor($offsetNum / $resultPerPage) + 1;
echo('<p>Page: ');
while($page <= $pages) {
if ($page == $curPage) {
echo('<strong>' . $page . '</strong>');
} else {
$newOffset = ($page - 1) * $resultPerPage;
echo('<a href="/sigcse2012/bing.php?offset=' . $newOffset . '&query=' . urlencode( $_GET["query"] ) . '">' . $page . '</a>');
}
echo(' ');
$page = $page + 1;
}
echo('</p>');
} ?>
</div>
<?php
$updated = filemtime( $_SERVER["SCRIPT_FILENAME"] );
$mainPage = true;
include("parts/bottom.php");
?>
8 changes: 8 additions & 0 deletions css/master.css
Expand Up @@ -453,3 +453,11 @@ blockquote {
margin-right: 5px;
}

.searchResult a:link a:active a:visited {
color: blue;
}

.searchUrl {
color: green;
}

12 changes: 3 additions & 9 deletions exhibitors/index.php
Expand Up @@ -33,15 +33,9 @@
<td align="center" valign="top" colspan="3"><h3>Platinum Supporters</h3></td>
</tr>
<tr>
<td align="center" valign="middle" colspan="1">
<a href="http://www.microsoft.com/education/highered/faculty/" alt="Microsoft Highered"><img src="/sigcse2012/images/logos/sponsors/microsoft.png" /></a>
</td>
<td align="center" valign="middle" colspan="1">
<a href="http://www.google.com/edu/" alt="Google EDU"><img src="/sigcse2012/images/logos/sponsors/google.png" /></a>
</td>
<td align="center" valign="middle">
<a href="http://software.intel.com/sites/academic_showcase/" alt="Intel Education"><img src="/sigcse2012/images/logos/sponsors/intel.png" /></a>
</td>
<?php
include("../parts/platinum.php");
?>
</tr>
<tr>
<td align="center" valign="top" colspan="3"><h3>Silver Supporters</h3></td>
Expand Down
12 changes: 3 additions & 9 deletions index.php
Expand Up @@ -25,15 +25,9 @@
<td align="center" valign="top" colspan="3"><h3>Platinum Supporters</h3></td>
</tr>
<tr>
<td align="center" valign="middle" colspan="1">
<a href="http://www.microsoft.com/education/highered/faculty/" alt="Microsoft Highered"><img src="/sigcse2012/images/logos/sponsors/microsoft.png" /></a>
</td>
<td align="center" valign="middle" colspan="1">
<a href="http://www.google.com/edu/" alt="Google EDU"><img src="/sigcse2012/images/logos/sponsors/google.png" /></a>
</td>
<td align="center" valign="middle">
<a href="http://software.intel.com/sites/academic_showcase/" alt="Intel Education"><img src="/sigcse2012/images/logos/sponsors/intel.png" /></a>
</td>
<?php
include("parts/platinum.php");
?>
</tr>
<tr>
<td align="center" valign="top" colspan="3"><h3>Silver Supporters</h3></td>
Expand Down
11 changes: 11 additions & 0 deletions parts/bing_search.php
@@ -0,0 +1,11 @@
<form method="get" action="/sigcse2012/bing.php">
Search with Bing<br/><input type="text" id="query" name="query" size="31" value="<?php
if (isset($_GET['query'])) {
echo($_GET['query']); }
else {
echo('SIGCSE 2012');
}
?>"/>
<input type="submit" value="Search" name="submit" id="searchButton" />

</form>
3 changes: 3 additions & 0 deletions parts/google.php
@@ -0,0 +1,3 @@
<td align="center" valign="middle" colspan="1">
<a href="http://www.google.com/edu/" alt="Google EDU"><img src="/sigcse2012/images/logos/sponsors/google.png" /></a>
</td>
20 changes: 20 additions & 0 deletions parts/google_search.php
@@ -0,0 +1,20 @@
Search with Google<br/><script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load('search', '1');
google.setOnLoadCallback(function() {
google.search.CustomSearchControl.attachAutoCompletion(
'000184131728111546209:ca9n_ricjba',
document.getElementById('q'),
'cse-search-box');
});
</script>
<form action="http://www.sigcse.org/sigcse2012/search.php" id="cse-search-box">
<div>
<input type="hidden" name="cx" value="000184131728111546209:bra5kgqicnk" />
<input type="hidden" name="cof" value="FORID:11" />
<input type="hidden" name="ie" value="UTF-8" />
<input type="text" name="q" id="q" autocomplete="on" size="31" />
<input type="submit" name="sa" value="Search" />
</div>
</form>
<script type="text/javascript" src="http://www.google.com/cse/brand?form=cse-search-box&lang=en"></script>
3 changes: 3 additions & 0 deletions parts/intel.php
@@ -0,0 +1,3 @@
<td align="center" valign="middle">
<a href="http://software.intel.com/sites/academic_showcase/" alt="Intel Education"><img src="/sigcse2012/images/logos/sponsors/intel.png" /></a>
</td>
28 changes: 8 additions & 20 deletions parts/menu.php
Expand Up @@ -85,26 +85,14 @@
</div>
<div class="menu"><a id="committee_menu" href="/sigcse2012/committee/">Program Committee</a></div>
<hr/>
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load('search', '1');
google.setOnLoadCallback(function() {
google.search.CustomSearchControl.attachAutoCompletion(
'000184131728111546209:ca9n_ricjba',
document.getElementById('q'),
'cse-search-box');
});
</script>
<form action="http://www.sigcse.org/sigcse2012/search.php" id="cse-search-box">
<div>
<input type="hidden" name="cx" value="000184131728111546209:bra5kgqicnk" />
<input type="hidden" name="cof" value="FORID:11" />
<input type="hidden" name="ie" value="UTF-8" />
<input type="text" name="q" id="q" autocomplete="off" size="31" />
<input type="submit" name="sa" value="Search" />
</div>
</form>
<script type="text/javascript" src="http://www.google.com/cse/brand?form=cse-search-box&lang=en"></script>

<?php
$sponsors = array("google_search.php", "bing_search.php");
shuffle($sponsors);
foreach ($sponsors as $sponsor) {
include($sponsor);
}
?>

<hr/>
<g:plus href="https://plus.google.com/105068073150868262530" size="badge"></g:plus>
Expand Down
3 changes: 3 additions & 0 deletions parts/microsoft.php
@@ -0,0 +1,3 @@
<td align="center" valign="middle" colspan="1">
<a href="http://www.microsoft.com/education/highered/faculty/" alt="Microsoft Highered"><img src="/sigcse2012/images/logos/sponsors/microsoft.png" /></a>
</td>
7 changes: 7 additions & 0 deletions parts/platinum.php
@@ -0,0 +1,7 @@
<?php
$sponsors = array("microsoft.php", "google.php", "intel.php");
shuffle($sponsors);
foreach ($sponsors as $sponsor) {
include($sponsor);
}
?>
4 changes: 2 additions & 2 deletions search.php
@@ -1,10 +1,10 @@
<?php
$title = "SIGCSE 2012 - Search Reults";
$title = "SIGCSE 2012 - Search Results";
$onload = "pageLoad(null, null);";
include("parts/top.php");
?>
<div class="SectionHeader"><div class="Full">
<h2>SIGCSE 2012 Search Results</h2>
<h2>SIGCSE 2012 Search Results from Google</h2>
</div></div>
<div id="cse-search-results"></div>
<script type="text/javascript">
Expand Down

0 comments on commit 59653df

Please sign in to comment.