westdc-zf1/application/admin/views/scripts/data/attachments.phtml

119 lines
4.2 KiB
PHTML

<?php
$this->headTitle($this->config->title->site);
$this->headTitle('后台管理');
$this->headTitle()->setSeparator(' - ');
$this->headLink()->appendStylesheet('/css/admin.css');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/admin">后台首页</a>');
$this->breadcrumb('数据管理');
$this->headScript()->appendFile('/static/js/jquery-1.7.2.min.js');
$this->headScript()->appendFile('/js/jquery.colorbox-min.js');
$this->headLink()->appendStylesheet('/css/colorbox.css');
$this->breadcrumb()->setSeparator(' > ');
?>
<div id="leftPanel">
<?= $this->partial('data/left.phtml'); ?>
</div>
<div id="rightPanel">
<?php if ($this->msg or $this->messages) :?>
<div id="message">
<?php if ($this->msg) : ?>
<p><?php echo $this->msg; ?></p>
<?php endif; if ($this->messages): foreach($this->messages as $msg): ?>
<p><?php echo $msg; ?></p>
<?php endforeach;endif; ?>
</div>
<?php endif; ?>
<div><a href="/admin/data/attachments/add/1">上传新附件</a> | <a href="attachments/search/my">查看我的附件</a></div>
<div class="search">
<form action="" method="get">
<input type="hidden" name="search" value='1' />
<ul>
<li><label>搜索关键字</label><input type="text" name="keyword" value="<?php echo $this->keyword; ?>" /></li>
<li><input type="submit" class="searchbtn" value="搜索" /></li>
</ul>
</form>
</div><!-- search DIV -->
<?php if (count($this->paginator)): ?>
<form method="get" action="/admin/data/md/att/1/addatts/1">
<table class="stylized">
<thead><tr>
<?php
if(!empty($this->uuid))
echo '<th width="40">选择</th>';
?>
<th width="50">ID</th>
<th width='100'>上传文件名</th>
<th width='80'>类型</th>
<th width='80'>大小</th>
<th width='80'>下载次数</th>
<th width='150'>上传时间</th>
<th width="150">操作</th>
</tr></thead>
<tbody id="list">
<?php $autoindex=0;?>
<?php foreach ($this->paginator as $item): ?>
<?php $autoindex++;?>
<tr id="att_<?php echo $item['id'];?>">
<?php
if(!empty($this->uuid))
echo '<td><input type="checkbox" value="'.$item['id'].'" name="ids[]" /></td>';
?>
<td><?php echo $item['id'];?></td>
<td><?php echo $item['realname'] ;?></td>
<td><?php
if($item['filetype']=='image') echo '图片' ;
if($item['filetype']=='file') echo '文件' ;
if($item['filetype']=='media') echo '多媒体' ;
if($item['filetype']=='reviewatt') echo '评审附件' ;
if($item['filetype']=='md') echo "数据文件";
if($item['filetype']=='literature')echo "文献";
if($item['filetype']=='document') echo "文档";
?></td>
<td><?php if($item['filesize']<1048576) echo round(($item['filesize']/1024),2).'KB'; else echo round(($item['filesize']/1024/1024),2).'MB'; ?></td>
<td><?= $item['downtimes']; ?></td>
<td><?= date('Y-m-d H:i:s',strtotime($item['ts_created'])); ?></td>
<td>
<a href="/admin/data/attachments/edit/<?= $item['id']; ?>">编辑</a> |
<a href="javascript:delatt(<?= $item['id']; ?>);" onclick="return confirm('是否确定删除该附件?')">删除</a> |
<a href="/service/attach/id/<?= $item['id']; ?>">下载</a>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php
if(!empty($this->uuid))
echo '<input type="hidden" name="uuid" value="'.$this->uuid.'" /><input type="hidden" name="submit" value="1" /><input type="submit" value="将已选择的附件添加到《'.$this->mdtitle.'》" />';
?>
</form>
<?php endif; ?>
<div class="pagenavi"><?= $this->paginator; ?></div>
</div>
<script>
function delatt(id){
$.ajax({
'type': "POST",
'url': "/admin/data/attachments/",
'data': 'delete='+id,
'success': function(data){
if(data==null){Alert('遇到错误,请重试');return false;}
if(data.error!=null){Alert(data.error);return false;}
if(data.status==1){$('#att_'+id).fadeOut("slow");}
},
'beforeSend':function(){},
'complete':function(){},
'timeout': 20000,
'dataType': 'json',
'error': function(){Alert('处理中出现问题,请重试');}
});
}
function Alert(html){
$.colorbox({'innerWidth':'50%','html':'<h4>'+html+'</h4>'});
}
$("#list tr").mouseover(function(){$(this).addClass("high")}).mouseout(function(){$(this).removeClass("high")})
</script>