전에 문의드렸던 datapicker 문제 입니다.ㅠ_ㅠ
본문
http://sir.co.kr/qa/?wr_id=49728&page=3&s_tag=%EA%B7%B8%EB%88%84%EB%B3%B4%EB%93%9C5 게시물이구요..
먼저 fm25님, 먼지손님, 대포산님 답변해 주셔서 진심으로 감사드립니다.
우선 말씀해 주신대로 수정도 해보았지만 쉽지가 않네요.. ㅎㅎ
소스를 정리해보면 먼저 write.php 부근에서
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
if ($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');
}
if(!$write[wr_link1]) $write[wr_link1] = date("Ymd");
?>
<link rel="stylesheet" href="<?php echo $board_skin_url ?>/style.css" type="text/css">
<div style="height:14px; line-height:1px; font-size:1px;"> </div>
<style type="text/css">
.write_head { height:30px; text-align:center; color:#8492A0; }
.field { border:1px solid #ccc; }
.table1 { border:0px solid #f1f1f1; }
.w1 { font-weight:bold; height:30px; background:#fbfbfb; padding:5px 25px 5px 20px; }
.w2 { height:30px; color:#888888; background:#fbfbfb; padding:7px 5px 0px 5px; }
.w3 { font-weight:bold; height:30px; background:#fbfbfb; padding:5px 0px 5px 5px; }
.w_input { font-family:굴림; font-size:9pt; color:#454545; border-top:1px solid #ababab; border-bottom:1px solid #dfdfdf; border-left:0px solid #ababab; border-right:0px solid #dfdfdf; height:21px;}
</style>
<script type="text/javascript">
// 글자수 제한
var char_min = parseInt(<?=$write_min?>); // 최소
var char_max = parseInt(<?=$write_max?>); // 최대
</script>
<form name="fwrite" id="fwrite" action="<?php echo $action_url ?>" onsubmit="return fwrite_submit(this);" method="post" enctype="multipart/form-data" autocomplete="off" style="width:<?php echo $width; ?>">
<input type="hidden" name="uid" value="<?php echo get_uniqid(); ?>">
<input type="hidden" name="w" value="<?php echo $w ?>">
<input type="hidden" name="bo_table" value="<?php echo $bo_table ?>">
<input type="hidden" name="wr_id" value="<?php echo $wr_id ?>">
<input type="hidden" name="sca" value="<?php echo $sca ?>">
<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="sst" value="<?php echo $sst ?>">
<input type="hidden" name="sod" value="<?php echo $sod ?>">
<input type="hidden" name="page" value="<?php echo $page ?>">
<table width="<?=$width?>" align="center" cellpadding="0" cellspacing="0"><tr><td>
<!-- 제목 시작 -->
</td></tr>
<tr><td>
<table border=0 cellpadding=0 cellspacing=0 width=100%>
<tr>
<td width="30"><img src="<?php echo $board_skin_url ?>/img/board_viewSUB.gif" width="30" height="55" align="absmiddle" border='0'></td>
<td background="<?php echo $board_skin_url ?>/img/board_viewC.gif">
<div style="width:100%; padding-top:1px; font-size:13px; font-weight:bold;line-height:15px;">
<?=$title_msg?>
</div>
</td>
<td width="8"><img src="<?php echo $board_skin_url ?>/img/board_viewR.gif" width="8" height="55" align="absmiddle" border='0'></td>
</tr>
</table>
<!-- 제목 끝 -->
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="table1">
<colgroup width=100>
<colgroup width=''>
<tr><td colspan="2" style="height:3px;"></td></tr>
<? if ($is_name) { ?>
<tr>
<td width="55" align="left" class="w1">이 름</td>
<td align="left"><input class='ed' maxlength=20 size=15 name=wr_name itemname="이름" required value="<?=$name?>"></td></tr>
<tr><td colspan=2 height=1 bgcolor=#e7e7e7></td></tr>
<? } ?>
<? if ($is_password) { ?>
<tr>
<td width="55" align="left" class="w1">패스워드</td>
<td align="left"><input class='ed' type=password maxlength=20 size=15 name=wr_password itemname="패스워드" <?=$password_required?>></td></tr>
<tr><td colspan=2 height=1 bgcolor=#e7e7e7></td></tr>
<? } ?>
<? if ($is_email) { ?>
<tr>
<td width="55" align="left" class="w1">이메일</td>
<td align="left"><input class='ed' maxlength=100 size=50 name=wr_email email itemname="이메일" value="<?=$email?>"></td></tr>
<tr><td colspan=2 height=1 bgcolor=#e7e7e7></td></tr>
<? } ?>
<? if ($is_homepage) { ?>
<tr>
<td width="55" align="left" class="w1">홈페이지</td>
<td align="left"><input class='ed' size=50 name=wr_homepage itemname="홈페이지" value="<?=$homepage?>"></td></tr>
<tr><td colspan=2 height=1 bgcolor=#e7e7e7></td></tr>
<? } ?>
<!-----------달력 시작---------------->
<tr>
<td width="55" align="left" class="w1">날 짜</td>
<td align="left">
<?php include_once(G5_PLUGIN_PATH.'/jquery-ui/datepicker.php'); ?>
<script>
$(function(){
$("#wr_link1").datepicker({ changeMonth: true, changeYear: true, dateFormat: "yy-mm-dd", showButtonPanel: true, yearRange: "c-99:c+99", maxDate: "+365d" });
</script>
<input type="text" name="wr_link1" value="<?php echo $write['wr_link1'] ?>" id="wr_link1" class="frm_input" size="20">
<img src="<?php echo $board_skin_url ?>/img/calendar.gif" border="0" align="absmiddle" title="날짜를 선택하세요"></a>
</td></tr>
<tr><td colspan=2 height=1 bgcolor=#e7e7e7></td></tr>
<!-----------달력 끝---------------->
<?
$option = "";
$option_hidden = "";
if ($is_notice || $is_html || $is_secret || $is_mail) {
$option = "";
if ($is_notice) {
$option .= "<input type=checkbox name=notice value='1' $notice_checked>공지 ";
}
if ($is_html) {
if ($is_dhtml_editor) {
$option_hidden .= "<input type=hidden value='html1' name='html'>";
} else {
$option .= "<input onclick='html_auto_br(this);' type=checkbox value='$html_value' name='html' $html_checked><span class=w_title>html</span> ";
}
}
if ($is_secret) {
if ($is_admin || $is_secret==1) {
$option .= "<input type=checkbox value='secret' name='secret' $secret_checked><span class=w_title>비밀글</span> ";
} else {
$option_hidden .= "<input type=hidden value='secret' name='secret'>";
}
}
if ($is_mail) {
$option .= "<input type=checkbox value='mail' name='mail' $recv_email_checked>답변메일받기 ";
}
}
echo $option_hidden;
if ($option) {
?>
소스가 정렬되어 있는데 아직 G4 소스가 많이 남아 있습니다.
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
if ($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');
}
if(!$write[wr_link1]) $write[wr_link1] = date("Ymd");
?> 부분도 수정을 해야할듯 한데 cheditor을 업그래이드 해야한다고 들었습니다. 검색해서 열심히 뒤적였는데 아직까진 해답을 찾지 못했습니다. ㅠㅠ
그리고 또 말씀하신 view.php를 보면
<?php
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
include_once(G5_LIB_PATH.'/thumbnail.lib.php');
// add_stylesheet('css 구문', 출력순서); 숫자가 작을 수록 먼저 출력됨
add_stylesheet('<link rel="stylesheet" href="'.$board_skin_url.'/style.css">', 0);
?>
<script src="<?php echo G5_JS_URL; ?>/viewimageresize.js"></script>
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
$year = substr($view[wr_link1],0,4);
$month = sprintf("%d",substr($view[wr_link1],4,2));
$day = sprintf("%d",substr($view[wr_link1],6,2));
?>
<link rel="stylesheet" href="<?php echo $board_skin_url ?>/style.css" type="text/css">
<!-- 게시글 보기 시작 -->
<table width="<?=$width?>" align="center" cellpadding="0" cellspacing="0"><tr><td align="left">
<div style="clear:both; height:30px;">
<div style="float:left; margin-top:6px;">
<img src="<?php echo $board_skin_url ?>/img/icon_date.gif" align=absmiddle border='0'>
<span style="color:#888888;">작성일 : <?=date("y-m-d H:i", strtotime($view[wr_datetime]))?></span>
</div>
<!-- 링크 버튼 -->
<div style="float:right;">
<?
ob_start();
?>
<? if ($copy_href) { echo "<a href=\"$copy_href\"><img src='$board_skin_path/img/btn_copy.gif' border='0' align='absmiddle'></a> "; } ?>
<? if ($move_href) { echo "<a href=\"$move_href\"><img src='$board_skin_path/img/btn_move.gif' border='0' align='absmiddle'></a> "; } ?>
<? if ($search_href) { echo "<a href=\"$search_href\"><img src='$board_skin_path/img/btn_list_search.gif' border='0' align='absmiddle'></a> "; } ?>
<? echo "<a href=\"$list_href\"><img src='$board_skin_path/img/btn_list.gif' border='0' align='absmiddle'></a> "; ?>
<? if ($update_href) { echo "<a href=\"$update_href\"><img src='$board_skin_path/img/btn_modify.gif' border='0' align='absmiddle'></a> "; } ?>
<? if ($delete_href) { echo "<a href=\"$delete_href\"><img src='$board_skin_path/img/btn_delete.gif' border='0' align='absmiddle'></a> "; } ?>
<? if ($write_href) { echo "<a href=\"$write_href\"><img src='$board_skin_path/img/btn_write.gif' border='0' align='absmiddle'></a> "; } ?>
<?
$link_buttons = ob_get_contents();
ob_end_flush();
?>
</div>
</div>
<!-- 제목 시작 -->
</td></tr>
<tr><td>
<table border=0 cellpadding=0 cellspacing=0 width=100%>
<tr>
<td width="30"><img src="<?php echo $board_skin_url ?>/img/board_viewSUB.gif" width="30" height="55" align="absmiddle" border='0'></td>
<td background="<?php echo $board_skin_url ?>/img/board_viewC.gif">
<div style="width:100%; padding-top:1px; font-size:13px; font-weight:bold;line-height:15px;">
<? if ($is_category) { echo ($category_name ? "[$view[ca_name]] " : ""); } ?>
<?=cut_hangul_last(get_text($view[wr_subject]))?>
</div>
</td>
<td width="8"><img src="<?php echo $board_skin_url ?>/img/board_viewR.gif" width="8" height="55" align="absmiddle" border='0'></td>
</tr>
</table>
<!-- 제목 끝 -->
<table width="100%" border="0" cellspacing="0" cellpadding="5">
<tr><td><font color="#CF4900"> 현재날짜</font> : <?=$year?>년 <?=$month?>월 <?=$day?>일 <font color="#CF4900"> </font><span class="style1">|</span><font color="#CF4900"> 등록일자</font> : <?=date("Y년 n월 j일", strtotime($view[wr_datetime]))?> </td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td valign="top" style='word-break:break-all; padding:5px;'>
<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td class="c_tc">
<?
// 파일 출력
for ($i=0; $i<=count($view[file]); $i++) {
if ($view[file][$i][view]) echo $view[file][$i][view] . "<p>" . $view[file][$i][content] . "<p>";
}
echo "<span class='bbs_content'>$view[content]</span>";
?>
</td></tr></table>
<!-- 테러 태그 방지용 --></xml></xmp><a href=""></a><a href=''></a>
</td></tr>
</table>
</td></tr>
</table>
</td></tr>
</table>
<script language="JavaScript">
// HTML 로 넘어온 <img ... > 태그의 폭이 테이블폭보다 크다면 테이블폭을 적용한다.
function resize_image()
{
var target = document.getElementsByName('target_resize_image[]');
var image_width = parseInt('<?=$board[bo_image_width]?>');
var image_height = 0;
for(i=0; i<target.length; i++) {
// 원래 사이즈를 저장해 놓는다
target[i].tmp_width = target[i].width;
target[i].tmp_height = target[i].height;
// 이미지 폭이 테이블 폭보다 크다면 테이블폭에 맞춘다
if(target[i].width > image_width) {
image_height = parseFloat(target[i].width / target[i].height)
target[i].width = image_width;
target[i].height = parseInt(image_width / image_height);
}
}
}
window.onload = resize_image;
</script>
구성되어 있습니다. 아무래도 익숙하신 분들께서 보시면 아직 짜집기가 어설프게 보이실 수도 있겠네요 ㅠ_ㅠ
이런 페이지가
월별, 일별, 주간별등으로 페이지가 나뉘어 있습니다.
그래도 글을 쓰려면 write.php를 거쳐야 하니 write쪽과 view를 해결해야하지 않을까 하는게 제 개인적인 생각입니다.
혹시나 제가 실수하고 있는 부분 보이시면 가르침 부탁드립니다.
가족님들 모두 추운날씨에 감기 조심하시구요~
답변 1
월/일/주별로 나뉘어진다고 하셨는데.. 저번의 질문만 생각하고 답변할게요.. 헷갈려서.. ^^;;
우선.. datepicker하고 출력유형을 맞추셔야 할듯합니다.
$("#wr_link1").datepicker({ changeMonth: true, changeYear: true, dateFormat: "yymmdd", showButtonPanel: true, yearRange: "c-99:c+99", maxDate: "+365d" });
2014-1-1 이런식으로 출력됐던 이유가 datepicker에서 1111-22-33 이런식으로 대쉬가 함께 지정돼서 그랬을 겁니다.
그리고 날짜를 클릭해서 입력폼으로 들어갔는데 지정한 날짜가 아닌 현재날짜가 나오는 이유는
if(!$write[wr_link1]) $write[wr_link1] = date("Ymd");
이거 때문입니다.
달력쪽에서 날짜를 클릭했을때 해당날짜의 값을 전달해줘서 그걸 적용시켜야겠죠.
날짜클릭을 단순하게 a링크로 하신거라면 href값이 bbs/board.php?bo_table=게시판아이디 이런식으로 되있으려나요?
bbs/board.php?bo_table=게시판아이디&wr_link1=Ymd
Ymd부분은 대쉬없이 자리수 맞춰서 넣어주시구요 (해당 날짜가 뿌려지는 부분 참조하시면 될겁니다. 헷갈리시면 달력부분도 소스를 보여주시면 좋겠네요.)
그리고 위에 언급한 부분도 수정해야겠군요.
if(!$write['wr_link1']) $write['wr_link1'] = $_GET['wr_link1'];
if(!$write['wr_link1']) $write['wr_link1'] = date('Ymd');
이렇게 위에 한줄 추가해주는 정도면 되겠군요.
일단 여기까지 해보시고 나머지도 하나씩 해결해보죠..