특정필드에 값이 있을때만 dhtml 쓰기 보이기 > 그누4 질문답변

그누4 질문답변

그누보드4 관련 질문은 QA 로 이전됩니다. QA 그누보드4 바로가기
기존 게시물은 열람만 가능합니다.

특정필드에 값이 있을때만 dhtml 쓰기 보이기 정보

특정필드에 값이 있을때만 dhtml 쓰기 보이기

본문

특정필드 wr_20 에 값이 있을때만 dhtml 쓰기가 보이고,
아니면 그냥 텍스트만 입력할 수 있는 폼이 보이게 할려고 합니다.
소스가 지저분하지만 올려 봅니다.
관심 부탁드립니다.
꾸벅.

<tr>
    <td class=write_head style='padding-left:10px;'>한의원 소개</td>
    <td style='padding:5 0 5 0;'><input type='hidden' name='html' value='html1'>
<?
$message[0] = "정성껏 진료하겠습니다.";


$num = rand(0, 0); // 숫자를 0부터 2까지 뽑는다

?><? if($w == "") {?>
<? if ($is_dhtml_editor) { ?>
            <?=cheditor2('wr_content', $message[$num]);?>
        <? }


else { ?>
        <table width=100% cellpadding=0 cellspacing=0>
        <tr>
            <td width=50% align=left valign=bottom>
                <span style="cursor: pointer;" onclick="textarea_decrease('wr_content', 10);"><img src="<?=$board_skin_path?>/img/up.gif"></span>
                <span style="cursor: pointer;" onclick="textarea_original('wr_content', 10);"><img src="<?=$board_skin_path?>/img/start.gif"></span>
                <span style="cursor: pointer;" onclick="textarea_increase('wr_content', 10);"><img src="<?=$board_skin_path?>/img/down.gif"></span></td>
            <td width=50% align=right><? if ($write_min || $write_max) { ?><span id=char_count></span>글자<?}?></td>
        </tr>
        </table>
        <textarea id="wr_content" name="wr_content" class=tx style='width:100%; word-break:break-all;' rows=10 itemname="한의원 소개" required
        <? if ($write_min || $write_max) { ?>onkeyup="check_byte('wr_content', 'char_count');"<?}?>>
<?=$message[$num]?>
</textarea>
        <? if ($write_min || $write_max) { ?><script language="javascript"> check_byte('wr_content', 'char_count'); </script><?}?>
        <? } ?><?}?>

<? if($w == "u") {?>
<? if ($is_dhtml_editor) { ?>
            <?=cheditor2('wr_content', $content);?>
        <? }


else { ?>
        <table width=100% cellpadding=0 cellspacing=0>
        <tr>
            <td width=50% align=left valign=bottom>
                <span style="cursor: pointer;" onclick="textarea_decrease('wr_content', 10);"><img src="<?=$board_skin_path?>/img/up.gif"></span>
                <span style="cursor: pointer;" onclick="textarea_original('wr_content', 10);"><img src="<?=$board_skin_path?>/img/start.gif"></span>
                <span style="cursor: pointer;" onclick="textarea_increase('wr_content', 10);"><img src="<?=$board_skin_path?>/img/down.gif"></span></td>
            <td width=50% align=right><? if ($write_min || $write_max) { ?><span id=char_count></span>글자<?}?></td>
        </tr>
        </table>
        <textarea id="wr_content" name="wr_content" class=tx style='width:100%; word-break:break-all;' rows=10 itemname="한의원 소개" required
        <? if ($write_min || $write_max) { ?>onkeyup="check_byte('wr_content', 'char_count');"<?}?>>
<?=$content?>
</textarea>
        <? if ($write_min || $write_max) { ?><script language="javascript"> check_byte('wr_content', 'char_count'); </script><?}?>
        <? } ?><?}?>
</td>
</tr>

댓글 전체

$is_dhtml_editor 만 아시면 되리라봅니다만..
if ($board[bo_use_dhtml_editor] && $member[mb_level] >= $board[bo_html_level])
    $is_dhtml_editor = true;
else
    $is_dhtml_editor = false;

따라서 게시판설정에 wr_20 있다면 혹은 $write[wr_20]

if ($board[wr_20] && $member[mb_level] >= $board[bo_html_level])
    $is_dhtml_editor2 = true;
else
    $is_dhtml_editor2 = false;


if ($is_dhtml_editor) { 에서 if ($is_dhtml_editor || $is_dhtml_editor2) { 으로 할수 있겠죠.

if ($is_dhtml_editor && $is_dhtml_editor2)  방법은 많겠네요.
태웅님 답변 감사합니다.
알려주신 소스는 write.php 제일 상단에 적용하라는 말씀인가요?
아니면 적용부분에 바로 해야 하는건가요?
이래저래 해봐도 안되어서요..ㅜㅜ
글쓰기에서 이걸 구현해야 한다면,,,,
wr_20 필드가 아직 디비에 입력되지 않은 상태가 아닌가요?

그렇다면 자바로 체크 해야 할것 같은데요
어째든 정확한 목정이나 상황이 파악이 않되네요,,,
우선 "특정필드 wr_20 에 값이 있을때만 dhtml 쓰기가 보이고" 이부분에대해서 wr_20 값이 게시판테이블에 있는 필드인지
게시판환경에 있는 필드인지 알아야합니다.

우선 게시판 부분에 있다면 글을 쓸때 wr_20 필드에 값을 넣거나 뺄수 있기때문에 

"특정필드 wr_20 에 값이 있을때만 dhtml 쓰기가 보이고,
아니면 그냥 텍스트만 입력할 수 있는 폼이 보이게 할려고 합니다." 는 수정시에만 가능한 부분입니다.

다만 wr_20 이 게시판 추가/수정시에 그값을 등록하거나 수정할수 있다면 
글등록과 수정 둘다 적용할수 있습니다.



추측컨데 첨부된 스크립트는 write.skin.php 스킨의 일부분일것입니다.
하여 basic 스킨을 기준으로 최상위에

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


if ($board[wr_20])
    $is_dhtml_use = true;
else
    $is_dhtml_use = false;



if ($is_dhtml_use || $is_dhtml_editor) {
    include_once("$g4[path]/lib/cheditor4.lib.php");
    echo "<script src='$g4[cheditor4_path]/cheditor.js'></script>";
    echo cheditor1('wr_content', '100%', '250');
}

?>







<tr>
    <td class=write_head style='padding-left:10px;'>한의원 소개</td>
    <td style='padding:5 0 5 0;'><input type='hidden' name='html' value='html1'>
<?
$message[0] = "정성껏 진료하겠습니다.";


$num = rand(0, 0); // 숫자를 0부터 2까지 뽑는다

?><? if($w == "") {?>
<? if ($is_dhtml_use || $is_dhtml_editor) { ?>
            <?=cheditor2('wr_content', $message[$num]);?>
        <? }


else { ?>
        <table width=100% cellpadding=0 cellspacing=0>
        <tr>
            <td width=50% align=left valign=bottom>
                <span style="cursor: pointer;" onclick="textarea_decrease('wr_content', 10);"><img src="<?=$board_skin_path?>/img/up.gif"></span>
                <span style="cursor: pointer;" onclick="textarea_original('wr_content', 10);"><img src="<?=$board_skin_path?>/img/start.gif"></span>
                <span style="cursor: pointer;" onclick="textarea_increase('wr_content', 10);"><img src="<?=$board_skin_path?>/img/down.gif"></span></td>
            <td width=50% align=right><? if ($write_min || $write_max) { ?><span id=char_count></span>글자<?}?></td>
        </tr>
        </table>
        <textarea id="wr_content" name="wr_content" class=tx style='width:100%; word-break:break-all;' rows=10 itemname="한의원 소개" required
        <? if ($write_min || $write_max) { ?>onkeyup="check_byte('wr_content', 'char_count');"<?}?>>
<?=$message[$num]?>
</textarea>
        <? if ($write_min || $write_max) { ?><script language="javascript"> check_byte('wr_content', 'char_count'); </script><?}?>
        <? } ?><?}?>

<? if($w == "u") {?>

<? if ($is_dhtml_use || $is_dhtml_editor) { ?>
            <?=cheditor2('wr_content', $content);?>

<? } else { ?>
        <table width=100% cellpadding=0 cellspacing=0>
        <tr>
            <td width=50% align=left valign=bottom>
                <span style="cursor: pointer;" onclick="textarea_decrease('wr_content', 10);"><img src="<?=$board_skin_path?>/img/up.gif"></span>
                <span style="cursor: pointer;" onclick="textarea_original('wr_content', 10);"><img src="<?=$board_skin_path?>/img/start.gif"></span>
                <span style="cursor: pointer;" onclick="textarea_increase('wr_content', 10);"><img src="<?=$board_skin_path?>/img/down.gif"></span></td>
            <td width=50% align=right><? if ($write_min || $write_max) { ?><span id=char_count></span>글자<?}?></td>
        </tr>
        </table>
        <textarea id="wr_content" name="wr_content" class=tx style='width:100%; word-break:break-all;' rows=10 itemname="한의원 소개" required
        <? if ($write_min || $write_max) { ?>onkeyup="check_byte('wr_content', 'char_count');"<?}?>>
<?=$content?>
</textarea>
        <? if ($write_min || $write_max) { ?><script language="javascript"> check_byte('wr_content', 'char_count'); </script><?}?>
        <? } ?>

<?}?>

</td>
</tr>
두 분 답변 감사드립니다.
설명하자면요
wr_20 은 여분필드입니다. 추가해둔 상태이고요.
관리자만이 볼수있고, 쓸수있는 필드입니다.
일반회원은 볼수도, 쓸수도 없는 필드입니다.
즉, 관리자와 계약이 된 회원의 글에만 wr_20필드에 체크를 해줍니다.
그러면 글쓰기 할 때 에디터가 보이는것이죠.
위에 소스대로 해봐도 에디터가 바로 보입니다.
wr_20에 체크가 안되어 있는데도요.
뜻밖에 도와주신 분이 계셔서 해결했습니다.
관심가져주신 두분께 깊이 감사드립니다.
아길이님은 늘 제 질문에 관심가져 주셔서 정말 고맙습니다.
태웅님께도 깊이 감사드립니다.
늦은 시간에 이렇게 여러번 답변을 해주시고, 좋은 밤 되세요.^^
전체 66,554 |RSS
그누4 질문답변 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1402호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT