Multiple changes:
- Shift ProfileField API so that new returns undef on invalid fields.
This makes it possible for Shortcut::www_saveUserPrefs to execute.
The class methods in ProfileField are now also actually class methods.
+ Also fix up other modules that created dummy ProfileFields so that
they don't need to do that anymore, because it's now invalid.
- Merge contradictory-looking code from Shortcut's view and www_view
into a reasonable compromise in view, and then have www_view call
$self->view in a manner similar to that of the default Asset::view.
+ The profile field overrides still don't work, because there's no
obvious mechanism for "transclude asset in context". This may
require some fiddling to get right...
This commit is contained in:
parent
84e8d8f689
commit
565119fa1a
5 changed files with 57 additions and 36 deletions
|
|
@ -312,7 +312,7 @@ sub getFieldsList {
|
|||
my $output = '<a href="'.$self->getUrl('op=editProfileSettings').'" class="formLink">'.$i18n->get('Manage Profile Fields').'</a><br /><br />';
|
||||
my %fieldNames;
|
||||
tie %fieldNames, 'Tie::IxHash';
|
||||
foreach my $field (@{WebGUI::ProfileField->new($self->session,'dummy')->getFields}) {
|
||||
foreach my $field (@{WebGUI::ProfileField->getFields($self->session)}) {
|
||||
my $fieldId = $field->getId;
|
||||
next if $fieldId =~ /contentPositions/;
|
||||
$fieldNames{$fieldId} = $field->getLabel.' ['.$fieldId.']';
|
||||
|
|
@ -616,11 +616,7 @@ sub prepareView {
|
|||
$template->prepare;
|
||||
$self->{_viewTemplate} = $template;
|
||||
my $shortcut = $self->getShortcut;
|
||||
if (defined $shortcut) {
|
||||
$shortcut->prepareView;
|
||||
} else {
|
||||
$self->notLinked;
|
||||
}
|
||||
$shortcut->prepareView if defined $shortcut;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -645,18 +641,21 @@ sub view {
|
|||
my $content;
|
||||
my $i18n = WebGUI::International->new($self->session,"Asset_Shortcut");
|
||||
my $shortcut = $self->getShortcut;
|
||||
if (defined $shortcut) {
|
||||
# continue
|
||||
} elsif ($self->canEdit) {
|
||||
return '<a href="'.$self->getUrl("func=delete").'">'.$self->notLinked.'</a>';
|
||||
} else {
|
||||
return undef;
|
||||
|
||||
unless (defined $shortcut) {
|
||||
if ($self->canEdit) {
|
||||
return $self->session->style->userStyle('<a href="'.$self->getUrl("func=delete").'">'.$self->notLinked.'</a>');
|
||||
} else {
|
||||
return $self->notLinked;
|
||||
}
|
||||
}
|
||||
|
||||
if ($self->get("shortcutToAssetId") eq $self->get("parentId")) {
|
||||
$content = $i18n->get("Displaying this shortcut would cause a feedback loop");
|
||||
} else {
|
||||
$content = $shortcut->view;
|
||||
}
|
||||
|
||||
my %var = (
|
||||
isShortcut => 1,
|
||||
'shortcut.content' => $content,
|
||||
|
|
@ -866,16 +865,12 @@ sub www_saveOverride {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_view {
|
||||
# Hrrrm. Why doesn't the default www_view work here?
|
||||
my $self = shift;
|
||||
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->notLinked;
|
||||
}
|
||||
my $check = $self->checkView;
|
||||
return $check if defined $check;
|
||||
$self->prepareView;
|
||||
return $self->view;
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue