";
$title = isset($project->title) ? $project->title : $project->name;
$row .= check_plain($title);
- $row .= ' ' . check_plain($project->version);
+ $row .= ' ' . check_plain(isset($project->info['version']) ? $project->info['version'] : $project->version);
if ($server = l10n_update_server($project->l10n_server)) {
$row .= ' ' . l($server['name'], $server['link']);
}
@@ -277,21 +281,30 @@ function theme_l10n_update_project_status($projects, $languages, $history, $avai
$row .= "
\n";
$versions = array();
foreach ($languages as $lang => $language) {
- $current = isset($history[$name][$lang]) ? $history[$name][$lang] : NULL;
+ $installed = isset($history[$name][$lang]) ? $history[$name][$lang] : NULL;
$update = isset($updates[$name][$lang]) ? $updates[$name][$lang] : NULL;
- if ($update) {
- $status = 'update';
- $class = 'warning';
- }
- elseif ($current) {
- $status = $class = 'ok';
+ $available = isset($available[$name]->$lang) ? $available[$name]->$lang : NULL;
+ if ($installed) {
+ if ($update) {
+ $status = 'updatable';
+ $class = 'messages warning';
+ }
+ else {
+ $status = 'uptodate';
+ $class = 'ok';
+ }
}
+ elseif ($available) {
+ $status = 'available';
+ $class = 'warning';
+ }
else {
- $status = $class ='unknown';
+ $status = 'unknown';
+ $class = 'unknown';
}
$version = array(
array('data' => $language, 'class' => 'version-title'),
- $current ? theme('l10n_update_release', $current) : '',
+ $installed ? theme('l10n_update_release', $installed) : '',
$update ? theme('l10n_update_release', $update) : '',
theme('l10n_update_version_status', $status, $update ? $update->type : NULL),
);
@@ -335,7 +348,7 @@ function theme_l10n_update_release($release) {
* Format version status with icon.
*
* @param string $status
- * Version status: 'ok', 'update', 'unknown'.
+ * Version status: 'uptodate', 'updatable', 'available', 'unknown'.
* @param string $type
* Update type: 'download', 'localfile'.
*
@@ -345,15 +358,20 @@ function theme_l10n_update_release($release) {
function theme_l10n_update_version_status($status, $type = NULL) {
$output = '
';
switch ($status) {
- case 'ok':
+ case 'uptodate':
$icon = theme('image', 'misc/watchdog-ok.png', t('ok'), t('ok'));
$msg = ''. t('Up to date') .'';
break;
- case 'update':
+ case 'updatable':
$icon = theme('image', 'misc/watchdog-warning.png', t('warning'), t('warning'));
$txt = ($type == 'download') ? t('Remote update available') : t('Local update available');
$msg = ''. $txt .'';
break;
+ case 'available':
+ $icon = theme('image', 'misc/watchdog-warning.png', t('warning'), t('warning'));
+ $txt = t('Uninstalled translation available');
+ $msg = ''. $txt .'';
+ break;
case 'unknown':
$icon = theme('image', 'misc/watchdog-warning.png', t('warning'), t('warning'));
$msg = ''. t('No information') .'';
diff --git a/l10n_update.project.inc b/l10n_update.project.inc
index b1119b6..03bdde3 100644
--- a/l10n_update.project.inc
+++ b/l10n_update.project.inc
@@ -36,7 +36,34 @@ function l10n_update_build_projects() {
// Mark all previous projects as disabled and store new project data
db_query("UPDATE {l10n_update_project} SET status = 0");
$default_server = l10n_update_default_server();
+
+ if (module_exists('update')) {
+ $projects_info = update_get_available(TRUE);
+ }
foreach ($projects as $name => $data) {
+ if (isset($projects_info[$name])) {
+ // Find out if a dev version is installed.
+ if (preg_match("/^[0-9]+\.x-([0-9]+)\..*-dev$/", $data['info']['version'], $matches)) {
+ foreach ($projects_info[$name]['releases'] as $project_release) {
+ if ($project_release['version_major'] == $matches[1] &&
+ (!isset($project_release['version_extra']) || $project_release['version_extra'] != 'dev')) {
+ $release = $project_release;
+ break;
+ }
+ }
+ }
+ elseif ($name == "drupal" || preg_match("/HEAD/", $data['info']['version'], $matches)) {
+ // Pick latest available release.
+ $release = array_shift($projects_info[$name]['releases']);
+ }
+
+ if (!empty($release['version'])) {
+ $data['info']['version'] = $release['version'];
+ }
+
+ unset($release);
+ }
+
$data += array(
'version' => isset($data['info']['version']) ? $data['info']['version'] : '',
'core' => isset($data['info']['core']) ? $data['info']['core'] : DRUPAL_CORE_COMPATIBILITY,