From daa301ab7080348618db09a101106c3027775c0a Mon Sep 17 00:00:00 2001 From: Kenji Tanaka Date: Fri, 20 Oct 2023 08:31:53 -0500 Subject: [PATCH 1/3] :sparkles: feat(OICRs summary): Show previous references in OICRs PDF summary --- .../summaries/BaseStudySummaryData.java | 27 ++++++++++++------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/marlo-web/src/main/java/org/cgiar/ccafs/marlo/action/summaries/BaseStudySummaryData.java b/marlo-web/src/main/java/org/cgiar/ccafs/marlo/action/summaries/BaseStudySummaryData.java index 645fb890db..5661bb1189 100644 --- a/marlo-web/src/main/java/org/cgiar/ccafs/marlo/action/summaries/BaseStudySummaryData.java +++ b/marlo-web/src/main/java/org/cgiar/ccafs/marlo/action/summaries/BaseStudySummaryData.java @@ -48,10 +48,15 @@ import org.pentaho.reporting.engine.classic.core.MasterReport; import org.pentaho.reporting.engine.classic.core.util.TypedTableModel; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class BaseStudySummaryData extends BaseSummariesAction { private static final long serialVersionUID = -3643067302492726266L; + + private static Logger LOG = LoggerFactory.getLogger(BaseStudySummaryData.class); + private final HTMLParser htmlParser; private final ProjectExpectedStudyCountryManager projectExpectedStudyCountryManager; @@ -484,15 +489,6 @@ public TypedTableModel getCaseStudiesTableModel(List p elaborationOutcomeImpactStatement = htmlParser.plainTextToHtml(projectExpectedStudyInfo.getElaborationOutcomeImpactStatement()); } - // References cited - - /* - * if (projectExpectedStudyInfo.getReferencesText() != null - * && !projectExpectedStudyInfo.getReferencesText().trim().isEmpty()) { - * studiesReference = htmlParser.plainTextToHtml(projectExpectedStudyInfo.getReferencesText()); - * referenceText = urlShortener.detectAndShortenLinks(studiesReference); - * } - */ // New references @@ -536,7 +532,20 @@ public TypedTableModel getCaseStudiesTableModel(List p referenceText = urlShortener.detectAndShortenLinks(studiesReference); } } catch (Exception e) { + LOG.error("Failed to get new reference information: " + e.getMessage()); + } + // References cited + try { + if ((referenceText == null) || (referenceText != null && referenceText.isEmpty())) { + if (projectExpectedStudyInfo.getReferencesText() != null + && !projectExpectedStudyInfo.getReferencesText().trim().isEmpty()) { + studiesReference = htmlParser.plainTextToHtml(projectExpectedStudyInfo.getReferencesText()); + referenceText = urlShortener.detectAndShortenLinks(studiesReference); + } + } + } catch (Exception e) { + LOG.error("Failed to get reference text: " + e.getMessage()); } // MELIA publications From 5e1fd5dc9c091debeada5d366f325c52d7c19335 Mon Sep 17 00:00:00 2001 From: Kenji Tanaka Date: Tue, 24 Oct 2023 10:46:58 -0500 Subject: [PATCH 2/3] :art: style(OICRs): Update references button style to standardized page conventions --- .../src/main/webapp/WEB-INF/global/macros/studiesTemplates.ftl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/marlo-web/src/main/webapp/WEB-INF/global/macros/studiesTemplates.ftl b/marlo-web/src/main/webapp/WEB-INF/global/macros/studiesTemplates.ftl index 7bc574e9a7..77e4a8042c 100644 --- a/marlo-web/src/main/webapp/WEB-INF/global/macros/studiesTemplates.ftl +++ b/marlo-web/src/main/webapp/WEB-INF/global/macros/studiesTemplates.ftl @@ -530,7 +530,7 @@ [/#list] [#if editable] -
Add Reference
+
Add Reference
[/#if] From 83b6819184d163fb5c86d3daa20b2660865ceeab Mon Sep 17 00:00:00 2001 From: Kenji Tanaka Date: Tue, 24 Oct 2023 11:04:57 -0500 Subject: [PATCH 3/3] :sparkles: feat(header): Create a custom parameter to define a personalized banner label --- .../cgiar/ccafs/marlo/action/BaseAction.java | 21 +++++++++++++++++++ .../cgiar/ccafs/marlo/config/APConstants.java | 1 + ...V2_6_0_20231020_1100__AICCRACustomText.sql | 6 ++++++ .../webapp/WEB-INF/global/pages/header.ftl | 2 +- 4 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 marlo-web/src/main/resources/database/migrations/V2_6_0_20231020_1100__AICCRACustomText.sql diff --git a/marlo-web/src/main/java/org/cgiar/ccafs/marlo/action/BaseAction.java b/marlo-web/src/main/java/org/cgiar/ccafs/marlo/action/BaseAction.java index 4714521154..b10cdb6da1 100644 --- a/marlo-web/src/main/java/org/cgiar/ccafs/marlo/action/BaseAction.java +++ b/marlo-web/src/main/java/org/cgiar/ccafs/marlo/action/BaseAction.java @@ -291,6 +291,7 @@ public class BaseAction extends ActionSupport implements Preparable, SessionAwar // Variables private String crpSession; + private String customTextHeader; protected boolean dataSaved; @@ -2627,6 +2628,26 @@ public String getCrpSession() { } return this.crpSession; } + + /** + * Get the Custom text from parameters table that for the testing banner + * + * @return the custom text header from parameters table + */ + public String getCustomTextHeader() { + try { + if (APConstants.CRP_LOGIN_HEADER_TEXT != null) { + customTextHeader = (String) this.getSession().get(APConstants.CRP_LOGIN_HEADER_TEXT); + } + } catch (Exception e) { + LOG.error("error getting custom text header " + e); + } + return customTextHeader; + } + + public void setCustomTextHeader(String customTextHeader) { + this.customTextHeader = customTextHeader; + } /** * ************************ CENTER METHOD ****************************** diff --git a/marlo-web/src/main/java/org/cgiar/ccafs/marlo/config/APConstants.java b/marlo-web/src/main/java/org/cgiar/ccafs/marlo/config/APConstants.java index f735611410..4499179b7c 100644 --- a/marlo-web/src/main/java/org/cgiar/ccafs/marlo/config/APConstants.java +++ b/marlo-web/src/main/java/org/cgiar/ccafs/marlo/config/APConstants.java @@ -59,6 +59,7 @@ public final class APConstants { public static final String CRP_FPM_ROLE = "crp_fpm_rol"; public static final String CRP_REPORT_DELIVERABLE_PPA_FILTER = "crp_report_deliverable_ppa_filter"; public static final String CRP_PROJECT_BUDGET_ZERO = "crp_project_budget_zero"; + public static final String CRP_LOGIN_HEADER_TEXT = "crp_login_header_text"; public static final String CRP_HAS_REGIONS = "crp_has_regions"; public static final String CRP_ID = "crpID"; diff --git a/marlo-web/src/main/resources/database/migrations/V2_6_0_20231020_1100__AICCRACustomText.sql b/marlo-web/src/main/resources/database/migrations/V2_6_0_20231020_1100__AICCRACustomText.sql new file mode 100644 index 0000000000..1267980e7f --- /dev/null +++ b/marlo-web/src/main/resources/database/migrations/V2_6_0_20231020_1100__AICCRACustomText.sql @@ -0,0 +1,6 @@ +INSERT INTO parameters (global_unit_type_id, `key`, `description`, `format`, default_value, category) +VALUES ( '1', 'crp_login_header_text', 'Custom text in header login page', '4', 'Testing Environment', '3'); +INSERT INTO parameters (global_unit_type_id, `key`, `description`, `format`, default_value, category) +VALUES ( '3', 'crp_login_header_text', 'Custom text in header login page', '4', 'Testing Environment', '3'); +INSERT INTO parameters (global_unit_type_id, `key`, `description`, `format`, default_value, category) +VALUES ( '4', 'crp_login_header_text', 'Custom text in header login page', '4', 'Testing Environment', '3'); \ No newline at end of file diff --git a/marlo-web/src/main/webapp/WEB-INF/global/pages/header.ftl b/marlo-web/src/main/webapp/WEB-INF/global/pages/header.ftl index c8fa9b9404..9dc1438952 100644 --- a/marlo-web/src/main/webapp/WEB-INF/global/pages/header.ftl +++ b/marlo-web/src/main/webapp/WEB-INF/global/pages/header.ftl @@ -128,7 +128,7 @@ [/#if]
[#-- Testing Environment --] - [#if !config.production]

Testing Environment

[/#if] + [#if !config.production]

${(customTextHeader)!'Testing Environment'}

[/#if] [#-- Closed --]

[#if crpClosed] Closed [/#if]