Skip to content

Commit

Permalink
added: Sort Items switch to Syndicated Content asset
Browse files Browse the repository at this point in the history
  • Loading branch information
Graham Knop committed Mar 28, 2010
1 parent 0a49321 commit 445486e
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 3 deletions.
1 change: 1 addition & 0 deletions docs/changelog/7.x.x.txt
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
18 changes: 17 additions & 1 deletion docs/upgrades/upgrade_7.9.1-7.9.2.pl
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ BEGIN

my $session = start(); # this line required

# upgrade functions go here
addSortItemsSCColumn($session);

finish($session); # this line required

Expand All @@ -44,6 +44,22 @@ BEGIN
# 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 --------------------------------

Expand Down
13 changes: 11 additions & 2 deletions lib/WebGUI/Asset/Wobject/SyndicatedContent.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand Down Expand Up @@ -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);
Expand Down
8 changes: 8 additions & 0 deletions lib/WebGUI/i18n/English/Asset_SyndicatedContent.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 445486e

Please sign in to comment.