Skip to content

Commit d7871f2

Browse files
authored
Update feedback v4 (#36)
* Updating static fallback files * Updating version to v5_0_0 * Feedback tool update * Updating test version, fixing test * Updating feedback tool with new changes * minor fixes * PR fixes * Fixing French accent * Fixing test French character * Update FeedbackAndShareThisPageSample.html
1 parent eafb04c commit d7871f2

107 files changed

Lines changed: 610 additions & 349 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: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
## v4.0.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+
- 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
811
- Bug fixes
912

1013
## v3.0.0

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 = "4.0.0";
1717

18-
public static final String CDTS_DEFAULT_VERSION = "v4_1_0";
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: 82 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import goc.webtemplate.Constants;
1616
import goc.webtemplate.ContextualFooter;
1717
import goc.webtemplate.CustomSearch;
18+
import goc.webtemplate.FeedbackLink;
1819
import goc.webtemplate.FooterLink;
1920
import goc.webtemplate.FooterSection;
2021
import goc.webtemplate.HeaderMenu;
@@ -37,7 +38,7 @@
3738
import goc.webtemplate.component.jsonentities.AppTop;
3839
import goc.webtemplate.component.jsonentities.CDTSEnvironment;
3940
import goc.webtemplate.component.jsonentities.CDTSEnvironmentList;
40-
import goc.webtemplate.component.jsonentities.FeedbackLink;
41+
import goc.webtemplate.component.jsonentities.Feedback;
4142
import goc.webtemplate.component.jsonentities.Footer;
4243
import goc.webtemplate.component.jsonentities.IPreFooter;
4344
import goc.webtemplate.component.jsonentities.PreFooter;
@@ -104,8 +105,13 @@ private enum Themes { GCWEB, GCINTRANET }
104105
private Link applicationTitle = new Link();
105106
private IntranetTitle intranetTitle = null;
106107
private String languageLinkUrl = "";
107-
private String feedbackUrl = this.getResourceBundleString("cdn", "goc.webtemplate.feedbackurl");
108-
private String feedbackUrlFr = this.getResourceBundleString("cdn", "goc.webtemplate.feedbackurl_fr");
108+
private FeedbackLink feedbackLink = new FeedbackLink(Boolean.parseBoolean(this.getResourceBundleString("cdn", "goc.webtemplate.showfeedbacklink")),
109+
this.getResourceBundleString("cdn", "goc.webtemplate.feedbackurl"),
110+
this.getResourceBundleString("cdn", "goc.webtemplate.feedbackurl_fr"),
111+
this.getResourceBundleString("cdn", "goc.webtemplate.feedbacktext"),
112+
this.getResourceBundleString("cdn", "goc.webtemplate.feedbacktext_fr"),
113+
this.getResourceBundleString("cdn", "goc.webtemplate.feedbacktheme"),
114+
this.getResourceBundleString("cdn", "goc.webtemplate.feedbacksection"));
109115
private List<Link> contactLinks = null;
110116
private LeavingSecureSiteWarning leavingSecureSiteWarning = new LeavingSecureSiteWarning(
111117
Boolean.parseBoolean(this.getResourceBundleString("cdn", "leavingsecuresitewarning.enabled")),
@@ -120,7 +126,6 @@ private enum Themes { GCWEB, GCINTRANET }
120126
private boolean showPreContent = Boolean.parseBoolean(this.getResourceBundleString("cdn", "goc.webtemplate.showprecontent"));
121127
private boolean showPostContent = Boolean.parseBoolean(this.getResourceBundleString("cdn", "goc.webtemplate.showpostcontent"));
122128
private boolean showLanguageLink = Boolean.parseBoolean(this.getResourceBundleString("cdn", "goc.webtemplate.showlanguagelink"));
123-
private boolean showFeedbackLink = Boolean.parseBoolean(this.getResourceBundleString("cdn", "goc.webtemplate.showfeedbacklink"));
124129
private boolean showSharePageLink = Boolean.parseBoolean(this.getResourceBundleString("cdn", "goc.webtemplate.showsharepagelink"));
125130
private boolean showFeatures = Boolean.parseBoolean(this.getResourceBundleString("cdn", "goc.webtemplate.showfeatures"));
126131
private List<Constants.SocialMediaSites> sharePageMediaSites = new ArrayList<Constants.SocialMediaSites>();
@@ -503,7 +508,7 @@ public void setUseSRI(boolean value) {
503508
}
504509

505510
/**
506-
* Returns the version of the CDN files to use to build the page. (e.g v4_1_0)
511+
* Returns the version of the CDN files to use to build the page. (e.g v5_0_0)
507512
*
508513
* Set at application level via "wettemplate_version" property in cdn.properties,
509514
* can be overriden programatically.
@@ -524,7 +529,7 @@ public String getTemplateVersion() {
524529
}
525530

526531
/**
527-
* Sets the version of the CDN files to use to build the page. (e.g v4_1_0)
532+
* Sets the version of the CDN files to use to build the page. (e.g v5_0_0)
528533
*
529534
* Set at application level via "wettemplate_version" property in cdn.properties,
530535
* can be overriden programatically.
@@ -1043,64 +1048,100 @@ public void setSharePageMediaSites(List<Constants.SocialMediaSites> value) {
10431048
*
10441049
* Set at application level via "goc.webtemplate.showfeedbacklink" property in cdn.properties,
10451050
* can be overriden programatically.
1051+
*
1052+
* * @Depracted Starting with version v4.0.0, use get/setFeedbackLink instead
10461053
*/
1054+
@Deprecated
10471055
public boolean getShowFeedbackLink() {
10481056
this.initializeOnce();
1049-
return this.showFeedbackLink;
1057+
return this.feedbackLink.isEnabled();
10501058
}
10511059

10521060
/**
10531061
* Sets whether the FeedBack link of the footer is to be displayed.
10541062
*
10551063
* Set at application level via "goc.webtemplate.showfeedbacklink" property in cdn.properties,
10561064
* can be overriden programatically.
1065+
*
1066+
* @Depracted Starting with version v4.0.0, use get/setFeedbackLink instead
10571067
*/
1068+
@Deprecated
10581069
public void setShowFeedbackLink(boolean value) {
1059-
this.showFeedbackLink = value;
1070+
this.feedbackLink.setEnabled(value);
10601071
}
10611072

10621073
/**
10631074
* Returns the FeedBack link URL.
10641075
*
10651076
* Set at application level via "goc.webtemplate.feedbackurl" property in cdn.properties,
10661077
* can be overriden programatically.
1078+
*
1079+
* * @Depracted Starting with version v4.0.0, use get/setFeedbackLink instead
10671080
*/
1081+
@Deprecated
10681082
public String getFeedbackUrl() {
10691083
this.initializeOnce();
1070-
return this.feedbackUrl;
1084+
return this.feedbackLink.getUrl();
10711085
}
10721086

10731087
/**
10741088
* Sets the FeedBack link URL.
10751089
*
10761090
* Set at application level via "goc.webtemplate.feedbackurl" property in cdn.properties,
10771091
* can be overriden programatically.
1092+
*
1093+
* * @Depracted Starting with version v4.0.0, use get/setFeedbackLink instead
10781094
*/
1095+
@Deprecated
10791096
public void setFeedbackUrl(String value) {
1080-
this.feedbackUrl = value;
1097+
this.feedbackLink.setUrl(value);
10811098
}
10821099

10831100
/**
10841101
* Returns the french FeedBack link URL.
10851102
*
10861103
* Set at application level via "goc.webtemplate.feedbackurl_fr" property in cdn.properties,
10871104
* can be overriden programatically.
1105+
*
1106+
* * @Depracted Starting with version v4.0.0, use get/setFeedbackLink instead
10881107
*/
1108+
@Deprecated
10891109
public String getFeedbackUrlFr() {
10901110
this.initializeOnce();
1091-
return this.feedbackUrlFr;
1111+
return this.feedbackLink.getUrlFr();
10921112
}
10931113

10941114
/**
10951115
* Sets the french FeedBack link URL.
10961116
*
10971117
* Set at application level via "goc.webtemplate.feedbackurl_fr" property in cdn.properties,
1098-
* can be overriden programatically.
1118+
* can be overriden programmatically.
1119+
*
1120+
* * @Depracted Starting with version v4.0.0, use get/setFeedbackLink instead
10991121
*/
1122+
@Deprecated
11001123
public void setFeedbackUrlFr(String value) {
1101-
this.feedbackUrlFr = value;
1124+
this.feedbackLink.setUrlFr(value);
1125+
}
1126+
1127+
/**
1128+
* Returns the FeedbackLink object used as configuration
1129+
*
1130+
* Configuration can be set at application level in cdn.properties, or set programmatically at runtime.
1131+
*/
1132+
public FeedbackLink getFeedbackLink() {
1133+
this.initializeOnce();
1134+
return this.feedbackLink;
11021135
}
11031136

1137+
/**
1138+
* Sets the FeedbackLink object used as configuration
1139+
*
1140+
* Configuration can be set at application level in cdn.properties, or set programattically at runtime.
1141+
*/
1142+
public void setFeedbackLink(FeedbackLink value) {
1143+
this.feedbackLink = value;
1144+
}
11041145

11051146
/**
11061147
* Returns a unique string to identify a web page. Used by user to identify the screen where an issue occured.
@@ -2013,22 +2054,44 @@ private AppTop buildAppTop() {
20132054
return appTop;
20142055
}
20152056

2057+
/**
2058+
* Builds the Feedback object
2059+
*/
2060+
private Feedback buildFeedback(FeedbackLink feedbackLink)
2061+
{
2062+
Feedback feedback = new Feedback();
2063+
feedback.setEnabled(this.feedbackLink.isEnabled());
2064+
2065+
Boolean isFrenchCulture = this.getTwoLetterCultureLanguage().toUpperCase().equals(Constants.FRENCH_ACCRONYM.toUpperCase());
2066+
2067+
if (!Utility.isNullOrEmpty(this.feedbackLink.getText()) || !Utility.isNullOrEmpty(this.feedbackLink.getSection()) || !Utility.isNullOrEmpty(this.feedbackLink.getTheme()))
2068+
{
2069+
feedback.setSection(feedbackLink.getSection());
2070+
feedback.setTheme(feedbackLink.getTheme());
2071+
feedback.setText((isFrenchCulture && !Utility.isNullOrEmpty(this.feedbackLink.getTextFr())) ? feedbackLink.getTextFr() : feedbackLink.getText());
2072+
feedback.setHref((isFrenchCulture && !Utility.isNullOrEmpty(this.feedbackLink.getUrlFr())) ? feedbackLink.getUrlFr() : feedbackLink.getUrl());
2073+
}
2074+
else if (!Utility.isNullOrEmpty(this.feedbackLink.getUrl()))
2075+
{
2076+
feedback.setLegacyBtnUrl((isFrenchCulture && !Utility.isNullOrEmpty(this.feedbackLink.getUrlFr())) ? this.feedbackLink.getUrlFr() : this.feedbackLink.getUrl());
2077+
}
2078+
2079+
return feedback;
2080+
}
2081+
20162082
/**
20172083
* Builds the "PreFooter" object needed in rendering the CDTS setup JSON
20182084
* (assumes initializeOnce() was called)
20192085
*/
20202086
private IPreFooter buildPreFooter(boolean isTransactional, boolean isUnilingualError) {
20212087
if (!isTransactional) {
20222088
if (!isUnilingualError) {
2023-
return new PreFooter(
2089+
return new PreFooter(
20242090
null, //no need for cdnEnv now that we're using CDTS setup function
20252091
JsonValueUtils.getNonEmptyString(this.getVersionIdentifier()),
20262092
this.buildDateModified(),
20272093
this.showPostContent,
2028-
new FeedbackLink(this.showFeedbackLink,
2029-
(this.getTwoLetterCultureLanguage().toUpperCase().equals(Constants.ENGLISH_ACCRONYM.toUpperCase()) || Utility.isNullOrEmpty(this.getFeedbackUrlFr()) ?
2030-
this.feedbackUrl:
2031-
this.feedbackUrlFr) ),
2094+
buildFeedback(this.getFeedbackLink()),
20322095
new ShareList(this.showSharePageLink, this.sharePageMediaSites),
20332096
JsonValueUtils.getNonEmptyString(this.getScreenIdentifier())
20342097
);
@@ -2042,7 +2105,7 @@ private IPreFooter buildPreFooter(boolean isTransactional, boolean isUnilingualE
20422105
JsonValueUtils.getNonEmptyString(this.getVersionIdentifier()),
20432106
this.buildDateModified(),
20442107
false, //showPostContent,
2045-
new FeedbackLink(false, null),
2108+
new Feedback(false, null, null, null, null, null),
20462109
new ShareList(false, null),
20472110
JsonValueUtils.getNonEmptyString(this.getScreenIdentifier())
20482111
);

0 commit comments

Comments
 (0)