You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by as...@apache.org on 2016/07/05 14:07:47 UTC
svn commit: r1751483 - in /ofbiz/trunk/applications/content:
groovyScripts/survey/EditSurveyQuestions.groovy
template/survey/EditSurveyQuestions.ftl
Author: ashish
Date: Tue Jul 5 14:07:47 2016
New Revision: 1751483
URL: http://svn.apache.org/viewvc?rev=1751483&view=rev
Log:
Applied patch from jira issue - OFBIZ-6214 - Have overview of questions in EditSurveyQuestions.ftl paginate properly.
Thanks Pierre for creating the issue and thanks Yashwant for providing the patch.
Modified:
ofbiz/trunk/applications/content/groovyScripts/survey/EditSurveyQuestions.groovy
ofbiz/trunk/applications/content/template/survey/EditSurveyQuestions.ftl
Modified: ofbiz/trunk/applications/content/groovyScripts/survey/EditSurveyQuestions.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/groovyScripts/survey/EditSurveyQuestions.groovy?rev=1751483&r1=1751482&r2=1751483&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/groovyScripts/survey/EditSurveyQuestions.groovy (original)
+++ ofbiz/trunk/applications/content/groovyScripts/survey/EditSurveyQuestions.groovy Tue Jul 5 14:07:47 2016
@@ -26,7 +26,33 @@ context.surveyQuestionId = surveyQuestio
surveyQuestion = from("SurveyQuestion").where("surveyQuestionId", surveyQuestionId).queryOne();
-surveyQuestionAndApplList = from("SurveyQuestionAndAppl").where("surveyId", surveyId).orderBy("sequenceNum").queryList();
+viewIndex = parameters.VIEW_INDEX ? Integer.valueOf(parameters.VIEW_INDEX) : 0;
+viewSize = parameters.VIEW_SIZE ? Integer.valueOf(parameters.VIEW_SIZE) : 20;
+
+int lowIndex = viewIndex * viewSize + 1;
+int highIndex = (viewIndex + 1) * viewSize;
+
+context.viewIndexFirst = 0;
+context.viewIndex = viewIndex;
+context.viewIndexPrevious = viewIndex - 1;
+context.viewIndexNext = viewIndex + 1;
+context.viewSize = viewSize;
+context.lowIndex = lowIndex;
+int listSize = 0;
+
+listIt = from("SurveyQuestionAndAppl").where("surveyId", surveyId).orderBy("sequenceNum").cursorScrollInsensitive().cache(true).queryIterator();
+surveyQuestionAndApplList = listIt.getPartialList(lowIndex, highIndex - lowIndex + 1);
+
+listSize = listIt.getResultsSizeAfterPartialList();
+if (listSize < highIndex) {
+ highIndex = listSize;
+}
+
+context.viewIndexLast = (int) (listSize / viewSize);
+context.highIndex = highIndex;
+context.listSize = listSize;
+listIt.close();
+
surveyPageList = from("SurveyPage").where("surveyId", surveyId).orderBy("sequenceNum").queryList();
surveyMultiRespList = from("SurveyMultiResp").where("surveyId", surveyId).orderBy("multiRespTitle").queryList();
Modified: ofbiz/trunk/applications/content/template/survey/EditSurveyQuestions.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/template/survey/EditSurveyQuestions.ftl?rev=1751483&r1=1751482&r2=1751483&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/template/survey/EditSurveyQuestions.ftl (original)
+++ ofbiz/trunk/applications/content/template/survey/EditSurveyQuestions.ftl Tue Jul 5 14:07:47 2016
@@ -17,13 +17,12 @@ specific language governing permissions
under the License.
-->
<div class="screenlet">
- <div class="screenlet-title-bar">
- <ul>
- <li class="h3">${uiLabelMap.PageTitleEditSurveyQuestions} ${uiLabelMap.ContentSurveySurveyId} ${surveyId}</li>
- </ul>
- <br class="clear"/>
- </div>
- <div class="screenlet-body">
+ <div class="screenlet-body no-padding">
+ <h3>${uiLabelMap.PageTitleEditSurveyQuestions} ${uiLabelMap.ContentSurveySurveyId} ${surveyId}</h3>
+ <#assign commonUrl="EditSurveyQuestions?surveyId=${parameters.surveyId}&" />
+ <#assign messageMap = Static["org.ofbiz.base.util.UtilMisc"].toMap("lowCount", lowIndex, "highCount", highIndex, "total", listSize)/>
+ <#assign commonDisplaying = Static["org.ofbiz.base.util.UtilProperties"].getMessage("CommonUiLabels", "CommonDisplaying", messageMap, locale)/>
+ <@htmlTemplate.nextPrev commonUrl=commonUrl listSize=listSize viewSize=viewSize viewIndex=viewIndex highIndex=highIndex commonDisplaying=commonDisplaying/>
<table class="basic-table hover-bar" cellspacing="0">
<tr class="header-row">
<td>${uiLabelMap.CommonId}</td>
@@ -53,7 +52,6 @@ under the License.
<#else>
<#assign currentSurveyMultiRespColumns = []/>
</#if>
-
<tr<#if alt_row> class="alternate-row"</#if>>
<form method="post" action="<@o...@ofbizUrl>">
<input type="hidden" name="surveyId" value="${surveyQuestionAndAppl.surveyId}" />