"MDL-23917, added component parameter to comment api"
authorDongsheng Cai <unoter@gmail.com>
Wed, 25 Aug 2010 06:24:17 +0000 (06:24 +0000)
committerDongsheng Cai <unoter@gmail.com>
Wed, 25 Aug 2010 06:24:17 +0000 (06:24 +0000)
comment/comment.js
comment/comment_ajax.php
comment/lib.php

index 8d13582..cce6192 100644 (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];
index 022676f..6187af8 100644 (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;
index 58bf4ea..d0d3059 100644 (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;