first
This commit is contained in:
14
modules/mediaset/themes/_mobile/rc-post-link/README.md
Normal file
14
modules/mediaset/themes/_mobile/rc-post-link/README.md
Normal file
@@ -0,0 +1,14 @@
|
||||
|
||||
# 부트스트랩4 파일 업로드 테마
|
||||
|
||||
부트스트랩
|
||||
|
||||
## 주요기능
|
||||
- 사진,파일 업로드
|
||||
- 첨부물 메타정보 등록
|
||||
- 첨부목록 숨김처리
|
||||
- 대표이미지 지정
|
||||
|
||||
## 요구사항
|
||||
- `widgets/_default/attach` 위젯 필요
|
||||
- `/plugins/jquery-form/4.2.2/jquery.form.min.js` 플러그인 필요
|
||||
@@ -0,0 +1,77 @@
|
||||
<li class="table-view-cell bg-white animated fadeIn pl-0" data-id="{$uid}" data-role="attach-item">
|
||||
<div class="media">
|
||||
<div class="pull-left media-object">
|
||||
<img src="{$thumbnail}" alt="" style="width: 42px;height: 42px">
|
||||
</div>
|
||||
<div class="media-body text-muted f14 w-75">
|
||||
<div class="line-clamp-2">
|
||||
<span class="badge badge-pill mr-1 {$is_featured}" data-role="attachList-label-featured" data-id="{$uid}">대표</span>
|
||||
<span class="badge badge-pill mr-1 {$is_hidden}" data-role="attachList-label-hidden-{$uid}">숨김</span>
|
||||
{$name}
|
||||
</div>
|
||||
<div class="meta">
|
||||
<span class="badge badge-inverted">{$provider}</span>
|
||||
<span class="badge badge-inverted" data-role="attachList-list-time-562">{$time}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<input type="hidden" name="attachfiles[]" value="[{$uid}]">
|
||||
<button type="button" class="btn btn-link"
|
||||
data-act="sheet"
|
||||
data-mod="link"
|
||||
data-target="#sheet-attach-moreAct"
|
||||
data-id="{$uid}" data-showhide="{$showhide}"
|
||||
data-insert="{$insert_text}"
|
||||
data-title="{$name}">
|
||||
<span class="fa fa-caret-down fa-lg text-muted"></span>
|
||||
</button>
|
||||
|
||||
<ul class="hidden dropdown-menu dropdown-menu-right" role="menu">
|
||||
<li>
|
||||
<a class="dropdown-item" href="#"
|
||||
data-link-act="featured-img"
|
||||
data-type="{$type}"
|
||||
data-id="{$uid}">
|
||||
대표이미지 설정
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="dropdown-item"
|
||||
href="#"
|
||||
data-toggle="modal"
|
||||
data-target="#modal-attach-{$type_modal}-meta"
|
||||
data-filename="{$file_name}"
|
||||
data-fileext="{$fileext}"
|
||||
data-caption="{$caption}"
|
||||
data-src="{$thumb_modal}"
|
||||
data-origin="{$img_origin}"
|
||||
data-link-act="edit"
|
||||
data-id="{$uid}"
|
||||
data-type="{$type}"
|
||||
data-role="attachList-menu-edit-{$uid}">
|
||||
정보수정
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="dropdown-item"
|
||||
href="#"
|
||||
data-link-act="showhide"
|
||||
data-role="attachList-menu-showhide-{$uid}"
|
||||
data-id="{$uid}" data-content="{$hidden_code}">
|
||||
{$hidden_str}
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="dropdown-item"
|
||||
href="#"
|
||||
data-link-act="delete"
|
||||
data-id="{$uid}"
|
||||
data-role="attachList-menu-delete-{$uid}"
|
||||
data-featured=""
|
||||
data-type="{$type}">
|
||||
삭제
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
@@ -0,0 +1 @@
|
||||
<figure class="media"><oembed url="{$linkurl}" class="bg-faded"></oembed></figure>
|
||||
5
modules/mediaset/themes/_mobile/rc-post-link/_var.php
Normal file
5
modules/mediaset/themes/_mobile/rc-post-link/_var.php
Normal file
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
$d['theme']['hidden_photo'] = "0"; // 이미지 추가시 사진 숨김여부 기본값 (숨김=1/보임=0)
|
||||
$d['theme']['allowedTypes'] = ""; // 업로드 가능한 파일 확장자. (명시하지 않으면 파일 확장자 필터링하지 않음.)
|
||||
$d['theme']['multiple'] = "1"; // 멀티 업로드 (허용=1/비허용=0)
|
||||
?>
|
||||
156
modules/mediaset/themes/_mobile/rc-post-link/footer.php
Normal file
156
modules/mediaset/themes/_mobile/rc-post-link/footer.php
Normal file
@@ -0,0 +1,156 @@
|
||||
|
||||
<script>
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
var sheet = $('#sheet-post-linkadd');
|
||||
|
||||
sheet.on('click','[data-act="saveLink"]',function(){
|
||||
var container = '#modal-post-write';
|
||||
var button = $(this);
|
||||
var input = sheet.find('input');
|
||||
var url = input.val();
|
||||
var linkNum = Number($(container).find('[data-role="linkNum"]').text());
|
||||
|
||||
if (!url) {
|
||||
input.focus()
|
||||
return false
|
||||
}
|
||||
|
||||
var link_url_parse = $('<a>', {href: url});
|
||||
|
||||
//네이버 블로그 URL의 실제 URL 변환
|
||||
if ((link_url_parse.prop('hostname')=='blog.naver.com' || link_url_parse.prop('hostname')=='m.blog.naver.com' ) && link_url_parse.prop('pathname')) {
|
||||
var nblog_path_arr = link_url_parse.prop('pathname').split("/");
|
||||
var nblog_id = nblog_path_arr[1];
|
||||
var nblog_pid = nblog_path_arr[2];
|
||||
if (nblog_pid) {
|
||||
var url = 'https://blog.naver.com/PostView.nhn?blogId='+nblog_id+'&logNo='+nblog_pid;
|
||||
} else {
|
||||
var url = 'https://blog.naver.com/PostList.nhn?blogId='+nblog_id;
|
||||
}
|
||||
}
|
||||
|
||||
button.attr('disabled',true)
|
||||
|
||||
$.get('//embed.kimsq.com/oembed',{
|
||||
url: url
|
||||
}).done(function(response) {
|
||||
var type = response.type;
|
||||
var title = response.title;
|
||||
var description = response.description;
|
||||
var thumbnail_url = response.thumbnail_url;
|
||||
var author = response.author;
|
||||
var provider = response.provider_name;
|
||||
var url = response.url;
|
||||
var width = response.thumbnail_width;
|
||||
var height = response.thumbnail_height;
|
||||
var embed = response.html;
|
||||
|
||||
sheet.find('[data-role="title"]').text(title);
|
||||
sheet.find('[data-role="description"]').text(description);
|
||||
sheet.find('[data-role="thumbnail"]').attr('src',thumbnail_url);
|
||||
sheet.find('[data-act="insert"]').attr('data-url',url).attr('data-title',title).attr('data-description',description).attr('data-thumbnail',thumbnail_url).attr('data-provider',provider);
|
||||
|
||||
if (type=='video') {
|
||||
|
||||
$.get('//embed.kimsq.com/iframely',{
|
||||
url: url
|
||||
}).done(function(response) {
|
||||
var duration = response.meta.duration;
|
||||
var _duration = moment.duration(duration, 's');
|
||||
var formatted_duration = _duration.format("h:*m:ss");
|
||||
|
||||
$.post(rooturl+'/?r='+raccount+'&m=mediaset&a=saveLink',{
|
||||
type : 9,
|
||||
title : title,
|
||||
theme : '_mobile/rc-post-link',
|
||||
description : description,
|
||||
thumbnail_url : thumbnail_url,
|
||||
author: author,
|
||||
provider : provider,
|
||||
url : url,
|
||||
duration : duration?duration:'',
|
||||
time : duration?formatted_duration:'',
|
||||
width : width,
|
||||
height : height,
|
||||
embed : embed
|
||||
},function(response){
|
||||
var result=$.parseJSON(response);
|
||||
if(!result.error){
|
||||
history.back();
|
||||
$(container).find('[data-role="attach-preview-link"]').append(result.list);
|
||||
setTimeout(function(){ $.notify("링크가 추가 되었습니다."); }, 300);
|
||||
$(container).find('[data-role="linkNum"]').text(linkNum+1);
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
} else {
|
||||
|
||||
$.post(rooturl+'/?r='+raccount+'&m=mediaset&a=saveLink',{
|
||||
type : 8,
|
||||
title : title,
|
||||
theme : '_mobile/rc-post-link',
|
||||
description : description,
|
||||
thumbnail_url : thumbnail_url,
|
||||
author: author,
|
||||
provider : provider,
|
||||
url : url,
|
||||
width : width,
|
||||
height : height,
|
||||
embed : embed
|
||||
},function(response){
|
||||
var result=$.parseJSON(response);
|
||||
if(!result.error){
|
||||
history.back();
|
||||
$(container).find('[data-role="attach-preview-link"]').append(result.list);
|
||||
setTimeout(function(){ $.notify("링크가 추가 되었습니다."); }, 300);
|
||||
$(container).find('[data-role="linkNum"]').text(linkNum+1);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
}).fail(function() {
|
||||
alert( "URL을 확인해주세요." );
|
||||
}).always(function() {
|
||||
input.val('')
|
||||
button.attr('disabled',false)
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
$('body').on('tap','[data-act="sheet"][data-target="#sheet-attach-moreAct"][data-mod="link"]',function(){
|
||||
var button = $(this);
|
||||
var target = button.attr('data-target');
|
||||
var type = button.attr('data-type');
|
||||
var title = button.attr('data-title');
|
||||
|
||||
var uid = button.attr('data-id');
|
||||
var type = button.attr('data-type');
|
||||
var showhide = button.attr('data-showhide');
|
||||
var name = button.attr('data-name');
|
||||
var insert_text = button.attr('data-insert');
|
||||
var sheet = $('#sheet-attach-moreAct');
|
||||
$('#attach-files-backdrop').removeClass('hidden');
|
||||
sheet.find('[data-role="insert_text"]').val(insert_text);
|
||||
sheet.find('[data-attach-act="featured-img"]').attr('data-id',uid).attr('data-type',type).attr('data-mod','link');
|
||||
sheet.find('[data-attach-act="showhide"]').attr('data-id',uid).attr('data-content',showhide).attr('data-mod','link');
|
||||
sheet.find('[data-attach-act="delete"]').attr('data-id',uid).attr('data-type',type).attr('data-mod','link');
|
||||
|
||||
if (type!='photo') { // 이미지가 아닐 경우
|
||||
sheet.find('[data-attach-act="featured-img"]').closest('.table-view-cell').addClass('hidden'); // 대표이미지 항목 숨김처리함
|
||||
} else {
|
||||
sheet.find('[data-attach-act="featured-img"]').closest('.table-view-cell').removeClass('hidden'); // 대표이미지 항목 숨김처리함
|
||||
}
|
||||
$(target).sheet({
|
||||
title : title
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
})
|
||||
</script>
|
||||
93
modules/mediaset/themes/_mobile/rc-post-link/header.php
Normal file
93
modules/mediaset/themes/_mobile/rc-post-link/header.php
Normal file
@@ -0,0 +1,93 @@
|
||||
<?php
|
||||
// 위젯 설정값 세팅
|
||||
$parent_module=$d['attach']['parent_module']; // 첨부파일 사용하는 모듈
|
||||
$parent_data=$d['attach']['parent_data']; // 해당 포스트 데이타 (수정시 필요)
|
||||
$attach_module_theme=$d['attach']['theme']; // 첨부파일 테마
|
||||
$attach_mode=$d['attach']['mod']; // list, main...
|
||||
$attach_handler_file=$d['attach']['handler_file']; //파일첨부 실행 엘리먼트 button or 기타 엘리먼트 data-role="" 형태로 하는 것을 권고
|
||||
$attach_handler_photo=$d['attach']['handler_photo']; // 사진첨부 실행 엘리먼트 button or 기타 엘리먼트 data-role="" 형태로 하는 것을 권고
|
||||
$attach_handler_getModalList=$d['attach']['handler_getModalList']; // 첨부파일 리스트 호출 handler
|
||||
$attach_object_type=$d['attach']['object_type']; // 첨부 대상에 따른 분류 : photo, file, link, video....
|
||||
$editor_type=$d['attach']['editor_type']; // 에디터 타입 : html,markdown
|
||||
|
||||
require_once $g['dir_attach_theme'].'/main.func.php'; // 함수 인클루드
|
||||
require_once $g['dir_attach_theme'].'/_var.php'; // 테마변수 인클루드
|
||||
require_once $g['path_module'].'mediaset/var/var.php'; //모듈 공통변수 인클루드
|
||||
?>
|
||||
|
||||
|
||||
<script src="<?php echo $g['url_attach_theme']?>/js/fileuploader.js"></script>
|
||||
<script src="<?php echo $g['url_attach_theme']?>/main.js"></script>
|
||||
|
||||
|
||||
<style media="screen">
|
||||
|
||||
/**
|
||||
* Nestable
|
||||
*/
|
||||
.dd { }
|
||||
.dd-list { display: block; position: relative; list-style: none; }
|
||||
.dd-list .dd-list { }
|
||||
.dd-collapsed .dd-list { display: none; }
|
||||
.dd-item,
|
||||
.dd-empty,
|
||||
.dd-placeholder { }
|
||||
.dd-handle {
|
||||
position: absolute;
|
||||
margin: 0;
|
||||
left: 0;
|
||||
top: 0;
|
||||
bottom:0;
|
||||
cursor: pointer;
|
||||
width: 25px;
|
||||
text-indent: 100%;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
background-color: #eff3f6;
|
||||
background-image: linear-gradient(-180deg, #fafbfc 0%, #eff3f6 90%);
|
||||
background-repeat: repeat-x;
|
||||
background-position: -1px -1px;
|
||||
background-size: 110% 110%;
|
||||
border-right: 1px solid rgba(27,31,35,0.1);
|
||||
border-top-right-radius: 0;
|
||||
border-bottom-right-radius: 0;
|
||||
}
|
||||
.dd-handle:hover {
|
||||
background-color: #e6ebf1;
|
||||
background-image: linear-gradient(-180deg, #f0f3f6 0%, #e6ebf1 90%);
|
||||
background-position: -.5em;
|
||||
}
|
||||
.dd-handle:before {
|
||||
display: block;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 50%;
|
||||
margin-top: -7px;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
text-indent: 0;
|
||||
color: #494949;
|
||||
font-size: 14px;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
.dd-placeholder,
|
||||
.dd-empty { margin: 5px 0; padding: 0; min-height: 30px; background: #f2fbff; border: 1px dashed #b6bcbf; box-sizing: border-box; -moz-box-sizing: border-box; }
|
||||
.dd-empty { border: 1px dashed #bbb; min-height: 100px; background-color: #e5e5e5;
|
||||
background-image: -webkit-linear-gradient(45deg, #fff 25%, transparent 25%, transparent 75%, #fff 75%, #fff),
|
||||
-webkit-linear-gradient(45deg, #fff 25%, transparent 25%, transparent 75%, #fff 75%, #fff);
|
||||
background-image: -moz-linear-gradient(45deg, #fff 25%, transparent 25%, transparent 75%, #fff 75%, #fff),
|
||||
-moz-linear-gradient(45deg, #fff 25%, transparent 25%, transparent 75%, #fff 75%, #fff);
|
||||
background-image: linear-gradient(45deg, #fff 25%, transparent 25%, transparent 75%, #fff 75%, #fff),
|
||||
linear-gradient(45deg, #fff 25%, transparent 25%, transparent 75%, #fff 75%, #fff);
|
||||
background-size: 60px 60px;
|
||||
background-position: 0 0, 30px 30px;
|
||||
}
|
||||
.dd-dragel { position: absolute; pointer-events: none; z-index: 9999; }
|
||||
.dd-dragel > .dd-item .dd-handle { margin-top: 0; }
|
||||
.dd-dragel .dd-handle {
|
||||
-webkit-box-shadow: 2px 4px 6px 0 rgba(0,0,0,.1);
|
||||
box-shadow: 2px 4px 6px 0 rgba(0,0,0,.1);
|
||||
}
|
||||
|
||||
</style>
|
||||
103
modules/mediaset/themes/_mobile/rc-post-link/main.func.php
Normal file
103
modules/mediaset/themes/_mobile/rc-post-link/main.func.php
Normal file
@@ -0,0 +1,103 @@
|
||||
<?php
|
||||
// 첨부파일 리스트 갯수 추출 함수
|
||||
function getLinkNum($upload,$mod)
|
||||
{
|
||||
global $table;
|
||||
|
||||
$attach = getArrayString($upload);
|
||||
$link_num=0;// 링크 수량
|
||||
$hidden_link_num=0; // 숨김링크 수량
|
||||
foreach($attach['data'] as $val)
|
||||
{
|
||||
$U = getUidData($table['s_upload'],$val);
|
||||
if($U['fserver']==3) $link_num++; // 전체 링크수량 증가
|
||||
if($U['fserver']==3 && $U['hidden']==1) $hidden_link_num++; // 숨김링크 수량 증가
|
||||
}
|
||||
$active_link_num=$link_num-$hidden_link_num; // 공개 링크
|
||||
$result=array();
|
||||
$result['modify']=$link_num;
|
||||
$result['view']=$active_link_num;
|
||||
|
||||
return $result[$mod];
|
||||
}
|
||||
|
||||
function getAttachPlatformList($parent_data,$mod,$type) {
|
||||
global $table;
|
||||
|
||||
$upload=$parent_data['upload'];
|
||||
$featured_img_uid=$parent_data['featured_img'];// 대표이미지 uid
|
||||
|
||||
$sql='fserver=3';
|
||||
$attach = getArrayString($upload);
|
||||
|
||||
if ($mod=='view') $sql.=' and hidden=0';
|
||||
|
||||
$uid_q='(';
|
||||
foreach($attach['data'] as $uid)
|
||||
{
|
||||
$uid_q.='uid='.$uid.' or ';
|
||||
}
|
||||
|
||||
$uid_q=substr($uid_q,0,-4).')';
|
||||
$sql=$sql.' and '.$uid_q;
|
||||
$RCD=getDbArray($table['s_upload'],$sql,'*','gid','asc','',1);
|
||||
$html='';
|
||||
while($R=db_fetch_array($RCD)){
|
||||
$U=getUidData($table['s_upload'],$R['uid']);
|
||||
$html.=getAttachPlatform($U,$mod,$featured_img_uid);
|
||||
}
|
||||
return $html;
|
||||
|
||||
}
|
||||
|
||||
// 추출 함수 (낱개)
|
||||
function getAttachPlatform($R,$mod,$featured_img_uid) {
|
||||
|
||||
global $g,$r,$m,$theme,$TMPL;
|
||||
|
||||
$m='mediaset';
|
||||
$theme='_mobile/rc-post-link';
|
||||
|
||||
include_once $GLOBALS['g']['path_core'].'function/sys.class.php';
|
||||
|
||||
$md_title=str_replace('|','-',$R['title']);
|
||||
$thumbnail_url_parse = parse_url($R['src']);
|
||||
$thumbnail_url_arr = explode('//',$R['src']);
|
||||
|
||||
if ($R['provider']=='Google Maps') {
|
||||
$thumbnail = $R['src'];
|
||||
} else if (strpos($R['src'], '?') !== false) {
|
||||
$thumbnail = '/_core/opensrc/timthumb/thumb.php?src='.$R['src'].'&w=50&h=50&s=1';
|
||||
} else {
|
||||
$thumbnail = '/thumb'.($thumbnail_url_parse['scheme']=='https'?'-ssl':'').'/50x50/u/'.$thumbnail_url_arr[1];
|
||||
}
|
||||
|
||||
$insert_text='<video class=mejs-player img-responsive img-fluid style=max-width:100% preload=none><source src=https://www.youtube.com/embed/'.$R['src'].' type=video/youtube></video>';
|
||||
|
||||
$TMPL['is_featured']=$R['uid']==$featured_img_uid?'':' hidden';
|
||||
$TMPL['is_hidden']=!$R['hidden']?' hidden':'';
|
||||
$TMPL['hidden_code']=$R['hidden']?'show':'hide';
|
||||
$TMPL['hidden_str']=$R['hidden']?'보이기':'숨기기';
|
||||
|
||||
$TMPL['showhide']=!$R['hidden']?'hide':'show';
|
||||
// $TMPL['insert_text']=$insert_text;
|
||||
|
||||
$TMPL['linkurl']=$R['linkurl'];
|
||||
$TMPL['thumbnail']=$thumbnail;
|
||||
$TMPL['name']=$R['caption']?$R['caption']:getStrCut($R['description'],100,'..');
|
||||
$TMPL['provider']=$R['provider'];
|
||||
$TMPL['time']=$R['time'];
|
||||
|
||||
$TMPL['uid']=$R['uid'];
|
||||
|
||||
if ($mod=='view') $markup_file = 'view_row';
|
||||
else $markup_file = 'edit_row';
|
||||
|
||||
$skin=new skin($markup_file);
|
||||
$html=$skin->make();
|
||||
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
?>
|
||||
162
modules/mediaset/themes/_mobile/rc-post-link/main.js
Normal file
162
modules/mediaset/themes/_mobile/rc-post-link/main.js
Normal file
@@ -0,0 +1,162 @@
|
||||
// 업로드 리스트 showhide 값 reset 함수
|
||||
var updateShowHide=function(uid,showhide){
|
||||
if(showhide=='show'){
|
||||
$(document).find('[data-role="attachList-menu-showhide-'+uid+'"]').attr('data-content','hide'); // data-content 값 수정
|
||||
$(document).find('[data-role="attachList-label-hidden-'+uid+'"]').addClass('d-none'); // 숨김 라벨 숨기기
|
||||
$(document).find('[data-attach-act="showhide"]').text('보이기');
|
||||
}else{
|
||||
$(document).find('[data-role="attachList-menu-showhide-'+uid+'"]').attr('data-content','show'); // data-content 값 수정
|
||||
$(document).find('[data-role="attachList-label-hidden-'+uid+'"]').removeClass('d-none'); // 숨김 라벨 노출
|
||||
$(document).find('[data-attach-act="showhide"]').text('숨기기');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
$(document).on('click','[data-attach-act][data-mod="link"]',function(e){
|
||||
var act=$(this).attr('data-attach-act');
|
||||
var uid=$(this).attr('data-id');
|
||||
var type=$(this).attr('data-type'); // file or photo
|
||||
var module = 'mediaset';
|
||||
|
||||
//showSaveButton(true) //포스트 저장버튼 활성화
|
||||
|
||||
if(act=='edit'){
|
||||
// data 값 세팅
|
||||
var modal=$(this).data('target');
|
||||
var filename=$(this).attr('data-filename'); // data-로 하면 변경된 값 적용 안됨
|
||||
var fileext=$(this).data('fileext');
|
||||
var caption=$(this).attr('data-caption'); // data- 로 하면 변경된 값 적용 안됨
|
||||
var img_thumb=$(this).data('src');// 미리보기 이미지
|
||||
var img_origin=$(this).data('origin');// 원본 이미지
|
||||
|
||||
// data 값 모달에 적용
|
||||
$(modal).find('[data-role="filename"]').val(filename);
|
||||
$(modal).find('[data-role="fileext"]').text(fileext);
|
||||
$(modal).find('[data-role="filecaption"]').val(caption);
|
||||
$(modal).find('[data-role="eventHandler"]').attr('data-id',uid); // save, cancel 엘리먼트 data-id="" 값에 uid 값 적용
|
||||
$(modal).find('[data-role="eventHandler"]').attr('data-type',type); // save, cancel 엘리먼트 data-type="" 값에 type 값 적용
|
||||
if(type=='photo'){
|
||||
$(modal).find('[data-role="img-preview"]').attr('src',img_thumb); // 미리보기 이미지 src 적용
|
||||
$(modal).find('[data-role="img-preview"]').attr('data-origin',img_origin); // 원본 이미지 src 적용
|
||||
} else if(type=='video'){
|
||||
$(modal).find('[data-role="img-preview"]').html('<i class="fa fa-file-video-o fa-4x"></i>'); // 타입별 아이콘 적용
|
||||
} else if(type=='audio'){
|
||||
$(modal).find('[data-role="img-preview"]').html('<i class="fa fa-file-audio-o fa-4x"></i>'); // 타입별 아이콘 적용
|
||||
} else {
|
||||
$(modal).find('[data-role="img-preview"]').html('<i class="fa fa-floppy-o fa-4x"></i>'); // 타입별 아이콘 적용
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//액션 실행
|
||||
if(act=='delete'){
|
||||
// 삭제하는 리스트가 대표 이미지인 경우 write.php input 값에 적용
|
||||
var is_featured=$(this).attr('data-featured');
|
||||
if(is_featured=='1' && type=='photo'){
|
||||
if(confirm('대표이미지를 삭제하시겠습니까? ')){
|
||||
$('input[name="featured_img"]').val('');
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
$.post(rooturl+'/?r='+raccount+'&m='+module+'&a=delete',{
|
||||
uid : uid
|
||||
},function(response){
|
||||
var previewUl_default=$('#modal-post-write').find('[data-role="attach-preview-link"]'); // 파일 리스트 엘리먼트 class
|
||||
var previewUl_modal=$('#modal-post-write').find('[data-role="modal-attach-preview-link"]'); // 파일 리스트 엘리먼트 class
|
||||
var delEl_default=previewUl_default.find('[data-id="'+uid+'"]'); // 삭제 이벤트 진행된 엘리먼트
|
||||
var delEl_modal=previewUl_modal.find('[data-id="'+uid+'"]'); // 삭제 이벤트 진행된 엘리먼트
|
||||
delEl_default.remove();// 삭제 이벤트 진행시 해당 li 엘리먼트 remove
|
||||
delEl_modal.remove();// 삭제 이벤트 진행시 해당 li 엘리먼트 remove\
|
||||
|
||||
var modal_item_num = $('#modal-post-write').find('[data-role="attach-preview-link"] [data-role="attach-item"]').length;
|
||||
setTimeout(function(){
|
||||
$('#modal-post-write').find('[data-role="linkNum"]').text(modal_item_num==0?'':modal_item_num);
|
||||
}, 100);
|
||||
|
||||
});
|
||||
}else if(act=='showhide'){
|
||||
var showhide=$(this).attr('data-content'); // data('content') 로 할 경우, ajax 로 변경된 값이 인식되지 않는다.
|
||||
$.post(rooturl+'/?r='+raccount+'&m='+module+'&a=edit',{
|
||||
act : act,
|
||||
uid : uid,
|
||||
showhide : showhide
|
||||
},function(response){
|
||||
var result=$.parseJSON(response);
|
||||
if(!result.error){
|
||||
updateShowHide(uid,showhide);
|
||||
}
|
||||
});
|
||||
}else if(act=='save'){ // 정보수정 저장
|
||||
var modal=$(this).data('target');
|
||||
var filename=$(modal).find('[data-role="filename"]').val(); // 입력된 파일명
|
||||
var filetype=$(modal).find('[data-role="eventHandler"]').attr('data-type'); // photo or file
|
||||
var fileext=$(modal).find('[data-role="fileext"]').text(); // 입력된 파일 확장자명
|
||||
var filecaption=$(modal).find('[data-role="filecaption"]').val(); // 입력된 캡션명
|
||||
var filesrc=$(modal).find('[data-role="img-preview"]').attr('data-origin'); // 원본 이미지 소스
|
||||
|
||||
$.post(rooturl+'/?r='+raccount+'&m='+module+'&a=edit',{
|
||||
act : act,
|
||||
uid : uid,
|
||||
filename : filename,
|
||||
filetype : filetype,
|
||||
fileext : fileext,
|
||||
filecaption : filecaption,
|
||||
filesrc : filesrc
|
||||
},function(response){
|
||||
var result=$.parseJSON(response);
|
||||
if(!result.error){
|
||||
var new_filename=result.filename;
|
||||
var new_filecaption=result.filecaption;
|
||||
var new_fileext=result.fileext;
|
||||
var new_filetype=result.filetype;
|
||||
var new_filesrc=result.filesrc;
|
||||
|
||||
// 리스트 값 수정
|
||||
$('[data-role="attachList-menu-edit-'+uid+'"]').attr('data-filename',new_filename); // 파일명 수정
|
||||
$('[data-role="attachList-menu-edit-'+uid+'"]').attr('data-caption',new_filecaption); // 'edit' 메뉴 캡션 업데이트
|
||||
$('[data-role="attachList-menu-insert-'+uid+'"]').attr('data-caption',new_filecaption); // 'insert' 메뉴 캡션내용 수정
|
||||
$('[data-role="attachList-list-name-'+uid+'"]').text(new_filename+'.'+new_fileext); // 리스트 name 수정
|
||||
$('[data-role="attachList-list-name-'+uid+'"]').attr('data-caption',new_filecaption); // 리스트에도 캡션 업데이트
|
||||
|
||||
// 모달 닫기
|
||||
$(modal).modal('hide');
|
||||
$(modal).find('[data-role="filename"]').val(''); // 입력된 파일명 초기화
|
||||
$(modal).find('[data-role="fileext"]').text(''); // 입력된 파일 확장자명 초기화
|
||||
$(modal).find('[data-role="filecaption"]').val(''); // 입력된 캡션명 초기화
|
||||
}
|
||||
});
|
||||
}else if(act=='featured-img'){ // 대표이미지 설정
|
||||
// write.php 페이지 <input name="featured_img" value > 값에 적용
|
||||
$('input[name="featured_img"]').val(uid);
|
||||
|
||||
// 대표 이미지 라벨 업데이트
|
||||
$('[data-role="attachList-label-featured"]').each(function(){
|
||||
$(this).addClass('d-none');
|
||||
// 삭제 메뉴에 대표이미지 표시 지우기
|
||||
$('[data-attach-act="delete"]').attr('data-featured','');
|
||||
if($(this).data('id')==uid){
|
||||
$(this).removeClass('d-none');
|
||||
// 삭제 메뉴에 대표이미지 표시
|
||||
$('[data-role="attachList-menu-delete-'+uid+'"]').attr('data-featured',1);
|
||||
}
|
||||
});
|
||||
}else if(act=='insert'){
|
||||
var url=$(this).attr('data-url');
|
||||
console.log(url)
|
||||
InserHTMLtoEditor(editor,url)
|
||||
|
||||
var showhide= 'hide'; // 숨김처리
|
||||
$.post(rooturl+'/?r='+raccount+'&m='+module+'&a=edit',{
|
||||
act : act,
|
||||
uid : uid,
|
||||
showhide : showhide
|
||||
},function(response){
|
||||
var result=$.parseJSON(response);
|
||||
if(!result.error){
|
||||
updateShowHide(uid,showhide);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
19
modules/mediaset/themes/_mobile/rc-post-link/main.php
Normal file
19
modules/mediaset/themes/_mobile/rc-post-link/main.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
include $g['dir_attach_theme'].'/header.php';
|
||||
?>
|
||||
|
||||
<div id="attach_link">
|
||||
|
||||
<ol class="list-group rb-attach-link rb-attach-featured mb-0" data-role="attach-preview-link" data-sortable="mediaset"> <!-- 일반파일 리스트 -->
|
||||
</ol>
|
||||
<div class="mt-3">
|
||||
<a class="btn btn-link btn-block" href="#sheet-post-linkadd" data-toggle="sheet" data-act="saveLink" role="button">
|
||||
추가
|
||||
</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<?php
|
||||
include $g['dir_attach_theme'].'/footer.php';
|
||||
?>
|
||||
1
modules/mediaset/themes/_mobile/rc-post-link/name.txt
Normal file
1
modules/mediaset/themes/_mobile/rc-post-link/name.txt
Normal file
@@ -0,0 +1 @@
|
||||
부트스트랩 심플 기본형
|
||||
Reference in New Issue
Block a user