Skip to content

Commit

Permalink
Merge pull request #418 from devgateway/hotfix/v2.12.6.5
Browse files Browse the repository at this point in the history
Hotfix/v2.12.6.5
  • Loading branch information
jdeanquin-dg authored Nov 4, 2016
2 parents 8a84829 + 93d04f5 commit 3383141
Show file tree
Hide file tree
Showing 12 changed files with 87 additions and 55 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@
"amp.gis:title-Poverty": "Poverty",
"amp.gis:title-NoAccesstosafewater": "No Access to safe water",
"amp.gis:menu-title-FundingData": "Funding Data",
"amp.gis:menu-title-MyLayers":"My Layers",
"amp.gis:menu-title-StandardLayers":"Standard Layers",
"amp.gis:menu-title-SharedLayers":"Shared Layers",
"amp.gis:menu-title-filters": "Apply filters to the map.",
"amp.gis:apply-button": "Apply",
"amp.gis:title-filters": "Filter",
Expand Down Expand Up @@ -101,5 +104,6 @@
"amp.gis:leaflet-button-zoom-out[title]":"Zoom out",
"amp.gis:page-title":"Aid Management Platform - GIS",
"amp.gis:title-gap-analysis-selector":"Gap Analysis View Available",
"amp.gis:title-gap-analysis-tooltip[title]":"Gap analysis calculates the amount of funding by location spent per the selected indicator. Example: Amount spent for each person with no access to safe water in each district. Filters should be used to specify funding for the appropriate sector (e.g. water and sanitation), etc. Gap analysis is not available for layers that are the 'Ratio: other' type."
"amp.gis:title-gap-analysis-tooltip[title]":"Gap analysis calculates the amount of funding by location spent per the selected indicator. Example: Amount spent for each person with no access to safe water in each district. Filters should be used to specify funding for the appropriate sector (e.g. water and sanitation), etc. Gap analysis is not available for layers that are the 'Ratio: other' type.",
"amp.gis:statistical-layers-btn": "Statistical Layers Manager"
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,14 @@ module.exports = Backbone.View.extend({
// append is important because 'share' is inside same el
// var value = $(self.template()).find('button.hideable').css('display','none').html();

self.$el.append(self.template());
self.$el.append(self.template());
self.$el.find('button.hideable').css('display', 'none')
} else {
// append is important because 'share' is inside same el
self.$el.append(self.template());

self.$el.append(self.template());
}

self.app.translator.translateDOM(self.el);
});
return this;
},
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions amp/TEMPLATE/ampTemplate/site-config.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<!DOCTYPE page [
<!ENTITY ampVersion "2.12.6.4">
<!ENTITY buildDate "31.10.2016">
<!ENTITY ampVersion "2.12.6.5">
<!ENTITY buildDate "4.11.2016">
]>
<site-config>
<site-layout>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;

import javax.jcr.Node;
import javax.jcr.Property;
Expand Down Expand Up @@ -173,17 +174,6 @@ public static AmpActivityVersion saveActivityNewVersion(AmpActivityVersion a, Co
.getMtefProjections().iterator();
updateFundingDetails(ampFundingMTEFProjectionIterator);
}
if (Hibernate.isInitialized(ampFunding.getAgreement())) {
AmpAgreement agg = ampFunding.getAgreement();
if (agg != null) {
if ((agg.getId() == null || agg.getId() < 0L)) {
agg.setId(null);
session.save(agg);
} else {
session.merge(agg);
}
}
}
}

}
Expand Down Expand Up @@ -259,9 +249,9 @@ public static AmpActivityVersion saveActivityNewVersion(AmpActivityVersion a, Co
saveResources(a, session);
saveEditors(session, createNewVersion);
saveComments(a, session,draft);
saveAgreements(session);
}

saveAgreements(a, session, isActivityForm);
saveContacts(a, session,(draft != draftChange));

updateComponentFunding(a, session);
Expand Down Expand Up @@ -590,16 +580,16 @@ private static void saveEditors(Session session, boolean createNewVersion) {
}
}

private static void saveAgreements(Session session) {

AmpAuthWebSession s = (AmpAuthWebSession) org.apache.wicket.Session.get();
HashSet<AmpAgreement> agreements = s.getMetaData(OnePagerConst.AGREEMENT_ITEMS);
// AmpFundiong
if (agreements == null)
return;
Iterator<AmpAgreement> it = agreements.iterator();
while (it.hasNext()) {
AmpAgreement agg = (AmpAgreement) it.next();
/**
* Method to save/update agreements into hibernate session
* @param a the AmpActivityVersion object
* @param session the Hibernate Session
* @param isActivityForm the parameter used to decide the source of the agreements (wicket session, activity object)
*/
private static void saveAgreements(AmpActivityVersion a, Session session, boolean isActivityForm) {
Set<AmpAgreement> agreements = isActivityForm ? getAgreementsFromActivityForm() : getAgreementsFromActivity(a);

for (AmpAgreement agg : agreements) {
if (agg.getId() == null || agg.getId() < 0L) {
agg.setId(null);
session.save(agg);
Expand All @@ -609,6 +599,37 @@ private static void saveAgreements(Session session) {
}
}

/**
* Get the agreements from the Wicket session
* @return Set<AmpAgreement>
*/
private static Set<AmpAgreement> getAgreementsFromActivityForm() {
AmpAuthWebSession s = (AmpAuthWebSession) org.apache.wicket.Session.get();
Set<AmpAgreement> agreements = s.getMetaData(OnePagerConst.AGREEMENT_ITEMS);

return agreements == null ? new HashSet<>() : agreements;
}

/**
* get Agreements from the activity object.
* Usually this method will process activities created/updated via Activity API endpoints
* @param a the AmpActivityVersion object
* @return Set<AmpAgreement>
*/
private static Set<AmpAgreement> getAgreementsFromActivity(AmpActivityVersion a) {
Set<AmpAgreement> agreements = new HashSet<>();

Set<AmpFunding> af = a.getFunding();
if (af != null && Hibernate.isInitialized(af)) {
agreements = af.stream()
.filter(f -> f.getAgreement() != null && Hibernate.isInitialized(f.getAgreement()))
.map(f -> f.getAgreement())
.collect(Collectors.toSet());
}

return agreements;
}

private static void saveResources(AmpActivityVersion a, Session session) {
AmpAuthWebSession s = (AmpAuthWebSession) org.apache.wicket.Session.get();

Expand Down
2 changes: 1 addition & 1 deletion amp/src/main/resources/gis/boundaries/HN/adm-1.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion amp/src/main/resources/gis/boundaries/HN/adm-2.json

Large diffs are not rendered by default.

0 comments on commit 3383141

Please sign in to comment.