From: <mp...@kr...> - 2012-07-06 15:14:58
|
Revision: 6828 Author: mpeters Date: 2012-07-06 11:14:49 -0400 (Fri, 06 Jul 2012) Log Message: ----------- handle tags in XML import/export Modified Paths: -------------- trunk/krang/lib/Krang/Story.pm trunk/krang/schema/story.xsd Modified: trunk/krang/lib/Krang/Story.pm =================================================================== --- trunk/krang/lib/Krang/Story.pm 2012-07-06 15:04:35 UTC (rev 6827) +++ trunk/krang/lib/Krang/Story.pm 2012-07-06 15:14:49 UTC (rev 6828) @@ -2862,6 +2862,11 @@ $writer->dataElement(retired => $self->retired); $writer->dataElement(trashed => $self->trashed); + # tags + for my $tag ($self->tags) { + $writer->dataElement(tag => $tag); + } + # categories for my $category ($self->categories) { $writer->dataElement(category_id => $category->category_id); @@ -2976,6 +2981,9 @@ $story->slug($data->{slug} || ""); $story->title($data->{title} || ""); + # handle the tags + $story->tags($data->{tag}) if $data->{tag}; + # get category objects for story my @category_ids = map { $set->map_id(class => pkg('Category'), id => $_) } @{$data->{category_id}}; @@ -3027,6 +3035,9 @@ no_verify_unique => 1, no_verify_reserved => 1, ); + + # handle the tags + $story->tags($data->{tag}) if $data->{tag}; } # preserve UUID if available Modified: trunk/krang/schema/story.xsd =================================================================== --- trunk/krang/schema/story.xsd 2012-07-06 15:04:35 UTC (rev 6827) +++ trunk/krang/schema/story.xsd 2012-07-06 15:14:49 UTC (rev 6828) @@ -40,6 +40,7 @@ <xs:element name="notes"/> <xs:element name="retired" type="xs:boolean"/> <xs:element name="trashed" type="xs:boolean"/> + <xs:element name="tag" type="xs:string" minOccurs="0" maxOccurs="unbounded"/> <xs:element name="category_id" type="xs:int" maxOccurs="unbounded"/> <xs:element name="url" maxOccurs="unbounded"> <xs:simpleType> |