/*************************************************************************** * filename : FFForm.js
* Form을 제어하는 클래스
* * @version : 1.0 * @author : Copyright (c) 2003 by free270. All Rights Reserved. ****************************************************************************/ if(FFFORM_CLASS!=null) { alert("[FFForm.js]는 이미 include 되어있습니다!!"); } var FFFORM_CLASS = true; function FFFormClass(){ var form, prefix var defaultWritePage, defaultListPage, defaultViewPage, defaultXTDeletePage, defaultXTWritePage this.fileserver_url = ""; this.defaultListPage = "frmList.asp"; this.defaultViewPage = "frmView.asp"; this.defaultWritePage = "frmWrite.asp"; this.defaultXTDeletePage = "actDelete.asp"; this.defaultXTWritePage = "actWrite.asp"; this.toString = FFForm_toString; this.getForm = FFForm_getForm; this.setForm = FFForm_setForm; this.setPrefix = FFForm_setPrefix; this.setFileserverURL = FFForm_setFileserverURL; this.goView = FFForm_goView; this.goBefore = FFForm_goBefore; this.goNext = FFForm_goNext; this.goWrite = FFForm_goWrite; this.goReply = FFForm_goReply; this.goEdit = FFForm_goEdit; this.goXTWrite = FFForm_goXTWrite; this.goDelete = FFForm_goDelete; this.goXTDelete = FFForm_goXTDelete; this.goSubmit = FFForm_goSubmit; this.search = FFForm_search; this.goSearch = FFForm_goSearch; this.goList = FFForm_goList; this.goPage = FFForm_goPage; this.reset = FFForm_reset; this.goBack = FFForm_goBack; this.setSearchType = FFForm_setSearchType; this.setSearchTypeSelectBox = FFForm_setSearchTypeSelectBox; this.selectedValue = FFForm_selectedValue; this.setPrefix("PR_"); } var FFForm = new FFFormClass(); /*###########[아래 함수들은 클래스의 정의를 ]######################*/ /*###########[위해서만 사용됩니다. ]######################*/ /*###########[직접 사용하시지 마시고 위에 정의된 ]######################*/ /*###########[클래스를 이용해 호출해 주세요 ]######################*/ function FFForm_getForm(){ if(this.form==null){ return document.frm_act; }else{ return this.form; } } function FFForm_toString(){ return "prefix=" + this.prefix + ", getFileserverURL() = " + this.fileserver_url + ", form = " + this.getForm(); } function FFForm_setForm(form){ this.form = form; } function FFForm_setPrefix(prefix){ if(prefix==null){ this.prefix = ""; }else{ this.prefix = prefix; this.defaultListPage = this.prefix + this.defaultListPage; this.defaultViewPage = this.prefix + this.defaultViewPage; this.defaultWritePage = this.prefix + this.defaultWritePage; this.defaultXTDeletePage = this.prefix + this.defaultXTDeletePage; this.defaultXTWritePage = this.prefix + this.defaultXTWritePage; } } function FFForm_setFileserverURL(fileserver_url){ if(fileserver_url==null){ this.fileserver_url = ""; }else{ this.fileserver_url = fileserver_url; } } function FFForm_goView( number ){ if (number==0) return; this.getForm().encoding = "application/x-www-form-urlencoded"; this.getForm().action = this.defaultViewPage; this.getForm().sCnum.value = number; this.getForm().encoding = "application/x-www-form-urlencoded"; this.getForm().submit(); } function FFForm_goBefore( num ){ if(num<0){ alert("이전내용이 없습니다."); return; } this.getForm().encoding = "application/x-www-form-urlencoded"; this.getForm().action = this.defaultViewPage; this.getForm().sCnum.value = num; this.getForm().encoding = "application/x-www-form-urlencoded"; this.getForm().submit(); } function FFForm_goNext( num ){ if(num<0){ alert("다음 내용이 없습니다."); return; } this.getForm().encoding = "application/x-www-form-urlencoded"; this.getForm().action = this.defaultViewPage; this.getForm().sCnum.value = num; this.getForm().encoding = "application/x-www-form-urlencoded"; this.getForm().submit(); } function FFForm_goWrite(url){ this.getForm().action = this.defaultWritePage; this.getForm().sWt.value= "add"; this.getForm().encoding = "application/x-www-form-urlencoded"; this.getForm().submit(); } function FFForm_goReply(){ this.getForm().action = this.defaultWritePage; this.getForm().sWt.value = "reply"; this.getForm().encoding = "application/x-www-form-urlencoded"; this.getForm().submit(); } function FFForm_goEdit(cnum){ if(cnum!=null){ this.getForm().sCnum.value = cnum; } this.getForm().action = this.defaultWritePage; this.getForm().sWt.value = "edit"; this.getForm().encoding = "application/x-www-form-urlencoded"; this.getForm().submit(); } function FFForm_goXTWrite(){ this.getForm().action = this.fileserver_url + this.defaultXTWritePage; this.getForm().submit(); } function FFForm_goDelete( ){ this.goXTDelete(this.defaultXTDeletePage,true); } function FFForm_goXTDelete( showmsg){ if(showmsg==null||showmsg){ if(confirm("정말로 삭제 하시겠습니까?")==false){ return; } } this.getForm().action = this.fileserver_url + this.defaultXTDeletePage; this.getForm().encoding = "application/x-www-form-urlencoded"; this.getForm().submit(); } function FFForm_setSearchType(data){ if(this.getForm().sStype.type!="select-one"){ FFCheckbox.checkByData(this.getForm().sStype,data,", "); }else{ this.getForm().sStype.value = data; } } function FFForm_setSearchTypeSelectBox(data){ this.getForm().sStype.value = data; } function FFForm_selectedValue(obj){ FFSelectbox.selectedValue(obj); } function FFForm_goSubmit(){ this.getForm().submit(); } function FFForm_search(){ if(!this.goSearch()){ return; } this.goSubmit(); } function FFForm_goSearch(){ if(this.getForm().sStype !=null){ var sStype_type = this.getForm().sStype.type; if(sStype_type !="select-one"){ if(sStype_type==null){ if(FFCheckbox.checkedCount(this.getForm().sStype)<1 && this.getForm().sSkey.value != ""){ alert("검색 항목을 선택하세요!!"); return false; } if(FFCheckbox.checkedCount(this.getForm().sStype)>0 && this.getForm().sSkey.value == ""){ alert("키워드를 입력하세요!!"); return false; } } }else{ } } this.getForm().action = this.defaultListPage; this.getForm().encoding = "application/x-www-form-urlencoded"; this.getForm().iPageNo.value = "1"; this.getForm().submit(); } function FFForm_goList(){ this.getForm().action = this.defaultListPage; this.getForm().encoding = "application/x-www-form-urlencoded"; this.getForm().submit(); //history.back(); } function FFForm_goPage(page){ this.getForm().iPageNo.value = page; this.getForm().action = this.defaultListPage; this.getForm().encoding = "application/x-www-form-urlencoded"; this.getForm().submit(); //history.back(); } function FFForm_reset(){ this.getForm().reset(); } function FFForm_goBack(){ window.history.go(-1); } //enctype="multipart/form-data"