/** @ program : javascript ui framework; @ auth : thKim™ @ desc : 공통자바스크립트 **/ $.file = function(limit, bbstype, bbsid){ this.limit = (limit)?limit:1, this.type = bbstype; this.bbsid = bbsid; this.url = "/common/modules/upload.php"; this.url_ok = "/common/modules/upload_ok.php"; /* this.urlone = "/common/upload_one.php"; this.urlone_ok = "/common/upload_one_ok.php" */ }; $.file.prototype = { Selected:function(f){ if (f) { var obj = f.options; if (obj.length==null) {cnt=0;} else {cnt=obj.length;} for (var i=0; i"; fwFilePop.Init(); window.onresize = function() { fwFilePop.setStatus(); } } else { alert("업로드 모듈이 설치되지 않았습니다. \n새로고침 하신 후 다시 시도하시기 바랍니다."); return; } }, Upload:function(f) { try { var frm = $.Id("attfile[]"); if ((frm.length-1) < this.limit) { // $.Modal(this.url+'?bbsid='+this.bbsid+'&filecnt='+(this.limit-frm.length+1), 'upload', '410', '165', 'no'); var url = this.url+'?bbsid='+this.bbsid+'&filecnt='+(this.limit-frm.length+1)+'&type='+this.type+'&mode=multi'; this.Module(url); } else { alert("첨부파일은 "+this.limit + "개 이상 올릴 수 없습니다."); return; } } catch (e) { $.Error(e); } }, UploadOne:function(type, f) { try { var frm = eval(f); if (frm.value.length==0) { /*$.Modal(this.urlone + '?bbsid='+this.bbsid+'&f='+f+'&type='+type, 'upload', '410','165','no');*/ var url = this.url+"?bbsid="+this.bbsid+"&f="+f+"&type="+type+"&mode=single"; this.Module(url); } else { alert("이미등록된 파일을 삭제 후 시도하세요."); return; } } catch (e) { $.Error(e); } }, UploadTrack:function(type, f) { try { var frm = eval(f); if (frm.value.length==0) { /*$.Modal(this.urlone + '?bbsid='+this.bbsid+'&f='+f+'&type='+type, 'upload', '410','165','no');*/ if (confirm("트랙정보를 업로드하시면, 등록된 트랙정보는 모두 초기화됩니다.")) { parent.fTable.init(); var url = this.url_track+"?bbsid="+this.bbsid+"&f="+f+"&type="+type+"&mode=single"; this.Module(url); } } else { alert("이미등록된 파일을 삭제 후 시도하세요."); return; } } catch (e) { $.Error(e); } }, Delete:function(f){ try { var frm = document.frmdelete; if ($.Id("attfile[]").length==1) { alert("첨부된 파일이 없습니다."); return; } if ($.Id("attfile[]").selectedIndex<=0) { alert("선택된 파일이 없습니다."); return; } selectedfile = $.Id("attfile[]").selectedIndex; frm.oldfile.value = $.Id("attfile[]").options[selectedfile].value; if (confirm("삭제하시겠습니까?")) { frm.action = this.url_ok; frm.gbn.value = "delete"; frm.mode.value = "multi"; frm.target = $._actionfrm; frm.submit(); /*리스트의 위치를 한칸씩 위로 올린다.*/ for(i = selectedfile; i < $.Id("attfile[]").length-1; i++) { $.Id("attfile[]").options[i].value = $.Id("attfile[]").options[i+1].value; $.Id("attfile[]").options[i].text = $.Id("attfile[]").options[i+1].text; } $.Id("attfile[]").length--; return; } } catch (e) { $.Error(e); } }, DeleteOne:function(f, mode){ try { var f2 = document.frm; var frm = document.frmdelete; if (f.value.length==0) { alert("등록된 파일이 없습니다."); return; } frm.oldfile.value = f2.gbn.value+"|"+f.value+"|"+mode; if (confirm("삭제하시겠습니까?")) { try { eval("document.frm."+mode+"_original").value=""; } catch (ef) { } f.value=""; frm.action = this.url_ok; frm.gbn.value = "delete"; frm.mode.value = "single"; frm.target = $._actionfrm; frm.submit(); } return; } catch (e) { $.Error(e); } }, UploadCheck:function(obj, type) { var array_images = Array("jpg", "gif", "png", "bmp", "jpeg", "swf"); var array_script = Array("php", "asp", "jsp", "cgi", "shtml", "php3", "js", "exe"); var array_movie = Array("wmv", "asf", "mpeg", "mpg", "avi", "flv", "mp4", "dv", "mov", "3qp", "skm", "k3g", "m4v", "mkv", "ts", "ogv"); var array_track = Array("csv"); try { var filename = $.Lower(obj.value); var intlen = filename.length; var ext = filename.substr(intlen-3, 3); var bln = false; if (type=="images") { for (i=0;i