116 lines
3.3 KiB
PHTML
116 lines
3.3 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 id="leftPanel">
|
|
<?= $this->partial('data/left.phtml'); ?>
|
|
</div>
|
|
<div id="rightPanel">
|
|
|
|
<div class="ctrlplan">
|
|
<a href="/admin/data/md/att/1/uuid/<?php echo $this->uuid;?>">返回元数据附件列表</a>
|
|
<a href="/data/<?php echo $this->uuid; ?>">查看元数据</a>
|
|
<a href="/admin/data/attachments/">返回附件管理</a>
|
|
</div>
|
|
|
|
<form action="#" method="POST" enctype='multipart/form-data'>
|
|
<input type="hidden" name="add" value="1" />
|
|
<input type="hidden" name="submit" value="1" />
|
|
|
|
<p>注:可选择多个文件<br />
|
|
<div id="datalist">
|
|
</div>
|
|
<input id="file_upload" name="Filedata" type="file" />
|
|
</p>
|
|
|
|
</form>
|
|
</div>
|
|
<script>
|
|
var _this = {
|
|
SessionID : '<?php echo session_id(); ?>'
|
|
};
|
|
var uploader;
|
|
var param;
|
|
param = {
|
|
"PHPSESSID" : _this.SessionID,
|
|
"multi" : 'yes'
|
|
};
|
|
$(function() {
|
|
$('#file_upload').uploadify({
|
|
'swf' : '/js/lib/uploadify/uploadify.swf',
|
|
'uploader' : '/admin/data/upload/<?php if(!empty($this->uuid)) echo "uuid/".$this->uuid; ?>',
|
|
'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));
|
|
}
|
|
},
|
|
makeFileHtml : function(data){
|
|
return '<div class="alert alert-success">'
|
|
+ '<button type="button" class="close" data-dismiss="alert" onclick="upload.deleteFile('+data.id+')"><i class="icon-trash icon-white"></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>
|