/*************************************************************************** * filename : FFForm.js
* Form을 제어하는 클래스
* * * GET방식으로운영될때 불필요한 form value가 넘어 가면서 URL의 길이가 한계에 달해서 생기는 * 문제를 filter()함수를 이용하여 해결한다. 주의해야 할 점은 goXTWrite()를 제외한 모든 액션함수에서 * 이 함수가 호출되므로 다음단계로 값을 넘겨야 하는 field는 모두 trans="true" 속성을 준다 * * @version : 1.1 * @author : Copyright (c) 2005 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.filter = FFForm_filter; this.setPrefix(""); } 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; if(number != null){ this.getForm().sCnum.value = number; } this.getForm().encoding = "application/x-www-form-urlencoded"; this.filter(); 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.filter(); 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.filter(); 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.filter(); 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.filter(); 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.filter(); 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.filter(); 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.filter(); 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.filter(); this.getForm().submit(); } function FFForm_filter(){ var frm = this.getForm(); var tmp for(var tmp in frm.all){ try{ var obj = frm.all[tmp]; if(obj.length == null || obj.type == "select-multiple" || obj.type == "select-one"){ if(obj.type != null && ( obj.type == "text" || obj.type == "textarea" || obj.type == "hidden" || obj.type == "radio" || obj.type == "checkbox" || obj.type == "select-multiple" || obj.type == "select-one" )){ if(obj.trans!=null && obj.trans.toLowerCase()=="true"){ }else{ obj.disabled = true; } } }else{ for(var i=0;i