Refactor preview
This commit is contained in:
parent
04f39ebc19
commit
4a9cbfd91c
4 changed files with 62 additions and 57 deletions
|
|
@ -141,57 +141,5 @@ sub processContentAsUser {
|
|||
# return $self->processStyle( $f->print );
|
||||
#}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
sub www_previewContent {
|
||||
my $self = shift;
|
||||
my $form = $self->session->form;
|
||||
|
||||
my $issueId = $form->get('issueId');
|
||||
my $userId = $form->get('userId');
|
||||
|
||||
return $self->processContentAsUser( $issueId, $userId );
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
sub www_previewEmail {
|
||||
my $self = shift;
|
||||
my $session = $self->session;
|
||||
my $form = $session->form;
|
||||
|
||||
my %recipients =
|
||||
map { $_->getId => $_->username }
|
||||
map { WebGUI::User->new( $session, $_ ) }
|
||||
@{ $self->getRecipients };
|
||||
|
||||
my $issueId = $form->get('issueId');
|
||||
my $userId = $form->get('userId') || ( %recipients )[0];
|
||||
|
||||
my $userSelection =
|
||||
WebGUI::Form::formHeader( $session )
|
||||
. WebGUI::Form::hidden( $session, { name => 'func', value => 'previewEmail' } )
|
||||
. WebGUI::Form::hidden( $session, { name => 'issueId', value => $issueId } )
|
||||
. WebGUI::Form::selectBox( $session, {
|
||||
name => 'userId',
|
||||
options => \%recipients,
|
||||
value => $userId,
|
||||
} )
|
||||
. WebGUI::Form::submit( $session, { value => 'Switch' } )
|
||||
. WebGUI::Form::formFooter( $session );
|
||||
|
||||
my $url = $self->getUrl("func=previewContent;issueId=$issueId;userId=$userId");
|
||||
|
||||
return <<EOHTML;
|
||||
<html>
|
||||
<head>
|
||||
</head>
|
||||
<body>
|
||||
$userSelection
|
||||
<iframe src="$url" id="previewFrame" style="width: 100%; height: 90%">
|
||||
</iframe>
|
||||
</body>
|
||||
</html>
|
||||
EOHTML
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue