Changeset 8743 for trunk/MagicSoft


Ignore:
Timestamp:
09/06/07 15:12:26 (17 years ago)
Author:
Daniela Dorner
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r8742 r8743  
    1818
    1919                                                 -*-*- END OF LINE -*-*-
     20
     21 2007/09/06 Daniela Dorner
     22
     23   * datacenter/db/resetseq.php:
     24     - added IP addresses
     25     - added project name and start time to list
     26     - added color coding
     27     - improved output
     28     - added mars version to output
     29
     30
     31
    2032 2007/09/06 Stefan Ruegamer
    2133
  • trunk/MagicSoft/Mars/datacenter/db/resetseq.php

    r8737 r8743  
    1111        mysql_select_db($db);
    1212
    13         $query1="SELECT MAX(fStartDate) FROM MarsVersion";
    14         $dateresult=mysql_query($query1);
    15         $row = mysql_fetch_row($dateresult);
    16         $date=$row[0];
     13        $query1="SELECT fMarsVersionName, fStartDate FROM MarsVersion ORDER BY fMarsVersion DESC LIMIT 0,1";
     14        $marsresult=mysql_query($query1);
     15        $row = mysql_fetch_row($marsresult);
     16        $mars=$row[0];
     17        $date=$row[1];
    1718        if (mysql_errno()>0)
    1819            printf("&nbsp; Error-Number: %s <br>", mysql_errno());
     
    2122        if (mysql_info()!="")
    2223            printf("&nbsp; Mysql-Info: %s <br>", mysql_info());
    23         mysql_free_result($dateresult);
    24         if (empty($date))
    25         {
    26             printf("Could not get date of latest Mars version from database.");
     24        mysql_free_result($marsresult);
     25        if (empty($mars))
     26        {
     27            printf("Could not get information for latest Mars version from the database.");
    2728            return;
    2829        }
     
    3031        if (empty($_GET["insert"]))
    3132        {
    32             $query0  = "SELECT fSequenceFirst, ";
    33             $query0 .= "if (fCallisto " . " < '" . $date . "', 'callisto to be resetted', ";
    34             $query0 .= "if (not isnull(fCallisto), 'callisto already processed with new release', ";
    35             $query0 .= "if (fStartTime > ADDDATE(Now(), INTERVAL -1 DAY) AND isnull(fFailedTime), 'callisto running',";
    36             $query0 .= "if (isnull(fFailedTime), 'callisto already resetted for new release', ";
    37             $query0 .= " 'callisto crashed or failed')))) as 'calstat', ";
    38             $query0 .= "if (fStar " . " < '" . $date . "', 'star to be resetted', ";
    39             $query0 .= "if (not isnull(fStar), 'star already processed with new release', ";
    40             $query0 .= "if (fStartTime > ADDDATE(Now(), INTERVAL -1 DAY) AND isnull(fFailedTime), 'star running',";
    41             $query0 .= "if (isnull(fFailedTime), 'star already resetted for new release', ";
    42             $query0 .= " 'star crashed or failed')))) as 'starstat' ";
     33            $query0  = "SELECT SequenceProcessStatus.fSequenceFirst, ";
     34//            $query0 .= "if (fCallisto " . " < '" . $date . "', 'to be resetted', ";
     35            $query0 .= "if (fCallisto " . " < '" . $date . "', CONCAT('outdated (', (SELECT fMarsVersionName FROM MarsVersion WHERE fCallisto > fStartDate ORDER BY fMarsVersion DESC LIMIT 0,1), ')'), ";
     36            $query0 .= "if (not isnull(fCallisto), 'up to date (" . $mars . ")', ";
     37            $query0 .= "if (fStartTime > ADDDATE(Now(), INTERVAL -1 DAY) AND isnull(fFailedTime), 'running (" . $mars . ")',";
     38            $query0 .= "if (isnull(fFailedTime), 'already resetted', ";
     39            $query0 .= " 'crashed or failed')))) as 'calstat', ";
     40//            $query0 .= "if (fStar " . " < '" . $date . "', 'to be resetted', ";
     41            $query0 .= "if (fStar " . " < '" . $date . "', CONCAT('outdated (', (SELECT fMarsVersionName FROM MarsVersion WHERE fStar > fStartDate ORDER BY fMarsVersion DESC LIMIT 0,1), ')'), ";
     42            $query0 .= "if (not isnull(fStar), 'up to date (" . $mars . ")', ";
     43            $query0 .= "if (fStartTime > ADDDATE(Now(), INTERVAL -1 DAY) AND isnull(fFailedTime) AND not isnull(fCallisto), 'running (" . $mars . ")',";
     44            $query0 .= "if (isnull(fFailedTime), 'already resetted', ";
     45            $query0 .= " 'crashed or failed')))) as 'starstat', fProjectName, fRunStart ";
    4346            $query0 .= "FROM SequenceProcessStatus ";
     47            $query0 .= "LEFT JOIN Sequences       ON Sequences.fSequenceFirst=SequenceProcessStatus.fSequenceFirst ";
     48            $query0 .= "LEFT JOIN Project         ON Project.fProjectKEY=Sequences.fProjectKEY ";
    4449        }
    4550        else
     
    6368        if (ereg("^([ ]*[0-9]{5,8}[ ]*[,])*[ ]*[0-9]{5,8}[ ]*$",$_GET["Seqs"]))
    6469        {
    65             if (strpos($query0, " WHERE ")==FALSE)
     70            if (strpos($query0, " WHERE ")==FALSE || (strpos($query0, " CONCAT(")==TRUE && strpos($query0, " WHERE ")==TRUE))
    6671                $query0 .= " WHERE ";
    6772            else
    6873                $query0 .= " AND ";
    69             $query0 .=" fSequenceFirst IN (" . $_GET["Seqs"] . ")";
     74            $query0 .=" SequenceProcessStatus.fSequenceFirst IN (" . $_GET["Seqs"] . ")";
    7075        }
    7176        else
     
    101106                return;
    102107            }
    103             echo "The status of the sequences you entered: <br>\n";
     108//            echo "The status of the sequences you entered: <br>\n";
    104109            $star="";
    105110            $callisto="";
     
    110115            $col   = FALSE;
    111116            $bgcolor='#C0C0C0';
    112             printf("<table border='0'>\n");
    113             printf("<tr bgcolor='%s'>\n<th style='padding-left:1ex;padding-right:1ex'>\n<u>Sequence</u>\n</th>\n<th>\n<u>Status Callisto</u>\n</th>\n<th>\n<u>Status Star</u>\n</th>\n</tr>\n", $bgcolor);
     117            $checked=0;
     118            printf("<table border='0' align='center'>\n");
     119            printf("<tr bgcolor='%s'>\n<th style='padding-left:1ex;padding-right:1ex'>\n<u>Sequence</u>\n</th>\n", $bgcolor);
     120            printf("\n<th>\n<u>ProjectName</u>\n</th>\n");
     121            printf("<th>\n<u>Status Callisto</u>\n</th>");
     122            printf("\n<th>\n<u>Status Star</u>\n</th>\n");
     123            printf("\n<th>\n<u>Starttime</u>\n</th>\n");
     124            printf("</tr>\n");
    114125            while ($row = mysql_fetch_row($result0))
    115126            {
    116                 if ($row[2]=='star to be resetted' && $_GET["step"]=='star')
     127                if (ereg('outdated', $row[2]) && $_GET["step"]=='star')
    117128                {
    118129                    $star[]=$row[0];
    119130                    $starcolor='green';
    120                         $style='bold';
     131                    $style='bold';
     132                    $row[2]=str_replace('outdated', 'marked for reset', $row[2]);
    121133                }
    122                 if ($row[1]=='callisto to be resetted' && $_GET["step"]=='callisto')
     134                if (ereg('outdated', $row[1]) && $_GET["step"]=='callisto')
    123135                {
    124136                    $callisto[]=$row[0];
    125137                    $calcolor='green';
     138                    $starcolor='green';
    126139                    $style='bold';
    127140                }
    128                 if (($row[1]=='callisto crashed or failed' || $row[2]=='star crashed or failed') && $_GET["step"]=='crashed')
     141                if (($row[1]=='crashed or failed' || $row[2]=='crashed or failed') && $_GET["step"]=='crashed')
    129142                {
    130143                    $crashed[]=$row[0];
    131                     if ($row[1]=='callisto crashed or failed')
     144                    if ($row[1]=='crashed or failed')
    132145                    {
    133146                        $calcolor='green';
     
    146159                $col = !$col;
    147160                printf("<tr bgcolor='%s'>\n<td align='center' style='font-weight:%s'>\n%s \n</td>\n", $bgcolor, $style, $row[0]);
     161                printf("<td style='padding-left:1ex;padding-right:1ex'>\n %s \n</td>\n", $row[3]);
    148162                printf("<td style='padding-left:1ex;padding-right:1ex'>\n <font color='%s'>%s </font>\n</td>\n", $calcolor, $row[1]);
    149                 printf("<td style='padding-left:1ex;padding-right:1ex'>\n <font color='%s'>%s </font>\n</td>\n</tr>\n", $starcolor, $row[2]);
     163                printf("<td style='padding-left:1ex;padding-right:1ex'>\n <font color='%s'>%s </font>\n</td>\n", $starcolor, $row[2]);
     164                printf("<td style='padding-left:1ex;padding-right:1ex'>\n %s \n</td>\n", $row[4]);
     165                printf("</tr>\n");
    150166                $calcolor='black';
    151167                $starcolor='black';
    152168                $style='normal';
     169                $checked+=1;
    153170            }
    154171            printf("</table>\n");
     
    157174                printf("<br>\n You chose to reset only the sequences which are crashed or failed.<br>\n");
    158175            else
    159                 printf("<br>\n Only the sequences which have not yet been processed or resetted, will be resetted.<br>\n");
    160             printf("To <b>reset</b> them, please check the insert checkbox and submit again.<br><br>\n");
    161 
     176                printf("<br>\n Only the sequences which are not 'up to date', 'running' or 'resetted', can be resetted.<br>\n");
    162177            if (empty($star) && empty($callisto) && empty($crashed))
    163178                echo "With your choice no sequences would be resetted.";
    164179            else
    165                 echo "With your choice the following sequences would be resetted: ";
     180                echo "With your choice the following sequences would be resetted:\n ";
     181            $marked=0;
    166182            if (!empty($star))
     183            {
    167184                foreach($star as $num => $seq)
    168185                    echo $seq . " ";
     186                $marked+=count($star);
     187            }
    169188            if (!empty($callisto))
     189            {
    170190                foreach($callisto as $num => $seq)
    171191                    echo $seq . " ";
     192                $marked+=count($callisto);
     193            }
    172194            if (!empty($crashed))
     195            {
    173196                foreach($crashed as $num => $seq)
    174197                    echo $seq . " ";
     198                $marked+=count($crashed);
     199            }
     200            printf("<br>\n Listed: %d <br> Marked: %d", $checked, $marked);
     201            printf("<br>\n<br>\nTo <b>reset</b> the <font color='green'>green marked entries</font>, please press the button 'Reset Sequences'.<br><br>\n");
     202
    175203            mysql_free_result($result0);
    176             printf("<br>\n<br>\n<input type='button' value='Reset Sequences' onClick='self.location.href=\"%s&amp;insert=On\"'>&nbsp;&nbsp;&nbsp;\n", htmlspecialchars($_SERVER["REQUEST_URI"]));
     204            printf("<input type='button' value='Reset Sequences' onClick='self.location.href=\"%s&amp;insert=On\"'>&nbsp;&nbsp;&nbsp;\n", htmlspecialchars($_SERVER["REQUEST_URI"]));
     205
    177206        }
    178207        mysql_close($db_id);
     
    192221    echo (file_get_contents("index-header.html"));
    193222
    194     $ips=array("91.64.78.187", "132.187.47.10", "132.187.47.67");
     223    $ips=array("91.64.78.187", "132.187.47.10", "132.187.47.67", "132.187.47.63", "129.217.160.151");
    195224    if (!in_array($_SERVER['REMOTE_ADDR'], $ips))
    196225    {
     
    217246    printf("<input type='radio' name='step' value='star' %s> star<br>", $_GET["step"]=="star" ? "checked" : "");
    218247
    219     printf("<table>\n<tr>\n<td align='left'>\nSequences: \n</td>\n</td>\n</tr>\n<tr>\n<td valign='left'>\n");
    220     printf("<input name='Seqs' type='text' size='75' maxlength='300' value='%s'>\n</td>\n</tr>\n</table>\n<br>\n", $_GET["Seqs"]);
     248    printf("<table>\n<tr>\n<td align='left'>\nSequences: \n</td>\n</tr>\n<tr>\n<td>\n");
     249    printf("<input name='Seqs' type='text' size='80' maxlength='300' value='%s'>\n</td>\n</tr>\n</table>\n<br>\n", $_GET["Seqs"]);
    221250
    222251    ini_set("mysql.trace_mode", "Off");
    223252//    ini_set("display_errors", "Off");
    224253
    225     printf("<input type='submit' value='Reset Sequences in DB'>&nbsp;&nbsp;&nbsp;\n");
    226     printf("<input class='Width' type='button' value='Reset' onClick='self.location.href=\"resetseq.php\"'>&nbsp;&nbsp;&nbsp;\n");
     254    printf("<input type='submit' value='Check Sequence Status'>&nbsp;&nbsp;&nbsp;\n");
     255    printf("<input class='Width' type='button' value='Clear Form' onClick='self.location.href=\"resetseq.php\"'>&nbsp;&nbsp;&nbsp;\n");
    227256//    if (!empty($_GET["step"]) && ereg("^([ ]*[0-9]{5,8}[ ]*[,])*[ ]*[0-9]{5,8}[ ]*$",$_GET["Seqs"]))
    228257//        printf("<input type='checkbox' name='insert' value='On'>insert\n");
Note: See TracChangeset for help on using the changeset viewer.