调整了ajax读取元数据评审意见附件的动作位置,增加了图片类型文件的缩略图预览。

This commit is contained in:
Li Jianxuan 2011-11-25 09:10:20 +00:00
parent 8b3da22dfb
commit 53c323d1ca
2 changed files with 45 additions and 1 deletions

View File

@ -642,6 +642,50 @@ class ServiceController extends Zend_Controller_Action
} }
} }
function getattsAction(){
$this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender();
$id = $this->_request->getParam('id');
if($id!='')
{
$auth = Zend_Auth::getInstance();
if($auth->hasIdentity())
{
$user = $auth->getIdentity();
$userid = $user->id;
$sql = "select att.realname,att.id,att.filename from attachments att
left join mdreviewattach ratt on att.id=ratt.attachid
where ratt.reviewid=$id and att.userid=$userid";
$rs = $this->db->query($sql);
$atts = $rs->fetchAll();
include_once('files.php');
foreach($atts as $k=>$v)
{
$imgct = files::getImageType($this->config->upload.$v['filename']);
if(!isset($imgct['error'])) $preview = '<img src="/service/attpreview/id/'.$v['id'].'" style="display:block;" />';
else $preview = "";
$atts[$k]['html']= $preview.$v['realname'].'[已完成]<input type="hidden" name="atts[]" value="'.$v['id'].'" /><div class="cancel"><a href="javascript:;" id="deletebtn_'.$v['id'].'"><img border="0" src="/static/js/uploadify/cancel.png" /></a></div>';
}
echo Zend_Json::encode($atts);
exit();
}else
{
exit();
}
}else{
exit();
}
//不输出错误
}//获取附件
function filelistAction() function filelistAction()
{ {
$uuid=$this->_request->getParam('uuid'); $uuid=$this->_request->getParam('uuid');

View File

@ -259,7 +259,7 @@ $(document).ready(function() {
}); });
} }
$.getJSON("/upload/getatts/id/<?php echo $this->review['id'];?>", function(data) { $.getJSON("/service/getatts/id/<?php echo $this->review['id'];?>", function(data) {
if(data) if(data)
{ {
$.each(data, function(key, val) { $.each(data, function(key, val) {