Skip to content

Commit

Permalink
Merge branch 'aiccra-shfrm-contribution-functionality' into aiccra-dev
Browse files Browse the repository at this point in the history
  • Loading branch information
kenjitm committed Feb 21, 2024
2 parents 12f58d6 + 7354127 commit eff771e
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
import org.cgiar.ccafs.marlo.data.manager.RepositoryChannelManager;
import org.cgiar.ccafs.marlo.data.manager.ShfrmPriorityActionManager;
import org.cgiar.ccafs.marlo.data.manager.ShfrmSubActionManager;
import org.cgiar.ccafs.marlo.data.manager.SoilIndicatorManager;
import org.cgiar.ccafs.marlo.data.manager.UserManager;
import org.cgiar.ccafs.marlo.data.model.Activity;
import org.cgiar.ccafs.marlo.data.model.CgiarCrossCuttingMarker;
Expand Down Expand Up @@ -147,6 +148,7 @@
import org.cgiar.ccafs.marlo.data.model.RepositoryChannel;
import org.cgiar.ccafs.marlo.data.model.ShfrmPriorityAction;
import org.cgiar.ccafs.marlo.data.model.ShfrmSubAction;
import org.cgiar.ccafs.marlo.data.model.SoilIndicator;
import org.cgiar.ccafs.marlo.data.model.User;
import org.cgiar.ccafs.marlo.security.Permission;
import org.cgiar.ccafs.marlo.utils.APConfig;
Expand Down Expand Up @@ -261,6 +263,7 @@ public class DeliverableAction extends BaseAction {
private ShfrmSubActionManager shfrmSubActionManager;
private DeliverableShfrmPriorityActionManager deliverableShfrmPriorityActionManager;
private DeliverableShfrmSubActionManager deliverableShfrmSubActionManager;
private SoilIndicatorManager soilIndicatorManager;

// Variables
private List<DeliverableQualityAnswer> answers;
Expand Down Expand Up @@ -310,6 +313,7 @@ public class DeliverableAction extends BaseAction {
private String DOI;
private String handle;
private String disseminationURL;
private String soilIndicatorsText;


private List<RepIndGenderYouthFocusLevel> focusLevels;
Expand Down Expand Up @@ -363,7 +367,7 @@ public DeliverableAction(APConfig config, DeliverableTypeManager deliverableType
DeliverableTraineesIndicatorManager deliverableTraineesIndicatorManager,
ShfrmPriorityActionManager shfrmPriorityActionManager, ShfrmSubActionManager shfrmSubActionManager,
DeliverableShfrmPriorityActionManager deliverableShfrmPriorityActionManager,
DeliverableShfrmSubActionManager deliverableShfrmSubActionManager) {
DeliverableShfrmSubActionManager deliverableShfrmSubActionManager, SoilIndicatorManager soilIndicatorManager) {
super(config);
this.activityManager = activityManager;
this.deliverableManager = deliverableManager;
Expand Down Expand Up @@ -429,6 +433,7 @@ public DeliverableAction(APConfig config, DeliverableTypeManager deliverableType
this.shfrmSubActionManager = shfrmSubActionManager;
this.deliverableShfrmPriorityActionManager = deliverableShfrmPriorityActionManager;
this.deliverableShfrmSubActionManager = deliverableShfrmSubActionManager;
this.soilIndicatorManager = soilIndicatorManager;
}

/**
Expand All @@ -450,6 +455,7 @@ public DeliverableClusterParticipant actualDeliverableClusterParticipant() {
}
}


@Override
public String cancel() {

Expand All @@ -474,6 +480,7 @@ public String cancel() {
return SUCCESS;
}


public Boolean candEditExpectedYear(long deliverableID) {
Deliverable deliverable = deliverableManager.getDeliverableById(deliverableID);

Expand Down Expand Up @@ -680,6 +687,27 @@ public void fillClusterParticipantsList() {
}
}

public void fillSoilIndicatorsText() {
try {
soilIndicatorsText = null;
List<SoilIndicator> soilIndicators = soilIndicatorManager.findAll();
if (soilIndicators != null && !soilIndicators.isEmpty()) {
for (SoilIndicator soilIndicator : soilIndicators) {
if (soilIndicator != null && soilIndicator.getIndicatorName() != null) {
if (soilIndicatorsText == null) {
soilIndicatorsText = soilIndicator.getIndicatorName();
} else {
soilIndicatorsText.concat(", " + soilIndicator.getIndicatorName());
}
}

}
}
} catch (Exception e) {
Log.info("error getting soil indicators " + e);
}
}

public void fillSubActionsGeneralList() {
try {
if (shfrmPriorityActions != null && !shfrmPriorityActions.isEmpty()) {
Expand Down Expand Up @@ -762,7 +790,6 @@ public List<Activity> getActivities() {
return activities;
}


/**
* Get the ID of the clusterParticipantObject for this cluster in actual phase
*
Expand All @@ -784,15 +811,16 @@ public long getActualClusterParticipantID() {
}
}


public List<DeliverableQualityAnswer> getAnswers() {
return answers;
}


public List<DeliverableQualityAnswer> getAnswersDataDic() {
return answersDataDic;
}


private Path getAutoSaveFilePath() {

// get the class simple name
Expand Down Expand Up @@ -930,20 +958,20 @@ public GlobalUnit getLoggedCrp() {
return loggedCrp;
}


public List<Project> getMyProjects() {
return myProjects;
}


public List<Institution> getPartnerInstitutions() {
return partnerInstitutions;
}


public List<ProjectPartnerPerson> getPartnerPersons() {
return partnerPersons;
}


public List<ProjectPartner> getPartners() {
return partners;
}
Expand Down Expand Up @@ -1038,6 +1066,10 @@ public List<ShfrmPriorityAction> getShfrmPriorityActions() {
return shfrmPriorityActions;
}

public String getSoilIndicatorsText() {
return soilIndicatorsText;
}

public Map<String, String> getStatus() {
return status;
}
Expand Down Expand Up @@ -1586,7 +1618,7 @@ public void prepare() throws Exception {
}
}


this.fillSoilIndicatorsText();
}

// Expected Study Geographic Regions List
Expand Down Expand Up @@ -4429,6 +4461,10 @@ public void setShfrmPriorityActions(List<ShfrmPriorityAction> shfrmPriorityActio
this.shfrmPriorityActions = shfrmPriorityActions;
}

public void setSoilIndicatorsText(String soilIndicatorsText) {
this.soilIndicatorsText = soilIndicatorsText;
}

public void setStatus(Map<String, String> status) {
this.status = status;
}
Expand Down
1 change: 1 addition & 0 deletions marlo-web/src/main/resources/custom/aicrra.properties
Original file line number Diff line number Diff line change
Expand Up @@ -951,6 +951,7 @@ deliverable.shfrmContribution.priorityAction=To which priority action of the SHF
deliverable.shfrmContribution.priorityAction.help=Select a priority action
deliverable.shfrmContribution.subAction=To which specific sub-action of the SHFRM is this deliverable contributing to?
deliverable.shfrmContribution.subAction.help=Select sub-action(s)
deliverable.shfrmContribution.indicators.help=Soil Indicator(s):

intellectualAsset.fillingType=Type of filling
intellectualAsset.patentStatus=Patent status
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE deliverables_info MODIFY COLUMN shfrm_contribution_narrative text CHARACTER SET utf8 COLLATE utf8_general_ci NULL;
1 change: 1 addition & 0 deletions marlo-web/src/main/resources/global.properties
Original file line number Diff line number Diff line change
Expand Up @@ -952,6 +952,7 @@ deliverable.shfrmContribution.priorityAction=To which priority action of the SHF
deliverable.shfrmContribution.priorityAction.help=Select a priority action
deliverable.shfrmContribution.subAction=To which specific sub-action of the SHFRM is this deliverable contributing to?
deliverable.shfrmContribution.subAction.help=Select sub-action(s)
deliverable.shfrmContribution.indicators.help=Soil Indicator(s):

intellectualAsset.fillingType=Type of filling
intellectualAsset.patentStatus=Patent status
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[#assign currentSectionString = "project-${actionName?replace('/','-')}-${expectedID}-phase-${(actualPhase.id)!}" /]
[#assign pageLibs = [ "select2", "blueimp-file-upload", "flag-icon-css", "components-font-awesome"] /]
[#assign customJS = [
"${baseUrlMedia}/js/projects/projectStudy.js?20240219",
"${baseUrlMedia}/js/projects/projectStudy.js?20240221",
"${baseUrlCdn}/global/js/fieldsValidation.js",
"${baseUrlCdn}/crp/js/feedback/feedbackAutoImplementation.js?20231017"
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[#assign currentSectionString = "${actionName?replace('/','-')}-${(expectedStudy.id)!}-phase-${(actualPhase.id)!}" /]
[#assign pageLibs = ["select2" ,"blueimp-file-upload", "flag-icon-css" ] /]
[#assign customJS = [
"${baseUrlMedia}/js/projects/projectStudy.js?20240219",
"${baseUrlMedia}/js/projects/projectStudy.js?20240221",
"${baseUrlCdn}/global/js/fieldsValidation.js"
] /]
[#assign customCSS = [
Expand Down
2 changes: 1 addition & 1 deletion marlo-web/src/main/webapp/crp/js/projects/projectStudy.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ function attachEvents() {
var $element = $('#multiInput-references-template').clone(true).removeAttr("id");
var $listLength = $list.children().length;

if ($listLength <= 20) {
if ($listLength <= 30) {
// Remove template tag
$element.find('input, textarea').each(function (i, e) {
e.name = (e.name).replace("_TEMPLATE_", "");
Expand Down

0 comments on commit eff771e

Please sign in to comment.