팝업창 내에서 수정&삭제버튼 삽입하는 법! 정보
팝업창 내에서 수정&삭제버튼 삽입하는 법!본문
까만도둑님이 올려주신 popup창 감사하게 받아 사용하고 있습니다. ^^
그런데, 게시물이 이 팝업창에 뜬 상태에서, 게시물을 수정과 삭제를 할 수 는 없을까요?
그러니까, 팝업창 내에 게시물의 수정버튼, 삭제버튼이 뜨도록이요.
까만도둑님의 팝업창 소스는 아래와 같습니다.
<?
$g4_path = "../../..";
$g4_path = "../../..";
include_once("$g4_path/common.php");
// wr_id 값이 있으면 글읽기
if ($wr_id) {
// 글이 없을 경우 해당 게시판 목록으로 이동
if (!$write[wr_id]) {
$msg = "글이 존재하지 않습니다.\\n\\n글이 삭제되었거나 이동된 경우입니
if ($wr_id) {
// 글이 없을 경우 해당 게시판 목록으로 이동
if (!$write[wr_id]) {
$msg = "글이 존재하지 않습니다.\\n\\n글이 삭제되었거나 이동된 경우입니
다.";
if ($cwin)
alert_close($msg);
else
alert($msg, "./board.php?bo_table=$bo_table");
}
if ($cwin)
alert_close($msg);
else
alert($msg, "./board.php?bo_table=$bo_table");
}
// 로그인된 회원의 권한이 설정된 읽기 권한보다 작다면
if ($member[mb_level] < $board[bo_read_level]) {
if ($member[mb_id])
alert("글을 읽을 권한이 없습니다.");
else
alert("글을 읽을 권한이 없습니다.\\n\\n회원이시라면 로그인 후 이용해 보
if ($member[mb_level] < $board[bo_read_level]) {
if ($member[mb_id])
alert("글을 읽을 권한이 없습니다.");
else
alert("글을 읽을 권한이 없습니다.\\n\\n회원이시라면 로그인 후 이용해 보
십시오.", "./login.php?wr_id=$wr_id{$qstr}&url=".urlencode("board.php?bo_table=$bo_table&wr_id=$wr_id"));
}
}
// 자신의 글이거나 관리자라면 통과
if (($write[mb_id] && $write[mb_id] == $member[mb_id]) || $is_admin)
;
else {
// 비밀글이라면
if (strstr($write[wr_option], "secret")) {
$ss_name = "ss_secret_{$bo_table}_$write[wr_num]";
//$ss_name = "ss_secret_{$bo_table}_{$wr_id}";
// 한번 읽은 게시물의 번호는 세션에 저장되어 있고 같은 게시물을 읽을 경우
if (($write[mb_id] && $write[mb_id] == $member[mb_id]) || $is_admin)
;
else {
// 비밀글이라면
if (strstr($write[wr_option], "secret")) {
$ss_name = "ss_secret_{$bo_table}_$write[wr_num]";
//$ss_name = "ss_secret_{$bo_table}_{$wr_id}";
// 한번 읽은 게시물의 번호는 세션에 저장되어 있고 같은 게시물을 읽을 경우
는 다시 패스워드를 묻지 않습니다.
// 이 게시물이 저장된 게시물이 아니면서 관리자가 아니라면
//if ("$bo_table|$write[wr_num]" != get_session("ss_secret"))
if (!get_session($ss_name))
goto_url("./password.php?w=s&bo_table=$bo_table&wr_id=$wr_id{$qstr}");
// 이 게시물이 저장된 게시물이 아니면서 관리자가 아니라면
//if ("$bo_table|$write[wr_num]" != get_session("ss_secret"))
if (!get_session($ss_name))
goto_url("./password.php?w=s&bo_table=$bo_table&wr_id=$wr_id{$qstr}");
set_session($ss_name, TRUE);
}
}
}
}
// 한번 읽은글은 브라우저를 닫기전까지는 카운트를 증가시키지 않음
$ss_name = "ss_view_{$bo_table}_{$wr_id}";
if (!get_session($ss_name))
{
sql_query(" update $write_table set wr_hit = wr_hit + 1 where wr_id = '$wr_id'
$ss_name = "ss_view_{$bo_table}_{$wr_id}";
if (!get_session($ss_name))
{
sql_query(" update $write_table set wr_hit = wr_hit + 1 where wr_id = '$wr_id'
");
// 자신의 글이면 통과
if ($write[mb_id] && $write[mb_id] == $member[mb_id])
;
else {
// 회원이상 글읽기가 가능하다면
//if ($board[bo_read_level] > 1) {
// 글읽기 포인트가 음수이고 회원의 포인트가 0 이거나 작다면
//if ($board[bo_read_point] < 0 && $member[mb_point] <= 0)
if ($member[mb_point] + $board[bo_read_point] < 0)
alert("보유하신 포인트(".number_format($member[mb_point]).")가 없
if ($write[mb_id] && $write[mb_id] == $member[mb_id])
;
else {
// 회원이상 글읽기가 가능하다면
//if ($board[bo_read_level] > 1) {
// 글읽기 포인트가 음수이고 회원의 포인트가 0 이거나 작다면
//if ($board[bo_read_point] < 0 && $member[mb_point] <= 0)
if ($member[mb_point] + $board[bo_read_point] < 0)
alert("보유하신 포인트(".number_format($member[mb_point]).")가 없
어나 모자라서 글읽기(".number_format($board[bo_read_point]).")가 불가합니다.\\n\\n포인트를 모으신 후 다시 글읽기 해 주십시오.");
insert_point($member[mb_id], $board[bo_read_point], "$board[bo_subject] $wr_id 글읽기");
//}
}
//}
}
set_session($ss_name, TRUE);
}
}
$g4[title] = "$group[gr_subject] > $board[bo_subject] > " . strip_tags(conv_subject($write[wr_subject], 255));
} else {
if ($member[mb_level] < $board[bo_list_level]) {
if ($member[mb_id])
alert("목록을 볼 권한이 없습니다.");
else
alert("목록을 볼 권한이 없습니다.\\n\\n회원이시라면 로그인 후 이용해 보
} else {
if ($member[mb_level] < $board[bo_list_level]) {
if ($member[mb_id])
alert("목록을 볼 권한이 없습니다.");
else
alert("목록을 볼 권한이 없습니다.\\n\\n회원이시라면 로그인 후 이용해 보
십시오.", "./login.php?wr_id=$wr_id{$qstr}&url=".urlencode("board.php?bo_table=$bo_table&wr_id=$wr_id"));
}
}
if (!$page) $page = 1;
$g4[title] = "$group[gr_subject] > $board[bo_subject] $page 페이지";
}
}
include_once("$g4[path]/head.sub.php");
$view = get_view($write, $board, $board_skin_path);
if (strstr($sfl, "subject"))
$view[subject] = search_font($stx, $view[subject]);
$view[subject] = search_font($stx, $view[subject]);
$html = 0;
if (strstr($view[wr_option], "html1"))
$html = 1;
else if (strstr($view[wr_option], "html2"))
$html = 2;
if (strstr($view[wr_option], "html1"))
$html = 1;
else if (strstr($view[wr_option], "html2"))
$html = 2;
$view[content] = conv_content($view[wr_content], $html);
if (strstr($sfl, "content"))
$view[content] = search_font($stx, $view[content]);
$view[content] = preg_replace("/(\<img )([^\>]*)(\>)/i", "\\1
if (strstr($sfl, "content"))
$view[content] = search_font($stx, $view[content]);
$view[content] = preg_replace("/(\<img )([^\>]*)(\>)/i", "\\1
name='target_resize_image[]' onclick='image_window(this)' style='cursor:pointer;'
// 트랙백
$trackback_url = "";
if ($member[mb_level] >= $board[bo_trackback_level])
$trackback_url = "$g4[url]/$g4[bbs]/tb.php/$bo_table/$wr_id";
$trackback_url = "";
if ($member[mb_level] >= $board[bo_trackback_level])
$trackback_url = "$g4[url]/$g4[bbs]/tb.php/$bo_table/$wr_id";
// 현재글의 스크랩 카운트
$temp =mysql_fetch_array(mysql_query("select count(*) from g4_scrap where bo_table='$bo_table' and wr_id = $wr_id"));
$scrap_count = $temp[0];
$temp =mysql_fetch_array(mysql_query("select count(*) from g4_scrap where bo_table='$bo_table' and wr_id = $wr_id"));
$scrap_count = $temp[0];
// 이모티콘
function emoticon_html($str, $board_skin_path)
{
function emoticon_html($str, $board_skin_path)
{
for($i=1; $i<=120; $i++) {
if($i < 10) {
$emo_id = "emoticon_00$i";
} else if($i < 100) {
$emo_id = "emoticon_0$i";
} else {
$emo_id = "emoticon_$i";
}
$img_src = "<img src='$board_skin_path/emoticons/$i.gif' width=18 height=18 border=0 title=$emo_id>";
$str = eregi_replace($emo_id, $img_src, $str);
}
if($i < 10) {
$emo_id = "emoticon_00$i";
} else if($i < 100) {
$emo_id = "emoticon_0$i";
} else {
$emo_id = "emoticon_$i";
}
$img_src = "<img src='$board_skin_path/emoticons/$i.gif' width=18 height=18 border=0 title=$emo_id>";
$str = eregi_replace($emo_id, $img_src, $str);
}
return $str;
}
}
?>
<script language="javascript" src="<?=$g4[path]?>/js/sideview.js"></script>
<!--<link rel='stylesheet' href='<?=$board_skin_path?>/style01.css' type='text/css'> -->
<style>
a:link, a:visited, a:active { text-decoration:none; color:#111111; }
a:hover { text-decoration:underline; color:#111111; }
.content { color:#111111; font-size:10pt; font-weight: normal; } /* 내용보기에서 본문
<style>
a:link, a:visited, a:active { text-decoration:none; color:#111111; }
a:hover { text-decoration:underline; color:#111111; }
.content { color:#111111; font-size:10pt; font-weight: normal; } /* 내용보기에서 본문
*/
.lh { line-height:200%; } /* 내용보기에서 줄간격 */
</style>
.lh { line-height:200%; } /* 내용보기에서 줄간격 */
</style>
<br>
<table width=95% border=0 align=center cellpadding=0 cellspacing=0>
<tr><td colspan=2 height=30 class=content>제 목 : <?=$view[subject]?></td></tr>
<tr><td colspan=2 height=30 class=content>제 목 : <?=$view[subject]?></td></tr>
<!-- root님 팁 적용 -->
<?
if($board[bo_2]) {
$smark = substr($board[bo_2],0,1); // 제목의 구분자를 파악한다.
$itemtitle = explode("$smark", $board[bo_2]); // 제목 구분자로 제목을 나눈다.
<?
if($board[bo_2]) {
$smark = substr($board[bo_2],0,1); // 제목의 구분자를 파악한다.
$itemtitle = explode("$smark", $board[bo_2]); // 제목 구분자로 제목을 나눈다.
// 각항목의 값과 각항목의 제목이 모두 존재할경우 항목을 보여준다.
if($write[wr_1] && $itemtitle[1]) { echo "<tr><td colspan=2 height=1 bgcolor=#C3BEB2></td></tr>
<tr><td colspan=2 height=25> <font color=cf4900>$itemtitle[1]</font> :
if($write[wr_1] && $itemtitle[1]) { echo "<tr><td colspan=2 height=1 bgcolor=#C3BEB2></td></tr>
<tr><td colspan=2 height=25> <font color=cf4900>$itemtitle[1]</font> :
$write[wr_1]</td></tr>"; }
if($write[wr_2] && $itemtitle[2]) { echo "<tr><td colspan=2 height=1
if($write[wr_2] && $itemtitle[2]) { echo "<tr><td colspan=2 height=1
bgcolor=#C3BEB2></td></tr>
<tr><td colspan=2 height=25> <font color=cf4900>$itemtitle[2]</font> :
<tr><td colspan=2 height=25> <font color=cf4900>$itemtitle[2]</font> :
$write[wr_2]</td></tr>"; }
if($write[wr_3] && $itemtitle[3]) { echo "<tr><td colspan=2 height=1
if($write[wr_3] && $itemtitle[3]) { echo "<tr><td colspan=2 height=1
bgcolor=#C3BEB2></td></tr>
<tr><td colspan=2 height=25> <font color=cf4900>$itemtitle[3]</font> :
<tr><td colspan=2 height=25> <font color=cf4900>$itemtitle[3]</font> :
$write[wr_3]</td></tr>"; }
if($write[wr_4] && $itemtitle[4]) { echo "<tr><td colspan=2 height=1
if($write[wr_4] && $itemtitle[4]) { echo "<tr><td colspan=2 height=1
bgcolor=#C3BEB2></td></tr>
<tr><td colspan=2 height=25> <font color=cf4900>$itemtitle[4]</font> :
<tr><td colspan=2 height=25> <font color=cf4900>$itemtitle[4]</font> :
$write[wr_4]</td></tr>"; }
if($write[wr_5] && $itemtitle[5]) { echo "<tr><td colspan=2 height=1
if($write[wr_5] && $itemtitle[5]) { echo "<tr><td colspan=2 height=1
bgcolor=#C3BEB2></td></tr>
<tr><td colspan=2 height=25> <font color=cf4900>$itemtitle[5]</font> :
<tr><td colspan=2 height=25> <font color=cf4900>$itemtitle[5]</font> :
$write[wr_5]</td></tr>"; }
}
?>
}
?>
<!--<tr><td colspan=2 height=1 bgcolor=#D4CFC3></td></tr>-->
<tr>
<td colspan=2>
<table width=100% cellpadding=5>
<tr>
<td style='word-break:break-all;' class='lh' height=100>
<?
// 파일 출력
for ($i=0; $i<=count($view[file]); $i++) {
if ($view[file][$i][view])
echo $view[file][$i][view] . "<p>" . $view[file][$i][content] . "<p>";
}
$view[content] = emoticon_html($view[content], $board_skin_path);
echo "<span class='content'>$view[content]</span>";
?>
echo "<span class='content'>$view[content]</span>";
?>
<?//echo $view[rich_content]; // 과 같은 코드를 사용할 경우?>
<!-- 테러 태그 방지용 -->
</xml></xmp><a href=""></a><a href=''></a>
</td>
</tr>
</xml></xmp><a href=""></a><a href=''></a>
</td>
</tr>
<?
// 가변 파일
$cnt = 0;
for ($i=0; $i<count($view[file]); $i++) {
if ($view[file][$i][source] && !$view[file][$i][view]) {
$cnt++;
echo <<<HEREDOC
<tr><td class=tt> <img src='$board_skin_path/img/icon_file.gif' align='absmiddle'>
<a href='{$view[file][$i][href]}' title='{$view[file][$i][content]}'>
<span class=tt>{$view[file][$i][source]}</span> ({$view[file][$i][size]}), Down:{$view[file][$i][download]}, {$view[file][$i][datetime]}</a>
</td></tr>
HEREDOC;
}
}
HEREDOC;
}
}
// 링크
$cnt = 0;
for ($i=1; $i<=$g4[link_count]; $i++) {
if ($view[link][$i]) {
$cnt++;
$link = cut_str($view[link][$i], 70);
echo <<<HEREDOC
<tr><td class=tt> <img src='$board_skin_path/img/icon_link.gif' align='absmiddle'> <a href="{$view[link_href][$i]}" target="_blank"><span class=tt>{$link}</span></a>, Hit:{$view[link_hit][$i]}</td></tr>
HEREDOC;
}
}
?>
$cnt = 0;
for ($i=1; $i<=$g4[link_count]; $i++) {
if ($view[link][$i]) {
$cnt++;
$link = cut_str($view[link][$i], 70);
echo <<<HEREDOC
<tr><td class=tt> <img src='$board_skin_path/img/icon_link.gif' align='absmiddle'> <a href="{$view[link_href][$i]}" target="_blank"><span class=tt>{$link}</span></a>, Hit:{$view[link_hit][$i]}</td></tr>
HEREDOC;
}
}
?>
</table>
<br><br></td>
</tr>
</table>
<script language="JavaScript">
// HTML 로 넘어온 <img ... > 태그의 폭이 테이블폭보다 크다면 테이블폭을 적용한다.
// HTML 로 넘어온 <img ... > 태그의 폭이 테이블폭보다 크다면 테이블폭을 적용한다.
function resize_image()
{
var target = document.getElementsByName('target_resize_image[]');
var image_width = parseInt('<?=$board[bo_image_width]?>');
var image_height = 0;
for(i=0; i<target.length; i++) {
// 원래 사이즈를 저장해 놓는다
target[i].tmp_width = target[i].width;
target[i].tmp_height = target[i].height;
// 이미지 폭이 테이블 폭보다 크다면 테이블폭에 맞춘다
if(target[i].width > image_width) {
image_height = parseFloat(target[i].width / target[i].height)
target[i].width = image_width;
target[i].height = parseInt(image_width / image_height);
}
}
}
// 원래 사이즈를 저장해 놓는다
target[i].tmp_width = target[i].width;
target[i].tmp_height = target[i].height;
// 이미지 폭이 테이블 폭보다 크다면 테이블폭에 맞춘다
if(target[i].width > image_width) {
image_height = parseFloat(target[i].width / target[i].height)
target[i].width = image_width;
target[i].height = parseInt(image_width / image_height);
}
}
}
window.onload = resize_image;
</script>
</script>
------------------------------
혹시나해서
<? if ($update_href) { echo "<a href=\"$update_href\"><img src='이미지 절대주
소' border='0' align='absmiddle'></a> "; } ?>
를 넣어봤더니 역시 안되더라구요^^;;
단순하게 저것만 넣으면 안되는 것 같은데...
뭐 더 집어넣어야 할 소스가 있을까요? 아니면 아예 안되려나?
답변 부탁드리겠습니다, 추운데 건강조심하시구요. *^^*
댓글 전체
잘 될지 모르겠지만.. 적어봅니다.
<input type="button" value="수정" onClick="modify_Click();">
<script type="text/javascript">
function modify_Click()
{
opener.location.href = "<?php echo $g4['bbs_path']; ?>/write.php?w=u&bo_table=<?php echo $bo_table; ?>&wr_id=<?php echo $wr_id; ?>";
window.close();
}
</script>
<input type="button" value="수정" onClick="modify_Click();">
<script type="text/javascript">
function modify_Click()
{
opener.location.href = "<?php echo $g4['bbs_path']; ?>/write.php?w=u&bo_table=<?php echo $bo_table; ?>&wr_id=<?php echo $wr_id; ?>";
window.close();
}
</script>
완전감사합니다! 산뜻하게 해결되었네요. *^________________^*