팝업으로 띄우려면...
본문
아래 } else { 에서 only_admin.php를 팝업으로 띄우려면 어떻게 해야 할까요?
그리고 이 버튼은 관리자만 보이게 하고 싶습니다,
if ($is_dhtml_editor && $js) {
$html .= "\n".'<script src="'.$editor_url.'/js/service/HuskyEZCreator.js"></script>';
$html .= "\n".'<script>var g5_editor_url = "'.$editor_url.'", oEditors = [], ed_nonce = "'.ft_nonce_create('smarteditor').'";</script>';
$html .= "\n".'<script src="'.$editor_url.'/config.js"></script>';
$html .= "\n<script>";
$html .= '
$(function(){
$(".btn_cke_sc").click(function(){
if ($(this).next("div.cke_sc_def").length) {
$(this).next("div.cke_sc_def").remove();
$(this).text("관리자 전용");
} else {
$(this).after("<div class=\'cke_sc_def\' />").next("div.cke_sc_def").load("'.$editor_url.'/only_admin.php");
$(this).text("관리자 전용 닫기");
}
});
$(document).on("click", ".btn_cke_sc_close", function(){
$(this).parent("div.cke_sc_def").remove();
});
});';
$html .= "\n</script>";
$js = false;
}
답변 3
다음을 참고하셔서 원하시는 형식으로 수정하시면 가능하지 않을까 합니다.
if ($is_dhtml_editor && $js) {
$html .= "\n".'<script src="'.$editor_url.'/js/service/HuskyEZCreator.js"></script>';
$html .= "\n".'<script>var g5_editor_url = "'.$editor_url.'", oEditors = [], ed_nonce = "'.ft_nonce_create('smarteditor').'";</script>';
$html .= "\n".'<script src="'.$editor_url.'/config.js"></script>';
$html .= "\n<script>";
$html .= '
$(function(){
$(".btn_cke_sc").click(function(){
if ($(this).next("div.cke_sc_def").length) {
$(this).next("div.cke_sc_def").remove();
$(this).text("관리자 전용");
} else {
$(this).after("<div id=\'cke_modal\' class=\'modal\' />").next("div#cke_modal").load("'.$editor_url.'/only_admin.php", function(){
// After loading the content, display the modal
$("#cke_modal").modal();
});
$(this).text("관리자 전용 닫기");
}
});
$(document).on("click", ".btn_cke_sc_close", function(){
$(this).parent("div.cke_sc_def").remove();
});
});';
$html .= "\n</script>";
$js = false;
}
그리고 버튼을 관리자만 볼 수 있게 하려면 PHP로 해당 버튼을 출력하는 부분을 관리자 권한 확인 후에 출력하도록 수정하면 될것 같습니다.
!-->window.open 으로 바꾸시면 됩니다.
다만 팝업형식으로 바꾸셔야 할듯 합니다.
그리고 어드민만 보이게 하실려면 $is_admin 을 조건에 넣으시면 됩니다.
이렇게만 봐서는 정확히 원하시는 방향을 말씀드리기는 어렵지만
.btn_cke_sc 로 적용된 class 부분의 태그를 봐야 하겠지만
해당 태그를 if($is_admin)으로 감싸주시고 그에 따른 스크립트로 막아서 처리해 주셔야 하며
팝업은 window.open 스크립트를 참고하셔서 적용하시면 되십니다.
window.open('팝업주소', '팝업창 이름', '팝업창 설정');
답변을 작성하시기 전에 로그인 해주세요.