default www_edit now returns template. add errors to edit template
This commit is contained in:
parent
ecce246e1c
commit
db9753eb01
6 changed files with 22 additions and 80 deletions
|
|
@ -2794,10 +2794,8 @@ sub www_edit {
|
|||
my $template = WebGUI::Asset->newById( $session, $session->setting->get('templateIdAssetEdit') );
|
||||
$template->setParam( %{ $f->toTemplateVars } );
|
||||
|
||||
return $self->session->style->process(
|
||||
$template->process,
|
||||
"PBtmpl0000000000000137"
|
||||
);
|
||||
$template->style( "PBtmpl0000000000000137" );
|
||||
return $template;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -542,23 +542,6 @@ around indexContent => sub {
|
|||
};
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_edit ( )
|
||||
|
||||
Override the method from Asset.pm to change the title of the screen.
|
||||
|
||||
=cut
|
||||
|
||||
sub www_edit {
|
||||
my $self = shift;
|
||||
return $self->session->privilege->insufficient() unless $self->canEdit;
|
||||
return $self->session->privilege->locked() unless $self->canEditIfLocked;
|
||||
my $i18n = WebGUI::International->new($self->session,"Asset_RichEdit");
|
||||
return $self->getAdminConsole->render($self->getEditForm->print,$i18n->get("rich edit edit config"));
|
||||
}
|
||||
|
||||
|
||||
__PACKAGE__->meta->make_immutable;
|
||||
1;
|
||||
|
||||
|
|
|
|||
|
|
@ -801,7 +801,7 @@ default template.
|
|||
|
||||
=cut
|
||||
|
||||
sub www_edit {
|
||||
override www_edit => sub {
|
||||
my $self = shift;
|
||||
return $self->session->privilege->insufficient() unless $self->canEdit;
|
||||
return $self->session->privilege->locked() unless $self->canEditIfLocked;
|
||||
|
|
@ -809,7 +809,7 @@ sub www_edit {
|
|||
my $form = $session->form;
|
||||
my $url = $session->url;
|
||||
my $i18n = WebGUI::International->new($session, "Asset_Template");
|
||||
my $output = '';
|
||||
my $template = super();
|
||||
|
||||
# Add an unfriendly warning message if this is a default template
|
||||
if ( $self->get( 'isDefault' ) ) {
|
||||
|
|
@ -821,48 +821,20 @@ sub www_edit {
|
|||
$duplicateUrl = $url->append( $duplicateUrl, "returnUrl=" . $form->get( "returnUrl" ) );
|
||||
}
|
||||
}
|
||||
|
||||
$session->style->setRawHeadTags( <<'ENDHTML' );
|
||||
<style type="text/css">
|
||||
.wGwarning {
|
||||
border : 1px solid red;
|
||||
background-color : #FF6666;
|
||||
padding : 10px;
|
||||
margin : 5px;
|
||||
/* TODO: Add a nice little image here */
|
||||
/* TODO: Make this a generic warning class from the default webgui stylesheet */
|
||||
}
|
||||
</style>
|
||||
ENDHTML
|
||||
|
||||
$output .= q{<div class="wGwarning"><p>}
|
||||
my $errors = $template->getParam('errors') || [];
|
||||
my $message .= q{<p>}
|
||||
. $i18n->get( "warning default template" )
|
||||
. q{</p><p>}
|
||||
. sprintf( q{<a href="} . $duplicateUrl . q{">%s</a>}, $i18n->get( "make duplicate label" ) )
|
||||
. q{</p></div>}
|
||||
. q{</p>}
|
||||
;
|
||||
push @$errors, $message;
|
||||
$template->setParam( 'errors' => $errors );
|
||||
}
|
||||
|
||||
my $func = $self->session->form->get('func');
|
||||
my $f = eval { $self->getEditForm };
|
||||
return $@ if $@;
|
||||
$f->addField( "Hidden", name => "func", value => "editSave" );
|
||||
if ( $func eq 'add' ) {
|
||||
my $className = $self->session->form->get('className');
|
||||
$f->action( $self->getParent->getUrl );
|
||||
$f->getTab('meta')->getField( 'className' )->set('value', $className);
|
||||
}
|
||||
else {
|
||||
$f->action( $self->getUrl );
|
||||
}
|
||||
$output .= $f->toHtml;
|
||||
|
||||
# TODO: Make a www_edit template
|
||||
return $self->session->style->process(
|
||||
'<div class="yui-skin-sam">' . $output . '</div>',
|
||||
"PBtmpl0000000000000137"
|
||||
);
|
||||
}
|
||||
return $template;
|
||||
};
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
|
|
|
|||
|
|
@ -1645,28 +1645,6 @@ sub wrapIcal {
|
|||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 www_edit ( )
|
||||
|
||||
Adds a submenu to the default edit page that includes links to Add an Event.
|
||||
|
||||
=cut
|
||||
|
||||
sub www_edit {
|
||||
my $self = shift;
|
||||
my $session = $self->session;
|
||||
my $i18n = WebGUI::International->new($session, 'Asset_Calendar');
|
||||
|
||||
return $session->privilege->insufficient() unless $self->canEdit;
|
||||
|
||||
|
||||
return $self->getAdminConsole->render(
|
||||
$self->getEditForm->toHtml,
|
||||
$i18n->get("assetName")
|
||||
);
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 www_ical
|
||||
|
||||
Export an iCalendar feed of this Events Calendar's events.
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -9,3 +9,14 @@
|
|||
margin-top: 1em;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.wg-formbuilder .wg-message {
|
||||
|
||||
}
|
||||
|
||||
.wg-formbuilder .wg-error {
|
||||
border : 1px solid red;
|
||||
background-color : #FF6666;
|
||||
padding : 10px;
|
||||
margin : 10px;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue