list 클릭시 view를 iframe으로 띄우려는데 자꾸 안 뜹니다 도와주세요ㅠㅠㅠ 채택완료

Copy
<?php

include_once('./_common.php');

 

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

$colspan = 6;

 

if ($is_checkbox) $colspan++;

if ($is_good) $colspan++;

if ($is_nogood) $colspan++;

 

?>

 

<style>

    .state {text-align: center;}

    .state p {color: white; border-radius: 5px; padding: 5px}

    .state_wait p {background-color: #EEA23E;}

    .state_approval p {background-color: #5DC264;}

    .state_refuse p {background-color: #F04438;}

    .state_cancel p {background-color: lightgrey;}

    .click_row {cursor: pointer;}

    .content-wrapper {padding: 20px}

    table {text-align: center;}

    .search_form {width: 100%; padding: 5px; margin-bottom:10px; float: right; border-bottom: 1px solid lightgrey; border-top: 1px solid lightgrey;}

    .search_form form {float: right}

    .modal-dialog {max-width: 800px;}

    .modal-content {height: 800px}

</style>

 

<div class="content-wrapper">

    <div class="content-header">

        <div class="container-fluid">

            <div class="row mb-2">

                <div class="col-sm-6">

                    <h1 class="m-0"><?php echo $board['bo_subject']; ?></h1>

                </div>

                <div class="col-sm-6">

                    <ol class="breadcrumb float-sm-right">

                        <li class="breadcrumb-item"><a href="<?php echo G5_URL; ?>">Home</a></li>

                        <li class="breadcrumb-item active"><?php echo $board['bo_subject']; ?></li>

                    </ol>

                </div>

            </div>

        </div>

    </div>

 

    <div class="search_form">

        <form name="fsearch" method="get">

            <input type="hidden" name="bo_table" value="<?php echo $bo_table; ?>">

            <input type="hidden" name="sca" value="<?php echo $sca; ?>">

            <input type="hidden" name="sop" value="and">

            <input type="hidden" name="sfl" value="wr_subject||wr_content">                                    

            <label for="stx" class="sound_only">검색어<strong class="sound_only"> 필수</strong></label>

           

            <div class="sch_bar input-group input-group-sm" style="width: 150px;">

                <div class="input-group-append">

                    <button type="submit" value="검색" class="btn btn-default sch_btn">

                        <i class="fas fa-search"></i><span class="sound_only">검색</span>

                    </button>

                </div>  

                <input type="text" name="stx" value="<?php echo stripslashes($stx); ?>" required id="stx" class="sch_input form-control float-right" placeholder="Search">

            </div>

        </form>

    </div><br><br>

 

    <div class="row">

        <?php include_once('write.skin.php'); ?>

 

        <div class="col-8">

            <section class="content">

                <?php if ($is_admin == 'super' || $is_auth || $admin_href || $is_checkbox || $rss_href) { ?>

                <div class="row display-none">

                    <div class="col-12">                  

                        <?php if ($admin_href) { ?><a href="<?php echo $admin_href ?>" class="btn_admin btn" title="관리자"><i class="fa fa-cog fa-spin fa-fw"></i><span class="sound_only">관리자</span></a><?php } ?>

                        <?php if ($rss_href) { ?><a href="<?php echo $rss_href ?>" class="btn_b01 btn" title="RSS"><i class="fa fa-rss" aria-hidden="true"></i><span class="sound_only">RSS</span></a><?php } ?>

                        <?php if ($is_admin == 'super' || $is_auth) {  ?>

                            <?php if ($is_checkbox) { ?>                            

                                <button type="submit" name="btn_submit" class="btn btn-secondary btn-sm" value="선택삭제" onclick="document.pressed=this.value"><i class="fa fa-trash-o" aria-hidden="true"></i> 선택삭제</button>

                                <button type="submit" name="btn_submit" class="btn btn-secondary btn-sm" value="선택복사" onclick="document.pressed=this.value"><i class="fa fa-files-o" aria-hidden="true"></i> 선택복사</button>

                                <button type="submit" name="btn_submit" class="btn btn-secondary btn-sm" value="선택이동" onclick="document.pressed=this.value"><i class="fa fa-arrows" aria-hidden="true"></i> 선택이동</button>

                            <?php } ?>                    

                        <?php }  ?>

                    </div>

                </div>

                <?php } ?>

 

                <div class="row">

                    <div class="col-12">

                        <div class="card">

                            <div class="card-body table-responsive p-0">

                                <form name="fboardlist" id="fboardlist" action="<?php echo G5_BBS_URL; ?>/board_list_update.php" onsubmit="return fboardlist_submit(this);" method="post">    

                                    <input type="hidden" name="bo_table" value="<?php echo $bo_table; ?>">

                                    <input type="hidden" name="sfl" value="<?php echo $sfl; ?>">

                                    <input type="hidden" name="stx" value="<?php echo $stx; ?>">

                                    <input type="hidden" name="spt" value="<?php echo $spt; ?>">

                                    <input type="hidden" name="sca" value="<?php echo $sca; ?>">

                                    <input type="hidden" name="sst" value="<?php echo $sst; ?>">

                                    <input type="hidden" name="sod" value="<?php echo $sod; ?>">

                                    <input type="hidden" name="page" value="<?php echo $page; ?>">

                                    <input type="hidden" name="sw" value="">

 

                                    <table class="table table-hover text-nowrap">

                                        <thead>

                                            <tr>

                                                <?php if ($is_checkbox) { ?>

                                                <?php } ?>

                                                <th style="width: 30px">신청자</th>

                                                <th>휴가구분</th>

                                                <th>시작일자</th>

                                                <th>종료일자</th>

                                                <th>일수</th>

                                                <th>상태</th>

                                                <th>승인자</th>

                                            </tr>

                                        </thead>

 

                                        <tbody>

                                            <?php

                                            for ($i=0; $i<count($list); $i++) {

                                                if ($i%2==0) $lt_class = "even";

                                                else $lt_class = "";

                                            ?>

                                            <tr data-bs-toggle="modal" data-bs-target="#view_modal" class="click_row <?php echo $lt_class; ?>" data-href="<?php echo $list[$i]['href']; ?>">

                                                <td><?php echo $list[$i]['name']; ?></td>

                                                <td>

                                                    <?php if ($is_category && $list[$i]['ca_name']) { ?>

                                                    <a href="<?php echo $list[$i]['ca_name_href']; ?>" class="btn btn-outline-secondary btn-xs"><?php echo $list[$i]['ca_name']; ?></a>

                                                    <?php } ?>

                                                </td>

                                                <td>

                                                <?php

                                                    if ($list[$i]['wr_3'] != '') { echo $list[$i]['wr_1'] . ' ' . $list[$i]['wr_3'] . ':00';

                                                    } else { echo $list[$i]['wr_1']; }

                                                ?>

                                                </td>                                        

                                                <td>

                                                <?php

                                                    if ($list[$i]['wr_2'] != '') {

                                                        echo $list[$i]['wr_2'];

                                                    } else {

                                                        $start_time = $list[$i]['wr_1'] . ' ' . $list[$i]['wr_3'] . ':00:00';

                                                        if (strpos($list[$i]['wr_4'],'시간')) {

                                                            $use = str_replace('시간', ' hours', $list[$i]['wr_4']);

                                                        } else {

                                                            $use = str_replace('분', ' minutes', $list[$i]['wr_4']);

                                                        }

                                                        $timestamp = strtotime('+' . $use, strtotime($start_time));

 

                                                        echo date("Y-m-d H:i", $timestamp);

                                                    }

                                                ?>

                                                </td>

                                                <td>

                                                <?php

                                                    if ($list[$i]['ca_name'] == '반차') {

                                                        echo "0.5일";

                                                    } else {

                                                        $date1 = new DateTime($list[$i]['wr_1']);

                                                        $date2 = new DateTime($list[$i]['wr_2']);

 

                                                        $interval = $date1->diff($date2);

 

                                                        $days = $interval->days;

                                                        echo $days + 1 . '일';

                                                    }

                                                ?>

                                                </td>

                                                <td class="state <?php echo $list[$i]['wr_5']=='대기중' ? 'state_wait' : ($list[$i]['wr_5']=='승인' ? 'state_approval' : ($list[$i]['wr_5']=='거절' ? 'state_refuse' : 'state_cancel'))?>">

                                                    <p>• <?php echo $list[$i]['wr_5']; ?></p>

                                                </td>                                        

                                                <td><?php echo $list[$i]['wr_6']?></td>

                                            </tr>

                                            <?php } ?>

                                            <?php if (count($list) == 0) { echo '<tr><td colspan="'.$colspan.'" class="empty_table">아직 등록된 게시물이 없습니다.</td></tr>'; } ?>

                                        </tbody>

                                       

                                        <?php if ($write_pages) { ?>

                                        <tfoot>

                                            <tr>

                                                <th colspan="<?php echo $colspan; ?>">

                                                    <?php echo $write_pages; ?>

                                                </th>

                                            </tr>

                                        </tfoot>

                                        <?php } ?>

 

                                    </table>

                                </form>

                            </div>

                        </div>

                    </div>

                </div>

            </section>

        </div>

    </div>

</div>

 

<!-- Modal -->

<div class="modal fade" id="view_modal" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" aria-labelledby="view_modal" aria-hidden="true">

    <div class="modal-dialog">

        <div class="modal-content">

            <div class="modal-header">

                <h4 class="modal-title" id="myModalLabel">신청 상세 내용</h4>

                <button type="button" class="close modal_close_btn" data-bs-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>

            </div>

            <div class="modal-body">

                <iframe src="" class="view_iframe" width="100%" height="100%" sandbox="allow-forms allow-scripts allow-same-origin"></iframe>

 

            </div>

            <div class="modal-footer">

                <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">닫기</button>

            </div>

        </div>

    </div>

</div>

 

<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script>

<script>

jQuery(function($){

    // 게시판 검색

    $(".btn_bo_sch").on("click", function() {

        $(".bo_sch_wrap").toggle();

    })

    $('.bo_sch_bg, .bo_sch_cls').click(function(){

        $('.bo_sch_wrap').hide();

    });

});

 

$(document).ready(function(){

    $(".click_row").click(function() {

        console.log($(this).data("href"));

        $(".view_iframe").attr('src', $(this).data("href"));

    });

});


 

// Element 에 style 한번에 오브젝트로 설정하는 함수 추가

Element.prototype.setStyle = function(styles) {

    for (var k in styles) this.style[k] = styles[k];

    return this;

};

 

</script>


 

<?php if($is_checkbox) { ?>

<noscript>

<p>자바스크립트를 사용하지 않는 경우<br>별도의 확인 절차 없이 바로 선택삭제 처리하므로 주의하시기 바랍니다.</p>

</noscript>

<?php } ?>

 

<?php if ($is_checkbox) { ?>

<script>

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 fboardlist_submit(f) {

    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(document.pressed + "할 게시물을 하나 이상 선택하세요.");

        return false;

    }

 

    if(document.pressed == "선택복사") {

        select_copy("copy");

        return;

    }

 

    if(document.pressed == "선택이동") {

        select_copy("move");

        return;

    }

 

    if(document.pressed == "선택삭제") {

        if (!confirm("선택한 게시물을 정말 삭제하시겠습니까?\n\n한번 삭제한 자료는 복구할 수 없습니다\n\n답변글이 있는 게시글을 선택하신 경우\n답변글도 선택하셔야 게시글이 삭제됩니다."))

            return false;

 

        f.removeAttribute("target");

        f.action = g5_bbs_url+"/board_list_update.php";

    }

 

    return true;

}

 

// 선택한 게시물 복사 및 이동

function select_copy(sw) {

    var f = document.fboardlist;

 

    if (sw == "copy")

        str = "복사";

    else

        str = "이동";

 

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

 

    f.sw.value = sw;

    f.target = "move";

    f.action = g5_bbs_url+"/move.php";

    f.submit();

}

 

// 게시판 리스트 관리자 옵션

jQuery(function($){

    $(".btn_more_opt.is_list_btn").on("click", function(e) {

        e.stopPropagation();

        $(".more_opt.is_list_btn").toggle();

    });

    $(document).on("click", function (e) {

        if(!$(e.target).closest('.is_list_btn').length) {

            $(".more_opt.is_list_btn").hide();

        }

    });

});

</script>

<?php } ?>

<!-- } 게시판 목록 끝 -->

 

list.skin.php 파일입니다.

테이블의 각 행을 클릭하면 해당 행의 view.skin.php 페이지를 모달창으로 띄우려고 iframe을 사용했는데

991318073_1708568605.9975.png

 

자꾸 이렇게 로딩창만 뜨고 view 페이지가 보이지 않습니다 ㅠ 뭐가 문제일까요?

 

답변 1개

채택된 답변
+20 포인트

아이프레임에 아이디를 발급해주셔야하죠

그리고 스크립트에서 해당 아이디에 대한 것을 처리 해주셔야하구요

로그인 후 평가할 수 있습니다

댓글을 작성하려면 로그인이 필요합니다.

답변을 작성하려면 로그인이 필요합니다.

로그인
🐛 버그신고