Julio Montoya 12 years ago
parent
commit
ec07bda26b

+ 2 - 36
plugin/olpc_peru_filter/index.php

@@ -1,38 +1,4 @@
 <?php
 /* For licensing terms, see /license.txt */
-/**
- * This script shows a list of options that are taken from a Squid configuration
- * directory and lets the teacher choose which filter options to enable for his
- * course.
- */
-/**
- * Configuration settings. Update if your Squid files are somewhere else
- */
-define('BLACKLISTS_ENABLED_FILE','/var/sqg/blacklists');
-define('BLACKLISTS_DIR','/var/squidGuard/blacklists');
-/**
- * Reading list
- */
-$list = scandir(BLACKLISTS_DIR);
-$categories = array();
-foreach ($list as $file) {
-    if (substr($file,0,1) == '.' or $file == 'custom_blacklist' or is_dir(BLACKLIST_DIR.'/'.$file)) {
-        continue;
-    }
-    $categories[] = $file; 
-}
-sort($categories);
-/**
- * Generate a checkboxes list with the names of the categories found in the
- * directory. Already check if the category belongs to a $blacklist
- */
-$blacklist = file(BLACKLISTS_ENABLED_FILE);
-foreach ($categories as $category) {
-    foreach ($blacklist as $blacklisted) {
-        $checked = '';
-        if ($category == trim($blacklisted)) {
-            $checked = ' checked="checked"';
-        }
-        echo '<input type="checkbox" name="blacklists[]" value="'.$category.'" '.$checked.'>'.$category.'</input><br />';
-    }
-}
+// placeholder - this plugin manages everything from its class and there is
+// no end-user interface

+ 11 - 0
plugin/olpc_peru_filter/lib/olpc_peru_filter_plugin.class.php

@@ -53,6 +53,17 @@ class OLPC_Peru_FilterPlugin extends Plugin
         //Deleting course settings
         $this->uninstall_course_fields_in_all_courses();
     }
+    /**
+     * Caller for the install_course_fields() function
+     * @param int The course's integer ID
+     * @param boolean Whether to add a tool link on the course homepage
+     * @return void
+     */
+    function course_install($course_id, $add_tool_link = true) {
+        //force ignoring the tools table insertion for this plugin
+        $this->install_course_fields($course_id, false);
+    }
+
     function course_settings_updated($values = array()) {
         if (!is_array($values) or count($values)==0) {
             return false;

+ 2 - 0
plugin/olpc_peru_filter/readme.txt

@@ -15,3 +15,5 @@ sudo chmod -R 0777 /var/squidGuard/blacklists
 After that, enable the plugin, then go to some course's config screen and
 check/uncheck the "Games" option. Now check that it updated the 
 /var/sqg/blacklists file... That's all folks!
+
+The blacklists in /var/squidGuard/blacklists/ can be downloaded from http://dsi.ut-capitole.fr/blacklists/index_en.php