session_start() # Using sessions allows more than one accessee to work
# simultaneously without confusion ?>
# The bulk of the webpage must conform to the MSSL standards, so invoke
# the already-created top and bottom parts. Fill in the middle with
# Cassini-specific stuff. There really isn't room for all the Cassini
# links as well thoughLKG 11/12/06.
include "/home/html/planetary/plasma_top.inc"; ?>
Cassini CAPS ELS browse plots at MSSL - page under construction
# Now, here's the first confusing bit. We need to know what values to set
# the form to, before bringing up the plot, and if it's the first run
# through they need to be defaults. So here's the code to work out what the
# values are and which plot they call up. Below we'll have the form itself
# and then the plotting command. First we set up the arrays we need.
$daynames=array("01","02","03","04","05","06","07","08","09","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31");
$sumyearnames=array("04","05","06","07","08");
$yearnames=array("2004","2005","2006","2007","2008");
$plotnames=array("0","1","2","3");
$accudays=array(31,59,90,120,151,181,212,243,273,304,334,365);
$leapaccudays=array(31,60,91,121,152,182,213,244,274,305,335,366);
# First the simple one - the user hits 'Go' and gets what's on the form
if(isset($_POST["Go"]))
{
if($_POST["year"]==0 or$_POST["year"]==4 )
{
if($_POST["month"]==0) $doy=$_POST["day"];
else $doy=$leapaccudays[$_POST["month"]-1]+$_POST["day"];
}
else
{
if($_POST["month"]==0) $doy=$_POST["day"];
else $doy=$accudays[$_POST["month"]-1]+$_POST["day"];
}
$filetoplot="cassiniplots/plots".$sumyearnames[$_POST["year"]]."/els_summaryplot_".$yearnames[$_POST["year"]].$doy.$plotnames[$_POST["plottype"]].".png";
$_SESSION["thisday"]=$_POST["day"];
$_SESSION["thismonth"]=$_POST["month"];
$_SESSION["thisyear"]=$_POST["year"];
$_SESSION["thisplottype"]=$_POST["plottype"];
}
# If user hits 'Back one day' then we use this code - the default on the
# end is for when the user chooses this option without having set the
# form up for themself first
elseif(isset($_POST["Back"]))
{
if(isset($_POST["day"]))
{
if($_POST["year"]==0 or $_POST["year"]==4)
{
if($_POST["month"]==0) $doy=$_POST["day"];
else $doy=$leapaccudays[$_POST["month"]-1]+$_POST["day"];
}
else
{
if($_POST["month"]==0) $doy=$_POST["day"];
else $doy=$accudays[$_POST["month"]-1]+$_POST["day"];
}
$newdoy=$doy-1;
if($newdoy==0)
{
if ($_POST["year"]==1) $newdoy=366;
else $newdoy=365;
$newyear=$_POST["year"]-1;
}
else $newyear=$_POST["year"];
$foundmatch=0;
$newmonth=0;
if($_POST["year"]==0 or $_POST["year"]==4)
{
do { if($newdoy<=$leapaccudays[$newmonth]) $foundmatch=1;
$newmonth=$newmonth+1; } while ($foundmatch==0);
$newmonth=$newmonth-1;
if ($newmonth > 0) $newday=$newdoy-$leapaccudays[$newmonth-1];
else $newday=$newdoy;
}
else
{
do { if($newdoy<=$accudays[$newmonth]) $foundmatch=1;
$newmonth=$newmonth+1; } while ($foundmatch==0);
$newmonth=$newmonth-1;
if ($newmonth > 0) $newday=$newdoy-$accudays[$newmonth-1];
else $newday=$newdoy;
}
$filetoplot="cassiniplots/plots".$sumyearnames[$newyear]."/els_summaryplot_".$yearnames[$newyear].$newdoy.$plotnames[$_POST["plottype"]].".png";
$_SESSION["thisday"]=$newday;
$_SESSION["thismonth"]=$newmonth;
$_SESSION["thisyear"]=$newyear;
$_SESSION["thisplottype"]=$_POST["plottype"];
}
else
{
$filetoplot="cassiniplots/plots04/els_summaryplot_20041820.png";
$_SESSION["thisday"]=30;
$_SESSION["thismonth"]=5;
$_SESSION["thisyear"]=0;
$_SESSION["thisplottype"]=0;
}
}
# If user hits 'Back 6hrs' then we use this code - the default on the
# end is for when the user chooses this option without having set the
# form up for themself first
elseif(isset($_POST["Back6"]))
{
if(isset($_POST["day"]))
{
if($_POST["plottype"]==0)
{
$newplottype=3;
if($_POST["year"]==0 or $_POST["year"]==4)
{
if($_POST["month"]==0) $doy=$_POST["day"];
else $doy=$leapaccudays[$_POST["month"]-1]+$_POST["day"];
}
else
{
if($_POST["month"]==0) $doy=$_POST["day"];
else $doy=$accudays[$_POST["month"]-1]+$_POST["day"];
}
$newdoy=$doy-1;
if($newdoy==0)
{
if ($_POST["year"]==1) $newdoy=366;
else $newdoy=365;
$newyear=$_POST["year"]-1;
}
else $newyear=$_POST["year"];
$foundmatch=0;
$newmonth=0;
if($_POST["year"]==0 or $_POST["year"]==4)
{
do { if($newdoy<=$leapaccudays[$newmonth]) $foundmatch=1;
$newmonth=$newmonth+1; } while ($foundmatch==0);
$newmonth=$newmonth-1;
if ($newmonth > 0) $newday=$newdoy-$leapaccudays[$newmonth-1];
else $newday=$newdoy;
}
else
{
do { if($newdoy<=$accudays[$newmonth]) $foundmatch=1;
$newmonth=$newmonth+1; } while ($foundmatch==0);
$newmonth=$newmonth-1;
if ($newmonth > 0) $newday=$newdoy-$accudays[$newmonth-1];
else $newday=$newdoy;
}
}
else
{
if($_POST["year"]==0 or$_POST["year"]==4)
{
if($_POST["month"]==0) $newdoy=$_POST["day"];
else $newdoy=$leapaccudays[$_POST["month"]-1]+$_POST["day"];
}
else
{
if($_POST["month"]==0) $doy=$_POST["day"];
else $newdoy=$accudays[$_POST["month"]-1]+$_POST["day"];
}
$newday=$_POST["day"];
$newmonth=$_POST["month"];
$newyear=$_POST["year"];
$newplottype=$_POST["plottype"]-1;
}
$filetoplot="cassiniplots/plots".$sumyearnames[$newyear]."/els_summaryplot_".$yearnames[$newyear].$newdoy.$plotnames[$newplottype].".png";
$_SESSION["thisday"]=$newday;
$_SESSION["thismonth"]=$newmonth;
$_SESSION["thisyear"]=$newyear;
$_SESSION["thisplottype"]=$newplottype;
}
else
{
$filetoplot="cassiniplots/plots04/els_summaryplot_20041823.png";
$_SESSION["thisday"]=30;
$_SESSION["thismonth"]=5;
$_SESSION["thisyear"]=0;
$_SESSION["thisplottype"]=3;
}
}
# If user hits 'Forward 6hrs' then we use this code - the default on the
# end is for when the user chooses this option without having set the
# form up for themself first
elseif(isset($_POST["Forward6"]))
{
if(isset($_POST["day"]))
{
if($_POST["plottype"]==3)
{
$newplottype=0;
if($_POST["year"]==0 or $_POST["year"]==4)
{
if($_POST["month"]==0) $doy=$_POST["day"];
else $doy=$leapaccudays[$_POST["month"]-1]+$_POST["day"];
}
else
{
if($_POST["month"]==0) $doy=$_POST["day"];
else $doy=$accudays[$_POST["month"]-1]+$_POST["day"];
}
$newdoy=$doy+1;
if($_POST["year"]==0 or $_POST["year"]==4)
{
if($newdoy==367)
{
$newdoy=1;
$newyear=$_POST["year"]+1;
} else $newyear=$_POST["year"];
}
else
{
if($newdoy==366)
{
$newdoy=1;
$newyear=$_POST["year"]+1;
} else $newyear=$_POST["year"];
}
$foundmatch=0;
$newmonth=0;
if($_POST["year"]==0 or $_POST["year"]==4)
{
do { if($newdoy<=$leapaccudays[$newmonth]) $foundmatch=1;
$newmonth=$newmonth+1; } while ($foundmatch==0);
$newmonth=$newmonth-1;
if ($newmonth > 0) $newday=$newdoy-$leapaccudays[$newmonth-1];
else $newday=$newdoy;
}
else
{
do { if($newdoy<=$accudays[$newmonth]) $foundmatch=1;
$newmonth=$newmonth+1; } while ($foundmatch==0);
$newmonth=$newmonth-1;
if ($newmonth > 0) $newday=$newdoy-$accudays[$newmonth-1];
else $newday=$newdoy;
}
}
else
{
if($_POST["year"]==0 or$_POST["year"]==4)
{
if($_POST["month"]==0) $newdoy=$_POST["day"];
else $newdoy=$leapaccudays[$_POST["month"]-1]+$_POST["day"];
}
else
{
if($_POST["month"]==0) $doy=$_POST["day"];
else $newdoy=$accudays[$_POST["month"]-1]+$_POST["day"];
}
$newday=$_POST["day"];
$newmonth=$_POST["month"];
$newyear=$_POST["year"];
$newplottype=$_POST["plottype"]+1;
}
$filetoplot="cassiniplots/plots".$sumyearnames[$newyear]."/els_summaryplot_".$yearnames[$newyear].$newdoy.$plotnames[$newplottype].".png";
$_SESSION["thisday"]=$newday;
$_SESSION["thismonth"]=$newmonth;
$_SESSION["thisyear"]=$newyear;
$_SESSION["thisplottype"]=$newplottype;
}
else
{
$filetoplot="cassiniplots/plots04/els_summaryplot_20041831.png";
$_SESSION["thisday"]=1;
$_SESSION["thismonth"]=6;
$_SESSION["thisyear"]=0;
$_SESSION["thisplottype"]=1;
}
}
# If user hits 'Forward one day' then we use this code - the default on the
# end is for when the user chooses this option without having set the
# form up for themself first
elseif(isset($_POST["Forward"]))
{
if(isset($_POST["day"]))
{
if($_POST["year"]==0 or $_POST["year"]==4)
{
if($_POST["month"]==0) $doy=$_POST["day"];
else $doy=$leapaccudays[$_POST["month"]-1]+$_POST["day"];
}
else
{
if($_POST["month"]==0) $doy=$_POST["day"];
else $doy=$accudays[$_POST["month"]-1]+$_POST["day"];
}
$newdoy=$doy+1;
if($_POST["year"]==0 or $_POST["year"]==4)
{
if($newdoy==367)
{
$newdoy=1;
$newyear=$_POST["year"]+1;
} else $newyear=$_POST["year"];
}
else
{
if($newdoy==366)
{
$newdoy=1;
$newyear=$_POST["year"]+1;
} else $newyear=$_POST["year"];
}
$foundmatch=0;
$newmonth=0;
if($_POST["year"]==0 or $_POST["year"]==4)
{
do { if($newdoy<=$leapaccudays[$newmonth]) $foundmatch=1;
$newmonth=$newmonth+1; } while ($foundmatch==0);
$newmonth=$newmonth-1;
if ($newmonth > 0) $newday=$newdoy-$leapaccudays[$newmonth-1];
else $newday=$newdoy;
}
else
{
do { if($newdoy<=$accudays[$newmonth]) $foundmatch=1;
$newmonth=$newmonth+1; } while ($foundmatch==0);
$newmonth=$newmonth-1;
if ($newmonth > 0) $newday=$newdoy-$accudays[$newmonth-1];
else $newday=$newdoy;
}
$filetoplot="cassiniplots/plots".$sumyearnames[$newyear]."/els_summaryplot_".$yearnames[$newyear].$newdoy.$plotnames[$_POST["plottype"]].".png";
$_SESSION["thisday"]=$newday;
$_SESSION["thismonth"]=$newmonth;
$_SESSION["thisyear"]=$newyear;
$_SESSION["thisplottype"]=$_POST["plottype"];
}
else
{
$filetoplot="cassiniplots/plots04/els_summaryplot_20041840.png";
$_SESSION["thisday"]=2;
$_SESSION["thismonth"]=6;
$_SESSION["thisyear"]=0;
$_SESSION["thisplottype"]=0;
}
}
# And finally, if this is the first load, set defaults
else
{
$filetoplot="cassiniplots/plots04/els_summaryplot_20041830.png";
$_SESSION["thisday"]=1;
$_SESSION["thismonth"]=6;
$_SESSION["thisyear"]=0;
$_SESSION["thisplottype"]=0;
} ?>
# At the top of the bit of page we're using we want the form and a link
# back to the VEx description page, on the same row, so we need them to
# be in a table. We also want a 'back-a-day' and a 'forward-a-day'
# button with the form ie there'll be 3 different submit buttons ?>
# This bit sets up the droplists and 5 submit buttons ('Go' to what's on
# the form, 2 backs from what we're looking at, 2 forwards ditto).
# Once any of them are pressed this page reloads and the code below picks
# up the right plot to display. It's complicated because if the user has
# already made a selection it needs to be held over. So instead of writing
# the html for the table directly we have to create it on the fly using php
# print statements, so that the 'select' keyword goes into the right
# line. Ye little apfelstrudels.... ?>
# And after the forms put in a link to MSSL's Cassini page.
# Remember it needs its own box in the table, and some whitespace. ?>
|
Cassini page
|
# Now pick up the file we defined above and display it. Put the standard
# MSSL footer on the bottom. And we're done.
print ""; ?>
include "/home/html/planetary/plasma_bot.inc"; ?>