135 lines
5.2 KiB
PHTML
135 lines
5.2 KiB
PHTML
<?php
|
|
$this->headTitle($this->config->title->site);
|
|
$this->headTitle('后台管理');
|
|
$this->headTitle()->setSeparator(' - ');
|
|
$this->headLink()->appendStylesheet('/css/admin.css');
|
|
$this->breadcrumb('<a href="/">首页</a>');
|
|
$this->breadcrumb('<a href="/admin">后台首页</a>');
|
|
$this->breadcrumb('数据管理');
|
|
$this->breadcrumb()->setSeparator(' > ');
|
|
$this->theme->AppendPlus($this,"uploadify");
|
|
?>
|
|
<div class="row">
|
|
<div class="hidden-sm hidden-xs col-md-2">
|
|
<?= $this->partial('data/left.phtml'); ?>
|
|
</div>
|
|
<div class="col-md-10 col-sm-12">
|
|
<div class="form-group">
|
|
<a class="btn btn-primary btn-sm" href="/admin/data/md/att/1/uuid/<?php echo $this->uuid;?>">返回元数据附件列表</a>
|
|
<a class="btn btn-primary btn-sm" href="/data/<?php echo $this->uuid; ?>">查看元数据</a>
|
|
<a class="btn btn-primary btn-sm" href="/admin/data/attachments/">返回附件管理</a>
|
|
</div>
|
|
<form action="#" method="POST" enctype='multipart/form-data' class="form-horizontal">
|
|
<input type="hidden" name="add" value="1" />
|
|
<input type="hidden" name="submit" value="1" />
|
|
<div class="form-group">
|
|
<label for="doi" class="col-md-2 col-sm-2 control-label">请先选择附件语言:</label>
|
|
<div class="col-md-2 col-sm-2">
|
|
<select name="language" id="language" class="form-control">
|
|
<option value="zh">zh</option>
|
|
<option value="en">en</option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="doi" class="col-md-2 col-sm-2 control-label">可选择多个文件:</label>
|
|
<div class="col-md-6 col-sm-63">
|
|
<input id="file_upload" name="Filedata" type="file" />
|
|
<div id="datalist"></div>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
<style type="text/css">.uploadify{margin:0;} #file_upload-queue a:focus {outline:none;-moz-outline:none;}</style>
|
|
<script>
|
|
var _this = {
|
|
SessionID: '<?php echo session_id(); ?>'
|
|
};
|
|
var uploader;
|
|
var param = {};
|
|
param = {
|
|
"PHPSESSID": _this.SessionID,
|
|
"multi": 'yes'
|
|
};
|
|
|
|
$("#language").click(function(){
|
|
param.language = $("#language").val();
|
|
});
|
|
|
|
$(function () {
|
|
$('#file_upload').uploadify({
|
|
'swf': '/js/lib/uploadify/uploadify.swf',
|
|
'uploader': '/admin/data/upload/<?php if(!empty($this->uuid)) echo "uuid/".$this->uuid; ?>',
|
|
'width': 155,
|
|
'buttonText': '浏览',
|
|
'debug': false,
|
|
'preventCaching':false,
|
|
'multi': true,
|
|
'auto': true,
|
|
'fileTypeExts': '*',
|
|
'onUploadSuccess': function (file, data, response) {
|
|
upload.onsuccess(file, data, response);
|
|
},
|
|
'onUploadStart': function (file) {
|
|
$('#file_upload').uploadify('settings', 'formData', param);
|
|
|
|
}
|
|
});
|
|
});
|
|
var upload = {
|
|
onsuccess: function (file, data, response) {
|
|
_data = $.parseJSON(data);
|
|
if (!$.isEmptyObject(_data.error)) {
|
|
alert(_data.error);
|
|
} else {
|
|
$('#datalist').append(upload.makeFileHtml(_data));
|
|
// console.log($("#language").val());
|
|
//console.log(_data);
|
|
}
|
|
},
|
|
makeFileHtml: function (data) {
|
|
return '<div class="alert alert-success">'
|
|
+ '<button type="button" class="close" data-dismiss="alert" onclick="upload.deleteFile('+ data.id +')"><i class="glyphicon glyphicon-trash"></i></button>'
|
|
+ '<a href="/service/attach/id/' + data.id + '">' + data.realname + '</a>'
|
|
+ '<input type="hidden" name="attid" value="' + data.id + '"></input>'
|
|
+ '</div>';
|
|
},
|
|
deleteFile: function (id) {
|
|
$.ajax({
|
|
'type': "POST",
|
|
'url': '/admin/data/attachments/',
|
|
'data': 'uuid=<?php echo $this->uuid?>&mdattdel=' + id,
|
|
'success': function (data) {
|
|
if (typeof (data) == 'undefined') {
|
|
alert("数据源错误,请联系管理员");
|
|
return false;
|
|
}
|
|
|
|
if (!$.isEmptyObject(data.error)) {
|
|
alert(data.error);
|
|
return false;
|
|
}
|
|
},
|
|
'timeout': 30000,
|
|
'error': function () {
|
|
alert('附件删除出错');
|
|
}
|
|
});
|
|
}
|
|
};
|
|
|
|
$(document).ready(function () {
|
|
$.getJSON("/admin/data/getatts/uuid/<?php echo $this->uuid;?>", function (data) {
|
|
if (data) {
|
|
$.each(data, function (key, val) {
|
|
$('#datalist').append(upload.makeFileHtml(val));
|
|
});
|
|
}
|
|
});
|
|
});
|
|
function Alert(html) {
|
|
$.colorbox({ 'innerWidth': '50%', 'html': '<h4>' + html + '</h4>' });
|
|
}
|
|
</script>
|