Replaced the account.options loop in the displayAccount auth methods with new macros for displaying deactivate account and back to site links. Another macro which allows text to be displayed according to whether the value passed in is empty or not was added to allow functionality similar to that which currently exists.
This commit is contained in:
parent
d91bc5754d
commit
32979d75e1
13 changed files with 175 additions and 82 deletions
62
lib/WebGUI/Macro/DeactivateAccount.pm
Normal file
62
lib/WebGUI/Macro/DeactivateAccount.pm
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
package WebGUI::Macro::DeactivateAccount;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001-2008 Plain Black Corporation.
|
||||
#-------------------------------------------------------------------
|
||||
# Please read the legal notices (docs/legal.txt) and the license
|
||||
# (docs/license.txt) that came with this distribution before using
|
||||
# this software.
|
||||
#-------------------------------------------------------------------
|
||||
# http://www.plainblack.com info@plainblack.com
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
use strict;
|
||||
use WebGUI::International;
|
||||
use WebGUI::Asset::Template;
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Package WebGUI::Macro::DeactivateAccount
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Macro for displaying a url to the user for deactivating their account, if
|
||||
the setting is turned on.
|
||||
|
||||
=head2 process ( [deactivateText, template ] )
|
||||
|
||||
process takes two optional parameters for customizing the content and layout
|
||||
of the self deactivation link.
|
||||
|
||||
=head3 deactivateText
|
||||
|
||||
The text displayed to the user for this link. If this is blank an internationalized default is used.
|
||||
|
||||
=head3 template
|
||||
|
||||
The url for a template from the Macro/DeactivateAccount namespace to use for formatting the link.
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub process {
|
||||
my $session = shift;
|
||||
my ($deactivateText, $templateName) = @_;
|
||||
|
||||
return "" unless ($session->setting->get("selfDeactivation") && !$session->user->isAdmin);
|
||||
|
||||
my $i18n = WebGUI::International->new($session);
|
||||
my $var = {};
|
||||
|
||||
$var->{'self_deactivation_url' } = $session->url->page('op=auth;method=deactivateAccount');
|
||||
$var->{'self_deactivation_text'} = $deactivateText || $i18n->get(65);
|
||||
|
||||
my $template = $templateName ? WebGUI::Asset::Template->newByUrl($session, $templateName)
|
||||
: WebGUI::Asset::Template->new($session, "CocyDcs-NqmKtPy0Bs_vUA")
|
||||
;
|
||||
return $template->process($var);
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue