Author: ashish
Date: Mon Jun 27 08:14:21 2016 New Revision: 1750306 URL: http://svn.apache.org/viewvc?rev=1750306&view=rev Log: Applied patch from jira issue OFBIZ-7565 - Remove HtmlFormWrapper dependencies from Survey Question Screen. Thanks Ravi for the contribution. Added: ofbiz/trunk/applications/content/groovyScripts/survey/SurveyOptions.ftl Modified: ofbiz/trunk/applications/content/groovyScripts/survey/EditSurveyQuestions.groovy ofbiz/trunk/applications/content/template/survey/EditSurveyQuestions.ftl ofbiz/trunk/applications/content/widget/SurveyScreens.xml Modified: ofbiz/trunk/applications/content/groovyScripts/survey/EditSurveyQuestions.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/groovyScripts/survey/EditSurveyQuestions.groovy?rev=1750306&r1=1750305&r2=1750306&view=diff ============================================================================== --- ofbiz/trunk/applications/content/groovyScripts/survey/EditSurveyQuestions.groovy (original) +++ ofbiz/trunk/applications/content/groovyScripts/survey/EditSurveyQuestions.groovy Mon Jun 27 08:14:21 2016 @@ -20,7 +20,6 @@ import org.ofbiz.entity.* import org.ofbiz.entity.condition.* import org.ofbiz.base.util.* -import org.ofbiz.widget.renderer.html.* surveyQuestionId = parameters.surveyQuestionId; context.surveyQuestionId = surveyQuestionId; @@ -31,20 +30,11 @@ surveyQuestionAndApplList = from("Survey surveyPageList = from("SurveyPage").where("surveyId", surveyId).orderBy("sequenceNum").queryList(); surveyMultiRespList = from("SurveyMultiResp").where("surveyId", surveyId).orderBy("multiRespTitle").queryList(); -HtmlFormWrapper createSurveyQuestionWrapper = new HtmlFormWrapper("component://content/widget/survey/SurveyForms.xml", "CreateSurveyQuestion", request, response); -createSurveyQuestionWrapper.putInContext("surveyId", surveyId); -createSurveyQuestionWrapper.putInContext("surveyQuestion", surveyQuestion); - -HtmlFormWrapper createSurveyQuestionCategoryWrapper = new HtmlFormWrapper("component://content/widget/survey/SurveyForms.xml", "CreateSurveyQuestionCategory", request, response); -createSurveyQuestionCategoryWrapper.putInContext("surveyId", surveyId); - if (surveyQuestion && surveyQuestion.surveyQuestionTypeId && "OPTION".equals(surveyQuestion.surveyQuestionTypeId)) { // get the options questionOptions = from("SurveyQuestionOption").where("surveyQuestionId", surveyQuestionId).orderBy("sequenceNum").queryList(); context.questionOptions = questionOptions; - HtmlFormWrapper createSurveyOptionWrapper = new HtmlFormWrapper("component://content/widget/survey/SurveyForms.xml", "CreateSurveyQuestionOption", request, response); - // survey question option optionSeqId = parameters.surveyOptionSeqId; surveyQuestionOption = null; @@ -52,11 +42,6 @@ if (surveyQuestion && surveyQuestion.sur surveyQuestionOption = from("SurveyQuestionOption").where("surveyQuestionId", surveyQuestionId, "surveyOptionSeqId", optionSeqId).queryOne(); } context.surveyQuestionOption = surveyQuestionOption; - - createSurveyOptionWrapper.putInContext("surveyQuestionOption", surveyQuestionOption); - createSurveyOptionWrapper.putInContext("surveyQuestionId", surveyQuestionId); - createSurveyOptionWrapper.putInContext("surveyId", surveyId); - context.createSurveyOptionWrapper = createSurveyOptionWrapper; } surveyQuestionCategoryId = parameters.surveyQuestionCategoryId; @@ -74,10 +59,6 @@ context.surveyQuestion = surveyQuestion; context.surveyQuestionAndApplList = surveyQuestionAndApplList; context.surveyPageList = surveyPageList; context.surveyMultiRespList = surveyMultiRespList; - -context.createSurveyQuestionWrapper = createSurveyQuestionWrapper; -context.createSurveyQuestionCategoryWrapper = createSurveyQuestionCategoryWrapper; - context.surveyQuestionCategory = surveyQuestionCategory; context.categoryQuestions = categoryQuestions; context.questionCategories = questionCategories; Added: ofbiz/trunk/applications/content/groovyScripts/survey/SurveyOptions.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/groovyScripts/survey/SurveyOptions.ftl?rev=1750306&view=auto ============================================================================== --- ofbiz/trunk/applications/content/groovyScripts/survey/SurveyOptions.ftl (added) +++ ofbiz/trunk/applications/content/groovyScripts/survey/SurveyOptions.ftl Mon Jun 27 08:14:21 2016 @@ -0,0 +1,35 @@ +<div class="screenlet"> + <div class="screenlet-title-bar"> + <ul> + <li class="h3">${uiLabelMap.ContentSurveyOptions} - ${uiLabelMap.CommonId} ${surveyQuestion.surveyQuestionId!}</li> + </ul> + <br class="clear"/> + </div> + <div class="screenlet-body"> + <table class="basic-table hover-bar" cellspacing="0"> + <tr class="header-row"> + <td>${uiLabelMap.CommonDescription}</td> + <td>${uiLabelMap.CommonSequenceNum}</td> + <td> </td> + <td> </td> + </tr> + <#assign alt_row = false> + <#list questionOptions as option> + <tr<#if alt_row> class="alternate-row"</#if>> + <td>${option.description!}</td> + <td>${option.sequenceNum!}</td> + <td><a href="<@ofbizUrl>EditSurveyQuestions?surveyId=${requestParameters.surveyId}&surveyQuestionId=${option.surveyQuestionId}&surveyOptionSeqId=${option.surveyOptionSeqId}</@ofbizUrl>" class="buttontext">${uiLabelMap.CommonEdit}</a></td> + <td> + <form id="deleteSurveyQuestionOption_${option_index}" action="<@ofbizUrl>deleteSurveyQuestionOption</@ofbizUrl>" method="post"> + <input type="hidden" name="surveyId" value="${requestParameters.surveyId}" /> + <input type="hidden" name="surveyQuestionId" value="${option.surveyQuestionId}" /> + <input type="hidden" name="surveyOptionSeqId" value="${option.surveyOptionSeqId}" /> + <a href="javascript:document.getElementById('deleteSurveyQuestionOption_${option_index}').submit();"" class="buttontext">${uiLabelMap.CommonRemove}</a> + </form> + </td> + </tr> + <#assign alt_row = !alt_row> + </#list> + </table> + </div> +</div> \ No newline at end of file Modified: ofbiz/trunk/applications/content/template/survey/EditSurveyQuestions.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/template/survey/EditSurveyQuestions.ftl?rev=1750306&r1=1750305&r2=1750306&view=diff ============================================================================== --- ofbiz/trunk/applications/content/template/survey/EditSurveyQuestions.ftl (original) +++ ofbiz/trunk/applications/content/template/survey/EditSurveyQuestions.ftl Mon Jun 27 08:14:21 2016 @@ -225,101 +225,4 @@ under the License. <input type="submit" value="${uiLabelMap.CommonApply}" class="smallSubmit"/> </form> </div> -</div> -<div class="screenlet"> - <#-- new question / category --> - <#if requestParameters.newCategory?default("N") == "Y"> - <div class="screenlet-title-bar"> - <ul> - <li class="h3">${uiLabelMap.ContentSurveyCreateQuestionCategory}</li> - </ul> - <br class="clear"/> - </div> - <div class="screenlet-body"> - <a href="<@ofbizUrl>EditSurveyQuestions?surveyId=${requestParameters.surveyId}</@ofbizUrl>" class="buttontext">${uiLabelMap.CommonNew} ${uiLabelMap.ContentSurveyQuestion}</a> - <br /><br /> - ${createSurveyQuestionCategoryWrapper.renderFormString(context)} - <#else> - <#if surveyQuestionId?has_content> - <div class="screenlet-title-bar"> - <ul> - <li class="h3">${uiLabelMap.CommonEdit} ${uiLabelMap.ContentSurveyQuestion}</li> - </ul> - <br class="clear"/> - </div> - <div class="screenlet-body"> - <a href="<@ofbizUrl>EditSurveyQuestions?surveyId=${requestParameters.surveyId}</@ofbizUrl>" class="buttontext">${uiLabelMap.CommonNew} ${uiLabelMap.ContentSurveyQuestion}</a> - <#else> - <div class="screenlet-title-bar"> - <ul> - <li class="h3">${uiLabelMap.ContentSurveyCreateQuestion}</li> - </ul> - <br class="clear"/> - </div> - <div class="screenlet-body"> - </#if> - <a href="<@ofbizUrl>EditSurveyQuestions?surveyId=${requestParameters.surveyId}&newCategory=Y</@ofbizUrl>" class="buttontext">${uiLabelMap.CommonNew} ${uiLabelMap.ContentSurveyQuestion} ${uiLabelMap.ContentSurveryCategory}</a> - <br /><br /> - ${createSurveyQuestionWrapper.renderFormString(context)} - </#if> - </div> -</div> -<#if (surveyQuestion?has_content && surveyQuestion.surveyQuestionTypeId?default("") == "OPTION")> -<div class="screenlet"> - <div class="screenlet-title-bar"> - <ul> - <li class="h3">${uiLabelMap.ContentSurveyOptions} - ${uiLabelMap.CommonId} ${surveyQuestion.surveyQuestionId!}</li> - </ul> - <br class="clear"/> - </div> - <div class="screenlet-body"> - <table class="basic-table hover-bar" cellspacing="0"> - <tr class="header-row"> - <td>${uiLabelMap.CommonDescription}</td> - <td>${uiLabelMap.CommonSequenceNum}</td> - <td> </td> - <td> </td> - </tr> - <#assign alt_row = false> - <#list questionOptions as option> - <tr<#if alt_row> class="alternate-row"</#if>> - <td>${option.description!}</td> - <td>${option.sequenceNum!}</td> - <td><a href="<@ofbizUrl>EditSurveyQuestions?surveyId=${requestParameters.surveyId}&surveyQuestionId=${option.surveyQuestionId}&surveyOptionSeqId=${option.surveyOptionSeqId}</@ofbizUrl>" class="buttontext">${uiLabelMap.CommonEdit}</a></td> - <td> - <form id="deleteSurveyQuestionOption_${option_index}" action="<@ofbizUrl>deleteSurveyQuestionOption</@ofbizUrl>" method="post"> - <input type="hidden" name="surveyId" value="${requestParameters.surveyId}" /> - <input type="hidden" name="surveyQuestionId" value="${option.surveyQuestionId}" /> - <input type="hidden" name="surveyOptionSeqId" value="${option.surveyOptionSeqId}" /> - <a href="javascript:document.getElementById('deleteSurveyQuestionOption_${option_index}').submit();"" class="buttontext">${uiLabelMap.CommonRemove}</a> - </form> - </td> - </tr> - <#assign alt_row = !alt_row> - </#list> - </table> - </div> -</div> -<div class="screenlet"> - <#if !surveyQuestionOption?has_content> - <div class="screenlet-title-bar"> - <ul> - <li class="h3">${uiLabelMap.ContentSurveyCreateQuestionOption}</li> - </ul> - <br class="clear"/> - </div> - <div class="screenlet-body"> - <#else> - <div class="screenlet-title-bar"> - <ul> - <li class="h3">${uiLabelMap.ContentSurveyEditQuestionOption}</li> - </ul> - <br class="clear"/> - </div> - <div class="screenlet-body"> - <a href="<@ofbizUrl>EditSurveyQuestions?surveyId=${requestParameters.surveyId}&surveyQuestionId=${surveyQuestionOption.surveyQuestionId}</@ofbizUrl>" class="buttontext">[${uiLabelMap.CommonNew} ${uiLabelMap.ContentSurveyOption}]</a> - </#if> - ${createSurveyOptionWrapper.renderFormString()} - </div> -</div> -</#if> +</div> \ No newline at end of file Modified: ofbiz/trunk/applications/content/widget/SurveyScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/widget/SurveyScreens.xml?rev=1750306&r1=1750305&r2=1750306&view=diff ============================================================================== --- ofbiz/trunk/applications/content/widget/SurveyScreens.xml (original) +++ ofbiz/trunk/applications/content/widget/SurveyScreens.xml Mon Jun 27 08:14:21 2016 @@ -177,6 +177,7 @@ under the License. <set field="tabButtonItem" value="SurveyQuestions"/> <set field="labelTitleProperty" value="PageTitleEditSurveyQuestions"/> + <set field="newCategory" from-field="parameters.newCategory" default-value="N"/> <set field="surveyId" from-field="parameters.surveyId"/> <entity-one entity-name="Survey" value-field="survey"/> @@ -191,7 +192,85 @@ under the License. <include-form name="ListSurveyQuestions" location="component://content/widget/survey/SurveyForms.xml"/> <include-form name="CreateSurveyQuestion" location="component://content/widget/survey/SurveyForms.xml"/> --> - + <section> + <condition> + <if-compare operator="equals" value="Y" field="newCategory"/> + </condition> + <widgets> + <screenlet title="${uiLabelMap.ContentSurveyCreateQuestionCategory}"> + <container style="button-bar"> + <link target="EditSurveyQuestions" text="${uiLabelMap.CommonNew} ${uiLabelMap.ContentSurveyQuestion}" style="buttontext"> + <parameter param-name="surveyId" from-field="parameters.surveyId"/> + </link> + </container> + <include-form name="CreateSurveyQuestionCategory" location="component://content/widget/survey/SurveyForms.xml"/> + </screenlet> + </widgets> + <fail-widgets> + <section> + <condition> + <not><if-empty field="surveyQuestionId"/></not> + </condition> + <widgets> + <screenlet title="${uiLabelMap.CommonEdit} ${uiLabelMap.ContentSurveyQuestion}"> + <container style="button-bar"> + <link target="EditSurveyQuestions" text="${uiLabelMap.CommonNew} ${uiLabelMap.ContentSurveyQuestion}" style="buttontext"> + <parameter param-name="surveyId" from-field="parameters.surveyId"/> + </link> + <link target="EditSurveyQuestions" text="${uiLabelMap.CommonNew} ${uiLabelMap.ContentSurveyQuestion} ${uiLabelMap.ContentSurveryCategory}" style="buttontext"> + <parameter param-name="surveyId" from-field="parameters.surveyId"/> + <parameter param-name="newCategory" value="Y"/> + </link> + </container> + <include-form name="CreateSurveyQuestion" location="component://content/widget/survey/SurveyForms.xml"/> + </screenlet> + </widgets> + <fail-widgets> + <screenlet title="${uiLabelMap.ContentSurveyCreateQuestion}"> + <container style="button-bar"> + <link target="EditSurveyQuestions" text="${uiLabelMap.CommonNew} ${uiLabelMap.ContentSurveyQuestion} ${uiLabelMap.ContentSurveryCategory}" style="buttontext"> + <parameter param-name="surveyId" from-field="parameters.surveyId"/> + <parameter param-name="newCategory" value="Y"/> + </link> + </container> + <include-form name="CreateSurveyQuestion" location="component://content/widget/survey/SurveyForms.xml"/> + </screenlet> + </fail-widgets> + </section> + </fail-widgets> + </section> + <section> + <condition> + <and> + <not><if-empty field="surveyQuestion"/></not> + <if-compare operator="equals" value="OPTION" field="surveyQuestion.surveyQuestionTypeId"/> + </and> + </condition> + <widgets> + <platform-specific><html><html-template location="component://content/template/survey/SurveyOptions.ftl"/></html></platform-specific> + <section> + <condition> + <if-empty field="surveyQuestionOption"/> + </condition> + <widgets> + <screenlet title="${uiLabelMap.ContentSurveyCreateQuestionOption}"> + <include-form name="CreateSurveyQuestionOption" location="component://content/widget/survey/SurveyForms.xml"/> + </screenlet> + </widgets> + <fail-widgets> + <screenlet title="${uiLabelMap.ContentSurveyEditQuestionOption}"> + <container style="button-bar"> + <link target="EditSurveyQuestions" text="${uiLabelMap.CommonNew} ${uiLabelMap.ContentSurveyOption}" style="buttontext"> + <parameter param-name="surveyId" from-field="parameters.surveyId"/> + <parameter param-name="surveyQuestionId" from-field="surveyQuestionOption.surveyQuestionId"/> + </link> + </container> + <include-form name="CreateSurveyQuestionOption" location="component://content/widget/survey/SurveyForms.xml"/> + </screenlet> + </fail-widgets> + </section> + </widgets> + </section> <screenlet id="SurveyPagePanel" title="${uiLabelMap.PageTitleEditSurveyPages} ${uiLabelMap.ContentSurveySurveyId} ${surveyId}" collapsible="true"> <include-form name="AddSurveyPage" location="component://content/widget/survey/SurveyForms.xml"/> </screenlet> |
Free forum by Nabble | Edit this page |