YNICTE/BO/Views/MM/PUs.cshtml

205 lines
12 KiB
Plaintext

@model NP.Model.VMMM
<header class="panel-heading bg-light" id="thistabbox">
<ul class="nav nav-tabs nav-justified">
<li class="@(Model.TabIdx == 0 ? "active" : "")"><a href="/CC/BHs" onclick="bglayer()" data-toggle="tabx">게시판관리</a></li>
<li class="@(Model.TabIdx == 1 ? "active" : "")"><a href="/MM/PUs" onclick="bglayer()" data-toggle="tabx">팝업관리</a></li>
<li class="@(Model.TabIdx == 2 ? "active" : "")"><a href="/MM/PGs" onclick="bglayer()" data-toggle="tabx">페이지관리</a></li>
</ul>
</header>
<form id="mform" method="post" action="/MM/PUs">
<div class="tar buttonbox"><a href="#" onclick="javascript:reg(0);" class="btn btn-s-xs btn-info" id="idid">등록</a></div>
<section class="panel panel-default">
<div class="table-responsive" id="excel1">
<table class="table table-striped b-t b-light" style="">
<thead>
<tr>
<th width="100">z좌표</th>
<th>제목</th>
<th>위치</th>
<th>공개여부</th>
<th>미리보기</th>
<th>수정일</th>
</tr>
</thead>
<tbody class="data" id="tbody1">
@foreach (var item in Model.Popups)
{
<tr>
<td>@item.ZIndex</td>
<td class="text-left"><a class="link" href="#" onclick="reg(@item.PNo)">@item.PTitle</a></td>
<td>@item.LeftPX x @item.TopPX</td>
<td>@(item.IsOpen == 1 ? "공개" : "비공개")</td>
<td><a style="font-size: 20px; font-weight: bold;" href="#" onclick="view(@item.PNo)"><i class="fa fa-eye"></i></a></td>
<td>@item.UDT1</td>
</tr>
}
</tbody>
</table>
</div>
</section>
@Html.HiddenFor(m => m.TabIdx)
</form>
<div style="position: fixed; display: none; border-radius: 10px; background-color: #fff; text-align: center; padding: 5px 10px;" class="draggable ui-widget-content" id="popbox">
<div id="popboxtop" style="height: 30px; line-height: 30px; cursor: pointer;">
<span id="poptitle" style="display: block; margin-right: 50px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;"></span>
<a href="#" class="btn btn-xxs btn-default f-r" style="margin-top: -25px;" onclick="bglayer(false); $('#popbox').hide();">X</a>
</div>
<iframe id="ifr01" style="border: 0 none;"></iframe>
<div id="popboxbot" style="height: 30px; line-height: 30px; font-weight: bold; text-align: right;"><a class="btn btn-xxs btn-primary" onclick="bglayer(false); $('#popbox').hide();"> 7일간 숨기기</a></div>
</div>
<div id="thisfindbox" class="findbox summernoteparentfixedbox" style="width: 700px; right: 10%; z-index: 1041; top: 0; bottom: 0; overflow: auto;">
<input type="hidden" id="rbno" />
<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><dt>제목</dt><dd><input type="text" class="form-control disp-init" style="width: 100%;" id="ptitle" maxlength="50" /></dd></dl>
<dl><dt>위치<span style="font-size: 10px;">(좌측x상단)</span></dt><dd><input type="text" class="form-control int disp-init text-center" id="leftpx" /> x <input type="text" class="form-control int disp-init text-center" id="toppx" /></dd></dl>
<dl><dt>위치<span style="font-size: 10px;">(z축)</span></dt><dd><select class="form-control disp-init" style="width: 100px;" id="zindex">@for(var i = 1;i<26;i++){<option value="@i">@i</option>}</select></dd></dl>
<dl><dt>크기<span style="font-size: 10px;">(너비x높이)</span></dt><dd><input type="text" class="form-control int disp-init text-center" id="pwidth" /> x <input type="text" class="form-control int disp-init text-center" id="pheight" /></dd></dl>
<dl><dt>공개</dt><dd>&nbsp;@Html.Partial("./Partial/Radio", null, new ViewDataDictionary() { { "valuetext", "1:공개;0:비공개" }, { "checked", 1 }, { "name", "isopen" } })</dd></dl>
<dl><dt>링크</dt><dd><input type="text" class="form-control disp-init" style="width: 100%;" id="purl" maxlength="50" placeholder="ex) 사이트내부: /Home/Index, 외부: http://www.daum.net" /></dd></dl>
<textarea name="pcontents" id="pcontents"></textarea>
<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>
</div>
<br />
</div>
@section styles{
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
@Html.Partial("./Partial/Summernotestyle")
<style type="text/css">
.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;}
/*.summernoteparentfixed{position: relative;left: 0 !important; top: 0 !important; width: 100%; height: 100%; min-height: 100%; max-width: 100%; overflow: visible !important;}*/
section.panel.panel-default{background-color: #fff;}
</style>
}
@section scriptsHeader{
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
@Html.Partial("./Partial/Summernote")
}
@section scripts{
<script>
$(document).ready(function () {
$("#popbox").draggable();
$("#thisfindbox").on("scroll", function () {
$("#savebox").css("position", "relative");
$("#botempty").hide();
if ($(this).scrollTop() < 10) {$("#savebox").css("position", "absolute");$("#botempty").show();}
});
bindCommaAll();
$('#pcontents').summernote({
height: 250,
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, "cbupload()");
}
}
});
});
function cbupload() {
if (_uploadeditorimagertn.Code == 1000) {
$(_uploadeditorimageitem).summernote('editor.insertImage', _uploadeditorimagertn.Obj.uri);
}
}
function reg(idx) {
_pno = idx;
$("#ptitle, #leftpx, #toppx, #zindex, #pwidth, #pheight, #purl,#pcontents").val("");
$("#isopen1").prop("checked", true);
$('#pcontents').summernote('code', "");
$("#pcap").text("팝업수정");
if (idx < 1) {
$("#pcap").text("팝업등록");
bglayer();
$("#thisfindbox").slideDown("fast", function () { $("#thisfindbox").scrollTop(0); $('#ptitle').focus(); });
}
else {
capp("/acommon/popup", { pno: idx }, "cbgetpopup");
}
}
function cbgetpopup() {
if (capResult.Code == 1000) {
$("#ptitle").val(capResultObj.PTitle);
$("#leftpx").val(capResultObj.LeftPX);
$("#toppx").val(capResultObj.TopPX);
$("#zindex").val(capResultObj.ZIndex);
$("#pwidth").val(capResultObj.PWidth);
$("#pheight").val(capResultObj.PHeight);
$("#isopen" + (capResultObj.IsOpen==1?1:2)).prop("checked", true);
$("#purl").val(capResultObj.PUrl);
$("#pcontents").val(capResultObj.PContents);
$('#pcontents').summernote('code', capResultObj.PContents);
$("#pcap").text("팝업수정");
setTimeout(function () {
bglayer();
$("#thisfindbox").slideDown("fast", function () { $("#thisfindbox").scrollTop(0); });
}, 10);
}
}
var _pno;
function save() {
var cdata = $('#pcontents').summernote('code');
cdata = cdata == "<p><br></p>" ? "" : cdata;
if (check("ptitle", null, "제목을 입력해주세요.", true)) { }
else if (getInt(val("zindex")) > 101) { focus("zindex"); msg2("위치(z축)은 100이하로 입력해주세요."); }
else if (cdata.length < 1) { $('#pcontents').summernote('focus'); msg2("내용을 입력해주세요."); }
else if (confirm("저장하시겠습니까?")) {
capp("/acommon/savepopup", { pno: _pno, ptitle: val("ptitle"), leftpx: getInt(val("leftpx")), toppx: getInt(val("toppx")), zindex: getInt(val("zindex")), pwidth: getInt(val("pwidth")), pheight: getInt(val("pheight")), isopen: $("#isopen1").prop("checked") ? 1 : 0, purl: val("purl"), pcontents: cdata }, "cbsave", null, null, true, true);
}
}
function cbsave() {
if (capResult.Code == 1000) {msg2("저장되었습니다.");$("#pcontents").val("");timesubmitauto();}
}
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);
}
}
function popclose() {
}
</script>
}