129 lines
4.6 KiB
PHTML
129 lines
4.6 KiB
PHTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
<title>数据上传</title>
|
|
<link rel="stylesheet" type="text/css" media="screen" href="/css/default.css" />
|
|
<script src='/static/js/jquery-1.7.2.min.js' type="text/javascript"></script>
|
|
<script type="text/javascript" src="/static/js/uploadify/swfobject.js"></script>
|
|
<script type="text/javascript" src="/static/js/uploadify/jquery.uploadify.v2.1.4.min.js"></script>
|
|
<script type="text/javascript" src="/js/jquery.colorbox-min.js"></script>
|
|
<link href="/css/author.css" media="screen" rel="stylesheet" type="text/css"/>
|
|
<link href="/static/js/uploadify/uploadify.css" media="screen" rel="stylesheet" type="text/css" />
|
|
<link href="/css/colorbox.css" media="screen" rel="stylesheet" type="text/css" />
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<!-- 页面内容 -->
|
|
<div id="page">
|
|
<div id="wapper full">
|
|
|
|
<div id="addform">
|
|
<form id="literature-add">
|
|
<p>
|
|
<label>文献引用信息:</label><br />
|
|
<textarea class="full" rows="3" id="ref" name="ref" placeholder="标准文献引用格式"></textarea><br />
|
|
<input type="hidden" name="uuid" value="<?php echo $this->uuid;?>" />
|
|
请输入排序数字 <input type="text" name="order_input" id="order_input" value="1"/><br />
|
|
<label>数据上传:</label>
|
|
<div><input id="file_upload" name="Filedata" type="file" /></div>
|
|
<div id="datalist"></div>
|
|
<input type="button" class="btn btn-small" onclick="return checksize();" value="上传" />
|
|
</p>
|
|
<p id="tips">
|
|
</p>
|
|
<p>
|
|
<br />
|
|
<input type="button" onclick="Submit()" id="commit_submit" class="btn btn-green big" value="提交"/>
|
|
</p>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<script>
|
|
$(document).ready(function() {
|
|
$('#file_upload').uploadify({
|
|
'uploader' : '/static/js/uploadify/uploadify.swf',
|
|
'scriptData': {'PHPSESSID' : '<?php echo session_id(); ?>','uuid':'<?php echo $this->uuid;?>','submit':'1'},
|
|
'script' : '/author/literature/ac/upload',
|
|
'cancelImg' : '/static/js/uploadify/cancel.png',
|
|
'folder' : '/uploads',
|
|
'sizeLimit' : 52428800,
|
|
'queueSizeLimit' : 1,
|
|
'multi' : false,
|
|
'auto' : false,
|
|
'displayData' : 'speed',
|
|
'buttonImg' : '/static/js/uploadify/selectfile.gif',
|
|
'onComplete' : function(event, ID, fileObj, response, data) {
|
|
var obj = jQuery.parseJSON(response);
|
|
if(obj.error=='')
|
|
{
|
|
html = obj.html;
|
|
}
|
|
else{html=uploadError(obj.error,obj.attid);}
|
|
$('<li/>', {
|
|
"id":'uploadedItem_'+obj.attid,
|
|
"class":'uploadifyQueueItem',
|
|
"html": html
|
|
}).appendTo('#datalist');
|
|
$('#deletebtn_'+obj.attid).bind('click', function() {
|
|
deleteatt(obj.attid);
|
|
});
|
|
},
|
|
'onError' : function (event,ID,fileObj,errorObj) {
|
|
alert(errorObj.type + ' Error: ' + errorObj.info);
|
|
}
|
|
});
|
|
});
|
|
function checksize(){
|
|
if($("#datalist").has("li").length)
|
|
{
|
|
$('#tips').html('只能上传一个文档,如果需要更换,请先删除原来的文档');
|
|
}else{
|
|
$('#file_upload').uploadifyUpload();
|
|
}
|
|
}
|
|
function Submit(){
|
|
$.ajax({
|
|
'type':"POST",
|
|
'url':'/author/literature/ac/add',
|
|
'data':'submit=submit&'+$('#literature-add').serialize(),
|
|
'success':function(data){
|
|
if (typeof(data)=='object')
|
|
{
|
|
if(typeof(data.error)!='undefined')
|
|
{$.colorbox({'innerWidth':'50%','html':data.error});}
|
|
if(typeof(data.commited)!='undefined')
|
|
{$('#addform').html('添加成功!');setTimeout('parent.$.fn.colorbox.close();',2000);}
|
|
}
|
|
else{
|
|
$.colorbox({'innerWidth':'50%','html':'<img src="/images/alert_big_warning.png" /><h4>出现错误,请稍候再试</h4>'});
|
|
}
|
|
},
|
|
'timeout': 30000,
|
|
'error': function(){
|
|
$.colorbox({'innerWidth':'50%','html':'<img src="/images/alert_big_error.png" /><h4>处理中出现错误,请刷新页面后重试</h4>'});
|
|
}
|
|
});
|
|
}
|
|
function deleteatt(attid){
|
|
$.ajax({
|
|
type:"POST",
|
|
url:'/service/delreviewatt/id/'+attid,
|
|
data:'',
|
|
success:function(html){
|
|
$('#uploadedItem_'+attid).remove();
|
|
},
|
|
beforeSend:function(){
|
|
$('#deletebtn_'+attid).html('<img src="/images/11887177066.gif" />');
|
|
}
|
|
});
|
|
}
|
|
function uploadError(msg,id){
|
|
var html = msg+'<div class="cancel"><a href="javascript:;" id="deletebtn_'+id+'"><img border="0" src="/static/js/uploadify/cancel.png" /></a></div>';
|
|
return html;
|
|
}
|
|
</script>
|
|
</body>
|
|
</html>
|