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

// 선택옵션으로 인해 셀합치기가 가변적으로 변함
$colspan = 9;
if ($is_category) $colspan++;
if ($is_checkbox) $colspan++;
if ($is_good) $colspan++;
if ($is_nogood) $colspan++;
?>

<link rel='stylesheet' type='text/css' href='<?=$board_skin_path?>/board_style.css'>

<table width="<?=$width?>" cellpadding="0" cellspacing="0" border="0" align="center" valign="top">
	<tr>
		<td align="center" valign="top">
<table width="100%" cellpadding="0" cellspacing="0" border="0" align="center" valign="top">
	<tr>
		<td width="100%">
<table width="100%" cellspacing="0" cellpadding="0" border="0">
<form name="fboardlist" method="post">
<input type="hidden" name="bo_table" value="<?=$bo_table?>">
<input type="hidden" name="sfl"  value="<?=$sfl?>">
<input type="hidden" name="stx"  value="<?=$stx?>">
<input type="hidden" name="spt"  value="<?=$spt?>">
<input type="hidden" name="page" value="<?=$page?>">
<input type="hidden" name="sw"   value="">
	<tr>
		<td width="50" align="center" valign="bottom"><img src="<?=$board_skin_path?>/img/t_num.gif" width="15" height="9"></td>
		<td width="1"></td>
		<td align="center" valign="bottom"><img src="<?=$board_skin_path?>/img/t_s.gif" width="22" height="12"></td>
		<td width="1"></td>
		<td width="130" align="center" valign="bottom"><img src="<?=$board_skin_path?>/img/t_n.gif" width="32" height="12"></td>
		<td width="1"></td>
		<td width="80" align="center" valign="bottom"><img src="<?=$board_skin_path?>/img/t_d.gif" width="23" height="12"></td>
		<td width="1"></td>
		<td width="40" align="center" valign="bottom"><img src="<?=$board_skin_path?>/img/t_h.gif" width="21" height="12"></td>
	</tr>
</table>
		</td>
	</tr>
	<tr>
		<td width="100%" height="10">
<table width="100%" height="10" cellspacing="0" cellpadding="0" border="0">
	<tr>
		<td width="50" height="10"><span class="L_T_L">&nbsp;</span></td>
		<td bgcolor="#d3d7f6" width="1" height="10"></td>
		<td height="10"><span class="L_T_L">&nbsp;</span></td>
		<td bgcolor="#d3d7f6" width="1" height="10"></td>
		<td width="130" height="10"><span class="L_T_L">&nbsp;</span></td>
		<td bgcolor="#d3d7f6" width="1" height="10"></td>
		<td width="80" height="10"><span class="L_T_L">&nbsp;</span></td>
		<td bgcolor="#d3d7f6" width="1" height="10"></td>
		<td width="40" height="10"><span class="L_T_L">&nbsp;</span></td>
	</tr>
</table></td>
	</tr>
	<tr>
		<td width="100%" bgcolor="#bdc1ee" height="1"></td>
	</tr>

	<tr>
		<td width="100%" bgcolor="#e7e9f9" height="1"></td>
	</tr>
	<tr>
		<td width="100%">
<table width="100%" cellspacing="0" cellpadding="0" border="0">
<? for ($i=0; $i<count($list); $i++) { ?>
	<tr height="33">
		<td width="50" align="center">
<? 
if ($list[$i][is_notice]) // 공지사항 
    echo "<img src=\"$board_skin_path/img/notice_icon.gif\" width=28 height=16>";
else if ($wr_id == $list[$i][wr_id]) // 현재위치
    echo "<font color='#2C8CB9'>{$list[$i][num]}";
else
    echo "<span class='L_Num'>{$list[$i][num]}</span>";
?></td>
		<td width="1"></td>
<? if ($is_checkbox) { ?>
		<td width="20">
<input type=checkbox name=chk_wr_id[] value="<?=$list[$i][wr_id]?>"></td>
<? } ?>
		<td style="word-break:break-all; padding:5 10 5 10px;">
<? 
echo $nobr_begin;
echo $list[$i][reply];
echo $list[$i][icon_reply];
echo "<a href='{$list[$i][href]}'>";
if ($list[$i][is_notice])
    echo "<span class='L_S_N'>{$list[$i][subject]}</span>";
else
    echo "<span class='L_S'>{$list[$i][subject]}</span>";
echo "</a>";

if ($list[$i][comment_cnt])
    echo " <a href=\"{$list[$i][comment_href]}\"><span class='L_C_C'>{$list[$i][comment_cnt]}</span></a>";

// if ($list[$i]['link']['count']) { echo "[{$list[$i]['link']['count']}]"; }
// if ($list[$i]['file']['count']) { echo "<{$list[$i]['file']['count']}>"; }

	echo " " . $list[$i][icon_new];
	echo " " . $list[$i][icon_file];
	echo " " . $list[$i][icon_link];
	echo " " . $list[$i][icon_hot];
	echo " " . $list[$i][icon_secret];
	echo $nobr_end;
?></td>
		<td width="1"></td>
		<td style="padding:3 0 3 0px;" width="130" align="center"><span class="L_N"><?=$list[$i][name]?></span></td>
		<td width="1"></td>
		<td width="80" align="center"><span class="L_D"><?=$list[$i][datetime]?></span></td>
		<td width="1"></td>
		<td width="40" align="center"><span class="L_H"><?=$list[$i][wr_hit]?></span></td>
	</tr>
	<tr>
		<td colspan="<?=$colspan?>" height="1" bgcolor="#EEEEEE"></td>
	</tr>
<? } ?>
</table>
		</td>
	</tr>
</form>
	<tr>
		<td width="100%" height="37" align="center">
<? if ($prev_part_href) { echo "<a href='$prev_part_href'><img src='$board_skin_path/img/search_prev.gif' width=50 height=20 border=0 align=absmiddle title='이전검색'></a>"; } ?>
<?=$write_pages?>
<? if ($next_part_href) { echo "<a href='$next_part_href'><img src='$board_skin_path/img/search_next.gif' width=50 height=20 border=0 align=absmiddle title='다음검색'></a>"; } ?>
		</td>
	</tr>
	<tr>
		<td width="100%">
<!-- 버튼 링크 -->
<form name=fsearch method=get style="margin:0px;">
<input type=hidden name=bo_table value="<?=$bo_table?>">
<input type=hidden name=sca      value="<?=$sca?>">
<table width="100%" cellspacing="0" cellpadding="0" border="0">
	<tr> 
		<td width="50%" height="40">
<? if ($list_href) { ?><a href="<?=$list_href?>"><img src="<?=$board_skin_path?>/img/list.gif" border="0"></a><? } ?>
<? if ($write_href) { ?><a href="<?=$write_href?>"><img src="<?=$board_skin_path?>/img/write.gif" border="0"></a><? } ?>
<? if ($is_checkbox) { ?>
&nbsp;<a href="javascript:select_delete();"><img src="<?=$board_skin_path?>/img/delete.gif" border="0"></a>
<a href="javascript:select_copy('copy');"><img src="<?=$board_skin_path?>/img/copy.gif" border="0"></a>
<a href="javascript:select_copy('move');"><img src="<?=$board_skin_path?>/img/move.gif" border="0"></a>
<? } ?></td>
		<td width="50%" align="right">
<select name=sfl class=L_Select>
	<option value='wr_subject||wr_content'>제목+내용</option>
	<option value='wr_subject'>제목</option>
	<option value='wr_content'>내용</option>
	<option value='mb_id'>회원아이디</option>
	<option value='wr_name'>이름</option>
</select>
<INPUT maxLength=15 size=10 name=stx itemname="검색어" required value="<?=$stx?>" class=L_Input>
<SELECT name=sop class="L_Select">
	<OPTION value=and>And</OPTION>
	<OPTION value=or>Or</OPTION>
</SELECT>
<INPUT type=image width="45" height="18" src="<?=$board_skin_path?>/img/search.gif" align=absmiddle border=0></td>
	</tr>
</table></form></td>
	</tr>
</table></td>
	</tr>
</table>

<script language="JavaScript">
if ("<?=$sca?>") document.fcategory.sca.value = "<?=$sca?>";
if ("<?=$stx?>") {
    document.fsearch.sfl.value = "<?=$sfl?>";
    document.fsearch.sop.value = "<?=$sop?>";
}
</script>

<? if ($is_checkbox) { ?>
<script language="JavaScript">
function all_checked(sw)
{
    var f = document.fboardlist;

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

function check_confirm(str)
{
    var f = document.fboardlist;
    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;
}

// 선택한 게시물 삭제
function select_delete()
{
    var f = document.fboardlist;

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

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

    f.action = "./delete_all.php";
    f.submit();
}

// 선택한 게시물 복사 및 이동
function select_copy(sw)
{
    var f = document.fboardlist;

    if (sw == "copy")
        str = "복사";
    else
        str = "이동";
                       
    if (!check_confirm(str))
        return;

    var sub_win = window.open("", "move", "left=50, top=50, width=396, height=550, scrollbars=1");

    f.sw.value = sw;
    f.target = "move";
    f.action = "./move.php";
    f.submit();
}
</script>
<? } ?>
