Add POD to 1 Asset and 7 Operations.
Internationalized a label in Operation::LoginHistory
This commit is contained in:
parent
c02a3019c2
commit
4206828715
9 changed files with 256 additions and 1 deletions
|
|
@ -21,6 +21,51 @@ use WebGUI::Asset::Wobject;
|
|||
|
||||
our @ISA = qw(WebGUI::Asset::Wobject);
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Package WebGUI::Asset::Wobject::Article
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Asset to display content to the user. Most content in WebGUI sites
|
||||
will be Articles.
|
||||
|
||||
Articles are Wobjects, so they inherit all the methods and properties of
|
||||
Wobjects.
|
||||
|
||||
=head2 definition ( $class, $definition )
|
||||
|
||||
This method defines all properties of an Article and is used to autogenerate
|
||||
most methods used by the Article.
|
||||
|
||||
=head3 $class
|
||||
|
||||
$class is used to make sure that inheritance works on Assets and Wobjects.
|
||||
|
||||
=head3 $definition
|
||||
|
||||
Definition hashref from subclasses.
|
||||
|
||||
=head3 Article specific properties
|
||||
|
||||
=over 4
|
||||
|
||||
=item templateId
|
||||
|
||||
ID of a tempate from the Article namespace to display the contents of the Article.
|
||||
|
||||
=item linkTitle
|
||||
|
||||
The text displayed to the user as a hyperlink to the linkURL.
|
||||
|
||||
=item convertCarriageReturns
|
||||
|
||||
A boolean. If set to true, all newlines will be converted to Break tags so that simple
|
||||
text will come out formatted as paragraphs.
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub definition {
|
||||
|
|
@ -75,6 +120,14 @@ sub definition {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 view ( )
|
||||
|
||||
view defines all template variables, processes the template and
|
||||
returns the output.
|
||||
|
||||
=cut
|
||||
|
||||
sub view {
|
||||
my $self = shift;
|
||||
my %var;
|
||||
|
|
|
|||
|
|
@ -21,7 +21,26 @@ use WebGUI::Privilege;
|
|||
use WebGUI::Session;
|
||||
use WebGUI::SQL;
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Package WebGUI::Operations::ActiveSessions
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Operation handler for displaying and killing active sessions.
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_killSession ( )
|
||||
|
||||
This method can be called directly, but is usually called
|
||||
from www_viewActiveSessions. It ends the active session in
|
||||
$session{form}{sid}. Afterwards, it calls www_viewActiveSessions.
|
||||
|
||||
=cut
|
||||
|
||||
sub www_killSession {
|
||||
return www_viewActiveSessions() if $session{form}{sid} eq $session{var}{sessionId};
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
|
||||
|
|
@ -30,6 +49,14 @@ sub www_killSession {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_viewActiveSessions ( )
|
||||
|
||||
Display a list of all active user sessions, along with an icon to
|
||||
delete (kill) each one via www_killSession
|
||||
|
||||
=cut
|
||||
|
||||
sub www_viewActiveSessions {
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
|
||||
my ($output, $p, @row, $i, $sth, %data);
|
||||
|
|
|
|||
|
|
@ -15,7 +15,24 @@ use WebGUI::AdminConsole;
|
|||
use WebGUI::Grouping;
|
||||
use WebGUI::Session;
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Package WebGUI::Operation::Admin
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Operation handler for admin functions
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_adminConsole ( )
|
||||
|
||||
If the current user is in the Turn On Admin Group, then return an Admin Console.
|
||||
|
||||
=cut
|
||||
|
||||
sub www_adminConsole {
|
||||
return "" unless (WebGUI::Grouping::isInGroup(12));
|
||||
my $ac = WebGUI::AdminConsole->new;
|
||||
|
|
@ -23,6 +40,15 @@ sub www_adminConsole {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_switchOffAdmin ( )
|
||||
|
||||
If the current user is in the Turn On Admin Group, then allow them to turn off Admin mode
|
||||
via WebGUI::Session::switchAdminOff()
|
||||
|
||||
|
||||
=cut
|
||||
|
||||
sub www_switchOffAdmin {
|
||||
return "" unless (WebGUI::Grouping::isInGroup(12));
|
||||
WebGUI::Session::switchAdminOff();
|
||||
|
|
@ -30,6 +56,14 @@ sub www_switchOffAdmin {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_adminConsole ( )
|
||||
|
||||
If the current user is in the Turn On Admin Group, then allow them to turn on Admin mode.
|
||||
via WebGUI::Session::switchAdminOn()
|
||||
|
||||
=cut
|
||||
|
||||
sub www_switchOnAdmin {
|
||||
return "" unless (WebGUI::Grouping::isInGroup(12));
|
||||
WebGUI::Session::switchAdminOn();
|
||||
|
|
|
|||
|
|
@ -49,6 +49,16 @@ sub getInstance {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_auth ( )
|
||||
|
||||
This subroutine does authentication dispatch. It looks up the authentication method for
|
||||
the current user, makes sure that it supports the operation that has been requested,
|
||||
and then executes it. If an illegal method was requested, then an error message
|
||||
is returned.
|
||||
|
||||
=cut
|
||||
|
||||
sub www_auth {
|
||||
my $auth;
|
||||
($auth) = WebGUI::SQL->quickArray("select authMethod from users where username=".quote($session{form}{username})) if($session{form}{username});
|
||||
|
|
|
|||
|
|
@ -18,7 +18,34 @@ use WebGUI::Privilege;
|
|||
use WebGUI::Session;
|
||||
use WebGUI::Form;
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Package WebGUI::Operation::Cache
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Operational handler for caching functions.
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 _submenu ( $workarea [,$title ] )
|
||||
|
||||
Internal subroutine for rendering output with an Admin Console. Returns
|
||||
the rendered output.
|
||||
|
||||
=head3 $workarea
|
||||
|
||||
The output that should be wrapped with an Admin Console.
|
||||
|
||||
=head3 $title
|
||||
|
||||
An optional title for the Admin Console. If it evaluates to true, the title
|
||||
is looked up in the i18n table in the WebGUI namespace.
|
||||
|
||||
=cut
|
||||
|
||||
sub _submenu {
|
||||
my $workarea = shift;
|
||||
my $title = shift;
|
||||
|
|
@ -32,6 +59,20 @@ sub _submenu {
|
|||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_flushCache ( duration )
|
||||
|
||||
|
||||
This method can be called directly, but is usually called from
|
||||
www_manageCache. It flushes the cache. Afterwards, it calls
|
||||
www_manageCache.
|
||||
|
||||
=head3 duration
|
||||
|
||||
Text description of how long the subscription lasts.
|
||||
|
||||
=cut
|
||||
|
||||
sub www_flushCache {
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
|
||||
my $cache = WebGUI::Cache->new();
|
||||
|
|
@ -40,6 +81,14 @@ sub www_flushCache {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_manageCache ( )
|
||||
|
||||
Display information about the current cache type and cache statistics. Also
|
||||
provides an option to clear the cache.
|
||||
|
||||
=cut
|
||||
|
||||
sub www_manageCache {
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
|
||||
my ($output, $data);
|
||||
|
|
|
|||
|
|
@ -20,15 +20,30 @@ use WebGUI::Privilege;
|
|||
use WebGUI::Session;
|
||||
use WebGUI::SQL;
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Package WebGUI::Operation::LoginHistory
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_viewLoginHistory ( )
|
||||
|
||||
Display the login history for all users by when they logged in.
|
||||
The login history is a table of username, userId, status, login date,
|
||||
IP address they logged in from and what browser (really userAgent)
|
||||
they used.
|
||||
|
||||
=cut
|
||||
|
||||
sub www_viewLoginHistory {
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
|
||||
my ($output, $p, @row, $i, $sth, %data);
|
||||
tie %data, 'Tie::CPHash';
|
||||
$sth = WebGUI::SQL->read("select * from users,userLoginLog where users.userId=userLoginLog.userId order by userLoginLog.timeStamp desc");
|
||||
while (%data = $sth->hash) {
|
||||
$data{username} = 'unknown user' if ($data{userId} eq "0");
|
||||
$data{username} = WebGUI::International::get('unknown user') if ($data{userId} eq "0");
|
||||
$row[$i] = '<tr class="tableData"><td>'.$data{username}.' ('.$data{userId}.')</td>';
|
||||
$row[$i] .= '<td>'.$data{status}.'</td>';
|
||||
$row[$i] .= '<td>'.epochToHuman($data{timeStamp},"%H:%n%p %M/%D/%y").'</td>';
|
||||
|
|
|
|||
|
|
@ -13,13 +13,41 @@ package WebGUI::Operation::Scratch;
|
|||
use strict;
|
||||
use WebGUI::Session;
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Package WebGUI::Operation::Scratch
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Operations that provide access to the scratch area of the session variable.
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_deleteScratch ( )
|
||||
|
||||
Delete a variable from the session scratch area by setting a form
|
||||
variable, scratchName.
|
||||
|
||||
=cut
|
||||
|
||||
sub www_deleteScratch {
|
||||
WebGUI::Session::deleteScratch("www_".$session{form}{scratchName});
|
||||
return "";
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_deleteScratch ( )
|
||||
|
||||
|
||||
Delete a variable from the session scratch area by setting forms
|
||||
variables, scratchName, the name of the variable to set, and scratchValue,
|
||||
the value the variable should take.
|
||||
|
||||
=cut
|
||||
|
||||
sub www_setScratch {
|
||||
WebGUI::Session::setScratch("www_".$session{form}{scratchName},$session{form}{scratchValue});
|
||||
return "";
|
||||
|
|
|
|||
|
|
@ -17,7 +17,25 @@ use WebGUI::Privilege;
|
|||
use WebGUI::Session;
|
||||
use WebGUI::URL;
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Package WebGUI::Operation::Style
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Operation for overriding styles in Assets.
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_makePrintable ( )
|
||||
|
||||
Copy $session{form}{styleId} to printableStyleId and set the makePrintable flag so that
|
||||
the printableStyleId is used instead of the normal styleId for the page.
|
||||
|
||||
=cut
|
||||
|
||||
sub www_makePrintable {
|
||||
if ($session{form}{styleId} ne "") {
|
||||
$session{page}{printableStyleId} = $session{form}{styleId};
|
||||
|
|
@ -26,13 +44,29 @@ sub www_makePrintable {
|
|||
return "";
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_setPersonalStyle ( )
|
||||
|
||||
Sets personalStyleId in the scratch area of the session variable. This allows
|
||||
overriding the style without setting a printable style and on a per user basis.
|
||||
|
||||
=cut
|
||||
|
||||
sub www_setPersonalStyle {
|
||||
WebGUI::Session::setScratch("personalStyleId",$session{form}{styleId});
|
||||
return "";
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_unsetPersonalStyle ( )
|
||||
|
||||
Clears the personalStyleId from the scratch area of the session variable.
|
||||
|
||||
=cut
|
||||
|
||||
sub www_unsetPersonalStyle {
|
||||
WebGUI::Session::deleteScratch("personalStyleId");
|
||||
return "";
|
||||
|
|
|
|||
|
|
@ -3845,6 +3845,11 @@ Message Boards hold forums for users. There are many different Wobjects in WebG
|
|||
lastUpdated => 1131246512,
|
||||
},
|
||||
|
||||
'unknown user' => {
|
||||
message => q|unknown user|,
|
||||
lastUpdated => 1135205716,
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
1;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue