? 1012132.patch
? 1016350.patch
? 1017036_0.txt
? 1020388_test.patch
? 1030220.txt
? 1042014.patch
? 1051088.patch
? 1051088.txt
? 1051158.patch
? 1051158.txt
? 1054748.txt
? 1058934.patch
? services_better_debug_watchdog.txt
? services_update_spyc.txt
Index: resources/comment_resource.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/services/resources/comment_resource.inc,v
retrieving revision 1.5
diff -u -p -r1.5 comment_resource.inc
--- resources/comment_resource.inc	13 Feb 2011 08:25:34 -0000	1.5
+++ resources/comment_resource.inc	13 Feb 2011 08:28:56 -0000
@@ -1,5 +1,5 @@
 <?php
-// $Id: comment_resource.inc,v 1.5 2011/02/13 08:25:34 heyrocker Exp $
+// $Id: comment_resource.inc,v 1.3 2010/12/24 17:25:13 ocyrus Exp $
 
 function _comment_resource_definition() {
   if (!module_exists('comment')) {
@@ -87,37 +87,6 @@ function _comment_resource_definition() 
         ),
       ),
       'actions' => array(
-        'loadNodeComments' => array(
-          'file' => array('type' => 'inc', 'module' => 'services', 'name' => 'resources/comment_resource'),
-          'help'   => t('This method returns the number of new comments on a given node since a given timestamp.'),
-          'access callback' => '_comment_resource_node_access',
-          'access arguments' => array('view'),
-          'access arguments append' => TRUE,
-          'callback' => '_comment_resource_load_node_comments',
-          'args'     => array(
-            array(
-              'name'         => 'nid',
-              'type'         => 'int',
-              'description'  => t('The node id to load comments for.'),
-              'source'       => 'data',
-              'optional'     => FALSE,
-            ),
-            array(
-              'name'         => 'count',
-              'type'         => 'int',
-              'description'  => t('Number of comments to load.'),
-              'source'       => 'data',
-              'optional'     => TRUE,
-            ),
-            array(
-              'name'         => 'start',
-              'type'         => 'int',
-              'description'  => t('If count is set to non-zero value, you can pass also non-zero value for start. For example to get comments from 5 to 15, pass count=10 and start=5.'),
-              'source'       => 'data',
-              'optional'     => TRUE,
-            ),
-          ),
-        ),
         'countAll' => array(
           'file' => array('type' => 'inc', 'module' => 'services', 'name' => 'resources/comment_resource'),
           'help'   => t('This method returns the number of comments on a given node.'),
@@ -283,28 +252,6 @@ function _comment_resource_delete($cid) 
 }
 
 /**
- * Returns the comments of a specified node.
- *
- * @param $nid
- *   Unique identifier for the node.
- * @param $count
- *   Number of comments to return.
- * @param $start
- *   Which comment to start with. if present, $start and $count are used together
- *   to create a LIMIT clause for selecting comments. This could be used to do paging.
- * @return
- *   An array of comment objects.
- */
-function _comment_resource_load_node_comments($nid, $count = 0, $start = 0) {
-  $comments = array();
-  $result = db_query_range('SELECT c.cid FROM {comment} c WHERE c.nid = :nid', 0, 10, array(':nid' => $nid));
-  foreach ($result as $record) {
-        $comments[] = comment_load($record->cid);
-  }
-  return $comments;
-}
-
-/**
  * Returns the number of comments on a given node id.
  *
  * @param $nid
Index: resources/node_resource.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/services/resources/node_resource.inc,v
retrieving revision 1.12
diff -u -p -r1.12 node_resource.inc
--- resources/node_resource.inc	13 Feb 2011 08:25:34 -0000	1.12
+++ resources/node_resource.inc	13 Feb 2011 08:28:56 -0000
@@ -131,6 +131,37 @@ function _node_resource_definition() {
             ),
           ),
         ),
+        'comments' => array(
+          'file' => array('type' => 'inc', 'module' => 'services', 'name' => 'resources/node_resource'),
+          'help'   => t('This method returns the number of new comments on a given node.'),
+          'access callback' => 'user_access',
+          'access arguments' => array('access comments'),
+          'access arguments append' => FALSE,
+          'callback' => '_node_resource_load_node_comments',
+          'args'     => array(
+            array(
+              'name'         => 'nid',
+              'type'         => 'int',
+              'description'  => t('The node id to load comments for.'),
+              'source' => array('path' => 0),
+              'optional'     => FALSE,
+            ),
+            array(
+              'name'         => 'count',
+              'type'         => 'int',
+              'description'  => t('Number of comments to load.'),
+              'source' => array('path' => 2),
+              'optional'     => TRUE,
+            ),
+            array(
+              'name'         => 'start',
+              'type'         => 'int',
+              'description'  => t('If count is set to non-zero value, you can pass also non-zero value for start. For example to get comments from 5 to 15, pass count=10 and start=5.'),
+              'source' => array('path' => 3),
+              'optional'     => TRUE,
+            ),
+          ),
+        ),        
       ),
     ),
   );
@@ -405,3 +436,38 @@ function _node_resource_load_node_files(
   return $files;
 }
 
+/**
+ * Returns the comments of a specified node.
+ *
+ * @param $nid
+ *   Unique identifier for the node.
+ * @param $count
+ *   Number of comments to return.
+ * @param $start
+ *   Which comment to start with. If present, $start and $count are used together
+ *   to create a LIMIT clause for selecting comments. This could be used to do paging.
+ * @return
+ *   An array of comment objects.
+ */
+function _node_resource_load_node_comments($nid, $count = 0, $start = 0) {
+  $comments = array();
+
+  $query = db_select('comment', 'c');
+  $query->innerJoin('node', 'n', 'n.nid = c.nid');
+  $query->addTag('node_access');
+  $query->fields('c', array('cid'))
+    ->condition('c.nid', $nid);
+
+  if ($count) {
+    $query->range($start, $count);
+  }
+
+  $result = $query->execute()
+    ->fetchAll();
+
+  foreach ($result as $record) {
+    $comments[] = comment_load($record->cid);
+  }
+
+  return $comments;
+}
