Beispiel #1
0
function get_updates_xml_from_commits($projectname, $projectid, $dates, $commits)
{
    $xml = "<updates>\n";
    $xml .= "<timestamp>" . date(FMT_DATETIMETZ, $dates['nightly-0']) . "</timestamp>";
    // Get revision numbers for the current day and "the last time it ran before that..."
    // Only works if the LIMIT 2 query below returns exactly 2 records and the date from
    // the most recent record matches the current 'nightly-0' date... If those criteria
    // are not met, the revision strings will be empty and no revision information will
    // be displayed on the resulting web page.
    //
    $revision_current = '';
    $revision_prior = '';
    $qry = "SELECT date, revision FROM dailyupdate " . "WHERE projectid='{$projectid}' " . "  AND date <= '" . gmdate(FMT_DATE, $dates['nightly-0']) . "' " . "ORDER BY date DESC LIMIT 2";
    $rows = pdo_all_rows_query($qry);
    if (count($rows) == 2) {
        if ($rows[0]['date'] == gmdate(FMT_DATE, $dates['nightly-0'])) {
            $revision_current = $rows[0]['revision'];
            $revision_prior = $rows[1]['revision'];
        }
    }
    $xml .= add_XML_value("revision", $revision_current);
    $xml .= add_XML_value("priorrevision", $revision_prior);
    $xml .= add_XML_value("revisionurl", get_revision_url($projectid, $revision_current, $revision_prior));
    $xml .= add_XML_value("revisiondiff", get_revision_url($projectid, $revision_prior, ''));
    // no prior prior revision...
    $xml .= "<javascript>\n";
    // Args to dbAdd : "true" means directory, "false" means file
    //
    $xml .= "dbAdd(true, \"Updated files  (" . count($commits) . ")\", \"\", 0, \"\", \"1\", \"\", \"\", \"\", \"\", \"\")\n";
    $previousdir = "";
    usort($commits, "sort_by_directory_file_time");
    $projecturl = get_project_property($projectname, "cvsurl");
    foreach ($commits as $commit) {
        $directory = $commit['directory'];
        if ($directory != $previousdir) {
            $xml .= "dbAdd(true, \"" . $directory . "\", \"\", 1, \"\", \"1\", \"\", \"\", \"\", \"\", \"\")\n";
            $previousdir = $directory;
        }
        $filename = $commit['filename'];
        $revision = '';
        if ($commit['priorrevision'] != "-1") {
            $revision = $commit['revision'];
        }
        $time = gmdate(FMT_DATETIME, strtotime($commit['time']));
        $author = $commit['author'];
        // Only display email if the user is logged in
        if (isset($_SESSION['cdash'])) {
            if (isset($commit['email'])) {
                $email = $commit['email'];
            } else {
                $email = get_author_email($projectname, $author);
            }
        } else {
            // If the author is an email (git for instance) we remove everything after the @
            $posat = strpos($author, '@');
            if ($posat !== false) {
                $author = substr($author, 0, $posat);
            }
            $email = "";
        }
        $comment = $commit['comment'];
        $comment = str_replace("\n", " ", $comment);
        // Do this twice so that <something> ends up as
        // &amp;lt;something&amp;gt; because it gets sent to a
        // java script function not just displayed as html
        $comment = XMLStrFormat($comment);
        $comment = XMLStrFormat($comment);
        $diff_url = get_diff_url(get_project_id($projectname), $projecturl, $directory, $filename, $revision);
        $diff_url = XMLStrFormat($diff_url);
        $xml .= "dbAdd(false, \"" . $filename . "  Revision: " . $revision . "\",\"" . $diff_url . "\",2,\"\",\"1\",\"" . $author . "\",\"" . $email . "\",\"" . $comment . "\",\"" . $commit['bugurl'] . "\",\"" . $commit['bugid'] . "\",\"" . $commit['bugpos'] . "\")\n";
    }
    $xml .= "</javascript>\n";
    $xml .= "</updates>";
    return $xml;
}
Beispiel #2
0
 $xml .= "<backurl>user.php</backurl>";
 $xml .= "<title>CDash - " . $projectname . " Measurements</title>";
 $xml .= "<menutitle>" . $projectname . "</menutitle>";
 $xml .= "<menusubtitle>Measurements</menusubtitle>";
 if ($projectid > 0) {
     $Project = new Project();
     $Project->Id = $projectid;
     $xml .= "<project>";
     $xml .= add_XML_value("id", $projectid);
     $xml .= add_XML_value("name", $Project->GetName());
     $xml .= add_XML_value("name_encoded", urlencode($Project->GetName()));
     $xml .= "</project>";
 }
 // Menu
 $xml .= "<menu>";
 $nightlytime = get_project_property($projectname, "nightlytime");
 $xml .= add_XML_value("back", "index.php?project=" . urlencode($projectname) . "&date=" . get_dashboard_date_from_build_starttime($build_array["starttime"], $nightlytime));
 $xml .= add_XML_value("noprevious", "1");
 $xml .= add_XML_value("nonext", "1");
 $xml .= "</menu>";
 $xml .= "<user>";
 $userid = $_SESSION['cdash']['loginid'];
 $user = pdo_query("SELECT admin FROM " . qid("user") . " WHERE id='{$userid}'");
 $user_array = pdo_fetch_array($user);
 $xml .= add_XML_value("id", $userid);
 $xml .= add_XML_value("admin", $user_array["admin"]);
 $xml .= "</user>";
 //get any measurements associated with this test
 $xml .= "<measurements>";
 $query = "SELECT id,name,testpage,summarypage FROM measurement WHERE projectid='{$projectid}' ORDER BY name ASC";
 $result = pdo_query($query);
Beispiel #3
0
{
    global $FormatTextForIphone;
    if (!isset($FormatTextForIphone)) {
        return $text;
    }
    $text = str_replace("\n", '<br/>', $text);
    return $text;
}
$response = begin_JSON_response();
$projectname = get_project_name($projectid);
$response['title'] = "CDash : {$projectname}";
$previous_buildid = $build->GetPreviousBuildId();
$current_buildid = $build->GetCurrentBuildId();
$next_buildid = $build->GetNextBuildId();
$menu = array();
$nightlytime = get_project_property($projectname, 'nightlytime');
$menu['back'] = 'index.php?project=' . urlencode($projectname) . '&date=' . get_dashboard_date_from_build_starttime($build->StartTime, $nightlytime);
if ($previous_buildid > 0) {
    $menu['previous'] = "buildSummary.php?buildid={$previous_buildid}";
    // Find the last submit date.
    $previous_build = new Build();
    $previous_build->Id = $previous_buildid;
    $previous_build->FillFromId($previous_build->Id);
    $lastsubmitdate = date(FMT_DATETIMETZ, strtotime($previous_build->StartTime . ' UTC'));
} else {
    $menu['noprevious'] = '1';
    $lastsubmitdate = 0;
}
$menu['current'] = "buildSummary.php?buildid={$current_buildid}";
if ($next_buildid > 0) {
    $menu['next'] = "buildSummary.php?buildid={$next_buildid}";