그누보드 질문은 아니지만 도와 주세요 .. > 그누4 질문답변

그누4 질문답변

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

그누보드 질문은 아니지만 도와 주세요 .. 정보

그누보드 질문은 아니지만 도와 주세요 ..

본문

제목이 없으면 글을 동록 목하게 하려고하는데요 않되네요
스크립트가 적요이 않되서요 좀 확인좀 부탁드립니다.


감사합니다.






<?


 // 개인 블로그 헤더 스킨 불러오기


include 'blog_sub_head.php';


if($_GET[mode] == '' || $_GET[mode] == 'post_insert'){
$mode = 'post_insert';
$_title = '글쓰기';
$upsize=9;//업로드 가능 갯수
}else{
$mode = 'post_update';
$sql = "SELECT * FROM wiz_blog_post WHERE idx='$idx'";
$result = mysql_query($sql) or error2(mysql_error());
$post_info = mysql_fetch_array($result);


$_title = '글수정';
 
$sql = "SELECT * FROM wiz_blog_menu WHERE blogurl='$blog' ORDER BY idx ASC";
$result = mysql_query($sql) or error2(mysql_error());
$_subinfo='';
while($_menu = mysql_fetch_array($result))
{
$selects = ($_menu[idx] == $post_info[blogcat])?"selected":"";
$_subinfo[subcate].="<option value='$_menu[idx]' $selects >$_menu[name]</option>\n";
}
$_subinfo[subcate]="<select name='post_category' class='input_select_kor'>".$_subinfo[subcate]."</select>";


 
$_rfile = explode("|",$post_info[up_filername]);//원본파일명
$_sfile = explode("|",$post_info[up_filesname]);//서버에 올라간 파일명
array_pop($_rfile);
array_pop($_sfile);
$upsize = 9-sizeof($_sfile);
$attfile='';
foreach($_rfile as $key => $value){
$attfile.="파일명 : $value <a href=\"javascript:filedelete('$key')\">[삭제]</a><a href='blog_filedown.php?blog=$blog&idx=$post_info[idx]&num=$key'>[다운로드]</a><br>";
}
}




?>
<style>
#imageUpload input {display: block;}
.sub_write_title { font-size: 12px; color: #444444; background: #ffffff; font-weight:bold; padding-left:10px; line-height:28px; width:20%;}
</style>
<script>
var filecnt = 0;//초기값
var nfilecnt = <?=$upsize?>;//10개까지 업로드 가능(미리 하나 넣어있어서)
function fileFields() {
    var x = document.getElementById('imageUpload');
    x.onclick = function() {
    if(filecnt==nfilecnt){
return;
}else{
        var i = parseFloat(this.lastChild.id)+1;
        input = document.createElement("input");
        input.setAttribute("type", "file");
        input.setAttribute("name", "post_file[]");
        input.setAttribute("id", i);
        input.setAttribute("size", "50");
        input.className="input_text";
        this.appendChild(input);
        filecnt++;
    }
    }


}


// Multiple onload function created by: Simon Willison
// http://simonwillison.net/2004/May/26/addLoadEvent/
function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}


<?if($upsize>0){?>
addLoadEvent(function() {
  fileFields();
});
<?}?>
function selecter(inputname,vars){
  var nn = eval("document.postFrm." + inputname);
  var num = nn.options.length
  for(ii=0; ii<num; ii++){
      if(nn.options[ii].value == vars)
        nn.options[ii].selected = true;
  }
 }
function filedelete(nums){
var url = "blog_save.php?blog=<?=$blog?>&mode=postfiledelete&pidx=<?=$post_info[idx]?>&nums=" + nums;
if(confirm("파일을 삭제하시겠습니까?")){
blog_save.document.location.href=url;
}
}


function inputCheckPost(frm) {
if(trim(frm.post_title.value) == "") {
alert("제목을 입력하세요.");
frm.post_title.focus();
return false;
}
if(trim(frm.content.value) == ""){
alert("내용을 입력하세요.");
try{ frm.content.focus(); }
catch(e){ }
return false;
}
}
</script>
<td valign="top" height="100%"><table width="100%" height="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="e2e2e2">
  <tr>
    <td bgcolor="#FFFFFF" style="padding:10px;"><div  style='width:100%; height:100%;'>
    <form name=postFrm action='blog_save.php' target='blog_save' method='POST' enctype="multipart/form-data" onSubmit="return inputCheckPost(this)">
    <table width="100%" border="0" cellpadding="0" cellspacing="0">
      <!--<tr><td colspan="2" class="board_view_title"><b>글쓰기</b></td></tr>
      <tr>
          <td height="1" bgcolor="#C8C8C8" colspan="2" ></td>
        </tr>
        <tr>
          <td height="2" bgcolor="#EBEBEB" colspan="2" ></td>
        </tr>
        <tr>
          <td height="15"colspan="2" ></td>
        </tr>-->






        <input type="hidden" name='blog' value='<?=$blog?>' />
        <input type="hidden" name='mode' value='<?=$mode?>' />
        <input type="hidden" name='pidx' value='<?=$idx?>' />
        <input type="hidden" name='nickname' value='<?=$blog_info[nickname]?>' />
        <tr>
          <td class="sub_write_title">카테고리</td>
          <td class="t_value"><?=$_subinfo[subcate]?></td>
        </tr>


        <tr>
          <td class="sub_write_title">제목</td>
          <td class="t_value"><input type="text" name='post_title' size="60" class="input_text" value="<?=stripslashes($post_info[subject])?>" /></td>
        </tr>


        <tr>
          <td class="sub_write_title">설정</td>
          <td class="t_value"><input type="radio" name='post_type' value='POST' id='ptype_post' <?=($post_info[post_type]=='POST'||$post_info[post_type]=='')?'checked':'';?> />
              <label for='ptype_post' style='cursor:hand;'>게시글</label>
              <input type="radio" name='post_type' value='NOTICE' id='ptype_notice' <?=($post_info[post_type]=='NOTICE')?'checked':'';?> />
            <label for='ptype_notice' style='cursor:hand;'>공지사항</label>          </td>
        </tr>


        <tr>
          <td colspan="2" style="padding:8px 0px;"><?
$content = xss_check(stripslashes($post_info[content]));
$edit_content = $content;
include WIZHOME_PATH."/webedit/WIZEditor.html";
?></td>
        </tr>


        <tr>
          <td class="sub_write_title">첨부파일</td>
          <td class="t_value"><?=$attfile?>
              <?
if($upsize>0){
?>
              <a href="#" id="imageUpload">
                <input type="file" name='post_file[]' size="50" class="input_text" id="1" />
                </a>
              <?}?>          </td>
        </tr>


        <tr>
          <td class="sub_write_title">태그</td>
          <td class="t_value"><input name='post_tags' type="text" class="input_text" value="<?=$post_info[tags]?>" size="50" maxlength="20" />
            , 콤마로 구분해주세요.</td>
        </tr>


        <tr>
          <td class="sub_write_title">공개여부</td>
          <td class="t_value"><select name='post_open'>
              <option value='ALL'>전체공개</option>
              <option value='MEM'>회원에게만 공개</option>
              <option value='FND'>이웃에게만 공개</option>
              <option value='NON'>비공개</option>
            </select>          </td>
        </tr>


        <tr>
          <td class="sub_write_title">스크랩여부</td>
          <td class="t_value"><select name='post_scr'>
              <option value='Y'>허용함</option>
              <option value='N'>허용안함</option>
            </select>          </td>
        </tr>


        <tr>
          <td class="sub_write_title">코멘트사용여부</td>
          <td class="t_value"><select name='post_cmt'>
              <option value='Y'>허용함</option>
              <option value='N'>허용안함</option>
            </select>          </td>
        </tr>


        <tr>
          <td class="sub_write_title">트랙백 보내기</td>
          <td class="t_value"><input type="text" name='post_trackurl' size="50" class="input_text" />
              <br />
              <font style='font-size:8pt;'>*트랙백을 받을 주소를 넣어주세요.예)http://abcd.textcube.com/track/2</font> </td>
        </tr>
        <tr>
          <td height="25" colspan="2"> </td>
        <tr>
          <td height="1" colspan="2" bgcolor="e2e2e2" ></td>
        <tr><td colspan="2" align="center" style="padding-top:25px;"><input type="image" src="<?=$blog_print[cimg]?>bt_reg.gif" />
        <a href='#' onClick="javascript:history.go(-1);"><img src="<?=$blog_print[cimg]?>bt_cancel.gif" border="0" ></a></td>
        <tr>
      </table>
    </form></div></td></tr></table></td>
  <script language="javascript">
 <!--
 selecter("post_open","<?=$post_info[open_type]?>");
 selecter("post_scr","<?=$post_info[scr_type]?>");
 selecter("post_cmt","<?=$post_info[cmt_use]?>");
 -->
</script>
<?
 
include 'blog_sub_foot.php';
?>

댓글 전체

trim 대신 document.getElementById("post_title").value.replace(/ /g, "") == "" 과 같이 해 주셔야 할 듯 합니다^^

참고로 post_title 에 id 값이 name 과 동일하게 들어가는 것을 기준으로 작성했습니다~~
전체 66,554 |RSS
그누4 질문답변 내용 검색

회원로그인

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