<%--
  - FileName   : mr_po_list.jsp
  - Author(s)  : 
  - Date       : 2011.11.22
  - Copyright  : Copyright (c) 
  - Description: 
  --%>

<%@ page contentType="text/html; charset=utf-8" %>
<%@ page import="com.udapsoft.waf.system.HandlerStorage" %>
<%@ page import="com.udapsoft.waf.common.ui.*"%>
<%@ page import="kr.co.hsnc.common.util.*" %>
<%@ page import="kr.co.udapsoft.common.code.*"%>

<jsp:useBean id="ctx" class="com.udapsoft.waf.system.context.SessionContext" scope="session" />
<%
	ctx.init(request, response);
	HandlerStorage storage = ctx.getHandlerStorage();
	
	ValueObject user = ctx.getUser();    
	ValueObject params = storage.getParams();
	
	String systemSelectTag = (String)storage.getObject("SystemSelectTag");
	System.out.println(systemSelectTag);
	
%>

<SCRIPT language="JavaScript">

	// 마지막으로 선택된 행의 번호를 기억하고 있음
	var CurMasterRow = 0;

	// Sheet의 초기화 작업
	function initIBSheet(sheetObj) {
		
		if( sheetObj.id == "sheet1" ) {
			with(sheetObj) { 
			
				//전체 너비 설정
				doResizeSheet(sheetObj);
				
				ExtendLastCol = true;

				//전체Merge 종류 [선택, Default msNone]
				MergeSheet = msAll;
				
				//전체Edit 허용 여부 [선택, Default false]
				Editable = true;
				//마우스 여러개 선택 가능 여부.
				MultiSelection=false;

				//행정보설정[필수][HEADROWS,DATAROWS,VIEWROWS,ONEPAGEROWS=100]
				InitRowInfo( 1, 1, 10, 100);
  
    			//컬럼정보설정[필수][COLS,FROZENCOL,LEFTHEADCOLS=0,FROZENMOVE=false]
    			InitColumnInfo(8, 0, 0, false);
     
    			//해더행정보[필수][ROW,HEADTEXT,ROWMERGE=false, HIDDEN=false]
    			
    			InitHeadRow(0, "No|PGM_ID|SYSTEM_CODE|System|Group|Program|Screen|", false);
    			
    			//헤더기능설정 [선택][SortEnable, ColumnMove, AllCheckEnable, UserResize, RowMove, Head3D] 
				InitHeadMode(false, false, true, false, false, true);
			
    			//데이터속성[ROW,COL,DATATYPE,WIDTH,DATAALIGN,COLMERGE,SAVENAME,KEYFIELD,CALCULOGIC,REQ_PO_ID DATAFORMAT,POINTCOUNT,UPDATEEDIT,INSERTEDIT,EDITLEN,FULLINPUT,SORTENABLE,TOOLTIP,ALLCHECK, SAVESTATUS, FORMATFIX]    
    			var colNum = 0;
    		
    			InitDataProperty(0,  colNum++, dtHidden,     		5,		daCenter, 	false, "NO" );
    			InitDataProperty(0, colNum++, 	dtHidden,       150,    daCenter,   false, "PGM_ID" );
    			InitDataProperty(0, colNum++,	dtHidden,       150,    daLeft,     false, "SYSTEM_CODE");
    			InitDataProperty(0, colNum++,	dtData,         30,     daLeft,     true, "SYSTEM_NAME",  false,   "",   dfNone,         0,   false,   false );
    			InitDataProperty(0, colNum++,	dtData,         150,    daLeft,     true, "PGM_GR_NAME" , false,   "",   dfNone,         0,   false,   false );
    			InitDataProperty(0, colNum++,	dtData,		    260,    daLeft,     false, "PGM_NAME",  false,   "",   dfNone,         0,   false,   false  );
    			InitDataProperty(0, colNum++,	dtHidden,		300,    daLeft,     false, "SCREEN_NAME",  false,   "",   dfNone,         0,   false,   false );
    			InitDataProperty(0,  colNum++, dtCheckBox,	  	5,   	daCenter, 	false, "CHK");
    			Visible = true;
			    sheetObj.ScrollBar = 2;	
			}
		}
		else if(sheetObj.id == "sheet2"){
			with(sheetObj) { 
				
				//전체 너비 설정
				doResizeSheet(sheetObj);
				
				ExtendLastCol = true;

				//전체Merge 종류 [선택, Default msNone]
				MergeSheet = msAll;
				
				//전체Edit 허용 여부 [선택, Default false]
				Editable = true;
				
				MultiSelection=false;

				//행정보설정[필수][HEADROWS,DATAROWS,VIEWROWS,ONEPAGEROWS=100]
				InitRowInfo( 1, 1, 10, 100);
  
    			//컬럼정보설정[필수][COLS,FROZENCOL,LEFTHEADCOLS=0,FROZENMOVE=false]
    			InitColumnInfo(8, 0, 0, false);
     
    			//해더행정보[필수][ROW,HEADTEXT,ROWMERGE=false, HIDDEN=false]
    			
    			InitHeadRow(0, "No|PGM_ID|SYSTEM_CODE|System|Group|Program|Screen|", false);
    			
    			//헤더기능설정 [선택][SortEnable, ColumnMove, AllCheckEnable, UserResize, RowMove, Head3D] 
				InitHeadMode(false, false, true, false, false, true);
			
    			//데이터속성[ROW,COL,DATATYPE,WIDTH,DATAALIGN,COLMERGE,SAVENAME,KEYFIELD,CALCULOGIC,REQ_PO_ID DATAFORMAT,POINTCOUNT,UPDATEEDIT,INSERTEDIT,EDITLEN,FULLINPUT,SORTENABLE,TOOLTIP,ALLCHECK, SAVESTATUS, FORMATFIX]    
    			var colNum = 0;
 
    			InitDataProperty(0, colNum++,   dtHidden,     		5,		daCenter, 	false, "NO" );
    			InitDataProperty(0, colNum++, 	dtHidden,       150,    daCenter,   false, "PGM_ID" );
    			InitDataProperty(0, colNum++,	dtHidden,       150,    daLeft,     false, "SYSTEM_CODE");
    			InitDataProperty(0, colNum++,	dtData,         30,     daLeft,     true, "SYSTEM_NAME", false,   "",   dfNone,         0,   false,   false );
    			InitDataProperty(0, colNum++,	dtData,         150,    daLeft,     true, "PGM_GR_NAME" ,false,   "",   dfNone,         0,   false,   false );
    			InitDataProperty(0, colNum++,	dtData,		    260,    daLeft,     false, "PGM_NAME",  false,   "",   dfNone,         0,   false,   false);
    			InitDataProperty(0, colNum++,	dtHidden,		300,    daLeft,     false, "SCREEN_NAME", false );
       			InitDataProperty(0, colNum++,   dtCheckBox,	  	5,   	daCenter, 	false, "CHK");
       			
    			Visible = true;
			    sheetObj.ScrollBar = 2;	
		   }
		}
	}
	
	//Search 
	function doSearch() {
		var f = document.form1;
		searchIBSheet("/sycs/security/Mymenu_data.screen", "GET_LEFT_MENU", f, document.all.sheet1);	
		searchIBSheet("/sycs/security/Mymenu_data.screen", "GET_RIGHT_MENU", f, document.all.sheet2);	
        
		document.form1.isSubmit = false;
		doResizeSheet(document.all.sheet1);
		doResizeSheet(document.all.sheet2);
		//마지막 열간격 조절 여부. 
		document.all.sheet1.ExtendLastCol = true;
		document.all.sheet2.ExtendLastCol = true;
		
	}
		
	//페이지 초기화 함수
	function doPageInit() {
	    doSearch();
	    
	}	
	//체크 저장 함수
	function doMakeMymenu(){
		var sheetObj = document.all.sheet1;
		var iCheckRow = sheetObj.CheckedRows("CHK");
		if(iCheckRow > 0){
			submitIBSheetRequest("/sycs/security/Mymenu_process.screen", "MENU_LIST_COPY", document.form1, sheetObj,  "ROWSET");
			document.form1.isSubmit = false;
		}
		else{
			alertMsg('NO_SAVE','');
		}
	}
	
	//체크 지움 함수
	function doDelMymenu(){
		var sheetObj = document.all.sheet2;
		var iCheckRow = sheetObj.CheckedRows("CHK");
		if(iCheckRow > 0){
			submitIBSheetRequest("/sycs/security/Mymenu_process.screen", "MENU_LIST_DEL", document.form1, sheetObj,  "ROWSET");
			document.form1.isSubmit = false;
		}
		else{
			alertMsg('NO_SAVE','');
		}
	}
	//결과 함수 
	function doResult(resultObj) {
		
		try {
			if( resultObj.getRequestEvent() == "MENU_LIST_COPY" ) {
		
				if( resultObj.getSuccess() ) {
					alert("Save Complete!");
					doSearch();
				}
				else {
					dlgErrorMsg(resultObj);
				}
			}
			
			else if( resultObj.getRequestEvent() == "MENU_LIST_DEL" ) {
				
				if( resultObj.getSuccess() ) {
					alert("Delete Complete!");
					doSearch();
				}
				else {
					dlgErrorMsg(resultObj);
				}
			}
		}
		catch(errorObject) {
	        showErrorDlg("doResult()", errorObject);
		}
	}
	
	//page close event
	function doClose(){
		self.close();
	}
	
	function doClear(){
 		document.form1.pgm_gr_name.value='';
		document.form1.pgm_name.value='';
		setSelect(document.form1.system_id, '');
	}

    //페이지 초기화 함수 Call
	document.body.onload = doPageInit;
	document.body.onresize = addEvent( document.body.onresize, "doResizeSheet(document.all.sheet1)");
</SCRIPT>	

<TABLE border="0" cellspacing="0" cellpadding="0" width="100%" height="100%">
	<TR>
		<TD height="1" valign="top">
			<TABLE class="screen_title_table">
			  <TR height="2"><TD colspan="2"></TD></TR>
			  <TR height="25">
			    <TD width="16" valign="middle"><IMG src="/img/button/bullet_03.gif" ></TD>
			    <TD width="100%" class="screen_title_text">My Menu Setup</TD>
			  </TR>
			</TABLE>
		</TD>
	</TR>
	<form name="form1" style="border:0; margin:0; padding:0;">
	<TR>
		<TD height="1" valign="top" colspan="3">
			<TABLE cellspacing="1" cellpadding="0" class="search_table">
	            <COLGROUP>
	                <COL width="10%">
	                <COL width="30%">
	                <COL width="10%">
	                <COL width="25%">
	                <COL width="25%">
	            </COLGROUP>
            	<TR height="25">
                	<TD class="search_table_title"><IMG src="/img/button/bullet_01.gif">System</TD>
                	<TD class="search_table_data" style="padding-left:3px;">
          			 <%= systemSelectTag %>
               		</TD>
                	<TD class="search_table_title"><IMG src="/img/button/bullet_01.gif">Group Name</td>
                	<TD class="search_table_data" style="padding-left:3px;"><input type="text" id="pgm_gr_name" name="pgm_gr_name" class="input" style="width:95%; ime-mode:disabled;" onKeyPress=""/></TD>
                	<TD class="search_button" rowspan="2">
                    	<TABLE border="0" cellpadding="0" cellspacing="0" align="center">
                    	<TR>
                        	<TD width="10"></TD>
                        	<TD>
                            	<DIV onclick="JavaScript:doSearch();" class="button_style">
		                            <TABLE border="0" cellpadding="0" cellspacing="0">
		                            	<TR>
		                                	<TD class="button_left1"></TD>
		                                	<TD class="button_text1">Search</TD>
		                                	<TD class="button_right"></TD>
		                              	</TR>
									</TABLE>
                            	</DIV>
                        	</TD>
                        	<TD width="5"></TD>
	                        <TD>
	                        	<DIV onclick="JavaScript:doClear();" class="button_style">
                            		<TABLE border="0" cellpadding="0" cellspacing="0">
                              			<TR>
                                			<TD class="button_left1"></TD>
                                			<TD class="button_text1">Clear&nbsp;&nbsp;</TD>
                                			<TD class="button_right"></TD>
                              			</TR>
                            		</TABLE>
                            	</DIV>
                        	</TD>
                        	<TD width="5"></TD>
                        	<TD>
	                        	<DIV onclick="JavaScript:doClose();" class="button_style">
                            		<TABLE border="0" cellpadding="0" cellspacing="0">
                              			<TR>
                                			<TD class="button_left1"></TD>
                                			<TD class="button_text1">close&nbsp;&nbsp;</TD>
                                			<TD class="button_right"></TD>
                              			</TR>
                            		</TABLE>
                            	</DIV>
                        	</TD>
                        	<TD width="10"></TD>
                      	</TR>
                    </TABLE>
                </TD>
            </TR>
            <TR height="25">
                <TD class="search_table_title"><IMG
                    src="/img/button/bullet_01.gif">Program</TD>
                <TD class="search_table_data" style="padding-left:3px;" colspan="3">
                    <input type="text" id="pgm_name" name="pgm_name" class="input" style="width:40%;"/>
                </TD>
            </TR>
        </TABLE>
		<!-- 데이터 영역 : 시작 -->
		</TD>
	</TR>
	</form>  
	<!-- 검색조건 영역, 테이터 영역 구분 여백 : 시작 -->
	<TR>
		<TD height="1">
			<TABLE border="0" cellspacing="0" cellpadding="0" class="search_data_div_height">
			<TR><TD></TD></TR>
			</TABLE>
		</TD>
	</TR>
	<!-- 검색조건 영역, 테이터 영역 구분 여백 : 종료 -->
	<TR height="100%" >
	
		<TD id="sheet1_td" valign="top" width="45%">
			<DIV width="100%">
				<SCRIPT>
		          var sheetObj = new IBSheetObject("sheet1");
		          sheetObj.display();
				</SCRIPT>
			</DIV>
		</TD>
			<TD width="5%" align="center">
				<DIV width="100%">
					<TABLE cellspacing="0" cellpadding="0" class="menu_data_button">
						<TR>
							<TD id="button_1">
							<IMG id='menu_right_button' onClick="javeScript:doMakeMymenu();" src='/img/button/bt_arrow_1.gif' border='0' align='absmiddle' style='cursor:hand;'>
							
							</TD>
						</TR>
						<TR>
						 <TD height="10"></TD>
						</TR>
						<TR >
							<TD id="button_2">
						    <IMG id='menu_left_button' onClick="javeScript:doDelMymenu();" src='/img/button/bt_arrow_3.gif' border='0' align='absmiddle' style='cursor:hand;'>
							</TD>
						</TR>
					</TABLE>
				</DIV>
			</TD>
			<TD id="sheet2_td" valign="top" width="45%">
			<DIV width="100%">
				<SCRIPT>
		          var sheetObj = new IBSheetObject("sheet2");
		          sheetObj.display();
				</SCRIPT>
			</DIV>
		</TD>
	
	</TR>
</TABLE>




