first commit
This commit is contained in:
408
application/views/admin/etc_section/weather_reg.php
Executable file
408
application/views/admin/etc_section/weather_reg.php
Executable file
@@ -0,0 +1,408 @@
|
||||
<?php
|
||||
include_once ("./static_data/continent.php");
|
||||
|
||||
if($mode=='edit') {
|
||||
$continent = $result['continent'];
|
||||
$country = $result['country'];
|
||||
$weather_icon = $result['weather_icon'];
|
||||
$weather_content = $result['weather_content'];
|
||||
$weather_content = htmlspecialchars($weather_content);
|
||||
$reg_date = $result['reg_date'];
|
||||
$display_status = $result['display_status'];
|
||||
$display_date = $result['display_date'];
|
||||
$tag = $result['tag'];
|
||||
$tag = str_replace(" ", ",", $tag);
|
||||
$is_auto_setting = $result['is_auto_setting'];
|
||||
$rank = $result['rank'];
|
||||
|
||||
$continent_key_tmp = array_keys($arr_continent1, $continent);
|
||||
$continent_key = $continent_key_tmp[0];
|
||||
} else {
|
||||
$continent = '';
|
||||
$country = '';
|
||||
$weather_icon = '';
|
||||
$weather_content = '';
|
||||
$display_status = '';
|
||||
$display_date = date("Y-m-d");
|
||||
$tag = '';
|
||||
$is_auto_setting = 'Y';
|
||||
$rank = '';
|
||||
$arr_relation_article = array();
|
||||
}
|
||||
|
||||
|
||||
$menu_code = '65';
|
||||
require_once (APPPATH.'views/skin/admin/_content_comm.php');
|
||||
?>
|
||||
|
||||
|
||||
<link rel="stylesheet" href="<?=DIR_CSS?>/jquery-ui.min.css" />
|
||||
<script src="<?=DIR_JS?>/jquery-ui.min.js"></script>
|
||||
|
||||
<form name="input_form" id="input_form" action="/admin/etc_section/weather_reg_proc" method="post">
|
||||
<input type="hidden" name="idx" id="idx" value="<?=$idx?>">
|
||||
<input type="hidden" id="search_type" name="search_type" value="<?=$search_type?>">
|
||||
<input type="hidden" id="search_keyword" name="search_keyword" value="<?=$search_keyword?>">
|
||||
<input type="hidden" id="search_display_status" name="search_display_status" value="<?=$search_display_status?>">
|
||||
<input type="hidden" id="mode" name="mode" value="<?=$mode?>">
|
||||
<input type="hidden" id="page" name="page" value="<?=$page?>">
|
||||
<input type="hidden" id="key" name="key">
|
||||
|
||||
|
||||
<div class="common_table news">
|
||||
<h2 class="subtitle">영적기상도 등록</h2>
|
||||
<table>
|
||||
<tr>
|
||||
<th>대륙</th>
|
||||
<td class="tl">
|
||||
<select name="continent" id="continent" onchange="change_continent(this.value)">
|
||||
<option value="">선택</option>
|
||||
<? foreach ($arr_continent1 as $key=>$val) {?>
|
||||
<option value="<?=$key?>" <? if($continent==$val) { echo 'selected';}?>><?=$val?></option>
|
||||
|
||||
<? }?>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>나라</th>
|
||||
<td class="tl">
|
||||
<select name="country" id="country">
|
||||
<option value="">선택</option>
|
||||
<? if(isset($arr_continent2[$continent_key])==true) {
|
||||
foreach ($arr_continent2[$continent_key] as $val) {
|
||||
?>
|
||||
<option value="<?=$val?>" <? if($country==$val) { echo 'selected';}?>><?=$val?></option>
|
||||
<? }
|
||||
|
||||
}?>
|
||||
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>날씨아이콘</th>
|
||||
<td class="tl">
|
||||
<button type="button" class="btn_black" style="width:100px" onclick="view_icon();" style="cursor: pointer;">선택하기</button>
|
||||
<input type="hidden" name="weather_icon" id="weather_icon" value="<?=$weather_icon?>">
|
||||
<div id="icon_img">
|
||||
<? if($weather_icon!='') { ?>
|
||||
<img src="<?=$weather_icon?>" width="50px">
|
||||
<? } ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>날씨코멘트</th>
|
||||
<td class="tl">
|
||||
<input type="text" name="weather_content" id="weather_content" value="<?=$weather_content?>">
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>순위</th>
|
||||
<td class="tl">
|
||||
<select name="rank" id="rank">
|
||||
<option value="">선택</option>
|
||||
<? for ($i=1; $i<=10; $i++) {?>
|
||||
<option value="<?=$i?>" <? if($rank==$i) { echo 'selected';}?>><?=$i?>위</option>
|
||||
<? }?>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>등록일시</th>
|
||||
<td class="tl">
|
||||
<? if($mode=='add' || $display_status == '0') {?>
|
||||
<input type="text" name="display_date" id="display_date" value="<?=$display_date?>" class="type02" size="10">
|
||||
<?
|
||||
} else {
|
||||
?>
|
||||
<?=$reg_date?>
|
||||
|
||||
<?}?>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>태그</th>
|
||||
<td class="tl">
|
||||
<input type="text" name="tag" id="tag" class="type01" value="<?=$tag?>"> 최대 5개까지 입력 가능(,로 구분해주세요.)
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>관련뉴스</th>
|
||||
<td class="tl">
|
||||
<input type="radio" name="is_auto_setting" id="is_auto_setting" onclick="click_relation_news_auto_setting('Y');" value="Y" <? if($is_auto_setting=='Y') { echo 'checked';}?>> 자동설정
|
||||
<input type="radio" name="is_auto_setting" id="is_auto_setting" onclick="click_relation_news_auto_setting('N');" value="N" <? if($is_auto_setting=='N') { echo 'checked';}?>> 수정설정
|
||||
<div class="two_box_type01 clearfix" id="no_auto_setting_content" style="display:none; margin-top:10px;">
|
||||
<div class="con">
|
||||
<div class="searh_area fn mb10">
|
||||
<input type="text" name="article_keyword" id="article_keyword" class="input00" size="20" placeholder="검색어 입력" onkeypress="if( event.keyCode==13 ){search_article();}">
|
||||
<a href="javascript:search_article();" class="btn"><i class="fa moving_all fa-search" style="margin-left:8px;"></i></a>
|
||||
</div>
|
||||
<div class="mb10">
|
||||
<input type="radio" name="article_sort" id="article_sort" value="1" onclick="search_article();" checked> 최신순
|
||||
<input type="radio" name="article_sort" id="article_sort" value="2" onclick="search_article();"> 오래된순
|
||||
|
||||
검색결과 <span class="mark" id="result_count">0</span>건
|
||||
</div>
|
||||
<div class="list scs">
|
||||
<ul id="result">
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="con">
|
||||
<h3 class="mb10">선택된 뉴스 항목</h3>
|
||||
<div class="list type02 scs">
|
||||
<ul id="selected_news">
|
||||
<? $i=1;
|
||||
foreach ($arr_relation_article as $val) { ?>
|
||||
<li><input type="checkbox" name="relation_idxs[]" id="relation_idx_<?=$i?>" value="<?=$val['relation_article_idx']?>" onclick="delete_article('<?=$i?>');" checked><a href="/web/news/news_view/<?=$val['relation_article_idx']?>" target="_blank"><?=$val['title']?></a></li>
|
||||
<?
|
||||
$i++;
|
||||
} ?>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
|
||||
</table>
|
||||
</div>
|
||||
<div class="write_btn tc">
|
||||
<a href="javascript:weather_reg_proc();">저장하기</a>
|
||||
<a href="/admin/etc_section/weather_list/6/<?=$page?>?search_type=<?=$search_type?>&search_keyword=<?=$search_keyword?>&search_display_status=<?=$search_display_status?>">목록으로</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 style="width:150px">아이콘선택</th>
|
||||
<td class="tl">
|
||||
<div class="icon_list" style="overflow-y: scroll; height:150px;">
|
||||
<? foreach ($weather_icon_list as $val) {?>
|
||||
<a href="#;" class="por">
|
||||
<input type="radio" name="sel_weather_icon" id="sel_weather_icon" class="stebox" value="<?=$val['weather_icon']?>">
|
||||
<img src="<?=$val['weather_icon']?>" width="50px" />
|
||||
</a>
|
||||
<? }?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
<div class="write_btn tc">
|
||||
<a href="javascript:select_weather_icon('add')">적용하기</a>
|
||||
<a href="javascript:commonLayerClose('icon_reg_layer')">취소하기</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</form>
|
||||
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
<? if($is_auto_setting=='N') {?>
|
||||
$("#no_auto_setting_content").show();
|
||||
<? }?>
|
||||
// 대륙변경
|
||||
function change_continent(val){
|
||||
var json_category = '<?=json_encode($arr_continent2)?>';
|
||||
json_category = eval(json_category);
|
||||
|
||||
$('#country').empty();
|
||||
var option = "<option value=''>선택</option>";
|
||||
$('#country').append(option);
|
||||
for(key in json_category[val]) {
|
||||
option = $("<option value='"+json_category[val][key]+"'>"+json_category[val][key]+"</option>");
|
||||
$('#country').append(option);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 아이콘 보기
|
||||
function view_icon(){
|
||||
commonLayerOpen('icon_reg_layer')
|
||||
|
||||
}
|
||||
|
||||
// 아이콘 적용
|
||||
function select_weather_icon(){
|
||||
var weather_icon = $("input[type=radio][id=sel_weather_icon]:checked").val();
|
||||
|
||||
if(weather_icon == '' || weather_icon == undefined) {
|
||||
alert("적용할 아이콘이 없습니다.");
|
||||
} else {
|
||||
$("#weather_icon").val(weather_icon);
|
||||
$("#icon_img").empty();
|
||||
$("#icon_img").html('<img src="'+weather_icon+'" width="50px">');
|
||||
}
|
||||
|
||||
commonLayerClose('icon_reg_layer')
|
||||
|
||||
}
|
||||
|
||||
|
||||
// 관련뉴스검색
|
||||
function click_relation_news_auto_setting(type){
|
||||
if(type == 'Y') {
|
||||
$("#no_auto_setting_content").hide();
|
||||
|
||||
} else {
|
||||
$("#no_auto_setting_content").show();
|
||||
$("#article_keyword").focus();
|
||||
}
|
||||
}
|
||||
|
||||
function search_article(){
|
||||
var article_keyword = $("#article_keyword").val();
|
||||
var article_sort = $(":input:radio[name=article_sort]:checked").val();
|
||||
|
||||
if(article_keyword == '') {
|
||||
alert("검색어를 입력해주세요");
|
||||
return false;
|
||||
}
|
||||
var form_data = {
|
||||
"content_type" : "<?=DEF_NEWS_CODE?>",
|
||||
"article_keyword" : article_keyword,
|
||||
"sort" : article_sort,
|
||||
"type" : 'JSON'
|
||||
};
|
||||
$.ajax({
|
||||
url: '/admin/search/search_article_list',
|
||||
async : false,
|
||||
type : 'POST',
|
||||
dataType : 'JSON',
|
||||
data : form_data,
|
||||
success: function (rtnJson) {
|
||||
if(rtnJson.result_code == '0000') {
|
||||
if(article_sort==1) {
|
||||
data = sortJSON(rtnJson.result_data.list,'reg_date', '321'); // 123 or 321
|
||||
} else {
|
||||
data = sortJSON(rtnJson.result_data.list,'reg_date', '123'); // 123 or 321
|
||||
}
|
||||
$('#result_count').html(rtnJson.result_data.count);
|
||||
$('#result').empty();
|
||||
|
||||
|
||||
|
||||
if(rtnJson.result_data.count == 0) {
|
||||
$('#result').html("<li>검색된 내용이 없습니다.</li>");
|
||||
} else {
|
||||
for(key in data) {
|
||||
var title = data[key]['title'];
|
||||
title = title.replace(/'/g, "'");
|
||||
title = title.replace(/"/g, '"');
|
||||
|
||||
$('#result').append('<li class="title"><a href="javascript:;" onclick="select_article(\''+data[key]['idx']+'\', \''+title+'\');">'+title+'</a></li>');
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
alert("뉴스검색에 실패했습니다.");
|
||||
return false;
|
||||
}
|
||||
|
||||
},
|
||||
error: function(jqXHR, exception) {
|
||||
console.log(jqXHR);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function select_article(idx, title){
|
||||
var index = ($("input[name=\"relation_idxs[]\"]").length)+1;
|
||||
$('#selected_news').append('<li><input type="checkbox" name="relation_idxs[]" id="relation_idx_'+index+'" value="'+idx+'" onclick="delete_article('+index+');"> <a href="/web/news/news_view/'+idx+'" target="_blank">'+title+'</a></li>');
|
||||
$("input[name='relation_idxs[]'][value=" + idx + "]").attr("checked", true);
|
||||
}
|
||||
|
||||
function delete_article(idx) {
|
||||
var checkbox_id = 'relation_idx_'+idx;
|
||||
if($('input:checkbox[id=checkbox_id]').is(":checked") == false){
|
||||
$("#"+checkbox_id).parent().remove();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 저장
|
||||
function weather_reg_proc(){
|
||||
if($("#continent").val()==''){
|
||||
alert("대륙을 선택해주세요.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if($("#country").val()==''){
|
||||
alert("나라를 선택해주세요.");
|
||||
return false;
|
||||
}
|
||||
if($("#weather_icon").val()=='') {
|
||||
alert("날씨이미지를 선택해주세요.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if($("#weather_content").val()=='') {
|
||||
alert("날씨코멘트를 입력해주세요.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if($("#rank").val()=='') {
|
||||
alert("순위를 입력해주세요.");
|
||||
return false;
|
||||
}
|
||||
|
||||
var is_auto_setting = $("input[type=radio][id=is_auto_setting]:checked").val();
|
||||
if(is_auto_setting == 'Y' && $("#tag").val()=='') {
|
||||
alert("관련뉴스를 자동설정 하시려면 tag가 필요합니다.");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
$("#input_form").submit();
|
||||
|
||||
}
|
||||
|
||||
|
||||
// 아이콘 이미지 선택
|
||||
$(".icon_list a").click(function(){
|
||||
$(".icon_list a").removeClass("on");
|
||||
$(this).addClass("on");
|
||||
});
|
||||
|
||||
|
||||
// jquery datepicker
|
||||
$("#display_date").datepicker({
|
||||
inline: true,
|
||||
dateFormat: 'yy-mm-dd',
|
||||
buttonImage:"/img/admin/btn_date.jpg",
|
||||
showOn: "both",
|
||||
buttonImageOnly: true
|
||||
|
||||
});
|
||||
$('img.ui-datepicker-trigger').css({'cursor':'pointer', 'width':'30px'}); //아이콘(icon) 위치
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
Reference in New Issue
Block a user