function theme_upgrade_status_report in Upgrade Status 5
Same name and namespace in other branches
- 6 upgrade_status.report.inc \theme_upgrade_status_report()
- 7 upgrade_status.report.inc \theme_upgrade_status_report()
Theme project status report.
1 theme call to theme_upgrade_status_report()
- _upgrade_status_status in ./
upgrade_status.admin.inc - Menu callback. Generate a page about the upgrade status of projects.
File
- ./
upgrade_status.admin.inc, line 344 - Checks to see if your installed modules are available for the next major release of Drupal.
Code
function theme_upgrade_status_report($data) {
$last = variable_get('upgrade_status_last', 0);
$current_data = update_status_get_available(TRUE);
$output = '<p>' . t("Clicking on any of the modules' boxes will expand the area and show you a link to download the new version of the project, as well as read its release notes.") . '</p>';
$output .= '<div class="upgrade-status checked"><p>' . t('Last checked: ') . ($last ? format_interval(time() - $last) . ' ' . t('ago') : t('Never'));
$output .= ' <span class="check-manually">(' . l(t('Check manually'), 'admin/logs/updates/upgrade/check') . ')</span>';
$output .= "</p></div>\n";
$output .= drupal_get_form('upgrade_status_core_version_form');
if (!is_array($data)) {
$output .= '<p>' . $data . '</p>';
return $output;
}
// Move 'drupal' to the top.
$data = array(
'drupal' => $data['drupal'],
) + $data;
$header = array();
$rows = array();
foreach ($data as $project) {
// Skip upgrade_status. Doesn't make sense to display it.
if ($project['name'] == 'upgrade_status') {
continue;
}
switch ($project['status']) {
case UPGRADE_STATUS_STABLE:
$class = 'ok';
$icon = theme('image', 'misc/watchdog-ok.png', t('ok'), t('ok'));
break;
case UPDATE_STATUS_REVOKED:
case UPGRADE_STATUS_NOT_PORTED:
$class = 'error';
$icon = theme('image', 'misc/watchdog-error.png', t('error'), t('error'));
break;
case UPGRADE_STATUS_DEVELOPMENT:
default:
$class = 'warning';
$icon = theme('image', 'misc/watchdog-warning.png', t('warning'), t('warning'));
break;
}
// Special handling for project moved into core.
if ($project['status'] == UPGRADE_STATUS_CORE) {
$class = 'ok';
if (!empty($project['in_core_note'])) {
$icon = theme('image', 'misc/watchdog-warning.png', t('warning'), t('warning'));
}
else {
$icon = theme('image', 'misc/watchdog-ok.png', t('ok'), t('ok'));
}
}
// Compact layout. 31/05/2008 sun
$row = '<div class="project">';
$row .= '<div class="version-status">';
switch ($project['status']) {
case UPDATE_STATUS_REVOKED:
$row .= '<span class="revoked">' . t('Revoked!') . '</span>';
break;
case UPGRADE_STATUS_NOT_PORTED:
$row .= '<span class="not-supported">' . t('Not ported yet') . '</span>';
break;
case UPGRADE_STATUS_DEVELOPMENT:
$row .= '<span class="not-current">' . t('In development') . '</span>';
break;
case UPGRADE_STATUS_STABLE:
case UPGRADE_STATUS_CORE:
$row .= '<span class="current">' . t('Available') . '</span>';
break;
default:
$row .= check_plain($project['reason']);
break;
}
$row .= '<span class="icon">' . $icon . '</span>';
$row .= "</div>\n";
// Collapse-trigger icon.
$row .= theme('image', 'misc/menu-collapsed.png', '', '', array(
'class' => 'collapse-icon',
));
$row .= '<span class="project-title">';
if (isset($project['title'])) {
if (isset($project['link'])) {
$row .= l($project['title'], $project['link']);
}
else {
$row .= check_plain($project['title']);
}
}
elseif (isset($current_data[$project['name']]) && isset($current_data[$project['name']]['title'])) {
if (isset($current_data[$project['name']]['link'])) {
$row .= l($current_data[$project['name']]['title'], $current_data[$project['name']]['link']);
}
else {
$row .= check_plain($current_data[$project_name]['title']);
}
}
else {
$row .= check_plain($project['name']);
}
$row .= '</span>';
$row .= '<span class="existing-version">';
$row .= ' ' . check_plain($project['existing_version']);
if ($project['type'] == 'dev' && !empty($project['datestamp'])) {
$row .= ' <span class="version-date">(' . format_date($project['datestamp'], 'custom', 'Y-M-d') . ')</span>';
}
$row .= '</span>';
// Compact layout. 31/05/2008 sun
$row .= "<div class=\"details-wrapper\">\n";
if ($project['status'] == UPGRADE_STATUS_CORE) {
$row .= "<div class=\"core-notice\">\n";
$row .= '<p>' . t('In Drupal core since @version', array(
'@version' => $project['in_core_since'],
)) . '</p>';
$row .= '<p>' . $project['in_core_note'] . '</p>';
$row .= '</div>';
}
$row .= "<div class=\"versions\">\n";
if (isset($project['recommended'])) {
if ($project['status'] != UPDATE_STATUS_CURRENT || $project['existing_version'] != $project['recommended']) {
// First, figure out what to recommend.
// If there's only 1 security update and it has the same version we're
// recommending, give it the same CSS class as if it was recommended,
// but don't print out a separate "Recommended" line for this project.
if (!empty($project['security updates']) && count($project['security updates']) == 1 && $project['security updates'][0]['version'] == $project['recommended']) {
$security_class = ' version-recommended version-recommended-strong';
}
else {
$security_class = '';
$version_class = 'version-recommended';
// Apply an extra class if we're displaying both a recommended
// version and anything else for an extra visual hint.
if ($project['recommended'] != $project['latest_version'] || !empty($project['also']) || $project['type'] == 'dev' && isset($project['dev_version']) && $project['latest_version'] != $project['dev_version'] && $project['recommended'] != $project['dev_version'] || isset($project['security updates'][0]) && $project['recommended'] != $project['security updates'][0]) {
$version_class .= ' version-recommended-strong';
}
$row .= theme('upgrade_status_version', $project['releases'][$project['recommended']], t('Recommended version:'), $version_class);
}
// Now, print any security updates.
if (!empty($project['security updates'])) {
foreach ($project['security updates'] as $security_update) {
$row .= theme('upgrade_status_version', $security_update, t('Security update:'), 'version-security' . $security_class);
}
}
}
if ($project['recommended'] != $project['latest_version']) {
$row .= theme('upgrade_status_version', $project['releases'][$project['latest_version']], t('Latest version:'), 'version-latest');
}
if ($project['type'] == 'dev' && $project['status'] != UPDATE_STATUS_CURRENT && isset($project['dev_version']) && $project['recommended'] != $project['dev_version']) {
$row .= theme('upgrade_status_version', $project['releases'][$project['dev_version']], t('Development version:'), 'version-latest');
}
}
if (isset($project['also'])) {
foreach ($project['also'] as $also) {
$row .= theme('upgrade_status_version', $project['releases'][$also], t('Also available:'), 'version-also-available');
}
}
$row .= "</div>\n";
// versions div.
$row .= "<div class=\"info\">\n";
if (!empty($project['notes'])) {
$row .= '<div class="notes">';
$row .= t('Administrator note: %notes', array(
'%notes' => $project['notes'],
));
$row .= "</div>\n";
}
$row .= '<div class="modules">';
$row .= t('Includes: %modules', array(
'%modules' => implode(', ', $project['modules']),
));
$row .= "</div>\n";
$row .= "</div>\n";
// info div.
$row .= "</div>\n";
// wrapper div.
$row .= "</div>\n";
// project div.
$rows[] = array(
'class' => $class,
'data' => array(
$row,
),
);
}
$output .= theme('table', $header, $rows, array(
'class' => 'upgrade-status',
));
drupal_add_css(drupal_get_path('module', 'upgrade_status') . '/upgrade_status.css');
drupal_add_js(drupal_get_path('module', 'upgrade_status') . '/upgrade_status.js');
return $output;
}