?> <p>Click on the request id to view all details</p><BR> <TABLE BORDER id = "requestTable"> <TR><TH>REQUEST ID</TH><TH>SCHEDULE</TH><TH>COMMENT</TH><TH>Change Control</TH><TH>DATE ENTERED</TH><TH>DATE APPROVED</TR> <? foreach ($totalRequests as $indRequest) { $indRequest = str_replace("___", "\M", $indRequest); $indRequestArray = explode ("\M", $indRequest); $requestId = $indRequestArray[0]; $priority = $indRequestArray[1]; $comments = $indRequestArray[2]; $changeControl = $indRequestArray[4]; $dateEntered = $indRequestArray[5]; $dateModified = $indRequestArray[6]; $detailForRequest = get_details_for_request_id ($requestId); $hostTotal = array(); $groupTotal = array(); foreach ($detailForRequest as $indRequest) { $indRequest = str_replace("___", "\M", $indRequest); $indRequestArray = explode ("\M", $indRequest); if ($indRequestArray[11] != "") { array_push ($hostTotal, $indRequestArray[11] . " " . $indRequestArray[12]); } if ($indRequestArray[13] != "") { array_push ($groupTotal, $indRequestArray[13]); } }
function show_request_detail($requestId, $showAffectedHosts) { $detailForRequest = get_details_for_request_id ($requestId); if (count($detailForRequest)) { $detailForRequestTmp = $detailForRequest[0]; $detailForRequestTmp = str_replace("___", "\M" , $detailForRequestTmp); $detailForRequestTmpArray = explode ("\M", $detailForRequestTmp); $userName = $detailForRequestTmpArray[1]; $firstname= $detailForRequestTmpArray[2]; $lastname = $detailForRequestTmpArray[3]; $comment = $detailForRequestTmpArray[4]; $priority = $detailForRequestTmpArray[5]; $changeControl = $detailForRequestTmpArray[14]; ?> <table class="menu"> <tr > <td class="menu"><b>RequestID</b></td> <td class="menu"><?php print $requestId; ?> </td> </tr> <tr> <td class="menu"><b>Requestor:</b></td> <td class="menu"><?php print "$firstname $lastname ($userName)"; ?></td> </tr> <!-- <tr> <td class="menu"><b>Priority:</b></td> <td class="menu"><?php print $priority; ?></td> </tr> --> <tr> <td class="menu"><b>Change control:</b></td> <td class="menu"><?php print $changeControl; ?></td> </tr> </table> <br/> <fieldset style="margin-top:2em;"> <legend>Description:</legend> <p><?php print $comment; ?></p> </fieldset> <br/> <br/> <? // We need to loop to get the hosts, groups, variable, value $hostTotal = array(); $groupTotal = array(); $variablevalue = array(); foreach ($detailForRequest as $indRequest) { $indRequest = str_replace("___", "\M", $indRequest); $indRequestArray = explode ("\M", $indRequest); array_push ($variablevalue, $indRequestArray[6] . "___" . $indRequestArray[7]. "___" . $indRequestArray[8]); if ($indRequestArray[11] != "") { $applyStatus = $indRequestArray[15]; if ($applyStatus == "1") { $applyStatus = "SUCCESS"; } elseif ($applyStatus == "2") { $applyStatus = "FAILED"; } elseif ($applyStatus == "3") { $applyStatus = "RETRYING"; } else { $applyStatus = "SCHEDULED"; } array_push ($hostTotal, $indRequestArray[11] . " " . $indRequestArray[12] . " " . $applyStatus . " " . $indRequestArray[16]); } if ($indRequestArray[13] != "") { array_push ($groupTotal, $indRequestArray[13]); } } sort ($hostTotal); $hostTotal = array_unique ($hostTotal); sort ($groupTotal); $groupTotal = array_unique ($groupTotal); sort ($variablevalue); $variablevalue = array_unique ($variablevalue); if(count($variablevalue)) { ?> <fieldset><legend>Rule changes</legend> <table class="pconfig"> <tr> <th>Variable</th> <th>Operation</th> <th>Value</th> </tr> <? foreach($variablevalue as $indVariable) { // We need to translate the rule $indVariable = str_replace ("___", "\M", $indVariable); $indVariableArray = explode ("\M", $indVariable); $indConfigVariable = $indVariableArray[0]; $indConfigOperation = $indVariableArray[1]; $indConfigValue = $indVariableArray[2]; if (strpos ($indConfigVariable, "/EVENTSPRING/PARAM_SETTINGS/THRESHOLDS")) { $value = str_replace(",", " ", $indConfigValue); $valueArray = explode (" ", $value); // We need to get the scan for 1 parameter $scan = "UNDEFINED"; $stringToTranslate = "1___2___3___4___$valueArray[1]___$valueArray[2]___$valueArray[3]___$valueArray[4]___$valueArray[5]___$valueArray[6]___$valueArray[7]___$valueArray[8]___$valueArray[9]___$valueArray[10]___$valueArray[11]___$valueArray[12]___$valueArray[13]___$valueArray[14]___$valueArray[15]___$valueArray[16]___$valueArray[17]___$valueArray[18]___$valueArray[18]___$valueArray[19]___A___$scan" . "___$valueArray[0]"; $value = translate_threshold_to_english($stringToTranslate); $indConfigValue = $indConfigValue . "<BR> Interpretation: <br>" . $value; } ?> <tr> <td><?php print $indConfigVariable;?></td> <td><?php print $indConfigOperation;?></td> <td><?php print $indConfigValue; ?></td> </tr> <?php } ?> </table> </fieldset> <br/> <br/> <? } if(count($groupTotal)) { ?> <fieldset><legend>Affected server groups</legend> <? $groupTotalString = "<ul><li>".implode ("</li><li>", $groupTotal)."</li></ul>"; echo "$groupTotalString <BR>"; ?> </fieldset> <br/> <br/> <? } if(count($hostTotal)) { ?> <fieldset><legend>Affected servers</legend> <? $hostTotalString = "<ul><li>".implode ("</li><li>", $hostTotal)."</li></ul>"; if ($showAffectedHosts) { ?> <input class="submit-button" name = "getHosts" type="button" onClick="submit();" value="Hide affected servers"> <?php print $hostTotalString; ?> <BR/> <input type = "hidden" name = "showAffectedHosts" value = 0> <?php } else { ?> <input class="submit-button" name = "getHosts" type="button" onClick="submit();" value="show affected servers"> <input type = "hidden" name = "showAffectedHosts" value = 1> <?php } ?> </fieldset> <? } ?> <br> <br> <? // We need to get scheduling details about this requestID $query = " SELECT username, firstname, lastname, comment, retries, scheduled_changes.date_entered, start_time, end_time FROM scheduled_changes, people WHERE requestid = '$requestId' AND scheduled_changes.schedulerId = people.id"; $result = run_query($query); if (count($result)) { $result = $result[0]; $result = str_replace("___", "\M", $result); $resultArray = explode("\M", $result); ?> <fieldset><legend>Scheduling</legend> <table class="menu"> <tr > <td class="menu"><b>SchedulerID:</b></td> <td class="menu"><?php print $resultArray[0]; ?> </td> </tr> <tr> <td class="menu"> <b>Requestor:</b> </td> <td class="menu"><?php print "$resultArray[1] $resultArray[2] ($resultArray[0])"; ?> </td> </tr> <tr> <td class="menu"> <b>Scheduler Comments:</b> </td> <td class="menu"><?php print $resultArray[3]; ?> </td> </tr> <tr> <td class="menu"> <b>Scheduled at:</b> </td> <td class="menu"><?php print $resultArray[5]; ?> </td> </tr> <tr> <td class="menu"> <b>Deployment scheduled at:</b> </td> <td class="menu"><?php print $resultArray[6]; ?> </td> </tr> <tr> <td class="menu"> <b>Deployment end at:</b> </td> <td class="menu"><?php print $resultArray[7]; ?> </td> </tr> <tr> <td class="menu"><b>Number of retries:</b> </td> <td class="menu"><?php print $resultArray[4]; ?></td> </tr> </table> </fieldset> <? } } else { ?> No details found <BR/> <?php } }