You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openmeetings.apache.org by se...@apache.org on 2020/04/17 23:15:05 UTC

[openmeetings] 01/01: Fixes: - Adding heading to the size of public and personal drive. There is enough space for it. - Adjust height to 70px - Toggle download button enable disable instead of visible true/false - Fix so that you can actually download original. getFile(null) defaults to first slide and gives you a PNG. Not the original

This is an automated email from the ASF dual-hosted git repository.

sebawagner pushed a commit to branch feature/OPENMEETINGS-2273-room-file-tree-details-area
in repository https://gitbox.apache.org/repos/asf/openmeetings.git

commit 80f8b0aa8245bf5822cbdca58405579ee513ab13
Author: Sebastian Wagner <se...@apache.org>
AuthorDate: Sat Apr 18 11:12:04 2020 +1200

    Fixes:
     - Adding heading to the size of public and personal drive. There is enough space for it.
     - Adjust height to 70px
     - Toggle download button enable disable instead of visible true/false
     - Fix so that you can actually download original. getFile(null) defaults to first slide and gives you a PNG. Not the original
---
 .../openmeetings/db/entity/file/BaseFileItem.java  | 27 +++++++++++++++++++++-
 .../web/common/tree/FileTreePanel.html             | 11 ++++++---
 .../web/common/tree/FileTreePanel.java             |  7 +++---
 openmeetings-web/src/main/webapp/css/raw-tree.css  |  6 +++++
 .../src/main/webapp/css/raw-variables.css          |  2 +-
 5 files changed, 44 insertions(+), 9 deletions(-)

diff --git a/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/file/BaseFileItem.java b/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/file/BaseFileItem.java
index c8fa9cf..0d07d67 100644
--- a/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/file/BaseFileItem.java
+++ b/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/file/BaseFileItem.java
@@ -54,6 +54,7 @@ import javax.xml.bind.annotation.XmlTransient;
 import javax.xml.bind.annotation.XmlType;
 import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
 
+import org.apache.commons.io.FilenameUtils;
 import org.apache.openmeetings.db.bind.adapter.FileTypeAdapter;
 import org.apache.openmeetings.db.bind.adapter.IntAdapter;
 import org.apache.openmeetings.db.bind.adapter.LongAdapter;
@@ -296,7 +297,31 @@ public abstract class BaseFileItem extends HistoricalEntity {
 	public void setExternalType(String externalType) {
 		this.externalType = externalType;
 	}
-
+	
+	/**
+	 * Generates a link to download. As opposed to display it on the Whiteboard.
+	 * 
+	 * @param ext
+	 * @return
+	 */
+	public final File getDownloadFile(String ext) {
+		// passing in null for PRESENTATION won't return the original
+		if (ext == null && getType() != null && getType().equals(Type.PRESENTATION)) {
+			// could by either a Doc/XLS/PPT or just a PDF
+			return getFile(FilenameUtils.getExtension(getName()));
+		}
+		// for other file types passing in null should return original
+		return getFile(ext);
+	}
+
+	/**
+	 * Returns a file. But mostly to get a link for the Whiteboard.
+	 * 
+	 * In case of a Presentation it will try to assume the first slide if passing in null.
+	 * 
+	 * @param ext
+	 * @return
+	 */
 	public final File getFile(String ext) {
 		File f = null;
 		if (!isDeleted() && getHash() != null) {
diff --git a/openmeetings-web/src/main/java/org/apache/openmeetings/web/common/tree/FileTreePanel.html b/openmeetings-web/src/main/java/org/apache/openmeetings/web/common/tree/FileTreePanel.html
index 6d787f0..5ece9e5 100644
--- a/openmeetings-web/src/main/java/org/apache/openmeetings/web/common/tree/FileTreePanel.html
+++ b/openmeetings-web/src/main/java/org/apache/openmeetings/web/common/tree/FileTreePanel.html
@@ -52,11 +52,16 @@
 			<div wicket:id="tree"></div>
 		</div>
 		<div class="footer">
-			<span wicket:id="download" wicket:message="title:867"></span>
+			<span class="download" wicket:id="download" wicket:message="title:867"></span>
+			<div class="sizes">
+			    <span class="size font-weight-bold"><wicket:message key="923"/></span>
+				<span class="font-weight-bold">/</span>
+				<span class="font-weight-bold"><wicket:message key="924"/></span>
+			</div>
 			<div wicket:id="sizes" class="sizes">
 				<span class="size" wicket:message="title:923" wicket:id="homeSize"></span>
-				<span class="size">/</span>
-				<span class="size" wicket:message="title:924" wicket:id="publicSize"></span>
+				<span>/</span>
+				<span wicket:message="title:924" wicket:id="publicSize"></span>
 			</div>
 		</div>
 		<div wicket:id="errors"></div>
diff --git a/openmeetings-web/src/main/java/org/apache/openmeetings/web/common/tree/FileTreePanel.java b/openmeetings-web/src/main/java/org/apache/openmeetings/web/common/tree/FileTreePanel.java
index 1082227..943a7e9 100644
--- a/openmeetings-web/src/main/java/org/apache/openmeetings/web/common/tree/FileTreePanel.java
+++ b/openmeetings-web/src/main/java/org/apache/openmeetings/web/common/tree/FileTreePanel.java
@@ -158,8 +158,7 @@ public abstract class FileTreePanel extends Panel {
 
 		public void onDownlownClick(AjaxRequestTarget target, String ext) {
 			BaseFileItem fi = getLastSelected();
-			File f = ext == null && (Type.IMAGE == fi.getType() || Type.PRESENTATION == fi.getType())
-					? fi.getOriginal() : fi.getFile(ext);
+			File f = fi.getDownloadFile(ext);
 			if (f != null && f.exists()) {
 				dwnldFile = f;
 				downloader.initiate(target);
@@ -192,7 +191,7 @@ public abstract class FileTreePanel extends Panel {
 		final OmTreeProvider tp = new OmTreeProvider(roomId);
 		select(tp.getRoot(), null, false, false);
 		form.add(tree = new FileItemTree("tree", this, tp));
-		form.add(download.setVisible(false).setOutputMarkupPlaceholderTag(true));
+		form.add(download.setEnabled(false).setOutputMarkupPlaceholderTag(true));
 		add(form.add(downloader));
 	}
 
@@ -467,7 +466,7 @@ public abstract class FileTreePanel extends Panel {
 		}
 		updateSelected(target); //all finally selected are in the update list
 		if (target != null) {
-			target.add(trashBorder, download.setVisible(isDownloadable(lastSelected)));
+			target.add(trashBorder, download.setEnabled(isDownloadable(lastSelected)));
 		}
 	}
 
diff --git a/openmeetings-web/src/main/webapp/css/raw-tree.css b/openmeetings-web/src/main/webapp/css/raw-tree.css
index 6cb4f70..e263640 100644
--- a/openmeetings-web/src/main/webapp/css/raw-tree.css
+++ b/openmeetings-web/src/main/webapp/css/raw-tree.css
@@ -17,6 +17,12 @@
 }
 .file-tree .footer {
 	height: var(--tree-footer-height);
+	display: flex;
+    flex-direction: column;
+}
+.file-tree .footer .download {
+	padding-left: 5px;
+	padding-right: 5px;
 }
 .file-tree .footer .sizes {
 	display: inline-block;
diff --git a/openmeetings-web/src/main/webapp/css/raw-variables.css b/openmeetings-web/src/main/webapp/css/raw-variables.css
index 55b38dc..7f8c478 100644
--- a/openmeetings-web/src/main/webapp/css/raw-variables.css
+++ b/openmeetings-web/src/main/webapp/css/raw-variables.css
@@ -38,7 +38,7 @@ body.no-menu {
 }
 .file-tree {
 	--tree-header-height: 36px;
-	--tree-footer-height: 80px;
+	--tree-footer-height: 70px;
 }
 .main.room {
 	--header-height: 0px;