$status = "Failed"; $ClientSite = new ClientSite(); $ClientSite->Id = $ClientJob->GetSite(); $status .= " (" . $ClientSite->GetName() . ")"; $lastrun = $ClientJob->GetEndDate(); break; case CDASH_JOB_ABORTED: $status = "Aborted"; $lastrun = $ClientJob->GetEndDate(); break; } } $xml .= "<jobschedule>"; $xml .= add_XML_value("id", $scheduleid); $xml .= add_XML_value("projectid", $Project->Id); $xml .= add_XML_value("projectname", $Project->GetName()); $xml .= add_XML_value("status", $status); $xml .= add_XML_value("lastrun", $lastrun); $xml .= add_XML_value("description", $ClientJobSchedule->GetDescription()); $xml .= "</jobschedule>"; } } // end if $CDASH_MANAGE_CLIENTS // Go through the public projects $project = pdo_query("SELECT name,id FROM project WHERE id\n NOT IN (SELECT projectid as id FROM user2project\n WHERE userid='{$userid}') AND public='1' ORDER BY name"); $j = 0; if ($CDASH_USE_LOCAL_DIRECTORY == '1') { if (file_exists('local/user.php')) { include_once 'local/user.php'; } }
$response['projectid'] = $projectid; $Project = new Project(); $Project->Id = $projectid; $role = $Project->GetUserRole($userid); if ($User->IsAdmin() === FALSE && $role <= 1) { $response['error'] = "You don't have the permissions to access this page."; echo json_encode($response); return; } $response['threshold'] = $Project->GetCoverageThreshold(); $SubProject = new SubProject(); $SubProject->SetProjectId($projectid); if ($projectid >= 0) { $project = array(); $project['id'] = $Project->Id; $project['name_encoded'] = urlencode($Project->GetName()); $response['project'] = $project; if ($projectid > 0) { $project['name'] = $Project->GetName(); $subprojectids = $Project->GetSubProjects(); $subprojs = array(); // subproject models $subprojects_response = array(); // JSON for subprojects $subproject_groups = array(); // JSON for subproject groups // Initialize our list of subprojects so dependencies can be resolved. // TODO: probably don't need this anymore? foreach ($subprojectids as $subprojectid) { $SubProject = new SubProject(); $SubProject->SetId($subprojectid);
$xml .= add_XML_value('id', $project_array['id']); $xml .= add_XML_value('name', $project_array['name']); if ($project_array['id'] == $projectid) { $xml .= add_XML_value('selected', '1'); } $xml .= '</availableproject>'; } $Banner = new Banner(); $Banner->SetProjectId($projectid); // If submit has been pressed @($updateMessage = $_POST['updateMessage']); if (isset($updateMessage)) { $Banner->SetText(htmlspecialchars(pdo_real_escape_string($_POST['message']))); } /* We start generating the XML here */ // List the available project if ($projectid >= 0) { $xml .= '<project>'; $xml .= add_XML_value('id', $Project->Id); $xml .= add_XML_value('text', $Banner->GetText()); if ($projectid > 0) { $xml .= add_XML_value('name', $Project->GetName()); $xml .= add_XML_value('name_encoded', urlencode($Project->GetName())); } $xml .= add_XML_value('id', $Project->Id); $xml .= '</project>'; } $xml .= '</cdash>'; // Now doing the xslt transition generate_XSLT($xml, 'manageBanner'); }
$User = new User(); $User->Id = $userid; $role = $Project->GetUserRole($userid); // If we are editing a project make sure we have the right to do so if (!is_null($projectid) && !(isset($_SESSION['cdash']['user_can_create_project']) && $_SESSION['cdash']['user_can_create_project'] == 1) && !$User->IsAdmin()) { $response['error'] = 'You do not have permission to access this page.'; echo json_encode($response); return; } elseif (!is_null($projectid) && (!$User->IsAdmin() && $role <= 1)) { $response['error'] = 'You do not have permission to access this page.'; echo json_encode($response); return; } $response = begin_JSON_response(); if ($projectid > 0) { get_dashboard_JSON($Project->GetName(), null, $response); } $response['hidenav'] = 1; $menu = array(); $menu['back'] = 'user.php'; $response['menu'] = $menu; $response['manageclient'] = $CDASH_MANAGE_CLIENTS; $nRepositories = 0; $repositories_response = array(); if ($edit || !is_null($projectid)) { $response['title'] = 'CDash - Edit Project'; $response['edit'] = 1; } else { $response['title'] = 'CDash - New Project'; $response['edit'] = 0; $response['noproject'] = 1;
} } $rules[] = $rule; } if (!empty($rules)) { $dynamic_response['rules'] = $rules; } $dynamics_response[] = $dynamic_response; } } $response['buildgroups'] = $buildgroups_response; $response['dynamics'] = $dynamics_response; // Store some additional details about this project. $project_response = array(); $project_response['id'] = $projectid; $project_name = $Project->GetName(); $project_response['name'] = $project_name; $project_response['name_encoded'] = urlencode($project_name); $response['project'] = $project_response; // Generate response for any wildcard groups. $wildcards = pdo_query("\n SELECT bg.name, bg.id, b2gr.buildtype, b2gr.buildname\n FROM build2grouprule AS b2gr, buildgroup AS bg\n WHERE b2gr.buildname LIKE '\\%%\\%' AND b2gr.groupid = bg.id AND\n bg.type = 'Daily' AND bg.projectid='{$projectid}'"); $err = pdo_error(); if (!empty($err)) { $response['error'] = $err; } $wildcards_response = array(); while ($wildcard_array = pdo_fetch_array($wildcards)) { $wildcard_response = array(); $wildcard_response['buildgroupname'] = $wildcard_array['name']; $wildcard_response['buildgroupid'] = $wildcard_array['id']; $wildcard_response['buildtype'] = $wildcard_array['buildtype'];
} $xml .= "</availableproject>"; } $Banner = new Banner(); $Banner->SetProjectId($projectid); // If submit has been pressed @($updateMessage = $_POST["updateMessage"]); if (isset($updateMessage)) { $Banner->SetText(htmlspecialchars(pdo_real_escape_string($_POST["message"]))); } /** We start generating the XML here */ // List the available project if ($projectid >= 0) { $xml .= "<project>"; $xml .= add_XML_value("id", $Project->Id); $xml .= add_XML_value("text", $Banner->GetText()); if ($projectid > 0) { $xml .= add_XML_value("name", $Project->GetName()); $xml .= add_XML_value("name_encoded", urlencode($Project->GetName())); } $xml .= add_XML_value("id", $Project->Id); $xml .= "</project>"; } $xml .= "</cdash>"; // Now doing the xslt transition generate_XSLT($xml, "manageBanner"); } // end session OK ?>
$status = 'Failed'; $ClientSite = new ClientSite(); $ClientSite->Id = $ClientJob->GetSite(); $status .= ' (' . $ClientSite->GetName() . ')'; $lastrun = $ClientJob->GetEndDate(); break; case CDASH_JOB_ABORTED: $status = 'Aborted'; $lastrun = $ClientJob->GetEndDate(); break; } } $xml .= '<jobschedule>'; $xml .= add_XML_value('id', $scheduleid); $xml .= add_XML_value('projectid', $Project->Id); $xml .= add_XML_value('projectname', $Project->GetName()); $xml .= add_XML_value('status', $status); $xml .= add_XML_value('lastrun', $lastrun); $xml .= add_XML_value('description', $ClientJobSchedule->GetDescription()); $xml .= '</jobschedule>'; } } // Go through the public projects $project = pdo_query("SELECT name,id FROM project WHERE id\n NOT IN (SELECT projectid as id FROM user2project\n WHERE userid='{$userid}') AND public='1' ORDER BY name"); $j = 0; if ($CDASH_USE_LOCAL_DIRECTORY == '1') { if (file_exists('local/user.php')) { include_once 'local/user.php'; } } while ($project_array = pdo_fetch_array($project)) {
foreach ($fileids as $fileid) { $coveragefile = new CoverageFile(); $CoverageFile2User->FileId = $fileid; $coveragefile->Id = $CoverageFile2User->GetCoverageFileId($buildid); $metric = $coveragefile->GetMetric(); if ($metric < $coverageThreshold / 100.0) { $file['percent'] = $coveragefile->GetLastPercentCoverage(); $file['path'] = $coveragefile->GetPath(); $file['id'] = $fileid; $files[] = $file; } } // Send an email if the number of uncovered file is greater than one if (count($files) > 0) { // Writing the message $messagePlainText = "The following files for the project " . $Project->GetName(); $messagePlainText .= " have a low coverage and "; $messagePlainText .= "you have been identified as one of the authors of these files.\n"; foreach ($files as $file) { $messagePlainText .= $file['path'] . " (" . round($file['percent'], 2) . "%)\n"; } $messagePlainText .= "Details on the submission can be found at "; $messagePlainText .= get_server_URI(); $messagePlainText .= "\n\n"; $serverName = $CDASH_SERVER_NAME; if (strlen($serverName) == 0) { $serverName = $_SERVER['SERVER_NAME']; } $messagePlainText .= "\n-CDash on " . $serverName . "\n"; // Send the email $title = "CDash [" . $Project->GetName() . "] - Low Coverage";
foreach ($fileids as $fileid) { $coveragefile = new CoverageFile(); $CoverageFile2User->FileId = $fileid; $coveragefile->Id = $CoverageFile2User->GetCoverageFileId($buildid); $metric = $coveragefile->GetMetric(); if ($metric < $coverageThreshold / 100.0) { $file['percent'] = $coveragefile->GetLastPercentCoverage(); $file['path'] = $coveragefile->GetPath(); $file['id'] = $fileid; $files[] = $file; } } // Send an email if the number of uncovered file is greater than one if (count($files) > 0) { // Writing the message $messagePlainText = 'The following files for the project ' . $Project->GetName(); $messagePlainText .= ' have a low coverage and '; $messagePlainText .= "you have been identified as one of the authors of these files.\n"; foreach ($files as $file) { $messagePlainText .= $file['path'] . ' (' . round($file['percent'], 2) . "%)\n"; } $messagePlainText .= 'Details on the submission can be found at '; $messagePlainText .= get_server_URI(); $messagePlainText .= "\n\n"; $serverName = $CDASH_SERVER_NAME; if (strlen($serverName) == 0) { $serverName = $_SERVER['SERVER_NAME']; } $messagePlainText .= "\n-CDash on " . $serverName . "\n"; // Send the email $title = 'CDash [' . $Project->GetName() . '] - Low Coverage';