cbf3066a56
Summernote 에디터 스타일 CSS 추가 - 텍스트 및 컴포넌트 스타일 정의 OpenAPI POC JS 파일 추가 - API 스펙 빌더 및 스텝별 렌더 구현
358 lines
14 KiB
Plaintext
358 lines
14 KiB
Plaintext
<%@ page language="java" contentType="text/html; charset=utf-8" %>
|
|
<%@ page import="java.io.*" %>
|
|
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
|
<%@ taglib uri="http://www.springframework.org/tags" prefix="spring" %>
|
|
<%@ include file="/jsp/common/include/localemessage.jsp" %>
|
|
<%
|
|
response.setHeader("Pragma", "No-cache");
|
|
response.setHeader("Cache-Control", "no-cache");
|
|
response.setHeader("Expires", "0");
|
|
%>
|
|
|
|
<html>
|
|
<head>
|
|
<title></title>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
<jsp:include page="/jsp/common/include/css.jsp"/>
|
|
<jsp:include page="/jsp/common/include/script.jsp"/>
|
|
|
|
<script language="javascript">
|
|
var url = '<c:url value="/onl/apim/portalproperty/propertyMan.json" />';
|
|
var url_view = '<c:url value="/onl/apim/portalproperty/propertyMan.view" />';
|
|
var lastsel2;
|
|
|
|
function isValid() {
|
|
if ($('input[name=prptyGroupName]').val() == "") {
|
|
alert("<%= localeMessage.getString("propertyDetail.checkRequired4") %>");
|
|
$('input[name=prptyGroupName]').focus();
|
|
return false;
|
|
}
|
|
if ($('input[name=prptyGroupDesc]').val() == "") {
|
|
alert("<%= localeMessage.getString("propertyDetail.checkRequired1") %>");
|
|
$('input[name=prptyGroupDesc]').focus();
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
function isValidGrid() {
|
|
if ($('input[name=prptyName]').val() == "") {
|
|
alert("<%= localeMessage.getString("propertyDetail.checkRequired2") %>");
|
|
return false;
|
|
} else if ($('input[name=prpty2Val]').val() == "") {
|
|
alert("<%= localeMessage.getString("propertyDetail.checkRequired3") %>");
|
|
return false;
|
|
}
|
|
//중복체크
|
|
if ($("#grid tr#" + lastsel2).attr("editable") == 1) { //editable=1 means row in edit mode
|
|
$("#grid").saveRow(lastsel2, false, "clientArray");
|
|
}
|
|
var data = $("#grid").getRowData();
|
|
for (var i = 0; i < data.length; i++) {
|
|
if (data[i]['PRPTYNAME'] == $('input[name=prptyName]').val()) {
|
|
alert("<%= localeMessage.getString("propertyDetail.checkDuplicate") %>");
|
|
return false;
|
|
}
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
function checkDuplicatePrptyName(data) {
|
|
var prptyNameSet = new Set();
|
|
for (var i = 0; i < data.length; i++) {
|
|
if (prptyNameSet.has(data[i].PRPTYNAME)) {
|
|
return true; // 중복 발견
|
|
}
|
|
prptyNameSet.add(data[i].PRPTYNAME);
|
|
}
|
|
return false;
|
|
}
|
|
|
|
function unformatterFunction(cellvalue, options, rowObject) {
|
|
return "";
|
|
}
|
|
|
|
function formatterFunction(cellvalue, options, rowObject) {
|
|
var rowId = options["rowId"];
|
|
return "<button type='button' class='cssbtn smallBtn2' id='btn_pop_delete' style='vertical-align:middle; font-weight:bold;' name='img_" + rowId + "'>delete</button>";
|
|
}
|
|
|
|
function gridRendering() {
|
|
$('#grid').jqGrid({
|
|
datatype: "local",
|
|
loadonce: true,
|
|
rowNum: 1000,
|
|
editurl: "clientArray",
|
|
colNames: ['<%= localeMessage.getString("propertyDetail.propertyKey") %>',
|
|
'<%= localeMessage.getString("propertyDetail.propertyValue") %>',
|
|
'설명',
|
|
'<%= localeMessage.getString("propertyDetail.delYn") %>'],
|
|
colModel: [{name: 'PRPTYNAME', width: 50, align: 'left', editable: true},
|
|
{name: 'PRPTY2VAL', width: 150, align: 'left', editable: true},
|
|
{name: 'PRPTYDESC', width: 200, align: 'left', editable: true, edittype: 'textarea', editoptions: {rows: 2}},
|
|
{
|
|
name: 'DELETEYN',
|
|
width: 20,
|
|
align: 'center',
|
|
unformat: unformatterFunction,
|
|
formatter: formatterFunction
|
|
}],
|
|
jsonReader: {
|
|
repeatitems: false
|
|
},
|
|
loadComplete: function () {
|
|
},
|
|
onSelectRow: function (rowid, status) {
|
|
if (lastsel2 != undefined) {
|
|
if ($("#grid tr#" + lastsel2).attr("editable") == 1) { //editable=1 means row in edit mode
|
|
$("#grid").saveRow(lastsel2, false, "clientArray");
|
|
}
|
|
}
|
|
$('#grid').restoreRow(lastsel2);
|
|
$('#grid').editRow(rowid, true);
|
|
lastsel2 = rowid;
|
|
},
|
|
onSortCol: function () {
|
|
return 'stop'; //정렬 방지
|
|
},
|
|
height: '500',
|
|
autowidth: true,
|
|
//autoheight : true,
|
|
viewrecords: true
|
|
,
|
|
loadError: function (jqXHR, textStatus, errorThrown) {
|
|
|
|
var location = '<%=request.getContextPath()%>/';
|
|
comloadError(jqXHR, textStatus, errorThrown, location);
|
|
|
|
}
|
|
});
|
|
|
|
resizeJqGridWidth('grid', 'title', '1000');
|
|
}
|
|
|
|
function init(key, callback) {
|
|
if (typeof callback === 'function') {
|
|
callback(key);
|
|
}
|
|
}
|
|
|
|
function detail(key) {
|
|
|
|
$.ajax({
|
|
type: "POST",
|
|
url: url,
|
|
dataType: "json",
|
|
data: {
|
|
cmd: 'DETAIL',
|
|
prptyGroupName: key
|
|
},
|
|
success: function (json) {
|
|
$("input[name=prptyGroupName]").val(json.PRPTYGROUPNAME).attr('readonly', true);
|
|
$("input[name=prptyGroupDesc]").val(json.PRPTYGROUPDESC);
|
|
$("#grid")[0].addJSONData(json.gridData);
|
|
|
|
$("button[name*=img]").click(function () {
|
|
var name = $(this).attr("name");
|
|
var rowId = name.split("_")[1];
|
|
$('#grid').jqGrid('delRowData', rowId);
|
|
});
|
|
},
|
|
error: function (e) {
|
|
alert(e.responseText);
|
|
}
|
|
});
|
|
|
|
}
|
|
|
|
$(document).ready(function () {
|
|
var returnUrl = getReturnUrlForReturn();
|
|
var key = "Portal";
|
|
gridRendering();
|
|
|
|
init(key, detail);
|
|
|
|
$("#btn_modify").click(function () {
|
|
if (!isValid()) return;
|
|
|
|
if (confirm("<%= localeMessage.getString("common.checkModify")%>") != true)
|
|
return;
|
|
|
|
if ($("#grid tr#" + lastsel2).attr("editable") == 1) { //editable=1 means row in edit mode
|
|
$("#grid").saveRow(lastsel2, false, "clientArray");
|
|
}
|
|
var data = $("#grid").getRowData();
|
|
|
|
// PrptyName 중복 체크
|
|
if (checkDuplicatePrptyName(data)) {
|
|
alert("<%= localeMessage.getString("propertyDetail.checkDuplicate") %>");
|
|
return;
|
|
}
|
|
|
|
var prptyGroupNameValue = $("input[name=prptyGroupName]").val();
|
|
var gridData = new Array();
|
|
|
|
for (var i = 0; i < data.length; i++) {
|
|
data[i]["PRPTYGROUPNAME"] = prptyGroupNameValue;
|
|
gridData.push(data[i]);
|
|
}
|
|
|
|
//공통부만 form으로 구성
|
|
var postData = $('#ajaxForm').serializeArray();
|
|
|
|
postData.push({
|
|
name: "gridData",
|
|
value: JSON.stringify(gridData)
|
|
});
|
|
|
|
postData.push({
|
|
name: "cmd",
|
|
value: "UPDATE"
|
|
});
|
|
|
|
$.ajax({
|
|
type: "POST",
|
|
url: url,
|
|
data: postData,
|
|
success: function (args) {
|
|
alert("<%= localeMessage.getString("common.saveMsg") %>");
|
|
goNav(returnUrl);//LIST로 이동
|
|
},
|
|
error: function (e) {
|
|
alert(e.responseText);
|
|
}
|
|
});
|
|
});
|
|
<%--$("#btn_delete").click(function () {--%>
|
|
|
|
<%-- if (confirm('<%=localeMessage.getString("common.confirmMsg")%>') != true)--%>
|
|
<%-- return;--%>
|
|
|
|
<%-- var postData = $('#ajaxForm').serializeArray();--%>
|
|
<%-- postData.push({--%>
|
|
<%-- name: "cmd",--%>
|
|
<%-- value: "DELETE"--%>
|
|
<%-- });--%>
|
|
<%-- $.ajax({--%>
|
|
<%-- type: "POST",--%>
|
|
<%-- url: url,--%>
|
|
<%-- data: postData,--%>
|
|
<%-- success: function (args) {--%>
|
|
<%-- alert("<%= localeMessage.getString("common.deleteMsg") %>");--%>
|
|
<%-- goNav(returnUrl);//LIST로 이동--%>
|
|
|
|
<%-- },--%>
|
|
<%-- error: function (e) {--%>
|
|
<%-- alert(e.responseText);--%>
|
|
<%-- }--%>
|
|
<%-- });--%>
|
|
|
|
<%--});--%>
|
|
|
|
$("#btn_previous").click(function () {
|
|
goNav(returnUrl);//LIST로 이동
|
|
});
|
|
$("#btn_pop_input").click(function () {
|
|
if (!isValidGrid()) {
|
|
return;
|
|
}
|
|
var data = new Object();
|
|
data["PRPTYNAME"] = $("input[name=prptyName]").val();
|
|
data["PRPTY2VAL"] = $("input[name=prpty2Val]").val();
|
|
data["PRPTYDESC"] = $("input[name=prptyDesc]").val();
|
|
|
|
var rows = $("#grid")[0].rows;
|
|
var index = Number($(rows[rows.length - 1]).attr("id"));
|
|
if (isNaN(index))
|
|
index = 0;
|
|
var rowid = index + 1;
|
|
$("#grid").jqGrid('addRow', {
|
|
rowID: rowid,
|
|
initdata: data,
|
|
position: "last", //first, last
|
|
useDefValues: false,
|
|
useFormatter: false,
|
|
addRowParams: {
|
|
extraparam: {}
|
|
}
|
|
});
|
|
$("#" + $('#grid').jqGrid('getGridParam', 'selrow')).focus();
|
|
$("button[name=img_" + rowid + "]").click(function () {
|
|
var name = $(this).attr("name");
|
|
var rowId = name.split("_")[1];
|
|
$('#grid').jqGrid('delRowData', rowId);
|
|
});
|
|
|
|
});
|
|
|
|
buttonControl(key);
|
|
titleControl(key);
|
|
});
|
|
</script>
|
|
</head>
|
|
<body>
|
|
<div class="right_box">
|
|
<div class="content_top">
|
|
<ul class="path">
|
|
<li><a href="#">${rmsMenuPath}</a></li>
|
|
</ul>
|
|
</div><!-- end content_top -->
|
|
<div class="content_middle" id="title">
|
|
<div class="search_wrap">
|
|
<%-- <button type="button" class="cssbtn" id="btn_delete" level="W" status="DETAIL">--%>
|
|
<%-- <i class="material-icons">delete</i> <%= localeMessage.getString("button.delete") %>--%>
|
|
<%-- </button>--%>
|
|
<button type="button" class="cssbtn" id="btn_modify" level="W" status="DETAIL,NEW">
|
|
<i class="material-icons">save</i> <%= localeMessage.getString("button.modify") %>
|
|
</button>
|
|
</div>
|
|
<div class="title"><%= localeMessage.getString("portalPropDetail.title") %>
|
|
</div>
|
|
|
|
<form id="ajaxForm">
|
|
<table class="table_row" cellspacing="0">
|
|
<tr>
|
|
<th style="width:180px;"><%= localeMessage.getString("property.propertyGroupName") %> *</th>
|
|
<td><input type="text" name="prptyGroupName"/>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<th><%= localeMessage.getString("property.propertyGroupDesc") %> *</th>
|
|
<td><input type="text" name="prptyGroupDesc"/>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</form>
|
|
|
|
<table class="table_row" cellspacing="0">
|
|
<tr>
|
|
<th style="width:180px;"><%= localeMessage.getString("propertyDetail.propertyKey") %>
|
|
</th>
|
|
<td>
|
|
<input type="text" name="prptyName" style="width:calc(100% - 70px);"/>
|
|
<button type="button" class="cssbtn smallBtn2" id="btn_pop_input"
|
|
style="vertical-align:middle; font-weight:bold;"><i
|
|
class="material-icons">input</i><%= localeMessage.getString("button.input") %>
|
|
</button>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<th><%= localeMessage.getString("propertyDetail.propertyValue") %>
|
|
</th>
|
|
<td colspan="3"><input type="text" name="prpty2Val"/>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<th>설명</th>
|
|
<td colspan="3"><input type="text" name="prptyDesc"/>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<!-- grid -->
|
|
<table id="grid"></table>
|
|
|
|
</div><!-- end content_middle -->
|
|
</div><!-- end right_box -->
|
|
</body>
|
|
</html> |