first
This commit is contained in:
8
modules/mediaset/themes/_mobile/rc-default/_main.css
Normal file
8
modules/mediaset/themes/_mobile/rc-default/_main.css
Normal file
@@ -0,0 +1,8 @@
|
||||
.rb-attach .table-view {
|
||||
border: none
|
||||
}
|
||||
|
||||
.rb-attach .table-view-cell {
|
||||
padding-left: 1rem;
|
||||
padding-right: 1rem
|
||||
}
|
||||
5
modules/mediaset/themes/_mobile/rc-default/_var.php
Normal file
5
modules/mediaset/themes/_mobile/rc-default/_var.php
Normal file
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
$d['theme']['hidden_photo'] = "0"; // 이미지 추가시 사진 숨김여부 기본값 (숨김=1/보임=0)
|
||||
$d['theme']['allowedTypes'] = "jpg,png,gif,hwp,doc,docx,pdf,ppt,pptx,xls,xlsx,zip,m4a,mp3,mp4,mov,jpeg"; // 업로드 가능한 파일 확장자. (명시하지 않으면 파일 확장자 필터링하지 않음.)
|
||||
$d['theme']['multiple'] = "1"; // 멀티 업로드 (허용=1/비허용=0)
|
||||
?>
|
||||
89
modules/mediaset/themes/_mobile/rc-default/footer.php
Normal file
89
modules/mediaset/themes/_mobile/rc-default/footer.php
Normal file
@@ -0,0 +1,89 @@
|
||||
<?php getImport('jquery-form','jquery.form.min','4.2.2','js'); ?>
|
||||
<script>
|
||||
var inputId='attach-file-input'; // 실제 작옹하는 input 엘리먼트 id 값을 옵션으로 지정을 해준다. (커스텀 버튼으로 click 이벤트 바인딩)
|
||||
var attach_file_saveDir = '<?php echo $g['path_file'].$parent_module?>/';// 파일 업로드 폴더
|
||||
var attach_module_theme = '<?php echo $attach_module_theme?>';// attach 모듈 테마
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
// 파일업로드 옵션값 세팅
|
||||
var upload_settings = {
|
||||
allowedTypes:"<?php echo $d['theme']['allowedTypes'] ?>",// 업로드 가능한 파일 확장자. 여기에 명시하지 않으면 파일 확장자 필터링하지 않음.
|
||||
fileName: "files", // <input type="file" name=""> 의 name 값 --> php 에서 파일처리할 때 사용됨.
|
||||
multiple: <?php echo $d['theme']['multiple']?'true':'false' ?>, // 멀티업로드를 할 경우 true 로 해준다.
|
||||
inputId:inputId, // 실제 작옹하는 input 엘리먼트 id 값을 옵션으로 지정을 해준다. (커스텀 버튼으로 click 이벤트 바인딩)
|
||||
formData: {"saveDir":attach_file_saveDir,"theme":attach_module_theme}, // 추가 데이타 세팅
|
||||
onSubmit:function(files){
|
||||
$(".content").loader({
|
||||
position: 'overlay',
|
||||
text: "업로드중...",
|
||||
disableOthers: [
|
||||
$('[data-role="attach-handler-file"]')
|
||||
]
|
||||
});
|
||||
},
|
||||
onSuccess:function(files,data,xhr,pd){
|
||||
$(".content").loader("hide")
|
||||
$('#popup-success').popup();
|
||||
$('[data-role="attach_guide"]').addClass('d-none');
|
||||
}
|
||||
}
|
||||
$("#attach-files").RbUploadFile(upload_settings); // 아작스 폼+input=file 엘리먼트 세팅
|
||||
|
||||
// main.js 기본값 세팅
|
||||
var attach_settings={
|
||||
module : 'mediaset',
|
||||
theme : attach_module_theme,
|
||||
handler_photo : '<?php echo $attach_handler_photo?>',
|
||||
handler_file : '<?php echo $attach_handler_file?>',
|
||||
handler_getModalList : '<?php echo $attach_handler_getModalList?>',
|
||||
listModal : '#modal-attach'
|
||||
}
|
||||
$("#attach-files").RbAttachTheme(attach_settings);
|
||||
|
||||
$('body').on('click','[data-act="sheet"][data-target="#sheet-attach-moreAct"]',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);
|
||||
sheet.find('[data-attach-act="showhide"]').attr('data-id',uid).attr('data-content',showhide);
|
||||
sheet.find('[data-attach-act="delete"]').attr('data-id',uid).attr('data-type',type);
|
||||
|
||||
if (showhide=='show') sheet.find('[data-attach-act="showhide"]').text('보이기');
|
||||
else sheet.find('[data-attach-act="showhide"]').text('숨기기');
|
||||
|
||||
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
|
||||
});
|
||||
});
|
||||
|
||||
$('#sheet-attach-moreAct').find('.table-view-cell a').click(function() { // 시트에 항목을 터치하면
|
||||
history.back()
|
||||
});
|
||||
|
||||
//$('#rb-attach-youtube-wrapper').RbAttachYoutube(link_settings);
|
||||
|
||||
$('.rb-preview').on('click', function() {
|
||||
$(this).removeClass('btn-primary').addClass('btn-default')
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
19
modules/mediaset/themes/_mobile/rc-default/header.php
Normal file
19
modules/mediaset/themes/_mobile/rc-default/header.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?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....
|
||||
|
||||
// 함수 인클루드
|
||||
require_once $g['dir_attach_theme'].'/main.func.php';
|
||||
require_once $g['dir_attach_theme'].'/_var.php'; // 테마변수 인클루드
|
||||
?>
|
||||
<!-- global css -->
|
||||
<link href="<?php echo $g['url_attach_theme']?>/_main.css" rel="stylesheet">
|
||||
<script src="<?php echo $g['url_attach_theme']?>/js/file-upload/fileuploader.js"></script>
|
||||
<script src="<?php echo $g['url_attach_theme']?>/main.js"></script>
|
||||
@@ -0,0 +1,899 @@
|
||||
/*!
|
||||
* jQuery Upload File Plugin
|
||||
* version: 4.0.9
|
||||
* @requires jQuery v1.5 or later & form plugin
|
||||
* Copyright (c) 2013 Ravishanker Kusuma
|
||||
* http://hayageek.com/
|
||||
* https://github.com/hayageek/jquery-upload-file
|
||||
*/
|
||||
(function ($) {
|
||||
var feature = {};
|
||||
feature.fileapi = $("<input type='file'/>").get(0).files !== undefined;
|
||||
feature.formdata = window.FormData !== undefined;
|
||||
$.fn.RbUploadFile = function (options) {
|
||||
// This is the easiest way to have default options.
|
||||
var s = $.extend({
|
||||
// These are the defaults.
|
||||
url: rooturl+'/?r='+raccount+'&m=mediaset&a=upload', // attach 모듈 upload 액션 파일 지정
|
||||
method: "POST",
|
||||
enctype: "multipart/form-data",
|
||||
returnType: null,
|
||||
allowDuplicates: true,
|
||||
duplicateStrict: false,
|
||||
allowedTypes: "*",
|
||||
//For list of acceptFiles
|
||||
// http://stackoverflow.com/questions/11832930/html-input-file-accept-attribute-file-type-csv
|
||||
acceptFiles: "*",
|
||||
fileName: "file",
|
||||
formData: false,
|
||||
dynamicFormData:false,
|
||||
maxFileSize: -1,
|
||||
maxFileCount: -1,
|
||||
multiple: true,
|
||||
dragDrop: false, // 수정 dragDrop 사용하지 않음
|
||||
autoSubmit: true,
|
||||
showCancel: true,
|
||||
showAbort: true,
|
||||
showDone: false,
|
||||
showDelete: false,
|
||||
showError: true,
|
||||
showStatusAfterSuccess: false, // 수정
|
||||
showStatusAfterError: true,
|
||||
showFileCounter: false, // 수정
|
||||
fileCounterStyle: "). ",
|
||||
showFileSize: true,
|
||||
showProgress: true,
|
||||
nestedForms: true,
|
||||
showDownload: false,
|
||||
onLoad: function (obj) {},
|
||||
onSelect: function (files) {
|
||||
return true;
|
||||
},
|
||||
onSubmit: function (files, xhr) {},
|
||||
onSuccess: function (files, response, xhr, pd) {},
|
||||
onError: function (files, status, message, pd) {},
|
||||
onCancel: function (files, pd) {},
|
||||
onAbort: function (files, pd) {},
|
||||
downloadCallback: false,
|
||||
deleteCallback: false,
|
||||
afterUploadAll: false,
|
||||
serialize:true,
|
||||
sequential:false,
|
||||
sequentialCount:2,
|
||||
customProgressBar: false,
|
||||
abortButtonClass: "ajax-file-upload-abort content-padded text-danger",
|
||||
cancelButtonClass: "ajax-file-upload-cancel content-padded text-danger",
|
||||
dragDropContainerClass: "ajax-upload-dragdrop content-padded",
|
||||
dragDropHoverClass: "state-hover",
|
||||
errorClass: "content-padded text-danger",
|
||||
uploadButtonClass: "ajax-file-upload",
|
||||
dragDropStr: "<span><b>드래그앤 드랍</b></span>",
|
||||
//uploadStr:"Upload",
|
||||
uploadStr:"", // 첨부파일 버튼을 커스텀할 수 있도록 숨긴다.
|
||||
abortStr: "실패",
|
||||
cancelStr: "취소",
|
||||
deletelStr: "삭제",
|
||||
doneStr: "완료",
|
||||
multiDragErrorStr: "드래그앤 드랍이 허용되지 않습니다.",
|
||||
extErrorStr: "허용 된 확장가 아닙니다.: ",
|
||||
duplicateErrorStr: "이미 존재하는 파일 입니다.",
|
||||
sizeErrorStr: "허용 된 최대 크기를 초과합니다.: ",
|
||||
uploadErrorStr: "업로드가 허용되지 않습니다.",
|
||||
maxFileCountErrorStr: " 최대 허용 파일 수가 초과 되었습니다.:",
|
||||
downloadStr: "Download",
|
||||
customErrorKeyStr: "content-padded text-danger",
|
||||
showQueueDiv: false,
|
||||
statusBarWidth: 400,
|
||||
dragdropWidth: 400,
|
||||
showPreview: false,
|
||||
previewHeight: "auto",
|
||||
previewWidth: "100%",
|
||||
extraHTML:false,
|
||||
uploadQueueOrder:'top'
|
||||
}, options);
|
||||
|
||||
this.fileCounter = 1;
|
||||
this.selectedFiles = 0;
|
||||
var formGroup = "ajax-file-upload-" + (new Date().getTime());
|
||||
this.formGroup = formGroup;
|
||||
this.errorLog = $("<div></div>"); //Writing errors
|
||||
this.responses = [];
|
||||
this.existingFileNames = [];
|
||||
if(!feature.formdata) //check drag drop enabled.
|
||||
{
|
||||
s.dragDrop = false;
|
||||
}
|
||||
if(!feature.formdata) {
|
||||
s.multiple = false;
|
||||
}
|
||||
|
||||
$(this).html("");
|
||||
|
||||
var obj = this;
|
||||
|
||||
var uploadLabel = $('<div>' + s.uploadStr + '</div>');
|
||||
|
||||
$(uploadLabel).addClass(s.uploadButtonClass);
|
||||
|
||||
// wait form ajax Form plugin and initialize
|
||||
(function checkAjaxFormLoaded() {
|
||||
if($.fn.ajaxForm) {
|
||||
|
||||
if(s.dragDrop) {
|
||||
var dragDrop = $('<div class="' + s.dragDropContainerClass + '" style="vertical-align:top;"></div>').width(s.dragdropWidth);
|
||||
$(obj).append(dragDrop);
|
||||
$(dragDrop).append(uploadLabel);
|
||||
$(dragDrop).append($(s.dragDropStr));
|
||||
setDragDropHandlers(obj, s, dragDrop);
|
||||
|
||||
} else {
|
||||
$(obj).append(uploadLabel);
|
||||
}
|
||||
$(obj).append(obj.errorLog);
|
||||
|
||||
// 미리보기 div 출력 삭제 - 이 부분은 해당 페이지에서 커스텀으로 처리한다.
|
||||
// if(s.showQueueDiv)
|
||||
// obj.container =$("#"+s.showQueueDiv);
|
||||
// else
|
||||
// obj.container = $("<div class='ajax-file-upload-container'></div>").insertAfter($(obj));
|
||||
|
||||
s.onLoad.call(this, obj);
|
||||
createCustomInputFile(obj, formGroup, s, uploadLabel);
|
||||
|
||||
} else window.setTimeout(checkAjaxFormLoaded, 10);
|
||||
})();
|
||||
|
||||
this.startUpload = function () {
|
||||
$("form").each(function(i,items)
|
||||
{
|
||||
if($(this).hasClass(obj.formGroup))
|
||||
{
|
||||
mainQ.push($(this));
|
||||
}
|
||||
});
|
||||
|
||||
if(mainQ.length >= 1 )
|
||||
submitPendingUploads();
|
||||
|
||||
}
|
||||
|
||||
this.getFileCount = function () {
|
||||
return obj.selectedFiles;
|
||||
|
||||
}
|
||||
this.stopUpload = function () {
|
||||
$("." + s.abortButtonClass).each(function (i, items) {
|
||||
if($(this).hasClass(obj.formGroup)) $(this).click();
|
||||
});
|
||||
$("." + s.cancelButtonClass).each(function (i, items) {
|
||||
if($(this).hasClass(obj.formGroup)) $(this).click();
|
||||
});
|
||||
}
|
||||
this.cancelAll = function () {
|
||||
$("." + s.cancelButtonClass).each(function (i, items) {
|
||||
if($(this).hasClass(obj.formGroup)) $(this).click();
|
||||
});
|
||||
}
|
||||
this.update = function (settings) {
|
||||
//update new settings
|
||||
s = $.extend(s, settings);
|
||||
}
|
||||
this.reset = function (removeStatusBars) {
|
||||
obj.fileCounter = 1;
|
||||
obj.selectedFiles = 0;
|
||||
obj.errorLog.html("");
|
||||
//remove all the status bars.
|
||||
if(removeStatusBars != false)
|
||||
{
|
||||
obj.container.html("");
|
||||
}
|
||||
}
|
||||
this.remove = function()
|
||||
{
|
||||
obj.container.html("");
|
||||
$(obj).remove();
|
||||
|
||||
}
|
||||
//This is for showing Old files to user.
|
||||
this.createProgress = function (filename,filepath,filesize) {
|
||||
var pd = new createProgressDiv(this, s);
|
||||
pd.progressDiv.show();
|
||||
pd.progressbar.width('100%');
|
||||
|
||||
var fileNameStr = "";
|
||||
if(s.showFileCounter)
|
||||
fileNameStr = obj.fileCounter + s.fileCounterStyle + filename;
|
||||
else fileNameStr = filename;
|
||||
|
||||
|
||||
if(s.showFileSize)
|
||||
fileNameStr += " ("+getSizeStr(filesize)+")";
|
||||
|
||||
|
||||
pd.filename.html(fileNameStr);
|
||||
obj.fileCounter++;
|
||||
obj.selectedFiles++;
|
||||
if(s.showPreview)
|
||||
{
|
||||
pd.preview.attr('src',filepath);
|
||||
pd.preview.show();
|
||||
}
|
||||
|
||||
if(s.showDownload) {
|
||||
pd.download.show();
|
||||
pd.download.click(function () {
|
||||
if(s.downloadCallback) s.downloadCallback.call(obj, [filename]);
|
||||
});
|
||||
}
|
||||
if(s.showDelete)
|
||||
{
|
||||
pd.del.show();
|
||||
pd.del.click(function () {
|
||||
pd.statusbar.hide().remove();
|
||||
var arr = [filename];
|
||||
if(s.deleteCallback) s.deleteCallback.call(this, arr, pd);
|
||||
obj.selectedFiles -= 1;
|
||||
updateFileCounter(s, obj);
|
||||
});
|
||||
}
|
||||
|
||||
return pd;
|
||||
}
|
||||
|
||||
this.getResponses = function () {
|
||||
return this.responses;
|
||||
}
|
||||
var mainQ=[];
|
||||
var progressQ=[]
|
||||
var running = false;
|
||||
function submitPendingUploads() {
|
||||
if(running) return;
|
||||
running = true;
|
||||
(function checkPendingForms() {
|
||||
|
||||
//if not sequential upload all files
|
||||
if(!s.sequential) s.sequentialCount=99999;
|
||||
|
||||
if(mainQ.length == 0 && progressQ.length == 0)
|
||||
{
|
||||
if(s.afterUploadAll) s.afterUploadAll(obj);
|
||||
running= false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( progressQ.length < s.sequentialCount)
|
||||
{
|
||||
var frm = mainQ.shift();
|
||||
if(frm != undefined)
|
||||
{
|
||||
progressQ.push(frm);
|
||||
frm.submit();
|
||||
}
|
||||
}
|
||||
window.setTimeout(checkPendingForms, 100);
|
||||
}
|
||||
})();
|
||||
}
|
||||
|
||||
function setDragDropHandlers(obj, s, ddObj) {
|
||||
ddObj.on('dragenter', function (e) {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
$(this).addClass(s.dragDropHoverClass);
|
||||
});
|
||||
ddObj.on('dragover', function (e) {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
var that = $(this);
|
||||
if (that.hasClass(s.dragDropContainerClass) && !that.hasClass(s.dragDropHoverClass)) {
|
||||
that.addClass(s.dragDropHoverClass);
|
||||
}
|
||||
});
|
||||
ddObj.on('drop', function (e) {
|
||||
e.preventDefault();
|
||||
$(this).removeClass(s.dragDropHoverClass);
|
||||
obj.errorLog.html("");
|
||||
var files = e.originalEvent.dataTransfer.files;
|
||||
if(!s.multiple && files.length > 1) {
|
||||
if(s.showError) $("<div class='" + s.errorClass + "'>" + s.multiDragErrorStr + "</div>").appendTo(obj.errorLog);
|
||||
return;
|
||||
}
|
||||
if(s.onSelect(files) == false) return;
|
||||
serializeAndUploadFiles(s, obj, files);
|
||||
});
|
||||
ddObj.on('dragleave', function (e) {
|
||||
$(this).removeClass(s.dragDropHoverClass);
|
||||
});
|
||||
|
||||
$(document).on('dragenter', function (e) {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
});
|
||||
$(document).on('dragover', function (e) {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
var that = $(this);
|
||||
if (!that.hasClass(s.dragDropContainerClass)) {
|
||||
that.removeClass(s.dragDropHoverClass);
|
||||
}
|
||||
});
|
||||
$(document).on('drop', function (e) {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
$(this).removeClass(s.dragDropHoverClass);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function getSizeStr(size) {
|
||||
var sizeStr = "";
|
||||
var sizeKB = size / 1024;
|
||||
if(parseInt(sizeKB) > 1024) {
|
||||
var sizeMB = sizeKB / 1024;
|
||||
sizeStr = sizeMB.toFixed(2) + " MB";
|
||||
} else {
|
||||
sizeStr = sizeKB.toFixed(2) + " KB";
|
||||
}
|
||||
return sizeStr;
|
||||
}
|
||||
|
||||
function serializeData(extraData) {
|
||||
var serialized = [];
|
||||
if(jQuery.type(extraData) == "string") {
|
||||
serialized = extraData.split('&');
|
||||
} else {
|
||||
serialized = $.param(extraData).split('&');
|
||||
}
|
||||
var len = serialized.length;
|
||||
var result = [];
|
||||
var i, part;
|
||||
for(i = 0; i < len; i++) {
|
||||
serialized[i] = serialized[i].replace(/\+/g, ' ');
|
||||
part = serialized[i].split('=');
|
||||
result.push([decodeURIComponent(part[0]), decodeURIComponent(part[1])]);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function noserializeAndUploadFiles(s, obj, files) {
|
||||
var ts = s;
|
||||
var fd = new FormData();
|
||||
var fileArray = [];
|
||||
var fileName = s.fileName.replace("[]", "");
|
||||
var fileListStr="";
|
||||
|
||||
for (var i = 0; i < files.length; i++) {
|
||||
if (!isFileTypeAllowed(obj, s, files[i].name)) {
|
||||
if (s.showError) $("<div><font color='red'><b>" + files[i].name + "</b> " + s.extErrorStr + s.allowedTypes + "</font></div>").appendTo(obj.errorLog);
|
||||
continue;
|
||||
}
|
||||
if (s.maxFileSize != -1 && files[i].size > s.maxFileSize) {
|
||||
if (s.showError) $("<div><font color='red'><b>" + files[i].name + "</b> " + s.sizeErrorStr + getSizeStr(s.maxFileSize) + "</font></div>").appendTo(obj.errorLog);
|
||||
continue;
|
||||
}
|
||||
fd.append(fileName+"[]", files[i]);
|
||||
fileArray.push(files[i].name);
|
||||
fileListStr += obj.fileCounter + "). " + files[i].name+"<br>";
|
||||
obj.fileCounter++;
|
||||
}
|
||||
if(fileArray.length ==0 ) return;
|
||||
|
||||
var extraData = s.formData;
|
||||
if (extraData) {
|
||||
var sData = serializeData(extraData);
|
||||
for (var j = 0; j < sData.length; j++) {
|
||||
if (sData[j]) {
|
||||
fd.append(sData[j][0], sData[j][1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ts.fileData = fd;
|
||||
var pd = new createProgressDiv(obj, s);
|
||||
pd.filename.html(fileListStr);
|
||||
var form = $("<form style='display:block; position:absolute;left: 150px;' class='" + obj.formGroup + "' method='" + s.method + "' action='" + s.url + "' enctype='" + s.enctype + "'></form>");
|
||||
form.appendTo('body');
|
||||
ajaxFormSubmit(form, ts, pd, fileArray, obj);
|
||||
|
||||
}
|
||||
|
||||
|
||||
function serializeAndUploadFiles(s, obj, files) {
|
||||
for(var i = 0; i < files.length; i++) {
|
||||
if(!isFileTypeAllowed(obj, s, files[i].name)) {
|
||||
if(s.showError) $("<div class='" + s.errorClass + "'><b>" + files[i].name + "</b> " + s.extErrorStr + s.allowedTypes + "</div>").appendTo(obj.errorLog);
|
||||
continue;
|
||||
}
|
||||
if(!s.allowDuplicates && isFileDuplicate(obj, files[i].name)) {
|
||||
if(s.showError) $("<div class='" + s.errorClass + "'><b>" + files[i].name + "</b> " + s.duplicateErrorStr + "</div>").appendTo(obj.errorLog);
|
||||
continue;
|
||||
}
|
||||
if(s.maxFileSize != -1 && files[i].size > s.maxFileSize) {
|
||||
if(s.showError) $("<div class='" + s.errorClass + "'><b>" + files[i].name + "</b> " + s.sizeErrorStr + getSizeStr(s.maxFileSize) + "</div>").appendTo(
|
||||
obj.errorLog);
|
||||
continue;
|
||||
}
|
||||
if(s.maxFileCount != -1 && obj.selectedFiles >= s.maxFileCount) {
|
||||
if(s.showError) $("<div class='" + s.errorClass + "'><b>" + files[i].name + "</b> " + s.maxFileCountErrorStr + s.maxFileCount + "</div>").appendTo(
|
||||
obj.errorLog);
|
||||
continue;
|
||||
}
|
||||
obj.selectedFiles++;
|
||||
obj.existingFileNames.push(files[i].name);
|
||||
var ts = s;
|
||||
var fd = new FormData();
|
||||
var fileName = s.fileName.replace("[]", "");
|
||||
fd.append(fileName, files[i]);
|
||||
var extraData = s.formData;
|
||||
if(extraData) {
|
||||
var sData = serializeData(extraData);
|
||||
for(var j = 0; j < sData.length; j++) {
|
||||
if(sData[j]) {
|
||||
fd.append(sData[j][0], sData[j][1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
ts.fileData = fd;
|
||||
|
||||
var pd = new createProgressDiv(obj, s);
|
||||
var fileNameStr = "";
|
||||
if(s.showFileCounter) fileNameStr = obj.fileCounter + s.fileCounterStyle + files[i].name
|
||||
else fileNameStr = files[i].name;
|
||||
|
||||
if(s.showFileSize)
|
||||
fileNameStr += " ("+getSizeStr(files[i].size)+")";
|
||||
|
||||
pd.filename.html(fileNameStr);
|
||||
var form = $("<form style='display:block; position:absolute;left: 150px;' class='" + obj.formGroup + "' method='" + s.method + "' action='" +
|
||||
s.url + "' enctype='" + s.enctype + "'></form>");
|
||||
form.appendTo('body');
|
||||
var fileArray = [];
|
||||
fileArray.push(files[i].name);
|
||||
|
||||
ajaxFormSubmit(form, ts, pd, fileArray, obj, files[i]);
|
||||
obj.fileCounter++;
|
||||
}
|
||||
}
|
||||
|
||||
function isFileTypeAllowed(obj, s, fileName) {
|
||||
var fileExtensions = s.allowedTypes.toLowerCase().split(/[\s,]+/g);
|
||||
var ext = fileName.split('.').pop().toLowerCase();
|
||||
if(s.allowedTypes != "*" && jQuery.inArray(ext, fileExtensions) < 0) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function isFileDuplicate(obj, filename) {
|
||||
var duplicate = false;
|
||||
if (obj.existingFileNames.length) {
|
||||
for (var x=0; x<obj.existingFileNames.length; x++) {
|
||||
if (obj.existingFileNames[x] == filename
|
||||
|| s.duplicateStrict && obj.existingFileNames[x].toLowerCase() == filename.toLowerCase()
|
||||
) {
|
||||
duplicate = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return duplicate;
|
||||
}
|
||||
|
||||
function removeExistingFileName(obj, fileArr) {
|
||||
if (obj.existingFileNames.length) {
|
||||
for (var x=0; x<fileArr.length; x++) {
|
||||
var pos = obj.existingFileNames.indexOf(fileArr[x]);
|
||||
if (pos != -1) {
|
||||
obj.existingFileNames.splice(pos, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getSrcToPreview(file, obj) {
|
||||
if(file) {
|
||||
obj.show();
|
||||
var reader = new FileReader();
|
||||
reader.onload = function (e) {
|
||||
obj.attr('src', e.target.result);
|
||||
};
|
||||
reader.readAsDataURL(file);
|
||||
}
|
||||
}
|
||||
|
||||
function updateFileCounter(s, obj) {
|
||||
if(s.showFileCounter) {
|
||||
var count = $(obj.container).find(".ajax-file-upload-filename").length;
|
||||
obj.fileCounter = count + 1;
|
||||
$(obj.container).find(".ajax-file-upload-filename").each(function (i, items) {
|
||||
var arr = $(this).html().split(s.fileCounterStyle);
|
||||
var fileNum = parseInt(arr[0]) - 1; //decrement;
|
||||
var name = count + s.fileCounterStyle + arr[1];
|
||||
$(this).html(name);
|
||||
count--;
|
||||
});
|
||||
}
|
||||
}
|
||||
// input 폼 세팅함수
|
||||
function createCustomInputFile (obj, group, s, uploadLabel) {
|
||||
|
||||
//var fileUploadId = "ajax-upload-id-" + (new Date().getTime());
|
||||
var fileUploadId=s.inputId; // 옵션에서 지정한 id 값으로 세팅한다.
|
||||
|
||||
var form = $("<form method='" + s.method + "' action='" + s.url + "' enctype='" + s.enctype + "'></form>");
|
||||
var fileInputStr = "<input type='file' id='" + fileUploadId + "' name='" + s.fileName + "' accept='" + s.acceptFiles + "'/>";
|
||||
if(s.multiple) {
|
||||
if(s.fileName.indexOf("[]") != s.fileName.length - 2) // if it does not endwith
|
||||
{
|
||||
s.fileName += "[]";
|
||||
}
|
||||
fileInputStr = "<input type='file' id='" + fileUploadId + "' name='" + s.fileName + "' accept='" + s.acceptFiles + "' multiple/>";
|
||||
}
|
||||
var fileInput = $(fileInputStr).appendTo(form);
|
||||
|
||||
//fileInput.change(function () {
|
||||
$(form).on('change','#'+fileUploadId,function(){
|
||||
console.log(fileUploadId);
|
||||
obj.errorLog.html("");
|
||||
var fileExtensions = s.allowedTypes.toLowerCase().split(",");
|
||||
var fileArray = [];
|
||||
if(this.files) //support reading files
|
||||
{
|
||||
for(i = 0; i < this.files.length; i++) {
|
||||
fileArray.push(this.files[i].name);
|
||||
}
|
||||
|
||||
if(s.onSelect(this.files) == false) return;
|
||||
} else {
|
||||
var filenameStr = $(this).val();
|
||||
var flist = [];
|
||||
fileArray.push(filenameStr);
|
||||
if(!isFileTypeAllowed(obj, s, filenameStr)) {
|
||||
if(s.showError) $("<div class='" + s.errorClass + "'><b>" + filenameStr + "</b> " + s.extErrorStr + s.allowedTypes + "</div>").appendTo(
|
||||
obj.errorLog);
|
||||
return;
|
||||
}
|
||||
//fallback for browser without FileAPI
|
||||
flist.push({
|
||||
name: filenameStr,
|
||||
size: 'NA'
|
||||
});
|
||||
if(s.onSelect(flist) == false) return;
|
||||
|
||||
}
|
||||
updateFileCounter(s, obj);
|
||||
|
||||
uploadLabel.unbind("click");
|
||||
form.hide();
|
||||
createCustomInputFile(obj, group, s, uploadLabel);
|
||||
form.addClass(group);
|
||||
if(s.serialize && feature.fileapi && feature.formdata) //use HTML5 support and split file submission
|
||||
{
|
||||
form.removeClass(group); //Stop Submitting when.
|
||||
var files = this.files;
|
||||
form.remove();
|
||||
serializeAndUploadFiles(s, obj, files);
|
||||
} else {
|
||||
var fileList = "";
|
||||
for(var i = 0; i < fileArray.length; i++) {
|
||||
if(s.showFileCounter) fileList += obj.fileCounter + s.fileCounterStyle + fileArray[i] + "<br>";
|
||||
else fileList += fileArray[i] + "<br>";;
|
||||
obj.fileCounter++;
|
||||
|
||||
}
|
||||
if(s.maxFileCount != -1 && (obj.selectedFiles + fileArray.length) > s.maxFileCount) {
|
||||
if(s.showError) $("<div class='" + s.errorClass + "'><b>" + fileList + "</b> " + s.maxFileCountErrorStr + s.maxFileCount + "</div>").appendTo(
|
||||
obj.errorLog);
|
||||
return;
|
||||
}
|
||||
obj.selectedFiles += fileArray.length;
|
||||
|
||||
var pd = new createProgressDiv(obj, s);
|
||||
pd.filename.html(fileList);
|
||||
ajaxFormSubmit(form, s, pd, fileArray, obj, null);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
if(s.nestedForms) {
|
||||
form.css({
|
||||
'margin': 0,
|
||||
'padding': 0
|
||||
});
|
||||
uploadLabel.css({
|
||||
position: 'relative',
|
||||
overflow: 'hidden',
|
||||
cursor: 'default'
|
||||
});
|
||||
fileInput.css({
|
||||
position: 'absolute',
|
||||
'cursor': 'pointer',
|
||||
'top': '0px',
|
||||
'width': '100%',
|
||||
'height': '100%',
|
||||
'left': '0px',
|
||||
'z-index': '100',
|
||||
'opacity': '0.0',
|
||||
'filter': 'alpha(opacity=0)',
|
||||
'-ms-filter': "alpha(opacity=0)",
|
||||
'-khtml-opacity': '0.0',
|
||||
'-moz-opacity': '0.0'
|
||||
});
|
||||
form.appendTo(uploadLabel);
|
||||
|
||||
} else {
|
||||
form.appendTo($('body'));
|
||||
form.css({
|
||||
margin: 0,
|
||||
padding: 0,
|
||||
display: 'block',
|
||||
position: 'absolute',
|
||||
left: '-250px'
|
||||
});
|
||||
if(navigator.appVersion.indexOf("MSIE ") != -1) //IE Browser
|
||||
{
|
||||
uploadLabel.attr('for', fileUploadId);
|
||||
} else {
|
||||
uploadLabel.click(function () {
|
||||
fileInput.click();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function defaultProgressBar(obj,s)
|
||||
{
|
||||
|
||||
this.statusbar = $("<div class='ajax-file-upload-statusbar'></div>").width(s.statusBarWidth);
|
||||
this.preview = $("<img class='ajax-file-upload-preview' />").width(s.previewWidth).height(s.previewHeight).appendTo(this.statusbar).hide();
|
||||
this.filename = $("<div class='ajax-file-upload-filename'></div>").appendTo(this.statusbar);
|
||||
this.progressDiv = $("<div class='ajax-file-upload-progress'>").appendTo(this.statusbar).hide();
|
||||
this.progressbar = $("<div class='ajax-file-upload-bar'></div>").appendTo(this.progressDiv);
|
||||
this.abort = $("<div>" + s.abortStr + "</div>").appendTo(this.statusbar).hide();
|
||||
this.cancel = $("<div>" + s.cancelStr + "</div>").appendTo(this.statusbar).hide();
|
||||
this.done = $("<div>" + s.doneStr + "</div>").appendTo(this.statusbar).hide();
|
||||
this.download = $("<div>" + s.downloadStr + "</div>").appendTo(this.statusbar).hide();
|
||||
this.del = $("<div>" + s.deletelStr + "</div>").appendTo(this.statusbar).hide();
|
||||
|
||||
this.abort.addClass("ajax-file-upload-red");
|
||||
this.done.addClass("ajax-file-upload-green");
|
||||
this.download.addClass("ajax-file-upload-green");
|
||||
this.cancel.addClass("ajax-file-upload-red");
|
||||
this.del.addClass("ajax-file-upload-red");
|
||||
|
||||
return this;
|
||||
}
|
||||
function createProgressDiv(obj, s) {
|
||||
var bar = null;
|
||||
if(s.customProgressBar)
|
||||
bar = new s.customProgressBar(obj,s);
|
||||
else
|
||||
bar = new defaultProgressBar(obj,s);
|
||||
|
||||
bar.abort.addClass(obj.formGroup);
|
||||
bar.abort.addClass(s.abortButtonClass);
|
||||
|
||||
bar.cancel.addClass(obj.formGroup);
|
||||
bar.cancel.addClass(s.cancelButtonClass);
|
||||
|
||||
if(s.extraHTML)
|
||||
bar.extraHTML = $("<div class='extrahtml'>"+s.extraHTML()+"</div>").insertAfter(bar.filename);
|
||||
|
||||
if(s.uploadQueueOrder == 'bottom')
|
||||
$(obj.container).append(bar.statusbar);
|
||||
else
|
||||
$(obj.container).prepend(bar.statusbar);
|
||||
return bar;
|
||||
}
|
||||
|
||||
|
||||
function ajaxFormSubmit(form, s, pd, fileArray, obj, file) {
|
||||
var currentXHR = null;
|
||||
var options = {
|
||||
cache: false,
|
||||
contentType: false,
|
||||
processData: false,
|
||||
forceSync: false,
|
||||
type: s.method,
|
||||
data: s.formData,
|
||||
formData: s.fileData,
|
||||
dataType: s.returnType,
|
||||
beforeSubmit: function (formData, $form, options) {
|
||||
if(s.onSubmit.call(this, fileArray) != false) {
|
||||
if(s.dynamicFormData)
|
||||
{
|
||||
var sData = serializeData(s.dynamicFormData());
|
||||
if(sData) {
|
||||
for(var j = 0; j < sData.length; j++) {
|
||||
if(sData[j]) {
|
||||
if(s.fileData != undefined) options.formData.append(sData[j][0], sData[j][1]);
|
||||
else options.data[sData[j][0]] = sData[j][1];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(s.extraHTML)
|
||||
{
|
||||
$(pd.extraHTML).find("input,select,textarea").each(function(i,items)
|
||||
{
|
||||
if(s.fileData != undefined) options.formData.append($(this).attr('name'),$(this).val());
|
||||
else options.data[$(this).attr('name')] = $(this).val();
|
||||
});
|
||||
}
|
||||
return true;
|
||||
}
|
||||
pd.statusbar.append("<div class='" + s.errorClass + "'>" + s.uploadErrorStr + "</div>");
|
||||
pd.cancel.show()
|
||||
form.remove();
|
||||
pd.cancel.click(function () {
|
||||
mainQ.splice(mainQ.indexOf(form), 1);
|
||||
removeExistingFileName(obj, fileArray);
|
||||
pd.statusbar.remove();
|
||||
s.onCancel.call(obj, fileArray, pd);
|
||||
obj.selectedFiles -= fileArray.length; //reduce selected File count
|
||||
updateFileCounter(s, obj);
|
||||
});
|
||||
return false;
|
||||
},
|
||||
beforeSend: function (xhr, o) {
|
||||
|
||||
pd.progressDiv.show();
|
||||
pd.cancel.hide();
|
||||
pd.done.hide();
|
||||
if(s.showAbort) {
|
||||
pd.abort.show();
|
||||
pd.abort.click(function () {
|
||||
removeExistingFileName(obj, fileArray);
|
||||
xhr.abort();
|
||||
obj.selectedFiles -= fileArray.length; //reduce selected File count
|
||||
s.onAbort.call(obj, fileArray, pd);
|
||||
|
||||
});
|
||||
}
|
||||
if(!feature.formdata) //For iframe based push
|
||||
{
|
||||
pd.progressbar.width('5%');
|
||||
} else pd.progressbar.width('1%'); //Fix for small files
|
||||
},
|
||||
uploadProgress: function (event, position, total, percentComplete) {
|
||||
//Fix for smaller file uploads in MAC
|
||||
if(percentComplete > 98) percentComplete = 98;
|
||||
|
||||
var percentVal = percentComplete + '%';
|
||||
if(percentComplete > 1) pd.progressbar.width(percentVal)
|
||||
if(s.showProgress) {
|
||||
pd.progressbar.html(percentVal);
|
||||
pd.progressbar.css('text-align', 'center');
|
||||
}
|
||||
|
||||
},
|
||||
success: function (data, message, xhr) {
|
||||
pd.cancel.remove();
|
||||
progressQ.pop();
|
||||
//For custom errors.
|
||||
if(s.returnType == "json" && $.type(data) == "object" && data.hasOwnProperty(s.customErrorKeyStr)) {
|
||||
pd.abort.hide();
|
||||
var msg = data[s.customErrorKeyStr];
|
||||
s.onError.call(this, fileArray, 200, msg, pd);
|
||||
if(s.showStatusAfterError) {
|
||||
pd.progressDiv.hide();
|
||||
pd.statusbar.append("<span class='" + s.errorClass + "'>ERROR: " + msg + "</span>");
|
||||
} else {
|
||||
pd.statusbar.hide();
|
||||
pd.statusbar.remove();
|
||||
}
|
||||
obj.selectedFiles -= fileArray.length; //reduce selected File count
|
||||
form.remove();
|
||||
return;
|
||||
}
|
||||
obj.responses.push(data);
|
||||
pd.progressbar.width('100%')
|
||||
if(s.showProgress) {
|
||||
pd.progressbar.html('100%');
|
||||
pd.progressbar.css('text-align', 'center');
|
||||
}
|
||||
|
||||
pd.abort.hide();
|
||||
s.onSuccess.call(this, fileArray, data, xhr, pd); // 해당 페이지에서 업로드 성공 후 추가 액션 가능
|
||||
// 미리보기 출력
|
||||
var result=$.parseJSON(data); // a.upload.php 에서 결과값을 preview & type 으로 구분하여 json 으로 보내준다.
|
||||
var preview_default=result.preview_default; // 기본 리스트
|
||||
var preview_modal=result.preview_modal; // 모달 리스트 (소스복사외 다른 메뉴는 노출하지 않는다.)
|
||||
var attachType=result.type; // 해당 attachHandler 의 data-type 값 photo, file, map, link, people....
|
||||
var previewBox_default=$('[data-role="attach-preview-'+attachType+'"]'); // type 에 따라서 미리보기 container 를 분리해서 지정한다.
|
||||
var previewBox_modal=$('[data-role="modal-attach-preview-'+attachType+'"]'); // type 에 따라서 미리보기 container 를 분리해서 지정한다.
|
||||
$(preview_default).appendTo(previewBox_default);// 업로드 성공후 미리보기 출력되는 부분 처리
|
||||
$(preview_modal).appendTo(previewBox_modal);// 업로드 성공후 모달 미리보기 출력되는 부분 처리
|
||||
|
||||
if(s.showStatusAfterSuccess) {
|
||||
if(s.showDone) {
|
||||
pd.done.show();
|
||||
pd.done.click(function () {
|
||||
pd.statusbar.hide("slow");
|
||||
pd.statusbar.remove();
|
||||
});
|
||||
} else {
|
||||
pd.done.hide();
|
||||
}
|
||||
if(s.showDelete) {
|
||||
pd.del.show();
|
||||
pd.del.click(function () {
|
||||
removeExistingFileName(obj, fileArray);
|
||||
pd.statusbar.hide().remove();
|
||||
if(s.deleteCallback) s.deleteCallback.call(this, data, pd);
|
||||
obj.selectedFiles -= fileArray.length; //reduce selected File count
|
||||
updateFileCounter(s, obj);
|
||||
|
||||
});
|
||||
} else {
|
||||
pd.del.hide();
|
||||
}
|
||||
} else {
|
||||
pd.statusbar.hide("slow");
|
||||
pd.statusbar.remove();
|
||||
|
||||
}
|
||||
if(s.showDownload) {
|
||||
pd.download.show();
|
||||
pd.download.click(function () {
|
||||
if(s.downloadCallback) s.downloadCallback(data);
|
||||
});
|
||||
}
|
||||
form.remove();
|
||||
},
|
||||
error: function (xhr, status, errMsg) {
|
||||
pd.cancel.remove();
|
||||
progressQ.pop();
|
||||
pd.abort.hide();
|
||||
if(xhr.statusText == "abort") //we aborted it
|
||||
{
|
||||
pd.statusbar.hide("slow").remove();
|
||||
updateFileCounter(s, obj);
|
||||
|
||||
} else {
|
||||
s.onError.call(this, fileArray, status, errMsg, pd);
|
||||
if(s.showStatusAfterError) {
|
||||
pd.progressDiv.hide();
|
||||
pd.statusbar.append("<span class='" + s.errorClass + "'>ERROR: " + errMsg + "</span>");
|
||||
} else {
|
||||
pd.statusbar.hide();
|
||||
pd.statusbar.remove();
|
||||
}
|
||||
obj.selectedFiles -= fileArray.length; //reduce selected File count
|
||||
}
|
||||
|
||||
form.remove();
|
||||
}
|
||||
};
|
||||
|
||||
if(s.showPreview && file != null) {
|
||||
if(file.type.toLowerCase().split("/").shift() == "image") getSrcToPreview(file, pd.preview);
|
||||
}
|
||||
|
||||
if(s.autoSubmit) {
|
||||
form.ajaxForm(options);
|
||||
mainQ.push(form);
|
||||
submitPendingUploads();
|
||||
|
||||
} else {
|
||||
if(s.showCancel) {
|
||||
pd.cancel.show();
|
||||
pd.cancel.click(function () {
|
||||
mainQ.splice(mainQ.indexOf(form), 1);
|
||||
removeExistingFileName(obj, fileArray);
|
||||
form.remove();
|
||||
pd.statusbar.remove();
|
||||
s.onCancel.call(obj, fileArray, pd);
|
||||
obj.selectedFiles -= fileArray.length; //reduce selected File count
|
||||
updateFileCounter(s, obj);
|
||||
});
|
||||
}
|
||||
form.ajaxForm(options);
|
||||
}
|
||||
|
||||
}
|
||||
return this;
|
||||
|
||||
}
|
||||
}(jQuery));
|
||||
29
modules/mediaset/themes/_mobile/rc-default/list.php
Normal file
29
modules/mediaset/themes/_mobile/rc-default/list.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
include $g['dir_attach_theme'].'/header.php';
|
||||
?>
|
||||
<div id="attach-files" class="files"><!-- 파일폼 출력 --></div>
|
||||
<div class="rb-attach">
|
||||
<?php if($attach_object_type=='photo'):?>
|
||||
<ul class="list-group rb-attach-photo" data-role="attach-preview-photo"><!-- 포토/이미지 리스트 -->
|
||||
<?php if($parent_data['uid']):?>
|
||||
<?php echo getAttachFileList($parent_data,'upload','photo')?>
|
||||
<?php endif?>
|
||||
</ul>
|
||||
<?php elseif($attach_object_type=='file'):?>
|
||||
<ul class="list-group rb-attach-file" data-role="attach-preview-file"> <!-- 일반파일 리스트 -->
|
||||
<?php if($parent_data['uid']):?>
|
||||
<?php echo getAttachFileList($parent_data,'upload','file')?>
|
||||
<?php endif?>
|
||||
</ul>
|
||||
<?php elseif($attach_object_type=='video'):?>
|
||||
<ul class="list-group rb-attach-video" data-role="attach-preview-video"> <!-- 비디오 리스트 -->
|
||||
<?php if($parent_data['uid']):?>
|
||||
<?php echo getAttachFileList($parent_data,'upload','video')?>
|
||||
<?php endif?>
|
||||
</ul>
|
||||
<?php endif?>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
include $g['dir_attach_theme'].'/footer.php';
|
||||
?>
|
||||
250
modules/mediaset/themes/_mobile/rc-default/main.func.php
Normal file
250
modules/mediaset/themes/_mobile/rc-default/main.func.php
Normal file
@@ -0,0 +1,250 @@
|
||||
<?php
|
||||
// 첨부파일 리스트 갯수 추출 함수
|
||||
function getAttachNum($upload,$mod)
|
||||
{
|
||||
global $table;
|
||||
|
||||
$attach = getArrayString($upload);
|
||||
$attach_file_num=0;// 첨부파일 수량
|
||||
$hidden_file_num=0; // 숨김파일(다운로드 방지) 수량
|
||||
foreach($attach['data'] as $val)
|
||||
{
|
||||
$U = getUidData($table['s_upload'],$val);
|
||||
if($U['fileonly']==1) $attach_file_num++; // 전체 첨부파일 수량 증가
|
||||
if($U['hidden']==1) $hidden_file_num++; // 숨김파일 수량 증가
|
||||
}
|
||||
$down_file_num=$attach_file_num-$hidden_file_num; // 다운로드 가능한 첨부파일
|
||||
$result=array();
|
||||
$result['modify']=$attach_file_num;
|
||||
$result['view']=$down_file_num;
|
||||
|
||||
return $result[$mod];
|
||||
}
|
||||
|
||||
// 첨부파일 리스트 추출 함수 (전체)
|
||||
/*
|
||||
$parent_data : 해당 포스트의 row 배열
|
||||
$mod : upload or modal ==> 실제 업로드 모드 와 모달을 띄워서 본문에 삽입용도로 쓰거나
|
||||
*/
|
||||
function getAttachFileList($parent_data,$mod,$type)
|
||||
{
|
||||
global $table;
|
||||
|
||||
$upload=$parent_data['upload'];
|
||||
$featured_img_uid=$parent_data['featured_img'];// 대표이미지 uid
|
||||
$featured_video_uid=$parent_data['featured_video'];// 대표비디오 uid
|
||||
$featured_audio_uid=$parent_data['featured_audio'];// 대표오디오 uid
|
||||
|
||||
if($type=='file') $sql='type=1';
|
||||
else if($type=='photo') $sql='type=2';
|
||||
else if($type=='audio') $sql='type=4';
|
||||
else if($type=='video') $sql='type=5';
|
||||
else if($type=='doc') $sql='type=6';
|
||||
else if($type=='zip') $sql='type=7';
|
||||
else $sql='type=1';
|
||||
|
||||
$attach = getArrayString($upload);
|
||||
$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','desc','',1);
|
||||
$html='';
|
||||
while($R=db_fetch_array($RCD)){
|
||||
$U=getUidData($table['s_upload'],$R['uid']);
|
||||
|
||||
if($type=='file') $html.=getAttachFile($U,$mod,$featured_img_uid);
|
||||
else if($type=='photo') $html.=getAttachFile($U,$mod,$featured_img_uid);
|
||||
else if($type=='audio') $html.=getAttachAudio($U,$mod,$featured_audio_uid);
|
||||
else if($type=='video') $html.=getAttachVideo($U,$mod,$featured_video_uid);
|
||||
else $html.=getAttachFile($U,$mod,$featured_img_uid);;
|
||||
}
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
|
||||
// 첨부파일 리스트 추출 함수 (낱개)
|
||||
function getAttachFile($R,$mod,$featured_img_uid)
|
||||
{
|
||||
global $g,$r;
|
||||
|
||||
$fileName=explode('.',$R['name']);
|
||||
$file_name=$fileName[0]; // 파일명만 분리
|
||||
|
||||
if ($R['type']==2) {
|
||||
$type='photo';
|
||||
} elseif($R['type']==4) {
|
||||
$type='audio';
|
||||
} elseif($R['type']==5) {
|
||||
$type='video';
|
||||
} else {
|
||||
$type='file';
|
||||
}
|
||||
|
||||
if($type=='photo'){
|
||||
$caption=$R['caption']?$R['caption']:$file_name;
|
||||
$img_origin=$R['host'].'/'.$R['folder'].'/'.$R['tmpname'];
|
||||
$thumb_list=getPreviewResize($R['src'],'q'); // 미리보기 사이즈 조정 (이미지 업로드시 썸네일을 만들 필요 없다.)
|
||||
$thumb_modal=getPreviewResize($R['src'],'n'); // 정보수정 모달용 사이즈 조정 (이미지 업로드시 썸네일을 만들 필요 없다.)
|
||||
$insert_text='';
|
||||
}else if($type=='file'){
|
||||
$caption=$R['caption']?$R['caption']:$R['name'];
|
||||
$src=$R['host'].$R['folder'].'/'.$R['name'];
|
||||
$insert_text='['.$caption.']('.$g['url_root'].'/?r='.$r.'&m=attach&a=download&uid='.$R['uid'].')';
|
||||
}
|
||||
|
||||
|
||||
$html='';
|
||||
$html.='
|
||||
<li class="table-view-cell media" data-id="'.$R['uid'].'" data-role="attach-item">';
|
||||
|
||||
if($R['type']==2){
|
||||
$html.='
|
||||
<img class="media-object pull-left" src="'.$thumb_list.'" alt="'.$caption.'" style="width: 42px;height: 42px">
|
||||
<div class="media-body">';
|
||||
$html.='<span class="badge badge-pill'.($R['uid']==$featured_img_uid?'':' hidden').'" data-role="attachList-label-featured" data-id="'.$R['uid'].'">대표</span> ';
|
||||
$html.='<span class="badge badge-pill'.(!$R['hidden']?' hidden':'').'" data-role="attachList-label-hidden-'.$R['uid'].'">숨김</span>';
|
||||
$html.=
|
||||
$R['name'].'
|
||||
<p>'.getSizeFormat($R['size'],2).'</p>
|
||||
</div>';
|
||||
}else {
|
||||
$html.='
|
||||
<div class="media-body">
|
||||
<i class="fa fa-floppy-o fa-fw"></i>';
|
||||
$html.='<span class="badge badge-pill'.(!$R['hidden']?' hidden':'').'" data-role="attachList-label-hidden-'.$R['uid'].'">숨김</span>';
|
||||
$html.=$R['name'].'
|
||||
<p>'.getSizeFormat($R['size'],2).'</p>
|
||||
</div>';
|
||||
}
|
||||
$html.='
|
||||
|
||||
<div class="btn-group">';
|
||||
if($mod=='upload') $html.='<input type="hidden" name="attachfiles[]" value="['.$R['uid'].']"/>';
|
||||
$html.='
|
||||
<button type="button" class="btn btn-secondary" data-act="sheet" data-target="#sheet-attach-moreAct" data-id="'.$R['uid'].'" data-showhide="'.(!$R['hidden']?'hide':'show').'" data-insert="'.$insert_text.'" data-title="'.$R['name'].'" data-type="'.$type.'"><span class="fa fa-caret-down"></span></button>';
|
||||
if($mod=='upload'){
|
||||
$html.='
|
||||
<ul class="hidden dropdown-menu dropdown-menu-right" role="menu">';
|
||||
if($R['type']==2){
|
||||
$html.='
|
||||
<li><a class="dropdown-item" href="#" data-attach-act="featured-img" data-type="'.$type.'" data-id="'.$R['uid'].'">대표이미지 설정</a></li>';
|
||||
}
|
||||
$html.='
|
||||
<li><a class="dropdown-item" href="#" data-toggle="modal" data-target="#modal-attach-'.($R['type']==2?'photo':'file').'-meta" data-filename="'.$file_name.'" data-fileext="'.$R['ext'].'" data-caption="'.$caption.'" data-src="'.$thumb_modal.'" data-origin="'.$img_origin.'" data-attach-act="edit" data-id="'.$R['uid'].'" data-type="'.$type.'" data-role="attachList-menu-edit-'.$R['uid'].'">정보수정</a></li>
|
||||
<li><a class="dropdown-item" href="#" data-attach-act="showhide" data-role="attachList-menu-showhide-'.$R['uid'].'" data-id="'.$R['uid'].'" data-content="'.($R['hidden']?'show':'hide').'" >'.($R['hidden']?'보이기':'숨기기').'</a></li>
|
||||
<li><a class="dropdown-item" href="#" data-attach-act="delete" data-id="'.$R['uid'].'" data-role="attachList-menu-delete-'.$R['uid'].'" data-featured="" data-type="'.$type.'">삭제</a></li>
|
||||
</ul>';
|
||||
}
|
||||
$html.='
|
||||
</div>
|
||||
|
||||
</li>';
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
// 오디오파일 리스트 추출 함수 (낱개)
|
||||
function getAttachAudio($R,$mod,$featured_audio_uid)
|
||||
{
|
||||
global $g,$r;
|
||||
|
||||
$fileName=explode('.',$R['name']);
|
||||
$file_name=$fileName[0]; // 파일명만 분리
|
||||
$caption=$R['caption']?$R['caption']:$file_name;
|
||||
|
||||
$html='';
|
||||
$html.='
|
||||
<div class="card bg-white" data-id="'.$R['uid'].'" data-role="attach-item">
|
||||
<audio controls class="card-img-top w-100"><source src="'.$R['host'].'/'.$R['folder'].'/'.$R['tmpname'].'" type="audio/mp3"></audio>
|
||||
<div class="card-block">';
|
||||
if($mod=='upload') $html.='<input type="hidden" name="attachfiles[]" value="['.$R['uid'].']"/>';
|
||||
$html.='
|
||||
<button type="button" class="btn btn-secondary btn-block mb-2" data-attach-act="delete" data-id="'.$R['uid'].'" data-role="attachList-menu-delete-'.$R['uid'].'" data-featured="" data-type="audio">삭제</button>';
|
||||
if($mod=='upload'){
|
||||
$html.='
|
||||
<a class="btn btn-secondary" href="#" data-attach-act="featured-audio" data-type="'.$type.'" data-id="'.$R['uid'].'">대표오디오 설정</a></li>';
|
||||
|
||||
$html.='
|
||||
<a class="btn btn-secondary" href="#" data-toggle="modal" data-target="#modal-attach-file-meta" data-filename="'.$file_name.'" data-fileext="'.$R['ext'].'" data-caption="'.$caption.'" data-src="'.$thumb_modal.'" data-origin="'.$img_origin.'" data-attach-act="edit" data-id="'.$R['uid'].'" data-type="audio" data-role="attachList-menu-edit-'.$R['uid'].'">정보수정</a>
|
||||
<a class="btn btn-secondary" href="#" data-attach-act="showhide" data-role="attachList-menu-showhide-'.$R['uid'].'" data-id="'.$R['uid'].'" data-content="'.($R['hidden']?'show':'hide').'" >'.($R['hidden']?'보이기':'숨기기').'</a>
|
||||
';
|
||||
}
|
||||
$html.='<h6 class="card-title mt-4"><span data-role="attachList-list-name-'.$R['uid'].'" >'.$R['name'].'</span>';
|
||||
$html.='<span class="badge badge-default'.($R['uid']==$featured_audio_uid?'':' hidden-xs-up').'" data-role="attachList-label-featured" data-id="'.$R['uid'].'">대표</span> ';
|
||||
$html.='<span class="badge badge-default'.(!$R['hidden']?' hidden-xs-up':'').'" data-role="attachList-label-hidden-'.$R['uid'].'">숨김</span>';
|
||||
$html.='
|
||||
<span class="badge badge-default">'.getSizeFormat($R['size'],2).'</span></h6><p></p></div></div>';
|
||||
return $html;
|
||||
}
|
||||
|
||||
|
||||
// 비디오파일 리스트 추출 함수 (낱개)
|
||||
function getAttachVideo($R,$mod,$featured_video_uid)
|
||||
{
|
||||
global $g,$r;
|
||||
|
||||
$fileName=explode('.',$R['name']);
|
||||
$file_name=$fileName[0]; // 파일명만 분리
|
||||
$caption=$R['caption']?$R['caption']:$file_name;
|
||||
|
||||
$html='';
|
||||
$html.='
|
||||
<div class="card bg-white" data-id="'.$R['uid'].'" data-role="attach-item">';
|
||||
|
||||
$html.='
|
||||
<div class="card-img-top embed-responsive embed-responsive-4by3"><video controls class="embed-responsive-item" controls preload="none"><source src="'.$R['host'].'/'.$R['folder'].'/'.$R['tmpname'].'" type="video/'.$R['ext'].'"></video></div>';
|
||||
$html.='<div class="card-block"><h5 class="card-title" data-role="attachList-list-name-'.$R['uid'].'" >'.$R['name'];
|
||||
|
||||
$html.='<span class="badge badge-default'.($R['uid']==$featured_video_uid?'':' hidden-xs-up').'" data-role="attachList-label-featured" data-id="'.$R['uid'].'">대표</span> ';
|
||||
$html.='<span class="badge badge-default'.(!$R['hidden']?' hidden-xs-up':'').'" data-role="attachList-label-hidden-'.$R['uid'].'">숨김</span></h5 >';
|
||||
|
||||
$html.='
|
||||
<p class="card-text text-muted">'.getSizeFormat($R['size'],2).'</p>';
|
||||
|
||||
if($mod=='upload'){ $html.=' <input type="hidden" name="attachfiles[]" value="['.$R['uid'].']"/>
|
||||
<button type="button" class="btn btn-secondary btn-block btn-sm" data-attach-act="delete" data-id="'.$R['uid'].'" data-role="attachList-menu-delete-'.$R['uid'].'" data-featured="" data-type="video">삭제</button></li>
|
||||
<div class="btn-group btn-group-sm hidden" role="group">
|
||||
<button type="button" class="btn btn-secondary" data-attach-act="delete" data-id="'.$R['uid'].'" data-role="attachList-menu-delete-'.$R['uid'].'" data-featured="" data-type="video">삭제</button></li>
|
||||
<button type="button" class="btn btn-secondary" data-attach-act="featured-video" data-type="'.$type.'" data-id="'.$R['uid'].'">대표 비디오 설정</button></li>
|
||||
<button type="button" class="btn btn-secondary" data-toggle="modal" data-target="#modal-attach-file-meta" data-filename="'.$file_name.'" data-fileext="'.$R['ext'].'" data-caption="'.$caption.'" data-src="'.$thumb_modal.'" data-origin="'.$img_origin.'" data-attach-act="edit" data-id="'.$R['uid'].'" data-type="video" data-role="attachList-menu-edit-'.$R['uid'].'">정보수정</button>
|
||||
<button type="button" class="btn btn-secondary" data-attach-act="showhide" data-role="attachList-menu-showhide-'.$R['uid'].'" data-id="'.$R['uid'].'" data-content="'.($R['hidden']?'show':'hide').'" >'.($R['hidden']?'보이기':'숨기기').'</button>
|
||||
</div>
|
||||
</div>
|
||||
';}
|
||||
|
||||
$html.='</div>';
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 본문삽입 이미지 uid 얻기 함수
|
||||
function getInsertImgUid($upload)
|
||||
{
|
||||
global $table;
|
||||
|
||||
$u_arr = getArrayString($upload);
|
||||
$Insert_arr=array();
|
||||
$i=0;
|
||||
foreach ($u_arr['data'] as $val) {
|
||||
$U=getUidData($table['s_upload'],$val);
|
||||
if(!$U['fileonly']) $Insert_arr[$i]=$val;
|
||||
$i++;
|
||||
}
|
||||
$upfiles='';
|
||||
// 중괄로로 재조립
|
||||
foreach ($Insert_arr as $uid) {
|
||||
$upfiles.='['.$uid.']';
|
||||
}
|
||||
|
||||
return $upfiles;
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
215
modules/mediaset/themes/_mobile/rc-default/main.js
Normal file
215
modules/mediaset/themes/_mobile/rc-default/main.js
Normal file
@@ -0,0 +1,215 @@
|
||||
/**
|
||||
* Copyright (c) 2015 redblock inc.
|
||||
* Author kiere@kismq.com
|
||||
* Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
|
||||
* and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
|
||||
*
|
||||
* Version: 1.0.0
|
||||
*/
|
||||
(function ($) {
|
||||
$.fn.RbAttachTheme= function (settings) {
|
||||
|
||||
var defaults = {};
|
||||
var opts = jQuery.extend(defaults, settings);
|
||||
|
||||
var module=opts.module; // 모듈명
|
||||
var theme=opts.theme; // 테마 패스
|
||||
var handler_photo=opts.handler_photo; // 사진첨부 실행 엘리먼트
|
||||
var handler_file=opts.handler_file; // 파일첨부 실행 엘리먼트
|
||||
var handler_getModalList=opts.handler_getModalList; // 첨부리스트 모달로 호출하는 엘리먼트
|
||||
var listModal=opts.listModal;
|
||||
var loaderbox='<div style="height:50%;margin-top:40%;" id="modal-loader-default"><div class="spinner-wrap"><div class="spinner"><div class="bounce1"></div><div class="bounce2"></div><div class="bounce3"></div></div></div></div>';
|
||||
|
||||
// 부모 모듈에서 파일첨부 액션 실행하는 버튼 or 기타 엘리먼트 클릭시 첨부파일 input click 이벤트 바인딩
|
||||
$(handler_file).click(function(e){
|
||||
e.preventDefault();
|
||||
$('#'+inputId).click();
|
||||
$('.rb-attach').addClass('active')
|
||||
});
|
||||
|
||||
// 부모 모듈에서 사진첨부 액션 실행하는 버튼 or 기타 엘리먼트 클릭시 첨부파일 input click 이벤트 바인딩
|
||||
$(handler_photo).click(function(e){
|
||||
e.preventDefault();
|
||||
$('#'+inputId).click();
|
||||
$('.rb-attach').addClass('active')
|
||||
});
|
||||
|
||||
// 부모 페이지 마크다운 에디터 toolbar 의 첨부파일 리스트 호출버튼 class 클릭시 첨부파일 리스트 모달 호출
|
||||
$('body').on('click',handler_getModalList,function(){
|
||||
if(handler_getModalList!='') $(listModal).modal('show');
|
||||
});
|
||||
|
||||
// 업로드 리스트 showhide 값 reset 함수
|
||||
var updateShowHide=function(uid,showhide){
|
||||
if(showhide=='show'){
|
||||
$('[data-role="attach-item"] [data-act="sheet"][data-id="'+uid+'"]').attr('data-showhide','hide');
|
||||
$('[data-role="attachList-label-hidden-'+uid+'"]').addClass('hidden'); // 숨김 라벨 숨기기
|
||||
console.log($('[data-role="attachList-label-hidden-'+uid+'"]'));
|
||||
}else{
|
||||
$('[data-role="attach-item"] [data-act="sheet"][data-id="'+uid+'"]').attr('data-showhide','show');
|
||||
$('[data-role="attachList-label-hidden-'+uid+'"]').removeClass('hidden'); // 숨김 라벨 노출
|
||||
}
|
||||
}
|
||||
|
||||
// 이벤트 바인딩 및 세팅
|
||||
$('body').on('click','[data-attach-act]',function(e){
|
||||
e.preventDefault();
|
||||
var act=$(this).data('attach-act');
|
||||
var uid=$(this).attr('data-id');
|
||||
var type=$(this).data('type'); // file or photo
|
||||
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=mediaset&a=delete',{
|
||||
uid : uid
|
||||
},function(response){
|
||||
var previewUl_default=$('[data-role="attach-preview-'+type+'"]'); // 파일 리스트 엘리먼트 class
|
||||
//var previewUl_modal=$('[data-role="modal-attach-preview-'+type+'"]'); // 파일 리스트 엘리먼트 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
|
||||
});
|
||||
}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 > 값에 적용
|
||||
|
||||
console.log('대표이미지 설정'+uid)
|
||||
$(document).find('input[name="featured_img"]').val(uid);
|
||||
|
||||
// 대표 이미지 라벨 업데이트
|
||||
$('[data-role="attachList-label-featured"]').each(function(){
|
||||
var id = $(this).data('id');
|
||||
$(this).addClass('hidden');
|
||||
//$(this).removeClass('hidden');
|
||||
// 삭제 메뉴에 대표이미지 표시 지우기
|
||||
$('[data-attach-act="delete"]').attr('data-featured','');
|
||||
if(id==uid){
|
||||
$(this).removeClass('hidden');
|
||||
// 삭제 메뉴에 대표이미지 표시
|
||||
$('[data-role="attachList-menu-delete-'+uid+'"]').attr('data-featured',1);
|
||||
}
|
||||
});
|
||||
}else if(act=='insert'){
|
||||
var src=$(this).data('origin');
|
||||
var caption=$(this).attr('data-caption');
|
||||
var dn_url = rooturl+'/download/'+uid;
|
||||
var img_html = '<img src="'+src+'" alt="'+caption+'" class="img-fluid">';
|
||||
var file_html = '<a href="'+dn_url+'">'+caption+'</a>';
|
||||
|
||||
if(type=='photo') {
|
||||
$('#summernote').summernote('insertImage',src, function ($image) {
|
||||
$image.attr('alt',caption);
|
||||
});
|
||||
|
||||
} else {
|
||||
$('#summernote').summernote('createLink', {
|
||||
text: caption,
|
||||
url: dn_url ,
|
||||
newWindow: true
|
||||
});
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
};
|
||||
})(jQuery);
|
||||
47
modules/mediaset/themes/_mobile/rc-default/main.php
Normal file
47
modules/mediaset/themes/_mobile/rc-default/main.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<style>
|
||||
.rb-attach .table-view:empty {
|
||||
display: none !important
|
||||
}
|
||||
</style>
|
||||
|
||||
<?php
|
||||
include $g['dir_attach_theme'].'/header.php';
|
||||
?>
|
||||
|
||||
<div id="attach-files" class="files"><!-- 파일폼 출력 --></div>
|
||||
|
||||
<div class="rb-attach" data-role="list"><!-- 포토/이미지 리스트 -->
|
||||
|
||||
<ul class="table-view bg-white" data-role="attach-preview-photo">
|
||||
</ul>
|
||||
|
||||
<!-- 일반파일 리스트 -->
|
||||
<ul class="table-view bg-white" data-role="attach-preview-file">
|
||||
</ul>
|
||||
|
||||
<!-- 오디오 리스트 -->
|
||||
<ul class="table-view bg-white" data-role="attach-preview-audio">
|
||||
</ul>
|
||||
|
||||
<!-- 비디오 리스트 -->
|
||||
<div class="table-view bg-white" data-role="attach-preview-video">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div data-role="attach_guide">
|
||||
<div class="d-flex justify-content-center align-items-center text-muted" style="height:70vh">
|
||||
<div data-role="attach-handler-photo" data-type="file" title="파일첨부" role="button" class="text-xs-center">
|
||||
<div class="material-icons mb-2" style="font-size: 120px;color:#ccc">
|
||||
add_photo_alternate
|
||||
</div>
|
||||
<p><small>사진,비디오,오디오,문서,파일을<br>첨부할 수 있습니다.</small></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="<?php echo $g['url_attach_theme']?>/main.js"></script>
|
||||
|
||||
<?php
|
||||
include $g['dir_attach_theme'].'/footer.php';
|
||||
?>
|
||||
177
modules/mediaset/themes/_mobile/rc-default/modals.php
Normal file
177
modules/mediaset/themes/_mobile/rc-default/modals.php
Normal file
@@ -0,0 +1,177 @@
|
||||
|
||||
<!-- 첨부 사진 메타정보 수정 -->
|
||||
<div class="modal fade rb-modal-attach-meta" id="modal-attach-photo-meta" tabindex="-1" role="dialog" aria-labelledby="">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-title" id=""><i class="fa fa-camera-retro"></i> 사진 정보수정</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="row">
|
||||
<!-- data-role="img-preview" src="_s 이미지" data-origin="원본 이미지" 넣는다. -->
|
||||
<div class="col-md-4"><p><img class="img-thumbnail" src="" alt="" data-role="img-preview" data-origin=""></p></div>
|
||||
<div class="col-md-8">
|
||||
<div class="form-group">
|
||||
<label for="file-name" class="control-label">파일명:</label>
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control" data-role="filename" name="filename">
|
||||
<span class="input-group-addon" data-role="fileext"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="file-caption" class="control-label">캡션:</label>
|
||||
<textarea class="form-control" data-role="filecaption"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal" data-attach-act="cancel" data-target="#modal-attach-photo-meta" data-role="eventHandler" data-id="">취소하기</button>
|
||||
<button type="button" class="btn btn-primary" data-attach-act="save" data-target="#modal-attach-photo-meta" data-role="eventHandler" data-id="">저장하기</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 첨부 파일 메타정보 수정 -->
|
||||
<div class="modal fade rb-modal-attach-meta" id="modal-attach-file-meta" tabindex="-1" role="dialog" aria-labelledby="">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-title" id=""><i class="fa fa-floppy-o"></i> 첨부파일 정보수정</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<h1 class="text-xs-center" data-role="img-preview">
|
||||
</h1>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<div class="form-group">
|
||||
<label for="file-name" class="control-label">파일명:</label>
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control" name="filename" data-role="filename">
|
||||
<span class="input-group-addon" data-role="fileext"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="file-caption" class="control-label">캡션:</label>
|
||||
<textarea class="form-control" data-role="filecaption" name="caption"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal" data-attach-act="cancel" data-target="#modal-attach-file-meta" data-role="eventHandler" data-id="">취소하기</button>
|
||||
<button type="button" class="btn btn-primary" data-attach-act="save" data-target="#modal-attach-file-meta" data-role="eventHandler" data-id="" data-type="">저장하기</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- 링크 추가 -->
|
||||
<div class="modal fade" tabindex="-1" role="dialog" id="modal-attach-link">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-title">링크 추가</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p id="attach-link"><!--링크 입력 필드 동적 생성 --></p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">닫기</button>
|
||||
<button type="button" class="btn btn-primary" data-plugin="clipboard" data-clipboard-text="" data-role="btn-copy-linkContent">링크내용 복사하기</button>
|
||||
</div>
|
||||
</div><!-- /.modal-content -->
|
||||
</div><!-- /.modal-dialog -->
|
||||
</div><!-- /.modal -->
|
||||
|
||||
<!-- 위치 추가 -->
|
||||
<div class="modal fade" tabindex="-1" role="dialog" id="modal-attach-map">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-title">위치 추가</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p>지도 검색 UI </p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">닫기</button>
|
||||
<button type="button" class="btn btn-primary">적용하기</button>
|
||||
</div>
|
||||
</div><!-- /.modal-content -->
|
||||
</div><!-- /.modal-dialog -->
|
||||
</div><!-- /.modal -->
|
||||
|
||||
<!-- 비디오 추가 -->
|
||||
<div class="modal fade" tabindex="-1" role="dialog" id="modal-attach-video">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-title">비디오 추가</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p>유튜브와 비메오 비디오만 링크를 추가하는 형태</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">닫기</button>
|
||||
<button type="button" class="btn btn-primary">적용하기</button>
|
||||
</div>
|
||||
</div><!-- /.modal-content -->
|
||||
</div><!-- /.modal-dialog -->
|
||||
</div><!-- /.modal -->
|
||||
|
||||
<!-- 업로드 리스트 -->
|
||||
<div class="modal fade" id="modal-attach" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-title" id="myModalLabel"><i class="fa fa-paperclip"></i> 첨부목록</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
|
||||
<!-- Nav tabs -->
|
||||
<ul class="nav nav-pills" role="tablist">
|
||||
<li role="presentation" class="active"><a href="#modal-attach-photo" arole="tab" data-toggle="tab">사진</a></li>
|
||||
<li role="presentation"><a href="#modal-attach-file" role="tab" data-toggle="tab">파일</a></li>
|
||||
<li role="presentation"><a href="#modal-attach-video" role="tab" data-toggle="tab">동영상</a></li>
|
||||
<li role="presentation"><a href="#modal-attach-link" role="tab" data-toggle="tab">링크</a></li>
|
||||
<li role="presentation"><a href="#modal-attach-map" role="tab" data-toggle="tab">위치</a></li>
|
||||
</ul>
|
||||
|
||||
<!-- Tab panes -->
|
||||
<div class="tab-content rb-attach">
|
||||
<div role="tabpanel" class="tab-pane active" id="modal-attach-photo">
|
||||
<ul class="list-group rb-attach-photo" data-role="modal-attach-preview-photo">
|
||||
<?php echo getAttachFileList($parent_data,'modal','photo')?>
|
||||
</ul>
|
||||
</div>
|
||||
<div role="tabpanel" class="tab-pane" id="modal-attach-file" >
|
||||
<ul class="list-group rb-attach-file" data-role="modal-attach-preview-file">
|
||||
<?php echo getAttachFileList($parent_data,'modal','file')?>
|
||||
</ul>
|
||||
</div>
|
||||
<div role="tabpanel" class="tab-pane" id="modal-attach-video">
|
||||
비디오 목록
|
||||
</div>
|
||||
<div role="tabpanel" class="tab-pane" id="modal-attach-link">
|
||||
링크목록
|
||||
</div>
|
||||
<div role="tabpanel" class="tab-pane" id="modal-attach-map">
|
||||
위치목록
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
1
modules/mediaset/themes/_mobile/rc-default/name.txt
Normal file
1
modules/mediaset/themes/_mobile/rc-default/name.txt
Normal file
@@ -0,0 +1 @@
|
||||
알씨 기본형
|
||||
@@ -0,0 +1,62 @@
|
||||
<li class="table-view-cell bg-white animated fadeIn pl-0" data-id="{$uid}" data-role="attach-item">
|
||||
<div class="media">
|
||||
<span class="media-object pull-left icon icon-pages media-middle text-muted"></span>
|
||||
<div class="media-body text-muted f14 w-75">
|
||||
<span class="badge badge-pill mr-1 {$is_hidden}" data-role="attachList-label-hidden-{$uid}">숨김</span>
|
||||
{$_name}
|
||||
<p>{$size}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<input type="hidden" name="attachfiles[]" value="[{$uid}]">
|
||||
<button type="button" class="btn btn-link"
|
||||
data-act="sheet"
|
||||
data-mod="file"
|
||||
data-target="#sheet-attach-moreAct"
|
||||
data-id="{$uid}" data-showhide="{$showhide}"
|
||||
data-insert="{$insert_text}"
|
||||
data-title="{$name}"
|
||||
data-type="{$type}">
|
||||
<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-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-attach-act="edit"
|
||||
data-id="{$uid}"
|
||||
data-type="{$type}"
|
||||
data-role="attachList-menu-edit-{$uid}">
|
||||
정보수정
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="dropdown-item"
|
||||
href="#"
|
||||
data-attach-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-attach-act="delete"
|
||||
data-id="{$uid}"
|
||||
data-role="attachList-menu-delete-{$uid}"
|
||||
data-featured=""
|
||||
data-type="{$type}">
|
||||
삭제
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
@@ -0,0 +1,90 @@
|
||||
<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="{$thumb_list}" alt="" style="width: 42px;height: 42px">
|
||||
</div>
|
||||
<div class="media-body text-muted f14 w-75">
|
||||
<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}
|
||||
<p>{$size}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<input type="hidden" name="attachfiles[]" value="[{$uid}]">
|
||||
<button type="button" class="btn btn-link"
|
||||
data-act="sheet"
|
||||
data-mod="file"
|
||||
data-target="#sheet-attach-moreAct"
|
||||
data-id="{$uid}" data-showhide="{$showhide}"
|
||||
data-insert="{$insert_text}"
|
||||
data-title="{$name}"
|
||||
data-type="{$type}">
|
||||
<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-attach-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-attach-act="edit"
|
||||
data-id="{$uid}"
|
||||
data-type="{$type}"
|
||||
data-role="attachList-menu-edit-{$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-attach-act="edit"
|
||||
data-id="{$uid}"
|
||||
data-type="{$type}"
|
||||
data-role="attachList-menu-edit-{$uid}">
|
||||
정보수정
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="dropdown-item"
|
||||
href="#"
|
||||
data-attach-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-attach-act="delete"
|
||||
data-id="{$uid}"
|
||||
data-role="attachList-menu-delete-{$uid}"
|
||||
data-featured=""
|
||||
data-type="{$type}">
|
||||
삭제
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
@@ -0,0 +1,72 @@
|
||||
<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="{$thumb_list}" alt="" style="width: 42px;height: 42px">
|
||||
</div>
|
||||
<div class="media-body text-muted f14 w-75">
|
||||
<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}
|
||||
<p>{$size}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<input type="hidden" name="attachfiles[]" value="{$uid}">
|
||||
<button type="button" class="btn btn-link"
|
||||
data-act="sheet"
|
||||
data-target="#sheet-attach-moreAct"
|
||||
data-id="{$uid}" data-showhide="{$showhide}"
|
||||
data-insert="{$insert_text}"
|
||||
data-title="{$name}"
|
||||
data-type="{$type}">
|
||||
<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-attach-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-attach-act="edit"
|
||||
data-id="{$uid}"
|
||||
data-type="{$type}"
|
||||
data-role="attachList-menu-edit-{$uid}">
|
||||
정보수정
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="dropdown-item"
|
||||
href="#"
|
||||
data-attach-act="showhide"
|
||||
data-role="attachList-menu-showhide-{$uid}"
|
||||
data-id="{$uid}" data-content="hide">
|
||||
숨기기
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="dropdown-item"
|
||||
href="#"
|
||||
data-attach-act="delete"
|
||||
data-id="{$uid}"
|
||||
data-role="attachList-menu-delete-{$uid}"
|
||||
data-featured=""
|
||||
data-type="{$type}">
|
||||
삭제
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
@@ -0,0 +1,9 @@
|
||||
<li class="table-view-cell">
|
||||
<a href="{$down_url}">
|
||||
<span class="media-object pull-left icon icon-download text-muted"></span>
|
||||
<div class="media-body">
|
||||
{$name}
|
||||
</div>
|
||||
<span class="badge badge-default badge-inverted">{$size}</span>
|
||||
</a>
|
||||
</li>
|
||||
@@ -0,0 +1,6 @@
|
||||
<figure data-id="{$uid}" class="embed-responsive embed-responsive-1by1">
|
||||
<a href="#page-{$m}-photo" data-toggle="page" data-start="#page-{$m}-view" data-index="{$index}" data-uid="{$uid}">
|
||||
<img src="{$thumb_view}" class="img-fluid" itemprop="thumbnail" alt="Image description" />
|
||||
</a>
|
||||
<figcaption itemprop="caption description" class="d-none">{$caption}</figcaption>
|
||||
</figure>
|
||||
@@ -0,0 +1,72 @@
|
||||
<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="{$thumb_list}" alt="" style="width: 42px;height: 42px">
|
||||
</div>
|
||||
<div class="media-body text-muted f14 w-75">
|
||||
<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}
|
||||
<p>{$size}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<input type="hidden" name="attachfiles[]" value="{$uid}">
|
||||
<button type="button" class="btn btn-link"
|
||||
data-act="sheet"
|
||||
data-target="#sheet-attach-moreAct"
|
||||
data-id="{$uid}" data-showhide="{$showhide}"
|
||||
data-insert="{$insert_text}"
|
||||
data-title="{$name}"
|
||||
data-type="{$type}">
|
||||
<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-attach-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-attach-act="edit"
|
||||
data-id="{$uid}"
|
||||
data-type="{$type}"
|
||||
data-role="attachList-menu-edit-{$uid}">
|
||||
정보수정
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="dropdown-item"
|
||||
href="#"
|
||||
data-attach-act="showhide"
|
||||
data-role="attachList-menu-showhide-{$uid}"
|
||||
data-id="{$uid}" data-content="hide">
|
||||
숨기기
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="dropdown-item"
|
||||
href="#"
|
||||
data-attach-act="delete"
|
||||
data-id="{$uid}"
|
||||
data-role="attachList-menu-delete-{$uid}"
|
||||
data-featured=""
|
||||
data-type="{$type}">
|
||||
삭제
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
8
modules/mediaset/themes/_mobile/rc-post-file/_main.css
Normal file
8
modules/mediaset/themes/_mobile/rc-post-file/_main.css
Normal file
@@ -0,0 +1,8 @@
|
||||
/* .rb-attach .table-view {
|
||||
border: none
|
||||
}
|
||||
|
||||
.rb-attach .table-view-cell {
|
||||
padding-left: 1rem;
|
||||
padding-right: 1rem
|
||||
} */
|
||||
5
modules/mediaset/themes/_mobile/rc-post-file/_var.php
Normal file
5
modules/mediaset/themes/_mobile/rc-post-file/_var.php
Normal file
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
$d['theme']['hidden_photo'] = "0"; // 이미지 추가시 사진 숨김여부 기본값 (숨김=1/보임=0)
|
||||
$d['theme']['allowedTypes'] = "jpg,png,gif,hwp,doc,docx,pdf,ppt,pptx,xls,xlsx,zip,m4a,mp3,mp4,mov,jpeg"; // 업로드 가능한 파일 확장자. (명시하지 않으면 파일 확장자 필터링하지 않음.)
|
||||
$d['theme']['multiple'] = "1"; // 멀티 업로드 (허용=1/비허용=0)
|
||||
?>
|
||||
89
modules/mediaset/themes/_mobile/rc-post-file/footer.php
Normal file
89
modules/mediaset/themes/_mobile/rc-post-file/footer.php
Normal file
@@ -0,0 +1,89 @@
|
||||
<?php getImport('jquery-form','jquery.form.min','4.2.2','js'); ?>
|
||||
<script>
|
||||
|
||||
var inputId='attach-file-input'; // 실제 작옹하는 input 엘리먼트 id 값을 옵션으로 지정을 해준다. (커스텀 버튼으로 click 이벤트 바인딩)
|
||||
var sheet_post_photoadd = $('#sheet-post-photoadd');
|
||||
|
||||
// 파일업로드 옵션값 세팅
|
||||
var <?php echo $d['attach']['parent_module'] ?>_upload_settings = {
|
||||
allowedTypes:"<?php echo $d['theme']['allowedTypes'] ?>",// 업로드 가능한 파일 확장자. 여기에 명시하지 않으면 파일 확장자 필터링하지 않음.
|
||||
fileName: "files", // <input type="file" name=""> 의 name 값 --> php 에서 파일처리할 때 사용됨.
|
||||
multiple: <?php echo $d['theme']['multiple']?'true':'false' ?>, // 멀티업로드를 할 경우 true 로 해준다.
|
||||
inputId:inputId, // 실제 작옹하는 input 엘리먼트 id 값을 옵션으로 지정을 해준다. (커스텀 버튼으로 click 이벤트 바인딩)
|
||||
formData: {"saveDir":'<?php echo $g['path_file'].$parent_module?>/',"theme":'<?php echo $attach_module_theme?>'}, // 추가 데이타 세팅
|
||||
onSubmit:function(files){
|
||||
sheet_post_photoadd.find('[data-act="attach"]').attr('disabled',true);
|
||||
$('[data-role="write"]').find('[data-role="attach-handler-photo"]').attr('disabled',true);
|
||||
$('[data-role="attach-handler-photo"]').addClass('d-none');
|
||||
},
|
||||
onSuccess:function(files,data,xhr,pd){
|
||||
sheet_post_photoadd.find('[data-role="none"]').addClass('d-none');
|
||||
},
|
||||
afterUploadAll:function(obj) {
|
||||
var attach_item_num = $('[data-role="write"].active').find('[data-role="list"] [data-role="attach-item"]').length;
|
||||
$('[data-act="attach"]').attr('disabled',false);
|
||||
$('[data-role="write"]').find('[data-role="attach-handler-photo"]').attr('disabled',false);
|
||||
$('[data-role="write"]').find('[data-role="attachNum"]').text(attach_item_num);
|
||||
$('[data-role="attach-handler-photo"]').removeClass('d-none');
|
||||
sheet_post_photoadd.find('[data-act="submit"]').addClass('active').removeClass('text-muted').attr('disabled',false);
|
||||
sheet_post_photoadd.find('[data-plugin="sortable"]').sortable({
|
||||
axis: 'y',
|
||||
cancel: 'button',
|
||||
delay: 250,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// main.js 기본값 세팅
|
||||
var <?php echo $d['attach']['parent_module'] ?>_attach_settings={
|
||||
module : 'mediaset',
|
||||
theme : '<?php echo $attach_module_theme?>',
|
||||
handler_photo : '<?php echo $attach_handler_photo?>',
|
||||
handler_file : '<?php echo $attach_handler_file?>',
|
||||
handler_getModalList : '<?php echo $attach_handler_getModalList?>',
|
||||
listModal : '#modal-attach'
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
$('body').on('tap','[data-act="sheet"][data-target="#sheet-attach-moreAct"][data-mod="file"]',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','file');
|
||||
sheet.find('[data-attach-act="edit"]').attr('data-id',uid).attr('data-type',type).attr('data-mod','file');
|
||||
sheet.find('[data-attach-act="showhide"]').attr('data-id',uid).attr('data-content',showhide).attr('data-mod','file');
|
||||
sheet.find('[data-attach-act="delete"]').attr('data-id',uid).attr('data-type',type).attr('data-mod','file');
|
||||
|
||||
if (showhide=='show') sheet.find('[data-attach-act="showhide"]').text('보이기');
|
||||
else sheet.find('[data-attach-act="showhide"]').text('숨기기');
|
||||
|
||||
if (type!='photo') { // 이미지가 아닐 경우
|
||||
sheet.find('[data-attach-act="featured-img"]').closest('.table-view-cell').addClass('hidden'); // 대표이미지 항목 숨김처리함
|
||||
sheet.find('[data-attach-act="imageGoodsTag"]').closest('.table-view-cell').addClass('hidden'); // 상품태그 항목 숨김처리함
|
||||
} else {
|
||||
sheet.find('[data-attach-act="featured-img"]').closest('.table-view-cell').removeClass('hidden'); // 대표이미지 항목 노출
|
||||
sheet.find('[data-attach-act="imageGoodsTag"]').closest('.table-view-cell').removeClass('hidden'); // 상품태그 항목 노출
|
||||
}
|
||||
|
||||
$(target).sheet({
|
||||
title : title
|
||||
});
|
||||
});
|
||||
|
||||
$('.rb-preview').on('click', function() {
|
||||
$(this).removeClass('btn-primary').addClass('btn-default')
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
19
modules/mediaset/themes/_mobile/rc-post-file/header.php
Normal file
19
modules/mediaset/themes/_mobile/rc-post-file/header.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?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....
|
||||
|
||||
// 함수 인클루드
|
||||
require_once $g['dir_attach_theme'].'main.func.php';
|
||||
include $g['dir_attach_theme'].'_var.php'; // 테마변수 인클루드
|
||||
?>
|
||||
<!-- global css -->
|
||||
<link href="<?php echo $g['url_attach_theme']?>/_main.css" rel="stylesheet">
|
||||
<script src="<?php echo $g['url_attach_theme']?>/js/file-upload/fileuploader.js"></script>
|
||||
<script src="<?php echo $g['url_attach_theme']?>/main.js"></script>
|
||||
@@ -0,0 +1,905 @@
|
||||
/*!
|
||||
* jQuery Upload File Plugin
|
||||
* version: 4.0.9
|
||||
* @requires jQuery v1.5 or later & form plugin
|
||||
* Copyright (c) 2013 Ravishanker Kusuma
|
||||
* http://hayageek.com/
|
||||
* https://github.com/hayageek/jquery-upload-file
|
||||
*/
|
||||
(function ($) {
|
||||
var feature = {};
|
||||
feature.fileapi = $("<input type='file'/>").get(0).files !== undefined;
|
||||
feature.formdata = window.FormData !== undefined;
|
||||
$.fn.RbUploadFile = function (options) {
|
||||
// This is the easiest way to have default options.
|
||||
var s = $.extend({
|
||||
// These are the defaults.
|
||||
url: rooturl+'/?r='+raccount+'&m=mediaset&a=upload', // attach 모듈 upload 액션 파일 지정
|
||||
method: "POST",
|
||||
enctype: "multipart/form-data",
|
||||
returnType: null,
|
||||
allowDuplicates: true,
|
||||
duplicateStrict: false,
|
||||
allowedTypes: "*",
|
||||
//For list of acceptFiles
|
||||
// http://stackoverflow.com/questions/11832930/html-input-file-accept-attribute-file-type-csv
|
||||
acceptFiles: "*",
|
||||
fileName: "file",
|
||||
formData: false,
|
||||
dynamicFormData:false,
|
||||
maxFileSize: -1,
|
||||
maxFileCount: -1,
|
||||
multiple: true,
|
||||
dragDrop: false, // 수정 dragDrop 사용하지 않음
|
||||
autoSubmit: true,
|
||||
showCancel: true,
|
||||
showAbort: true,
|
||||
showDone: false,
|
||||
showDelete: false,
|
||||
showError: true,
|
||||
showStatusAfterSuccess: false, // 수정
|
||||
showStatusAfterError: true,
|
||||
showFileCounter: false, // 수정
|
||||
fileCounterStyle: "). ",
|
||||
showFileSize: true,
|
||||
showProgress: true,
|
||||
nestedForms: true,
|
||||
showDownload: false,
|
||||
onLoad: function (obj) {},
|
||||
onSelect: function (files) {
|
||||
return true;
|
||||
},
|
||||
onSubmit: function (files, xhr) {},
|
||||
onSuccess: function (files, response, xhr, pd) {},
|
||||
onError: function (files, status, message, pd) {},
|
||||
onCancel: function (files, pd) {},
|
||||
onAbort: function (files, pd) {},
|
||||
downloadCallback: false,
|
||||
deleteCallback: false,
|
||||
afterUploadAll: false,
|
||||
serialize:true,
|
||||
sequential:false,
|
||||
sequentialCount:2,
|
||||
customProgressBar: false,
|
||||
abortButtonClass: "btn btn-secondary",
|
||||
cancelButtonClass: "btn btn-secondary",
|
||||
dragDropContainerClass: "ajax-upload-dragdrop",
|
||||
dragDropHoverClass: "state-hover",
|
||||
errorClass: "content-padded text-danger",
|
||||
uploadButtonClass: "ajax-file-upload",
|
||||
dragDropStr: "<span><b>드래그앤 드랍</b></span>",
|
||||
//uploadStr:"Upload",
|
||||
uploadStr:"", // 첨부파일 버튼을 커스텀할 수 있도록 숨긴다.
|
||||
abortStr: "취소",
|
||||
cancelStr: "취소",
|
||||
deletelStr: "삭제",
|
||||
doneStr: "완료",
|
||||
multiDragErrorStr: "드래그앤 드랍이 허용되지 않습니다.",
|
||||
extErrorStr: "허용 된 확장가 아닙니다.: ",
|
||||
duplicateErrorStr: "이미 존재하는 파일 입니다.",
|
||||
sizeErrorStr: "허용 된 최대 크기를 초과합니다.: ",
|
||||
uploadErrorStr: "업로드가 허용되지 않습니다.",
|
||||
maxFileCountErrorStr: " 최대 허용 파일 수가 초과 되었습니다.:",
|
||||
downloadStr: "Download",
|
||||
customErrorKeyStr: "content-padded text-danger",
|
||||
showQueueDiv: false,
|
||||
// statusBarWidth: 400,
|
||||
// dragdropWidth: 400,
|
||||
showPreview: false,
|
||||
previewHeight: "auto",
|
||||
previewWidth: "100%",
|
||||
extraHTML:false,
|
||||
uploadQueueOrder:'top'
|
||||
}, options);
|
||||
|
||||
this.fileCounter = 1;
|
||||
this.selectedFiles = 0;
|
||||
var formGroup = "ajax-file-upload-" + (new Date().getTime());
|
||||
this.formGroup = formGroup;
|
||||
this.errorLog = $("<div></div>"); //Writing errors
|
||||
this.responses = [];
|
||||
this.existingFileNames = [];
|
||||
if(!feature.formdata) //check drag drop enabled.
|
||||
{
|
||||
s.dragDrop = false;
|
||||
}
|
||||
if(!feature.formdata) {
|
||||
s.multiple = false;
|
||||
}
|
||||
|
||||
$(this).html("");
|
||||
|
||||
var obj = this;
|
||||
|
||||
var uploadLabel = $('<div>' + s.uploadStr + '</div>');
|
||||
|
||||
$(uploadLabel).addClass(s.uploadButtonClass);
|
||||
|
||||
// wait form ajax Form plugin and initialize
|
||||
(function checkAjaxFormLoaded() {
|
||||
if($.fn.ajaxForm) {
|
||||
|
||||
if(s.dragDrop) {
|
||||
var dragDrop = $('<div class="' + s.dragDropContainerClass + '" style="vertical-align:top;"></div>').width(s.dragdropWidth);
|
||||
$(obj).append(dragDrop);
|
||||
$(dragDrop).append(uploadLabel);
|
||||
$(dragDrop).append($(s.dragDropStr));
|
||||
setDragDropHandlers(obj, s, dragDrop);
|
||||
|
||||
} else {
|
||||
$(obj).append(uploadLabel);
|
||||
}
|
||||
$(obj).append(obj.errorLog);
|
||||
|
||||
// 업로드 진행바
|
||||
if(s.showQueueDiv)
|
||||
obj.container =$("#"+s.showQueueDiv);
|
||||
else
|
||||
obj.container = $("<div class='ajax-file-upload-container'></div>").insertAfter($(obj));
|
||||
|
||||
s.onLoad.call(this, obj);
|
||||
createCustomInputFile(obj, formGroup, s, uploadLabel);
|
||||
|
||||
} else window.setTimeout(checkAjaxFormLoaded, 10);
|
||||
})();
|
||||
|
||||
this.startUpload = function () {
|
||||
$("form").each(function(i,items)
|
||||
{
|
||||
if($(this).hasClass(obj.formGroup))
|
||||
{
|
||||
mainQ.push($(this));
|
||||
}
|
||||
});
|
||||
|
||||
if(mainQ.length >= 1 )
|
||||
submitPendingUploads();
|
||||
|
||||
}
|
||||
|
||||
this.getFileCount = function () {
|
||||
return obj.selectedFiles;
|
||||
|
||||
}
|
||||
this.stopUpload = function () {
|
||||
$("." + s.abortButtonClass).each(function (i, items) {
|
||||
if($(this).hasClass(obj.formGroup)) $(this).click();
|
||||
});
|
||||
$("." + s.cancelButtonClass).each(function (i, items) {
|
||||
if($(this).hasClass(obj.formGroup)) $(this).click();
|
||||
});
|
||||
}
|
||||
this.cancelAll = function () {
|
||||
$("." + s.cancelButtonClass).each(function (i, items) {
|
||||
if($(this).hasClass(obj.formGroup)) $(this).click();
|
||||
});
|
||||
}
|
||||
this.update = function (settings) {
|
||||
//update new settings
|
||||
s = $.extend(s, settings);
|
||||
}
|
||||
this.reset = function (removeStatusBars) {
|
||||
obj.fileCounter = 1;
|
||||
obj.selectedFiles = 0;
|
||||
obj.errorLog.html("");
|
||||
//remove all the status bars.
|
||||
if(removeStatusBars != false)
|
||||
{
|
||||
obj.container.html("");
|
||||
}
|
||||
}
|
||||
this.remove = function()
|
||||
{
|
||||
obj.container.html("");
|
||||
$(obj).remove();
|
||||
|
||||
}
|
||||
//This is for showing Old files to user.
|
||||
this.createProgress = function (filename,filepath,filesize) {
|
||||
var pd = new createProgressDiv(this, s);
|
||||
pd.progressDiv.show();
|
||||
pd.progressbar.width('100%');
|
||||
|
||||
var fileNameStr = "";
|
||||
if(s.showFileCounter)
|
||||
fileNameStr = obj.fileCounter + s.fileCounterStyle + filename;
|
||||
else fileNameStr = filename;
|
||||
|
||||
|
||||
if(s.showFileSize)
|
||||
fileNameStr += " ("+getSizeStr(filesize)+")";
|
||||
|
||||
|
||||
pd.filename.html(fileNameStr);
|
||||
obj.fileCounter++;
|
||||
obj.selectedFiles++;
|
||||
if(s.showPreview)
|
||||
{
|
||||
pd.preview.attr('src',filepath);
|
||||
pd.preview.show();
|
||||
}
|
||||
|
||||
if(s.showDownload) {
|
||||
pd.download.show();
|
||||
pd.download.click(function () {
|
||||
if(s.downloadCallback) s.downloadCallback.call(obj, [filename]);
|
||||
});
|
||||
}
|
||||
if(s.showDelete)
|
||||
{
|
||||
pd.del.show();
|
||||
pd.del.click(function () {
|
||||
pd.statusbar.hide().remove();
|
||||
var arr = [filename];
|
||||
if(s.deleteCallback) s.deleteCallback.call(this, arr, pd);
|
||||
obj.selectedFiles -= 1;
|
||||
updateFileCounter(s, obj);
|
||||
});
|
||||
}
|
||||
|
||||
return pd;
|
||||
}
|
||||
|
||||
this.getResponses = function () {
|
||||
return this.responses;
|
||||
}
|
||||
var mainQ=[];
|
||||
var progressQ=[]
|
||||
var running = false;
|
||||
function submitPendingUploads() {
|
||||
if(running) return;
|
||||
running = true;
|
||||
(function checkPendingForms() {
|
||||
|
||||
//if not sequential upload all files
|
||||
if(!s.sequential) s.sequentialCount=99999;
|
||||
|
||||
if(mainQ.length == 0 && progressQ.length == 0)
|
||||
{
|
||||
if(s.afterUploadAll) s.afterUploadAll(obj);
|
||||
running= false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( progressQ.length < s.sequentialCount)
|
||||
{
|
||||
var frm = mainQ.shift();
|
||||
if(frm != undefined)
|
||||
{
|
||||
progressQ.push(frm);
|
||||
frm.submit();
|
||||
}
|
||||
}
|
||||
window.setTimeout(checkPendingForms, 100);
|
||||
}
|
||||
})();
|
||||
}
|
||||
|
||||
function setDragDropHandlers(obj, s, ddObj) {
|
||||
ddObj.on('dragenter', function (e) {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
$(this).addClass(s.dragDropHoverClass);
|
||||
});
|
||||
ddObj.on('dragover', function (e) {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
var that = $(this);
|
||||
if (that.hasClass(s.dragDropContainerClass) && !that.hasClass(s.dragDropHoverClass)) {
|
||||
that.addClass(s.dragDropHoverClass);
|
||||
}
|
||||
});
|
||||
ddObj.on('drop', function (e) {
|
||||
e.preventDefault();
|
||||
$(this).removeClass(s.dragDropHoverClass);
|
||||
obj.errorLog.html("");
|
||||
var files = e.originalEvent.dataTransfer.files;
|
||||
if(!s.multiple && files.length > 1) {
|
||||
if(s.showError) $("<div class='" + s.errorClass + "'>" + s.multiDragErrorStr + "</div>").appendTo(obj.errorLog);
|
||||
return;
|
||||
}
|
||||
if(s.onSelect(files) == false) return;
|
||||
serializeAndUploadFiles(s, obj, files);
|
||||
});
|
||||
ddObj.on('dragleave', function (e) {
|
||||
$(this).removeClass(s.dragDropHoverClass);
|
||||
});
|
||||
|
||||
$(document).on('dragenter', function (e) {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
});
|
||||
$(document).on('dragover', function (e) {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
var that = $(this);
|
||||
if (!that.hasClass(s.dragDropContainerClass)) {
|
||||
that.removeClass(s.dragDropHoverClass);
|
||||
}
|
||||
});
|
||||
$(document).on('drop', function (e) {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
$(this).removeClass(s.dragDropHoverClass);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function getSizeStr(size) {
|
||||
var sizeStr = "";
|
||||
var sizeKB = size / 1024;
|
||||
if(parseInt(sizeKB) > 1024) {
|
||||
var sizeMB = sizeKB / 1024;
|
||||
sizeStr = sizeMB.toFixed(2) + " MB";
|
||||
} else {
|
||||
sizeStr = sizeKB.toFixed(2) + " KB";
|
||||
}
|
||||
return sizeStr;
|
||||
}
|
||||
|
||||
function serializeData(extraData) {
|
||||
var serialized = [];
|
||||
if(jQuery.type(extraData) == "string") {
|
||||
serialized = extraData.split('&');
|
||||
} else {
|
||||
serialized = $.param(extraData).split('&');
|
||||
}
|
||||
var len = serialized.length;
|
||||
var result = [];
|
||||
var i, part;
|
||||
for(i = 0; i < len; i++) {
|
||||
serialized[i] = serialized[i].replace(/\+/g, ' ');
|
||||
part = serialized[i].split('=');
|
||||
result.push([decodeURIComponent(part[0]), decodeURIComponent(part[1])]);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function noserializeAndUploadFiles(s, obj, files) {
|
||||
var ts = s;
|
||||
var fd = new FormData();
|
||||
var fileArray = [];
|
||||
var fileName = s.fileName.replace("[]", "");
|
||||
var fileListStr="";
|
||||
|
||||
for (var i = 0; i < files.length; i++) {
|
||||
if (!isFileTypeAllowed(obj, s, files[i].name)) {
|
||||
if (s.showError) $("<div><font color='red'><b>" + files[i].name + "</b> " + s.extErrorStr + s.allowedTypes + "</font></div>").appendTo(obj.errorLog);
|
||||
continue;
|
||||
}
|
||||
if (s.maxFileSize != -1 && files[i].size > s.maxFileSize) {
|
||||
if (s.showError) $("<div><font color='red'><b>" + files[i].name + "</b> " + s.sizeErrorStr + getSizeStr(s.maxFileSize) + "</font></div>").appendTo(obj.errorLog);
|
||||
continue;
|
||||
}
|
||||
fd.append(fileName+"[]", files[i]);
|
||||
fileArray.push(files[i].name);
|
||||
fileListStr += obj.fileCounter + "). " + files[i].name+"<br>";
|
||||
obj.fileCounter++;
|
||||
}
|
||||
if(fileArray.length ==0 ) return;
|
||||
|
||||
var extraData = s.formData;
|
||||
if (extraData) {
|
||||
var sData = serializeData(extraData);
|
||||
for (var j = 0; j < sData.length; j++) {
|
||||
if (sData[j]) {
|
||||
fd.append(sData[j][0], sData[j][1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ts.fileData = fd;
|
||||
var pd = new createProgressDiv(obj, s);
|
||||
pd.filename.html(fileListStr);
|
||||
var form = $("<form style='display:block; position:absolute;left: 150px;' class='" + obj.formGroup + "' method='" + s.method + "' action='" + s.url + "' enctype='" + s.enctype + "'></form>");
|
||||
form.appendTo('body');
|
||||
ajaxFormSubmit(form, ts, pd, fileArray, obj);
|
||||
|
||||
}
|
||||
|
||||
|
||||
function serializeAndUploadFiles(s, obj, files) {
|
||||
for(var i = 0; i < files.length; i++) {
|
||||
if(!isFileTypeAllowed(obj, s, files[i].name)) {
|
||||
if(s.showError) $("<div class='" + s.errorClass + "'><b>" + files[i].name + "</b> " + s.extErrorStr + s.allowedTypes + "</div>").appendTo(obj.errorLog);
|
||||
continue;
|
||||
}
|
||||
if(!s.allowDuplicates && isFileDuplicate(obj, files[i].name)) {
|
||||
if(s.showError) $("<div class='" + s.errorClass + "'><b>" + files[i].name + "</b> " + s.duplicateErrorStr + "</div>").appendTo(obj.errorLog);
|
||||
continue;
|
||||
}
|
||||
if(s.maxFileSize != -1 && files[i].size > s.maxFileSize) {
|
||||
if(s.showError) $("<div class='" + s.errorClass + "'><b>" + files[i].name + "</b> " + s.sizeErrorStr + getSizeStr(s.maxFileSize) + "</div>").appendTo(
|
||||
obj.errorLog);
|
||||
continue;
|
||||
}
|
||||
if(s.maxFileCount != -1 && obj.selectedFiles >= s.maxFileCount) {
|
||||
if(s.showError) $("<div class='" + s.errorClass + "'><b>" + files[i].name + "</b> " + s.maxFileCountErrorStr + s.maxFileCount + "</div>").appendTo(
|
||||
obj.errorLog);
|
||||
continue;
|
||||
}
|
||||
obj.selectedFiles++;
|
||||
obj.existingFileNames.push(files[i].name);
|
||||
var ts = s;
|
||||
var fd = new FormData();
|
||||
var fileName = s.fileName.replace("[]", "");
|
||||
fd.append(fileName, files[i]);
|
||||
var extraData = s.formData;
|
||||
if(extraData) {
|
||||
var sData = serializeData(extraData);
|
||||
for(var j = 0; j < sData.length; j++) {
|
||||
if(sData[j]) {
|
||||
fd.append(sData[j][0], sData[j][1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
ts.fileData = fd;
|
||||
|
||||
var pd = new createProgressDiv(obj, s);
|
||||
var fileNameStr = "";
|
||||
if(s.showFileCounter) fileNameStr = obj.fileCounter + s.fileCounterStyle + files[i].name
|
||||
else fileNameStr = files[i].name;
|
||||
|
||||
if(s.showFileSize)
|
||||
fileNameStr += " ("+getSizeStr(files[i].size)+")";
|
||||
|
||||
pd.filename.html(fileNameStr);
|
||||
var form = $("<form style='display:block; position:absolute;left: 150px;' class='" + obj.formGroup + "' method='" + s.method + "' action='" +
|
||||
s.url + "' enctype='" + s.enctype + "'></form>");
|
||||
form.appendTo('body');
|
||||
var fileArray = [];
|
||||
fileArray.push(files[i].name);
|
||||
|
||||
ajaxFormSubmit(form, ts, pd, fileArray, obj, files[i]);
|
||||
obj.fileCounter++;
|
||||
}
|
||||
}
|
||||
|
||||
function isFileTypeAllowed(obj, s, fileName) {
|
||||
var fileExtensions = s.allowedTypes.toLowerCase().split(/[\s,]+/g);
|
||||
var ext = fileName.split('.').pop().toLowerCase();
|
||||
if(s.allowedTypes != "*" && jQuery.inArray(ext, fileExtensions) < 0) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function isFileDuplicate(obj, filename) {
|
||||
var duplicate = false;
|
||||
if (obj.existingFileNames.length) {
|
||||
for (var x=0; x<obj.existingFileNames.length; x++) {
|
||||
if (obj.existingFileNames[x] == filename
|
||||
|| s.duplicateStrict && obj.existingFileNames[x].toLowerCase() == filename.toLowerCase()
|
||||
) {
|
||||
duplicate = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return duplicate;
|
||||
}
|
||||
|
||||
function removeExistingFileName(obj, fileArr) {
|
||||
if (obj.existingFileNames.length) {
|
||||
for (var x=0; x<fileArr.length; x++) {
|
||||
var pos = obj.existingFileNames.indexOf(fileArr[x]);
|
||||
if (pos != -1) {
|
||||
obj.existingFileNames.splice(pos, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getSrcToPreview(file, obj) {
|
||||
if(file) {
|
||||
obj.show();
|
||||
var reader = new FileReader();
|
||||
reader.onload = function (e) {
|
||||
obj.attr('src', e.target.result);
|
||||
};
|
||||
reader.readAsDataURL(file);
|
||||
}
|
||||
}
|
||||
|
||||
function updateFileCounter(s, obj) {
|
||||
if(s.showFileCounter) {
|
||||
var count = $(obj.container).find(".ajax-file-upload-filename").length;
|
||||
obj.fileCounter = count + 1;
|
||||
$(obj.container).find(".ajax-file-upload-filename").each(function (i, items) {
|
||||
var arr = $(this).html().split(s.fileCounterStyle);
|
||||
var fileNum = parseInt(arr[0]) - 1; //decrement;
|
||||
var name = count + s.fileCounterStyle + arr[1];
|
||||
$(this).html(name);
|
||||
count--;
|
||||
});
|
||||
}
|
||||
}
|
||||
// input 폼 세팅함수
|
||||
function createCustomInputFile (obj, group, s, uploadLabel) {
|
||||
|
||||
//var fileUploadId = "ajax-upload-id-" + (new Date().getTime());
|
||||
var fileUploadId=s.inputId; // 옵션에서 지정한 id 값으로 세팅한다.
|
||||
|
||||
var form = $("<form method='" + s.method + "' action='" + s.url + "' enctype='" + s.enctype + "'></form>");
|
||||
var fileInputStr = "<input type='file' id='" + fileUploadId + "' name='" + s.fileName + "' accept='" + s.acceptFiles + "'/>";
|
||||
if(s.multiple) {
|
||||
if(s.fileName.indexOf("[]") != s.fileName.length - 2) // if it does not endwith
|
||||
{
|
||||
s.fileName += "[]";
|
||||
}
|
||||
fileInputStr = "<input type='file' id='" + fileUploadId + "' name='" + s.fileName + "' accept='" + s.acceptFiles + "' multiple/>";
|
||||
}
|
||||
var fileInput = $(fileInputStr).appendTo(form);
|
||||
|
||||
//fileInput.change(function () {
|
||||
$(form).on('change','#'+fileUploadId,function(){
|
||||
console.log(fileUploadId);
|
||||
obj.errorLog.html("");
|
||||
var fileExtensions = s.allowedTypes.toLowerCase().split(",");
|
||||
var fileArray = [];
|
||||
if(this.files) //support reading files
|
||||
{
|
||||
for(i = 0; i < this.files.length; i++) {
|
||||
fileArray.push(this.files[i].name);
|
||||
}
|
||||
|
||||
if(s.onSelect(this.files) == false) return;
|
||||
} else {
|
||||
var filenameStr = $(this).val();
|
||||
var flist = [];
|
||||
fileArray.push(filenameStr);
|
||||
if(!isFileTypeAllowed(obj, s, filenameStr)) {
|
||||
if(s.showError) $("<div class='" + s.errorClass + "'><b>" + filenameStr + "</b> " + s.extErrorStr + s.allowedTypes + "</div>").appendTo(
|
||||
obj.errorLog);
|
||||
return;
|
||||
}
|
||||
//fallback for browser without FileAPI
|
||||
flist.push({
|
||||
name: filenameStr,
|
||||
size: 'NA'
|
||||
});
|
||||
if(s.onSelect(flist) == false) return;
|
||||
|
||||
}
|
||||
updateFileCounter(s, obj);
|
||||
|
||||
uploadLabel.unbind("click");
|
||||
form.hide();
|
||||
createCustomInputFile(obj, group, s, uploadLabel);
|
||||
form.addClass(group);
|
||||
if(s.serialize && feature.fileapi && feature.formdata) //use HTML5 support and split file submission
|
||||
{
|
||||
form.removeClass(group); //Stop Submitting when.
|
||||
var files = this.files;
|
||||
form.remove();
|
||||
serializeAndUploadFiles(s, obj, files);
|
||||
} else {
|
||||
var fileList = "";
|
||||
for(var i = 0; i < fileArray.length; i++) {
|
||||
if(s.showFileCounter) fileList += obj.fileCounter + s.fileCounterStyle + fileArray[i] + "<br>";
|
||||
else fileList += fileArray[i] + "<br>";;
|
||||
obj.fileCounter++;
|
||||
|
||||
}
|
||||
if(s.maxFileCount != -1 && (obj.selectedFiles + fileArray.length) > s.maxFileCount) {
|
||||
if(s.showError) $("<div class='" + s.errorClass + "'><b>" + fileList + "</b> " + s.maxFileCountErrorStr + s.maxFileCount + "</div>").appendTo(
|
||||
obj.errorLog);
|
||||
return;
|
||||
}
|
||||
obj.selectedFiles += fileArray.length;
|
||||
|
||||
var pd = new createProgressDiv(obj, s);
|
||||
pd.filename.html(fileList);
|
||||
ajaxFormSubmit(form, s, pd, fileArray, obj, null);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
if(s.nestedForms) {
|
||||
form.css({
|
||||
'margin': 0,
|
||||
'padding': 0
|
||||
});
|
||||
uploadLabel.css({
|
||||
position: 'relative',
|
||||
overflow: 'hidden',
|
||||
cursor: 'default'
|
||||
});
|
||||
fileInput.css({
|
||||
position: 'absolute',
|
||||
'cursor': 'pointer',
|
||||
'top': '0px',
|
||||
'width': '100%',
|
||||
'height': '100%',
|
||||
'left': '0px',
|
||||
'z-index': '100',
|
||||
'opacity': '0.0',
|
||||
'filter': 'alpha(opacity=0)',
|
||||
'-ms-filter': "alpha(opacity=0)",
|
||||
'-khtml-opacity': '0.0',
|
||||
'-moz-opacity': '0.0'
|
||||
});
|
||||
form.appendTo(uploadLabel);
|
||||
|
||||
} else {
|
||||
form.appendTo($('body'));
|
||||
form.css({
|
||||
margin: 0,
|
||||
padding: 0,
|
||||
display: 'block',
|
||||
position: 'absolute',
|
||||
left: '-250px'
|
||||
});
|
||||
if(navigator.appVersion.indexOf("MSIE ") != -1) //IE Browser
|
||||
{
|
||||
uploadLabel.attr('for', fileUploadId);
|
||||
} else {
|
||||
uploadLabel.click(function () {
|
||||
fileInput.click();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function defaultProgressBar(obj,s)
|
||||
{
|
||||
this.statusbar = $("<section class='mb-2'></section>").width(s.statusBarWidth);
|
||||
this.preview = $("<img class='ajax-file-upload-preview' />").width(s.previewWidth).height(s.previewHeight).appendTo(this.statusbar).hide();
|
||||
this.filename = $("<div class='text-muted small my-2'></div>").appendTo(this.statusbar);
|
||||
this.progressDiv = $("<div class='progress rounded-0 mb-3' style='height: 15px;'>").appendTo(this.statusbar).hide();
|
||||
this.progressbar = $("<div class='progress-bar progress-bar-striped progress-bar-animated'></div>").appendTo(this.progressDiv);
|
||||
this.abort = $("<button>" + s.abortStr + "</button>").appendTo(this.statusbar).hide();
|
||||
this.cancel = $("<div>" + s.cancelStr + "</div>").appendTo(this.statusbar).hide();
|
||||
this.done = $("<div>" + s.doneStr + "</div>").appendTo(this.statusbar).hide();
|
||||
this.download = $("<div>" + s.downloadStr + "</div>").appendTo(this.statusbar).hide();
|
||||
this.del = $("<div>" + s.deletelStr + "</div>").appendTo(this.statusbar).hide();
|
||||
|
||||
this.abort.addClass("ajax-file-upload-red");
|
||||
this.done.addClass("ajax-file-upload-green");
|
||||
this.download.addClass("ajax-file-upload-green");
|
||||
this.cancel.addClass("ajax-file-upload-red");
|
||||
this.del.addClass("ajax-file-upload-red");
|
||||
|
||||
return this;
|
||||
}
|
||||
function createProgressDiv(obj, s) {
|
||||
var bar = null;
|
||||
if(s.customProgressBar)
|
||||
bar = new s.customProgressBar(obj,s);
|
||||
else
|
||||
bar = new defaultProgressBar(obj,s);
|
||||
|
||||
bar.abort.addClass(obj.formGroup);
|
||||
bar.abort.addClass(s.abortButtonClass);
|
||||
|
||||
bar.cancel.addClass(obj.formGroup);
|
||||
bar.cancel.addClass(s.cancelButtonClass);
|
||||
|
||||
if(s.extraHTML)
|
||||
bar.extraHTML = $("<div class='extrahtml'>"+s.extraHTML()+"</div>").insertAfter(bar.filename);
|
||||
|
||||
if(s.uploadQueueOrder == 'bottom') {
|
||||
$(obj.container).append(bar.statusbar);
|
||||
} else {
|
||||
var sheet = $('#sheet-post-photoadd')
|
||||
if (sheet.hasClass('active')) {
|
||||
sheet.find('.file-upload-container').prepend(bar.statusbar);
|
||||
sheet.find('[data-role="none"]').addClass('d-none');
|
||||
} else {
|
||||
$(obj.container).prepend(bar.statusbar);
|
||||
}
|
||||
}
|
||||
return bar;
|
||||
}
|
||||
|
||||
|
||||
function ajaxFormSubmit(form, s, pd, fileArray, obj, file) {
|
||||
var currentXHR = null;
|
||||
var options = {
|
||||
cache: false,
|
||||
contentType: false,
|
||||
processData: false,
|
||||
forceSync: false,
|
||||
type: s.method,
|
||||
data: s.formData,
|
||||
formData: s.fileData,
|
||||
dataType: s.returnType,
|
||||
beforeSubmit: function (formData, $form, options) {
|
||||
if(s.onSubmit.call(this, fileArray) != false) {
|
||||
if(s.dynamicFormData)
|
||||
{
|
||||
var sData = serializeData(s.dynamicFormData());
|
||||
if(sData) {
|
||||
for(var j = 0; j < sData.length; j++) {
|
||||
if(sData[j]) {
|
||||
if(s.fileData != undefined) options.formData.append(sData[j][0], sData[j][1]);
|
||||
else options.data[sData[j][0]] = sData[j][1];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(s.extraHTML)
|
||||
{
|
||||
$(pd.extraHTML).find("input,select,textarea").each(function(i,items)
|
||||
{
|
||||
if(s.fileData != undefined) options.formData.append($(this).attr('name'),$(this).val());
|
||||
else options.data[$(this).attr('name')] = $(this).val();
|
||||
});
|
||||
}
|
||||
return true;
|
||||
}
|
||||
pd.statusbar.append("<div class='" + s.errorClass + "'>" + s.uploadErrorStr + "</div>");
|
||||
pd.cancel.show()
|
||||
form.remove();
|
||||
pd.cancel.click(function () {
|
||||
mainQ.splice(mainQ.indexOf(form), 1);
|
||||
removeExistingFileName(obj, fileArray);
|
||||
pd.statusbar.remove();
|
||||
s.onCancel.call(obj, fileArray, pd);
|
||||
obj.selectedFiles -= fileArray.length; //reduce selected File count
|
||||
updateFileCounter(s, obj);
|
||||
});
|
||||
return false;
|
||||
},
|
||||
beforeSend: function (xhr, o) {
|
||||
|
||||
pd.progressDiv.show();
|
||||
pd.cancel.hide();
|
||||
pd.done.hide();
|
||||
if(s.showAbort) {
|
||||
pd.abort.show();
|
||||
pd.abort.click(function () {
|
||||
removeExistingFileName(obj, fileArray);
|
||||
xhr.abort();
|
||||
obj.selectedFiles -= fileArray.length; //reduce selected File count
|
||||
s.onAbort.call(obj, fileArray, pd);
|
||||
|
||||
});
|
||||
}
|
||||
if(!feature.formdata) //For iframe based push
|
||||
{
|
||||
pd.progressbar.width('5%');
|
||||
} else pd.progressbar.width('1%'); //Fix for small files
|
||||
},
|
||||
uploadProgress: function (event, position, total, percentComplete) {
|
||||
//Fix for smaller file uploads in MAC
|
||||
if(percentComplete > 98) percentComplete = 98;
|
||||
|
||||
var percentVal = percentComplete + '%';
|
||||
if(percentComplete > 1) pd.progressbar.width(percentVal)
|
||||
if(s.showProgress) {
|
||||
pd.progressbar.html(percentVal);
|
||||
pd.progressbar.css('text-align', 'center');
|
||||
}
|
||||
|
||||
},
|
||||
success: function (data, message, xhr) {
|
||||
pd.cancel.remove();
|
||||
progressQ.pop();
|
||||
//For custom errors.
|
||||
if(s.returnType == "json" && $.type(data) == "object" && data.hasOwnProperty(s.customErrorKeyStr)) {
|
||||
pd.abort.hide();
|
||||
var msg = data[s.customErrorKeyStr];
|
||||
s.onError.call(this, fileArray, 200, msg, pd);
|
||||
if(s.showStatusAfterError) {
|
||||
pd.progressDiv.hide();
|
||||
pd.statusbar.append("<span class='" + s.errorClass + "'>ERROR: " + msg + "</span>");
|
||||
} else {
|
||||
pd.statusbar.hide();
|
||||
pd.statusbar.remove();
|
||||
}
|
||||
obj.selectedFiles -= fileArray.length; //reduce selected File count
|
||||
form.remove();
|
||||
return;
|
||||
}
|
||||
obj.responses.push(data);
|
||||
pd.progressbar.width('100%')
|
||||
if(s.showProgress) {
|
||||
pd.progressbar.html('100%');
|
||||
pd.progressbar.css('text-align', 'center');
|
||||
}
|
||||
|
||||
pd.abort.hide();
|
||||
s.onSuccess.call(this, fileArray, data, xhr, pd); // 해당 페이지에서 업로드 성공 후 추가 액션 가능
|
||||
// 미리보기 출력
|
||||
var result=$.parseJSON(data); // a.upload.php 에서 결과값을 preview & type 으로 구분하여 json 으로 보내준다.
|
||||
var preview_default=result.preview_default; // 기본 리스트
|
||||
var preview_modal=result.preview_modal; // 모달 리스트 (소스복사외 다른 메뉴는 노출하지 않는다.)
|
||||
var attachType=result.type; // 해당 attachHandler 의 data-type 값 photo, file, map, link, people....
|
||||
var previewBox_default=$('[data-role="attach-preview-'+attachType+'"]'); // type 에 따라서 미리보기 container 를 분리해서 지정한다.
|
||||
var previewBox_modal=$('[data-role="modal-attach-preview-'+attachType+'"]'); // type 에 따라서 미리보기 container 를 분리해서 지정한다.
|
||||
$(preview_default).appendTo(previewBox_default);// 업로드 성공후 미리보기 출력되는 부분 처리
|
||||
$(preview_modal).appendTo(previewBox_modal);// 업로드 성공후 모달 미리보기 출력되는 부분 처리
|
||||
|
||||
if(s.showStatusAfterSuccess) {
|
||||
if(s.showDone) {
|
||||
pd.done.show();
|
||||
pd.done.click(function () {
|
||||
pd.statusbar.hide("slow");
|
||||
pd.statusbar.remove();
|
||||
});
|
||||
} else {
|
||||
pd.done.hide();
|
||||
}
|
||||
if(s.showDelete) {
|
||||
pd.del.show();
|
||||
pd.del.click(function () {
|
||||
removeExistingFileName(obj, fileArray);
|
||||
pd.statusbar.hide().remove();
|
||||
if(s.deleteCallback) s.deleteCallback.call(this, data, pd);
|
||||
obj.selectedFiles -= fileArray.length; //reduce selected File count
|
||||
updateFileCounter(s, obj);
|
||||
|
||||
});
|
||||
} else {
|
||||
pd.del.hide();
|
||||
}
|
||||
} else {
|
||||
pd.statusbar.hide("slow");
|
||||
pd.statusbar.remove();
|
||||
|
||||
}
|
||||
if(s.showDownload) {
|
||||
pd.download.show();
|
||||
pd.download.click(function () {
|
||||
if(s.downloadCallback) s.downloadCallback(data);
|
||||
});
|
||||
}
|
||||
form.remove();
|
||||
},
|
||||
error: function (xhr, status, errMsg) {
|
||||
pd.cancel.remove();
|
||||
progressQ.pop();
|
||||
pd.abort.hide();
|
||||
if(xhr.statusText == "abort") //we aborted it
|
||||
{
|
||||
pd.statusbar.hide("slow").remove();
|
||||
updateFileCounter(s, obj);
|
||||
|
||||
} else {
|
||||
s.onError.call(this, fileArray, status, errMsg, pd);
|
||||
if(s.showStatusAfterError) {
|
||||
pd.progressDiv.hide();
|
||||
pd.statusbar.append("<span class='" + s.errorClass + "'>ERROR: " + errMsg + "</span>");
|
||||
} else {
|
||||
pd.statusbar.hide();
|
||||
pd.statusbar.remove();
|
||||
}
|
||||
obj.selectedFiles -= fileArray.length; //reduce selected File count
|
||||
}
|
||||
|
||||
form.remove();
|
||||
}
|
||||
};
|
||||
|
||||
if(s.showPreview && file != null) {
|
||||
if(file.type.toLowerCase().split("/").shift() == "image") getSrcToPreview(file, pd.preview);
|
||||
}
|
||||
|
||||
if(s.autoSubmit) {
|
||||
form.ajaxForm(options);
|
||||
mainQ.push(form);
|
||||
submitPendingUploads();
|
||||
|
||||
} else {
|
||||
if(s.showCancel) {
|
||||
pd.cancel.show();
|
||||
pd.cancel.click(function () {
|
||||
mainQ.splice(mainQ.indexOf(form), 1);
|
||||
removeExistingFileName(obj, fileArray);
|
||||
form.remove();
|
||||
pd.statusbar.remove();
|
||||
s.onCancel.call(obj, fileArray, pd);
|
||||
obj.selectedFiles -= fileArray.length; //reduce selected File count
|
||||
updateFileCounter(s, obj);
|
||||
});
|
||||
}
|
||||
form.ajaxForm(options);
|
||||
}
|
||||
|
||||
}
|
||||
return this;
|
||||
|
||||
}
|
||||
}(jQuery));
|
||||
29
modules/mediaset/themes/_mobile/rc-post-file/list.php
Normal file
29
modules/mediaset/themes/_mobile/rc-post-file/list.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
include $g['dir_attach_theme'].'/header.php';
|
||||
?>
|
||||
<div id="attach-files" class="files"><!-- 파일폼 출력 --></div>
|
||||
<div class="rb-attach">
|
||||
<?php if($attach_object_type=='photo'):?>
|
||||
<ul class="list-group rb-attach-photo" data-role="attach-preview-photo"><!-- 포토/이미지 리스트 -->
|
||||
<?php if($parent_data['uid']):?>
|
||||
<?php echo getAttachFileList($parent_data,'upload','photo')?>
|
||||
<?php endif?>
|
||||
</ul>
|
||||
<?php elseif($attach_object_type=='file'):?>
|
||||
<ul class="list-group rb-attach-file" data-role="attach-preview-file"> <!-- 일반파일 리스트 -->
|
||||
<?php if($parent_data['uid']):?>
|
||||
<?php echo getAttachFileList($parent_data,'upload','file')?>
|
||||
<?php endif?>
|
||||
</ul>
|
||||
<?php elseif($attach_object_type=='video'):?>
|
||||
<ul class="list-group rb-attach-video" data-role="attach-preview-video"> <!-- 비디오 리스트 -->
|
||||
<?php if($parent_data['uid']):?>
|
||||
<?php echo getAttachFileList($parent_data,'upload','video')?>
|
||||
<?php endif?>
|
||||
</ul>
|
||||
<?php endif?>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
include $g['dir_attach_theme'].'/footer.php';
|
||||
?>
|
||||
271
modules/mediaset/themes/_mobile/rc-post-file/main.func.php
Normal file
271
modules/mediaset/themes/_mobile/rc-post-file/main.func.php
Normal file
@@ -0,0 +1,271 @@
|
||||
<?php
|
||||
// 첨부파일 리스트 갯수 추출 함수
|
||||
function getAttachNum($upload,$mod)
|
||||
{
|
||||
global $table;
|
||||
|
||||
$attach = getArrayString($upload);
|
||||
$attach_file_num=0;// 첨부파일 수량
|
||||
$hidden_file_num=0; // 숨김파일(다운로드 방지) 수량
|
||||
foreach($attach['data'] as $val)
|
||||
{
|
||||
$U = getUidData($table['s_upload'],$val);
|
||||
if($U['fileonly']==1) $attach_file_num++; // 전체 첨부파일 수량 증가
|
||||
if($U['hidden']==1) $hidden_file_num++; // 숨김파일 수량 증가
|
||||
}
|
||||
$down_file_num=$attach_file_num-$hidden_file_num; // 다운로드 가능한 첨부파일
|
||||
$result=array();
|
||||
$result['modify']=$attach_file_num;
|
||||
$result['view']=$down_file_num;
|
||||
|
||||
return $result[$mod];
|
||||
}
|
||||
|
||||
// 첨부파일 리스트 추출 함수 (전체)
|
||||
/*
|
||||
$parent_data : 해당 포스트의 row 배열
|
||||
$mod : upload or modal ==> 실제 업로드 모드 와 모달을 띄워서 본문에 삽입용도로 쓰거나
|
||||
*/
|
||||
function getAttachFileList($parent_data,$mod,$type,$p_module) {
|
||||
global $table;
|
||||
|
||||
$upload=$parent_data['upload'];
|
||||
$featured_img_uid=$parent_data['featured_img'];// 대표이미지 uid
|
||||
$featured_video_uid=$parent_data['featured_video'];// 대표비디오 uid
|
||||
$featured_audio_uid=$parent_data['featured_audio'];// 대표오디오 uid
|
||||
|
||||
if($type=='photo') $sql='type=2';
|
||||
else if($type=='audio') $sql='type=4';
|
||||
else if($type=='video') $sql='type=5';
|
||||
else $sql='(type=1 or type=6 or type=7)';
|
||||
|
||||
if ($mod=='view') $sql.=' and hidden=0';
|
||||
|
||||
$attach = getArrayString($upload);
|
||||
$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']);
|
||||
|
||||
if($type=='file') $html.=getAttachFile($U,$mod,$featured_img_uid,$p_module);
|
||||
else if($type=='photo') $html.=getAttachFile($U,$mod,$featured_img_uid,$p_module);
|
||||
else if($type=='audio') $html.=getAttachAudio($U,$mod,$featured_audio_uid,$p_module);
|
||||
else if($type=='video') $html.=getAttachVideo($U,$mod,$featured_video_uid,$p_module);
|
||||
else $html.=getAttachFile($U,$mod,$featured_img_uid,$p_module);
|
||||
}
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
// 첨부파일 리스트 추출 함수 (낱개)
|
||||
function getAttachFile($R,$mod,$featured_img_uid,$p_module) {
|
||||
|
||||
global $g,$r,$TMPL ;
|
||||
|
||||
include_once $GLOBALS['g']['path_core'].'function/sys.class.php';
|
||||
|
||||
$fileName=explode('.',$R['name']);
|
||||
$file_name=$fileName[0]; // 파일명만 분리
|
||||
|
||||
$sync_array = getArrayString($R['sync']);
|
||||
$m = $sync_array['data'][0];
|
||||
|
||||
if ($R['type']==2) {
|
||||
$type='photo';
|
||||
} elseif($R['type']==4) {
|
||||
$type='audio';
|
||||
} elseif($R['type']==5) {
|
||||
$type='video';
|
||||
} else {
|
||||
$type='file';
|
||||
}
|
||||
|
||||
if($type=='photo'){
|
||||
$caption=$R['caption']?$R['caption']:$file_name;
|
||||
$img_origin=$R['host'].'/'.$R['folder'].'/'.$R['tmpname'];
|
||||
$thumb_list=getPreviewResize($R['src'],'q'); // 미리보기 사이즈 조정 (이미지 업로드시 썸네일을 만들 필요 없다.)
|
||||
$thumb_modal=getPreviewResize($R['src'],'n'); // 정보수정 모달용 사이즈 조정 (이미지 업로드시 썸네일을 만들 필요 없다.)
|
||||
$thumb_view=getPreviewResize($R['src'],'600x600'); // 보기 페이지 출력용
|
||||
$insert_text='';
|
||||
}else if($type=='file'){
|
||||
$caption=$R['caption']?$R['caption']:$R['name'];
|
||||
$src=$R['host'].$R['folder'].'/'.$R['name'];
|
||||
$down_url=$g['s'].'/?r='.$r.'&m=mediaset&a=download&uid='.$R['uid'];
|
||||
}
|
||||
|
||||
$html='';
|
||||
|
||||
$TMPL['m']=$p_module;
|
||||
$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['img_origin']=$img_origin;
|
||||
$TMPL['uid']=$R['uid'];
|
||||
$TMPL['img_origin_width']=$R['width'];
|
||||
$TMPL['img_origin_height']=$R['height'];
|
||||
$TMPL['type']=$type;
|
||||
$TMPL['type_modal']=$R['type']==2?'photo':'file';
|
||||
$TMPL['file_name']=$file_name;
|
||||
$TMPL['fileext']=$R['ext'];
|
||||
$TMPL['caption']=$caption;
|
||||
$TMPL['showhide']=!$R['hidden']?'hide':'show';
|
||||
$TMPL['insert_text']=$insert_text;
|
||||
$TMPL['thumb_modal']=$thumb_modal;
|
||||
$TMPL['thumb_list']=$thumb_list;
|
||||
$TMPL['thumb_view']=$thumb_view;
|
||||
$TMPL['name']=$R['name'];
|
||||
$TMPL['_name']=getStrCut($R['name'],25,'..');
|
||||
$TMPL['size']=getSizeFormat($R['size'],2);
|
||||
$TMPL['uid']=$R['uid'];
|
||||
$TMPL['down_url']=$down_url;
|
||||
|
||||
if ($mod=='upload') {
|
||||
if ($R['type']==2) $markup_file = 'edit_photo_row';
|
||||
else $markup_file = 'edit_file_row';
|
||||
} else {
|
||||
if ($R['type']==2) $markup_file = 'view_photo_row';
|
||||
else $markup_file = 'view_file_row';
|
||||
}
|
||||
|
||||
$skin=new skin($markup_file);
|
||||
$html.=$skin->make();
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
// 오디오파일 리스트 추출 함수 (낱개)
|
||||
function getAttachAudio($R,$mod,$featured_audio_uid)
|
||||
{
|
||||
global $g,$r;
|
||||
|
||||
$fileName=explode('.',$R['name']);
|
||||
$file_name=$fileName[0]; // 파일명만 분리
|
||||
$caption=$R['caption']?$R['caption']:$file_name;
|
||||
|
||||
$html='';
|
||||
$html.='
|
||||
<div class="card bg-white" data-id="'.$R['uid'].'" data-role="attach-item">
|
||||
<audio controls class="card-img-top w-100"><source src="'.$R['host'].'/'.$R['folder'].'/'.$R['tmpname'].'" type="audio/mp3"></audio>
|
||||
<div class="card-block">';
|
||||
if($mod=='upload') $html.='<input type="hidden" name="attachfiles[]" value="['.$R['uid'].']"/>';
|
||||
$html.='
|
||||
<button type="button" class="btn btn-secondary btn-block mb-2" data-attach-act="delete" data-id="'.$R['uid'].'" data-role="attachList-menu-delete-'.$R['uid'].'" data-featured="" data-type="audio">삭제</button>';
|
||||
if($mod=='upload'){
|
||||
$html.='
|
||||
<a class="btn btn-secondary" href="#" data-attach-act="featured-audio" data-type="'.$type.'" data-id="'.$R['uid'].'">대표오디오 설정</a></li>';
|
||||
|
||||
$html.='
|
||||
<a class="btn btn-secondary" href="#" data-toggle="modal" data-target="#modal-attach-file-meta" data-filename="'.$file_name.'" data-fileext="'.$R['ext'].'" data-caption="'.$caption.'" data-src="'.$thumb_modal.'" data-origin="'.$img_origin.'" data-attach-act="edit" data-id="'.$R['uid'].'" data-type="audio" data-role="attachList-menu-edit-'.$R['uid'].'">정보수정</a>
|
||||
<a class="btn btn-secondary" href="#" data-attach-act="showhide" data-role="attachList-menu-showhide-'.$R['uid'].'" data-id="'.$R['uid'].'" data-content="'.($R['hidden']?'show':'hide').'" >'.($R['hidden']?'보이기':'숨기기').'</a>
|
||||
';
|
||||
}
|
||||
$html.='<h6 class="card-title mt-4"><span data-role="attachList-list-name-'.$R['uid'].'" >'.$R['name'].'</span>';
|
||||
$html.='<span class="badge badge-default'.($R['uid']==$featured_audio_uid?'':' hidden-xs-up').'" data-role="attachList-label-featured" data-id="'.$R['uid'].'">대표</span> ';
|
||||
$html.='<span class="badge badge-default'.(!$R['hidden']?' hidden-xs-up':'').'" data-role="attachList-label-hidden-'.$R['uid'].'">숨김</span>';
|
||||
$html.='
|
||||
<span class="badge badge-default">'.getSizeFormat($R['size'],2).'</span></h6><p></p></div></div>';
|
||||
return $html;
|
||||
}
|
||||
|
||||
|
||||
// 비디오파일 리스트 추출 함수 (낱개)
|
||||
function getAttachVideo($R,$mod,$featured_video_uid)
|
||||
{
|
||||
global $g,$r;
|
||||
|
||||
$fileName=explode('.',$R['name']);
|
||||
$file_name=$fileName[0]; // 파일명만 분리
|
||||
$caption=$R['caption']?$R['caption']:$file_name;
|
||||
|
||||
$html='';
|
||||
$html.='
|
||||
<div class="card bg-white" data-id="'.$R['uid'].'" data-role="attach-item">';
|
||||
|
||||
$html.='
|
||||
<div class="card-img-top embed-responsive embed-responsive-4by3"><video controls class="embed-responsive-item" controls preload="none"><source src="'.$R['host'].'/'.$R['folder'].'/'.$R['tmpname'].'" type="video/'.$R['ext'].'"></video></div>';
|
||||
$html.='<div class="card-block"><h5 class="card-title" data-role="attachList-list-name-'.$R['uid'].'" >'.$R['name'];
|
||||
|
||||
$html.='<span class="badge badge-default'.($R['uid']==$featured_video_uid?'':' hidden-xs-up').'" data-role="attachList-label-featured" data-id="'.$R['uid'].'">대표</span> ';
|
||||
$html.='<span class="badge badge-default'.(!$R['hidden']?' hidden-xs-up':'').'" data-role="attachList-label-hidden-'.$R['uid'].'">숨김</span></h5 >';
|
||||
|
||||
$html.='
|
||||
<p class="card-text text-muted">'.getSizeFormat($R['size'],2).'</p>';
|
||||
|
||||
if($mod=='upload'){ $html.=' <input type="hidden" name="attachfiles[]" value="['.$R['uid'].']"/>
|
||||
<button type="button" class="btn btn-secondary btn-block btn-sm" data-attach-act="delete" data-id="'.$R['uid'].'" data-role="attachList-menu-delete-'.$R['uid'].'" data-featured="" data-type="video">삭제</button></li>
|
||||
<div class="btn-group btn-group-sm hidden" role="group">
|
||||
<button type="button" class="btn btn-secondary" data-attach-act="delete" data-id="'.$R['uid'].'" data-role="attachList-menu-delete-'.$R['uid'].'" data-featured="" data-type="video">삭제</button></li>
|
||||
<button type="button" class="btn btn-secondary" data-attach-act="featured-video" data-type="'.$type.'" data-id="'.$R['uid'].'">대표 비디오 설정</button></li>
|
||||
<button type="button" class="btn btn-secondary" data-toggle="modal" data-target="#modal-attach-file-meta" data-filename="'.$file_name.'" data-fileext="'.$R['ext'].'" data-caption="'.$caption.'" data-src="'.$thumb_modal.'" data-origin="'.$img_origin.'" data-attach-act="edit" data-id="'.$R['uid'].'" data-type="video" data-role="attachList-menu-edit-'.$R['uid'].'">정보수정</button>
|
||||
<button type="button" class="btn btn-secondary" data-attach-act="showhide" data-role="attachList-menu-showhide-'.$R['uid'].'" data-id="'.$R['uid'].'" data-content="'.($R['hidden']?'show':'hide').'" >'.($R['hidden']?'보이기':'숨기기').'</button>
|
||||
</div>
|
||||
</div>
|
||||
';}
|
||||
|
||||
$html.='</div>';
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 본문삽입 이미지 uid 얻기 함수
|
||||
function getInsertImgUid($upload)
|
||||
{
|
||||
global $table;
|
||||
|
||||
$u_arr = getArrayString($upload);
|
||||
$Insert_arr=array();
|
||||
$i=0;
|
||||
foreach ($u_arr['data'] as $val) {
|
||||
$U=getUidData($table['s_upload'],$val);
|
||||
if(!$U['fileonly']) $Insert_arr[$i]=$val;
|
||||
$i++;
|
||||
}
|
||||
$upfiles='';
|
||||
// 중괄로로 재조립
|
||||
foreach ($Insert_arr as $uid) {
|
||||
$upfiles.='['.$uid.']';
|
||||
}
|
||||
|
||||
return $upfiles;
|
||||
}
|
||||
|
||||
function getAttachPhotoSwipeFull($parent_data){
|
||||
global $table;
|
||||
|
||||
$upload=$parent_data['upload'];
|
||||
$sql='type=2 and hidden=0';
|
||||
|
||||
$attach = getArrayString($upload);
|
||||
$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)){
|
||||
|
||||
$img_origin=$R['src'];
|
||||
|
||||
$html.='<div class="swiper-slide" style="height:78vh;" data-uid="'.$R['uid'].'">
|
||||
<div class="swiper-zoom-container">
|
||||
<img src="'.$img_origin.'">
|
||||
</div>
|
||||
</div>';
|
||||
}
|
||||
return $html;
|
||||
}
|
||||
|
||||
?>
|
||||
241
modules/mediaset/themes/_mobile/rc-post-file/main.js
Normal file
241
modules/mediaset/themes/_mobile/rc-post-file/main.js
Normal file
@@ -0,0 +1,241 @@
|
||||
/**
|
||||
* Copyright (c) 2015 redblock inc.
|
||||
* Author kiere@kismq.com
|
||||
* Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
|
||||
* and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
|
||||
*
|
||||
* Version: 1.0.0
|
||||
*/
|
||||
(function ($) {
|
||||
$.fn.RbAttachTheme= function (settings) {
|
||||
|
||||
var defaults = {};
|
||||
var opts = jQuery.extend(defaults, settings);
|
||||
|
||||
var module=opts.module; // 모듈명
|
||||
var theme=opts.theme; // 테마 패스
|
||||
var handler_photo=opts.handler_photo; // 사진첨부 실행 엘리먼트
|
||||
var handler_file=opts.handler_file; // 파일첨부 실행 엘리먼트
|
||||
var handler_getModalList=opts.handler_getModalList; // 첨부리스트 모달로 호출하는 엘리먼트
|
||||
var listModal=opts.listModal;
|
||||
var loaderbox='<div style="height:50%;margin-top:40%;" id="modal-loader-default"><div class="spinner-wrap"><div class="spinner"><div class="bounce1"></div><div class="bounce2"></div><div class="bounce3"></div></div></div></div>';
|
||||
|
||||
// 부모 모듈에서 파일첨부 액션 실행하는 버튼 or 기타 엘리먼트 클릭시 첨부파일 input click 이벤트 바인딩
|
||||
$(handler_file).off().click(function(e){
|
||||
e.preventDefault();
|
||||
$('#'+inputId).click();
|
||||
$('.rb-attach').addClass('active')
|
||||
});
|
||||
|
||||
// 부모 모듈에서 사진첨부 액션 실행하는 버튼 or 기타 엘리먼트 클릭시 첨부파일 input click 이벤트 바인딩
|
||||
$(handler_photo).off().click(function(e){
|
||||
e.preventDefault();
|
||||
$('#'+inputId).click();
|
||||
$('.rb-attach').addClass('active')
|
||||
});
|
||||
|
||||
// 부모 페이지 마크다운 에디터 toolbar 의 첨부파일 리스트 호출버튼 class 클릭시 첨부파일 리스트 모달 호출
|
||||
$('body').on('click',handler_getModalList,function(){
|
||||
if(handler_getModalList!='') $(listModal).modal('show');
|
||||
});
|
||||
|
||||
// 업로드 리스트 showhide 값 reset 함수
|
||||
var updateShowHide=function(uid,showhide){
|
||||
if(showhide=='show'){
|
||||
$('[data-role="attach-item"] [data-act="sheet"][data-id="'+uid+'"]').attr('data-showhide','hide');
|
||||
$('[data-role="attachList-label-hidden-'+uid+'"]').addClass('hidden'); // 숨김 라벨 숨기기
|
||||
console.log($('[data-role="attachList-label-hidden-'+uid+'"]'));
|
||||
}else{
|
||||
$('[data-role="attach-item"] [data-act="sheet"][data-id="'+uid+'"]').attr('data-showhide','show');
|
||||
$('[data-role="attachList-label-hidden-'+uid+'"]').removeClass('hidden'); // 숨김 라벨 노출
|
||||
}
|
||||
}
|
||||
|
||||
// 이벤트 바인딩 및 세팅
|
||||
$('#sheet-attach-moreAct').off().on('click','[data-attach-act][data-mod="file"]',function(e){
|
||||
e.preventDefault();
|
||||
var act=$(this).data('attach-act');
|
||||
var uid=$(this).attr('data-id');
|
||||
var type=$(this).data('type'); // file or photo
|
||||
|
||||
if (act=='imageGoodsTag') {
|
||||
setTimeout(function(){ $('#page-post-edit-imageGoodsTag').page({ start: '#page-post-edit-main',title:'상품태그 설정' }); }, 250);
|
||||
return false
|
||||
}
|
||||
|
||||
if(act=='edit'){
|
||||
|
||||
// setTimeout(function(){ history.back(); }, 30);
|
||||
setTimeout(function(){ $('#page-post-edit-mediaset').page({ start: '#page-post-edit-main',title:'미디어 정보수정' }); }, 250);
|
||||
return false
|
||||
|
||||
// data 값 세팅
|
||||
var page=$(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 값 모달에 적용
|
||||
$(page).find('[data-role="filename"]').val(filename);
|
||||
$(page).find('[data-role="fileext"]').text(fileext);
|
||||
$(page).find('[data-role="filecaption"]').val(caption);
|
||||
$(page).find('[data-role="eventHandler"]').attr('data-id',uid); // save, cancel 엘리먼트 data-id="" 값에 uid 값 적용
|
||||
$(page).find('[data-role="eventHandler"]').attr('data-type',type); // save, cancel 엘리먼트 data-type="" 값에 type 값 적용
|
||||
if(type=='photo'){
|
||||
$(page).find('[data-role="img-preview"]').attr('src',img_thumb); // 미리보기 이미지 src 적용
|
||||
$(page).find('[data-role="img-preview"]').attr('data-origin',img_origin); // 원본 이미지 src 적용
|
||||
} else if(type=='video'){
|
||||
$(page).find('[data-role="img-preview"]').html('<i class="fa fa-file-video-o fa-4x"></i>'); // 타입별 아이콘 적용
|
||||
} else if(type=='audio'){
|
||||
$(page).find('[data-role="img-preview"]').html('<i class="fa fa-file-audio-o fa-4x"></i>'); // 타입별 아이콘 적용
|
||||
} else {
|
||||
$(page).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=mediaset&a=delete',{
|
||||
uid : uid
|
||||
},function(response){
|
||||
console.log('삭제완료')
|
||||
var previewUl_default=$('[data-role="attach-preview-'+type+'"]'); // 파일 리스트 엘리먼트 class
|
||||
//var previewUl_modal=$('[data-role="modal-attach-preview-'+type+'"]'); // 파일 리스트 엘리먼트 class
|
||||
var delEl_default=$(previewUl_default).find('[data-id="'+uid+'"]'); // 삭제 이벤트 진행된 엘리먼트
|
||||
//var delEl_modal=$(previewUl_modal).find('[data-id="'+uid+'"]'); // 삭제 이벤트 진행된 엘리먼트
|
||||
delEl_default.remove();// 삭제 이벤트 진행시 해당 li 엘리먼트 remove
|
||||
|
||||
var sheet_item_num = $('#sheet-post-photoadd').find('[data-role="attach-item"]').length;
|
||||
var attach_item_num = $('[data-role="write"].active').find('[data-role="attach-item"]').length;
|
||||
setTimeout(function(){
|
||||
$('[data-role="write"].active').find('[data-role="attachNum"]').text(attach_item_num==0?'':attach_item_num);
|
||||
if (!sheet_item_num) {
|
||||
$('#sheet-post-photoadd').find('[data-role="none"]').removeClass('d-none');
|
||||
$('#sheet-post-photoadd').find('[data-act="submit"]').removeClass('active').addClass('text-muted');
|
||||
}
|
||||
}, 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 > 값에 적용
|
||||
|
||||
console.log('대표이미지 설정'+uid)
|
||||
$(document).find('input[name="featured_img"]').val(uid);
|
||||
|
||||
// 대표 이미지 라벨 업데이트
|
||||
$('[data-role="attachList-label-featured"]').each(function(){
|
||||
var id = $(this).data('id');
|
||||
$(this).addClass('hidden');
|
||||
//$(this).removeClass('hidden');
|
||||
// 삭제 메뉴에 대표이미지 표시 지우기
|
||||
$('[data-attach-act="delete"]').attr('data-featured','');
|
||||
if(id==uid){
|
||||
$(this).removeClass('hidden');
|
||||
// 삭제 메뉴에 대표이미지 표시
|
||||
$('[data-role="attachList-menu-delete-'+uid+'"]').attr('data-featured',1);
|
||||
}
|
||||
});
|
||||
}else if(act=='insert'){
|
||||
var src=$(this).data('origin');
|
||||
var caption=$(this).attr('data-caption');
|
||||
var dn_url = rooturl+'/download/'+uid;
|
||||
var img_html = '<img src="'+src+'" alt="'+caption+'" class="img-fluid">';
|
||||
var file_html = '<a href="'+dn_url+'">'+caption+'</a>';
|
||||
|
||||
if(type=='photo') {
|
||||
$('#summernote').summernote('insertImage',src, function ($image) {
|
||||
$image.attr('alt',caption);
|
||||
});
|
||||
|
||||
} else {
|
||||
$('#summernote').summernote('createLink', {
|
||||
text: caption,
|
||||
url: dn_url ,
|
||||
newWindow: true
|
||||
});
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
history.back(); //sheet 내리기
|
||||
});
|
||||
|
||||
};
|
||||
})(jQuery);
|
||||
50
modules/mediaset/themes/_mobile/rc-post-file/main.php
Normal file
50
modules/mediaset/themes/_mobile/rc-post-file/main.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<style>
|
||||
.rb-attach .table-view:empty {
|
||||
display: none !important
|
||||
}
|
||||
</style>
|
||||
|
||||
<?php
|
||||
include $g['dir_attach_theme'].'/header.php';
|
||||
?>
|
||||
|
||||
<div class="rb-attach" data-role="list"><!-- 포토/이미지 리스트 -->
|
||||
|
||||
<ul class="table-view table-view-full my-0 ml-4 mr-0 border-top-0" data-role="attach-preview-photo" data-sortable="mediaset"></ul>
|
||||
|
||||
<!-- 일반파일 리스트 -->
|
||||
<ul class="table-view table-view-full my-0 ml-4 mr-0 border-top-0" data-role="attach-preview-file" data-sortable="mediaset">
|
||||
</ul>
|
||||
|
||||
<!-- 오디오 리스트 -->
|
||||
<ul class="table-view table-view-full my-0 ml-4 mr-0 border-top-0" data-role="attach-preview-audio" data-sortable="mediaset">
|
||||
</ul>
|
||||
|
||||
<!-- 비디오 리스트 -->
|
||||
<div class="table-view table-view-full my-0 ml-4 mr-0 border-top-0" data-role="attach-preview-video" data-sortable="mediaset">
|
||||
</div>
|
||||
|
||||
<div class="content-padded">
|
||||
<div data-role="attach-files" class="files"><!-- 파일폼 출력 --></div>
|
||||
</div>
|
||||
|
||||
<div class="px-2">
|
||||
<button class="btn btn-link btn-block py-3" data-role="attach-handler-photo" data-type="file" role="button">
|
||||
<span class="not-loading">
|
||||
추가
|
||||
</span>
|
||||
<span class="is-loading">
|
||||
<div class="spinner-border spinner-border-sm" role="status">
|
||||
<span class="sr-only">업로드중...</span>
|
||||
</div>
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<script src="<?php echo $g['url_attach_theme']?>/main.js"></script>
|
||||
|
||||
<?php
|
||||
include $g['dir_attach_theme'].'/footer.php';
|
||||
?>
|
||||
177
modules/mediaset/themes/_mobile/rc-post-file/modals.php
Normal file
177
modules/mediaset/themes/_mobile/rc-post-file/modals.php
Normal file
@@ -0,0 +1,177 @@
|
||||
|
||||
<!-- 첨부 사진 메타정보 수정 -->
|
||||
<div class="modal fade rb-modal-attach-meta" id="modal-attach-photo-meta" tabindex="-1" role="dialog" aria-labelledby="">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-title" id=""><i class="fa fa-camera-retro"></i> 사진 정보수정</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="row">
|
||||
<!-- data-role="img-preview" src="_s 이미지" data-origin="원본 이미지" 넣는다. -->
|
||||
<div class="col-md-4"><p><img class="img-thumbnail" src="" alt="" data-role="img-preview" data-origin=""></p></div>
|
||||
<div class="col-md-8">
|
||||
<div class="form-group">
|
||||
<label for="file-name" class="control-label">파일명:</label>
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control" data-role="filename" name="filename">
|
||||
<span class="input-group-addon" data-role="fileext"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="file-caption" class="control-label">캡션:</label>
|
||||
<textarea class="form-control" data-role="filecaption"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal" data-attach-act="cancel" data-target="#modal-attach-photo-meta" data-role="eventHandler" data-id="">취소하기</button>
|
||||
<button type="button" class="btn btn-primary" data-attach-act="save" data-target="#modal-attach-photo-meta" data-role="eventHandler" data-id="">저장하기</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 첨부 파일 메타정보 수정 -->
|
||||
<div class="modal fade rb-modal-attach-meta" id="modal-attach-file-meta" tabindex="-1" role="dialog" aria-labelledby="">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-title" id=""><i class="fa fa-floppy-o"></i> 첨부파일 정보수정</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<h1 class="text-xs-center" data-role="img-preview">
|
||||
</h1>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<div class="form-group">
|
||||
<label for="file-name" class="control-label">파일명:</label>
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control" name="filename" data-role="filename">
|
||||
<span class="input-group-addon" data-role="fileext"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="file-caption" class="control-label">캡션:</label>
|
||||
<textarea class="form-control" data-role="filecaption" name="caption"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal" data-attach-act="cancel" data-target="#modal-attach-file-meta" data-role="eventHandler" data-id="">취소하기</button>
|
||||
<button type="button" class="btn btn-primary" data-attach-act="save" data-target="#modal-attach-file-meta" data-role="eventHandler" data-id="" data-type="">저장하기</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- 링크 추가 -->
|
||||
<div class="modal fade" tabindex="-1" role="dialog" id="modal-attach-link">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-title">링크 추가</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p id="attach-link"><!--링크 입력 필드 동적 생성 --></p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">닫기</button>
|
||||
<button type="button" class="btn btn-primary" data-plugin="clipboard" data-clipboard-text="" data-role="btn-copy-linkContent">링크내용 복사하기</button>
|
||||
</div>
|
||||
</div><!-- /.modal-content -->
|
||||
</div><!-- /.modal-dialog -->
|
||||
</div><!-- /.modal -->
|
||||
|
||||
<!-- 위치 추가 -->
|
||||
<div class="modal fade" tabindex="-1" role="dialog" id="modal-attach-map">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-title">위치 추가</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p>지도 검색 UI </p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">닫기</button>
|
||||
<button type="button" class="btn btn-primary">적용하기</button>
|
||||
</div>
|
||||
</div><!-- /.modal-content -->
|
||||
</div><!-- /.modal-dialog -->
|
||||
</div><!-- /.modal -->
|
||||
|
||||
<!-- 비디오 추가 -->
|
||||
<div class="modal fade" tabindex="-1" role="dialog" id="modal-attach-video">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-title">비디오 추가</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p>유튜브와 비메오 비디오만 링크를 추가하는 형태</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">닫기</button>
|
||||
<button type="button" class="btn btn-primary">적용하기</button>
|
||||
</div>
|
||||
</div><!-- /.modal-content -->
|
||||
</div><!-- /.modal-dialog -->
|
||||
</div><!-- /.modal -->
|
||||
|
||||
<!-- 업로드 리스트 -->
|
||||
<div class="modal fade" id="modal-attach" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-title" id="myModalLabel"><i class="fa fa-paperclip"></i> 첨부목록</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
|
||||
<!-- Nav tabs -->
|
||||
<ul class="nav nav-pills" role="tablist">
|
||||
<li role="presentation" class="active"><a href="#modal-attach-photo" arole="tab" data-toggle="tab">사진</a></li>
|
||||
<li role="presentation"><a href="#modal-attach-file" role="tab" data-toggle="tab">파일</a></li>
|
||||
<li role="presentation"><a href="#modal-attach-video" role="tab" data-toggle="tab">동영상</a></li>
|
||||
<li role="presentation"><a href="#modal-attach-link" role="tab" data-toggle="tab">링크</a></li>
|
||||
<li role="presentation"><a href="#modal-attach-map" role="tab" data-toggle="tab">위치</a></li>
|
||||
</ul>
|
||||
|
||||
<!-- Tab panes -->
|
||||
<div class="tab-content rb-attach">
|
||||
<div role="tabpanel" class="tab-pane active" id="modal-attach-photo">
|
||||
<ul class="list-group rb-attach-photo" data-role="modal-attach-preview-photo">
|
||||
<?php echo getAttachFileList($parent_data,'modal','photo')?>
|
||||
</ul>
|
||||
</div>
|
||||
<div role="tabpanel" class="tab-pane" id="modal-attach-file" >
|
||||
<ul class="list-group rb-attach-file" data-role="modal-attach-preview-file">
|
||||
<?php echo getAttachFileList($parent_data,'modal','file')?>
|
||||
</ul>
|
||||
</div>
|
||||
<div role="tabpanel" class="tab-pane" id="modal-attach-video">
|
||||
비디오 목록
|
||||
</div>
|
||||
<div role="tabpanel" class="tab-pane" id="modal-attach-link">
|
||||
링크목록
|
||||
</div>
|
||||
<div role="tabpanel" class="tab-pane" id="modal-attach-map">
|
||||
위치목록
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
1
modules/mediaset/themes/_mobile/rc-post-file/name.txt
Normal file
1
modules/mediaset/themes/_mobile/rc-post-file/name.txt
Normal file
@@ -0,0 +1 @@
|
||||
알씨 기본형
|
||||
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