게시글 작성시 최소 최대 글자수 체크 스크립트 추가
This commit is contained in:
@ -198,6 +198,17 @@ if ($config['cf_kcpcert_use'] != '' && !$is_admin) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 글자수 제한 설정값
|
||||||
|
if ($is_admin || $board['bo_use_dhtml_editor'])
|
||||||
|
{
|
||||||
|
$write_min = $write_max = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$write_min = (int)$board['bo_write_min'];
|
||||||
|
$write_max = (int)$board['bo_write_max'];
|
||||||
|
}
|
||||||
|
|
||||||
$g4['title'] = $board['bo_subject']." ".$title_msg;
|
$g4['title'] = $board['bo_subject']." ".$title_msg;
|
||||||
|
|
||||||
$is_notice = false;
|
$is_notice = false;
|
||||||
|
|||||||
@ -107,9 +107,15 @@ echo $option_hidden;
|
|||||||
<tr>
|
<tr>
|
||||||
<th scope="row"><label for="wr_content">내용<strong class="sound_only">필수</strong></label></th>
|
<th scope="row"><label for="wr_content">내용<strong class="sound_only">필수</strong></label></th>
|
||||||
<td class="wr_content">
|
<td class="wr_content">
|
||||||
<!-- 최소/최대 글자 수 사용 시 --><p id="char_count_desc">이 게시판은 최소 <strong><?php echo $write_min; ?></strong>글자 초과, 최대 <strong><?php echo $write_max; ?></strong>글자 미만까지 글을 쓰실 수 있습니다.</p>
|
<?php if($write_min || $write_max) { ?>
|
||||||
|
<!-- 최소/최대 글자 수 사용 시 -->
|
||||||
|
<p id="char_count_desc">이 게시판은 최소 <strong><?php echo $write_min; ?></strong>글자 이상, 최대 <strong><?php echo $write_max; ?></strong>글자 이하까지 글을 쓰실 수 있습니다.</p>
|
||||||
|
<?php } ?>
|
||||||
<?php echo $editor_html; // 에디터 사용시는 에디터로, 아니면 textarea 로 노출 ?>
|
<?php echo $editor_html; // 에디터 사용시는 에디터로, 아니면 textarea 로 노출 ?>
|
||||||
<!-- 최소/최대 글자 수 사용 시 --><div id="char_count_wrp"><span id="char_count"></span>글자</div>
|
<?php if($write_min || $write_max) { ?>
|
||||||
|
<!-- 최소/최대 글자 수 사용 시 -->
|
||||||
|
<div id="char_count_wrp"><span id="char_count"></span>글자</div>
|
||||||
|
<?php } ?>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
@ -157,34 +163,19 @@ echo $option_hidden;
|
|||||||
</form>
|
</form>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
<?php
|
<?php if($write_min || $write_max) { ?>
|
||||||
// 관리자라면 분류 선택에 '공지' 옵션을 추가함
|
// 글자수 제한
|
||||||
if ($is_admin)
|
var char_min = parseInt(<?php echo $write_min; ?>); // 최소
|
||||||
{
|
var char_max = parseInt(<?php echo $write_max; ?>); // 최대
|
||||||
echo '
|
check_byte("wr_content", "char_count");
|
||||||
if (ca_name_select = document.getElementById("ca_name")) {
|
|
||||||
ca_name_select.options.length += 1;
|
|
||||||
ca_name_select.options[ca_name_select.options.length-1].value = "공지";
|
|
||||||
ca_name_select.options[ca_name_select.options.length-1].text = "공지";
|
|
||||||
}';
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
|
|
||||||
with (document.fwrite)
|
$(function() {
|
||||||
{
|
$("#wr_content").on("keyup", function() {
|
||||||
if (typeof(wr_name) != "undefined")
|
check_byte("wr_content", "char_count");
|
||||||
wr_name.focus();
|
});
|
||||||
else if (typeof(wr_subject) != "undefined")
|
});
|
||||||
wr_subject.focus();
|
|
||||||
else if (typeof(wr_content) != "undefined")
|
|
||||||
wr_content.focus();
|
|
||||||
|
|
||||||
if (typeof(ca_name) != "undefined")
|
|
||||||
if (w.value == "u") {
|
|
||||||
ca_name.value = "<?php echo isset($write['ca_name'])?$write['ca_name']:''; ?>";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
<?php } ?>
|
||||||
function html_auto_br(obj)
|
function html_auto_br(obj)
|
||||||
{
|
{
|
||||||
if (obj.checked) {
|
if (obj.checked) {
|
||||||
@ -236,6 +227,20 @@ function fwrite_submit(f)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (document.getElementById("char_count")) {
|
||||||
|
if (char_min > 0 || char_max > 0) {
|
||||||
|
var cnt = parseInt(check_byte("wr_content", "char_count"));
|
||||||
|
if (char_min > 0 && char_min > cnt) {
|
||||||
|
alert("내용은 "+char_min+"글자 이상 쓰셔야 합니다.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else if (char_max > 0 && char_max < cnt) {
|
||||||
|
alert("내용은 "+char_max+"글자 이하로 쓰셔야 합니다.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
<?php if ($is_guest) { echo chk_captcha_js(); } ?>
|
<?php if ($is_guest) { echo chk_captcha_js(); } ?>
|
||||||
|
|
||||||
document.getElementById("btn_submit").disabled = "disabled";
|
document.getElementById("btn_submit").disabled = "disabled";
|
||||||
|
|||||||
@ -107,9 +107,15 @@ echo $option_hidden;
|
|||||||
<tr>
|
<tr>
|
||||||
<th scope="row"><label for="wr_content">내용<strong class="sound_only">필수</strong></label></th>
|
<th scope="row"><label for="wr_content">내용<strong class="sound_only">필수</strong></label></th>
|
||||||
<td class="wr_content">
|
<td class="wr_content">
|
||||||
<!-- 최소/최대 글자 수 사용 시 --><p id="char_count_desc">이 게시판은 최소 <strong><?php echo $write_min; ?></strong>글자 초과, 최대 <strong><?php echo $write_max; ?></strong>글자 미만까지 글을 쓰실 수 있습니다.</p>
|
<?php if($write_min || $write_max) { ?>
|
||||||
|
<!-- 최소/최대 글자 수 사용 시 -->
|
||||||
|
<p id="char_count_desc">이 게시판은 최소 <strong><?php echo $write_min; ?></strong>글자 이상, 최대 <strong><?php echo $write_max; ?></strong>글자 이하까지 글을 쓰실 수 있습니다.</p>
|
||||||
|
<?php } ?>
|
||||||
<?php echo $editor_html; // 에디터 사용시는 에디터로, 아니면 textarea 로 노출 ?>
|
<?php echo $editor_html; // 에디터 사용시는 에디터로, 아니면 textarea 로 노출 ?>
|
||||||
<!-- 최소/최대 글자 수 사용 시 --><div id="char_count_wrp"><span id="char_count"></span>글자</div>
|
<?php if($write_min || $write_max) { ?>
|
||||||
|
<!-- 최소/최대 글자 수 사용 시 -->
|
||||||
|
<div id="char_count_wrp"><span id="char_count"></span>글자</div>
|
||||||
|
<?php } ?>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
@ -157,34 +163,19 @@ echo $option_hidden;
|
|||||||
</form>
|
</form>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
<?php
|
<?php if($write_min || $write_max) { ?>
|
||||||
// 관리자라면 분류 선택에 '공지' 옵션을 추가함
|
// 글자수 제한
|
||||||
if ($is_admin)
|
var char_min = parseInt(<?php echo $write_min; ?>); // 최소
|
||||||
{
|
var char_max = parseInt(<?php echo $write_max; ?>); // 최대
|
||||||
echo '
|
check_byte("wr_content", "char_count");
|
||||||
if (ca_name_select = document.getElementById("ca_name")) {
|
|
||||||
ca_name_select.options.length += 1;
|
|
||||||
ca_name_select.options[ca_name_select.options.length-1].value = "공지";
|
|
||||||
ca_name_select.options[ca_name_select.options.length-1].text = "공지";
|
|
||||||
}';
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
|
|
||||||
with (document.fwrite)
|
$(function() {
|
||||||
{
|
$("#wr_content").on("keyup", function() {
|
||||||
if (typeof(wr_name) != "undefined")
|
check_byte("wr_content", "char_count");
|
||||||
wr_name.focus();
|
});
|
||||||
else if (typeof(wr_subject) != "undefined")
|
});
|
||||||
wr_subject.focus();
|
|
||||||
else if (typeof(wr_content) != "undefined")
|
|
||||||
wr_content.focus();
|
|
||||||
|
|
||||||
if (typeof(ca_name) != "undefined")
|
|
||||||
if (w.value == "u") {
|
|
||||||
ca_name.value = "<?php echo isset($write['ca_name'])?$write['ca_name']:''; ?>";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
<?php } ?>
|
||||||
function html_auto_br(obj)
|
function html_auto_br(obj)
|
||||||
{
|
{
|
||||||
if (obj.checked) {
|
if (obj.checked) {
|
||||||
@ -236,8 +227,24 @@ function fwrite_submit(f)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (document.getElementById("char_count")) {
|
||||||
|
if (char_min > 0 || char_max > 0) {
|
||||||
|
var cnt = parseInt(check_byte("wr_content", "char_count"));
|
||||||
|
if (char_min > 0 && char_min > cnt) {
|
||||||
|
alert("내용은 "+char_min+"글자 이상 쓰셔야 합니다.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else if (char_max > 0 && char_max < cnt) {
|
||||||
|
alert("내용은 "+char_max+"글자 이하로 쓰셔야 합니다.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
<?php if ($is_guest) { echo chk_captcha_js(); } ?>
|
<?php if ($is_guest) { echo chk_captcha_js(); } ?>
|
||||||
|
|
||||||
|
document.getElementById("btn_submit").disabled = "disabled";
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@ -123,9 +123,15 @@ echo $option_hidden;
|
|||||||
<tr>
|
<tr>
|
||||||
<th scope="row"><label for="wr_content">내용<strong class="sound_only">필수</strong></label></th>
|
<th scope="row"><label for="wr_content">내용<strong class="sound_only">필수</strong></label></th>
|
||||||
<td class="wr_content">
|
<td class="wr_content">
|
||||||
<!-- 최소/최대 글자 수 사용 시 --><p id="char_count_desc">이 게시판은 최소 <strong><?php echo $write_min; ?></strong>글자 초과, 최대 <strong><?php echo $write_max; ?></strong>글자 미만까지 글을 쓰실 수 있습니다.</p>
|
<?php if($write_min || $write_max) { ?>
|
||||||
|
<!-- 최소/최대 글자 수 사용 시 -->
|
||||||
|
<p id="char_count_desc">이 게시판은 최소 <strong><?php echo $write_min; ?></strong>글자 이상, 최대 <strong><?php echo $write_max; ?></strong>글자 이하까지 글을 쓰실 수 있습니다.</p>
|
||||||
|
<?php } ?>
|
||||||
<?php echo $editor_html; // 에디터 사용시는 에디터로, 아니면 textarea 로 노출 ?>
|
<?php echo $editor_html; // 에디터 사용시는 에디터로, 아니면 textarea 로 노출 ?>
|
||||||
<!-- 최소/최대 글자 수 사용 시 --><div id="char_count_wrp"><span id="char_count"></span>글자</div>
|
<?php if($write_min || $write_max) { ?>
|
||||||
|
<!-- 최소/최대 글자 수 사용 시 -->
|
||||||
|
<div id="char_count_wrp"><span id="char_count"></span>글자</div>
|
||||||
|
<?php } ?>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
@ -173,6 +179,19 @@ echo $option_hidden;
|
|||||||
</form>
|
</form>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
<?php if($write_min || $write_max) { ?>
|
||||||
|
// 글자수 제한
|
||||||
|
var char_min = parseInt(<?php echo $write_min; ?>); // 최소
|
||||||
|
var char_max = parseInt(<?php echo $write_max; ?>); // 최대
|
||||||
|
check_byte("wr_content", "char_count");
|
||||||
|
|
||||||
|
$(function() {
|
||||||
|
$("#wr_content").on("keyup", function() {
|
||||||
|
check_byte("wr_content", "char_count");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
<?php } ?>
|
||||||
function html_auto_br(obj)
|
function html_auto_br(obj)
|
||||||
{
|
{
|
||||||
if (obj.checked) {
|
if (obj.checked) {
|
||||||
@ -223,6 +242,20 @@ function fwrite_submit(f)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (document.getElementById("char_count")) {
|
||||||
|
if (char_min > 0 || char_max > 0) {
|
||||||
|
var cnt = parseInt(check_byte("wr_content", "char_count"));
|
||||||
|
if (char_min > 0 && char_min > cnt) {
|
||||||
|
alert("내용은 "+char_min+"글자 이상 쓰셔야 합니다.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else if (char_max > 0 && char_max < cnt) {
|
||||||
|
alert("내용은 "+char_max+"글자 이하로 쓰셔야 합니다.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
<?php echo $captcha_js; // 캡챠 사용시 자바스크립트에서 입력된 캡챠를 검사함 ?>
|
<?php echo $captcha_js; // 캡챠 사용시 자바스크립트에서 입력된 캡챠를 검사함 ?>
|
||||||
|
|
||||||
document.getElementById("btn_submit").disabled = "disabled";
|
document.getElementById("btn_submit").disabled = "disabled";
|
||||||
|
|||||||
@ -120,9 +120,15 @@ echo $option_hidden;
|
|||||||
<tr>
|
<tr>
|
||||||
<th scope="row"><label for="wr_content">내용<strong class="sound_only">필수</strong></label></th>
|
<th scope="row"><label for="wr_content">내용<strong class="sound_only">필수</strong></label></th>
|
||||||
<td class="wr_content">
|
<td class="wr_content">
|
||||||
<!-- 최소/최대 글자 수 사용 시 --><p id="char_count_desc">이 게시판은 최소 <strong><?php echo $write_min; ?></strong>글자 초과, 최대 <strong><?php echo $write_max; ?></strong>글자 미만까지 글을 쓰실 수 있습니다.</p>
|
<?php if($write_min || $write_max) { ?>
|
||||||
|
<!-- 최소/최대 글자 수 사용 시 -->
|
||||||
|
<p id="char_count_desc">이 게시판은 최소 <strong><?php echo $write_min; ?></strong>글자 이상, 최대 <strong><?php echo $write_max; ?></strong>글자 이하까지 글을 쓰실 수 있습니다.</p>
|
||||||
|
<?php } ?>
|
||||||
<?php echo $editor_html; // 에디터 사용시는 에디터로, 아니면 textarea 로 노출 ?>
|
<?php echo $editor_html; // 에디터 사용시는 에디터로, 아니면 textarea 로 노출 ?>
|
||||||
<!-- 최소/최대 글자 수 사용 시 --><div id="char_count_wrp"><span id="char_count"></span>글자</div>
|
<?php if($write_min || $write_max) { ?>
|
||||||
|
<!-- 최소/최대 글자 수 사용 시 -->
|
||||||
|
<div id="char_count_wrp"><span id="char_count"></span>글자</div>
|
||||||
|
<?php } ?>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
@ -170,6 +176,19 @@ echo $option_hidden;
|
|||||||
</form>
|
</form>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
<?php if($write_min || $write_max) { ?>
|
||||||
|
// 글자수 제한
|
||||||
|
var char_min = parseInt(<?php echo $write_min; ?>); // 최소
|
||||||
|
var char_max = parseInt(<?php echo $write_max; ?>); // 최대
|
||||||
|
check_byte("wr_content", "char_count");
|
||||||
|
|
||||||
|
$(function() {
|
||||||
|
$("#wr_content").on("keyup", function() {
|
||||||
|
check_byte("wr_content", "char_count");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
<?php } ?>
|
||||||
function html_auto_br(obj)
|
function html_auto_br(obj)
|
||||||
{
|
{
|
||||||
if (obj.checked) {
|
if (obj.checked) {
|
||||||
@ -220,6 +239,20 @@ function fwrite_submit(f)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (document.getElementById("char_count")) {
|
||||||
|
if (char_min > 0 || char_max > 0) {
|
||||||
|
var cnt = parseInt(check_byte("wr_content", "char_count"));
|
||||||
|
if (char_min > 0 && char_min > cnt) {
|
||||||
|
alert("내용은 "+char_min+"글자 이상 쓰셔야 합니다.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else if (char_max > 0 && char_max < cnt) {
|
||||||
|
alert("내용은 "+char_max+"글자 이하로 쓰셔야 합니다.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
<?php echo $captcha_js; // 캡챠 사용시 자바스크립트에서 입력된 캡챠를 검사함 ?>
|
<?php echo $captcha_js; // 캡챠 사용시 자바스크립트에서 입력된 캡챠를 검사함 ?>
|
||||||
|
|
||||||
document.getElementById("btn_submit").disabled = "disabled";
|
document.getElementById("btn_submit").disabled = "disabled";
|
||||||
|
|||||||
Reference in New Issue
Block a user