1818import goc .webtemplate .Constants ;
1919import goc .webtemplate .ContextualFooter ;
2020import goc .webtemplate .CustomSearch ;
21+ import goc .webtemplate .FeedbackLink ;
2122import goc .webtemplate .FooterLink ;
2223import goc .webtemplate .FooterSection ;
2324import goc .webtemplate .HeaderMenu ;
4041import goc .webtemplate .component .jsonentities .AppTop ;
4142import goc .webtemplate .component .jsonentities .CDTSEnvironment ;
4243import goc .webtemplate .component .jsonentities .CdnEnvironment ;
43- import goc .webtemplate .component .jsonentities .FeedbackLink ;
44+ import goc .webtemplate .component .jsonentities .Feedback ;
4445import goc .webtemplate .component .jsonentities .Footer ;
4546import goc .webtemplate .component .jsonentities .PreFooter ;
4647import 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