<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가 
?>
<link rel="stylesheet" href="<?=$board_skin_path?>/css/basic.css" type="text/css">
<script type="text/javascript" src="<?=$board_skin_path?>/js/jquery-board.js"></script>

<div class="title">
<h2>
<?php 
if ($is_category) { 
  echo ($category_name ? "[$view[ca_name]] " : ""); 
}
  echo cut_hangul_last(get_text("$view[wr_subject]"));
?>
</h2>

<div class="support">
  <div class="dropdown">
  <span><a href="#">이 게시물을...</a></span>
    <ul>
	<? 
	if ($good_href) { echo "<li><span class=\"icon good\"></span><a href=\"$good_href\" target=\"hiddenframe\">추천</a></li><li><span class=\"icon nogood\"></span><a href=\"$nogood_href\" target=\"hiddenframe\">비추천</a></li>"; } 
	if ($scrap_href) { echo "<li><span class=\"icon scrap\"></span><a href=\"javascript:;\" onclick=\"win_scrap('$scrap_href');\">스크랩</a></li>"; } 
    if ($trackback_url) { echo "<li><span class=\"icon trackback\"></span><a href=\"javascript:trackback_send_server('<?=$trackback_url?>');\" >트랙백</a></li>"; }
    if ($copy_href) { echo "<li><span class=\"icon copy\"></span><a href=\"$copy_href\">복사</a></li> "; } 
    if ($move_href) { echo "<li><span class=\"icon move\"></span><a href=\"$move_href\">이동</a></li>"; } 
    if ($delete_href) { echo "<li><span class=\"icon delete\"></span><a href=\"$delete_href\">삭제</a></li>"; } 
    if ($update_href) { echo "<li><span class=\"icon update\"></span><a href=\"$update_href\">수정</a></li>"; } 
	?>
    </ul>
  </div>

  <? if ($search_href) 
    echo "<a href=\"$search_href\" class=\"button\">목록</a> "; 
  else
    echo "<a href=\"$list_href\" class=\"button\">목록</a> ";
  
  if ($write_href) 
    echo "<a href=\"$write_href\" class=\"button\"><span class=\"icon\"></span>글쓰기</a> "; 
  ?>
</div><!-- //support -->
</div><!-- //title -->

<div class="info">
<span class="writer">
  <span class="c_gray">글쓴이</span> <?=$view[name]?><? if ($is_ip_view) { echo "&nbsp;<span class='c_gray'>($ip)</span>"; } ?>
</span>
<span class="date">
  <span class="c_gray">등록일</span> <?=date("y-m-d H:i", strtotime($view[wr_datetime]))?>
</span>

<div class="right">
<span class="count"><span class="c_gray">조회</span> <?=number_format($view[wr_hit])?></span>
<? if ($is_good) { ?>
  <? if ($good_href) {?>
    <div class="good"><span class="icon good"></span><span class="c_gray">+</span><a href="<?=$good_href?>" target="hiddenframe" title="추천"><?=number_format($view[wr_good])?></a></div>
  <? }else {?>
    <div class="good"><span class="icon good"></span><span class="c_gray">+</span><?=number_format($view[wr_good])?></div>
  <? } ?>
<? } ?>

<? if ($is_nogood) { ?>
  <? if ($good_href) {?>
    <div class="nogood"><span class="icon nogood"></span><span class="c_gray">-</span><a href="<?=$nogood_href?>" target="hiddenframe" title="비추천"><?=number_format($view[wr_nogood])?></a></div>
  <? }else {?>
    <div class="nogood"><span class="icon nogood"></span><span class="c_gray">-</span><?=number_format($view[wr_nogood])?></div>
  <? } ?>
<? } ?>
</div>

<?
// 링크
echo "<div class=\"link\">";
echo "<ul>";

$cnt = 0;
for ($i=1; $i<=$g4[link_count]; $i++) {
  if ($view[link][$i]) {
    $cnt++;
    $link = cut_str($view[link][$i], 70);
    echo "<li>";
    echo "<span class=\"icon link\"></span><a href=\"{$view[link_href][$i]}\" target=\"_blank\" class=\"c_gray\">{$link}</a>";
    echo "&nbsp;<span class=\"c_orange\">[{$view[link_hit][$i]}]</span>";
    echo "</li>";
    }
}
echo "</ul>";
echo "</div>";
?>

<?
// 첨부파일
echo "<div class=\"file\">";
echo "<ul>";
$cnt = 0;
for ($i=0; $i<count($view[file]); $i++) {
    if ($view[file][$i][source] && !$view[file][$i][view]) {
        $cnt++;
    echo "<li>";
    echo "<span class=\"icon file\"></span><a href=\"javascript:file_download('{$view[file][$i][href]}', '{$view[file][$i][source]}');\" title=\"{$view[file][$i][content]}\">{$view[file][$i][source]}</a> <span class=\"c_gray\">({$view[file][$i][size]})</span>";
    echo "&nbsp;<span class=\"c_orange\">[{$view[file][$i][download]}]</span>";
    echo "&nbsp;<span class=\"c_gray\">DATE {$view[file][$i][datetime]}</span>";
    echo "</li>";
    }
}
echo "</ul>";
echo "</div>";
?>

</div><!-- info end -->

<!-- 게시글 보기 시작 -->
<? 
// 파일 출력
for ($i=0; $i<=count($view[file]); $i++) {
  if ($view[file][$i][view]) 
  echo "<p class=\"img\">{$view[file][$i][view]}</p>";
}
?>

<!-- 내용 출력 -->
<div class="contents">
<?=$view[content];?>

        
<?//echo $view[rich_content]; // {이미지:0} 과 같은 코드를 사용할 경우?>
<!-- 테러 태그 방지용 --></xml></xmp><a href=""></a><a href=''></a>
<? if ($is_signature) { echo "<div class=\"signature\">$signature</div>"; } // 서명 출력 ?>
</div>

<!-- 이전글 다음글 -->
<div class="nextprev">
    <? if ($prev_href) { echo "<a href=\"$prev_href\" title=\"$prev_wr_subject\" class=\"button prev\"><span class=\"icon prev\"></span>이전글</a>"; } ?>
    <? if ($next_href) { echo "<a href=\"$next_href\" title=\"$next_wr_subject\" class=\"button next\">다음글</a>"; } ?>
</div>

<?
// 코멘트 입출력
include_once("./view_comment.php");
?>

<script type="text/javascript">
function file_download(link, file) {
  <? if ($board[bo_download_point] < 0) { ?>
  if (confirm("'"+file+"' 파일을 다운로드 하시면 포인트가 차감(<?=number_format($board[bo_download_point])?>점)됩니다.\n\n포인트는 게시물당 한번만 차감되며 다음에 다시 다운로드 하셔도 중복하여 차감하지 않습니다.\n\n그래도 다운로드 하시겠습니까?"))
  <? }?>
    document.location.href=link;
}
</script>

<script type="text/javascript" src="<?="$g4[path]/js/board.js"?>"></script>
<script type="text/javascript">
window.onload=function() {
    resizeBoardImage(<?=(int)$board[bo_image_width]?>);
    drawFont();
}
</script>
<!-- 게시글 보기 끝 -->