Commit 8d43fa74 authored by dinesh's avatar dinesh

display a-z index for module search and some fixes

parent 4d553425
No preview for this file type
...@@ -13,12 +13,12 @@ $row = sqlite3_fetch_array($result); ...@@ -13,12 +13,12 @@ $row = sqlite3_fetch_array($result);
<tr align="center" bgcolor="FFFFCC"> <tr align="center" bgcolor="FFFFCC">
<td width="50%"> <td width="50%">
<?php <?php
if(file_exists($tar_dir . $_GET['module']."_dependencies.tar")) if(file_exists($tar_dir . $_GET['module'].".tar"))
echo '<a href='. $tar_dir . $_GET['module'] . '.tar>Download</a>'; echo '<a href='. $tar_dir . $_GET['module'] . '.tar>Download</a>';
?> ?>
<td> <td>
<?php <?php
if(file_exists($tar_dir . $_GET['module']."_dependencies.tar")) if(file_exists($tar_dir . $_GET['module']."_with_deps.tar"))
echo '<a href='. $tar_dir . $_GET['module'] . '_with_deps.tar>Download Dependencies</a>'; echo '<a href='. $tar_dir . $_GET['module'] . '_with_deps.tar>Download Dependencies</a>';
?> ?>
</td> </td>
......
...@@ -24,4 +24,15 @@ ...@@ -24,4 +24,15 @@
<td align="left"><a href=search.php?disp=all>Display all</a></td> <td align="left"><a href=search.php?disp=all>Display all</a></td>
</tr> </tr>
</table> </table>
<table align="center">
<tr align="left">
<?php
for ($i = "a"; $i != "aa"; $i++) {
echo '<td><a href=search.php?disp='. $i . '>'. $i .'</a></td>';
}
?>
</tr>
</td>
</tr>
</table>
</form> </form>
...@@ -13,15 +13,21 @@ if(isset($_POST['search'])) { ...@@ -13,15 +13,21 @@ if(isset($_POST['search'])) {
echo '<div align="center"><font color="RED">Please enter some keyword to search</font></div>'; echo '<div align="center"><font color="RED">Please enter some keyword to search</font></div>';
exit(); exit();
} }
$searchtext = '%'.$searchtext.'%';
} }
else if($_GET['author'] != '') { else if($_GET['author'] != '') {
$searchtext = $_GET['author']; $searchtext = '%'.$_GET['author'].'%';
$in = "author"; $in = "author";
} }
else if ($_GET['disp'] == 'all') { else if ($_GET['disp'] == 'all') {
$searchtext = ""; $searchtext = "%";
$in = "module"; $in = "module";
} }
else if ($_GET['disp'] != '') {
$searchtext = $_GET['disp'].'%';
$in = "module";
}
else else
exit(); exit();
...@@ -29,12 +35,14 @@ $result = searchdb($searchtext, $in, $db); ...@@ -29,12 +35,14 @@ $result = searchdb($searchtext, $in, $db);
echo '<table align="left" border="0" cellpadding="8" cellspacing="1">'; echo '<table align="left" border="0" cellpadding="8" cellspacing="1">';
if($row = sqlite3_fetch_array($result)) if($row = sqlite3_fetch_array($result))
echo "<tr><td><a href=\"dispmoduleinfo.php?module=".$row['module']."\">".$row["module"]."</a></br>". echo "<tr><td><a href=\"dispmoduleinfo.php?module=".$row['module']."\">".$row["module"]."</a></br>".
"<a href=\"search.php?author=".$row["author"]."\">".$row["author"]."</a> : ". $row["title"]." </br> </br></td></tr>"; "<a href=\"search.php?author=".$row["author"]."\">".$row["author"]."</a> : ". $row["title"].
" </br> </br></td></tr>";
else else
echo '<div align="center"><font color="RED"> No results found</font></div>'; echo '<div align="center"><font color="RED"> No results found</font></div>';
while($row = sqlite3_fetch_array($result)) { while($row = sqlite3_fetch_array($result)) {
echo "<tr><td><a href=\"dispmoduleinfo.php?module=".$row['module']."\">".$row["module"]."</a></br>". echo "<tr><td><a href=\"dispmoduleinfo.php?module=".$row['module']."\">".$row["module"]."</a></br>".
"<a href=\"search.php?author=".$row["author"]."\">".$row["author"]."</a> : ". $row["title"]." </br> </br></td></tr>"; "<a href=\"search.php?author=".$row["author"]."\">".$row["author"]."</a> : ". $row["title"].
" </br> </br></td></tr>";
} }
echo '</table>'; echo '</table>';
?> ?>
...@@ -4,11 +4,14 @@ function searchdb($text, $in, $db) ...@@ -4,11 +4,14 @@ function searchdb($text, $in, $db)
//search db //search db
$handle = sqlite3_open($db) or die("Could not open database"); $handle = sqlite3_open($db) or die("Could not open database");
if($in == 'module') if($in == 'module')
$query = "select * from search where title LIKE \"%$text%\""; $query = "select * from search where title LIKE \"$text\" order by module,
author";
else if($in == 'author') else if($in == 'author')
$query = "select * from search where author LIKE \"%$text%\""; $query = "select * from search where author LIKE \"$text\" order by module,
author";
else else
$query = "select * from search where title LIKE \"%$text%\" or author LIKE \"%$text%\""; $query = "select * from search where title LIKE \"$text\" or author LIKE \"$text\"
order by module, author";
$result = sqlite3_query($handle, $query) or die("Error in query: ".sqlite3_error($handle)); $result = sqlite3_query($handle, $query) or die("Error in query: ".sqlite3_error($handle));
return $result; return $result;
......
No preview for this file type
No preview for this file type
No preview for this file type
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