Changeset 9599


Ignore:
Timestamp:
Jun 28, 2010, 5:47:01 PM (10 years ago)
Author:
dorner
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r9598 r9599  
    1919                                                 -*-*- END OF LINE -*-*-
    2020
     21 2010/06/28 Daniela Dorner
     22
     23   * datacenter/db/include.php:
     24     - adapted status query for new db layout
     25
     26   * datacenter/db/menu.php:
     27     - added and exchanged menu points and init elements for the new
     28       layout of the FACT mc db
     29     - bugfix that menu items can be switched off
     30
     31   * datacenter/db/mcinfo.php:
     32     - adapted the queries for the new layout of the FACT mc db
     33       (different table names, structures and content)
     34     - adapted query for the status group by
     35
     36   * datacenter/db/mcdefs.php:
     37     - adapted the arrays for the new layout of the FACT mc db
     38
     39
     40
    2141 2010/06/28 Thomas Bretz
    2242
     
    88108
    89109
     110>>>>>>> 1.4293
    90111 2010/06/24 Daniela Dorner
    91112
  • trunk/MagicSoft/Mars/datacenter/db/include.php

    r9548 r9599  
    5050}
    5151
    52 function StatusQuery($name, $needs, $timelimits)
     52function StatusQuery($name, $timelimits)
    5353{
    5454    if (empty($timelimits[$name]))
     
    6060    switch ($_GET[$var])
    6161    {
    62     case 0: $txt .= ""; break;
    63     case 1: $txt .= "NOT (IsNull(" . $name . ") OR " . $name . "='1970-01-01 00:00:00') AND "; break;
    64 //    case 2: $txt .= "IsNull(" . $name . ") AND IsNull(fStartTime) AND IsNull(fFailedTime) AND NOT IsNull(" . $needs[$name] . ") AND "; break; //not done but step before is done
    65     case 2: $txt .= "IsNull(" . $name . ") AND "; break; //not done no matter what status of previous step is
    66     case 3: $txt .= $name ."='1970-01-01 00:00:00' AND "; break;
    67     case 4: $txt .= " (IsNull(" . $name . ") AND IsNull(fFailedTime) AND NOT IsNull(fStartTime) AND date_sub(Now(),interval " . $timelimit . " hour) < fStartTime AND NOT IsNull(" . $needs[$name] . ")) AND "; break;
    68     case 5: $txt .= " (IsNull(" . $name . ") AND NOT IsNull(fFailedTime) AND NOT IsNull(fStartTime) AND NOT IsNull(" . $needs[$name] . ")) AND "; break;
    69     case 6: $txt .= " (IsNull(" . $name . ") AND IsNull(fFailedTime) AND NOT IsNull(fStartTime) AND date_sub(Now(),interval " . $timelimit . " hour) > fStartTime AND NOT IsNull(" . $needs[$name] . ")) AND "; break;
    70 //    case 6: $txt .= "crashed"; break;
    71     case 7: $txt .= ""; break;
     62    case 0://all
     63        $txt .= " ";
     64        break;
     65    case 1://done
     66        $txt .= " NOT ISNULL(" . $name . "Status.fStartTime) AND "
     67            ." NOT ISNULL(" . $name . "Status.fStopTime) AND "
     68            ." ISNULL(" . $name . "Status.fReturnCode) AND ";
     69        break;
     70    case 2://not done
     71        $txt .= " ISNULL(" . $name . "Status.fStartTime) AND "
     72            ." ISNULL(" . $name . "Status.fStopTime) AND "
     73            ." ISNULL(" . $name . "Status.fReturnCode) AND ";
     74        break;
     75    case 3://not to be done
     76        $txt .= $name ."Status.fStartTime='1970-01-01 00:00:00' AND "
     77            . $name ."Status.fStopTime='1970-01-01 00:00:00' AND ";
     78        break;
     79    case 4://running
     80        $txt .= " NOT ISNULL(" . $name . "Status.fStartTime) AND "
     81            ." DATE_SUB(Now(),INTERVAL " . $timelimit . " HOUR) < " . $name . "Status.fStartTime AND "
     82            ." ISNULL(" . $name . "Status.fStopTime) AND "
     83            ." ISNULL(" . $name . "Status.fReturnCode) AND ";
     84        break;
     85    case 5://failed
     86        $txt .= " NOT ISNULL(" . $name . "Status.fStartTime) AND "
     87            ." NOT ISNULL(" . $name . "Status.fStopTime) AND "
     88            ." NOT ISNULL(" . $name . "Status.fReturnCode) AND ";
     89        break;
     90    case 6://crashed
     91        $txt .= " NOT ISNULL(" . $name . "Status.fStartTime) AND "
     92            ." DATE_SUB(Now(),INTERVAL " . $timelimit . " HOUR) > " . $name . "Status.fStartTime AND "
     93            ." ISNULL(" . $name . "Status.fStopTime) AND "
     94            ." ISNULL(" . $name . "Status.fReturnCode) AND ";
     95        break;
     96    case 7://group by
     97        $txt .= "";
     98        break;
    7299    }
    73100    return $txt;
     
    108135    }
    109136
    110     /*
    111     $status = array("all", "done", "not done", "not to be done");
    112     $counter = 0;
    113     foreach ($status as $element)
    114     {
    115         if ($counter==$_GET[$var])
    116             printf("<option value=\"%d\" selected>%3s</option>\n", $counter++, $element);
    117         else
    118             printf("<option value=\"%d\">%3s</option>\n", $counter++, $element);
    119     }*/
    120137    printf(" </select>\n");
    121138    printf(" &nbsp;&nbsp;&nbsp;\n");
     
    329346{
    330347    foreach ($_GET as $key => $element)
    331         if ($key==$column)
     348        if ($key==$column."Status")
    332349            if ($element==7)
    333350                return -1;
  • trunk/MagicSoft/Mars/datacenter/db/mcdefs.php

    r9498 r9599  
    11<?php
    2 
    3 $needs = array
    4     (
    5      "fCorsikaInputCreated" => "MCRunProcessStatus.fMCRunNumber",
    6      "fCorsikaFileAvail"    => "MCRunProcessStatus.fCorsikaInputCreated",
    7      );
    8 
    92
    103$timelimits = array
    114    (
    12      "fCorsikaInputCreated" => "1",
    13      "fCorsikaFileAvail"    => "60",
     5     "Corsika" => "60",
     6     "Ceres" => "1",
     7     "SequenceFile" => "1",
     8     "Callisto" => "1",
     9     "Star" => "1",
    1410     );
    1511
     
    1814    (
    1915     "fParticleTypeName"                 => CheckWhere("fParticleTypeKEY"),
     16     "fRunTypeName"                      => CheckWhere("fRunTypeKEY"),
    2017     "fAtmosphericModelName"             => CheckWhere("fAtmosphericModelKEY"),
    2118    );
     
    2421    (
    2522     "fParticleTypeName"                 => CheckGroup("fParticleTypeKEY"),
     23     "fRunTypeName"                      => CheckGroup("fRunTypeKEY"),
    2624     "fAtmosphericModelName"             => CheckGroup("fAtmosphericModelKEY"),
    2725    );
     
    3028$checkstatusgroup = array
    3129    (
    32      "fCorsikaInputCreated" => CheckStatusGroup("fCorsikaInputCreatedStatus"),
    33      "fCorsikaFileAvail" => CheckStatusGroup("fCorsikaFileAvailStatus"),
     30     "Corsika"      => CheckStatusGroup("Corsika"),
     31     "Ceres"        => CheckStatusGroup("Ceres"),
     32     "SequenceFile" => CheckStatusGroup("SequenceFile"),
     33     "Callisto"     => CheckStatusGroup("Callisto"),
     34     "Star"         => CheckStatusGroup("Star"),
    3435    );
    3536
     
    3839$alias = array
    3940    (
    40 //     "fRunNumber"                       => "Run#",
    41      "Run#"                    => "Run#",
    42      "fNumEvents"              => "#Evts",
    43      "SUM(fNumEvents)"         => "Evts",
    44      "fParticleTypeName"       => "Particle",
    45      "fAtmosphericModelName"   => "Atm.Model",
    46      "fCorsikaInputCreated"    => "Input",
    47      "fCorsikaFileAvail"       => "Corsika",
    48      "fStartTime"              => "Process",
    49      "fFailedTime"             => "Failed",
    50      "fReturnCode"             => "Ret<br>Code",
    51      "fProgramId"              => "Prgr<br>Id",
    52      "fZenithDistanceMin"      => "Zd<br>Min",
    53      "fZenithDistanceMax"      => "Zd<br>Max",
    54      "fAzimuthMin"             => "Az<br>Min",
    55      "fAzimuthMax"             => "Az<br>Max",
    56      "Min(fZenithDistanceMin)" => "ZDMin",
    57      "Max(fZenithDistanceMax)" => "ZDMax",
    58      "fEnergyMin"              => "EMin<br>[GeV]",
    59      "fEnergyMax"              => "EMax<br>[GeV]",
    60      "fImpactMax"              => "Impact<br>[cm]",
    61      "fViewConeMax"            => "View<br>cone<br>[deg]",
    62      "fEnergySlope"            => "Slope",
    63      "fNumReUseShower"         => "#ShowerReUse",
    64      "fStartingAltitude"       => "Altitude<br>[g/sqcm]",
    65      "fMirrorDiameter"         => "Mirror<br>diam.<br>[cm]",
     41     "Run.File"                 => "Run.File",
     42     "fNumEvents"               => "#Evts",
     43     "SUM(fNumEvents)"          => "Evts",
     44     "fParticleTypeName"        => "Particle",
     45     "fRunTypeName"             => "RunType",
     46     "fAtmosphericModelName"    => "Atm.Model",
     47     "fCorsikaInputCreated"     => "Input",
     48     "Corsika"                  => "Corsika",
     49     "Ceres"                    => "Ceres",
     50     "SequenceFile"             => "SequenceFile",
     51     "Callisto"                 => "Callisto",
     52     "Star"                     => "Star",
     53     "fStartTime"               => "Process",
     54     "fFailedTime"              => "Failed",
     55     "fReturnCode"              => "Ret<br>Code",
     56     "fProgramId"               => "Prgr<br>Id",
     57     "fZenithDistanceMin"       => "Zd<br>Min",
     58     "fZenithDistanceMax"       => "Zd<br>Max",
     59     "fAzimuthMin"              => "Az<br>Min",
     60     "fAzimuthMax"              => "Az<br>Max",
     61     "Min(fZenithDistanceMin)"  => "ZDMin",
     62     "Max(fZenithDistanceMax)"  => "ZDMax",
     63     "fEnergyMin"               => "EMin<br>[GeV]",
     64     "fEnergyMax"               => "EMax<br>[GeV]",
     65     "fImpactMax"               => "Impact<br>[cm]",
     66     "fViewConeMax"             => "View<br>cone<br>[deg]",
     67     "fEnergySlope"             => "Slope",
     68     "fStartingAltitude"        => "Altitude<br>[g/sqcm]",
     69     "fMirrorDiameter"          => "Mirror<br>diam.<br>[cm]",
    6670    );
    6771
     
    8084     $alias["fViewConeMax"]              => "1",
    8185     $alias["fEnergySlope"]              => "1",
    82      $alias["fNumReUseShower"]           => "1",
    8386     $alias["fStartingAltitude"]         => "1",
    8487     $alias["fMirrorDiameter"]           => "1",
     
    9295    $checks = array
    9396        (
    94          "fParticleTypeName"         => $fromtable . ".fParticleTypeKEY",
    95          "fAtmosphericModelName"     => $fromtable . ".fAtmosphericModelKEY",
     97         "fParticleTypeName"         => "ParticleType.fParticleTypeKEY",
     98         "fRunTypeName"              => "RunType.fRunTypeKEY",
     99         "fAtmosphericModelName"     => "AtmosphericModel.fAtmosphericModelKEY",
    96100        );
    97101
     
    117121         "fProgramId"                        => "fProgramId",
    118122         "fParticleTypeName"                 => "ParticleType.fParticleTypeName",
     123         "fRunTypeName"                      => "RunType.fRunTypeName",
    119124         "fAtmosphericModelName"             => "AtmosphericModel.fAtmosphericModelName",
    120          "fAzimuthMin"                       => $fromtable . ".fAzimuthMin",
    121          "fAzimuthMax"                       => $fromtable . ".fAzimuthMax",
    122          "fZenithDistanceMin"                => $fromtable . ".fZenithDistanceMin",
    123          "fZenithDistanceMax"                => $fromtable . ".fZenithDistanceMax",
    124          "fEnergyMin"                        => $fromtable . ".fEnergyMin",
    125          "fEnergyMax"                        => $fromtable . ".fEnergyMax",
    126          "fImpactMax"                        => $fromtable . ".fImpactMax",
    127          "fViewConeMax"                      => $fromtable . ".fViewConeMax",
    128          "fEnergySlope"                      => $fromtable . ".fEnergySlope",
    129          "fNumReUseShower"                   => $fromtable . ".fNumReUseShower",
    130          "fStartingAltitude"                 => $fromtable . ".fStartingAltitude",
    131          "fMirrorDiameter"                   => $fromtable . ".fMirrorDiameter",
     125         "fAzimuthMin"                       => "CorsikaInfo.fAzimuthMin",
     126         "fAzimuthMax"                       => "CorsikaInfo.fAzimuthMax",
     127         "fZenithDistanceMin"                => "CorsikaInfo.fZenithDistanceMin",
     128         "fZenithDistanceMax"                => "CorsikaInfo.fZenithDistanceMax",
     129         "fEnergyMin"                        => "CorsikaInfo.fEnergyMin",
     130         "fEnergyMax"                        => "CorsikaInfo.fEnergyMax",
     131         "fImpactMax"                        => "CorsikaInfo.fImpactMax",
     132         "fViewConeMax"                      => "CorsikaInfo.fViewConeMax",
     133         "fEnergySlope"                      => "CorsikaInfo.fEnergySlope",
     134         "fStartingAltitude"                 => "CorsikaInfo.fStartingAltitude",
     135         "fMirrorDiameter"                   => "CorsikaInfo.fMirrorDiameter",
    132136         "Min(fZenithDistanceMin)"           => "'ZDMin'",
    133137         "Max(fZenithDistanceMax)"           => "'ZDMax'",
     
    137141    if (!empty($tables[$val]))
    138142        $table=$tables[$val];
    139     if ($val=="Tel:Run/File")
    140         $table="'Tel:Run/File'";
     143    if ($val=="Run.File")
     144        $table="'Run.File'";
    141145    if ($val=="Tel:Sequ")
    142146        $table="CONCAT('M', Sequences.fTelescopeNumber, ':', LPAD(Sequences.fSequenceFirst, 8, '0'))";
     
    147151    if ($val=="NumDS")
    148152        $table="'# Datasets'";
     153    if ($val=="# Files")
     154        $table="'# Files'";
    149155    if ($val=="NumDays")
    150156        $table="'# days'";
     
    160166        (
    161167         "fParticleTypeName"           => " LEFT JOIN ParticleType         USING(fParticleTypeKEY) ",
     168         "fRunTypeName"                => " LEFT JOIN RunType              USING(fRunTypeKEY) ",
    162169         "fAtmosphericModelName"       => " LEFT JOIN AtmosphericModel     USING(fAtmosphericModelKEY) ",
     170         "Corsika"                     => " LEFT JOIN CorsikaStatus        USING(fRunNumber, fFileNumber) ",
     171         "Ceres"                       => " LEFT JOIN CeresStatus          USING(fRunNumber, fFileNumber, fCeresSetupKEY) ",
     172         "SequenceFile"                => " LEFT JOIN SequenceFileStatus   USING(fSequenceNumber) ",
     173         "Callisto"                    => " LEFT JOIN CallistoStatus       USING(fSequenceNumber, fCeresSetupKEY) ",
     174         "Star"                        => " LEFT JOIN StarStatus           USING(fSequenceNumber, fCeresSetupKEY) ",
    163175        );
    164176
  • trunk/MagicSoft/Mars/datacenter/db/mcinfo.php

    r9548 r9599  
    11<?php
    22{
    3     function CreateQuery($_GET, $alias, $checkwhere, $checkgroup, $checkstatusgroup, $needs, $timelimits)
    4     {
    5         $fromtable="MCCorsikaRunData";
     3    function CreateQuery($_GET, $alias, $checkwhere, $checkgroup, $checkstatusgroup, $timelimits)
     4    {
     5        $fromtable="CeresInfo";
    66
    77        $groups = 0;
     
    4242                foreach ($checkstatusgroup as $key => $element)
    4343                    if ($element==-1)
    44                         $query0 .= " (if(IsNull(" . $key . "), if(isnull(fStartTime), 'not done', if(isnull(fFailedTime),if(isnull(" . $needs[$key] . "),'not done',if(date_sub(Now(),interval " . $timelimits[$key] . " hour) < fStartTime,'running','crashed')),if(isnull(" . $needs[$key] . "),'not done','failed'))) ,if(" . $key . "='1970-01-01 00:00:00','dont do','done'))) as '" . $alias[$key] . "', ";
    45                 //                        $query0 .= " (if(IsNull(" . $key . "), 'not done' ,if(" . $key . "='1970-01-01 00:00:00','dont do','done'))) as '" . $alias[$key] . "', ";
    46 
    47 //                $query0 .= " count(*) as '# Runs'";
    48 //                $query0 .= ", SUM(fNumEvents) as '" . $alias["SUM(fNumEvents)"] . "' ";
    49 
     44                        $query0 .= " IF( ISNULL(" . $key . "Status.fStartTime) "
     45                            ." AND ISNULL(" . $key . "Status.fStopTime) "
     46                            ." AND ISNULL(" . $key . "Status.fReturnCode), 'not done', "
     47                            ." IF (NOT ISNULL(" . $key . "Status.fStartTime) "
     48                            ." AND DATE_SUB(Now(),INTERVAL " . $timelimits[$key] . " HOUR) > " . $key . "Status.fStartTime "
     49                            ." AND ISNULL(" . $key . "Status.fStopTime) "
     50                            ." AND ISNULL(" . $key . "Status.fReturnCode), 'crashed', "
     51                            ." IF (NOT ISNULL(" . $key . "Status.fStartTime) "
     52                            ." AND DATE_SUB(Now(),INTERVAL " . $timelimits[$key] . " HOUR) < " . $key . "Status.fStartTime "
     53                            ." AND ISNULL(" . $key . "Status.fStopTime) "
     54                            ." AND ISNULL(" . $key . "Status.fReturnCode), 'running', "
     55                            ." IF (NOT ISNULL(" . $key . "Status.fStartTime) "
     56                            ." AND NOT ISNULL(" . $key . "Status.fStopTime) "
     57                            ." AND ISNULL(" . $key . "Status.fReturnCode), 'done', 'bla' "
     58                            ." )))) AS '". $key . "', ";
    5059            }
    51             $query0 .= " COUNT(*) as '# Runs' ";
     60            $query0 .= " COUNT(*) as '# Files' ";
    5261            $query0 .= ", SUM(fNumEvents) as '" . $alias["SUM(fNumEvents)"] . "' ";
    5362        }
    5463        else
    5564        {
    56             $query0 .= " MCCorsikaRunData.fCorsikaRunNumber as 'Run' ";
    57 //                $query0 .= " Concat(RunData.fTelescopeNumber,':', RunData.fRunNumber,':', RunData.fFileNumber) as 'Run' ";
    58 //                $query0 .= " Concat('M', RunData.fTelescopeNumber,':', LPAD(RunData.fRunNumber,8, ' '),'/', LPAD(RunData.fFileNumber, 3, ' ')) as 'Tel:Run/File' ";
     65            $query0 .= " CONCAT(LPAD(" . $fromtable . ".fRunNumber,8, ' '),'.', ";
     66            $query0 .= " RIGHT(LPAD(" . $fromtable . ".fFileNumber, 6, 0), 3)) as 'Run.File' ";
    5967
    6068            if (empty($_GET["fSendTxt"]) && !empty($_GET["fLinks"]))
     
    6573
    6674            foreach ($_GET as $key => $element)
    67                 if ($key!="fLinks" && $_GET[$key]=="On" && $key!="fTest")
    68                     if (empty($checkwhere[$key]) || $checkwhere[$key]==0)
    69                         $query0 .= ", " . $key . " as '" . $alias[$key] . "' ";
    70         }
    71 
    72         $query0 .= " FROM MCCorsikaRunData ";
    73 
    74         $query0 .= " LEFT JOIN MCRunProcessStatus ON MCCorsikaRunData.fCorsikaRunNumber=MCRunProcessStatus.fMCRunNumber ";
     75                if ($_GET[$key]=="On" && $key!="fTest" && $key!="fLinks")
     76                    if (!ereg("^f", $key))
     77                    {
     78
     79                        $query0 .= ", IF (ISNULL(" . $key . "Status.fStartTime) AND ";
     80                        $query0 .= " ISNULL(" . $key . "Status.fStopTime) AND ";
     81                        $query0 .= " ISNULL(" . $key . "Status.fReturnCode), 'not done', ";
     82                        $query0 .= " IF (NOT ISNULL(" . $key . "Status.fReturnCode), ";
     83                        $query0 .= " CONCAT('failed (', " . $key . "Status.fReturnCode, ')'), ";
     84                        $query0 .= " CONCAT('done (', " . $key . "Status.fStopTime, ')'))) ";
     85
     86                        //$query0 .= ", CONCAT( 'halo', " . $key . "Status.fStartTime)";
     87                        $query0 .= " AS '" . $alias[$key] . "' ";
     88                        //echo "ereg: " . $key . "<br>";
     89                    }
     90                    else
     91                        if (empty($checkwhere[$key]) || $checkwhere[$key]==0)
     92                            $query0 .= ", " . $key . " as '" . $alias[$key] . "' ";
     93        }
     94
     95        $query0 .= " FROM " . $fromtable;
     96
     97        $query0 .= " LEFT JOIN CorsikaInfo USING(fRunNumber,fFileNumber) ";
    7598
    7699        foreach ($_GET as $key => $element)
    77100            if (($_GET[$key]=="On" || $groups>0))// && !empty($joins[$key]))
    78101                $query0 .= GetJoin($fromtable,$key);
    79 
    80         /*
    81         if ($_GET["fTest"]!="On")
    82         {
    83             if ($_GET["fSourceName"]!="On")
    84                 $query0 .= " LEFT JOIN Source USING(fSourceKEY) ";
    85             $query0 .= " WHERE fTest='no'";
    86         }
    87         */
    88102
    89103        foreach ($checkwhere as $key => $element)
     
    108122            $query0 .= " AND ";
    109123
    110         $query0 .= StatusQuery("fCorsikaInputCreated", $needs, $timelimits);
    111         $query0 .= StatusQuery("fCorsikaFileAvail", $needs, $timelimits);
     124        $query0 .= StatusQuery("Corsika",      $timelimits);
     125        $query0 .= StatusQuery("Ceres",        $timelimits);
     126        $query0 .= StatusQuery("SequenceFile", $timelimits);
     127        $query0 .= StatusQuery("Callisto",     $timelimits);
     128        $query0 .= StatusQuery("Star",         $timelimits);
    112129
    113130        if ((!empty($_GET["fRunMin"]) || $_GET["fRunMin"]=="0") && !empty($_GET["fRunMax"]))
    114             $query0 .= "MCCorsikaRunData.fCorsikaRunNumber BETWEEN " . $_GET["fRunMin"] . " AND " . $_GET["fRunMax"] . " ";
    115 
    116 //        if ((!empty($_GET["fZDMin"]) || $_GET["fZDMin"]==0) && !empty($_GET["fZDMax"]))
    117 //            $query0 .= "AND fZenithDistance BETWEEN " . $_GET["fZDMin"] . " AND  " . $_GET["fZDMax"] . " ";
    118 
    119 /*
    120         if (!empty($_GET["fDate"]))
    121             $query0 .= " AND fRunStart REGEXP \"^" . $_GET["fDate"] . "\" ";
    122 */
    123 
    124         /*
    125         if (!empty($_GET["fSourceN"]))
    126             $query0 .= " AND fSourceName REGEXP \"^" . $_GET["fSourceN"] . "\" ";
    127 
    128         if (!empty($_GET["fStartDate"]))
    129         {
    130             if (strpos(strrev($query0), " DNA ")!=0)
    131                 $query0 .= " AND ";
    132 
    133             $startdate=substr($_GET["fStartDate"], 0, 10);
    134             if ($startdate=="0000-00-00")
    135                 $query0 .=" fRunStart >= '" . $startdate . " 00:00:00' ";
    136             else
    137                 $query0 .= " fRunStart >= ADDDATE('" . $startdate . " 13:00:00', INTERVAL -1 DAY) ";
    138         }
    139 
    140         if (!empty($_GET["fStopDate"]))
    141         {
    142             if (strpos(strrev($query0), " DNA ")!=0)
    143                 $query0 .= " AND ";
    144 
    145             $stopdate=substr($_GET["fStopDate"], 0, 10);
    146             $query0 .= " fRunStart < '" . $stopdate . " 13:00:00' ";
    147         }
    148 
    149         if (!empty($_GET["fSequenceNo"]) || $_GET["fSequenceNo"]=="0")
    150         {
    151             if (strpos(strrev($query0), " DNA ")!=0)
    152                 $query0 .= " AND ";
    153 
    154             $query0 .= " fSequenceFirst = '" . $_GET["fSequenceNo"] . "' ";
    155         }
    156         */
     131            $query0 .= " " . $fromtable . ".fRunNumber BETWEEN " . $_GET["fRunMin"] . " AND " . $_GET["fRunMax"] . " ";
     132
    157133
    158134        //remove WHERE or AND in the end of the query
     
    175151        if ($statusgroups>0)
    176152        {
    177 //            $query0 .= " GROUP BY ";
    178153            if (strpos($query0, " GROUP BY ")==FALSE)
    179154                $query0 .= " GROUP BY ";
     
    198173        }
    199174        else
    200             $query0 .=" ORDER BY MCCorsikaRunData.fCorsikaRunNumber ASC";
     175            $query0 .=" ORDER BY " . $fromtable . ".fRunNumber ASC";
    201176
    202177        if (empty($_GET["fNumStart"]))
     
    265240    }
    266241
    267     function PrintPage($html, $host, $user, $pw, $db, $alias, $rightalign, $checkwhere, $checkgroup, $checkstatusgroup, $needs, $timelimits)
     242    function PrintPage($html, $host, $user, $pw, $db, $alias, $rightalign, $checkwhere, $checkgroup, $checkstatusgroup, $timelimits)
    268243    {
    269244        $db_id = mysql_connect($host, $user, $pw);
     
    276251        mysql_query("SET BIG_TABLES=1"); // necessary for mySQL <= 4
    277252
    278         $query0 = CreateQuery($_GET, $alias, $checkwhere, $checkgroup, $checkstatusgroup, $needs, $timelimits);
     253        $query0 = CreateQuery($_GET, $alias, $checkwhere, $checkgroup, $checkstatusgroup, $timelimits);
    279254
    280255        $result0 = mysql_query($query0, $db_id);
     
    310285        header("Content-Disposition: attachment; filename=query-result.txt");
    311286
    312         PrintPage("0", $host, $user, $pw, $db, $alias, $rightalign, $checkwhere, $checkgroup, $checkstatusgroup, $needs, $timelimits);
     287        PrintPage("0", $host, $user, $pw, $db, $alias, $rightalign, $checkwhere, $checkgroup, $checkstatusgroup, $timelimits);
    313288    }
    314289    else
    315290    {
    316291        if (empty($_GET["fPrintTable"]))
    317             echo (file_get_contents("index-header.html"));
     292            echo (file_get_contents("index-header-fact.html"));
    318293
    319294        $environment = sizeof($_GET);
     
    328303        {
    329304            if (empty($_GET["fPrintTable"]))
    330                 PrintPage("1", $host, $user, $pw, $db, $alias, $rightalign, $checkwhere, $checkgroup, $checkstatusgroup, $needs, $timelimits);
     305                PrintPage("1", $host, $user, $pw, $db, $alias, $rightalign, $checkwhere, $checkgroup, $checkstatusgroup, $timelimits);
    331306            else
    332                 PrintPage("2", $host, $user, $pw, $db, $alias, $rightalign, $checkwhere, $checkgroup, $checkstatusgroup, $needs, $timelimits);
     307                PrintPage("2", $host, $user, $pw, $db, $alias, $rightalign, $checkwhere, $checkgroup, $checkstatusgroup, $timelimits);
    333308        }
    334309
  • trunk/MagicSoft/Mars/datacenter/db/menu.php

    r9546 r9599  
    1717    CheckBox("fImpactMax",        "Impact");
    1818    CheckBox("fViewConeMax",      "Viewcone");
    19     CheckBox("fNumReUseShower",   "#Shower reuse");
    2019    CheckBox("fStartingAltitude", "Starting alt.");
    21 
    22     printf("  </tr><tr>\n");
    23 
    2420    CheckBox("fMirrorDiameter", "Mirror diam.");
    2521
     
    3531    PrintPullDown($host, $user, $pw, $db, "ParticleType",     "fParticleTypeName",     "fParticleTypeKEY", "Particle type");
    3632    printf("  </td><td>\n");
     33    PrintPullDown($host, $user, $pw, $db, "RunType",     "fRunTypeName",     "fRunTypeKEY", "Run type");
     34    printf("  </td><td>\n");
    3735    PrintPullDown($host, $user, $pw, $db, "AtmosphericModel",     "fAtmosphericModelName",     "fAtmosphericModelKEY", "Atm. model");
    3836    printf("  </td>\n");
     
    4947    printf("  <tr><td>\n");
    5048
    51     PrintStatusMenu("fCorsikaInputCreated",    "Input");
    52     printf("  </td><td>\n");
    53     PrintStatusMenu("fCorsikaFileAvail",    "Corsika");
     49    PrintStatusMenu("Corsika",    "Corsika");
     50    printf("  </td><td>\n");
     51    PrintStatusMenu("Ceres",    "Ceres");
     52    printf("  </td><td>\n");
     53    PrintStatusMenu("SequenceFile",    "SequenceFile");
     54
     55    printf("  </td></tr><tr><td>\n");
     56
     57    PrintStatusMenu("Callisto",    "Callisto");
     58    printf("  </td><td>\n");
     59    PrintStatusMenu("Star",    "Star");
    5460
    5561    printf(" </td></tr></table>\n");
     
    627633{
    628634    if (empty($_GET["fRunMin"]))
    629         $min = GetMin("fCorsikaRunNumber", "MCCorsikaRunData", $host, $user, $pw, $db);
     635        $min = GetMin("fRunNumber", "CorsikaInfo", $host, $user, $pw, $db);
    630636    else
    631637        $min = $_GET["fRunMin"];
    632638
    633639    if (empty($_GET["fRunMax"]))
    634         $max = GetMax("fCorsikaRunNumber", "MCCorsikaRunData", $host, $user, $pw, $db);
     640        $max = GetMax("fRunNumber", "CorsikaInfo", $host, $user, $pw, $db);
    635641    else
    636642        $max = $_GET["fRunMax"];
     
    16251631function InitMCRunStatus($_GET, $first)
    16261632{
    1627     if (empty($_GET["fCorsikaFileAvail"]))
    1628         $_GET["fCorsikaFileAvail"]="On";
    1629 
    1630     if (empty($_GET["fCorsikaFileAvailStatus"]))
    1631         $_GET["fCorsikaFileAvailStatus"]="0";
    1632 
    1633     if (empty($_GET["fCorsikaInputCreated"]))
    1634         $_GET["fCorsikaInputCreated"]="Off";
    1635 
    1636     if (empty($_GET["fCorsikaInputCreatedStatus"]))
    1637         $_GET["fCorsikaInputCreatedStatus"]="0";
     1633
     1634    if (empty($_GET["Corsika"]))
     1635        $_GET["Corsika"]=$first?"On":"";
     1636
     1637    if (empty($_GET["CorsikaStatus"]))
     1638        $_GET["CorsikaStatus"]="0";
     1639
     1640    if (empty($_GET["Ceres"]))
     1641        $_GET["Ceres"]=$first?"On":"";
     1642
     1643    if (empty($_GET["CeresStatus"]))
     1644        $_GET["CeresStatus"]="0";
     1645
     1646    if (empty($_GET["SequenceFile"]))
     1647        $_GET["SequenceFile"]=$first?"Off":"";
     1648
     1649    if (empty($_GET["SequenceFileStatus"]))
     1650        $_GET["SequenceFileStatus"]="0";
     1651
     1652    if (empty($_GET["Callisto"]))
     1653        $_GET["Callisto"]=$first?"Off":"";
     1654
     1655    if (empty($_GET["CallistoStatus"]))
     1656        $_GET["CallistoStatus"]="0";
     1657
     1658    if (empty($_GET["Star"]))
     1659        $_GET["Star"]=$first?"On":"";
     1660
     1661    if (empty($_GET["StarStatus"]))
     1662        $_GET["StarStatus"]="0";
    16381663
    16391664}
     
    16491674
    16501675    if (empty($_GET["fParticleTypeName"]))
    1651         $_GET["fParticleTypeName"]="On";
     1676        $_GET["fParticleTypeName"]=$first?"On":"";
     1677
     1678    if (empty($_GET["fRunTypeName"]))
     1679        $_GET["fRunTypeName"]=$first?"On":"";
    16521680
    16531681    if (empty($_GET["fAtmosphericModelName"]))
     
    16581686
    16591687    if (empty($_GET["fZenithDistanceMin"]))
    1660         $_GET["fZenithDistanceMin"]="On";
     1688        $_GET["fZenithDistanceMin"]=$first?"On":"";
    16611689
    16621690    if (empty($_GET["fZenithDistanceMax"]))
    1663         $_GET["fZenithDistanceMax"]="On";
     1691        $_GET["fZenithDistanceMax"]=$first?"On":"";
    16641692
    16651693    if (empty($_GET["fAzimuthMin"]))
    1666         $_GET["fAzimuthMin"]="On";
     1694        $_GET["fAzimuthMin"]=$first?"On":"";
    16671695
    16681696    if (empty($_GET["fAzimuthMax"]))
    1669         $_GET["fAzimuthMax"]="On";
     1697        $_GET["fAzimuthMax"]=$first?"On":"";
    16701698
    16711699    if (empty($_GET["fEnergyMin"]))
    1672         $_GET["fEnergyMin"]="On";
     1700        $_GET["fEnergyMin"]=$first?"On":"";
    16731701
    16741702    if (empty($_GET["fEnergyMax"]))
    1675         $_GET["fEnergyMax"]="On";
     1703        $_GET["fEnergyMax"]=$first?"On":"";
    16761704
    16771705    if (empty($_GET["fImpactMax"]))
    1678         $_GET["fImpactMax"]="On";
     1706        $_GET["fImpactMax"]=$first?"On":"";
    16791707
    16801708    if (empty($_GET["fViewConeMax"]))
    1681         $_GET["fViewConeMax"]="On";
     1709        $_GET["fViewConeMax"]=$first?"On":"";
    16821710
    16831711    if (empty($_GET["fEnergySlope"]))
    1684         $_GET["fEnergySlope"]="On";
    1685 
    1686     if (empty($_GET["fNumReUseShower"]))
    1687         $_GET["fNumReUseShower"]="Off";
     1712        $_GET["fEnergySlope"]=$first?"On":"";
    16881713
    16891714    if (empty($_GET["fStartingAltitude"]))
    1690         $_GET["fStartingAltitude"]="On";
     1715        $_GET["fStartingAltitude"]=$first?"On":"";
    16911716
    16921717    if (empty($_GET["fMirrorDiameter"]))
    1693         $_GET["fMirrorDiameter"]="On";
     1718        $_GET["fMirrorDiameter"]=$first?"On":"";
    16941719
    16951720}
Note: See TracChangeset for help on using the changeset viewer.