]> git.mjollnir.org Git - moodle.git/commitdiff
dropping studentcanpost in glossary, MDL_7170
authortoyomoyo <toyomoyo>
Wed, 15 Nov 2006 03:15:59 +0000 (03:15 +0000)
committertoyomoyo <toyomoyo>
Wed, 15 Nov 2006 03:15:59 +0000 (03:15 +0000)
mod/glossary/backuplib.php
mod/glossary/db/install.xml
mod/glossary/db/upgrade.php
mod/glossary/deleteentry.php
mod/glossary/import.php
mod/glossary/lib.php
mod/glossary/restorelib.php
mod/glossary/version.php

index 8ad9dd81a3cf4baf8ca24530e11ddcdcd0504401..2f0c0b3f9fda4a714fe132d1f4b6b4362b8e2fd6 100644 (file)
@@ -63,7 +63,6 @@
         fwrite ($bf,full_tag("MODTYPE",4,false,"glossary"));
         fwrite ($bf,full_tag("NAME",4,false,$glossary->name));
         fwrite ($bf,full_tag("INTRO",4,false,$glossary->intro));
-        fwrite ($bf,full_tag("STUDENTCANPOST",4,false,$glossary->studentcanpost));
         fwrite ($bf,full_tag("ALLOWDUPLICATEDENTRIES",4,false,$glossary->allowduplicatedentries));
         fwrite ($bf,full_tag("DISPLAYFORMAT",4,false,$glossary->displayformat));
         fwrite ($bf,full_tag("MAINGLOSSARY",4,false,$glossary->mainglossary));
index 5db7489b3057719ea6da5269a24d94dcbb09ec29..9a3134c2f557ec4d690ef2badc894ebe7c389a5e 100644 (file)
@@ -1,14 +1,16 @@
 <?xml version="1.0" encoding="UTF-8" ?>
-<XMLDB PATH="mod/glossary/db" VERSION="20060811" COMMENT="XMLDB file for Moodle mod/glossary">
+<XMLDB PATH="mod/glossary/db" VERSION="20061114" COMMENT="XMLDB file for Moodle mod/glossary"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:noNamespaceSchemaLocation="../../../lib/xmldb/xmldb.xsd"
+>
   <TABLES>
     <TABLE NAME="glossary" COMMENT="all glossaries" NEXT="glossary_entries">
       <FIELDS>
         <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" ENUM="false" NEXT="course"/>
         <FIELD NAME="course" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="id" NEXT="name"/>
         <FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="course" NEXT="intro"/>
-        <FIELD NAME="intro" TYPE="text" LENGTH="small" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="name" NEXT="studentcanpost"/>
-        <FIELD NAME="studentcanpost" TYPE="int" LENGTH="2" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="intro" NEXT="allowduplicatedentries"/>
-        <FIELD NAME="allowduplicatedentries" TYPE="int" LENGTH="2" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="studentcanpost" NEXT="displayformat"/>
+        <FIELD NAME="intro" TYPE="text" LENGTH="small" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="name" NEXT="allowduplicatedentries"/>
+        <FIELD NAME="allowduplicatedentries" TYPE="int" LENGTH="2" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="intro" NEXT="displayformat"/>
         <FIELD NAME="displayformat" TYPE="char" LENGTH="50" NOTNULL="true" DEFAULT="dictionary" SEQUENCE="false" ENUM="false" PREVIOUS="allowduplicatedentries" NEXT="mainglossary"/>
         <FIELD NAME="mainglossary" TYPE="int" LENGTH="2" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="displayformat" NEXT="showspecial"/>
         <FIELD NAME="showspecial" TYPE="int" LENGTH="2" NOTNULL="true" UNSIGNED="true" DEFAULT="1" SEQUENCE="false" ENUM="false" PREVIOUS="mainglossary" NEXT="showalphabet"/>
       </SENTENCES>
     </STATEMENT>
   </STATEMENTS>
-</XMLDB>
+</XMLDB>
\ No newline at end of file
index e22f49c1fc0a4124663de19f9533b09ccaf13274..f8d09080f213e29c02846b07fac2995c12cc7770 100644 (file)
@@ -31,7 +31,17 @@ function xmldb_glossary_upgrade($oldversion=0) {
 /// if ($result && $oldversion < YYYYMMDD00) { //New version in version.php
 ///     $result = result of "/lib/ddllib.php" function calls
 /// }
+    
+    if ($result && $oldversion < 2006111400) {
 
+    /// Define field studentcanpost to be dropped from glossary
+        $table = new XMLDBTable('glossary');
+        $field = new XMLDBField('studentcanpost');
+
+    /// Launch drop field studentcanpost
+        $result = $result && drop_field($table, $field);
+    }  
+    
     return $result;
 }
 
index a9bf26b4441199fd9e956f10ac0b1d24df3d83d1..fc89e74d0db305ca0467487fb76cffe33be94be2 100644 (file)
@@ -49,7 +49,7 @@
         error("You can't delete other people's entries!");
     }
     $ineditperiod = ((time() - $entry->timecreated <  $CFG->maxeditingtime) || $glossary->editalways);
-    if ((!$ineditperiod or !$glossary->studentcanpost) and !$manageentries) {
+    if (!$ineditperiod and !$manageentries) {
         error("You can't delete this. Time expired!");
     }
 
index 1a83a4bca3407dbbb1ea272d5c79025a5253b4e7..fbc6f9acb2065efc1d24cbbd0e8683b7458dd882 100644 (file)
                 $glossary->timemodified = time();
 
                 // Setting the default values if no values were passed
-                if ( isset($xmlglossary['STUDENTCANPOST'][0]['#']) ) {
-                    $glossary->studentcanpost = addslashes($xmlglossary['STUDENTCANPOST'][0]['#']);
-                } else {
-                    $glossary->studentcanpost = $CFG->glossary_studentspost;
-                }
                 if ( isset($xmlglossary['ENTBYPAGE'][0]['#']) ) {
                     $glossary->entbypage = addslashes($xmlglossary['ENTBYPAGE'][0]['#']);
                 } else {
index 9f5b7ba2913e52f24d7678498e1567a494e0c0b1..3fe3caa96baf68b83c64b2a773ab3ca0b1436198 100644 (file)
@@ -1690,7 +1690,6 @@ function glossary_generate_export_file($glossary, $hook = "", $hook = 0) {
     $co .= glossary_start_tag("INFO",1,true);
         $co .= glossary_full_tag("NAME",2,false,$glossary->name);
         $co .= glossary_full_tag("INTRO",2,false,$glossary->intro);
-        $co .= glossary_full_tag("STUDENTCANPOST",2,false,$glossary->studentcanpost);
         $co .= glossary_full_tag("ALLOWDUPLICATEDENTRIES",2,false,$glossary->allowduplicatedentries);
         $co .= glossary_full_tag("DISPLAYFORMAT",2,false,$glossary->displayformat);
         $co .= glossary_full_tag("SHOWSPECIAL",2,false,$glossary->showspecial);
index acbdb368bbd30f2999f8f27911e289ea059be86b..7c93daa4d0c652c6368967ab4aa3f6d012d993bd 100644 (file)
@@ -53,7 +53,6 @@
             $glossary->course = $restore->course_id;
             $glossary->name = backup_todb($info['MOD']['#']['NAME']['0']['#']);
             $glossary->intro = backup_todb($info['MOD']['#']['INTRO']['0']['#']);
-            $glossary->studentcanpost = backup_todb($info['MOD']['#']['STUDENTCANPOST']['0']['#']);
             $glossary->allowduplicatedentries = backup_todb($info['MOD']['#']['ALLOWDUPLICATEDENTRIES']['0']['#']);
             $glossary->displayformat = backup_todb($info['MOD']['#']['DISPLAYFORMAT']['0']['#']);
             $glossary->mainglossary = backup_todb($info['MOD']['#']['MAINGLOSSARY']['0']['#']);
index 46d936902002b6c2c79c65a93678471028699638..38cbadc3915ff93457311047e1ec9a6013c03015 100644 (file)
@@ -5,7 +5,7 @@
 ///  This fragment is called by moodle_needs_upgrading() and /admin/index.php
 /////////////////////////////////////////////////////////////////////////////////
 
-$module->version  = 2006091801;
+$module->version  = 2006111400;
 $module->requires = 2006082600;  // Requires this Moodle version
 $module->cron     = 0;           // Period for cron to check this module (secs)