Skip to content

Commit

Permalink
Merge branch 'aiccra-staging' into aiccra-dev
Browse files Browse the repository at this point in the history
  • Loading branch information
kenjitm committed Oct 24, 2023
2 parents 850feda + 83b6819 commit 8b47089
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ public class BaseAction extends ActionSupport implements Preparable, SessionAwar

// Variables
private String crpSession;
private String customTextHeader;

protected boolean dataSaved;

Expand Down Expand Up @@ -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 ******************************
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -484,15 +489,6 @@ public TypedTableModel getCaseStudiesTableModel(List<ProjectExpectedStudyInfo> 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
Expand Down Expand Up @@ -536,7 +532,20 @@ public TypedTableModel getCaseStudiesTableModel(List<ProjectExpectedStudyInfo> 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
Original file line number Diff line number Diff line change
@@ -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');
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@
[/#list]
</div>
[#if editable]
<div class="addButtonReference button-green pull-right"><span class="glyphicon glyphicon-plus-sign" aria-hidden="true"></span> Add Reference </div>
<div class="addButtonReference bigAddButton text-center"><span class="glyphicon glyphicon-plus" aria-hidden="true"></span>Add Reference </div>
<div class="clearfix"></div>
[/#if]
</div>
Expand Down
2 changes: 1 addition & 1 deletion marlo-web/src/main/webapp/WEB-INF/global/pages/header.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
[/#if]
<div class="clearfix"></div>
[#-- Testing Environment --]
[#if !config.production]<h4 class="testEnvironment"><span class="label label-danger text-left">Testing Environment</span> </h4>[/#if]
[#if !config.production]<h4 class="testEnvironment"><span class="label label-danger text-left">${(customTextHeader)!'Testing Environment'}</span> </h4>[/#if]
[#-- Closed --]
<h4 class="">[#if crpClosed] <span class="label label-default text-left">Closed</span> [/#if]</h4>
</div>
Expand Down

0 comments on commit 8b47089

Please sign in to comment.