1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
|
<?php include_once("./_common.php"); include_once($j3_path."/webhard/header.php");
//$where = " 1 and b_table = '{$id_cust}' "; $where = " 1 "; $order_key = " idx desc ";
$sql = "select count(*) as cnt from webhard where {$where} "; $cntinfo = sql_fetch($sql,$j3['connect_j3']); $total_count = $cntinfo['cnt'];
$list_num = 15; $total_page = ceil($total_count / $list_num); // 전체 페이지 계산 if ($page < 1) { $page = 1; } // 페이지가 없으면 첫 페이지 (1 페이지) $from_record = ($page - 1) * $list_num; // 시작 열을 구함
$sql = "select * from webhard a WHERE {$where} order by $order_key limit $from_record, $list_num"; //_pr($sql); $res = mysql_query($sql,$connect_j3); while($info=mysql_fetch_array($res)){ $file_array[] = $info; }
?> <link rel="stylesheet" href="./iconfont/css/fontello.css"/> <style> .pm_dir { display:inline-block; width:15px; font-size:1.1em; } .dir_tree_class li { padding:4px 0 2px 0; } </style> <div id="container"> <div id="wrapper">
<!-- 게시판 분류 영역 끝 --> <div class="mt30"> <div class="sub-btn-area"> <div class="sub-btn mb10"> <input type='button' value='파일 추가' onclick='add_file()'> </div> </div> <h3 class="mb10 txt14 align_l">Total <span class='total_cnt_class'><?php echo $total_count;?></span>건 <?php echo $page;?></h3>
<table class="width_full top_bold_line"> <colgroup> <col class="width50"> <col class="width80"><col class="width300"><col class="width300"> <col class="width140"><col class="width140"><col class="width140"> </colgroup> <thead> <tr> <th class="p15_0 txt14 gray_line_b"> <input type='checkbox' name='ck_all' class='check_all_class'> </th> <th class="p15_0 txt14 gray_line_b">번호</th> <th class="p15_0 txt14 gray_line_b">파일명</th> <th class="p15_0 txt14 gray_line_b">디렉토리</th> <th class="p15_0 txt14 gray_line_b">파일크기</th> <th class="p15_0 txt14 gray_line_b">등록일</th> <th class="p15_0 txt14 gray_line_b">관리</th> </tr> <thead> <tbody> <?php $num = $total_count - ($page - 1) * $list_num; for($i=0;$i<count($file_array);$i++){ $info = $file_array[$i]; if($info['idx']!=''){ ?> <tr> <td class="p15_0 txt14 gray2 align_c gray_line_b2"> <input type='checkbox' name='code_idx[]' value='<?php echo $i;?>' class='code_idx_class'> <input type='hidden' name='codes[]' value='<?php echo $info['idx'];?>'> <input type='hidden' name='b_tables[]' value='<?php echo $info['b_table'];?>'> </td> <td class="p15_0 txt14 gray2 align_c gray_line_b2"><?php echo $num;?><input type='hidden' name='codes[]' value='<?php echo $info['idx'];?>'></td> <td class="p15_0 txt14 gray2 gray_line_b2"><a href='./file_download.php?idx=<?php echo $info['idx'];?>'><?php echo $info['b_oriname'];?></a></td> <td class="p15_0 txt14 gray2 gray_line_b2"> <?php if($info['b_virt_dir']!=''){ echo $info['b_virt_dir']; } else { //echo "<input type='button' value='폴더선택' class='directory_btn_class'>"; } ?> </td> <td class="p15_0 txt14 gray2 align_c gray_line_b2"><?php echo number_format($info['b_filesize']);?></td> <td class="p15_0 txt14 gray2 align_c gray_line_b2"><?php echo substr($info['b_regdate'],0,10);?></td> <td class="p15_0 txt14 gray2 align_c gray_line_b2"> <input type='button' value='복사' class='copy_btn_class'> </td> </tr> <?php } $num--; } ?> </tbody> </table> </div>
<div class="mt20"> <!--<a class="float_l box100_40 white align_c l_height40 bg_red 1n1_delete_class">선택삭제</a>--> <div class="float_r"> <!--<a class="float_l mr10 box100_40 custom2 align_c bold l_height40 custom_line2 bg_white">목록</a>--> <?php if($bbsinfo['b_write_lv']<=$cust_info['mb_lv']){ ?> <!--<a class="float_l box100_40 white align_c bold l_height40 bg_custom2 board_new_class">게시글쓰기</a>--> <?php }?> </div> </div>
<div class='pg_wrap' style='padding-top:0px;'> <?php echo get_paging($list_num, $page, $total_page, "?$qstr");?> </div> <div class="sub-btn-area"> <div class="sub-btn"> <input type='button' value='폴더 이동' onclick='dir_move()'> <input type='button' value='선택 삭제' onclick='file_del()'> </div> </div> </div> </div> </div>
<script> $(function(){ $(".check_all_class").click(function(){ // 전체선택 전체선택 해제 if($(this).is(":checked")){ $("input[name='code_idx[]']").prop("checked",true); } else { $("input[name='code_idx[]']").prop("checked",false); } });
$(".directory_btn_class").click(function(){ $tr_obj = $(this).closest("tr"); $idx = $tr_obj.find("input[name='codes[]']").val(); $("#dir_move_form input[name='idx']").val($idx); load_dir1(); $("#modal_member_box2").dialog({ resizable: true, height:400, width:600, modal: true, title:"폴더 [선택]", buttons: { 폴더선택: function() { dir_save(); }, 닫기: function() { $( this ).dialog( "close" ); } } }); });
$(".copy_btn_class").click(function(){ $idx = $(this).closest("tr").find("input[name='codes[]']").val(); $("#dir_move_form input[name='idxs']").val($idx); load_dir1(); $("#modal_member_box2").dialog({ resizable: true, height:400, width:600, modal: true, title:"복사 [선택]", buttons: { 복사선택: function() { file_copy(); }, 닫기: function() { $( this ).dialog( "close" ); } } }); }); });
function dir_save(){ if($("input[name='cur_dir']").val()=='' && $("input[name='new_dir']").val()==''){ alert('폴더를 선택하시거나 추가하시기 바랍니다.'); return; } $form_obj = $("#dir_move_form"); form_data = $form_obj.serialize(); form_data = form_data + "&mode=dir"; $.post("ajax.file_list_process.php",form_data,function(rtn){ if(rtn=='OK'){ document.location.reload(); } else { alert(rtn); } });
}
function file_copy(){ if($("input[name='cur_dir']").val()=='' && $("input[name='new_dir']").val()==''){ alert('폴더를 선택하시거나 추가하시기 바랍니다.'); return; } $form_obj = $("#dir_move_form"); form_data = $form_obj.serialize(); form_data = form_data + "&mode=file_copy"; $.post("ajax.file_list_process.php",form_data,function(rtn){ if(rtn=='OK'){ document.location.reload(); } else { alert(rtn); } }); }
function dir_move(){ $flag = 0; $flag_idx = ""; $(".code_idx_class").each(function(){ if($(this).is(":checked")){ $v = $(this).closest("td").find("input[name='codes[]']").val(); $flag_idx = $flag_idx + $v+","; } }); $flag_idx = $flag_idx.substr(0,$flag_idx.length-1); if($flag_idx==''){ alert('이동할 파일을 선택하시기 바랍니다.'); return; } $("#dir_move_form input[name='idxs']").val($flag_idx); load_dir1(); $("#modal_member_box2").dialog({ resizable: true, height:400, width:600, modal: true, title:"폴더 [선택]", buttons: { 폴더선택: function() { dir_save(); }, 닫기: function() { $( this ).dialog( "close" ); } } }); }
function file_del(){ $flag = 0; $flag_idx = ""; $(".code_idx_class").each(function(){ if($(this).is(":checked")){ $v = $(this).closest("td").find("input[name='codes[]']").val(); $flag_idx = $flag_idx + $v+","; } }); $flag_idx = $flag_idx.substr(0,$flag_idx.length-1); if($flag_idx==''){ alert('삭제할 파일을 선택하시기 바랍니다.'); return; } if(confirm('해당파일들을 정말로 삭제하시겠습니까?')){ $("#dir_move_form input[name='idxs']").val($flag_idx);
$form_obj = $("#dir_move_form"); form_data = $form_obj.serialize(); form_data = form_data + "&mode=file_del"; $.post("ajax.file_list_process.php",form_data,function(rtn){ if(rtn=='OK'){ document.location.reload(); } else { alert(rtn); } }); }
}
function add_file(){ $("#modal_member_box3 .attached_class").html('');
$v = $(".file_attach_input").val(); $(".file_td").html($v);
$("#modal_member_box3").dialog({ resizable: true, height:600, width:800, modal: true, title:"파일 업로드 [선택]", buttons: { 닫기: function() { //$( this ).dialog( "close" ); document.location.reload(); } } }); } </script> <div id="modal_member_box2" class='modal_class' title="거래처수정" style="display:none;width:100%; height:100%; padding-top:3px;padding-left:3px;background-color:#FFFFFF;position:relative;"> <?php include("dir.inc.php");?> </div>
<div id='debug' class='none'></div>
<div id="modal_member_box3" class='modal_class' title="거래처수정" style="display:none;width:100%; height:100%; padding-top:3px;padding-left:3px;background-color:#FFFFFF;position:relative;"> <script> $(function(){ $("#file_form").ajaxForm({ dataType: 'json', beforeSend: function() { $('#debug').append( "beforeSend...\n" ); }, complete: function(data) { $('#debug') .append( "complete...\n" ) .append( JSON.stringify( data.responseJSON ) + "\n" ); obj = data.responseJSON; $(".attached_class").append(obj.file_html);
$("#file_form input[name^=attach]").each(function(){ // 첨부파일 필드 초기회 if($(this).attr("type")=='file'){ $(this).val(''); } }); $(".foo_class").hide(); } });
$(".file_process_class").click(function(){ $file_cnt = 0; $("#file_form input[name='attach[]']").each(function(){ $val = $(this).val(); if($val!=''){ $file_cnt++; } }); if($file_cnt==0){ alert('첨부파일을 등록하시기 바랍니다.'); return; }
$("#file_form").submit(); });
$(".add_file_upload").click(function(){ $v = $(".file_attach_input").val(); $(".file_td").append($v); });
$(document).on("click",".file_del_class",function(){ $this = $(this); if(confirm('정말로 삭제하시겠습니까?')){ $idx = $(this).data('idx'); form_data = "mode=del&idx="+$idx $.post("./ajax.file_upload_process.php",form_data,function(rtn){ if(rtn=='OK'){ $obj = $this.closest("p"); $obj.remove(); } else { alert(rtn); } }); } });
$(document).on("change","input[name='attach[]']",function(){ // 이미지 미리 보기 readURL(this); });
$(document).on("click",".f_box_del_class",function(){ // 첨부 input삭제 if($(".f_box_del_class").length>1){ $(this).closest("p").remove(); } });
});
function show_debug($v){ $("#debug").append("<p>§"+$v+"§</p>"); }
function readURL(input) { $fn = $(input).val().split("."); $ext = $fn[$fn.length-1].toLowerCase(); if($ext=='jpg' || $ext=='png' || $ext=='gif'){ if (input.files && input.files[0]) { var reader = new FileReader(); reader.onload = function(e) { $img = $(input).closest("p").find("#foo"); $img.attr('src', e.target.result); $img.show(); } reader.readAsDataURL(input.files[0]); } } }
function dir_select(){ load_dir1(); $("#modal_member_box2").dialog({ resizable: true, height:400, width:600, modal: true, title:"폴더 [선택]", buttons: { 폴더선택: function() { $("#modal_member_box3 input[name='cur_dir']").val($("#modal_member_box2 input[name='cur_dir']").val()); $("#modal_member_box3 input[name='new_dir']").val($("#modal_member_box2 input[name='new_dir']").val()); $( this ).dialog( "close" ); }, 닫기: function() { $( this ).dialog( "close" ); } } }); } </script>
<script src='<?php echo $j3_js_url?>/jquery.form.min.js'></script> <form name='file_form' id='file_form' method='post' onsubmit='return false;' action="ajax.file_upload_process.php" enctype='multipart/form-data'> <input type='hidden' name='session_key' value='<?php echo $session_key?>'> <section class="mt50 width_full top_bold_line gray_line_b2"> <!-- 받으시는 분 입력 시작 { --> <div class="float_l width800 p20_50 gray_r_line2"> <table class="width_full"> <caption class="mb20 txt16 bold align_l">파일업로드</caption> <colgroup> <col class="width100"><col class=""> </colgroup> <tbody> <tr> <th scope="row" class="p5_0 gray2 align_l"> <input type='button' value='폴더 선택' onclick='dir_select()'> </th> <td class="p3_0"> <input type='text' name='cur_dir' readonly value='' class='width300' style=''>/<input type='text' name='new_dir' value='' class='width100'>(새폴더추가) </td> </tr> <tr> <th scope="row" class="p5_0 gray2 align_l">첨부파일</th> <textarea class='none file_attach_input'><p class='pt5'><input type='file' name='attach[]'> <img id='foo' src='' class='none foo_class' style='max-width:200px;'> <span class='f_box_del_class'>[x]</span></p></textarea><!-- 추가 복사용 --> <td class="p3_0 file_td"> <p class='pt5'><input type='file' name='attach[]'> <img id='foo' src='' class='none foo_class' style='max-width:200px;'></p> </td> </tr> <tr> <td>첨부된 파일</> <td class='attached_class'>
</td> </tr> </table> </div> <!-- } 받으시는 분 입력 끝 -->
</section> <!-- } 배송정보 끝 --> </form>
<!--버튼--> <div class="mt50 align_c"> <input type="button" class="box170_50 white bold line0 bg_custom2 pointer file_process_class" value="업로드하기" /> <input type="button" class="box170_50 custom2 bold align_c bg_white custom_line2 pointer add_file_upload" value="파일추가" /> </div> <!--//버튼-->
</div>
|