westdc-zf1/application/default/views/scripts/author/document-view.phtml

107 lines
3.3 KiB
PHTML
Raw Normal View History

<?php
$this->headTitle($this->config->title->site);
$this->headTitle($this->config->title->author);
$this->headTitle()->setSeparator(' - ');
2013-03-28 07:12:10 +00:00
$this->theme->AppendPlus($this,'colorbox');
$this->headLink()->appendStylesheet('/css/author.css');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/author">数据作者</a>');
$this->breadcrumb('我的数据');
$this->breadcrumb()->setSeparator(' > ');
?>
2013-03-28 07:12:10 +00:00
<div class="row">
<div class="span3">
<?= $this->partial('author/navi.phtml'); ?>
</div>
2013-03-28 07:12:10 +00:00
<div class="span9">
<div>
<?php
if(!empty($this->error))
{
echo $this->error;
}
?>
<div class="pagetitle">
<?php echo $this->title ;?> (共 <?php echo count($this->info);?> 个文档)
</div>
<div>
<?php
if (count($this->paginator)):
echo '<ul class="unstyled">';
$autoindex=0;
foreach ($this->paginator as $item):
$autoindex++;?>
<li class="well" id="data_<?php echo $item['id'];?>">
<p>
<div class="input-append">
<input type="text" readonly="readonly" value="<?php echo $item['realname']; ?>" id="file_<?php echo $item['id'];?>" class="half" />
<button type="button" class="btn" id="btn_<?php echo $item['id'];?>" onclick="Submit(<?php echo $item['id'];?>)" disabled="disabled" style="display:none;">提交</button>
</div>
(<?php echo round($item['filesize']/1024,2)?>KB)</p>
<p><a href="javascript:;" onclick="del(<?php echo $item['id'];?>)">删除</a> |
<a href="javascript:;" onclick="edit(<?php echo $item['id'];?>)">改名</a> |
<a href="/author/document/ac/download/id/<?php echo $item['id'];?>" target="_blank">下载</a></p>
</li>
<?php endforeach;
echo "</ul>";
endif; ?>
<div class="pagenavi"><?= $this->paginator; ?></div>
</div>
</div>
2013-03-28 07:12:10 +00:00
</div>
</div>
2013-03-28 07:12:10 +00:00
<!-- //页面内容 -->
<script>
function edit(id){
$('#file_'+id).removeAttr('readonly');
$('#btn_'+id).removeAttr('disabled');
$('#btn_'+id).fadeIn();
}
function Submit(id){
$.ajax({
'type':"POST",
'url':'/submit/files/ac/editname',
'data':'id='+id+'&name='+$('#file_'+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':'修改成功'});
$('#btn_'+id).fadeOut();
$('#file_'+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:'/author/document/ac/del/uuid/<?php echo $this->info[0]['uuid']; ?>/id/'+id,
data:'',
success:function(html){
$('#data_'+id).fadeOut();
},
timeout:10000,
error:function(){
alert('删除失败,请重试');
}
});
}
</script>