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 @@
|
||||
알씨 기본형
|
||||
Reference in New Issue
Block a user