]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-13101
authornicolasconnault <nicolasconnault>
Thu, 24 Jan 2008 08:40:36 +0000 (08:40 +0000)
committernicolasconnault <nicolasconnault>
Thu, 24 Jan 2008 08:40:36 +0000 (08:40 +0000)
1. Showing full path
2. Showing plugins to be installed
3. Lang strings properly used
4. Table headers

lang/en_utf8/moodle.php
lib/adminlib.php

index 8a20d7d1690c74ca175e11cf72d60bc17bc4d59b..57057d8b12ef52119e33f963f14ee91d0ca00ecc 100644 (file)
@@ -2,6 +2,7 @@
       // moodle.php - created with Moodle 1.7 beta + (2006101003)
 
 
+$string['abouttobeinstalled'] = 'about to be installed';
 $string['action'] = 'Action';
 $string['actions'] = 'Actions';
 $string['active'] = 'Active';
@@ -385,6 +386,7 @@ $string['description'] = 'Description';
 $string['deselectall'] = 'Deselect all';
 $string['detailedless'] = 'Less detailed';
 $string['detailedmore'] = 'More detailed';
+$string['directory'] = 'Directory';
 $string['directorypaths'] = 'Directory Paths';
 $string['disable'] = 'Disable';
 $string['displayingfirst'] = 'Only the first $a->count $a->things are displayed';
index a88641aff4ca7fe29ea85760269c311cc787a902..d696bc153d8ed94ab126a0d479d3afaf05b22e4d 100644 (file)
@@ -4558,7 +4558,7 @@ function db_replace($search, $replace) {
  */
 function print_plugin_tables() {
     $compatlist = array();
-    $compatlist['mods'] = array('assignment',
+    $compatlist['mod'] = array('assignment',
                                 'chat',
                                 'choice',
                                 'data',
@@ -4587,7 +4587,6 @@ function print_plugin_tables() {
                                   'calendar_upcoming',
                                   'course_list',
                                   'course_summary',
-                                  'db',
                                   'glossary_random',
                                   'html',
                                   'loancalc',
@@ -4610,7 +4609,7 @@ function print_plugin_tables() {
                                   'tag_youtube',
                                   'tags');
     
-    $compatlist['filters'] = array('activitynames',
+    $compatlist['filter'] = array('activitynames',
                                    'algebra',
                                    'censor',
                                    'emailprotect',
@@ -4620,11 +4619,22 @@ function print_plugin_tables() {
                                    'tex',
                                    'tidy');
 
+    $installed_list = array();
+    $installed_mods = get_records_list('modules', '', '', '', 'name');
+    $installed_blocks = get_records_list('block', '', '', '', 'name');
+
+    foreach($installed_mods as $mod) {
+        $installed_list['mod'][] = $mod->name;
+    }
+
+    foreach($installed_blocks as $block) {
+        $installed_list['blocks'][] = $block->name;
+    }
     
     $plugins = array();
-    $plugins['mods'] = get_list_of_plugins();
-    $plugins['blocks'] = get_list_of_plugins('blocks');
-    $plugins['filters'] = get_list_of_plugins('filter');
+    $plugins['mod'] = get_list_of_plugins('mod', 'db');
+    $plugins['blocks'] = get_list_of_plugins('blocks', 'db');
+    $plugins['filter'] = get_list_of_plugins('filter', 'db');
     
     $strstandard    = get_string('standard');
     $strnonstandard = get_string('nonstandard');
@@ -4632,9 +4642,21 @@ function print_plugin_tables() {
     $html = '';
 
     foreach ($plugins as $cat => $list) {
+        $strcaption = get_string($cat);
+        if ($cat == 'mod') {
+            $strcaption = get_string('activitymodule');
+        } elseif ($cat == 'filter') {
+            $strcaption = get_string('managefilters');
+        }
+
         $html .= '<table class="plugincompattable generaltable boxaligncenter" cellspacing="1" cellpadding="5" '
-              . 'id="' . $cat . 'compattable" summary="compatibility table"><caption>' . ucfirst($cat) . '</caption>' . "\n";
-        $row = 0;      
+              . 'id="' . $cat . 'compattable" summary="compatibility table"><caption>' . $strcaption . '</caption>' . "\n";
+        $html .= '<tr class="r0"><th class="header c0">' . get_string('directory') . "</th>\n"
+               . '<th class="header c1">' . get_string('name') . "</th>\n"
+               . '<th class="header c2">' . get_string('status') . "</th>\n";
+        
+        $row = 1;      
+
         foreach ($list as $k => $plugin) {
             $standard = 'standard';
 
@@ -4642,7 +4664,41 @@ function print_plugin_tables() {
                 $standard = 'nonstandard';
             }    
 
-            $html .= "<tr class=\"r$row\"><td class=\"cell c0\">" . ucfirst($plugin) . "</td><td class=\"$standard cell c1\">" . ${'str' . $standard} . "</td></tr>\n";
+            // Get real name and full path of plugin
+            $plugin_name = "[[$plugin]]";
+            
+            global $CFG;
+            $plugin_path = $CFG->dirroot . "/$cat/$plugin";
+
+            if ($cat == 'mod') {
+                $plugin_name = get_string('modulename', $plugin);
+            } elseif ($cat == 'blocks') {
+                $plugin_name = get_string('blockname', "block_$plugin");
+                if (empty($plugin_name) || $plugin_name == '[[blockname]]') {
+                    if (($block = block_instance($plugin)) !== false) {
+                        $plugin_name = $block->get_title();
+                    } else {
+                        $plugin_name = "[[$plugin]]";
+                    }
+                }
+            } elseif ($cat == 'filter') {
+                $plugin_name = trim(get_string('filtername', $plugin));
+                if (empty($plugin_name) or ($plugin_name == '[[filtername]]')) {
+                    $textlib = textlib_get_instance();
+                    $plugin_name = $textlib->strtotitle($plugin);
+                } 
+            }
+            
+            // Determine if the plugin is about to be installed
+            $strabouttobeinstalled = '';
+            if ($cat != 'filter' && !in_array($plugin, $installed_list[$cat])) {
+                $strabouttobeinstalled = ' (' . get_string('abouttobeinstalled') . ')';
+            }
+
+            $html .= "<tr class=\"r$row\">\n"
+                  .  "<td class=\"cell c0\">$plugin_path</td>\n"
+                  .  "<td class=\"cell c1\">$plugin_name</td>\n"
+                  .  "<td class=\"$standard cell c2\">" . ${'str' . $standard} . $strabouttobeinstalled . "</td>\n</tr>\n";
             $row++;
         } 
         $html .= '</table><br />';