<?php

# Script:  All Asteroids in seasnam.txt - Numerical List.phpb
# 
# by Apollia - http://apollia.com/
#
#
#-------------------------------------------------------------------------------
#
# In numerical order, lists what asteroid and dwarf planet ephemerides you have
# in your /root/sweph/ folder.
#
#-------------------------------------------------------------------------------
# 
# 
# Under the GNU Affero General Public License v3.0.
# 
# 
# Copyright (C) 2013-2019  Apollia
# 
#     This program is free software: you can redistribute it and/or modify
#     it under the terms of the GNU Affero General Public License as published
#     by the Free Software Foundation, either version 3 of the License, or
#     (at your option) any later version.
# 
#     This program is distributed in the hope that it will be useful,
#     but WITHOUT ANY WARRANTY; without even the implied warranty of
#     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#     GNU Affero General Public License for more details.
# 
#     You should have received a copy of the GNU Affero General Public License
#     along with this program.  If not, see <http://www.gnu.org/licenses/>.
# 
# 
# Contact info:     http://astroblahhh.com/contact-apollia.shtml
# 
# ---- 



#*****************************************************************************
#
# Settings you can change. 
#
#

$Folder_of_Ephemerides="/root/sweph/";

$Full_Path_to_Complete_Asteroids_List = $Folder_of_Ephemerides . "Asteroid List/seasnam.txt";


$Default_Search_Engine = "Bing";
	# Possibilities:
	#	
	#	AOL
	#	Bing
	#	Dogpile
	#	Google (its links doesn't work right with the Dillo web browser, as of 7:54:31 4/7/2013)
	#	Yahoo
	
	
$Web_Browser_Shell_Command = "dillo";
	# Possibilities:
	#
	#	dillo
	#		A fast but primitive web browser.  
	#		Installed in many Puppies by default.
	#		
	#		Much faster than Firefox and Chromium.
	#		
	#	firefox
	#	chromium
	#		These will work if you have them installed.  Will be slow for
	#		large files.
	#	
	#	defaultbrowser
	#		Whatever your default browser is set to be.
	#		
	#		It can be changed by editing this file:
	#		/usr/local/bin/defaultbrowser
		
	
	
$Should_Use_Space_Saving_Output_Format = false;
	# I think the non-space-saving format is more readable.
	# Doesn't apply to HTML page.

$Should_Output_HTML_Page = true;
$Should_Display_HTML_Page = true;

$Full_Path_to_Temporary_HTML_Page = "/tmp/Temporary_File_of_Alphabetical_List_of_All_Asteroids_Etc_in_seasnam_txt.html";

#
#
# End of settings you can change.
#
#*****************************************************************************
#
#
# Everything else can be left alone.
#
#

require "includes/Library-of-Functions.php";


swe_set_ephe_path($Folder_of_Ephemerides);


$All_Asteroid_Numbers_and_Names = Get_All_Asteroid_Numbers_and_Names_from_($Full_Path_to_Complete_Asteroids_List);


$All_Asteroid_Numbers_and_Names = array_flip($All_Asteroid_Numbers_and_Names);

natcasesort($All_Asteroid_Numbers_and_Names);
	# Sorts by number.

$All_Asteroid_Numbers_and_Names = array_flip($All_Asteroid_Numbers_and_Names);


Print_Asteroid_Numbers_and_Names($Should_Use_Space_Saving_Output_Format, $All_Asteroid_Numbers_and_Names);

Print_Total_Number_of_Celestial_Objects($All_Asteroid_Numbers_and_Names);



if ($Should_Output_HTML_Page)
{
	$Temporary_HTML_Page = new HTML_Page("All Asteroids, Etc. in seasnam.txt in Numerical Order", $CSS_for_HTML_Page, "<center><h3>All Asteroids, Etc. in seasnam.txt<br>in Numerical Order</h3><p>");
	
	
	$html = Prepare_Total_Number_of_Celestial_Objects_for_HTML_Display($All_Asteroid_Numbers_and_Names);
	
	$Temporary_HTML_Page->Add_More_Content($html . "<p>");	
	
	if ($Web_Browser_Shell_Command == "dillo")
	{
		$html = Prepare_Dillo_Web_Browser_Tips_for_HTML_Display();
		$Temporary_HTML_Page->Add_More_Content("<p><br>" . $html . "<p>");	
	}
	
	$html = Prepare_Asteroid_Numbers_and_Names_for_HTML_Display($All_Asteroid_Numbers_and_Names, false);
	
	$Temporary_HTML_Page->Add_More_Content($html);	

	if ($Web_Browser_Shell_Command == "dillo")
	{
		$Temporary_HTML_Page -> Build_Page($dillo_html_body_stuff);
	}
	else
	{
		$Temporary_HTML_Page -> Build_Page();
	}
	$Temporary_HTML_Page -> Output_HTML_File_to_Path_($Full_Path_to_Temporary_HTML_Page);
}


if ($Should_Display_HTML_Page)
{
	execInBackground("$Web_Browser_Shell_Command \"$Full_Path_to_Temporary_HTML_Page\"");
	# Dillo displays the file much faster than Firefox.
}

die;

#
#
#
#*****************************************
# End of script.