MDL-24657, fixed xhtml in comment

This commit is contained in:
Dongsheng Cai 2010-10-14 03:21:31 +00:00
parent 1b2ecaf3b5
commit 034699d20a
3 changed files with 29 additions and 21 deletions

View File

@ -45,13 +45,13 @@ M.core_comment = {
if (args.autostart) {
this.view(args.page);
}
// hide toggle link
if (args.notoggle) {
Y.one('#comment-link-'+this.client_id).setStyle('display', 'none');
}
// load comments
var handle = Y.one('#comment-link-'+this.client_id);
// hide toggle link
if (handle) {
if (args.notoggle) {
handle.setStyle('display', 'none');
}
handle.on('click', function(e) {
e.preventDefault();
this.view(0);
@ -85,7 +85,9 @@ bodyContent: '<div class="comment-delete-confirm"><a href="#" id="confirmdelete-
container.appendChild(newcomment);
var ids = result.ids;
var linktext = Y.one('#comment-link-text-'+cid);
linktext.set('innerHTML', M.str.moodle.comments + ' ('+obj.count+')');
if (linktext) {
linktext.set('innerHTML', M.str.moodle.comments + ' ('+obj.count+')');
}
for(var i in ids) {
var attributes = {
color: { to: '#06e' },
@ -205,7 +207,7 @@ bodyContent: '<div class="comment-delete-confirm"><a href="#" id="confirmdelete-
params: params,
callback: function(id, ret, args) {
var linktext = Y.one('#comment-link-text-'+scope.client_id);
if (ret.count) {
if (ret.count && linktext) {
linktext.set('innerHTML', M.str.moodle.comments + ' ('+ret.count+')');
}
var container = Y.one('#comment-list-'+scope.client_id);
@ -350,7 +352,9 @@ bodyContent: '<div class="comment-delete-confirm"><a href="#" id="confirmdelete-
this.register_pagination();
}
container.setStyle('display', 'block');
img.set('src', M.util.image_url('t/expanded', 'core'));
if (img) {
img.set('src', M.util.image_url('t/expanded', 'core'));
}
} else {
// hide
container.setStyle('display', 'none');

View File

@ -321,15 +321,21 @@ EOD;
$icon = $OUTPUT->pix_url('t/collapsed');
$html .= <<<EOD
<div class="mdl-left">
<noscript>
<div><a href="{$this->link}">{$strshowcomments}</a></div>
</noscript>
<a class="showcommentsnonjs" href="{$this->link}">{$strshowcomments}</a>
EOD;
if ($this->env != 'block_comments') {
$html .= <<<EOD
<a id="comment-link-{$this->cid}" class="comment-link" href="#">
<img id="comment-img-{$this->cid}" src="$icon" alt="{$this->linktext}" title="{$this->linktext}" />
<span id="comment-link-text-{$this->cid}">{$this->linktext} {$this->count}</span>
</a>
EOD;
}
$html .= <<<EOD
<div id="comment-ctrl-{$this->cid}" class="comment-ctrl">
<ul id="comment-list-{$this->cid}" class="comment-list">
<li class="first"></li>
EOD;
// in comments block, we print comments list right away
if ($this->env == 'block_comments') {
@ -348,19 +354,15 @@ EOD;
$html .= <<<EOD
<div class='comment-area'>
<div class="bd">
<textarea name="content" rows="2" id="dlg-content-{$this->cid}"></textarea>
<textarea name="content" rows="2" cols="20" id="dlg-content-{$this->cid}"></textarea>
</div>
<div class="fd" id="comment-action-{$this->cid}">
<a href="#" id="comment-action-post-{$this->cid}"> {$strsubmit} </a>
EOD;
if ($this->env != 'block_comments') {
$html .= <<<EOD
<span> | </span>
<a href="#" id="comment-action-cancel-{$this->cid}"> {$strcancel} </a>
EOD;
}
$html .= <<<EOD
if ($this->env != 'block_comments') {
$html .= "<span> | </span><a href=\"#\" id=\"comment-action-cancel-{$this->cid}\"> {$strcancel} </a>";
}
$html .= <<<EOD
</div>
</div>
<div class="clearer"></div>
@ -637,7 +639,7 @@ EOD;
$replacements = array();
if (!empty($cmt->delete) && empty($nonjs)) {
$cmt->content = '<div class="comment-delete"><a href="#" id ="comment-delete-'.$this->cid.'-'.$cmt->id.'"><img src="'.$OUTPUT->pix_url('t/delete').'" /></a></div>' . $cmt->content;
$cmt->content = '<div class="comment-delete"><a href="#" id ="comment-delete-'.$this->cid.'-'.$cmt->id.'"><img src="'.$OUTPUT->pix_url('t/delete').'" alt="'.get_string('delete').'" /></a></div>' . $cmt->content;
// add the button
}
$patterns[] = '___picture___';

View File

@ -318,6 +318,7 @@ table.mod_index {width:100%;}
.comment-meta span {color:gray;}
.comment-list {font-size: 11px;overflow:auto;list-style:none;padding:0;margin:0;}
.comment-list li {margin: 2px;margin-bottom:5px;clear:both;}
.comment-list li.first {display:none}
.comment-paging{text-align:center;}
.comment-paging .pageno{padding:2px;}
.comment-paging .curpage{border:1px solid #CCC;}
@ -331,6 +332,7 @@ table.mod_index {width:100%;}
.comment-report-selectall{display:none}
.comment-link {display:none}
.jsenabled .comment-link {display:block}
.jsenabled .showcommentsnonjs{display:none}
.jsenabled .comment-report-selectall{display:inline}
/**
@ -677,4 +679,4 @@ body.tag .managelink {padding: 5px;}
* Fix for broken YUI images in the menunav component
*/
.yui3-skin-sam .yui3-menu-horizontal .yui3-menu-label,
.yui3-skin-sam .yui3-menu-horizontal .yui3-menu-content {background-image:none;}
.yui3-skin-sam .yui3-menu-horizontal .yui3-menu-content {background-image:none;}