Captcha forms are not allowed in Profiles (re JT)
POD for Operation/Help and Operation/DatabaseLink. Added check for deletion of a vital component in www_deleteDatabaseLink. This saves the user one click when trying to delete something they shouldn't.
This commit is contained in:
parent
782b181571
commit
9aac37ac91
3 changed files with 175 additions and 3 deletions
|
|
@ -62,9 +62,6 @@ sub definition {
|
|||
formName=>{
|
||||
defaultValue=>$i18n->get("topicName")
|
||||
},
|
||||
profileEnabled=>{
|
||||
defaultValue=>1
|
||||
},
|
||||
});
|
||||
return $class->SUPER::definition($session, $definition);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,39 @@ use WebGUI::AdminConsole;
|
|||
use WebGUI::DatabaseLink;
|
||||
use WebGUI::International;
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Package WebGUI::Operation::DatabaseLink
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Handles creating, managing and deleting Database Links via operations. Many
|
||||
of the subroutines here are wrappers around corresponding routines in WebGUI::Database.
|
||||
|
||||
=head2 _submenu ( $session, $workarea, $title, $help )
|
||||
|
||||
Utility routine for creating the AdminConsole for DatabaseLink functions.
|
||||
|
||||
=head3 $session
|
||||
|
||||
The current WebGUI session variable.
|
||||
|
||||
=head3 $workarea
|
||||
|
||||
The content to display to the user.
|
||||
|
||||
=head3 $title
|
||||
|
||||
The title of the Admin Console. This should be an entry in the i18n
|
||||
table in the WebGUI namespace.
|
||||
|
||||
=head3 $help
|
||||
|
||||
An entry in the Help system in the WebGUI namespace. This will be shown
|
||||
as a link to the user.
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub _submenu {
|
||||
my $session = shift;
|
||||
|
|
@ -38,6 +71,13 @@ sub _submenu {
|
|||
return $ac->render($workarea, $title);
|
||||
}
|
||||
|
||||
=head2 www_copyDatabaseLink ( $session )
|
||||
|
||||
Copies the requested database link in the form variable C<dlid> if the user
|
||||
is in group Admin (3). Returns the user to the List Database Links screen.
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_copyDatabaseLink {
|
||||
my $session = shift;
|
||||
|
|
@ -46,10 +86,19 @@ sub www_copyDatabaseLink {
|
|||
return www_listDatabaseLinks();
|
||||
}
|
||||
|
||||
=head2 www_deleteDatabaseLink ( $session )
|
||||
|
||||
Requests that the user confirm the deletion of the database link in
|
||||
the form variable C<dlid>. Returns Insufficient privilege if the
|
||||
user is not in group Admin (3).
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_deleteDatabaseLink {
|
||||
my $session = shift;
|
||||
return $session->privilege->insufficient unless ($session->user->isInGroup(3));
|
||||
return $session->privilege->vitalComponent if ($session->form->process("dlid") == 0);
|
||||
my $i18n = WebGUI::International->new($session);
|
||||
my ($output);
|
||||
$output .= $i18n->get(988).'<p>';
|
||||
|
|
@ -61,6 +110,16 @@ sub www_deleteDatabaseLink {
|
|||
return _submenu($session,$output,"987","database link delete");
|
||||
}
|
||||
|
||||
=head2 www_deleteDatabaseLinkConfirm ( $session )
|
||||
|
||||
Deletes the requested database link in the form variable C<dlid> if the user
|
||||
is in group Admin (3) and the default WebGUI database link (dlid 0) has not
|
||||
been requested.
|
||||
|
||||
Returns the user to the List Database Links screen.
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_deleteDatabaseLinkConfirm {
|
||||
my $session = shift;
|
||||
|
|
@ -71,6 +130,15 @@ sub www_deleteDatabaseLinkConfirm {
|
|||
return www_listDatabaseLinks($session);
|
||||
}
|
||||
|
||||
=head2 www_editDatabaseLink ( $session )
|
||||
|
||||
Create a new database link or edit an existing database link. The user must
|
||||
be in group Admin (3).
|
||||
|
||||
Calls www_editDatabaseLinkSave on user submission.
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editDatabaseLink {
|
||||
my $session = shift;
|
||||
|
|
@ -137,6 +205,15 @@ sub www_editDatabaseLink {
|
|||
return _submenu($session,$output,"990","database link add/edit");
|
||||
}
|
||||
|
||||
=head2 www_editDatabaseLinkSave ( $session )
|
||||
|
||||
Form postprocessor for www_editDatabaseLink. Only users in group Admin (3)
|
||||
are allowed to use this subroutine.
|
||||
|
||||
Returns the user the Link Database Links screen.
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editDatabaseLinkSave {
|
||||
my ($allowedKeywords);
|
||||
|
|
@ -160,6 +237,13 @@ sub www_editDatabaseLinkSave {
|
|||
return www_listDatabaseLinks($session);
|
||||
}
|
||||
|
||||
=head2 www_listDatabaseLinks ( $session )
|
||||
|
||||
List all Database links and allow the user to edit, copy or delete them.
|
||||
Only users in group Admin (3) are allowed to see this screen.
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_listDatabaseLinks {
|
||||
my $session = shift;
|
||||
|
|
|
|||
|
|
@ -18,6 +18,21 @@ use WebGUI::Asset::Template;
|
|||
use WebGUI::Macro;
|
||||
use WebGUI::Utility;
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Package WebGUI::Operation::Help
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Handles displaying WebGUI's internal help to the user as an operation.
|
||||
|
||||
=head2 _load ( $session, $namespace )
|
||||
|
||||
Safely load's the Help file for the requested namespace and logs errors
|
||||
during the load.
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub _load {
|
||||
my $session = shift;
|
||||
|
|
@ -35,6 +50,13 @@ sub _load {
|
|||
}
|
||||
}
|
||||
|
||||
=head2 _get ( $session, $id, $namespace )
|
||||
|
||||
Safely load's the Help file for the requested namespace and returns
|
||||
the specified id (help key).
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub _get {
|
||||
my $session = shift;
|
||||
|
|
@ -49,18 +71,38 @@ sub _get {
|
|||
}
|
||||
}
|
||||
|
||||
=head2 _link ( $session, $id, $namespace )
|
||||
|
||||
Utility routine for formatting a link for returning a help entry in the requested
|
||||
namespace.
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub _link {
|
||||
my $session = shift;
|
||||
return $session->url->page('op=viewHelp;hid='.$session->url->escape($_[0]).';namespace='.$_[1]);
|
||||
}
|
||||
|
||||
=head2 _linkTOC ( $session, $namespace )
|
||||
|
||||
Utility routine for formatting a link for returning a table of contents entry
|
||||
for a Help namespace.
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub _linkTOC {
|
||||
my $session = shift;
|
||||
return $session->url->page('op=viewHelpChapter;namespace='.$_[0]);
|
||||
}
|
||||
|
||||
=head2 _getHelpFilesList ( $session )
|
||||
|
||||
Utility routine for returning a list of all Help files in the lib/WebGUI/Help folder.
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub _getHelpFilesList {
|
||||
my $session = shift;
|
||||
|
|
@ -77,6 +119,15 @@ sub _getHelpFilesList {
|
|||
return @files;
|
||||
}
|
||||
|
||||
|
||||
=head2 _getHelpName ( $session, $file )
|
||||
|
||||
To support the table of contents, all WebGUI help files have a corresponding
|
||||
entry in the i18n file for the name of the chapter. This utility routine
|
||||
will fetch the correct i18n name for the chapter.
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub _getHelpName {
|
||||
my $session = shift;
|
||||
|
|
@ -95,6 +146,18 @@ sub _getHelpName {
|
|||
return $i18n->get($helpName,$file);
|
||||
}
|
||||
|
||||
=head2 _related ( $session, $related )
|
||||
|
||||
Utility routine for returning a list of topics related the the current help
|
||||
entry.
|
||||
|
||||
=head3 $related
|
||||
|
||||
A scalar ref to either an array ref, which will be dereferenced to return a list, or
|
||||
a code ref, which will be executed and should return a list.
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub _related {
|
||||
my ($session, $related) = @_;
|
||||
|
|
@ -106,6 +169,14 @@ sub _related {
|
|||
}
|
||||
}
|
||||
|
||||
=head2 www_viewHelp ( $session )
|
||||
|
||||
Display a single help entry in a namespace. The entry and namespace are passed in as
|
||||
form parameters. Entries in the fields key of the hash are filtered by the user's
|
||||
UI level, and this can be toggled on and off by another form parameter, uiOverride.
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_viewHelp {
|
||||
my $session = shift;
|
||||
|
|
@ -143,6 +214,12 @@ sub www_viewHelp {
|
|||
);
|
||||
}
|
||||
|
||||
=head2 _viewHelpIndex ( $session )
|
||||
|
||||
Display the index of all help entries in all namespaces.
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_viewHelpIndex {
|
||||
my $session = shift;
|
||||
|
|
@ -178,6 +255,13 @@ sub www_viewHelpIndex {
|
|||
return $ac->render($output, join ': ',$i18n->get(93), $i18n->get('help index'));
|
||||
}
|
||||
|
||||
=head2 www_viewHelpTOC ( $session )
|
||||
|
||||
Display the table of contents for the Help system. This generates a list of
|
||||
the assetName,macroName,topicNames for each installed Help file.
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_viewHelpTOC {
|
||||
my $session = shift;
|
||||
|
|
@ -209,6 +293,13 @@ sub www_viewHelpTOC {
|
|||
return $ac->render($output, join ': ',$i18n->get(93), $i18n->get('help toc'));
|
||||
}
|
||||
|
||||
=head2 www_viewHelpChapter ( $session )
|
||||
|
||||
Display all entries in one chapter of the help. The namespace is passed in via
|
||||
the form paramter "namespace".
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_viewHelpChapter {
|
||||
my $session = shift;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue