From e78b7890c590e2f43453b608f5aba9249e187054 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A1bor=20Hojtsy?= Date: Tue, 16 Oct 2007 09:15:19 +0000 Subject: #181577 by Crell: split up translation module --- modules/translation/translation.module | 53 +-------------------------- modules/translation/translation.pages.inc | 59 +++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+), 52 deletions(-) create mode 100644 modules/translation/translation.pages.inc (limited to 'modules') diff --git a/modules/translation/translation.module b/modules/translation/translation.module index 22b4690f9..17af41516 100644 --- a/modules/translation/translation.module +++ b/modules/translation/translation.module @@ -53,6 +53,7 @@ function translation_menu() { 'access arguments' => array(1), 'type' => MENU_LOCAL_TASK, 'weight' => 2, + 'file' => 'translation.pages.inc', ); return $items; } @@ -165,58 +166,6 @@ function translation_link($type, $node = NULL, $teaser = FALSE) { return $links; } -/** - * Overview page for a node's translations. - * - * @param $node - * Node object. - */ -function translation_node_overview($node) { - if ($node->tnid) { - // Already part of a set, grab that set. - $tnid = $node->tnid; - $translations = translation_node_get_translations($node->tnid); - } - else { - // We have no translation source nid, this could be a new set, emulate that. - $tnid = $node->nid; - $translations = array($node->language => $node); - } - - $header = array(t('Language'), t('Title'), t('Status'), t('Operations')); - - foreach (language_list() as $language) { - $options = array(); - $language_name = $language->name; - if (isset($translations[$language->language])) { - // Existing translation in the translation set: display status. - // We load the full node to check whether the user can edit it. - $translation_node = node_load($translations[$language->language]->nid); - $title = l($translation_node->title, 'node/'. $translation_node->nid); - if (node_access('update', $translation_node)) { - $options[] = l(t('edit'), "node/$translation_node->nid/edit"); - } - $status = $translation_node->status ? t('Published') : t('Not published'); - $status .= $translation_node->translate ? ' - '. t('outdated') .'' : ''; - if ($translation_node->nid == $tnid) { - $language_name = ''. $language_name .' (source)'; - } - } - else { - // No such translation in the set yet: help user to create it. - $title = t('n/a'); - if (node_access('create', $node)) { - $options[] = l(t('add translation'), 'node/add/'. $node->type, array('query' => "translation=$node->nid&language=$language->language")); - } - $status = t('Not translated'); - } - $rows[] = array($language_name, $title, $status, implode(" | ", $options)); - } - - drupal_set_title(t('Translations of %title', array('%title' => $node->title))); - return theme('table', $header, $rows); -} - /** * Implementation of hook_nodeapi(). * diff --git a/modules/translation/translation.pages.inc b/modules/translation/translation.pages.inc new file mode 100644 index 000000000..bc0a162fd --- /dev/null +++ b/modules/translation/translation.pages.inc @@ -0,0 +1,59 @@ +tnid) { + // Already part of a set, grab that set. + $tnid = $node->tnid; + $translations = translation_node_get_translations($node->tnid); + } + else { + // We have no translation source nid, this could be a new set, emulate that. + $tnid = $node->nid; + $translations = array($node->language => $node); + } + + $header = array(t('Language'), t('Title'), t('Status'), t('Operations')); + + foreach (language_list() as $language) { + $options = array(); + $language_name = $language->name; + if (isset($translations[$language->language])) { + // Existing translation in the translation set: display status. + // We load the full node to check whether the user can edit it. + $translation_node = node_load($translations[$language->language]->nid); + $title = l($translation_node->title, 'node/'. $translation_node->nid); + if (node_access('update', $translation_node)) { + $options[] = l(t('edit'), "node/$translation_node->nid/edit"); + } + $status = $translation_node->status ? t('Published') : t('Not published'); + $status .= $translation_node->translate ? ' - '. t('outdated') .'' : ''; + if ($translation_node->nid == $tnid) { + $language_name = ''. $language_name .' (source)'; + } + } + else { + // No such translation in the set yet: help user to create it. + $title = t('n/a'); + if (node_access('create', $node)) { + $options[] = l(t('add translation'), 'node/add/'. $node->type, array('query' => "translation=$node->nid&language=$language->language")); + } + $status = t('Not translated'); + } + $rows[] = array($language_name, $title, $status, implode(" | ", $options)); + } + + drupal_set_title(t('Translations of %title', array('%title' => $node->title))); + return theme('table', $header, $rows); +} -- cgit v1.2.3