Changeset 18640
- Timestamp:
- 2010/05/08 21:47:08 (14 years ago)
- Location:
- branches/comu-ver2
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/comu-ver2
- Property svn:mergeinfo changed
/branches/version-2_4 merged: 18519
- Property svn:mergeinfo changed
-
branches/comu-ver2/data/Smarty/templates/default/admin/contents/inquiry.tpl
r18254 r18640 24 24 <script type="text/javascript"> 25 25 <!-- 26 function func_check() { 27 res = confirm('登録します。宜しいですか?'); 28 if( res == true ) { 29 return true; 26 function func_check() { 27 res = confirm('登録します。宜しいですか?'); 28 if( res == true ) { 29 return true; 30 } 31 return false; 30 32 } 31 return false; 32 } 33 34 35 function func_disp( no ){ 33 34 35 function func_disp( no ){ 36 36 37 ml = document.form1.elements['question[' + no + '][kind]'];38 len = ml.length;37 ml = document.form1.elements['question[' + no + '][kind]']; 38 len = ml.length; 39 39 40 optd = $("#Q" + no + "-option"); 41 nmth = $("#Q" + no + "-name").children("th"); 42 var flag = 0; 43 44 for( i = 0; i < len ; i++) { 45 46 if ( ml[i].checked ){ 47 if ( (ml[i].value == 3) || (ml[i].value == 4) ) { 48 optd.show(); 49 nmth.attr("rowspan", "3"); 50 } else { 40 optd = $("#Q" + no + "-option"); 41 nmth = $("#Q" + no + "-name").children("th"); 42 var flag = 0; 43 44 for( i = 0; i < len ; i++) { 45 46 if ( ml[i].checked ){ 47 if ( (ml[i].value == 3) || (ml[i].value == 4) ) { 48 optd.show(); 49 nmth.attr("rowspan", "3"); 50 } else { 51 optd.hide(); 52 nmth.attr("rowspan", "2"); 53 } 54 flag = 1; 55 } 56 57 } 58 59 if ( flag == 0 ){ 51 60 optd.hide(); 52 61 nmth.attr("rowspan", "2"); 53 } 54 flag = 1; 55 } 56 57 } 58 59 if ( flag == 0 ){ 60 optd.hide(); 61 nmth.attr("rowspan", "2"); 62 } 63 62 64 } 63 65 64 }65 66 function delete_check() {67 res = confirm('アンケートを削除しても宜しいですか?');68 if(res == true) {69 return true;66 function delete_check() { 67 res = confirm('アンケートを削除しても宜しいですか?'); 68 if(res == true) { 69 return true; 70 } 71 return false; 70 72 } 71 return false;72 }73 73 // --> 74 74 </script> … … 77 77 <form name="form1" method="post" action="?mode=regist" onSubmit="return func_check(); false;"> 78 78 <input type="hidden" name="question_id" value="<!--{$QUESTION_ID}-->" /> 79 <h2><!--{if $QUESTION_ID}-->修正<!--{else}-->新規<!--{/if}-->登録</h2>80 <!--{if $MESSAGE != ""}-->81 <div class="message"><span class="attention"><!--{$MESSAGE}--></span></div>82 <!--{/if}-->79 <h2><!--{if $QUESTION_ID}-->修正<!--{else}-->新規<!--{/if}-->登録</h2> 80 <!--{if $MESSAGE != ""}--> 81 <div class="message"><span class="attention"><!--{$MESSAGE}--></span></div> 82 <!--{/if}--> 83 83 84 <table> 85 <tr> 86 <th>稼働・非稼働<span class="attention">*</span></th> 87 <td> 88 <span <!--{if $ERROR.active}--><!--{sfSetErrorStyle}--><!--{/if}-->> 89 <!--{html_radios name="active" options=$arrActive selected=$smarty.post.active}--> 90 </span> 91 <!--{if $ERROR.active}--><br /><span class="attention"><!--{$ERROR.active}--></span><!--{/if}--> 92 </td> 93 </tr> 94 <tr> 95 <th>アンケートタイトル<span class="attention">*</span></th> 96 <td> 97 <input type="text" name="title" size="70" class="box70" maxlength="<!--{$smarty.const.STEXT_LEN}-->" value="<!--{$smarty.post.title|escape}-->" <!--{if $ERROR.title}--><!--{sfSetErrorStyle}--><!--{/if}--> /> 98 <!--{if $ERROR.title}--><br /><span class="attention"><!--{$ERROR.title}--></span><!--{/if}--> 99 </td> 100 </tr> 101 <tr> 102 <th>アンケート内容<span class="attention">*</span></th> 103 <td> 104 <textarea name="contents" cols="60" rows="4" class="area60" wrap="physical" <!--{if $ERROR.contents}--><!--{sfSetErrorStyle}--><!--{/if}-->><!--{$smarty.post.contents}--></textarea> 105 <!--{if $ERROR.contents}--><br /><span class="attention"><!--{$ERROR.contents}--></span><!--{/if}--> 106 </td> 107 </tr> 108 <!--{section name=question loop=$cnt_question}--> 109 <tr id="Q<!--{$smarty.section.question.index}-->-name"> 110 <th rowspan="3">質問<!--{$smarty.section.question.iteration}--><!--{if $smarty.section.question.iteration eq 1}--><span class="attention">*</span><!--{/if}--></th> 111 <td> 112 <input type="text" name="question[<!--{$smarty.section.question.index}-->][name]" size="70" class="box70" maxlength="<!--{$smarty.const.STEXT_LEN}-->" value="<!--{$smarty.post.question[$smarty.section.question.index].name|escape}-->" <!--{if $ERROR.question[$smarty.section.question.index].name}--><!--{sfSetErrorStyle}--><!--{/if}--> /> 113 <!--{if $ERROR.question[$smarty.section.question.index].name}--><br /><span class="attention"><!--{$ERROR.question[$smarty.section.question.index].name}--></span><!--{/if}--> 114 </td> 115 </tr> 116 <tr id="Q<!--{$smarty.section.question.index}-->-kind"> 117 <td> 118 <span<!--{if $ERROR_COLOR.question[$smarty.section.question.index].kind}--> style="background-color:<!--{$ERROR_COLOR.question[$smarty.section.question.index].kind}-->"<!--{/if}-->> 119 <!--{html_radios_ex onClick="func_disp(`$smarty.section.question.index`)" name="question[`$smarty.section.question.index`][kind]" options="$arrQuestion" selected="`$smarty.post.question[$smarty.section.question.index].kind`"}--> 120 </span> 121 <!--{if $ERROR.question[$smarty.section.question.index].kind}--><br /><span class="attention"><!--{$ERROR.question[$smarty.section.question.index].kind}--></span><!--{/if}--> 122 </td> 123 </tr> 124 <tr id="Q<!--{$smarty.section.question.index}-->-option"> 125 <td> 126 1 <input type="text" name="question[<!--{$smarty.section.question.index}-->][option][0]" size="40" class="box40" maxlength="<!--{$smarty.const.STEXT_LEN}-->" value="<!--{$smarty.post.question[$smarty.section.question.index].option.0|escape}-->" <!--{if $ERROR.question[$smarty.section.question.index].kind}--><!--{sfSetErrorStyle}--><!--{/if}--> /> 2 <input type="text" name="question[<!--{$smarty.section.question.index}-->][option][1]" size="40" class="box40" value="<!--{$smarty.post.question[$smarty.section.question.index].option.1|escape}-->" <!--{if $ERROR.question[$smarty.section.question.index].kind}--><!--{sfSetErrorStyle}--><!--{/if}--> /><br /> 127 3 <input type="text" name="question[<!--{$smarty.section.question.index}-->][option][2]" size="40" class="box40" maxlength="<!--{$smarty.const.STEXT_LEN}-->" value="<!--{$smarty.post.question[$smarty.section.question.index].option.2|escape}-->" /> 4 <input type="text" name="question[<!--{$smarty.section.question.index}-->][option][3]" size="40" class="box40" value="<!--{$smarty.post.question[$smarty.section.question.index].option.3|escape}-->" /><br /> 128 5 <input type="text" name="question[<!--{$smarty.section.question.index}-->][option][4]" size="40" class="box40" maxlength="<!--{$smarty.const.STEXT_LEN}-->" value="<!--{$smarty.post.question[$smarty.section.question.index].option.4|escape}-->" /> 6 <input type="text" name="question[<!--{$smarty.section.question.index}-->][option][5]" size="40" class="box40" value="<!--{$smarty.post.question[$smarty.section.question.index].option.5|escape}-->" /><br /> 129 7 <input type="text" name="question[<!--{$smarty.section.question.index}-->][option][6]" size="40" class="box40" maxlength="<!--{$smarty.const.STEXT_LEN}-->" value="<!--{$smarty.post.question[$smarty.section.question.index].option.6|escape}-->" /> 8 <input type="text" name="question[<!--{$smarty.section.question.index}-->][option][7]" size="40" class="box40" value="<!--{$smarty.post.question[$smarty.section.question.index].option.7|escape}-->" /> 130 </td> 131 </tr> 132 <!--{/section}--> 133 </table> 84 <table> 85 <tr> 86 <th>稼働・非稼働<span class="attention">*</span></th> 87 <td> 88 <span <!--{if $ERROR.active}--><!--{sfSetErrorStyle}--><!--{/if}-->> 89 <!--{html_radios name="active" options=$arrActive selected=$smarty.post.active}--> 90 </span> 91 <!--{if $ERROR.active}--><br /><span class="attention"><!--{$ERROR.active}--></span><!--{/if}--> 92 </td> 93 </tr> 94 <tr> 95 <th>アンケートタイトル<span class="attention">*</span></th> 96 <td> 97 <input type="text" name="title" size="70" class="box70" maxlength="<!--{$smarty.const.STEXT_LEN}-->" value="<!--{$smarty.post.title|escape}-->" <!--{if $ERROR.title}--><!--{sfSetErrorStyle}--><!--{/if}--> /> 98 <!--{if $ERROR.title}--><br /><span class="attention"><!--{$ERROR.title}--></span><!--{/if}--> 99 </td> 100 </tr> 101 <tr> 102 <th>アンケート内容<span class="attention">*</span></th> 103 <td> 104 <textarea name="contents" cols="60" rows="4" class="area60" wrap="physical" <!--{if $ERROR.contents}--><!--{sfSetErrorStyle}--><!--{/if}-->><!--{$smarty.post.contents}--></textarea> 105 <!--{if $ERROR.contents}--><br /><span class="attention"><!--{$ERROR.contents}--></span><!--{/if}--> 106 </td> 107 </tr> 108 <!--{section name=question loop=$cnt_question}--> 109 <!--{assign var=index value=$smarty.section.question.index}--> 110 <tr id="Q<!--{$smarty.section.question.index|escape}-->-name"> 111 <th rowspan="3">質問<!--{$smarty.section.question.iteration}--><!--{if $smarty.section.question.iteration eq 1}--><span class="attention">*</span><!--{/if}--></th> 112 <td> 113 <input type="text" name="question[<!--{$index|escape}-->][name]" size="70" class="box70" maxlength="<!--{$smarty.const.STEXT_LEN}-->" value="<!--{$smarty.post.question[$index].name|escape}-->" <!--{if $ERROR.question[$index].name}--><!--{sfSetErrorStyle}--><!--{/if}-->> 114 <!--{if $ERROR.question[$index].name}--><br /><span class="attention"><!--{$ERROR.question[$index].name}--></span><!--{/if}--> 115 </td> 116 </tr> 117 <tr> 118 <td> 119 <span style=background-color:"<!--{$ERROR_COLOR.question[$index].kind}-->"> 120 <!--{html_radios_ex onClick="func_disp(`$index`)" name="question[`$index`][kind]" options="$arrQuestion" selected="`$smarty.post.question[$index].kind`"}--> 121 </span> 122 <!--{if $ERROR.question[$index].kind}--><br><span class="red"><!--{$ERROR.question[$index].kind}--></span><!--{/if}--> 123 </td> 124 </tr> 125 <!--{* ▼回答 *}--> 126 <tr id="Q<!--{$index|escape}-->-option"> 127 <td> 128 <!--{section name=option loop=4 start=0 max=7}--> 129 <div> 130 <!--{assign var=option_index1 value=$smarty.section.option.index*2}--> 131 <!--{assign var=option_index2 value=$option_index1+1}--> 132 <!--{assign var=num1 value=$option_index1+1}--> 133 <!--{assign var=num2 value=$option_index2+1}--> 134 <!--{assign var=error1 value=$ERROR.question[$index].option[$option_index1]}--> 135 <!--{assign var=error2 value=$ERROR.question[$index].option[$option_index2]}--> 136 <!--{* 回答エラー *}--> 137 <!--{if $error1}--><span class="red"><!--{$error1}--></span><br /><!--{/if}--> 138 <!--{if $error2}--><span class="red"><!--{$error2}--></span><br /><!--{/if}--> 139 <!--{* 回答フォーム *}--> 140 <!--{$num1}--> <input type="text" name="question[<!--{$index|escape}-->][option][<!--{$option_index1|escape}-->]" size="40" class="box40" maxlength="<!--{$smarty.const.STEXT_LEN}-->" value="<!--{$smarty.post.question[$index].option[$option_index1]|escape}-->" <!--{if $error1}--><!--{sfSetErrorStyle}--><!--{/if}-->> 141 <!--{$num2}--> <input type="text" name="question[<!--{$index|escape}-->][option][<!--{$option_index2|escape}-->]" size="40" class="box40" maxlength="<!--{$smarty.const.STEXT_LEN}-->" value="<!--{$smarty.post.question[$index].option[$option_index2]|escape}-->" <!--{if $error2}--><!--{sfSetErrorStyle}--><!--{/if}-->> 142 </div> 143 <!--{/section}--> 144 </td> 145 </tr> 146 <!--{* ▲回答 *}--> 147 <!--{/section}--> 148 </table> 134 149 135 <div class="btn">136 <button type="submit"><span>登録する</span></button>137 <button type="reset"><span>内容をクリア</span></button>138 </div>150 <div class="btn"> 151 <button type="submit"><span>登録する</span></button> 152 <button type="reset"><span>内容をクリア</span></button> 153 </div> 139 154 </form> 140 155 141 156 <form name="form2" method="post" action="?"> 142 <h2>登録済みアンケート</h2>143 <table class="list center">144 <tr>145 <th>編集</th>146 <th>登録日</th>147 <th>アンケートタイトル</th>148 <th>ページ参照</th>149 <th>結果取得</th>150 <th>削除</th>151 </tr>152 <!--{section name=data loop=$list_data}-->153 <tr <!--{if $list_data[data].question_id eq $smarty.request.question_id}--><!--{sfSetErrorStyle}--><!--{/if}-->>154 <td class="main"><a href="<!--{$smarty.server.PHP_SELF|escape}-->?question_id=<!--{$list_data[data].question_id}-->">編集</a></td>155 <td><!--{$list_data[data].disp_date}--></td>156 <td class="left"><!--{$list_data[data].question_name|escape}--></td>157 <td><a href="<!--{$smarty.const.SITE_URL}-->inquiry/<!--{$smarty.const.DIR_INDEX_URL}-->?question_id=<!--{$list_data[data].question_id}-->" target="_blank">参照</a></td>158 <td><a href="<!--{$smarty.server.PHP_SELF|escape}-->?mode=csv&question_id=<!--{$list_data[data].question_id}-->">download</a></td>159 <td><a href="<!--{$smarty.server.PHP_SELF|escape}-->?mode=delete&question_id=<!--{$list_data[data].question_id}-->" onClick="return delete_check()">削除</a></td>160 </tr>161 <!--{/section}-->162 </table>157 <h2>登録済みアンケート</h2> 158 <table class="list center"> 159 <tr> 160 <th>編集</th> 161 <th>登録日</th> 162 <th>アンケートタイトル</th> 163 <th>ページ参照</th> 164 <th>結果取得</th> 165 <th>削除</th> 166 </tr> 167 <!--{section name=data loop=$list_data}--> 168 <tr <!--{if $list_data[data].question_id eq $smarty.request.question_id}--><!--{sfSetErrorStyle}--><!--{/if}-->> 169 <td class="main"><a href="<!--{$smarty.server.PHP_SELF|escape}-->?question_id=<!--{$list_data[data].question_id}-->">編集</a></td> 170 <td><!--{$list_data[data].disp_date}--></td> 171 <td class="left"><!--{$list_data[data].question_name|escape}--></td> 172 <td><a href="<!--{$smarty.const.SITE_URL}-->inquiry/<!--{$smarty.const.DIR_INDEX_URL}-->?question_id=<!--{$list_data[data].question_id}-->" target="_blank">参照</a></td> 173 <td><a href="<!--{$smarty.server.PHP_SELF|escape}-->?mode=csv&question_id=<!--{$list_data[data].question_id}-->">download</a></td> 174 <td><a href="<!--{$smarty.server.PHP_SELF|escape}-->?mode=delete&question_id=<!--{$list_data[data].question_id}-->" onClick="return delete_check()">削除</a></td> 175 </tr> 176 <!--{/section}--> 177 </table> 163 178 </form> 164 179 … … 167 182 <script type="text/javascript"> 168 183 <!-- 169 <!--{section name=question loop=$cnt_question}-->170 func_disp(<!--{$smarty.section.question.index}-->);171 <!--{/section}-->184 <!--{section name=question loop=$cnt_question}--> 185 func_disp(<!--{$smarty.section.question.index}-->); 186 <!--{/section}--> 172 187 //--> 173 188 </script> -
branches/comu-ver2/data/class/pages/admin/contents/LC_Page_Admin_Contents_Inquiry.php
r18234 r18640 110 110 for ( $j=0; $j<count( $_POST['question'][$i]['option'] ); $j++ ){ 111 111 $_POST['question'][$i]['option'][$j] = mb_convert_kana( trim ( $_POST['question'][$i]['option'][$j] ) ); 112 } 113 } 114 115 for( $i = 0; $i < count( $_POST["question"] ); $i++ ) { 116 if( $_POST["question"][$i]["kind"] == 3 || $_POST["question"][$i]["kind"] == 4 ) { 117 $temp_data = array(); 118 // 項目間(テキストボックス)があいていたら詰めていく 119 for( $j = 0; $j < count( $_POST["question"][$i]["option"] ); $j++ ) { 120 if( strlen( $_POST["question"][$i]["option"][$j] ) > 0 ) $temp_data[] = mb_convert_kana( trim ( $_POST["question"][$i]["option"][$j] ), "asKVn" ); 121 } 122 $_POST["question"][$i]["option"] = $temp_data; 123 } else { 124 $_POST["question"][$i]["option"] = NULL; 112 125 } 113 126 } … … 294 307 if( $_POST["question"][$i]["kind"] == 3 || $_POST["question"][$i]["kind"] == 4 ) { 295 308 296 $temp_data = array();297 309 for( $j = 0; $j < count( $_POST["question"][$i]["option"] ); $j++ ) { 298 299 // 項目間(テキストボックス)があいていたら詰めていく 300 if( strlen( $_POST["question"][$i]["option"][$j] ) > 0 ) $temp_data[] = mb_convert_kana( trim ( $_POST["question"][$i]["option"][$j] ), "asKVn" ); 301 302 } 303 304 $_POST["question"][$i]["option"] = $temp_data; 310 // 同じ回答がないかチェック 311 if (strlen($_POST["question"][$i]["option"][$j]) > 0) { 312 $checkArray = $_POST["question"][$i]["option"]; 313 // 自身の値をunset 314 unset($checkArray[$j]); 315 if (in_array($_POST["question"][$i]["option"][$j], $checkArray)) { 316 $objErr->arrErr["question"][$i]["option"][$j] = "同じ質問に同じ回答は設定出来ません。"; 317 } 318 } 319 } 305 320 306 321 if( ( strlen( $_POST["question"][$i] ["option"][0] ) == 0 ) || ( strlen( $_POST["question"][$i] ["option"][0] ) > 0 307 322 && strlen( $_POST["question"][$i] ["option"][1] ) == 0 ) ) $objErr->arrErr["question"][$i]['kind'] = "下記の2つ以上の項目に記入してください。"; 323 308 324 } 309 325 }
Note: See TracChangeset
for help on using the changeset viewer.