The 4.6.7 bug fix cycle.

This commit is contained in:
JT Smith 2002-09-08 23:13:27 +00:00
parent a1a21aa1ee
commit c9dcb9dda1
9 changed files with 7467 additions and 7120 deletions

View file

@ -30,7 +30,8 @@ use WebGUI::URL;
use WebGUI::HTMLForm;
$f = WebGUI::HTMLForm->new;
$f->checkbox("toggleGadget","Turn Gadgets On?");
$f->checkbox("whichOne","Is red your favorite?","red");
$f->checkList("dayOfWeek",\%days,"Which day?");
$f->combo("fruit",\%fruit,"Choose a fruit or enter your own.");
$f->date("endDate","End Date",$endDate);
$f->email("emailAddress","Email Address");
@ -39,8 +40,11 @@ use WebGUI::URL;
$f->hidden("wid","55");
$f->HTMLArea("description","Description");
$f->integer("size","Size");
$f->interval("timeToLive","How long should this last?",12,"hours");
$f->password("identifier","Password");
$f->phone("cellPhone","Cell Phone");
$f->radio("whichOne","Is red your favorite?","red");
$f->radioList("dayOfWeek",\%days,"Which day?");
$f->raw("text");
$f->readOnly("34","Page ID");
$f->select("dayOfWeek",\%days,"Which day?");

View file

@ -32,7 +32,7 @@ sub _replacement {
if (not defined $text){
$temp .= WebGUI::International::get(48);
$temp .= ' <a href="'.WebGUI::URL::page('op=displayAccount').
'">'.$session{user}{username}.'</a>.';
'">'.$session{user}{username}.'</a>. ';
$temp .= WebGUI::International::get(49);
$temp = WebGUI::Macro::Backslash_pageUrl::process($temp);
} else {

View file

@ -158,9 +158,9 @@ sub www_editHelpSave {
$session{form}{seeAlso} = join(";",@seeAlso);
$session{form}{seeAlso} .= ';';
}
WebGUI::SQL->write("update international set message=".quote($session{form}{title})."
WebGUI::SQL->write("update international set message=".quote($session{form}{title}).", lastUpdated=".time()."
where internationalId=$session{form}{titleId} and languageId=1 and namespace=".quote($session{form}{namespace}));
WebGUI::SQL->write("update international set message=".quote($session{form}{body})."
WebGUI::SQL->write("update international set message=".quote($session{form}{body}).", lastUpdated=".time()."
where internationalId=$session{form}{bodyId} and languageId=1 and namespace=".quote($session{form}{namespace}));
WebGUI::SQL->write("update help set seeAlso=".quote($session{form}{seeAlso})."
where helpId=$session{form}{hid} and namespace=".quote($session{form}{namespace}));
@ -170,35 +170,18 @@ sub www_editHelpSave {
#-------------------------------------------------------------------
sub www_exportHelp {
if ($session{user}{userId} != 3) {
return "";
} else {
my ($export, $output, %help, %data, $sth);
$output = '<h1>Export Help</h1>';
$export = "#export of WebGUI ".$WebGUI::VERSION." help system.\n\n";
$sth = WebGUI::SQL->read("select * from help");
while (%help = $sth->hash) {
%data = WebGUI::SQL->quickHash("select * from international where internationalId=$help{titleId}"
." and languageId=1 and namespace=".quote($help{namespace}));
$export .= "delete from international where internationalId=$data{internationalId}"
." and namespace=".quote($data{namespace})." and languageId=1;\n";
$export .= "insert into international (internationalId,namespace,languageId,message) values ("
."$data{internationalId}, ".quote($data{namespace}).",1,".quote($data{message}).");\n";
%data = WebGUI::SQL->quickHash("select * from international where internationalId=$help{bodyId}"
." and languageId=1 and namespace=".quote($help{namespace}));
$export .= "delete from international where internationalId=$data{internationalId}"
." and namespace=".quote($data{namespace})." and languageId=1;\n";
$export .= "insert into international (internationalId,namespace,languageId,message) values ("
."$data{internationalId}, ".quote($data{namespace}).",1,".quote($data{message}).");\n";
$export .= "delete from help where helpId=$help{helpId} and namespace=".quote($help{namespace}).";\n";
$export .= "insert into help (helpId,namespace,titleId,bodyId,seeAlso) values ($help{helpId}, "
.quote($help{namespace}).", $help{titleId}, $help{bodyId}, ".quote($help{seeAlso}).");\n";
}
$sth->finish;
#$output .= '<form><textarea cols=80 rows=20>'.$export.'</textarea></form>';
$output .= "<p><pre>\n\n\n\n".$export."\n\n\n\n</pre><p>";
return $output;
return "" if ($session{user}{userId} != 3);
my ($export, $output, %help, $sth);
$export = "#export of WebGUI ".$WebGUI::VERSION." help system.\n\n";
$sth = WebGUI::SQL->read("select * from help");
while (%help = $sth->hash) {
$export .= "delete from help where helpId=$help{helpId} and namespace=".quote($help{namespace}).";\n";
$export .= "insert into help (helpId,namespace,titleId,bodyId,seeAlso) values ($help{helpId}, "
.quote($help{namespace}).", $help{titleId}, $help{bodyId}, ".quote($help{seeAlso}).");\n";
}
$sth->finish;
$session{header}{mimetype} = 'text/plain';
return $export;
}
#-------------------------------------------------------------------

View file

@ -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();
}

View file

@ -158,6 +158,7 @@ sub _loadWobjects {
sub close {
$session{'dbh'}->disconnect();
undef %session;
$ENV{PATH_INFO} = "/"; #work around to fix a bug in mod_perl (win32)
}
#-------------------------------------------------------------------
@ -174,7 +175,7 @@ sub httpHeader {
($charset) = WebGUI::SQL->quickArray("select characterSet from language where languageId=".$session{user}{language});
$charset = "ISO-8859-1" if ($charset eq "");
return $session{cgi}->header(
-type => 'text/html; charset='.$charset,
-type => $session{header}{mimetype}.'; charset='.$charset,
-cookie => $session{header}{cookie},
-status => $session{header}{status}
);
@ -218,6 +219,9 @@ sub open {
$session{cgi} = CGI->new();
$CGI::POST_MAX=1024 * $session{setting}{maxAttachmentSize};
###----------------------------
### header variables
$session{header}{mimetype} = 'text/html';
###----------------------------
### evironment variables from web server
$session{env} = \%ENV;
###----------------------------