diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 7dd774c17..94b700a29 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -1,5 +1,6 @@ 7.9.2 - added #11412: Additional navigation in Gallery Photo View + - added: Sort Items switch to Syndicated Content asset 7.9.1 - fixed #11464: blank page after setting posts per page in Collaboration System to 0 (zero) diff --git a/docs/upgrades/upgrade_7.9.1-7.9.2.pl b/docs/upgrades/upgrade_7.9.1-7.9.2.pl index 4f656b44c..5669b4bce 100644 --- a/docs/upgrades/upgrade_7.9.1-7.9.2.pl +++ b/docs/upgrades/upgrade_7.9.1-7.9.2.pl @@ -30,7 +30,7 @@ my $quiet; # this line required my $session = start(); # this line required -# upgrade functions go here +addSortItemsSCColumn($session); finish($session); # this line required @@ -44,6 +44,22 @@ finish($session); # this line required # print "DONE!\n" unless $quiet; #} +#---------------------------------------------------------------------------- +sub addSortItemsSCColumn { + my $session = shift; + print "\tAdding sort items switch to Syndicated Content... " unless $quiet; + + my $sth = $session->db->read('DESCRIBE `SyndicatedContent`'); + while (my ($col) = $sth->array) { + if ($col eq 'sortItems') { + print "Skipped.\n" unless $quiet; + return; + } + } + $session->db->write('ALTER TABLE SyndicatedContent ADD COLUMN sortItems BOOL DEFAULT 1'); + + print "Done.\n" unless $quiet; +} # -------------- DO NOT EDIT BELOW THIS LINE -------------------------------- diff --git a/lib/WebGUI/Asset/Wobject/SyndicatedContent.pm b/lib/WebGUI/Asset/Wobject/SyndicatedContent.pm index c1da1d9e1..9b65c9f81 100644 --- a/lib/WebGUI/Asset/Wobject/SyndicatedContent.pm +++ b/lib/WebGUI/Asset/Wobject/SyndicatedContent.pm @@ -106,7 +106,14 @@ sub definition { label=>$i18n->get('hasTermsLabel'), hoverHelp=>$i18n->get('hasTermsLabel description'), maxlength=>255 - } + }, + sortItems => { + tab => 'properties', + fieldType => 'yesNo', + defaultValue => 1, + label => $i18n->get('sortItemsLabel'), + hoverHelp => $i18n->get('sortItemsLabel description'), + }, ); push(@{$definition}, { assetName=>$i18n->get('assetName'), @@ -185,7 +192,9 @@ sub generateFeed { } # sort them by date and remove any duplicate from the OR based term matching above - $feed->sort_item(); + if ($self->get('sortItems')) { + $feed->sort_item(); + } # limit the feed to the maximum number of headlines (or the feed generator limit). $feed->limit_item($limit); diff --git a/lib/WebGUI/i18n/English/Asset_SyndicatedContent.pm b/lib/WebGUI/i18n/English/Asset_SyndicatedContent.pm index eed570d00..e12422299 100644 --- a/lib/WebGUI/i18n/English/Asset_SyndicatedContent.pm +++ b/lib/WebGUI/i18n/English/Asset_SyndicatedContent.pm @@ -244,6 +244,14 @@ our $I18N = { lastUpdated => 1168227896, }, + 'sortItemsLabel' => { + message => q{Sort feed items by date?}, + }, + + 'sortItemsLabel description' => { + message => q{If enabled, items will be sorted by date. If disabled, items will be left in the order they appear in the original feed.}, + }, + 'syndicated content asset template variables title' => { message => q|Syndicated Content Asset Template Variables|, lastUpdated => 1164841146