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

102 lines
3.7 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->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->headLink()->appendStylesheet('/static/js/uploadify/uploadify.css');
$this->headScript()->appendFile('/static/js/uploadify/swfobject.js');
$this->headScript()->appendFile('/static/js/uploadify/jquery.uploadify.v2.1.4.min.js');
$this->breadcrumb('数据管理');
$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 class="ctrlplan">
<a href="/admin/data/md/att/1/uuid/<?php echo $this->uuid;?>/addatts/1/mdtitle/<?php echo $this->mdtitle ;?>">为此元数据选择附件</a>
<a href="/admin/data/attachments/add/1/uuid/<?php echo $this->uuid;?>">为此元数据添加附件</a>
<a href="/data/<?php echo $this->uuid; ?>">查看元数据</a>
</div>
<table class="stylized">
<thead><tr>
<th width='250'>文件名</th>
<th width='80'>类型</th>
<th width='80'>大小</th>
<th width='80'>下载次数</th>
<th width='150'>上传时间</th>
<th width="200">操作</th>
</tr></thead>
<tbody>
<?php
foreach ($this->atts as $v)
{
if($v['filesize']<1048576) $v['filesize'] = round(($v['filesize']/1024),2).'KB'; else $v['filesize'] = round(($v['filesize']/1024/1024),2).'MB';
echo '
<tr id="att_'.$v['id'].'">
<td>'.$v['realname'].'</td>
<td>'.$v['filetype'].'</td>
<td>'.$v['filesize'].'</td>
<td>'.$v['downtimes'].'</td>
<td>'.date('Y-m-d H:i:s',strtotime($v['ts_created'])).'</td>
<td>
<a href="/admin/data/attachments/attupdate/'.$v['id'].'" class="iframe">更新文件</a>
<a href="javascript:;" onclick="delmdatt('.$v['id'].')">从此元数据中移除</a>
<a href="/service/attach/id/'.$v['id'].'">下载</a>
</td>
</tr>';
}
?>
</tbody></table>
</div>
<div style="display:none;">
<form id="fileUpdate" method="post">
<input type="hidden" id="id" name="id" value="" />
<p>注:要更新的文件只能选择一个<br />
<ul id="datalist"></ul>
<input id="file_upload" name="Filedata" type="file" />
<input type="button" class="btn btn-small btn-green" onclick="$('#file_upload').uploadifyUpload();" value="更改" />
</p>
</form>
</div>
<script>
function delmdatt(id){
$.ajax({
'type': "POST",
'url': "/admin/data/attachments/",
'data': 'uuid=<?php echo $this->uuid?>&mdattdel='+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('处理中出现问题,请重试');}
});
}
$(".iframe").colorbox({iframe:true, width:"50%", height:"50%"});
$(".inline").colorbox({inline:true,'innerWidth':'50%','innerHeight':'50%'});
function Alert(html){
$.colorbox({'innerWidth':'50%','html':'<h4>'+html+'</h4>'});
}
</script>