more session conversion
This commit is contained in:
parent
de50e9b49c
commit
657ae8baf7
15 changed files with 46 additions and 43 deletions
|
|
@ -52,11 +52,11 @@ sub process {
|
|||
my ($turnOn,$turnOff,$templateName) = @_;
|
||||
$turnOn ||= WebGUI::International::get(516,'Macro_AdminToggle');
|
||||
$turnOff ||= WebGUI::International::get(517,'Macro_AdminToggle');
|
||||
if (WebGUI::Session::isAdminOn()) {
|
||||
$var{'toggle.url'} = WebGUI::URL::page('op=switchOffAdmin');
|
||||
if ($session->var->isAdminOn) {
|
||||
$var{'toggle.url'} = $session->url->page('op=switchOffAdmin');
|
||||
$var{'toggle.text'} = $turnOff;
|
||||
} else {
|
||||
$var{'toggle.url'} = WebGUI::URL::page('op=switchOnAdmin');
|
||||
$var{'toggle.url'} = $session->url->page('op=switchOnAdmin');
|
||||
$var{'toggle.text'} = $turnOn;
|
||||
}
|
||||
if ($templateName) {
|
||||
|
|
|
|||
|
|
@ -56,10 +56,10 @@ sub process {
|
|||
my $turnOn = $param[0] || WebGUI::International::get(516,'Macro_EditableToggle');
|
||||
my $turnOff = $param[1] || WebGUI::International::get(517,'Macro_EditableToggle');
|
||||
if ($session->var->get("adminOn")) {
|
||||
$var{'toggle.url'} = WebGUI::URL::page('op=switchOffAdmin');
|
||||
$var{'toggle.url'} = $session->url->page('op=switchOffAdmin');
|
||||
$var{'toggle.text'} = $turnOff;
|
||||
} else {
|
||||
$var{'toggle.url'} = WebGUI::URL::page('op=switchOnAdmin');
|
||||
$var{'toggle.url'} = $session->url->page('op=switchOnAdmin');
|
||||
$var{'toggle.text'} = $turnOn;
|
||||
}
|
||||
if ($param[2]) {
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ sub process {
|
|||
return "" unless ($g->autoAdd);
|
||||
return "" if (WebGUI::Grouping::isInGroup($g->groupId));
|
||||
my %var = ();
|
||||
$var{'group.url'} = WebGUI::URL::page("op=autoAddToGroup;groupId=".$g->groupId);
|
||||
$var{'group.url'} = $session->url->page("op=autoAddToGroup;groupId=".$g->groupId);
|
||||
$var{'group.text'} = $param[1];
|
||||
if ($param[2]) {
|
||||
return WebGUI::Asset::Template->newByUrl($session,$param[2])->process(\%var);
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ sub process {
|
|||
return "" unless ($g->autoDelete);
|
||||
return "" unless (WebGUI::Grouping::isInGroup($g->groupId));
|
||||
my %var = ();
|
||||
$var{'group.url'} = WebGUI::URL::page("op=autoDeleteFromGroup;groupId=".$g->groupId);
|
||||
$var{'group.url'} = $session->url->page("op=autoDeleteFromGroup;groupId=".$g->groupId);
|
||||
$var{'group.text'} = $param[1];
|
||||
if ($param[2]) {
|
||||
return WebGUI::Asset::Template->newByUrl($session,$param[2])->process(\%var);
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ text to wrap in a link for logging out.
|
|||
sub _createURL {
|
||||
my $session = shift;
|
||||
my $text = shift;
|
||||
return '<a href="'.WebGUI::URL::page("op=auth;method=logout").'">'.$text.'</a>';
|
||||
return '<a href="'.$session->url->page("op=auth;method=logout").'">'.$text.'</a>';
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -69,8 +69,8 @@ sub process {
|
|||
$var{'customText'} = $param[1];
|
||||
$var{'customText'} =~ s/%(.*?)%/_createURL($session,$1)/ge;
|
||||
$var{'hello.label'} = WebGUI::International::get(48,'Macro_L_loginBox');
|
||||
$var{'logout.url'} = WebGUI::URL::page("op=auth;method=logout");
|
||||
$var{'account.display.url'} = WebGUI::URL::page('op=auth;method=displayAccount');
|
||||
$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');
|
||||
my $boxSize = $param[0];
|
||||
$boxSize = 12 unless ($boxSize);
|
||||
|
|
@ -79,7 +79,7 @@ sub process {
|
|||
}
|
||||
my $action;
|
||||
if ($session->setting->get("encryptLogin")) {
|
||||
$action = WebGUI::URL::page(undef,1);
|
||||
$action = $session->url->page(undef,1);
|
||||
$action =~ s/http:/https:/;
|
||||
}
|
||||
$var{'form.header'} = WebGUI::Form::formHeader({action=>$action})
|
||||
|
|
@ -107,7 +107,7 @@ sub process {
|
|||
value=>WebGUI::International::get(52),
|
||||
extras=>'class="loginBoxButton"'
|
||||
});
|
||||
$var{'account.create.url'} = WebGUI::URL::page('op=auth;method=createAccount');
|
||||
$var{'account.create.url'} = $session->url->page('op=auth;method=createAccount');
|
||||
$var{'account.create.label'} = WebGUI::International::get(407);
|
||||
$var{'form.footer'} = WebGUI::Form::formFooter();
|
||||
return WebGUI::Asset::Template->new($session,$templateId)->process(\%var);
|
||||
|
|
|
|||
|
|
@ -12,9 +12,7 @@ package WebGUI::Macro::LoginToggle;
|
|||
|
||||
use strict;
|
||||
use WebGUI::International;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::Asset::Template;
|
||||
use WebGUI::URL;
|
||||
|
||||
=head1 NAME
|
||||
|
||||
|
|
@ -52,12 +50,12 @@ sub process {
|
|||
my $logout = $param[1] || WebGUI::International::get(717,'Macro_LoginToggle');
|
||||
my %var;
|
||||
if ($session->user->profileField("userId") eq '1') {
|
||||
return WebGUI::URL::page("op=auth;method=init") if ($param[0] eq "linkonly");
|
||||
$var{'toggle.url'} = WebGUI::URL::page('op=auth;method=init');
|
||||
return $session->url->page("op=auth;method=init") if ($param[0] eq "linkonly");
|
||||
$var{'toggle.url'} = $session->url->page('op=auth;method=init');
|
||||
$var{'toggle.text'} = $login;
|
||||
} else {
|
||||
return WebGUI::URL::page("op=auth;method=logout") if ($param[0] eq "linkonly");
|
||||
$var{'toggle.url'} = WebGUI::URL::page('op=auth;method=logout');
|
||||
return $session->url->page("op=auth;method=logout") if ($param[0] eq "linkonly");
|
||||
$var{'toggle.url'} = $session->url->page('op=auth;method=logout');
|
||||
$var{'toggle.text'} = $logout;
|
||||
}
|
||||
if ($param[2]) {
|
||||
|
|
|
|||
|
|
@ -22,14 +22,14 @@ Macro for displaying the url for the current asset.
|
|||
|
||||
=head2 process ( )
|
||||
|
||||
process is really a wrapper around WebGUI::URL::page();
|
||||
process is really a wrapper around $session->url->page();
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub process {
|
||||
my $session = shift;
|
||||
return WebGUI::URL::page();
|
||||
return $session->url->page();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ sub process {
|
|||
'variant.weight' => $_->{weight},
|
||||
'variant.sku' => $_->{sku},
|
||||
'variant.compositionLoop' => \@compositionLoop,
|
||||
'variant.addToCart.url' => WebGUI::URL::page('op=addToCart;itemType=Product;itemId='.$_->{variantId}),
|
||||
'variant.addToCart.url' => $session->url->page('op=addToCart;itemType=Product;itemId='.$_->{variantId}),
|
||||
'variant.addToCart.label' => WebGUI::International::get('add to cart', 'Macro_Product'),
|
||||
}) if ($_->{available});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,14 +22,14 @@ Macro for returning the gateway URL (defined in the WebGUI config file) to the s
|
|||
|
||||
=head2 process ( )
|
||||
|
||||
process is really a wrapper around WebGUI::URL::gateway();
|
||||
process is really a wrapper around $session->url->gateway();
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub process {
|
||||
my $session = shift;
|
||||
return WebGUI::URL::gateway();
|
||||
return $session->url->gateway();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ sub process {
|
|||
my ($subscriptionId, $templateId, %var);
|
||||
($subscriptionId, $templateId) = @_;
|
||||
%var = $session->db->quickHash('select * from subscription where subscriptionId='.$session->db->quote($subscriptionId));
|
||||
$var{url} = WebGUI::URL::page('op=purchaseSubscription;sid='.$subscriptionId);
|
||||
$var{url} = $session->url->page('op=purchaseSubscription;sid='.$subscriptionId);
|
||||
return WebGUI::Asset::Template->new($session,$templateId || "PBtmpl0000000000000046")->process(\%var);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ The ID of the subscription item to purchase.
|
|||
|
||||
sub process {
|
||||
my $session = shift;
|
||||
return WebGUI::URL::page('op=purchaseSubscription;sid='.shift);
|
||||
return $session->url->page('op=purchaseSubscription;sid='.shift);
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ Macro for URL encoding text.
|
|||
|
||||
=head2 process ( text )
|
||||
|
||||
process is really a wrapper around WebGUI::URL::escape;
|
||||
process is really a wrapper around $session->url->escape;
|
||||
of the account link.
|
||||
|
||||
=head3 text
|
||||
|
|
@ -34,7 +34,7 @@ The text to URL encode.
|
|||
#-------------------------------------------------------------------
|
||||
sub process {
|
||||
my $session = shift;
|
||||
return WebGUI::URL::escape(shift);
|
||||
return $session->url->escape(shift);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -42,8 +42,8 @@ sub process {
|
|||
my $session = shift;
|
||||
my %var;
|
||||
my @param = @_;
|
||||
return WebGUI::URL::page("op=auth;method=init") if ($param[0] eq "linkonly");
|
||||
$var{'account.url'} = WebGUI::URL::page('op=auth;method=init');
|
||||
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');
|
||||
if ($param[1]) {
|
||||
return WebGUI::Asset::Template->newByUrl($session,$param[1])->process(\%var);
|
||||
|
|
|
|||
|
|
@ -54,13 +54,13 @@ sub process {
|
|||
@param = @_;
|
||||
my $append = 'op=makePrintable';
|
||||
if ($session->env->get("REQUEST_URI") =~ /op\=/) {
|
||||
$append = 'op2='.WebGUI::URL::escape($append);
|
||||
$append = 'op2='.$session->url->escape($append);
|
||||
}
|
||||
$temp = WebGUI::URL::page($append);
|
||||
$temp = $session->url->page($append);
|
||||
$temp =~ s/\/\//\//;
|
||||
$temp = WebGUI::URL::append($temp,$session->env->get("QUERY_STRING"));
|
||||
$temp = $session->url->append($temp,$session->env->get("QUERY_STRING"));
|
||||
if ($param[1] ne "") {
|
||||
$temp = WebGUI::URL::append($temp,'styleId='.$param[1]);
|
||||
$temp = $session->url->append($temp,'styleId='.$param[1]);
|
||||
}
|
||||
if ($param[0] ne "linkonly") {
|
||||
my %var;
|
||||
|
|
|
|||
|
|
@ -17,14 +17,19 @@ package WebGUI::Session;
|
|||
use strict;
|
||||
use Apache2::Request;
|
||||
use WebGUI::Config;
|
||||
use WebGUI::ErrorHandler;
|
||||
use WebGUI::Id;
|
||||
use WebGUI::Cache;
|
||||
use WebGUI::Setting;
|
||||
use WebGUI::SQL;
|
||||
use WebGUI::User;
|
||||
use WebGUI::Utility;
|
||||
use URI::Escape;
|
||||
use WebGUI::Session::Env;
|
||||
use WebGUI::Session::ErrorHandler;
|
||||
use WebGUI::Session::Form;
|
||||
use WebGUI::Session::Http;
|
||||
use WebGUI::Session::Os;
|
||||
use WebGUI::Session::Scratch;
|
||||
use WebGUI::Session::Setting;
|
||||
use WebGUI::Session::Stow;
|
||||
use WebGUI::Session::Style;
|
||||
use WebGUI::Session::Url;
|
||||
use WebGUI::Session::Var;
|
||||
|
||||
|
||||
|
||||
|
|
@ -197,7 +202,7 @@ Returns a WebGUI::ErrorHandler object.
|
|||
sub errorHandler {
|
||||
my $self = shift;
|
||||
unless (exists $self->{_errorHandler}) {
|
||||
$self->{_errorHandler} = WebGUI::ErrorHandler->new($self);
|
||||
$self->{_errorHandler} = WebGUI::Session::ErrorHandler->new($self);
|
||||
}
|
||||
return $self-{_errorHandler};
|
||||
}
|
||||
|
|
@ -226,7 +231,7 @@ Returns a reference to the WebGUI::HTTP object.
|
|||
sub http {
|
||||
my $self = shift;
|
||||
unless ($self->{_http}) {
|
||||
$self->{_http} = WebGUI::HTTP->new($session);
|
||||
$self->{_http} = WebGUI::Session::Http->new($session);
|
||||
}
|
||||
return $self->{_http};
|
||||
}
|
||||
|
|
@ -344,7 +349,7 @@ Returns a WebGUI::Session object.
|
|||
sub setting {
|
||||
my $self = shift;
|
||||
unless (exists $self->{_setting}) {
|
||||
$self->{_setting} = WebGUI::Setting->new($self);
|
||||
$self->{_setting} = WebGUI::Session::Setting->new($self);
|
||||
}
|
||||
return $self->{_setting};
|
||||
}
|
||||
|
|
@ -377,7 +382,7 @@ Returns a WebGUI::Style object.
|
|||
sub style {
|
||||
my $self = shift;
|
||||
unless (exists $self->{_style}) {
|
||||
$self->{_style} = WebGUI::Style->new($self);
|
||||
$self->{_style} = WebGUI::Session::Style->new($self);
|
||||
}
|
||||
return $self->{_style}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue