diff options
author | Maria Odea B. Ching <oching@apache.org> | 2011-05-12 09:53:13 +0000 |
---|---|---|
committer | Maria Odea B. Ching <oching@apache.org> | 2011-05-12 09:53:13 +0000 |
commit | 397c8f30673d3a46edc27b414c846b2d202c0a5b (patch) | |
tree | b553776fdae0acf6f496d71ac49ca287e58fec27 | |
parent | 41f14160026be4b7852b3146b23583f43223c26c (diff) | |
download | archiva-397c8f30673d3a46edc27b414c846b2d202c0a5b.tar.gz archiva-397c8f30673d3a46edc27b414c846b2d202c0a5b.zip |
[MRM-1463] better layout for artifact download box
submitted by Lucien Weller
o enlarged box to 280px (CSS and images)
o display size in KB, MB, GB depending on effective size
o added classifier next to type when available
git-svn-id: https://svn.apache.org/repos/asf/archiva/branches/archiva-1.3.x@1102222 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/DownloadArtifact.java | 29 | ||||
-rw-r--r-- | archiva-modules/archiva-web/archiva-webapp/src/main/webapp/css/site.css | 6 | ||||
-rw-r--r-- | archiva-modules/archiva-web/archiva-webapp/src/main/webapp/images/download.bl.gif | bin | 179 -> 198 bytes | |||
-rw-r--r-- | archiva-modules/archiva-web/archiva-webapp/src/main/webapp/images/download.ml.gif | bin | 103 -> 116 bytes | |||
-rw-r--r-- | archiva-modules/archiva-web/archiva-webapp/src/main/webapp/images/download.tl.gif | bin | 179 -> 197 bytes |
5 files changed, 30 insertions, 5 deletions
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/DownloadArtifact.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/DownloadArtifact.java index 23dcadd84..4a0cbe24d 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/DownloadArtifact.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/DownloadArtifact.java @@ -59,6 +59,10 @@ public class DownloadArtifact extends Component { private static final String DEFAULT_DOWNLOAD_IMAGE = "download-type-other.png"; + + private static final double KILO_BYTE = 1024.0; + private static final double MEGA_BYTE = 1048576.0; + private static final double GIGA_BYTE = 1073741824.0; /** * @plexus.requirement role-hint="jdo" @@ -100,7 +104,7 @@ public class DownloadArtifact public DownloadArtifact( ValueStack stack, PageContext pageContext ) { super( stack ); - decimalFormat = new DecimalFormat( "#,#00" ); + decimalFormat = new DecimalFormat( "#,##0.00" ); this.req = (HttpServletRequest) pageContext.getRequest(); this.res = (HttpServletResponse) pageContext.getResponse(); try @@ -290,13 +294,34 @@ public class DownloadArtifact { String type = artifact.getType(); String linkText = StringUtils.capitalize( type ); + + if( artifact.getModel().getClassifier() != null && !artifact.getModel().getClassifier().trim().equals( "" ) ) + { + linkText = new StringBuilder(linkText).append(" (").append(artifact.getModel().getClassifier()).append(")").toString(); + } appendLink( sb, prefix, repo, artifact, linkText ); } private void appendFilesize( StringBuffer sb, ArchivaArtifact artifact ) { - sb.append( decimalFormat.format( artifact.getModel().getSize() ) ); + long size = artifact.getModel().getSize(); + if( size > GIGA_BYTE ) + { + sb.append( decimalFormat.format( artifact.getModel().getSize() / GIGA_BYTE ) ).append(" GB"); + } + else if( size > MEGA_BYTE ) + { + sb.append( decimalFormat.format( artifact.getModel().getSize() / MEGA_BYTE ) ).append(" MB"); + } + else if( size > KILO_BYTE ) + { + sb.append( decimalFormat.format( artifact.getModel().getSize() / KILO_BYTE ) ).append(" KB"); + } + else + { + sb.append( decimalFormat.format( artifact.getModel().getSize() ) ).append(" B"); + } } public void setArtifactId( String artifactId ) diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/css/site.css b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/css/site.css index 996614608..8b24948db 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/css/site.css +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/css/site.css @@ -45,7 +45,7 @@ font-weight: bold; margin: 15px auto 0px auto; height: auto; - width: 150px; + width: 280px; min-width: 120px; display: block; } @@ -113,7 +113,7 @@ .download table { margin-left: 2px; - width: 140px; + width: 270px; } .download .icon { @@ -122,7 +122,7 @@ .download .type { font-size: 0.9em; - text-align: center; + text-align: left; } .download .size { diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/images/download.bl.gif b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/images/download.bl.gif Binary files differindex c59ba0062..849bd582e 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/images/download.bl.gif +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/images/download.bl.gif diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/images/download.ml.gif b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/images/download.ml.gif Binary files differindex 8fcfa4220..7f193e405 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/images/download.ml.gif +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/images/download.ml.gif diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/images/download.tl.gif b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/images/download.tl.gif Binary files differindex b4a8e97d3..06ace5d45 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/images/download.tl.gif +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/images/download.tl.gif |