[seam-commits] Seam SVN: r8531 - in trunk/examples/wiki: src/main/org/jboss/seam/wiki/core/action and 6 other directories.
seam-commits at lists.jboss.org
seam-commits at lists.jboss.org
Mon Jul 28 14:04:04 EDT 2008
Author: christian.bauer at jboss.com
Date: 2008-07-28 14:04:03 -0400 (Mon, 28 Jul 2008)
New Revision: 8531
Modified:
trunk/examples/wiki/src/etc/i18n/messages_en.properties
trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/UploadHome.java
trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/model/WikiUploadImage.java
trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/ui/FileServlet.java
trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/upload/editor/WikiUploadImageEditor.java
trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/wikitext/renderer/jsf/UIWikiFormattedText.java
trunk/examples/wiki/view/includes/userInfo.xhtml
trunk/examples/wiki/view/userProfile_m.xhtml
Log:
Fixed bug in uploaded image thumbnail generation
Modified: trunk/examples/wiki/src/etc/i18n/messages_en.properties
===================================================================
--- trunk/examples/wiki/src/etc/i18n/messages_en.properties 2008-07-28 17:18:58 UTC (rev 8530)
+++ trunk/examples/wiki/src/etc/i18n/messages_en.properties 2008-07-28 18:04:03 UTC (rev 8531)
@@ -497,6 +497,7 @@
lacewiki.label.userProfile.UserProfile=User Profile
lacewiki.button.userProfile.EditAccount=<u>E</u>dit Account/Profile
lacewiki.button.userProfile.EditAccount.accesskey=E
+lacewiki.label.userProfile.NoProfile=No profile available.
# Document History
Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/UploadHome.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/UploadHome.java 2008-07-28 17:18:58 UTC (rev 8530)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/UploadHome.java 2008-07-28 18:04:03 UTC (rev 8531)
@@ -116,6 +116,11 @@
}
@Override
+ protected boolean beforeUpdate() {
+ return uploadEditor.beforeUpdate();
+ }
+
+ @Override
public String remove() {
return trash();
}
Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/model/WikiUploadImage.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/model/WikiUploadImage.java 2008-07-28 17:18:58 UTC (rev 8530)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/model/WikiUploadImage.java 2008-07-28 18:04:03 UTC (rev 8531)
@@ -8,6 +8,17 @@
//TODO: @org.hibernate.annotations.OnDelete(action = org.hibernate.annotations.OnDeleteAction.CASCADE)
public class WikiUploadImage extends WikiUpload<WikiUploadImage> {
+ public static enum Thumbnail {
+ SMALL('S'), MEDIUM('M'), LARGE('L'), FULL('F'), ATTACHMENT('A');
+ private char flag;
+ Thumbnail(char flag) {
+ this.flag = flag;
+ }
+ public char getFlag() {
+ return flag;
+ }
+ }
+
@Column(name = "SIZE_X")
private int sizeX;
@@ -15,7 +26,7 @@
private int sizeY;
@Column(name = "THUMBNAIL")
- private char thumbnail = 'M'; // Medium size thumbnail by default, not attached
+ private char thumbnail = Thumbnail.MEDIUM.getFlag(); // Medium size thumbnail by default, not attached
// TODO: SchemaExport needs length.. MySQL has "tinyblob", "mediumblob" and other such nonsense types, this
// is a best-guess value
@@ -65,7 +76,7 @@
}
public boolean isAttachedToDocuments() {
- return getThumbnail() == 'A';
+ return getThumbnail() == Thumbnail.ATTACHMENT.getFlag();
}
public void flatCopy(WikiUploadImage original, boolean copyLazyProperties) {
Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/ui/FileServlet.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/ui/FileServlet.java 2008-07-28 17:18:58 UTC (rev 8530)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/ui/FileServlet.java 2008-07-28 18:04:03 UTC (rev 8531)
@@ -116,7 +116,7 @@
// the file instead of displaying it
// TODO: What about PDFs? Lot's of people want to show PDFs inline...
if ( file != null &&
- ( !file.isInstance(WikiUploadImage.class) || ( ((WikiUploadImage)file).getThumbnail() == 'A') )
+ ( !file.isInstance(WikiUploadImage.class) || file.isAttachedToDocuments() )
) {
response.setHeader("Content-Disposition", "attachement; filename=\"" + file.getFilename() + "\"" );
}
Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/upload/editor/WikiUploadImageEditor.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/upload/editor/WikiUploadImageEditor.java 2008-07-28 17:18:58 UTC (rev 8530)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/upload/editor/WikiUploadImageEditor.java 2008-07-28 18:04:03 UTC (rev 8531)
@@ -47,7 +47,7 @@
}
public void selectThumbnail() {
- if (getInstance().getThumbnail() == 'F')
+ if (getInstance().getThumbnail() == WikiUploadImage.Thumbnail.FULL.getFlag())
imagePreviewSize = getInstance().getSizeX();
else
imagePreviewSize = getThumbnailWidth();
@@ -56,13 +56,10 @@
public int getThumbnailWidth() {
int thumbnailWidth = 80;
// TODO: We could make these sizes customizable
- switch (getInstance().getThumbnail()) {
- case 'M':
+ if (getInstance().getThumbnail() == WikiUploadImage.Thumbnail.MEDIUM.getFlag()) {
thumbnailWidth = 160;
- break;
- case 'L':
+ } else if (getInstance().getThumbnail() == WikiUploadImage.Thumbnail.LARGE.getFlag()) {
thumbnailWidth = 320;
- break;
}
return thumbnailWidth;
}
Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/wikitext/renderer/jsf/UIWikiFormattedText.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/wikitext/renderer/jsf/UIWikiFormattedText.java 2008-07-28 17:18:58 UTC (rev 8530)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/wikitext/renderer/jsf/UIWikiFormattedText.java 2008-07-28 18:04:03 UTC (rev 8531)
@@ -156,7 +156,7 @@
// TODO: This is not typesafe and clean, need different rendering strategy for WikiUpload subclasses
WikiUploadImage image = (WikiUploadImage)link.getFile();
- if (image.getThumbnail() == 'F') {
+ if (image.getThumbnail() == WikiUploadImage.Thumbnail.FULL.getFlag()) {
// Full size display, no thumbnail
//TODO: Make sure we really don't need this - but it messes up the comment form conversation:
//String imageUrl = WikiUtil.renderURL(image) + "&cid=" + Conversation.instance().getId();
Modified: trunk/examples/wiki/view/includes/userInfo.xhtml
===================================================================
--- trunk/examples/wiki/view/includes/userInfo.xhtml 2008-07-28 17:18:58 UTC (rev 8530)
+++ trunk/examples/wiki/view/includes/userInfo.xhtml 2008-07-28 18:04:03 UTC (rev 8531)
@@ -68,7 +68,7 @@
and empty user.profile.website
and empty user.profile.location
and empty user.profile.occupation}">
- <h:outputText value="#{messages['lacewiki.label.userInfo.NoProfile']}"/>
+ <h:outputText value="#{messages['lacewiki.label.userProfile.NoProfile']}"/>
</s:div>
</div>
Modified: trunk/examples/wiki/view/userProfile_m.xhtml
===================================================================
--- trunk/examples/wiki/view/userProfile_m.xhtml 2008-07-28 17:18:58 UTC (rev 8530)
+++ trunk/examples/wiki/view/userProfile_m.xhtml 2008-07-28 18:04:03 UTC (rev 8531)
@@ -9,7 +9,7 @@
template="themes/#{preferences.get('Wiki').themeName}/#{skin}/template.xhtml">
<ui:define name="screenname">
- <h:outputText value="#{messages['lacewiki.label.userInfo.UserInfo']}"/>
+ <h:outputText value="#{messages['lacewiki.label.userProfile.UserProfile']}"/>
</ui:define>
<ui:define name="content">
More information about the seam-commits
mailing list