Add stories to a story archive.

i18n support for that.
log problems when calling www_add in the story archive.
This commit is contained in:
Colin Kuskie 2009-03-05 17:22:41 +00:00
parent 04105713f0
commit 40d17b7be9
4 changed files with 51 additions and 11 deletions

View file

@ -213,7 +213,7 @@ sub getEditForm {
my $title = $self->getTitle;
my $var = {
formHeader => WebGUI::Form::formHeader($session, {action => $url})
. WebGUI::Form::hidden($session, { name => 'func', value => $url })
. WebGUI::Form::hidden($session, { name => 'func', value => 'editSave' })
. WebGUI::Form::hidden($session, { name => 'proceed', value => 'showConfirmation' }),
formFooter => WebGUI::Form::formFooter($session),
formTitle => $i18n->get('editing','Asset_WikiPage').' '.$title,
@ -250,13 +250,23 @@ sub getEditForm {
value => $form->get('story') || $self->get('story'),
richEditId => $archive->get('richEditorId')
}),
saveButton => WebGUI::Form::submit($session, {
name => 'saveStory',
value => $i18n->get('save story'),
}),
previewButton => WebGUI::Form::submit($session, {
name => 'saveAndPreview',
value => $i18n->get('save and preview'),
}),
saveAndAddButton => WebGUI::Form::submit($session, {
name => 'saveAndAddPhoto',
value => $i18n->get('save and add another photo'),
}),
};
if ($isNew) {
$var->{formHeader} .= WebGUI::Form::hidden($session, { name => 'assetId', value => 'new' })
. WebGUI::Form::hidden($session, { name => 'className', value => $form->process('class', 'className') });
$var->{formHeader} .= WebGUI::Form::hidden($session, { name => 'assetId', value => 'new' })
. WebGUI::Form::hidden($session, { name => 'class', value => $form->process('class', 'className') });
}
$self->session->log->warn($archive->get('className'));
$self->session->log->warn($archive->get('editStoryTemplateId'));
return $self->processTemplate($var, $archive->get('editStoryTemplateId'));
}
@ -540,8 +550,8 @@ Shows a confirmation message letting the user know their page has been submitted
sub www_showConfirmation {
my $self = shift;
my $i18n = WebGUI::International->new($self->session, "Asset_Story");
return $self->getWiki->processStyle('<p>'.$i18n->get("page received").'</p><p><a href="'.$self->getWiki->getUrl.'">'.$i18n->get("493","WebGUI").'</a></p>');
my $i18n = WebGUI::International->new($self->session, 'Asset_Story');
return $self->getArchive->processStyle('<p>'.$i18n->get('story received').'</p><p><a href="'.$self->getArchive->getUrl.'">'.$i18n->get('493','WebGUI').'</a></p>');
}

View file

@ -333,11 +333,18 @@ www_add, find the right folder to use, then allow that folder to continue on.
sub www_add {
my $self = shift;
my $form = $self->session->form;
return undef unless $form->get('class') eq 'WebGUI::Asset::Story';
my $self = shift;
my $session = $self->session;
my $form = $session->form;
if ($form->get('class') ne 'WebGUI::Asset::Story') {
$session->log->warn('Refusing to add '. $form->get('class'). ' to StoryArchive');
return undef;
}
my $todayFolder = $self->getFolder;
return undef unless $todayFolder;
if (!$todayFolder) {
$session->log->warn('Unable to get folder for today. Not adding Story');
return undef;
}
$todayFolder->www_add;
}

View file

@ -81,6 +81,29 @@ our $I18N = {
lastUpdated => 0
},
'save story' => {
message => q|Save Story|,
context => q|Button label in the Edit Story form.|,
lastUpdated => 0
},
'save and preview' => {
message => q|Save and Preview|,
context => q|Button label in the Edit Story form.|,
lastUpdated => 0
},
'save and add another photo' => {
message => q|Save and Add Another Photo|,
context => q|Button label in the Edit Story form.|,
lastUpdated => 0
},
'story received' => {
message => q|Your story has been received and is being processed so it can be added to the site. It will be available for further editing after being processed. Please be patient.|,
lastUpdated => 0,
},
};
1;