]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-15402: dimmed text when plugin type is hidden
authorjerome <jerome>
Thu, 4 Sep 2008 03:41:23 +0000 (03:41 +0000)
committerjerome <jerome>
Thu, 4 Sep 2008 03:41:23 +0000 (03:41 +0000)
lang/en_utf8/repository.php
lib/adminlib.php
repository/lib.php

index 52a8bf83117c0d3a4efea8df7c7cac5749e12d01..c124dc8d749cb496c138e735b8341675d81dc37f 100644 (file)
@@ -59,6 +59,6 @@ $string['submit'] = 'Submit';
 $string['sync'] = 'Sync';
 $string['title'] = 'Repository file picker';
 $string['thumbview'] = 'View as icons';
-$string['updown'] = 'Up/Down';
+$string['updown'] = 'Display order';
 $string['upload'] = 'Upload this file';
 $string['uploading'] = 'Uploading...';
index 10bfdbeade0270049548262c3e34055d1f2a2012..098e12241f7d589d776a3a7347277e4153f86c6d 100644 (file)
@@ -5623,6 +5623,14 @@ class admin_setting_managerepository extends admin_setting {
                 $updowncount++;
 
             $table->data[] = array($i->get_readablename(), $updown,$row);
+
+            //display a grey row if the type is defined as not visible
+            if (!$i->get_visible()){
+                $table->rowclass[] = 'dimmed_text';
+            } else{
+                $table->rowclass[] = '';
+            }
+
             if (!in_array($i->get_typename(), $alreadyplugins)) {
                 $alreadyplugins[] = $i->get_typename();
             }
index 35db2fd0204502046081638e1ebaa37eaa71adf7..43e0c6fc70dcef177f1e52cf5b27b461a3c279e8 100644 (file)
@@ -607,7 +607,7 @@ abstract class repository {
             $id = $DB->insert_record('repository_instances', $record);
             $options = array();
             if (call_user_func($classname . '::has_instance_config')) {
-                $configs = call_user_func($classname . '::get_instance_option_names');                
+                $configs = call_user_func($classname . '::get_instance_option_names');
                 foreach ($configs as $config) {
                     $options[$config] = $params[$config];
                 }
@@ -1946,7 +1946,7 @@ final class repository_admin_form extends moodleform {
 
         $mform =& $this->_form;
         $strrequired = get_string('required');
-       
+
         $mform->addElement('hidden', 'edit',  ($this->instance) ? $this->instance->get_typename() : 0);
         $mform->addElement('hidden', 'new',   $this->plugin);
         $mform->addElement('hidden', 'plugin', $this->plugin);
@@ -2006,7 +2006,11 @@ function repository_display_instances_list($context, $admin = false, $typename =
         $stropt = get_string('operation', 'repository');
         $updown = get_string('updown', 'repository');
         $plugins = get_list_of_plugins('repository');
-        $instances = repository_get_instances($context,null,true,$typename);
+        //retrieve list of instances. In administration context we want to display all
+        //instances even if the type is not visible. In course/user context we
+        //want to display only visible instances. The repository_get_instances()
+        //third parameter displays only visible type.
+        $instances = repository_get_instances($context,null,!$admin,$typename);
         $instancesnumber = count($instances);
         $alreadyplugins = array();
         $table = new StdClass;
@@ -2021,6 +2025,14 @@ function repository_display_instances_list($context, $admin = false, $typename =
             //$row .= ' <a href="' . $baseurl . '&amp;type='.$typename.'&amp;hide=' . $i->id . '"><img src="' . $CFG->pixpath . '/t/' . ($i->visible ? 'hide' : 'show') . '.gif" alt="' . get_string($i->visible ? 'hide' : 'show') . '" /></a>' . "\n";
 
             $table->data[] = array($i->name, $type->get_readablename(),$row);
+
+            //display a grey row if the type is defined as not visible
+            if (isset($type) && !$type->get_visible()){
+                $table->rowclass[] = 'dimmed_text';
+            } else{
+                $table->rowclass[] = '';
+            }
+
             if (!in_array($i->name, $alreadyplugins)) {
                 $alreadyplugins[] = $i->name;
             }
@@ -2048,7 +2060,7 @@ function repository_display_instances_list($context, $admin = false, $typename =
         //create a unique type of instance
         else {
             if (repository_static_function($typename, 'has_multiple_instances')){
-                $addable = 1;               
+                $addable = 1;
                 $instancehtml .= '<li><a href="'.$baseurl.'&amp;new='.$typename.'">'.get_string('create', 'repository')
                                   .' "'.get_string('repositoryname', 'repository_'.$typename).'" '
                                   .get_string('instance', 'repository').'</a></li>';