优化文件列表显示
This commit is contained in:
parent
a12603a0de
commit
1e05da7fbe
|
@ -867,8 +867,23 @@ class ServiceController extends Zend_Controller_Action
|
||||||
$this->_helper->viewRenderer->setNoRender();
|
$this->_helper->viewRenderer->setNoRender();
|
||||||
|
|
||||||
$uuid=$this->_request->getParam('uuid');
|
$uuid=$this->_request->getParam('uuid');
|
||||||
$sql="select f.filename,f.id,s.uuid,f.depth from datafile f,dataset s where s.id=f.dsid and s.uuid=? and f.depth=1 and f.filename<>'/uuid.txt' order by f.isdir desc,f.filename";
|
$sql="select f.filename,f.id,s.uuid,f.depth,f.filesize as filesize,f.ts_created from datafile f,dataset s where s.id=f.dsid and s.uuid=? and f.depth=1 and f.filename<>'/uuid.txt' order by f.isdir desc,f.filename";
|
||||||
$files=$this->db->fetchAll($this->db->quoteInto($sql,$uuid));
|
$files=$this->db->fetchAll($this->db->quoteInto($sql,$uuid));
|
||||||
|
//文件大小处理
|
||||||
|
foreach($files as $k=>$v)
|
||||||
|
{
|
||||||
|
if ($v['filesize']<1024)
|
||||||
|
{
|
||||||
|
$files[$k]['filesize']=$v['filesize'].'Byte';
|
||||||
|
} elseif($v['filesize']<1024*1024) {
|
||||||
|
$files[$k]['filesize']=round($v['filesize']/1024,2).'KB';
|
||||||
|
} elseif($v['filesize']<1024*1024*1024) {
|
||||||
|
$files[$k]['filesize']=round($v['filesize']/1024/1024,2).'MB';
|
||||||
|
} else {
|
||||||
|
$files[$k]['filesize']=round($v['filesize']/1024/1024/1024,2).'GB';
|
||||||
|
}
|
||||||
|
$files[$k]['ts_created'] = date("Y-m-d H:i",strtotime($v['ts_created']));
|
||||||
|
}
|
||||||
|
|
||||||
$this->getResponse()->setHeader('Content-Type', 'application/json')->appendBody(json_encode($files,JSON_NUMERIC_CHECK));
|
$this->getResponse()->setHeader('Content-Type', 'application/json')->appendBody(json_encode($files,JSON_NUMERIC_CHECK));
|
||||||
return true;
|
return true;
|
||||||
|
@ -883,13 +898,29 @@ class ServiceController extends Zend_Controller_Action
|
||||||
$subpath=(int)$this->_request->getParam('subpath');
|
$subpath=(int)$this->_request->getParam('subpath');
|
||||||
$depth=(int)$this->_request->getParam('depth');
|
$depth=(int)$this->_request->getParam('depth');
|
||||||
$depth++;
|
$depth++;
|
||||||
$sql="select f.* from datafile f,dataset s where s.id=f.dsid and s.uuid=? and f.depth=".$depth." and f.filename<>'/uuid.txt' and f.filename ilike (select filename from datafile where id=".$subpath.")||'%' order by f.isdir desc,f.filename";
|
$sql="select f.*,s.uuid from datafile f,dataset s where s.id=f.dsid and s.uuid=? and f.depth=".$depth." and f.filename<>'/uuid.txt' and f.filename ilike (select filename from datafile where id=".$subpath.")||'%' order by f.isdir desc,f.filename";
|
||||||
$files=$this->db->fetchAll($this->db->quoteInto($sql,$uuid));
|
$files=$this->db->fetchAll($this->db->quoteInto($sql,$uuid));
|
||||||
|
|
||||||
foreach($files as $k=>$v)
|
foreach($files as $k=>$v)
|
||||||
{
|
{
|
||||||
$files[$k]['ts_created'] = date("Y-m-d H:i",strtotime($v['ts_created']));
|
$files[$k]['ts_created'] = date("Y-m-d H:i",strtotime($v['ts_created']));
|
||||||
$files[$k]['filesize'] = round($v['filesize']/1024,2) ."MB";
|
if ($v['filesize']<1024)
|
||||||
|
{
|
||||||
|
$files[$k]['filesize']=$v['filesize'].'Byte';
|
||||||
|
} elseif($v['filesize']<1024*1024) {
|
||||||
|
$files[$k]['filesize']=round($v['filesize']/1024,2).'KB';
|
||||||
|
} elseif($v['filesize']<1024*1024*1024) {
|
||||||
|
$files[$k]['filesize']=round($v['filesize']/1024/1024,2).'MB';
|
||||||
|
} else {
|
||||||
|
$files[$k]['filesize']=round($v['filesize']/1024/1024/1024,2).'GB';
|
||||||
|
}
|
||||||
|
if ($v['isdir']==1)
|
||||||
|
{
|
||||||
|
$files[$k]['filename']=substr(strrchr(substr($v['filename'],0,-1),'/'),1).'/';}
|
||||||
|
else{
|
||||||
|
$files[$k]['filename']=substr(strrchr($v['filename'],'/'),1);
|
||||||
|
}
|
||||||
|
|
||||||
$files[$k]['ext'] = "";
|
$files[$k]['ext'] = "";
|
||||||
$temp_arr = explode(".", $v['filename']);
|
$temp_arr = explode(".", $v['filename']);
|
||||||
if($temp_arr)
|
if($temp_arr)
|
||||||
|
|
|
@ -14,7 +14,10 @@
|
||||||
$this->nav[] = array('link'=>"/hiwater",'title'=>'黑河生态水文遥感试验');
|
$this->nav[] = array('link'=>"/hiwater",'title'=>'黑河生态水文遥感试验');
|
||||||
?>
|
?>
|
||||||
<style>
|
<style>
|
||||||
h3.gs_rt{font-size:110%;}
|
h3.gs_rt{font-size:110%;}
|
||||||
|
#file-list li:hover {background-color: #f5f5f5;}
|
||||||
|
#file-list li li:hover {background-color: #dedede;}
|
||||||
|
#file-list li li li:hover {background-color: #eeeeee;}
|
||||||
</style>
|
</style>
|
||||||
<?= $this->render('breadcrumbs.phtml'); ?>
|
<?= $this->render('breadcrumbs.phtml'); ?>
|
||||||
<?php $md=$this->metadata;if ($md):?>
|
<?php $md=$this->metadata;if ($md):?>
|
||||||
|
@ -299,7 +302,7 @@ endforeach;
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<hr />
|
<hr />
|
||||||
<h4>数据细节<a class="btn pull-right" href="javascript:void(0);" id="show-list" onclick="getFileList()" title=""><i class="icon-file"></i>文件列表</a></h4>
|
<h4>数据细节<a class="btn pull-right" href="javascript:void(0);" id="show-list" rel="<?= $md->uuid ?>"><i class="icon-file"></i>文件列表</a></h4>
|
||||||
<ul class="inline unstyled well">
|
<ul class="inline unstyled well">
|
||||||
<?php if ($md->fileformat) : ?>
|
<?php if ($md->fileformat) : ?>
|
||||||
<li><strong>格式:</strong><?php echo $md->fileformat; ?></li>
|
<li><strong>格式:</strong><?php echo $md->fileformat; ?></li>
|
||||||
|
@ -457,7 +460,10 @@ $(function() {
|
||||||
{
|
{
|
||||||
googleSearch('<?php echo $ev;?>');
|
googleSearch('<?php echo $ev;?>');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
$('#show-list').click(function(e) {
|
||||||
|
method.filelist.get($(this).attr('rel'));
|
||||||
|
});
|
||||||
});
|
});
|
||||||
//ajax literature
|
//ajax literature
|
||||||
function literature(page){
|
function literature(page){
|
||||||
|
@ -474,10 +480,6 @@ function recommend(page){
|
||||||
recommend_get(page,'<?= $md->uuid; ?>');
|
recommend_get(page,'<?= $md->uuid; ?>');
|
||||||
}
|
}
|
||||||
|
|
||||||
function getFileList(){
|
|
||||||
getFileList_h('<?php echo $md->uuid;?>');
|
|
||||||
}
|
|
||||||
|
|
||||||
function ajaxpage(page){
|
function ajaxpage(page){
|
||||||
ajaxpage_get(page,'<?= $md->uuid; ?>');
|
ajaxpage_get(page,'<?= $md->uuid; ?>');
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,16 +45,6 @@ if ($md->title_en) echo '<br />'.$this->escape($md->title_en);?>
|
||||||
?> (下载引用:<a href="/service/ris/lang/cn/uuid/<?php echo $md->uuid; ?>">RIS格式</a> | <a href="/service/ris/lang/en/uuid/<?php echo $md->uuid; ?>">RIS英文格式</a> | <a href="/service/bibtex/lang/cn/uuid/<?php echo $md->uuid; ?>">Bibtex格式</a> | <a href="/service/bibtex/lang/en/uuid/<?php echo $md->uuid; ?>">Bibtex英文格式</a>)</p>
|
?> (下载引用:<a href="/service/ris/lang/cn/uuid/<?php echo $md->uuid; ?>">RIS格式</a> | <a href="/service/ris/lang/en/uuid/<?php echo $md->uuid; ?>">RIS英文格式</a> | <a href="/service/bibtex/lang/cn/uuid/<?php echo $md->uuid; ?>">Bibtex格式</a> | <a href="/service/bibtex/lang/en/uuid/<?php echo $md->uuid; ?>">Bibtex英文格式</a>)</p>
|
||||||
<?php endif; endif; if ($this->ref) : ?>
|
<?php endif; endif; if ($this->ref) : ?>
|
||||||
<hr />
|
<hr />
|
||||||
<h4><i class="icon-quote-left muted"></i>本数据引用方式<a class="btn btn-danger pull-right" href="/archives/help/dataplatformhelp/archive-23.html" ><i class="icon-comment"></i>数据引用帮助</a></h4>
|
|
||||||
<p><?php if (empty($md->datadoi) || !strpos($md->citation,$md->datadoi)) : ?><span class="label label-info">文章的引用</span>
|
|
||||||
<?php endif; echo $this->escape($md->citation);?></p>
|
|
||||||
<?php if (!empty($md->datadoi) && !strpos($md->citation,$md->datadoi)) : ?>
|
|
||||||
<p><span class="label label-info">数据的引用</span><?php
|
|
||||||
echo substr($md->authors,1,-1).'. '.$md->title.'. '.$md->publisher.', '.$md->publish_year.'. doi:'.$md->doi;
|
|
||||||
echo ' ['.substr($md->author_en,1,-1).'. '.$md->title_en.'. '.$md->publisher_en.', '.$md->publish_year.'. doi:'.$md->doi.']';
|
|
||||||
?> (下载引用:<a href="/service/ris/lang/cn/uuid/<?php echo $md->uuid; ?>">RIS格式</a> | <a href="/service/ris/lang/en/uuid/<?php echo $md->uuid; ?>">RIS英文格式</a> | <a href="/service/bibtex/lang/cn/uuid/<?php echo $md->uuid; ?>">Bibtex格式</a> | <a href="/service/bibtex/lang/en/uuid/<?php echo $md->uuid; ?>">Bibtex英文格式</a>)</p>
|
|
||||||
<?php endif; endif; if ($this->ref) : ?>
|
|
||||||
<hr />
|
|
||||||
<h4><i class="icon-eye-open text-success"></i>建议参考文献</h4>
|
<h4><i class="icon-eye-open text-success"></i>建议参考文献</h4>
|
||||||
<ol>
|
<ol>
|
||||||
<?php foreach($this->ref as $ref) :
|
<?php foreach($this->ref as $ref) :
|
||||||
|
|
Loading…
Reference in New Issue