]> git.mjollnir.org Git - moodle.git/commitdiff
New feature to manage installed code modules!
authormoodler <moodler>
Fri, 9 May 2003 17:24:17 +0000 (17:24 +0000)
committermoodler <moodler>
Fri, 9 May 2003 17:24:17 +0000 (17:24 +0000)
You can now hide/show individual activity modules and even delete them completely!

For example, if you hide the "choice" module, then all choice activities
will be hidden throughout the whole site, and "Choice" will not
appear on any "Add..." menu.

Deleting a module is a complete deletion of all data from the database.

If you want to try out the deletion on a real module, I suggest the
pgassignment module, since it will soon be deleted from CVS anyway
(because it's being replaced with workshop).

Look for "Manage modules" on the admin menu.

admin/index.php
admin/modules.php [new file with mode: 0644]
course/lib.php
course/mod.php
lang/en/moodle.php
lib/db/mysql.php
lib/db/postgres7.php
lib/weblib.php
version.php

index 2af34bcb592a9a21dc4c617eef61005ba196662d..98ed066ca5fc50c615936011558fff19b488fb1b 100644 (file)
     if (isadmin()) {
         $table->head  = array (get_string("site"), get_string("courses"), get_string("users"));
                $table->align = array ("CENTER", "CENTER", "CENTER");
-               $table->data[0][0] = "<P><A HREF=\"config.php\">".get_string("configvariables")."</A></P>".
-                         "<P><A HREF=\"site.php\">".get_string("sitesettings")."</A></P>".
-                         "<P><A HREF=\"../course/log.php?id=$site->id\">".get_string("sitelogs")."</A></P>".
-                         "<P><A HREF=\"../theme/index.php\">".get_string("choosetheme")."</A></P>".
-                         "<P><A HREF=\"lang.php\">".get_string("checklanguage")."</A></P>";
+               $table->data[0][0] = "<p><a href=\"config.php\">".get_string("configvariables")."</a></p>".
+                         "<p><a href=\"site.php\">".get_string("sitesettings")."</a></p>".
+                         "<p><a href=\"../course/log.php?id=$site->id\">".get_string("sitelogs")."</a></p>".
+                         "<p><a href=\"../theme/index.php\">".get_string("choosetheme")."</a></p>".
+                         "<p><a href=\"lang.php\">".get_string("checklanguage")."</a></p>".
+                         "<p><a href=\"modules.php\">".get_string("managemodules")."</a></p>";
                if (file_exists("$CFG->dirroot/admin/$CFG->dbtype")) {
-            $table->data[0][0] .= "<P><A HREF=\"$CFG->dbtype/frame.php\">".get_string("managedatabase")."</A></P>";
+            $table->data[0][0] .= "<p><a href=\"$CFG->dbtype/frame.php\">".get_string("managedatabase")."</a></p>";
                }
-               $table->data[0][1] = "<P><A HREF=\"../course/edit.php\">".get_string("addnewcourse")."</A></P>".
-                         "<P><A HREF=\"../course/teacher.php\">".get_string("assignteachers")."</A></P>".
-                         "<P><A HREF=\"../course/delete.php\">".get_string("deletecourse")."</A></P>".
-                         "<P><A HREF=\"../course/categories.php\">".get_string("categories")."</A></P>";
-        if($CFG->auth == "email" || $CFG->auth == "none" || $CFG->auth == "manual"){
-                   $table->data[0][2] = "<P><A HREF=\"user.php?newuser=true\">".get_string("addnewuser")."</A></P>";
+               $table->data[0][1] = "<p><a href=\"../course/edit.php\">".get_string("addnewcourse")."</a></p>".
+                         "<p><a href=\"../course/teacher.php\">".get_string("assignteachers")."</a></p>".
+                         "<p><a href=\"../course/delete.php\">".get_string("deletecourse")."</a></p>".
+                         "<p><a href=\"../course/categories.php\">".get_string("categories")."</a></p>";
+        if ($CFG->auth == "email" || $CFG->auth == "none" || $CFG->auth == "manual") {
+                   $table->data[0][2] = "<p><a href=\"user.php?newuser=true\">".get_string("addnewuser")."</a></p>";
         }    
-        $table->data[0][2] .=  "<P><A HREF=\"user.php\">".get_string("edituser")."</A></P>".
-                         "<P><A HREF=\"admin.php\">".get_string("assignadmins")."</A></P>".
-                         "<P><A HREF=\"creators.php\">".get_string("assigncreators")."</A></P>".
-                         "<P><A HREF=\"auth.php\">".get_string("authentication")."</A></P>";
+        $table->data[0][2] .=  "<p><a href=\"user.php\">".get_string("edituser")."</a></p>".
+                         "<p><a href=\"admin.php\">".get_string("assignadmins")."</a></p>".
+                         "<p><a href=\"creators.php\">".get_string("assigncreators")."</a></p>".
+                         "<p><a href=\"auth.php\">".get_string("authentication")."</a></p>";
     } else { /// user is coursecreator
            $table->head  = array (get_string("courses"));
                $table->align = array ("CENTER");
-               $table->data[0][1] = "<P><A HREF=\"../course/edit.php\">".get_string("addnewcourse")."</A></P>".
-                 "<P><A HREF=\"../course/teacher.php\">".get_string("assignteachers")."</A></P>";
+               $table->data[0][1] = "<p><a href=\"../course/edit.php\">".get_string("addnewcourse")."</a></p>".
+                 "<p><a href=\"../course/teacher.php\">".get_string("assignteachers")."</a></p>";
        }
     
     print_table($table);
-    echo "<BR><DIV align=center>";
+    echo "<br><div align=center>";
     print_single_button("$CFG->wwwroot/doc", NULL, get_string("documentation"));
-    echo "</DIV>";
+    echo "</div>";
 
     print_heading("Moodle $CFG->release ($CFG->version)", "CENTER", 1);
 
diff --git a/admin/modules.php b/admin/modules.php
new file mode 100644 (file)
index 0000000..8ad67de
--- /dev/null
@@ -0,0 +1,182 @@
+<?PHP // $Id$
+      // Allows the admin to create, delete and rename course categories
+
+       require_once("../config.php");
+       require_once("../course/lib.php");
+
+    optional_variable($disable);
+    optional_variable($enable);
+    optional_variable($delete);
+    optional_variable($confirm);
+
+    if (!isadmin()) {
+        error("Only administrators can use this page!");
+    }
+
+    if (!$site = get_site()) {
+        error("Site isn't defined!");
+    }
+
+
+/// Print headings
+
+    $stradministration = get_string("administration");
+    $strmanagemodules = get_string("managemodules");
+    $strdelete = get_string("delete");
+    $strhide = get_string("hide");
+    $strshow = get_string("show");
+    $stractivitymodule = get_string("activitymodule");
+
+       print_header("$site->shortname: $strcategories", "$site->fullname", 
+                 "<a href=\"../$CFG->admin/index.php\">$stradministration</a> -> $strmanagemodules");
+
+    print_heading($strmanagemodules);
+   
+
+/// If data submitted, then process and store.
+
+    if (!empty($hide)) {
+        if (!$module = get_record("modules", "name", $hide)) {
+            error("Module doesn't exist!");
+        }
+        set_field("modules", "visible", "0", "id", $module->id);            // Hide main module
+        set_field("course_modules", "visible", "0", "module", $module->id); // Hide all related activity modules
+    }
+
+    if (!empty($show)) {
+        if (!$module = get_record("modules", "name", $show)) {
+            error("Module doesn't exist!");
+        }
+        set_field("modules", "visible", "1", "id", $module->id);            // Show main module
+        set_field("course_modules", "visible", "1", "module", $module->id); // Show all related activity modules
+    }
+
+    if (!empty($delete)) {
+      
+        $strmodulename = get_string("modulename", "$delete");
+
+        if (empty($confirm)) {
+            notice_yesno(get_string("moduledeleteconfirm", "", $strmodulename), 
+                         "modules.php?delete=$delete&confirm=$delete", 
+                         "modules.php");
+            print_footer();
+            exit;
+
+        } else {  // Delete everything!!
+
+            if ($delete == "forum") {
+                error("You can not delete the forum module!!");
+            }
+
+            if (!$module = get_record("modules", "name", $delete)) {
+                error("Module doesn't exist!");
+            }
+
+            // OK, first delete all the relevant instances from all course sections
+            if ($coursemods = get_records("course_modules", "module", $module->id)) {
+                foreach ($coursemods as $coursemod) {
+                    if (! delete_mod_from_section($coursemod->id, $coursemod->section)) {
+                        notify("Could not delete the $strmodulename with id = $coursemod->id from section $coursemod->section");
+                    }
+                }
+            }
+
+            // Now delete all the course module records
+            if (!delete_records("course_modules", "module", $module->id)) {
+                notify("Error occurred while deleting all $strmodulename records in course_modules table");
+            }
+
+            // Then delete all the logs 
+            if (!delete_records("log", "module", $module->name)) {
+                notify("Error occurred while deleting all $strmodulename records in log table");
+            }
+
+            // And log_display information
+            if (!delete_records("log_display", "module", $module->name)) {
+                notify("Error occurred while deleting all $strmodulename records in log_display table");
+            }
+
+            // And the module entry itself
+            if (!delete_records("modules", "name", $module->name)) {
+                notify("Error occurred while deleting the $strmodulename record from modules table");
+            }
+
+            // Then the tables themselves
+
+            if ($tables = $db->Metatables()) {
+                $prefix = $CFG->prefix.$module->name;
+                foreach ($tables as $table) {
+                    if (strpos($table, $prefix) === 0) {
+                        if (!execute_sql("DROP TABLE $table", false)) {
+                            notify("ERROR: while trying to drop table $table");
+                        }
+                    }
+                }
+            }  
+
+            rebuild_course_cache();  // Because things have changed
+
+
+            $a->module = $strmodulename;
+            $a->directory = "$CFG->dirroot/mod/$delete";
+            notice(get_string("moduledeletefiles", "", $a), "modules.php");
+        }
+    }
+
+/// Get and sort the existing modules
+
+    if (!$modules = get_records("modules")) {
+        error("No modules found!!");        // Should never happen
+    }
+
+    foreach ($modules as $module) {
+        $strmodulename = get_string("modulename", "$module->name");
+        $modulebyname[$strmodulename] = $module;
+    }
+    ksort($modulebyname);
+
+/// Print the table of all modules
+
+    if (empty($THEME->custompix)) {
+        $pixpath = "../pix";
+        $modpixpath = "../mod";
+    } else {
+        $pixpath = "../theme/$CFG->theme/pix";
+        $modpixpath = "../theme/$CFG->theme/pix/mod";
+    }
+
+    $table->head  = array ($stractivitymodule, "$strhide/$strshow", $strdelete);
+    $table->align = array ("LEFT", "CENTER", "CENTER");
+    $table->wrap = array ("NOWRAP", "", "");
+    $table->size = array ("100%", "10", "10");
+    $table->width = "100";
+
+    foreach ($modulebyname as $modulename => $module) {
+
+        $icon = "<img src=\"$modpixpath/$module->name/icon.gif\" hspace=10 height=16 width=16 border=0>";
+
+        $delete = "<a href=\"modules.php?delete=$module->name\">$strdelete</a>";
+
+        if ($module->visible) {
+            $visible = "<a href=\"modules.php?hide=$module->name\" title=\"$strhide\">".
+                       "<img src=\"$pixpath/i/hide.gif\" align=\"absmiddle\" height=16 width=16 border=0></a>";
+            $class = "";
+        } else {
+            $visible = "<a href=\"modules.php?show=$module->name\" title=\"$strshow\">".
+                       "<img src=\"$pixpath/i/show.gif\" align=\"absmiddle\" height=16 width=16 border=0></a>";
+            $class = "class=\"dimmed_text\"";
+        }
+        if ($module->name == "forum") {
+            $delete = "";
+            $visible = "";
+            $class = "";
+        }
+        $table->data[] = array ("<p $class>$icon $modulename</p>", $visible, $delete);
+    }
+    print_table($table);
+
+    echo "<br /><br />";
+
+    print_footer();
+
+?>
index 939972456c7712a3ecd4a9902c1a71dfd96482f2..5a34a89a342a9579cf447237731c2c7b790d6860 100644 (file)
@@ -437,7 +437,7 @@ function get_array_of_activities($courseid) {
 //  mod - name of the module (eg forum)
 //  section - the number of the section (eg week or topic)
 //  name - the name of the instance
-//  visible - when the instance is visible or no
+//  visible - is the instance visible or not
 
     $mod = array();
 
@@ -478,8 +478,10 @@ function get_all_mods($courseid, &$mods, &$modnames, &$modnamesplural, &$modname
 
     if ($allmods = get_records("modules")) {
         foreach ($allmods as $mod) {
-            $modnames[$mod->name] = get_string("modulename", "$mod->name");
-            $modnamesplural[$mod->name] = get_string("modulenameplural", "$mod->name");
+            if ($mod->visible) {
+                $modnames[$mod->name] = get_string("modulename", "$mod->name");
+                $modnamesplural[$mod->name] = get_string("modulenameplural", "$mod->name");
+            }
         }
         asort($modnames);
     } else {
@@ -544,10 +546,7 @@ function set_section_visible($courseid, $sectionnumber, $visibility) {
                 set_field("course_modules", "visible", "$visibility", "id", $moduleid);
             }
         }
-        $modinfo = serialize(get_array_of_activities($courseid));
-        if (!set_field("course", "modinfo", $modinfo, "id", $courseid)) {
-            error("Could not cache module information!");
-        }
+        rebuild_course_cache($courseid);
     }
 }
 
@@ -632,6 +631,28 @@ function print_section($course, $section, $mods, $modnamesused, $absolute=false,
     echo "</td></tr></table><br />\n\n";
 }
 
+
+function rebuild_course_cache($courseid=0) {
+// Rebuilds the cached list of course activities stored in the database
+// If a courseid is not specified, then all are rebuilt
+
+    if ($courseid) {
+        $select = "id = '$courseid'";
+    } else {
+        $select = "";
+    }
+
+    if ($courses = get_records_select("course", $select)) {
+        foreach ($courses as $course) {
+            $modinfo = serialize(get_array_of_activities($course->id));
+            if (!set_field("course", "modinfo", $modinfo, "id", $course->id)) {
+                notify("Could not cache module information for course '$course->fullname'!");
+            }
+        }
+    }
+}
+
+
 function print_heading_block($heading, $width="100%", $class="headingblock") {
     global $THEME;
 
@@ -706,50 +727,52 @@ function print_admin_links ($siteid, $width=180) {
     }
 
     if (isadmin()) {
-           $moddata[]="<A HREF=\"$CFG->wwwroot/$CFG->admin/config.php\">".get_string("configvariables")."</A>";
+           $moddata[]="<a href=\"$CFG->wwwroot/$CFG->admin/config.php\">".get_string("configvariables")."</a>";
+               $modicon[]=$icon;
+               $moddata[]="<a href=\"$CFG->wwwroot/$CFG->admin/site.php\">".get_string("sitesettings")."</a>";
                $modicon[]=$icon;
-               $moddata[]="<A HREF=\"$CFG->wwwroot/$CFG->admin/site.php\">".get_string("sitesettings")."</A>";
+               $moddata[]="<a href=\"$CFG->wwwroot/course/log.php?id=$siteid\">".get_string("sitelogs")."</a>";
                $modicon[]=$icon;
-               $moddata[]="<A HREF=\"$CFG->wwwroot/course/log.php?id=$siteid\">".get_string("sitelogs")."</A>";
+               $moddata[]="<a href=\"$CFG->wwwroot/theme/index.php\">".get_string("choosetheme")."</a>";
                $modicon[]=$icon;
-               $moddata[]="<A HREF=\"$CFG->wwwroot/theme/index.php\">".get_string("choosetheme")."</A>";
+               $moddata[]="<a href=\"$CFG->wwwroot/$CFG->admin/lang.php\">".get_string("checklanguage")."</a>";
                $modicon[]=$icon;
-               $moddata[]="<A HREF=\"$CFG->wwwroot/$CFG->admin/lang.php\">".get_string("checklanguage")."</A>";
+               $moddata[]="<a href=\"$CFG->wwwroot/$CFG->admin/modules.php\">".get_string("managemodules")."</a>";
                $modicon[]=$icon;
                if (file_exists("$CFG->dirroot/$CFG->admin/$CFG->dbtype")) {
-            $moddata[]="<A HREF=\"$CFG->wwwroot/$CFG->admin/$CFG->dbtype/frame.php\">".get_string("managedatabase")."</A>";
+            $moddata[]="<a href=\"$CFG->wwwroot/$CFG->admin/$CFG->dbtype/frame.php\">".get_string("managedatabase")."</a>";
                        $modicon[]=$icon;
                }
-               $moddata[]="<HR>";
+               $moddata[]="<hr>";
                $modicon[]="";
     }
     if (iscreator()) {
-           $moddata[]="<A HREF=\"$CFG->wwwroot/course/edit.php\">".get_string("addnewcourse")."</A>";
+           $moddata[]="<a href=\"$CFG->wwwroot/course/edit.php\">".get_string("addnewcourse")."</a>";
                $modicon[]=$icon;
-               $moddata[]="<A HREF=\"$CFG->wwwroot/course/teacher.php\">".get_string("assignteachers")."</A>";
+               $moddata[]="<a href=\"$CFG->wwwroot/course/teacher.php\">".get_string("assignteachers")."</a>";
                $modicon[]=$icon;
         $fulladmin = "";
     }
     if (isadmin()) {
-           $moddata[]="<A HREF=\"$CFG->wwwroot/course/categories.php\">".get_string("categories")."</A>";
+           $moddata[]="<a href=\"$CFG->wwwroot/course/categories.php\">".get_string("categories")."</a>";
                $modicon[]=$icon;
-               $moddata[]="<A HREF=\"$CFG->wwwroot/course/delete.php\">".get_string("deletecourse")."</A>";
+               $moddata[]="<a href=\"$CFG->wwwroot/course/delete.php\">".get_string("deletecourse")."</a>";
                $modicon[]=$icon;
-               $moddata[]="<HR>";
+               $moddata[]="<hr>";
                $modicon[]="";
         if($CFG->auth == "email" || $CFG->auth == "none" || $CFG->auth == "manual"){
-                   $moddata[]="<A HREF=\"$CFG->wwwroot/$CFG->admin/user.php?newuser=true\">".get_string("addnewuser")."</A>";
+                   $moddata[]="<a href=\"$CFG->wwwroot/$CFG->admin/user.php?newuser=true\">".get_string("addnewuser")."</a>";
                    $modicon[]=$icon;
         }
-               $moddata[]="<A HREF=\"$CFG->wwwroot/$CFG->admin/user.php\">".get_string("edituser")."</A>";
+               $moddata[]="<a href=\"$CFG->wwwroot/$CFG->admin/user.php\">".get_string("edituser")."</a>";
                $modicon[]=$icon;
-               $moddata[]="<A HREF=\"$CFG->wwwroot/$CFG->admin/admin.php\">".get_string("assignadmins")."</A>";
+               $moddata[]="<a href=\"$CFG->wwwroot/$CFG->admin/admin.php\">".get_string("assignadmins")."</a>";
                $modicon[]=$icon;
-        $moddata[]="<A HREF=\"$CFG->wwwroot/$CFG->admin/creators.php\">".get_string("assigncreators")."</A>";
+        $moddata[]="<a href=\"$CFG->wwwroot/$CFG->admin/creators.php\">".get_string("assigncreators")."</a>";
                $modicon[]=$icon;
-               $moddata[]="<A HREF=\"$CFG->wwwroot/$CFG->admin/auth.php\">".get_string("authentication")."</A>";
+               $moddata[]="<a href=\"$CFG->wwwroot/$CFG->admin/auth.php\">".get_string("authentication")."</a>";
                $modicon[]=$icon;
-        $fulladmin = "<P><A HREF=\"$CFG->wwwroot/$CFG->admin/\">".get_string("admin")."</A>...";
+        $fulladmin = "<p><a href=\"$CFG->wwwroot/$CFG->admin/\">".get_string("admin")."</a>...";
     }
 
     print_side_block(get_string("administration"), "", $moddata, $modicon, $fulladmin, $width);
index f6e05c7601e2ea5113f01641dbd4107aa40af356..48e7846f61f270eaae495572d5dd3e30ebf133ea 100644 (file)
@@ -47,7 +47,9 @@
                 if (! $updateinstancefunction($mod)) {
                     error("Could not update the $mod->modulename");
                 }
-                add_to_log($mod->course, "course", "update mod", "../mod/$mod->modulename/view.php?id=$mod->coursemodule", "$mod->modulename $mod->instance"); 
+                add_to_log($mod->course, "course", "update mod", 
+                           "../mod/$mod->modulename/view.php?id=$mod->coursemodule", 
+                           "$mod->modulename $mod->instance"); 
                 break;
 
             case "add":
@@ -66,7 +68,9 @@
                 if (! set_field("course_modules", "section", $sectionid, "id", $mod->coursemodule)) {
                     error("Could not update the course module with the correct section");
                 }   
-                add_to_log($mod->course, "course", "add mod", "../mod/$mod->modulename/view.php?id=$mod->coursemodule", "$mod->modulename $mod->instance"); 
+                add_to_log($mod->course, "course", "add mod", 
+                           "../mod/$mod->modulename/view.php?id=$mod->coursemodule", 
+                           "$mod->modulename $mod->instance"); 
                 break;
             case "delete":
                 if (! $deleteinstancefunction($mod->instance)) {
                 if (! delete_mod_from_section($mod->coursemodule, "$mod->section")) {
                     notify("Could not delete the $mod->modulename from that section");
                 }
-                add_to_log($mod->course, "course", "delete mod", "view.php?id=$mod->course", "$mod->modulename $mod->instance"); 
+                add_to_log($mod->course, "course", "delete mod", 
+                           "view.php?id=$mod->course", 
+                           "$mod->modulename $mod->instance"); 
                 break;
             default:
                 error("No mode defined");
 
         }
 
-        $modinfo = serialize(get_array_of_activities($mod->course));
-        if (!set_field("course", "modinfo", $modinfo, "id", $mod->course)) {
-            error("Could not cache module information!");
-        }
+        $db->debug = true;
+        rebuild_course_cache($mod->course);
+        $db->debug = false;
 
         if (!empty($SESSION->returnpage)) {
             $return = $SESSION->returnpage;
     
         move_module($cm, $move);
 
-        $modinfo = serialize(get_array_of_activities($cm->course));
-        if (!set_field("course", "modinfo", $modinfo, "id", $cm->course)) {
-            error("Could not cache module information!");
-        }
+        rebuild_course_cache($cm->course);
 
         $site = get_site();
         if ($site->id == $cm->course) {
             error("This course module doesn't exist");
         }
    
-        hide_course_module($hide);
+        hide_course_module($cm->id);
 
-        $modinfo = serialize(get_array_of_activities($cm->course));
-        if (!set_field("course", "modinfo", $modinfo, "id", $cm->course)) {
-            error("Could not cache module information!");
-        }
+        rebuild_course_cache($cm->course);
 
         $site = get_site();
         if ($site->id == $cm->course) {
             error("This course module doesn't exist");
         }
 
+        if (! $section = get_record("course_sections", "id", $cm->section)) {
+            error("This module doesn't exist");
+        }
+
+        if (! $module = get_record("modules", "id", $cm->module)) {
+            error("This module doesn't exist");
+        }
+
         $site = get_site();
 
-        if ($cm->visible or $site->id == $cm->course) {
-            show_course_module($show);
-            $modinfo = serialize(get_array_of_activities($cm->course));
-            if (!set_field("course", "modinfo", $modinfo, "id", $cm->course)) {
-                error("Could not cache module information!");
-            }
+        if ($module->visible and ($section->visible or ($site->id == $cm->course))) {
+            show_course_module($cm->id);
+            rebuild_course_cache($cm->course);
         }
 
         if ($site->id == $cm->course) {
index a69b511b59adda1f90ed2bc880eb54db6c925383..d23589d3cb9c5bc6b7559c1663f9e5f3264ec034 100644 (file)
@@ -4,8 +4,9 @@ $string['thislanguage'] = "English";  // Name of this language in the native lan
 $string['thischarset'] = "iso-8859-1";  // The best charset to use for this language
 
 $string['action'] = "Action";
-$string['activity'] = "Activity";
 $string['activities'] = "Activities";
+$string['activity'] = "Activity";
+$string['activitymodule'] = "Activity module";
 $string['activityreport'] = "Activity report";
 $string['add'] = "Add";
 $string['added'] = "Added \$a";
@@ -352,6 +353,7 @@ $string['makeafolder'] = "Make a folder";
 $string['makeeditable'] = "If you make '\$a' editable by the web server process (eg apache) then you could edit this file directly from this page";
 $string['mainmenu'] = "Main menu";
 $string['managedatabase'] = "Manage database";
+$string['managemodules'] = "Manage modules";
 $string['markedthistopic'] = "This topic is highlighted as the current topic";
 $string['markthistopic'] = "Highlight this topic as the current topic";
 $string['maximumchars'] = "Maximum of \$a characters";
@@ -381,6 +383,9 @@ $string['missingsummary'] = "Missing summary";
 $string['missingteacher'] = "Must choose something";
 $string['missingusername'] = "Missing username";
 $string['modified'] = "Modified";
+$string['moduledeleteconfirm'] = "You are about to completely delete the module '\$a'.  This will completely delete everything in the database associated with this activity module.  Are you SURE you want to continue?";
+$string['moduledeletefiles'] = "All data associated with the module '\$a->module' has been deleted from the database.  To complete the deletion (and prevent the module re-installing itself), you should now delete this directory from your server: \$a->directory";
+$string['modulesetup'] = "Setting up module tables";
 $string['modulesetup'] = "Setting up module tables";
 $string['modulesuccess'] = "\$a tables have been set up correctly";
 $string['mostrecently'] = "most recently";
index 528c4d80c5954efb8fd2aedb79c45d5711601ef4..9d396c311a7ffb4a71e05356781ac84a63fbafeb 100644 (file)
@@ -19,7 +19,7 @@
 
 function main_upgrade($oldversion=0) {
 
-    global $CFG;
+    global $CFG, $THEME;
 
     $result = true;
 
@@ -383,6 +383,12 @@ function main_upgrade($oldversion=0) {
         table_column("modules", "", "visible", "integer", "1", "unsigned", "1", "", "");
     }
 
+    if ($oldversion < 2003050902) {
+        if (get_records("modules", "name", "pgassignment")) {
+            print_simple_box("Note: the pgassignment module will soon be deleted from CVS!  Go to the new 'Manage Modules' page and DELETE IT from your system", "center", "50%", "$THEME->cellheading", "20", "noticebox");
+        }
+    }
+
     return $result;
 
 }
index c01069bea9e32a1857a0e5b844bb9dadf3cab6fc..b278921bfcc84bd9108b6cb014bea0b2dcdcfea9 100644 (file)
 // This file is tailored to PostgreSQL 7
 
 function main_upgrade($oldversion=0) {
-    global $CFG;
+
+    global $CFG, $THEME;
+
     $result = true;
+
+
     if ($oldversion < 2003010101) {
         delete_records("log_display", "module", "user");
         $new->module = "user";
@@ -150,6 +154,12 @@ function main_upgrade($oldversion=0) {
         table_column("modules", "", "visible", "integer", "1", "unsigned", "1", "", "");
     }
 
+    if ($oldversion < 2003050902) {
+        if (get_records("modules", "name", "pgassignment")) {
+            print_simple_box("Note: the pgassignment module will soon be deleted from CVS!  Go to the new 'Manage Modules' page and DELETE IT from your system", "center", "50%", "$THEME->cellheading", "20", "noticebox");
+        }
+    }
+
     return $result;
 }
 ?>    
index de56c773abf3783eafa3afc65d8a863bd1aad4ce..7ccc02108794c740f2273ed10165c049ec4153cc 100644 (file)
@@ -895,6 +895,7 @@ function print_table($table) {
 //     $table->head      is an array of heading names.
 //     $table->align     is an array of column alignments
 //     $table->size      is an array of column sizes
+//     $table->wrap      is an array of "nowrap"s or nothing
 //     $table->data[]    is an array of arrays containing the data.
 //     $table->width     is an percentage of the page
 //     $table->cellpadding    padding on each cell
@@ -918,6 +919,15 @@ function print_table($table) {
             }
         }
     }
+    if (isset($table->wrap)) {
+        foreach ($table->wrap as $key => $ww) {
+            if ($ww) {
+                $wrap[$key] = " NOWRAP ";
+            } else {
+                $wrap[$key] = "";
+            }
+        }
+    }
 
     if (empty($table->width)) {
         $table->width = "80%";
@@ -931,12 +941,12 @@ function print_table($table) {
         $table->cellspacing = "1";
     }
 
-    print_simple_box_start("CENTER", "$table->width", "#FFFFFF", 0);
-    echo "<TABLE WIDTH=100% BORDER=0 valign=top align=center ";
+    print_simple_box_start("center", "$table->width", "#ffffff", 0);
+    echo "<table width=100% border=0 valign=top align=center ";
     echo " cellpadding=\"$table->cellpadding\" cellspacing=\"$table->cellspacing\" class=\"generaltable\">\n";
 
     if (!empty($table->head)) {
-        echo "<TR>";
+        echo "<tr>";
         foreach ($table->head as $key => $heading) {
             if (!isset($size[$key])) {
                 $size[$key] = "";
@@ -944,13 +954,13 @@ function print_table($table) {
             if (!isset($align[$key])) {
                 $align[$key] = "";
             } 
-            echo "<TH VALIGN=top ".$align[$key].$size[$key]." NOWRAP class=\"generaltableheader\">$heading</TH>";
+            echo "<th valign=top ".$align[$key].$size[$key]." nowrap class=\"generaltableheader\">$heading</th>";
         }
         echo "</TR>\n";
     }
 
     foreach ($table->data as $row) {
-        echo "<TR VALIGN=TOP>";
+        echo "<tr valign=top>";
         foreach ($row as $key => $item) {
             if (!isset($size[$key])) {
                 $size[$key] = "";
@@ -958,11 +968,14 @@ function print_table($table) {
             if (!isset($align[$key])) {
                 $align[$key] = "";
             } 
-            echo "<TD ".$align[$key].$size[$key]." class=\"generaltablecell\">$item</TD>";
+            if (!isset($wrap[$key])) {
+                $wrap[$key] = "";
+            } 
+            echo "<td ".$align[$key].$size[$key].$wrap[$key]." class=\"generaltablecell\">$item</td>";
         }
-        echo "</TR>\n";
+        echo "</tr>\n";
     }
-    echo "</TABLE>\n";
+    echo "</table>\n";
     print_simple_box_end();
 
     return true;
index 3a6637e9725eba7ff21bd0237636eea6476fef65..fc8ba1dcaa406fa5b2154ffd0ffa7c1b4802858c 100644 (file)
@@ -5,7 +5,7 @@
 // database to determine whether upgrades should
 // be performed (see lib/db/*.php)
 
-$version = 2003050900;   // The current version is a date (YYYYMMDDXX)
+$version = 2003050902;   // The current version is a date (YYYYMMDDXX)
 
-$release = "1.0.9 development version";  // User-friendly version number
+$release = "1.0.9 development";  // User-friendly version number