添加评审意见发布功能,尚未完成

This commit is contained in:
Li Jianxuan 2011-10-14 10:29:26 +00:00
parent 8f89f79870
commit 8c1738137a
2 changed files with 156 additions and 13 deletions

View File

@ -257,12 +257,90 @@ class ReviewController extends Zend_Controller_Action
else else
{return "";} {return "";}
}//function rewriterstatus }//function rewriterstatus
function reviewAction() { function replace($string){
$uuid = $this->_request->getParam('uuid'); $patterns = array("/\"/i","/\'/i");
$sql=$this->db->quoteInto("select m.id,m.uuid,m.title,m.description,m.title_en from metadata m where m.uuid=?",$uuid); $replacements = array("","");
$this->view->metadata=$this->db->fetchRow($sql); ksort($patterns);
} ksort($replacements);
return preg_replace($patterns, $replacements, $string);
}
function reviewAction() {
$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);
$submit = $this->_request->getParam('submit');
if(!empty($submit)){
$redirectlink='/review/review/uuid/'.$uuid;
$auth = Zend_Auth::getInstance();
if($auth->hasIdentity())
{
$user = $auth->getIdentity();
$userid = $user->id;
}else{
$this->messenger->addMessage('读取用户信息失败,请刷新页面后重试 :(');
$this->_redirect($redirectlink);
}
$conclusion = $this->_request->getParam('conclusion');
$mdcomment = $this->replace(trim($this->_request->getParam('mdcomment')));
$datacomment = $this->replace(trim($this->_request->getParam('datacomment')));
$editorcomment = $this->replace(trim($this->_request->getParam('editorcomment')));
$this->view->conclusion = $_POST['conclusion'];
$this->view->mdcomment = $mdcomment;
$this->view->datacomment = $datacomment;
$this->view->editorcomment = $editorcomment;
if(empty($conclusion))
{
$this->messenger->addMessage('请选择评审意见');
$this->_redirect($redirectlink);
}
if( !is_numeric($conclusion) || !in_array($conclusion,array(-1,1,2,3)) )
{
$this->messenger->addMessage('参数有误,请刷新页面 :(');
$this->_redirect($redirectlink);
}
if(empty($mdcomment) )
{
$this->messenger->addMessage('请填写元数据意见后再发布 :(');
$this->_redirect($redirectlink);
}
if(!empty($_FILES['Filedata']))
{
$files=new files();
$msg = $files -> upload(Zend_Registry::get('upload'),$_FILES['Filedata'],$_POST['dir']);
if(empty($msg['error']))
{
$filename = $msg['db_path'];
$filesize = $msg['file_size'];
$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";
$sth = $this->db->prepare($sql);
$sth->execute();
$temp = $sth->fetch();
}else{
$this->messenger->addMessage('附件上传失败:'.$msg['error']);
@unlink($filename);
$this->_redirect($redirectlink);
}
}
$sql = "";
}
}//reviewAction()
} }

View File

@ -4,17 +4,20 @@
$this->headTitle('数据查看'); $this->headTitle('数据查看');
$this->headTitle()->setSeparator(' - '); $this->headTitle()->setSeparator(' - ');
$this->headLink()->appendStylesheet('/css/mdview.css'); $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>'); $this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/review">'.$this->config->title->review.'</a>'); $this->breadcrumb('<a href="/review">'.$this->config->title->review.'</a>');
$this->breadcrumb('评审元数据'); $this->breadcrumb('评审元数据');
$this->breadcrumb()->setSeparator(' > '); $this->breadcrumb()->setSeparator(' > ');
$auth = Zend_Auth::getInstance();
?> ?>
<?php $md=$this->metadata;if ($md):?> <?php $md=$this->metadata;if ($md):?>
<h1><?php echo $this->escape($md['title']); ?> <h1><?php echo $this->escape($md['title']); ?>
[<a href="/data/<?php echo $md['uuid']; ?>">查看</a> [<a href="/data/<?php echo $md['uuid']; ?>">查看</a>
<a href="/data/xml/uuid/<?php echo $md['uuid'];?>"><img src="/images/xml.gif" alt="查看XML源文件"></a> <a href="/data/xml/uuid/<?php echo $md['uuid'];?>"><img src="/images/xml.gif" alt="查看XML源文件"></a>
<a href="/data/doc/uuid/<?php echo $md['uuid']; ?>"><img src="/images/doc-icon.png" alt="Word doc格式"></a> <a href="/data/doc/uuid/<?php echo $md['uuid']; ?>"><img src="/images/doc-icon.png" alt="Word doc格式"></a>
] ]
<?php if ($md['title_en']) echo '<br />'.$this->escape($md['title_en']);?> <?php if ($md['title_en']) echo '<br />'.$this->escape($md['title_en']);?>
</h1> </h1>
<div id="left"> <div id="left">
@ -28,8 +31,70 @@
<hr /> <hr />
<div id="comments"> <div id="comments">
<h2>数据评审意见</h2> <h2>数据评审意见</h2>
<div id="allcomments"> <div class="form">
</div> <?php
if($auth->hasIdentity())
{
?>
<form method="post" id="postcomment" action="/review/review">
<input type="hidden" name="uuid" value="<?php echo $md['uuid'];?>" />
<input type="hidden" name="submit" value="1" />
<p>
评审意见(必选)<br />
<input type="radio" name="conclusion" value="1" <?php if($this->conclusion == 1) echo 'checked="checked"'; ?> />修改后再审
<input type="radio" name="conclusion" value="2" <?php if($this->conclusion == 2) echo 'checked="checked"'; ?> />修改后发布
<input type="radio" name="conclusion" value="3" <?php if($this->conclusion == 3) echo 'checked="checked"'; ?> />发布
<input type="radio" name="conclusion" value="-1" <?php if($this->conclusion == -1) echo 'checked="checked"'; ?> />退稿
</p>
<p>
元数据意见(必填)<br/>
<textarea id="mdcomment" class="medium half" name="mdcomment"><?php echo $this->mdcomment;?></textarea>
</p>
<p>
对数据的意见:<br/>
<textarea id="datacomment" class="small half" name="datacomment"><?php echo $this->datacomment;?></textarea>
</p>
<p>
给数据中心的意见:<br/>
<textarea id="editorcomment" class="small half" name="editorcomment"><?php echo $this->editorcomment;?></textarea>
</p>
<p>
评审附件:<br/>
<input type="file" name="Filedata" class="half" />
<select name="dir" style="width:100px;float:left;">
<option value="file">文件</option>
<option value="image">图片</option>
<option value="media">媒体</option>
</select>
</p>
<p>
<input id="submit" type="submit" value="提交" class="btn" onclick="return confirm('是否确定提交评审意见?')" />
</p>
</form>
<?php
} else {
echo '发表评审意见,请先<a href="/account/login/?href=/review/review/uuid/'.$md['uuid'].'">登录</a>';
}
?>
</div>
<?php if ($this->msg or $this->messages) :?>
<div id="message">
<?php if ($this->msg) : ?>
<p><?php echo $this->msg; ?></p>
<?php endif; if ($this->messages): foreach($this->messages as $msg): ?>
<p><?php echo $msg; ?></p>
<?php endforeach;endif; ?>
<script></script>
</div>
<?php endif; ?>
<div id="allcomments">
</div>
</div> </div>