Skip to content

Commit

Permalink
MDL-18910 normalised module intro and introformat
Browse files Browse the repository at this point in the history
  • Loading branch information
skodak committed Apr 20, 2009
1 parent c119057 commit 65e7c87
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 8 deletions.
11 changes: 6 additions & 5 deletions mod/chat/db/install.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
<XMLDB PATH="mod/chat/db" VERSION="20070122" COMMENT="XMLDB file for Moodle mod/chat"
<XMLDB PATH="mod/chat/db" VERSION="20090420" COMMENT="XMLDB file for Moodle mod/chat"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../lib/xmldb/xmldb.xsd"
>
Expand All @@ -9,15 +9,16 @@
<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="keepdays"/>
<FIELD NAME="keepdays" TYPE="int" LENGTH="11" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="intro" NEXT="studentlogs"/>
<FIELD NAME="intro" TYPE="text" LENGTH="small" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="name" NEXT="introformat"/>
<FIELD NAME="introformat" TYPE="int" LENGTH="4" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" COMMENT="text format of intro field" PREVIOUS="intro" NEXT="keepdays"/>
<FIELD NAME="keepdays" TYPE="int" LENGTH="11" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="introformat" NEXT="studentlogs"/>
<FIELD NAME="studentlogs" TYPE="int" LENGTH="4" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="keepdays" NEXT="chattime"/>
<FIELD NAME="chattime" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="studentlogs" NEXT="schedule"/>
<FIELD NAME="schedule" TYPE="int" LENGTH="4" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="chattime" NEXT="timemodified"/>
<FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="schedule"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id" />
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
</KEYS>
<INDEXES>
<INDEX NAME="course" UNIQUE="false" FIELDS="course"/>
Expand Down Expand Up @@ -89,4 +90,4 @@
</INDEXES>
</TABLE>
</TABLES>
</XMLDB>
</XMLDB>
13 changes: 13 additions & 0 deletions mod/chat/db/upgrade.php
Expand Up @@ -71,6 +71,19 @@ function xmldb_chat_upgrade($oldversion) {
upgrade_mod_savepoint($result, 2009010600, 'chat');
}

if ($result && $oldversion < 2009042000) {

/// Define field introformat to be added to chat
$table = new xmldb_table('chat');
$field = new xmldb_field('introformat', XMLDB_TYPE_INTEGER, '4', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'intro');

/// Launch add field introformat
$dbman->add_field($table, $field);

/// chat savepoint reached
upgrade_mod_savepoint($result, 2009042000, 'chat');
}

return $result;
}

Expand Down
4 changes: 2 additions & 2 deletions mod/chat/version.php
Expand Up @@ -5,8 +5,8 @@
/// This fragment is called by moodle_needs_upgrading() and /admin/index.php
/////////////////////////////////////////////////////////////////////////////////

$module->version = 2009031100; // The (date) version of this module
$module->requires = 2007101509; // Requires this Moodle version
$module->version = 2009042000; // The (date) version of this module
$module->requires = 2009041700; // Requires this Moodle version
$module->cron = 300; // How often should cron check this module (seconds)?
?>
3 changes: 2 additions & 1 deletion mod/chat/view.php
Expand Up @@ -173,7 +173,8 @@
}

if ($chat->intro) {
print_box(format_text($chat->intro), 'generalbox', 'intro');
$options = (object)array('noclean'=>true);
print_box(format_text($chat->intro, $chat->introformat, $options), 'generalbox', 'intro');
}

chat_delete_old_users();
Expand Down

0 comments on commit 65e7c87

Please sign in to comment.