westdc-zf1/application/default/views/scripts/submit/files.phtml

108 lines
3.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="/static/css/default.css" />
<link rel="stylesheet" type="text/css" media="screen" href="/static/css/table.css" />
<script src='/static/js/jquery-1.7.2.min.js' type="text/javascript"></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="/css/colorbox.css" media="screen" rel="stylesheet" type="text/css" />
</head>
<body>
<!-- 页面内容 -->
<div id="wapper">
<table class="stylized">
<thead>
<tr>
<td width='350'>数据名</td>
<td width='200'>操作</td>
</tr>
</thead>
<form id="filemanager">
<?php if (count($this->paginator)): ?>
<?php $autoindex=0;?>
<?php foreach ($this->paginator as $item): ?>
<?php $autoindex++;?>
<tr class="<?php if($autoindex%2 == 0) echo 'even'; else echo 'odd'; ?>" id="file_<?= $item['id']?>">
<td>
<input type="text" id="name_<?= $item['id']?>" value="<?= $item['realname']?>" readonly="readonly" />
<button type="button" id="submit_<?= $item['id']?>" style="display:none" onclick="Submit(<?= $item['id']?>)">提交</button>
</td>
<td>
<a href="javascript:;" onclick="del(<?= $item['id']?>)" id="del_<?= $item['id']?>">删除</a>
<a href="javascript:;" onclick="edit(<?= $item['id']?>)" id="edit_<?= $item['id']?>">改名</a></td>
</tr>
<?php endforeach; ?>
<?php endif; ?>
</form>
</table>
</div>
<!-- //页面内容 -->
<script>
function edit(id){
$('#submit_'+id).fadeIn();
$('#name_'+id).removeAttr('readonly');
}
function Submit(id){
$.ajax({
'type':"POST",
'url':'/submit/files/ac/editname',
'data':'id='+id+'&name='+$('#name_'+id).val(),
'datatype':'json',
'success':function(data){
if (typeof(data)=='object')
{
if(typeof(data.error)!='undefined')
{$.colorbox({'innerWidth':'50%','html':data.error});}
if(typeof(data.success)!='undefined' && data.success==1)
{
$.colorbox({'innerWidth':'50%','html':'修改成功'});
$('#submit_'+id).fadeOut();
$('#name_'+id).attr('readonly','readonly');
}
}
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 del(id){
$.ajax({
type:"POST",
url:'/submit/upload/ac/del/id/'+id,
data:'',
success:function(html){
$('#file_'+id).fadeOut();
},
beforeSend:function(){
$('#del_'+id).html('<img src="/images/ajax-loading-small.gif" />');
},
timeout:10000,
error:function(){
alert('删除失败,请重试');
}
});
}
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;
}
$('#wapper').width($('.body').width()-$('#sidebar').width()-20);
</script>
</body>
</html>