1 | <!--{* |
---|
2 | /* |
---|
3 | * This file is part of EC-CUBE |
---|
4 | * |
---|
5 | * Copyright(c) 2000-2008 LOCKON CO.,LTD. All Rights Reserved. |
---|
6 | * |
---|
7 | * http://www.lockon.co.jp/ |
---|
8 | * |
---|
9 | * This program is free software; you can redistribute it and/or |
---|
10 | * modify it under the terms of the GNU General Public License |
---|
11 | * as published by the Free Software Foundation; either version 2 |
---|
12 | * of the License, or (at your option) any later version. |
---|
13 | * |
---|
14 | * This program is distributed in the hope that it will be useful, |
---|
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
17 | * GNU General Public License for more details. |
---|
18 | * |
---|
19 | * You should have received a copy of the GNU General Public License |
---|
20 | * along with this program; if not, write to the Free Software |
---|
21 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
---|
22 | */ |
---|
23 | *}--> |
---|
24 | <script type="text/javascript"> |
---|
25 | <!-- |
---|
26 | function fnMoveOption(sel , moveflg) { |
---|
27 | var fm = document.form1; |
---|
28 | var arrChoice = new Array(); // 選択されている項目 |
---|
29 | var arrNotChoice = new Array(); // 選択されていない項目 |
---|
30 | var arrNew = new Array(); // 移動後のリスト |
---|
31 | var arrTmp = new Array(); |
---|
32 | var arrRev = new Array(); |
---|
33 | |
---|
34 | if(fm[sel].selectedIndex == -1) alert("何も選択されていません。"); |
---|
35 | else { |
---|
36 | // 下に移動する場合にはまずOPTIONを逆にする |
---|
37 | if (moveflg == 'bottom') { |
---|
38 | for(i=fm[sel].length-1, j=0; i >= 0; i--, j++){ |
---|
39 | fm[sel].options[i].label=i; // 順番をlabelに退避 |
---|
40 | arrRev[j] = fm[sel].options[i]; |
---|
41 | } |
---|
42 | for(i=0; i < arrRev.length; i++){ |
---|
43 | fm[sel].options[i] = new Option(arrRev[i].text, arrRev[i].value); |
---|
44 | fm[sel].options[i].selected = arrRev[i].selected; |
---|
45 | } |
---|
46 | } |
---|
47 | |
---|
48 | // 一番下に空白を追加 |
---|
49 | fm[sel].options[fm[sel].length] = new Option('', ''); |
---|
50 | |
---|
51 | for(i = 0, choiceCnt = 0, notCnt = 0; i < fm[sel].length; i++) { |
---|
52 | if(!fm[sel].options[i].selected) { |
---|
53 | // 選択されていない項目配列を生成 |
---|
54 | fm[sel].options[i].label=i; // 順番をlabelに退避 |
---|
55 | arrNotChoice[choiceCnt] = fm[sel].options[i]; |
---|
56 | choiceCnt++; |
---|
57 | }else{ |
---|
58 | // 選択されている項目配列を生成 |
---|
59 | fm[sel].options[i].label=i; // 順番をlabelに退避 |
---|
60 | arrChoice[notCnt] = fm[sel].options[i]; |
---|
61 | notCnt++; |
---|
62 | } |
---|
63 | } |
---|
64 | |
---|
65 | // 選択項目を上に移動 |
---|
66 | for(i = arrChoice.length; i < 1; i--){ |
---|
67 | arrChoice[i].label = arrChoice[i-1].label+1; |
---|
68 | } |
---|
69 | |
---|
70 | // 非選択項目を下に移動 |
---|
71 | for(i = 0; i < arrNotChoice.length - 1; i++){ |
---|
72 | arrNotChoice[i].label = arrNotChoice[i+1].label-1; |
---|
73 | } |
---|
74 | |
---|
75 | // 選択項目と非選択項目をマージする |
---|
76 | for(choiceCnt = 0, notCnt = 0, cnt = 0; cnt < fm[sel].length; cnt++){ |
---|
77 | if (choiceCnt >= arrChoice.length) { |
---|
78 | arrNew[cnt] = arrNotChoice[notCnt]; |
---|
79 | notCnt++; |
---|
80 | }else if (notCnt >= arrNotChoice.length) { |
---|
81 | arrNew[cnt] = arrChoice[choiceCnt]; |
---|
82 | choiceCnt++; |
---|
83 | }else{ |
---|
84 | if(arrChoice[choiceCnt].label-1 <= arrNotChoice[notCnt].label){ |
---|
85 | arrNew[cnt] = arrChoice[choiceCnt]; |
---|
86 | choiceCnt++; |
---|
87 | }else{ |
---|
88 | arrNew[cnt] = arrNotChoice[notCnt]; |
---|
89 | notCnt++; |
---|
90 | } |
---|
91 | } |
---|
92 | } |
---|
93 | |
---|
94 | // 下に移動する場合には逆にしたものを元に戻す |
---|
95 | if (moveflg == 'bottom') { |
---|
96 | for(i=arrNew.length-2, j=0; i >= 0; i--, j++){ |
---|
97 | arrTmp[j] = arrNew[i]; |
---|
98 | } |
---|
99 | arrTmp[j]=""; |
---|
100 | arrNew = arrTmp; |
---|
101 | } |
---|
102 | |
---|
103 | // optionを再作成 |
---|
104 | fm[sel].length = arrNew.length - 1; |
---|
105 | for(i=0; i < arrNew.length - 1; i++){ |
---|
106 | fm[sel].options[i] = new Option(arrNew[i].text, arrNew[i].value); |
---|
107 | fm[sel].options[i].selected = arrNew[i].selected; |
---|
108 | } |
---|
109 | } |
---|
110 | } |
---|
111 | |
---|
112 | function fnReplaceOption(restSel, addSel) { |
---|
113 | var fm = document.form1; |
---|
114 | var arrRest = new Array(); // 残りのリスト |
---|
115 | var arrAdd = new Array(); // 追加のリスト |
---|
116 | |
---|
117 | if(fm[restSel].selectedIndex == -1) alert("何も選択されていません。"); |
---|
118 | else { |
---|
119 | for(i = 0, restCnt = 0, addCnt = 0; i < fm[restSel].length; i++) { |
---|
120 | if(!fm[restSel].options[i].selected) { |
---|
121 | // 残要素の配列を生成 |
---|
122 | arrRest[restCnt] = fm[restSel].options[i]; |
---|
123 | restCnt++; |
---|
124 | }else{ |
---|
125 | // 追加要素の配列を生成 |
---|
126 | arrAdd[addCnt] = fm[restSel].options[i]; |
---|
127 | addCnt++; |
---|
128 | } |
---|
129 | } |
---|
130 | |
---|
131 | // 残リスト生成 |
---|
132 | fm[restSel].length = arrRest.length; |
---|
133 | for(i=0; i < arrRest.length; i++) |
---|
134 | { |
---|
135 | fm[restSel].options[i] = new Option(arrRest[i].text, arrRest[i].value); |
---|
136 | } |
---|
137 | |
---|
138 | // 追加先に項目を追加 |
---|
139 | //fm[addSel].options[fm[addSel].length] = new Option(fm[sel2].value, fm[sel2].value); |
---|
140 | |
---|
141 | for(i=0; i < arrAdd.length; i++) |
---|
142 | { |
---|
143 | fm[addSel].options[fm[addSel].length] = new Option(arrAdd[i].text, arrAdd[i].value); |
---|
144 | fm[addSel].options[fm[addSel].length-1].selected = true; |
---|
145 | } |
---|
146 | } |
---|
147 | } |
---|
148 | |
---|
149 | // submitした場合に、出力項目一覧を選択状態にする |
---|
150 | function lfnCheckList(sel) { |
---|
151 | var fm = document.form1; |
---|
152 | for(i = 0; i < fm[sel].length; i++) { |
---|
153 | fm[sel].options[i].selected = true; |
---|
154 | } |
---|
155 | } |
---|
156 | |
---|
157 | // リストボックスのサイズ変更 |
---|
158 | function ChangeSize(button, TextArea, Max, Min, row_tmp){ |
---|
159 | if(TextArea.rows <= Min){ |
---|
160 | TextArea.rows=Max; button.value="小さくする"; row_tmp.value=Max; |
---|
161 | }else{ |
---|
162 | TextArea.rows =Min; button.value="大きくする"; row_tmp.value=Min; |
---|
163 | } |
---|
164 | } |
---|
165 | |
---|
166 | //--> |
---|
167 | </script> |
---|
168 | |
---|
169 | |
---|
170 | |
---|
171 | <form name="form1" id="form1" method="post" action="?" onsubmit="lfnCheckList('output_list[]')"> |
---|
172 | <input type="hidden" name="mode" value="confirm" /> |
---|
173 | <input type="hidden" name="tpl_subno_csv" value="<!--{$tpl_subno_csv}-->" /> |
---|
174 | <div id="admin-contents" class="contents-main"> |
---|
175 | <h2><!--{$SubnaviName}--></h2> |
---|
176 | <table id="contents-csv-select"> |
---|
177 | <tr> |
---|
178 | <td> |
---|
179 | <div class="btn"> |
---|
180 | <button type="button" onClick="fnMoveOption('output_list[]', 'top');"><span> ▲ </span></button><br/> |
---|
181 | <button type="button" onClick="fnMoveOption('output_list[]', 'bottom');"><span> ▼ </span></button> |
---|
182 | </div> |
---|
183 | </td> |
---|
184 | <td> |
---|
185 | <h3>出力項目一覧</h3> |
---|
186 | <span class="attention"><!--{$arrErr.output_list}--></span> |
---|
187 | <select multiple name="output_list[]"<!--{if $arrErr.output_list}--> style="<!--{$arrErr.output_list|sfGetErrorColor}-->;"<!--{/if}-->> |
---|
188 | <!--{html_options options=$arrOutput}--> |
---|
189 | </select> |
---|
190 | </td> |
---|
191 | <td> |
---|
192 | <div class="btn"> |
---|
193 | <button type="button" onClick="fnReplaceOption('choice_list[]', 'output_list[]');"><< 追加</button><br/> |
---|
194 | <button type="button" onClick="fnReplaceOption('output_list[]', 'choice_list[]');">削除 >></button> |
---|
195 | </div> |
---|
196 | </td> |
---|
197 | <td> |
---|
198 | <h3>出力可能項目一覧</h3> |
---|
199 | <select multiple name="choice_list[]"> |
---|
200 | <!--{html_options options=$arrChoice}--> |
---|
201 | </select> |
---|
202 | </td> |
---|
203 | </tr> |
---|
204 | </table> |
---|
205 | |
---|
206 | <div class="btn"><button type="submit"><span>この内容で登録する</span></button></div> |
---|
207 | |
---|
208 | </div> |
---|
209 | </form> |
---|