<!-- lar.php3 -->
<?php
	if ($id)
		$head = "The LAR - entry $id";
	else
		$head = "The LART Application Repository";
	$title = $head;
	$thispage = "lar";
	require("table-top.php3");
	require("sidebar.php3");
	require("table-mid.php3");

	require("lar-func.php3");

	// Select how to sort the list
	
	$sort_types = array(
		"id" => "id",
		"id_r" => "id/reverse",
		"name" => "name",
		"name_r" => "name/reverse",
		"type" => "type",
		"type_r" => "type/reverse",
		"stat" => "status",
		"stat_r" => "status/reverse",
		"desc" => "description",
		"desc_r" => "description/reverse");

	if (! $sort)
		$sort = "id_r";
	if (! $id) {
		echo "<p> The LAR is displayed sorted by $sort_types[$sort].\n";
		echo "Alternatively, you may browse it sorted by:\n";
		while (list($a, $b) = each($sort_types)) {
			if ($a != $sort)
				echo "<a href=\"$PHP_SELF?sort=$a\">$b</a>;\n";
		}
		echo "just click the link.\n\n";
	}
?>

<p> If you want to see all fields of an entry, click its id. To show all
information of all records, check the `all' button below and click `Go!'

<?php
	// Select which fields to show for each record
	
	if ($id)
		$show_a = "on";
	
	$fields = array("info" => "show_i",
			"text" => "show_t",
			"link" => "show_l",
			"changelog" => "show_c",
			"all"  => "show_a");
	
	echo "<form action=\"$PHP_SELF\" method=\"GET\">\n";
	hrow("Show...", "left");
	$text = "";
	while (list($a, $b) = each($fields)) {
		$text .= "<input type=\"checkbox\" name=\"$b\"";
		if ($$b)
			$text .= " checked";
		$text .= "> $a";
		if ($a != "all")	// always last
			$text .= "</td>\n\t\t    <td width=\"20%\">";
	}
	lrow($text, "", "");
	
	// Search for a string in the LAR (unfortunately, we can't use lrow here
	// because of the colspan)

	echo "\t\t<tr><td colspan=\"4\">";
	echo "&nbsp;fields of records containing\n";
	echo "\t\t\t<input type=\"text\" name=\"str\" size=\"25\" value=\"$str\"></td>\n";
	echo "\t\t    <td align=\"right\"><input type=\"submit\" value=\"Go!\"></td></tr>\n";
	erow();
	echo "</form>";
?>

<p>
<ul>
<li> <a href="./lar-help.php3">Help!</a>
<li> Submit a new LAR
     entry (disabled due to bot abuse)
</ul>

<hr noshade>

<?php
	require("lar-list.php3");
	disp_lar($id, $str, $sort);
?>

<?php	require("table-btm.php3"); ?>
