YNICTE/BO/Views/MM/pages.cshtml

355 lines
18 KiB
Plaintext

@model NP.Model.VMMM
<div class="tar buttonbox"><a href="#" onclick="javascript:reg(0, 0, '', '-');" class="btn btn-s-xs btn-info" id="idid">Top메뉴추가</a></div>
<section class="panel panel-default">
<header class="panel-heading font-bold">메뉴 트리</header>
<div class="panel-body" id="treebox" style="overflow-y: auto;">
<div style="">
<ul class="box" id="menutree" style="list-style: none; padding-left: 20px;">
@foreach (var m in Model.MenuPages)
{
var hasChild = Model.MenuPages.Where(w => w.ppno == m.pno).Count() > 0;
<li data-id="@m.pno" data-pid="@m.ppno" data-porder="@m.porder" class="pno@(m.pno) @(Model.intval == m.pno ?"focusli":"") ppno@(m.ppno) depth@(m.pdepth) @(m.pdepth > 0 ? "draggable" : "") @(hasChild ? "isparent" : "") mg-l-@(m.pdepth) opened" style="@(m.pdepth == 0 ?"border-top: 1px solid #ddd;padding-top: 15px; padding-bottom: 5px;":"")">
<a href="#" class="navicon"><span class="glyphicon glyphicon-@(hasChild ? "asterisk":"asterisk")"></span></a>
<a href="#" class="naviname" onclick="reg(@m.pno, @m.pdepth, '@(m.ppno==null?"":m.ppno.ToString())', '@(m.ppagename??"-")', this);">@m.pagename (@(m.pagedesc ?? "-"))</a>
<a href="#" class="btn btn-xxs btn-info btn-child" onclick="reg(0, @(m.pdepth+1), @m.pno, '@m.pagename', this);" style="margin-left: 10px;">하위메뉴추가</a>
</li>
if (m.pdepth > 0)
{
@:
<li class="drop-desc drop-bottom">&nbsp;</li>
}
}
</ul>
</div>
</div>
</section>
<form id="mform" method="post">
@Html.HiddenFor(m => m.intval)
</form>
<div id="thisfindbox" class="findbox summernoteparentfixedbox" style="right: 50px; z-index: 1041; top: 0; bottom: 0; overflow: auto; left: 100px;">
<input type="hidden" id="pno" />
<input type="hidden" id="ppno" />
<input type="hidden" id="pdepth" />
<h4><i class="fa fa-bars"></i> <span id="pcap">페이지등록수정</span><a href="#" class="btn btn-default btn-xs f-r" onclick="$('#thisfindbox').slideUp('fast'); $('#bglayer').hide();">닫기</a></h4>
<dl id="ppagebox"><dt>상위메뉴</dt><dd>&nbsp;<label id="ppagename" style="color: #0094ff; font-weight: bold;">-</label></dd></dl>
<dl><dt>페이지유형</dt><dd>&nbsp;@Html.Partial("./Partial/Radio", null, new ViewDataDictionary() { { "valuetext", "0:폴더메뉴;1:HTML페이지;2:DB페이지;3:게시판;4:고객사마이페이지공지사항;5:스크립트" }, { "name", "pagetype" } })</dd></dl>
<dl id="boarddl"><dt>게시판</dt><dd>@Html.Partial("./Partial/Select", Model.BMs, new ViewDataDictionary { { "special", "reg" }, { "name", "bmno" }, { "selected", "" }, { "df", ":-게시판선택" }, { "class", "disp-init" } })</dd></dl>
<dl><dt>메뉴순서</dt><dd><input type="text" class="form-control disp-init int text-center" style="width: 100px;height: auto;" id="porder" maxlength="50" /></dd></dl>
<dl><dt>페이지이름</dt><dd><input type="text" class="form-control disp-init" id="pagename" maxlength="50" style="width: 100%; height: auto;" /></dd></dl>
<dl><dt>페이지설명</dt><dd><input type="text" class="form-control disp-init" id="pagedesc" maxlength="50" style="width: 100%; height: auto;" /></dd></dl>
<dl><dt>페이지URL</dt><dd><input type="text" class="form-control disp-init" id="pageurl" maxlength="50" style="width: 100%; height: auto;" /></dd></dl>
<dl><dt>페이지상태</dt><dd>&nbsp;@Html.Partial("./Partial/Radio", null, new ViewDataDictionary() { { "valuetext", "1:보임;3:탭메뉴;5:탭하위;6:하위숨김;4:팝업;2:GNB숨김;0:숨김" }, { "name", "isopen" } })</dd></dl>
<dl><dt>메뉴권한</dt><dd>&nbsp;@Html.Partial("./Partial/Radio", null, new ViewDataDictionary() { { "valuetext", "0:전체;1:수강생" }, { "name", "usertype" } })</dd></dl>
<dl><dt>참조코드</dt><dd><input type="text" class="form-control disp-init" id="refcode" maxlength="25" style="width: 100%; height: auto;" /></dd></dl>
<dl><dt>이미지참조코드</dt><dd><input type="text" class="form-control disp-init" id="imagecode" maxlength="50" style="width: 100%; height: auto;" /></dd></dl>
<dl><dt>배경타이틀</dt><dd><input type="text" class="form-control disp-init" id="bgtitle" maxlength="100" style="width: 100%; height: auto;" /></dd></dl>
<dl><dt>배경설명</dt><dd><input type="text" class="form-control disp-init" id="bgdesc" maxlength="1000" style="width: 100%; height: auto;" /></dd></dl>
<div id="wrap" style="padding-top: 0;">
<div class="container" id="subPage" style="padding-bottom: 0; max-width: initial;">
<textarea name="pagehtml" id="pagehtml"></textarea>
</div>
</div>
<div style="height: 60px;" id="botempty">&nbsp;</div>
<div class="text-center" style="position: absolute; bottom: 0; text-align: center; width: 100%; background-color: #41586e; left: 0; padding: 10px 0;" id="savebox">
<a href="#" class="btn btn-info btnadmin" onclick="save()" id="btnsave">저장</a>
&nbsp;&nbsp;
<a href="#" class="btn btn-default btnadmin" onclick="$('#thisfindbox').slideUp('fast'); $('#bglayer').hide();">닫기</a>
</div>
<br />
</div>
@section styles{
@Html.Partial("./Partial/Summernotestyle")
<style type="text/css">
#wrap table tr td {
text-align: left;
overflow: visible;
}
#wrap .note-editable table tr th, table.viewtable tr td {
overflow: visible;
}
.findbox dl {
margin-bottom: 2px;
}
.findbox dl dt, .findbox dl dd {
height: 32px;
line-height: 32px;
}
.findbox dl dt {
float: left;
width: 100px;
background-color: #ddd;
text-align: center;
}
.findbox dl dd {
margin-left: 102px;
}
#menutree li {
line-height: 25px;
}
#menutree li:hover {
background-color: #ddd;
}
.btn-child {
background-color: #fff;
color: #555 !important;
}
section.panel.panel-default {
background-color: #fff;
}
.findbox .note-image-url.form-control {
width: 100%;
height: 30px;
}
.focusli {
color: red;
}
</style>
<link rel="stylesheet" type="text/css" href="/css/www/common.css">
<link rel="stylesheet" type="text/css" href="/css/www/style.css">
<link rel="stylesheet" type="text/css" href="/css/www/slick.css">
<link rel="stylesheet" type="text/css" href="/css/www/animate.min.css">
<style type="text/css">
#nav ul.nav li a span {
color: #adbece;
font-size: 12px;
font-family: AppleSDGothicNeo-Regular,'Malgun Gothic','맑은 고딕',dotum,'돋움',sans-serif;
letter-spacing: initial;
}
#nav ul.nav li.active a span {
color: #adbece
}
#nav ul.nav li.active li.active a span {
color: #ffc333
}
#nav .nav > li > a i {
color: #adbece
}
</style>
}
@section scriptsHeader{
@Html.Partial("./Partial/Summernote")
@*<script charset="UTF-8" class="daum_roughmap_loader_script" src="https://ssl.daumcdn.net/dmaps/map_js_init/roughmapLoader.js"></script>*@
}
@section scripts{
<script>
$(document).ready(function () {
if ('@(Model.intval)' != '0' && $("li.pno@(Model.intval)").length > 0) {
$("li.pno@(Model.intval)")[0].scrollIntoView();
}
$("#thisfindbox").on("scroll", function () {
$("#savebox").css("position", "relative");
$("#botempty").hide();
if ($(this).scrollTop() < 10) {$("#savebox").css("position", "absolute");$("#botempty").show();}
});
$('#pagehtml').summernote({
height: 400,
tabsize: 2,
callbacks: {
onImageUpload: function (files, editor, welEditable) {
var fdata = new FormData();
fdata.append('img', files[0]);
fdata.append('fd', "Editor");
uploadeditorimage(files, this, fdata, "cbeditorupload()");
}
}
});
$("input[name=pagetype]").on("change", function () {
$("#pageurl").val("");
$('#pagehtml').summernote('code', "");
$("#pageurl").attr("readonly", "readonly");
$("div.note-editor.note-frame").hide();
$("#bmno").val("");
$("#boarddl").hide();
if ($(this).val() == "1") {
//$("div.note-editor.note-frame").show();
resetsummernote();
}
else if ($(this).val() == "2" || $(this).val() == "4" || $(this).val() == "5") {
$("#pageurl").removeAttr("readonly");
}
else if ($(this).val() == "3") {
$("#boarddl").show();
}
});
});
function resetsummernote() {
if (getrv("pagetype") == "1") {
var cdata = $('#pagehtml').summernote('code');
$('#pagehtml').summernote("destroy");
$('#pagehtml').summernote({
height: 400,
tabsize: 2,
callbacks: {
onImageUpload: function (files, editor, welEditable) {
var fdata = new FormData();
fdata.append('img', files[0]);
fdata.append('fd', "Editor");
uploadeditorimage(files, this, fdata, "cbeditorupload()");
}
}
});
$('#pagehtml').summernote('code', cdata);
}
}
function reg(idx, depth, ppno, ppname, a) {
a = a || "";
if (a != "") {
$(".focusli").removeClass("focusli");
$(a).closest("li").addClass("focusli");
}
ppname = ppname || "-";
$("#boarddl").hide();
setv("bmno", "");
$("#bmno").val("");
$("#pcap").text("페이지등록");
$("#pno").val(idx);
$("#ppno").val(ppno);
$("#pdepth").val(depth);
$("#pagetype0").prop("checked", true);
$("#pagename,#pagedesc,#pageurl, #refcode, #imagecode, #bgtitle, #bgdesc").val("");
$("#isopen1").prop("checked", true);
$("#usertype0").prop("checked", true);
$('#pagehtml').summernote('code', "");
$("#pageurl").attr("readonly", "readonly");
$("div.note-editor.note-frame").hide();
if (depth < 1) {
$("#ppagename").text(ppname);
}
if (idx < 1) {
$("#ppagename").text(ppname);
var porder = 1;
if (ppno == "") {
$.each($("#menutree li.depth" + depth), function (i, c) {
if (porder <= getint($(c).attr("data-porder"))) {
porder = getint($(c).attr("data-porder")) + 1;
}
});
}
else {
$.each($("#menutree li.ppno" + ppno), function (i, c) {
if (porder <= getint($(c).attr("data-porder"))) {
porder = getint($(c).attr("data-porder")) + 1;
}
});
}
$("#porder").val(porder);
bglayer();
$("#thisfindbox").slideDown("fast", function () { $("#thisfindbox").scrollTop(0); $('#pagename').focus(); });
}
else {
$("#pcap").text("페이지수정");
$("#ppagename").text(ppname);
capp("/acommon/menupage", { pno: idx }, "cbgetmenupage", null, null, true, true);
}
}
function cbgetmenupage() {
if (capResult.code == 1000) {
setrv("pagetype", capResultObj.pagetype);
if (capResultObj.pagetype == 3) {
$("#boarddl").show();
setv("bmno", capResultObj.bmno);
}
setv("porder", capResultObj.porder);
setv("pagename", capResultObj.pagename);
setv("pagedesc", capResultObj.pagedesc);
setv("refcode", capResultObj.refcode);
setv("imagecode", capResultObj.imagecode);
setv("bgtitle", capResultObj.bgtitle2);
setv("bgdesc", capResultObj.bgdesc2);
setv("pageurl", capResultObj.pageurl);
setrv("isopen", capResultObj.isopen);
setrv("usertype", capResultObj.usertype);
$('#pagehtml').summernote('code', capResultObj.pagehtml);
$("#pageurl").attr("readonly", "readonly");
$("div.note-editor.note-frame").hide();
if (capResultObj.pagetype == 1) {
$("div.note-editor.note-frame").show();
}
else if (capResultObj.pagetype == 2 || capResultObj.pagetype == 4 || capResultObj.pagetype == 5) {
$("#pageurl").removeAttr("readonly");
}
setTimeout(function () {
bglayer();
$("#thisfindbox").slideDown("fast", function () { $("#thisfindbox").scrollTop(0); $('#pagename').focus(); });
}, 10);
}
}
function save() {
var cdata = $('#pagehtml').summernote('code');
cdata = cdata == "<p><br></p>" ? "" : cdata;
if (check("pagename", null, "페이지이름을 입력해주세요.", true)) { }
else if (($("input[name='pagetype']:checked").val() == "2" || $("input[name='pagetype']:checked").val() == "4" || $("input[name='pagetype']:checked").val() == "5") && check("pageurl", null, "페이지URL을 입력해주세요.", true)) { }
else if ($("#pagetype1").prop("checked") && cdata.length < 1) { $('#pagehtml').summernote('focus'); msg2("html을 입력해주세요."); }
else if (confirm("저장하시겠습니까?")) {
capp("/acommon/savemenupage", {
pno : val("pno"),ppno : val("ppno"),pdepth: val("pdepth"),
pagetype: getrv("pagetype"),
bmno: val("bmno"),porder: val("porder"),
pagename: val("pagename"), pagedesc: val("pagedesc"), pageurl: val("pageurl"), pagehtml: cdata, isopen: getrv("isopen"), refcode: val("refcode"), imagecode: val("imagecode"), bgtitle: val("bgtitle"), bgdesc: val("bgdesc"),
usertype: getrv("usertype")
}, "cbsave", null, null, true, true);
}
}
function cbsave() {
if (capResult.code == 1000) { msg2("저장되었습니다.", null, null, null, true); $("#pagehtml").val(""); setv("IntVal", val("pno")); submit("mform", 500); }
else { msgadmin2(); }
}
function view(pno) {
_pno = pno;
capp("/acommon/popup", { pno: pno }, "cbview");
}
var _cro;
function cbview() {
if (capResult.code == 1000) {
_cro = capResult.obj;
setTimeout(function () {
$("#poptitle").text(_cro.ptitle);
$("#ifr01").css("height", _cro.pheight + "px");
$("#popbox").css({
"width": (_cro.pwidth + 20) + "px",
"height": (_cro.pheight + 80) + "px",
"left": _cro.leftpx + "px",
"top": _cro.toppx + "px",
"z-index": 10000 + _cro.zindex
});
var doc = $("#ifr01")[0].contentWindow.document;
doc.open();
doc.write("<head><meta http-equiv='Content-Type' content='text/html;charset=utf-8' />" +
"<script>function pf(){parent.hppopclick('" + getdb(_cro.purl) + "'); }<\/script><\/head>" +
"<body onclick='javascript:pf();' style='margin: 0;'>" + _cro.pcontents + "<\/body>");
doc.close();
bglayer();
$("#popbox").show();
//$(r).html(phs[i].toString());
//document.getElementById('iframe1').contentWindow.document.write("<html><body>Hello world</body></html>");
//$(r)[0].contentWindow.document.write("<html><body>Hello world</body></html>");
//$(r)[0].contentWindow.document.write(phs[i].toString());
}, 10);
}
}
function hppopclick(url) {
url = url.toLowerCase().replace('http//', 'http://').replace('https//', 'https://');
if (url.toLowerCase().indexOf("http://") == 0 || url.toLowerCase().indexOf("http://") == 0) {
window.open(url);
}
else if (url != "") {
window.open("@(Model.stringval)/"+url);
}
}
</script>
}