Merge branch 'MDL-26031_20_wip_guestsession' of git://github.com/skodak/moodle
authorSam Hemelryk <sam@moodle.com>
Tue, 18 Jan 2011 07:40:50 +0000 (15:40 +0800)
committerSam Hemelryk <sam@moodle.com>
Tue, 18 Jan 2011 07:40:50 +0000 (15:40 +0800)
35 files changed:
admin/qtypes.php
admin/settings/plugins.php
config-dist.php
course/lib.php
grade/import/csv/index.php [changed mode: 0755->0644]
grade/import/grade_import_form.php [changed mode: 0755->0644]
grade/import/lib.php [changed mode: 0755->0644]
grade/report/grader/lib.php
grade/report/lib.php [changed mode: 0755->0644]
install/lang/lv/install.php
install/lang/pt_br/install.php
install/lang/ta_lk/install.php
lib/db/access.php
lib/db/install.xml [changed mode: 0755->0644]
lib/db/upgrade.php
lib/dml/mysqli_native_moodle_database.php
lib/dml/pgsql_native_moodle_database.php
lib/environmentlib.php
lib/moodlelib.php
lib/simpletestlib.php
mnet/service/enrol/course.php
mnet/service/enrol/locallib.php
mod/quiz/module.js
mod/scorm/db/install.xml
mod/scorm/db/upgrade.php
mod/scorm/version.php [changed mode: 0755->0644]
mod/workshop/allocation/random/lang/en/workshopallocation_random.php
mod/workshop/allocation/random/lib.php
mod/workshop/allocation/random/settings_form.php
mod/workshop/allocation/random/styles.css [new file with mode: 0644]
tag/edit.php
tag/lib.php
tag/tag_autocomplete.php
theme/overlay/style/pagelayout.css
version.php

index 5536540..33a70d8 100644 (file)
         }
 
         // Settings link, if available.
-        if (file_exists($qtype->plugin_dir() . '/settings.php')) {
+        $settings = admin_get_root()->locate('qtypesetting' . $qtypename);
+        if ($settings instanceof admin_externalpage) {
+            $row[] = '<a href="' . $settings->url .
+                    '">' . get_string('settings') . '</a>';
+        } else if ($settings instanceof admin_settingpage) {
             $row[] = '<a href="' . admin_url('settings.php?section=qtypesetting' . $qtypename) .
                     '">' . get_string('settings') . '</a>';
         } else {
index d107eca..825673c 100644 (file)
@@ -372,13 +372,12 @@ if ($hassiteconfig || has_capability('moodle/question:config', $systemcontext))
     // Question type settings.
     $ADMIN->add('modules', new admin_category('qtypesettings', get_string('questiontypes', 'admin')));
     $ADMIN->add('qtypesettings', new admin_page_manageqtypes());
-    require_once($CFG->libdir . '/questionlib.php');
-    global $QTYPES;
-    foreach ($QTYPES as $qtype) {
-        $settingsfile = $qtype->plugin_dir() . '/settings.php';
+    $qtypes = get_plugin_list('qtype');
+    foreach ($qtypes as $qtype => $path) {
+        $settingsfile = $path . '/settings.php';
         if (file_exists($settingsfile)) {
-            $settings = new admin_settingpage('qtypesetting' . $qtype->name(),
-                    $qtype->local_name(), 'moodle/question:config');
+            $settings = new admin_settingpage('qtypesetting' . $qtype,
+                    get_string('pluginname', 'qtype_' . $qtype), 'moodle/question:config');
             include($settingsfile);
             if ($settings) {
                 $ADMIN->add('qtypesettings', $settings);
index 66f6bad..f9909be 100644 (file)
@@ -50,9 +50,12 @@ $CFG->dboptions = array(
                                 //  used? set to 'false' for the most stable
                                 //  setting, 'true' can improve performance
                                 //  sometimes
-    'dbsocket'  => false,       // should connection via UNIX socket be
-                                //  used? if you set it to 'true' here,
-                                //  set dbhost to 'localhost'
+    'dbsocket'  => false,       // should connection via UNIX socket be used?
+                                //  if you set it to 'true' or custom path
+                                //  here set dbhost to 'localhost',
+                                //  (please note mysql is always using socket
+                                //  if dbhost is 'localhost' - if you need
+                                //  local port connection use '127.0.0.1')
     'dbport'    => '',          // the TCP port number to use when connecting
                                 //  to the server. keep empty string for the
                                 //  default port
index 10d7178..28983a9 100644 (file)
@@ -351,7 +351,7 @@ function print_log($course, $user=0, $date=0, $order="l.time ASC", $page=0, $per
     $table->head = array(
         get_string('time'),
         get_string('ip_address'),
-        get_string('fullnamecourse'),
+        get_string('fullname'),
         get_string('action'),
         get_string('info')
     );
old mode 100755 (executable)
new mode 100644 (file)
index 4cd70b3..8681a83
@@ -79,8 +79,13 @@ if ($id) {
                 continue;
             }
 
-            // this was idnumber
-            $gradeitems[$grade_item->id] = $grade_item->get_name();
+            $displaystring = null;
+            if (!empty($grade_item->itemmodule)) {
+                $displaystring = get_string('modulename', $grade_item->itemmodule).': '.$grade_item->get_name();
+            } else {
+                $displaystring = $grade_item->get_name();
+            }
+            $gradeitems[$grade_item->id] = $displaystring;
         }
     }
 }
@@ -88,7 +93,9 @@ if ($id) {
 if ($importcode = optional_param('importcode', '', PARAM_FILE)) {
     $filename = $CFG->dataroot.'/temp/gradeimport/cvs/'.$USER->id.'/'.$importcode;
     $fp = fopen($filename, "r");
-    $header = explode($csv_delimiter, fgets($fp,GRADE_CSV_LINE_LENGTH), PARAM_RAW);
+    $headers = fgets($fp, GRADE_CSV_LINE_LENGTH);
+    $header = explode($csv_delimiter, $headers);
+    fclose($fp);
 }
 
 $mform2 = new grade_import_mapping_form(null, array('gradeitems'=>$gradeitems, 'header'=>$header));
@@ -122,7 +129,7 @@ if ($formdata = $mform->get_data()) {
     $fp = fopen($filename, "r");
 
     // --- get header (field names) ---
-    $header = explode($csv_delimiter, fgets($fp,GRADE_CSV_LINE_LENGTH));
+    $header = explode($csv_delimiter, fgets($fp, GRADE_CSV_LINE_LENGTH));
 
     // print some preview
     $numlines = 0; // 0 preview lines displayed
@@ -136,10 +143,10 @@ if ($formdata = $mform->get_data()) {
     }
     echo '</tr>';
     while (!feof ($fp) && $numlines <= $formdata->previewrows) {
-        $lines = explode($csv_delimiter, fgets($fp,GRADE_CSV_LINE_LENGTH));
+        $lines = explode($csv_delimiter, fgets($fp, GRADE_CSV_LINE_LENGTH));
         echo '<tr>';
         foreach ($lines as $line) {
-            echo '<td>'.$line.'</td>';;
+            echo '<td>'.$line.'</td>';
         }
         $numlines ++;
         echo '</tr>';
@@ -177,7 +184,9 @@ if ($formdata = $mform->get_data()) {
     $map = array();
     // loops mapping_0, mapping_1 .. mapping_n and construct $map array
     foreach ($header as $i => $head) {
-        $map[$i] = $formdata->{'mapping_'.$i};
+        if (isset($formdata->{'mapping_'.$i})) {
+            $map[$i] = $formdata->{'mapping_'.$i};
+        }
     }
 
     // if mapping information is supplied
@@ -185,7 +194,7 @@ if ($formdata = $mform->get_data()) {
 
     // check for mapto collisions
     $maperrors = array();
-    foreach ($map as $i=>$j) {
+    foreach ($map as $i => $j) {
         if ($j == 0) {
             // you can have multiple ignores
             continue;
@@ -211,14 +220,14 @@ if ($formdata = $mform->get_data()) {
     if ($fp = fopen($filename, "r")) {
 
         // read the first line makes sure this doesn't get read again
-        $header = explode($csv_delimiter, fgets($fp,GRADE_CSV_LINE_LENGTH));
+        $header = explode($csv_delimiter, fgets($fp, GRADE_CSV_LINE_LENGTH));
 
         $newgradeitems = array(); // temporary array to keep track of what new headers are processed
         $status = true;
 
         while (!feof ($fp)) {
             // add something
-            $line = explode($csv_delimiter, fgets($fp,GRADE_CSV_LINE_LENGTH));
+            $line = explode($csv_delimiter, fgets($fp, GRADE_CSV_LINE_LENGTH));
 
             if(count($line) <= 1){
                 // there is no data on this line, move on
@@ -303,18 +312,19 @@ if ($formdata = $mform->get_data()) {
                             $newgradeitem->importcode = $importcode;
                             $newgradeitem->importer   = $USER->id;
 
-                            // failed to insert into new grade item buffer
+                            // insert into new grade item buffer
                             $newgradeitems[$key] = $DB->insert_record('grade_import_newitem', $newgradeitem);
-                            // add this to grade_import_newitem table
-                            // add the new id to $newgradeitem[$key]
                         }
                         $newgrade = new stdClass();
                         $newgrade->newgradeitem = $newgradeitems[$key];
-                        $newgrade->finalgrade   = $value;
-                        $newgrades[] = $newgrade;
 
-                        // if not, put it in
-                        // else, insert grade into the table
+                        // if the user has a grade for this grade item
+                        if (trim($value) != '-') {
+                            // instead of omitting the grade we could insert one with finalgrade set to 0
+                            // we do not have access to grade item min grade
+                            $newgrade->finalgrade   = $value;
+                            $newgrades[] = $newgrade;
+                        }
                     break;
                     case 'feedback':
                         if ($t1) {
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
index 574b354..1209e1c
@@ -163,22 +163,31 @@ function get_unenrolled_users_in_import($importcode, $courseid) {
     global $CFG, $DB;
     $relatedctxcondition = get_related_contexts_string(get_context_instance(CONTEXT_COURSE, $courseid));
 
-    list($usql, $params) = $DB->get_in_or_equal(explode(',', $CFG->gradebookroles));
+    //users with a gradeable role
+    list($gradebookrolessql, $gradebookrolesparams) = $DB->get_in_or_equal(explode(',', $CFG->gradebookroles), SQL_PARAMS_NAMED, 'grbr0');
+
+    //enrolled users
+    $context = get_context_instance(CONTEXT_COURSE, $courseid);
+    list($enrolledsql, $enrolledparams) = get_enrolled_sql($context);
 
     $sql = "SELECT giv.id, u.firstname, u.lastname, u.idnumber AS useridnumber,
-                COALESCE(gi.idnumber, gin.itemname) AS gradeidnumber
-            FROM
-                {grade_import_values} giv
-                JOIN {user} u ON giv.userid = u.id
-                LEFT JOIN {grade_items} gi ON gi.id = giv.itemid
-                LEFT JOIN {grade_import_newitem} gin ON gin.id = giv.newgradeitem
-                LEFT JOIN {role_assignments} ra ON (giv.userid = ra.userid AND
-                    ra.roleid $usql AND
-                    ra.contextid $relatedctxcondition)
-                WHERE giv.importcode = ?
-                    AND ra.id IS NULL
-                ORDER BY gradeidnumber, u.lastname, u.firstname";
-    $params[] = $importcode;
+                   COALESCE(gi.idnumber, gin.itemname) AS gradeidnumber
+              FROM {grade_import_values} giv
+              JOIN {user} u
+                   ON giv.userid = u.id
+              LEFT JOIN {grade_items} gi
+                        ON gi.id = giv.itemid
+              LEFT JOIN {grade_import_newitem} gin
+                        ON gin.id = giv.newgradeitem
+              LEFT JOIN ($enrolledsql) je
+                        ON je.id = u.id
+              LEFT JOIN {role_assignments} ra
+                        ON (giv.userid = ra.userid AND ra.roleid $gradebookrolessql AND ra.contextid $relatedctxcondition)
+             WHERE giv.importcode = :importcode
+                   AND (ra.id IS NULL OR je.id IS NULL)
+          ORDER BY gradeidnumber, u.lastname, u.firstname";
+    $params = array_merge($gradebookrolesparams, $enrolledparams);
+    $params['importcode'] = $importcode;
 
     return $DB->get_records_sql($sql, $params);
 }
index d3bedfe..d76d679 100644 (file)
@@ -333,23 +333,35 @@ class grade_report_grader extends grade_report {
     public function load_users() {
         global $CFG, $DB;
 
-        list($usql, $gbrparams) = $DB->get_in_or_equal(explode(',', $this->gradebookroles), SQL_PARAMS_NAMED, 'grbr0');
+        //limit to users with a gradeable role
+        list($gradebookrolessql, $gradebookrolesparams) = $DB->get_in_or_equal(explode(',', $this->gradebookroles), SQL_PARAMS_NAMED, 'grbr0');
 
+        //limit to users with an active enrollment
+        list($enrolledsql, $enrolledparams) = get_enrolled_sql($this->context);
+
+        //fields we need from the user table
+        $userfields = user_picture::fields('u', array('idnumber'));
+
+        //if the user has clicked one of the sort asc/desc arrows
         if (is_numeric($this->sortitemid)) {
-            $params = array_merge(array('gitemid'=>$this->sortitemid), $gbrparams, $this->groupwheresql_params);
+            $params = array_merge(array('gitemid'=>$this->sortitemid), $gradebookrolesparams, $this->groupwheresql_params, $enrolledparams);
             // the MAX() magic is required in order to please PG
             $sort = "MAX(g.finalgrade) $this->sortorder";
 
-            $ufields = user_picture::fields('u', array('idnumber'));
-            $sql = "SELECT $ufields
+            $sql = "SELECT $userfields
                       FROM {user} u
-                           JOIN {role_assignments} ra ON ra.userid = u.id
-                           $this->groupsql
-                           LEFT JOIN {grade_grades} g ON (g.userid = u.id AND g.itemid = :gitemid)
-                     WHERE ra.roleid $usql AND u.deleted = 0
-                           $this->groupwheresql
+                      JOIN ($enrolledsql) je
+                           ON je.id = u.id
+                      JOIN {role_assignments} ra
+                           ON ra.userid = u.id
+                      $this->groupsql
+                      LEFT JOIN {grade_grades} g
+                                ON (g.userid = u.id AND g.itemid = :gitemid)
+                     WHERE ra.roleid $gradebookrolessql
+                           AND u.deleted = 0
                            AND ra.contextid ".get_related_contexts_string($this->context)."
-                  GROUP BY $ufields
+                           $this->groupwheresql
+                  GROUP BY $userfields
                   ORDER BY $sort";
 
         } else {
@@ -363,16 +375,19 @@ class grade_report_grader extends grade_report {
                     $sort = "u.idnumber $this->sortorder"; break;
             }
 
-            $params = array_merge($gbrparams, $this->groupwheresql_params);
+            $params = array_merge($gradebookrolesparams, $this->groupwheresql_params, $enrolledparams);
 
-            $userfields = user_picture::fields('u', array('idnumber'));
             $sql = "SELECT DISTINCT $userfields
                       FROM {user} u
-                           JOIN {role_assignments} ra ON u.id = ra.userid
+                      JOIN ($enrolledsql) je
+                           ON je.id = u.id
+                      JOIN {role_assignments} ra
+                           ON u.id = ra.userid
                            $this->groupsql
-                     WHERE ra.roleid $usql AND u.deleted = 0
-                           $this->groupwheresql
+                     WHERE ra.roleid $gradebookrolessql
+                           AND u.deleted = 0
                            AND ra.contextid ".get_related_contexts_string($this->context)."
+                           $this->groupwheresql
                   ORDER BY $sort";
         }
 
@@ -1269,20 +1284,29 @@ class grade_report_grader extends grade_report {
 
         $totalcount = $this->get_numusers($grouponly);
 
-        list($usql, $rolesparams) = $DB->get_in_or_equal(explode(',', $this->gradebookroles), SQL_PARAMS_NAMED, 'grbr0');
+        //limit to users with a gradeable role
+        list($gradebookrolessql, $gradebookrolesparams) = $DB->get_in_or_equal(explode(',', $this->gradebookroles), SQL_PARAMS_NAMED, 'grbr0');
+
+        //limit to users with an active enrollment
+        list($enrolledsql, $enrolledparams) = get_enrolled_sql($this->context);
 
         if ($showaverages) {
-            $params = array_merge(array('courseid'=>$this->courseid), $rolesparams, $groupwheresqlparams);
+            $params = array_merge(array('courseid'=>$this->courseid), $gradebookrolesparams, $enrolledparams, $groupwheresqlparams);
 
             // find sums of all grade items in course
             $SQL = "SELECT g.itemid, SUM(g.finalgrade) AS sum
                       FROM {grade_items} gi
-                           JOIN {grade_grades} g      ON g.itemid = gi.id
-                           JOIN {user} u              ON u.id = g.userid
-                           JOIN {role_assignments} ra ON ra.userid = u.id
-                           $groupsql
+                      JOIN {grade_grades} g
+                           ON g.itemid = gi.id
+                      JOIN {user} u
+                           ON u.id = g.userid
+                      JOIN ($enrolledsql) je
+                           ON je.id = u.id
+                      JOIN {role_assignments} ra
+                           ON ra.userid = u.id
+                      $groupsql
                      WHERE gi.courseid = :courseid
-                           AND ra.roleid $usql
+                           AND ra.roleid $gradebookrolessql
                            AND ra.contextid ".get_related_contexts_string($this->context)."
                            AND g.finalgrade IS NOT NULL
                            $groupwheresql
@@ -1296,15 +1320,18 @@ class grade_report_grader extends grade_report {
 
             // MDL-10875 Empty grades must be evaluated as grademin, NOT always 0
             // This query returns a count of ungraded grades (NULL finalgrade OR no matching record in grade_grades table)
-            $params = array_merge(array('courseid'=>$this->courseid), $rolesparams, $groupwheresqlparams);
             $SQL = "SELECT gi.id, COUNT(u.id) AS count
                       FROM {grade_items} gi
-                           CROSS JOIN {user} u
-                           JOIN {role_assignments} ra        ON ra.userid = u.id
-                           LEFT OUTER JOIN  {grade_grades} g ON (g.itemid = gi.id AND g.userid = u.id AND g.finalgrade IS NOT NULL)
-                           $groupsql
+                      CROSS JOIN {user} u
+                      JOIN ($enrolledsql) je
+                           ON je.id = u.id
+                      JOIN {role_assignments} ra
+                           ON ra.userid = u.id
+                      LEFT OUTER JOIN {grade_grades} g
+                           ON (g.itemid = gi.id AND g.userid = u.id AND g.finalgrade IS NOT NULL)
+                      $groupsql
                      WHERE gi.courseid = :courseid
-                           AND ra.roleid $usql
+                           AND ra.roleid $gradebookrolessql
                            AND ra.contextid ".get_related_contexts_string($this->context)."
                            AND g.id IS NULL
                            $groupwheresql
old mode 100755 (executable)
new mode 100644 (file)
index 45540a9..a49b89e
@@ -274,7 +274,14 @@ abstract class grade_report {
 
         $groupsql      = "";
         $groupwheresql = "";
-        list($usql, $params) = $DB->get_in_or_equal(explode(',', $this->gradebookroles), SQL_PARAMS_NAMED, 'grbr0');
+
+        //limit to users with a gradeable role
+        list($gradebookrolessql, $gradebookrolesparams) = $DB->get_in_or_equal(explode(',', $this->gradebookroles), SQL_PARAMS_NAMED, 'grbr0');
+
+        //limit to users with an active enrollment
+        list($enrolledsql, $enrolledparams) = get_enrolled_sql($this->context);
+
+        $params = array_merge($gradebookrolesparams, $enrolledparams);
 
         if ($groups) {
             $groupsql      = $this->groupsql;
@@ -284,9 +291,13 @@ abstract class grade_report {
 
         $countsql = "SELECT COUNT(DISTINCT u.id)
                        FROM {user} u
-                            JOIN {role_assignments} ra ON u.id = ra.userid
-                            $groupsql
-                      WHERE ra.roleid $usql AND u.deleted = 0
+                       JOIN ($enrolledsql) je
+                            ON je.id = u.id
+                       JOIN {role_assignments} ra
+                            ON u.id = ra.userid
+                       $groupsql
+                      WHERE ra.roleid $gradebookrolessql
+                            AND u.deleted = 0
                             $groupwheresql
                             AND ra.contextid ".get_related_contexts_string($this->context);
         return $DB->count_records_sql($countsql, $params);
index 84701c8..f250af7 100644 (file)
@@ -44,19 +44,14 @@ $string['memorylimithelp'] = '<p>Pašlaik iestatītais PHP atmiņas apjoma ierob
 <p>Sistēmā Moodle tas vēlāk var izraisīt atmiņas izmantošanas problēmas, it īpaši tad, 
    ja būsit iespējojis lielu skaitu moduļu un/vai lietotāju.</p>
 
-<p>Ieteicams konfigurēt PHP ar pēc iespējas lielāku atmiņas apjomu, piemēram, 40 MB.  
-   Ir vairāki veidi, kā to var izdarīt, piemēram:</p>
+<p>Ja iespējams, ieteicams konfigurēt PHP ar lielāku maksimālās atmiņas apjomu, piemēram, 40 MB. Ir vairāki veidi, kā to var izdarīt, piemēram:</p>
 <ol>
 <li>Ja iespējams, atkārtoti kompilējiet PHP, izmantojot <i>--enable-memory-limit</i>.  
     Šādā gadījumā sistēma Moodle atmiņas apjoma ierobežojumu varēs iestatīt automātiski.</li>
-<li>Ja jums ir piekļuve php.ini failam, varat mainīt tajā esošo parametra <b>memory_limit</b> 
-    iestatījumu, piemēram, uz 40 MB.  Ja jums nav piekļuves šim failam, palūdziet 
-    to izdarīt administratoram.</li>
-<li>Dažos PHP serveros Moodle direktorijā var izveidot failu .htaccess, kurā 
-    ir šāda rinda:
-    <p><blockquote>php_value memory_limit 40M</blockquote></p>
+<li>Ja jums ir piekļuve php.ini failam, varat mainīt tajā esošo parametra <b>memory_limit</b> iestatījumu, piemēram, uz 40 MB.  Ja jums nav piekļuves šim failam, palūdziet to izdarīt administratoram.</li>
+<li>Dažos PHP serveros Moodle direktorijā var izveidot failu .htaccess, kurā ir šāda rinda:    <p><blockquote>php_value memory_limit 40M</blockquote></p>
     <p>Tomēr dažos serveros tas neļaus darboties <b>nevienai</b> PHP lapai 
-    (atverot šīs lapas, tiks parādīti kļūdas ziņojumi), un fails .htaccess būs jānoņem.</p></li>
+(atverot šīs lapas, tiks parādīti kļūdas ziņojumi), un fails .htaccess būs jānoņem.</p></li>
 </ol>';
 $string['phpversion'] = 'PHP versija';
 $string['phpversionhelp'] = '<p>Sistēmā Moodle jāizmanto PHP, kuras versija ir vismaz 4.3.0 vai 5.1.0 (versijai 5.0.x piemīt vairākas zināmas problēmas).</p>
index 053387a..0dd99a8 100644 (file)
@@ -39,6 +39,7 @@ $string['dataroot'] = 'Diretório de Dados';
 $string['dbprefix'] = 'Prefixo das tabelas';
 $string['dirroot'] = 'Diretório Moodle';
 $string['environmenthead'] = 'Verificando o ambiente ...';
+$string['errorsinenvironment'] = 'Verificação do Ambiente falhou!';
 $string['installation'] = 'Instalação';
 $string['langdownloaderror'] = 'Infelizmente o idioma "{$a}" não foi instalado. A instalação vai continuar em Inglês.';
 $string['memorylimithelp'] = '<p>O limite de memória do PHP configurado atualmente no seu servidor é de {$a}.</p>
@@ -54,6 +55,8 @@ Com esta operação Moodle será capaz de configurar o limite de memória sózin
 <p><blockquote>php_value memory_limit 40M</blockquote></p>
 <p>Alguns servidores não aceitam este procedimento e <b>todas</b> as páginas PHP do servidor ficam bloqueadas ou imprimem mensagens de erro. Neste caso será necessário excluir o arquivo .htaccess .</p>
 </li></ol>';
+$string['pathssubdataroot'] = 'Você precisa de um local onde o Moodle possa salvar arquivos enviados. Este diretório deve possuir permissões de leitura e escrita pelo usuário do servidor web
+(geralmente \'nobody\' ou \'apache \'), mas não deverá ser acessível diretamente através da web. O instalador irá tentar criá-lo se ele não existir.';
 $string['pathssubdirroot'] = 'Caminho completo do diretório para instalação do Moddle.';
 $string['pathssubwwwroot'] = 'Endereço web completo onde o Moodle será acessado.
 Não é possível acessar o Moodle usando múltiplos endereços. Se seu site tem múltiplos endereços públicos você deve configurar redirecionamentos permantentes em todos eles exceto esse. Se seu site é acessado tanto da Intranet como Internet, use o endereço público aqui e configure o DNS para que os usuários da Intranet possam usar o endereço público também. Se o endereço não estiver correto, por favo mude a URL no seu navegador para reiniciar a instalação com um valor diferente.';
index fe94399..6ac0950 100644 (file)
@@ -60,7 +60,7 @@ $string['paths'] = 'பாதைகள்';
 $string['pathshead'] = 'பாதைகளை ஊர்ஜிதப்படுத்து';
 $string['phpextension'] = '{$a} PHP நீட்சி';
 $string['phpversion'] = 'PHP பதிப்பு';
-$string['phpversionhelp'] = '<p>Moodle குறைந்தளவு ஒரு PHP பதிப்பின் 4.3.0 or 5.1.0 ஐ (5.0.x அறியப்பட்ட பிரச்சினைகளின் ஒரு எண்ணிக்கையைக் கொண்டிருக்கின்றது) வேண்டுகின்றது).</p>
+$string['phpversionhelp'] = '<p>Moodle குறைந்தளவு ஒரு PHP பதிப்பின் 4.3.0 or 5.1.0 ஐ (5.0.x அறியப்பட்ட பிரச்சினைகளின் ஒரு எண்ணிக்கையைக் கொண்டிருக்கின்றது) வேண்டுகின்றது.</p>
 <p>நீங்கள் தற்போதைய பதிப்பு {$a} ஐ இயக்குகின்றீர்கள்</p>
 <p>நீங்கள் PHP ஐ மேம்படுத்த  அல்லது PHP இன் ஒரு புதிய பதிப்புடன் ஒரு வழங்கியிற்கு நகர்த்த வேண்டும்!<br/>
 
index 38729ea..e3e6d68 100644 (file)
@@ -727,7 +727,6 @@ $capabilities = array(
         'captype' => 'write',
         'contextlevel' => CONTEXT_COURSE,
         'archetypes' => array(
-            'editingteacher' => CAP_ALLOW,
             'manager' => CAP_ALLOW
         )
     ),
old mode 100755 (executable)
new mode 100644 (file)
index 0ff739b..7580795
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8" ?>
-<XMLDB PATH="lib/db" VERSION="20101121" COMMENT="XMLDB file for core Moodle tables"
+<XMLDB PATH="lib/db" VERSION="20110114" COMMENT="XMLDB file for core Moodle tables"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:noNamespaceSchemaLocation="../../lib/xmldb/xmldb.xsd"
 >
     <TABLE NAME="message" COMMENT="Stores all unread messages" PREVIOUS="log_display" NEXT="message_read">
       <FIELDS>
         <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" NEXT="useridfrom"/>
-        <FIELD NAME="useridfrom" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" PREVIOUS="id" NEXT="useridto"/>
-        <FIELD NAME="useridto" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" PREVIOUS="useridfrom" NEXT="subject"/>
+        <FIELD NAME="useridfrom" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="id" NEXT="useridto"/>
+        <FIELD NAME="useridto" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="useridfrom" NEXT="subject"/>
         <FIELD NAME="subject" TYPE="text" LENGTH="small" NOTNULL="false" SEQUENCE="false" COMMENT="The message subject" PREVIOUS="useridto" NEXT="fullmessage"/>
         <FIELD NAME="fullmessage" TYPE="text" LENGTH="small" NOTNULL="false" SEQUENCE="false" PREVIOUS="subject" NEXT="fullmessageformat"/>
         <FIELD NAME="fullmessageformat" TYPE="int" LENGTH="4" NOTNULL="false" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" COMMENT="The format of the full message" PREVIOUS="fullmessage" NEXT="fullmessagehtml"/>
     <TABLE NAME="message_read" COMMENT="Stores all messages that have been read" PREVIOUS="message" NEXT="message_contacts">
       <FIELDS>
         <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" NEXT="useridfrom"/>
-        <FIELD NAME="useridfrom" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" PREVIOUS="id" NEXT="useridto"/>
-        <FIELD NAME="useridto" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" PREVIOUS="useridfrom" NEXT="subject"/>
+        <FIELD NAME="useridfrom" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="id" NEXT="useridto"/>
+        <FIELD NAME="useridto" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="useridfrom" NEXT="subject"/>
         <FIELD NAME="subject" TYPE="text" LENGTH="small" NOTNULL="false" SEQUENCE="false" COMMENT="The message subject" PREVIOUS="useridto" NEXT="fullmessage"/>
         <FIELD NAME="fullmessage" TYPE="text" LENGTH="small" NOTNULL="false" SEQUENCE="false" PREVIOUS="subject" NEXT="fullmessageformat"/>
         <FIELD NAME="fullmessageformat" TYPE="int" LENGTH="4" NOTNULL="false" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" COMMENT="The format of the full message" PREVIOUS="fullmessage" NEXT="fullmessagehtml"/>
         <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" PREVIOUS="timecreated"/>
       </FIELDS>
       <KEYS>
-        <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
+        <KEY NAME="primary" TYPE="primary" FIELDS="id" NEXT="contextid"/>
+        <KEY NAME="contextid" TYPE="foreign" FIELDS="contextid" REFTABLE="context" REFFIELDS="id" COMMENT="Relates to context.id" PREVIOUS="primary" NEXT="userid"/>
+        <KEY NAME="userid" TYPE="foreign" FIELDS="userid" REFTABLE="user" REFFIELDS="id" COMMENT="Relates to user.id" PREVIOUS="contextid"/>
       </KEYS>
+      <INDEXES>
+        <INDEX NAME="itemid" UNIQUE="false" FIELDS="itemid"/>
+      </INDEXES>
     </TABLE>
     <TABLE NAME="license" COMMENT="store licenses used by moodle" PREVIOUS="rating" NEXT="registration_hubs">
       <FIELDS>
       </KEYS>
     </TABLE>
   </TABLES>
-</XMLDB>
+</XMLDB>
\ No newline at end of file
index 9bd9684..b45bf47 100644 (file)
@@ -239,7 +239,7 @@ function xmldb_main_upgrade($oldversion) {
         // add field
         $field = new xmldb_field('tiuserid');
         if (!$dbman->field_exists($table, $field)) {
-            $field->set_attributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, 0, 'itemid');
+            $field->set_attributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, 'itemid');
             $dbman->add_field($table, $field);
         }
         // modify index
@@ -645,49 +645,49 @@ function xmldb_main_upgrade($oldversion) {
     if ($oldversion < 2008081500) {
     /// Changing the type of all the columns that the question bank uses to store grades to be NUMBER(12, 7).
         $table = new xmldb_table('question');
-        $field = new xmldb_field('defaultgrade', XMLDB_TYPE_NUMBER, '12, 7', null, null, null, null, 'generalfeedback');
+        $field = new xmldb_field('defaultgrade', XMLDB_TYPE_NUMBER, '12, 7', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '1.0000000', 'generalfeedback');
         $dbman->change_field_type($table, $field);
         upgrade_main_savepoint(true, 2008081500);
     }
 
     if ($oldversion < 2008081501) {
         $table = new xmldb_table('question');
-        $field = new xmldb_field('penalty', XMLDB_TYPE_NUMBER, '12, 7', null, null, null, null, 'defaultgrade');
+        $field = new xmldb_field('penalty', XMLDB_TYPE_NUMBER, '12, 7', null, XMLDB_NOTNULL, null, '0.1000000', 'defaultgrade');
         $dbman->change_field_type($table, $field);
         upgrade_main_savepoint(true, 2008081501);
     }
 
     if ($oldversion < 2008081502) {
         $table = new xmldb_table('question_answers');
-        $field = new xmldb_field('fraction', XMLDB_TYPE_NUMBER, '12, 7', null, null, null, null, 'answer');
+        $field = new xmldb_field('fraction', XMLDB_TYPE_NUMBER, '12, 7', null, XMLDB_NOTNULL, null, '0', 'answer');
         $dbman->change_field_type($table, $field);
         upgrade_main_savepoint(true, 2008081502);
     }
 
     if ($oldversion < 2008081503) {
         $table = new xmldb_table('question_sessions');
-        $field = new xmldb_field('sumpenalty', XMLDB_TYPE_NUMBER, '12, 7', null, null, null, null, 'newgraded');
+        $field = new xmldb_field('sumpenalty', XMLDB_TYPE_NUMBER, '12, 7', null, XMLDB_NOTNULL, null, '0', 'newgraded');
         $dbman->change_field_type($table, $field);
         upgrade_main_savepoint(true, 2008081503);
     }
 
     if ($oldversion < 2008081504) {
         $table = new xmldb_table('question_states');
-        $field = new xmldb_field('grade', XMLDB_TYPE_NUMBER, '12, 7', null, null, null, null, 'event');
+        $field = new xmldb_field('grade', XMLDB_TYPE_NUMBER, '12, 7', null, XMLDB_NOTNULL, null, '0', 'event');
         $dbman->change_field_type($table, $field);
         upgrade_main_savepoint(true, 2008081504);
     }
 
     if ($oldversion < 2008081505) {
         $table = new xmldb_table('question_states');
-        $field = new xmldb_field('raw_grade', XMLDB_TYPE_NUMBER, '12, 7', null, null, null, null, 'grade');
+        $field = new xmldb_field('raw_grade', XMLDB_TYPE_NUMBER, '12, 7', null, XMLDB_NOTNULL, null, '0', 'grade');
         $dbman->change_field_type($table, $field);
         upgrade_main_savepoint(true, 2008081505);
     }
 
     if ($oldversion < 2008081506) {
         $table = new xmldb_table('question_states');
-        $field = new xmldb_field('penalty', XMLDB_TYPE_NUMBER, '12, 7', null, null, null, null, 'raw_grade');
+        $field = new xmldb_field('penalty', XMLDB_TYPE_NUMBER, '12, 7', null, XMLDB_NOTNULL, null, '0', 'raw_grade');
         $dbman->change_field_type($table, $field);
         upgrade_main_savepoint(true, 2008081506);
     }
@@ -1552,7 +1552,7 @@ WHERE gradeitemid IS NOT NULL AND grademax IS NOT NULL");
         $table = new xmldb_table('block_instances');
 
     /// Rename field weight on table block_instances to defaultweight
-        $field = new xmldb_field('weight', XMLDB_TYPE_INTEGER, '3', null, XMLDB_NOTNULL, null, '0', 'position');
+        $field = new xmldb_field('weight', XMLDB_TYPE_INTEGER, 10, null, XMLDB_NOTNULL, null, null, 'position');
         $dbman->rename_field($table, $field, 'defaultweight');
 
     /// Rename field position on table block_instances to defaultregion
@@ -1817,11 +1817,11 @@ WHERE gradeitemid IS NOT NULL AND grademax IS NOT NULL");
 
     /// Adding fields to table block_positions
         $table->add_field('id', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
-        $table->add_field('blockinstanceid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
+        $table->add_field('blockinstanceid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null);
         $table->add_field('contextid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null);
         $table->add_field('pagetype', XMLDB_TYPE_CHAR, '64', null, XMLDB_NOTNULL, null, null);
         $table->add_field('subpage', XMLDB_TYPE_CHAR, '16', null, XMLDB_NOTNULL, null, null);
-        $table->add_field('visible', XMLDB_TYPE_INTEGER, '4', null, XMLDB_NOTNULL, null, '1');
+        $table->add_field('visible', XMLDB_TYPE_INTEGER, '4', null, XMLDB_NOTNULL, null, null);
         $table->add_field('region', XMLDB_TYPE_CHAR, '16', null, XMLDB_NOTNULL, null, null);
         $table->add_field('weight', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
 
@@ -2351,19 +2351,19 @@ WHERE gradeitemid IS NOT NULL AND grademax IS NOT NULL");
 
     if ($oldversion < 2009110400) {
         // list of tables where we need to add new format field and convert texts
-        $extendtables = array('course' => 'summary',
-                              'course_categories' => 'description',
-                              'course_categories' => 'description',
-                              'course_request' => 'summary',
-                              'grade_outcomes' => 'description',
-                              'groups' => 'description',
-                              'groupings' => 'description',
-                              'scale' => 'description',
-                              'user_info_field' => 'description',
-                              'user_info_field' => 'defaultdata',
-                              'user_info_data' => 'data');
-
-        foreach ($extendtables as $tablestr=>$fieldstr) {
+        $extendtables = array('course'              => 'summary',
+                              'course_categories'   => 'description',
+                              'course_categories'   => 'description',
+                              'course_request'      => 'summary',
+                              'grade_outcomes'      => 'description',
+                              'groups'              => 'description',
+                              'groupings'           => 'description',
+                              'scale'               => 'description',
+                              'user_info_field'     => 'description',
+                              'user_info_field'     => 'defaultdata',
+                              'user_info_data'      => 'data');
+
+        foreach ($extendtables as $tablestr => $fieldstr) {
             $formatfieldstr = $fieldstr.'format';
 
             $table = new xmldb_table($tablestr);
@@ -2374,7 +2374,7 @@ WHERE gradeitemid IS NOT NULL AND grademax IS NOT NULL");
                 $dbman->add_field($table, $field);
             }
             if ($CFG->texteditors !== 'textarea') {
-                $rs = $DB->get_recordset($tablestr, array($formatfieldstr=>FORMAT_MOODLE), '', "id,$fieldstr,$formatfieldstr");
+                $rs = $DB->get_recordset($tablestr, array($formatfieldstr => FORMAT_MOODLE), '', "id,$fieldstr,$formatfieldstr");
                 foreach ($rs as $rec) {
                     $rec->$fieldstr       = text_to_html($rec->$fieldstr, false, false, true);
                     $rec->$formatfieldstr = FORMAT_HTML;
@@ -2382,6 +2382,7 @@ WHERE gradeitemid IS NOT NULL AND grademax IS NOT NULL");
                     upgrade_set_timeout();
                 }
                 $rs->close();
+                unset($rs);
             }
         }
 
@@ -2430,7 +2431,7 @@ WHERE gradeitemid IS NOT NULL AND grademax IS NOT NULL");
 
     if ($oldversion < 2010011200) {
         $table = new xmldb_table('grade_categories');
-        $field = new xmldb_field('hidden', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, 0);
+        $field = new xmldb_field('hidden', XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, 0, 'timemodified');
 
         if (!$dbman->field_exists($table, $field)) {
             $dbman->add_field($table, $field);
@@ -3594,8 +3595,8 @@ WHERE gradeitemid IS NOT NULL AND grademax IS NOT NULL");
         $table->add_field('id', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
         $table->add_field('userid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, null, null, 0);
         $table->add_field('name', XMLDB_TYPE_CHAR, '200', null, XMLDB_NOTNULL, null, null);
-        $table->add_field('private', XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, 0);
-        $table->add_field('sortorder', XMLDB_TYPE_INTEGER, '6', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0');
+        $table->add_field('private', XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '1');
+        $table->add_field('sortorder', XMLDB_TYPE_INTEGER, '6', null, XMLDB_NOTNULL, null, '0');
 
 
     /// Adding keys to table my_pages
@@ -5351,7 +5352,7 @@ WHERE gradeitemid IS NOT NULL AND grademax IS NOT NULL");
     //install.xml so there are 2.0 sites that are missing it.
     if ($oldversion < 2010101900) {
         $table = new xmldb_table('grade_categories');
-        $field = new xmldb_field('hidden', XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, 0);
+        $field = new xmldb_field('hidden', XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, 0, 'timemodified');
 
         if (!$dbman->field_exists($table, $field)) {
             $dbman->add_field($table, $field);
@@ -5371,9 +5372,9 @@ WHERE gradeitemid IS NOT NULL AND grademax IS NOT NULL");
     //MDL-24771
     if ($oldversion < 2010102601) {
 
-        $fieldnotification = new xmldb_field('notification', XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, 0, 'smallmessage');
-        $fieldcontexturl = new xmldb_field('contexturl', XMLDB_TYPE_CHAR, '255', null, null, null, null, 'notification');
-        $fieldcontexturlname = new xmldb_field('contexturlname', XMLDB_TYPE_CHAR, '255', null, null, null, null, 'contexturl');
+        $fieldnotification = new xmldb_field('notification', XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, null, null, 0, 'smallmessage');
+        $fieldcontexturl = new xmldb_field('contexturl', XMLDB_TYPE_TEXT, 'small', null, null, null, null, 'notification');
+        $fieldcontexturlname = new xmldb_field('contexturlname', XMLDB_TYPE_TEXT, 'small', null, null, null, null, 'contexturl');
         $fieldstoadd = array($fieldnotification, $fieldcontexturl, $fieldcontexturlname);
 
         $tablestomodify = array(new xmldb_table('message'), new xmldb_table('message_read'));
@@ -5421,7 +5422,7 @@ WHERE gradeitemid IS NOT NULL AND grademax IS NOT NULL");
     if ($oldversion < 2010102700) {
 
         $table = new xmldb_table('post');
-        $field = new xmldb_field('uniquehash', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null, 'content');
+        $field = new xmldb_field('uniquehash', XMLDB_TYPE_CHAR, '128', null, XMLDB_NOTNULL, null, null, 'content');
         // Launch change of precision for field name
         $dbman->change_field_precision($table, $field);
 
@@ -5512,6 +5513,449 @@ WHERE gradeitemid IS NOT NULL AND grademax IS NOT NULL");
         upgrade_main_savepoint(true, 2010121401);
     }
 
+    if ($oldversion < 2011011401) {
+        $columns = $DB->get_columns('block_instances');
+
+        // Check if we need to fix the default weight column
+        if (array_key_exists('defaultweight', $columns) && $columns['defaultweight']->max_length != 10) {
+            // Fix discrepancies in the block_instances table after upgrade from 1.9
+            $table = new xmldb_table('block_instances');
+
+            // defaultweight is smallint(3) after upgrade should be bigint 10
+            // Also fixed in earlier upgrade code
+            $field = new xmldb_field('defaultweight', XMLDB_TYPE_INTEGER, 10, null, XMLDB_NOTNULL, null, null, 'defaultregion');
+            if ($dbman->field_exists($table, $field)) {
+                $dbman->change_field_type($table, $field);
+            }
+
+            // add missing key `blocinst_par_ix` (`parentcontextid`)
+            $index = new xmldb_index('parentcontextid', XMLDB_INDEX_NOTUNIQUE, array('parentcontextid'));
+            if (!$dbman->index_exists($table, $index)) {
+                $dbman->add_index($table, $index);
+            }
+        }
+
+        // Main savepoint reached
+        upgrade_main_savepoint(true, 2011011401);
+    }
+
+    if ($oldversion < 2011011402) {
+        // Fix discrepancies in the block_positions table after upgrade from 1.9
+        $table = new xmldb_table('block_positions');
+        $columns = $DB->get_columns('block_positions');
+
+        // Check if we need to fix the blockinstanceid field
+        if (array_key_exists('blockinstanceid', $columns) && empty($columns['blockinstanceid']->unsigned)) {
+            // Fix blockinstanceid
+            // First remove the indexs on the field
+            $indexone = new xmldb_index('blockinstanceid', XMLDB_INDEX_NOTUNIQUE, array('blockinstanceid'));
+            $indexall = new xmldb_index('blockinstanceid-contextid-pagetype-subpage', XMLDB_INDEX_UNIQUE, array('blockinstanceid','contextid','pagetype','subpage'));
+            if ($dbman->index_exists($table, $indexone)) {
+                $dbman->drop_index($table, $indexone);
+            }
+            if ($dbman->index_exists($table, $indexall)) {
+                $dbman->drop_index($table, $indexall);
+            }
+            // blockinstanceid should be unsigned
+            // Also fixed in earlier upgrade code
+            $field = new xmldb_field('blockinstanceid', XMLDB_TYPE_INTEGER, 10, XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, 'id');
+            if ($dbman->field_exists($table, $field)) {
+                $dbman->change_field_unsigned($table, $field);
+            }
+
+            // Add the indexs back in
+            $dbman->add_index($table, $indexone);
+            $dbman->add_index($table, $indexall);
+        }
+
+        // Check if the visible field needs fixing.
+        if (array_key_exists('visible', $columns) && !empty($columns['visible']->has_default)) {
+            // visible shouldn't have a default
+            // Also fixed in earlier upgrade code
+            $field = new xmldb_field('visible', XMLDB_TYPE_INTEGER, 4, null, XMLDB_NOTNULL, null, null, 'subpage');
+            if ($dbman->field_exists($table, $field)) {
+                $dbman->change_field_default($table, $field);
+            }
+        }
+
+        // Main savepoint reached
+        upgrade_main_savepoint(true, 2011011402);
+    }
+
+    if ($oldversion < 2011011403) {
+        $columns = $DB->get_columns('grade_categories');
+        // Check if we need to fix the hidden field
+        if (array_key_exists('hidden', $columns) && $columns['hidden']->max_length != 1) {
+            // Fix discrepancies in the grade_categories table after upgrade from 1.9
+            $table = new xmldb_table('grade_categories');
+
+            // hidden should be tinyint(1)
+            // Also fixed in earlier upgrade code
+            $field = new xmldb_field('hidden', XMLDB_TYPE_INTEGER, 1, XMLDB_UNSIGNED, XMLDB_NOTNULL, null, 0, 'timemodified');
+            if ($dbman->field_exists($table, $field)) {
+                $dbman->change_field_precision($table, $field);
+            }
+        }
+
+        // Main savepoint reached
+        upgrade_main_savepoint(true, 2011011403);
+    }
+
+    if ($oldversion < 2011011404) {
+        // Fix discrepancies in the message table after upgrade from 1.9
+        $columns = $DB->get_columns('message');
+        $table = new xmldb_table('message');
+
+        // Check if we need to fix the useridfrom field
+        if (array_key_exists('useridfrom', $columns) && empty($columns['useridfrom']->unsigned)) {
+            // useridfrom should be unsigned
+            $field = new xmldb_field('useridfrom', XMLDB_TYPE_INTEGER, 10, XMLDB_UNSIGNED, XMLDB_NOTNULL, null, 0, 'id');
+            $index = new xmldb_index('useridfrom', XMLDB_INDEX_NOTUNIQUE, array('useridfrom'));
+            if ($dbman->index_exists($table, $index)) {
+                $dbman->drop_index($table, $index);
+            }
+            if ($dbman->field_exists($table, $field)) {
+                $dbman->change_field_unsigned($table, $field);
+            }
+            $dbman->add_index($table, $index);
+        }
+
+        // Check if we need to fix the useridto field
+        if (array_key_exists('useridto', $columns) && empty($columns['useridto']->unsigned)) {
+            // useridto should be unsigned
+            $field = new xmldb_field('useridto', XMLDB_TYPE_INTEGER, 10, XMLDB_UNSIGNED, XMLDB_NOTNULL, null, 0, 'useridfrom');
+            $index = new xmldb_index('useridto', XMLDB_INDEX_NOTUNIQUE, array('useridto'));
+            if ($dbman->index_exists($table, $index)) {
+                $dbman->drop_index($table, $index);
+            }
+            if ($dbman->field_exists($table, $field)) {
+                $dbman->change_field_unsigned($table, $field);
+            }
+            $dbman->add_index($table, $index);
+        }
+
+        // Check if we need to fix the notification field
+        if (array_key_exists('notification', $columns) && !empty($columns['notification']->not_null)) {
+            // notification should allow null
+            // Fixed in earlier upgrade code
+            $field = new xmldb_field('notification', XMLDB_TYPE_INTEGER, 1, XMLDB_UNSIGNED, null, null, 0, 'smallmessage');
+            if ($dbman->field_exists($table, $field)) {
+                $dbman->change_field_notnull($table, $field);
+            }
+        }
+
+        // Check if we need to fix the contexturl field
+        if (array_key_exists('contexturl', $columns) && strpos($columns['contexturl']->type, 'text') === false) {
+            // contexturl should be text
+            // Fixed in earlier upgrade code
+            $field = new xmldb_field('contexturl', XMLDB_TYPE_TEXT, 'small', null, null, null, null, 'notification');
+            if ($dbman->field_exists($table, $field)) {
+                $dbman->change_field_type($table, $field);
+            }
+        }
+
+        // Check if we need to fix the contexturl field
+        if (array_key_exists('contexturlname', $columns) && strpos($columns['contexturlname']->type, 'text') === false) {
+            // contexturlname should be text
+            // Fixed in earlier upgrade code
+            $field = new xmldb_field('contexturlname', XMLDB_TYPE_TEXT, 'small', null, null, null, null, 'contexturl');
+            if ($dbman->field_exists($table, $field)) {
+                $dbman->change_field_type($table, $field);
+            }
+        }
+
+        // Main savepoint reached
+        upgrade_main_savepoint(true, 2011011404);
+    }
+
+    if ($oldversion < 2011011405) {
+        // Fix discrepancies in the message_read table after upgrade from 1.9
+        $columns = $DB->get_columns('message_read');
+        $table = new xmldb_table('message_read');
+
+        // Check if we need to fix the useridfrom field
+        if (array_key_exists('useridfrom', $columns) && empty($columns['useridfrom']->unsigned)) {
+            // useridfrom should be unsigned
+            $field = new xmldb_field('useridfrom', XMLDB_TYPE_INTEGER, 10, XMLDB_UNSIGNED, XMLDB_NOTNULL, null, 0, 'id');
+            $index = new xmldb_index('useridfrom', XMLDB_INDEX_NOTUNIQUE, array('useridfrom'));
+            if ($dbman->index_exists($table, $index)) {
+                $dbman->drop_index($table, $index);
+            }
+            if ($dbman->field_exists($table, $field)) {
+                $dbman->change_field_unsigned($table, $field);
+            }
+            $dbman->add_index($table, $index);
+        }
+
+        // Check if we need to fix the useridto field
+        if (array_key_exists('useridto', $columns) && empty($columns['useridto']->unsigned)) {
+            // useridto should be unsigned
+            $field = new xmldb_field('useridto', XMLDB_TYPE_INTEGER, 10, XMLDB_UNSIGNED, XMLDB_NOTNULL, null, 0, 'useridfrom');
+            $index = new xmldb_index('useridto', XMLDB_INDEX_NOTUNIQUE, array('useridto'));
+            if ($dbman->index_exists($table, $index)) {
+                $dbman->drop_index($table, $index);
+            }
+            if ($dbman->field_exists($table, $field)) {
+                $dbman->change_field_unsigned($table, $field);
+            }
+            $dbman->add_index($table, $index);
+        }
+
+        // Check if we need to fix the notification field
+        if (array_key_exists('notification', $columns) && !empty($columns['notification']->not_null)) {
+            // notification should allow null
+            // Fixed in earlier upgrade code
+            $field = new xmldb_field('notification', XMLDB_TYPE_INTEGER, 1, XMLDB_UNSIGNED, null, null, 0, 'smallmessage');
+            if ($dbman->field_exists($table, $field)) {
+                $dbman->change_field_notnull($table, $field);
+            }
+        }
+
+        // Check if we need to fix the contexturl field
+        if (array_key_exists('contexturl', $columns) && strpos($columns['contexturl']->type, 'text') === false) {
+            // contexturl should be text
+            // Fixed in earlier upgrade code
+            $field = new xmldb_field('contexturl', XMLDB_TYPE_TEXT, 'small', null, null, null, null, 'notification');
+            if ($dbman->field_exists($table, $field)) {
+                $dbman->change_field_type($table, $field);
+            }
+        }
+
+        // Check if we need to fix the contexturl field
+        if (array_key_exists('contexturlname', $columns) && strpos($columns['contexturlname']->type, 'text') === false) {
+            // contexturlname should be text
+            // Fixed in earlier upgrade code
+            $field = new xmldb_field('contexturlname', XMLDB_TYPE_TEXT, 'small', null, null, null, null, 'contexturl');
+            if ($dbman->field_exists($table, $field)) {
+                $dbman->change_field_type($table, $field);
+            }
+        }
+
+        // Main savepoint reached
+        upgrade_main_savepoint(true, 2011011405);
+    }
+
+    if ($oldversion < 2011011406) {
+        // Fix discrepancies in the my_pages table after upgrade from 1.9
+        $columns = $DB->get_columns('my_pages');
+        $table = new xmldb_table('my_pages');
+
+        // Check if we need to fix the private column
+        if (array_key_exists('private', $columns) && $columns['private']->default_value != '1') {
+            // private should be default 1
+            // Fixed in earlier upgrade code
+            $field = new xmldb_field('private', XMLDB_TYPE_INTEGER, 1, XMLDB_UNSIGNED, XMLDB_NOTNULL, null, 1, 'name');
+            $index = new xmldb_index('user_idx', XMLDB_INDEX_NOTUNIQUE, array('userid','private'));
+            if ($dbman->index_exists($table, $index)) {
+                $dbman->drop_index($table, $index);
+            }
+            if ($dbman->field_exists($table, $field)) {
+                $dbman->change_field_default($table, $field);
+            }
+            $dbman->add_index($table, $index);
+        }
+
+        // Check if we need to fix the sortorder field
+        if (array_key_exists('sortorder', $columns) && !empty($columns['sortorder']->unsigned)) {
+            // Sortorder should not be unsigned
+            // Fixed in earlier upgrade code
+            $field = new xmldb_field('sortorder', XMLDB_TYPE_INTEGER, 6, null, XMLDB_NOTNULL, null, 0, 'private');
+            if ($dbman->field_exists($table, $field)) {
+                $dbman->change_field_notnull($table, $field);
+            }
+        }
+
+        upgrade_main_savepoint(true, 2011011406);
+    }
+
+    if ($oldversion < 2011011407) {
+        // Check if we need to fix post.uniquehash
+        $columns = $DB->get_columns('my_pages');
+        if (array_key_exists('uniquehash', $columns) && $columns['uniquehash']->max_length != 128) {
+            // Fix discrepancies in the post table after upgrade from 1.9
+            $table = new xmldb_table('post');
+
+            // Uniquehash should be 128 chars
+            // Fixed in earlier upgrade code
+            $field = new xmldb_field('uniquehash', XMLDB_TYPE_CHAR, 128, null, XMLDB_NOTNULL, null, null, 'content');
+            if ($dbman->field_exists($table, $field)) {
+                $dbman->change_field_precision($table, $field);
+            }
+        }
+
+        upgrade_main_savepoint(true, 2011011407);
+    }
+
+    if ($oldversion < 2011011408) {
+        // Fix question in the post table after upgrade from 1.9
+        $columns = $DB->get_columns('question');
+        $table = new xmldb_table('question');
+
+        // Check if we need to fix default grade
+        if (array_key_exists('defaultgrade', $columns) && (
+                empty($columns['defaultgrade']->unsigned) || 
+                empty($columns['defaultgrade']->not_null) || 
+                $columns['defaultgrade']->default_value !== '1.0000000')) {
+            // defaultgrade should be unsigned NOT NULL DEFAULT '1.0000000'
+            // Fixed in earlier upgrade code
+            $field = new xmldb_field('defaultgrade', XMLDB_TYPE_NUMBER, '12, 7', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '1.0000000', 'generalfeedbackformat');
+            if ($dbman->field_exists($table, $field)) {
+                $dbman->change_field_default($table, $field);
+            }
+        }
+
+        // Check if we need to fix penalty
+        if (array_key_exists('penalty', $columns) && (empty($columns['penalty']->not_null) || $columns['penalty']->default_value !== '0.1000000')) {
+            // penalty should be NOT NULL DEFAULT '0.1000000'
+            // Fixed in earlier upgrade code
+            $field = new xmldb_field('penalty', XMLDB_TYPE_NUMBER, '12, 7', null, XMLDB_NOTNULL, null, '0.1000000', 'defaultgrade');
+            if ($dbman->field_exists($table, $field)) {
+                $dbman->change_field_default($table, $field);
+            }
+        }
+
+        upgrade_main_savepoint(true, 2011011408);
+    }
+
+    if ($oldversion < 2011011409) {
+        // Fix question_answers in the post table after upgrade from 1.9
+        $columns = $DB->get_columns('question_answers');
+        $table = new xmldb_table('question_answers');
+
+        if (array_key_exists('fraction', $columns) && empty($columns['fraction']->not_null)) {
+            // fraction should be NOT NULL DEFAULT '0.0000000',
+            // Fixed in earlier upgrade code
+            $field = new xmldb_field('fraction', XMLDB_TYPE_NUMBER, '12, 7', null, XMLDB_NOTNULL, null, '0', 'feedback');
+            if ($dbman->field_exists($table, $field)) {
+                $dbman->change_field_default($table, $field);
+            }
+        }
+
+        upgrade_main_savepoint(true, 2011011409);
+    }
+
+    if ($oldversion < 2011011410) {
+        // Fix question_sessions in the post table after upgrade from 1.9
+        $columns = $DB->get_columns('question_sessions');
+        $table = new xmldb_table('question_sessions');
+
+        // Check if we need to fix sumpenalty
+        if (array_key_exists('sumpenalty', $columns) && empty($columns['sumpenalty']->not_null)) {
+            // sumpenalty should be NOT NULL DEFAULT '0.0000000',
+            // Fixed in earlier upgrade code
+            $field = new xmldb_field('sumpenalty', XMLDB_TYPE_NUMBER, '12, 7', null, XMLDB_NOTNULL, null, '0', 'newgraded');
+            if ($dbman->field_exists($table, $field)) {
+                $dbman->change_field_default($table, $field);
+            }
+        }
+
+        upgrade_main_savepoint(true, 2011011410);
+    }
+
+    if ($oldversion < 2011011411) {
+        // Fix question_states in the post table after upgrade from 1.9
+        $columns = $DB->get_columns('question_states');
+        $table = new xmldb_table('question_states');
+
+        // Check if we need to fix grade
+        if (array_key_exists('grade', $columns) && empty($columns['grade']->not_null)) {
+            // grade should be NOT NULL DEFAULT '0.0000000',
+            // Fixed in earlier upgrade code
+            $field = new xmldb_field('grade', XMLDB_TYPE_NUMBER, '12, 7', null, XMLDB_NOTNULL, null, '0', 'event');
+            if ($dbman->field_exists($table, $field)) {
+                $dbman->change_field_default($table, $field);
+            }
+        }
+
+        // Check if we need to fix raw_grade
+        if (array_key_exists('raw_grade', $columns) && empty($columns['raw_grade']->not_null)) {
+            // raw_grade should be NOT NULL DEFAULT '0.0000000',
+            // Fixed in earlier upgrade code
+            $field = new xmldb_field('raw_grade', XMLDB_TYPE_NUMBER, '12, 7', null, XMLDB_NOTNULL, null, '0', 'grade');
+            if ($dbman->field_exists($table, $field)) {
+                $dbman->change_field_default($table, $field);
+            }
+        }
+
+        // Check if we need to fix raw_grade
+        if (array_key_exists('penalty', $columns) && empty($columns['penalty']->not_null)) {
+            // penalty should be NOT NULL DEFAULT '0.0000000',
+            // Fixed in earlier upgrade code
+            $field = new xmldb_field('penalty', XMLDB_TYPE_NUMBER, '12, 7', null, XMLDB_NOTNULL, null, '0', 'raw_grade');
+            if ($dbman->field_exists($table, $field)) {
+                $dbman->change_field_default($table, $field);
+            }
+        }
+
+        upgrade_main_savepoint(true, 2011011411);
+    }
+
+    if ($oldversion < 2011011412) {
+        // Fix tag_instance in the post table after upgrade from 1.9
+        $columns = $DB->get_columns('tag_instance');
+        $table = new xmldb_table('tag_instance');
+
+        // Check if we need to fix tiuserid
+        if (array_key_exists('tiuserid', $columns) && !empty($columns['tiuserid']->has_default)) {
+            // tiuserid should have no default
+            // Fixed in earlier upgrade code
+            $field = new xmldb_field('tiuserid', XMLDB_TYPE_INTEGER, 10, XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, 'itemid');
+            $index = new xmldb_index('itemtype-itemid-tagid-tiuserid', XMLDB_INDEX_UNIQUE, array('itemtype', 'itemid', 'tagid', 'tiuserid'));
+            if ($dbman->index_exists($table, $index)) {
+                $dbman->drop_index($table, $index);
+            }
+            if ($dbman->field_exists($table, $field)) {
+                $dbman->change_field_default($table, $field);
+            }
+            $dbman->add_index($table, $index);
+        }
+
+        upgrade_main_savepoint(true, 2011011412);
+    }
+
+    if ($oldversion < 2011011413) {
+        // Fix user_info_field in the post table after upgrade from 1.9
+        $table = new xmldb_table('user_info_field');
+
+        // Missing field descriptionformat
+        // Fixed in earlier upgrade code
+        $field = new xmldb_field('descriptionformat', XMLDB_TYPE_INTEGER, 2, XMLDB_UNSIGNED, XMLDB_NOTNULL, null, 0, 'description');
+        if (!$dbman->field_exists($table, $field)) {
+            $dbman->add_field($table, $field);
+        }
+
+        upgrade_main_savepoint(true, 2011011413);
+    }
+
+    if ($oldversion < 2011011414) {
+        // Drop the adodb_logsql table if it exists... it was never actually used anyway.
+        $table = new xmldb_table('adodb_logsql');
+
+        if ($dbman->table_exists($table)) {
+            $dbman->drop_table($table);
+        }
+
+        upgrade_main_savepoint(true, 2011011414);
+    }
+    
+    if ($oldversion < 2011011415) {
+        //create the rating table indexes if required
+        $table = new xmldb_table('rating');
+        
+        $index = new xmldb_index('itemid', XMLDB_INDEX_NOTUNIQUE, array('itemid'));
+        if (!$dbman->index_exists($table, $index)) {
+            $dbman->add_index($table, $index);
+            
+            $key = new xmldb_key('contextid', XMLDB_KEY_FOREIGN, array('contextid'), 'context', array('id'));
+            $dbman->add_key($table, $key);
+            
+            $key = new xmldb_key('userid', XMLDB_KEY_FOREIGN, array('userid'), 'user', array('id'));
+            $dbman->add_key($table, $key);
+        }
+        
+        upgrade_main_savepoint(true, 2011011415);
+    }
+
     return true;
 }
 
index d4cb065..b22ca09 100644 (file)
@@ -264,15 +264,21 @@ class mysqli_native_moodle_database extends moodle_database {
         }
 
         $this->store_settings($dbhost, $dbuser, $dbpass, $dbname, $prefix, $dboptions);
-        unset($this->dboptions['dbsocket']);
 
+        // dbsocket is used ONLY if host is NULL or 'localhost',
+        // you can not disable it because it is always tried if dbhost is 'localhost'
+        if (!empty($this->dboptions['dbsocket']) and strpos($this->dboptions['dbsocket'], '/') !== false) {
+            $dbsocket = $this->dboptions['dbsocket'];
+        } else {
+            $dbsocket = ini_get('mysqli.default_socket');
+        }
         if (empty($this->dboptions['dbport'])) {
             $dbport = ini_get('mysqli.default_port');
         } else {
             $dbport = (int)$this->dboptions['dbport'];
         }
         ob_start();
-        $this->mysqli = new mysqli($dbhost, $dbuser, $dbpass, $dbname, $dbport);
+        $this->mysqli = new mysqli($dbhost, $dbuser, $dbpass, $dbname, $dbport, $dbsocket);
         $dberr = ob_get_contents();
         ob_end_clean();
         $errorno = @$this->mysqli->connect_errno;
index d78bf57..030e954 100644 (file)
@@ -138,8 +138,11 @@ class pgsql_native_moodle_database extends moodle_database {
         // Unix socket connections should have lower overhead
         if (!empty($this->dboptions['dbsocket']) and ($this->dbhost === 'localhost' or $this->dbhost === '127.0.0.1')) {
             $connection = "user='$this->dbuser' password='$pass' dbname='$this->dbname'";
+            if (strpos($this->dboptions['dbsocket'], '/') !== false) {
+                $connection = $connection." host='".$this->dboptions['dbsocket']."'";
+            }
         } else {
-            $this->dboptions['dbsocket'] = 0;
+            $this->dboptions['dbsocket'] = '';
             if (empty($this->dbname)) {
                 // probably old style socket connection - do not add port
                 $port = "";
index fde432c..f530b04 100644 (file)
@@ -716,7 +716,8 @@ function environment_check_php_settings($version, $env_select) {
         $result = new environment_results('php_setting');
         $result->setStatus(false);
         $result->setErrorCode(NO_VERSION_DATA_FOUND);
-        return $result;
+        $results[] = $result;
+        return $results;
     }
 
 /// Extract the php_setting part
index 0e0cc3a..dd9bbef 100644 (file)
@@ -792,10 +792,9 @@ function clean_param($param, $type) {
             }
 
         case PARAM_TAG:
-            //as long as magic_quotes_gpc is used, a backslash will be a
-            //problem, so remove *all* backslash.
-            //$param = str_replace('\\', '', $param);
-            //remove some nasties
+            // Please note it is not safe to use the tag name directly anywhere,
+            // it must be processed with s(), urlencode() before embedding anywhere.
+            // remove some nasties
             $param = preg_replace('~[[:cntrl:]]|[<>`]~u', '', $param);
             //convert many whitespace chars into one
             $param = preg_replace('/\s+/', ' ', $param);
@@ -803,7 +802,6 @@ function clean_param($param, $type) {
             $param = $textlib->substr(trim($param), 0, TAG_MAX_LENGTH);
             return $param;
 
-
         case PARAM_TAGLIST:
             $tags = explode(',', $param);
             $result = array();
index 7ae7766..ad3d5c5 100644 (file)
@@ -180,6 +180,8 @@ class CheckSpecifiedFieldsExpectation extends SimpleExpectation {
                 // OK
             } else if (is_null($value) && is_null($actual->$key)) {
                 // OK
+            } else if (!isset($actual->$key)) {
+                $mismatches[] = $key . ' (expected [' . $value . '] but was missing.';
             } else {
                 $mismatches[] = $key . ' (expected [' . $value . '] got [' . $actual->$key . '].';
             }
index 6ba05c7..d67eaf6 100644 (file)
@@ -69,7 +69,7 @@ if (!empty($course->summary)) {
     $options->noclean = false;
     $options->overflowdiv = true;
     print_collapsible_region_start('remotecourse summary', 'remotecourse-summary', get_string('coursesummary'), false, true);
-    echo format_text($course->summary, $course->summaryformat, $options,  $course->id);
+    echo format_text($course->summary, $course->summaryformat, $options);
     print_collapsible_region_end();
 }
 
@@ -192,4 +192,7 @@ if ($usecache) {
                                 get_string('refetch', 'mnetservice_enrol'), 'get');
 }
 
+echo $OUTPUT->single_button(new moodle_url('/mnet/service/enrol/host.php', array('id'=>$host->id)),
+                            get_string('availablecourseson', 'mnetservice_enrol', s($host->hostname)), 'get');
+
 echo $OUTPUT->footer();
index f5adbfc..b0c260a 100644 (file)
@@ -334,11 +334,12 @@ class mnetservice_enrol {
 
             // prune stale enrolment records
             if (empty($list)) {
-                $DB->delete_records('mnetservice_enrol_enrolments', array('hostid'=>$mnethostid));
+                $DB->delete_records('mnetservice_enrol_enrolments', array('hostid'=>$mnethostid, 'remotecourseid'=>$remotecourseid));
             } else {
                 list($isql, $params) = $DB->get_in_or_equal(array_keys($list), SQL_PARAMS_NAMED, 'param0000', false);
                 $params['hostid'] = $mnethostid;
-                $select = "hostid = :hostid AND id $isql";
+                $params['remotecourseid'] = $remotecourseid;
+                $select = "hostid = :hostid AND remotecourseid = :remotecourseid AND id $isql";
                 $DB->delete_records_select('mnetservice_enrol_enrolments', $select, $params);
             }
 
index 39dfb10..6d3b475 100644 (file)
@@ -195,7 +195,6 @@ M.mod_quiz.secure_window = {
             // Left click on a button or similar. No worries.
             return;
         }
-        alert(M.str.quiz.functiondisabledbysecuremode);
         e.halt();
     },
 
index d255b24..ab1d6e1 100644 (file)
@@ -18,7 +18,7 @@
         <FIELD NAME="grademethod" TYPE="int" LENGTH="2" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" PREVIOUS="maxgrade" NEXT="whatgrade"/>
         <FIELD NAME="whatgrade" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" PREVIOUS="grademethod" NEXT="maxattempt"/>
         <FIELD NAME="maxattempt" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="false" DEFAULT="1" SEQUENCE="false" PREVIOUS="whatgrade" NEXT="forcecompleted"/>
-        <FIELD NAME="forcecompleted" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="false" DEFAULT="1" SEQUENCE="false" PREVIOUS="maxattempt" NEXT="forcenewattempt"/>
+        <FIELD NAME="forcecompleted" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="false" DEFAULT="1" SEQUENCE="false" PREVIOUS="maxattempt" NEXT="forcenewattempt"/>
         <FIELD NAME="forcenewattempt" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" PREVIOUS="forcecompleted" NEXT="lastattemptlock"/>
         <FIELD NAME="lastattemptlock" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" PREVIOUS="forcenewattempt" NEXT="displayattemptstatus"/>
         <FIELD NAME="displayattemptstatus" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="false" DEFAULT="1" SEQUENCE="false" PREVIOUS="lastattemptlock" NEXT="displaycoursestructure"/>
       </KEYS>
     </TABLE>
   </TABLES>
-</XMLDB>
\ No newline at end of file
+</XMLDB>
index 7665300..ba04865 100644 (file)
 // Please do not forget to use upgrade_set_timeout()
 // before any action that may take longer time to finish.
 
+/**
+ * @global moodle_database $DB
+ * @param int $oldversion
+ * @return bool
+ */
 function xmldb_scorm_upgrade($oldversion) {
     global $CFG, $DB;
 
@@ -220,23 +225,23 @@ function xmldb_scorm_upgrade($oldversion) {
 
     /// Define new fields forcecompleted, forcenewattempt, displayattemptstatus, and displaycoursestructure to be added to scorm
         $table = new xmldb_table('scorm');
-        $field = new xmldb_field('forcecompleted', XMLDB_TYPE_INTEGER, '1', null, null, null, '0', 'maxattempt');
+        $field = new xmldb_field('forcecompleted', XMLDB_TYPE_INTEGER, 1, null, XMLDB_NOTNULL, null, 1, 'maxattempt');
         if (!$dbman->field_exists($table,$field)) {
             $dbman->add_field($table, $field);
         }
-        $field = new xmldb_field('forcenewattempt', XMLDB_TYPE_INTEGER, '1', null, null, null, '0', 'forcecompleted');
+        $field = new xmldb_field('forcenewattempt', XMLDB_TYPE_INTEGER, 1, null, XMLDB_NOTNULL, null, 0, 'forcecompleted');
         if (!$dbman->field_exists($table,$field)) {
             $dbman->add_field($table, $field);
         }
-        $field = new xmldb_field('lastattemptlock', XMLDB_TYPE_INTEGER, '1', null, null, null, '0', 'forcenewattempt');
+        $field = new xmldb_field('lastattemptlock', XMLDB_TYPE_INTEGER, 1, null, XMLDB_NOTNULL, null, 0, 'forcenewattempt');
         if (!$dbman->field_exists($table,$field)) {
             $dbman->add_field($table, $field);
         }
-        $field = new xmldb_field('displayattemptstatus', XMLDB_TYPE_INTEGER, '1', null, null, null, '1', 'lastattemptlock');
+        $field = new xmldb_field('displayattemptstatus', XMLDB_TYPE_INTEGER, 1, null, XMLDB_NOTNULL, null, 1, 'lastattemptlock');
         if (!$dbman->field_exists($table,$field)) {
             $dbman->add_field($table, $field);
         }
-        $field = new xmldb_field('displaycoursestructure', XMLDB_TYPE_INTEGER, '1', null, null, null, '1', 'displayattemptstatus');
+        $field = new xmldb_field('displaycoursestructure', XMLDB_TYPE_INTEGER, 1, null, XMLDB_NOTNULL, null, 1, 'displayattemptstatus');
         if (!$dbman->field_exists($table,$field)) {
             $dbman->add_field($table, $field);
         }
@@ -472,6 +477,58 @@ function xmldb_scorm_upgrade($oldversion) {
         /// scorm savepoint reached
         upgrade_mod_savepoint(true, 2010092400, 'scorm');
     }
+    
+    if ($oldversion < 2011011400) {
+        // Fix scorm in the post table after upgrade from 1.9
+        $table = new xmldb_table('scorm');
+        $columns = $DB->get_columns('scorm');
+
+        // forcecompleted should be bigint(1) NOT NULL DEFAULT '1'
+        // Fixed in earlier upgrade code
+        $field = new xmldb_field('forcecompleted', XMLDB_TYPE_INTEGER, 1, null, XMLDB_NOTNULL, null, 1, 'maxattempt');
+        if ($dbman->field_exists($table, $field)) {
+            $dbman->change_field_precision($table, $field);
+        }
+
+        if (array_key_exists('forcenewattempt', $columns) && empty($columns['forcenewattempt']->not_null)) {
+            // forcenewattempt should be NOT NULL
+            // Fixed in earlier upgrade code
+            $field = new xmldb_field('forcenewattempt', XMLDB_TYPE_INTEGER, 1, null, XMLDB_NOTNULL, null, 0, 'forcecompleted');
+            if ($dbman->field_exists($table, $field)) {
+                $dbman->change_field_notnull($table, $field);
+            }
+        }
+
+        if (array_key_exists('lastattemptlock', $columns) && empty($columns['lastattemptlock']->not_null)) {
+            // lastattemptlock should be NOT NULL
+            // Fixed in earlier upgrade code
+            $field = new xmldb_field('lastattemptlock', XMLDB_TYPE_INTEGER, 1, null, XMLDB_NOTNULL, null, 0, 'forcenewattempt');
+            if ($dbman->field_exists($table, $field)) {
+                $dbman->change_field_notnull($table, $field);
+            }
+        }
+
+        if (array_key_exists('displayattemptstatus', $columns) && empty($columns['displayattemptstatus']->not_null)) {
+            // displayattemptstatus should be NOT NULL
+            // Fixed in earlier upgrade code
+            $field = new xmldb_field('displayattemptstatus', XMLDB_TYPE_INTEGER, 1, null, XMLDB_NOTNULL, null, 1, 'lastattemptlock');
+            if ($dbman->field_exists($table, $field)) {
+                $dbman->change_field_notnull($table, $field);
+            }
+        }
+
+        if (array_key_exists('displaycoursestructure', $columns) && empty($columns['displaycoursestructure']->not_null)) {
+            // displaycoursestructure should be NOT NULL
+            // Fixed in earlier upgrade code
+            $field = new xmldb_field('displaycoursestructure', XMLDB_TYPE_INTEGER, 1, null, XMLDB_NOTNULL, null, 1, 'displayattemptstatus');
+            if ($dbman->field_exists($table, $field)) {
+                $dbman->change_field_notnull($table, $field);
+            }
+        }
+
+        upgrade_mod_savepoint(true, 2011011400, 'scorm');
+    }
+
     return true;
 }
 
old mode 100755 (executable)
new mode 100644 (file)
index 43fcfe2..9cb06b0
@@ -6,7 +6,7 @@
 /////////////////////////////////////////////////////////////////////////////////
 
 
-$module->version  = 2010092400;   // The (date) version of this module
+$module->version  = 2011011400;   // The (date) version of this module
 $module->requires = 2010080300;   // The version of Moodle that is required
 $module->cron     = 300;            // How often should cron check this module (seconds)?
 
index 2a30f02..6a541de 100644 (file)
@@ -32,7 +32,10 @@ $string['allocationsettings'] = 'Allocation settings';
 $string['assessmentdeleteddetail'] = 'Assessment deallocated: <strong>{$a->reviewername}</strong> is no longer reviewer of <strong>{$a->authorname}</strong>';
 $string['assesswosubmission'] = 'Participants can assess without having submitted anything';
 $string['confignumofreviews'] = 'Default number of submissions to be randomly allocated';
+$string['excludesamegroup'] = 'Prevent reviews by peers from the same group';
 $string['noallocationtoadd'] = 'No allocations to add';
+$string['nogroupusers'] = '<p>Warning: If the workshop is in \'visible groups\' mode or \'separate groups\' mode, then users MUST be part of at least one group to have peer-assessments allocated to them by this tool. Non-grouped users can still be given new self-assessments or have existing assessments removed.</p>
+<p>These users are currently not in a group: {$a}</p>';
 $string['numofdeallocatedassessment'] = 'Deallocating {$a} assessment(s)';
 $string['numofrandomlyallocatedsubmissions'] = 'Randomly allocating {$a} submissions';
 $string['numofreviews'] = 'Number of reviews';
index 5f65b29..13a4185 100644 (file)
@@ -76,6 +76,7 @@ class workshop_random_allocator implements workshop_allocator {
             $o                  = array();      // list of output messages
             $numofreviews       = required_param('numofreviews', PARAM_INT);
             $numper             = required_param('numper', PARAM_INT);
+            $excludesamegroup   = optional_param('excludesamegroup', false, PARAM_BOOL);
             $removecurrent      = optional_param('removecurrent', false, PARAM_BOOL);
             $assesswosubmission = optional_param('assesswosubmission', false, PARAM_BOOL);
             $addselfassessment  = optional_param('addselfassessment', false, PARAM_BOOL);
@@ -96,7 +97,11 @@ class workshop_random_allocator implements workshop_allocator {
                 } else {
                     $curassessments = $assessments;
                 }
-                $randomallocations  = $this->random_allocation($authors, $reviewers, $curassessments, $numofreviews, $numper, $o);
+                $options                     = array();
+                $options['numofreviews']     = $numofreviews;
+                $options['numper']           = $numper;
+                $options['excludesamegroup'] = $excludesamegroup;
+                $randomallocations  = $this->random_allocation($authors, $reviewers, $curassessments, $o, $options);
                 $newallocations     = array_merge($newallocations, $randomallocations);
                 $o[] = 'ok::' . get_string('numofrandomlyallocatedsubmissions', 'workshopallocation_random', count($randomallocations));
                 unset($randomallocations);
@@ -178,10 +183,37 @@ class workshop_random_allocator implements workshop_allocator {
         $this->mform->display();
         $out .= ob_get_contents();
         ob_end_clean();
-        $out .= $output->container_end();
+
+        // if there are some not-grouped participant in a group mode, warn the user
+        $gmode = groups_get_activity_groupmode($this->workshop->cm, $this->workshop->course);
+        if (VISIBLEGROUPS == $gmode or SEPARATEGROUPS == $gmode) {
+            $users = $this->workshop->get_potential_authors() + $this->workshop->get_potential_reviewers();
+            $users = $this->workshop->get_grouped($users);
+            if (isset($users[0])) {
+                $nogroupusers = $users[0];
+                foreach ($users as $groupid => $groupusers) {
+                    if ($groupid == 0) {
+                        continue;
+                    }
+                    foreach ($groupusers as $groupuserid => $groupuser) {
+                        unset($nogroupusers[$groupuserid]);
+                    }
+                }
+                if (!empty($nogroupusers)) {
+                    $list = array();
+                    foreach ($nogroupusers as $nogroupuser) {
+                        $list[] = fullname($nogroupuser);
+                    }
+                    $a = implode(', ', $list);
+                    $out .= $output->box(get_string('nogroupusers', 'workshopallocation_random', $a), 'generalbox warning nogroupusers');
+                }
+            }
+        }
 
         // TODO $out .= $output->heading(get_string('stats', 'workshopallocation_random'));
 
+        $out .= $output->container_end();
+
         return $out;
     }
 
@@ -371,19 +403,27 @@ class workshop_random_allocator implements workshop_allocator {
      * is to connect each "circle" (circles are representing either authors or reviewers) with a required
      * number of "squares" (the other type than circles are).
      *
+     * The passed $options array must provide keys:
+     *      (int)numofreviews - number of reviews to be allocated to each circle
+     *      (int)numper - what user type the circles represent.
+     *      (bool)excludesamegroup - whether to prevent peer submissions from the same group in visible group mode
+     *
      * @param array    $authors      structure of grouped authors
      * @param resource $reviewers    structure of grouped reviewers
      * @param array    $assessments  currently assigned assessments to be kept
-     * @param mixed    $numofreviews number of reviews to be allocated to each circle
-     * @param mixed    $numper       what user type the circles represent
      * @param array    $o            reference to an array of log messages
+     * @param array    $options      allocation options
      * @return array                 array of (reviewerid => authorid) pairs
      */
-    protected function random_allocation($authors, $reviewers, $assessments, $numofreviews, $numper, &$o) {
+    protected function random_allocation($authors, $reviewers, $assessments, &$o, array $options) {
         if (empty($authors) || empty($reviewers)) {
             // nothing to be done
             return array();
         }
+
+        $numofreviews = $options['numofreviews'];
+        $numper       = $options['numper'];
+
         if (self::USERTYPE_AUTHOR == $numper) {
             // circles are authors, squares are reviewers
             $o[] = 'info::Trying to allocate ' . $numofreviews . ' review(s) per author'; // todo translate
@@ -401,6 +441,22 @@ class workshop_random_allocator implements workshop_allocator {
         } else {
             throw new moodle_exception('unknownusertypepassed', 'workshop');
         }
+        // get the users that are not in any group. in visible groups mode, these users are exluded
+        // from allocation by this method
+        // $nogroupcircles is array (int)$userid => undefined
+        if (isset($allcircles[0])) {
+            $nogroupcircles = array_flip(array_keys($allcircles[0]));
+        } else {
+            $nogroupcircles = array();
+        }
+        foreach ($allcircles as $circlegroupid => $circles) {
+            if ($circlegroupid == 0) {
+                continue;
+            }
+            foreach ($circles as $circleid => $circle) {
+                unset($nogroupcircles[$circleid]);
+            }
+        }
         // $o[] = 'debug::circle links = ' . json_encode($circlelinks);
         // $o[] = 'debug::square links = ' . json_encode($squarelinks);
         $squareworkload         = array();  // individual workload indexed by squareid
@@ -428,76 +484,96 @@ class workshop_random_allocator implements workshop_allocator {
             // all users will be processed at once
             $circlegroups = array(0);
         }
-        $this->shuffle_assoc($circlegroups);
         // $o[] = 'debug::circle groups = ' . json_encode($circlegroups);
         foreach ($circlegroups as $circlegroupid) {
             $o[] = 'debug::processing circle group id ' . $circlegroupid;
             $circles = $allcircles[$circlegroupid];
-            $this->shuffle_assoc($circles);
-            foreach ($circles as $circleid => $circle) {
-                $o[] = 'debug::processing circle id ' . $circleid;
-                if (!isset($circlelinks[$circleid])) {
-                    $circlelinks[$circleid] = array();
-                }
-                $keeptrying     = true;     // is there a chance to find a square for this circle?
-                $failedgroups   = array();  // array of groupids where the square should be chosen from (because
-                                            // of their group workload) but it was not possible (for example there
-                                            // was the only square and it had been already connected
-                while ($keeptrying && (count($circlelinks[$circleid]) < $numofreviews)) {
-                    // firstly, choose a group to pick the square from
-                    if (NOGROUPS == $gmode) {
-                        if (in_array(0, $failedgroups)) {
-                            $keeptrying = false;
-                            $o[] = 'error::indent::No more peers available'; // todo translate
-                            break;
+            // iterate over all circles in the group until the requested number of links per circle exists
+            // or it is not possible to fulfill that requirment
+            // during the first iteration, we try to make sure that at least one circlelink exists. during the
+            // second iteration, we try to allocate two, etc.
+            for ($requiredreviews = 1; $requiredreviews <= $numofreviews; $requiredreviews++) {
+                $this->shuffle_assoc($circles);
+                $o[] = 'debug::iteration ' . $requiredreviews;
+                foreach ($circles as $circleid => $circle) {
+                    if (VISIBLEGROUPS == $gmode and isset($nogroupcircles[$circleid])) {
+                        $o[] = 'debug::skipping circle id ' . $circleid;
+                        continue;
+                    }
+                    $o[] = 'debug::processing circle id ' . $circleid;
+                    if (!isset($circlelinks[$circleid])) {
+                        $circlelinks[$circleid] = array();
+                    }
+                    $keeptrying     = true;     // is there a chance to find a square for this circle?
+                    $failedgroups   = array();  // array of groupids where the square should be chosen from (because
+                                                // of their group workload) but it was not possible (for example there
+                                                // was the only square and it had been already connected
+                    while ($keeptrying && (count($circlelinks[$circleid]) < $requiredreviews)) {
+                        // firstly, choose a group to pick the square from
+                        if (NOGROUPS == $gmode) {
+                            if (in_array(0, $failedgroups)) {
+                                $keeptrying = false;
+                                $o[] = 'error::indent::No more peers available'; // todo translate
+                                break;
+                            }
+                            $targetgroup = 0;
+                        } elseif (SEPARATEGROUPS == $gmode) {
+                            if (in_array($circlegroupid, $failedgroups)) {
+                                $keeptrying = false;
+                                $o[] = 'error::indent::No more peers available in this separate group'; // todo translate
+                                break;
+                            }
+                            $targetgroup = $circlegroupid;
+                        } elseif (VISIBLEGROUPS == $gmode) {
+                            $trygroups = array_diff_key($squaregroupsworkload, array(0 => null));   // all but [0]
+                            $trygroups = array_diff_key($trygroups, array_flip($failedgroups));     // without previous failures
+                            if ($options['excludesamegroup']) {
+                                // exclude groups the circle is member of
+                                $excludegroups = array();
+                                foreach (array_diff_key($allcircles, array(0 => null)) as $exgroupid => $exgroupmembers) {
+                                    if (array_key_exists($circleid, $exgroupmembers)) {
+                                        $excludegroups[$exgroupid] = null;
+                                    }
+                                }
+                                $trygroups = array_diff_key($trygroups, $excludegroups);
+                            }
+                            $targetgroup = $this->get_element_with_lowest_workload($trygroups);
                         }
-                        $targetgroup = 0;
-                    } elseif (SEPARATEGROUPS == $gmode) {
-                        if (in_array($circlegroupid, $failedgroups)) {
+                        if ($targetgroup === false) {
                             $keeptrying = false;
-                            $o[] = 'error::indent::No more peers available in this separate group'; // todo translate
+                            $o[] = 'error::indent::Not enough peers available'; // todo translate
                             break;
                         }
-                        $targetgroup = $circlegroupid;
-                    } elseif (VISIBLEGROUPS == $gmode) {
-                        $trygroups = array_diff_key($squaregroupsworkload, array(0 => null));   // all but [0]
-                        $trygroups = array_diff_key($trygroups, array_flip($failedgroups));     // without previous failures
-                        $targetgroup = $this->get_element_with_lowest_workload($trygroups);
-                    }
-                    if ($targetgroup === false) {
-                        $keeptrying = false;
-                        $o[] = 'error::indent::Not enough peers available'; // todo translate
-                        break;
-                    }
-                    $o[] = 'debug::indent::next square should be from group id ' . $targetgroup;
-                    // now, choose a square from the target group
-                    $trysquares = array_intersect_key($squareworkload, $allsquares[$targetgroup]);
-                    // $o[] = 'debug::indent::individual workloads in this group are ' . json_encode($trysquares);
-                    unset($trysquares[$circleid]);  // can't allocate to self
-                    $trysquares = array_diff_key($trysquares, array_flip($circlelinks[$circleid])); // can't re-allocate the same
-                    $targetsquare = $this->get_element_with_lowest_workload($trysquares);
-                    if (false === $targetsquare) {
-                        $o[] = 'debug::indent::unable to find an available square. trying another group';
-                        $failedgroups[] = $targetgroup;
-                        continue;
-                    }
-                    $o[] = 'debug::indent::target square = ' . $targetsquare;
-                    // ok - we have found the square
-                    $circlelinks[$circleid][]       = $targetsquare;
-                    $squarelinks[$targetsquare][]   = $circleid;
-                    $squareworkload[$targetsquare]++;
-                    $o[] = 'debug::indent::increasing square workload to ' . $squareworkload[$targetsquare];
-                    if ($targetgroup) {
-                        // recalculate the group workload
-                        $squaregroupsworkload[$targetgroup] = 0;
-                        foreach ($allsquares[$targetgroup] as $squareid => $square) {
-                            $squaregroupsworkload[$targetgroup] += $squareworkload[$squareid];
+                        $o[] = 'debug::indent::next square should be from group id ' . $targetgroup;
+                        // now, choose a square from the target group
+                        $trysquares = array_intersect_key($squareworkload, $allsquares[$targetgroup]);
+                        // $o[] = 'debug::indent::individual workloads in this group are ' . json_encode($trysquares);
+                        unset($trysquares[$circleid]);  // can't allocate to self
+                        $trysquares = array_diff_key($trysquares, array_flip($circlelinks[$circleid])); // can't re-allocate the same
+                        $targetsquare = $this->get_element_with_lowest_workload($trysquares);
+                        if (false === $targetsquare) {
+                            $o[] = 'debug::indent::unable to find an available square. trying another group';
+                            $failedgroups[] = $targetgroup;
+                            continue;
                         }
-                        $squaregroupsworkload[$targetgroup] /= count($allsquares[$targetgroup]);
-                        $o[] = 'debug::indent::increasing group workload to ' . $squaregroupsworkload[$targetgroup];
-                    }
-                } // end of processing this circle
-            } // end of processing circles in the group
+                        $o[] = 'debug::indent::target square = ' . $targetsquare;
+                        // ok - we have found the square
+                        $circlelinks[$circleid][]       = $targetsquare;
+                        $squarelinks[$targetsquare][]   = $circleid;
+                        $squareworkload[$targetsquare]++;
+                        $o[] = 'debug::indent::increasing square workload to ' . $squareworkload[$targetsquare];
+                        if ($targetgroup) {
+                            // recalculate the group workload
+                            $squaregroupsworkload[$targetgroup] = 0;
+                            foreach ($allsquares[$targetgroup] as $squareid => $square) {
+                                $squaregroupsworkload[$targetgroup] += $squareworkload[$squareid];
+                            }
+                            $squaregroupsworkload[$targetgroup] /= count($allsquares[$targetgroup]);
+                            $o[] = 'debug::indent::increasing group workload to ' . $squaregroupsworkload[$targetgroup];
+                        }
+                    } // end of processing this circle
+                } // end of one iteration of processing circles in the group
+            } // end of all iterations over circles in the group
         } // end of processing circle groups
         $returned = array();
         if (self::USERTYPE_AUTHOR == $numper) {
@@ -569,15 +645,14 @@ class workshop_random_allocator implements workshop_allocator {
     /**
      * Shuffle the order of array elements preserving the key=>values
      *
-     * @author rich at home dot nl
-     * @link http://php.net/manual/en/function.shuffle.php#80586
      * @param array $array to be shuffled
      * @return true
      */
     protected function shuffle_assoc(&$array) {
         if (count($array) > 1) {
             // $keys needs to be an array, no need to shuffle 1 item or empty arrays, anyway
-            $keys = array_rand($array, count($array));
+            $keys = array_keys($array);
+            shuffle($keys);
             foreach($keys as $key) {
                 $new[$key] = $array[$key];
             }
index 4b30f5b..3762e41 100644 (file)
@@ -74,6 +74,14 @@ class workshop_random_allocator_form extends moodleform {
         $mform->setDefault('numper', workshop_random_allocator::USERTYPE_AUTHOR);
         $mform->addGroup($grpnumofreviews, 'grpnumofreviews', get_string('numofreviews', 'workshopallocation_random'),
                 array(' '), false);
+
+        if (VISIBLEGROUPS == $gmode) {
+            $mform->addElement('checkbox', 'excludesamegroup', get_string('excludesamegroup', 'workshopallocation_random'));
+            $mform->setDefault('excludesamegroup', 0);
+        } else {
+            $mform->addElement('hidden', 'excludesamegroup', 0);
+        }
+
         $mform->addElement('checkbox', 'removecurrent', get_string('removecurrentallocations', 'workshopallocation_random'));
         $mform->setDefault('removecurrent', 0);
 
diff --git a/mod/workshop/allocation/random/styles.css b/mod/workshop/allocation/random/styles.css
new file mode 100644 (file)
index 0000000..e97804d
--- /dev/null
@@ -0,0 +1,4 @@
+.path-mod-workshop .random-allocator .warning {
+    width: 80%;
+    margin: 0px auto 15px auto;
+}
index 3b41373..306d557 100644 (file)
@@ -55,7 +55,9 @@ $PAGE->set_context($systemcontext);
 $PAGE->set_blocks_editing_capability('moodle/tag:editblocks');
 $PAGE->set_pagelayout('base');
 
+$PAGE->requires->yui2_lib('connection');
 $PAGE->requires->yui2_lib('animation');
+$PAGE->requires->yui2_lib('datasource');
 $PAGE->requires->yui2_lib('autocomplete');
 
 $tagname = tag_display_name($tag);
index 00533d7..ae9e4c0 100644 (file)
@@ -599,7 +599,7 @@ function tag_display_name($tagobject, $html=TAG_RETURN_HTML) {
 
     global $CFG;
 
-    if(!isset($tagobject->name)) {
+    if (!isset($tagobject->name)) {
         return '';
     }
 
@@ -612,6 +612,9 @@ function tag_display_name($tagobject, $html=TAG_RETURN_HTML) {
         $tagname = $tagobject->rawname;
     }
 
+    // clean up a bit just in case the rules change again
+    $tagname = clean_param($tagname, PARAM_TAG);
+
     if ($html == TAG_RETURN_TEXT) {
         return $tagname;
     } else { // TAG_RETURN_HTML
index ce8d23c..f55c2c3 100644 (file)
@@ -22,6 +22,8 @@
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
 
+define('AJAX_SCRIPT', true);
+
 require_once('../config.php');
 require_once('lib.php');
 
@@ -35,6 +37,6 @@ $query = optional_param('query', '', PARAM_RAW);
 
 if ($similar_tags = tag_autocomplete($query)) {
     foreach ($similar_tags as $tag) {
-        echo $tag->name . "\t" . tag_display_name($tag) . "\n";
+        echo clean_param($tag->name, PARAM_TAG) . "\t" . tag_display_name($tag) . "\n";
     }
 }
index a0c4952..d3b9b7a 100644 (file)
 /** Path: theme pagelayout **/
-
-
-
 body {margin:auto 0px;width:auto; height: 100%}
 #page {width:100%;overflow:hidden; min-height: 100%;}
 #page-content {
-       clear: both;
-       position: relative;
-       width: 100%;min-height: 100%;
+    clear: both;
+    position: relative;
+    width: 100%;min-height: 100%;
 }
 
 #page-content #region-main-box {
-       float: left;
-       margin-left: -200px;
-       position: relative;
-       width: 200%;
-       right: 100%;min-height: 100%;
+    float: left;
+    margin-left: -200px;
+    position: relative;
+    width: 200%;
+    right: 100%;min-height: 100%;
+}
+
+#page-content #region-post-box {
+    float: left;
+    margin-left: -200px;
+    width: 100%;min-height: 100%;
 }
 
-#page-content #region-main-box #region-post-box {
-       float: left;
-       margin-left: -200px;
-       width: 100%;min-height: 100%;
+#page-content #region-main-wrap {
+    float: left;
+    width: 50%;min-height: 100%;
 }
 
-#page-content #region-main-box #region-post-box #region-main-wrap {
-       float: left;
-       width: 50%;min-height: 100%;
+#page-content #region-main {
+    position: relative;
+    margin-left: 400px;
+    left: 100%;min-height: 100%;
 }
 
-#page-content #region-main-box #region-post-box #region-main-wrap #region-main {
-       
-       position: relative;
-       margin-left: 400px;
-       left: 100%;min-height: 100%;
+#page-content #region-pre {
+    float: right;
+    position: relative;
+    width: 200px;
+    left: 200px;
+    min-height: 100%;
 }
 
-#page-content #region-main-box #region-post-box #region-pre {
-       float: right;
-       position: relative;
-       width: 200px;
-       left: 200px;
-       min-height: 100%;
-       
+#page-content #region-post {
+    float: right;
+    position: relative;
+    left: 600px;
+    width: 200px;min-height: 100%;
 }
 
-#page-content #region-main-box #region-post-box #region-post {
-       float: right;
-       position: relative;
-       left: 600px;
-       width: 200px;min-height: 100%;
+#page-content #region-main .region-content {
+    overflow: hidden;
+    padding: 20px 20px 20px 0;min-height: 100%;
 }
 
-#page-content #region-main-box #region-post-box #region-main-wrap #region-main .region-content {
-       overflow: hidden;
-       padding: 20px 20px 20px 0;min-height: 100%;
+.pagelayout-report #page-content #region-main .region-content {
+    overflow: auto;
+    padding-bottom:0;
+    margin-bottom:20px;
 }
 
-#page-content #region-main-box #region-post-box #region-pre .region-content,
-#page-content #region-main-box #region-post-box #region-post .region-content {
-       overflow: hidden;
-       padding: 20px 10px;min-height: 100%;
+#page-content #region-pre .region-content,
+#page-content #region-post .region-content {
+    overflow: hidden;
+    padding: 20px 10px;
+    min-height: 100%;
 }
 
 #page-footer {
-       clear: both;
-       float: left;
-       width: 100%;
+    clear: both;
+    float: left;
+    width: 100%;
 }
 
 /** Only side pre **/
 
 .side-pre-only #page-content #region-main-box {
-       margin-left: 0px;
+    margin-left: 0px;
 }
 
 .side-pre-only #page-content #region-main-box #region-post-box {
-       margin-left: -200px;
+    margin-left: -200px;
 }
 
 .side-pre-only #page-content #region-main-box #region-post-box #region-main-wrap #region-main {
-       margin-left: 200px;
+    margin-left: 200px;
 }
 
 .side-pre-only #page-content #region-main-box #region-post-box #region-pre {
-       left: 200px;
-       width: 200px;
+    left: 200px;
+    width: 200px;
 }
 
 .side-pre-only #page-content #region-main-box #region-post-box #region-post {
-       width: 0%;
+    width: 0%;
 }
 
 /** Only side post **/
 
 .side-post-only #page-content #region-main-box {
-       margin-left: 0px;
-       
+    margin-left: 0px;
 }
 
 .side-post-only #page-content #region-main-box #region-post-box {
-       margin-left: -200px;
+    margin-left: -200px;
 }
 
 .side-post-only #page-content #region-main-box #region-post-box #region-main-wrap #region-main {
-       margin-left: 200px;
-       
+    margin-left: 200px;
 }
 
 .side-post-only #page-content #region-main-box #region-post-box #region-post {
-               left: 400px;
-               width: 200px;
+    left: 400px;
+    width: 200px;
 }
 
 .has_dock.side-post-only .page-middle #region-main-box #region-post-box #region-main-wrap #region-main {
-       margin-left: 200px;
+    margin-left: 200px;
 }
 
 /** No blocks whatsoever **/
 
 .content-only #page-content #region-main-box {
-       margin-left: 0px;
+    margin-left: 0px;
 }
 
 .content-only #page-content #region-main-box #region-post-box {
-       margin-left: 0px;
+    margin-left: 0px;
 }
 
 .content-only #page-content #region-main-box #region-post-box #region-main-wrap #region-main {
-       margin-left: 0px;
+    margin-left: 0px;
 }
 
 .content-only #page-content #region-main-box #region-post-box #region-pre {
-       width: 0px;
+    width: 0px;
 }
 
 .content-only #page-content #region-main-box #region-post-box #region-post {
-       width: 0px;
+    width: 0px;
 }
\ No newline at end of file
index cff03b5..8b50ac6 100644 (file)
@@ -29,7 +29,7 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$version = 2011011200;  // YYYYMMDD   = date of the last version bump
+$version = 2011011415;  // YYYYMMDD   = date of the last version bump
                         //         XX = daily increments
 
 $release = '2.0.1+ (Build: 20110112)';  // Human-friendly version name