YNICTE/BO/Views/MM/popups.cshtml

189 lines
11 KiB
Plaintext

@model NP.Model.VMMM
<form id="mform" method="post">
<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="link 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.udtymdhm</td>
</tr>
}
</tbody>
</table>
</div>
</section>
</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: auto; 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="2048" 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 href="~/css/jquery-ui-1.12.1/jquery-ui.min.css" rel="stylesheet" />
@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="~/js/jquery-ui.min.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, "cbeditorupload()");
}
}
});
});
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:0)).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("저장되었습니다.", null, null, null, true); $("#pcontents").val(""); submit("mform", 500);}
}
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 + 37 + "px");
$("#ifr01").css("width", _cro.pwidth + "px");
$("#popbox").css({
"width": (_cro.pwidth + 50) + "px",
"height": (_cro.pheight + 80 + 37) + "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();
}, 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>
}