Templates for archive, and edit story.

Added switches and URLs for adding stories.
Fixed date problems in the date_loop.
Fixed an autocommit issue with folders when there's no currently open version tag.
This commit is contained in:
Colin Kuskie 2009-03-05 00:15:20 +00:00
parent 874fad9917
commit cff0a9ae9d
5 changed files with 52 additions and 26 deletions

View file

@ -108,16 +108,14 @@ sub definition {
fieldType => 'template',
label => $i18n->get('template'),
hoverHelp => $i18n->get('template help'),
filter => 'fixId',
namespace => 'StoryArchive',
defaultValue => '',
defaultValue => 'yxD5ka7XHebPLD-LXBwJqw',
},
storyTemplateId => {
tab => 'display',
fieldType => 'template',
label => $i18n->get('story template'),
hoverHelp => $i18n->get('story template help'),
filter => 'fixId',
namespace => 'Story',
defaultValue => '',
},
@ -126,7 +124,6 @@ sub definition {
fieldType => 'template',
label => $i18n->get('edit story template'),
hoverHelp => $i18n->get('edit story template help'),
filter => 'fixId',
namespace => 'Story/Edit',
defaultValue => 'E3tzZjzhmYoNlAyP2VW33Q',
},
@ -207,7 +204,8 @@ sub getFolder {
isHidden => 1,
});
$newVersionTag->commit();
$oldVersionTag->setWorking();
##Restore the old one, if it exists
$oldVersionTag->setWorking() if $oldVersionTag;
##Get a new version of the asset from the db with the correct state
$folder = WebGUI::Asset->newByUrl($session, $folderUrl);
@ -266,6 +264,8 @@ sub view {
#This is an example of debugging code to help you diagnose problems.
#WebGUI::ErrorHandler::warn($self->get("templateId"));
use Data::Dumper;
$session->log->warn(Dumper $var);
return $self->processTemplate($var, undef, $self->{_viewTemplate});
}
@ -306,16 +306,19 @@ sub viewTemplateVariables {
if ($storyDate ne $lastStoryDate) {
push @{ $var->{date_loop} }, {};
$datePointer = $var->{date_loop}->[-1];
$datePointer->{epochDate} = $creationDate;
$datePointer->{storyLoop} = [];
$datePointer->{epochDate} = $creationDay;
$datePointer->{story_loop} = [];
$lastStoryDate = $storyDate;
}
push @{$datePointer->{storyLoop}}, {
push @{$datePointer->{story_loop}}, {
url => $story->getUrl,
title => $story->getTitle,
creationDate => $creationDate
}
}
$var->{addStoryUrl} = $self->getUrl('func=add;class=WebGUI::Asset::Story');
$var->{canPostStories} = $self->canPostStories;
return 1;
}

View file

@ -165,6 +165,12 @@ our $I18N = {
lastUpdated => 0,
},
'add a story' => {
message => q|Add a Story.|,
context => q|label for the URL to add a story to the archive.|,
lastUpdated => 0,
},
};
1;