다중셀렉트 질문입니다. > 그누4 질문답변

그누4 질문답변

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

다중셀렉트 질문입니다. 정보

다중셀렉트 질문입니다.

본문

그누보드 쉽다고 해서 처음으로 사용해 보는데 역시 무식한 사람은 뭘해도 어렵군요ㅠㅠ

옵션님의 인명관리 스킨을 사용하는데 추가필드를 이용한 다중셀렉트가 잘 안됩니다.
list.skin.php소스를 올리겠습니다.
고수님들 보시고 수고 스럽더라도 꼭 좀 잘 되게 부탁 드립니다.
참고로 저는 uft-8로 변환해서 사용하고 있습니다.


위 이미지에서 원래 옵션님의 스킨은 원래 있는 분류와 wr_7,wr_8,wr_9 총 4개의 셀렉트가 있는데
저는 wr_6을 추가해서 사용중입니다.

소스를 한번 보시고 수정 좀 부탁드립니다.
제가 워낙 초보라서 말귀가 어둡더라도 너그러이 이해해 주시기 바랍니다.
=============아래 list.skin.php============
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가

$colspan = 5;

//if ($is_category) $colspan++;
if ($is_checkbox) $colspan++;
if ($is_good) $colspan++;
if ($is_nogood) $colspan++;

include_once "$board_skin_path/skin.exe.php";

function get_bo_n_option($bo_n='')
{
    global $g4, $board;

    $arr = explode("|", $board[$bo_n]); // 구분자가 | 로 되어 있음
    $str = "";
    for ($i=0; $i<count($arr); $i++)
        if (trim($arr[$i]))
            $str .= "<option value='$arr[$i]'>$arr[$i]</option>\n";

    return $str;
}

// 카테고리 분할
if ($is_category = true) {
  $bo_6_option = get_bo_n_option('bo_6'); // SELECT OPTION 태그로 넘겨받음
 $bo_7_option = get_bo_n_option('bo_7'); // SELECT OPTION 태그로 넘겨받음
 $bo_8_option = get_bo_n_option('bo_8'); // SELECT OPTION 태그로 넘겨받음
 $bo_9_option = get_bo_n_option('bo_9'); // SELECT OPTION 태그로 넘겨받음
}

// 이미지 보이기 전체 보이기는 0
$all_view = 0;
// 미리보기 이미지크기
$img_w = 80;
$img_h = 60;
// 넓이로 맞췄을때 높이의 중간지점에서 80%로 복구시킨다.
$Percent = 80;

?>
<style type="text/css">
<!--
.list_sort_title {font-family:돋움;font-size:12px;color:#567a9c;text-decoration:none;}
.list_sort_arrow {font-family:돋움;font-size:10px;color:#c3cfdf;}

-->
a.1:link, a.1:visited, a.1:active { font-size:12px; text-decoration:none; color:#454545; }
a.1:hover { font-size:12px; text-decoration:none; }

a.2:link, a.2:visited, a.2:active { font-size:12px; text-decoration:none; color:#f96400; }
a.2:hover { font-size:12px; text-decoration:none; }

a.3:link, a.3:visited, a.3:active { font-size:12px; text-decoration:none; color:#429e05; }
a.3:hover { font-size:12px; text-decoration:none; }
</style>

<!-- 게시판 목록 시작 -->
<table width="<?=$width?>" align=center cellpadding=0 cellspacing=0><tr><td><!-- 분류 셀렉트 박스, 게시물 몇건, 관리자화면 링크 -->
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td>
<!-- 제목 -->
<table width="100%" border="0" cellpadding="0" cellspacing="2" bgcolor="#a2c0e7">
      <tr>
    <form name="fcategory" method="get">
 <td style='padding:0px 5px 0px 10px;'>

     <? if ($is_category) { ?>
        <select name=sca onChange="location='<?=$category_location?>'+encodeURI(this.value);">
        <option value=''>과정</option>
        <?=$category_option?>
        </select>
        <? } ?>
  
      <select name=wr_7 onChange="location='<?=$category_location?>&sca='+this.form.sca.value+'&wr_7='+this.value+'&wr_7='+this.form.wr_7.value+'&wr_8='+this.form.wr_8.value;">
      <option value=''><?=$board[bo_7_subj]?></option><?=$bo_7_option?></select>
     
      <select name=wr_8 onChange="location='<?=$category_location?>&sca='+this.form.sca.value+'&wr_8='+this.value+'&wr_8='+this.form.wr_8.value+'&wr_8='+this.form.wr_8.value;">
      <option value=''><?=$board[bo_8_subj]?></option><?=$bo_8_option?></select>
  
      <select name=wr_9 onChange="location='<?=$category_location?>&sca='+this.form.sca.value+'&wr_9='+this.value+'&wr_9='+this.form.wr_9.value+'&wr_9='+this.form.wr_9.value;">
      <option value=''><?=$board[bo_9_subj]?></option><?=$bo_9_option?></select>
  
      <select name=wr_6 onChange="location='<?=$category_location?>&sca='+this.form.sca.value+'&wr_6='+this.value+'&wr_6='+this.form.wr_6.value+'&wr_6='+this.form.wr_6.value;">
      <option value=''><?=$board[bo_6_subj]?></option><?=$bo_6_option?></select>   </td></form>
   <form name=fsearch method=get style="margin:0px;">
 <td style='padding:0px 5px 0px 10px;'>
      <div align="right">
        <input type=hidden name=bo_table value="<?=$bo_table?>">
        <input type=hidden name=sca value="<?=$sca?>">
        <input type=hidden name=wr_3 value="<?=$wr_3?>">
        <input type=hidden name=wr_4 value="<?=$wr_4?>">
         <select name=sfl>
           <option value='wr_subject'>이름</option>
           <option value='wr_21'>모이름</option>
           <option value='wr_26'>부이름</option>
          </select>
         <input name=stx maxlength=15 size=20 itemname="검색어" required value='<?=$stx?>'>
         <input type=hidden name=sop value=and>
         <input type=image src="<?=$board_skin_path?>/img/search_btn.gif" border=0 align=absmiddle>
        </div></td></form>
      </tr>
    </table>
<div style="height:1px; line-height:1px; font-size:1px; background-color:#ddd; clear:both;"> </div>
<table background="<?=$board_skin_path?>/img/bar_bg.gif" width=100% border="0" cellpadding=0 cellspacing="0">
  <tr align=center>
    <td width=2><img src="<?=$board_skin_path?>/img/bar_left.gif" width="2" height="23"></td>
    <td width=40><?=subject_sort_link('wr_num', $qstr2, 1)?><span class="list">번호▼</span></a></td>
 
    <td width=3><img src="<?=$board_skin_path?>/img/bar_line.gif" width="3" height="23"></td>
    <td width=30><INPUT onClick="if (this.checked) all_checked(true); else all_checked(false);" type=checkbox></td>
    <td width=3><img src="<?=$board_skin_path?>/img/bar_line.gif" width="3" height="23"></td>
 
    <td>이름</td>
    <td width=3><img src="<?=$board_skin_path?>/img/bar_line.gif" width="3" height="23"></td>
 
 <td width="60">과정</td>
    <td width=3><img src="<?=$board_skin_path?>/img/bar_line.gif" width="3" height="23"></td>
 
 <td width="60">학년</td>
    <td width=3><img src="<?=$board_skin_path?>/img/bar_line.gif" width="3" height="23"></td>
 
 <td width="60">반</td>
    <td width=3><img src="<?=$board_skin_path?>/img/bar_line.gif" width="3" height="23"></td>
   
    <td width="35">성별</td>
    <td width=3><img src="<?=$board_skin_path?>/img/bar_line.gif" width="3" height="23"></td>
 
 <td width="100">전화번호</td>
    <td width=3><img src="<?=$board_skin_path?>/img/bar_line.gif" width="3" height="23"></td>
 
 <td width="100">보호자전화</td>
    <td width=3><img src="<?=$board_skin_path?>/img/bar_line.gif" width="3" height="23"></td>
   
    <td width="40">상태</td>
    <td width=3><img src="<?=$board_skin_path?>/img/bar_line.gif" width="3" height="23"></td>
 
    <td width=30>수정</a></td>
    <td width=2><img src="<?=$board_skin_path?>/img/bar_right.gif" width="2" height="23"></td>
  </tr>
</table>
<script language="javascript">

function fwrite_check(f)
{
    var s = "";
    if (typeof(f.wr_subject) != 'undefined') {
          if (f.wr_subject.value == '') {
             f.wr_subject.focus();
       return;
         }
     }
    f.action = "./write_update.php";
    f.submit();
}

var v = document.fwrite;

function sendit() {
    v.w.value = "";
    v.wr_id.value = "";
    
    if(!v.wr_content.value) v.wr_content.value = "_";
    fwrite_check(v)
}
 
function FocusColor(This) { This.style.backgroundColor = "#FFF4DA"; }
function BlurColor(This) { This.style.backgroundColor = "#FFFFFF";}


//=====한영 체크 로직 끝=============

function text_check(text,total){
 //  text : 문자 필드명 , total : 총 문자길이
 var obj = eval("document.forms[0]."+text)
 var len = obj.value.length;
 var count = 0;
 var one_ch="";
 var total2 = 0;
 for (i = 0; i < len ; i++){
    one_ch = obj.value.charAt(i);    //한문자만 추출
     if (escape(one_ch).length > 4) {
         count = count + 2;   //한글
     }else {
         count = count + 1;   //영문
     }
 }
 total2 = Math.floor(total/2);
 if (count > total) {
     alert("입력하신 내용은 한글 "+total2+", 영문 "+total+"자까지 쓰실 수 있습니다.\n\n문자 수를 확인하여 주시기 바랍니다.");
  obj.value = obj.value.substring(0,total2);
  obj.focus();
  return false;
 }
}
</script>
<form name="fboardlist" method="post" style="margin:0px;">
<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=''>
<table width=100% height="23" border="0" cellpadding=0 cellspacing="0">
<!-- 목록 -->
<? for ($i=0; $i<count($list); $i++) {?>

<tr bgcolor="#DCF7FF"
 onmouseover=this.style.backgroundColor='#F7FEFF' onmouseout=this.style.backgroundColor=''>
 <td width=2><img src="<?=$board_skin_path?>/img/list_left.gif" width="2" height="23"></td>
 <td width=40><div align="center"><?
        if ($list[$i][is_notice]) // 공지사항
            echo "<img src=\"$board_skin_path/img/icon_notice.gif\">";
        else if ($wr_id == $list[$i][wr_id]) // 현재위치
            echo "<span style='font:bold 11px tahoma; color:#E15916;'>{$list[$i][num]}</span>";
        else
            echo "<span style='font:normal 11px tahoma; color:#BABABA;'>{$list[$i][num]}</span>";
        ?>
   </div></td>
   <td width=3><img src="<?=$board_skin_path?>/img/list_line.gif" width="3" height="23"></td>
    <td width="30" align="center"><input type=checkbox name=chk_wr_id[] value="<?=$list[$i][wr_id]?>"></td>
 <td width=3><img src="<?=$board_skin_path?>/img/list_line.gif" width="3" height="23"></td>
    <td align=center><b>
 <a href="<?=$list[$i][href]?>"  class="1">
 <?
        echo $nobr_begin;
        echo $list[$i][reply];
        echo $style = "";
        if ($list[$i][is_notice]) $style = " style='font-weight:bold;'";
//        echo $list[$i][subject];
echo  "<span style='font-family:{$list[$i][wr_1]};color:{$list[$i][wr_2]};font-size:{$list[$i][wr_3]};'>{$list[$i][subject]}</span>";  //ssh 태그효과

if ($list[$i][wr_nogood]==-1) echo "<font color='#FF0000'>비승인</font>"; //ssh

        // 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;
        ?></a></b></td>
  
 <td width=3><img src="<?=$board_skin_path?>/img/list_line.gif" width="3" height="23"></td>
 <td width="60" align="center"  bgcolor="<? if ($list[$i]['ca_name'] == '') {
        echo "ffe398";
            }
        else if ($list[$i]['ca_name'] == '') {
        echo "ffeebf";
            }
  else if ($list[$i]['ca_name'] == '') {
        echo "fff7e1";
            }
        else if ($list[$i]['ca_name'] == '') {
        echo "fffdf9";
      }
  else if ($list[$i]['ca_name'] == '') {
        echo "ffffff";
            }
?>" style='word-break:break-all;'><?=$list[$i][ca_name]?></td>
 
 <td width=3><img src="<?=$board_skin_path?>/img/list_line.gif" width="3" height="23"></td>
 <td width="60" align=center><?=$list[$i][wr_7]?></td>
 
  <td width=3><img src="<?=$board_skin_path?>/img/list_line.gif" width="3" height="23"></td>
  <td align=center style='word-break:break-all;' width="60" ><?=$list[$i][wr_8]?>    </a></td>
     
    <td width=3><img src="<?=$board_skin_path?>/img/list_line.gif" width="3" height="23"></td>
 <td width="35" align=left style='word-break:break-all;'>
      <div align="center">
      <font color="<? if ($list[$i]['wr_9'] == '남') {
        echo "0000ff";
            }
        else if ($list[$i]['wr_9'] == '여') {
        echo "ff00cc";
            }
?>"><?=$list[$i][wr_9]?></div></td>
 
  <td width=3><img src="<?=$board_skin_path?>/img/list_line.gif" width="3" height="23"></td>
 <td width="100" align=left style='word-break:break-all;'>
      <div align="center"><a href="<?=$g4[path]?>/sms/sms.php"  target="_blank"><?=$list[$i][wr_4]?>-<?=$list[$i][wr_5]?></a> </div></td>
 
  <td width=3><img src="<?=$board_skin_path?>/img/list_line.gif" width="3" height="23"></td>
  <td width="100" align=left style='word-break:break-all;'>
     <div align="center"><a href="<?=$g4[path]?>/sms/sms.php"  target="_blank"><?=$list[$i][wr_23]?>-<?=$list[$i][wr_24]?></a> </div></td>
     
    <td width=3><img src="<?=$board_skin_path?>/img/list_line.gif" width="3" height="23"></td>
 <td align=left style='word-break:break-all;' width="40" >
    <div align="center">
    <font color="<? if ($list[$i]['wr_6'] == '수강중') {
        echo "0000ff";
            }
        else if ($list[$i]['wr_6'] == '퇴교') {
        echo "ff00cc";
            }
  else  {
        echo "999999";
            }
?>"><?=$list[$i][wr_6]?></font></div></td>

    <td width=3><img src="<?=$board_skin_path?>/img/list_line.gif" width="3" height="23"></td>
 <td width="30" align=left style='word-break:break-all;'><div align="center"><a href="<?=$g4[bbs_path]?>/write.php?w=u&bo_table=<?=$bo_table?>&wr_id=<?=$list[$i][wr_id]?>&page=<?=$page?>"  class="1"><img src="<?=$board_skin_path?>/img/icon_delete.gif" border=0></a>
    </div></td>
 <td width=2><img src="<?=$board_skin_path?>/img/list_right.gif" width="2" height="23"></td>
</tr>
<tr><td colspan="22" bgcolor="#EDEDED" height="1"></td></tr>
<? }?>

<? if (count($list) == 0) { echo "<tr><td colspan='$colspan' height=100 align=center>게시물이 없습니다.</td></tr>"; } ?>
</table>
</form>

<!-- 페이지 -->
<div id="pagingNew"> <?=$write_pages?></div>

<div style="clear:both; margin-top:7px; height:31px;">
    <div style="float:left;">
    <? if ($list_href) { ?>
    <a href="<?=$list_href?>"><img src="<?=$board_skin_path?>/img/btn_list.gif" border="0" align=absmiddle></a>
    <? } ?>
    <? if ($write_href) { ?>
    <a href="<?=$write_href?>"><img src="<?=$board_skin_path?>/img/btn_write.gif" border="0"></a>
    <? } ?>
    <a href="javascript:select_delete();"><img src="<?=$board_skin_path?>/img/btn_select_delete.gif" border="0" align=absmiddle></a>

    </div>
    <div style="float:right;">    </div>
</div></td>
</tr></table>
</td>
</tr></table>

<script language="JavaScript">
if ('<?=$sca?>') document.fcategory.sca.value = '<?=$sca?>';
if ('<?=$wr_7?>') document.fcategory.wr_7.value = '<?=$wr_7?>';
if ('<?=$wr_8?>') document.fcategory.wr_8.value = '<?=$wr_8?>';
if ('<?=$wr_10?>') document.fcategory.wr_10.value = '<?=$wr_10?>';
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=500, height=550, scrollbars=1");

    f.sw.value = sw;
    f.target = "move";
    f.action = "./move.php";
    f.submit();
}
</script>
<? } ?>
<!-- 게시판 목록 끝 -->

  • 복사

댓글 전체

http://wisc.cafe24.com/wisc/bbs/board.php?bo_table=teacher_03&sca=
이러 오시면 상태를 확인할 수 있습니다.
꼭 좀 도움을 부탁드립니다.
원소스인 옵션님의 인명관리 스킨은 이리로
http://www.sir.co.kr/bbs/board.php?bo_table=g4_skin&wr_id=88026&sca=&sfl=wr_subject&stx=%C0%CE%B8%ED&sop=and
비회원 에게도 체크박스 사용 권한을 주어야 합니다.


list.skin.php 15번 라인 정도에 다음을 추가합니다.
$is_checkbox = true;




list.skin.php 96번 라인의 <th>번호</th> 라고 되어있는 부분 밑에 다음을 추가합니다.
<? if ($is_checkbox) { ?>





그런데, 체크박스 기능은 관리자 에게 필요한 기능일 텐데요...
비회원 에게 제공할 체크박스 관련 기능을 별도로 만들려고 그러시는지?
위 게시판은 학원에서 학생들 관리에 사용할 겁니다.
때문에 지금은 열어놓은 상태지만 정식오픈때는 강사, 직원만 사용할 수 있도록 레벨을 조정할 생각입니다.
그리고 체크박스는 특정 학년 반을 검색한 후 단체 메일이나 sms문자를 보낼 수 있도록 할 계획입니다.
이게 사실은 자신이 없어서 걱정이지만...
댓글 감사드립니다. 즐거운 주말되세요.
셀렉트를 선택하시고 주소창을 잘보세요
http://wisc.cafe24.com/wisc/bbs/board.php?bo_table=teacher_03&sca=&sca=&wr_9=여&wr_9=여&wr_9=여
이런식으로 나옵니다.
검색하였을때 &sca=&sca=&wr_9=여&wr_9=여&wr_9=여기가 틀렸네요

<select name=wr_7 onChange="location='<?=$category_location?>&sca='+this.form.sca.value+'&wr_7='+this.value+'&wr_7='+this.form.wr_7.value+'&wr_8='+this.form.wr_8.value;">
      <option value=''><?=$board[bo_7_subj]?></option><?=$bo_7_option?></select>
     
      <select name=wr_8 onChange="location='<?=$category_location?>&sca='+this.form.sca.value+'&wr_8='+this.value+'&wr_8='+this.form.wr_8.value+'&wr_8='+this.form.wr_8.value;">
      <option value=''><?=$board[bo_8_subj]?></option><?=$bo_8_option?></select>
 
      <select name=wr_9 onChange="location='<?=$category_location?>&sca='+this.form.sca.value+'&wr_9='+this.value+'&wr_9='+this.form.wr_9.value+'&wr_9='+this.form.wr_9.value;">
      <option value=''><?=$board[bo_9_subj]?></option><?=$bo_9_option?></select>
에서 wr_7을 예로들면

<select name=wr_7 onChange="location='<?=$category_location?>&sca='+this.form.sca.value+'&wr_7='+this.value+'&wr_8='+this.form.wr_8.value+'&wr_9='+this.form.wr_9.value;">
      <option value=''><?=$board[bo_7_subj]?></option><?=$bo_7_option?></select>
이렇게 되야합니다.

뭔소리냐면sca는 이폼에값이고 
wr_7=지금 선택한값이고
wr_8=이폼에값이고 ...

wr_6을 추가한경우 &wr_6='+this.form.wr_6.value+' 이거하나 추가하시고
skin.lib.php인가 에서 wr_6부분을 추가해주시면 됩니다.
© SIRSOFT
현재 페이지 제일 처음으로