mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-11-04 18:20:14 +00:00
a first prototype for a Qualtrics integration
This commit is contained in:
1 parent
8806700013
commit
73ebc58c36
19 files changed
+123
-34
No files matched your search
@@ -2,5 +2,6 @@
|
||||
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.7.0//EN" "http://gwtproject.org/doctype/2.7.0/gwt-module.dtd">
|
||||
<module>
|
||||
<inherits name='com.sap.sailing.gwt.home.HomeBase'/>
|
||||
<inherits name='com.sap.sse.gwt.Qualtrics'/>
|
||||
<entry-point class="com.sap.sailing.gwt.home.shared.SwitchingEntryPoint" />
|
||||
</module>
|
||||
@@ -22,7 +22,7 @@
|
||||
<inherits name='com.google.gwt.ajaxloader.AjaxLoader' />
|
||||
<inherits name='com.google.gwt.maps.Maps' />
|
||||
|
||||
<!-- module containing locale configuration -->
|
||||
<!-- module containing locale configuration -->
|
||||
<inherits name='com.sap.sailing.gwt.common.SailingLocalesAllPermutations' />
|
||||
|
||||
<source path='client' />
|
||||
@@ -38,10 +38,10 @@
|
||||
<inherits name='com.sap.sailing.gwt.ui.SourceActions'/>
|
||||
<inherits name='com.sap.sailing.gwt.ui.SourceSimulator'/>
|
||||
<inherits name="com.sap.sailing.gwt.ui.SourceAdminConsole"/>
|
||||
<!-- TODO: probably only used for flag images. Move RegattaRaceStatesFlagsResources to shared -->
|
||||
<!-- TODO: probably only used for flag images. Move RegattaRaceStatesFlagsResources to shared -->
|
||||
<inherits name="com.sap.sailing.gwt.regattaoverview.SourceRegattaOverview"/>
|
||||
<inherits name="com.sap.sailing.gwt.ui.SourceLeaderboard"/>
|
||||
<inherits name="com.sap.sailing.gwt.ui.SourceRaceboard"/>
|
||||
<inherits name="com.sap.sailing.gwt.ui.SourceRaceboard"/>
|
||||
<inherits name='com.sap.sse.gwt.CommonControlCSS'/>
|
||||
<inherits name='com.sap.sailing.gwt.settings.Settings'/>
|
||||
|
||||
|
||||
+12
-5
@@ -22,6 +22,7 @@ import com.sap.sailing.gwt.home.shared.SwitchingEntryPoint;
|
||||
import com.sap.sailing.gwt.home.shared.app.PlaceNavigation;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
import com.sap.sse.gwt.client.controls.languageselect.LanguageSelector;
|
||||
import com.sap.sse.gwt.qualtrics.Qualtrics;
|
||||
import com.sap.sse.gwt.shared.ClientConfiguration;
|
||||
import com.sap.sse.gwt.shared.DebugConstants;
|
||||
|
||||
@@ -32,7 +33,7 @@ public class Footer extends Composite {
|
||||
}
|
||||
|
||||
@UiField AnchorElement whatsNewAnchor;
|
||||
@UiField AnchorElement sapJobsAnchor;
|
||||
@UiField AnchorElement supportAnchor;
|
||||
@UiField AnchorElement feedbackAnchor;
|
||||
@UiField LanguageSelector languageSelector;
|
||||
@UiField DivElement copyrightDiv;
|
||||
@@ -59,23 +60,29 @@ public class Footer extends Composite {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Event.sinkEvents(feedbackAnchor, Event.ONCLICK);
|
||||
Event.setEventListener(feedbackAnchor, event->{
|
||||
if (Event.ONCLICK == event.getTypeInt()) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
Qualtrics.triggerIntercepts();
|
||||
}
|
||||
});
|
||||
if (!ClientConfiguration.getInstance().isBrandingActive()) {
|
||||
copyrightDiv.getStyle().setDisplay(NONE);
|
||||
languageSelector.setLabelText(StringMessages.INSTANCE.whitelabelFooterLanguage());
|
||||
sapJobsAnchor.getStyle().setDisplay(Display.NONE);
|
||||
supportAnchor.getStyle().setDisplay(Display.NONE);
|
||||
feedbackAnchor.getStyle().setDisplay(Display.NONE);
|
||||
whatsNewAnchor.getStyle().setDisplay(Display.NONE);
|
||||
imprintAnchorLink.getStyle().setDisplay(Display.NONE);
|
||||
privacyAnchorLink.getStyle().setDisplay(Display.NONE);
|
||||
}
|
||||
copyrightDiv.setAttribute(DebugConstants.DEBUG_ID_ATTRIBUTE, "copyrightDiv");
|
||||
sapJobsAnchor.setAttribute(DEBUG_ID_ATTRIBUTE, "sapJobsAnchor");
|
||||
supportAnchor.setAttribute(DEBUG_ID_ATTRIBUTE, "feedbackAnchor");
|
||||
feedbackAnchor.setAttribute(DEBUG_ID_ATTRIBUTE, "feedbackAnchor");
|
||||
whatsNewAnchor.setAttribute(DEBUG_ID_ATTRIBUTE, "whatsNewAnchor");
|
||||
imprintAnchorLink.setAttribute(DEBUG_ID_ATTRIBUTE, "imprintAnchorLink");
|
||||
privacyAnchorLink.setAttribute(DEBUG_ID_ATTRIBUTE, "privacyAnchorLink");
|
||||
languageSelector.getElement().setAttribute(DEBUG_ID_ATTRIBUTE, "languageSelector");
|
||||
}
|
||||
|
||||
}
|
||||
+4
-4
@@ -20,10 +20,10 @@
|
||||
<a ui:field="privacyAnchorLink" href="https://www.sap.com/about/legal/privacy.html" target="_blank" class="{local_res.css.sitefooter_links_link}">
|
||||
<ui:text from='{i18n.footerPrivacy}' />
|
||||
</a>
|
||||
<a ui:field="sapJobsAnchor" href="https://jobs.sap.com" target="_blank" class="{local_res.css.sitefooter_links_link}">
|
||||
<ui:text from='{i18n.footerJobs}'/>
|
||||
</a>
|
||||
<a ui:field="feedbackAnchor" href="mailto:support%40sapsailing.com?subject=[SAP Sailing] Feedback" target="_blank" class="{local_res.css.sitefooter_links_link}">
|
||||
<a ui:field="supportAnchor" href="mailto:support%40sapsailing.com?subject=[SAP Sailing] Feedback" target="_blank" class="{local_res.css.sitefooter_links_link}">
|
||||
<ui:text from='{i18n.footerSupport}' />
|
||||
</a>
|
||||
<a ui:field="feedbackAnchor" href="" class="{local_res.css.sitefooter_links_link}">
|
||||
<ui:text from='{i18n.footerFeedback}' />
|
||||
</a>
|
||||
<a ui:field="mobileUi" href="HomeMobile.html"
|
||||
|
||||
+11
-6
@@ -21,6 +21,7 @@ import com.sap.sailing.gwt.home.mobile.app.MobilePlacesNavigator;
|
||||
import com.sap.sailing.gwt.home.shared.SwitchingEntryPoint;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
import com.sap.sse.gwt.client.controls.languageselect.LanguageSelector;
|
||||
import com.sap.sse.gwt.qualtrics.Qualtrics;
|
||||
import com.sap.sse.gwt.shared.ClientConfiguration;
|
||||
|
||||
/**
|
||||
@@ -33,7 +34,7 @@ public class Footer extends Composite {
|
||||
}
|
||||
|
||||
@UiField Anchor whatsNewLinkUi;
|
||||
@UiField AnchorElement sapJobsAnchor;
|
||||
@UiField AnchorElement supportAnchor;
|
||||
@UiField AnchorElement feedbackAnchor;
|
||||
@UiField LanguageSelector languageSelector;
|
||||
@UiField DivElement copyrightDiv;
|
||||
@@ -45,10 +46,8 @@ public class Footer extends Composite {
|
||||
public Footer(MobilePlacesNavigator placeNavigator) {
|
||||
this.placeNavigator = placeNavigator;
|
||||
FooterResources.INSTANCE.css().ensureInjected();
|
||||
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
placeNavigator.getImprintNavigation().configureAnchorElement(imprintAnchorLink);
|
||||
|
||||
DOM.sinkEvents(desktopUi, Event.ONCLICK);
|
||||
DOM.setEventListener(desktopUi, new EventListener() {
|
||||
@Override
|
||||
@@ -59,11 +58,18 @@ public class Footer extends Composite {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Event.sinkEvents(feedbackAnchor, Event.ONCLICK);
|
||||
Event.setEventListener(feedbackAnchor, event->{
|
||||
if (Event.ONCLICK == event.getTypeInt()) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
Qualtrics.triggerIntercepts();
|
||||
}
|
||||
});
|
||||
if (!ClientConfiguration.getInstance().isBrandingActive()) {
|
||||
copyrightDiv.getStyle().setDisplay(NONE);
|
||||
languageSelector.setLabelText(StringMessages.INSTANCE.whitelabelFooterLanguage());
|
||||
sapJobsAnchor.getStyle().setDisplay(Display.NONE);
|
||||
supportAnchor.getStyle().setDisplay(Display.NONE);
|
||||
feedbackAnchor.getStyle().setDisplay(Display.NONE);
|
||||
whatsNewLinkUi.getElement().getStyle().setDisplay(Display.NONE);
|
||||
imprintAnchorLink.getStyle().setDisplay(Display.NONE);
|
||||
@@ -74,5 +80,4 @@ public class Footer extends Composite {
|
||||
void onWhatsNew(ClickEvent e) {
|
||||
placeNavigator.getWhatsNewNavigation(WhatsNewPlace.WhatsNewNavigationTabs.SailingAnalytics).goToPlace();
|
||||
}
|
||||
|
||||
}
|
||||
+5
-7
@@ -24,16 +24,14 @@
|
||||
title="{i18n.footerPrivacy}">
|
||||
<ui:text from='{i18n.footerPrivacy}' />
|
||||
</a>
|
||||
|
|
||||
<a ui:field="sapJobsAnchor" href="https://jobs.sap.com" target="_blank">
|
||||
<ui:text from='{i18n.footerJobs}'/>
|
||||
</a>
|
||||
<br></br>
|
||||
<a ui:field="feedbackAnchor" href="mailto:support%40sapsailing.com?subject=[SAP Sailing] Feedback"
|
||||
title="{i18n.footerFeedback}">
|
||||
<a ui:field="supportAnchor" href="mailto:support%40sapsailing.com?subject=[SAP Sailing] Support"
|
||||
title="{i18n.footerSupport}">
|
||||
<ui:text from='{i18n.footerSupport}' />
|
||||
</a>
|
||||
<a ui:field="feedbackAnchor" href="" title="{i18n.footerFeedback}">
|
||||
<ui:text from='{i18n.footerFeedback}' />
|
||||
</a>
|
||||
|
|
||||
<a ui:field="desktopUi" href="HomeDesktop.html" title="Desktop">
|
||||
Desktop
|
||||
</a>
|
||||
|
||||
-1
@@ -14,6 +14,5 @@ public interface FooterResources extends ClientBundle {
|
||||
String sitefooter();
|
||||
String sitefooter_language();
|
||||
String sitefooter_links();
|
||||
|
||||
}
|
||||
}
|
||||
-3
@@ -49,10 +49,8 @@ public class SwitchingEntryPoint implements EntryPoint {
|
||||
public void onModuleLoad() {
|
||||
Document.get().getElementById("loading").removeFromParent();
|
||||
LOG.info("Start switching entry point");
|
||||
|
||||
SharedResources.INSTANCE.mediaCss().ensureInjected();
|
||||
SharedResources.INSTANCE.mainCss().ensureInjected();
|
||||
|
||||
String hash = Window.Location.getHash();
|
||||
if (hash != null && hash.startsWith("#")) {
|
||||
hash = hash.substring(1);
|
||||
@@ -150,5 +148,4 @@ public class SwitchingEntryPoint implements EntryPoint {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
-4
@@ -2,10 +2,6 @@
|
||||
<!-- Could not determine the version of your GWT SDK; using the module DTD from GWT 1.6.4. You may want to change this. -->
|
||||
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.7.0//EN" "http://gwtproject.org/doctype/2.7.0/gwt-module.dtd">
|
||||
<module>
|
||||
|
||||
|
||||
<source path='client'/>
|
||||
|
||||
|
||||
</module>
|
||||
|
||||
+1
@@ -1709,6 +1709,7 @@ public interface StringMessages extends com.sap.sse.gwt.client.StringMessages,
|
||||
String footerLegal();
|
||||
String footerPrivacy();
|
||||
String footerFeedback();
|
||||
String footerSupport();
|
||||
String headerLogo();
|
||||
String headerSearchPlaceholder();
|
||||
String mainEventShowAll();
|
||||
|
||||
+1
@@ -1712,6 +1712,7 @@ footerLanguage=SAP Sailing in
|
||||
footerLegal=Legal Disclosure
|
||||
footerPrivacy=Privacy
|
||||
footerFeedback=Feedback
|
||||
footerSupport=Support
|
||||
headerLogo=Sailing Analytics
|
||||
headerSearchPlaceholder=Search
|
||||
mainEventShowAll=Show All Events
|
||||
|
||||
+1
@@ -1696,6 +1696,7 @@ footerLanguage=SAP Sailing in
|
||||
footerLegal=Impressum
|
||||
footerPrivacy=Datenschutz
|
||||
footerFeedback=Feedback
|
||||
footerSupport=Support
|
||||
headerLogo=Sailing Analytics
|
||||
headerSearchPlaceholder=Suche
|
||||
mainEventShowAll=Zeige alle Veranstaltungen
|
||||
|
||||
@@ -68,6 +68,7 @@ Export-Package: com.google.gwt.user.client.rpc.core.java.util,
|
||||
com.sap.sse.gwt.dispatch.shared.commands,
|
||||
com.sap.sse.gwt.dispatch.shared.exceptions,
|
||||
com.sap.sse.gwt.linker,
|
||||
com.sap.sse.gwt.qualtrics,
|
||||
com.sap.sse.gwt.resources,
|
||||
com.sap.sse.gwt.server,
|
||||
com.sap.sse.gwt.server.filestorage,
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.7.0//EN" "http://gwtproject.org/doctype/2.7.0/gwt-module.dtd">
|
||||
<module>
|
||||
<inherits name="com.google.gwt.user.User" />
|
||||
<entry-point class="com.sap.sse.gwt.qualtrics.QualtricsInjectingEntryPoint" />
|
||||
<source path="qualtrics" />
|
||||
</module>
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.sap.sse.gwt.qualtrics;
|
||||
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.core.client.ScriptInjector;
|
||||
import com.google.gwt.dom.client.DivElement;
|
||||
import com.google.gwt.dom.client.Document;
|
||||
|
||||
/**
|
||||
* Convenience class to inject Qualtrics script content. To use a Qualtrics survey in your entry point, inherit the
|
||||
* {@code com.sap.sse.gwt.Qualtrics} module which has an entry point that injects the script code needed. Then,
|
||||
* if your Qualtrics "Intercept" is setup of for an explicit JavaScript trigger, establish
|
||||
*/
|
||||
public final class Qualtrics {
|
||||
public static QualtricsRessource QUALTRICS_RESSOURCES = GWT.create(QualtricsRessource.class);
|
||||
|
||||
private static boolean isInjected = false;
|
||||
|
||||
protected Qualtrics() {
|
||||
}
|
||||
|
||||
/**
|
||||
* inject minimal js required for Qualtrics survey
|
||||
*/
|
||||
public static void ensureInjected() {
|
||||
if (!isInjected) {
|
||||
ScriptInjector.fromString(QUALTRICS_RESSOURCES.qualtricsLoadingCode().getText()).setWindow(ScriptInjector.TOP_WINDOW).inject();
|
||||
// Now produce the following div:
|
||||
// <div id='ZN_7WmsxxHQyCeUivX'><!--DO NOT REMOVE-CONTENTS PLACED HERE--></div>
|
||||
final DivElement div = Document.get().createDivElement();
|
||||
div.setId("ZN_7WmsxxHQyCeUivX");
|
||||
div.setInnerHTML("<!--DO NOT REMOVE-CONTENTS PLACED HERE-->");
|
||||
isInjected = true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Use this, e.g., in your "onclick" handler for your anchor, link or button to trigger the Qualtrics Intercepts
|
||||
* loaded for your page that are configured for explicit JavaScript invocation.
|
||||
*/
|
||||
public static native void triggerIntercepts() /*-{
|
||||
$wnd.QSI.API.unload();
|
||||
$wnd.QSI.API.load();
|
||||
$wnd.QSI.API.run();
|
||||
}-*/;
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
package com.sap.sse.gwt.qualtrics;
|
||||
|
||||
import com.google.gwt.core.client.EntryPoint;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
|
||||
public class QualtricsInjectingEntryPoint implements EntryPoint {
|
||||
@Override
|
||||
public void onModuleLoad() {
|
||||
GWT.log("Inject Qualtrics");
|
||||
Qualtrics.ensureInjected();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.sap.sse.gwt.qualtrics;
|
||||
|
||||
import com.google.gwt.resources.client.ClientBundle;
|
||||
import com.google.gwt.resources.client.TextResource;
|
||||
|
||||
public interface QualtricsRessource extends ClientBundle {
|
||||
@Source("resources/qualtrics.js")
|
||||
TextResource qualtricsLoadingCode();
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
/* BEGIN QUALTRICS WEBSITE FEEDBACK SNIPPET */
|
||||
(function(){var g=function(e,h,f,g){
|
||||
this.get=function(a){for(var a=a+"=",c=document.cookie.split(";"),b=0,e=c.length;b<e;b++){for(var d=c[b];" "==d.charAt(0);)d=d.substring(1,d.length);if(0==d.indexOf(a))return d.substring(a.length,d.length)}return null};
|
||||
this.set=function(a,c){var b="",b=new Date;b.setTime(b.getTime()+6048E5);b="; expires="+b.toGMTString();document.cookie=a+"="+c+b+"; path=/; "};
|
||||
this.check=function(){var a=this.get(f);if(a)a=a.split(":");else if(100!=e)"v"==h&&(e=Math.random()>=e/100?0:100),a=[h,e,0],this.set(f,a.join(":"));else return!0;var c=a[1];if(100==c)return!0;switch(a[0]){case "v":return!1;case "r":return c=a[2]%Math.floor(100/c),a[2]++,this.set(f,a.join(":")),!c}return!0};
|
||||
this.go=function(){if(this.check()){var a=document.createElement("script");a.type="text/javascript";a.src=g;document.body&&document.body.appendChild(a)}};
|
||||
this.start=function(){var t=this;"complete"!==document.readyState?window.addEventListener?window.addEventListener("load",function(){t.go()},!1):window.attachEvent&&window.attachEvent("onload",function(){t.go()}):t.go()};};
|
||||
try{(new g(100,"r","QSI_S_ZN_7WmsxxHQyCeUivX","https://zn7wmsxxhqyceuivx-sapdemo.siteintercept.qualtrics.com/SIE/?Q_ZID=ZN_7WmsxxHQyCeUivX")).start()}catch(i){}})();
|
||||
/* END WEBSITE FEEDBACK SNIPPET */
|
||||
@@ -4,7 +4,7 @@ import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.core.client.ScriptInjector;
|
||||
|
||||
/**
|
||||
* Convinience class to inject common control css content
|
||||
* Convenience class to inject common control css content
|
||||
*
|
||||
* @author pgtaboada
|
||||
*
|
||||
|
||||
Reference in new issue
Block a user