修改了评审页面的样式,表单样式、列表样式、增加了通用容器tbox。增加了ajax保存草稿的动作

This commit is contained in:
Li Jianxuan 2011-10-28 10:00:13 +00:00
parent 18ac03c6d6
commit ae5c70c4a6
2 changed files with 90 additions and 31 deletions

View File

@ -1,6 +1,6 @@
<?php <?php
class ReviewController extends Zend_Controller_Action class ReviewController extends Zend_Controller_Action
{ {
private $limit=10; private $limit=10;
function preDispatch() function preDispatch()
{ {
@ -130,7 +130,9 @@ class ReviewController extends Zend_Controller_Action
$sql=$this->db->quoteInto("select m.id,m.uuid,m.title,m.description,m.title_en,r.status from metadata m $sql=$this->db->quoteInto("select m.id,m.uuid,m.title,m.description,m.title_en,r.status from metadata m
left join mdstatus r on r.uuid=m.uuid left join mdstatus r on r.uuid=m.uuid
where m.uuid=?",$uuid); where m.uuid=?",$uuid);
$this->view->metadata = $md = $this->db->fetchRow($sql); $md = $this->db->fetchRow($sql);
$this->view->metadata = $md;
$auth = Zend_Auth::getInstance(); $auth = Zend_Auth::getInstance();
if($auth->hasIdentity()) if($auth->hasIdentity())
{ {
@ -311,32 +313,46 @@ class ReviewController extends Zend_Controller_Action
'; ';
} }
if(empty($list))
{
$list="<p style='text-align:center'>暂无评审数据</p>";
}
$stringbuffer = "<ul class='reviewlist'>$list</ul>"; $stringbuffer = "<ul class='reviewlist'>$list</ul>";
echo $stringbuffer.'<div class="paginator">'.$paginator.'</div>'; echo $stringbuffer.'<div class="paginator">'.$paginator.'</div>';
}//allreviewAction() }//allreviewAction() 所有评论 ajax
function searchAction() function saveAction(){
{
$key=$this->_request->getParam('q'); $this->_helper->layout->disableLayout();
if (!empty($key)) { $this->_helper->viewRenderer->setNoRender();
$search=new Search($key);
$where=$search->sql_expr(array("m.title","m.description")); echo "保存成功!";
$page=@(int)$this->_request->getParam('page');
if (empty($page)) $page=1; }// saveAction 存草稿 ajax
$offset=$this->limit*($page-1);
$row=$this->db->fetchAll("select count(s.*) from mdstatus s left join normalmetadata m on s.uuid=m.uuid where s.status>0 and ".$where); function searchAction()
$sum=$row[0]['count']; {
$sql="select m.uuid,m.title,m.id,m.description,s.status,g.id as gid,t.filename from mdstatus s left join normalmetadata m on s.uuid=m.uuid left join geonetworkmetadata g on g.uuid=m.uuid left join thumbnail t on t.id=m.id where s.status>0 and ".$where." order by s.ts_created desc,m.title limit ? offset ?"; $key=$this->_request->getParam('q');
$this->view->metadata=$this->db->fetchAll($sql,array($this->limit,$offset)); if (!empty($key)) {
$this->view->page=new Pagination($sum,$page,$this->limit); $search=new Search($key);
$this->view->key=$key; $where=$search->sql_expr(array("m.title","m.description"));
$page=@(int)$this->_request->getParam('page');
if (empty($page)) $page=1;
$offset=$this->limit*($page-1);
$row=$this->db->fetchAll("select count(s.*) from mdstatus s left join normalmetadata m on s.uuid=m.uuid where s.status>0 and ".$where);
$sum=$row[0]['count'];
$sql="select m.uuid,m.title,m.id,m.description,s.status,g.id as gid,t.filename from mdstatus s left join normalmetadata m on s.uuid=m.uuid left join geonetworkmetadata g on g.uuid=m.uuid left join thumbnail t on t.id=m.id where s.status>0 and ".$where." order by s.ts_created desc,m.title limit ? offset ?";
$this->view->metadata=$this->db->fetchAll($sql,array($this->limit,$offset));
$this->view->page=new Pagination($sum,$page,$this->limit);
$this->view->key=$key;
foreach($this->view->metadata as $k=>$v) foreach($this->view->metadata as $k=>$v)
{ {
$this->view->metadata[$k]['statustext']=$this->rewritestatus($v['status']); $this->view->metadata[$k]['statustext']=$this->rewritestatus($v['status']);
} }
} }
} }
} }

View File

@ -5,6 +5,7 @@
$this->headTitle()->setSeparator(' - '); $this->headTitle()->setSeparator(' - ');
$this->headLink()->appendStylesheet('/css/mdreview.css'); $this->headLink()->appendStylesheet('/css/mdreview.css');
$this->headScript()->appendFile('/js/jquery-1.6.4.min.js'); $this->headScript()->appendFile('/js/jquery-1.6.4.min.js');
$this->headScript()->appendFile('/js/pubfunc.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('评审元数据');
@ -29,7 +30,16 @@
<hr /> <hr />
<div id="comments"> <div id="comments">
<h2>数据评审意见</h2> <div class="tbox center slideabletbox" style="margin-top:10px;">
<div class="title"><img src="/images/listtitle.png" />所有评审意见<a href="javascript:void(0)" class="slidebtn"><img src="/images/slideup.png" /></a></div>
<div class="content">
<div id="allcomments"></div>
</div>
</div>
<div class="tbox center slideabletbox" style="margin-top:10px;">
<div class="title" id="commentsFormTitle"><img src="/images/formtitle.png" />发布评审意见<a href="javascript:void(0)" class="slidebtn"><img src="/images/slideup.png" /></a></div>
<div class="content" id="form">
<?php <?php
if($auth->hasIdentity()) if($auth->hasIdentity())
{ {
@ -40,8 +50,6 @@
echo "该数据已经通过评审"; echo "该数据已经通过评审";
}else{ }else{
?> ?>
<a href="javascript:void(0)" onclick="$('.form').slideToggle(1000)">我要发布评审意见</a>
<div class="form" style="display:none;">
<form id="postcomment" action="/review/review/uuid/<?php echo $md['uuid'];?>" method="POST" enctype='multipart/form-data'> <form id="postcomment" action="/review/review/uuid/<?php echo $md['uuid'];?>" method="POST" enctype='multipart/form-data'>
<input type="hidden" name="submit" value="1" /> <input type="hidden" name="submit" value="1" />
<p> <p>
@ -53,28 +61,29 @@
</p> </p>
<p> <p>
元数据意见(必填)<br/> 元数据意见(必填)<br/>
<textarea id="mdcomment" class="medium half" name="mdcomment"><?php echo $this->keyword.$this->mdcomment;?></textarea> <textarea id="mdcomment" class="medium full" name="mdcomment"><?php echo $this->keyword.$this->mdcomment;?></textarea>
</p> </p>
<p> <p>
对数据的意见:<br/> 对数据的意见:<br/>
<textarea id="datacomment" class="small half" name="datacomment"><?php echo $this->datacomment;?></textarea> <textarea id="datacomment" class="small full" name="datacomment"><?php echo $this->datacomment;?></textarea>
</p> </p>
<p> <p>
给数据中心的意见:<br/> 给数据中心的意见:<br/>
<textarea id="editorcomment" class="small half" name="editorcomment"><?php echo $this->editorcomment;?></textarea> <textarea id="editorcomment" class="small full" name="editorcomment"><?php echo $this->editorcomment;?></textarea>
</p> </p>
<p> <p>
评审附件:<br/> 评审附件:<br/>
<input type="file" name="Filedata" class="half" /><br /> <input type="file" name="Filedata" class="half" /><br />
<a href="javascript:void(0);" onclick="$('#showexts').toggle()">查看可上传的附件类型</a> <a href="javascript:void(0);" onclick="$('#showexts').toggle()">查看可上传的附件类型</a>
<div id='showexts' style="display:none;">'doc', 'docx', 'xls', 'xlsx', 'ppt', 'htm', 'html', 'txt', 'zip', 'rar', 'gz', 'bz2','gif', 'jpg', 'jpeg', 'png', 'bmp'</div> <div id='showexts' style="display:none;">'doc', 'docx', 'xls', 'xlsx', 'ppt', 'htm', 'html', 'txt', 'zip', 'rar', 'gz', 'bz2','gif', 'jpg', 'jpeg', 'png', 'bmp', 'pdf'</div>
</p> </p>
<p> <p>
<input id="submit" type="submit" value="提交" class="btn" onclick="return confirm('是否确定提交评审意见?')" /> <button class="btn btn-green" type="submit" onclick="return confirm('是否确定提交评审意见?')">提交</button>
<button class="btn btn-small" type="button" id="save">存草稿</button>
<button class="btn btn-small" type="reset" id="reset" onclick="return confirm('是否确定重置已经填写的意见?')">重置</button>
</p> </p>
</form> </form>
</div> <?php
<?php
} }
}else }else
{ {
@ -85,6 +94,9 @@
} }
?> ?>
</div>
</div>
@ -99,7 +111,8 @@
</div> </div>
<?php endif; ?> <?php endif; ?>
<div id="allcomments"></div>
</div> </div>
@ -109,6 +122,36 @@
loadmdcomment(1); loadmdcomment(1);
function loadmdcomment(page){var url="/review/allreview/uuid/<?php echo $md['uuid'];?>/";if(page!=''){url+='page/'+page;} function loadmdcomment(page){var url="/review/allreview/uuid/<?php echo $md['uuid'];?>/";if(page!=''){url+='page/'+page;}
$.ajax({type:"POST",url:url,data:'',success:function(html){$('#allcomments').html(html);},beforeSend:function(){$('#allcomments').html('<img src="/images/loading.gif" />正在加载...');}});} $.ajax({type:"POST",url:url,data:'',success:function(html){$('#allcomments').html(html);},beforeSend:function(){$('#allcomments').html('<img src="/images/loading.gif" />正在加载...');}});}
$('.slideabletbox .title').click(
function(){
$(this).next(".content").slideToggle(1000,function(){
if($(this).css('display')=='none')
$(this).prev('.title').find(".slidebtn").html('<img src="/images/slidedown.png" />');
else
$(this).prev('.title').find(".slidebtn").html('<img src="/images/slideup.png" />');
;})
});
$('#save').click(function(){
savereview();
});
function savereview(){
var url="/review/save/uuid/<?php echo $md['uuid'];?>/";
var date = $('#postcomment').serialize();
$.ajax({
type:"POST",
url:url,
data:date,
success:function(html){
$('#save').html(html);
setTimeout("$('#save').html('存草稿');$('#save').removeAttr('disabled');",2000)
},
beforeSend:function(){
$('#save').attr('disabled','disabled');
$('#save').html('<img src="/images/11887177066.gif" />正在保存...');
}
});
}
</script> </script>
<?php else: ?> <?php else: ?>