new i18n api requiring $session
This commit is contained in:
parent
877bf082a0
commit
01d95a265e
141 changed files with 2266 additions and 1745 deletions
|
|
@ -51,10 +51,11 @@ sub process {
|
|||
tie %hash, "Tie::IxHash";
|
||||
tie %hash2, "Tie::IxHash";
|
||||
tie %cphash, "Tie::CPHash";
|
||||
my $i18n = WebGUI::International->new($session,'Macro_AdminBar');
|
||||
$var{'packages.canAdd'} = ($session->user->profileField("uiLevel") >= 7);
|
||||
$var{'packages.label'} = WebGUI::International::get(376,'Macro_AdminBar');
|
||||
$var{'contentTypes.label'} = WebGUI::International::get(1083,'Macro_AdminBar');
|
||||
$var{'clipboard.label'} = WebGUI::International::get(1082,'Macro_AdminBar');
|
||||
$var{'packages.label'} = $i18n->get(376);
|
||||
$var{'contentTypes.label'} = $i18n->get(1083);
|
||||
$var{'clipboard.label'} = $i18n->get(1082);
|
||||
if ($session->asset) {
|
||||
foreach my $package (@{$session->asset->getPackageList}) {
|
||||
my $title = $package->getTitle;
|
||||
|
|
@ -82,7 +83,7 @@ sub process {
|
|||
#--admin functions
|
||||
$var{adminConsole_loop} = WebGUI::AdminConsole->getAdminFunction;
|
||||
return WebGUI::Asset::Template->new($session,$templateId)->process(\%var);
|
||||
# 'http://validator.w3.org/check?uri=referer'=>WebGUI::International::get(399,'Macro_AdminBar'),
|
||||
# 'http://validator.w3.org/check?uri=referer'=>$i18n->get(399),
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -50,8 +50,9 @@ sub process {
|
|||
if ($session->user->isInGroup(12)) {
|
||||
my %var;
|
||||
my ($turnOn,$turnOff,$templateName) = @_;
|
||||
$turnOn ||= WebGUI::International::get(516,'Macro_AdminToggle');
|
||||
$turnOff ||= WebGUI::International::get(517,'Macro_AdminToggle');
|
||||
my $i18n = WebGUI::International->new($session,'Macro_AdminToggle');
|
||||
$turnOn ||= $i18n->get(516);
|
||||
$turnOff ||= $i18n->get(517);
|
||||
if ($session->var->isAdminOn) {
|
||||
$var{'toggle.url'} = $session->url->page('op=switchOffAdmin');
|
||||
$var{'toggle.text'} = $turnOff;
|
||||
|
|
|
|||
|
|
@ -48,7 +48,8 @@ sub process {
|
|||
$output .= "AssetProxy:".Time::HiRes::tv_interval($t) if ($session->errorHandler->canShowPerformanceIndicators());
|
||||
return $output;
|
||||
} else {
|
||||
return WebGUI::International::get('invalid url', 'Macro_AssetProxy');
|
||||
my $i18n = WebGUI::International->new($session, 'Macro_AssetProxy');
|
||||
return $i18n->get('invalid url');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -53,8 +53,9 @@ sub process {
|
|||
if (exists $session->asset && $session->asset->canEdit && $session->user->isInGroup(12)) {
|
||||
my %var;
|
||||
my @param = @_;
|
||||
my $turnOn = $param[0] || WebGUI::International::get(516,'Macro_EditableToggle');
|
||||
my $turnOff = $param[1] || WebGUI::International::get(517,'Macro_EditableToggle');
|
||||
my $i18n = WebGUI::International->new($session,'Macro_EditableToggle');
|
||||
my $turnOn = $param[0] || $i18n->get(516);
|
||||
my $turnOff = $param[1] || $i18n->get(517);
|
||||
if ($session->var->get("adminOn")) {
|
||||
$var{'toggle.url'} = $session->url->page('op=switchOffAdmin');
|
||||
$var{'toggle.text'} = $turnOff;
|
||||
|
|
|
|||
|
|
@ -36,7 +36,8 @@ sub process {
|
|||
my $session = shift;
|
||||
my @param = @_;
|
||||
if ($param[0] =~ /passwd/ || $param[0] =~ /shadow/ || $param[0] =~ /\.conf/) {
|
||||
return WebGUI::International::get('execute error', 'Macro_Execute');
|
||||
my $i18n = WebGUI::International->new($session, 'Macro_Execute');
|
||||
return $i18n->get('execute error');
|
||||
} else {
|
||||
return `$param[0]`;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,7 +47,8 @@ sub process {
|
|||
my $storage = WebGUI::Storage->get($asset->get("storageId"));
|
||||
return $storage->getUrl($asset->get("filename"));
|
||||
} else {
|
||||
return WebGUI::International::get('invalid url', 'Macro_FileUrl');
|
||||
my $i18n = WebGUI::International->new($session, 'Macro_FileUrl');
|
||||
return $i18n->get('invalid url');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -51,7 +51,8 @@ sub process {
|
|||
if ($label ne "") {
|
||||
$var{'homeLink.text'} = $label;
|
||||
} else {
|
||||
$var{'homeLink.text'} = WebGUI::International::get(47,'Macro_H_homeLink');
|
||||
my $i18n = WebGUI::International->new($session,'Macro_H_homeLink');
|
||||
$var{'homeLink.text'} = $i18n->get(47);
|
||||
}
|
||||
if ($templateUrl) {
|
||||
return WebGUI::Asset::Template->newByUrl($session,$templateUrl)->process(\%var);
|
||||
|
|
|
|||
|
|
@ -39,8 +39,9 @@ sub process {
|
|||
my $self = shift;
|
||||
my (@param, $temp, $file);
|
||||
@param = @_;
|
||||
my $i18n = WebGUI::International->new($session,'Macro_Include');
|
||||
if ($param[0] =~ /passwd/ || $param[0] =~ /shadow/ || $param[0] =~ /WebGUI.conf/) {
|
||||
$temp = WebGUI::International::get('security','Macro_Include');
|
||||
$temp = $i18n->get('security');
|
||||
} else {
|
||||
$file = FileHandle->new($param[0],"r");
|
||||
if ($file) {
|
||||
|
|
@ -49,7 +50,7 @@ sub process {
|
|||
}
|
||||
$file->close;
|
||||
} else {
|
||||
$temp = WebGUI::International::get('not found','Macro_Include');
|
||||
$temp = $i18n->get('not found');
|
||||
}
|
||||
}
|
||||
return $temp;
|
||||
|
|
|
|||
|
|
@ -40,8 +40,9 @@ The namespace to pull the label from.
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub process {
|
||||
my $self = shift;
|
||||
return WebGUI::International::get(shift,shift);
|
||||
my ($self, $session, $key, $namespace) = @_;
|
||||
my $i18n = WebGUI::International->new($session);
|
||||
return $i18n->get($key, $namespace);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -65,13 +65,14 @@ sub process {
|
|||
my @param = @_;
|
||||
my $templateId = $param[2] || "PBtmpl0000000000000044";
|
||||
my %var;
|
||||
my $i18n = WebGUI::International->new($session,'Macro_L_loginBox');
|
||||
$var{'user.isVisitor'} = ($session->user->profileField("userId") eq "1");
|
||||
$var{'customText'} = $param[1];
|
||||
$var{'customText'} =~ s/%(.*?)%/_createURL($session,$1)/ge;
|
||||
$var{'hello.label'} = WebGUI::International::get(48,'Macro_L_loginBox');
|
||||
$var{'hello.label'} = $i18n->get(48);
|
||||
$var{'logout.url'} = $session->url->page("op=auth;method=logout");
|
||||
$var{'account.display.url'} = $session->url->page('op=auth;method=displayAccount');
|
||||
$var{'logout.label'} = WebGUI::International::get(49,'Macro_L_loginBox');
|
||||
$var{'logout.label'} = $i18n->get(49);
|
||||
my $boxSize = $param[0];
|
||||
$boxSize = 12 unless ($boxSize);
|
||||
if (index(lc($session->env->get("HTTP_USER_AGENT")),"msie") < 0) {
|
||||
|
|
@ -91,24 +92,24 @@ sub process {
|
|||
name=>"method",
|
||||
value=>"login"
|
||||
});
|
||||
$var{'username.label'} = WebGUI::International::get(50);
|
||||
$var{'username.label'} = $i18n->get(50, 'WebGUI');
|
||||
$var{'username.form'} = WebGUI::Form::text({
|
||||
name=>"username",
|
||||
size=>$boxSize,
|
||||
extras=>'class="loginBoxField"'
|
||||
});
|
||||
$var{'password.label'} = WebGUI::International::get(51);
|
||||
$var{'password.label'} = $i18n->get(51, 'WebGUI');
|
||||
$var{'password.form'} = WebGUI::Form::password({
|
||||
name=>"identifier",
|
||||
size=>$boxSize,
|
||||
extras=>'class="loginBoxField"'
|
||||
});
|
||||
$var{'form.login'} = WebGUI::Form::submit({
|
||||
value=>WebGUI::International::get(52),
|
||||
value=>$i18n->get(52, 'WebGUI'),
|
||||
extras=>'class="loginBoxButton"'
|
||||
});
|
||||
$var{'account.create.url'} = $session->url->page('op=auth;method=createAccount');
|
||||
$var{'account.create.label'} = WebGUI::International::get(407);
|
||||
$var{'account.create.label'} = $i18n->get(407, 'WebGUI');
|
||||
$var{'form.footer'} = WebGUI::Form::formFooter($session,);
|
||||
return WebGUI::Asset::Template->new($session,$templateId)->process(\%var);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,7 +46,8 @@ sub process {
|
|||
($label, $format) = @_;
|
||||
$format = '%z' if ($format eq "");
|
||||
($time) = $session->dbSlave->quickArray("SELECT max(revisionDate) FROM assetData where assetId=".$session->db->quote($session->asset->getId));
|
||||
return WebGUI::International::get('never','Macro_LastModified') if $time eq 0;
|
||||
my $i18n = WebGUI::International->new($session,'Macro_LastModified');
|
||||
return $i18n->get('never') if $time eq 0;
|
||||
return $label$session->datetime->epochToHuman($time,$format) if ($time);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -46,8 +46,9 @@ The ID of a template for custom layout of the link and text.
|
|||
#-------------------------------------------------------------------
|
||||
sub process {
|
||||
my @param = @_;
|
||||
my $login = $param[0] || WebGUI::International::get(716,'Macro_LoginToggle');
|
||||
my $logout = $param[1] || WebGUI::International::get(717,'Macro_LoginToggle');
|
||||
my $i18n = WebGUI::International->new($session,'Macro_LoginToggle');
|
||||
my $login = $param[0] || $i18n->get(716);
|
||||
my $logout = $param[1] || $i18n->get(717);
|
||||
my %var;
|
||||
if ($session->user->profileField("userId") eq '1') {
|
||||
return $session->url->page("op=auth;method=init") if ($param[0] eq "linkonly");
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ if no asset exists at that url, or if the asset has no children.
|
|||
sub process {
|
||||
my $session = shift;
|
||||
my $url = shift;
|
||||
my $i18n = WebGUI::International->new($session,'Macro_RandomAssetProxy');
|
||||
my $asset = WebGUI::Asset->newByUrl($session, $url);
|
||||
if (defined $asset) {
|
||||
my $children = $asset->getLineage(["children"]);
|
||||
|
|
@ -47,10 +48,10 @@ sub process {
|
|||
$randomAsset->toggleToolbar;
|
||||
return $randomAsset->canView ? $randomAsset->view() : undef;
|
||||
} else {
|
||||
return WebGUI::International::get('childless','Macro_RandomAssetProxy');
|
||||
return $i18n->get('childless');
|
||||
}
|
||||
} else {
|
||||
return WebGUI::International::get('invalid url','Macro_RandomAssetProxy');
|
||||
return $i18n->get('invalid url');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -41,11 +41,12 @@ sub process {
|
|||
my $session = shift;
|
||||
my ($output, @data, $rownum, $temp);
|
||||
my ($statement, $format) = @_;
|
||||
my $i18n = WebGUI::International->new($session,'Macro_SQL');
|
||||
$format = '^0;' if ($format eq "");
|
||||
if ($statement =~ /^\s*select/i || $statement =~ /^\s*show/i || $statement =~ /^\s*describe/i) {
|
||||
my $sth = $session->dbSlave->unconditionalRead($statement);
|
||||
unless ($sth->errorCode < 1) {
|
||||
return sprintf WebGUI::International::get('sql error','Macro_SQL'), $sth->errorMessage;
|
||||
return sprintf $i18n->get('sql error'), $sth->errorMessage;
|
||||
} else {
|
||||
while (@data = $sth->array) {
|
||||
$temp = $format;
|
||||
|
|
@ -58,7 +59,7 @@ sub process {
|
|||
return $output;
|
||||
}
|
||||
} else {
|
||||
return WebGUI::International::get('illegal query','Macro_SQL');
|
||||
return $i18n->get('illegal query');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -40,11 +40,12 @@ A template to use for formatting the link.
|
|||
#-------------------------------------------------------------------
|
||||
sub process {
|
||||
my $session = shift;
|
||||
my %var;
|
||||
my @param = @_;
|
||||
my %var;
|
||||
my @param = @_;
|
||||
return $session->url->page("op=auth;method=init") if ($param[0] eq "linkonly");
|
||||
$var{'account.url'} = $session->url->page('op=auth;method=init');
|
||||
$var{'account.text'} = $param[0] || WebGUI::International::get(46,'Macro_a_account');
|
||||
my $i18n = WebGUI::International->new($session,'Macro_a_account');
|
||||
$var{'account.url'} = $session->url->page('op=auth;method=init');
|
||||
$var{'account.text'} = $param[0] || $i18n->get(46);
|
||||
if ($param[1]) {
|
||||
return WebGUI::Asset::Template->newByUrl($session,$param[1])->process(\%var);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -68,7 +68,8 @@ sub process {
|
|||
if ($param[0] ne "") {
|
||||
$var{'printable.text'} = $param[0];
|
||||
} else {
|
||||
$var{'printable.text'} = WebGUI::International::get(53,'Macro_r_printable');
|
||||
my $i18n = WebGUI::International->new($session,'Macro_r_printable');
|
||||
$var{'printable.text'} = $i18n->get(53);
|
||||
}
|
||||
if ($param[2]) {
|
||||
$temp = WebGUI::Asset::Template->newByUrl($session,$param[2])->process(\%var);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue