YNICTE/BO/Views/MM/banners.cshtml

231 lines
12 KiB
Plaintext
Raw Permalink Normal View History

2020-10-12 14:39:23 +09:00
@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">순서</th>
<th>제목</th>
<th>썸네일</th>
@*<th>위치</th>*@
<th>설명</th>
<th>링크</th>
<th>공개여부</th>
<th>수정일</th>
<th>수정</th>
</tr>
</thead>
<tbody class="data" id="tbody1">
@foreach (var item in Model.Banners)
{
<tr>
<td>@item.bseq</td>
<td class="text-left">@item.btitle</td>
<td><img class="imgpreview" src="@(Model.Files + item.fileurl)" alt="썸네일" /></td>
@*<td>@(item.ismain == 1 ? "온라인강의메인" : "마이페이지")</td>*@
<td>@item.bdesc</td>
<td>@item.burl</td>
<td>@(item.isopen == 1 ? "공개" : "비공개")</td>
<td>@item.udtymdhm</td>
<td class="link text-center"><a class="link" href="#" onclick="reg(@item.bno)">[수정]</a></td>
</tr>
}
</tbody>
</table>
</div>
</section>
</form>
<form id="bform" method="post" enctype="multipart/form-data">
<input type="hidden" name="bno" id="bno" />
<div id="thisfindbox" class="findbox summernoteparentfixedbox" style="width: 700px; right: 10%; z-index: 1041; top: 0; bottom: 0; overflow: auto;">
<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" name="btitle" class="form-control disp-init" style="width: 100%;" id="btitle" maxlength="100" /></dd></dl>
<dl>
<dt>이미지(1920*110)</dt>
<dd>
<input type="hidden" name="fgno" id="fgnono" />
<img class="imgpreview" id="fgnothumb" src="/img/common/profile_sample.jpg" />
<input type="file" name="fgnoimg" id="fgno" style="margin-left: 50px;" />
</dd>
</dl>
<dl>
<dt>모바일이미지(750*130)</dt>
<dd>
<input type="hidden" name="fgno2" id="fgnono2" />
<img class="imgpreview2" id="fgnothumb2" src="/img/common/profile_sample.jpg" />
<input type="file" name="fgnoimg2" id="fgno2" style="margin-left: 50px;" />
</dd>
</dl>
<dl><dt>설명</dt><dd><input type="text" name="bdesc" class="form-control disp-init" style="width: 100%;" id="bdesc" maxlength="100" /></dd></dl>
<dl><dt>링크</dt><dd><input type="text" name="burl" class="form-control disp-init" style="width: 100%;" id="burl" maxlength="100" /></dd></dl>
@*<dl><dt>위치</dt><dd>&nbsp;@Html.Partial("./Partial/Radio", null, new ViewDataDictionary() { { "valuetext", "1:온라인강의 메인;0:마이페이지" }, { "checked", 1 }, { "name", "ismain" } })</dd></dl>*@
<dl><dt>순서</dt><dd><input type="text" class="form-control disp-init int" style="width: 100%;" name="bseq" id="bseq" maxlength="2" /></dd></dl>
<dl><dt>공개</dt><dd>&nbsp;@Html.Partial("./Partial/Radio", null, new ViewDataDictionary() { { "valuetext", "1:공개;0:비공개" }, { "checked", 1 }, { "name", "isopen" } })</dd></dl>
<div class="text-center">
<a href="#" class="btn btn-info btnadmin" onclick="save()" id="btnsave">저장</a>
</div>
<br />
</div>
</form>
@section styles{
<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;}
.imgpreview,.imgpreview2{max-width: 30px; max-height: 30px; border-radius: 5px; float: left;}
.imgpreview.act,.imgpreview2.act{position: fixed; left: 10%; top: 10%; max-width: initial; max-height: initial;}
</style>
}
@section scriptsHeader{
}
@section scripts{
<script>
$(document).ready(function () {
$(".imgpreview,.imgpreview2").on("click", function () {
$(this).toggleClass("act");
});
$("#fgno").on("change", function (e) {
if ($(this).val() != "") {
$("#fgnothumb").attr("src", "/img/common/profile_sample.jpg");
var fname = $(this).val().toUpperCase();
var fext = fname.split('.')[fname.split('.').length - 1];
if (fext != "JPG" && fext != "GIF" && fext != "PNG") {
$(this).val("");
msg("이미지만 첨부해주세요.", 1);
}
else {
var files = e.target.files;
var filesArr = Array.prototype.slice.call(files);
var fitem = $(this);
filesArr.forEach(function (f) {
if (!f.type.match("image.*")) {
return;
}
sel_file = f;
var reader = new FileReader();
reader.onload = function (e) {
$("#fgnothumb").attr("src", e.target.result);
}
reader.readAsDataURL(f);
});
}
}
});
$("#fgno2").on("change", function (e) {
if ($(this).val() != "") {
$("#fgnothumb2").attr("src", "/img/common/profile_sample.jpg");
var fname = $(this).val().toUpperCase();
var fext = fname.split('.')[fname.split('.').length - 1];
if (fext != "JPG" && fext != "GIF" && fext != "PNG") {
$(this).val("");
msg("이미지만 첨부해주세요.", 1);
}
else {
var files = e.target.files;
var filesArr = Array.prototype.slice.call(files);
var fitem = $(this);
filesArr.forEach(function (f) {
if (!f.type.match("image.*")) {
return;
}
sel_file = f;
var reader = new FileReader();
reader.onload = function (e) {
$("#fgnothumb2").attr("src", e.target.result);
}
reader.readAsDataURL(f);
});
}
}
});
});
function reg(idx) {
setv("bno", idx);
$("#btitle,#fgno,#fgno2,#bdesc,#burl,#bseq,#fgnono,#fgnono2").val("");
$("#isopen1").prop("checked", true);
//$("#isopen1,#ismain1").prop("checked", true);
$("#fgnothumb").attr("src", "/img/common/profile_sample.jpg");
$("#fgnothumb2").attr("src", "/img/common/profile_sample.jpg");
$("#pcap").text("배너수정");
if (idx < 1) {
$("#pcap").text("배너등록");
bglayer();
$("#thisfindbox").slideDown("fast", function () { $("#thisfindbox").scrollTop(0); $('#btitle').focus(); });
}
else {
capp("/acommon/banner", { bno: idx }, "cbget");
}
}
function cbget() {
if (capResult.code == 1000) {
var d = capResult.obj;
$("#btitle").val(d.btitle);
setv("fgnono", getdb(d.fgno));
setv("fgnono2", getdb(d.fgno2));
$("#fgnothumb").attr("src", "@(Model.Files)" + d.fileurl);
$("#fgnothumb2").attr("src", "@(Model.Files)" + d.fileurl2);
$("#bdesc").val(d.bdesc);
$("#burl").val(d.burl);
//$("#ismain" + d.ismain).prop("checked", true);
$("#bseq").val(d.bseq);
$("#isopen" + d.isopen).prop("checked", true);
$("#pcap").text("배너수정");
setTimeout(function () {
bglayer();
$("#thisfindbox").slideDown("fast", function () { $("#thisfindbox").scrollTop(0); });
}, 10);
}
}
function save() {
if (check("btitle", null, "제목을 입력해주세요.", true)) { }
else if ($("#fgnothumb").attr("src").toUpperCase() == "/IMG/COMMON/PROFILE_SAMPLE.JPG" && check("fgnothumb", null, "이미지를 등록해주세요.", true)) { }
else if ($("#fgnothumb2").attr("src").toUpperCase() == "/IMG/COMMON/PROFILE_SAMPLE.JPG" && check("fgnothumb2", null, "모바일이미지를 등록해주세요.", true)) { }
else if (check("bseq", null, "순서를 입력해주세요.", true)) { }
else if (confirm("저장하시겠습니까?")) {
capfileform("/acommon/savebanner", "bform", "cbsave", null, null, true, true, true);
}
}
function cbsave() {
if (capResult.code == 1000) { msg2("저장되었습니다.", null, null, null, true); 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 + "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);
}
}
</script>
}