Merge branch 'MDL-46215-master-fixes' of git://github.com/andrewnicols/moodle

This commit is contained in:
Marina Glancy 2014-10-28 15:37:05 +08:00
commit 45b7a397bb
6 changed files with 11 additions and 5 deletions

View File

@ -3791,6 +3791,7 @@ function forum_get_discussion_subscription_icon($forum, $discussionid, $returnur
'class' => 'discussiontoggle iconsmall',
'data-forumid' => $forum->id,
'data-discussionid' => $discussionid,
'data-includetext' => $includetext,
));
} else {
$o .= html_writer::link($subscriptionlink,
@ -3800,6 +3801,7 @@ function forum_get_discussion_subscription_icon($forum, $discussionid, $returnur
'class' => 'discussiontoggle iconsmall',
'data-forumid' => $forum->id,
'data-discussionid' => $discussionid,
'data-includetext' => $includetext,
));
}

View File

@ -29,6 +29,7 @@ require_once($CFG->dirroot . '/mod/forum/lib.php');
$forumid = required_param('forumid', PARAM_INT); // The forum to subscribe or unsubscribe.
$discussionid = optional_param('discussionid', null, PARAM_INT); // The discussionid to subscribe.
$sesskey = optional_param('sesskey', null, PARAM_RAW);
$includetext = optional_param('includetext', false, PARAM_BOOL);
$forum = $DB->get_record('forum', array('id' => $forumid), '*', MUST_EXIST);
$course = $DB->get_record('course', array('id' => $forum->course), '*', MUST_EXIST);
@ -56,6 +57,6 @@ if (\mod_forum\subscriptions::is_subscribed($USER->id, $forum, $discussion->id,
}
// Now return the updated subscription icon.
$return->icon = forum_get_discussion_subscription_icon($forum, $discussion->id, null, true);
$return->icon = forum_get_discussion_subscription_icon($forum, $discussion->id, null, $includetext);
echo json_encode($return);
die;

View File

@ -48,7 +48,8 @@ Y.extend(SubscriptionToggle, Y.Base, {
data: {
sesskey: M.cfg.sesskey,
forumid: clickedLink.getData('forumid'),
discussionid: clickedLink.getData('discussionid')
discussionid: clickedLink.getData('discussionid'),
includetext: clickedLink.getData('includetext')
},
context: this,
'arguments': {

View File

@ -1 +1 @@
YUI.add("moodle-mod_forum-subscriptiontoggle",function(e,t){function n(){n.superclass.constructor.apply(this,arguments)}var r="moodle-mod_forum-subscriptiontoggle";e.extend(n,e.Base,{initializer:function(){e.delegate("click",this._toggleSubscription,e.config.doc.body,".discussionsubscription .discussiontoggle",this)},_toggleSubscription:function(t){var n=t.currentTarget;e.io(this.get("uri"),{data:{sesskey:M.cfg.sesskey,forumid:n.getData("forumid"),discussionid:n.getData("discussionid")},context:this,arguments:{clickedLink:n},on:{complete:this._handleCompletion}}),t.preventDefault()},_handleCompletion:function(t,n,r){var i;try{i=e.JSON.parse(n.response);if(i.error)return e.use("moodle-core-notification-ajaxexception",function(){return new M.core.ajaxException(i)}),this}catch(s){return e.use("moodle-core-notification-exception",function(){return new M.core.exception(s)}),this}if(!i.icon)return;var o=r.clickedLink.ancestor(".discussionsubscription");o&&o.set("innerHTML",i.icon)}},{NAME:"subscriptionToggle",ATTRS:{uri:{value:M.cfg.wwwroot+"/mod/forum/subscribe_ajax.php"}}});var i=e.namespace("M.mod_forum.subscriptiontoggle");i.init=function(e){return new n(e)}},"@VERSION@",{requires:["base-base","io-base"]});
YUI.add("moodle-mod_forum-subscriptiontoggle",function(e,t){function n(){n.superclass.constructor.apply(this,arguments)}var r="moodle-mod_forum-subscriptiontoggle";e.extend(n,e.Base,{initializer:function(){e.delegate("click",this._toggleSubscription,e.config.doc.body,".discussionsubscription .discussiontoggle",this)},_toggleSubscription:function(t){var n=t.currentTarget;e.io(this.get("uri"),{data:{sesskey:M.cfg.sesskey,forumid:n.getData("forumid"),discussionid:n.getData("discussionid"),includetext:n.getData("includetext")},context:this,arguments:{clickedLink:n},on:{complete:this._handleCompletion}}),t.preventDefault()},_handleCompletion:function(t,n,r){var i;try{i=e.JSON.parse(n.response);if(i.error)return e.use("moodle-core-notification-ajaxexception",function(){return new M.core.ajaxException(i)}),this}catch(s){return e.use("moodle-core-notification-exception",function(){return new M.core.exception(s)}),this}if(!i.icon)return;var o=r.clickedLink.ancestor(".discussionsubscription");o&&o.set("innerHTML",i.icon)}},{NAME:"subscriptionToggle",ATTRS:{uri:{value:M.cfg.wwwroot+"/mod/forum/subscribe_ajax.php"}}});var i=e.namespace("M.mod_forum.subscriptiontoggle");i.init=function(e){return new n(e)}},"@VERSION@",{requires:["base-base","io-base"]});

View File

@ -48,7 +48,8 @@ Y.extend(SubscriptionToggle, Y.Base, {
data: {
sesskey: M.cfg.sesskey,
forumid: clickedLink.getData('forumid'),
discussionid: clickedLink.getData('discussionid')
discussionid: clickedLink.getData('discussionid'),
includetext: clickedLink.getData('includetext')
},
context: this,
'arguments': {

View File

@ -46,7 +46,8 @@ Y.extend(SubscriptionToggle, Y.Base, {
data: {
sesskey: M.cfg.sesskey,
forumid: clickedLink.getData('forumid'),
discussionid: clickedLink.getData('discussionid')
discussionid: clickedLink.getData('discussionid'),
includetext: clickedLink.getData('includetext')
},
context: this,
'arguments': {