fix - fix: shortcut bombs
This commit is contained in:
parent
e225c2276a
commit
7191b53e3e
2 changed files with 51 additions and 12 deletions
|
|
@ -53,6 +53,7 @@
|
||||||
- fix: cs mail posts - no url prepending
|
- fix: cs mail posts - no url prepending
|
||||||
- Multiple "Re:"'s on CS Mail posts are now a thing of the past.
|
- Multiple "Re:"'s on CS Mail posts are now a thing of the past.
|
||||||
- Made mail message ids follow convention.
|
- Made mail message ids follow convention.
|
||||||
|
- fix: shortcut bombs
|
||||||
|
|
||||||
|
|
||||||
6.99.3
|
6.99.3
|
||||||
|
|
|
||||||
|
|
@ -214,11 +214,18 @@ sub getEditForm {
|
||||||
my $tabform = $self->SUPER::getEditForm();
|
my $tabform = $self->SUPER::getEditForm();
|
||||||
my $originalTemplate;
|
my $originalTemplate;
|
||||||
my $i18n = WebGUI::International->new($self->session, "Asset_Shortcut");
|
my $i18n = WebGUI::International->new($self->session, "Asset_Shortcut");
|
||||||
$tabform->getTab("properties")->readOnly(
|
my $shortcut = $self->getShortcut;
|
||||||
-label=>$i18n->get(1),
|
if (defined $shortcut) {
|
||||||
-hoverHelp=>$i18n->get('1 description'),
|
$tabform->getTab("properties")->readOnly(
|
||||||
-value=>'<a href="'.$self->getShortcut->getUrl.'">'.$self->getShortcut->get('title').'</a> ('.$self->getShortcut->getId.')'
|
-label=>$i18n->get(1),
|
||||||
);
|
-hoverHelp=>$i18n->get('1 description'),
|
||||||
|
-value=>'<a href="'.$shortcut->getUrl.'">'.$shortcut->get('title').'</a> ('.$shortcut->getId.')'
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
$tabform->getTab("properties")->readOnly(
|
||||||
|
value=>'<a href="'.$self->getUrl("func=delete").'"><span style="font-weight: bold; color: red;">'.$self->notLinked.'</span></a>'
|
||||||
|
);
|
||||||
|
}
|
||||||
$tabform->getTab("display")->template(
|
$tabform->getTab("display")->template(
|
||||||
-value=>$self->getValue("templateId"),
|
-value=>$self->getValue("templateId"),
|
||||||
-label=>$i18n->get('shortcut template title'),
|
-label=>$i18n->get('shortcut template title'),
|
||||||
|
|
@ -341,7 +348,9 @@ sub getOverridesList {
|
||||||
my %overrides = $self->getOverrides;
|
my %overrides = $self->getOverrides;
|
||||||
$output .= '<table cellspacing="0" cellpadding="3" border="1">';
|
$output .= '<table cellspacing="0" cellpadding="3" border="1">';
|
||||||
$output .= '<tr class="tableHeader"><td>'.$i18n->get('fieldName').'</td><td>'.$i18n->get('edit delete fieldname').'</td><td>'.$i18n->get('Original Value').'</td><td>'.$i18n->get('New value').'</td><td>'.$i18n->get('Replacement value').'</td></tr>';
|
$output .= '<tr class="tableHeader"><td>'.$i18n->get('fieldName').'</td><td>'.$i18n->get('edit delete fieldname').'</td><td>'.$i18n->get('Original Value').'</td><td>'.$i18n->get('New value').'</td><td>'.$i18n->get('Replacement value').'</td></tr>';
|
||||||
foreach my $definition (@{$self->getShortcutOriginal->definition($self->session)}) {
|
my $shortcut = $self->getShortcutOriginal;
|
||||||
|
return undef unless defined $shortcut;
|
||||||
|
foreach my $definition (@{$shortcut->definition($self->session)}) {
|
||||||
foreach my $prop (keys %{$definition->{properties}}) {
|
foreach my $prop (keys %{$definition->{properties}}) {
|
||||||
next if $definition->{properties}{$prop}{fieldType} eq 'hidden';
|
next if $definition->{properties}{$prop}{fieldType} eq 'hidden';
|
||||||
$output .= '<tr>';
|
$output .= '<tr>';
|
||||||
|
|
@ -373,12 +382,14 @@ sub getOverrides {
|
||||||
unless ($overridesRef->{cacheNotExpired}) {
|
unless ($overridesRef->{cacheNotExpired}) {
|
||||||
my %overrides;
|
my %overrides;
|
||||||
my $orig = $self->getShortcutOriginal;
|
my $orig = $self->getShortcutOriginal;
|
||||||
unless (exists $orig->{_propertyDefinitions}) {
|
if (defined $orig) {
|
||||||
|
unless ( exists $orig->{_propertyDefinitions}) {
|
||||||
my %properties;
|
my %properties;
|
||||||
foreach my $definition (@{$orig->definition($self->session)}) {
|
foreach my $definition (@{$orig->definition($self->session)}) {
|
||||||
%properties = (%properties, %{$definition->{properties}});
|
%properties = (%properties, %{$definition->{properties}});
|
||||||
|
}
|
||||||
|
$orig->{_propertyDefinitions} = \%properties;
|
||||||
}
|
}
|
||||||
$orig->{_propertyDefinitions} = \%properties;
|
|
||||||
}
|
}
|
||||||
$overrides{cacheNotExpired} = 1;
|
$overrides{cacheNotExpired} = 1;
|
||||||
my $sth = $self->session->db->read("select fieldName, newValue from Shortcut_overrides where assetId=".$self->session->db->quote($self->getId)." order by fieldName");
|
my $sth = $self->session->db->read("select fieldName, newValue from Shortcut_overrides where assetId=".$self->session->db->quote($self->getId)." order by fieldName");
|
||||||
|
|
@ -577,6 +588,14 @@ sub isDashlet {
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub notLinked {
|
||||||
|
my $self = shift;
|
||||||
|
$self->session->errorHandler->warn("Shortcut ".$self->getId." is linked to an asset ".$self->get("shortcutToAssetId").", which no longer exists.");
|
||||||
|
return "The asset this shortcut is linked to no longer exists. You need to delete this shortcut.";
|
||||||
|
}
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------
|
||||||
|
|
||||||
=head2 prepareView ( )
|
=head2 prepareView ( )
|
||||||
|
|
||||||
See WebGUI::Asset::prepareView() for details.
|
See WebGUI::Asset::prepareView() for details.
|
||||||
|
|
@ -589,7 +608,12 @@ sub prepareView {
|
||||||
my $template = WebGUI::Asset::Template->new($self->session, $self->get("templateId"));
|
my $template = WebGUI::Asset::Template->new($self->session, $self->get("templateId"));
|
||||||
$template->prepare;
|
$template->prepare;
|
||||||
$self->{_viewTemplate} = $template;
|
$self->{_viewTemplate} = $template;
|
||||||
$self->getShortcut->prepareView;
|
my $shortcut = $self->getShortcut;
|
||||||
|
if (defined $shortcut) {
|
||||||
|
$shortcut->prepareView;
|
||||||
|
} else {
|
||||||
|
$self->notLinked;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -614,6 +638,13 @@ sub view {
|
||||||
my $content;
|
my $content;
|
||||||
my $i18n = WebGUI::International->new($self->session,"Asset_Shortcut");
|
my $i18n = WebGUI::International->new($self->session,"Asset_Shortcut");
|
||||||
my $shortcut = $self->getShortcut;
|
my $shortcut = $self->getShortcut;
|
||||||
|
if (defined $shortcut) {
|
||||||
|
# continue
|
||||||
|
} elsif ($self->canEdit) {
|
||||||
|
return '<a href="'.$self->getUrl("func=delete").'">'.$self->notLinked.'</a>';
|
||||||
|
} else {
|
||||||
|
return undef;
|
||||||
|
}
|
||||||
if ($self->get("shortcutToAssetId") eq $self->get("parentId")) {
|
if ($self->get("shortcutToAssetId") eq $self->get("parentId")) {
|
||||||
$content = $i18n->get("Displaying this shortcut would cause a feedback loop");
|
$content = $i18n->get("Displaying this shortcut would cause a feedback loop");
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -814,7 +845,14 @@ sub www_view {
|
||||||
$self->session->asset($self->getParent);
|
$self->session->asset($self->getParent);
|
||||||
return $self->session->asset->www_view;
|
return $self->session->asset->www_view;
|
||||||
} else {
|
} else {
|
||||||
return $self->getShortcut->www_view;
|
my $shortcut = $self->getShortcut;
|
||||||
|
if (defined $shortcut) {
|
||||||
|
return $shortcut->www_view;
|
||||||
|
} elsif ($self->canEdit) {
|
||||||
|
return $self->session->style->userStyle('<a href="'.$self->getUrl("func=delete").'">'.$self->notLinked.'</a>');
|
||||||
|
} else {
|
||||||
|
return $self->getParent->www_view;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue