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

$g4[title] = "배너관리";

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


///////////////////////////////////////////////////
//배너 분류를 호출한다
$banner_mct     = " where po_poll19 = 'banner' and po_cnt1 = '1' ";
$banner_sql     = " select po_id,po_subject  from g4_site_bill $banner_mct ";
$banner_row     = sql_fetch($banner_sql);
$banner_arr     = explode("|", $banner_row[po_subject]); 
    $banner_op = "";
    for ($i=0; $i<count($banner_arr); $i++)
        if (trim($banner_arr[$i]))
            $banner_op .= "<option value='$banner_arr[$i]'>$banner_arr[$i]</option>\n";
///////////////////////////////////////////////////


//수정이라면
if ($w == "u") {
$mct            = " where po_id = '$po_id' ";
$sql            = " select * from $g4_site_table $mct ";
$site_banner    = sql_fetch($sql);
}

$colspan = 2;

//입력일경우
if ($w == "") {
$site_banner[po_poll4]  = "http://";
$site_banner[po_cnt2]   = date("Ymd", time());
$site_banner[po_cnt3]   = date("Ymd", time()+(60*60*24*365));
}


?>

<table width=100% cellpadding=0 cellspacing=1>
<tr><td colspan='<?=$colspan?>' class='line1'></td></tr>

<form name=banner action="<?=$g4[admin_path]?>/category_list.php?url=banner_update" method=post enctype="multipart/form-data">
<input type=hidden name=po_id   value="<?=$po_id?>">
<input type=hidden name=w   value="<?=$w?>">
<input type=hidden name=g4_table   value="<?=$g4_table?>">


<tr><td colspan='<?=$colspan?>' style='padding-left:10px; height:30px;'><b><?=$url?></b></td></tr>
<tr><td colspan='<?=$colspan?>' class='line2'></td></tr>
<tr><td width="120" style='padding-left:10px; height:30px;'>위치선택</td>
    <td style='padding-left:10px;'>
	<select name="po_poll1" value="<?=$site_banner[po_poll1]?>" >
	<option value='' >선택하세요
	<?=$banner_op?>
	</select>
	<script language='javascript'> document.banner.po_poll1.value = '<?=$site_banner[po_poll1]?>'; </script>
    </td>
</tr>
<tr><td width="120" style='padding-left:10px; height:30px;'>배너제목</td>
    <td style='padding-left:10px;'>
     <input type=text class=ed required style='width:80%;' name='po_subject' value='<?=$site_banner[po_subject]?>' title='여분필드 po_poll6 설정값'>
    </td>
</tr>
<tr><td width="120" style='padding-left:10px; height:30px;'>이미지등록</td>
    <td style='padding-left:10px;'>
        <input type=file name=po_poll19  class=ed size=60>
        <?
        if ($site_banner[po_poll19])
            echo "<br><a href='$g4[path]/data/file/banner/$site_banner[po_poll19]' target='_blank'>$site_banner[po_poll19]</a> <input type=checkbox name='index_menu_del' value='$site_banner[po_poll19]'> 삭제";
        ?>
    </td>
</tr>
<?if($site_banner[po_poll19]){	
	?>
<tr>
  <td width="120" style='padding-left:10px; height:30px;'></td>
  <td style='padding-left:10px;'>
    <?
    //파일 확장자 검색, 오류예방
    $path_info       =  pathinfo($site_banner[po_poll19]);
    if($path_info["extension"] == 'swf'){
    ?>
    <script>
    doc_write(flash_movie("<?=$g4[path]?>/data/file/banner/<?=$site_banner[po_poll19]?>", "myfile", "<?=$site_banner[po_cnt5]?>", "<?=$site_banner[po_cnt6]?>", "transparent"));
    </script>
    <?
    }
	else{
    echo "<img src='$g4[path]/data/file/banner/$site_banner[po_poll19]'  border='0'>";
	}
    ?>
  </td>
</tr>
<?}?>
<tr><td width="120" style='padding-left:10px; height:30px;' valign="top">이미지설명</td>
    <td style='padding-left:10px;'>
     <textarea class=ed name=po_poll2 rows=3 style='width:80%;' title='여분필드 po_poll2 설정값'><?=$site_banner["po_poll2"] ?></textarea>
    </td>
</tr>
<tr><td width="120" style='padding-left:10px; height:30px;'>연결주소</td>
    <td style='padding-left:10px;'>

     <input type=text class=ed style='width:80%;' name='po_poll4' value='<?=$site_banner[po_poll4]?>' title='여분필드 po_poll4 설정값'>
    </td>
</tr>
<tr><td width="120" style='padding-left:10px; height:30px;'>기타설정</td>
    <td style='padding-left:10px;'>
	   <table width=100% cellpadding=0 cellspacing=0>
	   <tr>
	       <td width="100">출력순서 :</td>
	       <td width="150"><input type=text class=ed style='width:60;' name='po_cnt4' value='<?=$site_banner[po_cnt4]?>' title='여분필드 po_cnt4 설정값'></td>
	       <td width="100">대상프레임 :</td>
	       <td>
		   	<select name="po_poll5" value="<?=$site_banner[po_poll5]?>" >
	        <option value='_self' >_self
	        <option value='_parent' >_parent
	        <option value='_blank' >_blank
	        </select>
	        <script language='javascript'> document.banner.po_poll5.value = '<?=$site_banner[po_poll5]?>'; </script>
		   </td>
		</tr>
		</table>
    </td> 
</tr>
<tr><td width="120" style='padding-left:10px; height:30px;'>긴간별설정</td>
    <td style='padding-left:10px;'>
	   <table width=100% cellpadding=0 cellspacing=0>
	   <tr>
	       <td width="100">시작일 :</td>
           <td width="150"><input type=text class=ed style='width:60;' name='po_cnt2' value='<?=$site_banner[po_cnt2]?>' title='여분필드 po_cnt2 설정값'> <?=help("사용예 - 20071011 .\n 끝자리는 공백이 없어야 합니다.", 50)?></td> 
	       <td width="100">종료일 :</td>
		  <td><input type=text class=ed style='width:60;' name='po_cnt3' value='<?=$site_banner[po_cnt3]?>' title='여분필드 po_cnt3 설정값'>
		  <?=help("사용예 - 20071011 .\n 끝자리는 공백이 없어야 합니다.", 50)?></td> 
		</tr>
		</table>
    </td> 
</tr>
<tr><td width="120" style='padding-left:10px; height:30px;'>이미지 사이즈(플레쉬)</td>
    <td style='padding-left:10px;'>
	   <table width=100% cellpadding=0 cellspacing=0>
	   <tr>
	       <td width="100">가로사이즈 :</td>
	       <td width="150"><input type=text class=ed style='width:60;' name='po_cnt5' value='<?=$site_banner[po_cnt5]?>' title='여분필드 po_cnt5 설정값'></td>
	       <td width="100">세로사이즈 :</td>
	       <td><input type=text class=ed style='width:60;' name='po_cnt6' value='<?=$site_banner[po_cnt6]?>' title='여분필드 po_cnt6 설정값'></td>
		</tr>
		</table>
    </td> 
</tr>
<? for ($i=6; $i<=8; $i++) { ?>
<tr class='ht'>
    <td width="120"><input type=text class=ed name='po_poll1<?=$i?>' value='<?=$site_bill["po_poll{$i}"]?>' title='여분필드 po_poll<?=$i?> 제목' style='text-align:right;font-weight:bold;'></td>
    <td style='padding-left:10px;'>
     <input type=text class=ed style='width:80%;' name='po_poll1<?=$i?>' value='<?=$site_banner["po_poll1{$i}"]?>' title='여분필드 po_poll1<?=$i?> 설정값'>
    </td>
</tr>
<? } ?>

<tr><td colspan='<?=$colspan?>' height="15"></td></tr>
<tr><td colspan='<?=$colspan?>' align="center"><input type="submit" name="formbutton1" value="확인"></td></tr>
<tr><td colspan='<?=$colspan?>' height="15"></td></tr>
<tr><td colspan='<?=$colspan?>' class='line2'></td></tr>
</form>
</table>

