Files
cm-web-legacy/application/views/admin/life/life_channel_reg.php
2020-06-10 06:19:03 +09:00

235 lines
7.1 KiB
PHP
Executable File

<?php
$category_idx = $search_category;
$channel_name = '';
$channel_intro = '';
$channel_icon = '';
$main_img = '';
if($mode=='edit') {
$category_idx = $result[0]['category_idx'];
$channel_name = $result[0]['channel_name'];
$channel_intro = $result[0]['channel_intro'];
$channel_intro = htmlspecialchars($channel_intro);
$channel_icon = $result[0]['channel_icon'];
$main_img = $result[0]['main_img'];
}
$menu_code = '52';
require_once (APPPATH.'views/skin/admin/_content_comm.php');
?>
<link href="/css/admin/multi-select.css" media="screen" rel="stylesheet" type="text/css">
<script src="/js/admin/jquery.multi-select.js" type="text/javascript"></script>
<script src="/js/admin/jquery.quicksearch.js" type="text/javascript"></script>
<form name="input_form" id="input_form" method="post" action="/admin/life/life_channel_reg_proc" enctype="multipart/form-data">
<input type="hidden" id="mode" name="mode" value="<?=$mode?>">
<input type="hidden" id="idx" name="idx" value="<?=$idx?>">
<input type="hidden" id="editor_count" name="editor_count" value="<?=$editor_count?>">
<input type="hidden" id="editor_val" name="editor_val" value="">
<div class="common_table news">
<table>
<tr>
<th>카테고리</th>
<td class="tl">
<select name="category_idx" id="category_idx">
<option value="">선택</option>
<? foreach($category_list as $val) {?>
<option value="<?=$val['idx']?>" <? if($category_idx==$val['idx']) { echo 'selected'; }?>><?=$val['category_name']?></option>
<? }?>
</select>
</td>
</tr>
<tr>
<th>채널명</th>
<td class="tl"><input type="text" name="channel_name" id="channel_name" class="type01" size="100" value="<?=$channel_name?>"></td>
</tr>
<tr>
<th>한줄소개</th>
<td class="tl"><input type="text" name="channel_intro" id="channel_intro" class="input00" size="100" value="<?=$channel_intro?>"></td>
</tr>
<tr>
<th>체널아이콘</th>
<td class="tl">
<button type="button" class="btn_black" style="width:100px" onclick="view_channel_icon();" style="cursor: pointer;">선택하기</button>
<input type="hidden" name="channel_icon" id="channel_icon" value="<?=$channel_icon?>">
<div id="icon_img">
<? if($channel_icon!='') { ?>
<img src="<?=$channel_icon?>" width="100px">
<? } ?>
</div>
</td>
</tr>
<tr>
<th>대문이미지</th>
<td class="tl">
<? if($main_img!='') { ?>
<input type="checkbox" name="is_del_main_img" value="Y">삭제
<input type="hidden" name="org_main_img" value="<?=$main_img?>">
<img src="<?=$main_img?>" width="100px"></br>
<? } ?>
<input type="file" name="main_img" id="main_img" class="input00">
</td>
</tr>
<tr>
<th>에디터등록</th>
<td class="tl">
<div style="border:solid 0px #5362a4;width:45%;float:left;">
<select multiple="multiple" id="editor" name="editor[]">
<? foreach($editor_all_list as $val) {?>
<option value="<?=$val['idx']?>"><?=$val['partner_name']?>(<?=$val['partner_id']?>)</option>
<? }?>
<? foreach($channel_editor_list as $val) {?>
<option value="<?=$val['idx']?>" selected><?=$val['partner_name']?>(<?=$val['partner_id']?>)</option>
<? }?>
</select>
</div>
</td>
</tr>
</table>
</div>
<div class="write_btn tc">
<a href="javascript:channel_reg_proc();">저장하기</a>
<a href="/admin/life/life_channel_list/5/<?=$page?>?search_type=<?=$search_type?>&search_keyword=<?=$search_keyword?>&search_category=<?=$search_category?>">목록으로</a>
</div>
<div id="icon_reg_layer" style="display:none">
<div class="black_board" style="display:block"></div>
<div class="pop_con common_table moving_all" style="display:block;top:100px;">
<a href="javascript:commonLayerClose('icon_reg_layer')" class="pop_close">x</a>
<h2>채널아이콘</h2>
<table>
<tr>
<th>아이콘선택</th>
<td class="tl">
<div class="icon_list" style="overflow-y: scroll; height:150px;">
<? foreach ($channel_icon_list as $val) {?>
<a href="#;" class="por">
<input type="radio" name="sel_channel_icon" id="sel_channel_icon" class="stebox" value="<?=$val['channel_icon']?>">
<img src="<?=$val['channel_icon']?>" alt=""/>
</a>
<? }?>
</div>
</td>
</tr>
</table>
<div class="write_btn tc">
<a href="javascript:select_channel_icon('add')">적용하기</a>
<a href="javascript:commonLayerClose('icon_reg_layer')">취소하기</a>
</div>
</div>
</div>
</form>
<script type="text/javascript">
var editor_num = new Array();
$('#editor').multiSelect({
selectableHeader: "<input type='text' class='search-input' autocomplete='off' placeholder='이름 or 아이디' style='padding: 10px;margin-left: 5px; width:280px;'>",
selectionHeader: "<div style='height:37px;text-align:right;width:280px'>에디터: <span id='edit_count_txt'><?=number_format($editor_count)?></span>, 등록글수: <?=number_format($article_count)?></div>",
afterInit: function(ms){
var that = this,
$selectableSearch = that.$selectableUl.prev(),
selectableSearchString = '#'+that.$container.attr('id')+' .ms-elem-selectable:not(.ms-selected)';
that.qs1 = $selectableSearch.quicksearch(selectableSearchString)
.on('keydown', function(e){
if (e.which === 40){
that.$selectableUl.focus();
return false;
}
});
},
afterSelect: function(e){
this.qs1.cache();
var new_editor_count = parseInt($("#editor_count").val())+1;
$("#editor_count").val(new_editor_count);
$("#edit_count_txt").html(new_editor_count);
$('#editor').find('option[value="'+e[0]+'"]').prop('selected', true);
},
afterDeselect: function(e){
this.qs1.cache();
var new_editor_count = parseInt($("#editor_count").val())-1;
$("#editor_count").val(new_editor_count);
$("#edit_count_txt").html(new_editor_count);
$('#editor').find('option[value="'+e[0]+'"]').prop('selected', false);
}
});
// 아이콘 보기
function view_channel_icon(){
commonLayerOpen('icon_reg_layer')
}
// 아이콘 적용
function select_channel_icon(){
var channel_icon = $("input[type=radio][id=sel_channel_icon]:checked").val();
$("#channel_icon").val(channel_icon);
$("#icon_img").empty();
$("#icon_img").html('<img src="'+channel_icon+'" width="40">');
commonLayerClose('icon_reg_layer')
}
// 채널추가
function channel_reg_proc(){
if($("#category_idx").val()=='') {
alert("카테고리를 선택해주세요.");
return false;
}
if($("#channel_name").val()=='') {
alert("채널명을 등록해주세요.");
return false;
}
$('.ms-selection').find('.ms-list').find('li.ms-selected span').each(function(e, val){
$('#editor option').each(function(i, v){
if($(v).text() == $(val).text()) {
editor_num[e] = $(v).val();
}
});
});
$('#editor_val').val(editor_num.join(','));
$("#input_form").submit();
}
$(".icon_list a").click(function(){
$(".icon_list a").removeClass("on");
$(this).addClass("on");
});
</script>