120 lines
3.5 KiB
PHTML
120 lines
3.5 KiB
PHTML
<?php
|
|
$this->headTitle($this->config->title->site);
|
|
$this->headTitle('后台管理');
|
|
$this->headTitle()->setSeparator(' - ');
|
|
$this->breadcrumb('<a href="/">首页</a>');
|
|
$this->breadcrumb('<a href="/admin/data">数据管理</a>');
|
|
$this->breadcrumb('文献管理');
|
|
$this->breadcrumb()->setSeparator(' > ');
|
|
$this->theme->AppendPlus($this,'colorbox');
|
|
$this->theme->AppendPlus($this,"uploadify");
|
|
$this->theme->AppendPlus($this,'admin_plugin');
|
|
?>
|
|
<style>
|
|
table thead tr th {background:#EBF2F6;}
|
|
</style>
|
|
<div class="row-fluid">
|
|
<div class="span2">
|
|
<?= $this->partial('data/left.phtml'); ?>
|
|
</div>
|
|
<div class="span10">
|
|
<div>
|
|
<?= $this->partial('data/ref-nav.phtml',array('ac'=>$this->ac)); ?>
|
|
</div>
|
|
<?php if(!empty($this->error)) { ?>
|
|
<?= $this->error ?>
|
|
<?php } ?>
|
|
<?php if(!empty($this->msg)) { ?>
|
|
<?= $this->msg ?>
|
|
<?php } else{ ?>
|
|
<form class="form-horizontal" method="post">
|
|
<div class="control-group">
|
|
<label class="control-label" for="inputPassword">PDF</label>
|
|
<div class="controls">
|
|
<input type="file" name="Filedata" id="file_upload" />
|
|
<div id="uploadedFile"></div>
|
|
</div>
|
|
</div>
|
|
<div class="form-actions">
|
|
<a class="btn btn-primary" href="/admin/data/ref/ac/files">文件管理</a>
|
|
</div>
|
|
</form>
|
|
<?php } ?>
|
|
</div>
|
|
</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/ref/ac/pdfupload',
|
|
'multi' : true,
|
|
'auto' : true,
|
|
'fileTypeExts' : '*.pdf',
|
|
'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{
|
|
$('#uploadedFile').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>'
|
|
+ data.realname
|
|
+'<input type="hidden" name="attid" value="'+data.id+'"></input>'
|
|
+'</div>';
|
|
},
|
|
deleteFile : function(id){
|
|
$.ajax({
|
|
'type':"POST",
|
|
'url':'/admin/data/ref/ac/delete',
|
|
'data':'attid=' + 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('附件删除出错');
|
|
}
|
|
});
|
|
}
|
|
};
|
|
</script>
|
|
<?php if(isset($this->data['attid']) && !empty($this->data['attid'])){ ?>
|
|
<input type="hidden" id="reference_file_content" value='<?= json_encode($this->data['file']) ?>' />
|
|
<script>
|
|
upload.onsuccess('',$('#reference_file_content').val(),"");
|
|
</script>
|
|
<?php } ?> |