Rearrange form fields in default edit story template.

Change photo JSON blob to be an array ref, not a hash ref.
Code for saving new photo data.
This commit is contained in:
Colin Kuskie 2009-03-20 21:42:47 +00:00
parent 420a70531b
commit 3d5f5b04c1
4 changed files with 46 additions and 18 deletions

View file

@ -145,7 +145,7 @@ sub definition {
},
photo => {
fieldType => 'text',
defaultValue => '{}',
defaultValue => '[]',
},
storageId => {
fieldType => 'hidden',
@ -249,7 +249,6 @@ sub getAutoCommitWorkflowId {
my $self = shift;
my $archive = $self->getArchive;
if ($archive->hasBeenCommitted) {
$self->session->log->warn($archive->get('approvalWorkflowId'));
return $archive->get('approvalWorkflowId')
|| $self->session->setting->get('defaultVersionTagWorkflow');
}
@ -490,6 +489,7 @@ sub processPropertiesFromFormPost {
if ($newStorage) {
push @{ $photoData }, {
caption => $form->process('newImgCaption', 'text'),
alt => $form->process('newImgAlt', 'text'),
title => $form->process('newImgTitle', 'text'),
byLine => $form->process('newImgByline', 'text'),
url => $form->process('newImgUrl', 'url'),
@ -538,9 +538,7 @@ sub purgeRevision {
=head2 setPhotoData ( $perlStructure )
Returns the storage location for this Story. If it does not exist,
then it creates it via setStorageLocation. Subsequent lookups return
an internally cached Storage object to save time.
Sets the photo data from the JSON stored in the object.
=head3 $perlStructure
@ -577,7 +575,7 @@ want in there so there's no valid content checking.
sub setPhotoData {
my $self = shift;
my $photoData = shift || {};
my $photoData = shift || [];
my $photo = to_json($photoData);
$self->update({photo => $photo});
delete $self->{_photoData};

View file

@ -344,6 +344,36 @@ our $I18N = {
lastUpdated => 0,
},
'photo caption' => {
message => q|Photo Caption|,
context => q|Label in the edit story form. Short for Photograph Caption.|,
lastUpdated => 0,
},
'photo byline' => {
message => q|Photo By Line|,
context => q|Label in the edit story form. The person who took, or owns this photo.|,
lastUpdated => 0,
},
'photo alt' => {
message => q|Photo Alternate Text|,
context => q|Label in the edit story form. Text for the ALT attribute of an IMG tag.|,
lastUpdated => 0,
},
'photo title' => {
message => q|Photo Alternate Title|,
context => q|Label in the edit story form. Text for the TITLE attribute of an IMG tag.|,
lastUpdated => 0,
},
'photo url' => {
message => q|Photo URL|,
context => q|Label in the edit story form. A link from the photo to more information about it, or referring to it.|,
lastUpdated => 0,
},
};
1;