var JSONResponse = jQuery.Class.create( { _formId: null, _exception: null, _errors: null, _valid: false, init : function( transport , status, xhr) { // Check content type var contentType = xhr.getResponseHeader("content-type"); //20110712 ums //22-apache 셋팅된 서버에서는 오류가 났다. contentType = text/plain //21 - none return; //if ( contentType == null ) return; //if ( contentType == ( "application/json,charset=UTF-8" ) ) return; try { var json = transport; this._formId = json[ 'formId' ]; alert(this._formId); alert(this._formId.html()); this._exception = json[ 'exception' ]; this._errors = $H( json[ 'errors' ] ); this._valid = true; } catch ( e ) {} }, getFormId: function() { return this._formId; }, getException: function() { return this._exception; }, isValid: function() { return this._valid; }, hasErrors: function() { return this.getException() != null || this.hasFieldErrors(); }, hasFieldErrors: function() { if ( this._errors == null ) return false; return this._errors.keys().length > 0; }, getFirstErrorField: function() { return this._errors.keys()[ 0 ]; }, getFirstErrorMessage: function() { return this._errors.get( this.getFirstErrorField() )[ 0 ]; }, showErrors: function() { if ( this.getException() != null ) { if ( this.getException() == '로그인이 필요합니다.' ) executeAction( contextPath + '/comm/support/login/loginForm', { redirUrl: location.href } ); else alert( this.getException() ); return null; } if ( this.hasFieldErrors() ) { alert( this.getFirstErrorMessage() ); return this.getFirstErrorField(); } return null; }, toString: function() { var returnStr = ""; returnStr = returnStr + "formId : " + this._formId; returnStr = returnStr + ", exception : "+ this._exception; returnStr = returnStr + ", errors : " + this._errors; returnStr = returnStr + ", valid : " + this._valid; return returnStr; } } ); function _actionToUrl( action ) { return action + '.action'; } function executeAction( action, paramsJson ) { var url = _actionToUrl( action ); //if ( paramsJson != null ) url += '?' + $H(paramsJson).toQueryString(); //location.href = url; //post 방식만 가능한 서버 상황에 따라서 변경적용. ums 20110713 if ( paramsJson != null ) mkPost($H(paramsJson).toQueryString()); $("#menu").attr("action",url); $("#menu").submit(); } function validate( form ) { new Ajax.Request( form.action, { method: form.method, parameters: Form.serialize( form ) + '&struts.enableAjaxValidation=true&struts.formId=' + form.id, onComplete: function( transport ) { var response = new JSONResponse( transport ); if ( response.hasErrors() ) { var field = response.showErrors(); try { if ( field != null ) form[ field ].activate();} catch (e) {} } else form.submit(); } } ); return false; } function validateAndSubmit( form ) { var success = true; /* var success = true; new Ajax.Request( form.action, { method: form.method, parameters: Form.serialize( form ), asynchronous: false, onSuccess: function( transport ) { var response = new JSONResponse( transport ); if ( response.hasErrors() ) { success = false; var field = response.showErrors(); try { if ( field != null ) form[ field ].activate();} catch (e) {} } } } ); */ var result; var xhr = $.ajax({ url: $(form).attr("action"), type:'post', data: $(form).serialize(), dataType: "json", success: function(transport,status,xhr) { var response = new JSONResponse( transport,status,xhr ); if ( response.hasErrors() ) { response.showErrors(); return; } result = transport; }, error: function(transport,status,xhr) { }, complete: function(transport,status,xhr) {} }); return success; } function validateAndRequest( action, paramsJson, asyncHandler, lodingHandler ) { var url = _actionToUrl( action ); var success = true; var asyncYn = false; if (asyncHandler != null) asyncYn = true; new Ajax.Request( url, { method: 'post', parameters: $H( paramsJson ).toQueryString(), asynchronous: asyncYn, onLoading: lodingHandler, onComplete: function( transport ) { var response = new JSONResponse( transport ); if ( response.hasErrors() ) { response.showErrors(); success = false; } if (asyncHandler != null) asyncHandler(success); } } ); return success; } function requestData( action, paramsJson, asyncHandler, lodingHandler ) { var asyncYn = false; if (asyncHandler != null) asyncYn = true; var url = _actionToUrl( action ); var result = null; if(paramsJson == "undefined" || paramsJson == null ){ paramsJson = null; } var xhr = $.ajax({ url: url, async: asyncYn, type:'post', data: $H(paramsJson).toQueryString(), dataType: "json", success: function(transport,status,xhr) { var response = new JSONResponse( transport,status,xhr ); if ( response.hasErrors() ) { response.showErrors(); return; } result = transport; if (asyncHandler != null) asyncHandler(result); }, error: function(transport,status,xhr) { }, complete: function(transport,status,xhr) {} }); return result; } function requestDataLoading( action, paramsJson, asyncHandler, lodingHandler ) { $.blockUI(); var asyncYn = false; //asyncYn = true; var url = _actionToUrl( action ); var result = null; if(paramsJson == "undefined" || paramsJson == null ){ paramsJson = null; } var xhr = $.ajax({ url: url, async: asyncYn, type:'post', data: $H(paramsJson).toQueryString(), dataType: "json", success: function(transport,status,xhr) { var response = new JSONResponse( transport,status,xhr ); if ( response.hasErrors() ) { response.showErrors(); return; } result = transport; }, error: function(transport,status,xhr) { $.unblockUI(); }, complete: function(transport,status,xhr) { $.unblockUI(); } }); return result; } function requestQueryLoading( action, Query, asyncHandler, lodingHandler ) { $.blockUI(); var asyncYn = false; //asyncYn = true; var url = _actionToUrl( action ); var result = null; var xhr = $.ajax({ url: url, async: asyncYn, type:'post', data: Query, dataType: "json", success: function(transport,status,xhr) { var response = new JSONResponse( transport,status,xhr ); if ( response.hasErrors() ) { response.showErrors(); return; } result = transport; }, error: function(transport,status,xhr) { $.unblockUI(); }, complete: function(transport,status,xhr) { $.unblockUI(); } }); return result; } function updateContainer( container, action, paramsJson, asyncYn ) { if (asyncYn == null) asyncYn = true; var url = _actionToUrl( action ); var success = true; new Ajax.Updater( container, url, { method: 'post', asynchronous: asyncYn, parameters: $H( paramsJson ).toQueryString(), onComplete: function( transport ) { var response = new JSONResponse( transport ); if ( response.hasErrors() ) { $(container).update(); response.showErrors(); success = false; } } } ); return success; } function doProgress( progress ) { ProgressBar.show(); var script = '_doProgress( ' + progress + ' );'; setTimeout( script, 0 ); } function _doProgress( progress ) { progress(); ProgressBar.hide(); } function requestBatch( action, handlerOnComplete, paramsJson ) { var script = '_requestBatch( \'' + action + '\', ' + handlerOnComplete + ', ' + $H( paramsJson ).toJSON() + ' );'; setTimeout( script, 0 ); } function _requestBatch( action, handlerOnComplete, paramsJson ) { var url = _actionToUrl( action ); var success = true; var xhr = $.ajax({ url: url, async: false, type:'post', data: $H(paramsJson).toQueryString(), dataType: "json", success: function(transport,status,xhr) { var response = new JSONResponse( transport,status,xhr ); if ( response.hasErrors() ) { response.showErrors(); return; } handlerOnComplete( success, success ? transport : null ); }, error: function(transport,status,xhr) { }, complete: function(transport,status,xhr) {} }); } function setStyle( cssRule, style ) { $( cssRule ).each( function( item,idx ) { item.css(style); } ); } function findElement( cssRule ) { var items = $( cssRule ); if ( items == null ) return null; return items[ 0 ]; } function openReportPopup( reportFileName, showToolbar, readonly, rpArgs, rvArgs, width, height, actionName ) { var rp = ''; var rv = ''; if ( rpArgs != null ) for ( var i = 0; i < rpArgs.length; i++ ) rp += '[' + rpArgs[ i ] + '] '; var hash = $H( rvArgs ); hash.$( 'url', location.href ); hash.forEach( function( value , key ) { rv += key + '[' + value + '] '; } ); if ( width == null || height == null ) { width = '800'; height = '600'; } openPopup( $H({ width: width, height: height }), actionName==null ? contextPath + '/common/reportPopup.action' : actionName, { reportFileName: reportFileName, showToolbar: showToolbar, readonly: readonly, url: location.href, rpArgs: rp, rvArgs: rv, height: height, scrollbars: 'yes', resizable:'yes' }, 'report' ); } /** * openHelp 도움팝업을 호출한다. */ function openHelp() { var url = location.href; var first = url.indexOf( '/', 7 ); var last = url.lastIndexOf( '/' ); openPopup( { width: 750, height: 550 }, contextPath + '/comm/program/mngProgram/helpPopup.action', { 'program.prog_url': url.substring( first, last + 1 ) } ); } /* * openPopup 함수 : 팝업창을 호출하면서 값을 전달 하는 함수 * + parma1 : 창 사이즈 및 위치 조정 정의(옵션) * + param2 : 호출할 팝업창 URL * + param3 : 전달할 매개변수 */ function openPopup(options, url, paramsHash, popupId) { var strOptions = ''; var popId = popupId; var width = 500; var height = 500; var ah = screen.availHeight - 30; var aw = screen.availWidth - 10; var xc = (aw - width) / 2; var yc = (ah - height) / 2; if ( typeof options === "string" ) strOptions = options; else { // Default Values var defaultOptions = $H({ width : width, height : height, left : xc, screenX : xc, top : yc, screenY : yc, toolbar : "no", scrollbars : "no" }); defaultOptions.update(options); defaultOptions.forEach( function( value,key ) { if ( strOptions != '' ){ strOptions += ', '; } strOptions += key + '=' + value; } ); } //if ( paramsHash != null ) url += '?' +$H(paramsHash).toQueryString(); if ( popId == null ) popId = '_blank'; var win = window.open("/eess/popup.jsp", popId, strOptions); mkPost($H(paramsHash).toQueryString()); $("#menu").attr("action",url); $("#menu").attr("target",popId); $("#menu").submit(); $("#menu").attr("target","_self"); return win; } function mkPost(str){ var ar = str.split("&"); $("#menu").html(""); for(var i = 0;i"); } } /* * openPopup 함수 : 팝업창을 호출하면서 값을 전달 하는 함수 * + parma1 : 창 사이즈 및 위치 조정 정의(옵션) * + param2 : 호출할 팝업창 URL * + param3 : 전달할 매개변수 */ function openPopupH(options, url, paramsHash, popupId) { var strOptions = ''; var popId = popupId; var width = 500; var height = 500; var ah = screen.availHeight - 30; var aw = screen.availWidth - 10; var xc = (aw - width) / 2; var yc = (ah - height) / 2; if ( Object.isString(options) ) strOptions = options; else { // Default Values var defaultOptions = $H({ width : width, height : height, left : xc, screenX : xc, top : yc, screenY : yc, toolbar : 'no', scrollbars : 'yes' }); defaultOptions.update(options); defaultOptions.each( function( pair ) { if ( strOptions != '' ) strOptions += ', '; strOptions += pair.key + '=' + pair.value; } ); } if ( paramsHash != null ) url += '?' + $H(paramsHash).toQueryString(); if ( popId == null ) popId = '_blank'; window.open(url, popId, strOptions); } /* function showDialog(options, url, paramsHash) { var strOptions = ''; var width = 445; var height = 490; var ah = screen.availHeight - 30; var aw = screen.availWidth - 10; var xc = (aw - width) / 2; var yc = (ah - height) / 2; if ( Object.isString(options) ) strOptions = options; else { // Default Values var defaultOptions = $H({ dialogWidth : width+"px", dialogHeight : height+"px", dialogLeft : xc, dialogTop : yc, maximize : 'no', minimize : 'no', center : 'yes', scroll : 'no', status : 'no', help : 'no' }); defaultOptions.update(options); defaultOptions.each( function( pair ) { if ( strOptions != '' ) strOptions += '; '; strOptions += pair.key + ':' + pair.value; } ); } if ( paramsHash != null ) url += '?' + $H(paramsHash).toQueryString(); return window.showModalDialog(url, '', strOptions); } */ function searchSecondSelect(param, actionName) { var actName = ""; if(actionName==null) actName = "doubleSelectLink.action"; // default else actName = actionName+'.action'; var ajax = new Ajax.Request( actName, { method: 'post', parameters: param.toQueryString() } ); } /** * 입력 필드 관련 Utils */ var Utils = { _getFieldType: function( fieldId ) { var field = $( fieldId ); if ( field == null ) return null; var type = field.attr('tagName'); if ( type == 'INPUT' ) type += '_' + $(field).attr('type'); return type; }, focus: function( fieldId ) { var field = $( fieldId ); var type = this._getFieldType( fieldId ); if ( field == null ) return; if ( type == 'INPUT_hidden' ) field = $( field.id + '_' ); field.focus(); field.select(); }, /** * 필드의 값을 변경한다. */ _setFieldValue: function( fieldId, value ) { if ( value == null ) return; value = value.toString(); var field = $( fieldId ); var type = this._getFieldType( fieldId ); if ( field == null ) return; var disabled = $(field).attr('disabled'); $(field).attr('disabled',false); switch ( type ) { case 'INPUT_text': $(fieldId).val(value); case 'INPUT_password':$(fieldId).val(value); case 'TEXTAREA': field.value = value; break; case 'INPUT_checkbox': field.checked = value == 'true'; break; case 'INPUT_hidden': field.value = value; var coverField = $( field.id + '_' ); // DatePicker 또는 TimePicker인 경우 if ( coverField != null && coverField.hasClass( 'datePicker' ) ) coverField.value = eval( 'DatePicker._toCoverValue( \'' + value + '\' )' ); if ( coverField != null && coverField.hasClass( 'timePicker' ) ) coverField.value = eval( 'TimePicker._toCoverValue( \'' + value + '\' )' ); if ( coverField != null && coverField.hasClass( 'moneyPicker' ) ) coverField.value = eval( 'MoneyPicker._toCoverValue( \'' + value + '\' )' ); break; case 'SELECT': /* for ( var i = 0; i < $(field).find('option').length; i++ ) { if ( field.options[ i ].value == value ) { field.selectedIndex = i; break; } if ( i == field.options.length - 1 ) field.selectedIndex = 0; } */ $(field).find('option').val(value); break; case 'DIV': case 'SPAN': case 'TD': $(fieldId).update(value); break; } $(field).attr('disabled',disabled) }, /** * 필드의 값을 변경하고 변경되었음을 알리는 이벤트를 발생시킨다. */ setFieldValue: function( fieldId, value ) { this._setFieldValue( fieldId, value ); var field = $( fieldId ); var type = this._getFieldType( fieldId ); if ( field == null ) return; switch ( type ) { case 'INPUT_text': $(fieldId).val(value); case 'INPUT_password':$(fieldId).val(value); case 'TEXTAREA': $(fieldId).val(value); case 'SELECT': this.fireEvent( fieldId, 'change' ); break; case 'INPUT_hidden': var coverField = $( field.id + '_' ); if ( coverField != null ) this.fireEvent( coverField, 'change' ); break; case 'INPUT_checkbox': this.fireEvent( fieldId, 'click' ); break; } }, getFieldValue: function( fieldId ) { var field = $( fieldId ); var type = this._getFieldType( fieldId ); if ( field == null ) return null; switch ( type ) { case 'INPUT_text':return $(fieldId).val(); case 'INPUT_password':return $(fieldId).val(); case 'INPUT_hidden':return $(fieldId).val(); case 'TEXTAREA': return $(fieldId).val(); case 'SELECT': return $(field).val(); case 'INPUT_checkbox': /* 프로그램별 checkbox 처리..--; */ if($(".grid table tr").length > 0 && v_prog!=null){ switch(v_prog){ case "CM102": var rowId=grid.getSelectedRowId(); if($(field).attr("checked") ){ grid.setValue(rowId,'existflag','1'); }else{ grid.setValue(rowId,'existflag','0'); } grid.save(); break; case "SC100": var rowId=grid.getSelectedRowId(); for(var s=1;s<4;s++){ grid.setValue(rowId,'score'+s,''); /* var v_cell=grid.getCellEditor(rowId,('score'+s)); if(v_cell!=null){ v_cell.value=""; grid.applyChanging($(v_cell).attr("class"),v_cell); } */ } if($(field).attr("checked") ){ grid.setValue(rowId,'absence1','1'); for(var s=1;s<4;s++){ $(grid.getCellEditor(rowId,('score'+s))).attr("readOnly","true"); } }else{ grid.setValue(rowId,'absence1','0'); for(var s=1;s<4;s++){ $(grid.getCellEditor(rowId,('score'+s))).removeAttr("readOnly"); } $(grid.getCellEditor(rowId,'score1')).focus(); } grid.save({'sc.subject_cnt': v_subject_cnt}); break; case "SC105": var rowId=grid.getSelectedRowId(); for(var s=1;s<7;s++){//6 grid.setValue(rowId,('grade'+s),""); grid.setValue(rowId,('score'+s),""); /* var v_cell=grid.getCellEditor(rowId,('grade'+s)); if(v_cell!=null){ v_cell.value=""; grid.applyChanging($(v_cell).attr("class"),v_cell); } var v_cell=grid.getCellEditor(rowId,('score'+s)); if(v_cell!=null){ v_cell.value=""; grid.applyChanging($(v_cell).attr("class"),v_cell); } */ } if($(field).attr("checked") ){ grid.setValue(rowId,'absence1','1'); for(var s=1;s<7;s++){ $(grid.getCellEditor(rowId,('grade'+s))).attr("readOnly","true"); } $(grid.getCellEditor(rowId,'score6')).attr("readOnly","true"); }else{ grid.setValue(rowId,'absence1','0'); for(var s=1;s<7;s++){ $(grid.getCellEditor(rowId,('grade'+s))).removeAttr("readOnly"); } $(grid.getCellEditor(rowId,'score6')).removeAttr("readOnly"); $(grid.getCellEditor(rowId,'grade1')).focus(); } grid.save({'sc.subject_cnt': v_subject_cnt}); break; case "SC120": var rowId=grid.getSelectedRowId(); for(var s=1;s<6;s++){//6 var v_cell=grid.getCellEditor(rowId,('score'+s)); if(v_cell!=null){ v_cell.value=""; grid.applyChanging($(v_cell).attr("class"),v_cell); } } if($(field).attr("checked") ){ grid.setValue(rowId,'absence1','1'); for(var s=1;s<6;s++){ $(grid.getCellEditor(rowId,('score'+s))).attr("readOnly","true"); } }else{ grid.setValue(rowId,'absence1','0'); for(var s=1;s<6;s++){ $(grid.getCellEditor(rowId,('score'+s))).removeAttr("readOnly"); } $(grid.getCellEditor(rowId,'score1')).focus(); } grid.save({'sc.subject_cnt': v_subject_cnt}); break; case "SC141": var rowId=grid.getSelectedRowId(); for(var s=1;s<9;s++){//8 grid.setValue(rowId,('grade'+s),""); grid.setValue(rowId,('score'+s),""); grid.setValue(rowId,('remark'+s),""); } if($(field).attr("checked") ){ grid.setValue(rowId,'absence1','1'); for(var s=1;s<4;s++){ $(grid.getCellEditor(rowId,('grade'+s))).attr("readOnly","true"); } }else{ grid.setValue(rowId,'absence1','0'); var v_InputType = $('#cmb_Jury').val(); for(var s=1;s<4;s++){ $(grid.getCellEditor(rowId,('score'+s))).removeAttr("readOnly"); } $(grid.getCellEditor(rowId,'score1')).focus(); } grid.save({'sc.subject_cnt': v_subject_cnt}); break; case "SC150": var rowId=grid.getSelectedRowId(); var v_cell=grid.getCellEditor(rowId,'grade1'); var v_cell1=grid.getCellEditor(rowId,'score1'); if(v_cell!=null){ v_cell.value=""; grid.applyChanging($(v_cell).attr("class"),v_cell); v_cell1.value=""; grid.applyChanging($(v_cell1).attr("class"),v_cell1); } if($(field).attr("checked") ){ grid.setValue(rowId,'absence1','1'); grid.setValue(rowId,'remark1',""); $(grid.getCellEditor(rowId,'grade1')).attr("readOnly","true"); $(grid.getCellEditor(rowId,'score1')).attr("readOnly","true"); }else{ grid.setValue(rowId,'absence1','0'); $(grid.getCellEditor(rowId,'grade1')).removeAttr("readOnly"); $(grid.getCellEditor(rowId,'grade1')).focus(); } grid.save({'sc.subject_cnt': v_subject_cnt}); break; case "SC160": var rowId=grid.getSelectedRowId(); var x_v= v_subject_cnt ; for(var i=1;i<=x_v;i++){ var v_cell=grid.getCellEditor(rowId, 'score'+i ); if(v_cell!=null){ v_cell.value=""; grid.applyChanging($(v_cell).attr("class"),v_cell); } } if($(field).attr("checked") ){ grid.setValue(rowId,'absence1','1'); for(var i=1;i<=x_v;i++){ var v_cell=grid.getCellEditor(rowId, 'score'+i ); if(v_cell!=null){ $(v_cell).attr("readOnly","true"); } } }else{ grid.setValue(rowId,'absence1','0'); for(var i=1;i<=x_v;i++){ var v_cell=grid.getCellEditor(rowId, 'score'+i ); if(v_cell!=null){ $(v_cell).removeAttr("readOnly"); } } $(grid.getCellEditor(rowId,'score1')).focus(); } grid.save({'sc.cnt': 1,'sc.subject_cnt': v_subject_cnt}); break; case "SC170": var rowId=grid.getSelectedRowId(); for(var s=1;s<11;s++){//10 var v_cell=grid.getCellEditor(rowId,('grade'+s)); if(v_cell!=null){ v_cell.value=""; grid.applyChanging($(v_cell).attr("class"),v_cell); } } if($(field).attr("checked") ){ grid.setValue(rowId,'absence1','1'); for(var s=1;s<6;s++){ $(grid.getCellEditor(rowId,('grade'+s))).attr("readOnly","true"); } }else{ grid.setValue(rowId,'absence1','0'); for(var s=1;s<6;s++){ $(grid.getCellEditor(rowId,('grade'+s))).removeAttr("readOnly"); } $(grid.getCellEditor(rowId,'grade')).focus(); } grid.save({'sc.subject_cnt': v_subject_cnt}); break; case "SC171": var rowId=grid.getSelectedRowId(); var v_num=parseInt(grid.getValue(rowId,"mcnt")); for(var i=1;i<=v_num;i++){ grid.setValue(rowId,'grade'+i,''); } // 체크 변경시 해당 필드 수정유무 처리할 예제. if($(field).attr("checked") ){ grid.setValue(rowId,'absence1','1'); for(var s=1;s<=v_num;s++){ if(s>1){ grid.setValue(rowId,'absence'+s,grid.getValue(rowId,'1')); } } for(var s=1;s<=v_num;s++){ var v_cell=grid.getCellEditor(rowId,'grade'+s); if(v_cell!=null){ $(grid.getCellEditor(rowId,'grade'+s)).attr("readOnly","true"); } } }else{ grid.setValue(rowId,'absence1','0'); for(var s=1;s<=v_num;s++){ if(s>1){ grid.setValue(rowId,'absence'+s,'0'); } } for(var s=1;s<=v_num;s++){ var v_cell=grid.getCellEditor(rowId,'grade'+s); if(v_cell!=null){ $(grid.getCellEditor(rowId,'grade'+s)).removeAttr("readOnly"); if(s==1)$(grid.getCellEditor(rowId,'grade1')).focus(); } } } grid.save(); break; case "SC180": var rowId=grid.getSelectedRowId(); var v_cell=grid.getCellEditor(rowId,'upper_score1'); if(v_cell!=null){ v_cell.value=""; grid.applyChanging($(v_cell).attr("class"),v_cell); } var v_cell=grid.getCellEditor(rowId,'score1'); if(v_cell!=null){ v_cell.value=""; grid.applyChanging($(v_cell).attr("class"),v_cell); } if($(field).attr("checked") ){ grid.setValue(rowId,'absence1','1'); $(grid.getCellEditor(rowId,'upper_score1')).attr("readOnly","true"); $(grid.getCellEditor(rowId,'score1')).attr("readOnly","true"); }else{ grid.setValue(rowId,'absence1','0'); $(grid.getCellEditor(rowId,'upper_score1')).removeAttr("readOnly"); $(grid.getCellEditor(rowId,'score1')).removeAttr("readOnly"); $(grid.getCellEditor(rowId,'upper_score1')).focus(); } grid.save(); break; case "SC190": var rowId=grid.getSelectedRowId(); var v_cell=grid.getCellEditor(rowId,'score1'); if(v_cell!=null){ v_cell.value=""; grid.applyChanging($(v_cell).attr("class"),v_cell); } if($(field).attr("checked") ){ grid.setValue(rowId,'absence1','1'); $(grid.getCellEditor(rowId,'score1')).attr("readOnly","true"); }else{ grid.setValue(rowId,'absence1','0'); $(grid.getCellEditor(rowId,'score1')).removeAttr("readOnly"); $(grid.getCellEditor(rowId,'score1')).focus(); } grid.save({'sc.subject_cnt': v_subject_cnt}); break; case "SC200": var rowId=grid.getSelectedRowId(); var v_cell=grid.getCellEditor(rowId,'score'); if(v_cell!=null){ v_cell.value=""; grid.applyChanging($(v_cell).attr("class"),v_cell); } if($(field).attr("checked") ){ grid.setValue(rowId,'absence','1'); $(grid.getCellEditor(rowId,'score')).attr("readOnly","true"); }else{ grid.setValue(rowId,'absence','0'); $(grid.getCellEditor(rowId,'score')).removeAttr("readOnly"); $(grid.getCellEditor(rowId,'score')).focus(); } grid.save(); break; case "SC210": var rowId=grid.getSelectedRowId(); var v_cell=grid.getCellEditor(rowId,'score'); if(v_cell!=null){ $(v_cell).val(""); grid.applyChanging($(v_cell).attr("class"),v_cell); } if($(field).attr("checked") ){ grid.setValue(rowId,'absence','1'); $(grid.getCellEditor(rowId,'score')).attr("disabled",true); }else{ grid.setValue(rowId,'absence','0'); $(grid.getCellEditor(rowId,'score')).removeAttr("disabled"); $(grid.getCellEditor(rowId,'score')).focus(); } grid.save(); break; case "SC260": var rowId=grid.getSelectedRowId(); var x_v=7; for(var i=1;i 0 ) field.options.remove( 0 ); }, addOption: function( fieldId, value, text ) { var field = $( fieldId ); var opt = document.createElement( 'OPTION' ); field.options.add( opt ); opt.value = value; opt.innerText = text; }, insertOption: function( fieldId, value, text, index ) { var field = $( fieldId ); if ( index == null ) index = 0; var opt = document.createElement( 'OPTION' ); field.insertBefore( opt, field.options.item( index ) ); opt.value = value; opt.innerText = text; field.value = value; }, removeOption: function( fieldId, index ) { var field = $( fieldId ); field.options.remove( index ); } }; var KeyUtils = { /** * 내용을 변경하지 않는 키인지 검사한다. */ isSilentKey: function( keyCode ) { switch ( keyCode ) { case 9: // Tab case 12: // KeyPad Center case 13: // Enter case 16: // Shift case 17: // Ctrl case 18: // Alt case 19: // Pause case 20: // Caps Lock case 25: // Chinese case 33: // PgUp case 34: // PgDn case 35: // End case 36: // Home case 37: // Left case 38: // Up case 39: // Right case 40: // Down case 45: // Insert case 91: // Left Window case 92: // Right Window case 93: // Menu case 112: // F1 case 113: // F2 case 114: // F3 case 115: // F4 case 116: // F5 case 117: // F6 case 118: // F7 case 119: // F8 case 120: // F9 case 121: // F10 case 122: // F11 case 123: // F12 case 145: // Scroll Lock case 144: // Num Lock return true; } return false; } }; function embedFlash( url, width, height ) { document.write( '' ); document.write( ' ' ); document.write( ' ' ); document.write( ' ' ); document.write( ' ' ); document.write( ' ' ); document.write( ' ' ); document.write( '' ); } function getTagYn(str) { var reg = new RegExp('<[^<>]*>','gi'); return reg.test(str); } String.prototype.replaceAll = function( searchStr, replaceStr ) { return this.replace( new RegExp(searchStr,'gi'), replaceStr ).toString(); } function autoBlur(){ if(event.srcElement.tagName=="A"||event.srcElement.tagName=="IMG") document.body.focus(); } document.onfocusin=autoBlur; var imagePopup = null; function open_img(url) { try { var left = Math.floor((screen.availWidth - 250) / 2); var top = Math.floor((screen.availHeight - 100) / 2); try { imagePopup.close(); } catch(e) { } imagePopup = window.open("", "", "width=250, height=100, left=" + left + ", top=" + top + ", scrollbars=no, resizable=yes"); imagePopup.document.open("text/html", "replace"); imagePopup.document.write( '\r\n' + '\r\n' + ' \r\n' + ' \r\n' + ' :: ImageViewPopup :: \r\n' + ' \r\n' + ' \r\n' + ' \r\n' + ' \r\n' + ((navigator.userAgent.indexOf("Safari") > -1) ? '
클릭하시면 닫힙니다.
\r\n' : '
클릭하시면 닫힙니다.
\r\n') + ' \r\n' + '' ); imagePopup.document.close(); if(imagePopup.document.focus) imagePopup.document.focus(); } catch(e) { window.open(url, "_blank"); } } function onlyNum(event){ var key = event.keyCode; if(!(key==8||key==9||key==13||key==46||key==144||(key>=48&&key<=57)||key==110||key==190)){ event.returnValue = false; } } /** * SMS 팝업을 띄운다. */ function openSmsPopup(param) { var size = { width: 580, height: 360 }; var url = contextPath+'/comm/program/sms/smsPopup.action'; openPopup(size, url, param); } /** * Email 팝업을 띄운다. */ function openEmailPopup(param) { var size = { width: 580, height: 480 }; var url =contextPath+'/comm/program/email/emailPopup.action'; openPopup(size, url, param); } function getCurrentURI() { var url = location.href; var temp = ''; var first = url.indexOf( '/', 7 ); var last = url.lastIndexOf( '/' ); temp = url.substring( first, last + 1 ); if(contextPath != null && contextPath != ''){ var second = temp.indexOf('/',1); temp = temp.substring(second, last+1); } return temp; }