From aca64b7934c361854bed8b85e29ee58cc3c253b0 Mon Sep 17 00:00:00 2001 From: jerome Date: Mon, 8 Sep 2008 09:41:38 +0000 Subject: [PATCH] MDL-15402: fix a bug when try to display list of instances for not added plugin --- repository/lib.php | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/repository/lib.php b/repository/lib.php index c096f1af2d8..53940bb0d5b 100644 --- a/repository/lib.php +++ b/repository/lib.php @@ -24,6 +24,20 @@ // // /////////////////////////////////////////////////////////////////////////// +/** + * About repository/lib.php: + * two main classes: + * 1. repository_type => a repository plugin, You can activate a plugin into + * Moodle. You also can set some general settings/options for this type of repository. + * All instances would share the same options (for example: a API key for the connection + * to the repository) + * 2. repository => an instance of a plugin. You can also call it an access or + * an account. An instance has specific settings (for example: a public url) and a specific + * name. That's this name which is displayed in the file picker. + */ + + + /** * This is the base class of the repository class * @@ -953,7 +967,7 @@ function repository_get_instances($contexts=array(), $userid = null, $onlyvisibl if ($firstcontext) { $sql .=')'; } - + if($onlyvisible == true) { $sql .= ' AND (r.visible = 1)'; } @@ -1369,7 +1383,7 @@ function _client(){ }); var repo_kit_div = new YAHOO.util.Element('repo-kit-$suffix'); repo_kit_div.get('element').innerHTML = ''; - var repo_kit_ccache = new YAHOO.util.Element('repo-kit-ccacle-$suffix'); + var repo_kit_ccache = new YAHOO.util.Element('repo-kit-ccacle-$suffix'); repo_kit_ccache.callback = { success: function(o) { var panel = new YAHOO.util.Element('panel-$suffix'); @@ -2147,8 +2161,7 @@ function repository_display_instances_list($context, $typename = null){ //retrieve list of instances. In administration context we want to display all //instances of a type, even if this type is not visible. In course/user context we //want to display only visible instances, but for every type types. The repository_get_instances() - //third parameter displays only visible type. The fifth parameter is a trick that return - //instances of the $context + systemcontext. + //third parameter displays only visible type. $instances = repository_get_instances(array($context),null,!$admin,$typename); $instancesnumber = count($instances); $alreadyplugins = array(); @@ -2187,7 +2200,7 @@ function repository_display_instances_list($context, $typename = null){ $instancehtml .= '