添加了评审意见的删除功能

This commit is contained in:
Li Jianxuan 2011-10-19 08:27:24 +00:00
parent 0c03498dec
commit 24ab7b677c
2 changed files with 60 additions and 2 deletions

View File

@ -903,6 +903,60 @@ class Admin_ReviewController extends Zend_Controller_Action
$this->_helper->viewRenderer('commentslist');
}//评审意见列表 or 某条元数据的评审意见列表
else if($ac=='del' && !empty($id))
{
$redirect = "/admin/review/comments/ac/list/";
if(!is_numeric($id))
{
$this->messenger->addMessage('参数不正确,请按正确的步骤进行访问');
$this->_redirect($redirect);
}
$sql = "select r.id,att.filename,ratt.attachid as attid from mdreview r
left join mdreviewattach ratt on ratt.reviewid=r.id
left join attachments att on att.id=ratt.attachid
where r.id='$id'";
$rs = $this->db->query($sql);
$row = $rs->fetch();
if(!empty($row['filename']))
{
//需要删除文件通过Zend_Registry::get('upload')获得上传文件的根目录
$basepath = Zend_Registry::get('upload');
$filepath = $basepath.$row['filename'];
if(unlink($filepath))
{
$sql = "delete from mdreview where id='$id'";
if($this->db->exec($sql)>0)
{
$this->messenger->addMessage('评审意见删除成功!');
$this->_redirect($redirect);
}
}
else
{
$sql = "delete from mdreview where id='$id'";
if($this->db->exec($sql)>0)
{
$this->messenger->addMessage('评审意见删除成功!但附件删除失败,请手动删除文件:'.$row['filename']);
$this->_redirect($redirect);
}
}
}else{
$sql = "delete from mdreview where id='$id'";
if($this->db->exec($sql)>0)
{
$this->messenger->addMessage('评审意见删除成功!');
$this->_redirect($redirect);
}
}
}//删除评审意见 同时删除附件
else
{
try{

View File

@ -49,10 +49,14 @@
<textarea id="editorcomment" class="small half" name="editorcomment" readonly="readonly"><?php echo $this->info['editorcomment'];?></textarea>
</p>
<p>
<label>附件</label><br />
<?php echo $this->info['attid'];?>
<label>附件</label><?php echo $this->info['attid'];?>
</p>
</form>
<form action="/admin/review/comments/">
<input type="hidden" name="ac" value="del" />
<input type="hidden" name="id" value="<?php echo $this->info['id'];?>" />
<input type="submit" class="btn" value="删除" />
</form>
</div>
</div>
<script>$("#list tr").mouseover(function(){$(this).addClass("high")}).mouseout(function(){$(this).removeClass("high")})</script>