Index: trunk/www/flare_alerts/index.php
===================================================================
--- trunk/www/flare_alerts/index.php	(revision 19580)
+++ trunk/www/flare_alerts/index.php	(revision 19634)
@@ -115,6 +115,9 @@
     $colnames = "";
 
-    $query="SELECT fSourceName AS 'Source', fTriggerKey AS 'Trigger', fTriggerType as 'Type', fRunID as 'Run', fBinning as 'Binning', ";
-    $query.="fTriggerInserted as 'Inserted', fTriggerAcknowledged as 'Acknowledged', ";
+    $query="SELECT CONCAT(fTriggerKey, '[', fTriggerType, ']') AS 'Trigger[Type]', if (isnull(fName), fSourceName, fName) AS 'Source', ";
+    $query.="fPacketTypeKey AS 'Packet', CONCAT(Round(fRa,1), '/', Round(fDec,1), '/', Round(fErr,1)) AS 'Ra/Dec/Err', ";
+    $query.="CONCAT(fNight, '_', fRunID) AS 'Run', ";
+    $query.="if (fBinning=-1, 'nightly', CONCAT(fBinning, ' min')) AS 'Binning', ";
+    $query.="fTriggerInserted AS 'Inserted', fTriggerAcknowledged AS 'Acknowledged', ";
     //$query.="CONCAT('<a target=\"_blank\" href=\"http://fact-project.org/monitoring/index.php?y=".substr($today,0,4)."&m=".substr($today,4,2)."&d=".substr($today,6,2)."&source=', fSourceKey, '&timebin=3&plot=night\">20Min</a> ', ";
     //$query.="'<a target=\"_blank\" href=\"http://fact-project.org/monitoring/index.php?y=".substr($today,0,4)."&m=".substr($today,4,2)."&d=".substr($today,6,2)."&source=', fSourceKey, '&timebin=12&plot=night\">Nightly</a>') as 'QLA', ";
@@ -124,10 +127,10 @@
     $query.="CONCAT('<a target=\"_blank\" href=\"http://www.fact-project.org/run_db/db/fact_runinfo.php?fSourceKEY=', fSourceKey, '&fStartDate=', "
         .$today.", '&fStopDate=', ".$today.", '&fSourceName=On&fRunTypeKEY=-1\">Summary</a>') AS 'Summary', ";
-    $query.="CONCAT('<image src=\"https://fact-project.org/lightcurves/".$year."/".$month."/".$day."/lightcurve', fSourceKey, '_20min_".$today.".root-2.png\" width=\"200\" height=\"200\"></image>\n <br>\n "
-        ."<a target=\"_blank\" href=\"http://fact-project.org/monitoring/index.php?y=".substr($today,0,4)."&m=".substr($today,4,2)."&d=".substr($today,6,2)."&source=', fSourceKey, '&timebin=3&plot=night\">more details</a>\n') AS 'QLA 20min', ";
-    $query.="CONCAT('<image src=\"https://fact-project.org/lightcurves/".$year."/".$month."/".$day."/lightcurve', fSourceKey, '_1night_".$today.".root-2.png\" width=\"200\" height=\"200\"></image>\n <br>\n "
-        ."<a target=\"_blank\" href=\"http://fact-project.org/monitoring/index.php?y=".substr($today,0,4)."&m=".substr($today,4,2)."&d=".substr($today,6,2)."&source=', fSourceKey, '&timebin=12&plot=night\">more details</a>\n') AS 'QLA 1night', ";
-    $query.="CONCAT('<image src=\"https://fact-project.org/lightcurves/".$year."/".$month."/".$day."/lightcurve', fSourceKey, '_1night_week.root-2.png\" width=\"200\" height=\"200\"></image>\n <br>\n "
-        ."<a target=\"_blank\" href=\"http://fact-project.org/monitoring/index.php?y=".substr($today,0,4)."&m=".substr($today,4,2)."&d=".substr($today,6,2)."&source=', fSourceKey, '&timebin=12&plot=week\">more details</a>\n') AS 'QLA nightly last week' ";
+    $query.="CONCAT('<image src=\"https://fact-project.org/lightcurves/', DATE_FORMAT(fNight, '%Y/%m/%d'), '/lightcurve', fSourceKey, '_20min_', fNight, '.root-2.png\" width=\"200\" height=\"200\"></image>\n <br>\n "
+        ."<a target=\"_blank\" href=\"http://fact-project.org/monitoring/index.php?y=', YEAR(fNight), '&m=', MONTH(fNight), '&d=', DAY(fNight), '&source=', fSourceKey, '&timebin=3&plot=night\">more details</a>\n') AS 'QLA 20min', ";
+    $query.="CONCAT('<image src=\"https://fact-project.org/lightcurves/', DATE_FORMAT(fNight, '%Y/%m/%d'), '/lightcurve', fSourceKey, '_1night_', fNight, '.root-2.png\" width=\"200\" height=\"200\"></image>\n <br>\n "
+        ."<a target=\"_blank\" href=\"http://fact-project.org/monitoring/index.php?y=', YEAR(fNight), '&m=', MONTH(fNight), '&d=', DAY(fNight), '&source=', fSourceKey, '&timebin=12&plot=night\">more details</a>\n') AS 'QLA 1night', ";
+    $query.="CONCAT('<image src=\"https://fact-project.org/lightcurves/', DATE_FORMAT(fNight, '%Y/%m/%d'), '/lightcurve', fSourceKey, '_1night_week.root-2.png\" width=\"200\" height=\"200\"></image>\n <br>\n "
+        ."<a target=\"_blank\" href=\"http://fact-project.org/monitoring/index.php?y=', YEAR(fNight), '&m=', MONTH(fNight), '&d=', DAY(fNight), '&source=', fSourceKey, '&timebin=12&plot=week\">more details</a>\n') AS 'QLA nightly last week' ";
     $query.="FROM FlareTriggers LEFT JOIN factdata.Source USING (fSourceKey) WHERE fNight BETWEEN ".$today." AND ".$today2;
     if ($trigger=="New")
