Commit bdeaaa1f authored by Francesco Iannuzzelli's avatar Francesco Iannuzzelli

#27 Revision and adaptation for translations

parent 181e4a35
......@@ -75,6 +75,8 @@ if ($from=="translation")
$notes = $post['notes'];
$priority = $post['priority'];
$id_user = $fh->String2Number($post['id_user']);
$id_rev = $fh->String2Number($post['id_rev']);
$id_ad = $fh->String2Number($post['id_ad']);
$id_article = $fh->String2Number($post['id_article']);
$start_date = $fh->DateMerge("start_date",$post);
$comments = $post['comments'];
......@@ -83,7 +85,7 @@ if ($from=="translation")
if ($id_language_trad>0)
{
if ($action2=="update")
$tra->TranslationUpdate($id_translation,$start_date,$id_language,$id_language_trad,$notes,$priority,$id_user,$comments,$translator,$completed);
$tra->TranslationUpdate($id_translation,$start_date,$id_language,$id_language_trad,$notes,$priority,$id_user,$comments,$translator,$completed,$id_rev,$id_ad);
if ($action2=="insert")
$tra->TranslationInsert($id_article,$id_language,$id_language_trad,$notes,$priority);
if ($action2=="take")
......
......@@ -127,17 +127,20 @@ echo $hh->input_array(($id_article>0)?"lingue disponibili<br/>per la traduzione"
if ($row['id_language_trad']>0)
{
$translators = $tra->TranslatorsLanguage($row['id_language'],$row['id_language_trad']);
$translators = $tra->TranslatorsLanguage($row['id_language'],$row['id_language_trad']);
echo $hh->input_row("traduttore","id_user",$row['id_user']>0? $row['id_user'] : $ah->current_user_id,$translators,"--",0,$input_right);
$tra_users = $tra->Users();
if ($row['id_article_trad']>0)
{
$atra = new Article($row['id_article_trad']);
$atra->ArticleLoad();
echo $hh->input_text("oppure","translator",$row['translator'],40,0,$input_right);
echo $hh->input_note("Articolo tradotto: <a href=\"/articles/article.php?w=tra&id_translation=$id_translation&id={$row['id_article_trad']}\">{$atra->headline}</a>");
echo $hh->input_row("revisore","id_rev",$row['id_rev'],$tra_users,"--",0,$input_right);
echo $hh->input_row("adattatore","id_ad",$row['id_ad'],$tra_users,"--",0,$input_right);
echo $hh->input_textarea("note sulla traduzione","comments",$row['comments'],75,6,"",$input_right);
echo $hh->input_checkbox("completetato","completed",$row['completed'],0,$input_right);
echo $hh->input_checkbox("completato","completed",$row['completed'],0,$input_right);
}
}
......
......@@ -1375,9 +1375,12 @@ class Article
{
$row = array();
$db =& Db::globaldb();
$sqlstr = "SELECT t.id_translation,t.id_language,t.id_article,t.id_language_trad,t.comments,t.id_user,u.name AS user_name,t.translator
$sqlstr = "SELECT t.id_translation,t.id_language,t.id_article,t.id_language_trad,t.comments,t.id_user,u.name AS user_name,t.translator,
t.id_rev,t.id_ad,u2.name AS rev_name,u3.name AS ad_name
FROM translations t
LEFT JOIN users u ON t.id_user=u.id_user
LEFT JOIN users u2 ON t.id_rev=u2.id_user
LEFT JOIN users u3 ON t.id_ad=u3.id_user
WHERE t.id_article_trad='$this->id' AND t.completed=1 ";
$db->query_single($row, $sqlstr);
return $row;
......
......@@ -384,6 +384,12 @@ class Layout
$tra['disclaimer'] = array('xvalue'=>$this->tr->TranslateParams("translation_note3",array($translator['user_name'],$this->ini->Get("title"),$this->topic->name,$translator['id_user'])));
}
}
if($translator['id_rev']>0) {
$tra['revision'] = $translator['rev_name'];
}
if($translator['id_ad']>0) {
$tra['adaptation'] = $translator['ad_name'];
}
if($translator['id_article']>0)
{
$atr = new Article($translator['id_article']);
......
......@@ -59,7 +59,7 @@ define('PHPEACE_VERSION',"2.6.26");
* PhPeace Database version number (integer)
* Increased by 1 for each DB schema change
*/
define('PHPEACE_DB_VERSION',269);
define('PHPEACE_DB_VERSION',270);
/* ##################################### */
......
......@@ -126,6 +126,9 @@ class PhPeaceUpdates
{
switch($version_new)
{
case "305":
$this->UpdateDB("270");
break;
case "304":
$fm->DirAction("cache/events_api","check");
break;
......@@ -476,6 +479,10 @@ class PhPeaceUpdates
$dbconf = $conf->Get("dbconf");
switch($db_version)
{
case "270":
$db->ColumnAdd("translations","id_rev","SMALLINT(4)","0");
$db->ColumnAdd("translations","id_ad","SMALLINT(4)","0");
break;
case "269":
$db->TableCreate('site_watch', "`id_watch` SMALLINT(4) NOT NULL DEFAULT '0',`url` VARCHAR(250) NOT NULL DEFAULT '',`keyword` VARCHAR(50) NOT NULL DEFAULT '',`notify` VARCHAR(250) NOT NULL DEFAULT '',`counter` SMALLINT(4) NOT NULL DEFAULT '0', PRIMARY KEY (`id_watch`)");
break;
......
......@@ -121,7 +121,7 @@ class Translations
$db =& Db::globaldb();
$sqlstr = "SELECT t.id_article,t.id_language,UNIX_TIMESTAMP(t.start_date) AS start_date_ts,t.notes,t.id_article_trad,
t.id_language_trad,t.completed,t.comments,t.id_user,t.priority,
u.name AS user_name,t.translator
u.name AS user_name,t.translator,t.id_rev,t.id_ad
FROM translations t
LEFT JOIN users u ON t.id_user=u.id_user
WHERE t.id_translation=$id_translation";
......@@ -179,12 +179,13 @@ class Translations
Db::finish( $res, $db);
}
public function TranslationUpdate($id_translation,$start_date,$id_language,$id_language_trad,$notes,$priority,$id_user,$comments,$translator,$completed)
public function TranslationUpdate($id_translation,$start_date,$id_language,$id_language_trad,$notes,$priority,$id_user,$comments,$translator,$completed,$id_rev,$id_ad)
{
$db =& Db::globaldb();
$db->begin();
$sqlstr = "UPDATE translations SET id_language=$id_language,id_language_trad=$id_language_trad,notes='$notes',
id_user=$id_user,start_date='$start_date',comments='$comments',priority='$priority',translator='$translator',completed='$completed'
id_user=$id_user,start_date='$start_date',comments='$comments',priority='$priority',translator='$translator',completed='$completed',
id_rev=$id_rev,id_ad=$id_ad
WHERE id_translation=$id_translation";
$db->lock( "translations" );
$res[] = $db->query( $sqlstr );
......@@ -326,18 +327,18 @@ class Translations
// diverso, dovrebbe prendere anche le lingue e i task
}
/*
function Users()
public function Users()
{
$db =& Db::globaldb();
$rows = array();
$sqlstr = "SELECT t.id_topic,t.name,tu.id_user
FROM topics t LEFT JOIN topic_users tu ON t.id_topic=tu.id_topic AND tu.id_user=$id_user
WHERE t.id_topic<>$this->temp_id_topic ORDER BY name";
$db =& Db::globaldb();
$sqlstr = "SELECT users.id_user,name FROM users
INNER JOIN module_users ON module_users.id_user=users.id_user
WHERE users.active=1 AND users.id_user>0 AND module_users.id_module={$this->id_module}
GROUP BY users.id_user ORDER BY name";
$db->QueryExe($rows, $sqlstr);
return $rows;
}
*/
}
?>
......@@ -1376,8 +1376,8 @@ CREATE TABLE `keywords_feeds` (
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `keywords_landing` (
`id_keyword` mediumint(9) NOT NULL DEFAULT '0',
`content` text COLLATE utf8_unicode_ci NOT NULL,
`youtube` varchar(150) COLLATE utf8_unicode_ci NOT NULL DEFAULT ''
`content` text NOT NULL,
`youtube` varchar(150) NOT NULL DEFAULT ''
);
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40101 SET @saved_cs_client = @@character_set_client */;
......@@ -2342,9 +2342,9 @@ CREATE TABLE `sessions` (
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `site_watch` (
`id_watch` smallint(4) NOT NULL DEFAULT '0',
`url` varchar(250) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`keyword` varchar(50) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`notify` varchar(250) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`url` varchar(250) NOT NULL DEFAULT '',
`keyword` varchar(50) NOT NULL DEFAULT '',
`notify` varchar(250) NOT NULL DEFAULT '',
`counter` smallint(4) NOT NULL DEFAULT '0',
PRIMARY KEY (`id_watch`)
);
......@@ -3060,6 +3060,8 @@ CREATE TABLE `translations` (
`comments` text,
`id_user` smallint(4) NOT NULL,
`translator` varchar(100) DEFAULT NULL,
`id_rev` smallint(4) NOT NULL DEFAULT '0',
`id_ad` smallint(4) NOT NULL DEFAULT '0',
PRIMARY KEY (`id_translation`),
KEY `id_article` (`id_article`),
KEY `id_article_trad` (`id_article_trad`),
......
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