<?php

	/*
	** File: display_nodes
	** Description: Displays list of nodes from a query result
	** Query Result set must contain the following fields in order:
	** ID, Name, Description, Content (name from content table),
	** Age of the node in days, Icon, and pathway ID of the parent
	** pathway of the node
	** You should check for an empty result set before including the file
	** (Used to display list of nodes for particular query on view
	** screen, sample screen, and newest screen)
	** Created: 01/04/2000
	** Author: Vicky Atkinson
	** Email: vicky@clearink.com
	**
	**
	*/
	
	print("<DL>\n");
		
	while($DatabaseRow = mysql_fetch_row($DatabaseResult))
	{
		$node_ID = $DatabaseRow[0];
		$node_Name = $DatabaseRow[1];
		$node_Description = $DatabaseRow[2];
		$node_Content = $DatabaseRow[3];
		$node_DaysOld = $DatabaseRow[4];
		$node_Icon = $DatabaseRow[5];
		$pathway = $DatabaseRow[6];
	
		print("<DT>");
		print("<A HREF=\"");
	
		switch($node_Content)
		{
			case 'Link':
				print("$Location_Script?sid=$sid");
				break;		
			case 'File':
				print(ScreenURL("file") . "&pathway=" . $pathway);
				break;		
			case 'Story':
				print(ScreenURL("story") . "&pathway=" . $pathway);
				break;		
			case 'Vote':
				print(ScreenURL("vote") . "&pathway=" . $pathway);
				break;		
			case 'Threaded Discussion':
				print(ScreenURL("thread") . "&pathway=" . $pathway);
				break;		
			case 'Bulletin Board':
				print(ScreenURL("bbs") . "&pathway=" . $pathway);
				break;		
		}
	
		
		print("&node=$node_ID");
		
		if ($node_Content == 'Story' || $node_Content == 'File' || $node_Content == 'Vote' || $node_Content == 'Threaded Discussion' || $node_Content == 'Bulletin Board')
		{
			print("&ACTION=UPDATE_COUNT");
		}
		print("\">");
		
		if ($node_Icon)
		{
			print("<IMG SRC=\"$Icon_URL$node_Icon\">");
		}
		print("<FONT FACE=\"helvetica\">$node_Name</FONT>");
		print("</A>");
	
		print("<DD>");
	
		/* 
		** put a 'new' tag next to nodes that are younger than seven days
		*/			
		if($node_DaysOld < 7)
		{
			print("<SMALL><FONT COLOR=RED>NEW</FONT></SMALL>\n");
		}
		if($node_Description != "")
		{
			print("<FONT FACE=\"helvetica\" SIZE=2>$node_Description</FONT><BR>\n");
		}
	
	}
	
	print("</DL>\n");

?>
