Remove Feedback window. #PL-6217

This commit is contained in:
Konstantin Krivopustov 2015-10-20 10:29:02 +00:00
parent 693964845f
commit 220abd0b74
13 changed files with 1 additions and 296 deletions

View File

@ -172,7 +172,7 @@ public interface ClientConfig extends Config {
String getGenericFilterControlsLayout(); String getGenericFilterControlsLayout();
/** /**
* Support e-mail. Exception reports and feedback emails are sent to this address. * Support e-mail. Exception report emails are sent to this address.
*/ */
@Property("cuba.supportEmail") @Property("cuba.supportEmail")
String getSupportEmail(); String getSupportEmail();

View File

@ -66,7 +66,6 @@ menu-config.help=Help
menu-config.aboutWindow=About menu-config.aboutWindow=About
menu-config.logWindow=Application Log menu-config.logWindow=Application Log
menu-config.settings=Settings menu-config.settings=Settings
menu-config.feedback=Feedback
menu-config.jmxConsole = JMX Console menu-config.jmxConsole = JMX Console
menu-config.entityRestore=Data Recovery menu-config.entityRestore=Data Recovery
menu-config.sec$ScreenHistory.browse=History menu-config.sec$ScreenHistory.browse=History

View File

@ -98,7 +98,6 @@ menu-config.sys$ScheduledTask.browse = Tâches programmées
menu-config.sec$ScreenHistory.browse = Historique menu-config.sec$ScreenHistory.browse = Historique
navigator.caption = Navigateur navigator.caption = Navigateur
actions.View = Voir actions.View = Voir
menu-config.feedback = Feedback
Datatype.boolean = Booléen Datatype.boolean = Booléen
viewLogBtn = Voir journal viewLogBtn = Voir journal
permission-config.cuba.gui.searchFolder.global = Créer/modifier les dossiers de recherche globale permission-config.cuba.gui.searchFolder.global = Créer/modifier les dossiers de recherche globale

View File

@ -57,7 +57,6 @@ menu-config.help=Помощь
menu-config.aboutWindow=О программе menu-config.aboutWindow=О программе
menu-config.logWindow=Журнал приложения menu-config.logWindow=Журнал приложения
menu-config.settings=Параметры menu-config.settings=Параметры
menu-config.feedback=Обратная связь
menu-config.jmxConsole = Консоль JMX menu-config.jmxConsole = Консоль JMX
menu-config.entityRestore=Восстановление записей menu-config.entityRestore=Восстановление записей
menu-config.sec$ScreenHistory.browse=История menu-config.sec$ScreenHistory.browse=История

View File

@ -1,160 +0,0 @@
/*
* Copyright (c) 2008-2013 Haulmont. All rights reserved.
* Use is subject to license terms, see http://www.cuba-platform.com/license for details.
*/
package com.haulmont.cuba.web.app.ui.core.feedback;
import com.haulmont.chile.core.datatypes.Datatypes;
import com.haulmont.cuba.client.ClientConfig;
import com.haulmont.cuba.core.app.EmailService;
import com.haulmont.cuba.core.global.Configuration;
import com.haulmont.cuba.core.global.EmailInfo;
import com.haulmont.cuba.core.global.TimeSource;
import com.haulmont.cuba.core.global.UserSessionSource;
import com.haulmont.cuba.gui.components.*;
import com.haulmont.cuba.security.entity.User;
import com.haulmont.cuba.web.gui.WebWindow;
import javax.inject.Inject;
import javax.inject.Named;
import java.util.Arrays;
import java.util.Date;
import java.util.Map;
/**
* @author timofeev
* @version $Id$
*/
public class FeedbackWindow extends AbstractWindow {
@Inject
protected TimeSource timeSource;
@Inject
protected UserSessionSource userSessionSource;
@Inject
protected Configuration configuration;
@Inject
protected EmailService emailService;
@Inject
protected TextArea mainBody;
@Named("reason")
protected LookupField reason;
@Inject
protected TextField reasonFreeText;
@Inject
protected Button okBtn;
@Inject
protected Button cancelBtn;
protected String otherReason;
protected Boolean validateAndSend() {
Boolean result = true;
StringBuilder sb = new StringBuilder();
if (mainBody.isRequired() && mainBody.isVisible()) {
try {
mainBody.validate();
} catch (ValidationException ve) {
sb.append(ve.getMessage()).append('\n');
}
}
if (reason.isRequired() && reason.isVisible()) {
try {
reason.validate();
} catch (ValidationException ve) {
sb.append(ve.getMessage()).append('\n');
}
}
if (reasonFreeText.isRequired() && reasonFreeText.isVisible()) {
try {
reasonFreeText.validate();
} catch (ValidationException ve) {
sb.append(ve.getMessage()).append('\n');
}
}
if(sb.length() > 0){
showNotification(messages.getMessage(WebWindow.class, "validationFail.caption"),
sb.toString(), NotificationType.TRAY);
result = false;
}
if (result) {
try {
ClientConfig clientConfig = configuration.getConfig(ClientConfig.class);
String infoHeader = "";
infoHeader += (getMessage("supportEmail") + ".\n");
infoHeader += (getMessage("systemID") + ": " + (clientConfig.getSystemID() == null ? "none" : clientConfig.getSystemID()) + "\n");
User user = userSessionSource.getUserSession().getUser();
infoHeader += (getMessage("userLogin") + ": " + (user.getLogin() == null ? "none" : user.getLogin()) + "\n");
infoHeader += (getMessage("userEmail") + ": " + (user.getEmail() == null ? "none" : user.getEmail()) + "\n");
infoHeader += (getMessage("userFirstName") + ": " + (user.getFirstName() == null ? "none" : user.getFirstName()) + "\n");
infoHeader += (getMessage("userMiddleName") + ": " + (user.getMiddleName() == null ? "none" : user.getMiddleName()) + "\n");
infoHeader += (getMessage("userLastName") + ": " + (user.getLastName() == null ? "none" : user.getLastName()) + "\n");
infoHeader += (getMessage("timestamp") + ": " + (Datatypes.getNN(Date.class).format(timeSource.currentTimestamp())) + "\n");
infoHeader += (getMessage("reason") + ": "
+ (otherReason.equals(reason.getValue())
? reasonFreeText.getValue()
: reason.getValue()) + "\n");
infoHeader += (getMessage("mailBody") + ": \n");
infoHeader += mainBody.getValue();
EmailInfo emailInfo = new EmailInfo(
clientConfig.getSupportEmail(),
"[Feedback Form][" + clientConfig.getSystemID() + "]["
+ user.getLogin() + "]["
+ Datatypes.getNN(Date.class).format(timeSource.currentTimestamp()) + "] "
+ (otherReason.equals(reason.getValue())
? reasonFreeText.getValue()
: reason.getValue()),
infoHeader
);
emailService.sendEmail(emailInfo);
showNotification(getMessage("emailSent"), NotificationType.HUMANIZED);
} catch (Exception e) {
showNotification(getMessage("emailSentErr"), NotificationType.ERROR);
result = false;
}
}
return result;
}
@Override
public void init(Map<String, Object> params) {
otherReason = getMessage("other");
reason.setOptionsList(Arrays.asList(getMessage("bugReport"), getMessage("featureRequest"), otherReason));
reasonFreeText.setVisible(false);
reason.addValueChangeListener(e -> {
if (otherReason.equals(e.getValue())) {
reasonFreeText.setVisible(true);
} else {
reasonFreeText.setVisible(false);
}
});
okBtn.setAction(
new AbstractAction("ok") {
@Override
public void actionPerform(Component component) {
if (validateAndSend()) {
close("ok");
}
}
}
);
cancelBtn.setAction(
new AbstractAction("cancel") {
@Override
public void actionPerform(Component component) {
close("cancel");
}
}
);
}
}

View File

@ -1,24 +0,0 @@
<!--
~ Copyright (c) 2008-2013 Haulmont. All rights reserved.
~ Use is subject to license terms, see http://www.cuba-platform.com/license for details.
-->
<window xmlns="http://schemas.haulmont.com/cuba/window.xsd"
class="com.haulmont.cuba.web.app.ui.core.feedback.FeedbackWindow"
messagesPack="com.haulmont.cuba.web.app.ui.core.feedback"
focusComponent="reason">
<layout expand="buttons" spacing="true">
<groupBox spacing="true">
<label value="msg://theme"/>
<lookupField id="reason" required="true" width="theme://cuba.web.feedback-window.reason.width" requiredMessage="msg://themeMsg"/>
<textField id="reasonFreeText" required="true" width="theme://cuba.web.feedback-window.reasonFreeText.width" requiredMessage="msg://themeMsg"/>
<label value="msg://body"/>
<textArea id="mainBody" required="true" rows="15" width="theme://cuba.web.feedback-window.mainBody.width" requiredMessage="msg://bodyMsg"/>
</groupBox>
<buttonsPanel id="buttons">
<button id="okBtn" icon="icons/ok.png"/>
<button id="cancelBtn" icon="icons/cancel.png"/>
</buttonsPanel>
</layout>
</window>

View File

@ -1,34 +0,0 @@
#
# Copyright (c) 2008-2013 Haulmont. All rights reserved.
# Use is subject to license terms, see http://www.cuba-platform.com/license for details.
#
ok=OK
cancel=Cancel
bugReport=Bug Report
featureRequest=Feature Request
other=Other...
emptyReasonErr=Reason must be not empty
emptyBodyErr=Body must be not empty
emailSent=Email sent
emailSentErr=Error while sending email
theme=Subject
body=Message
supportEmail=Support Email
systemID=System ID
userLogin=User Login
userEmail=User Email
userFirstName=User First Name
userMiddleName=User Middle Name
userLastName=User Last Name
timestamp=Timestamp
reason=Reason
mailBody=Mail Body
themeMsg=Message subject isn't specified
bodyMsg=Message body isn't specified

View File

@ -1,28 +0,0 @@
#
# Copyright (c) 2008-2013 Haulmont. All rights reserved.
# Use is subject to license terms, see http://www.cuba-platform.com/license for details.
#
emptyReasonErr = La raison ne doit pas être vide
supportEmail = Email de support
body = Message
other = Autre…
reason = Raison
userFirstName = Prénom utilisateur
theme = Objet
bodyMsg = Le corps du message n'est pas spécifié
userEmail = Email utilisateur
cancel = Annuler
userMiddleName = Nom intermédiaire utilisateur
userLogin = Login utilisateur
emptyBodyErr = Le corps ne doit pas être vide
timestamp = Horodatage
mailBody = Corps de l'email
bugReport = Rapport de bug
systemID = ID système
emailSentErr = Erreur pendant l'envoi de l'email
themeMsg = L'objet du message n'est pas spécifié
ok = OK
userLastName = Nom de famille utilisateur
featureRequest = Demande de fonction
emailSent = Email envoyé

View File

@ -1,34 +0,0 @@
#
# Copyright (c) 2008-2013 Haulmont. All rights reserved.
# Use is subject to license terms, see http://www.cuba-platform.com/license for details.
#
ok=OK
cancel=Отменить
bugReport=Отчёт об ошибке
featureRequest=Предложение разработчикам
other=Другое...
emptyReasonErr=Причина должна быть заполнена
emptyBodyErr=Тело письма должно быть заполнено
emailSent=Письмо разработчикам отправлено
emailSentErr=При отправке письма произошла ошибка
theme=Тема сообщения
body=Содержание сообщения
supportEmail=Письмо в техническую поддержку
systemID=Идентификатор системы
userLogin=Логин пользователя
userEmail=E-Mail пользователя
userFirstName=Имя пользователя
userMiddleName=Отчество пользователя
userLastName=Фамилия пользователя
timestamp=Дата обращения
reason=Причина
mailBody=Сообщение
themeMsg=Заполните поле "Тема сообщения"
bodyMsg=Заполните поле "Содержание сообщения"

View File

@ -31,7 +31,6 @@
<item id="printDomain"/> <item id="printDomain"/>
<separator/> <separator/>
<item id="settings"/> <item id="settings"/>
<item id="feedback"/>
<item id="logWindow"/> <item id="logWindow"/>
<separator/> <separator/>
<item id="sec$ScreenHistory.browse"/> <item id="sec$ScreenHistory.browse"/>

View File

@ -10,9 +10,6 @@
<screen id="settings" <screen id="settings"
template="/com/haulmont/cuba/web/app/ui/core/settings/settings-window.xml"/> template="/com/haulmont/cuba/web/app/ui/core/settings/settings-window.xml"/>
<screen id="feedback"
template="/com/haulmont/cuba/web/app/ui/core/feedback/feedback-window.xml"/>
<screen id="logWindow" <screen id="logWindow"
class="com.haulmont.cuba.web.log.LogWindowLauncher"/> class="com.haulmont.cuba.web.log.LogWindowLauncher"/>

View File

@ -104,10 +104,6 @@ cuba.web.ScreenHistoryBrowse.height=480
cuba.web.save-set-window.folderSelect.width=250px cuba.web.save-set-window.folderSelect.width=250px
cuba.web.feedback-window.reason.width=200px
cuba.web.feedback-window.reasonFreeText.width=400px
cuba.web.feedback-window.mainBody.width=600px
cuba.web.settings-window.appThemeField.width=150px cuba.web.settings-window.appThemeField.width=150px
cuba.web.settings-window.timeZoneField.width=150px cuba.web.settings-window.timeZoneField.width=150px

View File

@ -90,10 +90,6 @@ cuba.web.ScreenHistoryBrowse.height=480
cuba.web.save-set-window.folderSelect.width=250px cuba.web.save-set-window.folderSelect.width=250px
cuba.web.feedback-window.reason.width=200px
cuba.web.feedback-window.reasonFreeText.width=400px
cuba.web.feedback-window.mainBody.width=600px
cuba.web.settings-window.appThemeField.width=150px cuba.web.settings-window.appThemeField.width=150px
cuba.web.settings-window.timeZoneField.width=150px cuba.web.settings-window.timeZoneField.width=150px