修改了入库的文献下载地址,修改了文档查看的bug

This commit is contained in:
Li Jianxuan 2012-05-18 01:45:40 +00:00
parent 7f5b1d86c4
commit 71ab8c65ad
3 changed files with 16 additions and 10 deletions

View File

@ -2561,7 +2561,7 @@ class AuthorController extends Zend_Controller_Action
$att = $sth->fetch(PDO::FETCH_ASSOC); $att = $sth->fetch(PDO::FETCH_ASSOC);
$msg['attid'] = $attid = $att['id']; $msg['attid'] = $attid = $att['id'];
$msg['html'] = $realname.'['. round($filesize/1024,2) .' kb]<input type="hidden" name="url" value="'.$filename.'" /><div class="cancel"><a href="javascript:;" id="deletebtn_'.$attid.'" title="删除该文件"><img border="0" src="/static/js/uploadify/cancel.png" /></a></div>'; $msg['html'] = $realname.'['. round($filesize/1024,2) .' kb]<input type="hidden" name="url" value="/service/attach/id/'.$attid.'" /><div class="cancel"><a href="javascript:;" id="deletebtn_'.$attid.'" title="删除该文件"><img border="0" src="/static/js/uploadify/cancel.png" /></a></div>';
echo Zend_Json::encode($msg); echo Zend_Json::encode($msg);
exit(); exit();
@ -2643,13 +2643,22 @@ class AuthorController extends Zend_Controller_Action
return true; return true;
} }
$sql = "SELECT title FROM metadata WHERE uuid=?";
$sth = $this->db->prepare($sql);
$sth->execute(array($uuid));
$row = $sth->fetch();
$this->view->title = $row['title'];
$sql = "SELECT att.*,md.title,md.uuid FROM mdattach mda $sql = "SELECT att.*,md.title,md.uuid FROM mdattach mda
LEFT JOIN attachments att ON mda.id=att.id LEFT JOIN attachments att ON mda.id=att.id
LEFT JOIN metadata md ON mda.uuid=md.uuid LEFT JOIN metadata md ON mda.uuid=md.uuid
LEFT JOIN users u ON att.userid=u.id"; LEFT JOIN users u ON att.userid=u.id
WHERE md.uuid=?
";
$sth = $this->db->prepare($sql); $sth = $this->db->prepare($sql);
$sth->execute(array()); $sth->execute(array($uuid));
$rows = $sth->fetchAll(); $rows = $sth->fetchAll();
$this->view->info=$rows; $this->view->info=$rows;
@ -2806,7 +2815,7 @@ class AuthorController extends Zend_Controller_Action
$this->_helper->layout->disableLayout(); $this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender(); $this->_helper->viewRenderer->setNoRender();
$this->getResponse()->setHeader('Content-Type', 'application/octet-stream') $this->getResponse()->setHeader('Content-Type', 'application/octet-stream')
->setHeader('Content-Disposition','attachment; filename="'.basename($fullPath).'"') ->setHeader('Content-Disposition','attachment; filename="'.$row['realname'].'"')
->setHeader('Content-Length', $fsize) ->setHeader('Content-Length', $fsize)
->setHeader('Content-Type','application/force-download') ->setHeader('Content-Type','application/force-download')
->setHeader('Content-Type','application/download') ->setHeader('Content-Type','application/download')

View File

@ -30,7 +30,7 @@ if(!empty($this->error))
?> ?>
<div class="pagetitle"> <div class="pagetitle">
<?php echo $this->info[0]['title'] ;?> (共 <?php echo count($this->info);?> 个文档) <?php echo $this->title ;?> (共 <?php echo count($this->info);?> 个文档)
</div> </div>
<div id="datalist"> <div id="datalist">
<?php <?php

View File

@ -324,7 +324,6 @@ if($auth->hasIdentity())
</div> </div>
<div id="window-outter" style="display:none;"> <div id="window-outter" style="display:none;">
<div id="window-inner"> <div id="window-inner">
<div id="window-closer-container">[<a href="#" id="window-closer" onclick="$('#window-outter').hide()">关闭</a>]</div>
<div id="window-content-container"> <div id="window-content-container">
<div id="window-loading"><img src="/images/loading.gif" />加载中...</div> <div id="window-loading"><img src="/images/loading.gif" />加载中...</div>
<ol id="file-list"> <ol id="file-list">
@ -394,9 +393,7 @@ function recommend(page){$.ajax({type:"GET",url:"/service/recommend/uuid/<?= $md
beforeSend:function(){$('#recommend').html('<img src="/images/loading.gif" />加载中');}});} beforeSend:function(){$('#recommend').html('<img src="/images/loading.gif" />加载中');}});}
function getFileList(){ function getFileList(){
var tw = ($(window).width() - $('#window-outter').width())/2; $.colorbox({width:"80%",height:"80%",html:$('#window-outter').html()});
$('#window-outter').css({'right':tw});
$('#window-outter').show();
$.getJSON("/service/filelist/uuid/<?php echo $md->uuid;?>", function(data) { $.getJSON("/service/filelist/uuid/<?php echo $md->uuid;?>", function(data) {
var items = []; var items = [];
if(data.length>0) if(data.length>0)
@ -424,7 +421,7 @@ function getSubFileList(uuid,id,depth){
return false; return false;
} }
$('<div/>', { $('<div/>', {
'style':'max-height:400px; overflow:auto; overflow-x:hidden;', 'style':'',
'id': 'div_'+id, 'id': 'div_'+id,
"html": '<li><img src="/images/loading.gif" />加载中</li>' "html": '<li><img src="/images/loading.gif" />加载中</li>'
}).appendTo('#li_'+id); }).appendTo('#li_'+id);