<?php
	require_once( "../inc/session.php" );
	require_once ($_SERVER['DOCUMENT_ROOT']."/inc/pgsql.inc");

	//$suid = $HTTP_COOKIE_VARS[SUID];
	$suid = $_COOKIE[SUID];

	if ($suid != "guru222")
	{
	    AlertBack("전체관리자만 접근할 수 있습니다.");
	    exit;
	}

    $objConn = new DB_Sql;
    $enCoding = "set client_encoding = 'uhc'";
    $objConn->query($enCoding);
?>	
<html>

<head><title>Cloud Storage System Administration</title><meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=euc-kr"><link href="http://cc-gms.ktsh.co.kr/status/css/style.css" rel="stylesheet" type="text/css"><script language="javascript" type="text/javascript" src="http://cc-gms.ktsh.co.kr/status/rcmng/rc_list.js"></script><style>BODY,TABLE,TR,TD {font-size:12px;}select{behavior: url('http://cc-gms.ktsh.co.kr/status/css/selectbox.htc');}TD{line-height:150%;}</style>
<link rel="stylesheet" href="img/style.css" type="text/css">
</head><head><title>Cloud Storage System Administration</title><meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=euc-kr"><link href="http://cc-gms.ktsh.co.kr/status/css/style.css" rel="stylesheet" type="text/css"><script language="javascript" type="text/javascript" src="http://cc-gms.ktsh.co.kr/status/rcmng/rc_modify.js"></script><style>BODY,TABLE,TR,TD {font-size:12px;}select{behavior: url('http://cc-gms.ktsh.co.kr/status/css/selectbox.htc');}TD{line-height:150%;}</style></head><script language="javascript">
function check_rcid(rcid, rcname, arrange)
{
	window.open("rc_server_pop.html?rc_name="+rcname+"&rc_id="+rcid+"&arrange="+arrange, "rc_id_popup", "width=500, height=400, resizable");
}

function winopen_update()
{
	if (confirm("모든 서버 목록이 갱신됩니다. 진행 하시겠습니까?"))
		window.open("../servListUpdate.html", "slu_popup", "width=400, height=100");
	else
		return;
}

function DoDel(arrange)
{
	if ( confirm("RC에 포함된 모든 서버목록이 삭제됩니다. 진행 하시겠습니까?") )
		document.location.href("rc_delete.html?arrange="+arrange);
	else
		return;
}

function winopen_groupadd(mode, gseq)
{
	window.open("sms_group_add.html?mode="+mode+"&group="+gseq, "sga_popup", "width=350, height=250");
}

function winopen_memberadd(mode, gseq, gname, phone)
{
	window.open("sms_member_add.html?mode="+mode+"&group="+gseq+"&gname="+gname+"&phone="+phone, "sma_popup", "width=350, height=180");
}

function winopen_raid()
{
    //window.open("http://cc-raid.ktsh.co.kr/index.html", "_blank");
    //window.open("http://cs-raid.ktcdn.co.kr/index.html", "_blank");
    window.open("http://cs-raid.myskcdn.co.kr/index.html", "_blank");
}

</script>

<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="700" valign="top"><img src="img/TopBg.gif" usemap="#Map" border="0" width="700" height="90"></td>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="50" align="right" class="PR40" style="padding-right:30"><img src="img/Dot.gif"><a href="../inc/logout_process.html"><img src="img/BtnLogout.gif" border="0" width="36" height="9"></a></td>
</tr>
<tr>
<td height="40" align="right" bgcolor="#EDEDED" class="PR40 Color01" style="padding-right:30">
<span><b>'관리자'</b> </span> <img src="img/TxtNiceDay.gif" align="absmiddle" width="87" height="13">
</td>
</tr>
</table>
</td>
</tr>
</table>

<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td>
      <table width="100%" border="0" cellpadding="0" cellspacing="0">
		<tr>
          <td width="169" bgcolor="#F1F1F1" valign="top">
            <table width=100% border=0 cellpadding=0 cellspacing=0>
              <tr height=12> 
                <td></td>
              </tr>
              <tr height=1> 
                <td bgcolor="#B9B9B9"></td>
              </tr>
              <!-- menu title -->
              <tr height=30> 
                <td align=center class="LeftMenuTitle"> RC Management </td>
              </tr>
              <tr height=1> 
                <td bgcolor="#B9B9B9"></td>
              </tr>
              <!-- submenu -->
              <tr height=30> 
                <td align=center class=LeftMenu style="padding-top:10;padding-bottom:10"><a href='javascript:winopen_update();'><img src='img/Btnupdate.gif' border='0'></a></td>
              </tr>
              <tr height=30> 
                <td align=center class=LeftMenu><a href='rc_list.html'>RC 
                  목록</a></td>
              </tr>
              <tr height=30> 
                <td align=center class=LeftMenu height="17"><a href='rc_add.html'>RC 
                  추가</a></td>
              </tr>
              <tr height=30> 
                <td align=center class=LeftMenu height="50">&nbsp;</td>
              </tr>
              <tr height=1> 
                <td bgcolor="#B9B9B9"></td>
              </tr>
              <!-- menu title -->
              <tr height=30> 
                <td align=center class="LeftMenuTitle"> SMS Management </td>
              </tr>
              <tr height=1> 
                <td bgcolor="#B9B9B9"></td>
              </tr>
              <tr height=30> 
                <td align=center class=LeftMenu bgcolor=#CDCDCD><a href='sms_list.html'>수신 목록</a></td>
              </tr>
			  <tr height=30>
                <td align=center class=LeftMenu height="50">&nbsp;</td>
              </tr>
              <tr height=1>
                <td bgcolor="#B9B9B9"></td>
              </tr>
              <tr height=30>
                <td align=center class="LeftMenuTitle"> Monitor Page </td>
              </tr>
              <tr height=1>
                <td bgcolor="#B9B9B9"></td>
              </tr>
              <tr height=20>
                <td align=center class=LeftMenu><a href='../monitor.html'>서버 상태</a></td>
              </tr>
              <tr height=20>
                <td align=center class=LeftMenu><a href="javascript:winopen_raid();">RAID 상태</a></td>
              </tr>
            </table>
          </td>
          <td width="1" bgcolor="#CECECE"></td>
          <td width="30" bgcolor="#FFFFFF"></td>
          <td>
            <table width="100%" border="0" cellpadding="0" cellspacing="0">
              <tr height="12">
                <td></td>
              </tr>
              <tr height="28">
                <td class="ContentSummary">>> SMS Management</td>
              </tr>
              <tr height="1">
                <td height="1" background="../image/bg_line_dash.gif"></td>
              </tr>
              <tr height="24">
                <td></td>
              </tr>
              <tr>
                <td valign="top">

                  <!-- CONTENT TABLE START -->
                  <table width="100%" border="0" cellpadding="0" cellspacing="0">
                    <tr>
                      <!-- LEFT CELL START -->
                      <td valign="top">
                        <!-- content subtitle -->
                        <table width="100%" border="0" cellpadding="0" cellspacing="0" class="ContentSubtitle">
                          <tr>
                            <td width="10" height="25"><img src="img/icon_arrow.gif" width="16" height="10"></td>
                            <td>수신 목록</td>
                          </tr>
                        </table>
                                                
                        <!-- RC 목록 TABLE START -->
                        <table border='0'>
                          <tr align='left'> 
                            <td colspan='4' style="padding-top:20"><a href="javascript:winopen_groupadd('add', '')"><img src="img/br_g_add.gif" width="50" height="18" border="0"></a> 
                              * 이름을 클릭하면 삭제 및 수정이 가능합니다.</td>
                          </tr>
                          <tr align='center'> 
			<?php
				$row = 0;
				$table = 0;

				$strSql  = "SELECT a.group_seq, a.group_name, b.member_name, b.member_cellphone ";
				$strSql .= "FROM t_group a ";
				$strSql .= "LEFT OUTER JOIN t_group_member b ON a.group_seq = b.group_seq ";
				$strSql .= "WHERE a.deleted_yn = 'N' ";
				$strSql .= "ORDER BY a.group_seq, b.member_name ";

				$objConn->query($strSql);

				if($objConn->nf() != 0)
				{
					$chkFirst = 0;
					while($objConn->next_record())
					{
						if($chkFirst == 0) $pre_group_seq = $objConn->f("group_seq");
						$group_seq = $objConn->f("group_seq");
						if($pre_group_seq != $group_seq)
						{
							$table++;
							$row = 0;
						}
						$tmpArr[$table][$row][0] = $group_seq;
						$tmpArr[$table][$row][1] = $objConn->f("group_name");
						$tmpArr[$table][$row][2] = $objConn->f("member_name");
						$tmpArr[$table][$row][3] = $objConn->f("member_cellphone");
						//echo $table."-".$row."<br>";
						//echo $pre_group_seq."-".$group_seq."<br>";
						$pre_group_seq = $group_seq;
						$row++;
						$chkFirst++;
					}

					for ($i=0; $i < $table + 1; $i++)
					{
			?>
							<td valign='top'>
                              <table border='0' width='200' cellpadding="3" cellspacing="1" bgcolor="ccc391">
                                <tr> 
                                  <td height="19" bgcolor="efeddd">
                                    <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                      <tr>
                                        <td><font color="666666"><b>그룹명#<?=($i+1)?></b></font><b>&nbsp;&nbsp;<span class="name_link"><a href="javascript:winopen_groupadd('mod', '<?=$tmpArr[$i][0][0]?>');"><?=$tmpArr[$i][0][1]?></a></span> 
                                          </b></td>
                                      <td width="50"><b><a href="javascript:winopen_memberadd('add', '<?=$tmpArr[$i][0][0]?>', '<?=$tmpArr[$i][0][1]?>', '')"><img src="img/bt_add.gif" width="50" height="18" border="0" align="absmiddle"></a></b></td>
                                      </tr>
                                    </table>
                                    
                                  </td>
                                </tr>
                              </table>
							  
                              <table width="200" border="0" cellspacing="0" cellpadding="0">
                                <tr>
                                  <td height="5"></td>
                                </tr>
                              </table>
							  
                              <table border='0' width='200' cellspacing="1" cellpadding="3" bgcolor="e1e1e1">
								
							<?php
								for($j=0; $j<sizeof($tmpArr[$i]); $j++)
								{
							?>
								<tr bgcolor="#F6F5F2">
                                  <td width='10' align='center'><font color="666666"><?=($j+1)?></font></td>
                                  <td width='80' align='center' class="name_link"><a href="javascript:winopen_memberadd('mod', '<?=$tmpArr[$i][0][0]?>', '<?=$tmpArr[$i][0][1]?>', '<?=$tmpArr[$i][$j][3]?>')"><?=$tmpArr[$i][$j][2]?></a></td>
                                  <td width='110' bgcolor="#F6F5F2"><font color="666666">&nbsp;<?=$tmpArr[$i][$j][3]?></font></td>
                                </tr>
							<?
								}
							?>
                                </tr>
                                <tr align="right"> 
                                  <td colspan="3" bgcolor="#FFFFFF"><b><a href="javascript:winopen_memberadd('add', '<?=$tmpArr[$i][0][0]?>', '<?=$tmpArr[$i][0][1]?>', '')"><img src="img/bt_add.gif" width="50" height="18" border="0" align="absmiddle"></a></b></td>
                                </tr>
                              </table>
							  
                            <div align='right'><b></b></div>
                            </td>
				<?
					}
				}
				?>
				
                        <!-- RC 목록 TABLE END -->
                        <!-- divider -->
                        <table width="100%" border="0" cellpadding="0" cellspacing="0">
                          <tr>
                            <td height="20"></td>
                          </tr>
                        </table>
                  
                        <table width="100%" border="0" cellpadding="0" cellspacing="0">
                          <tr>
                            <td height="25"></td>
                          </tr>
                        </table>
                  
                      </td>
                      <!-- LEFT CELL END -->
                  
                    </tr>
                  </table>
                  <!-- CONTENT TABLE END -->
                
                </td>
              </tr>
            </table>
          </td>
          <td width="30" bgcolor="#FFFFFF"></td>
        </tr>
      </table>
    </td>
  </tr>
  
  <tr>
    <td>
            <!-- FOOTER TABLE START -->
      <table width="100%" border="0" cellpadding="0" cellspacing="0">
        <tr>
          <td colspan="3" width="100%" bgcolor="#FAE5B2"></td>
        </tr>
        <tr>
          <td width="169" height="43"><img src="img/logo_foot.gif" width="169" height="43"></td>
          <td width="492"><img src="img/addr_foot.gif" width="492" height="43"></td>
          <td width="100%" bgcolor="#FAF7F0"></td>
        </tr>
      </table>
      <!-- FOOTER TABLE END -->
    </td>
  </tr>
  
</table>
</body>
</html>
