Add some of the POD missing from the Shortcut.
This commit is contained in:
parent
7498ff6520
commit
cdf3677655
1 changed files with 118 additions and 2 deletions
|
|
@ -140,6 +140,14 @@ sub _submenu {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 canEdit
|
||||
|
||||
Extend the base method to handle dashlets. If this Shortcut is a dashlet, then if you
|
||||
can manage the parent you can edit this Shortcut.
|
||||
|
||||
=cut
|
||||
|
||||
sub canEdit {
|
||||
my $self = shift;
|
||||
return 1 if ($self->SUPER::canEdit || ($self->isDashlet && $self->getParent->canManage));
|
||||
|
|
@ -147,6 +155,13 @@ return 1 if ($self->SUPER::canEdit || ($self->isDashlet && $self->getParent->can
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 canManage
|
||||
|
||||
An alias for canEdit.
|
||||
|
||||
=cut
|
||||
|
||||
sub canManage {
|
||||
my $self = shift;
|
||||
return $self->canEdit;
|
||||
|
|
@ -207,6 +222,14 @@ sub definition {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 discernUserId
|
||||
|
||||
This utility method is used to determine if the user should be shown the view of the
|
||||
Shortcut that the Visitor would see, or their own.
|
||||
|
||||
=cut
|
||||
|
||||
sub discernUserId {
|
||||
my $self = shift;
|
||||
return ($self->canManage && $self->session->var->isAdminOn) ? '1' : $self->session->user->userId;
|
||||
|
|
@ -218,8 +241,6 @@ sub discernUserId {
|
|||
|
||||
Extend the base method to duplicate shortcut overrides.
|
||||
|
||||
See also Asset::duplicate.
|
||||
|
||||
=cut
|
||||
|
||||
sub duplicate {
|
||||
|
|
@ -235,6 +256,14 @@ END_SQL
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getContentLastModified
|
||||
|
||||
Extend the base method to consider the revisionDate of the Asset being shortcutted.
|
||||
Return the largest of either the asset revision date, or the shortcut revision date.
|
||||
|
||||
=cut
|
||||
|
||||
sub getContentLastModified {
|
||||
my $self = shift;
|
||||
my $assetRev = $self->get('revisionDate');
|
||||
|
|
@ -243,6 +272,13 @@ sub getContentLastModified {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getEditForm
|
||||
|
||||
Extend the base class to handle hand drawing the query build and other pieces.
|
||||
|
||||
=cut
|
||||
|
||||
sub getEditForm {
|
||||
my $self = shift;
|
||||
my $tabform = $self->SUPER::getEditForm();
|
||||
|
|
@ -324,6 +360,14 @@ sub getEditForm {
|
|||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getFieldsList
|
||||
|
||||
Return a form with a list of profile fields to show to the user, and a list of fields
|
||||
to import as variables for use in overrides.
|
||||
|
||||
=cut
|
||||
|
||||
sub getFieldsList {
|
||||
my $self = shift;
|
||||
my $session = $self->session;
|
||||
|
|
@ -496,6 +540,14 @@ sub getOverrides {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getShortcut
|
||||
|
||||
Return a copy of the Asset that this Shortcut points to. Overrides are
|
||||
processed if set.
|
||||
|
||||
=cut
|
||||
|
||||
sub getShortcut {
|
||||
my $self = shift;
|
||||
unless ($self->{_shortcut}) {
|
||||
|
|
@ -629,12 +681,27 @@ sub getShortcutByCriteria {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getShortcutDefault
|
||||
|
||||
Return the asset that this Shortcut points to.
|
||||
|
||||
=cut
|
||||
|
||||
sub getShortcutDefault {
|
||||
my $self = shift;
|
||||
return WebGUI::Asset->newByDynamicClass($self->session, $self->get("shortcutToAssetId"));
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getShortcutOriginal
|
||||
|
||||
If shortcutByCriteria is set, return the Shortcut that matches the criteria. Otherwise,
|
||||
just return the asset the shortcut points to.
|
||||
|
||||
=cut
|
||||
|
||||
sub getShortcutOriginal {
|
||||
my $self = shift;
|
||||
if ($self->get("shortcutByCriteria")) {
|
||||
|
|
@ -645,12 +712,27 @@ sub getShortcutOriginal {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getPrefFieldsToShow
|
||||
|
||||
Returns an array of profile fields to show to the user as preferences.
|
||||
|
||||
=cut
|
||||
|
||||
sub getPrefFieldsToShow {
|
||||
my $self = shift;
|
||||
return split("\n",$self->getValue("prefFieldsToShow"));
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getPrefFieldsToImport
|
||||
|
||||
Returns an array of profile fields to import from the user's profile as variables
|
||||
for overrides.
|
||||
|
||||
=cut
|
||||
|
||||
sub getPrefFieldsToImport {
|
||||
my $self = shift;
|
||||
return split("\n",$self->getValue("prefFieldsToImport"));
|
||||
|
|
@ -678,6 +760,13 @@ sub getTemplateVars {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 isDashlet
|
||||
|
||||
Returns true if this Shortcut is a Dashlet. Dashlets are chilren of Dashboards.
|
||||
|
||||
=cut
|
||||
|
||||
sub isDashlet {
|
||||
my $self = shift;
|
||||
return 1 if ref $self->getParent eq 'WebGUI::Asset::Wobject::Dashboard';
|
||||
|
|
@ -686,6 +775,12 @@ sub isDashlet {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 notLinked
|
||||
|
||||
Returns an I18n'ed error message that the Asset that this Shortcut points to no longer exists.
|
||||
|
||||
=cut
|
||||
|
||||
sub notLinked {
|
||||
my $self = shift;
|
||||
$self->session->errorHandler->warn("Shortcut ".$self->getId." is linked to an asset ".$self->get("shortcutToAssetId").", which no longer exists.");
|
||||
|
|
@ -777,12 +872,26 @@ END_SQL
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 uncacheOverrides
|
||||
|
||||
Delete any cached overrides.
|
||||
|
||||
=cut
|
||||
|
||||
sub uncacheOverrides {
|
||||
my $self = shift;
|
||||
WebGUI::Cache->new($self->session,$self->_overridesCacheTag)->delete;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 view
|
||||
|
||||
Render the Shortcut.
|
||||
|
||||
=cut
|
||||
|
||||
sub view {
|
||||
my $self = shift;
|
||||
my $content;
|
||||
|
|
@ -824,6 +933,13 @@ sub view {
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_edit
|
||||
|
||||
Override the base class to handle adding a menu entry for Manage Overrides.
|
||||
|
||||
=cut
|
||||
|
||||
sub www_edit {
|
||||
my $self = shift;
|
||||
return $self->session->privilege->insufficient() unless $self->canEdit;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue