Skip to content

Commit

Permalink
Merge pull request #658 from devgateway/bug/AMP-23930/backport-hotfix
Browse files Browse the repository at this point in the history
Bug/AMP-23930/backport hotfix
  • Loading branch information
mbaralo authored Jan 19, 2017
2 parents 5e11902 + 2c4238a commit b8afc52
Showing 9 changed files with 39 additions and 18 deletions.
9 changes: 9 additions & 0 deletions amp/WEB-INF/fn.tld
Original file line number Diff line number Diff line change
@@ -204,4 +204,13 @@
</example>
</function>

<function>
<description>
Returns the correct url for specific report. It can point to legacy or nireports.
</description>
<name>getReportUrl</name>
<function-class>org.digijava.kernel.ampapi.endpoints.reports.ReportsUtil</function-class>
<function-signature>java.lang.String getUrl(org.digijava.module.aim.dbentity.AmpReports)</function-signature>
</function>

</taglib>
Original file line number Diff line number Diff line change
@@ -848,4 +848,14 @@ public static AmountsUnits getAmountsUnitsOrDefault(ReportSpecification spec) {
return spec.getSettings().getUnitsOption();
return AmountsUnits.getDefaultValue();
}

public static String getUrl(AmpReports report) {
String prefix;
if (report.getType() != null && report.getType().equals((long) ArConstants.REGIONAL_TYPE)){
prefix = "/aim/viewNewAdvancedReport.do~view=reset&widget=false&resetSettings=true~ampReportId=";
} else {
prefix = "/TEMPLATE/ampTemplate/saikuui_nireports/index_reports.html#report/open/";
}
return prefix + report.getAmpReportId();
}
}
Original file line number Diff line number Diff line change
@@ -664,17 +664,18 @@ protected ActionForward serializeReportAndOpen(AmpReports ampReport, TeamMember
MultilingualInputFieldValues.serialize(ampReport, "name", null, null, request);

if ((request.getParameter("openReport") != null) && request.getParameter("openReport").equals("true")) {
callSaikuReport (ampReport.getAmpReportId().intValue(), response,"openReportId", ampReport.hasAvailableMeasures());
boolean saiku = ampReport.hasAvailableMeasures() && ampReport.getType().intValue() != ArConstants.REGIONAL_TYPE;
callSaikuReport (ampReport.getAmpReportId().intValue(), response,"openReportId", saiku);
}
return null;
}

private void callSaikuReport(Integer reportId, HttpServletResponse response, String varName, boolean hasAvailableMeasures ) throws IOException {
private void callSaikuReport(Integer reportId, HttpServletResponse response, String varName, boolean saiku) throws IOException {
PrintWriter out = response.getWriter();
StringBuilder responseString = new StringBuilder();
responseString.append(varName + "=" + reportId);
responseString.append(",");
responseString.append("saiku=" + hasAvailableMeasures );
responseString.append("saiku=" + saiku);

out.write(responseString.toString());
out.flush();
2 changes: 1 addition & 1 deletion amp/repository/aim/view/myReports.jsp
Original file line number Diff line number Diff line change
@@ -66,7 +66,7 @@ function popup(mylink, windowname)
<logic:notEmpty name="lastViewedReports" scope="session">
<logic:iterate name="lastViewedReports" id="report" scope="session" type="org.digijava.module.aim.dbentity.AmpReports" length="5">
<li class="tri">
<a title="${report.name}" href="/TEMPLATE/ampTemplate/saikuui_nireports/index_reports.html#report/open/${report.ampReportId}" onclick="return popup(this,'');">
<a title="${report.name}" href="${fn:getReportUrl(report)}" onclick="return popup(this,'');">
<c:choose>
<c:when test="${fn:length(report.name) > 50}" >
<c:out value="${fn:substring(report.name, 0, 50)}"/>...
6 changes: 6 additions & 0 deletions amp/repository/aim/view/reportWizard/toolbar.jsp
Original file line number Diff line number Diff line change
@@ -34,6 +34,9 @@
</button>
</feature:display>
<logic:present name="currentMember" scope="session">
<script type="application/javascript">
var currentMemberInSession = true;
</script>
<button style="margin-right:2px;" type="button" name="save" disabled="disabled" onclick="saveReportEngine.saveOverwrite()" class="buttonx_dis"/>
<digi:trn key="rep:wizard:Save">Save</digi:trn>
</button>
@@ -42,6 +45,9 @@
</button>
</logic:present>
<logic:notPresent name="currentMember" scope="session">
<script type="application/javascript">
var currentMemberInSession = false;
</script>
<button style="margin-right:2px;" type="button" name="save" disabled="disabled" onclick="saveReportEngine.executeReport()" class="buttonx_dis"/>
<digi:trn key="rep:wizard:RunReport">Run report...</digi:trn>
</button>
5 changes: 3 additions & 2 deletions amp/repository/aim/view/scripts/reportWizard/reportManager.js
Original file line number Diff line number Diff line change
@@ -361,8 +361,9 @@ NormalReportManager.prototype.callbackRepTypeCall = {

NormalReportManager.prototype.checkReportDetails = function () {
this.enableTab(1);
return true;

// regional reports are not supported by nireports yet
// we either have to be logged in or choose a report different from regional
return currentMemberInSession || getReportType() != "regional";
};

NormalReportManager.prototype.checkMeasures = function () {
9 changes: 3 additions & 6 deletions amp/repository/aim/view/showTeamReports.jsp
Original file line number Diff line number Diff line change
@@ -17,6 +17,7 @@
<%@ taglib uri="/taglib/category" prefix="category" %>

<%@ page language="java" import="org.digijava.module.aim.helper.TeamMember" %>
<%@ page import="org.dgfoundation.amp.ar.ArConstants" %>


<!-- this is for the nice tooltip widgets -->
@@ -465,6 +466,7 @@ $(document).ready(function() {
type="org.digijava.module.aim.dbentity.AmpReports">
<tr onmouseout="setPointer(this, <%=idx.intValue()%>, 'out', <%=(idx.intValue()%2==1?"\'#dbe5f1\'":"\'#ffffff\'")%>, '#a5bcf2', '#FFFF00');"
onmouseover="setPointer(this, <%=idx.intValue()%>, 'over', <%=(idx.intValue()%2==1?"\'#dbe5f1\'":"\'#ffffff\'")%>, '#a5bcf2', '#FFFF00');" >
<c:set var="reportLink" value="${fn:getReportUrl(report)}" />
<%if(idx.intValue()%2==1) color = "#dbe5f1"; %>
<%if(idx.intValue()%2!=1) color = "#ffffff"; %>
<td align="center" class="inside" style="padding-right: 10px; padding-left: 10px;" bgcolor="<%=color%>">
@@ -477,11 +479,6 @@ $(document).ready(function() {
</td>
<td class="inside" style="padding-right: 15px; padding-left: 15px;" bgcolor="<%=color%>">
<c:if test="${!aimTeamReportsForm.showTabs}">
<c:set var="reportLink" value="/TEMPLATE/ampTemplate/saikuui_nireports/index_reports.html#report/open/${report.ampReportId}" />
<!-- link to the report under the Legacy engine
left here for historical and/or debug reasons
/aim/viewNewAdvancedReport.do~view=reset&widget=false&resetSettings=true~ampReportId=REPORT_ID
-->
<a href="${reportLink}" styleClass="h-box" onclick="return popup(this,'');" title="<digi:trn>Click here to view the Report</digi:trn>">
<b> <p style="display: inline; max-width: 400px; white-space: normal" title='<c:out value="${report.name}"/>'>
<c:choose>
@@ -646,7 +643,7 @@ $(document).ready(function() {
<bean:write name="report" property="ampReportId" />
</c:set>
<c:if test="${!aimTeamReportsForm.showTabs}">
<a href="/TEMPLATE/ampTemplate/saikuui_nireports/index_reports.html#report/open/${report.ampReportId}"
<a href="${reportLink}"
onclick="return popup(this,'');" class="img-padding" title="<digi:trn>Click here to view the NiReport in Saiku</digi:trn>">
<img src= "/TEMPLATE/ampTemplate/saikuui_nireports/images/saiku.png" border="0" /></a>
</c:if>
7 changes: 2 additions & 5 deletions amp/repository/aim/view/showTeamReportsPublic.jsp
Original file line number Diff line number Diff line change
@@ -340,14 +340,11 @@ function submitForm(action){
<c:set var="nameTooltip">
<digi:trn>Click here to view the Report</digi:trn>
</c:set>
<c:set var="reportLink" value="${fn:getReportUrl(report)}" />
<td class="report_inside" style="font-size: 11px;"
bgcolor="${color}">
<div class="t_sm" title="${report.name}">

<%-- <c:set var="reportLink" value="/aim/viewNewAdvancedReport.do~view=reset&widget=false&resetSettings=true~ampReportId=${report.ampReportId}"/> --%>

<c:set var="reportLink" value="/TEMPLATE/ampTemplate/saikuui_nireports/index_reports.html#report/open/${report.ampReportId}" />

<a
href="${reportLink}"
onclick="return popup(this,'');"
@@ -462,7 +459,7 @@ function submitForm(action){
</c:set>
<c:set target="${urlParams}" property="event" value="edit" />

<a href="/TEMPLATE/ampTemplate/saikuui_nireports/index_reports.html#report/open/${report.ampReportId}"
<a href="${reportLink}"
onclick="return popup(this,'');" style="padding-right: 5px;" title="<digi:trn>Click here to view the NiReport in Saiku</digi:trn>">
<img src= "/TEMPLATE/ampTemplate/saikuui_nireports/images/saiku.png" border="0" /></a>

2 changes: 1 addition & 1 deletion amp/repository/search/view/search.jsp
Original file line number Diff line number Diff line change
@@ -260,7 +260,7 @@
<c:forEach items="${resultReports}" var="report">
<li><a title="<digi:trn>Click here to view the report</digi:trn>"
onclick="return popup(this,'');"
href="/TEMPLATE/ampTemplate/saikuui_nireports/index_reports.html#report/open/${report.ampReportId}">
href="${fn:getReportUrl(report)}">
${report.objectFilteredName}
</a>
</li>

0 comments on commit b8afc52

Please sign in to comment.