Commit 85805096 authored by Gábor Hojtsy's avatar Gábor Hojtsy

#142280 by Jose A Reyero, yched and myself: Content translation support built...

#142280 by Jose A Reyero, yched and myself: Content translation support built on the existing node language feature
parent ae0392b2
......@@ -581,10 +581,10 @@ function node_load($param = array(), $revision = NULL, $reset = NULL) {
// No db_rewrite_sql is applied so as to get complete indexing for search.
if ($revision) {
array_unshift($arguments, $revision);
$node = db_fetch_object(db_query('SELECT n.nid, r.vid, n.type, n.status, n.language, n.created, n.changed, n.comment, n.promote, n.sticky, r.timestamp AS revision_timestamp, r.title, r.body, r.teaser, r.log, r.format, u.uid, u.name, u.picture, u.data FROM {node} n INNER JOIN {users} u ON u.uid = n.uid INNER JOIN {node_revisions} r ON r.nid = n.nid AND r.vid = %d WHERE '. $cond, $arguments));
$node = db_fetch_object(db_query('SELECT n.nid, r.vid, n.type, n.status, n.language, n.created, n.changed, n.comment, n.promote, n.sticky, n.tnid, n.translate, r.timestamp AS revision_timestamp, r.title, r.body, r.teaser, r.log, r.format, u.uid, u.name, u.picture, u.data FROM {node} n INNER JOIN {users} u ON u.uid = n.uid INNER JOIN {node_revisions} r ON r.nid = n.nid AND r.vid = %d WHERE '. $cond, $arguments));
}
else {
$node = db_fetch_object(db_query('SELECT n.nid, n.vid, n.type, n.status, n.language, n.created, n.changed, n.comment, n.promote, n.sticky, r.timestamp AS revision_timestamp, r.title, r.body, r.teaser, r.log, r.format, u.uid, u.name, u.picture, u.data FROM {node} n INNER JOIN {users} u ON u.uid = n.uid INNER JOIN {node_revisions} r ON r.vid = n.vid WHERE '. $cond, $arguments));
$node = db_fetch_object(db_query('SELECT n.nid, n.vid, n.type, n.status, n.language, n.created, n.changed, n.comment, n.promote, n.sticky, n.tnid, n.translate, r.timestamp AS revision_timestamp, r.title, r.body, r.teaser, r.log, r.format, u.uid, u.name, u.picture, u.data FROM {node} n INNER JOIN {users} u ON u.uid = n.uid INNER JOIN {node_revisions} r ON r.vid = n.vid WHERE '. $cond, $arguments));
}
if ($node && $node->nid) {
......@@ -1371,10 +1371,17 @@ function node_operations_unsticky($nodes) {
function node_filters() {
// Regular filters
$filters['status'] = array('title' => t('status'),
'options' => array('status-1' => t('published'), 'status-0' => t('not published'),
'promote-1' => t('promoted'), 'promote-0' => t('not promoted'),
'sticky-1' => t('sticky'), 'sticky-0' => t('not sticky')));
'options' => array('status-1' => t('published'), 'status-0' => t('not published'),
'promote-1' => t('promoted'), 'promote-0' => t('not promoted'),
'sticky-1' => t('sticky'), 'sticky-0' => t('not sticky'))
);
// Include translation states if we have this module enabled
if (module_exists('translation')) {
$filters['status']['options'] += array('translate-0' => t('up to date translation'), 'translate-1' => t('outdated translation'));
}
$filters['type'] = array('title' => t('type'), 'options' => node_get_types('names'));
// The taxonomy filter
if ($taxonomy = module_invoke('taxonomy', 'form_all', 1)) {
$filters['category'] = array('title' => t('category'), 'options' => $taxonomy);
......
......@@ -4,19 +4,21 @@
function node_schema() {
$schema['node'] = array(
'fields' => array(
'nid' => array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE),
'vid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => FALSE, 'default' => 0),
'type' => array('type' => 'varchar', 'length' => 32, 'not null' => TRUE, 'default' => ''),
'language' => array('type' => 'varchar', 'length' => 12, 'not null' => TRUE, 'default' => ''),
'title' => array('type' => 'varchar', 'length' => 128, 'not null' => TRUE, 'default' => ''),
'uid' => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
'status' => array('type' => 'int', 'not null' => TRUE, 'default' => 1),
'created' => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
'changed' => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
'comment' => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
'promote' => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
'moderate' => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
'sticky' => array('type' => 'int', 'not null' => TRUE, 'default' => 0)
'nid' => array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE),
'vid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => FALSE, 'default' => 0),
'type' => array('type' => 'varchar', 'length' => 32, 'not null' => TRUE, 'default' => ''),
'language' => array('type' => 'varchar', 'length' => 12, 'not null' => TRUE, 'default' => ''),
'title' => array('type' => 'varchar', 'length' => 128, 'not null' => TRUE, 'default' => ''),
'uid' => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
'status' => array('type' => 'int', 'not null' => TRUE, 'default' => 1),
'created' => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
'changed' => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
'comment' => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
'promote' => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
'moderate' => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
'sticky' => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
'tnid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0),
'translate' => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
),
'indexes' => array(
'nid' => array('nid'),
......@@ -28,7 +30,9 @@ function node_schema() {
'node_title_type' => array('title', array('type', 4)),
'node_type' => array(array('type', 4)),
'status' => array('status'),
'uid' => array('uid')
'uid' => array('uid'),
'tnid' => array('tnid'),
'translate' => array('translate'),
),
'unique keys' => array(
'nid_vid' => array('nid', 'vid'),
......
......@@ -3349,6 +3349,18 @@ function system_update_6023() {
return $ret;
}
/**
* Add translation fields to nodes used by translation module.
*/
function system_update_6024() {
$ret = array();
db_add_field($ret, 'node', 'tnid', array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0));
db_add_field($ret, 'node', 'translate', array('type' => 'int', 'not null' => TRUE, 'default' => 0));
db_add_index($ret, 'node', 'tnid', array('tnid'));
db_add_index($ret, 'node', 'translate', array('translate'));
return $ret;
}
/**
* @} End of "defgroup updates-5.x-to-6.x"
* The next series of updates should start at 7000.
......
; $Id$
name = Content translation
description = Allows content to be translated into different languages.
dependencies[] = locale
package = Core - optional
version = VERSION
core = 6.x
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment