The 4.6.7 bug fix cycle.
This commit is contained in:
parent
a1a21aa1ee
commit
c9dcb9dda1
9 changed files with 7467 additions and 7120 deletions
|
|
@ -23,19 +23,47 @@ use WebGUI::SQL;
|
|||
use WebGUI::URL;
|
||||
|
||||
our @ISA = qw(Exporter);
|
||||
our @EXPORT = qw(&www_listLanguages &www_editLanguage &www_submitTranslation &www_submitTranslationConfirm &www_deleteLanguage &www_deleteLanguageConfirm
|
||||
&www_listInternationalMessages &www_editLanguageSave &www_editInternationalMessage &www_editInternationalMessageSave &www_listHelpMessages
|
||||
&www_editHelpMessage &www_editHelpMessageSave);
|
||||
our @EXPORT = qw(&www_listLanguages &www_editLanguage &www_submitTranslation &www_submitTranslationConfirm
|
||||
&www_deleteLanguage &www_deleteLanguageConfirm &www_addInternationalMessage &www_addInternationalMessageSave
|
||||
&www_listInternationalMessages &www_editLanguageSave &www_editInternationalMessage
|
||||
&www_exportTranslation &www_editInternationalMessageSave );
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub _export {
|
||||
my ($sth, %data, $export);
|
||||
tie %data, 'Tie::CPHash';
|
||||
%data = WebGUI::SQL->quickHash("select * from language where languageId=".$_[0]);
|
||||
$export = "#".$data{language}." translation export for WebGUI ".$WebGUI::VERSION.".\n\n";
|
||||
$export .= "#language\n\n";
|
||||
$export .= "delete from language where languageId=".$_[0].";\n";
|
||||
$export .= "insert into language (languageId,language,characterSet) values ("
|
||||
.$data{languageId}.", ".quote($data{language}).", ".quote($data{characterSet}).");\n";
|
||||
$export .= "\n#international\n\n";
|
||||
$sth = WebGUI::SQL->read("select * from international where languageId=".$_[0]." order by lastUpdated desc");
|
||||
while (%data = $sth->hash) {
|
||||
$export .= "delete from international where languageId=".$_[0]." and namespace="
|
||||
.quote($data{namespace})." and internationalId=".$data{internationalId}.";\n";
|
||||
$export .= "insert into international (internationalId,languageId,namespace,message,lastUpdated) values ("
|
||||
.$data{internationalId}.",".$data{languageId}.",".quote($data{namespace})
|
||||
.",".quote($data{message}).", ".$data{lastUpdated}.");\n";
|
||||
}
|
||||
$sth->finish;
|
||||
return $export;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub _submenu {
|
||||
my ($output);
|
||||
$output = '<table width="100%"><tr>';
|
||||
$output .= '<td valign="top" class="content">'.$_[0].'</td>';
|
||||
$output .= '<td valign="top" class="tableMenu">';
|
||||
$output .= '<li><a href="'.WebGUI::URL::page('op=editLanguage&lid='.$session{form}{lid}).'">'.WebGUI::International::get(598).'</a>';
|
||||
$output .= '<td valign="top" class="tableMenu" nowrap="1">';
|
||||
if ($session{form}{lid} == 1) {
|
||||
$output .= '<li><a href="'.WebGUI::URL::page('op=addInternationalMessage&lid=1').'">Add new message.</a>';
|
||||
}
|
||||
$output .= '<li><a href="'.WebGUI::URL::page('op=listInternationalMessages&lid='.$session{form}{lid}).'">'.WebGUI::International::get(594).'</a>';
|
||||
$output .= '<li><a href="'.WebGUI::URL::page('op=editLanguage&lid='.$session{form}{lid}).'">'.WebGUI::International::get(598).'</a>';
|
||||
$output .= '<li><a href="'.WebGUI::URL::page('op=exportTranslation&lid='.$session{form}{lid}).'">'.WebGUI::International::get(718).'</a>';
|
||||
$output .= '<li><a href="'.WebGUI::URL::page('op=submitTranslation&lid='.$session{form}{lid}).'">'.WebGUI::International::get(593).'</a>';
|
||||
$output .= '<li><a href="'.WebGUI::URL::page('op=listLanguages').'">'.WebGUI::International::get(585).'</a>';
|
||||
$output .= '<li><a href="'.WebGUI::URL::page().'">'.WebGUI::International::get(493).'</a>';
|
||||
|
|
@ -43,6 +71,34 @@ sub _submenu {
|
|||
return $output;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_addInternationalMessage {
|
||||
my ($output,$f,$namespace);
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Privilege::isInGroup(3));
|
||||
$output = '<h1>Add English Message</h1>';
|
||||
$namespace = $session{wobject};
|
||||
$namespace->{WebGUI} = 'WebGUI';
|
||||
$f = WebGUI::HTMLForm->new();
|
||||
$f->hidden("lid",1);
|
||||
$f->hidden("op","addInternationalMessageSave");
|
||||
$f->select("namespace",$namespace,"Namespace",['WebGUI']);
|
||||
$f->textarea("message","Message");
|
||||
$f->submit;
|
||||
$output .= $f->print;
|
||||
return _submenu($output);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_addInternationalMessageSave {
|
||||
my ($nextId);
|
||||
($nextId) = WebGUI::SQL->quickArray("select max(internationalId) from international where languageId=1
|
||||
and namespace=".quote($session{form}{namespace}));
|
||||
$nextId++;
|
||||
WebGUI::SQL->write("insert into international (languageId, internationalId, namespace, message, lastUpdated) values
|
||||
(1,$nextId,".quote($session{form}{namespace}).",".quote($session{form}{message}).",".time().")");
|
||||
return "<b>Message was added with id $nextId.</b>".www_listInternationalMessages();
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_deleteLanguage {
|
||||
my ($output);
|
||||
|
|
@ -109,10 +165,12 @@ sub www_editInternationalMessage {
|
|||
sub www_editInternationalMessageSave {
|
||||
if (WebGUI::Privilege::isInGroup(3)) {
|
||||
if ($session{form}{missing}) {
|
||||
WebGUI::SQL->write("insert into international (message,namespace,languageId,internationalId) values (".quote($session{form}{message})
|
||||
.",".quote($session{form}{namespace}).",".$session{form}{lid}.",".$session{form}{iid}.")");
|
||||
WebGUI::SQL->write("insert into international (message,namespace,languageId,internationalId,lastUpdated)
|
||||
values (".quote($session{form}{message}).",".quote($session{form}{namespace})
|
||||
.",".$session{form}{lid}.",".$session{form}{iid}.", ".time().")");
|
||||
} else {
|
||||
WebGUI::SQL->write("update international set message=".quote($session{form}{message})." where namespace=".quote($session{form}{namespace})."
|
||||
WebGUI::SQL->write("update international set message=".quote($session{form}{message}).", lastUpdated="
|
||||
.time()." where namespace=".quote($session{form}{namespace})."
|
||||
and languageId=".$session{form}{lid}." and internationalId=".$session{form}{iid});
|
||||
}
|
||||
return www_listInternationalMessages();
|
||||
|
|
@ -140,12 +198,6 @@ sub www_editLanguage {
|
|||
$f->text("characterSet",WebGUI::International::get(592),$data{characterSet});
|
||||
$f->submit;
|
||||
$output .= $f->print;
|
||||
if ($session{form}{lid} ne "new") {
|
||||
$output .= '<ul>';
|
||||
$output .= '<li><a href="'.WebGUI::URL::page('op=listInternationalMessages&lid='.$session{form}{lid}).'">'.WebGUI::International::get(594).'</a>';
|
||||
$output .= '<li><a href="'.WebGUI::URL::page('op=submitLanguage&lid='.$session{form}{lid}).'">'.WebGUI::International::get(593).'</a>';
|
||||
$output .= '</ul>';
|
||||
}
|
||||
return _submenu($output);
|
||||
} else {
|
||||
return WebGUI::Privilege::adminOnly();
|
||||
|
|
@ -168,90 +220,79 @@ sub www_editLanguageSave {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_listHelpMessages {
|
||||
my ($output, $sth, $key, $p, %data, %newList, %list, $i, $missing, @row, @split,$new);
|
||||
tie %data, 'Tie::CPHash';
|
||||
tie %list, 'Tie::IxHash';
|
||||
tie %newList, 'Tie::IxHash';
|
||||
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>';
|
||||
$output = '<h1>'.WebGUI::International::get(595).' ('.$data{language}.')</h1>';
|
||||
$sth = WebGUI::SQL->read("select * from help where languageId=".$session{form}{lid});
|
||||
while (%data = $sth->hash) {
|
||||
$list{$data{helpId}."-".$data{namespace}} = $data{action}.' '.$data{object};
|
||||
}
|
||||
$sth->finish;
|
||||
$sth = WebGUI::SQL->read("select * from help where languageId=1");
|
||||
while (%data = $sth->hash) {
|
||||
unless ($list{$data{helpId}."-".$data{namespace}}) {
|
||||
$list{"missing-".$data{helpId}."-".$data{namespace}} = $missing;
|
||||
}
|
||||
}
|
||||
$sth->finish;
|
||||
foreach $key (sort {$b cmp $a} keys %list) {
|
||||
$newList{$key}=$list{$key};
|
||||
}
|
||||
foreach $key (keys %newList) {
|
||||
@split = split(/-/,$key);
|
||||
if ($split[0] eq "missing") {
|
||||
$split[0] = $split[1];
|
||||
$split[1] = $split[2];
|
||||
$new = 1;
|
||||
} else {
|
||||
$new = 0;
|
||||
}
|
||||
$row[$i] = editIcon('op=editHelpMessage&lid='.$session{form}{lid}.'&hid='.$split[0].'&namespace='.$split[1].'&pn='.$session{form}{pn}.'&missing='.$new)
|
||||
.' '.$newList{$key}."<br>";
|
||||
$i++;
|
||||
}
|
||||
$p = WebGUI::Paginator->new(WebGUI::URL::page('op=listHelpMessages&lid='.$session{form}{lid}),\@row,50);
|
||||
$output .= $p->getPage($session{form}{pn});
|
||||
$output .= $p->getBarTraditional($session{form}{pn});
|
||||
return _submenu($output);
|
||||
} else {
|
||||
return WebGUI::Privilege::adminOnly();
|
||||
}
|
||||
sub www_exportTranslation {
|
||||
$session{header}{mimetype} = 'text/plain';
|
||||
return _export($session{form}{lid});
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_listInternationalMessages {
|
||||
my ($output, $sth, $new, $key, $p, %data, %newList, %list, $i, $missing, @row, @split);
|
||||
my ($output, $sth, $key, $p, $search, $status, %data, %list, $i, $missing, @row, $f, $outOfDate, $ok);
|
||||
tie %data, 'Tie::CPHash';
|
||||
tie %list, 'Tie::IxHash';
|
||||
tie %newList, 'Tie::IxHash';
|
||||
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);
|
||||
$output = '<h1>'.WebGUI::International::get(595).' ('.$data{language}.')</h1>';
|
||||
$sth = WebGUI::SQL->read("select * from international where languageId=".$session{form}{lid}." order by namespace");
|
||||
$f = WebGUI::HTMLForm->new(1);
|
||||
$f->hidden("op","listInternationalMessages");
|
||||
$f->hidden("lid",$session{form}{lid});
|
||||
$f->text("search","",$session{form}{search});
|
||||
$f->submit("search");
|
||||
$output .= $f->print;
|
||||
if ($session{form}{search} ne "") {
|
||||
$search = " and message like ".quote("%".$session{form}{search}."%");
|
||||
}
|
||||
$sth = WebGUI::SQL->read("select * from international where languageId=".$session{form}{lid}.$search);
|
||||
while (%data = $sth->hash) {
|
||||
$list{$data{namespace}."-".$data{internationalId}} = "<em>[$data{namespace}]</em> - ".$data{message};
|
||||
$list{"z-".$data{namespace}."-".$data{internationalId}}{id} = $data{internationalId};
|
||||
$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;
|
||||
}
|
||||
$sth->finish;
|
||||
$sth = WebGUI::SQL->read("select * from international where languageId=1");
|
||||
$sth = WebGUI::SQL->read("select * from international where languageId=1".$search);
|
||||
while (%data = $sth->hash) {
|
||||
unless ($list{$data{namespace}."-".$data{internationalId}}) {
|
||||
$list{"missing-".$data{namespace}."-".$data{internationalId}} = "<em>[$data{namespace}]</em> - ".$missing;
|
||||
}
|
||||
}
|
||||
$sth->finish;
|
||||
foreach $key (sort {$b cmp $a} keys %list) {
|
||||
$newList{$key}=$list{$key};
|
||||
}
|
||||
foreach $key (keys %newList) {
|
||||
@split = reverse(split(/-/,$key));
|
||||
if ($split[3] eq "missing") {
|
||||
$new = 1;
|
||||
$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};
|
||||
} else {
|
||||
$new = 0;
|
||||
}
|
||||
$row[$i] = editIcon('op=editInternationalMessage&lid='.$session{form}{lid}.'&iid='.$split[0].'&namespace='.$split[1]
|
||||
.'&pn='.$session{form}{pn}.'&missing='.$new)
|
||||
.' '.$newList{$key}."<br>"; # add real message here
|
||||
$i++;
|
||||
if ($list{"z-".$key}{lastUpdated} > $data{lastUpdated}) {
|
||||
$list{"o-".$key} = $list{"z-".$key};
|
||||
delete($list{"z-".$key});
|
||||
$list{"o-".$key}{outOfDate} = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
$sth->finish;
|
||||
foreach $key (sort {$a cmp $b} keys %list) {
|
||||
if ($list{$key}{outOfDate}) {
|
||||
$status = $outOfDate;
|
||||
} elsif ($list{$key}{missing}) {
|
||||
$status = $missing;
|
||||
} else {
|
||||
$status = $ok;
|
||||
}
|
||||
$row[$i] = '<tr valign="top"><td>'.$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>"
|
||||
.$list{$key}{id}."</td><td>".$list{$key}{message}."</td></tr>\n";
|
||||
$i++;
|
||||
}
|
||||
$p = WebGUI::Paginator->new(WebGUI::URL::page('op=listInternationalMessages&lid='.$session{form}{lid}),\@row,100);
|
||||
$output .= $p->getBarTraditional($session{form}{pn});
|
||||
$output .= '<table style="font-size: 11px;" width="100%">';
|
||||
$output .= '<tr><td class="tableHeader">'.WebGUI::International::get(434).'</td><td class="tableHeader">'.
|
||||
WebGUI::International::get(575).'</td><td class="tableHeader">'.WebGUI::International::get(721)
|
||||
.'</td><td class="tableHeader">'.WebGUI::International::get(722)
|
||||
.'</td><td class="tableHeader" width="100%">'.WebGUI::International::get(230).'</td></tr>';
|
||||
$output .= $p->getPage($session{form}{pn});
|
||||
$output .= '</table>';
|
||||
$output .= $p->getBarTraditional($session{form}{pn});
|
||||
return _submenu($output);
|
||||
} else {
|
||||
|
|
@ -295,26 +336,7 @@ sub www_submitTranslation {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_submitTranslationConfirm {
|
||||
my ($sth, %data, $submission);
|
||||
tie %data, 'Tie::CPHash';
|
||||
$submission = "#Translation export for WebGUI ".$WebGUI::Version.".\n\n";
|
||||
$submission .= "#language\n\n";
|
||||
$submission .= "delete from language where languageId=".$session{form}{lid}.";\n";
|
||||
$sth = WebGUI::SQL->read("select * from language where languageId=".$session{form}{lid});
|
||||
while (%data = $sth->hash) {
|
||||
$submission .= "insert into language (languageId,language,characterSet) values ("
|
||||
.$data{languageId}.", ".quote($data{language}).", ".quote($data{characterSet}).");\n";
|
||||
}
|
||||
$sth->finish;
|
||||
$submission .= "\n#international\n\n";
|
||||
$submission .= "delete from international where languageId=".$session{form}{lid}.";\n";
|
||||
$sth = WebGUI::SQL->read("select * from international where languageId=".$session{form}{lid});
|
||||
while (%data = $sth->hash) {
|
||||
$submission .= "insert into international (internationalId,languageId,namespace,message) values ("
|
||||
.$data{internationalId}.",".$data{languageId}.",".quote($data{namespace}).",".quote($data{message}).");\n";
|
||||
}
|
||||
$sth->finish;
|
||||
WebGUI::Mail::send("info\@plainblack.com","International Message Submission",$submission);
|
||||
WebGUI::Mail::send("info\@plainblack.com","International Message Submission",_export($session{form}{lid}));
|
||||
return www_editLanguage();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue