Fixed when writing a Message you click on another message everything you wrote in your message is lost without any advice.

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/message-conversations@178517 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Massimiliano Assante 2019-03-08 14:23:41 +00:00
parent c5976d8938
commit 443b492b9f
11 changed files with 106 additions and 30 deletions

View File

@ -33,6 +33,7 @@
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/messages-2.3.0-SNAPSHOT/WEB-INF/classes"/>

View File

@ -35,6 +35,16 @@
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.gwtplugins.gdt.eclipse.core.webAppProjectValidator</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.gwtplugins.gwt.eclipse.core.gwtProjectValidator</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
@ -45,5 +55,6 @@
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
<nature>com.liferay.ide.core.liferayNature</nature>
<nature>com.google.gwt.eclipse.core.gwtNature</nature>
<nature>com.gwtplugins.gwt.eclipse.core.gwtNature</nature>
</natures>
</projectDescription>

View File

@ -1,3 +1,4 @@
eclipse.preferences.version=1
lastWarOutDir=${webappDirectory}
warSrcDir=src/main/webapp
warSrcDirIsOutput=false

View File

@ -5,4 +5,5 @@ org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.release=disabled
org.eclipse.jdt.core.compiler.source=1.8

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="message-conversations-portlet">
<wb-module deploy-name="messages">
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>

View File

@ -6,4 +6,5 @@
<installed facet="wst.jsdt.web" version="1.0"/>
<installed facet="liferay.portlet" version="6.0"/>
<installed facet="jst.jaxrs" version="2.0"/>
<installed facet="com.gwtplugins.gwt.facet" version="1.0"/>
</faceted-project>

View File

@ -1,6 +1,7 @@
<ReleaseNotes>
<Changeset component="org.gcube.portlets-user.messages.2-3-0"
date="2019-02-28">
<Change>Feature #10068, Request for enhancement: new Messages is error prone and challenging to use</Change>
<Change>Feature #16194, Isolate Gateway user list in Messages</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.messages.2-1-0"

93
pom.xml
View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
@ -54,7 +55,53 @@
<dependencies>
<!-- http://mvnrepository.com/artifact/javax.servlet/javax.servlet-api -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-servlet</artifactId>
<version>${gwt.version}</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-dev</artifactId>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>${gwt.version}</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
<version>2.9.1</version>
</dependency>
<dependency>
<groupId>org.gcube.portlets.widgets</groupId>
<artifactId>workspace-explorer</artifactId>
@ -85,24 +132,7 @@
<artifactId>portlet-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-servlet</artifactId>
<version>${gwt.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>${gwt.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-dev</artifactId>
<version>${gwt.version}</version>
<scope>provided</scope>
</dependency>
<!-- FWS -->
<dependency>
<groupId>org.gcube.core</groupId>
@ -114,6 +144,12 @@
<groupId>com.github.gwtmaterialdesign</groupId>
<artifactId>gwt-material</artifactId>
<version>${gwt-material.version}</version>
<exclusions>
<exclusion>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.github.gwtmaterialdesign</groupId>
@ -157,12 +193,6 @@
<artifactId>xml-apis</artifactId>
<version>1.4.01</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<!-- <version>3.1.0</version> -->
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.dvos</groupId>
<artifactId>usermanagement-core</artifactId>
@ -188,6 +218,15 @@
<artifactId>util-java</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
@ -219,10 +258,12 @@
<!-- Plugin configuration. There are many available options, see gwt-maven-plugin
documentation at codehaus.org -->
<configuration>
<extraJvmArgs>-Dlog4j.configuration=clientlog4j.properties</extraJvmArgs>
<runTarget>MessageConversations.html</runTarget>
<modules>
<module>org.gcube.portets.user.message_conversations.MessageConversations</module>
</modules>
<hostedWebapp>${webappDirectory}</hostedWebapp>
</configuration>
</plugin>
<plugin>

View File

@ -74,6 +74,7 @@ public class ApplicationView extends Composite {
private static Binder uiBinder = GWT.create(Binder.class);
private final MessageServiceAsync convService = GWT.create(MessageService.class);
protected static boolean WRITING_MESSAGE = false;
private boolean toggle = false;
private boolean toggleSwitch = false;
@ -117,7 +118,7 @@ public class ApplicationView extends Composite {
forward.setTooltip("Forward");
forward.setTooltipPosition(Position.LEFT);
}
String[] usernamesToSendTo = sendToUserNames;
if (usernamesToSendTo != null && usernamesToSendTo.length > 0) {
prepareNewMessageForSendTo(usernamesToSendTo);
@ -234,6 +235,18 @@ public class ApplicationView extends Composite {
* @param sent
*/
public void readUserMessage(String messageId, final boolean sent) {
if (WRITING_MESSAGE == true) {
boolean continueDisplay = Window.confirm("The message content you are writing will be lost if you continue");
if (continueDisplay) {
displayMessage(messageId, sent);
}
}
else {
displayMessage(messageId, sent);
}
}
private void displayMessage(String messageId, final boolean sent) {
messageLoader.setColor(Utils.getRandomColor());
messageLoader.setVisible(true);
scrollerPanel.clear();
@ -256,6 +269,7 @@ public class ApplicationView extends Composite {
}
});
}
private void updateBadge(boolean sent) {
String badgeText = totalMessages + (sent ? " sent" : " (" + unreadMessages + " unread" + ")");
if (unreadMessages == 0 && !sent)
@ -305,6 +319,7 @@ public class ApplicationView extends Composite {
private void displayNewOrReplyMessage() {
WRITING_MESSAGE = true;
FAB.setVisible(false);
messagesCollection.clearActive();
scrollerPanel.clear();

View File

@ -276,7 +276,6 @@ public class WriteMessage extends Composite {
@UiHandler("btnSendModal")
void onSendMessage(ClickEvent e) {
if (getSelectedUsers().isEmpty()) {
acModal.setError("Look empty to me");
return;
@ -307,6 +306,7 @@ public class WriteMessage extends Composite {
sendingLoader.setVisible(true);
btnSendModal.setEnabled(false);
ApplicationView.WRITING_MESSAGE = false;
convService.sendToById(recipientIds, getSelectedFilesAndFoldersId(), txtBoxSubject.getText(), txtArea.getText(), new AsyncCallback<Boolean>() {
@Override
public void onFailure(Throwable caught) {
@ -336,6 +336,7 @@ public class WriteMessage extends Composite {
if (Utils.isMobile())
ap.showSidePanel();
mainPanel.clear();
ApplicationView.WRITING_MESSAGE = false;
}
public List<WSUser> getSelectedUsers() {

View File

@ -15,4 +15,7 @@ log4j.logger.org.gcube.common.authorization=WARN
log4j.logger.org.gcube.common.clients=WARN
log4j.logger.org.gcube.resources.clients=WARN
log4j.logger.org.gcube.contentmanager=WARN
log4j.logger.org.gcube.resources.discovery=WARN
log4j.logger.org.gcube.resources.discovery=WARN
log4j.logger.com.liferay.portal.kernel.bean.PortalBeanLocatorUtil=OFF
log4j.logger.com.liferay.portal.kernel.log.Jdk14LogImpl=OFF
log4j.logger.org.eclipse.jetty=ERROR