"MDL-23917, added component parameter to comment api"

This commit is contained in:
Dongsheng Cai 2010-08-25 06:24:17 +00:00
parent e993559256
commit 7ade777c54
3 changed files with 6 additions and 0 deletions

View File

@ -37,6 +37,7 @@ M.core_comment = {
this.client_id = args.client_id;
this.itemid = args.itemid;
this.commentarea = args.commentarea;
this.component = args.component;
this.courseid = args.courseid;
this.contextid = args.contextid;
this.env = args.env;
@ -121,6 +122,7 @@ bodyContent: '<div class="comment-delete-confirm"><a href="#" id="confirmdelete-
params['area'] = this.commentarea;
params['courseid'] = this.courseid;
params['contextid'] = this.contextid;
params['component'] = this.component;
if (args['params']) {
for (i in args['params']) {
params[i] = args['params'][i];

View File

@ -45,6 +45,7 @@ $commentid = optional_param('commentid', -1, PARAM_INT);
$content = optional_param('content', '', PARAM_RAW);
$itemid = optional_param('itemid', '', PARAM_INT);
$page = optional_param('page', 0, PARAM_INT);
$component = optional_param('component', '', PARAM_ALPHAEXT);
echo $OUTPUT->header(); // send headers
@ -57,6 +58,7 @@ if (!empty($client_id)) {
$args->area = $area;
$args->itemid = $itemid;
$args->client_id = $client_id;
$args->component = $component;
$manager = new comment($args);
} else {
die;

View File

@ -221,6 +221,7 @@ EOD;
}
public function set_component($component) {
$this->component = $component;
list($this->plugintype, $this->pluginname) = normalize_component($component);
return null;
}
@ -277,6 +278,7 @@ EOD;
$options->courseid = $this->courseid;
$options->contextid = $this->contextid;
$options->env = $this->env;
$options->component = $this->component;
if ($this->env == 'block_comments') {
$options->notoggle = true;
$options->autostart = true;