234 lines
11 KiB
HTML
234 lines
11 KiB
HTML
{template "header.html"}
|
|
|
|
<form class="form-horizontal" method="post" role="form" id="myform" style="margin-top:-20px;">
|
|
{$form}
|
|
<div class="portlet light " style="padding: 0">
|
|
|
|
<div class="portlet-title tabbable-line">
|
|
<ul class="nav nav-tabs" style="float:left;">
|
|
{if $unused}
|
|
<li id="tab_nav_0" class="{if $pp==0}active{/if}">
|
|
<a href="{$tab_url}&pp=0"><i class="fa fa-folder"></i> {dr_lang('未归档')} </a>
|
|
</li>
|
|
{/if}
|
|
<li class="dev {if $pp==1}active{/if}">
|
|
<a href="{$tab_url}&pp=1"><i class="bi bi-folder-check"></i> {dr_lang('已归档')} </a>
|
|
</li>
|
|
{if $member.is_admin}
|
|
<li class="dev {if $pp==2}active{/if}">
|
|
<a href="{$tab_url}&pp=2"><i class="fa fa-folder-open"></i> {dr_lang('浏览')} </a>
|
|
</li>
|
|
{/if}
|
|
<li class="dev {if $pp==3}active{/if}">
|
|
<a href="{$tab_url}&pp=3"><i class="fa fa-edit"></i> {dr_lang('录入')} </a>
|
|
</li>
|
|
{if $field}
|
|
<link href="{ROOT_THEME_PATH}assets/global/plugins/jquery-fileupload/css/jquery.fileupload.css" rel="stylesheet" type="text/css" />
|
|
<script src="{ROOT_THEME_PATH}assets/global/plugins/jquery-fileupload/js/jquery.fileupload.js" type="text/javascript"></script>
|
|
<li class="dev" id="fileupload">
|
|
<a href="JavaScript:;" title="{$field.tips}" class="fileinput-button tooltips" data-container="body" data-placement="bottom" data-original-title="{$field.tips}"> <i class="fa fa-upload"></i> {dr_lang('上传')}<input type="file" multiple name="file_data"> </a>
|
|
</li>
|
|
<li class="dev">
|
|
<input id="dr_file_count" value="0" type="hidden">
|
|
<a class="fileupload-progress"></a>
|
|
</li>
|
|
<script type="text/javascript">
|
|
$(function() {
|
|
$("#fileupload").fileupload({
|
|
disableImageResize: false,
|
|
autoUpload: true,
|
|
maxFileSize: "{$field.param.size}",
|
|
url: "{$field.url}",
|
|
dataType: "json",
|
|
acceptFileTypes: "{$field.param.exts}",
|
|
maxChunkSize: '{$field.param.chunk}',
|
|
progressall: function (e, data) {
|
|
// 上传进度条 all
|
|
var progress = parseInt(data.loaded / data.total * 100, 10);
|
|
$(".fileupload-progress").show();
|
|
$(".fileupload-progress").html(""+progress+"%");
|
|
},
|
|
add: function (e, data) {
|
|
$(".fileupload-progress").hide();
|
|
data.submit();
|
|
|
|
},
|
|
done: function (e, data) {
|
|
var count = parseInt($('#dr_file_count').val()) + 1;
|
|
$('#dr_file_count').val(count);
|
|
$(".fileupload-progress").hide();
|
|
if (data.result.code > 0) {
|
|
dr_tips(data.result.code, data.result.msg);
|
|
if (count == data.originalFiles.length) {
|
|
setTimeout("window.location.href = '{$field.back}'", 2000);
|
|
}
|
|
//setTimeout("window.location.href = '{$field.back}'", 2000);
|
|
} else {
|
|
dr_tips(data.result.code, data.result.msg, -1);
|
|
}
|
|
},
|
|
fail: function (e, data) {
|
|
//console.log(data.errorThrown);
|
|
dr_tips(0, "系统故障:"+data.errorThrown, -1);
|
|
layer.closeAll('tips');
|
|
$(".fileupload-progress").hide();
|
|
|
|
},
|
|
});
|
|
});
|
|
</script>
|
|
{/if}
|
|
</ul>
|
|
</div>
|
|
|
|
<style>
|
|
.table-fc-upload .fc-upload-item .color-demo { position: relative; }
|
|
.table-fc-upload .fc-upload-del {
|
|
position: absolute; right: 4px; top: 4px; z-index: 10;
|
|
width: 24px; height: 24px; line-height: 24px; text-align: center;
|
|
background: rgba(0,0,0,.5); color: #fff; border-radius: 4px;
|
|
opacity: 0; transition: opacity .2s;
|
|
display: block; text-decoration: none;
|
|
}
|
|
.table-fc-upload .fc-upload-item:hover .fc-upload-del { opacity: 1; }
|
|
.table-fc-upload .fc-upload-del:hover { background: #d9534f; color: #fff; }
|
|
</style>
|
|
<div class="portlet-body table-finecms-upload">
|
|
|
|
{if $unused && $pp==0}
|
|
<div role="presentation" class="table table-fc-upload table-striped clearfix">
|
|
<div class="files row">
|
|
{php $tid=0;}
|
|
{table cache=0 table=attachment_unused where=$list.unused IN_fileext=$fileext order=id_desc pagefile=admin page=1 pagesize=$psize urlrule=$urlrule}
|
|
{template "api_upload_data.html"}
|
|
{/table}
|
|
</div>
|
|
</div>
|
|
{elseif $pp==3}
|
|
<div class="form-group" id="dr_row_url">
|
|
<label class="col-xs-3 control-label ajax_name" style="padding-top: 0">{dr_lang('文件地址')}</label>
|
|
<div class="col-xs-8">
|
|
<input type="text" class="form-control" id="dr_url" name="data[url]" value="{$file}">
|
|
</div>
|
|
</div>
|
|
<div class="form-group" id="dr_row_down">
|
|
<label class="col-xs-3 control-label ajax_name" style="padding-top: 0">{dr_lang('下载文件')}</label>
|
|
<div class="col-xs-8">
|
|
<div class="mt-radio-inline">
|
|
<label class="mt-radio mt-radio-outline"><input type="radio" name="data[down]" value="1" {if $data['down']}checked{/if} /> {dr_lang('是')} <span></span></label>
|
|
<label class="mt-radio mt-radio-outline"><input type="radio" name="data[down]" value="0" {if empty($data['down'])}checked{/if} /> {dr_lang('否')} <span></span></label>
|
|
</div>
|
|
<span class="help-block"> {dr_lang('当目标文件过大或者对方服务器拒绝下载时会导致下载失败')} </span>
|
|
</div>
|
|
</div>
|
|
{elseif $pp==2 && $member.is_admin}
|
|
<div role="presentation" class="table table-fc-filelist table-striped clearfix">
|
|
</div>
|
|
<script>
|
|
function dr_filelist(dir) {
|
|
$.get('{$listurl}&dir='+dir, function (text){
|
|
$('.table-fc-filelist').html(text);
|
|
}, 'text');
|
|
}
|
|
function dr_file_select(file) {
|
|
|
|
}
|
|
dr_filelist('');
|
|
</script>
|
|
{else}
|
|
<div class="row">
|
|
<div class="col-md-12 text-center margin-bottom-20">
|
|
<label><select id="dr_field_name"class="form-control">
|
|
{loop $sfield $i $t}
|
|
<option value="{$i}" {if $param.name == $i} selected{/if}>{$t}</option>
|
|
{/loop}
|
|
</select></label>
|
|
<label>
|
|
<input type="text" class="form-control" value="{$param.value}" id="dr_field_value">
|
|
</label>
|
|
<label><a class="btn green btn-sm onloading" href="javascript:;" onclick="dr_fsearch()"> <i class="fa fa-search"></i> {dr_lang('搜索')}</a></label>
|
|
</div>
|
|
</div>
|
|
<div role="presentation" class="table table-fc-upload table-striped clearfix">
|
|
|
|
<div class="files row">
|
|
{php $tid=1;}
|
|
{table cache=0 table=attachment_data where=$list.used IN_fileext=$fileext order=id_desc pagefile=admin page=1 pagesize=$psize urlrule=$urlrule}
|
|
{template "api_upload_data.html"}
|
|
{/table}
|
|
</div>
|
|
</div>
|
|
|
|
{/if}
|
|
<div class="row">
|
|
<div class="col-md-12 text-center margin-bottom-20 ">
|
|
{$pages}
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<input type="hidden" name="is_ajax" value="1">
|
|
<input type="hidden" name="is_page" id="dr_page" value="{$pp}">
|
|
</form>
|
|
|
|
<script>
|
|
function dr_fsearch() {
|
|
var url = '{$search_url}&name='+$('#dr_field_name').val()+'&value='+$('#dr_field_value').val();
|
|
window.location.href = url;
|
|
}
|
|
function dr_file_delete_tips(obj, id) {
|
|
layer.confirm(
|
|
"{dr_lang('确定要删除本文件吗?')}",
|
|
{
|
|
icon: 3,
|
|
shade: 0,
|
|
title: lang['ts'],
|
|
btn: [lang['ok'], lang['esc']]
|
|
}, function(index){
|
|
layer.close(index);
|
|
dr_file_delete(obj, id);
|
|
setTimeout("window.location.reload(true)", 2000);
|
|
});
|
|
}
|
|
function dr_select_ids(tid, id) {
|
|
var obj = $('.div_ids'+tid+'_'+id);
|
|
var select = $('.select_ids'+tid+'_'+id);
|
|
if (obj.hasClass('on-view')) {
|
|
obj.removeClass('on-view');
|
|
select.val('');
|
|
} else {
|
|
obj.addClass('on-view');
|
|
select.val(id);
|
|
}
|
|
}
|
|
$(function (){
|
|
// 懒加载缩略图:仅当图片进入视口时再加载,避免文件过多时同时请求导致卡顿
|
|
var rsLoad = document.querySelectorAll(".rs-load");
|
|
if (rsLoad.length && "IntersectionObserver" in window) {
|
|
var io = new IntersectionObserver(function(entries) {
|
|
entries.forEach(function(entry) {
|
|
if (entry.isIntersecting) {
|
|
var img = entry.target;
|
|
var src = img.getAttribute("rs-src");
|
|
if (src) {
|
|
img.src = src;
|
|
img.removeAttribute("rs-src");
|
|
img.classList.remove("rs-load");
|
|
io.unobserve(img);
|
|
}
|
|
}
|
|
});
|
|
}, { rootMargin: "50px", threshold: 0.01 });
|
|
rsLoad.forEach(function(img) { io.observe(img); });
|
|
} else {
|
|
$(".rs-load").each(function() {
|
|
$(this).attr("src", $(this).attr("rs-src"));
|
|
});
|
|
}
|
|
});
|
|
</script>
|
|
|
|
{template "footer.html"} |