Compare commits

...

64 Commits

Author SHA1 Message Date
Francesco Mangiacrapa 00a747735a replaced social dependencies, see #27083#note-16 2024-04-22 16:39:55 +02:00
Francesco Mangiacrapa 39c91b5721 removed -SNAPSHOT to be released 2024-03-19 10:43:37 +01:00
Francesco Mangiacrapa 693a4fc281 Merge pull request 'edit_facility_26115' (!5) from edit_facility_26115 into master
Reviewed-on: #5
2024-03-19 10:42:37 +01:00
Francesco Mangiacrapa 4e409b16cd updated changelog 2024-03-19 10:42:08 +01:00
Francesco Mangiacrapa 0e88bbbab5 commented profile 2024-02-23 17:34:21 +01:00
Francesco Mangiacrapa 31130db6c9 updated pom 2024-02-23 17:09:25 +01:00
Francesco Mangiacrapa 18c0300dc7 removed data-miner-manager-cl (indirect) dependency 2024-02-20 17:25:02 +01:00
Francesco Mangiacrapa b678fdeedc reverted to GWT 2.7.0 2024-02-20 14:57:41 +01:00
Francesco Mangiacrapa 6a19713ea4 - Moved to maven parent 1.2.0
- Added lombok 1.18.4 (provided) to avoid
`java.lang.ClassNotFoundException: com.sun.tools.javac.code.TypeTags`
- Moved to GWT 2.8.2
2024-02-20 11:49:03 +01:00
Francesco Mangiacrapa a7bed05f4c fixing the incident #23862 2022-09-14 14:58:01 +02:00
Francesco Mangiacrapa 9ca232196e Removed -SNAPSHOT to be released. Passed to maven-portal-bom.3.6.4 2022-09-05 14:52:08 +02:00
Francesco Mangiacrapa 040b2c3817 Bug fixing issues #23676, #23789 2022-09-05 14:09:33 +02:00
Francesco Mangiacrapa 506d129cbc removed -SNAPSHOT to be released 2022-06-27 15:02:25 +02:00
Francesco Mangiacrapa fead3eaee0 #23523 Updated to maven-portal-bom 3.6.4 2022-06-27 14:51:32 +02:00
Francesco Mangiacrapa c9e3430b83 Removed -SNAPSHOT to be released 2022-05-03 16:02:12 +02:00
Francesco Mangiacrapa 074f7866ea Merge pull request 'task_23225' (!4) from task_23225 into master
Reviewed-on: #4
2022-05-03 15:58:54 +02:00
Francesco Mangiacrapa 10a0985740 Updated the description of the Enhancement implemented 2022-05-03 15:57:53 +02:00
Francesco Mangiacrapa 2f172d6b56 Moved to v 6.35.0-SNAPSHOT. Updated the method
NotificationStorageHubUtil according to #23225
2022-05-02 15:11:48 +02:00
Francesco Mangiacrapa 0c0ead6389 removed -SNAPSHOT to be released. Used maven-portal-bom 3.6.3 2022-03-24 10:47:11 +01:00
Francesco Mangiacrapa 7496865a60 Merge pull request '#23026 reinforced the logic to discovery the WEA Generic Resource' (!3) from feature_23026 into master
Reviewed-on: #3
2022-03-24 10:43:17 +01:00
Francesco Mangiacrapa 0d184f3b80 #23026 reinforced the logic to discovery the WEA Generic Resource 2022-03-23 15:51:04 +01:00
Francesco Mangiacrapa 1a62ba4ca2 add source folder src/test/resources 2022-03-23 11:59:40 +01:00
Francesco Mangiacrapa b1dac31708 moved to 6.34.2-SNAPSHOT, commented xstream dependency 2022-03-09 16:35:49 +01:00
Francesco Mangiacrapa 58fc766113 #22923 Migrate to maven-portal-bom 3.7.0[-SNAPSHOT] 2022-03-08 11:55:06 +01:00
Francesco Mangiacrapa 751e9b9b5e removed -SNAPSHOT to be released 2021-12-20 15:02:54 +01:00
Francesco Mangiacrapa 064009cea0 Bug fixing #22578. Moved to v6.34.1-SNAPSHOT 2021-12-20 14:41:43 +01:00
Francesco Mangiacrapa d4f64e35ed only replaced * with - 2021-11-10 14:59:49 +01:00
Francesco Mangiacrapa 47f566899f removed -SNAPSHOT to be released 2021-11-10 10:26:28 +01:00
Francesco Mangiacrapa 0e90e12b98 Implemented feature #22251 - Make workspace file size field smart 2021-11-05 12:03:56 +01:00
Francesco Mangiacrapa 027c05eec8 Moved to maven-portal-bom 3.6.3 2021-06-24 15:04:47 +02:00
Francesco Mangiacrapa 98ea30ff1e removed -SNASPSHOT to be released 2021-06-14 11:06:39 +02:00
Francesco Mangiacrapa aec4b7a5b7 bug fixed #21575 2021-06-11 17:58:10 +02:00
Francesco Mangiacrapa a919610ea9 removed -SNAPSHOT to be released 2021-05-25 11:01:10 +02:00
Francesco Mangiacrapa b5effefc64 Merge pull request 'task_21388' (#2) from task_21388 into master
Reviewed-on: #2
2021-05-25 10:57:37 +02:00
Francesco Mangiacrapa 0a0e6b1479 added new folder synched icon 2021-05-24 15:33:34 +02:00
Francesco Mangiacrapa 1bfd347cc5 only added and updated the icon synched_folder 2021-05-20 17:55:41 +02:00
Francesco Mangiacrapa 1265cd6b19 [#21444] Moved to maven-portal-bom >= 3.6.2-SNAPSHOT 2021-05-20 11:03:44 +02:00
Francesco Mangiacrapa a6609a5b4a using internal getConfiguration 2021-05-19 17:29:38 +02:00
Francesco Mangiacrapa c8159a783e in progress on #21388 2021-05-18 15:34:43 +02:00
Francesco Mangiacrapa dc1188cf2b fixed the control-label "Synched with THREDDS" 2021-05-17 18:19:15 +02:00
Francesco Mangiacrapa 996c982b39 in progess on #21388 2021-05-14 17:18:16 +02:00
Francesco Mangiacrapa cc17be1761 in progress on #21388 2021-05-12 16:33:37 +02:00
Francesco Mangiacrapa fd6d1570e8 moved to 6.33.0-SNAPSHOT and updated the CHANGELOG consequently 2021-05-11 16:45:31 +02:00
Francesco Mangiacrapa 00c048af95 removed -SNAPSHOT to be released 2021-04-16 17:44:29 +02:00
Francesco Mangiacrapa 15c522518b #21153 Upgrade the maven-portal-bom to 3.6.1 version
#21154 Test in DEV the Workspace with maven-portal-bom 3.6.1-SNAPSHOT
version
2021-04-12 15:51:30 +02:00
Francesco Mangiacrapa a09fe4af69 merged with "task_20762" 2021-04-09 15:09:29 +02:00
Francesco Mangiacrapa 79f24b497e only updated changelog 2021-03-25 15:08:24 +01:00
Francesco Mangiacrapa b91b217dcd Declared the workspace-uploader range [2.X, 3.X-SNAPSHOT) 2021-03-25 15:03:14 +01:00
Francesco Mangiacrapa 842d83a104 Declared the workspace-uploader range [2.0, 3.0) 2021-03-25 11:04:08 +01:00
Francesco Mangiacrapa 3d8cf49f2e Merge branch 'master' of https://code-repo.d4science.org/gCubeSystem/workspace-tree-widget.git 2021-01-21 14:58:45 +01:00
Francesco Mangiacrapa 415e39cac0 Removed -SNAPSHOT to be released 2021-01-21 14:57:51 +01:00
Francesco Mangiacrapa 20bc8be488 Updated Eclipse Repo URL to new one https://nexus.d4science.org 2021-01-20 14:22:01 +01:00
Francesco Mangiacrapa 0b63d5304a Moved to 6.31.2-SNAPSHOT. Just including patched library #20457 2021-01-18 13:15:19 +01:00
Roberto Cirillo ee77480d64 Update 'CHANGELOG.md' 2020-10-19 15:59:07 +02:00
Roberto Cirillo 040e16d298 Update 'CHANGELOG.md'
[#19952] Fixed incident v 6.31.1
2020-10-19 15:58:33 +02:00
Roberto Cirillo b364b93e99 Update 'pom.xml'
update pom to version 6.31.1 (new version of workspace-sharing-widget)
2020-10-19 15:56:46 +02:00
Francesco Mangiacrapa b2872ba474 Updated changelog 2020-09-29 09:47:37 +02:00
Francesco Mangiacrapa 96dab14983 Bug fixes https://support.d4science.org/issues/19759#note-12 2020-09-29 09:43:52 +02:00
Francesco Mangiacrapa 1175c4fb77 removed -SNAPSHOT to be released 2020-08-25 15:38:52 +02:00
Francesco Mangiacrapa 049f96dff2 Optimized the business logic to show the preview of files by Get Info
(as reported at https://support.d4science.org/issues/19600#note-7)
2020-08-25 11:10:58 +02:00
Francesco Mangiacrapa 26b7497446 added new spinner and improved stylesheet for displayng File Preview 2020-07-29 15:37:19 +02:00
Francesco Mangiacrapa d88ce70e93 removed not needed repository <repository>
<id>Apache</id>
			<name>Apache repository</name>
			<url>https://repo1.maven.org/maven2</url>
		</repository>
2020-07-28 16:05:44 +02:00
Francesco Mangiacrapa af33f2fb78 merged with needed dependencies of tika 2020-07-28 16:02:51 +02:00
Francesco Mangiacrapa 95194f2ed2 merged with branch version #19600 2020-07-28 15:02:19 +02:00
53 changed files with 4083 additions and 1842 deletions

View File

@ -6,26 +6,21 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="test" value="true"/>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
<attributes>
<attribute name="test" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="org.eclipse.jst.component.nondependency" value=""/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="test" value="true"/>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
@ -40,5 +35,16 @@
<attribute name="optional" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
<attribute name="org.eclipse.jst.component.nondependency" value=""/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>

View File

@ -2,4 +2,5 @@ eclipse.preferences.version=1
encoding//src/main/java=UTF-8
encoding//src/main/resources=UTF-8
encoding//src/test/java=UTF-8
encoding//src/test/resources=UTF-8
encoding/<project>=UTF-8

View File

@ -1,7 +1,72 @@
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="workspace-tree-widget">
<wb-resource deploy-path="/" source-path="/src/main/java"/>
<wb-resource deploy-path="/" source-path="/src/main/resources"/>
<wb-resource deploy-path="/" source-path="/target/generated-sources/annotations"/>
</wb-module>
</project-modules>

View File

@ -4,30 +4,126 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [v6.35.3] - 2024-03-19
## [v6.30.1] [r4.24.0] - 2020-06-25
- Moved to maven parent 1.2.0
- Added lombok 1.18.4 (provided) to avoid `java.lang.ClassNotFoundException: com.sun.tools.javac.code.TypeTags`
- Equipped with the new Catalogue Publishing Widget [#26825]
- image-previewer-widget range at [1.0.0, 1.3.0-SNAPSHOT)
**Fixes**
## [v6.35.2] - 2022-09-14
[Task #19544] update the unsharing messages in the accounting history
#### Bug fixed
- [#23676] Fixed - Added extension .txt to ASC files when dowloaded
- [#23789] Fixed - Notebook files (.ipynb) are downloaded with .txt attached.
- [#23862] Fixed - Downloading folders containing a "." in the name, the .zip is appended to file name
## [v6.35.1] - 2022-06-27
- [#23523] Updated to maven-portal-bom 3.6.4
## [v6.35.0] - 2022-05-03
#### Enhancements
- [#23225] Updated the method to read the members of (VRE or Simple) shared folders
## [v6.34.3] - 2022-03-24
#### Enhancements
- [#23020] Reinforce the (ApplicationProfile-)Workspace-Explorer-App discovery
- [#22923] Migrate to maven-portal-bom 3.7.0[-SNAPSHOT]
## [v6.34.1] - 2021-12-20
#### Fixes
- [#22578] GetInfo facility invoked by Tree View does not display properly the Owner field
## [v6.34.0] - 2021-11-05
#### Enhancements
- [#22251] Make workspace file size field smart
## [v6.33.1] - 2021-06-11
#### Fixes
[#21575] Fixed icon associated with simple folders in the grid view
Moved to maven-portal-bom 3.6.3
## [v6.33.0] - 2021-05-11
#### Enhancements
[#21388] Integrated with new workflow to interact with ws-thredds 1.x
[#21444] Moved to maven-portal-bom >= 3.6.2-SNAPSHOT
## [v6.32.0] - 2021-04-12
#### Enhancements
[#21153] Upgrade the maven-portal-bom to 3.6.1 version
[#20762] Moved to ckan-metadata-publisher-widget 2.X
## [v6.31.3] - 2021-03-25
#### Bug Fixes
Declared the workspace-uploader range [2.X, 3.X-SNAPSHOT)
## [v6.31.2] - 2021-01-18
#### Bug Fixes
[#20457] Just including patched library
## [v6.31.1] - 2020-10-19
#### Bug Fixes
[#19952] Fixed incident
## [v6.31.0] - 2020-09-29
#### Enhancements
[#19600] revisit the "Get Info" Dialog in a modern view
#### New Features
[#19695] Show the file preview via Google Docs Viewer
#### Bug Fixes
[#19759#note-12] Fixed updating the description of a folder
## [v6.30.1] - 2020-06-25
#### Fixes
[#19544] update the unsharing messages in the accounting history
## [v6.30.0] [r4.23.0] - 2020-05-18
## [v6.30.0] - 2020-05-18
**New Features**
#### New Features
[#19058] Restore operation: the user has to select the destination folder
**Fixes**
#### Fixes
[#19232] Fixed upload of file names that use special characters
[#19243] Fixed upload archive facility does not work properly with Windows OS
## [v6.29.0] [r4.21.0] - 2020-03-27
## [v6.29.0] - 2020-03-27
**New Features**
#### New Features
[#18150] Get Shareable Link as Long URL also
@ -35,7 +131,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
[#18174] Workspace Search facility, business logic applied on workspace side
**Fixes**
#### Fixes
[#18577] Fixing Shareable link informative text for public file

111
pom.xml
View File

@ -5,13 +5,13 @@
<parent>
<artifactId>maven-parent</artifactId>
<groupId>org.gcube.tools</groupId>
<version>1.1.0</version>
<version>1.2.0</version>
<relativePath />
</parent>
<groupId>org.gcube.portlets.user</groupId>
<artifactId>workspace-tree-widget</artifactId>
<version>6.30.1</version>
<version>6.35.3</version>
<name>gCube Workspace Tree Widget</name>
<description>
gCube Workspace Tree Widget is a widget to navigate and interact with gCube Workspace
@ -27,7 +27,7 @@
<repositories>
<repository>
<id>eclipselink</id>
<url>http://maven.research-infrastructures.eu:8081/nexus/content/repositories/eclipselink/</url>
<url>https://nexus.d4science.org/nexus/content/repositories/eclipselink/</url>
</repository>
</repositories>
@ -39,6 +39,9 @@
<maven.compiler.target>1.8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<gxt2.2.5-gwt2.X-version>2.7.0</gxt2.2.5-gwt2.X-version>
<gcube-portal-bom-version>3.7.0</gcube-portal-bom-version>
</properties>
<dependencyManagement>
@ -46,31 +49,40 @@
<dependency>
<groupId>org.gcube.distribution</groupId>
<artifactId>maven-portal-bom</artifactId>
<version>3.6.0</version>
<version>${gcube-portal-bom-version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<!-- <profiles> -->
<!-- <profile> -->
<!-- <id>workspace-tree-release-profile</id> -->
<!-- <activation> -->
<!-- <property> -->
<!-- <name>Release</name> -->
<!-- </property> -->
<!-- </activation> -->
<!-- <properties> -->
<!-- <gcube-portal-bom-version>3.7.0</gcube-portal-bom-version> -->
<!-- </properties> -->
<!-- </profile> -->
<!-- <profile> -->
<!-- <id>workspace-tree-snapshot-profile</id> -->
<!-- <activation> -->
<!-- <property> -->
<!-- <name>!Release</name> -->
<!-- </property> -->
<!-- </activation> -->
<!-- <properties> -->
<!-- <gcube-portal-bom-version>3.8.0-SNAPSHOT</gcube-portal-bom-version> -->
<!-- </properties> -->
<!-- </profile> -->
<!-- </profiles> -->
<dependencies>
<!-- UNCOMMENT THIS TO RUN IN DEVO MODE -->
<!-- <dependency> -->
<!-- <groupId>xerces</groupId> -->
<!-- <artifactId>xerces</artifactId> -->
<!-- <version>2.4.0</version> -->
<!-- </dependency> -->
<!-- This dependency is needed to use GWT UI BInder without old Xerces
version of gCore complaining -->
<!-- <dependency> -->
<!-- <groupId>xerces</groupId> -->
<!-- <artifactId>xercesImpl</artifactId> -->
<!-- <version>2.9.1</version> -->
<!-- <scope>provided</scope> -->
<!-- </dependency> -->
<!-- Google Web Toolkit (GWT) -->
<dependency>
<groupId>com.google.gwt</groupId>
@ -81,13 +93,12 @@
<dependency>
<groupId>org.gcube.portal</groupId>
<artifactId>storagehub-icons-library</artifactId>
<version>[1.0.0, 2.0.0-SNAPSHOT)</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.sencha.gxt</groupId>
<artifactId>gxt2.2.5-gwt2.X</artifactId>
<version>${gwtVersion}</version>
<version>${gxt2.2.5-gwt2.X-version}</version>
<scope>compile</scope>
</dependency>
@ -155,7 +166,7 @@
<dependency>
<groupId>org.gcube.portlets.widgets</groupId>
<artifactId>image-previewer-widget</artifactId>
<version>[1.0.0,)</version>
<version>[1.0.0, 1.3.0-SNAPSHOT)</version>
<exclusions>
<exclusion>
<groupId>com.google.gwt</groupId>
@ -177,10 +188,24 @@
<scope>compile</scope>
</dependency>
<dependency>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
<version>1.1.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.portlets.widgets</groupId>
<artifactId>ws-task-executor-widget</artifactId>
<version>[0.0.1, 2.0.0-SNAPSHOT)</version>
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
</dependency>
<dependency>
@ -202,23 +227,23 @@
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
<!-- <version>1.4.5</version> -->
</dependency>
<!-- <dependency> -->
<!-- <groupId>com.thoughtworks.xstream</groupId> -->
<!-- <artifactId>xstream</artifactId> -->
<!-- <version>1.4.5</version> -->
<!-- </dependency> -->
<dependency>
<groupId>org.gcube.portlets.widgets</groupId>
<artifactId>workspace-uploader</artifactId>
<version>[1.0.0, 3.0.0-SNAPSHOT)</version>
<version>[2.0.0, 3.0.0-SNAPSHOT)</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.gcube.common</groupId>
<artifactId>storagehub-client-wrapper</artifactId>
<version>[0.6.2, 1.0.0-SNAPSHOT)</version>
<version>[1.0.0, 2.0.0-SNAPSHOT)</version>
<scope>compile</scope>
</dependency>
@ -241,6 +266,7 @@
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<scope>test</scope>
</dependency>
<dependency>
@ -250,9 +276,22 @@
</dependency>
<dependency>
<groupId>org.gcube.portal</groupId>
<artifactId>social-networking-library</artifactId>
<artifactId>social-library-stubs</artifactId>
<version>[1.0.0-SNAPSHOT, 2.0.0)</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.social-networking</groupId>
<artifactId>social-service-client</artifactId>
<version>[2.0.0-SNAPSHOT, 3.0.0)</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>org.gcube.portal</groupId>
<artifactId>social-networking-library</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.gcube.applicationsupportlayer</groupId>
<artifactId>aslsocial</artifactId>
@ -263,8 +302,14 @@
<dependency>
<groupId>org.gcube.portlets.widgets</groupId>
<artifactId>ckan-metadata-publisher-widget</artifactId>
<version>[1.0.0,2.0.0-SNAPSHOT)</version>
<version>[2.0.0-SNAPSHOT, 3.0.0)</version>
<scope>compile</scope>
<exclusions>
<exclusion>
<groupId>com.allen-sauer.gwt.log</groupId>
<artifactId>gwt-log</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- JSON PARSER -->

View File

@ -118,7 +118,6 @@ import org.gcube.portlets.user.workspace.client.view.tree.AsyncTreePanel;
import org.gcube.portlets.user.workspace.client.view.windows.DialogAddFolderAndSmart;
import org.gcube.portlets.user.workspace.client.view.windows.DialogAddFolderAndSmart.AddType;
import org.gcube.portlets.user.workspace.client.view.windows.DialogAddUrl;
import org.gcube.portlets.user.workspace.client.view.windows.DialogGetInfo;
import org.gcube.portlets.user.workspace.client.view.windows.DialogGetLink;
import org.gcube.portlets.user.workspace.client.view.windows.DialogGetLink.Link_Type;
import org.gcube.portlets.user.workspace.client.view.windows.DialogShareLink;
@ -175,6 +174,7 @@ import com.github.gwtbootstrap.client.ui.Modal;
import com.github.gwtbootstrap.client.ui.event.HideEvent;
import com.github.gwtbootstrap.client.ui.event.HideHandler;
import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Element;
import com.google.gwt.event.shared.EventHandler;
import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.http.client.RequestBuilder;
@ -209,6 +209,8 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
private WsTaskExecutorWidget taskExecutor = new WsTaskExecutorWidget();
public static final int delayTime = 3000;
public static Map<String, List<String>> mapOfAllowedMimeTypesForPreview = null;
/**
* Instantiates a new app controller explorer.
@ -310,7 +312,7 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
modal.setTitle("Publish Item");
modal.addStyleName("insert-metadata-modal-style");
modal.addStyleName("modal-top-custom");
// ((Element)modal.getElement().getChildNodes().getItem(1)).addClassName("modal-body-custom");
((Element)modal.getElement().getChildNodes().getItem(1)).addClassName("modal-body-ws-tree ");
modal.add(new CreateDatasetForm(folderId, eventBus));
modal.setCloseVisible(true);
modal.show();
@ -690,8 +692,35 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
@Override
public void onGetInfo(GetInfoEvent getInfoEvent) {
new DialogGetInfo(getInfoEvent.getSourceFile());
//new DialogInfoboot(getInfoEvent.getSourceFile());
//new DialogGetInfo(getInfoEvent.getSourceFile());
final FileModel fileItem = getInfoEvent.getSourceFile();
if(fileItem!=null) {
/*final Modal modal = new Modal(true);
modal.setCloseVisible(true);
modal.setTitle(fileItem.getName() + " - Details");
modal.setMaxHeigth("800px");
ModalFooter modalFooter = new ModalFooter();
final Button buttClose = new Button("Close");
modalFooter.add(buttClose);
buttClose.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
modal.hide();
}
});
DialogGetInfoBootstrap dlg = new DialogGetInfoBootstrap(fileItem);
modal.add(dlg);
modal.add(modalFooter);
modal.show();*/
notifySubscriber(new GetInfoEvent(fileItem));
}
}
});
@ -2102,6 +2131,9 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
} else if (event instanceof LoadFolderEvent) {
LoadFolderEvent loadFolderEvent = (LoadFolderEvent) event;
sub.loadFolder(loadFolderEvent.getTargetFolder());
} else if (event instanceof GetInfoEvent) {
GetInfoEvent getInfoEvent = (GetInfoEvent) event;
sub.showDetails(getInfoEvent.getSourceFile(), mapOfAllowedMimeTypesForPreview);
}
}
@ -2297,6 +2329,7 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
this.explorerPanel = new ExplorerPanel(true, true);
loadMyLogin();
loadMyFirstName();
loadAllowedMimeTypesForPreview();
return this.explorerPanel;
}
@ -2318,9 +2351,12 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
this.selectRootItem = selectRootItem;
loadMyLogin();
loadMyFirstName();
loadAllowedMimeTypesForPreview();
return this.explorerPanel;
}
/**
* Edi permissions.
*
@ -2604,6 +2640,22 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
}
});
}
private void loadAllowedMimeTypesForPreview() {
rpcWorkspaceService.getAllowedMimetypesForPreview(new AsyncCallback<Map<String,List<String>>>() {
@Override
public void onFailure(Throwable caught) {
}
@Override
public void onSuccess(Map<String, List<String>> result) {
mapOfAllowedMimeTypesForPreview = result;
}
});
}
/**
* Load my first name.

View File

@ -4,7 +4,6 @@ import java.util.HashMap;
import java.util.Map;
import com.google.gwt.core.client.GWT;
import com.google.gwt.i18n.client.NumberFormat;
//import com.google.gwt.dom.client.Element;
//import com.google.gwt.user.client.Element;
@ -217,7 +216,7 @@ public static enum WS_UPLOAD_TYPE {File, Archive};
public static final String ACCOUNTING_HISTORY_OF = "Accounting history of: ";
public static final String ACCOUNTING_READERS_OF = "Accounting readers of: ";
public static final NumberFormat numberFormatterKB = NumberFormat.getFormat("#,##0 KB;(#,##0 KB)");
//public static final NumberFormat numberFormatterKB = NumberFormat.getFormat("#,##0 KB;(#,##0 KB)");
//USED IN HTTP GET AS PARAMETER.. THIS PARAMS ARE REPLICATED IN THE CONSTANTS OF TREE WIDGET
public static final String GET_SEARCH_PARAMETER ="search";

View File

@ -1,5 +1,7 @@
package org.gcube.portlets.user.workspace.client.event;
import org.gcube.portlets.user.workspace.client.interfaces.EventsTypeEnum;
import org.gcube.portlets.user.workspace.client.interfaces.GuiEventInterface;
import org.gcube.portlets.user.workspace.client.model.FileModel;
import com.google.gwt.event.shared.GwtEvent;
@ -9,7 +11,7 @@ import com.google.gwt.event.shared.GwtEvent;
* @author Francesco Mangiacrapa francesco.mangiacrapa{@literal @}isti.cnr.it
*
*/
public class GetInfoEvent extends GwtEvent<GetInfoEventHandler> {
public class GetInfoEvent extends GwtEvent<GetInfoEventHandler> implements GuiEventInterface{
public static Type<GetInfoEventHandler> TYPE = new Type<GetInfoEventHandler>();
private FileModel targetFile = null;
@ -32,4 +34,9 @@ public class GetInfoEvent extends GwtEvent<GetInfoEventHandler> {
public FileModel getSourceFile() {
return targetFile;
}
@Override
public EventsTypeEnum getKey() {
return EventsTypeEnum.GET_DETAILS_FOR_ITEM;
}
}

View File

@ -35,5 +35,6 @@ public enum EventsTypeEnum
UPDATE_WORKSPACE_SIZE,
ADD_ADMINISTRATOR_EVENT,
FILE_VERSIONING_HISTORY_EVENT,
GET_DETAILS_FOR_ITEM,
LOAD_FOLDER_EVENT;
}

View File

@ -2,6 +2,7 @@ package org.gcube.portlets.user.workspace.client.interfaces;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.gcube.portlets.user.workspace.client.ConstantsExplorer.ViewSwitchType;
import org.gcube.portlets.user.workspace.client.ConstantsExplorer.WS_UPLOAD_TYPE;
@ -10,6 +11,7 @@ import org.gcube.portlets.user.workspace.client.model.FolderModel;
import org.gcube.portlets.user.workspace.shared.WorkspaceTrashOperation;
// TODO: Auto-generated Javadoc
// Implements this interface to receive events by tree async
/**
* The Interface SubscriberInterface.
@ -196,5 +198,16 @@ public interface SubscriberInterface {
* @param folderTarget the folder target
*/
void loadFolder(FileModel folderTarget);
/**
* Show details.
*
* @param fileModel the file model
* @param mapAllowedMimeTypesForPreview the map allowed mime types for preview
*/
void showDetails(FileModel fileModel, Map<String,List<String>> mapAllowedMimeTypesForPreview);
}

View File

@ -3,7 +3,6 @@ package org.gcube.portlets.user.workspace.client.model;
import java.io.Serializable;
import java.util.List;
import org.gcube.portal.wssynclibrary.shared.thredds.Sync_Status;
import org.gcube.portlets.user.workspace.client.ConstantsExplorer;
import org.gcube.portlets.user.workspace.client.interfaces.GXTCategorySmartFolder;
import org.gcube.portlets.user.workspace.client.interfaces.GXTFolderItemTypeEnum;
@ -16,13 +15,12 @@ import com.google.gwt.user.client.rpc.IsSerializable;
import com.google.gwt.user.client.ui.AbstractImagePrototype;
import com.google.gwt.user.client.ui.Image;
// TODO: Auto-generated Javadoc
/**
* The Class FileModel.
*
* @author Francesco Mangiacrapa francesco.mangiacrapa{@literal @}isti.cnr.it
* Sep 15, 2016
* Sep 15, 2016
*/
public class FileModel extends BaseModelData implements Serializable, IsSerializable {
@ -31,8 +29,8 @@ public class FileModel extends BaseModelData implements Serializable, IsSerializ
*/
private static final long serialVersionUID = 1L;
protected GXTFolderItemTypeEnum folderItemType; //It's here to serialization don't remove
protected GXTCategorySmartFolder smartFolders; //It's here to serialization don't remove
protected GXTFolderItemTypeEnum folderItemType; // It's here to serialization don't remove
protected GXTCategorySmartFolder smartFolders; // It's here to serialization don't remove
protected InfoContactModel infoContacts;
protected boolean isRoot = false;
protected boolean isVreFolder;
@ -55,23 +53,23 @@ public class FileModel extends BaseModelData implements Serializable, IsSerializ
public static final String OWNERFULLNAME = "Owner Name";
public static final String HUMAN_REDABLE_CATEGORY = "HR Category";
//Thredds Synch status
private Sync_Status synchedThreddsStatus;
// Synched with thredds
private Boolean synchedWithWsThredds = null;
/**
* Instantiates a new file model.
*/
protected FileModel(){
protected FileModel() {
}
/**
* Instantiates a new file model.
*
* @param identifier the identifier
* @param name the name
* @param parent the parent
* @param identifier the identifier
* @param name the name
* @param parent the parent
* @param isDirectory the is directory
* @param isShared the is shared
* @param isShared the is shared
*/
public FileModel(String identifier, String name, FileModel parent, boolean isDirectory, boolean isShared) {
setIdentifier(identifier);
@ -85,8 +83,8 @@ public class FileModel extends BaseModelData implements Serializable, IsSerializ
/**
* USED FOR ATTACHMENTS AND FolderBulkCreator.
*
* @param identifier the identifier
* @param name the name
* @param identifier the identifier
* @param name the name
* @param isDirectory the is directory
*/
public FileModel(String identifier, String name, boolean isDirectory) {
@ -99,7 +97,7 @@ public class FileModel extends BaseModelData implements Serializable, IsSerializ
/**
* Inits the default properties.
*/
protected void initDefaultProperties(){
protected void initDefaultProperties() {
setShortcutCategory(GXTCategorySmartFolder.SMF_UNKNOWN);
setShareable(true);
}
@ -110,7 +108,7 @@ public class FileModel extends BaseModelData implements Serializable, IsSerializ
* @param bool the new shareable
*/
public void setShareable(boolean bool) {
set(ConstantsExplorer.ISSHAREABLE,bool);
set(ConstantsExplorer.ISSHAREABLE, bool);
}
@ -119,7 +117,7 @@ public class FileModel extends BaseModelData implements Serializable, IsSerializ
*
* @param description the new description
*/
public void setDescription(String description){
public void setDescription(String description) {
set(ConstantsExplorer.DIRECTORYDESCRIPTION, description);
}
@ -128,7 +126,7 @@ public class FileModel extends BaseModelData implements Serializable, IsSerializ
*
* @return the description
*/
public String getDescription(){
public String getDescription() {
return get(ConstantsExplorer.DIRECTORYDESCRIPTION);
}
@ -139,7 +137,7 @@ public class FileModel extends BaseModelData implements Serializable, IsSerializ
*/
public boolean isShareable() {
Object sharable = get(ConstantsExplorer.ISSHAREABLE);
if(sharable!=null)
if (sharable != null)
return (Boolean) sharable;
return false;
}
@ -147,14 +145,15 @@ public class FileModel extends BaseModelData implements Serializable, IsSerializ
/**
* Instantiates a new file model.
*
* @param identifier the identifier
* @param name the name
* @param type the type
* @param identifier the identifier
* @param name the name
* @param type the type
* @param folderItemTypeEnum the folder item type enum
* @param isDirectory the is directory
* @param isShared the is shared
* @param isDirectory the is directory
* @param isShared the is shared
*/
public FileModel(String identifier, String name, String type, GXTFolderItemTypeEnum folderItemTypeEnum, boolean isDirectory, boolean isShared) {
public FileModel(String identifier, String name, String type, GXTFolderItemTypeEnum folderItemTypeEnum,
boolean isDirectory, boolean isShared) {
setIdentifier(identifier);
setName(name);
setType(type);
@ -170,14 +169,12 @@ public class FileModel extends BaseModelData implements Serializable, IsSerializ
* @param parent the new parent file model
*/
public void setParentFileModel(FileModel parent) {
set(PARENT,parent);
set(PARENT, parent);
}
/**
* Status values
* ConstantsExplorer.FOLDERNOTLOAD = "notload";
* ConstantsExplorer.FOLDERLOADED = "loaded";
* Status values ConstantsExplorer.FOLDERNOTLOAD = "notload";
* ConstantsExplorer.FOLDERLOADED = "loaded";
*
* @param status the new status
*/
@ -192,9 +189,9 @@ public class FileModel extends BaseModelData implements Serializable, IsSerializ
Image icon = (Image) get(ICON);
AbstractImagePrototype iconAbs;
if(icon==null){
if (icon == null) {
iconAbs = getAbstractPrototypeIcon();
}else
} else
return;
set(ICON, iconAbs.createImage());
@ -206,7 +203,7 @@ public class FileModel extends BaseModelData implements Serializable, IsSerializ
*
* @param fullName the new owner full name
*/
public void setOwnerFullName(String fullName){
public void setOwnerFullName(String fullName) {
set(FileModel.OWNERFULLNAME, fullName);
}
@ -215,17 +212,17 @@ public class FileModel extends BaseModelData implements Serializable, IsSerializ
*
* @return the owner full name
*/
public String getOwnerFullName(){
public String getOwnerFullName() {
return get(FileModel.OWNERFULLNAME);
}
/**
* Sets the sharing value.
*
* @param isShared the is shared
* @param isShared the is shared
* @param listShareUsers the list share users
*/
public void setSharingValue(boolean isShared, List<InfoContactModel> listShareUsers){
public void setSharingValue(boolean isShared, List<InfoContactModel> listShareUsers) {
set(ISSHARED, isShared);
set(SHAREUSERS, listShareUsers);
}
@ -236,7 +233,7 @@ public class FileModel extends BaseModelData implements Serializable, IsSerializ
* @return the list user sharing
*/
@SuppressWarnings("unchecked")
public List<InfoContactModel> getListUserSharing(){
public List<InfoContactModel> getListUserSharing() {
return (List<InfoContactModel>) get(SHAREUSERS);
}
@ -245,7 +242,7 @@ public class FileModel extends BaseModelData implements Serializable, IsSerializ
*
* @param listShareUsers the new list share user
*/
public void setListShareUser(List<InfoContactModel> listShareUsers){
public void setListShareUser(List<InfoContactModel> listShareUsers) {
set(SHAREUSERS, listShareUsers);
}
@ -254,9 +251,9 @@ public class FileModel extends BaseModelData implements Serializable, IsSerializ
*
* @return true, if is shared
*/
public boolean isShared(){
public boolean isShared() {
Object shared = get(ISSHARED);
if(shared!=null)
if (shared != null)
return (Boolean) shared;
return false;
}
@ -266,7 +263,7 @@ public class FileModel extends BaseModelData implements Serializable, IsSerializ
*
* @return true, if is root
*/
public boolean isRoot(){
public boolean isRoot() {
return isRoot;
}
@ -275,11 +272,10 @@ public class FileModel extends BaseModelData implements Serializable, IsSerializ
*
* @param isRoot the new checks if is root
*/
public void setIsRoot(boolean isRoot){
public void setIsRoot(boolean isRoot) {
this.isRoot = isRoot;
}
/**
* Gets the icon.
*
@ -296,61 +292,56 @@ public class FileModel extends BaseModelData implements Serializable, IsSerializ
*/
public AbstractImagePrototype getAbstractPrototypeIcon() {
GWT.log("My prop: "+this.toString());
GWT.log("My prop: " + this.toString());
AbstractImagePrototype absImgPr = Resources.getIconTable();
if (!this.isDirectory()) { //IS FILE
if(this.getType()!=null)
if (!this.isDirectory()) { // IS FILE
if (this.getType() != null)
absImgPr = Resources.getIconByType(this.getName(), this.getType());
else
absImgPr = Resources.getIconByFolderItemType(this.getGXTFolderItemType());
}else if(this.isShared()){ //IS A SHARED FOLDER?
} else if (this.isShared()) { // IS A SHARED FOLDER?
//GWT.log("setting icon "+this.getName()+" is shared: "+this.isShared() + ", this.isVreFolder() "+this.isVreFolder() +", this.isShareable() "+this.isShareable());
// GWT.log("setting icon "+this.getName()+" is shared: "+this.isShared() + ",
// this.isVreFolder() "+this.isVreFolder() +", this.isShareable()
// "+this.isShareable());
if(this.isVreFolder())
absImgPr = Resources.getIconVREFolder();
else{
if(this.isShareable()){ //IS ROOT SHARED FOLDER
if(this.isPublic()) //IS PLUBIC
absImgPr = Resources.getIconFolderSharedPublic();
if (this.isVreFolder())
absImgPr = Resources.getIconVREFolder();
else {
if (this.isShareable()) { // IS ROOT SHARED FOLDER
if (this.isPublic()) // IS PLUBIC
absImgPr = Resources.getIconFolderSharedPublic();
else
absImgPr = Resources.getIconSharedFolder();
}else{ //IS A DESCENDANT
if(this.isPublic()) //IS PLUBIC
absImgPr = Resources.getIconSharedFolder();
} else { // IS A DESCENDANT
if (this.isPublic()) // IS PLUBIC
absImgPr = Resources.getIconFolderPublic();
else
absImgPr = Resources.getIconSharedFolder(); //IS A SHARED FOLDER DESCENDANT OF ROOT SHARED FOLDER
absImgPr = Resources.getIconSharedFolder(); // IS A SHARED FOLDER DESCENDANT OF ROOT SHARED
// FOLDER
}
}
}else if(this.getStatus() == ConstantsExplorer.FOLDERNOTLOAD){ //IS A FOLDER IN LOADING
} else if (this.getStatus() == ConstantsExplorer.FOLDERNOTLOAD) { // IS A FOLDER IN LOADING
absImgPr = Resources.getIconLoading2();
}else{
//SPECIAL FOLDER?
if(this.isSpecialFolder())
} else {
// SPECIAL FOLDER?
if (this.isSpecialFolder()) {
absImgPr = Resources.getIconSpecialFolder();
else{ //SIMPLE FOLDER
if(this.isPublic()) //IS PLUBIC
absImgPr = Resources.getIconFolderPublic();
else {
if(this.getSynchedThreddsStatus()!=null) {
switch(this.getSynchedThreddsStatus()) {
case OUTDATED_REMOTE:
absImgPr = Resources.getIconSyncTo();
break;
case OUTDATED_WS:
absImgPr = Resources.getIconSyncFrom();
break;
case UP_TO_DATE:
absImgPr = Resources.getIconSynched();
break;
}
}else
absImgPr = Resources.getIconFolder();
} else { // SIMPLE FOLDER
if (this.isPublic()) { // IS PLUBIC
absImgPr = Resources.getIconFolderPublic();
} else {
Boolean isSynched = this.getSynchedWithWsThredds();
if (isSynched != null && isSynched) {
absImgPr = Resources.getIconSynchedFolder();
} else {
absImgPr = Resources.getIconFolder();
}
}
}
}
@ -358,7 +349,6 @@ public class FileModel extends BaseModelData implements Serializable, IsSerializ
return absImgPr;
}
/**
* Gets the status.
*
@ -368,13 +358,12 @@ public class FileModel extends BaseModelData implements Serializable, IsSerializ
return get("status");
}
/**
* Sets the checks if is directory.
*
* @param flag the new checks if is directory
*/
public void setIsDirectory(boolean flag){
public void setIsDirectory(boolean flag) {
set(ISDIRECTORY, flag);
}
@ -392,7 +381,7 @@ public class FileModel extends BaseModelData implements Serializable, IsSerializ
*
* @return the identifier
*/
public String getIdentifier(){
public String getIdentifier() {
return get(IDENTIFIER);
}
@ -403,21 +392,19 @@ public class FileModel extends BaseModelData implements Serializable, IsSerializ
*/
public void setShortcutCategory(GXTCategorySmartFolder smfDocuments) {
set(SHORTCUTCATEGORY, smfDocuments);
if(smfDocuments!=null)
if (smfDocuments != null)
set(HUMAN_REDABLE_CATEGORY, smfDocuments.getValue());
}
/**
* Gets the shortcut category.
*
* @return the shortcut category
*/
public GXTCategorySmartFolder getShortcutCategory(){
public GXTCategorySmartFolder getShortcutCategory() {
return (GXTCategorySmartFolder) get(SHORTCUTCATEGORY);
}
/**
* Sets the name.
*
@ -441,7 +428,7 @@ public class FileModel extends BaseModelData implements Serializable, IsSerializ
*
* @return the parent file model
*/
public FileModel getParentFileModel(){
public FileModel getParentFileModel() {
return (FileModel) get(PARENT);
}
@ -450,14 +437,16 @@ public class FileModel extends BaseModelData implements Serializable, IsSerializ
*
* @return true, if is directory
*/
public boolean isDirectory(){
public boolean isDirectory() {
Object directory = get(ISDIRECTORY);
if(directory!=null)
if (directory != null)
return (Boolean) directory;
return false;
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see java.lang.Object#equals(java.lang.Object)
*/
/**
@ -489,7 +478,7 @@ public class FileModel extends BaseModelData implements Serializable, IsSerializ
*
* @param type the new type
*/
public void setType(String type){
public void setType(String type) {
set(TYPE, type);
}
@ -498,7 +487,7 @@ public class FileModel extends BaseModelData implements Serializable, IsSerializ
*
* @return the type
*/
public String getType(){
public String getType() {
return get(TYPE);
}
@ -507,7 +496,7 @@ public class FileModel extends BaseModelData implements Serializable, IsSerializ
*
* @param folderItemTypeEnum the new folder item type
*/
public void setFolderItemType(GXTFolderItemTypeEnum folderItemTypeEnum){
public void setFolderItemType(GXTFolderItemTypeEnum folderItemTypeEnum) {
set(FOLDERITEMTYPE, folderItemTypeEnum);
}
@ -516,7 +505,7 @@ public class FileModel extends BaseModelData implements Serializable, IsSerializ
*
* @return the GXT folder item type
*/
public GXTFolderItemTypeEnum getGXTFolderItemType(){
public GXTFolderItemTypeEnum getGXTFolderItemType() {
return (GXTFolderItemTypeEnum) get(FOLDERITEMTYPE);
}
@ -571,21 +560,31 @@ public class FileModel extends BaseModelData implements Serializable, IsSerializ
*
* @return true, if is public
*/
public boolean isPublic(){
public boolean isPublic() {
return isPublic;
}
public void setSyncThreddsStatus(Sync_Status status) {
this.synchedThreddsStatus = status;
/**
* Sets the synched with ws thredds.
*
* @param bool the new synched with ws thredds
*/
public void setSynchedWithWsThredds(Boolean bool) {
this.synchedWithWsThredds = bool;
}
public Sync_Status getSynchedThreddsStatus() {
return synchedThreddsStatus;
/**
* Gets the synched with ws thredds.
*
* @return the synched with ws thredds
*/
public Boolean getSynchedWithWsThredds() {
return synchedWithWsThredds;
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see java.lang.Object#toString()
*/
/**
@ -620,5 +619,4 @@ public class FileModel extends BaseModelData implements Serializable, IsSerializ
return builder.toString();
}
}

View File

@ -411,14 +411,24 @@ public interface Icons extends ClientBundle {
@Source("icons/sync-icon-to.png")
ImageResource syncIconTo();
@Source("icons/folder_sync.png")
ImageResource synchedFolder();
@Source("icons/sync-icon-from.png")
ImageResource syncIconFrom();
@Source("icons/sync-icon-synched.png")
ImageResource syncIconSynched();
// @Source("icons/sync-icon-from.png")
// ImageResource syncIconFrom();
//
// @Source("icons/sync-icon-synched.png")
// ImageResource syncIconSynched();
@Source("icons/no-preview-available.png")
ImageResource previewNotAvailable();
@Source("icons/no-preview-available-no-border.png")
ImageResource previewNotAvailableNoBorder();
@Source("icons/spinner2.gif")
ImageResource spinner();
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 667 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 625 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 660 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -28,6 +28,7 @@ import org.gcube.portlets.user.workspace.shared.accounting.GxtAccountingField;
import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
// TODO: Auto-generated Javadoc
/**
* The Interface GWTWorkspaceService.
*
@ -676,4 +677,22 @@ public interface GWTWorkspaceService extends RemoteService {
*/
FileModel getItemForFileTree(String itemId) throws Exception;
/**
* Update description for item.
*
* @param itemId the item id
* @param newDescription the new description
* @return the description updated on the server
* @throws Exception the exception
*/
String updateDescriptionForItem(String itemId, String newDescription) throws Exception;
/**
* Gets the allowed mimetypes for preview.
*
* @return the allowed mimetypes for preview
*/
Map<String, List<String>> getAllowedMimetypesForPreview();
}

View File

@ -612,5 +612,24 @@ public interface GWTWorkspaceServiceAsync {
* @return the link for send to switch board
*/
void getLinkForSendToSwitchBoard(String itemId, AsyncCallback<String> callback);
/**
* Update description for item.
*
* @param itemId the item id
* @param newDescription the new description
* @param callback the callback
*/
void updateDescriptionForItem(String itemId, String newDescription, AsyncCallback<String> callback);
/**
* Gets the allowed mimetypes for preview.
*
* @return the allowed mimetypes for preview
*/
void getAllowedMimetypesForPreview(AsyncCallback<Map<String, List<String>>> callback);
}

View File

@ -0,0 +1,42 @@
package org.gcube.portlets.user.workspace.client.util;
import com.google.gwt.core.client.GWT;
import com.google.gwt.i18n.client.NumberFormat;
/**
* The Class SizeUtil.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Nov 5, 2021
*/
public class SizeUtil {
public static final NumberFormat numberFormat = NumberFormat.getFormat("#,##0.#");
/**
* Readable file size.
*
* @param size the size
* @return the string
*/
public static String readableFileSize(long size) {
GWT.log("Converting size: "+size);
// -1 should be the size of a folder
if (size == -1)
return "";
// in some cases the size returned by SHUB is negative,
// so reporting as 1B to user
if (size < 0)
return "1 byte";
if (size == 0)
return "0 byte";
final String[] units = new String[] { "bytes", "kB", "MB", "GB", "TB" };
int digitGroups = (int) (Math.log10(size) / Math.log10(1024));
return numberFormat.format(size / Math.pow(1024, digitGroups)) +" " +units[digitGroups];
}
}

View File

@ -31,8 +31,8 @@ import com.google.gwt.user.client.rpc.AsyncCallback;
public class DialogEditProperties extends Dialog {
private FileModel item;
private int widthDialog = 450;
private int heigthDialog = 300;
private int widthDialog = 800;
private int heigthDialog = 400;
private Command commad;
private List<TextField<String>> fields;
private FormLayout layout;
@ -50,8 +50,8 @@ public class DialogEditProperties extends Dialog {
this.commad = command;
layout = new FormLayout();
layout.setLabelWidth(90);
layout.setDefaultWidth(300);
layout.setLabelWidth(200);
layout.setDefaultWidth(550);
setLayout(layout);
setHeading("Edit Properties: " + item.getName());
@ -72,6 +72,15 @@ public class DialogEditProperties extends Dialog {
saveProperties(true);
}
});
//SET TOGGLE BUTTON GRID VIEW
/*Scheduler.get().scheduleDeferred(new ScheduledCommand() {
@Override
public void execute() {
setZIndex(99999);
}
});*/
}
/*
@ -82,7 +91,7 @@ public class DialogEditProperties extends Dialog {
@Override
public void show() {
resetForm();
loadGcubeItemProperties();
//loadGcubeItemProperties();
super.show();
}
@ -121,31 +130,33 @@ public class DialogEditProperties extends Dialog {
}
private void loadGcubeItemProperties() {
// mask("Loading properties...");
AppControllerExplorer.rpcWorkspaceService.loadGcubeItemProperties(item.getIdentifier(),
new AsyncCallback<Map<String, String>>() {
// private void loadGcubeItemProperties() {
// // mask("Loading properties...");
// AppControllerExplorer.rpcWorkspaceService.loadGcubeItemProperties(item.getIdentifier(),
// new AsyncCallback<Map<String, String>>() {
//
// @Override
// public void onSuccess(Map<String, String> result) {
// // unmask();
// setProperties(result);
// }
//
// @Override
// public void onFailure(Throwable caught) {
// // unmask();
// GWT.log("an error occured in loadGcubeItemProperties " + item + " " + caught.getMessage());
// }
// });
// }
@Override
public void onSuccess(Map<String, String> result) {
// unmask();
setProperties(result);
}
@Override
public void onFailure(Throwable caught) {
// unmask();
GWT.log("an error occured in loadGcubeItemProperties " + item + " " + caught.getMessage());
}
});
}
private void setProperties(Map<String, String> result) {
public void setProperties(Map<String, String> result) {
fields = new ArrayList<TextField<String>>(result.size());
for (String key : result.keySet()) {
TextField<String> field = new TextField<String>();
GWT.log("Adding field: "+key);
field.setFieldLabel(key);
field.setValue(result.get(key));
field.setReadOnly(false);
add(field);
fields.add(field);
}

View File

@ -4,10 +4,10 @@ import java.util.Date;
import java.util.List;
import org.gcube.portlets.user.workspace.client.AppControllerExplorer;
import org.gcube.portlets.user.workspace.client.ConstantsExplorer;
import org.gcube.portlets.user.workspace.client.model.FileGridModel;
import org.gcube.portlets.user.workspace.client.model.FileModel;
import org.gcube.portlets.user.workspace.client.resources.Resources;
import org.gcube.portlets.user.workspace.client.util.SizeUtil;
import org.gcube.portlets.widgets.workspacesharingwidget.client.rpc.WorkspaceSharingServiceAsync;
import org.gcube.portlets.widgets.workspacesharingwidget.shared.InfoContactModel;
@ -26,7 +26,6 @@ import com.extjs.gxt.ui.client.widget.layout.FormLayout;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.i18n.client.NumberFormat;
import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.Image;
@ -60,7 +59,7 @@ public class DialogGetInfo extends Dialog {
// private TextArea textAreaSharedWith = new TextArea();
private Html htmlUsersWidget = new Html();
private Html htmlPropertiesWidget = new Html();
private final NumberFormat number = ConstantsExplorer.numberFormatterKB;
//private final NumberFormat number = ConstantsExplorer.numberFormatterKB;
// private TextField<String> txtGcubeItemProperties;
private HorizontalPanel hpGcubeProperties;
private DialogEditProperties editProperties = null;
@ -114,11 +113,11 @@ public class DialogGetInfo extends Dialog {
txtIsPublic.setValue(fileModel.isPublic() + "");
add(txtIsPublic);
if (fileModel.getSynchedThreddsStatus() != null) {
if (fileModel.getSynchedWithWsThredds() != null) {
txtThreddsSynched = new TextField<String>();
txtThreddsSynched.setFieldLabel("Thredds Sync");
txtThreddsSynched.setFieldLabel("Synched with Thredds");
txtThreddsSynched.setReadOnly(true);
txtThreddsSynched.setValue(fileModel.getSynchedThreddsStatus() + "");
txtThreddsSynched.setValue(fileModel.getSynchedWithWsThredds() + "");
add(txtThreddsSynched);
}
@ -448,10 +447,7 @@ public class DialogGetInfo extends Dialog {
private String getFormattedSize(long value) {
if (value > 0) {
double kb = value / 1024;
if (kb < 1)
kb = 1;
return number.format(kb);
return SizeUtil.readableFileSize(value);
} else if (value == 0) {
return EMPTY;
} else

View File

@ -0,0 +1,938 @@
package org.gcube.portlets.user.workspace.client.view.windows;
import java.util.Date;
import java.util.List;
import java.util.Map;
import org.gcube.portlets.user.workspace.client.AppControllerExplorer;
import org.gcube.portlets.user.workspace.client.event.CreateSharedFolderEvent;
import org.gcube.portlets.user.workspace.client.event.FileDownloadEvent;
import org.gcube.portlets.user.workspace.client.event.FileDownloadEvent.DownloadType;
import org.gcube.portlets.user.workspace.client.interfaces.GXTFolderItemTypeEnum;
import org.gcube.portlets.user.workspace.client.model.FileGridModel;
import org.gcube.portlets.user.workspace.client.model.FileModel;
import org.gcube.portlets.user.workspace.client.resources.Resources;
import org.gcube.portlets.user.workspace.client.util.SizeUtil;
import org.gcube.portlets.user.workspace.client.workspace.GWTWorkspaceItem;
import org.gcube.portlets.user.workspace.client.workspace.folder.item.GWTExternalImage;
import org.gcube.portlets.user.workspace.client.workspace.folder.item.gcube.GWTImageDocument;
import org.gcube.portlets.user.workspace.shared.PublicLink;
import org.gcube.portlets.widgets.workspacesharingwidget.client.rpc.WorkspaceSharingServiceAsync;
import com.github.gwtbootstrap.client.ui.Button;
import com.github.gwtbootstrap.client.ui.ControlGroup;
import com.github.gwtbootstrap.client.ui.Label;
import com.github.gwtbootstrap.client.ui.TextArea;
import com.github.gwtbootstrap.client.ui.Tooltip;
import com.github.gwtbootstrap.client.ui.constants.ButtonType;
import com.github.gwtbootstrap.client.ui.constants.IconType;
import com.github.gwtbootstrap.client.ui.constants.LabelType;
import com.github.gwtbootstrap.client.ui.constants.ResizeType;
import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Style.Float;
import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.LoadEvent;
import com.google.gwt.event.dom.client.LoadHandler;
import com.google.gwt.http.client.URL;
import com.google.gwt.i18n.client.DateTimeFormat;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.Timer;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Frame;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.NamedFrame;
import com.google.gwt.user.client.ui.Widget;
// TODO: Auto-generated Javadoc
/**
* The Class DialogGetInfoBootstrap.
*
* @author Francesco Mangiacrapa at ISTI-CNR Pisa (Italy)
* Jul 13, 2020
*/
public class DialogGetInfoBootstrap extends Composite {
private static final int PREVIEW_WAITING_TIME = 9000; //9 sec
private static final int PREVIEW_MAX_RETRIES = 3;
private int showPreviewAttempt = 0;
private long loaderPreviewStartTime = 0;
private static DialogGetInfoBootstrapUiBinder uiBinder = GWT.create(DialogGetInfoBootstrapUiBinder.class);
/**
* The Interface DialogGetInfoBootstrapUiBinder.
*
* @author Francesco Mangiacrapa at ISTI-CNR Pisa (Italy)
* Jul 13, 2020
*/
interface DialogGetInfoBootstrapUiBinder extends UiBinder<Widget, DialogGetInfoBootstrap> {
}
public static final String EMPTY = "empty";
//private final NumberFormat number = ConstantsExplorer.numberFormatterKB;
/**
* Instantiates a new dialog get info bootstrap.
*/
public DialogGetInfoBootstrap() {
initWidget(uiBinder.createAndBindUi(this));
}
public static final String NOT_AVAILABLE = "n.a.";
private Map<String, String> gCubeProperties;
@UiField
HorizontalPanel hpItemType;
@UiField
HorizontalPanel hpHeaderDetails;
@UiField
Button buttonClose;
@UiField
HTMLPanel htmlPanelImagePreview;
@UiField
HTMLPanel htmlPanelFilePreview;
@UiField
HTML txtName;
@UiField
HTML txtId;
@UiField
HTML txtLocation;
@UiField
ControlGroup cgTxtIsPublic;
@UiField
HTML txtIsPublic;
@UiField
HTML txtMimeType;
@UiField
ControlGroup cgTxtMimeType;
@UiField
ControlGroup cgThreddsSynched;
@UiField
HTML txtThreddsSynched;
@UiField
ControlGroup cgGcubeProperties;
@UiField
TextArea txtAreaGcubeProperties;
@UiField
TextArea txtAreaDescription;
@UiField
HTML txtOwner;
@UiField
HTML txtCreated;
@UiField
HTML txtLastMofication;
@UiField
HTML txtSize;
@UiField
HTML txtShared;
@UiField
Button buttonUpdateDescription;
@UiField
Button buttonSaveDescription;
@UiField
Button buttonUpdateGcubeProperties;
@UiField
Button buttonUpdateShare;
@UiField
ControlGroup cgSharedWith;
@UiField
HTML txtSharedWith;
private FileModel fileModel;
private Command onCloseCommand;
private Tooltip tooltipDownload = new Tooltip("Download");
private Button buttonDownload = new Button("Download");
// private Tooltip tooltipSharebleLink = new Tooltip("Get Shareable Link");
// private Button buttonShareableLink = new Button();
private DateTimeFormat dateFormatter = DateTimeFormat.getFormat("dd MMM yyyy, hh:mm aaa");
private boolean iFrameGoogleDocViewerLoaded = false;
private Long fileSize = null;
private Map<String, List<String>> mapAllowedMimeTypesForPreview;
private Image spinnerImage = Resources.getSpinner().createImage();
private Image noPreviewAvailable = new Image(Resources.getPreviewNotAvailableNoBorder());
private Frame iFrameGDV = null;
private Timer timerGDV = null;
/**
* Instantiates a new dialog get info bootstrap.
*
* @param fileModel the file model
* @param onCloseCommand the on close command
* @param mapAllowedMimeTypesForPreview the map allowed mime types for preview
*/
public DialogGetInfoBootstrap(final FileModel fileModel, final Command onCloseCommand, Map<String,List<String>> mapAllowedMimeTypesForPreview) {
initWidget(uiBinder.createAndBindUi(this));
this.fileModel = fileModel;
this.onCloseCommand = onCloseCommand;
this.mapAllowedMimeTypesForPreview = mapAllowedMimeTypesForPreview;
this.cgTxtMimeType.setVisible(true);
buttonClose.getElement().getStyle().setFloat(Float.RIGHT);
hpItemType.add(fileModel.getIcon());
Label labelItemType = new Label();
labelItemType.setType(LabelType.DEFAULT);
//labelItemType.getElement().getStyle().setMarginLeft(10, Unit.PX);
String label = null;
GXTFolderItemTypeEnum typeEnum = fileModel.getGXTFolderItemType();
//in case of folder see #19600
if(fileModel.isDirectory()) {
label = "Private Folder";
if(fileModel.isPublic()) {
//is public
label = "Public Folder";
if(fileModel.isShared()) {
label = "Shared and Public Folder";
}
}else {
//is not public
if(fileModel.isShared()) {
//is shared
label = "Shared Folder";
if(fileModel.isVreFolder()) {
label = "VRE Folder";
}
}
}
//hiding the type
cgTxtMimeType.setVisible(false);
}else {
//in case of file see #19600
if (typeEnum != null) {
//the file is categorized
label = typeEnum.getLabel();
label = label.replace("External ", "");
} else {
//the file is NOT categorized using the default "File"
label = "File";
}
}
labelItemType.setText(label);
hpItemType.add(labelItemType);
buttonDownload.setType(ButtonType.LINK);
buttonDownload.setIcon(IconType.CLOUD_DOWNLOAD);
tooltipDownload.add(buttonDownload);
hpItemType.add(tooltipDownload);
// buttonShareableLink.setType(ButtonType.LINK);
// buttonShareableLink.setIcon(IconType.LINK);
// buttonShareableLink.set
// tooltipSharebleLink.add(buttonShareableLink);
// hpItemType.add(tooltipSharebleLink);
// Setting name
htmlSetValue(txtName, fileModel.getName());
htmlSetValue(txtId, fileModel.getIdentifier());
if (fileModel.isRoot())
txtLocation.setHTML("/");
else
loadLocation(fileModel);
if (fileModel.isDirectory()) {
cgTxtIsPublic.setVisible(true);
htmlSetValue(txtIsPublic, fileModel.isPublic() + "");
GWT.log("Is synched? "+fileModel.getSynchedWithWsThredds());
if (fileModel.getSynchedWithWsThredds() != null) {
if (fileModel.getSynchedWithWsThredds()) {
cgThreddsSynched.setVisible(true);
//txtThreddsSynched.setVisible(true);
htmlSetValue(txtThreddsSynched, fileModel.getSynchedWithWsThredds() + "");
txtThreddsSynched.setHTML(fileModel.getSynchedWithWsThredds() + "");
}
}
}
//mimetype
htmlSetValue(txtMimeType, fileModel.getType());
txtAreaDescription.setResize(ResizeType.VERTICAL);
//load description
loadDescription(fileModel.getIdentifier());
//owner
htmlSetValue(txtOwner, fileModel.getOwnerFullName());
//creation date
loadCreationDate(fileModel.getIdentifier());
if(fileModel instanceof FileGridModel) {
FileGridModel fileGridModel = ((FileGridModel) fileModel);
//last update
htmlSetValue(txtLastMofication, dateFormatter.format(fileGridModel.getLastModification()));
//size
fileSize = fileGridModel.getSize();
htmlSetValue(txtSize, getFormattedSize(fileGridModel.getSize()));
}else {
loadLastModificationDate(fileModel.getIdentifier());
loadSize(fileModel.getIdentifier());
}
htmlSetValue(txtShared, fileModel.isShared()+"");
// USERS SHARED
if (fileModel.isShared()) {
cgSharedWith.setVisible(true);
loadACLsDescriptionForSharedFolder(fileModel.getIdentifier());
}
boolean previewManaged = false;
if (typeEnum != null) {
// is it an image?
if (typeEnum.equals(GXTFolderItemTypeEnum.IMAGE_DOCUMENT)
|| typeEnum.equals(GXTFolderItemTypeEnum.EXTERNAL_IMAGE)) {
previewManaged = true;
loadThumbnailsForImage();
}
// is it a GCUBE-Item?
if (typeEnum.equals(GXTFolderItemTypeEnum.GCUBE_ITEM)) {
previewManaged = true; //preview not avaible for the type GCUBE_ITEM
loadGcubeItemProperties();
}
}
//If the preview is not managed
//through the previous code
//managing it by checking the mime-type
if(!previewManaged) {
if (!fileModel.isDirectory() && mapAllowedMimeTypesForPreview.containsKey(fileModel.getType())) {
// SOLUTION BASED ON GOOGLE DOC VIEWER
GWT.log("Mime type " + fileModel.getType() + " allowed for preview, try to display it");
final HTML loadingPreviewHTML = new HTML();
setPlaceholder(loadingPreviewHTML, true, "loading preview...");
htmlPanelFilePreview.add(loadingPreviewHTML);
htmlPanelFilePreview.setVisible(true);
AppControllerExplorer.rpcWorkspaceService.getPublicLinkForFileItemId(fileModel.getIdentifier(), false,
new AsyncCallback<PublicLink>() {
@Override
public void onFailure(Throwable caught) {
removePlaceHolder(loadingPreviewHTML);
GWT.log("Error on loading the Public link for: "+fileModel.getIdentifier());
htmlPanelFilePreview.add(noPreviewAvailable);
htmlPanelFilePreview.setVisible(true);
}
@Override
public void onSuccess(PublicLink result) {
GWT.log("The PublicLink link is: " + result);
if (result != null) {
// if file size is null or greater than 25MB
long byteTo25MB = 1024 * 1024 * 25;
GWT.log("The file size is: " + fileSize);
if (fileSize == null || fileSize > byteTo25MB) {
GWT.log("The file size is null or greater than " + byteTo25MB + ", returning");
// htmlPanelFilePreview.add(new Image(Resources.getPreviewNotAvailable()));
return;
}
final String googleDocViewerURL = "https://docs.google.com/viewer?url="
+ URL.encode(result.getCompleteURL()) + "&embedded=true";
iFrameGDV = instanceFrame(googleDocViewerURL, loadingPreviewHTML);
loaderPreviewStartTime = new Date().getTime();
showPreviewAttempt = 1;
timerGDV = new Timer() {
@Override
public void run() {
GWT.log("Checking if the iFrameGoogleDocViewer is ready");
if (iFrameGoogleDocViewerLoaded) {
removePlaceHolder(loadingPreviewHTML);
GWT.log("iFrameGoogleDocViewer currently loaded, cancelling timer");
cancel();
return;
}
long checkTime = new Date().getTime();
long diff = checkTime - loaderPreviewStartTime;
if (diff > PREVIEW_WAITING_TIME) { // is greater than PREVIEW_WAITING_TIME, performs a new attempt or terminate
if(showPreviewAttempt >= PREVIEW_MAX_RETRIES) {
try {
GWT.log("iFrameGoogleDocViewer not loaded within "+PREVIEW_WAITING_TIME+" sec and max retries "+PREVIEW_MAX_RETRIES+", cancelling timer, removing iframe");
cancel();
removePlaceHolder(loadingPreviewHTML);
htmlPanelFilePreview.add(noPreviewAvailable);
iFrameGDV.setVisible(false);
htmlPanelFilePreview.remove(iFrameGDV);
} catch (Exception e) {
// Silent
}
}else {
GWT.log("iFrameGoogleDocViewer not loaded on attempt "+showPreviewAttempt+", instancing new iFrame");
//new retry by instancing the iFrame again...
iFrameGDV = instanceFrame(googleDocViewerURL, loadingPreviewHTML);
try {
//removing old iFrame
htmlPanelFilePreview.remove(iFrameGDV);
}catch (Exception e) {
//silent
}
//adding the new one
htmlPanelFilePreview.add(iFrameGDV);
//new attempt so incrementing it
showPreviewAttempt++;
GWT.log("Retry, go to attempt "+showPreviewAttempt);
//resetting start time for new attempt
loaderPreviewStartTime = new Date().getTime();
}
}
}
};
int attemptRepeater = PREVIEW_WAITING_TIME / 3;
timerGDV.scheduleRepeating(attemptRepeater);
htmlPanelFilePreview.add(iFrameGDV);
}
}
});
} else {
GWT.log("Mime type " + fileModel.getType() + " NOT allowed for preview, displaying 'No preview available'");
htmlPanelFilePreview.add(noPreviewAvailable);
htmlPanelFilePreview.setVisible(true);
}
}
addHandlers();
}
/**
* On detach.
*/
@Override
protected void onDetach() {
super.onDetach();
GWT.log("Detached...");
htmlPanelFilePreview.clear();
if(timerGDV!=null) {
try {
timerGDV.cancel();
}catch (Exception e) {
// TODO: handle exception
}
}
}
/**
* Instance frame.
*
* @param fileURL the file URL
* @param thePreviewPlaceholder the the preview placeholder
* @return the frame
*/
public Frame instanceFrame(String fileURL, final HTML thePreviewPlaceholder) {
//addLoading();
String urlEncoded = URL.encode(fileURL);
GWT.log("Encoded url for instanciating frame is " + urlEncoded);
iFrameGoogleDocViewerLoaded = false;
final NamedFrame frame = new NamedFrame("iFrameGoogleDocViewer");
frame.setUrl(urlEncoded);
frame.setVisible(false);
frame.getElement().setId("iFrameGoogleDocViewer");
frame.getElement().getStyle().setBorderWidth(0, Unit.PX);
frame.addLoadHandler(new LoadHandler() {
@Override
public void onLoad(LoadEvent arg0) {
GWT.log("iFrameGoogleDocViewer loaded");
iFrameGoogleDocViewerLoaded = true;
removePlaceHolder(thePreviewPlaceholder);
frame.getElement().addClassName("my-preview-doc");
frame.setVisible(true);
}
});
return frame;
}
/**
* Adds the handlers.
*/
private void addHandlers() {
buttonClose.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
onCloseCommand.execute();
}
});
buttonUpdateDescription.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
txtAreaDescription.setReadOnly(false);
txtAreaDescription.setFocus(true);
buttonSaveDescription.setVisible(true);
}
});
buttonSaveDescription.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
buttonSaveDescription.setVisible(false);
txtAreaDescription.setReadOnly(true);
AppControllerExplorer.rpcWorkspaceService.updateDescriptionForItem(fileModel.getIdentifier(), txtAreaDescription.getValue(), new AsyncCallback<String>() {
@Override
public void onFailure(Throwable caught) {
loadDescription(fileModel.getIdentifier());
new MessageBoxAlert("Error on updating description...", caught.getMessage(), null);
}
@Override
public void onSuccess(String result) {
GWT.log("Updated the description as: "+result);
txtAreaDescription.setValue(result);
}
});
}
});
final Command cmdReloadProperties = new Command() {
@Override
public void execute() {
loadGcubeItemProperties();
}
};
buttonUpdateGcubeProperties.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
final DialogEditProperties editProperties = new DialogEditProperties(fileModel, cmdReloadProperties);
editProperties.show();
editProperties.setProperties(gCubeProperties);
}
});
buttonUpdateShare.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
AppControllerExplorer.getEventBus().fireEvent(new CreateSharedFolderEvent(fileModel, fileModel.getParentFileModel(),false));
onCloseCommand.execute();
}
});
buttonDownload.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
AppControllerExplorer.getEventBus()
.fireEvent(new FileDownloadEvent(fileModel.getIdentifier(), fileModel.getName(),
DownloadType.SHOW, fileModel.isDirectory() || fileModel.isVreFolder(), null));
}
});
}
/**
* Html set value.
*
* @param field the field
* @param value the value
*/
private void htmlSetValue(HTML field, String value) {
if (value == null || value.isEmpty())
field.setHTML(NOT_AVAILABLE);
else
field.setHTML(value);
}
/**
* Gets the formatted size.
*
* @param value the value
* @return the formatted size
*/
private String getFormattedSize(long value) {
if (value > 0) {
return SizeUtil.readableFileSize(value);
} else if (value == 0) {
return EMPTY;
} else
return "";
}
/**
* Load location.
*
* @param fileModel the file model
*/
private void loadLocation(FileModel fileModel) {
setPlaceholder(txtLocation, false, "loading...");
AppControllerExplorer.rpcWorkspaceService.getListParentsByItemIdentifier(fileModel.getIdentifier(), false,
new AsyncCallback<List<FileModel>>() {
@Override
public void onFailure(Throwable caught) {
GWT.log("failure get list parents by item identifier " + caught);
removePlaceHolder(txtLocation);
txtLocation.setHTML(NOT_AVAILABLE);
// txtLocation.set(false);
}
@Override
public void onSuccess(List<FileModel> result) {
removePlaceHolder(txtLocation);
String location = "";
if (result != null) {
for (FileModel fileModel : result) {
if (fileModel != null)
location += "/" + fileModel.getName();
}
}
if (location.isEmpty())
location = "/";
txtLocation.setHTML(location);
}
});
}
/**
* Load size.
*
* @param itemId the item id
*/
private void loadSize(final String itemId) {
GWT.log("Load size");
setPlaceholder(txtSize, false, "loading...");
fileSize = new Long(-1); //means is loading
AppControllerExplorer.rpcWorkspaceService.loadSizeByItemId(itemId, new AsyncCallback<Long>() {
@Override
public void onFailure(Throwable caught) {
fileSize = null;
GWT.log("an error occured in load creation date by Id " + itemId + " " + caught.getMessage());
removePlaceHolder(txtSize);
}
@Override
public void onSuccess(Long result) {
GWT.log("Loaded size=" + result);
fileSize = result;
removePlaceHolder(txtSize);
if(result!=null)
htmlSetValue(txtSize, getFormattedSize(result));
else
htmlSetValue(txtSize, null);
}
});
}
/**
* Load creation date.
*
* @param itemId the item id
*/
private void loadCreationDate(final String itemId) {
setPlaceholder(txtCreated, false, "loading...");
AppControllerExplorer.rpcWorkspaceService.getItemCreationDateById(itemId, new AsyncCallback<Date>() {
@Override
public void onFailure(Throwable caught) {
GWT.log("an error occured in load creation date by Id " + itemId + " " + caught.getMessage());
removePlaceHolder(txtCreated);
}
@Override
public void onSuccess(Date dateResult) {
removePlaceHolder(txtCreated);
if (dateResult != null) {
htmlSetValue(txtCreated, dateFormatter.format(dateResult));
}else
htmlSetValue(txtCreated, null);
}
});
}
/**
* Load last modification date.
*
* @param itemId the item id
*/
private void loadLastModificationDate(final String itemId) {
setPlaceholder(txtLastMofication, false, "loading...");
AppControllerExplorer.rpcWorkspaceService.loadLastModificationDateById(itemId, new AsyncCallback<Date>() {
@Override
public void onFailure(Throwable caught) {
GWT.log("an error occured in loadLastModificationDateById " + itemId + " " + caught.getMessage());
removePlaceHolder(txtLastMofication);
}
@Override
public void onSuccess(Date dateResult) {
removePlaceHolder(txtLastMofication);
if (dateResult != null) {
htmlSetValue(txtLastMofication, dateFormatter.format(dateResult));
}else
htmlSetValue(txtLastMofication, null);
}
});
}
/**
* Load description.
*
* @param identifier the identifier
*/
private void loadDescription(String identifier) {
txtAreaDescription.setEnabled(false);
AppControllerExplorer.rpcWorkspaceService.getItemDescriptionById(identifier, new AsyncCallback<String>() {
@Override
public void onFailure(Throwable arg0) {
txtAreaDescription.setEnabled(false);
}
@Override
public void onSuccess(String result) {
if (result != null)
txtAreaDescription.setValue(result);
else
txtAreaDescription.setValue("");
txtAreaDescription.setEnabled(true);
}
});
}
/**
* Load gcube item properties.
*/
private void loadGcubeItemProperties() {
// mask("Loading properties...");
AppControllerExplorer.rpcWorkspaceService.loadGcubeItemProperties(fileModel.getIdentifier(),
new AsyncCallback<Map<String, String>>() {
@Override
public void onSuccess(Map<String, String> result) {
txtAreaGcubeProperties.setText("");
GWT.log("Gcube Item Properties: " + result);
gCubeProperties = result;
// unmask();
if (result != null && result.size() > 0) {
for (String key : result.keySet()) {
String text = txtAreaGcubeProperties.getText();
text += key + "=" + result.get(key) + ";\n";
txtAreaGcubeProperties.setText(text);
}
cgGcubeProperties.setVisible(true);
}
}
@Override
public void onFailure(Throwable caught) {
// unmask();
cgGcubeProperties.setVisible(false);
GWT.log("an error occured in loadGcubeItemProperties " + fileModel.getIdentifier() + " "
+ caught.getMessage());
}
});
}
/**
* Load AC ls description for shared folder.
*
* @param sharedId the shared id
*/
private void loadACLsDescriptionForSharedFolder(String sharedId) {
setPlaceholder(txtSharedWith, true, "loading...");
WorkspaceSharingServiceAsync.INSTANCE.getACLsDescriptionForSharedFolderId(sharedId,
new AsyncCallback<String>() {
@Override
public void onFailure(Throwable caught) {
removePlaceHolder(txtSharedWith);
txtSharedWith.setHTML("Error on recovering users");
}
@Override
public void onSuccess(String result) {
removePlaceHolder(txtSharedWith);
txtSharedWith.getElement().addClassName("shared-with-style");
GWT.log("Loaded ACLs: " + result);
txtSharedWith.setHTML(result);
}
});
}
/**
* Load thumbnails for image.
*/
private void loadThumbnailsForImage() {
htmlPanelImagePreview.setVisible(true);
final HTML txtLoadingPreview = new HTML();
htmlPanelImagePreview.add(txtLoadingPreview);
setPlaceholder(txtLoadingPreview, true, "loading preview...");
AppControllerExplorer.rpcWorkspaceService.getImageById(fileModel.getIdentifier(),
fileModel.getGXTFolderItemType().equals(GXTFolderItemTypeEnum.IMAGE_DOCUMENT), false,
new AsyncCallback<GWTWorkspaceItem>() {
@Override
public void onFailure(Throwable caught) {
removePlaceHolder(txtLoadingPreview);
}
@Override
public void onSuccess(GWTWorkspaceItem item) {
GWT.log("Image loaded: " + item.getName() + " label: " + item.getLabel() + " type: "
+ fileModel.getGXTFolderItemType());
if (fileModel.getGXTFolderItemType().equals(GXTFolderItemTypeEnum.IMAGE_DOCUMENT)) {
GWTImageDocument theItemImage = (GWTImageDocument) item;
htmlPanelImagePreview.add(new Image(theItemImage.getThumbnailUrl()));
htmlPanelImagePreview.setVisible(true);
}else {
GWTExternalImage theExternalImage = (GWTExternalImage) item;
htmlPanelImagePreview.add(new Image(theExternalImage.getThumbnailUrl()));
htmlPanelImagePreview.setVisible(true);
}
removePlaceHolder(txtLoadingPreview);
}
});
}
/**
* Sets the placeholder.
*
* @param html the html
* @param spinner the spinner
* @param placeholder the placeholder
*/
private void setPlaceholder(HTML html, boolean spinner, String placeholder) {
String loadingHMTL = placeholder;
if(spinner) {
loadingHMTL = "<span><img src=\""+spinnerImage.getUrl()+"\" style=\"padding-right:5px;\">"+placeholder+"</span>";
}
html.setHTML(loadingHMTL);
html.getElement().addClassName("placeholder-loading");
}
/**
* Removes the place holder.
*
* @param html the html
*/
private void removePlaceHolder(HTML html) {
html.setHTML("");
html.getElement().removeClassName("placeholder-loading");
}
/**
* Show PDF preview.
*
* @param pdfURL the pdf URL
* @param divId the div id
* @return the string
*/
public static native String showPDFPreview(String pdfURL, String divId)/*-{
var theDivContainer = "#"+divId;
$wnd.PDFObject.embed(pdfURL, theDivContainer);
}-*/;
}

View File

@ -0,0 +1,173 @@
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui"
xmlns:b="urn:import:com.github.gwtbootstrap.client.ui">
<ui:style>
.no-border {
border: 0px;
}
</ui:style>
<g:HTMLPanel>
<g:HorizontalPanel ui:field="hpHeaderDetails"
addStyleNames="item-details-header">
<g:HTML>Details</g:HTML>
<b:Button icon="REMOVE" ui:field="buttonClose" type="LINK"></b:Button>
</g:HorizontalPanel>
<g:HorizontalPanel ui:field="hpItemType"
addStyleNames="item-type-style">
</g:HorizontalPanel>
<g:HTMLPanel ui:field="htmlPanelImagePreview"
visible="false" addStyleNames="preview-image-style">
</g:HTMLPanel>
<g:HTMLPanel ui:field="htmlPanelFilePreview"
visible="false" addStyleNames="preview-file-style">
</g:HTMLPanel>
<b:Form type="HORIZONTAL">
<b:Alert ui:field="actionAlert" close="false" type="INFO"
visible="false">
<b:Icon type="ROTATE_RIGHT" spin="true" />
</b:Alert>
<b:Fieldset ui:field="fieldSetGetInfo"
styleName="{style.noBorder}">
<b:ControlGroup
addStyleNames="my-control-group-get-info">
<b:ControlLabel>Name</b:ControlLabel>
<b:Controls>
<g:HTML ui:field="txtName">
</g:HTML>
</b:Controls>
</b:ControlGroup>
<b:ControlGroup
addStyleNames="my-control-group-get-info">
<b:ControlLabel>Id</b:ControlLabel>
<b:Controls>
<g:HTML ui:field="txtId">
</g:HTML>
</b:Controls>
</b:ControlGroup>
<b:ControlGroup
addStyleNames="my-control-group-get-info">
<b:ControlLabel>Location</b:ControlLabel>
<b:Controls>
<g:HTML ui:field="txtLocation">
</g:HTML>
</b:Controls>
</b:ControlGroup>
<b:ControlGroup
addStyleNames="my-control-group-get-info" ui:field="cgTxtIsPublic"
visible="false">
<b:ControlLabel>Public</b:ControlLabel>
<b:Controls>
<g:HTML ui:field="txtIsPublic">
</g:HTML>
</b:Controls>
</b:ControlGroup>
<b:ControlGroup
addStyleNames="my-control-group-get-info" ui:field="cgTxtMimeType">
<b:ControlLabel>Type</b:ControlLabel>
<b:Controls>
<g:HTML ui:field="txtMimeType">
</g:HTML>
</b:Controls>
</b:ControlGroup>
<b:ControlGroup
addStyleNames="my-control-group-get-info"
ui:field="cgThreddsSynched" visible="false">
<b:ControlLabel title="Synched with THREDDS">Synched</b:ControlLabel>
<b:Controls>
<g:HTML ui:field="txtThreddsSynched">
</g:HTML>
</b:Controls>
</b:ControlGroup>
<b:ControlGroup
addStyleNames="my-control-group-get-info">
<b:ControlLabel>Description</b:ControlLabel>
<b:Controls>
<b:TextArea ui:field="txtAreaDescription"
readOnly="true">
</b:TextArea>
<b:Tooltip text="Edit the Description">
<b:Button icon="EDIT" ui:field="buttonUpdateDescription"
type="LINK">Edit</b:Button>
</b:Tooltip>
<b:Tooltip text="Save the Description">
<b:Button icon="SAVE" ui:field="buttonSaveDescription"
type="LINK" visible="false">Save</b:Button>
</b:Tooltip>
</b:Controls>
</b:ControlGroup>
<b:ControlGroup
addStyleNames="my-control-group-get-info"
ui:field="cgGcubeProperties" visible="false">
<b:ControlLabel>Gcube Properties</b:ControlLabel>
<b:Controls>
<b:TextArea ui:field="txtAreaGcubeProperties"
readOnly="true">
</b:TextArea>
<b:Tooltip text="Update the Gcube Properties">
<b:Button icon="PENCIL"
ui:field="buttonUpdateGcubeProperties" type="LINK">Edit</b:Button>
</b:Tooltip>
</b:Controls>
</b:ControlGroup>
<b:ControlGroup
addStyleNames="my-control-group-get-info">
<b:ControlLabel>Owner</b:ControlLabel>
<b:Controls>
<g:HTML ui:field="txtOwner">
</g:HTML>
</b:Controls>
</b:ControlGroup>
<b:ControlGroup
addStyleNames="my-control-group-get-info">
<b:ControlLabel>Created</b:ControlLabel>
<b:Controls>
<g:HTML ui:field="txtCreated">
</g:HTML>
</b:Controls>
</b:ControlGroup>
<b:ControlGroup
addStyleNames="my-control-group-get-info">
<b:ControlLabel>Modified</b:ControlLabel>
<b:Controls>
<g:HTML ui:field="txtLastMofication">
</g:HTML>
</b:Controls>
</b:ControlGroup>
<b:ControlGroup
addStyleNames="my-control-group-get-info">
<b:ControlLabel>Size</b:ControlLabel>
<b:Controls>
<g:HTML ui:field="txtSize">
</g:HTML>
</b:Controls>
</b:ControlGroup>
<b:ControlGroup
addStyleNames="my-control-group-get-info">
<b:ControlLabel>Shared</b:ControlLabel>
<b:Controls>
<g:HTML ui:field="txtShared">
</g:HTML>
</b:Controls>
</b:ControlGroup>
<b:ControlGroup
addStyleNames="my-control-group-get-info" ui:field="cgSharedWith"
visible="false">
<b:ControlLabel>Shared with</b:ControlLabel>
<b:Controls>
<g:HTML ui:field="txtSharedWith">
</g:HTML>
<b:Tooltip text="Go to Share">
<b:Button icon="USER" ui:field="buttonUpdateShare"
type="LINK">Share</b:Button>
</b:Tooltip>
</b:Controls>
</b:ControlGroup>
<b:Alert close="false" ui:field="errorAlert" type="ERROR"
visible="false"></b:Alert>
</b:Fieldset>
</b:Form>
</g:HTMLPanel>
</ui:UiBinder>

View File

@ -13,7 +13,6 @@ import org.gcube.portlets.widgets.workspacesharingwidget.shared.InfoContactModel
import com.extjs.gxt.ui.client.Style.ButtonScale;
import com.extjs.gxt.ui.client.Style.HorizontalAlignment;
import com.extjs.gxt.ui.client.data.BaseModel;
import com.extjs.gxt.ui.client.data.BaseModelData;
import com.extjs.gxt.ui.client.data.ModelData;
import com.extjs.gxt.ui.client.event.ButtonEvent;

View File

@ -0,0 +1,286 @@
/*global ActiveXObject, window, console, define, module, jQuery */
//jshint unused:false, strict: false
/*
PDFObject v2.1.1
https://github.com/pipwerks/PDFObject
Copyright (c) 2008-2018 Philip Hutchison
MIT-style license: http://pipwerks.mit-license.org/
UMD module pattern from https://github.com/umdjs/umd/blob/master/templates/returnExports.js
*/
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define([], factory);
} else if (typeof module === 'object' && module.exports) {
// Node. Does not work with strict CommonJS, but
// only CommonJS-like environments that support module.exports,
// like Node.
module.exports = factory();
} else {
// Browser globals (root is window)
root.PDFObject = factory();
}
}(this, function () {
"use strict";
//jshint unused:true
//PDFObject is designed for client-side (browsers), not server-side (node)
//Will choke on undefined navigator and window vars when run on server
//Return boolean false and exit function when running server-side
if(typeof window === "undefined" || typeof navigator === "undefined"){ return false; }
var pdfobjectversion = "2.1.1",
ua = window.navigator.userAgent,
//declare booleans
supportsPDFs,
isIE,
supportsPdfMimeType = (typeof navigator.mimeTypes['application/pdf'] !== "undefined"),
supportsPdfActiveX,
isModernBrowser = (function (){ return (typeof window.Promise !== "undefined"); })(),
isFirefox = (function (){ return (ua.indexOf("irefox") !== -1); } )(),
isFirefoxWithPDFJS = (function (){
//Firefox started shipping PDF.js in Firefox 19.
//If this is Firefox 19 or greater, assume PDF.js is available
if(!isFirefox){ return false; }
//parse userAgent string to get release version ("rv")
//ex: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:57.0) Gecko/20100101 Firefox/57.0
return (parseInt(ua.split("rv:")[1].split(".")[0], 10) > 18);
})(),
isIOS = (function (){ return (/iphone|ipad|ipod/i.test(ua.toLowerCase())); })(),
//declare functions
createAXO,
buildFragmentString,
log,
embedError,
embed,
getTargetElement,
generatePDFJSiframe,
generateEmbedElement;
/* ----------------------------------------------------
Supporting functions
---------------------------------------------------- */
createAXO = function (type){
var ax;
try {
ax = new ActiveXObject(type);
} catch (e) {
ax = null; //ensure ax remains null
}
return ax;
};
//IE11 still uses ActiveX for Adobe Reader, but IE 11 doesn't expose
//window.ActiveXObject the same way previous versions of IE did
//window.ActiveXObject will evaluate to false in IE 11, but "ActiveXObject" in window evaluates to true
//so check the first one for older IE, and the second for IE11
//FWIW, MS Edge (replacing IE11) does not support ActiveX at all, both will evaluate false
//Constructed as a method (not a prop) to avoid unneccesarry overhead -- will only be evaluated if needed
isIE = function (){ return !!(window.ActiveXObject || "ActiveXObject" in window); };
//If either ActiveX support for "AcroPDF.PDF" or "PDF.PdfCtrl" are found, return true
//Constructed as a method (not a prop) to avoid unneccesarry overhead -- will only be evaluated if needed
supportsPdfActiveX = function (){ return !!(createAXO("AcroPDF.PDF") || createAXO("PDF.PdfCtrl")); };
//Determines whether PDF support is available
supportsPDFs = (
//as of iOS 12, inline PDF rendering is still not supported in Safari or native webview
//3rd-party browsers (eg Chrome, Firefox) use Apple's webview for rendering, and thus the same result as Safari
//Therefore if iOS, we shall assume that PDF support is not available
!isIOS && (
//Modern versions of Firefox come bundled with PDFJS
isFirefoxWithPDFJS ||
//Browsers that still support the original MIME type check
supportsPdfMimeType || (
//Pity the poor souls still using IE
isIE() && supportsPdfActiveX()
)
)
);
//Create a fragment identifier for using PDF Open parameters when embedding PDF
buildFragmentString = function(pdfParams){
var string = "",
prop;
if(pdfParams){
for (prop in pdfParams) {
if (pdfParams.hasOwnProperty(prop)) {
string += encodeURIComponent(prop) + "=" + encodeURIComponent(pdfParams[prop]) + "&";
}
}
//The string will be empty if no PDF Params found
if(string){
string = "#" + string;
//Remove last ampersand
string = string.slice(0, string.length - 1);
}
}
return string;
};
log = function (msg){
if(typeof console !== "undefined" && console.log){
console.log("[PDFObject] " + msg);
}
};
embedError = function (msg){
log(msg);
return false;
};
getTargetElement = function (targetSelector){
//Default to body for full-browser PDF
var targetNode = document.body;
//If a targetSelector is specified, check to see whether
//it's passing a selector, jQuery object, or an HTML element
if(typeof targetSelector === "string"){
//Is CSS selector
targetNode = document.querySelector(targetSelector);
} else if (typeof jQuery !== "undefined" && targetSelector instanceof jQuery && targetSelector.length) {
//Is jQuery element. Extract HTML node
targetNode = targetSelector.get(0);
} else if (typeof targetSelector.nodeType !== "undefined" && targetSelector.nodeType === 1){
//Is HTML element
targetNode = targetSelector;
}
return targetNode;
};
generatePDFJSiframe = function (targetNode, url, pdfOpenFragment, PDFJS_URL, id){
var fullURL = PDFJS_URL + "?file=" + encodeURIComponent(url) + pdfOpenFragment;
var scrollfix = (isIOS) ? "-webkit-overflow-scrolling: touch; overflow-y: scroll; " : "overflow: hidden; ";
var iframe = "<div style='" + scrollfix + "position: absolute; top: 0; right: 0; bottom: 0; left: 0;'><iframe " + id + " src='" + fullURL + "' style='border: none; width: 100%; height: 100%;' frameborder='0'></iframe></div>";
targetNode.className += " pdfobject-container";
targetNode.style.position = "relative";
targetNode.style.overflow = "auto";
targetNode.innerHTML = iframe;
return targetNode.getElementsByTagName("iframe")[0];
};
generateEmbedElement = function (targetNode, targetSelector, url, pdfOpenFragment, width, height, id){
var style = "";
if(targetSelector && targetSelector !== document.body){
style = "width: " + width + "; height: " + height + ";";
} else {
style = "position: absolute; top: 0; right: 0; bottom: 0; left: 0; width: 100%; height: 100%;";
}
targetNode.className += " pdfobject-container";
targetNode.innerHTML = "<embed " + id + " class='pdfobject' src='" + url + pdfOpenFragment + "' type='application/pdf' style='overflow: auto; " + style + "'/>";
return targetNode.getElementsByTagName("embed")[0];
};
embed = function(url, targetSelector, options){
//Ensure URL is available. If not, exit now.
if(typeof url !== "string"){ return embedError("URL is not valid"); }
//If targetSelector is not defined, convert to boolean
targetSelector = (typeof targetSelector !== "undefined") ? targetSelector : false;
//Ensure options object is not undefined -- enables easier error checking below
options = (typeof options !== "undefined") ? options : {};
//Get passed options, or set reasonable defaults
var id = (options.id && typeof options.id === "string") ? "id='" + options.id + "'" : "",
page = (options.page) ? options.page : false,
pdfOpenParams = (options.pdfOpenParams) ? options.pdfOpenParams : {},
fallbackLink = (typeof options.fallbackLink !== "undefined") ? options.fallbackLink : true,
width = (options.width) ? options.width : "100%",
height = (options.height) ? options.height : "100%",
assumptionMode = (typeof options.assumptionMode === "boolean") ? options.assumptionMode : true,
forcePDFJS = (typeof options.forcePDFJS === "boolean") ? options.forcePDFJS : false,
PDFJS_URL = (options.PDFJS_URL) ? options.PDFJS_URL : false,
targetNode = getTargetElement(targetSelector),
fallbackHTML = "",
pdfOpenFragment = "",
fallbackHTML_default = "<p>This browser does not support inline PDFs. Please download the PDF to view it: <a href='[url]'>Download PDF</a></p>";
//If target element is specified but is not valid, exit without doing anything
if(!targetNode){ return embedError("Target element cannot be determined"); }
//page option overrides pdfOpenParams, if found
if(page){
pdfOpenParams.page = page;
}
//Stringify optional Adobe params for opening document (as fragment identifier)
pdfOpenFragment = buildFragmentString(pdfOpenParams);
//Do the dance
//If the forcePDFJS option is invoked, skip everything else and embed as directed
if(forcePDFJS && PDFJS_URL){
return generatePDFJSiframe(targetNode, url, pdfOpenFragment, PDFJS_URL, id);
//If traditional support is provided, or if this is a modern browser and not iOS (see comment for supportsPDFs declaration)
} else if(supportsPDFs || (assumptionMode && isModernBrowser && !isIOS)){
return generateEmbedElement(targetNode, targetSelector, url, pdfOpenFragment, width, height, id);
//If everything else has failed and a PDFJS fallback is provided, try to use it
} else if(PDFJS_URL){
return generatePDFJSiframe(targetNode, url, pdfOpenFragment, PDFJS_URL, id);
} else {
//Display the fallback link if available
if(fallbackLink){
fallbackHTML = (typeof fallbackLink === "string") ? fallbackLink : fallbackHTML_default;
targetNode.innerHTML = fallbackHTML.replace(/\[url\]/g, url);
}
return embedError("This browser does not support embedded PDFs");
}
};
return {
embed: function (a,b,c){ return embed(a,b,c); },
pdfobjectversion: (function () { return pdfobjectversion; })(),
supportsPDFs: (function (){ return supportsPDFs; })()
};
}));

View File

@ -264,27 +264,26 @@ table.userssuggest th {
margin-left: -600px !important;
}
.modal-body-custom {
height: 550px !important;
max-height: none !important;
.modal-body-ws-tree {
max-height: 700px !important;
}
.modal-top-custom {
top: 2% !important;
}
.my-control-group .controls{
.my-control-group .controls {
margin-left: 70px !important;
}
.my-control-group .control-label {
width: 80px !important;
text-align: center !important;
padding-right: 10px !important;
width: 80px !important;
text-align: center !important;
padding-right: 10px !important;
}
.my-control-group .add-on{
width: 20px !important;
.my-control-group .add-on {
width: 20px !important;
}
.my-control-group .gwt-TextBox {
@ -300,4 +299,145 @@ table.userssuggest th {
cursor: default;
color: gray !important;
text-decoration: none;
}
.my-control-group-get-info {
margin-bottom: 5px !important;
margin-left: 15px;
font-size: 14px !important;
font-family: Arial, serif;
color: #222;
}
.my-control-group-get-info .controls {
margin-left: 70px !important;
}
.my-control-group-get-info .control-label {
width: 80px !important;
text-align: left !important;
padding-right: 10px !important;
font-family: Roboto, Arial, serif !important;
color: #959595;
}
.my-control-group-get-info .add-on {
width: 20px !important;
}
.my-control-group-get-info .gwt-HTML {
padding-top: 5px;
font-family: Roboto, Arial, serif !important;
word-wrap: break-word;
overflow-wrap: anywhere;
overflow: hidden;
}
.my-control-group-get-info .gwt-TextBox:hover {
cursor: text !important;
}
.my-control-group-get-info .gwt-TextArea {
width: 260px;
min-height: 60px;
height: 60px;
}
.my-control-group-get-info .btn-link {
margin-left: 7px !important;
}
.item-type-style {
margin-top: 1px;
margin-left: 10px;
margin-bottom: 10px;
padding-top: 5px;
padding-bottom: 5px;
}
.item-type-style td {
height: 30px;
}
.item-type-style td:first-child {
width: 30px;
padding-left: 5px;
}
.item-type-style td {
vertical-align: middle !important;
}
/*THIS IS THE SIZE OF DOWNLOAD ICON
IN THE 'DETAILS' PANEL*/
.item-type-style td a i{
font-size: 22px;
}
.item-details-header {
margin-top: 15px;
margin-left: 15px;
margin-right: 15px;
}
.item-details-header td {
vertical-align: middle !important;
}
.item-details-header td:last-child {
width: 85%;
color: #555;
}
.item-details-header .gwt-HTML {
font-size: 20px;
font-family: Roboto, Arial, serif !important;
color: #555;
}
.placeholder-loading {
color: rgb(142, 142, 142);
}
.shared-with-style{
width: 90% !important;
font-size: 12px !important;
display: inline-block !important;
}
.preview-image-style {
width: 95%;
display: flex;
align-items: center;
justify-content: center;
margin-left: 10px;
border: 1px solid #e6e6e6;
padding-top: 5px;
padding-bottom: 5px;
border-left: none;
border-right: none;
}
.preview-image-style img {
max-width: 400px;
}
.preview-file-style {
width: 95%;
display: flex;
align-items: center;
justify-content: center;
margin-left: 10px;
border: 1px solid #e6e6e6;
padding-top: 5px;
padding-bottom: 5px;
border-left: none;
border-right: none;
}
.my-preview-doc {
width: 350px;
height: 350px;
}

View File

@ -153,7 +153,7 @@ public class DownloadServlet extends HttpServlet{
ByteArrayInputStream is = new ByteArrayInputStream(fileContent.getBytes());
String contentDisposition = viewContent?"inline":"attachment";
String urlMimeType = "text/uri-list";
String itemName = MimeTypeUtility.getNameWithExtension(item.getName(), urlMimeType);
String itemName = MimeTypeUtility.getNameWithExtension(item.getName(), urlMimeType, false);
resp.setHeader("Content-Disposition", contentDisposition+"; filename=\"" + itemName + "\"" );
resp.setContentType(urlMimeType);
@ -190,7 +190,7 @@ public class DownloadServlet extends HttpServlet{
logger.info("Downloading the folder: "+workspaceFolder);
String contentDisposition = viewContent?"inline":"attachment";
String mimeType = "application/zip";
String itemName = MimeTypeUtility.getNameWithExtension(item.getName(), mimeType);
String itemName = MimeTypeUtility.getNameWithExtension(item.getName(), mimeType,true);
resp.setHeader("Content-Disposition", contentDisposition+"; filename=\"" + itemName + "\"" );
resp.setContentType(mimeType);
@ -233,7 +233,7 @@ public class DownloadServlet extends HttpServlet{
String mimeType = pdfFile.getMimeType();
logger.trace("EXTERNAL_FILE DOWNLOAD FOR "+pdfFile.getId());
String contentDisposition = viewContent?"inline":"attachment";
String itemName = MimeTypeUtility.getNameWithExtension(descr.getItemName(), mimeType);
String itemName = MimeTypeUtility.getNameWithExtension(descr.getItemName(), mimeType,false);
resp.setHeader("Content-Disposition", contentDisposition+"; filename=\"" + itemName + "\"" );
resp.setContentType(mimeType);
@ -267,7 +267,7 @@ public class DownloadServlet extends HttpServlet{
ImageFileItem imageFile = (ImageFileItem) workspaceFileItem;
logger.info("Downloading: "+imageFile);
String mimeType = imageFile.getMimeType();
String itemName = MimeTypeUtility.getNameWithExtension(descr.getItemName(), mimeType);
String itemName = MimeTypeUtility.getNameWithExtension(descr.getItemName(), mimeType,false);
String contentDisposition = viewContent?"inline":"attachment";
resp.setHeader("Content-Disposition", contentDisposition+"; filename=\"" + itemName + "\"" );
resp.setContentType(mimeType);
@ -298,7 +298,7 @@ public class DownloadServlet extends HttpServlet{
URLFileItem externalUrl = (URLFileItem) workspaceFileItem;
logger.info("Downloading: "+externalUrl);
String urlMimeType = "text/uri-list";
String itemName = MimeTypeUtility.getNameWithExtension(descr.getItemName(), urlMimeType);
String itemName = MimeTypeUtility.getNameWithExtension(descr.getItemName(), urlMimeType,false);
String contentDisposition = viewContent?"inline":"attachment";
resp.setHeader("Content-Disposition", contentDisposition+"; filename=\"" + itemName + "\"" );
resp.setContentType(urlMimeType);
@ -347,7 +347,7 @@ public class DownloadServlet extends HttpServlet{
try{
String itemName = MimeTypeUtility.getNameWithExtension(descr.getItemName(), workspaceFileItem.getMimeType());
String itemName = MimeTypeUtility.getNameWithExtension(descr.getItemName(), workspaceFileItem.getMimeType(),false);
logger.info("Downloading default item: "+workspaceFileItem);
//String contentDisposition = viewContent?"inline":"attachment";

View File

@ -145,17 +145,21 @@ public class ImageServlet extends HttpServlet{
try{
streamDescr = wa.getThumbnailData(image.getId());
/*TODO
* UNCOMMENT THIS IF YOU WANT TO ADD MORE CONTROLS
ReusableInputStream ris = new ReusableInputStream(streamDescr.getStream());
logger.debug("Thumbnail data has size: "+streamDescr.getSize());
//CHECKING IF THE STREAM IS A VALID IMAGE
/* TODO
* ReusableInputStream ris = new ReusableInputStream(streamDescr.getStream());
boolean isAvalidImage = isAnImage(ris, image.getName());
if(!isAvalidImage)
if(!isAvalidImage) {
//CREATING THE THUMBNAIL
logger.debug("the stream seems not be a valid image, creating the thumbnail");
streamDescr = createThumbnailForImage(wa, image);
else {
}else {
//ASSIGNING THE REUSABLE STREAM
streamDescr = new org.gcube.common.storagehubwrapper.shared.tohl.impl.StreamDescriptor(ris, image.getName(), null, image.getMimeType());
logger.debug("using reusable stream");
size = streamDescr.getSize()==null?0:streamDescr.getSize();
logger.debug("ReusableInputStream has size: "+size);
streamDescr = new org.gcube.common.storagehubwrapper.shared.tohl.impl.StreamDescriptor(ris, image.getName(), size, streamDescr.getMimeType());
}*/
@ -186,8 +190,9 @@ public class ImageServlet extends HttpServlet{
resp.setContentType(mimeType);
//if image/thumbnail size is 0, skipping setContentLength
if(size!=0)
resp.setContentLength((int)size);
//AVOIDING TO SET IT, SOME CASES THE SIZE MISMATCH
// if(size!=0)
// resp.setContentLength((int)size);
InputStream in = streamDescr.getStream();

View File

@ -9,6 +9,7 @@ import java.util.List;
import javax.servlet.http.HttpServletRequest;
import org.gcube.common.storagehub.model.types.WorkspaceItemType;
import org.gcube.common.storagehubwrapper.shared.Member;
import org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceFolder;
import org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceItem;
import org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceSharedFolder;
@ -160,18 +161,13 @@ public class NotificationStorageHubUtil {
if(isFolderAndShared(rootSharedFolder)){ //JUST TO BE SURE
List<String> listPortalLogin = workspace.getSharedFolderMembers(rootSharedFolder.getId());
logger.debug("StorageHub returned "+ listPortalLogin.size() + " user/s");
List<Member> listMembers = workspace.getSharedFolderMembers(rootSharedFolder.getId());
logger.debug("StorageHub returned "+ listMembers.size() + " user/s");
if(!WsUtil.isWithinPortal())
return StorageHubToWorkpaceConverter.buildGxtInfoContactFromPortalLoginTestMode(listPortalLogin);
List<InfoContactModel> listContacts = new ArrayList<InfoContactModel>(listPortalLogin.size());
for (String login : listPortalLogin) {
listContacts.add(StorageHubToWorkpaceConverter.buildGxtInfoContactFromPortalLogin(login));
}
return StorageHubToWorkpaceConverter.buildGxtInfoContactFromPortalLoginTestMode(listMembers);
return listContacts;
return StorageHubToWorkpaceConverter.listMembersToListContact(listMembers);
}
else
logger.debug("the item with id: "+rootSharedFolder.getId()+ " is not "+WorkspaceItemType.SHARED_FOLDER);

View File

@ -10,7 +10,8 @@ import javax.xml.parsers.DocumentBuilderFactory;
import org.gcube.common.resources.gcore.utils.XPathHelper;
import org.gcube.common.scope.api.ScopeProvider;
import org.gcube.portlets.user.workspace.server.util.WsUtil;
import org.gcube.common.scope.impl.ScopeBean;
import org.gcube.common.scope.impl.ScopeBean.Type;
import org.gcube.resources.discovery.client.api.DiscoveryClient;
import org.gcube.resources.discovery.client.queries.api.Query;
import org.gcube.resources.discovery.client.queries.impl.QueryBox;
@ -19,12 +20,11 @@ import org.slf4j.LoggerFactory;
import org.w3c.dom.Node;
import org.xml.sax.InputSource;
/**
* The Class ApplicationProfileReader.
*
* @author Francesco Mangiacrapa francesco.mangiacrapa{@literal @}isti.cnr.it
* Sep 14, 2016
* Sep 14, 2016
*/
public class ApplicationProfileReader {
@ -48,12 +48,26 @@ public class ApplicationProfileReader {
private String resourceName;
private String appID;
public enum APPLICATION_PROFILE_ITEM {
SCOPE("/Scope/text()"), URL("/URL/text()");
private String xPath;
APPLICATION_PROFILE_ITEM(String xpath) {
this.xPath = xpath;
}
public String getXPath() {
return xPath;
}
}
/**
* Instantiates a new application profile reader.
*
* @param resourceName the resource name
* @param appID the app id
* @param appID the app id
* @throws Exception the exception
*/
public ApplicationProfileReader(String resourceName, String appID) throws Exception {
@ -64,150 +78,167 @@ public class ApplicationProfileReader {
this.scope = ScopeProvider.instance.get();
}
/**
* this method looks up the generic resource among the ones available in the infrastructure using scope provider {@link ScopeProvider.instance.get()}
* resource name {@value #WORKSPACE_EXPLORER_APP_NAME} and secondaryType {@value #SECONDARY_TYPE}
* this method looks up the generic resource among the ones available in the
* infrastructure using scope provider {@link ScopeProvider.instance.get()}
* resource name {@value #WORKSPACE_EXPLORER_APP_NAME} and secondaryType
* {@value #SECONDARY_TYPE}
*
* @return the applicationProfile profile
*/
/**
* this method looks up the applicationProfile profile among the ones available in the infrastructure.
* this method looks up the applicationProfile profile among the ones available
* in the infrastructure.
*
* @return the applicationProfile profile
*/
public ApplicationProfile readProfileFromInfrastrucure() {
ApplicationProfile appProf = new ApplicationProfile();
String queryString = getGcubeGenericQueryString(secondaryType, appID);
ApplicationProfile appProf = new ApplicationProfile();
String queryString = getGcubeGenericQueryString(secondaryType, appID);
try {
try {
if(scope==null)
throw new Exception("Scope is null, set scope into ScopeProvider");
if (scope == null)
throw new Exception("Scope is null, set scope into ScopeProvider");
logger.info("Trying to fetch ApplicationProfile in the scope: "+scope+", SecondaryType: " + secondaryType + ", AppId: " + appID);
Query q = new QueryBox(queryString);
DiscoveryClient<String> client = client();
List<String> appProfile = client.submit(q);
logger.info("Trying to fetch " + SECONDARY_TYPE + " in the scope: " + scope + ", SecondaryType: "
+ secondaryType + ", AppId: " + appID);
Query q = new QueryBox(queryString);
DiscoveryClient<String> client = client();
List<String> appProfile = client.submit(q);
if (appProfile == null || appProfile.size() == 0)
throw new ApplicationProfileNotFoundException("ApplicationProfile with SecondaryType: " + secondaryType + ", AppId: " + appID +" is not registered in the scope: "+scope);
else {
String elem = appProfile.get(0);
DocumentBuilder docBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
Node node = docBuilder.parse(new InputSource(new StringReader(elem))).getDocumentElement();
XPathHelper helper = new XPathHelper(node);
if (appProfile == null || appProfile.size() == 0)
throw new ApplicationProfileNotFoundException("Generic Resource with SecondaryType: " + secondaryType
+ ", AppId: " + appID + " is not registered in the scope: " + scope);
else {
String elem = appProfile.get(0);
DocumentBuilder docBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
Node node = docBuilder.parse(new InputSource(new StringReader(elem))).getDocumentElement();
XPathHelper helper = new XPathHelper(node);
List<String> currValue = null;
currValue = helper.evaluate(RESOURCE_PROFILE_NAME_TEXT);
if (currValue != null && currValue.size() > 0) {
appProf.setName(currValue.get(0));
}
else throw new ApplicationProfileNotFoundException("Your applicationProfile NAME was not found in the profile");
List<String> currValue = null;
currValue = helper.evaluate(RESOURCE_PROFILE_NAME_TEXT);
if (currValue != null && currValue.size() > 0) {
appProf.setName(currValue.get(0));
} else
throw new ApplicationProfileNotFoundException(
"Your " + SECONDARY_TYPE + " NAME was not found in the generic resource");
currValue = helper.evaluate(RESOURCE_PROFILE_DESCRIPTION_TEXT);
if (currValue != null && currValue.size() > 0) {
appProf.setDescription(currValue.get(0));
}
else logger.warn("No Description exists for " + appProf.getName());
currValue = helper.evaluate(RESOURCE_PROFILE_DESCRIPTION_TEXT);
if (currValue != null && currValue.size() > 0) {
appProf.setDescription(currValue.get(0));
} else
logger.warn("No Description exists for " + appProf.getName());
currValue = helper.evaluate(RESOURCE_PROFILE_BODY_APP_ID_TEXT);
if (currValue != null && currValue.size() > 0) {
appProf.setKey(currValue.get(0));
}
else throw new ApplicationProfileNotFoundException("Your applicationProfile ID n was not found in the profile, consider adding <AppId> element in <Body>");
currValue = helper.evaluate(RESOURCE_PROFILE_BODY_APP_ID_TEXT);
if (currValue != null && currValue.size() > 0) {
appProf.setKey(currValue.get(0));
} else
throw new ApplicationProfileNotFoundException("Your " + SECONDARY_TYPE
+ " ID was not found in the generic resource, consider adding <AppId> element in <Body>");
currValue = helper.evaluate(RESOURCE_PROFILE_BODY_THUMBNAIL_URL_TEXT);
if (currValue != null && currValue.size() > 0) {
appProf.setImageUrl(currValue.get(0));
}
else{
logger.warn("Null or empty <ThumbnailURL> element in <Body>" + appProf.getName());
}
currValue = helper.evaluate(RESOURCE_PROFILE_BODY_THUMBNAIL_URL_TEXT);
if (currValue != null && currValue.size() > 0) {
appProf.setImageUrl(currValue.get(0));
} else {
logger.warn("Null or empty <ThumbnailURL> element in <Body> of " + appProf.getName());
}
currValue = helper.evaluate("/Resource/Profile/Body/EndPoint[Scope='"+scope.toString()+"']/Scope/text()");
currValue = helper
.evaluate("/Resource/Profile/Body/EndPoint[Scope='" + scope.toString() + "']/Scope/text()");
if (currValue != null && currValue.size() > 0) {
List<String> scopes = currValue;
String currentScope = scopes.get(0);
appProf = readEndPointForScopeWithRetry(helper, scope, APPLICATION_PROFILE_ITEM.SCOPE, appProf);
//int slashCount = StringUtils.countMatches(currentScope, "/");
boolean isVRE = WsUtil.isVRE(currentScope);
appProf = readEndPointForScopeWithRetry(helper, scope, APPLICATION_PROFILE_ITEM.URL, appProf);
//if(slashCount < 3){//CASE not VRE - set session scope
if(!isVRE){//CASE not VRE - set session scope
logger.info("Scope "+ scope.toString() + " is not a VRE");
List<String> listSessionScope = helper.evaluate("/Resource/Profile/Body/EndPoint[Scope='"+scope.toString()+"']/Sessionscope/text()"); //get session scope of i+1-mo scope
logger.debug("ListSessionScope is: "+ listSessionScope.toString());
if(listSessionScope!=null && listSessionScope.size()>0){ //If sessions scope exists
logger.debug("setting session scope "+ listSessionScope.get(0));
appProf.setScope(listSessionScope.get(0));
}
else{
logger.trace("session scope not exists setting scope "+ scope.toString());
appProf.setScope(scope.toString());
}
}
else{ //CASE IS A VRE
logger.info("Scope "+ scope.toString() + " is a VRE");
appProf.setScope(scope.toString());
}
//RETRIEVE URL
currValue = helper.evaluate("/Resource/Profile/Body/EndPoint[Scope='"+scope.toString()+"']/URL/text()");
if (currValue != null && currValue.size() > 0) {
String url = currValue.get(0);
// System.out.println("URL "+url);
if(url!=null)
appProf.setUrl(url);
else
throw new ApplicationProfileNotFoundException("Your applicationProfile URL was not found in the profile for Scope: " + scope.toString());
}
else throw new ApplicationProfileNotFoundException("Your applicationProfile URL was not found in the profile for Scope: " + scope.toString());
}
else throw new ApplicationProfileNotFoundException("Your applicationProfile with scope "+scope.toString()+" was not found in the profile, consider adding <EndPoint><Scope> element in <Body>");
logger.debug("returning: "+appProf);
logger.debug("returning: " + appProf);
return appProf;
}
} catch (Exception e) {
logger.error("Error while trying to fetch applicationProfile profile from the infrastructure", e);
return null;
}finally{
} finally {
/*
if(originalScope!=null && !originalScope.isEmpty()){
ScopeProvider.instance.set(originalScope);
logger.info("scope provider setted to orginal scope: "+originalScope);
}else{
ScopeProvider.instance.reset();
logger.info("scope provider reset");
}*/
* if(originalScope!=null && !originalScope.isEmpty()){
* ScopeProvider.instance.set(originalScope);
* logger.info("scope provider setted to orginal scope: "+originalScope); }else{
* ScopeProvider.instance.reset(); logger.info("scope provider reset"); }
*/
}
}
private ApplicationProfile readEndPointForScopeWithRetry(XPathHelper helper, String scope,
APPLICATION_PROFILE_ITEM searchItem, ApplicationProfile appProf)
throws ApplicationProfileNotFoundException {
String xPathToQuery = "/Resource/Profile/Body/EndPoint[Scope='" + scope + "']" + searchItem.getXPath();
logger.debug("Identifying path with current scope: " + xPathToQuery);
List<String> currValue = helper.evaluate(xPathToQuery);
String queryResult = null;
if (currValue == null || currValue.isEmpty()) {
logger.warn("In the " + SECONDARY_TYPE + " with name " + appProf.getName() + " the xPath " + xPathToQuery
+ " returned with no results");
ScopeBean scopeBean = new ScopeBean(scope);
if (scopeBean.is(Type.VRE) || scopeBean.is(Type.VO)) {
String pathSeparator = "/";
String[] components = scope.split(pathSeparator);
scope = pathSeparator + components[1];
logger.info("The scope "+scopeBean.toString()+" is of kind " + Type.VRE + " or " + Type.VO
+ ". Retry in action - going to search the default <EndPoint> with the root scope: " + scope);
xPathToQuery = "/Resource/Profile/Body/EndPoint[Scope='" + scope + "']" + searchItem.getXPath();
logger.debug("Identifying path with root scope: " + xPathToQuery);
currValue = helper.evaluate(xPathToQuery);
if (currValue == null || currValue.isEmpty()) {
logger.warn("In the " + SECONDARY_TYPE + " with name " + appProf.getName() + " the xPath " + xPathToQuery
+ " returned with no results");
}
}
}
if (currValue == null || currValue.isEmpty()) {
throw new ApplicationProfileNotFoundException("Your ApplicationProfile in the scope " + scope
+ " have not an <EndPoint> accessible, consider adding <EndPoint><Scope></Scope> element in <Body>");
}
queryResult = currValue.get(0);
logger.info("The xPath: " + xPathToQuery + " returned with the result: " + queryResult);
switch (searchItem) {
case SCOPE:
appProf.setScope(currValue.get(0));
break;
case URL:
appProf.setUrl(currValue.get(0));
break;
default:
break;
}
return appProf;
}
/**
* Gets the gcube generic query string.
* Gets the gcube generic xPath string.
*
* @param secondaryType the secondary type
* @param appId the app id
* @return the gcube generic query string
* @param appId the app id
* @return the gcube generic xPath string
*/
public static String getGcubeGenericQueryString(String secondaryType, String appId){
public static String getGcubeGenericQueryString(String secondaryType, String appId) {
return "for $profile in collection('/db/Profiles/GenericResource')//Resource " +
"where $profile/Profile/SecondaryType/string() eq '"+secondaryType+"' and $profile/Profile/Body/AppId/string() " +
" eq '" + appId + "'" +
"return $profile";
return "for $profile in collection('/db/Profiles/GenericResource')//Resource "
+ "where $profile/Profile/SecondaryType/string() eq '" + secondaryType
+ "' and $profile/Profile/Body/AppId/string() " + " eq '" + appId + "'" + "return $profile";
}
/**
@ -219,7 +250,6 @@ public class ApplicationProfileReader {
return secondaryType;
}
/**
* Gets the scope.
*
@ -238,8 +268,9 @@ public class ApplicationProfileReader {
return resourceName;
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see java.lang.Object#toString()
*/
@Override
@ -258,20 +289,4 @@ public class ApplicationProfileReader {
return builder.toString();
}
// public static void main(String[] args) {
//
// try {
// ScopeProvider.instance.set("/gcube");
// ApplicationProfileReader ap = new ApplicationProfileReader("Workspace-Explorer-App", "org.gcube.portlets.user.workspaceexplorerapp.server.WorkspaceExplorerAppServiceImpl");
// System.out.println(ap.readProfileFromInfrastrucure());
// }
// catch (Exception e) {
// // TODO Auto-generated catch block
// e.printStackTrace();
// }
//
//
// }
}

View File

@ -63,9 +63,6 @@ public class ObjectStorageHubToWorkpaceMapper {
isVreFolder = sharedFolder.isVreFolder();
}
// FolderModel root = new FolderModel(workspaceRoot.getId(),workspaceRoot.getName(),null, true, workspaceRoot.isShared(), false, workspaceRoot.isPublic());
// root.setIsRoot(true);
FolderModel theFolder = new FolderModel(folder.getId(), folder.getName(), null, folder.isFolder(), folder.isShared(), isVreFolder, isPublicFolder);
theFolder.setIsRoot(folder.isRoot());
return theFolder;
@ -82,7 +79,7 @@ public class ObjectStorageHubToWorkpaceMapper {
* @return the file model
* @throws InternalErrorException the internal error exception
*/
public static FileModel toTreeFileModelItem(org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceItem wrappedItem, FileModel parentFolderModel, boolean isParentShared) throws InternalErrorException{
public static FileModel toTreeFileModelItem(org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceItem wrappedItem, FileModel parentFolderModel, boolean isParentShared, GCubeUser loggedUser) throws InternalErrorException{
FileModel fileModel = null;
//boolean isPublic = false;
@ -147,6 +144,8 @@ public class ObjectStorageHubToWorkpaceMapper {
if(wrappedItem.getParentId()!=null && isParentShared)
fileModel.setShareable(false);
}
setFullNameOwner(wrappedItem, fileModel, loggedUser);
//setSynchedThreddsStateFor(fileModel);
fileModel.setIsRoot(wrappedItem.isRoot());
@ -250,27 +249,32 @@ public class ObjectStorageHubToWorkpaceMapper {
fileGridModel.setShareable(false); //UPDATED TO CHANGE PERMISSIONS TO SHARED SUBFOLDERS
}
setFullNameOwner(wrappedItem, fileGridModel, loggedUser);
logger.trace("Returning converted grid item: "+fileGridModel);
return fileGridModel;
}
private static void setFullNameOwner(org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceItem wrappedItem, FileModel fileModel, GCubeUser loggedUser) {
//OWNER
if(wrappedItem.isShared()){ //IT IS READ FROM SHUB ONLY IF THE ITEM IS SHARED
fileGridModel.setShared(true); //NOT REMOVE IT IS IMPORTANT, SEE #1459
fileModel.setShared(true); //NOT REMOVE IT IS IMPORTANT, SEE #1459
String ownerUsername = wrappedItem.getOwner();
if(ownerUsername!=null){
// System.out.println("++++reading owner");
//String portalLogin = owner.getPortalLogin();
fileGridModel.setOwnerFullName(UserUtil.getUserFullName(ownerUsername));
fileModel.setOwnerFullName(UserUtil.getUserFullName(ownerUsername));
}
}
else{
String ownerUsername = wrappedItem.getOwner();
//Task #12911 I'm calling getUserFullName for any user other than logged user
if(ownerUsername!=null && ownerUsername.compareToIgnoreCase(loggedUser.getUsername())!=0){
fileGridModel.setOwnerFullName(UserUtil.getUserFullName(ownerUsername));
fileModel.setOwnerFullName(UserUtil.getUserFullName(ownerUsername));
}else
fileGridModel.setOwnerFullName(loggedUser.getFullname());
fileModel.setOwnerFullName(loggedUser.getFullname());
}
logger.trace("Returning converted grid item: "+fileGridModel);
return fileGridModel;
}

View File

@ -22,6 +22,7 @@ import org.apache.tika.mime.MediaType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
// TODO: Auto-generated Javadoc
/**
* The Class MimeTypeUtil.
*
@ -48,15 +49,19 @@ public class MimeTypeUtility {
protected static final Map<String, List<String>> mimetype_extension_map = new LinkedHashMap<String, List<String>>();
protected static final Map<String, String> extension_mimetype_map = new LinkedHashMap<String, String>();
protected static final Map<String, List<String>> preview_mimetype_extension_map = new LinkedHashMap<String, List<String>>();
static {
InputStream extensionToMimetype = MimeTypeUtility.class
.getResourceAsStream("/WsExtensionToMimeTypeMap.properties");
InputStream mimetypeToExtension = MimeTypeUtility.class
.getResourceAsStream("/WsMimeTypeToExtensionMap.properties");
InputStream previewMimeTypeToExtension = MimeTypeUtility.class
.getResourceAsStream("/PreviewMimeTypeToExtensionMap.properties");
try {
loadExtensions(extensionToMimetype);
loadMimeTypes(mimetypeToExtension);
loadPreviewMimeTypes(previewMimeTypeToExtension);
} catch (IOException e) {
e.printStackTrace();
}
@ -115,6 +120,34 @@ public class MimeTypeUtility {
br.close();
}
/**
* Load preview mime types.
*
* @param is the is
* @throws IOException Signals that an I/O exception has occurred.
*/
protected static void loadPreviewMimeTypes(InputStream is) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(is));
String line = br.readLine();
while (line != null) {
String[] split = line.split("=");
if (split.length == 2) {
String mimeType = split[0];
String extension = split[1];
List<String> toExtensions = preview_mimetype_extension_map.get(mimeType);
if (toExtensions == null) {
toExtensions = new ArrayList<String>();
}
toExtensions.add(extension);
preview_mimetype_extension_map.put(mimeType, toExtensions);
}
line = br.readLine();
}
br.close();
}
/**
* Gets the extension.
*
@ -130,12 +163,12 @@ public class MimeTypeUtility {
*
* @param name the file name.
* @param mimeType the mime type.
* @param isFolder the is folder
* @return the right name.
* @throws IOException Signals that an I/O exception has occurred.
*/
public static String getNameWithExtension(String name, String mimeType) throws IOException {
logger.debug("Deriving the file extension for file name: " + name + ", with mimeType: " + mimeType);
public static String getNameWithExtension(String name, String mimeType, boolean isFolder) throws IOException {
logger.debug("Deriving the file extension for file name: " + name + ", with mimeType: " + mimeType+", isFolder: "+isFolder);
if (mimeType == null || mimeType.isEmpty()) {
logger.debug("Input mime type is null or empty returning passed name: " + name);
@ -143,52 +176,30 @@ public class MimeTypeUtility {
}
String declaredExtension = FilenameUtils.getExtension(name);
logger.debug("The name " + name + " contains the extension: " + declaredExtension);
logger.info("The name " + name + " contains the extension: " + declaredExtension);
if (declaredExtension.equals("exe"))
//If the filename contains the extension returning the name like it is (skipping the folder)
if (declaredExtension != null && !declaredExtension.isEmpty() && !isFolder) {
logger.debug(
"The filename contains a not empty extension: " + declaredExtension + ", so returning the name like it is");
return name;
}
logger.debug("Either the name does not contains the extension or it is a folder, deriving extension from mimeType");
List<String> extensions = MimeTypeUtility.getExtension(mimeType);
logger.trace("Extension/s available for input mimetype: " + mimeType + " into map is/are: " + extensions);
logger.debug("Extension/s available for input mimetype: " + mimeType + " into map is/are: " + extensions);
String toMimeTypeExtension = "";
if (extensions != null) {
toMimeTypeExtension = extensions.get(extensions.size() - 1); // I'm reading the last extension in the map
// (myme type - list of extensions)
logger.debug("Using the last extension read into list of available extensions: " + toMimeTypeExtension);
String fullName = name;
if (extensions != null && extensions.size() > 0) {
// I'm reading the last extension in the map (myme type - list of extensions)
toMimeTypeExtension = extensions.get(extensions.size() - 1);
logger.info("Using the last extension read into list of available extensions: " + toMimeTypeExtension);
fullName = String.format("%s%s%s", name, DOT_STRING, toMimeTypeExtension);
}
// MANAGING ALREADY DECLARED EXTENSION IN THE FILE NAME
if (!declaredExtension.isEmpty() && !toMimeTypeExtension.isEmpty()) {
String dEextL = declaredExtension.toLowerCase();
String mtExtL = toMimeTypeExtension.toLowerCase();
// The extension writes in the file name is matching the mime type extension
// declared in the map
if (dEextL.equals(mtExtL)) {
logger.trace("The Extension declared in the name " + name
+ " is matching derived mime type extension so returning the input name: " + name);
return name;
}
// if(!dEextL.trim().contains(" ")) {
// logger.trace("The Extension declared in the name "+name+" seems a valid suffix (without other spaces) so returning the input name: "+name);
// return name;
// }
logger.debug("No logic seems to match the extension declared in the name " + declaredExtension
+ " as a valid extension so I'm adding the extension derived from mime type map: "
+ toMimeTypeExtension);
}
// CHECKING THE FOLLOWING IN ORDER TO AVOID THE DOT AS LAST CHAR OF FILENAME
if (toMimeTypeExtension.isEmpty()) {
return name;
}
String fullname = String.format("%s%s%s", name, DOT_STRING, toMimeTypeExtension);
logger.trace("returning full name:" + fullname);
return fullname;
logger.info("returning full name:" + fullName);
return fullName;
}
@ -280,4 +291,14 @@ public class MimeTypeUtility {
return extension_mimetype_map;
}
/**
* Gets the preview mimetype extension map with the mime types allowed for
* preview displaying
*
* @return the preview mimetype extension map
*/
public static Map<String, List<String>> getPreviewMimetypeExtensionMap() {
return preview_mimetype_extension_map;
}
}

View File

@ -136,7 +136,7 @@ public class ThumbnailGenerator {
extension = extension.startsWith(".") ? extension : "." + extension;
final File tempFile = File.createTempFile(filename, extension);
//tempFile.deleteOnExit();
tempFile.deleteOnExit();
try (FileOutputStream out = new FileOutputStream(tempFile)) {
IOUtils.copy(in, out);
}

View File

@ -0,0 +1,62 @@
application/msword=doc
application/pdf=pdf
application/rtf=rtf
application/vnd.ms-excel=xls
application/vnd.ms-powerpoint=ppt
application/vnd.openxmlformats-officedocument.wordprocessingml.document=docx
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet=xlsx
application/vnd.openxmlformats-officedocument.presentationml.presentation=pptx
application/x-javascript=js
application/json=json
audio/mid=mid
audio/mpeg=mp3
audio/x-wav=wav
image/bmp=bmp
image/gif=gif
image/ief=ief
image/jpeg=jpe
image/jpeg=jpeg
image/jpeg=jpg
image/pipeg=jfif
image/svg+xml=svg
image/tiff=tif
image/tiff=tiff
image/x-cmu-raster=ras
image/x-cmx=cmx
image/x-icon=ico
image/x-rgb=rgb
text/css=css
text/html=htm
text/html=stm
text/html=html
text/plain=bas
text/plain=c
text/plain=h
text/plain=txt
text/richtext=rtx
text/scriptlet=sct
text/tab-separated-values=tsv
text/uri-list=txt
text/webviewhtml=htt
text/x-component=htc
video/mpeg=mp2
video/mpeg=mpa
video/mpeg=mpe
video/mpeg=mpeg
video/mpeg=mpg
video/mpeg=mpv2
video/quicktime=mov
video/quicktime=qt
video/x-la-asf=lsf
video/x-la-asf=lsx
video/x-ms-asf=asf
video/x-ms-asf=asr
video/x-ms-asf=asx
video/x-msvideo=avi
video/x-sgi-movie=movie
x-world/x-vrml=flr
x-world/x-vrml=vrml
x-world/x-vrml=wrl
x-world/x-vrml=wrz
x-world/x-vrml=xaf
x-world/x-vrml=xof

View File

@ -181,6 +181,7 @@ text/iuls=uls
text/plain=bas
text/plain=c
text/plain=h
text/plain=asc
text/plain=txt
text/richtext=rtx
text/scriptlet=sct

View File

@ -149,6 +149,7 @@ text/iuls=uls
text/plain=bas
text/plain=c
text/plain=h
text/plain=asc
text/plain=txt
text/richtext=rtx
text/scriptlet=sct

1
src/test/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/resources/

View File

@ -175,5 +175,5 @@ public class HttpCallerUtil {
public void setPassword(String password) {
this.password = password;
}
}

View File

@ -0,0 +1,71 @@
package org.gcube.portlets.user.workspace;
import org.gcube.common.storagehubwrapper.server.StorageHubClientService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class MappingGroupNameToScopeName {
private static Logger logger = LoggerFactory.getLogger(MappingGroupNameToScopeName.class);
public static void main(String[] args) {
// VRE
String context = "d4science.research-infrastructures.eu-D4OS-FAO-Tuna_Atlas";
String rootName = "/d4science.research-infrastructures.eu";
String vreName = "FAO-Tuna_Atlas";
//
// //VO
// String context = "d4science.research-infrastructures.eu-D4OS";
// String rootName = "/d4science.research-infrastructures.eu";
// String vreName = null;
// ROOT
// String context = "d4science.research-infrastructures.eu";
// String rootName = "/d4science.research-infrastructures.eu";
// String vreName = null;
System.out.println(getScopeFromVREGroupName(context, rootName, vreName));
}
/**
* Gets the scope from VRE group name.
*
* @param context the context
* @return the scope from VRE group name. Eg. with the input
* 'gcube-devNext-NextNext' returns '/gcube/devNext/NextNext'
*/
public static String getScopeFromVREGroupName(String context, String infrastructurName, String vreName) {
// String entireScopeName = context.replaceAll("^/(.*)/?$", "$1").replaceAll("-", "/");
// return entireScopeName;
if (vreName == null)
vreName = "";
logger.debug("vreName: " + vreName);
if (infrastructurName.startsWith("/"))
infrastructurName = infrastructurName.substring(1, infrastructurName.length());
logger.debug("infrastructurName: " + infrastructurName);
String voGroup = context.replaceAll(infrastructurName, "");
if (vreName != null) {
voGroup = voGroup.replaceAll(vreName, "").replaceAll("-", "");
}
String voName = voGroup.replaceAll("-", "");
logger.debug("voName: " + voName);
StringBuilder theScopeBuilder = new StringBuilder();
theScopeBuilder.append("/" + infrastructurName);
if (voName != null && !voName.isEmpty()) {
theScopeBuilder.append("/" + voName);
}
if (vreName != null && !vreName.isEmpty()) {
theScopeBuilder.append("/" + vreName);
}
String theScope = theScopeBuilder.toString();
logger.info("Built scope: " + theScope);
return theScope;
}
}

View File

@ -38,7 +38,7 @@ public class MimeTypeUtilityTest {
for (String keyFileName : fileNamesToMimeTypes.keySet()) {
try {
System.out.println("\nResolving file name with extension for name: "+keyFileName);
String toFileName = MimeTypeUtility.getNameWithExtension(keyFileName, fileNamesToMimeTypes.get(keyFileName));
String toFileName = MimeTypeUtility.getNameWithExtension(keyFileName, fileNamesToMimeTypes.get(keyFileName), false);
System.out.println("Assigned the file name: "+toFileName);
} catch (IOException e) {
e.printStackTrace();

View File

@ -3,10 +3,7 @@
*/
package org.gcube.portlets.user.workspace;
import java.util.Iterator;
import org.gcube.common.encryption.StringEncrypter;
import org.gcube.common.scope.api.ScopeProvider;
import org.gcube.portlets.user.workspace.server.util.StringUtil;

View File

@ -1,29 +1,25 @@
package org.gcube.portlets.user.workspace;
import java.io.IOException;
import java.util.Properties;
import org.gcube.portlets.user.workspace.server.GWTWorkspaceServiceImpl;
public class TestProperties {
public static void main(String[] args) {
// public static void main(String[] args) {
//
// Properties prop = new Properties();
//
// try {
// // load a properties file from class path, inside static method
// prop.load(GWTWorkspaceServiceImpl.class.getClassLoader().getResourceAsStream("portletClassName.properties"));
//
// // get the property value and print it out
// System.out.println(prop.getProperty("idreport"));
// System.out.println(prop.getProperty("idtemplate"));
//
//
// } catch (IOException ex) {
// ex.printStackTrace();
// }
//
// }
Properties prop = new Properties();
try {
// load a properties file from class path, inside static method
prop.load(GWTWorkspaceServiceImpl.class.getClassLoader().getResourceAsStream("portletClassName.properties"));
// get the property value and print it out
System.out.println(prop.getProperty("idreport"));
System.out.println(prop.getProperty("idtemplate"));
} catch (IOException ex) {
ex.printStackTrace();
}
}
}

View File

@ -0,0 +1,26 @@
package org.gcube.portlets.user.workspace.junit;
import org.gcube.common.scope.api.ScopeProvider;
import org.gcube.portlets.user.workspace.server.reader.ApplicationProfileReader;
public class WEA_AP_Reader {
public static String SCOPE = "/d4science.research-infrastructures.eu";
public static String resourceName = "Workspace-Explorer-App";
public static String appID = "org.gcube.portlets.user.workspaceexplorerapp.server.WorkspaceExplorerAppServiceImpl";
// @Test
public void readAP() {
try {
// ScopeProvider.instance.set("/d4science.research-infrastructures.eu/D4Research/Limnodata");
ScopeProvider.instance.set(SCOPE);
ApplicationProfileReader ap = new ApplicationProfileReader(resourceName, appID);
System.out.println("ApplicationProfile found: " + ap.readProfileFromInfrastrucure());
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}