Commit bce18cc5 by Kim Gyeongeun

#56952 設問設定機能追加(初期化されない問題修正)

parent b697f54d
......@@ -238,7 +238,7 @@ public class EnqueteAction extends AbstractAction {
*/
@Execute(validator = false,reset="valueReset")
public String confirm() {
ActionMessages actionMessages =enqueteValidate();
if(actionMessages != null && !actionMessages.isEmpty()){
addErrorMessage("errorheader", "errors.enqheader");
......@@ -263,6 +263,15 @@ public class EnqueteAction extends AbstractAction {
return getHtmlPath(enqueteForm.template,confirmPage);
}
/**
* 戻るボタン
* @throws SystemException
*/
@Execute(validator = false)
public String reInput() throws SystemException {
return getHtmlPath(enqueteForm.template,indexPage);
}
public EnqueteSumBatchAction enqueteSumBatchAction;
/**
* アンケート回答確認画面でアンケート回答を押下した場合の処理
......@@ -418,6 +427,9 @@ public class EnqueteAction extends AbstractAction {
//ポイント寄付
Integer orgniz = SinaburoConstant.EnqueteType.ORGANIZATION_CONTRIBUTE;
valueReplace(enqueteForm);
//条件付必須チェック(初期画面表示・非表示セット)
questionService.setQuestionDisable(enqueteForm.questionList);
//回答数を求め、必須チェックを行う。
for(Question question : enqueteForm.questionList){
......@@ -689,9 +701,6 @@ public class EnqueteAction extends AbstractAction {
Answer answer = question.answerList.get(i);
answerIdValue = StringUtil.isNotBlank(answer.answerIdValue) ? answer.answerIdValue :answerIdValue;
if(StringUtil.equals(answerIdValue, answer.answerId.toString()) ){
answer.answerIdValue = answerIdValue;
}else{
......
......@@ -14,8 +14,6 @@ import javax.persistence.Transient;
import org.apache.commons.lang.builder.StandardToStringStyle;
import org.apache.commons.lang.builder.ToStringBuilder;
import jp.agentec.sinaburocast.common.SinaburoConstant;
@Entity
@Table(name="m_answer")
public class Answer extends AbstractEntity {
......@@ -57,9 +55,6 @@ public class Answer extends AbstractEntity {
@Column(name = "default_flg")
public int defaultFlg;
@Transient
public short answerInitDisable = SinaburoConstant.initDisable.NO;
/** MEnquete関連プロパティ */
@ManyToOne
@JoinColumn(name = "enquete_id", referencedColumnName = "enquete_id")
......
......@@ -11,6 +11,7 @@ import org.seasar.extension.jdbc.where.SimpleWhere;
import org.seasar.framework.container.annotation.tiger.Component;
import org.seasar.framework.container.annotation.tiger.InstanceType;
import org.seasar.framework.util.IntegerConversionUtil;
import org.seasar.framework.util.StringUtil;
import jp.agentec.sinaburocast.common.SinaburoConstant;
import jp.agentec.sinaburocast.entity.AdminUser;
......@@ -301,25 +302,20 @@ public class QuestionService extends AbstractService<Question> {
//初期表示情報セット
for (Question question : questionList) {
for (Answer answer : question.answerList) {
if (question.condRequiredQuestionNo != null && question.condRequiredQuestionNo == 0
&& answer.defaultFlg == 1 && requiredQuestionInfo.get(answer.answerId) == null) {
requiredQuestionInfo.put(answer.answerId, answer.defaultFlg);
if (question.condRequiredQuestionNo != null && question.condRequiredQuestionNo == 0 && requiredQuestionInfo.get(answer.answerId) == null) {
if (answer.defaultFlg == 0 && StringUtil.isBlank(answer.answerIdValue)) {continue;}
requiredQuestionInfo.put(answer.answerId, 1);
}
}
}
for (Question question : questionList) {
//条件付必須チェック(初期画面表示・非表示セット)
for (Answer answer : question.answerList) {
if (question.condRequiredQuestionNo != null && question.condRequiredQuestionNo != 0
&& StringUtils.isNotBlank(question.condRequiredAnswer)) {
List<String> requiredAnswerIdList = new ArrayList<String>(Arrays.asList(question.condRequiredAnswer.split(",")));
for (String requiredAnswerId : requiredAnswerIdList) {
if (requiredQuestionInfo.get(IntegerConversionUtil.toInteger(requiredAnswerId)) == null) {
question.questionInitDisable = SinaburoConstant.initDisable.YES;
answer.answerInitDisable = SinaburoConstant.initDisable.YES;
break;
}
}
if (question.condRequiredQuestionNo != null && question.condRequiredQuestionNo != 0
&& StringUtils.isNotBlank(question.condRequiredAnswer)) {
List<String> requiredAnswerIdList = new ArrayList<String>(Arrays.asList(question.condRequiredAnswer.split(",")));
for (String requiredAnswerId : requiredAnswerIdList) {
question.questionInitDisable = (requiredQuestionInfo.get(IntegerConversionUtil.toInteger(requiredAnswerId)) == null) ?
SinaburoConstant.initDisable.YES : SinaburoConstant.initDisable.NO;
}
}
}
......
......@@ -68,7 +68,7 @@ $tools.getMsg("errorheader")
#if($!question.controlId == "0")
<input type="radio" class="#he($!question.questionId)" id="#he($!answer.answerId)" name="$!answerIdValueRadioName" value="$!escape.html($!velocityCount)" #if($!answer.answerIdValue == $velocityCount.toString() && $enqueteForm.initCount =="2") checked #{end}
#if($!answer.defaultFlg == 1 && $enqueteForm.initCount =="1") checked #end
#if($!answer.answerInitDisable == "1") disabled #end />$!answer.answer
#if($!question.questionInitDisable == "1") disabled #end />$!answer.answer
##end
##<!-- 自由入力欄。freeTextFlg=1(あり)、2(必須) -->
......@@ -80,7 +80,7 @@ $tools.getMsg("errorheader")
##if($!answer.freeTextFlg != "1" && $!answer.freeTextFlg != "2")
<input type="checkbox" class="#he($!question.questionId)" id="#he($!answer.answerId)" name="$answerIdValueName" value="$!escape.html($!answer.answerNo)" #if($answer.answerIdValue != "" && $enqueteForm.initCount =="2") checked #end
#if($!answer.defaultFlg == 1 && $enqueteForm.initCount =="1") checked #end
#if($!answer.answerInitDisable == "1") disabled #end
#if($!question.questionInitDisable == "1") disabled #end
/>$!answer.answer
##end
......
......@@ -44,7 +44,7 @@ $tools.getMsg("errorheader")
#if($!question.controlId == "2")
<td width="$tdWidthPercent%" valign = "top" >
#set($answerIdValueName = "questionList[$questionIndex].answerList[0].answerIdValue")
<select name="$answerIdValueName" class="#he($!question.questionId),#he($!answer.answerId)" #if($!question.questionInitDisable == "1") disabled #end>
<select name="$answerIdValueName" class="#he($!question.questionId) #he($!answer.answerId)" #if($!question.questionInitDisable == "1") disabled #end>
#foreach($selectAnswer in $question.answerList)
<option value="$!selectAnswer.answerId" #if($enqueteForm.initCount =="2" && $!selectAnswer.answerId == $!selectAnswer.answerIdValue) selected #elseif($!selectAnswer.defaultFlg == "1" && $enqueteForm.initCount!="2") selected #end >$!escape.html($!selectAnswer.answer)</option>
#end
......@@ -80,14 +80,14 @@ $tools.getMsg("errorheader")
<input type="radio" class="#he($!question.questionId) #he($!answer.answerId)" name="$!answerIdValueRadioName" id=$answerId value="$velocityCount"
#if($!answer.answerIdValue == $velocityCount.toString() && $enqueteForm.initCount =="2") checked #{end}
#if($!answer.defaultFlg == 1 && $enqueteForm.initCount =="1") checked #end
#if($!answer.answerInitDisable == "1") disabled #end>
#if($!question.questionInitDisable == "1") disabled #end>
<label for=$answerId>$!answer.answer</label>
</div>
##<!-- 自由入力欄。freeTextFlg=1(あり)、2(必須) -->
#if($!answer.freeTextFlg == 1 || $!answer.freeTextFlg == 2)
<div data-role="fieldcontain">
<input type="text" class="#he($!answer.answerId)" id="$answerValue" name="$answerValue" size="$!answer.freeTextColWidth" value="$!escape.html($!answer.answerValue)" />
<input type="text" class="#he($!question.questionId) #he($!answer.answerId)" id="$answerValue" name="$answerValue" size="$!answer.freeTextColWidth" value="$!escape.html($!answer.answerValue)" />
<label for=$answerValue class="ui-hidden-accessible"></label>
</div>
#end
......@@ -99,14 +99,14 @@ $tools.getMsg("errorheader")
<div data-role="fieldcontain">
<input type="checkbox" class="#he($!question.questionId) #he($!answer.answerId)" id=$answerId name="$answerIdValueName" value="$!escape.html($!answer.answerNo)" #if($answer.answerIdValue != "" && $enqueteForm.initCount =="2") checked #end
#if($!answer.defaultFlg == 1 && $enqueteForm.initCount =="1") checked #end
#if($!answer.answerInitDisable == "1") disabled #end>
#if($!question.questionInitDisable == "1") disabled #end>
<label for=$answerId id="#he($!answer.answerId)">$!answer.answer</label>
</div>
##<!-- 自由入力欄。freeTextFlg=1(あり)、2(必須) -->
#if($!answer.freeTextFlg == 1 || $!answer.freeTextFlg == 2)
<div data-role="fieldcontain">
<input type="text" class="#he($!answer.answerId)" id="$answerValue" name="$answerValue" size="$!answer.freeTextColWidth" value="$!escape.html($!answer.answerValue)" #if($!question.questionInitDisable == "1") disabled #end/>
<input type="text" class="#he($!question.questionId) #he($!answer.answerId)" id="$answerValue" name="$answerValue" size="$!answer.freeTextColWidth" value="$!escape.html($!answer.answerValue)" #if($!question.questionInitDisable == "1") disabled #end/>
<label for=$answerValue class="ui-hidden-accessible"></label>
</div>
#end
......@@ -116,7 +116,7 @@ $tools.getMsg("errorheader")
#if($velocityCount == 0)
<div data-role="fieldcontain">
<select name="$answerIdValueName" class="#he($!question.questionId),#he($!answer.answerId)" #if($!question.questionInitDisable == "1") disabled #end>
<select name="$answerIdValueName" class="#he($!question.questionId) #he($!answer.answerId)" #if($!question.questionInitDisable == "1") disabled #end>
#foreach($selectAnswer in $question.answerList)
<option value="$!selectAnswer.answerId" #if($!selectAnswer.defaultFlg == "1") selected #end >$!selectAnswer.answer</option>
#end
......@@ -127,24 +127,24 @@ $tools.getMsg("errorheader")
##<!-- 3:TEXTAREA ユーザー入力値を値にする。-->
#elseif($!question.controlId == "3")
<div data-role="fieldcontain">
<textArea type="text" class="#he($!question.questionId)" name="$answerIdValueName" cols="$!question.dispWitdth" rows="$!question.rowCount">$!answer.answerIdValue</textarea>
<textArea type="text" class="#he($!question.questionId) #he($!answer.answerId)" name="$answerIdValueName" cols="$!question.dispWitdth" rows="$!question.rowCount" #if($!question.questionInitDisable == "1") disabled #end>$!answer.answerIdValue</textarea>
</div>
##<!-- 4:TEXTFIELD ユーザー入力値を値にする。-->
#elseif($!question.controlId == "4")
<div data-role="fieldcontain">
<input type="text" class="#he($!question.questionId)" id="$answerIdValueName" name="$answerIdValueName" value="$!escape.html($!answer.answerIdValue)" size="$!question.dispWitdth" #if($!question.questionInitDisable == "1") disabled #end/>
<input type="text" class="#he($!question.questionId) #he($!answer.answerId)" id="$answerIdValueName" name="$answerIdValueName" value="$!escape.html($!answer.answerIdValue)" size="$!question.dispWitdth" #if($!question.questionInitDisable == "1") disabled #end/>
<label for=$answerIdValueName class="ui-hidden-accessible"></label>
</div>
##<!-- 5:日付入力 ユーザー入力値を値にする。-->
#elseif($!question.controlId == "5")
<div data-role="fieldcontain">
<input type="date" class="#he($!question.questionId)" id="$answerIdName" name="$answerValue" value="$!escape.html($!answer.answerValue)" #if($!question.questionInitDisable == "1") disabled #end/>
<input type="date" class="#he($!question.questionId) #he($!answer.answerId)" id="$answerIdName" name="$answerValue" value="$!escape.html($!answer.answerValue)" #if($!question.questionInitDisable == "1") disabled #end/>
<label for=$answerIdName class="ui-hidden-accessible"></label>
<input type="hidden" name="$answerIdValueName" value="$!answer.answerId" />
</div>
#elseif($!question.controlId == "6")
<div data-role="fieldcontain">
<select name="$answerIdValueName" class="#he($!question.questionId),#he($!answer.answerId)" #if($!question.questionInitDisable == "1") disabled #end>
<select name="$answerIdValueName" class="#he($!question.questionId) #he($!answer.answerId)" #if($!question.questionInitDisable == "1") disabled #end>
<option value="" >下記より選択してください</option>
#foreach($pecent1 in $enqueteForm.organizationListFor1Percent)
<option value="$!pecent1.organizationId" #if($!answer.answerIdValue == $!pecent1.organizationId) selected #end>$!{pecent1.organizationNo} : $!escape.html($!{pecent1.organizationName})</option>
......
......@@ -15,7 +15,7 @@ $(function() {
if ("${question.controlId}" == "0" || "${question.controlId}" == "1") {
$("#${answer.answerId}").attr("checked", false);
$("#${answer.answerId}").attr("disabled", true);
} else if ("${question.controlId}" == "2" || "${question.controlId}" == "3" || "${question.controlId}" == "4") {
} else if ("${question.controlId}" == "2" || "${question.controlId}" == "3" || "${question.controlId}" == "4" || "${question.controlId}" == "6") {
$("#${question.questionId}").val("");
$("#${question.questionId}").attr("disabled", true);
} else if ("${question.controlId}" == "5") {
......@@ -26,7 +26,7 @@ $(function() {
} else {
if ("${question.controlId}" == "0" || "${question.controlId}" == "1") {
$("#${answer.answerId}").attr("disabled", false);
} else if ("${question.controlId}" == "2" || "${question.controlId}" == "3" || "${question.controlId}" == "4") {
} else if ("${question.controlId}" == "2" || "${question.controlId}" == "3" || "${question.controlId}" == "4" || "${question.controlId}" == "6") {
$("#${question.questionId}").attr("disabled", false);
} else if ("${question.controlId}" == "5") {
$(".${question.questionId}").attr("disabled", false);
......
#set($title = "アンケート")
<!-- preHeader -->
#parse( "/WEB-INF/view/common/preHeader_mb.vm" )
<script language="javascript" type="text/javascript" charset="utf-8">
<!--
function reInput() {
location.href = "/em/user/enquete/reInput/";
}
//-->
</script>
<body style="font-family: monospace; width: 240px; border: 2px solid black;">
<!--ヘッダー-->
#parse( "/WEB-INF/view/common/header_mb.vm" )
......@@ -37,7 +44,7 @@
<br>
<!-- ※回答内容を修正する場合は、ブラウザの戻る機能で前画面へお戻りください。-->
<br>
<input type="button" value="戻る" onclick="history.back();" />
<input type="button" value="戻る" onclick="reInput();return false;" />
<br>
<hr>
<br>
......
#set($title = "アンケート回答")
<script type="text/javascript" src="/em/js/jquery-1.3.1.min.js"></script>
<script language="javascript" type="text/javascript" charset="utf-8">
<!--
window.onload = function () {
$("input[type=text], input[type=date], textArea[type=text]").each(function(){
if ($(this).prop("disabled")) {
$(this).val("");
$(this).textinput().textinput("disable");
if ($(this).prop("type") == "date") {
$(this).next().hide();
}
}
});
}
// -->
</script>
#foreach($question in $!enqueteForm.questionList)
#foreach($answer in $question.answerList)
<script language="javascript" type="text/javascript" charset="utf-8">
<!--
$(function() {
$(function() {
//条件付必須チェック
$("input[type=radio], input[type=checkbox], input[type=select]").click(function () {
var idArray = $(this).attr("class").split(" ");
......@@ -16,34 +31,36 @@ $(function() {
if ("${question.condRequiredAnswer}".split(",").indexOf(thisAnswerId) < 0) {
if ("${question.controlId}" == "0" || "${question.controlId}" == "1") {
key = "${answer.answerId}";
var controlName = ("${question.controlId}" == "0")? "radio" : "checkbox";
document.getElementById(key).classList.remove("ui-"+controlName+"-on");
document.getElementById(key).classList.add("ui-"+controlName+"-off");
$("#" + key).children().children("span:eq(1)").removeClass("ui-icon-"+controlName+"-on");
$("#" + key).children().children("span:eq(1)").addClass("ui-icon-"+controlName+"-off");
$("#" + key).closest("span.ui-icon").removeClass("ui-checkbox-on");
$("#" + key).closest("span.ui-icon").addClass("ui-checkbox-off");
$("." + key).attr("checked", false);
$("." + key).attr("disabled", true);
} else if ("${question.controlId}" == "2" || "${question.controlId}" == "3" || "${question.controlId}" == "4") {
$("#${question.questionId}").val("");
$("#${question.questionId}").attr("disabled", true);
$("." + key).prop("checked", false);
$("." + key).checkboxradio('refresh').checkboxradio('disable');
} else if ("${question.controlId}" == "2" || ${question.controlId} == "6") {
key = "${question.questionId}";
$("." + key).val("");
$("." + key).selectmenu("refresh").selectmenu("disable");
} else if ("${question.controlId}" == "3" || "${question.controlId}" == "4") {
key = "${question.questionId}";
$("." + key).val("");
$("." + key).textinput("disable");
} else if ("${question.controlId}" == "5") {
$(".${question.questionId}").val("");
$(".${question.questionId}").attr("disabled", true);
$(".${question.questionId}").next().hide();
key = "${question.questionId}";
$("." + key).val("");
$("." + key).textinput("disable");
$("." + key).next().hide();
}
} else {
if ("${question.controlId}" == "0" || "${question.controlId}" == "1") {
key = "${answer.answerId}";
$("." + key).prop("disabled", false);
} else if ("${question.controlId}" == "2" || "${question.controlId}" == "3" || "${question.controlId}" == "4") {
$("#${question.questionId}").attr("disabled", false);
$("." + key).checkboxradio('enable');
} else if ("${question.controlId}" == "2" || "${question.controlId}" == "6") {
key = "${question.questionId}";
$("." + key).selectmenu("enable");
} else if ("${question.controlId}" == "3" || "${question.controlId}" == "4") {
key = "${question.questionId}";
$("." + key).textinput("enable");
} else if ("${question.controlId}" == "5") {
$(".${question.questionId}").attr("disabled", false);
$(".${question.questionId}").next().show();
key = "${question.questionId}";
$("." + key).textinput("enable");
$("." + key).next().show();
}
}
}
......
#set($title = "アンケート回答確認画面")
<!-- preHeader -->
#parse( "/WEB-INF/view/common/preHeader_sp.vm" )
<script language="javascript" type="text/javascript" charset="utf-8">
<!--
function reInput() {
location.href = "/em/user/enquete/reInput/";
}
//-->
</script>
<body>
<div data-role="page" id="enqueteConfirm" data-theme="f">
......@@ -42,7 +48,7 @@
<br>
<!-- ※回答内容を修正する場合は、ブラウザの戻る機能で前画面へお戻りください。-->
<br>
<input type="button" value="戻る" onclick="history.back();" />
<input type="button" value="戻る" onclick="reInput();return false;" />
<br>
<hr>
<br>
......
......@@ -39,18 +39,18 @@ $(function() {
if ("${question.controlId}" == "0" || "${question.controlId}" == "1") {
$("#${answer.answerId}").attr("checked", false);
$("#${answer.answerId}").attr("disabled", true);
} else if ("${question.controlId}" == "2" || "${question.controlId}" == "3" || "${question.controlId}" == "4") {
$("#${question.questionId}").val("");
} else if ("${question.controlId}" == "2" || "${question.controlId}" == "3" || "${question.controlId}" == "4" || "${question.controlId}" == "6") {
$("#${question.questionId}").val('');
$("#${question.questionId}").attr("disabled", true);
} else if ("${question.controlId}" == "5") {
$(".${question.questionId}").val("");
$(".${question.questionId}").val('');
$(".${question.questionId}").attr("disabled", true);
$(".${question.questionId}").next().hide();
}
} else {
if ("${question.controlId}" == "0" || "${question.controlId}" == "1") {
$("#${answer.answerId}").attr("disabled", false);
} else if ("${question.controlId}" == "2" || "${question.controlId}" == "3" || "${question.controlId}" == "4") {
} else if ("${question.controlId}" == "2" || "${question.controlId}" == "3" || "${question.controlId}" == "4" || "${question.controlId}" == "6") {
$("#${question.questionId}").attr("disabled", false);
} else if ("${question.controlId}" == "5") {
$(".${question.questionId}").attr("disabled", false);
......@@ -253,7 +253,7 @@ $tools.getMsg("errorheader")
#if($!question.controlId == "0")
##if($!answer.freeTextFlg != "1" && $!answer.freeTextFlg != "2")
<input type="radio" class="#he($!question.questionId)" id="#he($!answer.answerId)" name="$!answerIdValueRadioName" value="$velocityCount" #if($!answer.answerIdValue == $velocityCount.toString() && $enqueteForm.initCount =="2") checked #end
#if($!answer.defaultFlg == 1 && $enqueteForm.initCount =="1") checked #end #if($!answer.answerInitDisable == "1") disabled #end> $!escape.html($!answer.answer)
#if($!answer.defaultFlg == 1 && $enqueteForm.initCount =="1") checked #end #if($!question.questionInitDisable == "1") disabled #end> $!escape.html($!answer.answer)
##end
##<!-- 自由入力欄。freeTextFlg=1(あり)、2(必須) -->
......@@ -264,7 +264,7 @@ $tools.getMsg("errorheader")
#elseif($!question.controlId == "1")
##if($!answer.freeTextFlg != "1" && $!answer.freeTextFlg != "2")
<input type="checkbox" class="#he($!question.questionId)" id="#he($!answer.answerId)" name="$answerIdValueName" value="$!escape.html($!answer.answerNo)" #if($answer.answerIdValue != "" && $enqueteForm.initCount =="2") checked #end
#if($!answer.defaultFlg == 1 && $enqueteForm.initCount =="1") checked #end #if($!answer.answerInitDisable == "1") disabled #end> $!escape.html($!answer.answer)
#if($!answer.defaultFlg == 1 && $enqueteForm.initCount =="1") checked #end #if($!question.questionInitDisable == "1") disabled #end> $!escape.html($!answer.answer)
##end
##<!-- 自由入力欄。freeTextFlg=1(あり)、2(必須) -->
......
......@@ -232,7 +232,8 @@
<tr>
<td nowrap class="td_return">
<!-- <input type="button" value="戻る" onclick="history.back();" />-->
<a href="#" class="btn_return" onclick="history.back();return false;"><span class="btn_return_text" title="戻る">戻る</span></a>
#set($back-path = '/em/user/enquete/reInput/')
<a class="btn_return" href="/em/user/enquete/reInput/"><span class="btn_return_text" title="戻る">戻る</span></a>
</td>
</tr>
</table>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment