Changeset 18842
- Timestamp:
- 2010/10/02 13:05:28 (12 years ago)
- Location:
- branches/version-2_5-dev
- Files:
-
- 6 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_5-dev/data/Smarty/templates/default/admin/contents/csv.tpl
r18700 r18842 22 22 */ 23 23 *}--> 24 <link rel="stylesheet" href="<!--{$TPL_DIR}-->jquery.multiselect2side/css/jquery.multiselect2side.css" type="text/css" media="screen" /> 25 <script type="text/javascript" src="<!--{$TPL_DIR}-->jquery.multiselect2side/js/jquery.multiselect2side.js" ></script> 24 26 <script type="text/javascript"> 25 27 <!-- 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 28 $().ready(function() { 29 $('#output_list').multiselect2side({ 30 selectedPosition: 'left', 31 moveOptions: true, 32 labelsx: '出力項目一覧', 33 labeldx: '出力可能項目一覧' 34 }); 35 // multiselect2side の初期選択を解除 36 $('.ms2side__div select').val(null); 37 // [Sort] ボタンは混乱防止のため非表示 38 // FIXME 選択・非選択のボタンと比べて、位置ズレしている 39 $('.ms2side__div .SelSort').hide(); 40 }); 166 41 //--> 167 42 </script> 168 43 169 170 171 <form name="form1" id="form1" method="post" action="?" onsubmit="lfnCheckList('output_list[]')"> 44 <form name="form1" id="form1" method="post" action="?"> 172 45 <input type="hidden" name="mode" value="confirm" /> 173 46 <input type="hidden" name="tpl_subno_csv" value="<!--{$tpl_subno_csv}-->" /> 174 47 <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> 48 <h2><!--{$SubnaviName}--></h2> 49 <div> 186 50 <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}-->51 <select multiple name="output_list[]" style="<!--{$arrErr.output_list|sfGetErrorColor}-->;" id="output_list" size="20"> 52 <!--{html_options options=$arrOptions selected=$arrSelected}--> 189 53 </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> 54 </div> 205 55 206 <div class="btn"><button type="submit"><span>この内容で登録する</span></button></div>56 <div class="btn"><button type="submit"><span>この内容で登録する</span></button></div> 207 57 208 58 </div> -
branches/version-2_5-dev/data/class/pages/admin/contents/LC_Page_Admin_Contents_CSV.php
r18701 r18842 71 71 SC_Utils_Ex::sfIsSuccess($objSess); 72 72 73 $arrOutput = array();74 $arrChoice = array();75 76 73 $get_tpl_subno_csv = isset($_GET['tpl_subno_csv']) 77 74 ? $_GET['tpl_subno_csv'] : ""; … … 118 115 119 116 // 出力項目の取得 120 $arrOutput = SC_Utils_Ex::sfSwapArray($objCSV->sfgetCsvOutput($subno_id, 'status = 1')); 121 $arrOutput = SC_Utils_Ex::sfarrCombine($arrOutput['no'], $arrOutput['disp_name']); 117 $arrSelected = SC_Utils_Ex::sfSwapArray($objCSV->sfgetCsvOutput($subno_id, 'status = 1')); 118 119 if (!isset($arrSelected['no'])) $arrSelected['no'] = array(); 120 if (!isset($arrSelected['disp_name'])) $arrSelected['disp_name'] = array(); 121 122 $this->arrSelected = $arrSelected['no']; 122 123 123 124 // 非出力項目の取得 … … 127 128 if (!isset($arrChoice['disp_name'])) $arrChoice['disp_name'] = array(); 128 129 129 $arrChoice = SC_Utils_Ex::sfarrCombine($arrChoice['no'], $arrChoice['disp_name']); 130 $arrOptions = array_merge( 131 SC_Utils_Ex::sfarrCombine($arrSelected['no'], $arrSelected['disp_name']), 132 SC_Utils_Ex::sfarrCombine($arrChoice['no'], $arrChoice['disp_name']) 133 ); 130 134 131 $this->arrOutput=$arrOutput; 132 $this->arrChoice=$arrChoice; 133 135 $this->arrOptions = $arrOptions; 134 136 135 137 $this->SubnaviName = $this->arrSubnaviName[$subno_id];
Note: See TracChangeset
for help on using the changeset viewer.