게시판관리 - 게시유형, 고정여부 추가
This commit is contained in:
@@ -17,34 +17,75 @@
|
||||
<script language="javascript" >
|
||||
var url = '<c:url value="/onl/apim/portalnotice/portalNoticeMan.json" />';
|
||||
var url_view = '<c:url value="/onl/apim/portalnotice/portalNoticeMan.view" />';
|
||||
|
||||
var combo;
|
||||
|
||||
function formatNoticeType(cellvalue, options, rowObject) {
|
||||
var name = "";
|
||||
for (var i = 0; i < combo.noticeTypeList.length; i++) {
|
||||
if (combo.noticeTypeList[i].CODE == cellvalue) {
|
||||
return combo.noticeTypeList[i].NAME;
|
||||
}
|
||||
}
|
||||
return cellvalue;
|
||||
}
|
||||
|
||||
function formatuseYn(cellvalue, options, rowObject) {
|
||||
return cellvalue === 'N'
|
||||
? '<span style="color: red;">미사용</span>'
|
||||
: '<span>사용</span>';
|
||||
}
|
||||
|
||||
function formatFixYn(cellvalue, options, rowObject) {
|
||||
return cellvalue === 'Y'
|
||||
? '고정'
|
||||
: '';
|
||||
}
|
||||
|
||||
function formatFile(cellvalue, options, rowObject) {
|
||||
var iconPath = '${pageContext.request.contextPath}/images/icon_file.png';
|
||||
var icon = rowObject.hasAttachment ? '<img src="' + iconPath + '" alt="File Attached" style="vertical-align: middle; margin-left: 5px; width: 16px; height: 16px;">' : '';
|
||||
return cellvalue + icon;
|
||||
}
|
||||
|
||||
|
||||
function init(){
|
||||
$.ajax({
|
||||
type : "POST",
|
||||
url:url,
|
||||
dataType:"json",
|
||||
data:{cmd: 'LIST_INIT_COMBO'},
|
||||
success:function(json){
|
||||
console.log('init', json);
|
||||
combo = json;
|
||||
new makeOptions("CODE","NAME").setObj($("select[name=searchNoticeType]")).setNoValueInclude(true).setNoValue('','<%=localeMessage.getString("combo.all")%>').setData(json.noticeTypeList).rendering();
|
||||
|
||||
putSelectFromParam();
|
||||
},
|
||||
error:function(e){
|
||||
alert(e.responseText);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
$('#grid').jqGrid({
|
||||
datatype:"json",
|
||||
mtype: 'POST',
|
||||
url: url,
|
||||
postData : { cmd : 'LIST',
|
||||
searchNoticeType: $('select[name=searchNoticeType]').val(),
|
||||
searchUseYn: $('select[name=searchUseYn]').val(),
|
||||
searchNoticeSubject: $('input[name=searchNoticeSubject]').val(),
|
||||
searchNoticeDetail: $('input[name=searchNoticeDetail]').val()
|
||||
},
|
||||
colNames:['id', 'No.', '제목', '사용', '마지막 수정일', '등록일', '등록자', '조회수'],
|
||||
colNames:['id', 'No.', '게시유형', '제목', '고정여부', '사용', '마지막 수정일', '등록일', '등록자', '조회수'],
|
||||
colModel:[
|
||||
{ name : 'id' , align:'center', key:true, hidden:true},
|
||||
{ name : 'rowNum' , align:'center', width:80 },
|
||||
{ name : 'noticeSubject' , align:'left' , width:200 , formatter: formatFile },
|
||||
{ name : 'rowNum' , align:'center', width:60 },
|
||||
{ name : 'noticeType' , align:'center', width:60, formatter: formatNoticeType },
|
||||
{ name : 'noticeSubject' , align:'left' , width:300, formatter: formatFile },
|
||||
{ name : 'fixYn' , align:'center', width:60, formatter: formatFixYn },
|
||||
{ name : 'useYn' , align:'center', width:60, formatter: formatuseYn },
|
||||
{ name : 'lastModifiedDate', align:'center', width:120 , formatter: timeStampFormat},
|
||||
{ name : 'createdDate' , align:'center', width:120, formatter: timeStampFormat },
|
||||
@@ -98,6 +139,8 @@
|
||||
}
|
||||
});
|
||||
|
||||
init();
|
||||
|
||||
resizeJqGridWidth('grid','content_middle','1000');
|
||||
|
||||
$("#btn_search").click(function(){
|
||||
@@ -140,9 +183,25 @@
|
||||
<div class="title">공지사항 목록<span class="tooltip">공지사항을 관리합니다.</span></div>
|
||||
<form id="ajaxForm" onsubmit="return false;">
|
||||
<table class="search_condition" cellspacing=0;>
|
||||
<colgroup>
|
||||
<col style="width:180px;">
|
||||
<col style="width:240px;">
|
||||
<col style="width:180px;">
|
||||
<col style="width:240px;">
|
||||
<col style="width:180px;">
|
||||
<col style="width:240px;">
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th style="width:180px;">사용여부</th>
|
||||
<th>게시유형</th>
|
||||
<td>
|
||||
<div class="select-style">
|
||||
<select name="searchNoticeType"></select>
|
||||
</div>
|
||||
</td>
|
||||
<th>제목/내용</th>
|
||||
<td><input type="text" name="searchSubjectDetail"></td>
|
||||
<th>사용여부</th>
|
||||
<td>
|
||||
<div class="select-style">
|
||||
<select name="searchUseYn">
|
||||
@@ -152,8 +211,6 @@
|
||||
</select>
|
||||
</div>
|
||||
</td>
|
||||
<th style="width:180px;">제목/내용</th>
|
||||
<td><input type="text" name="searchSubjectDetail"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@@ -24,7 +24,36 @@
|
||||
var fileInfo = null;
|
||||
|
||||
function init() {
|
||||
var key = "${param.id}";
|
||||
isDetail = key != "" && key != "null";
|
||||
|
||||
if (isDetail) {
|
||||
$("#title").append(" 수정");
|
||||
buttonControl(true);
|
||||
} else {
|
||||
$("#title").append(" 등록");
|
||||
$("#btn_modify").html('<i class="material-icons">save</i> <%= localeMessage.getString("button.register") %>');
|
||||
buttonControl(false);
|
||||
}
|
||||
|
||||
// 초기화 로직
|
||||
$.ajax({
|
||||
type : "POST",
|
||||
url:url,
|
||||
dataType:"json",
|
||||
data:{cmd: 'LIST_INIT_COMBO'},
|
||||
success:function(json){
|
||||
combo = json;
|
||||
new makeOptions("CODE","NAME").setObj($("select[name=noticeType]")).setNoValueInclude(false).setData(json.noticeTypeList).rendering();
|
||||
|
||||
if (key) {
|
||||
detail(key);
|
||||
}
|
||||
},
|
||||
error:function(e){
|
||||
alert(e.responseText);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function decodeHTMLEntities(text) {
|
||||
@@ -98,8 +127,10 @@
|
||||
data: {cmd: 'DETAIL', id: key},
|
||||
success: function (data) {
|
||||
$("#id").val(key);
|
||||
$('#noticeType').val(data.noticeType);
|
||||
$("#noticeSubject").val(data.noticeSubject);
|
||||
$("#useYn").prop("checked", data.useYn === "Y");
|
||||
$("#fixYn").prop("checked", data.fixYn === "Y");
|
||||
|
||||
var decodedContent = decodeHTMLEntities(data.noticeDetail);
|
||||
$('#contents').summernote('code', decodedContent);
|
||||
@@ -123,19 +154,9 @@
|
||||
|
||||
$(document).ready(function () {
|
||||
var returnUrl = getReturnUrlForReturn();
|
||||
var key = "${param.id}";
|
||||
isDetail = key != "" && key != "null";
|
||||
|
||||
if (isDetail) {
|
||||
$("#title").append(" 수정");
|
||||
buttonControl(true);
|
||||
} else {
|
||||
$("#title").append(" 등록");
|
||||
$("#btn_modify").html('<i class="material-icons">save</i> <%= localeMessage.getString("button.register") %>');
|
||||
buttonControl(false);
|
||||
}
|
||||
|
||||
|
||||
init();
|
||||
|
||||
|
||||
// Summernote 에디터 초기화 (이미지 붙여넣기 data-uri 방식, 리사이징 지원)
|
||||
initSummernote('#contents', {
|
||||
@@ -143,9 +164,6 @@
|
||||
height: 300
|
||||
});
|
||||
|
||||
if (key) {
|
||||
detail(key);
|
||||
}
|
||||
|
||||
$('#fileInput').change(function(e) {
|
||||
var file = e.target.files[0];
|
||||
@@ -175,6 +193,7 @@
|
||||
var formData = new FormData($("#ajaxForm")[0]);
|
||||
|
||||
formData.set("useYn", $("#useYn").is(":checked") ? "Y" : "N");
|
||||
formData.set("fixYn", $("#fixYn").is(":checked") ? "Y" : "N");
|
||||
formData.set("noticeDetail", $('#contents').summernote('code'));
|
||||
|
||||
formData.append("cmd", isDetail ? "UPDATE" : "INSERT");
|
||||
@@ -244,24 +263,43 @@
|
||||
<form id="ajaxForm" enctype="multipart/form-data" accept-charset="UTF-8">
|
||||
<input type="hidden" name="id" id="id">
|
||||
<table class="table_row" cellspacing="0">
|
||||
<colgroup>
|
||||
<col style="width: 10%"/>
|
||||
<col style="width: 40%"/>
|
||||
<col style="width: 10%"/>
|
||||
<col style="width: 40%"/>
|
||||
</colgroup>
|
||||
<tr>
|
||||
<th style="width:20%;">사용여부</th>
|
||||
<td>
|
||||
<input type="checkbox" name="useYn" id="useYn" value="Y" ${portalNoticeUI.useYn eq 'Y' ? 'checked' : ''}> 사용</td>
|
||||
<th>게시유형</th>
|
||||
<td colspan="3">
|
||||
<div class="select-style" >
|
||||
<select name="noticeType" id="noticeType"></select>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width:20%;">제목 <font color="red">*</font></th>
|
||||
<td><input type="text" id="noticeSubject" name="noticeSubject" style="width:100%" data-required data-warning="제목을 입력하여 주십시오."/></td>
|
||||
<th>제목 <font color="red">*</font></th>
|
||||
<td colspan="3"><input type="text" id="noticeSubject" name="noticeSubject" style="width:100%" data-required data-warning="제목을 입력하여 주십시오."/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width:20%;">본문 <font color="red">*</font></th>
|
||||
<th>사용여부</th>
|
||||
<td>
|
||||
<input type="checkbox" name="useYn" id="useYn" value="Y" ${portalNoticeUI.useYn eq 'Y' ? 'checked' : ''}> 사용
|
||||
</td>
|
||||
<th>고정여부</th>
|
||||
<td>
|
||||
<input type="checkbox" name="fixYn" id="fixYn" value="Y" ${portalNoticeUI.fixYn eq 'Y' ? 'checked' : ''}> 고정
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>본문 <font color="red">*</font></th>
|
||||
<td colspan="3">
|
||||
<textarea id="contents" name="noticeDetail" style="width:100%;height:300px" data-required data-warning="본문을 입력하여 주십시오."></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width:20%;">첨부파일</th>
|
||||
<td>
|
||||
<th>첨부파일</th>
|
||||
<td colspan="3">
|
||||
<div style="margin: 5px 0px; display: inline-block;">
|
||||
<input type="file" id="fileInput" name="files" style="display:none;" />
|
||||
<button type="button" id="addFile" class="cssbtn smallBtn">파일 선택</button>
|
||||
|
||||
Reference in New Issue
Block a user