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

$g4[title] = "배너목록";

$g4_table         = "point";	  
$g4_site_table   =  "g4_site_".$g4_table;  

           //////////////////////////////////////////////////////////

          //페이지 구현
           $sql = " select count(*) as cnt from {$g4_site_table} ";
           $row = sql_fetch($sql);
           $total_count = $row[cnt];

           $rows =  25;
           $total_page  = ceil($total_count / $rows);  // 전체 페이지 계산
           if (!$page) $page = 1; // 페이지가 없으면 첫 페이지 (1 페이지)
           $from_record = ($page - 1) * $rows; // 시작 열을 구함
  



           $sql          = " select * from {$g4_site_table} order by po_id desc limit $from_record, $rows ";
           $result       = sql_query($sql);
           $total_count  = mysql_num_rows($result);

           $write_pages  = get_paging($result, $page, $total_page, "?url=category&page=");
          ////////////////////////////////////////////////////////////

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

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


$colspan = 6;
if ($is_checkbox) $colspan++;

/////////////////////


?>

<table width=100% cellpadding=3 cellspacing=1>
<form name=fsearch method=get>
<tr>
    <td width=50% align=left><?=$listall?> (데이타 : <?=number_format($total_count)?>개)</td>
    <td width=50% align=right>
    </td>
</tr>
</form>
</table>


<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">
    <colgroup width=30>
    <colgroup width=''>
    <colgroup width=90>
    <colgroup width=90>
	<colgroup width=90>
    <colgroup width=80>

    <tr><td colspan='<?=$colspan?>' class='line1'></td></tr>
    <tr class='bgcol1 bold col1 ht 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>신청자</td>
	                <td>신청일</td>
					<td>배송상태</td>
					<td align="center"><!--<a href="<?=$g4[admin_path]?>/category_list.php?url=banner_write"><img src='<?=$g4[admin_path]?>/img/icon_insert.gif' border=0 title='생성'></a>-->수정 / 삭제</td>
	</tr>
    <tr><td colspan='<?=$colspan?>' class='line2'></td></tr>

    <!-- 목록 -->
    <?
    for($i=1;$i<count($list = sql_fetch_array($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;

		//등록상품의 정보를 불러옴
		$tmp_write_table = $g4['write_prefix'] .$list[bo_table];
		$p_sql           =  " select wr_subject from $tmp_write_table where wr_id = '$list[wr_id]' ";
		$p_row           = sql_fetch($p_sql);

		$p_row_subject   = conv_subject($p_row['wr_subject'], 20, "");

		//상품 배송상태
		$order_state = $list[order_state];
		if(!$order_state)
			$order_state = "대기";

		//교차배경
		if($i%2 == 0)
			$bg_color = "bgcolor=#f7f7f7";
		else
			$bg_color = "bgcolor=#ffffff";
		


		?>
    <tr height="28" align="center" <?=$bg_color?>>
                     <? if ($is_checkbox) { ?><td><input type=checkbox name=chk_wr_id[] value="<?=$list[po_id]?>"></td><? } ?>
					<td style='padding-left:<?=$r_ca?>px;' align="left"><a href="<?=$g4[bbs_path]?>/board.php?bo_table=<?=$list[bo_table]?>&wr_id=<?=$list[wr_id]?>" target="_block"><?=$p_row_subject?> [<?=$list[order_id]?>]</a></td>
					<td style='padding-left:<?=$r_ca?>px;' align="center"><?=$list[mb_id]?><br></td> 
					<td><?=$list[order_time]?></td>
					<td><?=$order_state?></td>
					<td align="center">
					<a href="<?=$g4[admin_path]?>/category_list.php?url=point_write&w=u&po_id=<?=$list[po_id]?>"><img src='<?=$g4[admin_path]?>/img/icon_modify.gif' border=0 title='수정'></a>
					<a href="javascript:add_del('<?=$list[po_id]?>','<?=$p_row_subject?>','po_id');"><img src='<?=$g4[admin_path]?>/img/icon_delete.gif' border=0 title='삭제'></a></td>
	</tr>
<tr><td></td>
    <td colspan="5" style='padding-left:10px;'>
<?if($list[po_poll19]){

    //파일 확장자 검색, 오류예방
    $path_info       =  pathinfo($list[po_poll19]);
    if($path_info["extension"] == 'swf'){
		?>
    <script>
    doc_write(flash_movie("<?=$g4[path]?>/data/file/banner/<?=$list[po_poll19]?>", "myfile", "<?=$list[po_cnt5]?>", "<?=$list[po_cnt6]?>", "transparent"));
    </script>
		<?
	}
	else{
     echo "<img src='$g4[path]/data/file/banner/$list[po_poll19]'  border='0'>";
	}
		}?>
    </td>
</tr>
    <tr><td height="5" colspan=<?=$colspan?>></td></tr>
	<?}?>	
    <? if ($total_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>
	<!--------페이지--------->
	<table width="100%" height="30" 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+"/shop/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+"/shop/point_del.php?po_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+"/shop/point_del.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>





