<#-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <#macro renderSurveyQuestionText surveyQuestionAndAppl>
${surveyQuestionAndAppl.question?if_exists}
<#if surveyQuestionAndAppl.hint?has_content>
${surveyQuestionAndAppl.hint}
<#macro renderSurveyQuestionRequired surveyQuestionAndAppl> <#if surveyQuestionAndAppl.requiredField?default("N") == "Y"> *[required] <#else/> [optional] <#macro renderSurveyQuestionInput surveyQuestionAndAppl questionFieldName> <#if surveyQuestionAndAppl.surveyQuestionTypeId == "BOOLEAN"> <#assign selectedOption = (answer.booleanResponse)?default("Y")> <#elseif surveyQuestionAndAppl.surveyQuestionTypeId == "TEXTAREA"/> <#elseif surveyQuestionAndAppl.surveyQuestionTypeId == "TEXT_SHORT"/> <#elseif surveyQuestionAndAppl.surveyQuestionTypeId == "TEXT_LONG"/> <#elseif surveyQuestionAndAppl.surveyQuestionTypeId == "EMAIL"/> <#elseif surveyQuestionAndAppl.surveyQuestionTypeId == "URL"/> <#elseif surveyQuestionAndAppl.surveyQuestionTypeId == "DATE"/> <#elseif surveyQuestionAndAppl.surveyQuestionTypeId == "CREDIT_CARD"/> <#elseif surveyQuestionAndAppl.surveyQuestionTypeId == "GIFT_CARD"/> <#elseif surveyQuestionAndAppl.surveyQuestionTypeId == "NUMBER_CURRENCY"/> <#elseif surveyQuestionAndAppl.surveyQuestionTypeId == "NUMBER_FLOAT"/> <#elseif surveyQuestionAndAppl.surveyQuestionTypeId == "NUMBER_LONG"/> <#elseif surveyQuestionAndAppl.surveyQuestionTypeId == "PASSWORD"/> <#elseif surveyQuestionAndAppl.surveyQuestionTypeId == "CONTENT"/> <#if (answer.contentId)?has_content> <#assign content = answer.getRelatedOne("Content")> ${answer.contentId} - ${content.contentName?if_exists}    <#elseif surveyQuestionAndAppl.surveyQuestionTypeId == "OPTION"/> <#assign options = surveyQuestionAndAppl.getRelated("SurveyQuestionOption", sequenceSort)?if_exists/> <#assign selectedOption = (answer.surveyOptionSeqId)?default("_NA_")/> <#elseif surveyQuestionAndAppl.surveyQuestionTypeId == "ENUMERATION"/> <#elseif surveyQuestionAndAppl.surveyQuestionTypeId == "GEO"/> <#elseif surveyQuestionAndAppl.surveyQuestionTypeId == "STATE_PROVINCE"/> <#elseif surveyQuestionAndAppl.surveyQuestionTypeId == "COUNTRY"/> <#else/>
Unsupported question type : ${surveyQuestionAndAppl.surveyQuestionTypeId}
<#if additionalFields?has_content> <#list additionalFields.keySet() as field> <#-- update response --> <#if surveyResponseId?has_content> <#-- party ID --> <#if partyId?has_content> <#-- survey ID -->

${survey.description?if_exists}


<#if survey.comments?has_content>
${survey.comments}

<#assign lastSurveyMultiRespId = ""/> <#assign haveOpenMultiRespHeader = false/> <#list surveyQuestionAndAppls as surveyQuestionAndAppl> <#if !alreadyShownSqaaPkWithColId.contains(surveyQuestionAndAppl.getPrimaryKey())> <#-- Get and setup MultiResp info for this question --> <#assign openMultiRespHeader = false/> <#assign closeMultiRespHeader = false/> <#assign surveyMultiResp = surveyQuestionAndAppl.getRelatedOneCache("SurveyMultiResp")?if_exists/> <#if surveyMultiResp?has_content> <#assign surveyMultiRespColumnList = surveyMultiResp.getRelatedCache("SurveyMultiRespColumn", Static["org.ofbiz.base.util.UtilMisc"].toList("sequenceNum"))/> <#if lastSurveyMultiRespId == ""> <#assign openMultiRespHeader = true/> <#elseif lastSurveyMultiRespId != surveyMultiResp.surveyMultiRespId> <#assign openMultiRespHeader = true/> <#assign closeMultiRespHeader = true/> <#assign lastSurveyMultiRespId = surveyMultiResp.surveyMultiRespId/> <#else/> <#if lastSurveyMultiRespId?has_content><#assign closeMultiRespHeader = true/> <#assign lastSurveyMultiRespId = ""/> <#-- this is before the rest because it will be done if the current row is not a MultiResp (or is different MultiResp) but the last row was... --> <#if closeMultiRespHeader> <#assign haveOpenMultiRespHeader = false/>
<#-- --> <#if openMultiRespHeader> <#assign haveOpenMultiRespHeader = true/> <#list surveyMultiRespColumnList as surveyMultiRespColumn> <#-- placeholder for required/optional column --> <#if surveyMultiResp?has_content> <#assign sqaaWithColIdList = (sqaaWithColIdListByMultiRespId[surveyMultiResp.surveyMultiRespId])?if_exists/> <#list surveyMultiRespColumnList as surveyMultiRespColumn> <#else/> <#-- special formatting for select boxes --> <#assign align = "left"/> <#if surveyQuestionAndAppl?exists && surveyQuestionAndAppl.surveyQuestionTypeId?has_content> <#if (surveyQuestionAndAppl.surveyQuestionTypeId == "BOOLEAN" || surveyQuestionAndAppl.surveyQuestionTypeId == "CONTENT" || surveyQuestionAndAppl.surveyQuestionTypeId == "OPTION")> <#assign align = "right"/> <#-- get an answer from the answerMap --> <#if surveyAnswers?has_content> <#assign answer = surveyAnswers.get(surveyQuestionAndAppl.surveyQuestionId)?if_exists/> <#-- get the default value from value map --> <#if defaultValues?has_content> <#assign defValue = defaultValues.get(surveyQuestionAndAppl.surveyQuestionId)?if_exists/> <#if surveyQuestionAndAppl?exists && surveyQuestionAndAppl.surveyQuestionTypeId?has_content> <#-- seperator options --> <#if surveyQuestionAndAppl.surveyQuestionTypeId == "SEPERATOR_TEXT"> <#elseif surveyQuestionAndAppl.surveyQuestionTypeId == "SEPERATOR_LINE"/> <#else/> <#-- standard question options --> <#-- one last check for a multi-resp table left open before moving on, will happen if last question was in a multi-resp --> <#if haveOpenMultiRespHeader>
${surveyMultiResp.multiRespTitle?default(" ")}
${surveyMultiRespColumn.columnTitle?default(" ")}
Required?
<@renderSurveyQuestionText surveyQuestionAndAppl=surveyQuestionAndAppl/> <#-- if there is a surveyMultiRespColId on the surveyQuestionAndAppl use the corresponding surveyQuestionId; these should be in the same order as the surveyQuestionAndAppls List, so just see if it matches the first in the list --> <#if sqaaWithColIdList?has_content><#assign nextSqaaWithColId = sqaaWithColIdList?first/><#else/><#assign nextSqaaWithColId = []> <#if surveyQuestionAndAppl.surveyMultiRespColId?has_content && nextSqaaWithColId?has_content && nextSqaaWithColId.surveyMultiRespColId = surveyMultiRespColumn.surveyMultiRespColId> <#assign dummySqaaWithColId = Static["org.ofbiz.base.util.UtilMisc"].removeFirst(sqaaWithColIdList)/> <#assign changed = alreadyShownSqaaPkWithColId.add(nextSqaaWithColId.getPrimaryKey())/> <#assign questionFieldName = "answers_" + nextSqaaWithColId.surveyQuestionId + "_" + surveyMultiRespColumn.surveyMultiRespColId/> <#else/> <#assign questionFieldName = "answers_" + surveyQuestionAndAppl.surveyQuestionId + "_" + surveyMultiRespColumn.surveyMultiRespColId/> <@renderSurveyQuestionInput surveyQuestionAndAppl=surveyQuestionAndAppl questionFieldName=questionFieldName/> <@renderSurveyQuestionRequired surveyQuestionAndAppl=surveyQuestionAndAppl/>
${surveyQuestionAndAppl.question?if_exists}

<@renderSurveyQuestionText surveyQuestionAndAppl=surveyQuestionAndAppl/>   <#assign questionFieldName = "answers_" + surveyQuestionAndAppl.surveyQuestionId/> <@renderSurveyQuestionInput surveyQuestionAndAppl=surveyQuestionAndAppl questionFieldName=questionFieldName/> <@renderSurveyQuestionRequired surveyQuestionAndAppl=surveyQuestionAndAppl/>