<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가

//전체 체크박스 on
$is_checkbox = 1;

//전체폭
$width = "98%"; // 전체폭 890 에서 작업

//$cart_table[cart_category] = "g4_cart_category";

$colspan = 7;



if ($is_checkbox) $colspan++;



?>



<table width="<?=$width?>" align=center cellpadding=0 cellspacing=0>
<tr>
  <td>
    <form name="fcart_list" method="post" style="margin:0px;">
    <input type = "hidden" name = "save" value = "true" />

    <table width="100%" cellspacing="0" cellpadding="0">
    <tr><td height="1" colspan=<?=$colspan?> bgcolor="#dadada"></td></tr>
    <tr height="35" align="center">
                    <? if ($is_checkbox) { ?><td width=40><INPUT onclick="if (this.checked) all_checked(true); else all_checked(false);" type=checkbox></td><?}?>
					<td>카테고리명</td>
	                <td width="80">분류코드</td>
					<td width="60">출력스킨</td>
					<td width="60">상품재고</td>
					<td width="50">등록수</td>
					<td width="50">정렬순</td>
					<td width="160"><a href="javascript:add_cate('','','');">++추가++</a></td>
	</tr>
    <tr><td height="1" colspan=<?=$colspan?> bgcolor="#dadada"></td></tr>

    <!-- 목록 -->
    <?
    for($i=1;$i<count($list = sql_fetch_array($h_result));$i++) 
    {


        //$r_ca = "<span style='font-family:Tahoma;font-size:7pt;color:#ffffff;'>&nbsp;{$list[wr_reply]}</span>";
		//문자열의 길이반환
		$r_ca = strlen($list[wr_reply]);
		$r_ca = 10*$r_ca;

		


		?>
    <tr height="23" align="center">
                     <? if ($is_checkbox) { ?><td><input type=checkbox name=chk_wr_id[] value="<?=$list[wr_id]?>"></td><? } ?>
					<td style='padding-left:<?=$r_ca?>px;' align="left"><?=$list[wr_subject]?></td>
	                <td><?=$list[ne_1]?></td>	                
					<td><?=$list[ne_2]?></td>
					<td><?=$list[ne_3]?></td>
					<td>11</td>
					<td><?=$list[ne_8]?></td>
					<td><a href="javascript:add_cate('<?=$list[ne_1]?>','<?=$list[wr_id]?>','p');">+추가+</a> /<a href="javascript:add_cate('<?=$list[ne_1]?>','','w');">+수정+</a> / <a href="javascript:add_del('<?=$list[wr_id]?>','<?=$list[wr_subject]?>','wr_id');">+삭제+</a></td>
	</tr>
    <tr><td height="1" colspan=<?=$colspan?> bgcolor="#dadada"></td></tr>
	<?}?>

    <? if ($h_count == 0) { echo "<tr><td colspan='$colspan' height=100 align=center>카테고리가 존재하지 않습니다.</td></tr>"; } ?>
    <tr><td height="1" colspan=<?=$colspan?> bgcolor="#dadada"></td></tr>

    </table>
    </form>

	<!--------페이지--------->
	<br><br>
    <table width="100%" height="50" cellspacing="0" cellpadding="0">
    <tr><td align="center"><?=$write_pages?></td></tr>
    </table>
	<br>
	<!--------페이지--------->
	<br><br>
    <table width="100%" height="50" cellspacing="0" cellpadding="0">
    <tr><td>
        <? if ($is_checkbox) { ?>
            <a href="javascript:select_delete();">선택삭제</a>
        <? } ?>
	</td></tr>
    </table>
	<br>
	<!--------페이지--------->

  </td>
</tr>
</table>




<script language="javascript">




 function add_cate(se_01, se_02, se_03)
{ 
   url = g4_path+"/skin/cart/basic/category/add.php?se_01="+se_01+"&se_02="+se_02+"&se_03="+se_03;
        
   win_open(url, "winFormmail", "left=100, top=100, width=680, height=580, scrollbars=1");

}

 function add_del(se_01, se_02, se_03)
{ 
    var f = document.fcart_list;

    str = "삭제";
    if (!confirm(se_02+" 를 정말 "+str+" 하시겠습니까?\n\n한번 "+str+"한 자료는 복구할 수 없습니다"))
        return;

    f.action = g4_path+"/skin/cart/basic/delete_cate.php?wr_id="+se_01;
    f.submit();

}


// 선택한 게시물 삭제

 function all_checked(sw) {
  var f = document.fcart_list;

  for (var i=0; i<f.length; i++) {
  if (f.elements[i].name == "chk_wr_id[]")
      f.elements[i].checked = sw;
   }
}


function select_delete() {
    var f = document.fcart_list;

    str = "삭제";
    if (!check_confirm(str))
        return;

    if (!confirm("선택한 분류를 정말 "+str+" 하시겠습니까?\n\n한번 "+str+"한 자료는 복구할 수 없습니다"))
        return;

    f.action = g4_path+"/skin/cart/basic/delete_cate.php";
    f.submit();
}

function check_confirm(str) {
    var f = document.fcart_list;
    var chk_count = 0;

    for (var i=0; i<f.length; i++) {
        if (f.elements[i].name == "chk_wr_id[]" && f.elements[i].checked)
            chk_count++;
    }

    if (!chk_count) {
        alert(str + "할 게시물을 하나 이상 선택하세요.");
        return false;
    }
    return true;
}

</script>




