summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorwebchick <webchick@24967.no-reply.drupal.org>2011-05-24 15:50:37 -0700
committerwebchick <webchick@24967.no-reply.drupal.org>2011-05-24 15:50:37 -0700
commitee61c8eacd3efde0a0e23dafd6bdc885e9555efa (patch)
treec84c96cef462461e6bc985b538410becd8ff8789 /modules
parentc09a969d96e70cd2470849fc159d74f54b552181 (diff)
downloadbrdo-ee61c8eacd3efde0a0e23dafd6bdc885e9555efa.tar.gz
brdo-ee61c8eacd3efde0a0e23dafd6bdc885e9555efa.tar.bz2
Issue #1137074 by plach, Jose Reyero: notices and wrong links on translation tab for unpublished nodes.
Diffstat (limited to 'modules')
-rw-r--r--modules/translation/translation.pages.inc6
-rw-r--r--modules/translation/translation.test10
2 files changed, 12 insertions, 4 deletions
diff --git a/modules/translation/translation.pages.inc b/modules/translation/translation.pages.inc
index 102d1b882..7e4f0af26 100644
--- a/modules/translation/translation.pages.inc
+++ b/modules/translation/translation.pages.inc
@@ -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');
}
diff --git a/modules/translation/translation.test b/modules/translation/translation.test
index fa8c6b63f..54b53d9fd 100644
--- a/modules/translation/translation.test
+++ b/modules/translation/translation.test
@@ -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');