- Patch #1137074 by plach, Jose Reyero: notices and wrong links on translation tab for unpublished nodes.

8.0.x
Dries Buytaert 2011-05-24 17:40:58 -04:00
parent d6c4e2a1be
commit 2f1267996f
2 changed files with 12 additions and 4 deletions

View File

@ -37,12 +37,12 @@ function translation_node_overview($node) {
$translation_node = node_load($translations[$langcode]->nid);
$path = 'node/' . $translation_node->nid;
$links = language_negotiation_get_switch_links($type, $path);
$title = empty($links->links[$langcode]) ? l($translation_node->title, $path) : l($translation_node->title, $links->links[$langcode]['href'], $links->links[$langcode]);
$title = empty($links->links[$langcode]['href']) ? l($translation_node->title, $path) : l($translation_node->title, $links->links[$langcode]['href'], $links->links[$langcode]);
if (node_access('update', $translation_node)) {
$text = t('edit');
$path = 'node/' . $translation_node->nid . '/edit';
$links = language_negotiation_get_switch_links($type, $path);
$options[] = empty($links->links[$langcode]) ? l($text, $path) : l($text, $links->links[$langcode]['href'], $links->links[$langcode]);
$options[] = empty($links->links[$langcode]['href']) ? l($text, $path) : l($text, $links->links[$langcode]['href'], $links->links[$langcode]);
}
$status = $translation_node->status ? t('Published') : t('Not published');
$status .= $translation_node->translate ? ' - <span class="marker">' . t('outdated') . '</span>' : '';
@ -58,7 +58,7 @@ function translation_node_overview($node) {
$path = 'node/add/' . str_replace('_', '-', $node->type);
$links = language_negotiation_get_switch_links($type, $path);
$query = array('query' => array('translation' => $node->nid, 'target' => $langcode));
$options[] = empty($links->links[$langcode]) ? l($text, $path, $query) : l($text, $links->links[$langcode]['href'], array_merge_recursive($links->links[$langcode], $query));
$options[] = empty($links->links[$langcode]['href']) ? l($text, $path, $query) : l($text, $links->links[$langcode]['href'], array_merge_recursive($links->links[$langcode], $query));
}
$status = t('Not translated');
}

View File

@ -20,7 +20,7 @@ class TranslationTestCase extends DrupalWebTestCase {
parent::setUp('locale', 'translation', 'translation_test');
// Setup users.
$this->admin_user = $this->drupalCreateUser(array('bypass node access', 'administer nodes', 'administer languages', 'administer content types', 'administer blocks', 'access administration pages'));
$this->admin_user = $this->drupalCreateUser(array('bypass node access', 'administer nodes', 'administer languages', 'administer content types', 'administer blocks', 'access administration pages', 'translate content'));
$this->translator = $this->drupalCreateUser(array('create page content', 'edit own page content', 'translate content'));
$this->drupalLogin($this->admin_user);
@ -67,6 +67,14 @@ class TranslationTestCase extends DrupalWebTestCase {
$node_body = $this->randomName();
$node = $this->createPage($node_title, $node_body, 'en');
// Unpublish the original node to check that this has no impact on the
// translation overview page, publish it again afterwards.
$this->drupalLogin($this->admin_user);
$this->drupalPost('node/' . $node->nid . '/edit', array('status' => FALSE), t('Save'));
$this->drupalGet('node/' . $node->nid . '/translate');
$this->drupalPost('node/' . $node->nid . '/edit', array('status' => NODE_PUBLISHED), t('Save'));
$this->drupalLogin($this->translator);
// Check that the "add translation" link uses a localized path.
$languages = language_list();
$this->drupalGet('node/' . $node->nid . '/translate');