<?php
require_once "../../../../config/settings.inc.php";
define("IEM_APPID", 96);
require_once "../../../../include/database.inc.php";
require_once "../../../../include/reference.php";
require_once "../../../../include/network.php";
require_once "../../../../include/forms.php";
require_once "../../../../include/myview.php";
require_once "../../../../include/memcache.php";
require_once "../../../../include/warnings_plot.php";
$t = new MyView();
require_once "../../../../include/rview_lib.php";
$baseuri = "warnings.phtml";
putenv("TZ=UTC");
date_default_timezone_set('UTC');

if (isset($_GET["img_x"]) && isset($_GET["img_y"])) {
    $arExtents = explode(",", $_GET["extents"]);
    $ll_x = $arExtents[0];
    $ll_y = $arExtents[1];
    $ur_x = $arExtents[2];
    $ur_y = $arExtents[3];

    $dy = ($ur_y - $ll_y) / floatval(480);
    $dx = ($ur_x - $ll_x) / floatval(640);

    $_REQUEST["lon0"] = (get_int404("img_x", 0) * $dx) + $ll_x;
    $_REQUEST["lat0"] = $ur_y - (get_int404("img_y", 0) * $dy);
}

$layers = isset($_GET["layers"]) ? $_GET["layers"] : array(
    "cwas",
    "warnings",
    "uscounties",
    "nexrad",
    "watches"
);
if (!is_array($layers)) {
    $layers = array($layers);
}
$cu = get_int404("cu", 0);
$loop = get_int404("loop", 0);
if ($loop == 2) $loop = 1;
$tz = strtoupper(get_str404("tz", "CDT"));
$tzdict = array(
    "UTC" => 0,
    "EDT" => 14400,
    "EST" => 18000,
    "CDT" => 18000,
    "CST" => 21600,
    "MDT" => 21600,
    "MST" => 25200,
    "PDT" => 25200,
    "PST" => 28800
);
if (!array_key_exists($tz, $tzdict)) {
    die405();
}

$tzoff = $tzdict[$tz];
$filter = get_int404("filter", 0);
$lsrwindow = get_int404("lsrwindow", "0");
$lsrlook = get_str404("lsrlook", "+");
// careful here as we can have PXXX sites
$site = get_str404("site", "DMX");
$osite = get_str404("osite", "DMX");
$sortcol = get_str404("sortcol", "issue");
$sortdir = get_str404("sortdir", "DESC");
$lon0 = get_float404("lon0", 0);
$lat0 = get_float404("lat0", 0);
$zoom = get_int404("zoom", 250);
$imgsize = get_str404("imgsize", "640x480");
$interval = get_int404("interval", 5);
$frames = get_int404("frames", 10);
$warngeo = get_str404("warngeo", "both");
$ar = explode("x", $imgsize);
if (count($ar) != 2) {
    die405();
}
$width = $ar[0];
$height = $ar[1];

$isarchive = (isset($_GET["archive"]) && $_GET["archive"] == "yes") ? 1 : 0;
$archive = get_str404("archive", "");
$a = time();
if ($isarchive) {
    $year = get_int404("year", date("Y", $a - $tzoff));
    $month = get_int404("month", date("m", $a - $tzoff));
    $day = get_int404("day", date("d", $a - $tzoff));
    $hour = get_int404("hour", date("H", $a - $tzoff));
    $m = get_int404("minute", date("i", $a - $tzoff));
} else {
    $year = date("Y", $a - $tzoff);
    $month = date("m", $a - $tzoff);
    $day = date("d", $a - $tzoff);
    $hour = date("H", $a - $tzoff);
    $m = date("i", $a - $tzoff);
}

if ($m >= 55) $ma = "55";
else if ($m >= 50) $ma = "50";
else if ($m >= 45) $ma = "45";
else if ($m >= 40) $ma = "40";
else if ($m >= 35) $ma = "35";
else if ($m >= 30) $ma = "30";
else if ($m >= 25) $ma = "25";
else if ($m >= 20) $ma = "20";
else if ($m >= 15) $ma = "15";
else if ($m >= 10) $ma = "10";
else if ($m >= 5) $ma = "05";
else $ma = "00";

$m = $ma;
$basets = mktime($hour, $m, 0, $month, $day, $year);
$wfo_filter_ts = mktime(0, 0, 0, 8, 29, 2004);
if ($isarchive && $basets < $wfo_filter_ts) {
    $filter = 0;
}

$nt = new NetworkTable(array("WFO", "RFC", "CWSU"), TRUE);
$nt->table["NHC"] = array(
    "lat" => 25.75,
    "lon" => -80.38,
    "name" => "National Hurricane Center"
);
if (!array_key_exists($site, $nt->table)) {
    http_response_code(422);
    die("Invalid Site Identifier");
}

$uri = "$baseuri?frames=$frames&amp;interval=$interval&amp;site=$site&amp;" .
    "cu=$cu&amp;archive=$archive&amp;year=$year&amp;month=$month&amp;" .
    "day=$day&amp;hour=$hour&amp;minute=$m&amp;loop=$loop&amp;" .
    "filter=$filter&amp;sortdir=$sortdir&amp;zoom=$zoom&amp;warngeo=$warngeo";
$uri_nowfo = "$baseuri?frames=$frames&amp;interval=$interval&amp;" .
    "archive=$archive&amp;cu=$cu&amp;year=$year&amp;month=$month&amp;" .
    "day=$day&amp;hour=$hour&amp;minute=$m&amp;loop=$loop&amp;" .
    "filter=$filter&amp;sortdir=$sortdir&amp;zoom=$zoom&amp;warngeo=$warngeo";


/*
 Okay, complicated location stuff here...
  + case1: Default DMX (first page load)
  + case2: User clicks on map
  + case3: User selects different WFO  ($osite != $site)
  + case4: Nothing happens. lat0 lon0 are defined
*/

if (isset($_REQUEST["lat0"]) && isset($_REQUEST["lon0"]) && $osite == $site) {
    $uri .= "&lat0=$lat0&lon0=$lon0";
} else if (isset($_GET["site"]) || $lat0 == 0 || $lon0 == 0 || $osite != $site) {
    $osite = $site;
    $lat0 = $nt->table[$site]["lat"];
    $lon0 = $nt->table[$site]["lon"];
    $uri .= "&lat0=$lat0&lon0=$lon0";
}

$t->title = "RADAR &amp; NWS Warnings";
$t->jsextra = <<<EOM
<script src="warnings.module.js" type="module"></script>
EOM;
$t->headextra = <<<EOM
<link rel="stylesheet" type="text/css" href="warnings.css" />
EOM;

$content = <<<EOM
<form style="display: inline;" method="GET" name="myform" action="{$baseuri}">
<input type="hidden" value="{$site}" name="osite">
<input type="hidden" name="tzoff" value="0">
EOM;
if (isset($_REQUEST["lat0"])) {
    $content .= "<input type=\"hidden\" value=\"{$lat0}\" name=\"lat0\">
    <input type=\"hidden\" value=\"{$lon0}\" name=\"lon0\">";
}

$rtl = array(
    "usdm" => "US Drought Monitor",
    "goes_vis" => "CONUS GOES Visible",
    "goes_ir" => "CONUS GOES Infrared",
    "goes_wv" => "CONUS GOES Water Vapor",
    "current_barbs" => "Current Wind Barbs",
    "airtemps" => "Current Air Temps",
    "current_sites" => "Site Labels",
);
$rtlselect = "";
foreach ($rtl as $key => $val) {
    $rtlselect .= sprintf(
        '<br /><input id="layer%s" name="layers[]" type="checkbox" '
            . ' value="%s"%s> <label for="layer%s">%s</label>',
        $key,
        $key,
        (in_array($key, $layers)) ? ' checked="checked"' : '',
        $key,
        $val
    );
}

$ll = array(
    "nexrad" => "CONUS NEXRAD",
    "akn0q" => "Alaska NEXRAD (2010+)",
    "hin0q" => "Hawaii NEXRAD (2010+)",
    "prn0q" => "Puerto Rico NEXRAD (2010+)",
    "warnings" => "Warnings",
    "cwsu" => "CWSU Boundaries",
    "cwas" => "WFO Boundaries",
    "uscounties" => "US Counties",
    "interstates" => "US Interstates",
    "watches" => "Watches",
);
$lselect = "";
foreach ($ll as $key => $val) {
    $lselect .= sprintf(
        '<br /><input id="layer%s" name="layers[]" type="checkbox" '
            . ' value="%s"%s> <label for="layer%s">%s</label>',
        $key,
        $key,
        (in_array($key, $layers)) ? ' checked="checked"' : '',
        $key,
        $val
    );
}

$wselect = '<select name="site" style="width: 100%">';
foreach ($nt->table as $key => $value) {
    $wselect .= "<option value=\"$key\" ";
    if ($site == $key) $wselect .= "SELECTED";
    $wselect .= ">[" . $key . "] " . $value["name"] . "</option>";
}
$wselect .= "</select>";

$ar = array(
    "UTC" => "UTC",
    "EDT" => "EDT",
    "EST" => "EST",
    "CDT" => "CDT",
    "CST" => "CST",
    "MDT" => "MDT",
    "MST" => "MST",
    "PDT" => "PDT",
    "PST" => "PST"
);
$tzselect = make_select("tz", $tz, $ar);

$ar = array(
    "both" => "County + Polygon",
    "county" => "County Only",
    "sbw" => "Storm Based Warning"
);
$wgselect = make_select("warngeo", $warngeo, $ar);

$ar = array(
    5 => "5 km",
    10 => "10 km",
    25 => "25 km",
    50 => "50 km",
    100 => "100 km",
    250 => "250 km",
    500 => "500 km",
    1000 => "1000 km",
    3000 => "3000 km"
);
$zselect = make_select("zoom", $zoom, $ar);

$ar = array(
    0 => "Hide",
    5 => "5 minutes",
    10 => "10 minutes",
    15 => "15 minutes",
    30 => "30 minutes",
    60 => "60 minutes"
);
$lwselect = make_select("lsrwindow", $lsrwindow, $ar);

$ar = array(
    "fcster" => "Product Author",
    "phenomena" => "Product Type",
    "expire" => "Product Expiration",
    "issue" => "Product Issued",
    "sname" => "State Name",
    "updated" => "Product Updated",
    "wfo" => "Weather Office",
    "eventid" => "VTEC Event ID",
    "status" => "VTEC Status"
);
$sselect = make_select("sortcol", $sortcol, $ar);

$ar = array(
    "640x480" => "640x480",
    "800x600" => "800x600",
    "1024x768" => "1024x768",
    "1280x1024" => "1280x1024",
);
$igselect = make_select("imgsize", $imgsize, $ar);

$ar = array(
    "+" => "+",
    "-" => "-",
    "+/-" => "+/-",
);
$lrselect = make_select("lsrlook", $lsrlook, $ar);

$ar = array(
    "0" => "1 image only",
    "1" => "Java Script Loop"
);
$loselect = make_select("loop", $loop, $ar);

$ar = array(
    "5" => "5 minutes",
    "10" => "10 minutes",
    "15" => "15 minutes",
    "30" => "30 minutes",
    "60" => "1 hour",
    "120" => "2 hours",
    "1440" => "1 day",
);
$ivselect = make_select("interval", $interval, $ar);

$ar = array("0" => "No", "1" => "Yes");
$wfselect = make_select("filter", $filter, $ar);

$pradio = "<br /><input id=\"cu-all\" type=\"radio\" value=\"0\" name=\"cu\" ";
if ($cu == 0) {
    $pradio .= "checked";
}
$pradio .= "> <label for=\"cu-all\">Show All</label>";
$pradio .= "<br /><input id=\"cu-convective\" type=\"radio\" value=\"1\" name=\"cu\" ";
if ($cu == 1) {
    $pradio .= "checked";
}
$pradio .= "> <label for=\"cu-convective\">Convective Only</label>";

$ar = array("DESC" => "DESC", "ASC" => "ASC");
if (!array_key_exists($sortdir, $ar)) {
    $sortdir = "DESC";
}
$sdselect = make_select("sortdir", $sortdir, $ar);

$yselect = yearSelect(2003, $year, "year");
$mselect = monthSelect($month, "month");
$dselect = daySelect($day, "day");
$hselect = hourSelect($hour, "hour");
$miselect = minuteSelect($m, "minute", 5);

$achecked = ($isarchive) ? " CHECKED='CHECKED'" : "";
$dwwidth = $width + 250;
$dwheight = $height + 100;
$content .= <<<EOM
<div id="datawindow"
 style="background: #eee; height: {$dwheight}px; width: {$dwwidth}px; z-index: 2;">
<button type="button" data-control="layers" aria-controls="layers-control" aria-expanded="false" style="background: #73FA4D;">
Layers</button>
<button type="button" data-control="locations" aria-controls="locations-control" aria-expanded="false" style="background: #F2FE5A;">
Locations</button>
<button type="button" data-control="time" aria-controls="time-control" aria-expanded="false" style="background: #FF5EC4;">
Time</button>
<button type="button" data-control="options" aria-controls="options-control" aria-expanded="false" style="background: #2EA7F2;">
Options</button>
<input type="submit" value="Update Map">
<br />
<div id="layers-control" hidden aria-labelledby="layers-heading" style="width: 450px; background: #73FA4D; display: none; z-index: 3; position: absolute; padding: 5px; margin: 2px; border: 2px solid #000;">

<strong id="layers-heading">Available Layers</strong>
{$rtlselect}
{$lselect}
<input type="hidden" name="layers[]" value="blank">

<div style="float: right;">
<button type="button" data-control="layers">Save Settings</button>
<input type="submit" value="Save + Update Map"> </div>
</div>
<div id="locations-control" hidden aria-labelledby="locations-heading" style="width: 450px; background: #F2FE5A; display: none; z-index: 3; position: absolute;  padding: 5px; margin: 2px; border: 2px solid #000;">
<strong id="locations-heading">NWS CWSU/WFO/RFC Office:</strong><br />
{$wselect}

<br />Selecting a different office will move the display to that office.
<div style="float: right;">
<button type="button" data-control="locations">Save Settings</button>
<input type="submit" value="Save + Update Map"> </div>
</div>
<div id="time-control" hidden aria-labelledby="time-heading" style="width: 450px; background: #FF5EC4; display: none; z-index: 3; position: absolute;  padding: 5px; margin: 2px; border: 2px solid #000;">
<p><strong id="time-heading">Select Time Zone</strong><br />
{$tzselect}

<p><strong>Archive Options</strong><br />
<input id="archive-mode" type="checkbox" value="yes" name="archive"{$achecked}><label for="archive-mode"> Set Archive Mode</label>
<br />If you are producing an animation, this date specifies the end date of
the loop.</p>
<table class="table table-sm">
<tr><th>Year:</th><td>{$yselect}</td></tr>
<tr><th>Month:</th><td>{$mselect}</td></tr>
<tr><th>Day:</th><td>{$dselect}</td></tr>
<tr><th>Time:</th><td>{$hselect}:{$miselect}</td></tr>
</table>

<p><div style="float: right;">
<button type="button" data-control="time">Save Settings</button>
<input type="submit" value="Save + Update Map"> </div>
</div>
<div id="options-control" hidden aria-labelledby="options-heading" style="width: 450px; background: #2EA7F2; display: none; z-index: 3; position: absolute;  padding: 5px; margin: 2px; border: 2px solid #000;">
<strong id="options-heading">Warning geography:</strong>
<br />Short term warnings (SVR,TOR,SMW) have a storm based and county
geography associated with them.  You can pick which or both to display:
<br />{$wgselect}

<p><strong>Map Extent:</strong>
<br />View Scale: {$zselect}

<br />Image Size:
{$igselect}

<p><strong>Loop Options</strong>
<br />{$loselect}
<br />Loop Frames:
<input type="text" value="{$frames}" name="frames" size="3">
<br />Loop Frame Interval:
{$ivselect}

<p><strong>Text Warning Listing</strong>
<br />Filter by WFO:
{$wfselect}

<br />Product Filter:
{$pradio}

<br />Sort Column:
{$sselect}

<br />Sort Direction:
{$sdselect}

<p><strong>Local Storm Reports (LSR)</strong>
<br />Time window around plot valid time to plot LSRs.
<br />{$lrselect}
{$lwselect}
<div style="float: right;">
<button type="button" data-control="options">Save Settings</button>
<input type="submit" value="Save + Update Map"> </div>
</div>
EOM;

$heightadd = 0;
$maptitle = "IEM NEXRAD Mosaic Base Reflectivity";
if ($loop === 1 || $loop === 2) {
    $t->jsani = true;
    // Alternative 1, we want javascript looper!
    $hidden_list = '<ul style="display: none;" id="iemjsani_frames">';
    $urls = array();
    for ($i = 0; $i < $frames; $i++) {
        $imgi = $frames - 1 - $i;
        $url = generate_radmap_url(
            $basets,
            $tzoff,
            $imgi,
            $interval,
            $width,
            $height,
            $tz,
            $zoom,
            $lon0,
            $lat0,
            $layers,
            $warngeo,
            $lsrwindow,
        );
        $hidden_list .= sprintf('<li>%s</li>', $url);
        $urls[] = "'{$url}'";
    }
    $hidden_list .= "</ul>";
    // Save this animation to memcache for future potential use
    $memcache = MemcacheSingleton::getInstance();
    // UNIX time is not unique enough, so we multiply by a random int
    $fts = time() * random_int(1, 100);
    $memcache->set("/GIS/apps/rview/warnings.phtml?fts={$fts}", $urls, 86400);

    $content .= <<<EOM
</form>
<a href="anim_gif.php?fts=$fts">Download as Animated Gif</a><br />
<div id="iemjsani" style="width: {$width}px; height: {$height}px;"></div>
{$hidden_list}
EOM;
} else {
    $imgi = 0;
    $url = generate_radmap_url(
        $basets,
        $tzoff,
        $imgi,
        $interval,
        $width,
        $height,
        $tz,
        $zoom,
        $lon0,
        $lat0,
        $layers,
        $warngeo,
        $lsrwindow,
    );
    $lpad = $zoom / 100.0;
    $x0 = $lon0 - $lpad;
    $y0 = $lat0 - $lpad;
    $x1 = $lon0 + $lpad;
    $y1 = $lat0 + $lpad;

    $content .= "<input type=\"hidden\" name=\"extents\" value=\"{$x0},{$y0},{$x1},{$y1}\">\n";
    $content .= "<input type=\"image\" name=\"img\" src=\"" . $url . "\" border=\"1\" alt=\"Weather warning map. Click to recenter the display.\">\n";
    $content .= "</form>";
}
$content .= <<<EOM
</div>
EOM;

// Position legend outside datawindow to prevent layout conflicts
$content .= <<<EOM
<!-- Warnings Key positioned outside datawindow -->
<div class="legend-container">
<img src="static/warnings_legend.png" alt="Warnings Legend">
</div>
EOM;

$connection = iemdb("postgis");

$scols = array("wfo", "phenomena", "cname", "expire", "sname", "issue", "updated", "status", "fcster", "eventid");
if (!in_array($sortcol, $scols)) {
    $sortcol = "issue";
}

$wtable = "warnings_$year";
$tsextra = "CURRENT_TIMESTAMP and issue < CURRENT_TIMESTAMP ";
if ($isarchive) {
    $wtable = "warnings_$year";
    $tsextra = "'" . date("Y-m-d H:i:00+00", $basets + $tzoff) . "' and w.issue < '" . date("Y-m-d H:i:00+00", $basets + $tzoff) . "'";
}
$cuextra = "";
if ($cu == 1) {
    $cuextra = " and w.phenomena IN ('SV','TO','MA') ";
}
$query = "SELECT w.phenomena, u.name as cname, w.expire as expire,
  w.updated as updated, w.status as status, w.fcster as fcster,
  w.eventid as eventid, w.significance as significance,
  w.issue as issue, u.state as sname, ST_xmax(u.geom) as lon0,
  ST_ymax(u.geom) as lat0, w.wfo as wfo
  from $wtable w, nws_ugc u
  WHERE w.expire > $tsextra and w.significance != 'A'
   and w.ugc = u.ugc $cuextra ORDER by {$sortcol} {$sortdir}";
pg_query($connection, "set time zone 'UTC'");
$result = pg_query($connection, $query);

$afos = array(
    "SV" => "Svr Tstorm",
    "TO" => "Tornado",
    "FF" => "Flash Flood"
);
$content .= "<div style=\"clear: both;\">
Warnings Valid at: <b>";

if ($tzoff == 0) {
    if ($isarchive)
        $content .= date("d M Y H:i T", $basets);
    else
        $content .= date("d M Y H:i T");
} else {
    if ($isarchive)
        $content .= date("d M Y h:i A ", $basets) . $tz;
    else
        $content .= date("d M Y h:i A ", time() - $tzoff) . $tz;
}
$content .= "</b>
<br clear=\"all\" />";
$k = 0;
if ($tzoff == 0) {
    $dformat = "H:i UTC";
} else {
    $dformat = "h:i A";
}

/* Loop thru results from database! */
$wA = array();
$iA = array();
$uA = array();
$fA = array();
for ($i = 0; $row = pg_fetch_assoc($result); $i++) {
    /* Save the drama! */
    if ($filter && $row["wfo"] != $site) continue;

    /* key is wfo_state_vtecP_vtecE_vtecSig_expire_status */
    $key = sprintf(
        "%s|%s|%s|%s|%s|%s|%s",
        $row["wfo"],
        $row["sname"],
        $row["phenomena"],
        $row["eventid"],
        $row["significance"],
        $row["expire"],
        $row["status"]
    );

    $iA[$key] = $row["issue"];
    $uA[$key] = $row["updated"];
    $fA[$key] = $row["fcster"];
    if (!array_key_exists($key, $wA)) {
        $wA[$key] = "";
    }
    $wA[$key] .= "<a href=\"warnings.phtml?archive=$archive&tz=$tz&cu=$cu&year=$year&month=$month&day=$day&hour=$hour&minute=$m&tzoff=$tzoff&sortdir=$sortdir&loop=$loop&sortcol=$sortcol&c=yes&lon0=" . $row["lon0"] . "&lat0=" . $row["lat0"] . "&warngeo=$warngeo\">" . $row["cname"] . "</a>, ";
}

/* Now we loop thru aggregated warnings */
foreach ($wA as $key => $val) {
    $tokens = explode("|", $key);
    $wfo = $tokens[0];
    $sname = $tokens[1];
    $phenomena = $tokens[2];
    $eventid = $tokens[3];
    $significance = $tokens[4];
    $expire = $tokens[5];
    $status = $tokens[6];

    $warningscat = sprintf(
        "/vtec/%s-O-NEW-K%s-%s-%s-%04d.html",
        $year,
        $wfo,
        $phenomena,
        $significance,
        $eventid
    );

    $k += 1;
    $issue = strtotime($iA[$key]) - $tzoff;
    $expire = strtotime($expire) - $tzoff;
    $updated = strtotime($uA[$key]) - $tzoff;
    $resetApp = "$uri_nowfo&tz=$tz&cu=$cu&year=$year&month=$month&day=$day&hour=$hour&minute=$m&archive=$archive&tzoff=$tzoff&site=$wfo";

    $pp = (array_key_exists($phenomena, $reference["vtec_phenomena"])) ? $reference["vtec_phenomena"][$phenomena] : "(($phenomena))";
    $content .= "<div class=\"wwa-state\">$sname</div>" .
        "<div class=\"wwa$significance\"><span style=\"font-size: 14pt;\">" .
        $pp . " " . $reference["vtec_significance"][$significance] .
        "</span> (<a href=\"$warningscat\">View Text</a>) expires " .
        date($dformat, $expire) . " by <a href=\"$resetApp\">$wfo</a> (" .
        $fA[$key] . ")<br />" . $wA[$key] .
        "in $sname  <br /><div class=\"vtec\">VTEC# $eventid ($status)</div>" .
        "<div class=\"issued\">Issued: " . date($dformat, $issue) . "</div>" .
        "<div class=\"updated\">Updated: " .  date($dformat, $updated) . "</div>&nbsp;</div>\n";
}
$msg = "";
if ($k == 0 && $filter) {
    $msg = "<p>No warnings currently valid for " . $nt->table[$site]["name"];
} else if ($k == 0) {
    $msg = "<p>No warnings valid in the United States";
}
if ($k == 0) {
    $content .= $msg;
}

$content .= "<div style=\"clear: both;\">";
if (!$isarchive) {
    $content .= "<img src=\"/images/gisready.png\">Download <a href=\"/data/gis/shape/unproj/us/current_ww.zip\">GIS shapefile of current warnings</a> and/or <a href=\"/data/gis/images/4326/USCOMP/n0r_0.gtif.Z\">GeoTiff of NEXRAD base reflectivity</a>.";
}
$content .= <<<EOM
<p><b>Notes:</b>
<ul>
 <li>The status column is simply the status of the warning.
 The warning is in 'NEW' state until a SVS is issued, then it goes to 'CON' for continued.</li>
 <li>NEXRAD composite is available since 1 Jan 1997.</li>
 <li>Prior to the NWS adoption of VTEC, warnings were not expired nor canceled.</li>
 <li>SVS updates were added in 2005.</li>
 <li>LSR archive begins 1 Jan 2002.</li>
 <li>Archive of watches begins 1 Jan 1997.</li>
</ul>
</div>
EOM;
$t->content = $content;
$t->render('single.phtml');
