修改heihe view中的评论为ajax评论

This commit is contained in:
Li Jianxuan 2011-11-24 08:39:58 +00:00
parent 54fb11683b
commit 5ad2a13520
1 changed files with 40 additions and 1 deletions

View File

@ -268,7 +268,43 @@ endforeach;
<h2>数据评论</h2>
<div id="allcomments">
</div>
<?php echo $this->commentForm; ?>
<?php
$auth = Zend_Auth::getInstance();
if($auth->hasIdentity())
{
$user = $auth->getIdentity();
$name = $user->realname;
$email = $user->email;
}else
{
$name = "";
$email = "";
}
?>
<form id="postcommentform">
<p>
<label class="required" style="background:none;">姓名</label>
<input type="text" name="author" value="<?php echo $name;?>" />
</p>
<p>
<label class="required" style="background:none;">EMAIL</label>
<input type="text" name="email" value="<?php echo $email;?>" />
</p>
<p>
<label>WEBSITE</label>
<input type="text" name="url" value="" /> <small>e.g. http://westdc.westgis.ac.cn/</small>
</p>
<p>
<label class="required" style="background:none;">内容</label>
<textarea name="content" class="medium half"></textarea>
</p>
<p>
<label> </label>
<input type="hidden" name="mdtitle" value="<?php echo $md->title;?>" />
<input type="hidden" name="uuid" value="<?php echo $md->uuid;?>" />
<a class="btn btn-green" id="postcomment" href="javascript:;" onclick="postcomment();">提交</a><button type="reset" id="reset" class="btn">重置</button><span id="returninfo"></span>
</p>
</form>
<?php endif; ?>
</div>
<div id="window-outter" style="display:none;">
@ -323,6 +359,9 @@ function todownload(ft)
//ajax comment
function ajaxpage(page){$.ajax({type:"GET",url:"/data/comment/uuid/<?= $md->uuid; ?>",data:'page='+page,success:function(html){$('#allcomments').html(html);},
beforeSend:function(){$('#allcomments').html('<img src="/images/loading.gif" />加载中');}});};ajaxpage(0);
function postcomment(){ $.ajax({'type':"POST",'url':"/data/postcomment",'data':$('#postcommentform').serialize(),
'success':function(html){$('#postcomment').html('提交');setTimeout("$('#postcomment').removeAttr('disabled');",3000); $('#returninfo').html(html);ajaxpage(0);},
'beforeSend':function(){$('#postcomment').attr('disabled','disabled');$('#postcomment').html('<img src="/images/11887177066.gif" />正在提交...'); }});}
//ajax literature
function literature(page){$.ajax({type:"GET",url:"/data/literature/uuid/<?= $md->uuid; ?>",data:'page='+page,success:function(html){$('#literature').html('<ol start="'+ ((page-1)*10+1) +'">'+html+'</ol>');},