From 40d17b7be9ef84651b9967d18b32c5dee97690de Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Thu, 5 Mar 2009 17:22:41 +0000 Subject: [PATCH] Add stories to a story archive. i18n support for that. log problems when calling www_add in the story archive. --- .../root_import_storymanager_editstory.wgpkg | Bin 980 -> 995 bytes lib/WebGUI/Asset/Story.pm | 24 +++++++++++++----- lib/WebGUI/Asset/Wobject/StoryArchive.pm | 15 ++++++++--- lib/WebGUI/i18n/English/Asset_Story.pm | 23 +++++++++++++++++ 4 files changed, 51 insertions(+), 11 deletions(-) diff --git a/docs/upgrades/packages-7.7.0/root_import_storymanager_editstory.wgpkg b/docs/upgrades/packages-7.7.0/root_import_storymanager_editstory.wgpkg index f83d8df285d9410beb87cd93bf976791f73528ba..d2fbf2be73f31119b8da6fb7d67ec6c9b48757c0 100644 GIT binary patch literal 995 zcmV<9104JxiwFP!00000|Ls;$Z`(Kw&hvhS;io&GXkt5QmMmAG-P$$4R%B?pVq5PD z#a0t7ieyM~GWW3meiUuTZkl$*T@Bnr1SA4Xiu_1Q{J7t!f3;ezZnx8D*!`f5yVr)@ zS+7>Z^Sn;G)oOcQtKq<3D`+@yr2ds?Lli&@C1+y(xW7bGr5_jD;9y~JxIdx#e-a^T zNH;9}?*#kbwG=N35o{mib>CM1ju*5y>K`0@eEIktmLz zl$55)7B-NkjXqrv0U1zD8Zm<(N)$wEYI0L2fw}wo{cg7SBG36zI`ThX1;M9Mm+6s` zMw&FvqOAnO^cjmHDmH_hDw)K?=mZ?2s9jn!bP@9+af4e%c?3|L5UQa6xOOep3k&|* zJ-ikJPN!5vhXVtLZk9wjw^A*}%y4=*Xy!styC=3eq{^O-*b4TYgf5W}P( z{I_0j?}|>|Uk-nN1C~$&PUx73iZ^3Doq|j7hN8@wpba@Cs_#ssnY{tPgJ$lr z*q;KRlL?yNJF>O7!JwbQQs~zNXOaS0(C325v}=OGWr$UJE|@~UCOC7NuB3`|2Ir{~ z6`C~xX?y-N?yOE03!>7RFw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ufecipA#U~{KrY}<8@dXJDU!eFpwl8TcE-15%s-6aWBA C7UgCD diff --git a/lib/WebGUI/Asset/Story.pm b/lib/WebGUI/Asset/Story.pm index d7b3956f1..e78dd4bfa 100644 --- a/lib/WebGUI/Asset/Story.pm +++ b/lib/WebGUI/Asset/Story.pm @@ -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('

'.$i18n->get("page received").'

'.$i18n->get("493","WebGUI").'

'); + my $i18n = WebGUI::International->new($self->session, 'Asset_Story'); + return $self->getArchive->processStyle('

'.$i18n->get('story received').'

'.$i18n->get('493','WebGUI').'

'); } diff --git a/lib/WebGUI/Asset/Wobject/StoryArchive.pm b/lib/WebGUI/Asset/Wobject/StoryArchive.pm index 6b4ca2c99..7f6ea7bcc 100644 --- a/lib/WebGUI/Asset/Wobject/StoryArchive.pm +++ b/lib/WebGUI/Asset/Wobject/StoryArchive.pm @@ -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; } diff --git a/lib/WebGUI/i18n/English/Asset_Story.pm b/lib/WebGUI/i18n/English/Asset_Story.pm index e204141ea..926b50d77 100644 --- a/lib/WebGUI/i18n/English/Asset_Story.pm +++ b/lib/WebGUI/i18n/English/Asset_Story.pm @@ -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;