mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-11-14 06:18:12 +00:00
bug6105: implemented take-down request button for Event stage image
This commit is contained in:
1 parent
96061d31f0
commit
5926962e5d
9 files changed
+64
-26
No files matched your search
+6
-9
@@ -67,7 +67,6 @@ public class EventOverviewStage extends Composite {
|
||||
|
||||
public EventOverviewStage(EventView.Presenter presenter) {
|
||||
this.presenter = presenter;
|
||||
|
||||
updatesUi = new UpdatesBox(presenter);
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
}
|
||||
@@ -86,16 +85,15 @@ public class EventOverviewStage extends Composite {
|
||||
|
||||
private void setStageData(EventOverviewStageDTO stageData) {
|
||||
message.setMessage(stageData.getEventMessage());
|
||||
|
||||
EventOverviewStageContentDTO data = stageData.getStageContent();
|
||||
if(data instanceof EventOverviewVideoStageDTO) {
|
||||
if(!(lastContent instanceof Video) || ((Video) lastContent).shouldBeReplaced(((EventOverviewVideoStageDTO) data).getVideo().getSourceRef())) {
|
||||
if (data instanceof EventOverviewVideoStageDTO) {
|
||||
if (!(lastContent instanceof Video) || ((Video) lastContent).shouldBeReplaced(((EventOverviewVideoStageDTO) data).getVideo().getSourceRef())) {
|
||||
lastContent = new Video();
|
||||
((Video)lastContent).setData((EventOverviewVideoStageDTO) data);
|
||||
((Video) lastContent).setData((EventOverviewVideoStageDTO) data);
|
||||
}
|
||||
} else if (data instanceof EventOverviewTickerStageDTO) {
|
||||
if (!(lastContent instanceof Countdown)) {
|
||||
lastContent = new Countdown(countdownNavigationProvider);
|
||||
lastContent = new Countdown(countdownNavigationProvider, presenter.getUserService());
|
||||
}
|
||||
((Countdown) lastContent).setData((EventOverviewTickerStageDTO) data);
|
||||
} else {
|
||||
@@ -105,11 +103,10 @@ public class EventOverviewStage extends Composite {
|
||||
}
|
||||
|
||||
private void setNews(List<NewsEntryDTO> news) {
|
||||
if(lastContent == null) {
|
||||
if (lastContent == null) {
|
||||
setStageData(new EventOverviewStageDTO(null, new EventOverviewTickerStageDTO(null, null, null)));
|
||||
}
|
||||
|
||||
if(news == null || news.isEmpty()) {
|
||||
if (news == null || news.isEmpty()) {
|
||||
updatesWrapperUi.getStyle().setDisplay(Display.NONE);
|
||||
stage.removeStyleName(mediaCss.medium7());
|
||||
stage.removeStyleName(mediaCss.large8());
|
||||
|
||||
+2
-2
@@ -47,10 +47,10 @@ public class EventOverviewStage extends Composite implements RefreshableWidget<E
|
||||
|| ((Video) lastContent).shouldBeReplaced(videoStageDTO.getVideo().getSourceRef())) {
|
||||
lastContent = new Video();
|
||||
((Video) lastContent).setData(videoStageDTO);
|
||||
}
|
||||
}
|
||||
} else if (data instanceof EventOverviewTickerStageDTO) {
|
||||
if (!(lastContent instanceof Countdown)) {
|
||||
lastContent = new Countdown(countdownNavigationProvider);
|
||||
lastContent = new Countdown(countdownNavigationProvider, presenter.getUserService());
|
||||
}
|
||||
((Countdown) lastContent).setData((EventOverviewTickerStageDTO) data);
|
||||
} else {
|
||||
|
||||
+43
-9
@@ -5,12 +5,14 @@ import com.google.gwt.dom.client.DivElement;
|
||||
import com.google.gwt.dom.client.HeadingElement;
|
||||
import com.google.gwt.dom.client.Style.Display;
|
||||
import com.google.gwt.event.dom.client.ClickEvent;
|
||||
import com.google.gwt.event.shared.HandlerRegistration;
|
||||
import com.google.gwt.uibinder.client.UiBinder;
|
||||
import com.google.gwt.uibinder.client.UiField;
|
||||
import com.google.gwt.uibinder.client.UiHandler;
|
||||
import com.google.gwt.user.client.Event;
|
||||
import com.google.gwt.user.client.ui.Anchor;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
import com.google.gwt.user.client.ui.HTML;
|
||||
import com.google.gwt.user.client.ui.SimplePanel;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
import com.sap.sailing.gwt.common.client.SharedResources;
|
||||
@@ -23,7 +25,13 @@ import com.sap.sailing.gwt.home.shared.app.PlaceNavigation;
|
||||
import com.sap.sailing.gwt.home.shared.partials.countdown.CountdownResources.LocalCss;
|
||||
import com.sap.sailing.gwt.home.shared.partials.countdowntimer.CountdownTimer;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
import com.sap.sse.common.media.TakedownNoticeRequestContext;
|
||||
import com.sap.sse.gwt.client.LinkUtil;
|
||||
import com.sap.sse.gwt.client.Notification;
|
||||
import com.sap.sse.gwt.client.Notification.NotificationType;
|
||||
import com.sap.sse.gwt.client.dialog.DataEntryDialog.DialogCallback;
|
||||
import com.sap.sse.gwt.client.media.TakedownNoticeRequestDialog;
|
||||
import com.sap.sse.security.ui.client.UserService;
|
||||
|
||||
public class Countdown extends Composite {
|
||||
|
||||
@@ -42,20 +50,27 @@ public class Countdown extends Composite {
|
||||
@UiField HeadingElement infoTitle;
|
||||
@UiField(provided = true) NavigationAnchor navigationButton;
|
||||
@UiField DivElement image;
|
||||
|
||||
public Countdown(CountdownNavigationProvider navigationProvider) {
|
||||
@UiField HTML imageMenuButton;
|
||||
|
||||
private HandlerRegistration takedownNoticeButtonClickHandlerRegistration;
|
||||
|
||||
private final UserService takedownNoticeService;
|
||||
|
||||
public Countdown(CountdownNavigationProvider navigationProvider, UserService takedownNoticeService) {
|
||||
CSS.ensureInjected();
|
||||
this.navigationButton = new NavigationAnchor(navigationProvider);
|
||||
this.takedownNoticeService = takedownNoticeService;
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
}
|
||||
|
||||
|
||||
public void setData(EventOverviewTickerStageDTO data) {
|
||||
String stageImageUrl = SharedHomeResources.INSTANCE.defaultStageEventTeaserImage().getSafeUri().asString();
|
||||
if(data.getStageImageUrl() != null) {
|
||||
final String stageImageUrl;
|
||||
if (data.getStageImageUrl() != null) {
|
||||
stageImageUrl = data.getStageImageUrl();
|
||||
} else {
|
||||
stageImageUrl = SharedHomeResources.INSTANCE.defaultStageEventTeaserImage().getSafeUri().asString();
|
||||
}
|
||||
image.getStyle().setBackgroundImage("url(\"" + stageImageUrl + "\")");
|
||||
|
||||
navigationButton.removeStyleName(MAIN_CSS.buttonred());
|
||||
navigationButton.removeStyleName(MAIN_CSS.buttonprimary());
|
||||
if (data instanceof EventOverviewRaceTickerStageDTO) {
|
||||
@@ -67,12 +82,32 @@ public class Countdown extends Composite {
|
||||
} else {
|
||||
this.updateUi(data.getTickerInfo() != null ? I18N.startingIn(data.getTickerInfo()) : null, null);
|
||||
}
|
||||
|
||||
if(data.getStartTime() != null) {
|
||||
if (data.getStartTime() != null) {
|
||||
this.tickerContainer.setWidget(new CountdownTimer(data.getStartTime(), true));
|
||||
} else {
|
||||
this.tickerContainer.setWidget(null);
|
||||
}
|
||||
if (takedownNoticeButtonClickHandlerRegistration != null) {
|
||||
takedownNoticeButtonClickHandlerRegistration.removeHandler();
|
||||
}
|
||||
takedownNoticeButtonClickHandlerRegistration = imageMenuButton.addClickHandler(e->{
|
||||
if (takedownNoticeService.isEmailAddressOfCurrentUserValidated()) {
|
||||
new TakedownNoticeRequestDialog("takedownRequestForImageOnEventStage", data.getTickerInfo(), stageImageUrl,
|
||||
takedownNoticeService.getCurrentUser().getName(), StringMessages.INSTANCE,
|
||||
new DialogCallback<TakedownNoticeRequestContext>() {
|
||||
@Override
|
||||
public void ok(TakedownNoticeRequestContext editedObject) {
|
||||
takedownNoticeService.fileTakedownNotice(editedObject);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancel() {
|
||||
}
|
||||
}).show();
|
||||
} else {
|
||||
Notification.notify(StringMessages.INSTANCE.mustBeLoggedInAndWithValidatedEmail(), NotificationType.ERROR);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void updateUi(String title, String info) {
|
||||
@@ -87,7 +122,6 @@ public class Countdown extends Composite {
|
||||
}
|
||||
|
||||
private class NavigationAnchor extends Anchor {
|
||||
|
||||
private final CountdownNavigationProvider navigationProvider;
|
||||
private PlaceNavigation<?> currentPlaceNavigation;
|
||||
|
||||
|
||||
+3
-1
@@ -5,7 +5,9 @@
|
||||
<ui:with field="res" type="com.sap.sailing.gwt.common.client.SharedResources" />
|
||||
<ui:with field="local_res" type="com.sap.sailing.gwt.home.shared.partials.countdown.CountdownResources" />
|
||||
<g:HTMLPanel addStyleNames="{local_res.css.countdown}">
|
||||
<div ui:field="image" class="{local_res.css.countdown_image}"></div>
|
||||
<div ui:field="image" class="{local_res.css.countdown_image} {res.mainCss.media_wrapper}">
|
||||
<g:HTML ui:field="imageMenuButton" addStyleNames="{res.mainCss.media_menu_icon}">⋯</g:HTML>
|
||||
</div>
|
||||
<div class="{local_res.css.countdown_content}">
|
||||
<h3 class="{local_res.css.countdown_content_title}" ui:field="countdownTitle"></h3>
|
||||
<g:SimplePanel ui:field="tickerContainer"/>
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@ public class Message extends Widget {
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
if(message == null || message.isEmpty()) {
|
||||
if (message == null || message.isEmpty()) {
|
||||
getElement().getStyle().setDisplay(Display.NONE);
|
||||
} else {
|
||||
text.setInnerText(message);
|
||||
|
||||
@@ -3,8 +3,11 @@ package com.sap.sse.gwt.client.media;
|
||||
import com.sap.sse.common.media.TakedownNoticeRequestContext;
|
||||
|
||||
public interface TakedownNoticeService {
|
||||
|
||||
void fileTakedownNotice(TakedownNoticeRequestContext takedownNoticeRequestContext);
|
||||
|
||||
/**
|
||||
* @return {@code true} if and only if a user is currently logged in and that user's e-mail address has been
|
||||
* validated successfully
|
||||
*/
|
||||
boolean isEmailAddressOfCurrentUserValidated();
|
||||
}
|
||||
+1
-1
@@ -604,6 +604,6 @@ public class UserService implements TakedownNoticeService {
|
||||
|
||||
@Override
|
||||
public boolean isEmailAddressOfCurrentUserValidated() {
|
||||
return getCurrentUser().isEmailValidated();
|
||||
return getCurrentUser() != null && getCurrentUser().isEmailValidated();
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
emailValidationSubject=Mail Validation
|
||||
emailValidationMessage=Please click on the link below to validate your e-mail address for user {0}.
|
||||
takedownRequestConfirmation=Dear {0},\n\nan e-mail with your media take-down request has been sent to {1}. The message we sent on your behalf was:\n\n{2}
|
||||
takedownRequestForImageInTagColumn=Tag column in race board, {0}
|
||||
takedownRequestForImageInTagColumn=Tag column in race board, {0}
|
||||
takedownRequestForImageOnEventStage=Event stage for event {0}
|
||||
@@ -1,4 +1,5 @@
|
||||
emailValidationSubject=Mail-Validierung
|
||||
emailValidationMessage=Bitte den folgenden Link benutzen, um die e-Mail Adresse für den Benutzer {0} zu validieren.
|
||||
takedownRequestConfirmation=Lieber {0},\neine e-Mail mit dem Antrag zur Löschung von Medieninhalten wurde an die Adresse {1} gesendet. Die Nachricht lautet:\n\n{2}
|
||||
takedownRequestForImageInTagColumn=Kommentarspalte im "Race Board", {0}
|
||||
takedownRequestForImageInTagColumn=Kommentarspalte im "Race Board", {0}
|
||||
takedownRequestForImageOnEventStage=Veranstaltungs-Seite für Veranstaltung {0}
|
||||
Reference in new issue
Block a user