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(' - ');
$this->headScript()->appendFile('/js/jquery-1.7.min.js');
$this->headScript()->appendFile('/js/jquery.colorbox-min.js');
$this->headLink()->appendStylesheet('/css/author.css');
$this->headLink()->appendStylesheet('/css/colorbox.css');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/author">数据作者</a>');
$this->breadcrumb('我的数据');
$this->breadcrumb()->setSeparator(' > ');
?>
<!-- 左侧导航 -->
<div id='sidebar'>
<div id='leftnavi'>
<?= $this->partial('author/navi.phtml'); ?>
</div>
</div>
<!-- //左侧导航 -->
<!-- 页面内容 -->
<div id="wapper">
<?php
if(!empty($this->error))
{
echo $this->error;
}
?>
<div class="pagetitle">
<?php echo $this->info[0]['title'] ;?> (共 <?php echo count($this->info);?> 个文档)
</div>
<div id="datalist">
<?php
if (count($this->paginator)):
echo "<ul>";
$autoindex=0;
foreach ($this->paginator as $item):
$autoindex++;?>
<li id="data_<?php echo $item['id'];?>">
<p><input type="text" readonly="readonly" value="<?php echo $item['realname']; ?>" id="file_<?php echo $item['id'];?>" class="half" />
<button type="button" id="btn_<?php echo $item['id'];?>" onclick="Submit(<?php echo $item['id'];?>)" disabled="disabled" style="display:none;">提交</button>
(<?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>
<!-- //页面内容 -->
<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>