Fix the javascript error that occurs when no content folder in the course but the...
authorcindy li <cli@ocad.ca>
Thu, 11 Nov 2010 20:05:56 +0000 (20:05 -0000)
committercindy li <cli@ocad.ca>
Thu, 11 Nov 2010 20:05:56 +0000 (20:05 -0000)
docs/include/classes/ContentManager.class.php

index 9c70bd7..30423e5 100644 (file)
@@ -836,10 +836,12 @@ function initContentMenu() {
                                 ORDER BY ordering 
                                 LIMIT 1";
                        $result = mysql_query($sql, $this->db);
-                       $row = mysql_fetch_assoc($result);
                        
                        // print out javascript to expand the first content folder
-                       echo $this->get_js_expand_folder($row['content_id']);
+                       if (mysql_num_rows($result)) {
+                               $row = mysql_fetch_assoc($result);
+                               echo $this->get_js_expand_folder($row['content_id']);
+                       }
                }
                echo '}'; // end of javascript function initContentMenu()
        }