diff --git a/mod/chat/db/upgrade.php b/mod/chat/db/upgrade.php index dd1b40eef6b..6c26cc3efec 100644 --- a/mod/chat/db/upgrade.php +++ b/mod/chat/db/upgrade.php @@ -26,9 +26,36 @@ function xmldb_chat_upgrade($oldversion) { $dbman = $DB->get_manager(); $result = true; -//===== 1.9.0 upgrade line ======// + //===== 1.9.0 upgrade line ======// - if ($result && $oldversion < 2008072400) { + if ($result && $oldversion < 2010050100) { + + /// Changing precision of field ip on table chat_users to (45) + $table = new xmldb_table('chat_users'); + $field = new xmldb_field('ip', XMLDB_TYPE_CHAR, '45', null, XMLDB_NOTNULL, null, null, 'version'); + + /// Launch change of precision for field ip + $dbman->change_field_precision($table, $field); + + /// chat savepoint reached + upgrade_mod_savepoint($result, 2010050100, 'chat'); + } + + if ($result && $oldversion < 2010050101) { + + /// 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, '0', 'intro'); + + /// Launch add field introformat + $dbman->add_field($table, $field); + + /// chat savepoint reached + upgrade_mod_savepoint($result, 2010050101, 'chat'); + } + + /// Creating chat_messages_current to hold latest chat messages + if ($result && $oldversion < 2010050102) { /// Define table chat_messages_current to be created $table = new xmldb_table('chat_messages_current'); @@ -52,38 +79,13 @@ function xmldb_chat_upgrade($oldversion) { $table->add_index('timestamp-chatid', XMLDB_INDEX_NOTUNIQUE, array('timestamp', 'chatid')); /// create table for chat_messages_current - $dbman->create_table($table); + if (!$dbman->table_exists($table)) { + $dbman->create_table($table); + } /// chat savepoint reached - upgrade_mod_savepoint($result, 2008072400, 'chat'); + upgrade_mod_savepoint($result, 2010050102, 'chat'); } - - if ($result && $oldversion < 2009010600) { - - /// Changing precision of field ip on table chat_users to (45) - $table = new xmldb_table('chat_users'); - $field = new xmldb_field('ip', XMLDB_TYPE_CHAR, '45', null, XMLDB_NOTNULL, null, null, 'version'); - - /// Launch change of precision for field ip - $dbman->change_field_precision($table, $field); - - /// chat savepoint reached - 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, '0', 'intro'); - - /// Launch add field introformat - $dbman->add_field($table, $field); - - /// chat savepoint reached - upgrade_mod_savepoint($result, 2009042000, 'chat'); - } - return $result; } diff --git a/mod/chat/version.php b/mod/chat/version.php index 870b86ea106..15d1d16fadf 100644 --- a/mod/chat/version.php +++ b/mod/chat/version.php @@ -5,7 +5,7 @@ /// This fragment is called by moodle_needs_upgrading() and /admin/index.php ///////////////////////////////////////////////////////////////////////////////// -$module->version = 2009042000; // The (date) version of this module +$module->version = 2010050102; // The (date) version of this module $module->requires = 2009041700; // Requires this Moodle version $module->cron = 300; // How often should cron check this module (seconds)? diff --git a/mod/chat/view.php b/mod/chat/view.php index 41916aee5fd..347492523e8 100644 --- a/mod/chat/view.php +++ b/mod/chat/view.php @@ -112,18 +112,6 @@ if (has_capability('mod/chat:chat',$context)) { /// Print the main part of the page echo $OUTPUT->box_start('generalbox', 'enterlink'); - // users with screenreader set, will only see 1 link, to the manual refresh page - // for better accessibility - if (!empty($USER->screenreader)) { - $chattarget = "/mod/chat/gui_basic/index.php?id=$chat->id$groupparam"; - } else { - $chattarget = "/mod/chat/gui_$CFG->chat_method/index.php?id=$chat->id$groupparam"; - } - - echo '

'; - echo $OUTPUT->action_link($chattarget, $strenterchat, new popup_action('click', $chattarget, "chat$course->id$chat->id$groupparam", array('height' => 500, 'width' => 700))); - - echo '

'; if ($CFG->enableajax) { echo '

'; @@ -131,10 +119,23 @@ $link = new moodle_url("/mod/chat/gui_ajax/index.php?id=$chat->id$groupparam"); $action = new popup_action('click', $link, "chat$course->id$chat->id$groupparam", array('height' => 500, 'width' => 700, 'toolbar' => false, 'resizeable' => false, 'status' => false)); echo $OUTPUT->action_link($link, get_string('ajax_gui', 'message'), $action, array('title'=>get_string('modulename', 'chat'))); + echo '

'; + } else { + if (!empty($USER->screenreader)) { + $chattarget = "/mod/chat/gui_basic/index.php?id=$chat->id$groupparam"; + } else { + $chattarget = "/mod/chat/gui_$CFG->chat_method/index.php?id=$chat->id$groupparam"; + } + + echo '

'; + echo $OUTPUT->action_link($chattarget, $strenterchat, new popup_action('click', $chattarget, "chat$course->id$chat->id$groupparam", array('height' => 500, 'width' => 700))); + echo '

'; } // if user is using screen reader, then there is no need to display this link again + // users with screenreader set, will only see 1 link, to the manual refresh page + // for better accessibility if ($CFG->chat_method == 'header_js' && empty($USER->screenreader)) { // show frame/js-less alternative echo '

(';