Fixed a bug in the translations manager where all messages were always marked "Out of Date".
This commit is contained in:
parent
b0955f6fe1
commit
1dd74c1dc3
2 changed files with 18 additions and 9 deletions
|
|
@ -3,7 +3,8 @@ delete from international where internationalId=12 and namespace='Poll');
|
|||
INSERT INTO international VALUES (12,'Poll',1,'Total Votes:',1031514049);
|
||||
INSERT INTO international VALUES (12,'Poll',7,'总投票人数:',1031514049);'
|
||||
alter table page modify title varchar(255) null;
|
||||
|
||||
update international set lastUpdated='1031510000' where lastUpdated='1031516049';
|
||||
insert into international (internationalId,languageId,namespace,message,lastUpdated) values (723,1,'WebGUI','Deprecated', 1031800566);
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ package WebGUI::Operation::International;
|
|||
use Exporter;
|
||||
use strict;
|
||||
use Tie::CPHash;
|
||||
use WebGUI::DateTime;
|
||||
use WebGUI::HTMLForm;
|
||||
use WebGUI::Icon;
|
||||
use WebGUI::International;
|
||||
|
|
@ -227,13 +228,14 @@ sub www_exportTranslation {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_listInternationalMessages {
|
||||
my ($output, $sth, $key, $p, $search, $status, %data, %list, $i, $missing, @row, $f, $outOfDate, $ok);
|
||||
my ($output, $sth, $key, $p, $search, $status, %data, %list, $deprecated, $i, $missing, @row, $f, $outOfDate, $ok);
|
||||
tie %data, 'Tie::CPHash';
|
||||
if (WebGUI::Privilege::isInGroup(3)) {
|
||||
%data = WebGUI::SQL->quickHash("select language from language where languageId=".$session{form}{lid});
|
||||
$missing = '<b>'.WebGUI::International::get(596).'</b>';
|
||||
$outOfDate = '<b>'.WebGUI::International::get(719).'</b>';
|
||||
$ok = WebGUI::International::get(720);
|
||||
$deprecated = WebGUI::International::get(723);
|
||||
$output = '<h1>'.WebGUI::International::get(595).' ('.$data{language}.')</h1>';
|
||||
$f = WebGUI::HTMLForm->new(1);
|
||||
$f->hidden("op","listInternationalMessages");
|
||||
|
|
@ -250,34 +252,40 @@ sub www_listInternationalMessages {
|
|||
$list{"z-".$data{namespace}."-".$data{internationalId}}{namespace} = $data{namespace};
|
||||
$list{"z-".$data{namespace}."-".$data{internationalId}}{message} = $data{message};
|
||||
$list{"z-".$data{namespace}."-".$data{internationalId}}{lastUpdated} = $data{lastUpdated};
|
||||
$list{"z-".$data{namespace}."-".$data{internationalId}}{missing} = 0;
|
||||
$list{"z-".$data{namespace}."-".$data{internationalId}}{status} = "deleted";
|
||||
}
|
||||
$sth->finish;
|
||||
$sth = WebGUI::SQL->read("select * from international where languageId=1".$search);
|
||||
while (%data = $sth->hash) {
|
||||
$key = $data{namespace}."-".$data{internationalId};
|
||||
unless ($list{"z-".$key}) {
|
||||
$list{"a-".$key}{missing} = 1;
|
||||
$list{"a-".$key}{namespace} = $data{namespace};
|
||||
$list{"a-".$key}{id} = $data{internationalId};
|
||||
$list{"a-".$key}{status} = "missing";
|
||||
} else {
|
||||
if ($list{"z-".$key}{lastUpdated} > $data{lastUpdated}) {
|
||||
if ($list{"z-".$key}{lastUpdated} < $data{lastUpdated}) {
|
||||
$list{"o-".$key} = $list{"z-".$key};
|
||||
delete($list{"z-".$key});
|
||||
$list{"o-".$key}{outOfDate} = 1;
|
||||
$list{"o-".$key}{status} = "updated";
|
||||
} else {
|
||||
$list{"q-".$key} = $list{"z-".$key};
|
||||
delete($list{"z-".$key});
|
||||
$list{"q-".$key}{status} = "ok";
|
||||
}
|
||||
}
|
||||
}
|
||||
$sth->finish;
|
||||
foreach $key (sort {$a cmp $b} keys %list) {
|
||||
if ($list{$key}{outOfDate}) {
|
||||
if ($list{$key}{status} eq "updated") {
|
||||
$status = $outOfDate;
|
||||
} elsif ($list{$key}{missing}) {
|
||||
} elsif ($list{$key}{status} eq "missing") {
|
||||
$status = $missing;
|
||||
} elsif ($list{$key}{status} eq "deleted") {
|
||||
$status = $deprecated;
|
||||
} else {
|
||||
$status = $ok;
|
||||
}
|
||||
$row[$i] = '<tr valign="top"><td>'.$status."</td><td>"
|
||||
$row[$i] = '<tr valign="top"><td nowrap="1">'.$status."</td><td>"
|
||||
.editIcon('op=editInternationalMessage&lid='.$session{form}{lid}
|
||||
.'&iid='.$list{$key}{id}.'&namespace='.$list{$key}{namespace}.'&pn='.$session{form}{pn}
|
||||
.'&missing='.$list{$key}{missing})."</td><td>".$list{$key}{namespace}."</td><td>"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue