Skip to content

Commit 1746f26

Browse files
authored
Update feedback v2 (#37)
* Updating static fallback files v5.0.0 * Updating version to v5_0_0 * Updating Feedback tool * Fixing spelling
1 parent 4008697 commit 1746f26

105 files changed

Lines changed: 645 additions & 440 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@
55
## v2.7.0
66

77
- **SECURITY FIX** Removal of default redirect handlers for "leaving secure site" feature. Leaving secure site feature now relies solely on WET functionality. Unless these redirect handlers were explicitely referenced by client application there should be no impact. (Spring version: removal of endpoint "/gocwebtemplate_leavesecuresiteredirect"; JSP version: removal of action "leavesecuresiteredirect.action")
8-
- Bug fixes
8+
- Replacing the 'Report a problem button' with the new Page Feedback tool. The Page Feedback tool is optional and will be hidden unless explicitly enabled and other conditions are met. Please visit the sample pages for more information.
9+
- [CDTS](https://github.com/wet-boew/cdts-sgdc/) v5.0.0 & [wet-boew](https://github.com/wet-boew/wet-boew) v4.0.70.1
10+
- Updated static fallback files
11+
- Bug Fixes
912

1013
## v2.6.0
1114

gocwebtemplate-core/gocwebtemplate-core-base/src/main/java/goc/webtemplate/Constants.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public abstract class Constants {
1515

1616
public static final String WEB_TEMPLATE_DISTRIBUTION_VERSION = "2.7.0";
1717

18-
public static final String CDTS_DEFAULT_VERSION = "v4_0_47";
18+
public static final String CDTS_DEFAULT_VERSION = "v5_0_0";
1919

2020
public static final String STATIC_FALLBACK_FILES_INTERNAL_PATH = "/goc/webtemplate/StaticFallbackFiles";
2121

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
package goc.webtemplate;
2+
3+
import java.io.Serializable;
4+
5+
public class FeedbackLink implements Serializable {
6+
private static final long serialVersionUID = 1L;
7+
8+
private boolean enabled;
9+
private String url;
10+
private String urlFr;
11+
private String text;
12+
private String textFr;
13+
private String theme;
14+
private String section;
15+
16+
public FeedbackLink() {
17+
}
18+
19+
public FeedbackLink(boolean enabled, String url, String urlFr, String text, String textFr, String theme, String section) {
20+
this.enabled = enabled;
21+
this.url = url;
22+
this.urlFr = urlFr;
23+
this.text = text;
24+
this.textFr = textFr;
25+
this.theme = theme;
26+
this.section = section;
27+
}
28+
29+
public boolean isEnabled() {
30+
return enabled;
31+
}
32+
33+
public void setEnabled(boolean enabled) {
34+
this.enabled = enabled;
35+
}
36+
37+
public String getUrl() {
38+
return url;
39+
}
40+
41+
public void setUrl(String url) {
42+
this.url = url;
43+
}
44+
45+
public String getUrlFr() {
46+
return urlFr;
47+
}
48+
49+
public void setUrlFr(String urlFr) {
50+
this.urlFr = urlFr;
51+
}
52+
53+
public String getText() {
54+
return text;
55+
}
56+
57+
public void setText(String text) {
58+
this.text = text;
59+
}
60+
61+
public String getTextFr() {
62+
return textFr;
63+
}
64+
65+
public void setTextFr(String textFr) {
66+
this.textFr = textFr;
67+
}
68+
69+
public String getTheme() {
70+
return theme;
71+
}
72+
73+
public void setTheme(String theme) {
74+
this.theme = theme;
75+
}
76+
77+
public String getSection() {
78+
return section;
79+
}
80+
81+
public void setSection(String section) {
82+
this.section = section;
83+
}
84+
}

gocwebtemplate-core/gocwebtemplate-core-base/src/main/java/goc/webtemplate/component/AbstractCoreBean.java

Lines changed: 86 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import goc.webtemplate.Constants;
1919
import goc.webtemplate.ContextualFooter;
2020
import goc.webtemplate.CustomSearch;
21+
import goc.webtemplate.FeedbackLink;
2122
import goc.webtemplate.FooterLink;
2223
import goc.webtemplate.FooterSection;
2324
import goc.webtemplate.HeaderMenu;
@@ -40,7 +41,7 @@
4041
import goc.webtemplate.component.jsonentities.AppTop;
4142
import goc.webtemplate.component.jsonentities.CDTSEnvironment;
4243
import goc.webtemplate.component.jsonentities.CdnEnvironment;
43-
import goc.webtemplate.component.jsonentities.FeedbackLink;
44+
import goc.webtemplate.component.jsonentities.Feedback;
4445
import goc.webtemplate.component.jsonentities.Footer;
4546
import goc.webtemplate.component.jsonentities.PreFooter;
4647
import goc.webtemplate.component.jsonentities.RefFooter;
@@ -101,8 +102,13 @@ private enum Themes { GCWEB, GCINTRANET }
101102
private Link applicationTitle = new Link();
102103
private IntranetTitle intranetTitle = null;
103104
private String languageLinkUrl = "";
104-
private String feedbackUrl = this.getResourceBundleString("cdn", "goc.webtemplate.feedbackurl");
105-
private String feedbackUrlFr = this.getResourceBundleString("cdn", "goc.webtemplate.feedbackurl_fr");
105+
private FeedbackLink feedbackLink = new FeedbackLink(Boolean.parseBoolean(this.getResourceBundleString("cdn", "goc.webtemplate.showfeedbacklink")),
106+
this.getResourceBundleString("cdn", "goc.webtemplate.feedbackurl"),
107+
this.getResourceBundleString("cdn", "goc.webtemplate.feedbackurl_fr"),
108+
this.getResourceBundleString("cdn", "goc.webtemplate.feedbacktext"),
109+
this.getResourceBundleString("cdn", "goc.webtemplate.feedbacktext_fr"),
110+
this.getResourceBundleString("cdn", "goc.webtemplate.feedbacktheme"),
111+
this.getResourceBundleString("cdn", "goc.webtemplate.feedbacksection"));
106112
private List<Link> contactLinks = null;
107113
private LeavingSecureSiteWarning leavingSecureSiteWarning = new LeavingSecureSiteWarning(
108114
Boolean.parseBoolean(this.getResourceBundleString("cdn", "leavingsecuresitewarning.enabled")),
@@ -117,7 +123,6 @@ private enum Themes { GCWEB, GCINTRANET }
117123
private boolean showPreContent = Boolean.parseBoolean(this.getResourceBundleString("cdn", "goc.webtemplate.showprecontent"));
118124
private boolean showPostContent = Boolean.parseBoolean(this.getResourceBundleString("cdn", "goc.webtemplate.showpostcontent"));
119125
private boolean showLanguageLink = Boolean.parseBoolean(this.getResourceBundleString("cdn", "goc.webtemplate.showlanguagelink"));
120-
private boolean showFeedbackLink = Boolean.parseBoolean(this.getResourceBundleString("cdn", "goc.webtemplate.showfeedbacklink"));
121126
private boolean showSharePageLink = Boolean.parseBoolean(this.getResourceBundleString("cdn", "goc.webtemplate.showsharepagelink"));
122127
private boolean showFeatures = Boolean.parseBoolean(this.getResourceBundleString("cdn", "goc.webtemplate.showfeatures"));
123128
private List<Constants.SocialMediaSites> sharePageMediaSites = new ArrayList<Constants.SocialMediaSites>();
@@ -456,7 +461,7 @@ public void setUseHttps(boolean value) {
456461
}
457462

458463
/**
459-
* Returns the version of the CDN files to use to build the page. (e.g v4_0_47)
464+
* Returns the version of the CDN files to use to build the page. (e.g v5_0_0)
460465
*
461466
* Set at application level via "wettemplate_version" property in cdn.properties,
462467
* can be overriden programatically.
@@ -477,7 +482,7 @@ public String getTemplateVersion() {
477482
}
478483

479484
/**
480-
* Sets the version of the CDN files to use to build the page. (e.g v4_0_47)
485+
* Sets the version of the CDN files to use to build the page. (e.g v5_0_0)
481486
*
482487
* Set at application level via "wettemplate_version" property in cdn.properties,
483488
* can be overriden programatically.
@@ -1015,65 +1020,101 @@ public void setSharePageMediaSites(List<Constants.SocialMediaSites> value) {
10151020
* Returns whether the FeedBack link of the footer is to be displayed.
10161021
*
10171022
* Set at application level via "goc.webtemplate.showfeedbacklink" property in cdn.properties,
1018-
* can be overriden programatically.
1023+
* can be overriden programatically.
1024+
*
1025+
* @Deprecated Starting with version v2.7.0, use get/setFeedbackLink instead
10191026
*/
1027+
@Deprecated
10201028
public boolean getShowFeedbackLink() {
10211029
this.initializeOnce();
1022-
return this.showFeedbackLink;
1030+
return this.feedbackLink.isEnabled();
10231031
}
10241032

10251033
/**
10261034
* Sets whether the FeedBack link of the footer is to be displayed.
10271035
*
10281036
* Set at application level via "goc.webtemplate.showfeedbacklink" property in cdn.properties,
1029-
* can be overriden programatically.
1037+
* can be overriden programatically.
1038+
*
1039+
* @Deprecated Starting with version v2.7.0, use get/setFeedbackLink instead
10301040
*/
1041+
@Deprecated
10311042
public void setShowFeedbackLink(boolean value) {
1032-
this.showFeedbackLink = value;
1043+
this.feedbackLink.setEnabled(value);
10331044
}
10341045

10351046
/**
10361047
* Returns the FeedBack link URL.
10371048
*
10381049
* Set at application level via "goc.webtemplate.feedbackurl" property in cdn.properties,
1039-
* can be overriden programatically.
1050+
* can be overriden programatically.
1051+
*
1052+
* @Deprecated Starting with version v2.7.0, use get/setFeedbackLink instead
10401053
*/
1054+
@Deprecated
10411055
public String getFeedbackUrl() {
10421056
this.initializeOnce();
1043-
return this.feedbackUrl;
1057+
return this.feedbackLink.getUrl();
10441058
}
10451059

10461060
/**
10471061
* Sets the FeedBack link URL.
10481062
*
10491063
* Set at application level via "goc.webtemplate.feedbackurl" property in cdn.properties,
1050-
* can be overriden programatically.
1064+
* can be overriden programatically.
1065+
*
1066+
* @Deprecated Starting with version v2.7.0, use get/setFeedbackLink instead
10511067
*/
1068+
@Deprecated
10521069
public void setFeedbackUrl(String value) {
1053-
this.feedbackUrl = value;
1070+
this.feedbackLink.setUrl(value);
10541071
}
10551072

10561073
/**
10571074
* Returns the french FeedBack link URL.
10581075
*
10591076
* Set at application level via "goc.webtemplate.feedbackurl_fr" property in cdn.properties,
1060-
* can be overriden programatically.
1077+
* can be overriden programatically.
1078+
*
1079+
* @Deprecated Starting with version v2.7.0, use get/setFeedbackLink instead
10611080
*/
1081+
@Deprecated
10621082
public String getFeedbackUrlFr() {
10631083
this.initializeOnce();
1064-
return this.feedbackUrlFr;
1084+
return this.feedbackLink.getUrlFr();
10651085
}
10661086

10671087
/**
10681088
* Sets the french FeedBack link URL.
10691089
*
10701090
* Set at application level via "goc.webtemplate.feedbackurl_fr" property in cdn.properties,
1071-
* can be overriden programatically.
1091+
* can be overriden programatically.
1092+
*
1093+
* @Deprecated Starting with version v2.7.0, use get/setFeedbackLink instead
10721094
*/
1095+
@Deprecated
10731096
public void setFeedbackUrlFr(String value) {
1074-
this.feedbackUrlFr = value;
1097+
this.feedbackLink.setUrlFr(value);
10751098
}
10761099

1100+
/**
1101+
* Returns the FeedbackLink object used as configuration
1102+
*
1103+
* Configuration can be set at application level in cdn.properties, or set programmatically at runtime.
1104+
*/
1105+
public FeedbackLink getFeedbackLink() {
1106+
this.initializeOnce();
1107+
return this.feedbackLink;
1108+
}
1109+
1110+
/**
1111+
* Sets the FeedbackLink object used as configuration
1112+
*
1113+
* Configuration can be set at application level in cdn.properties, or set programattically at runtime.
1114+
*/
1115+
public void setFeedbackLink(FeedbackLink value) {
1116+
this.feedbackLink = value;
1117+
}
10771118

10781119
/**
10791120
* Returns a unique string to identify a web page. Used by user to identify the screen where an issue occured.
@@ -2030,6 +2071,31 @@ public String getRenderSplash() {
20302071
));
20312072
}
20322073

2074+
/**
2075+
* Builds the Feedback object
2076+
*/
2077+
private Feedback buildFeedback(FeedbackLink feedbackLink)
2078+
{
2079+
Feedback feedback = new Feedback();
2080+
feedback.setEnabled(this.feedbackLink.isEnabled());
2081+
2082+
Boolean isFrenchCulture = this.getTwoLetterCultureLanguage().toUpperCase().equals(Constants.FRENCH_ACCRONYM.toUpperCase());
2083+
2084+
if (!Utility.isNullOrEmpty(this.feedbackLink.getText()) || !Utility.isNullOrEmpty(this.feedbackLink.getSection()) || !Utility.isNullOrEmpty(this.feedbackLink.getTheme()))
2085+
{
2086+
feedback.setSection(feedbackLink.getSection());
2087+
feedback.setTheme(feedbackLink.getTheme());
2088+
feedback.setText((isFrenchCulture && !Utility.isNullOrEmpty(this.feedbackLink.getTextFr())) ? feedbackLink.getTextFr() : feedbackLink.getText());
2089+
feedback.setHref((isFrenchCulture && !Utility.isNullOrEmpty(this.feedbackLink.getUrlFr())) ? feedbackLink.getUrlFr() : feedbackLink.getUrl());
2090+
}
2091+
else if (!Utility.isNullOrEmpty(this.feedbackLink.getUrl()))
2092+
{
2093+
feedback.setLegacyBtnUrl((isFrenchCulture && !Utility.isNullOrEmpty(this.feedbackLink.getUrlFr())) ? this.feedbackLink.getUrlFr() : this.feedbackLink.getUrl());
2094+
}
2095+
2096+
return feedback;
2097+
}
2098+
20332099
/**
20342100
* Builds a string with the format required by the closure template to represent the JSON object used
20352101
* as parameter for the "preFooter"
@@ -2040,10 +2106,7 @@ public String getRenderPreFooter() {
20402106
JsonValueUtils.getNonEmptyString(this.getVersionIdentifier()),
20412107
this.buildDateModified(),
20422108
this.showPostContent,
2043-
new FeedbackLink(this.showFeedbackLink,
2044-
(this.getTwoLetterCultureLanguage().toUpperCase().equals(Constants.ENGLISH_ACCRONYM.toUpperCase()) || Utility.isNullOrEmpty(this.getFeedbackUrlFr()) ?
2045-
this.feedbackUrl:
2046-
this.feedbackUrlFr) ),
2109+
buildFeedback(this.getFeedbackLink()),
20472110
new ShareList(this.showSharePageLink, this.sharePageMediaSites),
20482111
JsonValueUtils.getNonEmptyString(this.getScreenIdentifier())
20492112
));
@@ -2059,7 +2122,7 @@ public String getRenderTransactionalPreFooter() {
20592122
JsonValueUtils.getNonEmptyString(this.getVersionIdentifier()),
20602123
this.buildDateModified(),
20612124
false, //showPostContent,
2062-
new FeedbackLink(false, null),
2125+
new Feedback(false, null, null, null, null, null),
20632126
new ShareList(false, null),
20642127
JsonValueUtils.getNonEmptyString(this.getScreenIdentifier())
20652128
));

0 commit comments

Comments
 (0)