From: David ‘Bombe’ Roden Date: Wed, 13 Apr 2011 04:46:32 +0000 (+0200) Subject: Bring image-management up to speed. X-Git-Tag: beta-freefall-0.6.2-1~8 X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=commitdiff_plain;h=a23c4f218c3adf236d89d5927cae37d6e6e4feda Bring image-management up to speed. Conflicts: src/main/java/net/pterodactylus/sone/core/Core.java src/main/java/net/pterodactylus/sone/data/Sone.java src/main/java/net/pterodactylus/sone/web/WebInterface.java src/main/resources/i18n/sone.en.properties src/main/resources/static/css/sone.css --- a23c4f218c3adf236d89d5927cae37d6e6e4feda diff --cc src/main/java/net/pterodactylus/sone/data/Sone.java index 1a8c7df,2dd4bc1..aa4a155 --- a/src/main/java/net/pterodactylus/sone/data/Sone.java +++ b/src/main/java/net/pterodactylus/sone/data/Sone.java @@@ -27,10 -27,11 +27,12 @@@ import java.util.Set import java.util.logging.Level; import java.util.logging.Logger; + import net.pterodactylus.sone.core.Options; import net.pterodactylus.sone.freenet.wot.Identity; import net.pterodactylus.sone.template.SoneAccessor; + import net.pterodactylus.util.filter.Filter; import net.pterodactylus.util.logging.Logging; +import net.pterodactylus.util.validation.Validation; import freenet.keys.FreenetURI; /** @@@ -100,9 -110,9 +111,12 @@@ public class Sone implements Fingerprin /** The IDs of all liked replies. */ private final Set likedReplyIds = Collections.synchronizedSet(new HashSet()); + /** The albums of this Sone. */ + private final List albums = Collections.synchronizedList(new ArrayList()); + + /** Sone-specific options. */ + private final Options options = new Options(); + /** * Creates a new Sone. * @@@ -585,50 -597,14 +601,59 @@@ } /** + * Returns the albums of this Sone. + * + * @return The albums of this Sone + */ + public List getAlbums() { + return Collections.unmodifiableList(albums); + } + + /** + * Adds an album to this Sone. + * + * @param album + * The album to add + */ + public synchronized void addAlbum(Album album) { + Validation.begin().isNotNull("Album", album).check().isEqual("Album Owner", album.getSone(), this).check(); + albums.add(album); + } + + /** + * Sets the albums of this Sone. + * + * @param albums + * The albums of this Sone + */ + public synchronized void setAlbums(Collection albums) { + Validation.begin().isNotNull("Albums", albums).check(); + this.albums.clear(); + for (Album album : albums) { + addAlbum(album); + } + } + + /** + * Removes an album from this Sone. + * + * @param album + * The album to remove + */ + public synchronized void removeAlbum(Album album) { + Validation.begin().isNotNull("Album", album).check().isEqual("Album Owner", album.getSone(), this).check(); + albums.remove(album); + } + ++ /** + * Returns Sone-specific options. + * + * @return The options of this Sone + */ + public Options getOptions() { + return options; + } + // // FINGERPRINTABLE METHODS // diff --cc src/main/java/net/pterodactylus/sone/web/WebInterface.java index 376ff09,b3772f9..f5b111f --- a/src/main/java/net/pterodactylus/sone/web/WebInterface.java +++ b/src/main/java/net/pterodactylus/sone/web/WebInterface.java @@@ -46,12 -44,10 +46,12 @@@ import net.pterodactylus.sone.freenet.w import net.pterodactylus.sone.freenet.wot.Trust; import net.pterodactylus.sone.main.SonePlugin; import net.pterodactylus.sone.notify.ListNotification; +import net.pterodactylus.sone.template.AlbumAccessor; import net.pterodactylus.sone.template.CollectionAccessor; import net.pterodactylus.sone.template.CssClassNameFilter; - import net.pterodactylus.sone.template.GetPagePlugin; + import net.pterodactylus.sone.template.HttpRequestAccessor; import net.pterodactylus.sone.template.IdentityAccessor; +import net.pterodactylus.sone.template.ImageLinkFilter; import net.pterodactylus.sone.template.JavascriptFilter; import net.pterodactylus.sone.template.NotificationManagerAccessor; import net.pterodactylus.sone.template.ParserFilter; @@@ -219,7 -210,7 +224,8 @@@ public class WebInterface implements Co templateContextFactory.addFilter("unknown", new UnknownDateFilter(getL10n(), "View.Sone.Text.UnknownDate")); templateContextFactory.addFilter("format", new FormatFilter()); templateContextFactory.addFilter("sort", new CollectionSortFilter()); + templateContextFactory.addFilter("image-link", new ImageLinkFilter(templateContextFactory)); + templateContextFactory.addFilter("replyGroup", new ReplyGroupFilter()); templateContextFactory.addProvider(Provider.TEMPLATE_CONTEXT_PROVIDER); templateContextFactory.addProvider(new ClassPathTemplateProvider()); templateContextFactory.addTemplateObject("formPassword", formPassword); diff --cc src/main/resources/i18n/sone.en.properties index a5ab0c1,a73432d..a5f423e --- a/src/main/resources/i18n/sone.en.properties +++ b/src/main/resources/i18n/sone.en.properties @@@ -264,15 -240,23 +283,32 @@@ View.Trust.Tooltip.Trust=Trust this per View.Trust.Tooltip.Distrust=Assign negative trust to this person View.Trust.Tooltip.Untrust=Remove your trust assignment for this person +View.CreateAlbum.Title=Create Album +View.CreateAlbum.Label.Name=Name: +View.CreateAlbum.Label.Description=Description: + +View.UploadImage.Title=Upload Image +View.UploadImage.Label.Title=Title: +View.UploadImage.Label.Description=Description: +View.UploadImage.Button.UploadImage=Upload Image + + View.Time.InTheFuture=in the future + View.Time.AFewSecondsAgo=a few seconds ago + View.Time.HalfAMinuteAgo=about half a minute ago + View.Time.AMinuteAgo=about a minute ago + View.Time.XMinutesAgo=${min} minutes ago + View.Time.HalfAnHourAgo=half an hour ago + View.Time.AnHourAgo=about an hour ago + View.Time.XHoursAgo=${hour} hours ago + View.Time.ADayAgo=about a day ago + View.Time.XDaysAgo=${day} days ago + View.Time.AWeekAgo=about a week ago + View.Time.XWeeksAgo=${week} week ago + View.Time.AMonthAgo=about a month ago + View.Time.XMonthsAgo=${month} months ago + View.Time.AYearAgo=about a year ago + View.Time.XYearsAgo=${year} years ago + WebInterface.DefaultText.StatusUpdate=What’s on your mind? WebInterface.DefaultText.Message=Write a Message… WebInterface.DefaultText.Reply=Write a Reply… @@@ -284,15 -268,11 +320,19 @@@ WebInterface.DefaultText.BirthMonth=Mon WebInterface.DefaultText.BirthYear=Year WebInterface.DefaultText.FieldName=Field name WebInterface.DefaultText.Option.InsertionDelay=Time to wait after a Sone is modified before insert (in seconds) +WebInterface.DefaultText.Search=What are you looking for? +WebInterface.DefaultText.CreateAlbum.Name=Album title +WebInterface.DefaultText.CreateAlbum.Description=Album description +WebInterface.DefaultText.EditAlbum.Title=Album title +WebInterface.DefaultText.EditAlbum.Description=Album description +WebInterface.DefaultText.UploadImage.Title=Image title +WebInterface.DefaultText.UploadImage.Description=Image description +WebInterface.DefaultText.EditImage.Title=Image title +WebInterface.DefaultText.EditImage.Description=Image description + WebInterface.DefaultText.Option.PostsPerPage=Number of posts to show on a page + WebInterface.DefaultText.Option.PositiveTrust=The positive trust to assign + WebInterface.DefaultText.Option.NegativeTrust=The negative trust to assign + WebInterface.DefaultText.Option.TrustComment=The comment to set in the web of trust -WebInterface.DefaultText.Search=What are you looking for? WebInterface.Confirmation.DeletePostButton=Yes, delete! WebInterface.Confirmation.DeleteReplyButton=Yes, delete! WebInterface.SelectBox.Choose=Choose… diff --cc src/main/resources/static/css/sone.css index ab242a2,f6bb62d..9470850 --- a/src/main/resources/static/css/sone.css +++ b/src/main/resources/static/css/sone.css @@@ -549,36 -549,19 +553,49 @@@ textarea position: relative; } +#sone .backlinks { + font-size: 80%; +} + +#sone .backlinks .backlink { + display: inline; +} + +#sone .album { +} + +#sone .image { + width: 200px; + height: 150px; + display: table-cell; + vertical-align: middle; + text-align: center; + padding: 0.5ex; +} + +#sone .image img, #sone .single-image img { + padding: 1ex; + border: solid 1px #000; + background-color: #fff; +} + +#sone .backlinks .separator { + display: inline; +} + + #sone #search { + text-align: right; + } + + #sone #search input[type=text] { + width: 35em; + } + + #sone #sone-results + #sone #post-results { + clear: both; + padding-top: 1em; + } + #sone #tail { margin-top: 1em; border-top: solid 1px #ccc;