增加了ajax查看评审意见的功能

修改了发布评审意见的动作
修改了视图
This commit is contained in:
Li Jianxuan 2011-10-17 08:10:25 +00:00
parent 1bcb649da0
commit e350283132
2 changed files with 83 additions and 13 deletions

View File

@ -271,6 +271,16 @@ class ReviewController extends Zend_Controller_Action
$uuid = $this->_request->getParam('uuid');
$sql=$this->db->quoteInto("select m.id,m.uuid,m.title,m.description,m.title_en from metadata m where m.uuid=?",$uuid);
$this->view->metadata=$this->db->fetchRow($sql);
$auth = Zend_Auth::getInstance();
if($auth->hasIdentity())
{
$user = $auth->getIdentity();
$userid = $user->id;
$sql = "select id from mdreview where userid='$userid' and uuid='$uuid'";
$rs = $this->db->query($sql);
$row = $rs->fetch();
$this->view->pms = $row['id'];
}
$submit = $this->_request->getParam('submit');
@ -288,7 +298,7 @@ class ReviewController extends Zend_Controller_Action
{
$user = $auth->getIdentity();
$userid = $user->id;
$sql = "select id,userid from mdreview where userid='$userid'";
$sql = "select id,userid from mdreview where userid='$userid' and uuid='$uuid'";
$rs = $this->db->query($sql);
$row = $rs->fetch();
if($row['id']!='')
@ -319,7 +329,7 @@ class ReviewController extends Zend_Controller_Action
if(!empty($_FILES['Filedata']['name']))
{
$files=new files();
$msg = $files -> upload(Zend_Registry::get('upload'),$_FILES['Filedata'],$_POST['dir']);
$msg = $files -> upload(Zend_Registry::get('upload'),$_FILES['Filedata'],'reviewatt');
if(empty($msg['error']))
{
@ -328,7 +338,7 @@ class ReviewController extends Zend_Controller_Action
$filedesc = $this->_request->getParam('filedesc');
$filetype = $this->_request->getParam('dir');
$sql = "insert into attachments (filename,filetype,filedesc,userid,filesize) values ('$filename','$filetype','$filedesc','$userid','$filesize') RETURNING id";
$sql = "insert into attachments (filename,filetype,filedesc,userid,filesize) values ('$filename','reviewatt','$filedesc','$userid','$filesize') RETURNING id";
$sth = $this->db->prepare($sql);
$sth->execute();
$att = $sth->fetch(PDO::FETCH_ASSOC);
@ -394,11 +404,47 @@ class ReviewController extends Zend_Controller_Action
$this->_redirect($redirectlink);
}
}
}//reviewAction()
function allreviewAction(){
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender();
$uuid = $this->_request->getParam('uuid');
$sql = "select r.uuid,r.userid,r.ts_created,u.realname,r.mdcomment,r.conclusion from mdreview r
left join users u on u.id=r.userid
where r.uuid='$uuid'";
$rs = $this->db->query($sql);
$rows = $rs->fetchAll();
$paginator = Zend_Paginator::factory($rows);
$paginator->setCurrentPageNumber($this->_getParam('page'));
$paginator->setItemCountPerPage(5);
$paginator->setView($this->view);
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
$list = "";
foreach($rows as $k=>$v)
{
$list.='
<li>
<div class="reviewitem">
<div class="itemtitle">评审人:'.$v['realname'].'</div><div class="itemtime">评审时间:'.date("Y-m-d H:i",strtotime($v['ts_created'])).'</div>
<p>'.str_replace(array("\r\n", "\n", "\r"),'</p><p>',$v['mdcomment']).'</p>
</div>
</li>
';
}
$stringbuffer = "<ul class='reviewlist'>$list</ul>";
echo $stringbuffer.'<div class="paginator">'.$paginator.'</div>';
}
}

View File

@ -3,7 +3,6 @@
$this->headTitle($this->config->title->review);
$this->headTitle('数据查看');
$this->headTitle()->setSeparator(' - ');
$this->headLink()->appendStylesheet('/css/mdview.css');
$this->headLink()->appendStylesheet('/css/mdreview.css');
$this->headScript()->appendFile('/js/jquery-1.6.4.min.js');
$this->breadcrumb('<a href="/">首页</a>');
@ -21,9 +20,9 @@
<?php if ($md['title_en']) echo '<br />'.$this->escape($md['title_en']);?>
</h1>
<div id="left">
<div id="ImageViewer"><img src="/data/thumb/id/<?php echo $md['id'];?>" /> </div>
<div id="abstract">
<p>
<img src="/data/thumb/id/<?php echo $md['id'];?>" class="thumb" />
<?php echo str_replace(array("\r\n", "\n", "\r"),'</p><p>',$md['description']);?>
</p>
</div>
@ -34,6 +33,8 @@
<div class="form">
<?php
if($auth->hasIdentity())
{
if(empty($this->pms))
{
?>
<form id="postcomment" action="/review/review/uuid/<?php echo $md['uuid'];?>" method="POST" enctype='multipart/form-data'>
@ -59,11 +60,6 @@
</p>
<p>
评审附件:<br/>
<select name="dir" style="width:100px;">
<option value="file">文件</option>
<option value="image">图片</option>
<option value="media">媒体</option>
</select>
<input type="file" name="Filedata" class="half" />
</p>
<p>
@ -71,6 +67,10 @@
</p>
</form>
<?php
}else
{
echo "您已经对此数据作出过评审";
}
} else {
echo '发表评审意见,请先<a href="/account/login/?href=/review/review/uuid/'.$md['uuid'].'">登录</a>';
}
@ -98,6 +98,30 @@
</div>
<script type="text/javascript" language="javascript">
loadmdcomment();
function loadmdcomment(){
var url = "/review/allreview/uuid/<?php echo $md['uuid'];?>";
var data = '';
$.ajax({
type: "POST",
url: url,
data: data,
success: function(html){
$('#allcomments').html(html);
},
beforeSend:function(){
$('#allcomments').html('正在加载...');
},
/*
complete:function(){
$('#submit').val('提交');
$('#submit').removeAttr('disabled');
}*/
});
}
</script>
<?php else: ?>
<p>Cannot find the metadata.</p>
<p>没有找到对应的元数据。</p>