super.processTemplate(request, templateContext);
String sortField = request.getHttpRequest().getParam("sort");
String sortOrder = request.getHttpRequest().getParam("order");
- String followedSones = request.getHttpRequest().getParam("followedSones");
+ String filter = request.getHttpRequest().getParam("filter");
templateContext.set("sort", (sortField != null) ? sortField : "name");
templateContext.set("order", (sortOrder != null) ? sortOrder : "asc");
- templateContext.set("followedSones", followedSones);
+ templateContext.set("filter", filter);
final Sone currentSone = getCurrentSone(request.getToadletContext(), false);
List<Sone> knownSones = Filters.filteredList(new ArrayList<Sone>(webInterface.getCore().getSones()), Sone.EMPTY_SONE_FILTER);
- if ((currentSone != null) && "show-only".equals(followedSones)) {
+ if ((currentSone != null) && "followed".equals(filter)) {
knownSones = Filters.filteredList(knownSones, new Filter<Sone>() {
@Override
return currentSone.hasFriend(sone.getId());
}
});
- } else if ((currentSone != null) && "hide".equals(followedSones)) {
+ } else if ((currentSone != null) && "not-followed".equals(filter)) {
knownSones = Filters.filteredList(knownSones, new Filter<Sone>() {
@Override
return !currentSone.hasFriend(sone.getId());
}
});
+ } else if ("new".equals(filter)) {
+ knownSones = Filters.filteredList(knownSones, new Filter<Sone>() {
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean filterObject(Sone sone) {
+ return webInterface.getCore().isNewSone(sone.getId());
+ }
+ });
+ } else if ("not-new".equals(filter)) {
+ knownSones = Filters.filteredList(knownSones, new Filter<Sone>() {
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean filterObject(Sone sone) {
+ return !webInterface.getCore().isNewSone(sone.getId());
+ }
+ });
}
if ("activity".equals(sortField)) {
if ("asc".equals(sortOrder)) {
Page.KnownSones.Title=Known Sones - Sone
Page.KnownSones.Page.Title=Known Sones
-Page.KnownSones.Text.NoKnownSones=There are currently no known Sones.
+Page.KnownSones.Text.NoKnownSones=There are currently no known Sones that match the given filter.
Page.KnownSones.Label.Sort=Sort:
-Page.KnownSones.Label.FollowedSones=Followed Sones:
+Page.KnownSones.Label.FilterSones=Filter Sones:
Page.KnownSones.Sort.Field.Name=Name
Page.KnownSones.Sort.Field.LastActivity=Last activity
Page.KnownSones.Sort.Field.Posts=Number of posts
Page.KnownSones.Sort.Field.Images=Number of images
Page.KnownSones.Sort.Order.Ascending=Ascending
Page.KnownSones.Sort.Order.Descending=Descending
-Page.KnownSones.FollowedSones.ShowOnly=Show only followed Sones
-Page.KnownSones.FollowedSones.Hide=Hide followed Sones
+Page.KnownSones.Filter.Followed=Show only followed Sones
+Page.KnownSones.Filter.NotFollowed=Hide followed Sones
+Page.KnownSones.Filter.New=Show only new Sones
+Page.KnownSones.Filter.NotNew=Hide new Sones
Page.KnownSones.Button.Apply=Apply
Page.KnownSones.Button.FollowAllSones=Follow all Sones on this page
Page.KnownSones.Button.UnfollowAllSones=Unfollow all Sones on this page
</div>
<%ifnull !currentSone>
<div>
- <%= Page.KnownSones.Label.FollowedSones|l10n|html>
- <select name="followedSones">
+ <%= Page.KnownSones.Label.FilterSones|l10n|html>
+ <select name="filter">
<option value="none"></option>
- <option value="show-only"<%if followedSones|match value="show-only"> selected="selected"<%/if>><%= Page.KnownSones.FollowedSones.ShowOnly|l10n|html></option>
- <option value="hide"<%if followedSones|match value="hide"> selected="selected"<%/if>><%= Page.KnownSones.FollowedSones.Hide|l10n|html></option>
+ <%ifnull !currentSone>
+ <option value="followed"<%if filter|match value="followed"> selected="selected"<%/if>><%= Page.KnownSones.Filter.Followed|l10n|html></option>
+ <option value="not-followed"<%if filter|match value="not-followed"> selected="selected"<%/if>><%= Page.KnownSones.Filter.NotFollowed|l10n|html></option>
+ <%/if>
+ <option value="new"<%if filter|match value="new"> selected="selected"<%/if>><%= Page.KnownSones.Filter.New|l10n|html></option>
+ <option value="not-new"<%if filter|match value="not-new"> selected="selected"<%/if>><%= Page.KnownSones.Filter.NotNew|l10n|html></option>
</select>
</div>
<%/if>