diff --git a/admin/index.php b/admin/index.php index af41e667551..6bfba862b88 100644 --- a/admin/index.php +++ b/admin/index.php @@ -501,19 +501,7 @@ /// Check if the guest user exists. If not, create one. if (! record_exists("user", "username", "guest")) { - $guest->auth = "manual"; - $guest->username = "guest"; - $guest->password = md5("guest"); - $guest->firstname = addslashes(get_string("guestuser")); - $guest->lastname = " "; - $guest->email = "root@localhost"; - $guest->description = addslashes(get_string("guestuserinfo")); - $guest->mnethostid = $CFG->mnet_localhost_id; - $guest->confirmed = 1; - $guest->lang = $CFG->lang; - $guest->timemodified= time(); - - if (! $guest->id = insert_record("user", $guest)) { + if (! $guest = create_guest_record()) { notify("Could not create guest user record !!!"); } } diff --git a/auth/README2 b/auth/README2 deleted file mode 100644 index 2934800fa14..00000000000 --- a/auth/README2 +++ /dev/null @@ -1,91 +0,0 @@ -AUTHENTICATION PLUGINS ----------------------- -Each authentication plugin is now contained in a subfolder as a class definition -in the auth.php file. For instance, the LDAP authentication plugin is the class -called auth_plugin_ldap defined in: - - /auth/ldap/auth.php - -To instantiate the class, there is a function in lib/moodlelib called -get_auth_plugin() that does the work for you: - - $ldapauth = get_auth_plugin('ldap'); - -Auth plugin classes are pretty basic. They contain the same functions that were -previously in each plugin's lib.php file, but refactored to become class -methods, and tweaked to reference the plugin's instantiated config to get at the -settings, rather than the global $CFG variable. - -Configuration ------------------ - -All auth plugins must have a config property that contains the name value pairs -from the config_plugins table. This is populated using the get_config() function -in the constructor. The settings keys have also had the "auth_" prefix, as well -as the auth plugin name, trimmed. For instance, what used to be - - echo $CFG->auth_ldapversion; - -is now accessed as - - echo $ldapauth->config->version; - -Authentication settings have been moved to the config_plugins database table, -with the plugin field set to "auth/foo" (for instance, "auth/ldap"). - -Method Names ------------------ - -When the functions from lib.php were ported to methods in auth.php, the "auth_" -prefix was dropped. For instance, calls to - - auth_user_login($user, $pass); - -now become - - $ldapauth->user_login($user, $pass); - -this also avoids having to worry about which auth/lib file to include since -Moodle takes care of it for you when you create an instance with -get_auth_plugin(). - -Code Use ------------------ - -Code calling auth plugins can use method_exists() to determine plugin -functionality, much in the same way that function_exists() was used until now. -In addition, auth plugins provide some methods by default that can be called: - -user_login($username, $password) - This is the primary method that is used by the authenticate_user_login() - function in moodlelib.php. This method should return a boolean indicating - whether or not the username and password authenticate successfully. - Both parameter must have magic quotes applied. - -is_internal() - Returns true if this authentication plugin is "internal" (which means that - Moodle stores the users' passwords and other details in the local Moodle - database). - -can_change_password() - Returns true if the plugin can change the users' passwords. - -change_password_url() - Returns the URL for changing the users' passwords, or false if the default - URL can be used. - -Other Methods ------------------ - -get_userinfo($username) - This method should return an array of fields from the authentication source - for the given username. Username parameter must have magic quotes applied. - The returned array does not have magic quotes applied. - -Upgrading from Moodle 1.7 ------------------------------ - -Moodle will upgrade the old auth settings (in $CFG->auth_foobar where foo is the -auth plugin and bar is the setting) to the new style in the config_plugin -database table. - diff --git a/auth/cas/auth_ldap_sync_users.php b/auth/cas/auth_ldap_sync_users.php deleted file mode 100644 index e4caec4b45d..00000000000 --- a/auth/cas/auth_ldap_sync_users.php +++ /dev/null @@ -1,48 +0,0 @@ -<?php -/** auth_ldap_sync_users.php - * Modified for cas Module - * - * This script is meant to be called from a cronjob to sync moodle with the LDAP - * backend in those setups where the LDAP backend acts as 'master'. - * - * Recommended cron entry: - * # 5 minutes past 4am - * 5 4 * * * /usr/bin/php -c /etc/php4/cli/php.ini /var/www/moodle/auth/ldap/auth_ldap_sync_users.php - * - * Notes: - * - If you have a large number of users, you may want to raise the memory limits - * by passing -d momory_limit=256M - * - For debugging & better logging, you are encouraged to use in the command line: - * -d log_errors=1 -d error_reporting=E_ALL -d display_errors=0 -d html_errors=0 - * - * Performance notes: - * We have optimized it as best as we could for Postgres and mySQL, with 27K students - * we have seen this take 10 minutes. - * - */ - - -if (isset($_SERVER['REMOTE_ADDR'])) { - error_log("should not be called from web server!"); - exit; -} - -$nomoodlecookie = true; // cookie not needed - -require_once(dirname(dirname(dirname(__FILE__))).'/config.php'); // global moodle config file. - -require_once($CFG->dirroot.'/course/lib.php'); -require_once($CFG->dirroot.'/lib/blocklib.php'); -require_once($CFG->dirroot.'/mod/resource/lib.php'); -require_once($CFG->dirroot.'/mod/forum/lib.php'); -require_once($CFG->dirroot.'/lib/moodlelib.php'); - -if (!is_enabled_auth('cas')) { - echo "Plugin not enabled!"; - die; -} - -$casauth = get_auth_plugin('cas'); -$casauth->sync_users(1000, true); - -?> \ No newline at end of file diff --git a/auth/cas/forbidden.html b/auth/cas/forbidden.html deleted file mode 100644 index fb4674bef68..00000000000 --- a/auth/cas/forbidden.html +++ /dev/null @@ -1,8 +0,0 @@ -<table width="90%" border="0" cellspacing="10" cellpadding="5" align="center" style="font-size: small"> - <tr> - <td width="50%" class="required" class="headingblock"> - <p align="center"><b><font size="3"><?php formerr($errormsg) ?></font></b></p> - </td> - </tr> -</table> - diff --git a/auth/cas/forbidden.php b/auth/cas/forbidden.php deleted file mode 100644 index 918261ecf65..00000000000 --- a/auth/cas/forbidden.php +++ /dev/null @@ -1,18 +0,0 @@ -<?php -// version $Id$ -// Page for forbidden access from CAS - require("../../config.php"); - - if (!$site = get_site()) { - print_error('nosite', '', '', NULL, true); - } - - $loginsite = get_string("loginsite"); - $errormsg = get_string("auth_cas_invalidcaslogin", "auth"); - - print_header("$site->fullname: $loginsite", $site->fullname, $loginsite); - include("forbidden.html"); - print_footer(); - exit; -?> - diff --git a/auth/cas/index_form.html b/auth/cas/index_form.html deleted file mode 100644 index 5a1c85e2e39..00000000000 --- a/auth/cas/index_form.html +++ /dev/null @@ -1,85 +0,0 @@ -<table width="90%" border="0" cellspacing="10" cellpadding="5" > - <tr> -<?php if ($show_instructions) { ?> - <td width="50%" class="headingblock"> - <p><b><?php print_string("returningtosite") ?></b></p> - </td> - <td width="50%" class="headingblock"> - <p><b><?php print_string("firsttime") ?></b></p> - </td> -<?php } ?> - </tr> - <tr> - <td width="50%" align="center" valign="top" class="generalbox"> - <p><?php print_string("loginusing") ?>:<br /> - (<?php print_string("cookiesenabled");?>) - <?php helpbutton("cookies", get_string("cookiesenabled"))?><br /><?php formerr($errormsg) ?> - </p> - <form action="index.php" method="post" id="login"> - <div> - <table border="0" style="font-size: small"> - <tr> - <td width="100%"> - <input type="hidden" name="username" id="username" value="cas" /> - <input type="hidden" name="password" id="password" value="cas" /> - <input type="submit" value="<?php print_string("auth_cas_logincas", "auth") ?>" /> - </td> - </tr> - </table> - </div> - </form> -<?php if ($CFG->guestloginbutton) { ?> - <hr width="80%" /> - <p><?php print_string("someallowguest") ?>:</p> - <form action="index.php" method="post" id="guestlogin"> - <div> - <input type="hidden" name="username" value="guest" /> - <input type="hidden" name="password" value="guest" /> - <input type="submit" value="<?php print_string("loginguest") ?>" /> - </div> - </form> -<?php } ?> - -<?php if (is_internal_auth() ) { - $changepassword = "forgot_password.php"; - $changebuttonname = get_string("senddetails"); -?> - <hr width="80%" /> - <p><?php print_string("forgotten") ?></p> - <form action="<?php p($changepassword) ?>" method="get" id="changepassword"> - <div><input type="submit" value="<?php p($changebuttonname) ?>" /></div> - </form> -<?php } ?> - - </td> - -<?php if ($show_instructions) { ?> - <td width="50%" valign="top" class="generalbox"> -<?php switch ($CFG->auth) { - case "email": - print_string("loginsteps", "", "signup.php"); -?> - <form action="signup.php" method="get" id="signup"> - <div><input type="submit" value="<?php print_string("startsignup") ?>" /></div> - </form> -<?php break; - case "none": - print_string("loginstepsnone"); - break; - default: - $authplugin = get_auth_plugin($CFG->auth); - echo format_text($CFG->auth_instructions); - if (!empty($authplugin->config->user_create) and method_exists($authplugin, 'user_create')) { -?> - - <form action="signup.php" method="get" id="signup"> - <div><input type="submit" value="<?php print_string("startsignup") ?>" /></div> - </form> - -<?php } - } -?> - </td></tr> -<?php } ?> -</table> - diff --git a/auth/cas/login.php b/auth/cas/login.php deleted file mode 100644 index 7551bc88c40..00000000000 --- a/auth/cas/login.php +++ /dev/null @@ -1,313 +0,0 @@ -<?php -// $Id$ -// author: romualdLorthioir $ -//CHANGELOG: -//05.03.2005 replace /login/index.php -defined('MOODLE_INTERNAL') or die('Direct access to this script is forbidden.'); - - //Define variables used in page - if (!$site = get_site()) { - print_error('nosite', '', '', NULL, true); - } - - if (empty($CFG->langmenu)) { - $langmenu = ""; - } else { - $currlang = current_language(); - $langs = get_list_of_languages(); - if (empty($CFG->loginhttps)) { - $wwwroot = $CFG->wwwroot; - } else { - $wwwroot = str_replace('http:','https:',$CFG->wwwroot); - } - $langmenu = popup_form ("$wwwroot/login/index.php?lang=", $langs, "chooselang", $currlang, "", "", "", true); - } - - $loginsite = get_string("loginsite"); - $casauth = get_auth_plugin('cas'); - $ldapauth = get_auth_plugin('ldap'); - - - $frm = false; - $user = false; - if ((!empty($SESSION->wantsurl) and strstr($SESSION->wantsurl,'username=guest')) or $loginguest) { - /// Log in as guest automatically (idea from Zbigniew Fiedorowicz) - $frm->username = 'guest'; - $frm->password = 'guest'; - } else if (!empty($SESSION->wantsurl) && file_exists($CFG->dirroot.'/login/weblinkauth.php')) { - // Handles the case of another Moodle site linking into a page on this site - include($CFG->dirroot.'/login/weblinkauth.php'); - if (function_exists(weblink_auth)) { - $user = weblink_auth($SESSION->wantsurl); - } - if ($user) { - $frm->username = $user->username; - } else { - $frm = data_submitted(); - } - } else { - $frm = data_submitted(); - } - - if ($frm and (get_moodle_cookie() == '')) { // Login without cookie - - $errormsg = get_string("cookiesnotenabled"); - - } else if ($frm) { // Login WITH cookies - - $frm->username = trim(moodle_strtolower($frm->username)); - - if (($frm->username == 'guest') and empty($CFG->guestloginbutton)) { - $user = false; /// Can't log in as guest if guest button is disabled - $frm = false; - } else if (!$user) { - if ($CFG->auth == "cas" && $frm->username != 'guest') { /// Cas SSO case - $user = $casauth->authenticate_user_login($frm->username, $frm->password); - }else{ - $user = authenticate_user_login($frm->username, $frm->password); - } - } - update_login_count(); - - if ($user) { - if (! $user->confirmed ) { // they never confirmed via email - print_header(get_string("mustconfirm"), get_string("mustconfirm") ); - print_heading(get_string("mustconfirm")); - print_simple_box(get_string("emailconfirmsent", "", $user->email), "center"); - print_footer(); - die; - } - - $USER = $user; - if (!empty($USER->description)) { - $USER->description = true; // No need to cart all of it around - } - $USER->loggedin = true; - $USER->site = $CFG->wwwroot; // for added security, store the site in the session - sesskey(); // for added security, used to check script parameters - - if ($USER->username == "guest") { - $USER->lang = $CFG->lang; // Guest language always same as site - $USER->firstname = get_string("guestuser"); // Name always in current language - $USER->lastname = " "; - } - - if (!update_user_login_times()) { - error("Wierd error: could not update login records"); - } - - set_moodle_cookie($USER->username); - - unset($SESSION->lang); - $SESSION->justloggedin = true; - - // Restore the calendar filters, if saved - if (intval(get_user_preferences('calendar_persistflt', 0))) { - include_once($CFG->dirroot.'/calendar/lib.php'); - calendar_set_filters_status(get_user_preferences('calendar_savedflt', 0xff)); - } - - //Select password change url - $userauth = get_auth_plugin($USER->auth); - if (method_exists($userauth, 'can_change_password') and $userauth->can_change_password()) { - $passwordchangeurl=$CFG->wwwroot.'/login/change_password.php'; - } - - // check whether the user should be changing password - if (get_user_preferences('auth_forcepasswordchange', false)) { - if (isset($passwordchangeurl)) { - redirect($passwordchangeurl); - } else { - print_error('auth_cas_broken_password','auth'); - } - } - - - add_to_log(SITEID, "user", "login", "view.php?id=$user->id&course=".SITEID, $user->id, 0, $user->id); - - if (user_not_fully_set_up($USER)) { - $urltogo = $CFG->wwwroot.'/user/edit.php?id='.$USER->id.'&course='.SITEID; - // We don't delete $SESSION->wantsurl yet, so we get there later - - } else if (isset($SESSION->wantsurl) and (strpos($SESSION->wantsurl, $CFG->wwwroot) === 0)) { - $urltogo = $SESSION->wantsurl; /// Because it's an address in this site - unset($SESSION->wantsurl); - - } else { - $urltogo = $CFG->wwwroot.'/'; /// Go to the standard home page - unset($SESSION->wantsurl); /// Just in case - } - - // check if user password has expired - // Currently supported only for ldap-authentication module - if ($ldapauth->config->expiration == 1) { - $days2expire = $ldapauth->password_expire($USER->username); - if (intval($days2expire) > 0 && intval($days2expire) < intval($CFG->{$USER->auth.'_expiration_warning'})) { - print_header("$site->fullname: $loginsite", $site->fullname, $loginsite, $focus, "", true, "<div align=\"right\">$langmenu</div>"); - notice_yesno(get_string('auth_passwordwillexpire', 'auth', $days2expire), $passwordchangeurl, $urltogo); - print_footer(); - exit; - } elseif (intval($days2expire) < 0 ) { - print_header("$site->fullname: $loginsite", $site->fullname, $loginsite, $focus, "", true, "<div align=\"right\">$langmenu</div>"); - notice_yesno(get_string('auth_passwordisexpired', 'auth'), $passwordchangeurl, $urltogo); - print_footer(); - exit; - } - } - - reset_login_count(); - - load_all_capabilities(); /// This is what lets the user do anything on the site :-) - - redirect($urltogo); - - exit; - - } else { - if ($CFG->auth == "cas" ) { /// CAS error login - $errormsg = get_string("invalidcaslogin"); - phpCAS::logout("$CFG->wwwroot/auth/cas/forbidden.php"); - }else{ - $errormsg = get_string("invalidlogin"); - } - } - } - $user = $casauth->automatic_authenticate($user); - if ($user) { - if (! $user->confirmed ) { // they never confirmed via email - print_header(get_string("mustconfirm"), get_string("mustconfirm") ); - print_heading(get_string("mustconfirm")); - print_simple_box(get_string("emailconfirmsent", "", $user->email), "center"); - print_footer(); - die; - } - - $USER = $user; - if (!empty($USER->description)) { - $USER->description = true; // No need to cart all of it around - } - $USER->loggedin = true; - $USER->site = $CFG->wwwroot; // for added security, store the site in the session - sesskey(); // for added security, used to check script parameters - - if ($USER->username == "guest") { - $USER->lang = $CFG->lang; // Guest language always same as site - $USER->firstname = get_string("guestuser"); // Name always in current language - $USER->lastname = " "; - } - - if (!update_user_login_times()) { - error("Wierd error: could not update login records"); - } - - set_moodle_cookie($USER->username); - - unset($SESSION->lang); - $SESSION->justloggedin = true; - - // Restore the calendar filters, if saved - if (intval(get_user_preferences('calendar_persistflt', 0))) { - include_once($CFG->dirroot.'/calendar/lib.php'); - calendar_set_filters_status(get_user_preferences('calendar_savedflt', 0xff)); - } - - //Select password change url - $userauth = get_auth_plugin($USER->auth); - if (method_exists($userauth, 'can_change_password') and $userauth->can_change_password()) { - $passwordchangeurl=$CFG->wwwroot.'/login/change_password.php'; - } - - // check whether the user should be changing password - if (get_user_preferences('auth_forcepasswordchange', false)) { - if (isset($passwordchangeurl)) { - redirect($passwordchangeurl); - } else { - print_error('auth_cas_broken_password','auth'); - } - } - - - add_to_log(SITEID, "user", "login", "view.php?id=$user->id&course=".SITEID, $user->id, 0, $user->id); - - if (user_not_fully_set_up($USER)) { - $urltogo = $CFG->wwwroot.'/user/edit.php?id='.$USER->id.'&course='.SITEID; - // We don't delete $SESSION->wantsurl yet, so we get there later - - } else if (isset($SESSION->wantsurl) and (strpos($SESSION->wantsurl, $CFG->wwwroot) === 0)) { - $urltogo = $SESSION->wantsurl; /// Because it's an address in this site - unset($SESSION->wantsurl); - - } else { - $urltogo = $CFG->wwwroot.'/'; /// Go to the standard home page - unset($SESSION->wantsurl); /// Just in case - } - - // check if user password has expired - // Currently supported only for ldap-authentication module - if ($ldapauth->config->expiration == 1) { - $days2expire = $ldapauth->password_expire($USER->username); - if (intval($days2expire) > 0 && intval($days2expire) < intval($CFG->{$USER->auth.'_expiration_warning'})) { - print_header("$site->fullname: $loginsite", $site->fullname, $loginsite, $focus, "", true, "<div class=\"langmenu\">$langmenu</div>"); - notice_yesno(get_string('auth_passwordwillexpire', 'auth', $days2expire), $passwordchangeurl, $urltogo); - print_footer(); - exit; - } elseif (intval($days2expire) < 0 ) { - print_header("$site->fullname: $loginsite", $site->fullname, $loginsite, $focus, "", true, "<div class=\"langmenu\">$langmenu</div>"); - notice_yesno(get_string('auth_passwordisexpired', 'auth'), $passwordchangeurl, $urltogo); - print_footer(); - exit; - } - } - - reset_login_count(); - - load_all_capabilities(); /// This is what lets the user do anything on the site :-) - - redirect($urltogo); - - exit; - } else { - if (!$CFG->guestloginbutton) { - $errormsg = get_string("invalidcaslogin"); - phpCAS::logout("$CFG->wwwroot/auth/cas/forbidden.php"); - } - } - - if (empty($errormsg)) { - $errormsg = ""; - } - - if (empty($SESSION->wantsurl)) { - $SESSION->wantsurl = array_key_exists('HTTP_REFERER',$_SERVER) ? $_SERVER["HTTP_REFERER"] : $CFG->wwwroot.'/'; - } - - if (get_moodle_cookie() == '') { - set_moodle_cookie('nobody'); // To help search for cookies - } - - if (empty($frm->username)) { - $frm->username = get_moodle_cookie() === 'nobody' ? '' : get_moodle_cookie(); - $frm->password = ""; - } - - if (!empty($frm->username)) { - $focus = "login.password"; - } else { - $focus = "login.username"; - } - - if ($CFG->auth == "email" or $CFG->auth == "none" or chop($CFG->auth_instructions) <> "" ) { - $show_instructions = true; - } else { - $show_instructions = false; - } - - print_header("$site->fullname: $loginsite", $site->fullname, $loginsite, $focus, "", true, "<div align=\"right\">$langmenu</div>"); - include($CFG->dirroot.'/auth/cas/index_form.html'); - print_footer(); - - exit; - - // No footer on this page - -?> diff --git a/auth/cas/logout.php b/auth/cas/logout.php deleted file mode 100644 index 5f0a5cc87ad..00000000000 --- a/auth/cas/logout.php +++ /dev/null @@ -1,15 +0,0 @@ -<?php -// $Id$ -// logout the user from CAS server (destroy the ticket) -defined('MOODLE_INTERNAL') or die('Direct access to this script is forbidden.'); - - global $CFG; - if ($CFG->cas_logout) { - require_once($CFG->dirroot.'/config.php'); - include_once($CFG->dirroot.'/lib/cas/CAS.php'); - phpCAS::client($CFG->cas_version,$CFG->cas_hostname,(int)$CFG->cas_port,$CFG->cas_baseuri); - $backurl = $CFG->wwwroot; - phpCAS::logout($backurl); - } - -?> \ No newline at end of file diff --git a/auth/nologin/auth.php b/auth/nologin/auth.php index f91ec9c8a7f..91070593673 100644 --- a/auth/nologin/auth.php +++ b/auth/nologin/auth.php @@ -1,7 +1,7 @@ <?php /** - * @author Martin Dougiamas + * @author Petr Skoda * @license http://www.gnu.org/copyleft/gpl.html GNU Public License * @package moodle multiauth * @@ -19,7 +19,7 @@ if (!defined('MOODLE_INTERNAL')) { require_once($CFG->libdir.'/authlib.php'); /** - * Plugin for no authentication. + * Plugin for no authentication - disabled user. */ class auth_plugin_nologin extends auth_plugin_base { @@ -32,10 +32,10 @@ class auth_plugin_nologin extends auth_plugin_base { } /** - * Do not allow any login + * Do not allow any login. * */ - function user_login ($username, $password) { + function user_login($username, $password) { return false; } @@ -47,18 +47,17 @@ class auth_plugin_nologin extends auth_plugin_base { } /** - * Returns true if this authentication plugin is 'internal'. + * No external data sync. * * @return bool */ function is_internal() { //we do not know if it was internal or external originally - return false; + return true; } /** - * Returns true if this authentication plugin can change the user's - * password. + * No changing of password. * * @return bool */ @@ -67,21 +66,10 @@ class auth_plugin_nologin extends auth_plugin_base { } /** - * Prints a form for configuring this authentication plugin. - * - * This function is called from admin/auth.php, and outputs a full page with - * a form for configuring this plugin. - * - * @param array $page An object containing all the data for this page. + * No password resetting. */ - function config_form($config, $err, $user_fields) { - } - - /** - * Processes and stores configuration data for this authentication plugin. - */ - function process_config($config) { - return true; + function can_reset_password() { + return false; } } diff --git a/backup/db/mysql.sql b/backup/db/mysql.sql deleted file mode 100644 index 66c9359a7b4..00000000000 --- a/backup/db/mysql.sql +++ /dev/null @@ -1,75 +0,0 @@ -# -# Table structure for table `prefix_backup_files` -# - -CREATE TABLE `prefix_backup_files` ( - `id` int(10) unsigned NOT NULL auto_increment, - `backup_code` int(10) unsigned NOT NULL default '0', - `file_type` varchar(10) NOT NULL default '', - `path` varchar(255) NOT NULL default '', - `old_id` int(10) unsigned NOT NULL default '0', - `new_id` int(10) unsigned NOT NULL default '0', - PRIMARY KEY (`id`), - UNIQUE KEY `backup_files_uk` (`backup_code`,`file_type`,`path`) -) TYPE=MyISAM COMMENT='To store and recode ids to user and course files.'; -# -------------------------------------------------------- - -# -# Table structure for table `prefix_backup_ids` -# - -CREATE TABLE `prefix_backup_ids` ( - `id` int(10) unsigned NOT NULL auto_increment, - `backup_code` int(12) unsigned NOT NULL default '0', - `table_name` varchar(30) NOT NULL default '', - `old_id` int(10) unsigned NOT NULL default '0', - `new_id` int(10) unsigned NOT NULL default '0', - `info` mediumtext NOT NULL default '', - PRIMARY KEY (`id`), - UNIQUE KEY `backup_ids_uk` (`backup_code` ,`table_name`,`old_id`) -) TYPE=MyISAM COMMENT='To store and convert ids in backup/restore'; -# -------------------------------------------------------- - -# -# Table structure for table `prefix_backup_config` -# - -CREATE TABLE `prefix_backup_config` ( - `id` int(10) unsigned NOT NULL auto_increment, - `name` varchar(255) NOT NULL default '', - `value` varchar(255) NOT NULL default '', - PRIMARY KEY (`id`), - UNIQUE KEY `name` (`name`) -) TYPE=MyISAM COMMENT='To store backup configuration variables'; -# -------------------------------------------------------- - -# -# Table structure for table `prefix_backup_courses` -# - -CREATE TABLE `prefix_backup_courses` ( - `id` int(10) unsigned NOT NULL auto_increment, - `courseid` int(10) unsigned NOT NULL default '0', - `laststarttime` int(10) unsigned NOT NULL default '0', - `lastendtime` int(10) unsigned NOT NULL default '0', - `laststatus` varchar(1) NOT NULL default '0', - `nextstarttime` int(10) unsigned NOT NULL default '0', - PRIMARY KEY (`id`), - UNIQUE KEY `courseid` (`courseid`) -) TYPE=MyISAM COMMENT='To store every course backup status'; - -# -------------------------------------------------------- - -# -# Table structure for table `prefix_backup_log` -# - -CREATE TABLE `prefix_backup_log` ( - `id` int(10) unsigned NOT NULL auto_increment, - `courseid` int(10) unsigned NOT NULL default '0', - `time` int(10) unsigned NOT NULL default '0', - `laststarttime` int(10) unsigned NOT NULL default '0', - `info` varchar(255) NOT NULL default '', - PRIMARY KEY (`id`) -) TYPE=MyISAM COMMENT='To store every course backup log info'; -# -------------------------------------------------------- diff --git a/backup/db/postgres7.sql b/backup/db/postgres7.sql deleted file mode 100644 index d39f76402db..00000000000 --- a/backup/db/postgres7.sql +++ /dev/null @@ -1,67 +0,0 @@ -# -# Table structure for table prefix_backup_files -# - -CREATE TABLE prefix_backup_files ( - id SERIAL PRIMARY KEY, - backup_code integer NOT NULL default '0', - file_type varchar(10) NOT NULL default '', - path varchar(255) NOT NULL default '', - old_id integer default NULL, - new_id integer default NULL, - CONSTRAINT prefix_backup_files_uk UNIQUE (backup_code, file_type, path) -); - - -# -# Table structure for table prefix_backup_ids -# - -CREATE TABLE prefix_backup_ids ( - id SERIAL PRIMARY KEY, - backup_code integer NOT NULL default '0', - table_name varchar(30) NOT NULL default '', - old_id integer NOT NULL default '0', - new_id integer default NULL, - info text, - CONSTRAINT prefix_backup_ids_uk UNIQUE (backup_code, table_name, old_id) -); - - -# -# Table structure for table prefix_backup_config -# - -CREATE TABLE prefix_backup_config ( - id SERIAL PRIMARY KEY, - name varchar(255) UNIQUE NOT NULL default '', - value varchar(255) NOT NULL default '' -); - - -# -# Table structure for table prefix_backup_courses -# - -CREATE TABLE prefix_backup_courses ( - id SERIAL PRIMARY KEY, - courseid integer UNIQUE NOT NULL default '0', - laststarttime integer NOT NULL default '0', - lastendtime integer NOT NULL default '0', - laststatus varchar(1) NOT NULL default '0', - nextstarttime integer NOT NULL default '0' -); - - - -# -# Table structure for table prefix_backup_log -# - -CREATE TABLE prefix_backup_log ( - id SERIAL PRIMARY KEY, - courseid integer NOT NULL default '0', - time integer NOT NULL default '0', - laststarttime integer NOT NULL default '0', - info varchar(255) NOT NULL default '' -); diff --git a/blocks/blog_tags/block_blog_tags.php b/blocks/blog_tags/block_blog_tags.php index f69aa8bc55b..c257e104e53 100644 --- a/blocks/blog_tags/block_blog_tags.php +++ b/blocks/blog_tags/block_blog_tags.php @@ -132,7 +132,7 @@ class block_blog_tags extends block_base { case BLOG_GROUP_LEVEL: $filtertype = 'group'; - $filterselect = get_current_group($this->instance->pageid); + $filterselect = get_and_set_current_group($COURSE, groupmode($COURSE)); break; case BLOG_COURSE_LEVEL: diff --git a/blocks/db/mysql.sql b/blocks/db/mysql.sql deleted file mode 100644 index 8aafe1b6fda..00000000000 --- a/blocks/db/mysql.sql +++ /dev/null @@ -1,45 +0,0 @@ -# $Id$ -# -# Table structure for table `blocks` -# - -CREATE TABLE `prefix_block` ( - `id` int(10) unsigned NOT NULL auto_increment, - `name` varchar(40) NOT NULL default '', - `version` int(10) NOT NULL default '0', - `cron` int(10) unsigned NOT NULL default '0', - `lastcron` int(10) unsigned NOT NULL default '0', - `visible` tinyint(1) NOT NULL default '1', - `multiple` tinyint(1) NOT NULL default '0', - PRIMARY KEY (`id`) -) TYPE=MyISAM; - -CREATE TABLE `prefix_block_instance` ( - `id` int(10) not null auto_increment, - `blockid` int(10) not null default '0', - `pageid` int(10) not null default '0', - `pagetype` varchar(20) not null default '', - `position` varchar(10) not null default '', - `weight` tinyint(3) not null default '0', - `visible` tinyint(1) not null default '0', - `configdata` text not null default '', - PRIMARY KEY(`id`), - INDEX pageid(`pageid`), - INDEX pagetype(`pagetype`) -) TYPE=MyISAM; - -CREATE TABLE `prefix_block_pinned` ( - `id` int(10) not null auto_increment, - `blockid` int(10) not null default '0', - `pagetype` varchar(20) not null default '', - `position` varchar(10) not null default '', - `weight` tinyint(3) not null default '0', - `visible` tinyint(1) not null default '0', - `configdata` text not null default '', - PRIMARY KEY(`id`), - INDEX pagetype(`pagetype`) -) TYPE=MyISAM; - - - -# -------------------------------------------------------- diff --git a/blocks/db/postgres7.sql b/blocks/db/postgres7.sql deleted file mode 100644 index 352774cd2a9..00000000000 --- a/blocks/db/postgres7.sql +++ /dev/null @@ -1,41 +0,0 @@ -# $Id$ -# -# Table structure for table blocks -# - -CREATE TABLE prefix_block ( - id SERIAL8 PRIMARY KEY, - name varchar(40) NOT NULL default '', - version INT8 NOT NULL default '0', - cron INT8 NOT NULL default '0', - lastcron INT8 NOT NULL default '0', - visible int NOT NULL default '1', - multiple int NOT NULL default '0' -) ; - -CREATE TABLE prefix_block_instance ( - id SERIAL8 PRIMARY KEY, - blockid INT8 not null default '0', - pageid INT8 not null default '0', - pagetype varchar(20) not null default '', - position varchar(10) not null default '', - weight int not null default '0', - visible int not null default '0', - configdata text not null default '' -) ; -CREATE INDEX prefix_block_instance_pageid_idx ON prefix_block_instance (pageid); -CREATE INDEX prefix_block_instance_pagetype_idx ON prefix_block_instance (pagetype); - -CREATE TABLE prefix_block_pinned ( - id SERIAL8 PRIMARY KEY, - blockid INT8 NOT NULL default 0, - pagetype varchar(20) NOT NULL default '', - position varchar(10) NOT NULL default '', - weight INT NOT NULL default 0, - visible INT NOT NULL default 0, - configdata text NOT NULL default 0 -) ; - -CREATE INDEX prefix_block_pinned_pagetype_idx ON prefix_block_pinned (pagetype); - -# -------------------------------------------------------- diff --git a/blocks/news_items/block_news_items.php b/blocks/news_items/block_news_items.php index 8f46dfadebf..a4d7f3e2fd3 100644 --- a/blocks/news_items/block_news_items.php +++ b/blocks/news_items/block_news_items.php @@ -29,46 +29,29 @@ class block_news_items extends block_base { $text = ''; if (!$forum = forum_get_course_forum($COURSE->id, 'news')) { - return $this->content; + return ''; } + if (!$cm = get_coursemodule_from_instance('forum', $forum->id, $COURSE->id)) { + return ''; + } + + $context = get_context_instance(CONTEXT_MODULE, $cm->id); /// First work out whether we can post to this group and if so, include a link + $groupmode = groupmode($COURSE, $cm); + $currentgroup = get_and_set_current_group($COURSE, $groupmode); + - if (has_capability('moodle/site:accessallgroups', get_context_instance(CONTEXT_COURSE, $COURSE->id))) { /// Teachers can always post - $visiblegroups = -1; - + if (forum_user_can_post_discussion($forum, $currentgroup, $groupmode, $cm, $context)) { $text .= '<div class="newlink"><a href="'.$CFG->wwwroot.'/mod/forum/post.php?forum='.$forum->id.'">'. get_string('addanewtopic', 'forum').'</a>...</div>'; - - } else { /// Check the group situation - $currentgroup = get_current_group($COURSE->id); - - if (forum_user_can_post_discussion($forum, $currentgroup)) { - $text .= '<div align="center" class="newlink"><a href="'.$CFG->wwwroot.'/mod/forum/post.php?forum='.$forum->id.'">'. - get_string('addanewtopic', 'forum').'</a>...</div>'; - } - - if (!$cm = get_coursemodule_from_instance('forum', $forum->id, $COURSE->id)) { - $this->content->text = $text; - return $this->content; - } - - $groupmode = groupmode($COURSE, $cm); - - /// Decides if current user is allowed to see ALL the current discussions or not - - if (!$currentgroup and ($groupmode != SEPARATEGROUPS) ) { - $visiblegroups = -1; - } else { - $visiblegroups = $currentgroup; - } } /// Get all the recent discussions we're allowed to see if (! $discussions = forum_get_discussions($forum->id, 'p.modified DESC', 0, false, - $visiblegroups, $COURSE->newsitems) ) { + $currentgroup, $COURSE->newsitems) ) { $text .= '('.get_string('nonews', 'forum').')'; $this->content->text = $text; return $this->content; diff --git a/blocks/online_users/block_online_users.php b/blocks/online_users/block_online_users.php index 389c900ae38..fc019867bb4 100644 --- a/blocks/online_users/block_online_users.php +++ b/blocks/online_users/block_online_users.php @@ -43,7 +43,7 @@ class block_online_users extends block_base { && !has_capability('moodle/site:accessallgroups', $context)); //Get the user current group - $currentgroup = $isseparategroups ? get_current_group($COURSE->id) : NULL; + $currentgroup = $isseparategroups ? get_and_set_current_group($COURSE, groupmode($COURSE)) : NULL; $groupmembers = ""; $groupselect = ""; @@ -51,7 +51,7 @@ class block_online_users extends block_base { //Add this to the SQL to show only group users if ($currentgroup !== NULL) { $groupmembers = ', '.groups_members_from_sql(); //TODO: ", {$CFG->prefix}groups_members gm "; - $groupselect .= groups_members_where_sql($currentgroup, 'u.id'); //" AND u.id = gm.userid AND gm.groupid = '$currentgroup'"; + $groupselect = ' AND '.groups_members_where_sql($currentgroup, 'u.id'); //" AND u.id = gm.userid AND gm.groupid = '$currentgroup'"; } if ($COURSE->id == SITEID) { // Site-level diff --git a/blocks/rss_client/db/mysql.sql b/blocks/rss_client/db/mysql.sql deleted file mode 100644 index fd41951d1ed..00000000000 --- a/blocks/rss_client/db/mysql.sql +++ /dev/null @@ -1,23 +0,0 @@ -# $Id$ -# This file contains a complete database schema for all the -# tables used by this module, written in SQL - -# It may also contain INSERT statements for particular data -# that may be used, especially new entries in the table log_display - -# -------------------------------------------------------- - -# -# Table structure for table `prefix_block_rss_client` -# - -CREATE TABLE prefix_block_rss_client ( - `id` int(11) NOT NULL auto_increment, - `userid` int(11) NOT NULL default '0', - `title` text NOT NULL default '', - `preferredtitle` varchar(64) NOT NULL default '', - `description` text NOT NULL default '', - `shared` int(2) NOT NULL default '0', - `url` varchar(255) NOT NULL default '', -PRIMARY KEY (`id`) -) TYPE=MyISAM COMMENT='Remote news feed information. Contains the news feed id, the userid of the user who added the feed, the title of the feed itself and a description of the feed contents along with the url used to access the remote feed. Preferredtitle is a field for future use - intended to allow for custom titles rather than those found in the feed.'; \ No newline at end of file diff --git a/blocks/rss_client/db/postgres7.sql b/blocks/rss_client/db/postgres7.sql deleted file mode 100644 index 7cd0a8793e7..00000000000 --- a/blocks/rss_client/db/postgres7.sql +++ /dev/null @@ -1,20 +0,0 @@ -# $Id$ -# This file contains a complete database schema for all the -# tables used by this module, written in SQL - -# It may also contain INSERT statements for particular data -# that may be used, especially new entries in the table log_display - -# -# Table structure for table `block_rss_client` -# - -CREATE TABLE prefix_block_rss_client ( - id SERIAL PRIMARY KEY, - userid INTEGER NOT NULL default '0', - title text NOT NULL default '', - preferredtitle varchar(64) NOT NULL default '', - description text NOT NULL default '', - shared INTEGER NOT NULL default '0', - url varchar(255) NOT NULL default '' -); diff --git a/course/grades.php b/course/grades.php index 64c93076456..33928b17dd9 100644 --- a/course/grades.php +++ b/course/grades.php @@ -22,11 +22,8 @@ $stractivityreport = get_string("activityreport"); /// Check to see if groups are being used in this course - if ($groupmode = groupmode($course)) { // Groups are being used - $currentgroup = get_and_set_current_group($course, $groupmode, $changegroup); - } else { - $currentgroup = false; - } + $groupmode = groupmode($course); + $currentgroup = get_and_set_current_group($course, $groupmode, $changegroup); /// Get a list of all students if ($currentgroup) { @@ -308,7 +305,6 @@ $options["download"] = "xls"; print_single_button("grades.php", $options, get_string("downloadexcel")); echo "<td>"; - $options = array(); $options["download"] = "txt"; print_single_button("grades.php", $options, get_string("downloadtext")); echo "</table>"; diff --git a/course/group-edit.html b/course/group-edit.html deleted file mode 100644 index 2c3cd954e20..00000000000 --- a/course/group-edit.html +++ /dev/null @@ -1,63 +0,0 @@ -<form method="post" enctype="multipart/form-data" action="group.php"> -<table cellpadding="9" cellspacing="0" align="center"> -<tr valign="top"> - <td align="right"><?php print_string("name") ?>:</td> - <td><input type="text" name="name" size="30" value="<?php p($group->name) ?>" /> - <?php if (isset($err["name"])) formerr($err["name"]); ?> - </td> -</tr> -<tr valign="top"> - <td align="right"><?php print_string("description") ?>:<br /> - <?php helpbutton("text", get_string("helptext")) ?> - </td> - <td><?php - print_textarea($usehtmleditor, 8, 35, 660, 200, "description", $group->description); - if (isset($err["description"])) formerr($err["description"]); - ?> - </td> -</tr> - -<tr valign="top"> - <td align="right"><?php print_string('enrolmentkey') ?>:</td> - <td><input type="text" name="password" size="25" value="<?php echo $group->password ?>" alt="<?php print_string('enrolmentkey') ?>" /></td> -</tr> - -<tr valign="top"> - <td align="right"><?php print_string("hidepicture") ?>:</td> - <td><?php - $options = NULL; - $options[0] = get_string("no"); - $options[1] = get_string("yes"); - choose_from_menu ($options, "hidepicture", $group->hidepicture, ""); - ?> - </td> -</tr> - -<?php - $maxbytes = get_max_upload_file_size($CFG->maxbytes, $course->maxbytes); - if (!empty($CFG->gdversion) and $maxbytes) { -?> -<tr valign="top"> - <td align="right"><?php print_string("newpicture") ?>:<br />(<?php - print_string("maxsize", "", display_size($maxbytes)); - echo ') '; - helpbutton("picture", get_string("helppicture")); - ?></td> - <td> - <?php - require_once($CFG->dirroot.'/lib/uploadlib.php'); - upload_print_form_fragment(1,array('imagefile'),null,false,null,0,0,false); - if (isset($err["imagefile"])) formerr($err["imagefile"]); - ?> - </td> -</tr> -<?php } ?> -<tr> - <td></td> - <td><input type="submit" value="<?php print_string("savechanges") ?>" /></td> -</table> - -<input type="hidden" name="group" value="<?php p($group->id) ?>" /> -<input type="hidden" name="id" value="<?php p($course->id) ?>" /> -<input type="hidden" name="sesskey" value="<?php p(sesskey()) ?>" /> -</form> diff --git a/course/group.php b/course/group.php deleted file mode 100644 index 96e14e4713e..00000000000 --- a/course/group.php +++ /dev/null @@ -1,85 +0,0 @@ -<?php // $Id$ - -/// Shows current group, and allows editing of the group -/// icon and other settings related to that group - -/// This script appears within a popup window - - require_once('../config.php'); - require_once('lib.php'); - - $id = required_param('id', PARAM_INT); // Course id - $group = optional_param('group', 0, PARAM_INT); // Optionally look at other groups - - if (! $course = get_record('course', 'id', $id) ) { - error("That's an invalid course id"); - } - - require_login($course->id); - - if (! $group = get_record("groups", "id", $group, "courseid", $course->id)) { - notice('Specified group could not be found!', "#"); - close_window_button(); - } - - // this is fine since group inherits course settings, this allows 1) teacher to edit all groups - // 2 someone with a role with a cap to modify a specific group - $context = get_context_instance(CONTEXT_GROUP, $group->id); - - // this is really weird - if (!has_capability('moodle/course:managegroups', $context)) { - close_window(); - } - -/// Print the headers of the page - - print_header(get_string('groupinfoedit').' : '.$group->name); - - -/// If data submitted, then process and store. - - if ($form = data_submitted() and confirm_sesskey()) { - - if (empty($form->name)) { - $err['name'] = get_string("missingname"); - - } else { - require_once($CFG->dirroot.'/lib/uploadlib.php'); - - $um = new upload_manager('imagefile',false,false,null,false,0,true,true); - if ($um->preprocess_files()) { - require_once("$CFG->libdir/gdlib.php"); - - if (save_profile_image($group->id, $um, 'groups')) { - $group->picture = 1; - } - } - - // Setting a new object in order to avoid updating other columns for the record, - // which could lead to SQL injection vulnerabilities. - - // Be VERY sure to sanitize all parameters that go into $dataobj! - - $dataobj = new stdClass; - $dataobj->id = $group->id; - $dataobj->name = clean_text($form->name); - $dataobj->description = clean_text($form->description); - $dataobj->hidepicture = empty($form->hidepicture) ? 0 : 1; - $dataobj->password = required_param('password', PARAM_ALPHANUM); - $dataobj->picture = $group->picture; - if (!update_record('groups', $dataobj)) { - notify("A strange error occurred while trying to save"); - } else { - notify(get_string('changessaved')); - } - close_window(3); - } - } - - - $usehtmleditor = false; - - include('group-edit.html'); - - echo "</body></html>"; -?> diff --git a/course/groups-edit.html b/course/groups-edit.html deleted file mode 100755 index 6d43f92e534..00000000000 --- a/course/groups-edit.html +++ /dev/null @@ -1,182 +0,0 @@ -<script type="text/javascript"> -//<![CDATA[ -<?php - $roleoptions = array(0 => get_string('all')); - $roles = get_all_roles(); - foreach ($roles as $rolex) { - $roleoptions[$rolex->id] = $rolex->name; - } - - foreach ($listmembers as $groupid => $listmember) { - echo "group$groupid = new Object();\n"; - $useridstring = "group$groupid.userid = new Array("; - $usernamestring = "group$groupid.username = new Array("; - $max = count($listmember); - $count = 0; - foreach ($listmember as $userid => $username) { - $count++; - $useridstring .= "\"$userid\""; - $usernamestring .= '"'.addslashes($username).'"'; - if ($count < $max) { - $useridstring .= ', '; - $usernamestring .= ', '; - } - } - $useridstring .= ");\n"; - $usernamestring .= ");\n"; - - echo $useridstring; - echo $usernamestring; - } -?> - -function updateGroup() { - document.getElementById("form1").groupid.value = document.getElementById("form2").groups.value; - document.getElementById("form3").groupid.value = document.getElementById("form2").groups.value; -} - - -function updateMembers(selectgroup) { - eval('group=group'+selectgroup.value); - - username = group.username; - userid = group.userid; - - document.getElementById("form3")['members[]'].length = username.length; - - for (i=0;i<username.length;i++) { - document.getElementById("form3")['members[]'].options[i].value = userid[i]; - document.getElementById("form3")['members[]'].options[i].text = username[i]; - } - - updateGroup(); -} - -function userWindow(selectuser) { - num = 0; - for (var i=0; i<selectuser.options.length; i++) { - if (selectuser.options[i].selected) { - num++; - user = selectuser.options[i].value; - openpopup('/user/view.php?id='+user+'&course=<?php echo $courseid ?>','userinfo'+num,'',''); - } - } - return false; -} - -function groupWindow(selectgroup) { - num = 0; - for (var i=0; i<selectgroup.options.length; i++) { - if (selectgroup.options[i].selected) { - num++; - group = selectgroup.options[i].value; - openpopup('/course/group.php?id=<?php echo $courseid ?>&group='+group,'groupinfo'+num,'menubar=0,directory=0,location=0,scrollbars,resizable,width=600,height=480',''); - } - } - return false; -} - - -//]]> -</script> - - <form id="rolesform1" action="groups.php" method="get"> - <input type="hidden" name="id" value="<?php echo $courseid ?>" /> - <div align="center"><?php echo get_string('currentrole', 'role') ?>: - <?php choose_from_menu ($roleoptions, 'roleid', $roleid, '', 'document.getElementById(\'rolesform1\').submit()') ?> - </div></form> - - <table cellspacing="0" cellpadding="10" align="center" class="generaltable generalbox"> - <tr align="center" valign="top"> - <td class="generalboxcontent"> - <label for="nonmembers"><?php p($strmemberincourse) ?></label> - <form id="form1" method="post" action="groups.php"> - <input type="hidden" name="id" value="<?php p($course->id) ?>" /> - <input type="hidden" name="groupid" value="<?php p($selectedgroup) ?>" /> - <input type="hidden" name="sesskey" value="<?php p($sesskey) ?>" /> - <input type="hidden" name="roleid" value="<?php p($roleid) ?>" /> - - <select name="nonmembers[]" size="15" id="nonmembers" multiple="multiple"> - <?php - if (!empty($nonmembers)) { - foreach ($nonmembers as $id => $nonmembername) { - if (!is_array($ugroups = user_group($course->id, $id))) { - $numgroups = 0; - } - else { - $numgroups = count($ugroups); - } - echo "<option value=\"$id\" title=\"$nonmembername is in $numgroups groups\">$nonmembername ($numgroups)</option>\n"; - } - } - ?> - </select> - <br /> - <input type="submit" name="nonmembersadd" value="<?php p($strgroupaddusers) ?> ->" - onclick="updateGroup()" /> - <br /> - <!-- - <input type="submit" name="nonmembersrandom" value="<?php p($strgrouprandomassign) ?> ->" /> - <br /> --> - <input type="submit" name="nonmembersinfo" value="<?php p($strgroupinfopeople) ?>" - onclick="return userWindow(document.getElementById('form1')['nonmembers[]']);" /> - </form> - </td> - <td class="generalboxcontent"> - <label for="groups"><?php p($strgroups) ?></label> - <form id="form2" method="post" action="groups.php"> - <input type="hidden" name="id" value="<?php p($course->id) ?>" /> - <input type="hidden" name="sesskey" value="<?php p($sesskey) ?>" /> - <input type="hidden" name="roleid" value="<?php p($roleid) ?>" /> - <select name="groups" size="15" id="groups" onchange="updateMembers(this)"> - <?php - if (!empty($listgroups)) { - foreach ($listgroups as $id => $listgroup) { - $selected = ''; - if ($id == $selectedgroup) { - $selected = 'selected="selected"'; - } - echo "<option $selected value=\"$id\">$listgroup</option>"; - } - } - ?> - </select> - <br /> - <input type="submit" name="groupsinfo" value="<?php p($strgroupinfoedit) ?>" - onclick="return groupWindow(document.getElementById('form2').groups);" /> - <br /> - <input type="submit" name="groupsremove" value="<?php p($strgroupremove) ?>" /> - <br /> - <label for="groupadd" class="accesshide"><?php p($strgroupadd) ?></label> - <input name="newgroupname" id="groupadd" type="text" size="10" /> - <input type="submit" name="groupsadd" value="<?php p($strgroupadd) ?>" /> - </form> - </td> - - - <td class="generalboxcontent"> - <label for="members"><?php p($strgroupmembersselected) ?></label> - <form id="form3" method="post" action="groups.php"> - <input type="hidden" name="id" value="<?php p($course->id) ?>" /> - <input type="hidden" name="groupid" value="<?php p($selectedgroup) ?>" /> - <input type="hidden" name="sesskey" value="<?php p($sesskey) ?>" /> - <input type="hidden" name="roleid" value="<?php p($roleid) ?>" /> - <select name="members[]" size="15" id="members" multiple="multiple"> - <?php - if (!empty($members)) { - foreach ($members as $id => $membername) { - echo "<option value=\"$id\">$membername</option>"; - } - } - ?> - </select> - <br /> - <input type="submit" name="membersinfo" value="<?php p($strgroupinfomembers) ?>" - onclick="return userWindow(document.getElementById('form3')['members[]']);" /> - <br /> - <input type="submit" name="membersremove" value="<?php p($strgroupremovemembers) ?>" - onclick="updateGroup()" /> - </form> - </td> - </tr> - </table> diff --git a/course/groups.php b/course/groups.php deleted file mode 100644 index 30bd4d00ab1..00000000000 --- a/course/groups.php +++ /dev/null @@ -1,230 +0,0 @@ -<?php // $Id$ - -/////////////////////////////////////////////////////////////////////////// -// // -// NOTICE OF COPYRIGHT // -// // -// Moodle - Modular Object-Oriented Dynamic Learning Environment // -// http://moodle.org // -// // -// Copyright (C) 1999-2004 Martin Dougiamas http://dougiamas.com // -// // -// This program is free software; you can redistribute it and/or modify // -// it under the terms of the GNU General Public License as published by // -// the Free Software Foundation; either version 2 of the License, or // -// (at your option) any later version. // -// // -// This program is distributed in the hope that it will be useful, // -// but WITHOUT ANY WARRANTY; without even the implied warranty of // -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // -// GNU General Public License for more details: // -// // -// http://www.gnu.org/copyleft/gpl.html // -// // -/////////////////////////////////////////////////////////////////////////// - -/// Editing interface to edit all the groups in a course - - require_once('../config.php'); - require_once('lib.php'); - - $courseid = required_param('id', PARAM_INT); // Course id - $selectedgroup = optional_param('group', NULL, PARAM_INT); // Current group id - $roleid = optional_param('roleid', 0, PARAM_INT); // Current role id - - if (! $course = get_record('course', 'id', $courseid) ) { - error("That's an invalid course id"); - } - - require_login($course->id); - $context = get_context_instance(CONTEXT_COURSE, $course->id); - - if (!has_capability('moodle/course:managegroups', $context)) { - redirect("group.php?id=$course->id"); // Not allowed to see all groups - } - -/// Get the current list of groups and check the selection is valid - - $groups = get_groups($course->id); - - if ($selectedgroup and !isset($groups[$selectedgroup])) { - $selectedgroup = NULL; - } - - -/// Print the header of the page - - $strgroup = get_string('group'); - $strgroups = get_string('groups'); - $streditgroupprofile = get_string('editgroupprofile'); - $strgroupmembers = get_string('groupmembers'); - $strgroupmemberssee = get_string('groupmemberssee'); - $strparticipants = get_string('participants'); - - print_header("$course->shortname: $strgroups", $course->fullname, - "<a href=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</a> ". - "-> <a href=\"$CFG->wwwroot/user/index.php?id=$course->id\">$strparticipants</a> ". - "-> $strgroups", "", "", true, '', user_login_string($course, $USER)); - - -/// First, process any inputs there may be. - - if ($data = data_submitted() and confirm_sesskey()) { - - // Clean ALL incoming parameters which go in SQL queries here for good measure - $data->id = required_param('id', PARAM_INT); - $data->groups = optional_param('groups', 0, PARAM_INT); - $data->groupid = optional_param('groupid', 0, PARAM_INT); - $data->members = optional_param('members', array(), PARAM_INT); - - if (!empty($data->nonmembersadd)) { /// Add people to a group - if (!empty($data->nonmembers) and !empty($data->groupid)) { - $groupmodified = false; - foreach ($data->nonmembers as $userid) { - //since we allow people to be in more than 1 group, this has to go. - if (!ismember($data->groupid,$userid)) {// Just to make sure (another teacher could be editing) - $record->groupid = $data->groupid; - $record->userid = $userid; - $record->timeadded = time(); - if (!insert_record('groups_members', $record)) { - notify("Error occurred while adding user $userid to group $data->groupid"); - } - $groupmodified = true; - } - } - if ($groupmodified) { - set_field('groups', 'timemodified', time(), 'id', $data->groupid); - } - } - $selectedgroup = $data->groupid; - - - } else if (!empty($data->nonmembersrandom)) { /// Add all non members to groups - notify("Random adding of people into groups is not functional yet."); - - } else if (!empty($data->nonmembersinfo)) { /// Return info about the selected users - notify("You must turn Javascript on"); - - } else if (!empty($data->groupsremove)) { /// Remove a group, all members become nonmembers - if (!empty($data->groups)) { - if(!isset($groups[$data->groups])) { - error("This is not a valid group to remove"); - } - delete_records("groups", "id", $data->groups); - delete_records("groups_members", "groupid", $data->groups); - unset($groups[$data->groups]); - } - - - } else if (!empty($data->groupsinfo)) { /// Display full info for a group - notify("You must turn Javascript on"); - - } else if (!empty($data->groupsadd)) { /// Create a new group - if (!empty($data->newgroupname)) { - $newgroup->name = $data->newgroupname; - $newgroup->courseid = $course->id; - $newgroup->lang = current_language(); - $newgroup->timecreated = time(); - $newgroup->description = ''; // can not be null MDL-7300 - if (!insert_record("groups", $newgroup)) { - notify("Could not insert the new group '$newgroup->name'"); - } - $groups = get_groups($course->id); - } - - } else if (!empty($data->membersremove)) { /// Remove selected people from a particular group - - if (!empty($data->members) and !empty($data->groupid)) { - foreach ($data->members as $userid) { - delete_records('groups_members', 'userid', $userid, "groupid", $data->groupid); - } - set_field('groups', 'timemodified', time(), 'id', $data->groupid); - } - $selectedgroup = $data->groupid; - - } else if (!empty($data->membersinfo)) { /// Return info about the selected users - notify("You must turn Javascript on"); - - } - } - - -/// Calculate data ready to create the editing interface - - $strmemberincourse = get_string('memberincourse'); - $strgroupnonmembers = get_string('groupnonmembers'); - $strgroupmembersselected = get_string('groupmembersselected'); - $strgroupremovemembers = get_string('groupremovemembers'); - $strgroupinfomembers = get_string('groupinfomembers'); - $strgroupadd = get_string('groupadd'); - $strgroupremove = get_string('groupremove'); - $strgroupinfo = get_string('groupinfo'); - $strgroupinfoedit = get_string('groupinfoedit'); - $strgroupinfopeople = get_string('groupinfopeople'); - $strgrouprandomassign = get_string('grouprandomassign'); - $strgroupaddusers = get_string('groupaddusers'); - $courseid = $course->id; - $listgroups = array(); - $listmembers = array(); - $nonmembers = array(); - $groupcount = count($groups); - - -/// First, get everyone into the nonmembers array - - if ($contextusers = get_role_users($roleid, $context)) { - foreach ($contextusers as $contextuser) { - $nonmembers[$contextuser->id] = fullname($contextuser, true); - } - } - unset($contextusers); - -/// Pull out all the members into little arrays - - if ($groups) { - foreach ($groups as $group) { - $countusers = 0; - $listmembers[$group->id] = array(); - if ($groupusers = get_group_users($group->id, 'u.lastname ASC, u.firstname ASC')) { - foreach ($groupusers as $key=>$groupuser) { - if (!array_key_exists($groupuser->id, $nonmembers)) { - // group member with another role - unset($groupusers[$key]); - } else { - $listmembers[$group->id][$groupuser->id] = $nonmembers[$groupuser->id]; - //we do not remove people from $nonmembers, everyone is displayed - //this is to enable people to be registered in multiple groups - //unset($nonmembers[$groupuser->id]); - $countusers++; - } - } - } - $listgroups[$group->id] = $group->name." ($countusers)"; - } - natcasesort($listgroups); - } - - if (empty($selectedgroup)) { // Choose the first group by default - if ($selectedgroup = array_shift($temparr = array_keys($listgroups))) { - $members = $listmembers[$selectedgroup]; - } - } else { - $members = $listmembers[$selectedgroup]; - } - - $sesskey = !empty($USER->id) ? $USER->sesskey : ''; - -//TODO: -if (debugging()) { - echo '<p>[ <a href="../group/index.php?id='. $courseid .'">New groups</a> - debugging. ]</p>'; -} - -/// Print out the complete form - - print_heading(get_string('groups')); - - include('groups-edit.html'); - - print_footer($course); - -?> \ No newline at end of file diff --git a/course/moodleform_mod.php b/course/moodleform_mod.php index a73494aa66a..a0869614cb2 100644 --- a/course/moodleform_mod.php +++ b/course/moodleform_mod.php @@ -65,6 +65,7 @@ class moodleform_mod extends moodleform { $mform =& $this->_form; $mform->addElement('header', 'modstandardelshdr', get_string('modstandardels', 'form')); if ($supportsgroups){ + // TODO: we must define this as mod property! $mform->addElement('modgroupmode', 'groupmode', get_string('groupmode')); } $mform->addElement('modvisible', 'visible', get_string('visible')); diff --git a/enrol/authorize/db/mysql.sql b/enrol/authorize/db/mysql.sql deleted file mode 100755 index e0bd8c1d37c..00000000000 --- a/enrol/authorize/db/mysql.sql +++ /dev/null @@ -1,31 +0,0 @@ -CREATE TABLE `prefix_enrol_authorize` ( - `id` int(10) unsigned NOT NULL auto_increment, - `paymentmethod` enum('cc', 'echeck') NOT NULL default 'cc', - `cclastfour` int(4) unsigned NOT NULL default '0', - `ccname` varchar(255) NOT NULL default '', - `courseid` int(10) unsigned NOT NULL default '0', - `userid` int(10) unsigned NOT NULL default '0', - `transid` int(10) unsigned NOT NULL default '0', - `status` int(10) unsigned NOT NULL default '0', - `timecreated` int(10) unsigned NOT NULL default '0', - `settletime` int(10) unsigned NOT NULL default '0', - `amount` varchar(10) NOT NULL default '', - `currency` varchar(3) NOT NULL default 'USD', - PRIMARY KEY (`id`), - KEY `courseid` (`courseid`), - KEY `userid` (`userid`), - KEY `status` (`status`), - KEY `transid` (`transid`) -) TYPE=MyISAM COMMENT='Holds all known information about authorize.net transactions'; - -CREATE TABLE `prefix_enrol_authorize_refunds` ( - `id` int(10) unsigned NOT NULL auto_increment, - `orderid` int(10) unsigned NOT NULL default '0', - `status` int(1) unsigned NOT NULL default '0', - `amount` varchar(10) NOT NULL default '', - `transid` int(10) unsigned default '0', - `settletime` int(10) unsigned NOT NULL default '0', - PRIMARY KEY (`id`), - KEY `orderid` (`orderid`), - KEY `transid` (`transid`) -) TYPE=MyISAM COMMENT='Authorize.net refunds'; diff --git a/enrol/authorize/db/postgres7.sql b/enrol/authorize/db/postgres7.sql deleted file mode 100644 index 8f789e7aec8..00000000000 --- a/enrol/authorize/db/postgres7.sql +++ /dev/null @@ -1,32 +0,0 @@ -CREATE TABLE prefix_enrol_authorize ( - id SERIAL PRIMARY KEY, - paymentmethod varchar(6) default 'cc' NOT NULL, - cclastfour integer DEFAULT 0 NOT NULL, - ccname varchar(255) DEFAULT '', - courseid integer DEFAULT 0 NOT NULL, - userid integer DEFAULT 0 NOT NULL, - transid integer DEFAULT 0 NOT NULL, - status integer DEFAULT 0 NOT NULL, - timecreated integer DEFAULT 0 NOT NULL, - settletime integer DEFAULT 0 NOT NULL, - amount varchar(10) DEFAULT '0' NOT NULL, - currency varchar(3) DEFAULT 'USD' NOT NULL, - CONSTRAINT enroauth_pay_ck CHECK (paymentmethod IN ('cc', 'echeck')) -); - -CREATE INDEX prefix_enrol_authorize_courseid_idx ON prefix_enrol_authorize(courseid); -CREATE INDEX prefix_enrol_authorize_userid_idx ON prefix_enrol_authorize(userid); -CREATE INDEX prefix_enrol_authorize_status_idx ON prefix_enrol_authorize(status); -CREATE INDEX prefix_enrol_authorize_transid_idx ON prefix_enrol_authorize(transid); - -CREATE TABLE prefix_enrol_authorize_refunds ( - id SERIAL PRIMARY KEY, - orderid integer DEFAULT 0 NOT NULL, - status integer DEFAULT 0 NOT NULL, - amount varchar(10) DEFAULT '' NOT NULL, - transid integer DEFAULT 0, - settletime integer DEFAULT 0 NOT NULL -); - -CREATE INDEX prefix_enrol_authorize_refunds_orderid_idx ON prefix_enrol_authorize_refunds(orderid); -CREATE INDEX prefix_enrol_authorize_refunds_transid_idx ON prefix_enrol_authorize_refunds(transid); diff --git a/enrol/paypal/db/mysql.sql b/enrol/paypal/db/mysql.sql deleted file mode 100644 index b43cb7522dd..00000000000 --- a/enrol/paypal/db/mysql.sql +++ /dev/null @@ -1,23 +0,0 @@ -CREATE TABLE `prefix_enrol_paypal` ( - `id` int(10) unsigned NOT NULL auto_increment, - `business` varchar(255) NOT NULL default '', - `receiver_email` varchar(255) NOT NULL default '', - `receiver_id` varchar(255) NOT NULL default '', - `item_name` varchar(255) NOT NULL default '', - `courseid` int(10) unsigned NOT NULL default '0', - `userid` int(10) unsigned NOT NULL default '0', - `memo` varchar(255) NOT NULL default '', - `tax` varchar(255) NOT NULL default '', - `option_name1` varchar(255) NOT NULL default '', - `option_selection1_x` varchar(255) NOT NULL default '', - `option_name2` varchar(255) NOT NULL default '', - `option_selection2_x` varchar(255) NOT NULL default '', - `payment_status` varchar(255) NOT NULL default '', - `pending_reason` varchar(255) NOT NULL default '', - `reason_code` varchar(30) NOT NULL default '', - `txn_id` varchar(255) NOT NULL default '', - `parent_txn_id` varchar(255) NOT NULL default '', - `payment_type` varchar(30) NOT NULL default '', - `timeupdated` int(10) unsigned NOT NULL default '0', - PRIMARY KEY (`id`) -) TYPE=MyISAM COMMENT='Holds all known information about PayPal transactions' ; diff --git a/enrol/paypal/db/postgres7.sql b/enrol/paypal/db/postgres7.sql deleted file mode 100644 index dc3073b1c00..00000000000 --- a/enrol/paypal/db/postgres7.sql +++ /dev/null @@ -1,22 +0,0 @@ -CREATE TABLE prefix_enrol_paypal ( - id SERIAL PRIMARY KEY, - business varchar(255) NOT NULL default '', - receiver_email varchar(255) NOT NULL default '', - receiver_id varchar(255) NOT NULL default '', - item_name varchar(255) NOT NULL default '', - courseid integer NOT NULL default '0', - userid integer NOT NULL default '0', - memo varchar(255) NOT NULL default '', - tax varchar(255) NOT NULL default '', - option_name1 varchar(255) NOT NULL default '', - option_selection1_x varchar(255) NOT NULL default '', - option_name2 varchar(255) NOT NULL default '', - option_selection2_x varchar(255) NOT NULL default '', - payment_status varchar(255) NOT NULL default '', - pending_reason varchar(255) NOT NULL default '', - reason_code varchar(30) NOT NULL default '', - txn_id varchar(255) NOT NULL default '', - parent_txn_id varchar(255) NOT NULL default '', - payment_type varchar(30) NOT NULL default '', - timeupdated integer NOT NULL default '0' -); diff --git a/group/db/mysql.sql b/group/db/mysql.sql deleted file mode 100644 index bf9b69147ce..00000000000 --- a/group/db/mysql.sql +++ /dev/null @@ -1,117 +0,0 @@ -# phpMyAdmin SQL Dump -# version 2.8.1 -# http://www.phpmyadmin.net -# -# Host: localhost -# Generation Time: Oct 24, 2006 at 05:23 PM -# Server version: 5.0.21 -# PHP Version: 4.4.2-pl1 -# -# Database: `moodle` -# - -# -------------------------------------------------------- - -# -# Table structure for table `mdl_groups_courses_groupings` -# - -CREATE TABLE `prefix_groups_courses_groupings` ( - `id` int(10) unsigned NOT NULL auto_increment, - `courseid` int(10) unsigned NOT NULL default '0', - `groupingid` mediumint(9) NOT NULL default '0', - PRIMARY KEY (`id`), - UNIQUE KEY `id` (`id`), - KEY `courseid` (`courseid`) -) ENGINE=MyISAM ; - -# -------------------------------------------------------- - -# -# Table structure for table `prefix_groups_courses_groups` -# - -CREATE TABLE `prefix_groups_courses_groups` ( - `id` int(10) unsigned NOT NULL auto_increment, - `courseid` int(10) unsigned NOT NULL default '0', - `groupid` int(11) NOT NULL default '0', - PRIMARY KEY (`id`), - UNIQUE KEY `id` (`id`), - KEY `courseid` (`courseid`) -) ENGINE=MyISAM ; - -# -------------------------------------------------------- - -# -# Table structure for table `prefix_groups_groupings` -# - -CREATE TABLE `prefix_groups_groupings` ( - `id` int(10) unsigned NOT NULL auto_increment, - `name` varchar(254) NOT NULL, - `description` text NOT NULL default '', - `timecreated` int(10) unsigned NOT NULL default '0', - `viewowngroup` tinyint(1) NOT NULL default 1, - `viewallgroupsmembers` tinyint(1) NOT NULL default 0, - `viewallgroupsactivities` tinyint(1) NOT NULL default 0, - `teachersgroupmark` tinyint(1) NOT NULL default 0, - `teachersgroupview` binary(1) NOT NULL default 0, - `teachersoverride` binary(1) NOT NULL default 0, - `teacherdeletable` binary(1) NOT NULL default 0, - PRIMARY KEY (`id`), - UNIQUE KEY `id` (`id`) -) ENGINE=MyISAM ; - -# -------------------------------------------------------- - -# -# Table structure for table `prefix_groups_groupings_groups` -# - -CREATE TABLE `prefix_groups_groupings_groups` ( - `id` int(10) unsigned NOT NULL auto_increment, - `groupingid` int(10) unsigned default '0', - `groupid` int(10) NOT NULL default '0', - `timeadded` int(10) unsigned NOT NULL default '0', - PRIMARY KEY (`id`), - UNIQUE KEY `id` (`id`), - KEY `courseid` (`groupingid`) -) ENGINE=MyISAM AUTO_INCREMENT=67 ; - -# -------------------------------------------------------- - -# -# Table structure for table `prefix_groups` -# - -CREATE TABLE `prefix_groups` ( - `id` int(10) unsigned NOT NULL auto_increment, - `name` varchar(255) NOT NULL, - `description` text NOT NULL default '', - `enrolmentkey` varchar(50) NOT NULL default '', - `lang` varchar(10) NOT NULL default 'en', - `theme` varchar(50) NOT NULL default '', - `picture` int(10) unsigned NOT NULL default '0', - `hidepicture` int(1) unsigned NOT NULL default '0', - `timecreated` int(10) unsigned NOT NULL default '0', - `timemodified` int(10) unsigned NOT NULL default '0', - PRIMARY KEY (`id`), - UNIQUE KEY `id` (`id`) -) ENGINE=MyISAM ; - -# -------------------------------------------------------- - -# -# Table structure for table `prefix_groups_members` -# - -CREATE TABLE `prefix_groups_members` ( - `id` int(10) unsigned NOT NULL auto_increment, - `groupid` int(10) unsigned NOT NULL default '0', - `userid` int(10) unsigned NOT NULL default '0', - `timeadded` int(10) unsigned NOT NULL default '0', - PRIMARY KEY (`id`), - UNIQUE KEY `id` (`id`), - KEY `groupid` (`groupid`), - KEY `userid` (`userid`) -) ENGINE=MyISAM ; diff --git a/group/db/postgres7.sql b/group/db/postgres7.sql deleted file mode 100644 index a21609b3527..00000000000 --- a/group/db/postgres7.sql +++ /dev/null @@ -1,65 +0,0 @@ - - -CREATE TABLE prefix_groups_courses_groupings ( - id SERIAL PRIMARY KEY, - courseid integer NOT NULL default 0, - groupingid integer NOT NULL default 0 -); -CREATE INDEX prefix_groups_courses_groupings_courseid_idx ON prefix_groups_courses_groupings (courseid); -COMMENT ON TABLE prefix_groups_courses_groupings IS 'New groupings (OU).'; - - -CREATE TABLE prefix_groups_courses_groups ( - id SERIAL PRIMARY KEY, - courseid integer NOT NULL default '0', - groupid integer NOT NULL default '0' -); -CREATE INDEX prefix_groups_courses_groups_courseid_idx ON prefix_groups_courses_groups (courseid); - - -CREATE TABLE prefix_groups_groupings ( - id SERIAL PRIMARY KEY, - name varchar(254) NOT NULL, - description text NOT NULL default '', - timecreated integer NOT NULL default 0, - viewowngroup integer NOT NULL default 1, - viewallgroupsmembers integer NOT NULL default 0, - viewallgroupsactivities integer NOT NULL default 0, - teachersgroupmark integer NOT NULL default 0, - teachersgroupview integer NOT NULL default 0, - teachersoverride integer NOT NULL default 0 -); - - -CREATE TABLE prefix_groups_groupings_groups ( - id SERIAL PRIMARY KEY, - groupingid integer NOT NULL default 0, - groupid integer NOT NULL default 0, - timeadded integer NOT NULL default 0 -); -CREATE INDEX prefix_groups_groupings_groups_groupingid_idx ON prefix_groups_groupings_groups (groupingid); - - -CREATE TABLE prefix_groups ( - id SERIAL PRIMARY KEY, - name varchar(255) NOT NULL, - description text NOT NULL default '', - enrolmentkey varchar(50) NOT NULL default '', - lang varchar(10) NOT NULL default 'en', - theme varchar(50) NOT NULL default '', - picture integer NOT NULL default '0', - hidepicture integer NOT NULL default '0', - timecreated integer NOT NULL default '0', - timemodified integer NOT NULL default '0' -); - - -CREATE TABLE prefix_groups_members ( - id SERIAL PRIMARY KEY, - groupid integer NOT NULL default '0', - userid integer NOT NULL default '0', - timeadded integer NOT NULL default '0' -); -CREATE INDEX prefix_groups_members_groupid_idx ON prefix_groups_members (groupid); -CREATE INDEX prefix_groups_members_userid_idx ON prefix_groups_members (userid); -COMMENT ON TABLE prefix_groups_members IS 'New groupings (OU).'; diff --git a/group/edit.php b/group/edit.php index cacbb5bf78e..af358da0005 100755 --- a/group/edit.php +++ b/group/edit.php @@ -16,12 +16,17 @@ require_once('lib.php'); require_once('edit_form.php'); /// get url variables +$courseid = required_param('courseid', PARAM_INT); $id = optional_param('id', false, PARAM_INT); $groupingid = optional_param('grouping', false, PARAM_INT); $newgrouping = optional_param('newgrouping', false, PARAM_INT); -$courseid = required_param('courseid', PARAM_INT); +$delete = optional_param('delete', 0, PARAM_BOOL); +$confirm = optional_param('confirm', 0, PARAM_BOOL); -$delete = optional_param('delete', false, PARAM_BOOL); +if (empty($CFG->enablegroupings)) { + // NO GROUPINGS YET! + $groupingid = GROUP_NOT_IN_GROUPING; +} /// Course must be valid if (!$course = get_record('course', 'id', $courseid)) { @@ -33,6 +38,18 @@ if ($delete && !$id) { error(get_string('errorinvalidgroup')); } +if ($delete && !$confirm) { + print_header(get_string('deleteselectedgroup', 'group'), get_string('deleteselectedgroup', 'group')); + $optionsyes = array('id'=>$id, 'delete'=>1, 'courseid'=>$courseid, 'sesskey'=>sesskey(), 'confirm'=>1); + $optionsno = array('id'=>$courseid); + if (!$group = get_record('groups', 'id', $id)) { + error('Group ID was incorrect'); + } + notice_yesno(get_string('deletegroupconfirm', 'group', $group->name), 'edit.php', 'index.php', $optionsyes, $optionsno, 'post', 'get'); + print_footer(); + die; +} + /// basic access control checks if ($id) { if (!$group = get_record('groups', 'id', $id)) { @@ -62,6 +79,9 @@ if (!empty($group)) { // Process delete action if ($delete) { + if (!confirm_sesskey()) { + error('Sesskey error'); + } if (groups_delete_group($id)) { redirect(groups_home_url($course->id, null, $groupingid, false)); } else { diff --git a/group/edit_form.php b/group/edit_form.php index 8e1a5a2e14a..f1d9a335059 100644 --- a/group/edit_form.php +++ b/group/edit_form.php @@ -47,12 +47,16 @@ class group_edit_form extends moodleform { $mform->setHelpButton('imagefile', array ('picture', get_string('helppicture')), true); } - + if ($group) { $buttonstr = get_string('save', 'group'); $mform->addElement('hidden','id', null); $mform->setType('id', PARAM_INT); - +if (empty($CFG->enablegroupings)) { + // NO GROUPINGS YET! + $mform->addElement('hidden', 'newgrouping', GROUP_NOT_IN_GROUPING); + $mform->setType('newgrouping', PARAM_INT); +} else { // Options to move group to another grouping $groupingids = groups_get_groupings($courseid); @@ -67,8 +71,9 @@ class group_edit_form extends moodleform { $mform->addElement('select', 'newgrouping', get_string('addgroupstogrouping', 'group'), $listgroupings); $mform->setDefault('newgrouping', $groupingid); } +} } - + if($groupingid) { $mform->addElement('hidden', 'grouping', $groupingid); $mform->setType('grouping', PARAM_INT); diff --git a/group/grouping.php b/group/grouping.php index 4bdcd8bb632..04324eb882a 100644 --- a/group/grouping.php +++ b/group/grouping.php @@ -18,6 +18,11 @@ $id = optional_param('id', false, PARAM_INT); $delete = optional_param('delete', false, PARAM_BOOL); +if (empty($CFG->enablegroupings)) { + // NO GROUPIGS YET! + error('No groupings yet'); +} + // Get the course information so we can print the header and // check the course id is valid $course = groups_get_course_info($courseid); diff --git a/group/groupui/addgroupstogrouping-form.html b/group/groupui/addgroupstogrouping-form.html deleted file mode 100644 index cc998c8bbb1..00000000000 --- a/group/groupui/addgroupstogrouping-form.html +++ /dev/null @@ -1,9 +0,0 @@ -<div id="addgroupstogroupingform" class="popup"> - <h3><?php print_string('addgroupstogrouping', 'group'); ?> <span id="selectedgroupingforaddinggroups"></span> - </h3> - <form action=""> - <p><select id="groupsnotingrouping" size="15" multiple="multiple" class="select"></select></p> - <p><input type="button" id="addgroupstogrouping" value="<?php print_string('addgroupstogrouping', 'group'); ?>" /></p> - <p><input type="button" id="canceladdgroupstogrouping" value="<?php print_string('cancel', 'group'); ?>" /></p> - </form> -</div> diff --git a/group/groupui/addgroupstogrouping-form.js b/group/groupui/addgroupstogrouping-form.js deleted file mode 100644 index 9a9e90accf0..00000000000 --- a/group/groupui/addgroupstogrouping-form.js +++ /dev/null @@ -1,73 +0,0 @@ - - -function onAddGroupsToGrouping() { - hideAllForms(); - showElement("groupeditform"); - addGroupsToGrouping(); - setText('selectedgroupingforaddinggroups', ""); - return false; -} - - -/* - * Adds the selected groups to the selected groupings - */ -function addGroupsToGrouping() { - //alert("Called addGroupsToGrouping"); - selectedgroups = getMultipleSelect("groupsnotingrouping"); - if (selectedgroups != '') { - var url = "addgroupstogrouping-xml.php"; - var requeststring = "groupingid="+selectedgroupingid - +"&groups="+selectedgroups; - sendPostRequest(request, url, requeststring, addGroupsToGroupingResponse); - } -} - - -/** - * The callback for the response to the request sent in addGroupsToGrouping() - */ -function addGroupsToGroupingResponse() { - if (checkAjaxResponse(request)) { - //alert("addGroupsToGrouping called"); - //alert(request.responseText); - // Need XML sent back with groupingid - // Really want to set this to be the grouping before - error = getFromXML(request.responseXML, 'error'); - if (error != null) { - alert(error); - } - updateGroupings(); - hideElement("addgroupstogroupingform"); - } -} - - -/** - * Updates the groups not in the selected grouping for the form for adding groups to a grouping - */ -function updateGroupsNotInGrouping() { - //alert("updateNonMembers called"); - var url="getgroupsnotingrouping-xml.php"; - var requeststring = "groupingid="+selectedgroupingid; - sendPostRequest(request, url, requeststring, updateGroupsNotInGroupingResponse); -} - - -/** - * The callback for the response to the request sent in updateGroupsNotInGrouping() - */ -function updateGroupsNotInGroupingResponse() { - if (checkAjaxResponse(request)) { - //alert("updateGroupsNotInGroupingResponse"); - var xmlDoc = request.responseXML; - //alert(request.responseText); - error = getFromXML(request.responseXML, 'error'); - if (error != null) { - alert(error); - } - addOptionsFromXML("groupsnotingrouping", xmlDoc); - } -} - - diff --git a/group/groupui/addgroupstogrouping-xml.php b/group/groupui/addgroupstogrouping-xml.php deleted file mode 100644 index 9e3850f737b..00000000000 --- a/group/groupui/addgroupstogrouping-xml.php +++ /dev/null @@ -1,37 +0,0 @@ -<?php -/** - * Adds an existing group to a grouping. - * - * @copyright © 2006 The Open University - * @author J.White AT open.ac.uk - * @license http://www.gnu.org/copyleft/gpl.html GNU Public License - * @package groups - */ -require_once('../../config.php'); -require_once('../lib/lib.php'); - -@header('Content-Type: text/xml; charset=utf-8'); -echo '<?xml version="1.0" encoding="utf-8"?>'; -echo '<groupsresponse>'; - -$courseid = required_param('courseid', PARAM_INT); -$groupingid = required_param('groupingid', PARAM_INT); -$groups = required_param('groups', PARAM_SEQUENCE); //TODO: check. - -require_login($courseid); - -if (confirm_sesskey() and isteacheredit($courseid)) { - $groupids = explode(',', $groups); - - if ($groupids != false) { - foreach($groupids as $groupid) { - $groupadded = groups_add_group_to_grouping($groupid, $groupingid); - if (!$groupadded) { - echo '<error>Failed to add group $groupid to grouping</error>'; - } - } - } -} - -echo '</groupsresponse>'; -?> diff --git a/group/groupui/addmembers-form.html b/group/groupui/addmembers-form.html deleted file mode 100644 index 54847fcf670..00000000000 --- a/group/groupui/addmembers-form.html +++ /dev/null @@ -1,9 +0,0 @@ -<div id="addmembersform" class="popup"> - <h3><?php print_string('adduserstogroup', 'group'); ?> <span id="selectedgroup"></span></h3> - <form action=""> - <p><input type="checkbox" id="showall" /><?php print_string('showusersalreadyingroup', 'group'); ?> </p> - <p><select id="nonmembers" size="15" multiple="multiple" class="select"></select></p> - <p><input type="button" id="addmembers" value="<?php print_string('adduserstogroup', 'group'); ?>" /></p> - <p><input type="button" id="canceladdmembers" value="<?php print_string('cancel', 'group'); ?>" /></p> - </form> -</div> diff --git a/group/groupui/addmembers-form.js b/group/groupui/addmembers-form.js deleted file mode 100644 index 9aa54bb728c..00000000000 --- a/group/groupui/addmembers-form.js +++ /dev/null @@ -1,79 +0,0 @@ -function onAddMembers() { - hideAllForms(); - showElement("groupeditform"); - addMembers(); - return false; -} - -function onShowAll() { - updateNonMembers(); - return false; -} - - - -/* - * Adds the selected users to the selected group - */ -function addMembers() { - //alert("Called addMembers"); - users = getMultipleSelect("nonmembers"); - if (users != '') { - var url = "addmembers-xml.php"; - var requeststring = "groupid="+selectedgroupid+"&users="+users; - sendPostRequest(request, url, requeststring, addMembersResponse); - } -} - -/** - * The callback for the response to the request sent in addMembers() - */ -function addMembersResponse() { - if (checkAjaxResponse(request)) { - //alert("addMembersResponse called"); - //alert(request.responseText); - // Need XML sent back with groupingid - // Really want to set this to be the grouping before - error = getFromXML(request.responseXML, 'error'); - if (error != null) { - alert(error); - } - updateSelectedGrouping(); - hideElement("addmembersform"); - } -} - - -/** - * Updates the list of non members of a group in the form for adding members to a group - */ -function updateNonMembers() { - //alert("updateNonMembers called"); - var url="getnonmembers-xml.php"; - // showall indicates if we should show users already in groups in the grouping - // we have to turn it into a variable that we can put in a post - var showall = getCheckBoxValue('showall');; - var requeststring = "groupid="+selectedgroupid - +"&groupingid="+selectedgroupingid - +"&showall="+showall; - - sendPostRequest(request, url, requeststring, updateNonMembersResponse); -} - -/** - * The callback for the response to the request sent in updateNonMembers() - */ -function updateNonMembersResponse() { - if (checkAjaxResponse(request)) { - //alert("updateNonMembersResponse"); - var xmlDoc = request.responseXML; - // alert(request.responseText); - error = getFromXML(request.responseXML, 'error'); - if (error != null) { - alert(error); - } - addOptionsFromXML("nonmembers", xmlDoc); - } -} - - diff --git a/group/groupui/addmembers-xml.php b/group/groupui/addmembers-xml.php deleted file mode 100644 index b31478d019a..00000000000 --- a/group/groupui/addmembers-xml.php +++ /dev/null @@ -1,33 +0,0 @@ -<?php -/********************************************** - * Adds users to a group - **********************************************/ - -require_once('../../config.php'); -require_once('../lib/lib.php'); - -@header('Content-Type: text/xml; charset=utf-8'); -echo '<?xml version="1.0" encoding="utf-8"?>'; -echo '<groupsresponse>'; - -$courseid = required_param('courseid', PARAM_INT); -$groupid = required_param('groupid', PARAM_INT); -$users = required_param('users', PARAM_SEQUENCE); - -require_login($courseid); - -if (confirm_sesskey() and isteacheredit($courseid)) { - $userids = explode(',', $users); - - if ($userids != false) { - foreach($userids as $userid) { - $useradded = groups_add_member($groupid, $userid); - if (!$useradded) { - echo '<error>Failed to add user $userid to group</error>'; - } - } - } -} - -echo '</groupsresponse>'; -?> diff --git a/group/groupui/ajax.js b/group/groupui/ajax.js deleted file mode 100644 index eab802eb7e3..00000000000 --- a/group/groupui/ajax.js +++ /dev/null @@ -1,77 +0,0 @@ -/*********************************************************************************************************** - * Contains functions for creating and sending Ajax requests. - * This code needs to be a bit more careful about creating separate requests for different events - if - * somebody presses a button several times in quick succession (such as the delete grouping button) then - * we get an error. - * There also seems to a problem with IE - need to check this out - ***********************************************************************************************************/ - - -<?php - echo "var courseid = $courseid;"; - echo "var sesskey = '$sesskey';"; -?> - -/* - * Creates an XMLHttpRequest object - * @return The XMLHttpRequest object created. - */ -function createRequest() { - var newrequest = null; - try { - newrequest = new XMLHttpRequest(); - } catch (trymicrosoft) { - // Deal with Microsoft browsers - try { - newrequest = new ActiveXObject("Msxml2.XMLHTTP"); - } catch (othermicrosoft) { - try { - newrequest = new ActiveXObject("Microsoft.XMLHTTP"); - } catch (failed) { - newrequest = null; - } - } - } - - if (newrequest == null) { - alert("Error creating request object!"); - } else { - return newrequest; - } -} - -/* - * Sends an Ajax post request - * @param request - The XMLHttpRequest object - * @param url - The URL to send the request to - * @param requeststring - The string containing the variables to send in the post request - the format - * is basically the same as a GET string - * @callbackfunction - The function to call when the response to the request is received -*/ -function sendPostRequest(postrequest, url, requeststring, callbackfunction) { - // Add on the date and time to get round caching problem - url = url + "?dummy=" + new Date().getTime(); - // Add the course id and sesskey so we can check these on the server - requeststring = 'courseid='+courseid+'&'+'sesskey='+sesskey+'&'+requeststring; - postrequest.abort(); - postrequest.open('post', url, true); - postrequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); - postrequest.onreadystatechange = callbackfunction; - postrequest.send(requeststring); -} - -function checkAjaxResponse(request) { - process = false; - - if (request.readyState == 4 && request.status == 200) { - process = true; - } - if (request.readyState == 4 && request.status != 200) { - alert('An error has occurred - the page returned a '+ request.status + ' error'); - } - return process; -} - -var responseFailure = function(o){ - alert("Failure callback"); -} diff --git a/group/groupui/connection.js b/group/groupui/connection.js deleted file mode 100644 index 670a10600d6..00000000000 --- a/group/groupui/connection.js +++ /dev/null @@ -1,775 +0,0 @@ -/* -Copyright (c) 2006, Yahoo! Inc. All rights reserved. -Code licensed under the BSD License: -http://developer.yahoo.net/yui/license.txt -version: 0.11.0 -*/ - -/** - * The Connection Manager provides a simplified interface to the XMLHttpRequest - * object. It handles cross-browser instantiantion of XMLHttpRequest, negotiates the - * interactive states and server response, returning the results to a pre-defined - * callback you create. - * @ class - */ -YAHOO.util.Connect = -{ -/** - * Array of MSFT ActiveX ids for XMLHttpRequest. - * @private - * @type array - */ - _msxml_progid:[ - 'MSXML2.XMLHTTP.3.0', - 'MSXML2.XMLHTTP', - 'Microsoft.XMLHTTP' - ], - - /** - * Object literal of HTTP header(s) - * @private - * @type object - */ - _http_header:{}, - - /** - * Determines if HTTP headers are set. - * @private - * @type boolean - */ - _has_http_headers:false, - - /** - * Determines if a default header of - * Content-Type of 'application/x-www-form-urlencoded' - * will be added to any client HTTP headers sent for POST - * transactions. - * @private - * @type boolean - */ - _default_post_header:true, - - /** - * Property modified by setForm() to determine if the data - * should be submitted as an HTML form. - * @private - * @type boolean - */ - _isFormSubmit:false, - - /** - * Property modified by setForm() to determine if a file(s) - * upload is expected. - * @private - * @type boolean - */ - _isFileUpload:false, - - /** - * Property modified by setForm() to set a reference to the HTML - * form node if the desired action is file upload. - * @private - * @type object - */ - _formNode:null, - - /** - * Property modified by setForm() to set the HTML form data - * for each transaction. - * @private - * @type string - */ - _sFormData:null, - - /** - * Collection of polling references to the polling mechanism in handleReadyState. - * @private - * @type string - */ - _poll:[], - - /** - * Queue of timeout values for each transaction callback with a defined timeout value. - * @private - * @type string - */ - _timeOut:[], - - /** - * The polling frequency, in milliseconds, for HandleReadyState. - * when attempting to determine a transaction's XHR readyState. - * The default is 50 milliseconds. - * @private - * @type int - */ - _polling_interval:50, - - /** - * A transaction counter that increments the transaction id for each transaction. - * @private - * @type int - */ - _transaction_id:0, - - /** - * Member to add an ActiveX id to the existing xml_progid array. - * In the event(unlikely) a new ActiveX id is introduced, it can be added - * without internal code modifications. - * @public - * @param string id The ActiveX id to be added to initialize the XHR object. - * @return void - */ - setProgId:function(id) - { - this._msxml_progid.unshift(id); - }, - - /** - * Member to enable or disable the default POST header. - * @public - * @param boolean b Set and use default header - true or false . - * @return void - */ - setDefaultPostHeader:function(b) - { - this._default_post_header = b; - }, - - /** - * Member to modify the default polling interval. - * @public - * @param {int} i The polling interval in milliseconds. - * @return void - */ - setPollingInterval:function(i) - { - if(typeof i == 'number' && isFinite(i)){ - this._polling_interval = i; - } - }, - - /** - * Instantiates a XMLHttpRequest object and returns an object with two properties: - * the XMLHttpRequest instance and the transaction id. - * @private - * @param {int} transactionId Property containing the transaction id for this transaction. - * @return connection object - */ - createXhrObject:function(transactionId) - { - var obj,http; - try - { - // Instantiates XMLHttpRequest in non-IE browsers and assigns to http. - http = new XMLHttpRequest(); - // Object literal with http and tId properties - obj = { conn:http, tId:transactionId }; - } - catch(e) - { - for(var i=0; i<this._msxml_progid.length; ++i){ - try - { - // Instantiates XMLHttpRequest for IE and assign to http. - http = new ActiveXObject(this._msxml_progid[i]); - // Object literal with http and tId properties - obj = { conn:http, tId:transactionId }; - break; - } - catch(e){} - } - } - finally - { - return obj; - } - }, - - /** - * This method is called by asyncRequest to create a - * valid connection object for the transaction. It also passes a - * transaction id and increments the transaction id counter. - * @private - * @return object - */ - getConnectionObject:function() - { - var o; - var tId = this._transaction_id; - - try - { - o = this.createXhrObject(tId); - if(o){ - this._transaction_id++; - } - } - catch(e){} - finally - { - return o; - } - }, - - /** - * Method for initiating an asynchronous request via the XHR object. - * @public - * @param {string} method HTTP transaction method - * @param {string} uri Fully qualified path of resource - * @param callback User-defined callback function or object - * @param {string} postData POST body - * @return {object} Returns the connection object - */ - asyncRequest:function(method, uri, callback, postData) - { - var o = this.getConnectionObject(); - - if(!o){ - return null; - } - else{ - if(this._isFormSubmit){ - if(this._isFileUpload){ - this.uploadFile(o.tId, callback, uri); - this.releaseObject(o); - return; - } - - //If the specified HTTP method is GET, setForm() will return an - //encoded string that is concatenated to the uri to - //create a querystring. - if(method == 'GET'){ - uri += "?" + this._sFormData; - } - else if(method == 'POST'){ - postData = this._sFormData; - } - this._sFormData = ''; - } - - o.conn.open(method, uri, true); - - if(this._isFormSubmit || (postData && this._default_post_header)){ - this.initHeader('Content-Type','application/x-www-form-urlencoded'); - if(this._isFormSubmit){ - this._isFormSubmit = false; - } - } - - //Verify whether the transaction has any user-defined HTTP headers - //and set them. - if(this._has_http_headers){ - this.setHeader(o); - } - - this.handleReadyState(o, callback); - postData?o.conn.send(postData):o.conn.send(null); - - return o; - } - }, - - /** - * This method serves as a timer that polls the XHR object's readyState - * property during a transaction, instead of binding a callback to the - * onreadystatechange event. Upon readyState 4, handleTransactionResponse - * will process the response, and the timer will be cleared. - * - * @private - * @param {object} o The connection object - * @param callback User-defined callback object - * @return void - */ - handleReadyState:function(o, callback) - { - var timeOut = callback.timeout; - var oConn = this; - - try - { - if(timeOut !== undefined){ - this._timeOut[o.tId] = window.setTimeout(function(){ oConn.abort(o, callback, true) }, timeOut); - } - this._poll[o.tId] = window.setInterval( - function(){ - if(o.conn && o.conn.readyState == 4){ - window.clearInterval(oConn._poll[o.tId]); - oConn._poll.splice(o.tId); - if(timeOut){ - oConn._timeOut.splice(o.tId); - } - - oConn.handleTransactionResponse(o, callback); - } - } - ,this._polling_interval); - } - catch(e) - { - window.clearInterval(oConn._poll[o.tId]); - oConn._poll.splice(o.tId); - if(timeOut){ - oConn._timeOut.splice(o.tId); - } - - oConn.handleTransactionResponse(o, callback); - } - }, - - /** - * This method attempts to interpret the server response and - * determine whether the transaction was successful, or if an error or - * exception was encountered. - * - * @private - * @param {object} o The connection object - * @param {object} callback - User-defined callback object - * @param {boolean} determines if the transaction was aborted. - * @return void - */ - handleTransactionResponse:function(o, callback, isAbort) - { - // If no valid callback is provided, then do not process any callback handling. - if(!callback){ - this.releaseObject(o); - return; - } - - var httpStatus, responseObject; - - try - { - if(o.conn.status !== undefined && o.conn.status != 0){ - httpStatus = o.conn.status; - } - else{ - httpStatus = 13030; - } - } - catch(e){ - // 13030 is the custom code to indicate the condition -- in Mozilla/FF -- - // when the o object's status and statusText properties are - // unavailable, and a query attempt throws an exception. - httpStatus = 13030; - } - - if(httpStatus >= 200 && httpStatus < 300){ - responseObject = this.createResponseObject(o, callback.argument); - if(callback.success){ - if(!callback.scope){ - callback.success(responseObject); - } - else{ - // If a scope property is defined, the callback will be fired from - // the context of the object. - callback.success.apply(callback.scope, [responseObject]); - } - } - } - else{ - switch(httpStatus){ - // The following case labels are wininet.dll error codes that may be encountered. - // Server timeout - case 12002: - // 12029 to 12031 correspond to dropped connections. - case 12029: - case 12030: - case 12031: - // Connection closed by server. - case 12152: - // See above comments for variable status. - case 13030: - responseObject = this.createExceptionObject(o.tId, callback.argument, isAbort); - if(callback.failure){ - if(!callback.scope){ - callback.failure(responseObject); - } - else{ - callback.failure.apply(callback.scope, [responseObject]); - } - } - break; - default: - responseObject = this.createResponseObject(o, callback.argument); - if(callback.failure){ - if(!callback.scope){ - callback.failure(responseObject); - } - else{ - callback.failure.apply(callback.scope, [responseObject]); - } - } - } - } - - this.releaseObject(o); - }, - - /** - * This method evaluates the server response, creates and returns the results via - * its properties. Success and failure cases will differ in the response - * object's property values. - * @private - * @param {object} o The connection object - * @param {} callbackArg User-defined argument or arguments to be passed to the callback - * @return object - */ - createResponseObject:function(o, callbackArg) - { - var obj = {}; - var headerObj = {}; - - try - { - var headerStr = o.conn.getAllResponseHeaders(); - var header = headerStr.split('\n'); - for(var i=0; i < header.length; i++){ - var delimitPos = header[i].indexOf(':'); - if(delimitPos != -1){ - headerObj[header[i].substring(0,delimitPos)] = header[i].substring(delimitPos+1); - } - } - } - catch(e){} - - obj.tId = o.tId; - obj.status = o.conn.status; - obj.statusText = o.conn.statusText; - obj.getResponseHeader = headerObj; - obj.getAllResponseHeaders = headerStr; - obj.responseText = o.conn.responseText; - obj.responseXML = o.conn.responseXML; - - if(typeof callbackArg !== undefined){ - obj.argument = callbackArg; - } - - return obj; - }, - - /** - * If a transaction cannot be completed due to dropped or closed connections, - * there may be not be enough information to build a full response object. - * The failure callback will be fired and this specific condition can be identified - * by a status property value of 0. - * - * If an abort was successful, the status property will report a value of -1. - * - * @private - * @param {int} tId Transaction Id - * @param callbackArg The user-defined arguments - * @param isAbort Determines if the exception is an abort. - * @return object - */ - createExceptionObject:function(tId, callbackArg, isAbort) - { - var COMM_CODE = 0; - var COMM_ERROR = 'communication failure'; - var ABORT_CODE = -1; - var ABORT_ERROR = 'transaction aborted'; - - var obj = {}; - - obj.tId = tId; - if(isAbort){ - obj.status = ABORT_CODE; - obj.statusText = ABORT_ERROR; - } - else{ - obj.status = COMM_CODE; - obj.statusText = COMM_ERROR; - } - - if(callbackArg){ - obj.argument = callbackArg; - } - - return obj; - }, - - /** - * Public method that stores the custom HTTP headers for each transaction. - * @public - * @param {string} label The HTTP header label - * @param {string} value The HTTP header value - * @return void - */ - initHeader:function(label,value) - { - if(this._http_header[label] === undefined){ - this._http_header[label] = value; - } - else{ - this._http_header[label] = value + "," + this._http_header[label]; - } - - this._has_http_headers = true; - }, - - /** - * Accessor that sets the HTTP headers for each transaction. - * @private - * @param {object} o The connection object for the transaction. - * @return void - */ - setHeader:function(o) - { - for(var prop in this._http_header){ - if(this._http_header.propertyIsEnumerable){ - o.conn.setRequestHeader(prop, this._http_header[prop]); - } - } - delete this._http_header; - - this._http_header = {}; - this._has_http_headers = false; - }, - - /** - * This method assembles the form label and value pairs and - * constructs an encoded string. - * asyncRequest() will automatically initialize the - * transaction with a HTTP header Content-Type of - * application/x-www-form-urlencoded. - * @public - * @param {string || object} form id or name attribute, or form object. - * @param {string} optional boolean to indicate SSL environment. - * @param {string} optional qualified path of iframe resource for SSL in IE. - * @return void - */ - setForm:function(formId, isUpload, secureUri) - { - this._sFormData = ''; - if(typeof formId == 'string'){ - // Determine if the argument is a form id or a form name. - // Note form name usage is deprecated by supported - // here for legacy reasons. - var oForm = (document.getElementById(formId) || document.forms[formId]); - } - else if(typeof formId == 'object'){ - var oForm = formId; - } - else{ - return; - } - - // If the isUpload argument is true, setForm will call createFrame to initialize - // an iframe as the form target. - // - // The argument secureURI is also required by IE in SSL environments - // where the secureURI string is a fully qualified HTTP path, used to set the source - // of the iframe, to a stub resource in the same domain. - if(isUpload){ - (typeof secureUri == 'string')?this.createFrame(secureUri):this.createFrame(); - this._isFormSubmit = true; - this._isFileUpload = true; - this._formNode = oForm; - - return; - } - - var oElement, oName, oValue, oDisabled; - var hasSubmit = false; - - // Iterate over the form elements collection to construct the - // label-value pairs. - for (var i=0; i<oForm.elements.length; i++){ - oDisabled = oForm.elements[i].disabled; - - // If the name attribute is not populated, the form field's - // value will not be submitted. - oElement = oForm.elements[i]; - oName = oForm.elements[i].name; - oValue = oForm.elements[i].value; - - // Do not submit fields that are disabled or - // do not have a name attribute value. - if(!oDisabled && oName) - { - switch (oElement.type) - { - case 'select-one': - case 'select-multiple': - for(var j=0; j<oElement.options.length; j++){ - if(oElement.options[j].selected){ - this._sFormData += encodeURIComponent(oName) + '=' + encodeURIComponent(oElement.options[j].value || oElement.options[j].text) + '&'; - } - } - break; - case 'radio': - case 'checkbox': - if(oElement.checked){ - this._sFormData += encodeURIComponent(oName) + '=' + encodeURIComponent(oValue) + '&'; - } - break; - case 'file': - // stub case as XMLHttpRequest will only send the file path as a string. - case undefined: - // stub case for fieldset element which returns undefined. - case 'reset': - // stub case for input type reset button. - case 'button': - // stub case for input type button elements. - break; - case 'submit': - if(hasSubmit == false){ - this._sFormData += encodeURIComponent(oName) + '=' + encodeURIComponent(oValue) + '&'; - hasSubmit = true; - } - break; - default: - this._sFormData += encodeURIComponent(oName) + '=' + encodeURIComponent(oValue) + '&'; - break; - } - } - } - - this._isFormSubmit = true; - this._sFormData = this._sFormData.substr(0, this._sFormData.length - 1); - }, - - /** - * Creates an iframe to be used for form file uploads. It is remove from the - * document upon completion of the upload transaction. - * - * @private - * @param {string} optional qualified path of iframe resource for SSL in IE. - * @return void - */ - createFrame:function(secureUri){ - - // IE does not allow the setting of id and name attributes as DOM - // properties. A different iframe creation pattern is required for IE. - if(window.ActiveXObject){ - var io = document.createElement('<IFRAME name="ioFrame" id="ioFrame">'); - if(secureUri){ - // IE will throw a security exception in an SSL environment if the - // iframe source isn't set to a valid resource. - io.src = secureUri; - } - } - else{ - var io = document.createElement('IFRAME'); - io.id = 'ioFrame'; - io.name = 'ioFrame'; - } - - io.style.position = 'absolute'; - io.style.top = '-1000px'; - io.style.left = '-1000px'; - - document.body.appendChild(io); - }, - - /** - * Uploads HTML form, including files/attachments, targeting the - * iframe created in createFrame. - * - * @private - * @param {int} id The transaction id. - * @param {object} callback - User-defined callback object. - * @param {string} uri Fully qualified path of resource. - * @return void - */ - uploadFile:function(id, callback, uri){ - // Initialize the HTML form properties in case they are - // not defined in the HTML form. - this._formNode.action = uri; - this._formNode.enctype = 'multipart/form-data'; - this._formNode.method = 'POST'; - this._formNode.target = 'ioFrame'; - this._formNode.submit(); - - // Reset form status properties. - this._formNode = null; - this._isFileUpload = false; - this._isFormSubmit = false; - - // Create the upload callback handler that fires when the iframe - // receives the load event. Subsequently, the event handler is detached - // and the iframe removed from the document. - - var uploadCallback = function() - { - var oResponse = - { - tId: id, - responseText: document.getElementById("ioFrame").contentWindow.document.body.innerHTML, - argument: callback.argument - } - - if(callback.upload && !callback.scope){ - callback.upload(oResponse); - } - else{ - callback.upload.apply(callback.scope, [oResponse]); - } - - YAHOO.util.Event.removeListener("ioFrame", "load", uploadCallback); - window.ioFrame.location.replace('#'); - setTimeout("document.body.removeChild(document.getElementById('ioFrame'))",100); - }; - - // Bind the onload handler to the iframe to detect the file upload response. - YAHOO.util.Event.addListener("ioFrame", "load", uploadCallback); - }, - - /** - * Public method to terminate a transaction, if it has not reached readyState 4. - * @public - * @param {object} o The connection object returned by asyncRequest. - * @param {object} callback User-defined callback object. - * @param {string} isTimeout boolean to indicate if abort was a timeout. - * @return void - */ - abort:function(o, callback, isTimeout) - { - if(this.isCallInProgress(o)){ - window.clearInterval(this._poll[o.tId]); - this._poll.splice(o.tId); - if(isTimeout){ - this._timeOut.splice(o.tId); - } - o.conn.abort(); - this.handleTransactionResponse(o, callback, true); - - return true; - } - else{ - return false; - } - }, - - /** - * Public method to check if the transaction is still being processed. - * @public - * @param {object} o The connection object returned by asyncRequest - * @return boolean - */ - isCallInProgress:function(o) - { - // if the XHR object assigned to the transaction has not been dereferenced, - // then check its readyState status. Otherwise, return false. - if(o.conn){ - return o.conn.readyState != 4 && o.conn.readyState != 0; - } - else{ - //The XHR object has been destroyed. - return false; - } - }, - - /** - * Dereference the XHR instance and the connection object after the transaction is completed. - * @private - * @param {object} o The connection object - * @return void - */ - releaseObject:function(o) - { - //dereference the XHR instance. - o.conn = null; - //dereference the connection object. - o = null; - } -}; diff --git a/group/groupui/createautomaticgrouping-form.html b/group/groupui/createautomaticgrouping-form.html deleted file mode 100644 index 282fe1c7acf..00000000000 --- a/group/groupui/createautomaticgrouping-form.html +++ /dev/null @@ -1,54 +0,0 @@ -<div id="createautomaticgroupingform" class="popupwide"> -<h3><?php print_string('createautomaticgrouping', 'group'); ?></h3> -<form name="automaticgroupingform" action=""> - -<table cellpadding="10"> - <tr> - <td valign="top"> - <p><?php print_string('groupingname', 'group'); ?></p> - <p><input id="automaticgroupingname" type="text" size="40" value="<?php print_string('defaultgroupingname', 'group'); ?>" /></p> - <p><?php print_string('groupingdescription', 'group'); ?></p> - <p><?php print_textarea($usehtmleditor, 4, 45, 150, 400, 'automaticgroupingdescription'); ?></p> - <p> <?php print_string('prefixforgroupnames', 'group'); ?> </p> - <p><input id="groupprefix" type="text" size="40 " value="<?php print_string('defaultgroupname', 'group'); ?> " /></p> - <p><?php print_string('defaultgroupdescription', 'group'); ?></p> - <p><?php print_textarea($usehtmleditor, 4, 45, 150, 400, 'defaultgroupdescription'); ?></p> - </td> - <td valign="top"> - <p><input type="checkbox" id="alphabetical" /> <?php print_string('distributealphabetically', 'group'); ?></p> - <table> - <tr> - <td><input type="radio" name ="generationtype" id="nostudents" value="nostudents" checked /> - </td> - <td> <?php print_string('selectnumberineachgroup', 'group'); ?> - </td> - </tr> - <tr> - <td> </td> - <td> - <p><?php print_string('numberofstudents', 'group'); ?> </p><p><input id="noofstudents" type="text" size="5" /></p> - <p><input type="checkbox" id="distribevenly" checked /> <?php print_string('distributeevenly', 'group'); ?></p> - </td> - </tr> - </table> - - <table> - <tr> - <td><input type="radio" name ="generationtype" id="nogroups" value="nogroups" /></td> - <td><?php print_string('selectnumberofgroups', 'group'); ?></td> - </tr> - <tr> - <td> </td> - <td> - <p><?php print_string('numberofgroups', 'group'); ?></p><p> <input id="noofgroups" type="text" size="5" /></p> - </td> - </tr> - </table> - - <p><input type="button" id="createautomaticgrouping" value=" <?php print_string('creategrouping', 'group'); ?>" /> - <input type="button" id="cancelcreateautomaticgrouping" value=" <?php print_string('cancel', 'group'); ?>" /></p> - </td> - </tr> -</table> -</form> -</div> diff --git a/group/groupui/createautomaticgrouping-form.js b/group/groupui/createautomaticgrouping-form.js deleted file mode 100644 index 9a0020d4528..00000000000 --- a/group/groupui/createautomaticgrouping-form.js +++ /dev/null @@ -1,79 +0,0 @@ -function onCreateAutomaticGrouping() { - valid = validateAutomaticGroupingForm(); - if (valid) { - hideAllForms(); - showElement("groupeditform"); - createAutomaticGrouping(); - } - - return false; -} - - -/** - * Adds an automatically generated grouping with the details as specified in the form - */ -function createAutomaticGrouping() { - //alert("Called createAutomaticGrouping"); - var url = "createautomaticgrouping-xml.php"; - var requeststring = "noofstudents="+getTextInputValue('noofstudents') - +"&noofgroups="+getTextInputValue('noofgroups') - +"&distribevenly="+getCheckBoxValue('distribevenly') - +"&alphabetical="+getCheckBoxValue('alphabetical') - +"&generationtype="+getRadioValue(document.automaticgroupingform.generationtype) - +"&name="+getTextInputValue('automaticgroupingname') - +"&description="+getTextInputValue('edit-automaticgroupingdescription') - +"&prefix="+getTextInputValue('groupprefix') - +"&defaultgroupdescription="+getTextInputValue('edit-defaultgroupdescription'); - - // alert(requeststring); - sendPostRequest(request, url, requeststring, createAutomaticGroupingResponse); -} - - - - /** - * The callback for the response to the request sent in createAutomaticGrouping() - * It sets the new grouping to be selected in the form. - */ - function createAutomaticGroupingResponse() { - if (checkAjaxResponse(request)) { - //alert("createAutomaticGroupingResponse"); - //alert(request.responseText); - error = getFromXML(request.responseXML, 'error'); - if (error != null) { - alert(error); - } - selectedgroupingid = getFromXML(request.responseXML, 'groupingid'); - selectedgroupid = null; - updateGroupings(); - hideElement("createautomaticgroupingform"); - } - } - -function validateAutomaticGroupingForm() { - valid = true; - generationtype = getRadioValue(document.automaticgroupingform.generationtype); - noofstudents = getTextInputValue('noofstudents'); - noofgroups = getTextInputValue('noofgroups'); - groupingname = getTextInputValue('automaticgroupingname'); - - if (generationtype == 'nostudents') { - if (!isPositiveInt(noofstudents)) { - alert('The number of students is not valid.'); - valid = false; - } - } else { - if (!isPositiveInt(noofgroups)) { - alert('The number of groups is not valid.'); - valid = false; - } - } - - if (groupingname == '') { - alert('You must enter a name for the new grouping'); - valid = false; - } - - return valid; -} diff --git a/group/groupui/createautomaticgrouping-xml.php b/group/groupui/createautomaticgrouping-xml.php deleted file mode 100644 index 14e00ec235b..00000000000 --- a/group/groupui/createautomaticgrouping-xml.php +++ /dev/null @@ -1,46 +0,0 @@ -<?php -/********************************************** - * Sets up an automatic grouping - **********************************************/ - -require_once('../../config.php'); -require_once('../lib/lib.php'); - -@header('Content-Type: text/xml; charset=utf-8'); -echo '<?xml version="1.0" encoding="utf-8"?>'; -echo '<groupsresponse>'; - -require_login($courseid); - -groups_seed_random_number_generator(); - -$courseid = required_param('courseid', PARAM_INT); - -$noofstudents = required_param('noofstudents', PARAM_INT); -$noofgroups = required_param('noofgroups', PARAM_INT); -$distribevenly = required_param('distribevenly', PARAM_INT); //TODO: PARAM_BOOL ? -$alphabetical = required_param('alphabetical', PARAM_INT); -$generationtype = required_param('generationtype', PARAM_ALPHA); - -$groupingsettings->name = required_param('name', PARAM_ALPHANUM); -$groupingsettings->description = required_param('description', PARAM_ALPHANUM); -$groupingsettings->prefix = required_param('prefix'); -$groupingsettings->defaultgroupdescription = required_param('defaultgroupdescription'); - - -if (confirm_sesskey() and isteacheredit($courseid)) { - if ($generationtype == 'nogroups') { - $noofstudents = false; - } - - $groupingid = groups_create_automatic_grouping($courseid, $noofstudents, $noofgroups, - $distribevenly, $groupingsettings, false, $alphabetical); - if (!$groupingid) { - echo '<error>Failed to create grouping</error>'; - } else { - echo '<groupingid>'.$groupingid.'</groupingid>'; - } -} - -echo '</groupsresponse>'; -?> diff --git a/group/groupui/creategroup-form.html b/group/groupui/creategroup-form.html deleted file mode 100644 index a1066fd93db..00000000000 --- a/group/groupui/creategroup-form.html +++ /dev/null @@ -1,31 +0,0 @@ -<div id="creategroupform" class="popup"> - <h3><?php print_string('creategroup', 'group'); ?> <span id="selectedgroupingforcreatinggroup"></span></h3> - <form action=""> - <p><label for="newgroupname"><?php print_string('groupname', 'group'); ?></label></p> - <p><input id="newgroupname" type="text" size="40" value="<?php print_string('defaultgroupname', 'group'); ?>" /> - <p><?php print_string('groupingdescription', 'group'); ?><br /> - <?php helpbutton("text", get_string("helptext")) ?></p> - <p><?php print_textarea($usehtmleditor, 5, 45, 200, 400, "newgroupdescription");?></p> - <p><?php print_string('enrolmentkey', 'group'); ?></p> - <p><input type="text" id="newgroupenrolmentkey" size="25" /></p> - <?php if ($printuploadpicture) { ?> - <p><?php print_string('hidepicture', 'group'); ?></p> - <p><?php $options = NULL; $options[0] = get_string("no"); - $options[1] = get_string("yes"); - $group->hidepicture = 1; - choose_from_menu ($options, "newgrouphidepicture", isset($group)? $group->hidepicture: 1, '');?></p> - - <p><?php print_string('newpicture', 'group'); ?></p> - <p><?php upload_print_form_fragment(1,array('newgroupicon'),null,false,null,0,0,false); - helpbutton("picture", get_string("helppicture")); - print_string("maxsize", "", display_size($maxbytes), 'group'); ?> - </p> - <?php - } - ?> - </table> - - <p><input type="button" id="creategroup" value="<?php print_string('creategroup', 'group'); ?>" /></p> - <p><input type="button" id="cancelcreategroup" value="<?php print_string('cancel', 'group'); ?>" /></p> - </form> -</div> diff --git a/group/groupui/creategroup-form.js b/group/groupui/creategroup-form.js deleted file mode 100644 index 36fcdae938d..00000000000 --- a/group/groupui/creategroup-form.js +++ /dev/null @@ -1,61 +0,0 @@ - -function onCreateGroup() { - valid = validateCreateGroupForm(); - - if (valid) { - hideAllForms(); - showElement("groupeditform"); - createGroup(); - replaceText('selectedgroupingforcreatinggroup', ""); - } - - return false; -} - -/* - * Adds a group with the name specified in the form to the selected grouping. - */ -function createGroup() { - //alert("Called createGroup"); - var url = "creategroup-xml.php"; - var requeststring = "groupname="+getTextInputValue('newgroupname') - +"&groupingid="+selectedgroupingid - +"&description="+getTextInputValue('edit-newgroupdescription') - +"&enrolmentkey="+getTextInputValue('newgroupenrolmentkey'); - // The picture fields aren't displayed if the right library isn't present - if (document.getElementById('menunewgrouphidepicture')) { - requeststring = requeststring+"&hidepicture="+getTextInputValue('menunewgrouphidepicture'); - } - sendPostRequest(request, url, requeststring, createGroupResponse); -} - -/** - * The callback for the response to the request sent in createGroup() - * The function sets the new group as selected in the form. - */ -function createGroupResponse() { - if (checkAjaxResponse(request)) { - //alert("createGroupResponse called"); - //alert(request.responseText); - error = getFromXML(request.responseXML, 'error'); - if (error != null) { - alert(error); - } - selectedgroupid = getFromXML(request.responseXML, 'groupid'); - updateGroupings(); - hideElement("creategroupform"); - } -} - - -function validateCreateGroupForm() { - valid = true; - groupname = getTextInputValue('newgroupname'); - - if (groupname == '') { - alert('You must enter a name for the new group'); - valid = false; - } - return valid; -} - diff --git a/group/groupui/creategroup-xml.php b/group/groupui/creategroup-xml.php deleted file mode 100644 index e69ed69f63d..00000000000 --- a/group/groupui/creategroup-xml.php +++ /dev/null @@ -1,55 +0,0 @@ -<?php -/********************************************** - * Adds a new group to a grouping - **********************************************/ - -require_once('../../config.php'); -require_once('../lib/lib.php'); - -@header('Content-Type: text/xml; charset=utf-8'); -echo '<?xml version="1.0" encoding="utf-8"?>'; -echo '<groupsresponse>'; - -$courseid = required_param('courseid', PARAM_INT); -$groupingid = required_param('groupingid', PARAM_INT); - -$groupsettings->name = required_param('groupname', PARAM_ALPHANUM); -$groupsettings->description = required_param('description', PARAM_ALPHANUM); -$groupsettings->enrolmentkey= required_param('enrolmentkey', PARAM_ALPHANUM); -$groupsettings->hidepicture = optional_param('hidepicture', PARAM_INT); - - -require_login($courseid); - -if (confirm_sesskey() and isteacheredit($courseid)) { - $groupid = groups_create_group($courseid, $groupsettings); - - if (!$groupid) { - echo '<error>Failed to create group</error>'; - } else { - $groupadded = groups_add_group_to_grouping($groupid, $groupingid); - - if (!$groupadded) { - echo '<error>Failed to add group to grouping</error>'; - } else { - // Upload a picture file if there was one - note that we don't remove any previous icons - require_once($CFG->libdir.'/uploadlib.php'); - $um = new upload_manager('newgroupicon', false, false, null, false, 0, true, true); - if ($um->preprocess_files()) { - require_once("$CFG->libdir/gdlib.php"); - if (save_profile_image($groupid, $um, 'groups')) { - $groupsettings->picture = 1; - $infoset = groups_set_group_settings($groupid, $groupsettings); - if (!$infoset) { - echo '<error>Failed to save the fact that the group image was uploaded</error>'; - } - } - } - - echo '<groupid>'.$groupid.'</groupid>'; - } - } -} - -echo '</groupsresponse>'; -?> diff --git a/group/groupui/creategrouping-form.html b/group/groupui/creategrouping-form.html deleted file mode 100644 index 0343b5a7f01..00000000000 --- a/group/groupui/creategrouping-form.html +++ /dev/null @@ -1,11 +0,0 @@ -<div id="creategroupingform" class="popup"> -<h3><?php print_string('creategrouping', 'group'); ?></h3> -<form action=""> -<p><?php print_string('groupingname', 'group'); ?></p> -<p><input id="newgroupingname" type="text" size="40" value="<?php print_string('defaultgroupingname', 'group'); ?>" /></p> -<p><?php print_string('groupingdescription', 'group'); ?></p> -<p><?php print_textarea($usehtmleditor,5, 45, 200, 400, "newgroupingdescription");?></p> -<p><input type="button" id="creategrouping" value="<?php print_string('creategrouping', 'group'); ?>" /></p> -<p><input type="button" id="cancelcreategrouping" value="<?php print_string('cancel', 'group'); ?>" /></p> -</form> -</div> diff --git a/group/groupui/creategrouping-form.js b/group/groupui/creategrouping-form.js deleted file mode 100644 index 2fb72ac8995..00000000000 --- a/group/groupui/creategrouping-form.js +++ /dev/null @@ -1,56 +0,0 @@ - - -function onCreateGrouping() { - valid = validateCreateGroupingForm(); - if (valid) { - hideAllForms(); - showElement("groupeditform"); - createGrouping(); - } - - return false; -} - -/** - * Creates a new grouping for the course. - */ -function createGrouping() { - // alert("Called createGrouping"); - var url = "creategrouping-xml.php"; - var requeststring = "groupingname="+getTextInputValue('newgroupingname') - +"&description="+getTextInputValue('edit-newgroupingdescription'); - sendPostRequest(request, url, requeststring, createGroupingResponse); - } - - /** - * The callback for the response to the request sent in createGrouping() - * It sets the new grouping as selected in the form. - */ - function createGroupingResponse() { - if (checkAjaxResponse(request)) { - // alert("createGroupingResponse"); - // alert(request.responseText); - error = getFromXML(request.responseXML, 'error'); - if (error != null) { - alert(error); - } - selectedgroupingid = getFromXML(request.responseXML, 'groupingid'); - selectedgroupid = null; - updateGroupings(); - hideElement("creategroupingform"); - } - } - -function validateCreateGroupingForm() { - valid = true; - groupingname = getTextInputValue('newgroupingname'); - - if (groupingname == '') { - alert('You must enter a name for the new grouping'); - valid = false; - } - return valid; -} - - - diff --git a/group/groupui/creategrouping-xml.php b/group/groupui/creategrouping-xml.php deleted file mode 100644 index f22eba4be8c..00000000000 --- a/group/groupui/creategrouping-xml.php +++ /dev/null @@ -1,31 +0,0 @@ -<?php -/********************************************** - * Adds a new grouping - **********************************************/ - -require_once('../../config.php'); -require_once('../lib/lib.php'); - -@header('Content-Type: text/xml; charset=utf-8'); -echo '<?xml version="1.0" encoding="utf-8"?>'; -echo '<groupsresponse>'; - -$courseid = required_param('courseid', PARAM_INT); - -$groupingsettings->name = required_param('groupingname', PARAM_ALPHANUM); -$groupingsettings->description= required_param('description', PARAM_ALPHANUM); - -require_login($courseid); - -if (confirm_sesskey() and isteacheredit($courseid)) { - $groupingid = groups_create_grouping($courseid, $groupingsettings); - - if (!$groupingid) { - echo '<error>Failed to create grouping</error>'; - } else { - echo '<groupingid>'.$groupingid.'</groupingid>'; - } -} - -echo '</groupsresponse>'; -?> diff --git a/group/groupui/deletegroup-xml.php b/group/groupui/deletegroup-xml.php deleted file mode 100644 index 2e22f9fc306..00000000000 --- a/group/groupui/deletegroup-xml.php +++ /dev/null @@ -1,27 +0,0 @@ -<?php -/********************************************** - * Deletes a group - **********************************************/ - -require_once('../../config.php'); -require_once('../lib/lib.php'); - -@header('Content-Type: text/xml; charset=utf-8'); -echo '<?xml version="1.0" encoding="utf-8"?>'; -echo '<groupsresponse>'; - -$groupid = required_param('groupid', PARAM_INT); -$courseid = required_param('courseid', PARAM_INT); - -require_login($courseid); - -if (confirm_sesskey() and isteacheredit($courseid)) { - $groupremoved = groups_delete_group($groupid); - - if ($groupremoved == false) { - echo "<error>Could not delete group $groupid</error>"; - } -} - -echo '</groupsresponse>'; -?> diff --git a/group/groupui/deletegroup.js b/group/groupui/deletegroup.js deleted file mode 100644 index 541a21ca190..00000000000 --- a/group/groupui/deletegroup.js +++ /dev/null @@ -1,35 +0,0 @@ -function onDeleteGroup() { - hideAllForms() - showElement("groupeditform"); - deleteGroup(); - return false; -} - - -/** - * Deletes the selected group - */ -function deleteGroup() { - //alert("Called deleteGroup"); - var url = "deletegroup-xml.php"; - var requeststring = "groupid="+selectedgroupid; - sendPostRequest(request, url, requeststring, deleteGroupResponse); -} - -/** - * The callback for the response to the request sent in updateSelectedGrouping() - */ -function deleteGroupResponse() { - if (checkAjaxResponse(request)) { - //alert("deleteGroupResponse called"); - // alert(request.responseText); - error = getFromXML(request.responseXML, 'error'); - if (error != null) { - alert(error); - } - // Need XML sent back with groupingid - // Really want to set this to be the grouping before - selectedgroupid = null; - updateGroupings(); - } -} diff --git a/group/groupui/deletegrouping-xml.php b/group/groupui/deletegrouping-xml.php deleted file mode 100644 index 8a901d69d03..00000000000 --- a/group/groupui/deletegrouping-xml.php +++ /dev/null @@ -1,26 +0,0 @@ -<?php -/********************************************** - * Deletes a specified grouping - **********************************************/ - -require_once('../../config.php'); -require_once('../lib/lib.php'); - -@header('Content-Type: text/xml; charset=utf-8'); -echo '<?xml version="1.0" encoding="utf-8"?>'; -echo '<groupsresponse>'; - -$groupingid = required_param('groupingid', PARAM_INT); -$courseid = required_param('courseid', PARAM_INT); - -require_login($courseid); - -if (confirm_sesskey() and isteacheredit($courseid)) { - $groupingremoved = groups_delete_grouping($groupingid); - if (!$groupingremoved) { - echo '<error>Failed to delete grouping</error>'; - } -} - -echo '</groupsresponse>'; -?> diff --git a/group/groupui/deletegrouping.js b/group/groupui/deletegrouping.js deleted file mode 100644 index 2e9898583be..00000000000 --- a/group/groupui/deletegrouping.js +++ /dev/null @@ -1,37 +0,0 @@ - -function onDeleteGrouping() { - hideAllForms() - showElement("groupeditform"); - deleteGrouping(); - return false; -} - - -/* - * Deletes the selected grouping - */ -function deleteGrouping() { - //alert("Called deleteGrouping"); - var url = "deletegrouping-xml.php"; - var requeststring = "groupingid="+selectedgroupingid; - confirm('Are you sure you want to delete this grouping and the groups that it contains?'); - sendPostRequest(request, url, requeststring, deleteGroupingResponse); - } - - /** - * The callback for the response to the request sent in deleteGrouping() - */ - function deleteGroupingResponse() { - if (checkAjaxResponse(request)) { - //alert("deleteGroupingResponse called"); - //alert(request.responseText); - error = getFromXML(request.responseXML, 'error'); - if (error != null) { - alert(error); - } - selectedgroupingid = null; - selectedgroupid = null; - updateGroupings(); - } -} - diff --git a/group/groupui/editgroupingpermissions-form.html b/group/groupui/editgroupingpermissions-form.html deleted file mode 100644 index cb5435c6205..00000000000 --- a/group/groupui/editgroupingpermissions-form.html +++ /dev/null @@ -1,13 +0,0 @@ -<div id="editgroupingpermissionsform" class="popup"> -<h3><?php print_string('editgroupingpermissions', 'group'); ?> for <span id="editperm-groupingname"></span></h3> -<form action=""> -<p><input type="checkbox" id="edit-viewowngroup" checked /><?php print_string('viewowngroup', 'group'); ?></p> -<p><input type="checkbox" id="edit-viewallgroupsmembers" checked /><?php print_string('viewallgroupsmembers', 'group'); ?></p> -<p><input type="checkbox" id="edit-viewallgroupsactivities" checked /><?php print_string('viewallgroupsactivities', 'group'); ?></p> -<p><input type="checkbox" id="edit-teachersgroupmark" /><?php print_string('teachersgroupmark', 'group'); ?></p> -<p><input type="checkbox" id="edit-teachersgroupview" /><?php print_string('teachersgroupview', 'group'); ?></p> -<p><input type="checkbox" id="edit-teachersoverride" /><?php print_string('teachersoverride', 'group'); ?></p> -<p><input type="button" id="editgroupingpermissions" value="<?php print_string('save', 'group'); ?>" /></p> -<p><input type="button" id="canceleditgroupingpermissions" value="<?php print_string('cancel', 'group'); ?>" /></p> -</form> -</div> diff --git a/group/groupui/editgroupingpermissions-form.js b/group/groupui/editgroupingpermissions-form.js deleted file mode 100644 index c678d436f8c..00000000000 --- a/group/groupui/editgroupingpermissions-form.js +++ /dev/null @@ -1,66 +0,0 @@ - -function onEditGroupingPermissionsSave() { - hideAllForms(); - showElement("groupeditform"); - editGroupingPermissions() ; - return false; -} - - -/** - * Creates a new grouping for the course. - */ -function editGroupingPermissions() { - var url = "editgroupingpermissions-xml.php"; - var requeststring = "groupingid=" + selectedgroupingid - +"&viewowngroup=" + getCheckBoxValue('edit-viewowngroup') - +"&viewallgroupsmembers=" + getCheckBoxValue('edit-viewallgroupsmembers') - +"&viewallgroupsactivities=" + getCheckBoxValue('edit-viewallgroupsactivities') - +"&teachersgroupmark=" + getCheckBoxValue('edit-teachersgroupmark') - +"&teachersgroupview=" + getCheckBoxValue('edit-teachersgroupview') - +"&teachersoverride=" + getCheckBoxValue('edit-teachersoverride'); - sendPostRequest(request, url, requeststring, editGroupingPermissionsResponse); -} - - /** - * The callback for the response to the request sent in editgroupingpermissions() - * It sets the new grouping as selected in the form. - */ - function editGroupingPermissionsResponse() { - if (checkAjaxResponse(request)) { - //alert("editGroupingPermissionsResponse called"); - //alert(request.responseText); - error = getFromXML(request.responseXML, 'error'); - if (error != null) { - alert(error); - } - updateGroupings(); - hideElement("editgroupingpermissionsform"); - } - } - -function getGroupingPermissions() { - //alert("Called getgroupingpermissions"); - var url = "getgroupingpermissions-xml.php"; - var requeststring = "groupingid="+selectedgroupingid; - sendPostRequest(request, url, requeststring, getGroupingPermissionsResponse); -} - -function getGroupingPermissionsResponse() { - if (checkAjaxResponse(request)) { - //alert("getgroupingpermissionsResponse"); - //alert(request.responseText); - error = getFromXML(request.responseXML, 'error'); - if (error != null) { - alert(error); - } - xml = request.responseXML; - replaceText('editperm-groupingname', getFromXML(xml, 'name')); - setCheckBoxValue('edit-viewowngroup', boolStringToBool(getFromXML(xml, 'viewowngroup'))); - setCheckBoxValue('edit-viewallgroupsmembers', boolStringToBool(getFromXML(xml, 'viewallgroupsmembers'))); - setCheckBoxValue('edit-viewallgroupsactivities', boolStringToBool(getFromXML(xml, 'viewallgroupsactivities'))); - setCheckBoxValue('edit-teachersgroupmark', boolStringToBool(getFromXML(xml, 'teachersgroupmark'))); - setCheckBoxValue('edit-teachersgroupview', boolStringToBool(getFromXML(xml, 'teachersgroupview'))); - setCheckBoxValue('edit-teachersoverride', boolStringToBool(getFromXML(xml, 'teachersoverride'))); - } -} diff --git a/group/groupui/editgroupingpermissions-xml.php b/group/groupui/editgroupingpermissions-xml.php deleted file mode 100644 index d4d4f2a05a9..00000000000 --- a/group/groupui/editgroupingpermissions-xml.php +++ /dev/null @@ -1,30 +0,0 @@ -<?php -/********************************************** - * Adds a new grouping - **********************************************/ - -require_once('../../config.php'); -require_once('../lib/lib.php'); - -@header('Content-Type: text/xml; charset=utf-8'); -echo '<?xml version="1.0" encoding="utf-8"?>'; -echo '<groupsresponse>'; - -$groupingid = required_param('groupingid', PARAM_INT); -$courseid = required_param('courseid', PARAM_INT); - -$groupingsettings->viewowngroup = required_param('viewowngroup', PARAM_INT); //TODO: PARAM_BOOL ?? -$groupingsettings->viewallgroupsmembers = required_param('viewallgroupsmembers', PARAM_INT); -$groupingsettings->viewallgroupsactivities = required_param('viewallgroupsactivities', PARAM_INT); -$groupingsettings->teachersgroupmark = required_param('teachersgroupmark', PARAM_INT); -$groupingsettings->teachersgroupview = required_param('teachersgroupview', PARAM_INT); -$groupingsettings->teachersoverride = required_param('teachersoverride', PARAM_INT); - -require_login($courseid); - -if (confirm_sesskey() and isteacheredit($courseid)) { - $groupingid = groups_set_grouping_settings($groupingid, $groupingsettings); -} - -echo '</groupsresponse>'; -?> diff --git a/group/groupui/editgroupingsettings-form.html b/group/groupui/editgroupingsettings-form.html deleted file mode 100644 index 3500d8ca73c..00000000000 --- a/group/groupui/editgroupingsettings-form.html +++ /dev/null @@ -1,11 +0,0 @@ -<div id="editgroupingsettingsform" class="popup"> -<h3><?php print_string('editgroupingsettings', 'group'); ?></h3> -<form action=""> -<p><?php print_string('groupingname', 'group'); ?></p> -<p><input id="edit-groupingname" type="text" size="40" /></p> -<p><?php print_string('groupingdescription', 'group'); ?></p> -<p><?php print_textarea($usehtmleditor, 5, 45, 200, 400, "edit-groupingdescription");?></p> -<p><input type="button" id="editgroupingsettings" value="<?php print_string('save', 'group'); ?>" /></p> -<p><input type="button" id="canceleditgroupingsettings" value="<?php print_string('cancel', 'group'); ?>" /></p> -</form> -</div> diff --git a/group/groupui/editgroupingsettings-form.js b/group/groupui/editgroupingsettings-form.js deleted file mode 100644 index f8ecf5280c3..00000000000 --- a/group/groupui/editgroupingsettings-form.js +++ /dev/null @@ -1,72 +0,0 @@ - -function onEditGroupingSettingsSave() { - valid = validateEditGroupingSettingsForm(); - if (valid) { - hideAllForms(); - showElement("groupeditform"); - editGroupingSettings() ; - return false; - } -} - - -/** - * Creates a new grouping for the course. - */ -function editGroupingSettings() { - var url = "editgroupingsettings-xml.php"; - var requeststring = "groupingid="+selectedgroupingid - +"&groupingname="+getTextInputValue('edit-groupingname') - +"&description="+getTextInputValue('edit-edit-groupingdescription'); - sendPostRequest(request, url, requeststring, editGroupingSettingsResponse); -} - - /** - * The callback for the response to the request sent in editgroupingsettings() - * It sets the new grouping as selected in the form. - */ - function editGroupingSettingsResponse() { - if (checkAjaxResponse(request)) { - //alert("editGroupingSettingsResponse called"); - //alert(request.responseText); - error = getFromXML(request.responseXML, 'error'); - if (error != null) { - alert(error); - } - updateGroupings(); - hideElement("editgroupingsettingsform"); - } - } - -function getGroupingSettings() { - //alert("Called getgroupingsettings"); - var url = "getgroupingsettings-xml.php"; - var requeststring = "groupingid="+selectedgroupingid; - sendPostRequest(request, url, requeststring, getGroupingSettingsResponse); -} - -function getGroupingSettingsResponse() { - if (checkAjaxResponse(request)) { - //alert("getgroupingsettingsResponse"); - //alert(request.responseText); - error = getFromXML(request.responseXML, 'error'); - if (error != null) { - alert(error); - } - xml = request.responseXML; - setTextInputValue('edit-groupingname', getFromXML(xml, 'name')); - setTextInputValue('edit-edit-groupingdescription', getFromXML(xml, 'description')); - } -} - - -function validateEditGroupingSettingsForm() { - valid = true; - groupingname = getTextInputValue('edit-groupingname'); - - if (groupingname == '') { - alert('You must enter a name for the new grouping'); - valid = false; - } - return valid; -} diff --git a/group/groupui/editgroupingsettings-xml.php b/group/groupui/editgroupingsettings-xml.php deleted file mode 100644 index 5aa6255b65f..00000000000 --- a/group/groupui/editgroupingsettings-xml.php +++ /dev/null @@ -1,26 +0,0 @@ -<?php -/********************************************** - * Adds a new grouping - **********************************************/ - -require_once('../../config.php'); -require_once('../lib/lib.php'); - -@header('Content-Type: text/xml; charset=utf-8'); -echo '<?xml version="1.0" encoding="utf-8"?>'; -echo '<groupsresponse>'; - -$groupingid = required_param('groupingid', PARAM_INT); -$courseid = required_param('courseid', PARAM_INT); - -$groupingsettings->name = required_param('groupingname', PARAM_ALPHANUM); -$groupingsettings->description= required_param('description', PARAM_ALPHANUM); - -require_login($courseid); - -if (confirm_sesskey() and isteacheredit($courseid)) { - $groupingid = groups_set_grouping_settings($groupingid, $groupingsettings); -} - -echo '</groupsresponse>'; -?> diff --git a/group/groupui/editgroupsettings-form.html b/group/groupui/editgroupsettings-form.html deleted file mode 100644 index 015def1fc87..00000000000 --- a/group/groupui/editgroupsettings-form.html +++ /dev/null @@ -1,22 +0,0 @@ -<div id="editgroupsettingsform" class="popup"> - <h3><?php print_string('editgroupsettings', 'group'); ?></h3> - <form action=""> - <p><?php print_string('groupname', 'group'); ?></p> - <p><input id="groupname" type="text" size="40" /></p> - <p><?php print_string("description") ?><br /> - <?php helpbutton("text", get_string("helptext")) ?></p> - <p><?php print_textarea($usehtmleditor, 5, 45, 200, 400, "groupdescription");?> </p> - <p><?php print_string('enrolmentkey') ?></p> - <p><input type="text" id="enrolmentkey" size="25" /></p> - <?php if ($printuploadpicture) { ?> - <p><?php print_string("hidepicture") ?></p> - <p><?php $options = NULL; $options[0] = get_string("no"); $options[1] = get_string("yes"); - choose_from_menu ($options, "hidepicture", $group->hidepicture, ""); ?></p> - <p><?php print_string("newpicture") ?></p> - <p><?php upload_print_form_fragment(1,array('groupicon'),null,false,null,0,0,false); - helpbutton("picture", get_string("helppicture")); - print_string("maxsize", "", display_size($maxbytes), 'group'); ?></p> - <?php } ?> - <p><input type="button" id="editgroupsettings" value="<?php print_string('save', 'group'); ?>" /> <input type="button" id="canceleditgroupsettings" value="<?php print_string('cancel', 'group'); ?>" /></p> - </form> -</div> diff --git a/group/groupui/editgroupsettings-form.js b/group/groupui/editgroupsettings-form.js deleted file mode 100644 index f862c535788..00000000000 --- a/group/groupui/editgroupsettings-form.js +++ /dev/null @@ -1,78 +0,0 @@ - -function onEditGroupSettingsSave() { - valid = validateEditgroupsettingsForm(); - if (valid) { - editgroupsettings() ; - hideAllForms(); - showElement("groupeditform"); - } - return false; -} - -/** - * Creates a new group for the course. - */ -function editGroupSettings() { - // alert("Called editgroupsettings"); - var url = "editgroupsettings-xml.php"; - var requeststring = "groupid="+selectedgroupid - +"&groupname="+getTextInputValue('groupname') - +"&description="+getTextInputValue('edit-groupdescription') - +"&enrolmentkey="+getTextInputValue('enrolmentkey') - +"&hidepicture="+hidepicture; - // The picture fields aren't displayed if the right library isn't present - if (document.getElementById('menuhidepicture')) { - requeststring = requeststring+"&hidepicture="+getTextInputValue('menuhidepicture'); - } - sendPostRequest(request, url, requeststring, editGroupSettingsResponse); - } - - /** - * The callback for the response to the request sent in editgroupsettings(() - */ - function editGroupSettingsResponse() { - if (checkAjaxResponse(request)) { - // alert("editgroupsettingsResponse"); - // alert(request.responseText); - error = getFromXML(request.responseXML, 'error'); - if (error != null) { - alert(error); - } - updateSelectedGrouping(); - hideElement("editgroupsettingsform"); - } - } - -function getGroupSettings() { - // alert("Called getgroupsettings"); - groupid = getSelectedGroup(); - var url = "getgroupsettings-xml.php"; - var requeststring = "groupid="+groupid; - sendPostRequest(request, url, requeststring, getGroupSettingsResponse); -} - -function getGroupSettingsResponse() { - if (checkAjaxResponse(request)) { - // alert("getgroupsettingsResponse"); - // alert(request.responseText); - error = getFromXML(request.responseXML, 'error'); - if (error != null) { - alert(error); - } - xml = request.responseXML; - setTextInputValue('groupname', getFromXML(xml, 'name')); - setTextInputValue('edit-groupdescription', getFromXML(xml, 'description')); - setTextInputValue('enrolmentkey', getFromXML(xml, 'enrolmentkey')); - } -} - -function validateEditgroupsettingsForm() { - valid = true; - groupname = getTextInputValue('groupname'); - - if (groupname == '') { - alert('You must enter a name for the new group'); - valid = false; - } - return valid; -} diff --git a/group/groupui/editgroupsettings-xml.php b/group/groupui/editgroupsettings-xml.php deleted file mode 100644 index b4fcb70abef..00000000000 --- a/group/groupui/editgroupsettings-xml.php +++ /dev/null @@ -1,49 +0,0 @@ -<?php -/********************************************** - * Adds a new grouping - **********************************************/ - -require_once('../../config.php'); -require_once('../lib/lib.php'); - -@header('Content-Type: text/xml; charset=utf-8'); -echo '<?xml version="1.0" encoding="utf-8"?>'; -echo '<groupsresponse>'; - -$groupid = required_param('groupid', PARAM_INT); -$groupname = required_param('groupname', PARAM_ALPHANUM); -$description = required_param('description', PARAM_ALPHANUM); -$enrolmentkey= required_param('enrolmentkey', PARAM_ALPHANUM); -$hidepicture = required_param('hidepicture', PARAM_INT); //TODO: PARAM_BOOL ?? -$courseid = required_param('courseid', PARAM_INT); - -require_login($courseid); - -if (confirm_sesskey() and isteacheredit($courseid)) { - $groupsettings->name = $groupname; - $groupsettings->description = $description; - $groupsettings->enrolmentkey = $enrolmentkey; - $groupsettings->hidepicture = $hidepicture; - - // Upload the group icon if there is one - note that we don't remove any previous icons - require_once($CFG->libdir.'/uploadlib.php'); - $um = new upload_manager('groupicon', false, false, null, false, 0, true, true); - if ($um->preprocess_files()) { - require_once("$CFG->libdir/gdlib.php"); - if (save_profile_image($groupid, $um, 'groups')) { - $groupsettings->picture = 1; - } else { - echo '<error>Failed to save group image</error>'; - } - } else { - $groupsettings->picture = 0; - } - - $infoset = groups_set_group_settings($groupid, $groupsettings); - if (!$infoset) { - echo "<error>Failed to set new group settings</error>"; - } -} - -echo '</groupsresponse>'; -?> diff --git a/group/groupui/form.css b/group/groupui/form.css deleted file mode 100644 index c778b2b0516..00000000000 --- a/group/groupui/form.css +++ /dev/null @@ -1,52 +0,0 @@ -.popup -{ - position:absolute; - left:300px; - top:80px; - width:550px; - border-style:solid; - border-color: grey; - border-width: 1px; - background-color: white; - padding:10px; - z-index:1; - visibility: hidden; -} - -.popupwide -{ - position:absolute; - left:200px; - top:80px; - width:900px; - border-style:solid; - border-color: grey; - border-width: 1px; - background-color: white; - padding:10px; - z-index:1; - visibility: hidden; -} - -.select -{ - overflow: visible; - clip: auto; - width:200px; -} - -.groupmanagementtable -{ - padding: 10px; - margin-left: auto; - margin-right: auto; - text-align: center; -} - -.groupmanagementtableheader -{ - width: 300px; -} - - - diff --git a/group/groupui/form.html b/group/groupui/form.html deleted file mode 100644 index db18de96afd..00000000000 --- a/group/groupui/form.html +++ /dev/null @@ -1,42 +0,0 @@ -<link rel="stylesheet" type="text/css" href="form.css" /> - - -<script type="text/javascript" src="yahoo.js"></script> -<script type="text/javascript" src="connection.js"></script> - -<script type="text/javascript"> -<!-- Begin -<?php include('ajax.js'); ?> -// end hiding script --> -</script> -<script type="text/javascript" src="util-form.js"></script> -<script type="text/javascript" src="main-buttons-form.js"></script> -<script type="text/javascript" src="main-selects-form.js"></script> -<script type="text/javascript" src="creategroup-form.js"></script> -<script type="text/javascript" src="creategrouping-form.js"></script> -<script type="text/javascript" src="editgroupingsettings-form.js"></script> -<script type="text/javascript" src="editgroupingpermissions-form.js"></script> -<script type="text/javascript" src="editgroupsettings-form.js"></script> -<script type="text/javascript" src="createautomaticgrouping-form.js"></script> -<script type="text/javascript" src="addmembers-form.js"></script> -<script type="text/javascript" src="addgroupstogrouping-form.js"></script> -<script type="text/javascript" src="main-init-form.js"></script> -<script type="text/javascript" src="deletegroup.js"></script> -<script type="text/javascript" src="deletegrouping.js"></script> -<script type="text/javascript" src="removegroupfromgrouping.js"></script> -<script type="text/javascript" src="removemembers.js"></script> - - -<noscript> - <?php notify(get_string('javascriptrequired')); ?> -</noscript> - -<?php include('main-form.html'); ?> -<?php include('creategroup-form.html'); ?> -<?php include('editgroupsettings-form.html'); ?> -<?php include('creategrouping-form.html'); ?> -<?php include('editgroupingsettings-form.html'); ?> -<?php include('editgroupingpermissions-form.html'); ?> -<?php include('addgroupstogrouping-form.html'); ?> -<?php include('addmembers-form.html'); ?> -<?php include('createautomaticgrouping-form.html'); ?> diff --git a/group/groupui/getgroupingpermissions-xml.php b/group/groupui/getgroupingpermissions-xml.php deleted file mode 100644 index c2335b76c1f..00000000000 --- a/group/groupui/getgroupingpermissions-xml.php +++ /dev/null @@ -1,62 +0,0 @@ -<?php -/********************************************** - * Fetches the settings of a grouping and returns - * them in an XML format - **********************************************/ - -require_once('../../config.php'); -require_once('../lib/lib.php'); - -@header('Content-Type: text/xml; charset=utf-8'); -echo '<?xml version="1.0" encoding="utf-8"?>'; -echo '<groupsresponse>'; - -$courseid = required_param('courseid', PARAM_INT); -$groupingid = required_param('groupingid', PARAM_INT); - -require_login($courseid); - -if (confirm_sesskey() and isteacheredit($courseid)) { - $groupingsettings = groups_get_grouping_settings($groupingid); - echo '<name>'.$groupingsettings->name.'</name>'; - - if ($groupingsettings->viewowngroup) { - echo '<viewowngroup>true</viewowngroup>'; - } else { - echo '<viewowngroup>false</viewowngroup>'; - } - - if ($groupingsettings->viewallgroupsmembers) { - echo '<viewallgroupsmembers>true</viewallgroupsmembers>'; - } else { - echo '<viewallgroupsmembers>false</viewallgroupsmembers>'; - } - - if ($groupingsettings->viewallgroupsactivities) { - echo '<viewallgroupsactivities>true</viewallgroupsactivities>'; - } else { - echo '<viewallgroupsactivities>false</viewallgroupsactivities>'; - } - - if ($groupingsettings->teachersgroupmark) { - echo '<teachersgroupmark>true</teachersgroupmark>'; - } else { - echo '<teachersgroupmark>false</teachersgroupmark>'; - } - - if ($groupingsettings->teachersgroupview) { - echo '<teachersgroupview>true</teachersgroupview>'; - } else { - echo '<teachersgroupview>false</teachersgroupview>'; - } - - if ($groupingsettings->teachersoverride) { - echo '<teachersoverride>true</teachersoverride>'; - } else { - echo '<teachersoverride>false</teachersoverride>'; - } - -} - -echo '</groupsresponse>'; -?> diff --git a/group/groupui/getgroupings-xml.php b/group/groupui/getgroupings-xml.php deleted file mode 100644 index 44821aa6217..00000000000 --- a/group/groupui/getgroupings-xml.php +++ /dev/null @@ -1,41 +0,0 @@ -<?php -/********************************************** - * Fetches the settings of the groupings for a course - * and returns them in an XML format - **********************************************/ - -require_once('../../config.php'); -require_once('../lib/lib.php'); - -@header('Content-Type: text/xml; charset=utf-8'); -echo '<?xml version="1.0" encoding="utf-8"?>'; -echo '<groupsresponse>'; - -$courseid = required_param('courseid', PARAM_INT); - -require_login($courseid); - -if (confirm_sesskey() and isteacheredit($courseid)) { - $groupingids = groups_get_groupings($courseid); - if ($groupingids != false) { - // Put the groupings into a hash and sort them - foreach($groupingids as $groupingid) { - $listgroupings[$groupingid] = groups_get_grouping_displayname($groupingid); - } - natcasesort($listgroupings); - - // Print out the XML - echo '<option>'; - foreach($listgroupings as $value=>$name) { - echo "<name>$name</name>"; - echo "<value>$value</value>"; - } - echo '</option>'; - } -} - -echo '</groupsresponse>'; -?> - - - diff --git a/group/groupui/getgroupingsettings-xml.php b/group/groupui/getgroupingsettings-xml.php deleted file mode 100644 index 5327d80ada3..00000000000 --- a/group/groupui/getgroupingsettings-xml.php +++ /dev/null @@ -1,27 +0,0 @@ -<?php -/********************************************** - * Fetches the settings of a grouping and returns - * them in an XML format - **********************************************/ - -require_once('../../config.php'); -require_once('../lib/lib.php'); - -@header('Content-Type: text/xml; charset=utf-8'); -echo '<?xml version="1.0" encoding="utf-8"?>'; -echo '<groupsresponse>'; - -$courseid = required_param('courseid', PARAM_INT); -$groupingid = required_param('groupingid', PARAM_INT); - -require_login($courseid); - -if (confirm_sesskey() and isteacheredit($courseid)) { - $groupingsettings = groups_get_grouping_settings($groupingid); - echo '<name>'.$groupingsettings->name.'</name>'; - echo '<description>'.$groupingsettings->description.'</description>'; - -} - -echo '</groupsresponse>'; -?> diff --git a/group/groupui/getgroupsettings-xml.php b/group/groupui/getgroupsettings-xml.php deleted file mode 100644 index 79f63f5f252..00000000000 --- a/group/groupui/getgroupsettings-xml.php +++ /dev/null @@ -1,36 +0,0 @@ -<?php -/********************************************** - * Fetches the settings of a grouping and returns - * them in an XML format - **********************************************/ - -require_once('../../config.php'); -require_once('../lib/lib.php'); - -@header('Content-Type: text/xml; charset=utf-8'); -echo '<?xml version="1.0" encoding="utf-8"?>'; -echo '<groupsresponse>'; - -$courseid = required_param('courseid', PARAM_INT); -$groupid = required_param('groupid', PARAM_INT); - -require_login($courseid); - -if (confirm_sesskey() and isteacheredit($courseid)) { - - $groupsettings = groups_get_group_settings($groupid); - if (!$groupsettings) { - echo '<error>Failed to get group details</error>'; - } else { - echo '<name>'.$groupsettings->name.'</name>'; - echo '<description>'.$groupsettings->description.'</description>'; - echo '<enrolmentkey>'.$groupsettings->enrolmentkey.'</enrolmentkey>'; - echo '<hidepicture>'.$groupsettings->hidepicture.'</hidepicture>'; - echo '<picture>'.$groupsettings->picture.'</picture>'; - echo '<lang>'.$groupinkfo->lang.'</lang>'; - echo '<theme>'.$groupsettings->theme.'</theme>'; - } -} - -echo '</groupsresponse>'; -?> diff --git a/group/groupui/getgroupsingrouping-xml.php b/group/groupui/getgroupsingrouping-xml.php deleted file mode 100644 index bcec2802737..00000000000 --- a/group/groupui/getgroupsingrouping-xml.php +++ /dev/null @@ -1,40 +0,0 @@ -<?php -/********************************************** - * Adds an existing group to a grouping - **********************************************/ - -require_once('../../config.php'); -require_once('../lib/lib.php'); - -@header('Content-Type: text/xml; charset=utf-8'); -echo '<?xml version="1.0" encoding="utf-8"?>'; -echo '<groupsresponse>'; - -$groupingid = required_param('groupingid', PARAM_INT); -$courseid = required_param('courseid', PARAM_INT); - -require_login($courseid); - -if (confirm_sesskey() and isteacheredit($courseid)) { - $groupids = groups_get_groups_in_grouping($groupingid); - - if ($groupids != false) { - // Put the groupings into a hash and sort them - foreach($groupids as $groupid) { - $listgroups[$groupid] = groups_get_group_displayname($groupid); - } - - natcasesort($listgroups); - - // Print out the XML - echo "<option>"; - foreach($listgroups as $value=>$name) { - echo "<name>$name</name>"; - echo "<value>$value</value>"; - } - echo "</option>"; - } -} - -echo '</groupsresponse>'; -?> diff --git a/group/groupui/getgroupsnotingrouping-xml.php b/group/groupui/getgroupsnotingrouping-xml.php deleted file mode 100644 index 48531f610a0..00000000000 --- a/group/groupui/getgroupsnotingrouping-xml.php +++ /dev/null @@ -1,40 +0,0 @@ -<?php -/********************************************** - * Gets the groups not in a grouping for a course - * and returns them in an XML format - **********************************************/ - -require_once('../lib/lib.php'); -require_once('../../config.php'); - -@header('Content-Type: text/xml; charset=utf-8'); -echo '<?xml version="1.0" encoding="utf-8"?>'; -echo '<groupsresponse>'; - -$groupingid = required_param('groupingid', PARAM_INT); -$courseid = required_param('courseid', PARAM_INT); - -require_login($courseid); - -if (confirm_sesskey() and isteacheredit($courseid)) { - $groupids = groups_get_groups_not_in_grouping($groupingid, $courseid); - if ($groupids != false) { - // Put the groupings into a hash and sort them - foreach($groupids as $groupid) { - $listgroups[$groupid] = groups_get_group_displayname($groupid); - } - - natcasesort($listgroups); - - // Print out the XML - echo "<option>"; - foreach($listgroups as $value=>$name) { - echo "<name>$name</name>"; - echo "<value>$value</value>"; - } - echo "</option>"; - } -} - -echo '</groupsresponse>'; -?> diff --git a/group/groupui/getmembers-xml.php b/group/groupui/getmembers-xml.php deleted file mode 100644 index d738037d3c3..00000000000 --- a/group/groupui/getmembers-xml.php +++ /dev/null @@ -1,43 +0,0 @@ -<?php -/********************************************** - * Gets the members of a group and returns them - * in an XMl format - **********************************************/ - -require_once('../../config.php'); -require_once('../lib/lib.php'); - -@header('Content-Type: text/xml; charset=utf-8'); -echo '<?xml version="1.0" encoding="utf-8"?>'; -echo '<groupsresponse>'; - -$groupid = required_param('groupid', PARAM_INT); -$courseid = required_param('courseid', PARAM_INT); - -require_login($courseid); - -if (confirm_sesskey() and isteacheredit($courseid)) { - - $userids = groups_get_members($groupid); - - if ($userids != false) { - // Put the groupings into a hash and sort them - foreach($userids as $userid) { - $listmembers[$userid] = groups_get_user_displayname($userid, $courseid); - } - natcasesort($listmembers); - - - // Print out the XML - - echo "<option>"; - foreach($listmembers as $value=>$name) { - echo "<name>$name</name>"; - echo "<value>$value</value>"; - } - echo "</option>"; - } -} - -echo '</groupsresponse>'; -?> diff --git a/group/groupui/getnonmembers-xml.php b/group/groupui/getnonmembers-xml.php deleted file mode 100644 index 3fc6d241135..00000000000 --- a/group/groupui/getnonmembers-xml.php +++ /dev/null @@ -1,49 +0,0 @@ -<?php -/********************************************** - * Gets the users registered for a course that - * don't belong to a specified group and prints - * their detailsin an XML format. - **********************************************/ - -require_once('../../config.php'); -require_once('../lib/lib.php'); - -@header('Content-Type: text/xml; charset=utf-8'); -echo '<?xml version="1.0" encoding="utf-8"?>'; -echo '<groupsresponse>'; - -$groupid = required_param('groupid', PARAM_INT); -$groupingid = required_param('groupingid', PARAM_INT); -$courseid = required_param('courseid', PARAM_INT); -$showall = required_param('showall', PARAM_INT); - -require_login($courseid); - -if (confirm_sesskey() and isteacheredit($courseid)) { - echo "$groupingid $groupid"; - if ($showall == 0) { - $userids = groups_get_users_not_in_any_group_in_grouping($courseid,$groupingid, $groupid); - } else { - $userids = groups_get_users_not_in_group($courseid, $groupid); - } - - if ($userids != false) { - // Put the groupings into a hash and sorts them - foreach($userids as $userid) { - $listmembers[$userid] = groups_get_user_displayname($userid, $courseid); - } - natcasesort($listmembers); - - - // Print out the XML - echo "<option>"; - foreach($listmembers as $value=>$name) { - echo "<name>$name</name>"; - echo "<value>$value</value>"; - } - echo "</option>"; - } -} - -echo '</groupsresponse>'; -?> diff --git a/group/groupui/index.php b/group/groupui/index.php deleted file mode 100644 index 1210e779c31..00000000000 --- a/group/groupui/index.php +++ /dev/null @@ -1,64 +0,0 @@ -<?php // $Id$ -/** - * The main group management user interface. - * - * @copyright © 2006 The Open University - * @author J.White AT open.ac.uk - * @license http://www.gnu.org/copyleft/gpl.html GNU Public License - * @package groups - */ -require_once('../../config.php'); -require_once('../lib/lib.php'); -//require_once('../../course/lib.php'); -require_once($CFG->libdir.'/moodlelib.php'); -require_once($CFG->libdir.'/uploadlib.php'); - -$error = false; - -$courseid = required_param('id', PARAM_INTEGER); - -// Get the course information so we can print the header and check the course id -// is valid -$course = groups_get_course_info($courseid); -if (!$course) { - $error = true; - print_error('The course id is invalid'); -} - - -if (!$error) { - // Make sure that the user is a teacher with edit permission for this course - require_login($courseid); - if (!isteacheredit($courseid)) { - redirect(); - } - - // Set the session key so we can check this later - $sesskey = !empty($USER->id) ? $USER->sesskey : ''; - - if (!empty($CFG->gdversion)) { //TODO: and $maxbytes) - $printuploadpicture = true; - } else { - $printuploadpicture = false; - } - - - $maxbytes = get_max_upload_file_size($CFG->maxbytes, $course->maxbytes); - $strgroups = get_string('groups'); - $strparticipants = get_string('participants'); - // Print the page and form - print_header("$course->shortname: $strgroups", - $course->fullname, - "<a href=\"$CFG->wwwroot/course/view.php?id=$courseid\">$course->shortname</a> ". - "-> <a href=\"$CFG->wwwroot/user/index.php?id=$courseid\">$strparticipants</a> ". - "-> $strgroups", "", "", true, '', user_login_string($course, $USER)); - - //TODO: set to false in /course/group.php - $usehtmleditor = false; - - require_once('form.html'); - - print_footer($course); -} - -?> diff --git a/group/groupui/main-buttons-form.js b/group/groupui/main-buttons-form.js deleted file mode 100644 index 887fac20717..00000000000 --- a/group/groupui/main-buttons-form.js +++ /dev/null @@ -1,66 +0,0 @@ - - -function onShowAddMembersForm() { - hideAllForms(); - showElement("addmembersform"); - updateNonMembers(); - groupname = getSelectedGroupName(); - replaceText('selectedgroup', groupname); - return false; -} - -function onShowAddGroupsToGroupingForm() { - hideAllForms(); - showElement("addgroupstogroupingform"); - updateGroupsNotInGrouping(); - groupingname = getSelectedGroupingName(); - replaceText('selectedgroupingforaddinggroups', groupingname); - return false; -} - -function onShowCreateGroupingForm() { - hideAllForms(); - showElement("creategroupingform"); - return false; -} - -function onShowCreateGroupForm() { - hideAllForms(); - showElement("creategroupform"); - groupingname = getSelectedGroupingName(); - replaceText('selectedgroupingforcreatinggroup', groupingname); - return false; -} - -function onShowEditGroupSettingsForm() { - hideAllForms(); - showElement("editgroupsettingsform"); - getGroupSettings(); - return false; -} - -function onShowEditGroupingPermissionsForm() { - hideAllForms(); - showElement("editgroupingpermissionsform"); - getGroupingPermissions(); - return false; -} - -function onShowEditGroupingSettingsForm() { - hideAllForms(); - showElement("editgroupingsettingsform"); - getGroupingSettings(); - return false; -} - - -function onShowAutomaticGroupingForm() { - hideAllForms(); - showElement("createautomaticgroupingform"); - return false; -} - -function onPrinterFriendly() { - document.location.href = "printgrouping.php?courseid="+courseid+"&groupingid="+selectedgroupingid; - return false; -} diff --git a/group/groupui/main-form.html b/group/groupui/main-form.html deleted file mode 100644 index 54c4789737d..00000000000 --- a/group/groupui/main-form.html +++ /dev/null @@ -1,41 +0,0 @@ -<form name="groupeditform" id="groupeditform" action=""> - <table cellpadding="10" class="generaltable generalbox groupmanagementtable"> - <tr> - <th class="header groupmanagementtableheader" scope="col"><?php print_string('groupings', 'group'); ?></th> - <th class="header groupmanagementtableheader" scope="col"><?php print_string('groupsinselectedgrouping', 'group'); ?></th> - <th class="header groupmanagementtableheader" scope="col"><?php print_string('membersofselectedgroup', 'group'); ?></th> - </tr> - <tr> - <td class="generalboxcontent"> - <select id="groupings" size="15" class="select"></select> - </td> - <td> - <select id="groups" size="15" class="select"></select> - </td> - <td> - <select id="members" size="15" multiple="multiple" class="select"></select> - </td> - </tr> - <tr> - <td> - <p><input type="button" id="showeditgroupingsettingsform" value="<?php print_string('editgroupingsettings', 'group'); ?>" /></p> - <p><input type="button" id="showeditgroupingpermissionsform" value="<?php print_string('editgroupingpermissions', 'group'); ?>" /></p> - <p><input type="button" id="deletegrouping" value="<?php print_string('deletegrouping', 'group'); ?>" /></p> - <p><input type="button" id="showcreategroupingform" value="<?php print_string('creategrouping', 'group'); ?>" /></p> - <p><input type="button" id="showcreateautomaticgroupingform" value="<?php print_string('createautomaticgrouping', 'group'); ?>" /></p> - <p><input type="button" id="printerfriendly" value="<?php print_string('printerfriendly', 'group'); ?>" /></p> - </td> - <td> - <p><input type="button" id="showeditgroupsettingsform" value="<?php print_string('editgroupsettings', 'group'); ?>" /></p> - <p><input type="button" id="deletegroup" value="<?php print_string('deleteselectedgroup', 'group'); ?>" /></p> - <p><input type="button" id="removegroup" value="<?php print_string('removegroupfromselectedgrouping', 'group'); ?>" /></p> - <p><input type="button" id="showcreategroupform" value="<?php print_string('creategroupinselectedgrouping', 'group'); ?>" /></p> - <p><input type="button" id="showaddgroupstogroupingform" value="<?php print_string('addexistinggroupstogrouping', 'group'); ?>" /></p> - </td> - <td> - <p><input type="button" id="removemembers" value="<?php print_string('removeselectedusers', 'group'); ?>"/></p> - <p><input type="button" id="showaddmembersform" value="<?php print_string('adduserstogroup', 'group'); ?>" /></p> - </td> - </tr> - </table> -</form> diff --git a/group/groupui/main-init-form.js b/group/groupui/main-init-form.js deleted file mode 100644 index 6b4679f843b..00000000000 --- a/group/groupui/main-init-form.js +++ /dev/null @@ -1,71 +0,0 @@ -/* - * This file contains all the functions called when the pages loads and also all the functions that are called - * on events such as clicking buttons in the forms for the form.html page. - * - * This script requires functions from ajax.js and form-access.js - * - * This code also assumes you have a basic understanding of how Ajax works - if - * you don't, it won't make much sense! -*/ - - - -// Create XMLHttpRequest objects to use -var request = createRequest(); -var updategroupingsrequest = createRequest(); -var updateselectedgroupingsrequest = createRequest(); -var updateselectedgrouprequest = createRequest(); - -// The selectedgroupingid should always be set to the current selected groupingid and the -// selectedgroupid should always be set to the current selected groupid. We initialise them to -// be null at the start, but they'll get set when the page loads. -var selectedgroupingid = null; -var selectedgroupid = null; - -// When the page has loaded called the initPage function -window.onload = initPage; - -/** - * The initPage function updates the groupings, groups and members in all the selects appropriately - *and adds the right javascript events to all the buttons etc. - */ -function initPage() { - // Check that we're using a recent enough version of javascript - if (!document.getElementById) { - return false; - } - updateGroupings(); - - addEvent('groupings', 'change', onGroupingChange); - addEvent('groups', 'change', onGroupChange); - addEvent('deletegrouping', 'click', onDeleteGrouping); - addEvent('deletegroup', 'click', onDeleteGroup); - addEvent('removegroup', 'click', onRemoveGroup); - addEvent('removemembers', 'click', onRemoveMembers); - addEvent('showaddmembersform', 'click', onShowAddMembersForm); - addEvent('showaddgroupstogroupingform', 'click', onShowAddGroupsToGroupingForm); - addEvent('showcreategroupingform', 'click', onShowCreateGroupingForm); - addEvent('showcreategroupform', 'click', onShowCreateGroupForm); - addEvent('showeditgroupsettingsform', 'click', onShowEditGroupSettingsForm); - addEvent('showeditgroupingsettingsform', 'click', onShowEditGroupingSettingsForm); - addEvent('showeditgroupingpermissionsform', 'click', onShowEditGroupingPermissionsForm); - addEvent('showcreateautomaticgroupingform', 'click', onShowAutomaticGroupingForm); - addEvent('printerfriendly', 'click', onPrinterFriendly); - addEvent('createautomaticgrouping', 'click', onCreateAutomaticGrouping); - addEvent('cancelcreateautomaticgrouping', 'click', onCancel); - addEvent('addgroupstogrouping', 'click', onAddGroupsToGrouping); - addEvent('canceladdgroupstogrouping', 'click', onCancel); - addEvent('creategroup', 'click', onCreateGroup); - addEvent('cancelcreategroup', 'click', onCancel); - addEvent('creategrouping', 'click', onCreateGrouping); - addEvent('cancelcreategrouping', 'click', onCancel); - addEvent('addmembers', 'click', onAddMembers); - addEvent('canceladdmembers', 'click', onCancel); - addEvent('showall', 'change', onShowAll); - addEvent('editgroupsettings', 'click', onEditGroupSettingsSave); - addEvent('canceleditgroupsettings', 'click', onCancel); - addEvent('editgroupingsettings', 'click', onEditGroupingSettingsSave); - addEvent('canceleditgroupingsettings', 'click', onCancel); - addEvent('editgroupingpermissions', 'click', onEditGroupingPermissionsSave); - addEvent('canceleditgroupingpermissions', 'click', onCancel); -} diff --git a/group/groupui/main-selects-form.js b/group/groupui/main-selects-form.js deleted file mode 100644 index 78dab510f25..00000000000 --- a/group/groupui/main-selects-form.js +++ /dev/null @@ -1,238 +0,0 @@ -/** - * This file contains various utility functions, primarily to get and set information on form.html - * and to take information from XML documents and either return information from them or modifiy the - * form appropriately. - */ - - -function onGroupingChange() { - hideAllForms(); - showElement("groupeditform"); - if (!document.getElementById('groupings')) { - alert('No groupings id element'); - } else { - groupingselect = document.getElementById('groupings'); - selectedgroupingid = groupingselect.value; - selectedgroupid = null; - updateSelectedGrouping(); - } - return false; -} - -function onGroupChange() { - hideAllForms(); - showElement("groupeditform"); - selectedgroupid = getSelectedGroup(); - updateSelectedGroup(); - return false; -} - - -function getSelectedGroupingName() { - if (!document.getElementById('groupings')) { - alert('No groupings id element'); - value = null; - } else { - groupingselect = document.getElementById('groupings'); - value = groupingselect.options[groupingselect.selectedIndex].firstChild.nodeValue; - } - return value; -} - -function getSelectedGroupName() { - if (!document.getElementById('groups')) { - alert('No groups id element'); - value = null; - } else { - groupselect = document.getElementById('groups'); - value = groupselect.options[groupselect.selectedIndex].firstChild.nodeValue; - } - return value; -} - -/* - * Set the selected grouping on the form to the grouping whose id is selectedgroupingid - */ -function setSelectedGrouping() { - if (selectedgroupingid == null) { - selectedgroupingid = getFirstOption("groupings"); - } - - if (selectedgroupingid != null) { - if (!document.getElementById('groupings')) { - alert('No groupings id element'); - } else { - groupingselect = document.getElementById('groupings'); - groupingselect.value = selectedgroupingid - } - } -} - -/* - * Get the id of the group that is currently selected - */ -function getSelectedGroup() { - if (!document.getElementById('groups')) { - alert('No groups id element'); - value = null; - } else { - groupselect = document.getElementById('groups'); - value = groupselect.value; - } - return value; -} - -/* - * Set the selected group on the form to the group whose id is selectedgroupid - */ -function setSelectedGroup() { - if (selectedgroupid == null) { - selectedgroupid = getFirstOption("groups"); - } - - if (selectedgroupid != null) { - if (!document.getElementById('groups')) { - alert('No groups id element'); - } else { - groupselect = document.getElementById('groups'); - groupselect.value = selectedgroupid; - } - } -} - - -/* - * Get the selected users to delete - */ -function getSelectedUsers() { - return getMultipleSelect("members") -} - - - -/*************************************************************** - * Functions that just display information (and don't change the data in the database) - **********************************************/ - -/** - * Updates the list of groupings, setting either a specified grouping as selected or - * the first grouping as selected. - */ -function updateGroupings() { - alert("updateGroupings called"); - var url = "getgroupings-xml.php"; - requeststring = 'courseid='+courseid+'&'+'sesskey='+sesskey; - var transaction = YAHOO.util.Connect.asyncRequest('POST', url, - updateGroupingsResponseCallback, requeststring); - //sendPostRequest(updategroupingsrequest, url, requeststring, updateGroupingsResponse); -} - -var updateGroupingsResponseCallback = -{ - success:function(o) { - - // alert("updateGroupingsResponse called"); - var xmlDoc = o.responseXML; - error = getFromXML(o.responseXML, 'error'); - if (error != null) { - alert(error); - } - // alert(o.responseXML); - var noofoptions = addOptionsFromXML("groupings", xmlDoc); - - // If the selected grouping is not set, set it to the first grouping in the list - if(selectedgroupingid == null) { - selectedgroupingid = getFirstOption("groupings"); - selectedgroupid = null; - } - - // If there are no groupings, make sure the rest of the form is set up appropriately - // i.e. there should be any groups or members shown and various buttons should be disabled - // If there are groupings, update the one that is selected and enable any buttons that - // might have been disabled. - if (noofoptions == 0) { - removeOptions("groups"); - removeOptions("members"); - disableButton("showaddmembersform"); - disableButton("showcreategroupform"); - disableButton("showaddgroupstogroupingform"); - } else { - updateSelectedGrouping(); - enableButton("showaddmembersform"); - enableButton("showcreategroupform"); - enableButton("showaddgroupstogroupingform"); - } -}, - failure:responseFailure, -}; - - - - -/** - * Updates the list of groups when groupingid is marked as selected - * groupid can be null or a specified group - this is the group that gets marked as - * selectedgroupingid cannot be null. - */ -function updateSelectedGrouping() { - //alert("UpdateSelectedGrouping called"); - setSelectedGrouping(); - var url = "getgroupsingrouping-xml.php"; - requeststring = "groupingid="+selectedgroupingid; - sendPostRequest(updateselectedgroupingsrequest, url, requeststring, updateSelectedGroupingResponse); -} - -/** - * The callback for the response to the request sent in updateSelectedGrouping() - */ -function updateSelectedGroupingResponse() { - if (checkAjaxResponse(updateselectedgroupingsrequest)) { - //alert("updateSelectedGroupingResponse called"); - var xmlDoc = updateselectedgroupingsrequest.responseXML; - error = getFromXML(updateselectedgroupingsrequest.responseXML, 'error'); - if (error != null) { - alert(error); - } - // alert(updateselectedgroupingsrequest.responseText); - var noofoptions = addOptionsFromXML("groups", xmlDoc); - if (selectedgroupid == null) { - selectedgroupid = getFirstOption("groups"); - } - - if (noofoptions == 0) { - removeOptions("members"); - disableButton("showaddmembersform"); - } else { - updateSelectedGroup(selectedgroupid); - enableButton("showaddmembersform"); - } - } -} - -/** - * Updates the members for the selected group - currently none marked as selected - */ -function updateSelectedGroup() { - //alert("updateSelectedGroup"); - setSelectedGroup(); - var url = "getmembers-xml.php"; - var requeststring = "groupid="+selectedgroupid; - sendPostRequest(updateselectedgrouprequest, url, requeststring, updateSelectedGroupResponse); -} - -/** - * The callback for the response to the request sent in updateSelectedGroup() - */ -function updateSelectedGroupResponse() { - if (checkAjaxResponse(updateselectedgrouprequest)) { - var xmlDoc = updateselectedgrouprequest.responseXML; - //alert("updateSelectedGroupResponse"); - error = getFromXML(xmlDoc, 'error'); - if (error != null) { - alert(error); - } - - //alert(request.responseText); - var noofoptions = addOptionsFromXML("members", xmlDoc); - } -} diff --git a/group/groupui/printgrouping.php b/group/groupui/printgrouping.php deleted file mode 100644 index 010585c9eaa..00000000000 --- a/group/groupui/printgrouping.php +++ /dev/null @@ -1,88 +0,0 @@ -<?php -/** - * Print groups in groupings, and members of groups. - * - * @copyright © 2006 The Open University - * @author J.White AT open.ac.uk - * @license http://www.gnu.org/copyleft/gpl.html GNU Public License - * @package groups - */ -require_once('../../config.php'); -require_once('../lib.php'); - -$success = true; - -$courseid = required_param('courseid', PARAM_INT); -$groupingid = required_param('groupingid', PARAM_INT); - -// Get the course information so we can print the header and -// check the course id is valid -$course = groups_get_course_info($courseid); -if (! $course) { - $success = false; - print_error('invalidcourse'); -} - - -if ($success) { - // Make sure that the user has permissions to manage groups. - require_login($courseid); - - $context = get_context_instance(CONTEXT_COURSE, $courseid); - if (! has_capability('moodle/course:managegroups', $context)) { - redirect(); - } - - //( confirm_sesskey checks that this is a POST request.) - - // Print the page and form - $strgroups = get_string('groups'); - $strparticipants = get_string('participants'); - print_header("$course->shortname: $strgroups", $course->fullname, - "<a href=\"$CFG->wwwroot/course/view.php?id=$courseid\">$course->shortname</a> ". - "-> <a href=\"$CFG->wwwroot/user/index.php?id=$courseid\">$strparticipants</a> ". - "-> <a href=\"$CFG->wwwroot/group/groupui/index.php?id=$courseid\">$strgroups</a>". - "-> Display grouping", "", "", true, '', user_login_string($course, $USER)); - - $groupingname = groups_get_grouping_name($groupingid); - if (! $groupingname) { - print_error('errorinvalidgrouping', 'group', groups_home_url($courseid)); - } else { - // Print the name of the grouping - echo "<h1>$groupingname</h1>\n"; - } - - // Get the groups and group members for the grouping. - if (GROUP_NOT_IN_GROUPING == $groupingid) { - $groupids = groups_get_groups_not_in_any_grouping($courseid); - } else { - $groupids = groups_get_groups_in_grouping($groupingid); - } - - if ($groupids) { - // Make sure the groups are in the right order - $group_names = groups_groupids_to_group_names($groupids); - - // Go through each group in turn and print the group name and then the members - foreach ($group_names as $group) { - - echo "<h2>{$group->name}</h2>\n"; - $userids = groups_get_members($group->id); - if ($userids != false) { - // Make sure the users are in the right order - $user_names = groups_userids_to_user_names($userids, $courseid); - - echo "<ol>\n"; - foreach ($user_names as $user) { - - echo "<li>{$user->name}</li>\n"; - } - echo "</ol>\n"; - } - } - } - - print_footer($course); -} - -?> diff --git a/group/groupui/removegroupfromgrouping-xml.php b/group/groupui/removegroupfromgrouping-xml.php deleted file mode 100644 index 5e94f122c12..00000000000 --- a/group/groupui/removegroupfromgrouping-xml.php +++ /dev/null @@ -1,28 +0,0 @@ -<?php -/********************************************** - * Removes a specified group from a specified grouping - * (but does not delete the group) - **********************************************/ - -require_once('../../config.php'); -require_once('../lib/lib.php'); - -@header('Content-Type: text/xml; charset=utf-8'); -echo '<?xml version="1.0" encoding="utf-8"?>'; -echo '<groupsresponse>'; - -$groupid = required_param('groupid', PARAM_INT); -$groupingid = required_param('groupingid', PARAM_INT); -$courseid = required_param('courseid', PARAM_INT); - -require_login($courseid); - -if (confirm_sesskey() and isteacheredit($courseid)) { - $groupingremoved = groups_remove_group_from_grouping($groupid, $groupingid); - if (!$groupingremoved) { - echo '<error>Failed to remove group from grouping</error>'; - } -} - -echo '</groupsresponse>'; -?> diff --git a/group/groupui/removegroupfromgrouping.js b/group/groupui/removegroupfromgrouping.js deleted file mode 100644 index dca1caae95f..00000000000 --- a/group/groupui/removegroupfromgrouping.js +++ /dev/null @@ -1,34 +0,0 @@ - -function onRemoveGroup() { - hideAllForms(); - showElement("groupeditform"); - removeGroupFromGrouping(); - return false; -} - -/** - * Removes the selected group from the selected grouping, does not delete the group (so it can e.g. be added to - * another grouping - */ -function removeGroupFromGrouping() { - //alert("Called removeGroupFromGrouping"); - var url = "removegroupfromgrouping-xml.php"; - var requeststring = "groupid="+selectedgroupid+"&groupingid="+selectedgroupingid; - sendPostRequest(request, url, requeststring, removeGroupFromGroupingResponse); -} - -/** - * The callback for the response to the request sent in removeGroupFromGrouping() - */ -function removeGroupFromGroupingResponse() { - if (checkAjaxResponse(request)) { - //alert("removeGroupFromGroupingResponse called"); - var xmlDoc= request.responseXML; - // Need XML sent back with groupingid - // Really want to set this to be the grouping before - selectedgroupid = null; - updateGroupings(); - } -} - - diff --git a/group/groupui/removemembers-xml.php b/group/groupui/removemembers-xml.php deleted file mode 100644 index a585f28eea3..00000000000 --- a/group/groupui/removemembers-xml.php +++ /dev/null @@ -1,38 +0,0 @@ -<?php -/********************************************** - * Takes a groupid and comma-separated list of - * userids, and removes each of those userids - * from the specified group - **********************************************/ - -require_once('../../config.php'); -require_once('../lib/lib.php'); - -@header('Content-Type: text/xml; charset=utf-8'); -echo '<?xml version="1.0" encoding="utf-8"?>'; -echo '<groupsresponse>'; - -$groupid = required_param('groupid', PARAM_INT); -$users = required_param('users', PARAM_SEQUENCE); -$courseid = required_param('courseid', PARAM_INT); - -require_login($courseid); - -if (confirm_sesskey() and isteacheredit($courseid)) { - // Change the comma-separated string of the userids into an array of the userids - $userids = explode(',', $users); - if ($userids != false) { - // Remove each user in turn from the group. - foreach($userids as $userid) { - $useradded = groups_remove_member($groupid, $userid); - if (!$useradded) { - echo "<error>Failed to adduser $userid</error>"; - } - } - } -} - - -echo '</groupsresponse>'; - -?> diff --git a/group/groupui/removemembers.js b/group/groupui/removemembers.js deleted file mode 100644 index 8fe86de6731..00000000000 --- a/group/groupui/removemembers.js +++ /dev/null @@ -1,33 +0,0 @@ - - - -function onRemoveMembers() { - hideAllForms(); - showElement("groupeditform"); - removeMembers(); - return false; -} - - - -/** - * Removes the selected members from the selected group - */ -function removeMembers() { - //alert("Called removeMembers"); - users = getSelectedUsers(); - var url = "removemembers-xml.php"; - var requeststring = "groupid="+selectedgroupid+"&users="+users; - sendPostRequest(request, url, requeststring, removeMembersResponse); -} - -/** - * The callback for the response to the request sent in removeMembers() - */ -function removeMembersResponse() { - if (checkAjaxResponse(request)) { - //alert("removeMembersResponse called"); - //alert(request.responseText); - updateSelectedGroup(); - } -} diff --git a/group/groupui/util-form.js b/group/groupui/util-form.js deleted file mode 100644 index af7b1c8e29e..00000000000 --- a/group/groupui/util-form.js +++ /dev/null @@ -1,358 +0,0 @@ -/** - * This file contains various utility functions, primarily to get and set information on form.html - * and to take information from XML documents and either return information from them or modifiy the - * form appropriately. - */ - -/* - * Disable the button with the specified id - */ -function disableButton(id) { - if (!document.getElementById(id)) { - showNoElementError(id) - } else { - var node = document.getElementById(id); - node.disabled = true; - } -} - -/** - * Enable the button with the specified id - */ -function enableButton(id) { - if (!document.getElementById(id)) { - showNoElementError(id) - } else { - var node = document.getElementById(id); - node.disabled = false; - } -} - -/** - * Show the form with the specified id - */ -function showElement(id) { - if (!document.getElementById(id)) { - showNoElementError(id) - } else { - document.getElementById(id).style.visibility = "visible"; - } -} - -/** - * Hide the form with the specified id - */ -function hideElement(id) { - if (!document.getElementById(id)) { - showNoElementError(id) - } else { - var node = document.getElementById(id); - node.style.visibility = "hidden"; - } -} - - -/** - * Hides all the extra forms in form.html - */ -function hideAllForms() { - hideElement("addmembersform"); - hideElement("addgroupstogroupingform"); - hideElement("creategroupingform"); - hideElement("createautomaticgroupingform"); - hideElement("creategroupform"); - hideElement("editgroupingsettingsform"); - hideElement("editgroupingpermissionsform"); - hideElement("editgroupsettingsform"); - hideElement("groupeditform"); -} - -function onCancel() { - hideAllForms(); - showElement("groupeditform"); - return false; -} - - -function addEvent(id, eventtype, fn){ - if (!document.getElementById(id)) { - alert('No ' + id + ' element'); - return false; - } else { - obj = document.getElementById(id); - } - - if (obj.addEventListener) { - obj.addEventListener(eventtype, fn, false ); - } else if (obj.attachEvent) { - obj["e"+ eventtype +fn] = fn; - obj[eventtype+fn] = function() { obj["e"+ eventtype +fn]( window.event ); } - obj.attachEvent( "on"+ eventtype , obj[eventtype+fn] ); - } else { - obj["on"+type] = obj["e"+ eventtype +fn]; - } -} - -/** - * Gets the value of the first option in a select - */ -function getFirstOption(id) { - if (document.getElementById(id)) { - var node = document.getElementById(id); - if (node.hasChildNodes()) { - var children - firstoption = node.firstChild; - if (firstoption.value) { - value = firstoption.value; - } else { - value = null; - } - } else { - value = null; - } - } else { - value = null; - } - return value; -} - -/* - *Turn the values from a multiple select to a comma-separated list -*/ -function getMultipleSelect(id) { - if (!document.getElementById(id)) { - showNoElementError(id) - } else { - node = document.getElementById(id); - } - var selected = "" - - for (var i = 0; i < node.options.length; i++) { - if (node.options[i].selected) { - selected = selected + node.options[ i ].value + ","; - } - } - // Remove the last comma - there must be a nicer way of doing this! - // Maybe easier with regular expressions? - var length = selected.length; - if (selected.charAt(length - 1) == ',') { - selected = selected.substring(0, length -1); - } - - return selected; -} - -/* - * Creates an option in a select element with the specified id with the given name and value. -*/ -function createOption(id, value, name) { - var node = document.getElementById(id); - var option = document.createElement("option"); - option.setAttribute("value", value); - node.appendChild(option); - var namenode = document.createTextNode(name); - option.appendChild(namenode); -} - -/* - * Removes all the options from a select with a given id -*/ -function removeOptions(id) { - var node = document.getElementById(id); - - while (node.hasChildNodes()) - { - node.removeChild(node.firstChild); - } -} - -/* - * Takes an XML doc of the form <option><name></name><value></value><name></name><value></value></option> - * And adds an option to the selected with the specified id - * @param id The id of the select - * @param xmlDoc The XML document - * @return The number of options added - */ -function addOptionsFromXML(id, xmlDoc) { - // Clear any options that are already there. - removeOptions(id); - - var optionelements = xmlDoc.getElementsByTagName('option'); - var nameelements = xmlDoc.getElementsByTagName('name'); - var valueelements = xmlDoc.getElementsByTagName('value'); - - if (nameelements != null) { - for (var i = 0; i < nameelements.length; i++) { - var name = nameelements[i].firstChild.nodeValue; - var value = valueelements[i].firstChild.nodeValue; - createOption(id, value, name); - } - noofoptions = nameelements.length; - } else { - noofoptions = 0; - } - return noofoptions; -} - -/* - * Gets an error from an XML doc contain a tag of the form <error></error> - * If it contains more than one such tag, it only return the value from the first one. - */ -function getErrorFromXML(xmlDoc) { - alert(xmlDoc.getElementsByTagName('error')); - if (!xmlDoc.getElementsByTagName('error')) { - value = null; - } else { - var errorelement = xmlDoc.getElementsByTagName('error')[0]; - var value = errorelement.firstChild.nodeValue; - } - return value; -} - - -function addChildrenFromXML(parentnode, xmlparentnode) { - xmlChildNodes = xmlparentnode.childNodes; - length = xmlChildNodes.length; - for (i = 0; i < length; i++) { - child = parentnode.appendChild(parentnode, xmlChildNodes[i]); - addChildrenFromXML(child, xmlChildNodes[i]) - } -} - -function getTextInputValue(id) { - if (!document.getElementById(id)) { - showNoElementError(id) - value = null; - } else { - textinput = document.getElementById(id); - value = textinput.value; - } - return value; -} - -function setTextInputValue(id, value) { - if (!document.getElementById(id)) { - showNoElementError(id); - value = null; - } else { - textinput = document.getElementById(id); - textinput.value = value; - } -} - -function getCheckBoxValue(id) { - if (!document.getElementById(id)) { - showNoElementError(id); - value= null; - } else { - checkbox = document.getElementById(id); - value = checkbox.checked; - } - return boolToInt(value); -} - -function boolStringToBool(boolstring) { - if (boolstring == 'true') { - return true; - } else { - return false; - } -} - -function boolToInt(boolean) { - if (boolean) { - return '1'; - } else if (boolean == false) { - return '0'; - } else { - return boolean; - } -} - -function setCheckBoxValue(id, checked) { - if (!document.getElementById(id)) { - showNoElementError(id); - } else { - checkbox = document.getElementById(id); - checkbox.checked = checked; - } -} - -function replaceText(id, text) { - if (!document.getElementById(id)) { - showNoElementError(id) - value = null; - } else { - element = document.getElementById(id); - if (element.childNodes) { - for (var i = 0; i < element.childNodes.length; i++) { - var childNode = element.childNodes[i]; - element.removeChild(childNode); - } - } - var textnode = document.createTextNode(text); - element.appendChild(textnode); - } -} - - -function getRadioValue(radioelement) { - value = ""; - if (!radioelement) { - value = ""; - } - - - for(var i = 0; i < radioelement.length; i++) { - if(radioelement[i].checked) { - value = radioelement[i].value; - } - } - return value; -} - -/* - * Gets the groupid from an XML doc contain a tag of the form <groupid></groupid> - * If it contains more than one such tag, it only return the value from the first one. - */ -function getFromXML(xmlDoc, id) { - if (!xmlDoc.getElementsByTagName(id)) { - var value = null; - } else if (xmlDoc.getElementsByTagName(id).length == 0) { - var value = null; - } else { - var element = xmlDoc.getElementsByTagName(id)[0]; - if (!element.firstChild) { - var value = ''; - } else { - var value = element.firstChild.nodeValue; - } - } - - return value; -} - -function showNoElementError(id) { - alert('Error: No ' + id +' element'); -} - -function isPositiveInt(str) { - isPosInt = true; - - var i = parseInt (str); - - if (isNaN (i)) { - isPosInt = false; - } - - if (i < 0) { - isPosInt = false; - // Check not characters at the end of the number - } - - if (i.toString() != str) { - isPosInt = false; - } - return isPosInt ; -} - diff --git a/group/groupui/yahoo.js b/group/groupui/yahoo.js deleted file mode 100644 index e285bc39a22..00000000000 --- a/group/groupui/yahoo.js +++ /dev/null @@ -1,84 +0,0 @@ -/* -Copyright (c) 2006, Yahoo! Inc. All rights reserved. -Code licensed under the BSD License: -http://developer.yahoo.net/yui/license.txt -version: 0.11.0 -*/ - -/** - * The Yahoo global namespace - * @constructor - */ -var YAHOO = window.YAHOO || {}; - -/** - * Returns the namespace specified and creates it if it doesn't exist - * - * YAHOO.namespace("property.package"); - * YAHOO.namespace("YAHOO.property.package"); - * - * Either of the above would create YAHOO.property, then - * YAHOO.property.package - * - * @param {String} ns The name of the namespace - * @return {Object} A reference to the namespace object - */ -YAHOO.namespace = function(ns) { - - if (!ns || !ns.length) { - return null; - } - - var levels = ns.split("."); - var nsobj = YAHOO; - - // YAHOO is implied, so it is ignored if it is included - for (var i=(levels[0] == "YAHOO") ? 1 : 0; i<levels.length; ++i) { - nsobj[levels[i]] = nsobj[levels[i]] || {}; - nsobj = nsobj[levels[i]]; - } - - return nsobj; -}; - -/** - * Uses YAHOO.widget.Logger to output a log message, if the widget is available. - * - * @param {string} sMsg The message to log. - * @param {string} sCategory The log category for the message. Default - * categories are "info", "warn", "error", time". - * Custom categories can be used as well. (opt) - * @param {string} sSource The source of the the message (opt) - * @return {boolean} True if the log operation was successful. - */ -YAHOO.log = function(sMsg, sCategory, sSource) { - var l = YAHOO.widget.Logger; - if(l && l.log) { - return l.log(sMsg, sCategory, sSource); - } else { - return false; - } -}; - -/** - * Utility to set up the prototype, constructor and superclass properties to - * support an inheritance strategy that can chain constructors and methods. - * - * @param {Function} subclass the object to modify - * @param {Function} superclass the object to inherit - */ -YAHOO.extend = function(subclass, superclass) { - var f = function() {}; - f.prototype = superclass.prototype; - subclass.prototype = new f(); - subclass.prototype.constructor = subclass; - subclass.superclass = superclass.prototype; - if (superclass.prototype.constructor == Object.prototype.constructor) { - superclass.prototype.constructor = superclass; - } -}; - -YAHOO.namespace("util"); -YAHOO.namespace("widget"); -YAHOO.namespace("example"); - diff --git a/group/index.php b/group/index.php index ee1f677816f..84b8fe2e3ad 100644 --- a/group/index.php +++ b/group/index.php @@ -27,6 +27,11 @@ $groupid = optional_param('group', false, PARAM_INT); $userid = optional_param('user', false, PARAM_INT); $action = groups_param_action(); +if (empty($CFG->enablegroupings)) { + // NO GROUPINGS YET! + $groupingid = GROUP_NOT_IN_GROUPING; +} + if ($groupid) { $groupingsforgroup = groups_get_groupings_for_group($groupid); if ($groupingsforgroup) { @@ -100,7 +105,7 @@ if ($success) { redirect(groups_grouping_edit_url($courseid, null, false)); break; case 'printerfriendly': - redirect('groupui/printgrouping.php?courseid='. $courseid .'&groupingid='. $groupingid); + redirect('printgrouping.php?courseid='. $courseid .'&groupingid='. $groupingid); break; case 'showgroupsettingsform': @@ -201,6 +206,11 @@ if ($success) { */ echo '<table cellpadding="6" class="generaltable generalbox groupmanagementtable boxaligncenter" summary="">'."\n"; echo '<tr>'."\n"; + +if (empty($CFG->enablegroupings)) { +// NO GROUPIGS YET! + $sel_groupingid = -1; +} else { echo '<td class="generalboxcontent">'."\n"; echo '<p><label for="groupings">' . get_string('groupings', 'group') . '<span id="dummygrouping"> </span></label></p>'."\n"; echo '<select name="grouping" id="groupings" size="15" class="select"'; @@ -265,8 +275,15 @@ if ($success) { echo '<p><input type="submit" ' . $printerfriendly_disabled . ' name="act_printerfriendly" id="printerfriendly" value="' . get_string('printerfriendly', 'group') . '" /></p>'."\n"; - echo "</td>\n<td>\n"; + echo "</td>\n"; +} + echo "<td>\n"; +if (empty($CFG->enablegroupings)) { + // NO GROUPINGS YET! + echo '<p><label for="groups"><span id="groupslabel">'.get_string('groups').':</span><span id="thegrouping"> </span></label></p>'."\n"; +} else { echo '<p><label for="groups"><span id="groupslabel">'.get_string('groupsinselectedgrouping', 'group').' </span><span id="thegrouping">'.get_string('grouping', 'group').'</span></label></p>'."\n"; +} echo '<select name="group" id="groups" size="15" class="select" onchange="membersCombo.refreshMembers(this.options[this.selectedIndex].value);"'."\n"; echo ' onclick="window.status=this.options[this.selectedIndex].title;" onmouseout="window.status=\'\';">'."\n"; @@ -307,7 +324,14 @@ if ($success) { echo '<p><input type="submit" '.$disabled.' name="act_removegroup" ' . 'id="removegroup" value="' . get_string('removegroupfromselectedgrouping', 'group') . '" /></p>'."\n"; } - + +if (empty($CFG->enablegroupings)) { +// NO GROUPIGS YET! + echo '<p><input type="submit" name="act_showcreateorphangroupform" id="showcreateorphangroupform" value="' + . get_string('creategroup', 'group') . '" /></p>'."\n"; + echo '<p><input type="submit" name="act_printerfriendly" id="printerfriendly" value="' + . get_string('printerfriendly', 'group') . '" /></p>'."\n"; +} else { echo '<p><input type="submit" ' . $showcreategroupform_disabled . ' name="act_showcreategroupform" id="showcreategroupform" value="' . get_string('creategroupinselectedgrouping', 'group') . '" /></p>'."\n"; @@ -318,10 +342,11 @@ if ($success) { echo '<p><input type="submit" '.$disabled.' name="act_addgroupstogroupingform" ' . 'id="showaddgroupstogroupingform" value="' . get_string('addgroupstogrouping', 'group') . '" /></p>'."\n"; } - +} + echo '</td>'."\n"; echo '<td>'."\n"; - echo '<p><label for="members"><span id="memberslabel">'.get_string('membersofselectedgroup', 'group').' </span><span id="thegroup">'.get_string('group', 'group').'</span></label></p>'."\n"; + echo '<p><label for="members"><span id="memberslabel">'.get_string('membersofselectedgroup', 'group').' </span><span id="thegroup"> </span></label></p>'."\n"; //NOTE: the SELECT was, multiple="multiple" name="user[]" - not used and breaks onclick. echo '<select name="user" id="members" size="15" class="select"'."\n"; echo ' onclick="window.status=this.options[this.selectedIndex].title;" onmouseout="window.status=\'\';">'."\n"; diff --git a/group/lib/legacylib.php b/group/lib/legacylib.php index 0959aa65e6c..388908fd160 100644 --- a/group/lib/legacylib.php +++ b/group/lib/legacylib.php @@ -161,7 +161,7 @@ function groupmode($course, $cm=null) { return $cm->groupmode; } return $course->groupmode; - + /*if ($cm and !$course->groupingid) { //TODO: was $coursemodule return groups_has_groups_setup_for_instance($cm); @@ -201,25 +201,29 @@ function set_current_group($courseid, $groupid) { function get_current_group($courseid, $full = false) { global $SESSION; + if (isset($SESSION->currentgroup[$courseid])) { + if ($full) { + return groups_get_group($SESSION->currentgroup[$courseid], false); + } else { + return $SESSION->currentgroup[$courseid]; + } + } + $mygroupid = mygroupid($courseid); if (is_array($mygroupid)) { $mygroupid = array_shift($mygroupid); - } - - if (isset($SESSION->currentgroup[$courseid])) { - $currentgroup = $SESSION->currentgroup[$courseid]; - } else { - $currentgroup = $mygroupid; - } - - if ($currentgroup) { - $SESSION->currentgroup[$courseid] = $mygroupid; + set_current_group($courseid, $mygroupid); + if ($full) { + return groups_get_group($mygroupid, false); + } else { + return $mygroupid; + } } if ($full) { - return groups_groupid_to_group($currentgroup); + return false; } else { - return $currentgroup; + return 0; } } @@ -265,12 +269,11 @@ function get_and_set_current_group($course, $groupmode, $groupid=-1) { /*)}else { $currentgroupid = $group->id;*/ } elseif ($groupmode == SEPARATEGROUPS) { // student in separate groups switching - if (ismember($group->id)) { //check if is a member + if (ismember($groupid)) { //check if is a member $currentgroupid = set_current_group($course->id, $groupid); //might need to set_current_group? } else { - echo($group->id); - notify('You do not belong to this group!', 'error'); + notify('You do not belong to this group! ('.$groupid.')', 'error'); } } } @@ -280,8 +283,8 @@ function get_and_set_current_group($course, $groupmode, $groupid=-1) { if (has_capability('moodle/site:accessallgroups', $context)) { // Sets current default group $currentgroupid = set_current_group($course->id, 0); - } elseif ($groupmode == VISIBLEGROUPS) { // All groups are visible - $currentgroupid = 0; + } else if ($groupmode == VISIBLEGROUPS) { // All groups are visible + $currentgroupid = set_current_group($course->id, 0); } } @@ -317,31 +320,52 @@ function setup_and_print_groups($course, $groupmode, $urlroot) { $context = get_context_instance(CONTEXT_COURSE, $course->id); - if ($groupmode == VISIBLEGROUPS - or ($groupmode and has_capability('moodle/site:accessallgroups', $context))) { - groups_instance_print_grouping_selector(); - }//added code here to allow non-editting teacher to swap in-between his own groups - //added code for students in separategrous to swtich groups - else if ($groupmode == SEPARATEGROUPS and has_capability('moodle/course:view', $context)) { - groups_instance_print_group_selector(); + if ($groupmode == SEPARATEGROUPS and !$currentgroup and !has_capability('moodle/site:accessallgroups', $context)) { + //we are in separate groups and the current group is group 0, as last set. + //this can mean that either, this guy has no group + //or, this guy just came from a visible all forum, and he left when he set his current group to 0 (show all) + + if ($usergroups = user_group($course->id, $USER->id)){ + //for the second situation, we need to perform the trick and get him a group. + $first = reset($usergroups); + $currentgroup = get_and_set_current_group($course, $groupmode, $first->id); + + } else { + //else he has no group in this course + print_heading(get_string('notingroup')); + print_footer($course); + exit; + } + } + + if ($groupmode == VISIBLEGROUPS or ($groupmode and has_capability('moodle/site:accessallgroups', $context))) { + + if ($groups = get_groups($course->id)) { + + echo '<div class="groupselector">'; + print_group_menu($groups, $groupmode, $currentgroup, $urlroot, 1); + echo '</div>'; + } + + } else if ($groupmode == SEPARATEGROUPS and has_capability('moodle/course:view', $context)) { + //get all the groups this guy is in in this course + if ($usergroups = user_group($course->id, $USER->id)){ + echo '<div class="groupselector">'; + //print them in the menu + print_group_menu($usergroups, $groupmode, $currentgroup, $urlroot, 0); + echo '</div>'; + } } return $currentgroup; -} - -function groups_instance_print_grouping_selector() { - //TODO: ?? -} -function groups_instance_print_group_selector() { - //TODO: ?? } function oldgroups_print_user_group_info($currentgroup, $isseparategroups, $courseid) { global $CFG; $context = get_context_instance(CONTEXT_COURSE, $courseid); - + if ($currentgroup and (!$isseparategroups or has_capability('moodle/site:accessallgroups', $context))) { /// Display info about the group if ($group = get_record('groups', 'id', $currentgroup)) { if (!empty($group->description) or (!empty($group->picture) and empty($group->hidepicture))) { diff --git a/lib/cas/CAS.php b/lib/cas/CAS.php deleted file mode 100644 index 07774766072..00000000000 --- a/lib/cas/CAS.php +++ /dev/null @@ -1,1182 +0,0 @@ -<?php - -error_reporting(E_ALL ^ E_NOTICE); - -// -// hack by Vangelis Haniotakis to handle the absence of $_SERVER['REQUEST_URI'] in IIS -// -if (!$_SERVER['REQUEST_URI']) { - $_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME'].'?'.$_SERVER['QUERY_STRING']; -} - -// -// another one by Vangelis Haniotakis also to make phpCAS work with PHP5 -// -if (version_compare(PHP_VERSION,'5','>=')) { - require_once(dirname(__FILE__).'/domxml-php4-php5.php'); -} - -/** - * @file CAS/CAS.php - * Interface class of the phpCAS library - * - * @ingroup public - */ - -// ######################################################################## -// CONSTANTS -// ######################################################################## - -// ------------------------------------------------------------------------ -// CAS VERSIONS -// ------------------------------------------------------------------------ - -/** - * phpCAS version. accessible for the user by phpCAS::getVersion(). - */ -define('PHPCAS_VERSION','0.4.20-1'); - -// ------------------------------------------------------------------------ -// CAS VERSIONS -// ------------------------------------------------------------------------ -/** - * @addtogroup public - * @{ - */ - -/** - * CAS version 1.0 - */ -define("CAS_VERSION_1_0",'1.0'); -/*! - * CAS version 2.0 - */ -define("CAS_VERSION_2_0",'2.0'); - -/** @} */ -/** - * @addtogroup publicPGTStorage - * @{ - */ -// ------------------------------------------------------------------------ -// FILE PGT STORAGE -// ------------------------------------------------------------------------ -/** - * Default path used when storing PGT's to file - */ -define("CAS_PGT_STORAGE_FILE_DEFAULT_PATH",'/tmp'); -/** - * phpCAS::setPGTStorageFile()'s 2nd parameter to write plain text files - */ -define("CAS_PGT_STORAGE_FILE_FORMAT_PLAIN",'plain'); -/** - * phpCAS::setPGTStorageFile()'s 2nd parameter to write xml files - */ -define("CAS_PGT_STORAGE_FILE_FORMAT_XML",'xml'); -/** - * Default format used when storing PGT's to file - */ -define("CAS_PGT_STORAGE_FILE_DEFAULT_FORMAT",CAS_PGT_STORAGE_FILE_FORMAT_PLAIN); -// ------------------------------------------------------------------------ -// DATABASE PGT STORAGE -// ------------------------------------------------------------------------ -/** - * default database type when storing PGT's to database - */ -define("CAS_PGT_STORAGE_DB_DEFAULT_DATABASE_TYPE",'mysql'); -/** - * default host when storing PGT's to database - */ -define("CAS_PGT_STORAGE_DB_DEFAULT_HOSTNAME",'localhost'); -/** - * default port when storing PGT's to database - */ -define("CAS_PGT_STORAGE_DB_DEFAULT_PORT",''); -/** - * default database when storing PGT's to database - */ -define("CAS_PGT_STORAGE_DB_DEFAULT_DATABASE",'phpCAS'); -/** - * default table when storing PGT's to database - */ -define("CAS_PGT_STORAGE_DB_DEFAULT_TABLE",'pgt'); - -/** @} */ -// ------------------------------------------------------------------------ -// SERVICE ACCESS ERRORS -// ------------------------------------------------------------------------ -/** - * @addtogroup publicServices - * @{ - */ - -/** - * phpCAS::service() error code on success - */ -define("PHPCAS_SERVICE_OK",0); -/** - * phpCAS::service() error code when the PT could not retrieve because - * the CAS server did not respond. - */ -define("PHPCAS_SERVICE_PT_NO_SERVER_RESPONSE",1); -/** - * phpCAS::service() error code when the PT could not retrieve because - * the response of the CAS server was ill-formed. - */ -define("PHPCAS_SERVICE_PT_BAD_SERVER_RESPONSE",2); -/** - * phpCAS::service() error code when the PT could not retrieve because - * the CAS server did not want to. - */ -define("PHPCAS_SERVICE_PT_FAILURE",3); -/** - * phpCAS::service() error code when the service was not available. - */ -define("PHPCAS_SERVICE_NOT AVAILABLE",4); - -/** @} */ -// ------------------------------------------------------------------------ -// LANGUAGES -// ------------------------------------------------------------------------ -/** - * @addtogroup publicLang - * @{ - */ - -define("PHPCAS_LANG_ENGLISH", 'english'); -define("PHPCAS_LANG_FRENCH", 'french'); -define("PHPCAS_LANG_GREEK", 'greek'); - -/** @} */ - -/** - * @addtogroup internalLang - * @{ - */ - -/** - * phpCAS default language (when phpCAS::setLang() is not used) - */ -define("PHPCAS_LANG_DEFAULT", PHPCAS_LANG_ENGLISH); - -/** @} */ -// ------------------------------------------------------------------------ -// MISC -// ------------------------------------------------------------------------ -/** - * @addtogroup internalMisc - * @{ - */ - -/** - * This global variable is used by the interface class phpCAS. - * - * @hideinitializer - */ -$PHPCAS_CLIENT = null; - -/** - * This global variable is used to store where the initializer is called from - * (to print a comprehensive error in case of multiple calls). - * - * @hideinitializer - */ -$PHPCAS_INIT_CALL = array('done' => FALSE, - 'file' => '?', - 'line' => -1, - 'method' => '?'); - -/** - * This global variable is used to store where the method checking - * the authentication is called from (to print comprehensive errors) - * - * @hideinitializer - */ -$PHPCAS_AUTH_CHECK_CALL = array('done' => FALSE, - 'file' => '?', - 'line' => -1, - 'method' => '?', - 'result' => FALSE); - -/** - * This global variable is used to store phpCAS debug mode. - * - * @hideinitializer - */ -$PHPCAS_DEBUG = array('filename' => FALSE, - 'indent' => 0, - 'unique_id' => ''); - -/** @} */ - -// ######################################################################## -// CLIENT CLASS -// ######################################################################## - -// include client class -include_once(dirname(__FILE__).'/client.php'); - -// ######################################################################## -// INTERFACE CLASS -// ######################################################################## - -/** - * @class phpCAS - * The phpCAS class is a simple container for the phpCAS library. It provides CAS - * authentication for web applications written in PHP. - * - * @ingroup public - * @author Pascal Aubry <pascal.aubry at univ-rennes1.fr> - * - * \internal All its methods access the same object ($PHPCAS_CLIENT, declared - * at the end of CAS/client.php). - */ - - - -class phpCAS -{ - - // ######################################################################## - // INITIALIZATION - // ######################################################################## - - /** - * @addtogroup publicInit - * @{ - */ - - /** - * phpCAS client initializer. - * @note Only one of the phpCAS::client() and phpCAS::proxy functions should be - * called, only once, and before all other methods (except phpCAS::getVersion() - * and phpCAS::setDebug()). - * - * @param $server_version the version of the CAS server - * @param $server_hostname the hostname of the CAS server - * @param $server_port the port the CAS server is running on - * @param $server_uri the URI the CAS server is responding on - * @param $start_session Have phpCAS start PHP sessions (default true) - * - * @return a newly created CASClient object - */ - function client($server_version, - $server_hostname, - $server_port, - $server_uri, - $start_session = true) - { - global $PHPCAS_CLIENT, $PHPCAS_INIT_CALL; - - phpCAS::traceBegin(); - if ( is_object($PHPCAS_CLIENT) ) { - phpCAS::error($PHPCAS_INIT_CALL['method'].'() has already been called (at '.$PHPCAS_INIT_CALL['file'].':'.$PHPCAS_INIT_CALL['line'].')'); - } - if ( gettype($server_version) != 'string' ) { - phpCAS::error('type mismatched for parameter $server_version (should be `string\')'); - } - if ( gettype($server_hostname) != 'string' ) { - phpCAS::error('type mismatched for parameter $server_hostname (should be `string\')'); - } - if ( gettype($server_port) != 'integer' ) { - phpCAS::error('type mismatched for parameter $server_port (should be `integer\')'); - } - if ( gettype($server_uri) != 'string' ) { - phpCAS::error('type mismatched for parameter $server_uri (should be `string\')'); - } - - // store where the initialzer is called from - $dbg = phpCAS::backtrace(); - $PHPCAS_INIT_CALL = array('done' => TRUE, - 'file' => $dbg[0]['file'], - 'line' => $dbg[0]['line'], - 'method' => __CLASS__.'::'.__FUNCTION__); - - // initialize the global object $PHPCAS_CLIENT - $PHPCAS_CLIENT = new CASClient($server_version,FALSE/*proxy*/,$server_hostname,$server_port,$server_uri,$start_session); - phpCAS::traceEnd(); - } - - /** - * phpCAS proxy initializer. - * @note Only one of the phpCAS::client() and phpCAS::proxy functions should be - * called, only once, and before all other methods (except phpCAS::getVersion() - * and phpCAS::setDebug()). - * - * @param $server_version the version of the CAS server - * @param $server_hostname the hostname of the CAS server - * @param $server_port the port the CAS server is running on - * @param $server_uri the URI the CAS server is responding on - * @param $start_session Have phpCAS start PHP sessions (default true) - * - * @return a newly created CASClient object - */ - function proxy($server_version, - $server_hostname, - $server_port, - $server_uri, - $start_session = true) - { - global $PHPCAS_CLIENT, $PHPCAS_INIT_CALL; - - phpCAS::traceBegin(); - if ( is_object($PHPCAS_CLIENT) ) { - phpCAS::error($PHPCAS_INIT_CALL['method'].'() has already been called (at '.$PHPCAS_INIT_CALL['file'].':'.$PHPCAS_INIT_CALL['line'].')'); - } - if ( gettype($server_version) != 'string' ) { - phpCAS::error('type mismatched for parameter $server_version (should be `string\')'); - } - if ( gettype($server_hostname) != 'string' ) { - phpCAS::error('type mismatched for parameter $server_hostname (should be `string\')'); - } - if ( gettype($server_port) != 'integer' ) { - phpCAS::error('type mismatched for parameter $server_port (should be `integer\')'); - } - if ( gettype($server_uri) != 'string' ) { - phpCAS::error('type mismatched for parameter $server_uri (should be `string\')'); - } - - // store where the initialzer is called from - $dbg = phpCAS::backtrace(); - $PHPCAS_INIT_CALL = array('done' => TRUE, - 'file' => $dbg[0]['file'], - 'line' => $dbg[0]['line'], - 'method' => __CLASS__.'::'.__FUNCTION__); - - // initialize the global object $PHPCAS_CLIENT - $PHPCAS_CLIENT = new CASClient($server_version,TRUE/*proxy*/,$server_hostname,$server_port,$server_uri,$start_session); - phpCAS::traceEnd(); - } - - /** @} */ - // ######################################################################## - // DEBUGGING - // ######################################################################## - - /** - * @addtogroup publicDebug - * @{ - */ - - /** - * Set/unset debug mode - * - * @param $filename the name of the file used for logging, or FALSE to stop debugging. - */ - function setDebug($filename='') - { - global $PHPCAS_DEBUG; - - if ( $filename != FALSE && gettype($filename) != 'string' ) { - phpCAS::error('type mismatched for parameter $dbg (should be FALSE or the name of the log file)'); - } - - if ( empty($filename) ) { - if ( preg_match('/^Win.*/',getenv('OS')) ) { - if ( isset($_ENV['TMP']) ) { - $debugDir = $_ENV['TMP'].'/'; - } else if ( isset($_ENV['TEMP']) ) { - $debugDir = $_ENV['TEMP'].'/'; - } else { - $debugDir = ''; - } - } else { - $debugDir = '/tmp/'; - } - $filename = $debugDir . 'phpCAS.log'; - } - - if ( empty($PHPCAS_DEBUG['unique_id']) ) { - $PHPCAS_DEBUG['unique_id'] = substr(strtoupper(md5(uniqid(''))),0,4); - } - - $PHPCAS_DEBUG['filename'] = $filename; - - phpCAS::trace('START ******************'); - } - - /** @} */ - /** - * @addtogroup internalDebug - * @{ - */ - - /** - * This method is a wrapper for debug_backtrace() that is not available - * in all PHP versions (>= 4.3.0 only) - */ - function backtrace() - { - if ( function_exists('debug_backtrace') ) { - return debug_backtrace(); - } else { - // poor man's hack ... but it does work ... - return array(); - } - } - - /** - * Logs a string in debug mode. - * - * @param $str the string to write - * - * @private - */ - function log($str) - { - $indent_str = "."; - global $PHPCAS_DEBUG; - - if ( $PHPCAS_DEBUG['filename'] ) { - for ($i=0;$i<$PHPCAS_DEBUG['indent'];$i++) { - $indent_str .= '| '; - } - error_log($PHPCAS_DEBUG['unique_id'].' '.$indent_str.$str."\n",3,$PHPCAS_DEBUG['filename']); - } - - } - - /** - * This method is used by interface methods to print an error and where the function - * was originally called from. - * - * @param $msg the message to print - * - * @private - */ - function error($msg) - { - $dbg = phpCAS::backtrace(); - $function = '?'; - $file = '?'; - $line = '?'; - if ( is_array($dbg) ) { - for ( $i=1; $i<sizeof($dbg); $i++) { - if ( is_array($dbg[$i]) ) { - if ( $dbg[$i]['class'] == __CLASS__ ) { - $function = $dbg[$i]['function']; - $file = $dbg[$i]['file']; - $line = $dbg[$i]['line']; - } - } - } - } - echo "<br />\n<b>phpCAS error</b>: <font color=\"FF0000\"><b>".__CLASS__."::".$function.'(): '.htmlentities($msg)."</b></font> in <b>".$file."</b> on line <b>".$line."</b><br />\n"; - phpCAS::trace($msg); - phpCAS::traceExit(); - exit(); - } - - /** - * This method is used to log something in debug mode. - */ - function trace($str) - { - $dbg = phpCAS::backtrace(); - phpCAS::log($str.' ['.basename($dbg[1]['file']).':'.$dbg[1]['line'].']'); - } - - /** - * This method is used to indicate the start of the execution of a function in debug mode. - */ - function traceBegin() - { - global $PHPCAS_DEBUG; - - $dbg = phpCAS::backtrace(); - $str = '=> '; - if ( !empty($dbg[2]['class']) ) { - $str .= $dbg[2]['class'].'::'; - } - $str .= $dbg[2]['function'].'('; - if ( is_array($dbg[2]['args']) ) { - foreach ($dbg[2]['args'] as $index => $arg) { - if ( $index != 0 ) { - $str .= ', '; - } - $str .= str_replace("\n","",var_export($arg,TRUE)); - } - } - $str .= ') ['.basename($dbg[2]['file']).':'.$dbg[2]['line'].']'; - phpCAS::log($str); - $PHPCAS_DEBUG['indent'] ++; - } - - /** - * This method is used to indicate the end of the execution of a function in debug mode. - * - * @param $res the result of the function - */ - function traceEnd($res='') - { - global $PHPCAS_DEBUG; - - $PHPCAS_DEBUG['indent'] --; - $dbg = phpCAS::backtrace(); - $str = ''; - $str .= '<= '.str_replace("\n","",var_export($res,TRUE)); - phpCAS::log($str); - } - - /** - * This method is used to indicate the end of the execution of the program - */ - function traceExit() - { - global $PHPCAS_DEBUG; - - phpCAS::log('exit()'); - while ( $PHPCAS_DEBUG['indent'] > 0 ) { - phpCAS::log('-'); - $PHPCAS_DEBUG['indent'] --; - } - } - - /** @} */ - // ######################################################################## - // INTERNATIONALIZATION - // ######################################################################## - /** - * @addtogroup publicLang - * @{ - */ - - /** - * This method is used to set the language used by phpCAS. - * @note Can be called only once. - * - * @param $lang a string representing the language. - * - * @sa PHPCAS_LANG_FRENCH, PHPCAS_LANG_ENGLISH - */ - function setLang($lang) - { - global $PHPCAS_CLIENT; - if ( !is_object($PHPCAS_CLIENT) ) { - phpCAS::error('this method should not be called before '.__CLASS__.'::client() or '.__CLASS__.'::proxy()'); - } - if ( gettype($lang) != 'string' ) { - phpCAS::error('type mismatched for parameter $lang (should be `string\')'); - } - $PHPCAS_CLIENT->setLang($lang); - } - - /** @} */ - // ######################################################################## - // VERSION - // ######################################################################## - /** - * @addtogroup public - * @{ - */ - - /** - * This method returns the phpCAS version. - * - * @return the phpCAS version. - */ - function getVersion() - { - return PHPCAS_VERSION; - } - - /** @} */ - // ######################################################################## - // HTML OUTPUT - // ######################################################################## - /** - * @addtogroup publicOutput - * @{ - */ - - /** - * This method sets the HTML header used for all outputs. - * - * @param $header the HTML header. - */ - function setHTMLHeader($header) - { - global $PHPCAS_CLIENT; - if ( !is_object($PHPCAS_CLIENT) ) { - phpCAS::error('this method should not be called before '.__CLASS__.'::client() or '.__CLASS__.'::proxy()'); - } - if ( gettype($header) != 'string' ) { - phpCAS::error('type mismatched for parameter $header (should be `string\')'); - } - $PHPCAS_CLIENT->setHTMLHeader($header); - } - - /** - * This method sets the HTML footer used for all outputs. - * - * @param $footer the HTML footer. - */ - function setHTMLFooter($footer) - { - global $PHPCAS_CLIENT; - if ( !is_object($PHPCAS_CLIENT) ) { - phpCAS::error('this method should not be called before '.__CLASS__.'::client() or '.__CLASS__.'::proxy()'); - } - if ( gettype($footer) != 'string' ) { - phpCAS::error('type mismatched for parameter $footer (should be `string\')'); - } - $PHPCAS_CLIENT->setHTMLHeader($header); - } - - /** @} */ - // ######################################################################## - // PGT STORAGE - // ######################################################################## - /** - * @addtogroup publicPGTStorage - * @{ - */ - - /** - * This method is used to tell phpCAS to store the response of the - * CAS server to PGT requests onto the filesystem. - * - * @param $format the format used to store the PGT's (`plain' and `xml' allowed) - * @param $path the path where the PGT's should be stored - */ - function setPGTStorageFile($format='', - $path='') - { - global $PHPCAS_CLIENT,$PHPCAS_AUTH_CHECK_CALL; - - phpCAS::traceBegin(); - if ( !is_object($PHPCAS_CLIENT) ) { - phpCAS::error('this method should only be called after '.__CLASS__.'::proxy()'); - } - if ( !$PHPCAS_CLIENT->isProxy() ) { - phpCAS::error('this method should only be called after '.__CLASS__.'::proxy()'); - } - if ( $PHPCAS_AUTH_CHECK_CALL['done'] ) { - phpCAS::error('this method should only be called before '.$PHPCAS_AUTH_CHECK_CALL['method'].'() (called at '.$PHPCAS_AUTH_CHECK_CALL['file'].':'.$PHPCAS_AUTH_CHECK_CALL['line'].')'); - } - if ( gettype($format) != 'string' ) { - phpCAS::error('type mismatched for parameter $format (should be `string\')'); - } - if ( gettype($path) != 'string' ) { - phpCAS::error('type mismatched for parameter $format (should be `string\')'); - } - $PHPCAS_CLIENT->setPGTStorageFile($format,$path); - phpCAS::traceEnd(); - } - - /** - * This method is used to tell phpCAS to store the response of the - * CAS server to PGT requests into a database. - * @note The connection to the database is done only when needed. - * As a consequence, bad parameters are detected only when - * initializing PGT storage, except in debug mode. - * - * @param $user the user to access the data with - * @param $password the user's password - * @param $database_type the type of the database hosting the data - * @param $hostname the server hosting the database - * @param $port the port the server is listening on - * @param $database the name of the database - * @param $table the name of the table storing the data - */ - function setPGTStorageDB($user, - $password, - $database_type='', - $hostname='', - $port=0, - $database='', - $table='') - { - global $PHPCAS_CLIENT,$PHPCAS_AUTH_CHECK_CALL; - - phpCAS::traceBegin(); - if ( !is_object($PHPCAS_CLIENT) ) { - phpCAS::error('this method should only be called after '.__CLASS__.'::proxy()'); - } - if ( !$PHPCAS_CLIENT->isProxy() ) { - phpCAS::error('this method should only be called after '.__CLASS__.'::proxy()'); - } - if ( $PHPCAS_AUTH_CHECK_CALL['done'] ) { - phpCAS::error('this method should only be called before '.$PHPCAS_AUTH_CHECK_CALL['method'].'() (called at '.$PHPCAS_AUTH_CHECK_CALL['file'].':'.$PHPCAS_AUTH_CHECK_CALL['line'].')'); - } - if ( gettype($user) != 'string' ) { - phpCAS::error('type mismatched for parameter $user (should be `string\')'); - } - if ( gettype($password) != 'string' ) { - phpCAS::error('type mismatched for parameter $password (should be `string\')'); - } - if ( gettype($database_type) != 'string' ) { - phpCAS::error('type mismatched for parameter $database_type (should be `string\')'); - } - if ( gettype($hostname) != 'string' ) { - phpCAS::error('type mismatched for parameter $hostname (should be `string\')'); - } - if ( gettype($port) != 'integer' ) { - phpCAS::error('type mismatched for parameter $port (should be `integer\')'); - } - if ( gettype($database) != 'string' ) { - phpCAS::error('type mismatched for parameter $database (should be `string\')'); - } - if ( gettype($table) != 'string' ) { - phpCAS::error('type mismatched for parameter $table (should be `string\')'); - } - $PHPCAS_CLIENT->setPGTStorageDB($this,$user,$password,$hostname,$port,$database,$table); - phpCAS::traceEnd(); - } - - /** @} */ - // ######################################################################## - // ACCESS TO EXTERNAL SERVICES - // ######################################################################## - /** - * @addtogroup publicServices - * @{ - */ - - /** - * This method is used to access an HTTP[S] service. - * - * @param $url the service to access. - * @param $err_code an error code Possible values are PHPCAS_SERVICE_OK (on - * success), PHPCAS_SERVICE_PT_NO_SERVER_RESPONSE, PHPCAS_SERVICE_PT_BAD_SERVER_RESPONSE, - * PHPCAS_SERVICE_PT_FAILURE, PHPCAS_SERVICE_NOT AVAILABLE. - * @param $output the output of the service (also used to give an error - * message on failure). - * - * @return TRUE on success, FALSE otherwise (in this later case, $err_code - * gives the reason why it failed and $output contains an error message). - */ - function serviceWeb($url,&$err_code,&$output) - { - global $PHPCAS_CLIENT, $PHPCAS_AUTH_CHECK_CALL; - - phpCAS::traceBegin(); - if ( !is_object($PHPCAS_CLIENT) ) { - phpCAS::error('this method should only be called after '.__CLASS__.'::proxy()'); - } - if ( !$PHPCAS_CLIENT->isProxy() ) { - phpCAS::error('this method should only be called after '.__CLASS__.'::proxy()'); - } - if ( !$PHPCAS_AUTH_CHECK_CALL['done'] ) { - phpCAS::error('this method should only be called after the programmer is sure the user has been authenticated (by calling '.__CLASS__.'::checkAuthentication() or '.__CLASS__.'::forceAuthentication()'); - } - if ( !$PHPCAS_AUTH_CHECK_CALL['result'] ) { - phpCAS::error('authentication was checked (by '.$PHPCAS_AUTH_CHECK_CALL['method'].'() at '.$PHPCAS_AUTH_CHECK_CALL['file'].':'.$PHPCAS_AUTH_CHECK_CALL['line'].') but the method returned FALSE'); - } - if ( gettype($url) != 'string' ) { - phpCAS::error('type mismatched for parameter $url (should be `string\')'); - } - - $res = $PHPCAS_CLIENT->serviceWeb($url,$err_code,$output); - - phpCAS::traceEnd($res); - return $res; - } - - /** - * This method is used to access an IMAP/POP3/NNTP service. - * - * @param $url a string giving the URL of the service, including the mailing box - * for IMAP URLs, as accepted by imap_open(). - * @param $flags options given to imap_open(). - * @param $err_code an error code Possible values are PHPCAS_SERVICE_OK (on - * success), PHPCAS_SERVICE_PT_NO_SERVER_RESPONSE, PHPCAS_SERVICE_PT_BAD_SERVER_RESPONSE, - * PHPCAS_SERVICE_PT_FAILURE, PHPCAS_SERVICE_NOT AVAILABLE. - * @param $err_msg an error message on failure - * @param $pt the Proxy Ticket (PT) retrieved from the CAS server to access the URL - * on success, FALSE on error). - * - * @return an IMAP stream on success, FALSE otherwise (in this later case, $err_code - * gives the reason why it failed and $err_msg contains an error message). - */ - function serviceMail($url,$flags,&$err_code,&$err_msg,&$pt) - { - global $PHPCAS_CLIENT, $PHPCAS_AUTH_CHECK_CALL; - - phpCAS::traceBegin(); - if ( !is_object($PHPCAS_CLIENT) ) { - phpCAS::error('this method should only be called after '.__CLASS__.'::proxy()'); - } - if ( !$PHPCAS_CLIENT->isProxy() ) { - phpCAS::error('this method should only be called after '.__CLASS__.'::proxy()'); - } - if ( !$PHPCAS_AUTH_CHECK_CALL['done'] ) { - phpCAS::error('this method should only be called after the programmer is sure the user has been authenticated (by calling '.__CLASS__.'::checkAuthentication() or '.__CLASS__.'::forceAuthentication()'); - } - if ( !$PHPCAS_AUTH_CHECK_CALL['result'] ) { - phpCAS::error('authentication was checked (by '.$PHPCAS_AUTH_CHECK_CALL['method'].'() at '.$PHPCAS_AUTH_CHECK_CALL['file'].':'.$PHPCAS_AUTH_CHECK_CALL['line'].') but the method returned FALSE'); - } - if ( gettype($url) != 'string' ) { - phpCAS::error('type mismatched for parameter $url (should be `string\')'); - } - - if ( gettype($flags) != 'integer' ) { - phpCAS::error('type mismatched for parameter $flags (should be `integer\')'); - } - - $res = $PHPCAS_CLIENT->serviceMail($url,$flags,$err_code,$err_msg,$pt); - - phpCAS::traceEnd($res); - return $res; - } - - /** @} */ - // ######################################################################## - // AUTHENTICATION - // ######################################################################## - /** - * @addtogroup publicAuth - * @{ - */ - - /** - * This method is called to check if the user is authenticated (use the gateway feature). - * @return TRUE when the user is authenticated; otherwise FALSE. - */ - function checkAuthentication() - { - global $PHPCAS_CLIENT, $PHPCAS_AUTH_CHECK_CALL; - - phpCAS::traceBegin(); - if ( !is_object($PHPCAS_CLIENT) ) { - phpCAS::error('this method should not be called before '.__CLASS__.'::client() or '.__CLASS__.'::proxy()'); - } - - $auth = $PHPCAS_CLIENT->checkAuthentication(); - - // store where the authentication has been checked and the result - $dbg = phpCAS::backtrace(); - $PHPCAS_AUTH_CHECK_CALL = array('done' => TRUE, - 'file' => $dbg[0]['file'], - 'line' => $dbg[0]['line'], - 'method' => __CLASS__.'::'.__FUNCTION__, - 'result' => $auth ); - phpCAS::traceEnd($auth); - return $auth; - } - - /** - * This method is called to force authentication if the user was not already - * authenticated. If the user is not authenticated, halt by redirecting to - * the CAS server. - */ - function forceAuthentication() - { - global $PHPCAS_CLIENT, $PHPCAS_AUTH_CHECK_CALL; - - phpCAS::traceBegin(); - if ( !is_object($PHPCAS_CLIENT) ) { - phpCAS::error('this method should not be called before '.__CLASS__.'::client() or '.__CLASS__.'::proxy()'); - } - - $auth = $PHPCAS_CLIENT->forceAuthentication(); - - // store where the authentication has been checked and the result - $dbg = phpCAS::backtrace(); - $PHPCAS_AUTH_CHECK_CALL = array('done' => TRUE, - 'file' => $dbg[0]['file'], - 'line' => $dbg[0]['line'], - 'method' => __CLASS__.'::'.__FUNCTION__, - 'result' => $auth ); - - if ( !$auth ) { - phpCAS::trace('user is not authenticated, redirecting to the CAS server'); - $PHPCAS_CLIENT->forceAuthentication(); - } else { - phpCAS::trace('no need to authenticate (user `'.phpCAS::getUser().'\' is already authenticated)'); - } - - phpCAS::traceEnd(); - } - - /** - * This method has been left from version 0.4.1 for compatibility reasons. - */ - function authenticate() - { - phpCAS::error('this method is deprecated. You should use '.__CLASS__.'::forceAuthentication() instead'); - } - - /** - * This method has been left from version 0.4.19 for compatibility reasons. - */ - function isAuthenticated() - { - phpCAS::error('this method is deprecated. You should use '.__CLASS__.'::forceAuthentication() instead'); - } - - /** - * This method returns the CAS user's login name. - * @warning should not be called only after phpCAS::forceAuthentication() - * or phpCAS::checkAuthentication(). - * - * @return the login name of the authenticated user - */ - function getUser() - { - global $PHPCAS_CLIENT, $PHPCAS_AUTH_CHECK_CALL; - if ( !is_object($PHPCAS_CLIENT) ) { - phpCAS::error('this method should not be called before '.__CLASS__.'::client() or '.__CLASS__.'::proxy()'); - } - if ( !$PHPCAS_AUTH_CHECK_CALL['done'] ) { - phpCAS::error('this method should only be called after '.__CLASS__.'::forceAuthentication() or '.__CLASS__.'::isAuthenticated()'); - } - if ( !$PHPCAS_AUTH_CHECK_CALL['result'] ) { - phpCAS::error('authentication was checked (by '.$PHPCAS_AUTH_CHECK_CALL['method'].'() at '.$PHPCAS_AUTH_CHECK_CALL['file'].':'.$PHPCAS_AUTH_CHECK_CALL['line'].') but the method returned FALSE'); - } - return $PHPCAS_CLIENT->getUser(); - } - - /** - * This method returns the URL to be used to login. - * or phpCAS::isAuthenticated(). - * - * @return the login name of the authenticated user - */ - function getServerLoginURL() - { - global $PHPCAS_CLIENT; - if ( !is_object($PHPCAS_CLIENT) ) { - phpCAS::error('this method should not be called before '.__CLASS__.'::client() or '.__CLASS__.'::proxy()'); - } - return $PHPCAS_CLIENT->getServerLoginURL(); - } - - /** - * This method returns the URL to be used to login. - * or phpCAS::isAuthenticated(). - * - * @return the login name of the authenticated user - */ - function getServerLogoutURL() - { - global $PHPCAS_CLIENT; - if ( !is_object($PHPCAS_CLIENT) ) { - phpCAS::error('this method should not be called before '.__CLASS__.'::client() or '.__CLASS__.'::proxy()'); - } - return $PHPCAS_CLIENT->getServerLogoutURL(); - } - - /** - * This method is used to logout from CAS. Halts by redirecting to the CAS server. - * @param $url a URL that will be transmitted to the CAS server (to come back to when logged out) - */ - function logout($url = "") - { - global $PHPCAS_CLIENT; - - phpCAS::traceBegin(); - if ( !is_object($PHPCAS_CLIENT) ) { - phpCAS::error('this method should only be called after '.__CLASS__.'::client() or'.__CLASS__.'::proxy()'); - } - $PHPCAS_CLIENT->logout($url); - // never reached - phpCAS::traceEnd(); - } - - /** - * Set the fixed URL that will be used by the CAS server to transmit the PGT. - * When this method is not called, a phpCAS script uses its own URL for the callback. - * - * @param $url the URL - */ - function setFixedCallbackURL($url='') - { - global $PHPCAS_CLIENT; - phpCAS::traceBegin(); - if ( !is_object($PHPCAS_CLIENT) ) { - phpCAS::error('this method should only be called after '.__CLASS__.'::proxy()'); - } - if ( !$PHPCAS_CLIENT->isProxy() ) { - phpCAS::error('this method should only be called after '.__CLASS__.'::proxy()'); - } - if ( gettype($url) != 'string' ) { - phpCAS::error('type mismatched for parameter $url (should be `string\')'); - } - $PHPCAS_CLIENT->setCallbackURL($url); - phpCAS::traceEnd(); - } - - /** - * Set the fixed URL that will be set as the CAS service parameter. When this - * method is not called, a phpCAS script uses its own URL. - * - * @param $url the URL - */ - function setFixedServiceURL($url) - { - global $PHPCAS_CLIENT; - phpCAS::traceBegin(); - if ( !is_object($PHPCAS_CLIENT) ) { - phpCAS::error('this method should only be called after '.__CLASS__.'::proxy()'); - } - if ( gettype($url) != 'string' ) { - phpCAS::error('type mismatched for parameter $url (should be `string\')'); - } - $PHPCAS_CLIENT->setURL($url); - phpCAS::traceEnd(); - } - - /** - * Get the URL that is set as the CAS service parameter. - */ - function getServiceURL() - { - global $PHPCAS_CLIENT; - if ( !is_object($PHPCAS_CLIENT) ) { - phpCAS::error('this method should only be called after '.__CLASS__.'::proxy()'); - } - return($PHPCAS_CLIENT->getURL()); - } - - /** - * Retrieve a Proxy Ticket from the CAS server. - */ - function retrievePT($target_service,&$err_code,&$err_msg) - { - global $PHPCAS_CLIENT; - if ( !is_object($PHPCAS_CLIENT) ) { - phpCAS::error('this method should only be called after '.__CLASS__.'::proxy()'); - } - if ( gettype($target_service) != 'string' ) { - phpCAS::error('type mismatched for parameter $target_service(should be `string\')'); - } - return($PHPCAS_CLIENT->retrievePT($target_service,$err_code,$err_msg)); - } - /** @} */ - -} - -// ######################################################################## -// DOCUMENTATION -// ######################################################################## - -// ######################################################################## -// MAIN PAGE - -/** - * @mainpage - * - * The following pages only show the source documentation. - * - * For more information on phpCAS, please refer to http://esup-phpcas.sourceforge.net - * - */ - -// ######################################################################## -// MODULES DEFINITION - -/** @defgroup public User interface */ - -/** @defgroup publicInit Initialization - * @ingroup public */ - -/** @defgroup publicAuth Authentication - * @ingroup public */ - -/** @defgroup publicServices Access to external services - * @ingroup public */ - -/** @defgroup publicConfig Configuration - * @ingroup public */ - -/** @defgroup publicLang Internationalization - * @ingroup publicConfig */ - -/** @defgroup publicOutput HTML output - * @ingroup publicConfig */ - -/** @defgroup publicPGTStorage PGT storage - * @ingroup publicConfig */ - -/** @defgroup publicDebug Debugging - * @ingroup public */ - - -/** @defgroup internal Implementation */ - -/** @defgroup internalAuthentication Authentication - * @ingroup internal */ - -/** @defgroup internalBasic CAS Basic client features (CAS 1.0, Service Tickets) - * @ingroup internal */ - -/** @defgroup internalProxy CAS Proxy features (CAS 2.0, Proxy Granting Tickets) - * @ingroup internal */ - -/** @defgroup internalPGTStorage PGT storage - * @ingroup internalProxy */ - -/** @defgroup internalPGTStorageDB PGT storage in a database - * @ingroup internalPGTStorage */ - -/** @defgroup internalPGTStorageFile PGT storage on the filesystem - * @ingroup internalPGTStorage */ - -/** @defgroup internalCallback Callback from the CAS server - * @ingroup internalProxy */ - -/** @defgroup internalProxied CAS proxied client features (CAS 2.0, Proxy Tickets) - * @ingroup internal */ - -/** @defgroup internalConfig Configuration - * @ingroup internal */ - -/** @defgroup internalOutput HTML output - * @ingroup internalConfig */ - -/** @defgroup internalLang Internationalization - * @ingroup internalConfig - * - * To add a new language: - * - 1. define a new constant PHPCAS_LANG_XXXXXX in CAS/CAS.php - * - 2. copy any file from CAS/languages to CAS/languages/XXXXXX.php - * - 3. Make the translations - */ - -/** @defgroup internalDebug Debugging - * @ingroup internal */ - -/** @defgroup internalMisc Miscellaneous - * @ingroup internal */ - -// ######################################################################## -// EXAMPLES - -/** - * @example example_simple.php - */ -/** - * @example example_proxy.php - */ -/** - * @example example_proxy2.php - */ -/** - * @example example_lang.php - */ -/** - * @example example_html.php - */ -/** - * @example example_file.php - */ -/** - * @example example_db.php - */ -/** - * @example example_service.php - */ -/** - * @example example_session_proxy.php - */ -/** - * @example example_session_service.php - */ -/** - * @example example_gateway.php - */ - - - -?> diff --git a/lib/cas/PGTStorage/pgt-db.php b/lib/cas/PGTStorage/pgt-db.php deleted file mode 100644 index 1477570badb..00000000000 --- a/lib/cas/PGTStorage/pgt-db.php +++ /dev/null @@ -1,190 +0,0 @@ -<?php - -/** - * @file CAS/PGTStorage/pgt-db.php - * Basic class for PGT database storage - */ - -// include phpDB library (the test was introduced in release 0.4.8 for -// the integration into Tikiwiki). -if (!class_exists('DB')) { - include_once('DB.php'); -} - -/** - * @class PGTStorageDB - * The PGTStorageDB class is a class for PGT database storage. An instance of - * this class is returned by CASClient::SetPGTStorageDB(). - * - * @author Pascal Aubry <pascal.aubry at univ-rennes1.fr> - * - * @ingroup internalPGTStorageDB - */ - -class PGTStorageDB extends PGTStorage -{ - /** - * @addtogroup internalPGTStorageDB - * @{ - */ - - /** - * a string representing a PEAR DB URL to connect to the database. Written by - * PGTStorageDB::PGTStorageDB(), read by getURL(). - * - * @hideinitializer - * @private - */ - var $_url=''; - - /** - * This method returns the PEAR DB URL to use to connect to the database. - * - * @return a PEAR DB URL - * - * @private - */ - function getURL() - { - return $this->_url; - } - - /** - * The handle of the connection to the database where PGT's are stored. Written by - * PGTStorageDB::init(), read by getLink(). - * - * @hideinitializer - * @private - */ - var $_link = null; - - /** - * This method returns the handle of the connection to the database where PGT's are - * stored. - * - * @return a handle of connection. - * - * @private - */ - function getLink() - { - return $this->_link; - } - - /** - * The name of the table where PGT's are stored. Written by - * PGTStorageDB::PGTStorageDB(), read by getTable(). - * - * @hideinitializer - * @private - */ - var $_table = ''; - - /** - * This method returns the name of the table where PGT's are stored. - * - * @return the name of a table. - * - * @private - */ - function getTable() - { - return $this->_table; - } - - // ######################################################################## - // DEBUGGING - // ######################################################################## - - /** - * This method returns an informational string giving the type of storage - * used by the object (used for debugging purposes). - * - * @return an informational string. - * @public - */ - function getStorageType() - { - return "database"; - } - - /** - * This method returns an informational string giving informations on the - * parameters of the storage.(used for debugging purposes). - * - * @public - */ - function getStorageInfo() - { - return 'url=`'.$this->getURL().'\', table=`'.$this->getTable().'\''; - } - - // ######################################################################## - // CONSTRUCTOR - // ######################################################################## - - /** - * The class constructor, called by CASClient::SetPGTStorageDB(). - * - * @param $cas_parent the CASClient instance that creates the object. - * @param $user the user to access the data with - * @param $password the user's password - * @param $database_type the type of the database hosting the data - * @param $hostname the server hosting the database - * @param $port the port the server is listening on - * @param $database the name of the database - * @param $table the name of the table storing the data - * - * @public - */ - function PGTStorageDB($cas_parent,$user,$password,$database_type,$hostname,$port,$database,$table) - { - phpCAS::traceBegin(); - - // call the ancestor's constructor - $this->PGTStorage($cas_parent); - - if ( empty($database_type) ) $database_type = CAS_PGT_STORAGE_DB_DEFAULT_DATABASE_TYPE; - if ( empty($hostname) ) $hostname = CAS_PGT_STORAGE_DB_DEFAULT_HOSTNAME; - if ( $port==0 ) $port = CAS_PGT_STORAGE_DB_DEFAULT_PORT; - if ( empty($database) ) $database = CAS_PGT_STORAGE_DB_DEFAULT_DATABASE; - if ( empty($table) ) $table = CAS_PGT_STORAGE_DB_DEFAULT_TABLE; - - // build and store the PEAR DB URL - $this->_url = $database_type.':'.'//'.$user.':'.$password.'@'.$server.':'.$port.'/'.$database; - - // XXX should use setURL and setTable - phpCAS::traceEnd(); - } - - // ######################################################################## - // INITIALIZATION - // ######################################################################## - - /** - * This method is used to initialize the storage. Halts on error. - * - * @public - */ - function init() - { - phpCAS::traceBegin(); - // if the storage has already been initialized, return immediatly - if ( $this->isInitialized() ) - return; - // call the ancestor's method (mark as initialized) - parent::init(); - - // try to connect to the database - $this->_link = DB::connect($this->getURL()); - if ( DB::isError($this->_link) ) { - phpCAS::error('could not connect to database ('.DB::errorMessage($this->_link).')'); - } - var_dump($this->_link); - phpCAS::traceBEnd(); - } - - /** @} */ -} - -?> \ No newline at end of file diff --git a/lib/cas/PGTStorage/pgt-file.php b/lib/cas/PGTStorage/pgt-file.php deleted file mode 100644 index bd0637c33bb..00000000000 --- a/lib/cas/PGTStorage/pgt-file.php +++ /dev/null @@ -1,237 +0,0 @@ -<?php - -/** - * @file CAS/PGTStorage/pgt-file.php - * Basic class for PGT file storage - */ - -/** - * @class PGTStorageFile - * The PGTStorageFile class is a class for PGT file storage. An instance of - * this class is returned by CASClient::SetPGTStorageFile(). - * - * @author Pascal Aubry <pascal.aubry at univ-rennes1.fr> - * - * @ingroup internalPGTStorageFile - */ - -class PGTStorageFile extends PGTStorage -{ - /** - * @addtogroup internalPGTStorageFile - * @{ - */ - - /** - * a string telling where PGT's should be stored on the filesystem. Written by - * PGTStorageFile::PGTStorageFile(), read by getPath(). - * - * @private - */ - var $_path; - - /** - * This method returns the name of the directory where PGT's should be stored - * on the filesystem. - * - * @return the name of a directory (with leading and trailing '/') - * - * @private - */ - function getPath() - { - return $this->_path; - } - - /** - * a string telling the format to use to store PGT's (plain or xml). Written by - * PGTStorageFile::PGTStorageFile(), read by getFormat(). - * - * @private - */ - var $_format; - - /** - * This method returns the format to use when storing PGT's on the filesystem. - * - * @return a string corresponding to the format used (plain or xml). - * - * @private - */ - function getFormat() - { - return $this->_format; - } - - // ######################################################################## - // DEBUGGING - // ######################################################################## - - /** - * This method returns an informational string giving the type of storage - * used by the object (used for debugging purposes). - * - * @return an informational string. - * @public - */ - function getStorageType() - { - return "file"; - } - - /** - * This method returns an informational string giving informations on the - * parameters of the storage.(used for debugging purposes). - * - * @return an informational string. - * @public - */ - function getStorageInfo() - { - return 'path=`'.$this->getPath().'\', format=`'.$this->getFormat().'\''; - } - - // ######################################################################## - // CONSTRUCTOR - // ######################################################################## - - /** - * The class constructor, called by CASClient::SetPGTStorageFile(). - * - * @param $cas_parent the CASClient instance that creates the object. - * @param $format the format used to store the PGT's (`plain' and `xml' allowed). - * @param $path the path where the PGT's should be stored - * - * @public - */ - function PGTStorageFile($cas_parent,$format,$path) - { - phpCAS::traceBegin(); - // call the ancestor's constructor - $this->PGTStorage($cas_parent); - - if (empty($format) ) $format = CAS_PGT_STORAGE_FILE_DEFAULT_FORMAT; - if (empty($path) ) $path = CAS_PGT_STORAGE_FILE_DEFAULT_PATH; - - // check that the path is an absolute path - if ( $path[0] != '/' ) { - phpCAS::error('an absolute path is needed for PGT storage to file'); - } - - // store the path (with a leading and trailing '/') - $path = preg_replace('|[/]*$|','/',$path); - $path = preg_replace('|^[/]*|','/',$path); - $this->_path = $path; - - // check the format and store it - switch ($format) { - case CAS_PGT_STORAGE_FILE_FORMAT_PLAIN: - case CAS_PGT_STORAGE_FILE_FORMAT_XML: - $this->_format = $format; - break; - default: - phpCAS::error('unknown PGT file storage format (`'.CAS_PGT_STORAGE_FILE_FORMAT_PLAIN.'\' and `'.CAS_PGT_STORAGE_FILE_FORMAT_XML.'\' allowed)'); - } - phpCAS::traceEnd(); - } - - // ######################################################################## - // INITIALIZATION - // ######################################################################## - - /** - * This method is used to initialize the storage. Halts on error. - * - * @public - */ - function init() - { - phpCAS::traceBegin(); - // if the storage has already been initialized, return immediatly - if ( $this->isInitialized() ) - return; - // call the ancestor's method (mark as initialized) - parent::init(); - phpCAS::traceEnd(); - } - - // ######################################################################## - // PGT I/O - // ######################################################################## - - /** - * This method returns the filename corresponding to a PGT Iou. - * - * @param $pgt_iou the PGT iou. - * - * @return a filename - * @private - */ - function getPGTIouFilename($pgt_iou) - { - phpCAS::traceBegin(); - return $this->getPath().$pgt_iou.'.'.$this->getFormat(); - phpCAS::traceEnd(); - } - - /** - * This method stores a PGT and its corresponding PGT Iou into a file. Echoes a - * warning on error. - * - * @param $pgt the PGT - * @param $pgt_iou the PGT iou - * - * @public - */ - function write($pgt,$pgt_iou) - { - phpCAS::traceBegin(); - $fname = $this->getPGTIouFilename($pgt_iou); - if ( $f=fopen($fname,"w") ) { - if ( fputs($f,$pgt) === FALSE ) { - phpCAS::error('could not write PGT to `'.$fname.'\''); - } - fclose($f); - } else { - phpCAS::error('could not open `'.$fname.'\''); - } - phpCAS::traceEnd(); - } - - /** - * This method reads a PGT corresponding to a PGT Iou and deletes the - * corresponding file. - * - * @param $pgt_iou the PGT iou - * - * @return the corresponding PGT, or FALSE on error - * - * @public - */ - function read($pgt_iou) - { - phpCAS::traceBegin(); - $pgt = FALSE; - $fname = $this->getPGTIouFilename($pgt_iou); - if ( !($f=fopen($fname,"r")) ) { - phpCAS::trace('could not open `'.$fname.'\''); - } else { - if ( ($pgt=fgets($f)) === FALSE ) { - phpCAS::trace('could not read PGT from `'.$fname.'\''); - } - fclose($f); - } - - // delete the PGT file - @unlink($fname); - - phpCAS::traceEnd($pgt); - return $pgt; - } - - /** @} */ - -} - - -?> \ No newline at end of file diff --git a/lib/cas/PGTStorage/pgt-main.php b/lib/cas/PGTStorage/pgt-main.php deleted file mode 100644 index 8fd3c9e12ba..00000000000 --- a/lib/cas/PGTStorage/pgt-main.php +++ /dev/null @@ -1,188 +0,0 @@ -<?php - -/** - * @file CAS/PGTStorage/pgt-main.php - * Basic class for PGT storage - */ - -/** - * @class PGTStorage - * The PGTStorage class is a generic class for PGT storage. This class should - * not be instanciated itself but inherited by specific PGT storage classes. - * - * @author Pascal Aubry <pascal.aubry at univ-rennes1.fr> - * - * @ingroup internalPGTStorage - */ - -class PGTStorage -{ - /** - * @addtogroup internalPGTStorage - * @{ - */ - - // ######################################################################## - // CONSTRUCTOR - // ######################################################################## - - /** - * The constructor of the class, should be called only by inherited classes. - * - * @param $cas_parent the CASclient instance that creates the current object. - * - * @protected - */ - function PGTStorage($cas_parent) - { - phpCAS::traceBegin(); - if ( !$cas_parent->isProxy() ) { - phpCAS::error('defining PGT storage makes no sense when not using a CAS proxy'); - } - phpCAS::traceEnd(); - } - - // ######################################################################## - // DEBUGGING - // ######################################################################## - - /** - * This virtual method returns an informational string giving the type of storage - * used by the object (used for debugging purposes). - * - * @public - */ - function getStorageType() - { - phpCAS::error(__CLASS__.'::'.__FUNCTION__.'() should never be called'); - } - - /** - * This virtual method returns an informational string giving informations on the - * parameters of the storage.(used for debugging purposes). - * - * @public - */ - function getStorageInfo() - { - phpCAS::error(__CLASS__.'::'.__FUNCTION__.'() should never be called'); - } - - // ######################################################################## - // ERROR HANDLING - // ######################################################################## - - /** - * string used to store an error message. Written by PGTStorage::setErrorMessage(), - * read by PGTStorage::getErrorMessage(). - * - * @hideinitializer - * @private - * @deprecated not used. - */ - var $_error_message=FALSE; - - /** - * This method sets en error message, which can be read later by - * PGTStorage::getErrorMessage(). - * - * @param $error_message an error message - * - * @protected - * @deprecated not used. - */ - function setErrorMessage($error_message) - { - $this->_error_message = $error_message; - } - - /** - * This method returns an error message set by PGTStorage::setErrorMessage(). - * - * @return an error message when set by PGTStorage::setErrorMessage(), FALSE - * otherwise. - * - * @public - * @deprecated not used. - */ - function getErrorMessage() - { - return $this->_error_message; - } - - // ######################################################################## - // INITIALIZATION - // ######################################################################## - - /** - * a boolean telling if the storage has already been initialized. Written by - * PGTStorage::init(), read by PGTStorage::isInitialized(). - * - * @hideinitializer - * @private - */ - var $_initialized = FALSE; - - /** - * This method tells if the storage has already been intialized. - * - * @return a boolean - * - * @protected - */ - function isInitialized() - { - return $this->_initialized; - } - - /** - * This virtual method initializes the object. - * - * @protected - */ - function init() - { - $this->_initialized = TRUE; - } - - // ######################################################################## - // PGT I/O - // ######################################################################## - - /** - * This virtual method stores a PGT and its corresponding PGT Iuo. - * @note Should never be called. - * - * @param $pgt the PGT - * @param $pgt_iou the PGT iou - * - * @protected - */ - function write($pgt,$pgt_iou) - { - phpCAS::error(__CLASS__.'::'.__FUNCTION__.'() should never be called'); - } - - /** - * This virtual method reads a PGT corresponding to a PGT Iou and deletes - * the corresponding storage entry. - * @note Should never be called. - * - * @param $pgt_iou the PGT iou - * - * @protected - */ - function read($pgt_iou) - { - phpCAS::error(__CLASS__.'::'.__FUNCTION__.'() should never be called'); - } - - /** @} */ - -} - -// include specific PGT storage classes -include_once(dirname(__FILE__).'/pgt-file.php'); -include_once(dirname(__FILE__).'/pgt-db.php'); - -?> \ No newline at end of file diff --git a/lib/cas/client.php b/lib/cas/client.php deleted file mode 100644 index 7b878642418..00000000000 --- a/lib/cas/client.php +++ /dev/null @@ -1,1950 +0,0 @@ -<?php - -/** - * @file CAS/client.php - * Main class of the phpCAS library - */ - -// include internationalization stuff -include_once(dirname(__FILE__).'/languages/languages.php'); - -// include PGT storage classes -include_once(dirname(__FILE__).'/PGTStorage/pgt-main.php'); - -/** - * @class CASClient - * The CASClient class is a client interface that provides CAS authentication - * to PHP applications. - * - * @author Pascal Aubry <pascal.aubry at univ-rennes1.fr> - */ - -class CASClient -{ - - // XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX - // XX XX - // XX CONFIGURATION XX - // XX XX - // XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX - - // ######################################################################## - // HTML OUTPUT - // ######################################################################## - /** - * @addtogroup internalOutput - * @{ - */ - - /** - * This method filters a string by replacing special tokens by appropriate values - * and prints it. The corresponding tokens are taken into account: - * - __CAS_VERSION__ - * - __PHPCAS_VERSION__ - * - __SERVER_BASE_URL__ - * - * Used by CASClient::PrintHTMLHeader() and CASClient::printHTMLFooter(). - * - * @param $str the string to filter and output - * - * @private - */ - function HTMLFilterOutput($str) - { - $str = str_replace('__CAS_VERSION__',$this->getServerVersion(),$str); - $str = str_replace('__PHPCAS_VERSION__',phpCAS::getVersion(),$str); - $str = str_replace('__SERVER_BASE_URL__',$this->getServerBaseURL(),$str); - echo $str; - } - - /** - * A string used to print the header of HTML pages. Written by CASClient::setHTMLHeader(), - * read by CASClient::printHTMLHeader(). - * - * @hideinitializer - * @private - * @see CASClient::setHTMLHeader, CASClient::printHTMLHeader() - */ - var $_output_header = ''; - - /** - * This method prints the header of the HTML output (after filtering). If - * CASClient::setHTMLHeader() was not used, a default header is output. - * - * @param $title the title of the page - * - * @see HTMLFilterOutput() - * @private - */ - function printHTMLHeader($title) - { - $this->HTMLFilterOutput(str_replace('__TITLE__', - $title, - (empty($this->_output_header) - ? '<html><head><title>__TITLE__</title></head><body><h1>__TITLE__</h1>' - : $this->output_header) - ) - ); - } - - /** - * A string used to print the footer of HTML pages. Written by CASClient::setHTMLFooter(), - * read by printHTMLFooter(). - * - * @hideinitializer - * @private - * @see CASClient::setHTMLFooter, CASClient::printHTMLFooter() - */ - var $_output_footer = ''; - - /** - * This method prints the footer of the HTML output (after filtering). If - * CASClient::setHTMLFooter() was not used, a default footer is output. - * - * @see HTMLFilterOutput() - * @private - */ - function printHTMLFooter() - { - $this->HTMLFilterOutput(empty($this->_output_footer) - ?('<hr><address>phpCAS __PHPCAS_VERSION__ '.$this->getString(CAS_STR_USING_SERVER).' <a href="__SERVER_BASE_URL__">__SERVER_BASE_URL__</a> (CAS __CAS_VERSION__)</a></address></body></html>') - :$this->_output_footer); - } - - /** - * This method set the HTML header used for all outputs. - * - * @param $header the HTML header. - * - * @public - */ - function setHTMLHeader($header) - { - $this->_output_header = $header; - } - - /** - * This method set the HTML footer used for all outputs. - * - * @param $footer the HTML footer. - * - * @public - */ - function setHTMLFooter($footer) - { - $this->_output_footer = $footer; - } - - /** @} */ - // ######################################################################## - // INTERNATIONALIZATION - // ######################################################################## - /** - * @addtogroup internalLang - * @{ - */ - /** - * A string corresponding to the language used by phpCAS. Written by - * CASClient::setLang(), read by CASClient::getLang(). - - * @note debugging information is always in english (debug purposes only). - * - * @hideinitializer - * @private - * @sa CASClient::_strings, CASClient::getString() - */ - var $_lang = ''; - - /** - * This method returns the language used by phpCAS. - * - * @return a string representing the language - * - * @private - */ - function getLang() - { - if ( empty($this->_lang) ) - $this->setLang(PHPCAS_LANG_DEFAULT); - return $this->_lang; - } - - /** - * array containing the strings used by phpCAS. Written by CASClient::setLang(), read by - * CASClient::getString() and used by CASClient::setLang(). - * - * @note This array is filled by instructions in CAS/languages/<$this->_lang>.php - * - * @private - * @see CASClient::_lang, CASClient::getString(), CASClient::setLang(), CASClient::getLang() - */ - var $_strings; - - /** - * This method returns a string depending on the language. - * - * @param $str the index of the string in $_string. - * - * @return the string corresponding to $index in $string. - * - * @private - */ - function getString($str) - { - // call CASclient::getLang() to be sure the language is initialized - $this->getLang(); - - if ( !isset($this->_strings[$str]) ) { - trigger_error('string `'.$str.'\' not defined for language `'.$this->getLang().'\'',E_USER_ERROR); - } - return $this->_strings[$str]; - } - - /** - * This method is used to set the language used by phpCAS. - * @note Can be called only once. - * - * @param $lang a string representing the language. - * - * @public - * @sa CAS_LANG_FRENCH, CAS_LANG_ENGLISH - */ - function setLang($lang) - { - // include the corresponding language file - include_once(dirname(__FILE__).'/languages/'.$lang.'.php'); - - if ( !is_array($this->_strings) ) { - trigger_error('language `'.$lang.'\' is not implemented',E_USER_ERROR); - } - $this->_lang = $lang; - } - - /** @} */ - // ######################################################################## - // CAS SERVER CONFIG - // ######################################################################## - /** - * @addtogroup internalConfig - * @{ - */ - - /** - * a record to store information about the CAS server. - * - $_server["version"]: the version of the CAS server - * - $_server["hostname"]: the hostname of the CAS server - * - $_server["port"]: the port the CAS server is running on - * - $_server["uri"]: the base URI the CAS server is responding on - * - $_server["base_url"]: the base URL of the CAS server - * - $_server["login_url"]: the login URL of the CAS server - * - $_server["service_validate_url"]: the service validating URL of the CAS server - * - $_server["proxy_url"]: the proxy URL of the CAS server - * - $_server["proxy_validate_url"]: the proxy validating URL of the CAS server - * - $_server["logout_url"]: the logout URL of the CAS server - * - * $_server["version"], $_server["hostname"], $_server["port"] and $_server["uri"] - * are written by CASClient::CASClient(), read by CASClient::getServerVersion(), - * CASClient::getServerHostname(), CASClient::getServerPort() and CASClient::getServerURI(). - * - * The other fields are written and read by CASClient::getServerBaseURL(), - * CASClient::getServerLoginURL(), CASClient::getServerServiceValidateURL(), - * CASClient::getServerProxyValidateURL() and CASClient::getServerLogoutURL(). - * - * @hideinitializer - * @private - */ - var $_server = array( - 'version' => -1, - 'hostname' => 'none', - 'port' => -1, - 'uri' => 'none' - ); - - /** - * This method is used to retrieve the version of the CAS server. - * @return the version of the CAS server. - * @private - */ - function getServerVersion() - { - return $this->_server['version']; - } - - /** - * This method is used to retrieve the hostname of the CAS server. - * @return the hostname of the CAS server. - * @private - */ - function getServerHostname() - { return $this->_server['hostname']; } - - /** - * This method is used to retrieve the port of the CAS server. - * @return the port of the CAS server. - * @private - */ - function getServerPort() - { return $this->_server['port']; } - - /** - * This method is used to retrieve the URI of the CAS server. - * @return a URI. - * @private - */ - function getServerURI() - { return $this->_server['uri']; } - - /** - * This method is used to retrieve the base URL of the CAS server. - * @return a URL. - * @private - */ - function getServerBaseURL() - { - // the URL is build only when needed - if ( empty($this->_server['base_url']) ) { - $this->_server['base_url'] = 'https://' - .$this->getServerHostname() - .':' - .$this->getServerPort() - .$this->getServerURI(); - } - return $this->_server['base_url']; - } - - /** - * This method is used to retrieve the login URL of the CAS server. - * @param $gateway true to check authentication, false to force it - * @return a URL. - * @private - */ - function getServerLoginURL($gateway) - { - phpCAS::traceBegin(); - // the URL is build only when needed - if ( empty($this->_server['login_url']) ) { - $this->_server['login_url'] = $this->getServerBaseURL(); - $this->_server['login_url'] .= 'login?service='; - $this->_server['login_url'] .= preg_replace('/&/','%26',$this->getURL()); - if ($gateway) { - $this->_server['login_url'] .= '&gateway=true'; - } - } - phpCAS::traceEnd($this->_server['login_url']); - return $this->_server['login_url']; - } - - /** - * This method is used to retrieve the service validating URL of the CAS server. - * @return a URL. - * @private - */ - function getServerServiceValidateURL() - { - // the URL is build only when needed - if ( empty($this->_server['service_validate_url']) ) { - switch ($this->getServerVersion()) { - case CAS_VERSION_1_0: - $this->_server['service_validate_url'] = $this->getServerBaseURL().'validate'; - break; - case CAS_VERSION_2_0: - $this->_server['service_validate_url'] = $this->getServerBaseURL().'serviceValidate'; - break; - } - } - return $this->_server['service_validate_url'].'?service='.preg_replace('/&/','%26',$this->getURL()); - } - - /** - * This method is used to retrieve the proxy validating URL of the CAS server. - * @return a URL. - * @private - */ - function getServerProxyValidateURL() - { - // the URL is build only when needed - if ( empty($this->_server['proxy_validate_url']) ) { - switch ($this->getServerVersion()) { - case CAS_VERSION_1_0: - $this->_server['proxy_validate_url'] = ''; - break; - case CAS_VERSION_2_0: - $this->_server['proxy_validate_url'] = $this->getServerBaseURL().'proxyValidate'; - break; - } - } - return $this->_server['proxy_validate_url'].'?service='.preg_replace('/&/','%26',$this->getURL()); - } - - /** - * This method is used to retrieve the proxy URL of the CAS server. - * @return a URL. - * @private - */ - function getServerProxyURL() - { - // the URL is build only when needed - if ( empty($this->_server['proxy_url']) ) { - switch ($this->getServerVersion()) { - case CAS_VERSION_1_0: - $this->_server['proxy_url'] = ''; - break; - case CAS_VERSION_2_0: - $this->_server['proxy_url'] = $this->getServerBaseURL().'proxy'; - break; - } - } - return $this->_server['proxy_url']; - } - - /** - * This method is used to retrieve the logout URL of the CAS server. - * @return a URL. - * @private - */ - function getServerLogoutURL() - { - // the URL is build only when needed - if ( empty($this->_server['logout_url']) ) { - $this->_server['logout_url'] = $this->getServerBaseURL().'logout'; - } - return $this->_server['logout_url']; - } - - // ######################################################################## - // CONSTRUCTOR - // ######################################################################## - /** - * CASClient constructor. - * - * @param $server_version the version of the CAS server - * @param $proxy TRUE if the CAS client is a CAS proxy, FALSE otherwise - * @param $server_hostname the hostname of the CAS server - * @param $server_port the port the CAS server is running on - * @param $server_uri the URI the CAS server is responding on - * @param $start_session Have phpCAS start PHP sessions (default true) - * - * @return a newly created CASClient object - * - * @public - */ - function CASClient($server_version, - $proxy, - $server_hostname, - $server_port, - $server_uri, - $start_session = true) - { - phpCAS::traceBegin(); - - // activate session mechanism if desired - if ($start_session) { - session_start(); - } - - $this->_proxy = $proxy; - - // check version - switch ($server_version) { - case CAS_VERSION_1_0: - if ( $this->isProxy() ) - phpCAS::error('CAS proxies are not supported in CAS ' - .$server_version); - break; - case CAS_VERSION_2_0: - break; - default: - phpCAS::error('this version of CAS (`' - .$server_version - .'\') is not supported by phpCAS ' - .phpCAS::getVersion()); - } - $this->_server['version'] = $server_version; - - // check hostname - if ( empty($server_hostname) - || !preg_match('/[\.\d\-abcdefghijklmnopqrstuvwxyz]*/',$server_hostname) ) { - phpCAS::error('bad CAS server hostname (`'.$server_hostname.'\')'); - } - $this->_server['hostname'] = $server_hostname; - - // check port - if ( $server_port == 0 - || !is_int($server_port) ) { - phpCAS::error('bad CAS server port (`'.$server_hostname.'\')'); - } - $this->_server['port'] = $server_port; - - // check URI - if ( !preg_match('/[\.\d\-_abcdefghijklmnopqrstuvwxyz\/]*/',$server_uri) ) { - phpCAS::error('bad CAS server URI (`'.$server_uri.'\')'); - } - // add leading and trailing `/' and remove doubles - $server_uri = preg_replace('/\/\//','/','/'.$server_uri.'/'); - $this->_server['uri'] = $server_uri; - - // set to callback mode if PgtIou and PgtId CGI GET parameters are provided - if ( $this->isProxy() ) { - $this->setCallbackMode(!empty($_GET['pgtIou'])&&!empty($_GET['pgtId'])); - } - - if ( $this->isCallbackMode() ) { - // callback mode: check that phpCAS is secured - if ( $_SERVER['HTTPS'] != 'on' ) { - phpCAS::error('CAS proxies must be secured to use phpCAS; PGT\'s will not be received from the CAS server'); - } - } else { - // normal mode: get ticket and remove it from CGI parameters for developpers - $ticket = $_GET['ticket']; - // at first check for a Service Ticket - if( preg_match('/^ST-/',$ticket)) { - phpCAS::trace('ST \''.$ticket.'\' found'); - // ST present - $this->setST($ticket); - } - // in a second time check for a Proxy Ticket (CAS >= 2.0) - else if( ($this->getServerVersion()!=CAS_VERSION_1_0) && preg_match('/^PT-/',$ticket) ) { - phpCAS::trace('PT \''.$ticket.'\' found'); - $this->setPT($ticket); - } - // ill-formed ticket, halt - else if ( !empty($ticket) ) { - phpCAS::error('ill-formed ticket found in the URL (ticket=`'.htmlentities($ticket).'\')'); - } - // ticket has been taken into account, unset it to hide it to applications - unset($_GET['ticket']); - } - phpCAS::traceEnd(); - } - - /** @} */ - - // XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX - // XX XX - // XX AUTHENTICATION XX - // XX XX - // XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX - - /** - * @addtogroup internalAuthentication - * @{ - */ - - /** - * The Authenticated user. Written by CASClient::setUser(), read by CASClient::getUser(). - * @attention client applications should use phpCAS::getUser(). - * - * @hideinitializer - * @private - */ - var $_user = ''; - - /** - * This method sets the CAS user's login name. - * - * @param $user the login name of the authenticated user. - * - * @private - */ - function setUser($user) - { - $this->_user = $user; - } - - /** - * This method returns the CAS user's login name. - * @warning should be called only after CASClient::forceAuthentication() or - * CASClient::isAuthenticated(), otherwise halt with an error. - * - * @return the login name of the authenticated user - */ - function getUser() - { - if ( empty($this->_user) ) { - phpCAS::error('this method should be used only after '.__CLASS__.'::forceAuthentication() or '.__CLASS__.'::isAuthenticated()'); - } - return $this->_user; - } - - /** - * This method is called to be sure that the user is authenticated. When not - * authenticated, halt by redirecting to the CAS server; otherwise return TRUE. - * @return TRUE when the user is authenticated; otherwise halt. - * @public - */ - function forceAuthentication() - { - phpCAS::traceBegin(); - - if ( $this->isAuthenticated() ) { - // the user is authenticated, nothing to be done. - phpCAS::trace('no need to authenticate'); - $res = TRUE; - } else { - // the user is not authenticated, redirect to the CAS server - unset($_SESSION['phpCAS']['auth_checked']); - $this->redirectToCas(FALSE/* no gateway */); - // never reached - $res = FALSE; - } - phpCAS::traceEnd($res); - return $res; - } - - /** - * This method is called to check whether the ser is authenticated or not. - * @return TRUE when the user is authenticated, FALSE otherwise. - * @public - */ - function checkAuthentication() - { - phpCAS::traceBegin(); - - if ( $this->isAuthenticated() ) { - phpCAS::trace('user is authenticated'); - $res = TRUE; - } else if (isset($_SESSION['phpCAS']['auth_checked'])) { - // the previous request has redirected the client to the CAS server with gateway=true - unset($_SESSION['phpCAS']['auth_checked']); - $res = FALSE; - } else { - $_SESSION['phpCAS']['auth_checked'] = true; - $this->redirectToCas(TRUE/* gateway */); - // never reached - $res = FALSE; - } - phpCAS::traceEnd($res); - return $res; - } - - /** - * This method is called to check if the user is authenticated (previously or by - * tickets given in the URL - * - * @return TRUE when the user is authenticated; otherwise halt. - * - * @public - */ - function isAuthenticated() - { - phpCAS::traceBegin(); - $res = FALSE; - $validate_url = ''; - - if ( $this->wasPreviouslyAuthenticated() ) { - // the user has already (previously during the session) been - // authenticated, nothing to be done. - phpCAS::trace('user was already authenticated, no need to look for tickets'); - $res = TRUE; - } elseif ( $this->hasST() ) { - // if a Service Ticket was given, validate it - phpCAS::trace('ST `'.$this->getST().'\' is present'); - $this->validateST($validate_url,$text_response,$tree_response); // if it fails, it halts - phpCAS::trace('ST `'.$this->getST().'\' was validated'); - if ( $this->isProxy() ) { - $this->validatePGT($validate_url,$text_response,$tree_response); // idem - phpCAS::trace('PGT `'.$this->getPGT().'\' was validated'); - $_SESSION['phpCAS']['pgt'] = $this->getPGT(); - } - $_SESSION['phpCAS']['user'] = $this->getUser(); - $res = TRUE; - } elseif ( $this->hasPT() ) { - // if a Proxy Ticket was given, validate it - phpCAS::trace('PT `'.$this->getPT().'\' is present'); - $this->validatePT($validate_url,$text_response,$tree_response); // note: if it fails, it halts - phpCAS::trace('PT `'.$this->getPT().'\' was validated'); - if ( $this->isProxy() ) { - $this->validatePGT($validate_url,$text_response,$tree_response); // idem - phpCAS::trace('PGT `'.$this->getPGT().'\' was validated'); - $_SESSION['phpCAS']['pgt'] = $this->getPGT(); - } - $_SESSION['phpCAS']['user'] = $this->getUser(); - $res = TRUE; - } else { - // no ticket given, not authenticated - phpCAS::trace('no ticket found'); - } - - phpCAS::traceEnd($res); - return $res; - } - - /** - * This method tells if the user has already been (previously) authenticated - * by looking into the session variables. - * - * @note This function switches to callback mode when needed. - * - * @return TRUE when the user has already been authenticated; FALSE otherwise. - * - * @private - */ - function wasPreviouslyAuthenticated() - { - phpCAS::traceBegin(); - - if ( $this->isCallbackMode() ) { - $this->callback(); - } - - $auth = FALSE; - - if ( $this->isProxy() ) { - // CAS proxy: username and PGT must be present - if ( !empty($_SESSION['phpCAS']['user']) && !empty($_SESSION['phpCAS']['pgt']) ) { - // authentication already done - $this->setUser($_SESSION['phpCAS']['user']); - $this->setPGT($_SESSION['phpCAS']['pgt']); - phpCAS::trace('user = `'.$_SESSION['phpCAS']['user'].'\', PGT = `'.$_SESSION['phpCAS']['pgt'].'\''); - $auth = TRUE; - } elseif ( !empty($_SESSION['phpCAS']['user']) && empty($_SESSION['phpCAS']['pgt']) ) { - // these two variables should be empty or not empty at the same time - phpCAS::trace('username found (`'.$_SESSION['phpCAS']['user'].'\') but PGT is empty'); - // unset all tickets to enforce authentication - unset($_SESSION['phpCAS']); - $this->setST(''); - $this->setPT(''); - } elseif ( empty($_SESSION['phpCAS']['user']) && !empty($_SESSION['phpCAS']['pgt']) ) { - // these two variables should be empty or not empty at the same time - phpCAS::trace('PGT found (`'.$_SESSION['phpCAS']['pgt'].'\') but username is empty'); - // unset all tickets to enforce authentication - unset($_SESSION['phpCAS']); - $this->setST(''); - $this->setPT(''); - } else { - phpCAS::trace('neither user not PGT found'); - } - } else { - // `simple' CAS client (not a proxy): username must be present - if ( !empty($_SESSION['phpCAS']['user']) ) { - // authentication already done - $this->setUser($_SESSION['phpCAS']['user']); - phpCAS::trace('user = `'.$_SESSION['phpCAS']['user'].'\''); - $auth = TRUE; - } else { - phpCAS::trace('no user found'); - } - } - - phpCAS::traceEnd($auth); - return $auth; - } - - /** - * This method is used to redirect the client to the CAS server. - * It is used by CASClient::forceAuthentication() and CASClient::checkAuthentication(). - * @param $gateway true to check authentication, false to force it - * @public - */ - function redirectToCas($gateway) - { - phpCAS::traceBegin(); - $cas_url = $this->getServerLoginURL($gateway); - header('Location: '.$cas_url); - $this->printHTMLHeader($this->getString(CAS_STR_AUTHENTICATION_WANTED)); - printf('<p>'.$this->getString(CAS_STR_SHOULD_HAVE_BEEN_REDIRECTED).'</p>',$cas_url); - $this->printHTMLFooter(); - phpCAS::traceExit(); - exit(); - } - - /** - * This method is used to logout from CAS. - * @param $url a URL that will be transmitted to the CAS server (to come back to when logged out) - * @public - */ - function logout($url = "") - { - phpCAS::traceBegin(); - $cas_url = $this->getServerLogoutURL(); - // v0.4.14 sebastien.gougeon at univ-rennes1.fr - // header('Location: '.$cas_url); - if ( $url != "" ) { - $url = '?service=' . $url; - } - header('Location: '.$cas_url . $url); - session_unset(); - session_destroy(); - $this->printHTMLHeader($this->getString(CAS_STR_LOGOUT)); - printf('<p>'.$this->getString(CAS_STR_SHOULD_HAVE_BEEN_REDIRECTED).'</p>',$cas_url); - $this->printHTMLFooter(); - phpCAS::traceExit(); - exit(); - } - - /** @} */ - - // XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX - // XX XX - // XX BASIC CLIENT FEATURES (CAS 1.0) XX - // XX XX - // XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX - - // ######################################################################## - // ST - // ######################################################################## - /** - * @addtogroup internalBasic - * @{ - */ - - /** - * the Service Ticket provided in the URL of the request if present - * (empty otherwise). Written by CASClient::CASClient(), read by - * CASClient::getST() and CASClient::hasPGT(). - * - * @hideinitializer - * @private - */ - var $_st = ''; - - /** - * This method returns the Service Ticket provided in the URL of the request. - * @return The service ticket. - * @private - */ - function getST() - { return $this->_st; } - - /** - * This method stores the Service Ticket. - * @param $st The Service Ticket. - * @private - */ - function setST($st) - { $this->_st = $st; } - - /** - * This method tells if a Service Ticket was stored. - * @return TRUE if a Service Ticket has been stored. - * @private - */ - function hasST() - { return !empty($this->_st); } - - /** @} */ - - // ######################################################################## - // ST VALIDATION - // ######################################################################## - /** - * @addtogroup internalBasic - * @{ - */ - - /** - * This method is used to validate a ST; halt on failure, and sets $validate_url, - * $text_reponse and $tree_response on success. These parameters are used later - * by CASClient::validatePGT() for CAS proxies. - * - * @param $validate_url the URL of the request to the CAS server. - * @param $text_response the response of the CAS server, as is (XML text). - * @param $tree_response the response of the CAS server, as a DOM XML tree. - * - * @return bool TRUE when successfull, halt otherwise by calling CASClient::authError(). - * - * @private - */ - function validateST($validate_url,&$text_response,&$tree_response) - { - phpCAS::traceBegin(); - // build the URL to validate the ticket - $validate_url = $this->getServerServiceValidateURL().'&ticket='.$this->getST(); - if ( $this->isProxy() ) { - // pass the callback url for CAS proxies - $validate_url .= '&pgtUrl='.$this->getCallbackURL(); - } - - // open and read the URL - if ( !$this->readURL($validate_url,''/*cookies*/,$headers,$text_response,$err_msg) ) { - phpCAS::trace('could not open URL \''.$validate_url.'\' to validate ('.$err_msg.')'); - $this->authError('ST not validated', - $validate_url, - TRUE/*$no_response*/); - } - - // analyze the result depending on the version - switch ($this->getServerVersion()) { - case CAS_VERSION_1_0: - if (preg_match('/^no\n/',$text_response)) { - phpCAS::trace('ST has not been validated'); - $this->authError('ST not validated', - $validate_url, - FALSE/*$no_response*/, - FALSE/*$bad_response*/, - $text_response); - } - if (!preg_match('/^yes\n/',$text_response)) { - phpCAS::trace('ill-formed response'); - $this->authError('ST not validated', - $validate_url, - FALSE/*$no_response*/, - TRUE/*$bad_response*/, - $text_response); - } - // ST has been validated, extract the user name - $arr = preg_split('/\n/',$text_response); - $this->setUser(trim($arr[1])); - break; - case CAS_VERSION_2_0: - // read the response of the CAS server into a DOM object - if ( !($dom = domxml_open_mem($text_response))) { - phpCAS::trace('domxml_open_mem() failed'); - $this->authError('ST not validated', - $validate_url, - FALSE/*$no_response*/, - TRUE/*$bad_response*/, - $text_response); - } - // read the root node of the XML tree - if ( !($tree_response = $dom->document_element()) ) { - phpCAS::trace('document_element() failed'); - $this->authError('ST not validated', - $validate_url, - FALSE/*$no_response*/, - TRUE/*$bad_response*/, - $text_response); - } - // insure that tag name is 'serviceResponse' - if ( $tree_response->node_name() != 'serviceResponse' ) { - phpCAS::trace('bad XML root node (should be `serviceResponse\' instead of `'.$tree_response->node_name().'\''); - $this->authError('ST not validated', - $validate_url, - FALSE/*$no_response*/, - TRUE/*$bad_response*/, - $text_response); - } - if ( sizeof($success_elements = $tree_response->get_elements_by_tagname("authenticationSuccess")) != 0) { - // authentication succeded, extract the user name - if ( sizeof($user_elements = $success_elements[0]->get_elements_by_tagname("user")) == 0) { - phpCAS::trace('<authenticationSuccess> found, but no <user>'); - $this->authError('ST not validated', - $validate_url, - FALSE/*$no_response*/, - TRUE/*$bad_response*/, - $text_response); - } - $user = trim($user_elements[0]->get_content()); - phpCAS::trace('user = `'.$user); - $this->setUser($user); - - } else if ( sizeof($failure_elements = $tree_response->get_elements_by_tagname("authenticationFailure")) != 0) { - phpCAS::trace('<authenticationFailure> found'); - // authentication failed, extract the error code and message - $this->authError('ST not validated', - $validate_url, - FALSE/*$no_response*/, - FALSE/*$bad_response*/, - $text_response, - $failure_elements[0]->get_attribute('code')/*$err_code*/, - trim($failure_elements[0]->get_content())/*$err_msg*/); - } else { - phpCAS::trace('neither <authenticationSuccess> nor <authenticationFailure> found'); - $this->authError('ST not validated', - $validate_url, - FALSE/*$no_response*/, - TRUE/*$bad_response*/, - $text_response); - } - break; - } - - // at this step, ST has been validated and $this->_user has been set, - phpCAS::traceEnd(TRUE); - return TRUE; - } - - /** @} */ - - // XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX - // XX XX - // XX PROXY FEATURES (CAS 2.0) XX - // XX XX - // XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX - - // ######################################################################## - // PROXYING - // ######################################################################## - /** - * @addtogroup internalProxy - * @{ - */ - - /** - * A boolean telling if the client is a CAS proxy or not. Written by CASClient::CASClient(), - * read by CASClient::isProxy(). - * - * @private - */ - var $_proxy; - - /** - * Tells if a CAS client is a CAS proxy or not - * - * @return TRUE when the CAS client is a CAs proxy, FALSE otherwise - * - * @private - */ - function isProxy() - { - return $this->_proxy; - } - - /** @} */ - // ######################################################################## - // PGT - // ######################################################################## - /** - * @addtogroup internalProxy - * @{ - */ - - /** - * the Proxy Grnting Ticket given by the CAS server (empty otherwise). - * Written by CASClient::setPGT(), read by CASClient::getPGT() and CASClient::hasPGT(). - * - * @hideinitializer - * @private - */ - var $_pgt = ''; - - /** - * This method returns the Proxy Granting Ticket given by the CAS server. - * @return The Proxy Granting Ticket. - * @private - */ - function getPGT() - { return $this->_pgt; } - - /** - * This method stores the Proxy Granting Ticket. - * @param $pgt The Proxy Granting Ticket. - * @private - */ - function setPGT($pgt) - { $this->_pgt = $pgt; } - - /** - * This method tells if a Proxy Granting Ticket was stored. - * @return TRUE if a Proxy Granting Ticket has been stored. - * @private - */ - function hasPGT() - { return !empty($this->_pgt); } - - /** @} */ - - // ######################################################################## - // CALLBACK MODE - // ######################################################################## - /** - * @addtogroup internalCallback - * @{ - */ - /** - * each PHP script using phpCAS in proxy mode is its own callback to get the - * PGT back from the CAS server. callback_mode is detected by the constructor - * thanks to the GET parameters. - */ - - /** - * a boolean to know if the CAS client is running in callback mode. Written by - * CASClient::setCallBackMode(), read by CASClient::isCallbackMode(). - * - * @hideinitializer - * @private - */ - var $_callback_mode = FALSE; - - /** - * This method sets/unsets callback mode. - * - * @param $callback_mode TRUE to set callback mode, FALSE otherwise. - * - * @private - */ - function setCallbackMode($callback_mode) - { - $this->_callback_mode = $callback_mode; - } - - /** - * This method returns TRUE when the CAs client is running i callback mode, - * FALSE otherwise. - * - * @return A boolean. - * - * @private - */ - function isCallbackMode() - { - return $this->_callback_mode; - } - - /** - * the URL that should be used for the PGT callback (in fact the URL of the - * current request without any CGI parameter). Written and read by - * CASClient::getCallbackURL(). - * - * @hideinitializer - * @private - */ - var $_callback_url = ''; - - /** - * This method returns the URL that should be used for the PGT callback (in - * fact the URL of the current request without any CGI parameter, except if - * phpCAS::setFixedCallbackURL() was used). - * - * @return The callback URL - * - * @private - */ - function getCallbackURL() - { - // the URL is built when needed only - if ( empty($this->_callback_url) ) { - $final_uri = ''; - // remove the ticket if present in the URL - $final_uri = 'https://'; - /* replaced by Julien Marchal - v0.4.6 - * $this->uri .= $_SERVER['SERVER_NAME']; - */ - if(empty($_SERVER['HTTP_X_FORWARDED_SERVER'])){ - /* replaced by teedog - v0.4.12 - * $final_uri .= $_SERVER['SERVER_NAME']; - */ - if (empty($_SERVER['SERVER_NAME'])) { - $final_uri .= $_SERVER['HTTP_HOST']; - } else { - $final_uri .= $_SERVER['SERVER_NAME']; - } - } else { - $final_uri .= $_SERVER['HTTP_X_FORWARDED_SERVER']; - } - if ( ($_SERVER['HTTPS']=='on' && $_SERVER['SERVER_PORT']!=443) - || ($_SERVER['HTTPS']!='on' && $_SERVER['SERVER_PORT']!=80) ) { - $final_uri .= ':'; - $final_uri .= $_SERVER['SERVER_PORT']; - } - $request_uri = $_SERVER['REQUEST_URI']; - $request_uri = preg_replace('/\?.*$/','',$request_uri); - $final_uri .= $request_uri; - $this->setCallbackURL($final_uri); - } - return $this->_callback_url; - } - - /** - * This method sets the callback url. - * - * @param $callback_url url to set callback - * - * @private - */ - function setCallbackURL($url) - { - return $this->_callback_url = $url; - } - - /** - * This method is called by CASClient::CASClient() when running in callback - * mode. It stores the PGT and its PGT Iou, prints its output and halts. - * - * @private - */ - function callback() - { - phpCAS::traceBegin(); - $this->printHTMLHeader('phpCAS callback'); - $pgt_iou = $_GET['pgtIou']; - $pgt = $_GET['pgtId']; - phpCAS::trace('Storing PGT `'.$pgt.'\' (id=`'.$pgt_iou.'\')'); - echo '<p>Storing PGT `'.$pgt.'\' (id=`'.$pgt_iou.'\').</p>'; - $this->storePGT($pgt,$pgt_iou); - $this->printHTMLFooter(); - phpCAS::traceExit(); - } - - /** @} */ - - // ######################################################################## - // PGT STORAGE - // ######################################################################## - /** - * @addtogroup internalPGTStorage - * @{ - */ - - /** - * an instance of a class inheriting of PGTStorage, used to deal with PGT - * storage. Created by CASClient::setPGTStorageFile() or CASClient::setPGTStorageDB(), used - * by CASClient::setPGTStorageFile(), CASClient::setPGTStorageDB() and CASClient::initPGTStorage(). - * - * @hideinitializer - * @private - */ - var $_pgt_storage = null; - - /** - * This method is used to initialize the storage of PGT's. - * Halts on error. - * - * @private - */ - function initPGTStorage() - { - // if no SetPGTStorageXxx() has been used, default to file - if ( !is_object($this->_pgt_storage) ) { - $this->setPGTStorageFile(); - } - - // initializes the storage - $this->_pgt_storage->init(); - } - - /** - * This method stores a PGT. Halts on error. - * - * @param $pgt the PGT to store - * @param $pgt_iou its corresponding Iou - * - * @private - */ - function storePGT($pgt,$pgt_iou) - { - // ensure that storage is initialized - $this->initPGTStorage(); - // writes the PGT - $this->_pgt_storage->write($pgt,$pgt_iou); - } - - /** - * This method reads a PGT from its Iou and deletes the corresponding storage entry. - * - * @param $pgt_iou the PGT Iou - * - * @return The PGT corresponding to the Iou, FALSE when not found. - * - * @private - */ - function loadPGT($pgt_iou) - { - // ensure that storage is initialized - $this->initPGTStorage(); - // read the PGT - return $this->_pgt_storage->read($pgt_iou); - } - - /** - * This method is used to tell phpCAS to store the response of the - * CAS server to PGT requests onto the filesystem. - * - * @param $format the format used to store the PGT's (`plain' and `xml' allowed) - * @param $path the path where the PGT's should be stored - * - * @public - */ - function setPGTStorageFile($format='', - $path='') - { - // check that the storage has not already been set - if ( is_object($this->_pgt_storage) ) { - phpCAS::error('PGT storage already defined'); - } - - // create the storage object - $this->_pgt_storage = &new PGTStorageFile($this,$format,$path); - } - - /** - * This method is used to tell phpCAS to store the response of the - * CAS server to PGT requests into a database. - * @note The connection to the database is done only when needed. - * As a consequence, bad parameters are detected only when - * initializing PGT storage. - * - * @param $user the user to access the data with - * @param $password the user's password - * @param $database_type the type of the database hosting the data - * @param $hostname the server hosting the database - * @param $port the port the server is listening on - * @param $database the name of the database - * @param $table the name of the table storing the data - * - * @public - */ - function setPGTStorageDB($user, - $password, - $database_type, - $hostname, - $port, - $database, - $table) - { - // check that the storage has not already been set - if ( is_object($this->_pgt_storage) ) { - phpCAS::error('PGT storage already defined'); - } - - // warn the user that he should use file storage... - trigger_error('PGT storage into database is an experimental feature, use at your own risk',E_USER_WARNING); - - // create the storage object - $this->_pgt_storage = & new PGTStorageDB($this,$user,$password,$database_type,$hostname,$port,$database,$table); - } - - // ######################################################################## - // PGT VALIDATION - // ######################################################################## - /** - * This method is used to validate a PGT; halt on failure. - * - * @param $validate_url the URL of the request to the CAS server. - * @param $text_response the response of the CAS server, as is (XML text); result - * of CASClient::validateST() or CASClient::validatePT(). - * @param $tree_response the response of the CAS server, as a DOM XML tree; result - * of CASClient::validateST() or CASClient::validatePT(). - * - * @return bool TRUE when successfull, halt otherwise by calling CASClient::authError(). - * - * @private - */ - function validatePGT(&$validate_url,$text_response,$tree_response) - { - phpCAS::traceBegin(); - if ( sizeof($arr = $tree_response->get_elements_by_tagname("proxyGrantingTicket")) == 0) { - phpCAS::trace('<proxyGrantingTicket> not found'); - // authentication succeded, but no PGT Iou was transmitted - $this->authError('Ticket validated but no PGT Iou transmitted', - $validate_url, - FALSE/*$no_response*/, - FALSE/*$bad_response*/, - $text_response); - } else { - // PGT Iou transmitted, extract it - $pgt_iou = trim($arr[0]->get_content()); - $pgt = $this->loadPGT($pgt_iou); - if ( $pgt == FALSE ) { - phpCAS::trace('could not load PGT'); - $this->authError('PGT Iou was transmitted but PGT could not be retrieved', - $validate_url, - FALSE/*$no_response*/, - FALSE/*$bad_response*/, - $text_response); - } - $this->setPGT($pgt); - } - phpCAS::traceEnd(TRUE); - return TRUE; - } - - // ######################################################################## - // PGT VALIDATION - // ######################################################################## - - /** - * This method is used to retrieve PT's from the CAS server thanks to a PGT. - * - * @param $target_service the service to ask for with the PT. - * @param $err_code an error code (PHPCAS_SERVICE_OK on success). - * @param $err_msg an error message (empty on success). - * - * @return a Proxy Ticket, or FALSE on error. - * - * @private - */ - function retrievePT($target_service,&$err_code,&$err_msg) - { - phpCAS::traceBegin(); - - // by default, $err_msg is set empty and $pt to TRUE. On error, $pt is - // set to false and $err_msg to an error message. At the end, if $pt is FALSE - // and $error_msg is still empty, it is set to 'invalid response' (the most - // commonly encountered error). - $err_msg = ''; - - // build the URL to retrieve the PT - $cas_url = $this->getServerProxyURL().'?targetService='.preg_replace('/&/','%26',$target_service).'&pgt='.$this->getPGT(); - - // open and read the URL - if ( !$this->readURL($cas_url,''/*cookies*/,$headers,$cas_response,$err_msg) ) { - phpCAS::trace('could not open URL \''.$cas_url.'\' to validate ('.$err_msg.')'); - $err_code = PHPCAS_SERVICE_PT_NO_SERVER_RESPONSE; - $err_msg = 'could not retrieve PT (no response from the CAS server)'; - phpCAS::traceEnd(FALSE); - return FALSE; - } - - $bad_response = FALSE; - - if ( !$bad_response ) { - // read the response of the CAS server into a DOM object - if ( !($dom = @domxml_open_mem($cas_response))) { - phpCAS::trace('domxml_open_mem() failed'); - // read failed - $bad_response = TRUE; - } - } - - if ( !$bad_response ) { - // read the root node of the XML tree - if ( !($root = $dom->document_element()) ) { - phpCAS::trace('document_element() failed'); - // read failed - $bad_response = TRUE; - } - } - - if ( !$bad_response ) { - // insure that tag name is 'serviceResponse' - if ( $root->node_name() != 'serviceResponse' ) { - phpCAS::trace('node_name() failed'); - // bad root node - $bad_response = TRUE; - } - } - - if ( !$bad_response ) { - // look for a proxySuccess tag - if ( sizeof($arr = $root->get_elements_by_tagname("proxySuccess")) != 0) { - // authentication succeded, look for a proxyTicket tag - if ( sizeof($arr = $root->get_elements_by_tagname("proxyTicket")) != 0) { - $err_code = PHPCAS_SERVICE_OK; - $err_msg = ''; - $pt = trim($arr[0]->get_content()); - phpCAS::traceEnd($pt); - return $pt; - } else { - phpCAS::trace('<proxySuccess> was found, but not <proxyTicket>'); - } - } - // look for a proxyFailure tag - else if ( sizeof($arr = $root->get_elements_by_tagname("proxyFailure")) != 0) { - // authentication failed, extract the error - $err_code = PHPCAS_SERVICE_PT_FAILURE; - $err_msg = 'PT retrieving failed (code=`' - .$arr[0]->get_attribute('code') - .'\', message=`' - .trim($arr[0]->get_content()) - .'\')'; - phpCAS::traceEnd(FALSE); - return FALSE; - } else { - phpCAS::trace('neither <proxySuccess> nor <proxyFailure> found'); - } - } - - // at this step, we are sure that the response of the CAS server was ill-formed - $err_code = PHPCAS_SERVICE_PT_BAD_SERVER_RESPONSE; - $err_msg = 'Invalid response from the CAS server (response=`'.$cas_response.'\')'; - - phpCAS::traceEnd(FALSE); - return FALSE; - } - - // ######################################################################## - // ACCESS TO EXTERNAL SERVICES - // ######################################################################## - - /** - * This method is used to acces a remote URL. - * - * @param $url the URL to access. - * @param $cookies an array containing cookies strings such as 'name=val' - * @param $headers an array containing the HTTP header lines of the response - * (an empty array on failure). - * @param $body the body of the response, as a string (empty on failure). - * @param $err_msg an error message, filled on failure. - * - * @return TRUE on success, FALSE otherwise (in this later case, $err_msg - * contains an error message). - * - * @private - */ - function readURL($url,$cookies,&$headers,&$body,&$err_msg) - { - phpCAS::traceBegin(); - $headers = ''; - $body = ''; - $err_msg = ''; - - $res = TRUE; - - // initialize the CURL session - $ch = curl_init($url); - - // verify the the server's certificate corresponds to its name - curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 1); - // but do not verify the certificate itself - curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); - - // return the CURL output into a variable - curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); - // include the HTTP header with the body - curl_setopt($ch, CURLOPT_HEADER, 1); - // add cookies headers - if ( is_array($cookies) ) { - curl_setopt($ch,CURLOPT_COOKIE,implode(';',$cookies)); - } - // perform the query - $buf = curl_exec ($ch); - if ( $buf === FALSE ) { - phpCAS::trace('cur_exec() failed'); - $err_msg = 'CURL error #'.curl_errno($ch).': '.curl_error($ch); - // close the CURL session - curl_close ($ch); - $res = FALSE; - } else { - // close the CURL session - curl_close ($ch); - - // find the end of the headers - // note: strpos($str,"\n\r\n\r") does not work (?) - $pos = FALSE; - for ($i=0; $i<strlen($buf); $i++) { - if ( $buf[$i] == chr(13) ) - if ( $buf[$i+1] == chr(10) ) - if ( $buf[$i+2] == chr(13) ) - if ( $buf[$i+3] == chr(10) ) { - // header found - $pos = $i; - break; - } - } - - if ( $pos === FALSE ) { - // end of header not found - $err_msg = 'no header found'; - phpCAS::trace($err_msg); - $res = FALSE; - } else { - // extract headers into an array - $headers = preg_split ("/[\n\r]+/",substr($buf,0,$pos)); - // extract body into a string - $body = substr($buf,$pos+4); - } - } - - phpCAS::traceEnd($res); - return $res; - } - - /** - * This method is used to access an HTTP[S] service. - * - * @param $url the service to access. - * @param $err_code an error code Possible values are PHPCAS_SERVICE_OK (on - * success), PHPCAS_SERVICE_PT_NO_SERVER_RESPONSE, PHPCAS_SERVICE_PT_BAD_SERVER_RESPONSE, - * PHPCAS_SERVICE_PT_FAILURE, PHPCAS_SERVICE_NOT AVAILABLE. - * @param $output the output of the service (also used to give an error - * message on failure). - * - * @return TRUE on success, FALSE otherwise (in this later case, $err_code - * gives the reason why it failed and $output contains an error message). - * - * @public - */ - function serviceWeb($url,&$err_code,&$output) - { - phpCAS::traceBegin(); - // at first retrieve a PT - $pt = $this->retrievePT($url,$err_code,$output); - - $res = TRUE; - - // test if PT was retrieved correctly - if ( !$pt ) { - // note: $err_code and $err_msg are filled by CASClient::retrievePT() - phpCAS::trace('PT was not retrieved correctly'); - $res = FALSE; - } else { - // add cookies if necessary - if ( is_array($_SESSION['phpCAS']['services'][$url]['cookies']) ) { - foreach ( $_SESSION['phpCAS']['services'][$url]['cookies'] as $name => $val ) { - $cookies[] = $name.'='.$val; - } - } - - // build the URL including the PT - if ( strstr($url,'?') === FALSE ) { - $service_url = $url.'?ticket='.$pt; - } else { - $service_url = $url.'&ticket='.$pt; - } - - phpCAS::trace('reading URL`'.$service_url.'\''); - if ( !$this->readURL($service_url,$cookies,$headers,$output,$err_msg) ) { - phpCAS::trace('could not read URL`'.$service_url.'\''); - $err_code = PHPCAS_SERVICE_NOT_AVAILABLE; - // give an error message - $output = sprintf($this->getString(CAS_STR_SERVICE_UNAVAILABLE), - $service_url, - $err_msg); - $res = FALSE; - } else { - // URL has been fetched, extract the cookies - phpCAS::trace('URL`'.$service_url.'\' has been read, storing cookies:'); - foreach ( $headers as $header ) { - // test if the header is a cookie - if ( preg_match('/^Set-Cookie:/',$header) ) { - // the header is a cookie, remove the beginning - $header_val = preg_replace('/^Set-Cookie: */','',$header); - // extract interesting information - $name_val = strtok($header_val,'; '); - // extract the name and the value of the cookie - $cookie_name = strtok($name_val,'='); - $cookie_val = strtok('='); - // store the cookie - $_SESSION['phpCAS']['services'][$url]['cookies'][$cookie_name] = $cookie_val; - phpCAS::trace($cookie_name.' -> '.$cookie_val); - } - } - } - } - - phpCAS::traceEnd($res); - return $res; - } - - /** - * This method is used to access an IMAP/POP3/NNTP service. - * - * @param $url a string giving the URL of the service, including the mailing box - * for IMAP URLs, as accepted by imap_open(). - * @param $flags options given to imap_open(). - * @param $err_code an error code Possible values are PHPCAS_SERVICE_OK (on - * success), PHPCAS_SERVICE_PT_NO_SERVER_RESPONSE, PHPCAS_SERVICE_PT_BAD_SERVER_RESPONSE, - * PHPCAS_SERVICE_PT_FAILURE, PHPCAS_SERVICE_NOT AVAILABLE. - * @param $err_msg an error message on failure - * @param $pt the Proxy Ticket (PT) retrieved from the CAS server to access the URL - * on success, FALSE on error). - * - * @return an IMAP stream on success, FALSE otherwise (in this later case, $err_code - * gives the reason why it failed and $err_msg contains an error message). - * - * @public - */ - function serviceMail($url,$flags,&$err_code,&$err_msg,&$pt) - { - phpCAS::traceBegin(); - // at first retrieve a PT - $pt = $this->retrievePT($target_service,$err_code,$output); - - $stream = FALSE; - - // test if PT was retrieved correctly - if ( !$pt ) { - // note: $err_code and $err_msg are filled by CASClient::retrievePT() - phpCAS::trace('PT was not retrieved correctly'); - } else { - phpCAS::trace('opening IMAP URL `'.$url.'\'...'); - $stream = @imap_open($url,$this->getUser(),$pt,$flags); - if ( !$stream ) { - phpCAS::trace('could not open URL'); - $err_code = PHPCAS_SERVICE_NOT_AVAILABLE; - // give an error message - $err_msg = sprintf($this->getString(CAS_STR_SERVICE_UNAVAILABLE), - $service_url, - var_export(imap_errors(),TRUE)); - $pt = FALSE; - $stream = FALSE; - } else { - phpCAS::trace('ok'); - } - } - - phpCAS::traceEnd($stream); - return $stream; - } - - /** @} */ - - // XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX - // XX XX - // XX PROXIED CLIENT FEATURES (CAS 2.0) XX - // XX XX - // XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX - - // ######################################################################## - // PT - // ######################################################################## - /** - * @addtogroup internalProxied - * @{ - */ - - /** - * the Proxy Ticket provided in the URL of the request if present - * (empty otherwise). Written by CASClient::CASClient(), read by - * CASClient::getPT() and CASClient::hasPGT(). - * - * @hideinitializer - * @private - */ - var $_pt = ''; - - /** - * This method returns the Proxy Ticket provided in the URL of the request. - * @return The proxy ticket. - * @private - */ - function getPT() - { return $this->_pt; } - - /** - * This method stores the Proxy Ticket. - * @param $pt The Proxy Ticket. - * @private - */ - function setPT($pt) - { $this->_pt = $pt; } - - /** - * This method tells if a Proxy Ticket was stored. - * @return TRUE if a Proxy Ticket has been stored. - * @private - */ - function hasPT() - { return !empty($this->_pt); } - - /** @} */ - // ######################################################################## - // PT VALIDATION - // ######################################################################## - /** - * @addtogroup internalProxied - * @{ - */ - - /** - * This method is used to validate a PT; halt on failure - * - * @return bool TRUE when successfull, halt otherwise by calling CASClient::authError(). - * - * @private - */ - function validatePT(&$validate_url,&$text_response,&$tree_response) - { - phpCAS::traceBegin(); - // build the URL to validate the ticket - $validate_url = $this->getServerProxyValidateURL().'&ticket='.$this->getPT(); - - if ( $this->isProxy() ) { - // pass the callback url for CAS proxies - $validate_url .= '&pgtUrl='.$this->getCallbackURL(); - } - - // open and read the URL - if ( !$this->readURL($validate_url,''/*cookies*/,$headers,$text_response,$err_msg) ) { - phpCAS::trace('could not open URL \''.$validate_url.'\' to validate ('.$err_msg.')'); - $this->authError('PT not validated', - $validate_url, - TRUE/*$no_response*/); - } - - // read the response of the CAS server into a DOM object - if ( !($dom = domxml_open_mem($text_response))) { - // read failed - $this->authError('PT not validated', - $validate_url, - FALSE/*$no_response*/, - TRUE/*$bad_response*/, - $text_response); - } - // read the root node of the XML tree - if ( !($tree_response = $dom->document_element()) ) { - // read failed - $this->authError('PT not validated', - $validate_url, - FALSE/*$no_response*/, - TRUE/*$bad_response*/, - $text_response); - } - // insure that tag name is 'serviceResponse' - if ( $tree_response->node_name() != 'serviceResponse' ) { - // bad root node - $this->authError('PT not validated', - $validate_url, - FALSE/*$no_response*/, - TRUE/*$bad_response*/, - $text_response); - } - if ( sizeof($arr = $tree_response->get_elements_by_tagname("authenticationSuccess")) != 0) { - // authentication succeded, extract the user name - if ( sizeof($arr = $tree_response->get_elements_by_tagname("user")) == 0) { - // no user specified => error - $this->authError('PT not validated', - $validate_url, - FALSE/*$no_response*/, - TRUE/*$bad_response*/, - $text_response); - } - $this->setUser(trim($arr[0]->get_content())); - - } else if ( sizeof($arr = $tree_response->get_elements_by_tagname("authenticationFailure")) != 0) { - // authentication succeded, extract the error code and message - $this->authError('PT not validated', - $validate_url, - FALSE/*$no_response*/, - FALSE/*$bad_response*/, - $text_response, - $arr[0]->get_attribute('code')/*$err_code*/, - trim($arr[0]->get_content())/*$err_msg*/); - } else { - $this->authError('PT not validated', - $validate_url, - FALSE/*$no_response*/, - TRUE/*$bad_response*/, - $text_response); - } - - // at this step, PT has been validated and $this->_user has been set, - - phpCAS::traceEnd(TRUE); - return TRUE; - } - - /** @} */ - - // XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX - // XX XX - // XX MISC XX - // XX XX - // XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX - - /** - * @addtogroup internalMisc - * @{ - */ - - // ######################################################################## - // URL - // ######################################################################## - /** - * the URL of the current request (without any ticket CGI parameter). Written - * and read by CASClient::getURL(). - * - * @hideinitializer - * @private - */ - var $_url = ''; - - /** - * This method returns the URL of the current request (without any ticket - * CGI parameter). - * - * @return The URL - * - * @private - */ - function getURL() - { - phpCAS::traceBegin(); - // the URL is built when needed only - if ( empty($this->_url) ) { - $final_uri = ''; - // remove the ticket if present in the URL - $final_uri = ($_SERVER['HTTPS'] == 'on') ? 'https' : 'http'; - $final_uri .= '://'; - /* replaced by Julien Marchal - v0.4.6 - * $this->_url .= $_SERVER['SERVER_NAME']; - */ - if(empty($_SERVER['HTTP_X_FORWARDED_SERVER'])){ - /* replaced by teedog - v0.4.12 - * $this->_url .= $_SERVER['SERVER_NAME']; - */ - if (empty($_SERVER['SERVER_NAME'])) { - $final_uri .= $_SERVER['HTTP_HOST']; - } else { - $final_uri .= $_SERVER['SERVER_NAME']; - } - } else { - $final_uri .= $_SERVER['HTTP_X_FORWARDED_SERVER']; - } - if ( ($_SERVER['HTTPS']=='on' && $_SERVER['SERVER_PORT']!=443) - || ($_SERVER['HTTPS']!='on' && $_SERVER['SERVER_PORT']!=80) ) { - $final_uri .= ':'; - $final_uri .= $_SERVER['SERVER_PORT']; - } - - $final_uri .= strtok($_SERVER['REQUEST_URI'],"?"); - $cgi_params = '?'.strtok("?"); - // remove the ticket if present in the CGI parameters - $cgi_params = preg_replace('/&ticket=[^&]*/','',$cgi_params); - $cgi_params = preg_replace('/\?ticket=[^&;]*/','?',$cgi_params); - $cgi_params = preg_replace('/\?$/','',$cgi_params); - $final_uri .= $cgi_params; - $this->setURL($final_uri); - } - phpCAS::traceEnd($this->_url); - return $this->_url; - } - - /** - * This method sets the URL of the current request - * - * @param $url url to set for service - * - * @private - */ - function setURL($url) - { - $this->_url = $url; - } - - // ######################################################################## - // AUTHENTICATION ERROR HANDLING - // ######################################################################## - /** - * This method is used to print the HTML output when the user was not authenticated. - * - * @param $failure the failure that occured - * @param $cas_url the URL the CAS server was asked for - * @param $no_response the response from the CAS server (other - * parameters are ignored if TRUE) - * @param $bad_response bad response from the CAS server ($err_code - * and $err_msg ignored if TRUE) - * @param $cas_response the response of the CAS server - * @param $err_code the error code given by the CAS server - * @param $err_msg the error message given by the CAS server - * - * @private - */ - function authError($failure,$cas_url,$no_response,$bad_response='',$cas_response='',$err_code='',$err_msg='') - { - phpCAS::traceBegin(); - - $this->printHTMLHeader($this->getString(CAS_STR_AUTHENTICATION_FAILED)); - printf($this->getString(CAS_STR_YOU_WERE_NOT_AUTHENTICATED),$this->getURL(),$_SERVER['SERVER_ADMIN']); - phpCAS::trace('CAS URL: '.$cas_url); - phpCAS::trace('Authentication failure: '.$failure); - if ( $no_response ) { - phpCAS::trace('Reason: no response from the CAS server'); - } else { - if ( $bad_response ) { - phpCAS::trace('Reason: bad response from the CAS server'); - } else { - switch ($this->getServerVersion()) { - case CAS_VERSION_1_0: - phpCAS::trace('Reason: CAS error'); - break; - case CAS_VERSION_2_0: - if ( empty($err_code) ) - phpCAS::trace('Reason: no CAS error'); - else - phpCAS::trace('Reason: ['.$err_code.'] CAS error: '.$err_msg); - break; - } - } - phpCAS::trace('CAS response: '.$cas_response); - } - $this->printHTMLFooter(); - phpCAS::traceExit(); - exit(); - } - - /** @} */ -} - -?> diff --git a/lib/cas/domxml-php4-php5.php b/lib/cas/domxml-php4-php5.php deleted file mode 100644 index a0dfb99c7ac..00000000000 --- a/lib/cas/domxml-php4-php5.php +++ /dev/null @@ -1,277 +0,0 @@ -<?php -/** - * @file domxml-php4-php5.php - * Require PHP5, uses built-in DOM extension. - * To be used in PHP4 scripts using DOMXML extension. - * Allows PHP4/DOMXML scripts to run on PHP5/DOM. - * (Requires PHP5/XSL extension for domxml_xslt functions) - * - * Typical use: - * <pre> - * { - * if (version_compare(PHP_VERSION,'5','>=')) - * require_once('domxml-php4-to-php5.php'); - * } - * </pre> - * - * Version 1.5.5, 2005-01-18, http://alexandre.alapetite.net/doc-alex/domxml-php4-php5/ - * - * ------------------------------------------------------------------<br> - * Written by Alexandre Alapetite, http://alexandre.alapetite.net/cv/ - * - * Copyright 2004, Licence: Creative Commons "Attribution-ShareAlike 2.0 France" BY-SA (FR), - * http://creativecommons.org/licenses/by-sa/2.0/fr/ - * http://alexandre.alapetite.net/divers/apropos/#by-sa - * - Attribution. You must give the original author credit - * - Share Alike. If you alter, transform, or build upon this work, - * you may distribute the resulting work only under a license identical to this one - * - The French law is authoritative - * - Any of these conditions can be waived if you get permission from Alexandre Alapetite - * - Please send to Alexandre Alapetite the modifications you make, - * in order to improve this file for the benefit of everybody - * - * If you want to distribute this code, please do it as a link to: - * http://alexandre.alapetite.net/doc-alex/domxml-php4-php5/ - */ - -function domxml_new_doc($version) {return new php4DOMDocument('');} -function domxml_open_file($filename) {return new php4DOMDocument($filename);} -function domxml_open_mem($str) -{ - $dom=new php4DOMDocument(''); - $dom->myDOMNode->loadXML($str); - return $dom; -} -function xpath_eval($xpath_context,$eval_str,$contextnode=null) {return $xpath_context->query($eval_str,$contextnode);} -function xpath_new_context($dom_document) {return new php4DOMXPath($dom_document);} - -class php4DOMAttr extends php4DOMNode -{ - function php4DOMAttr($aDOMAttr) {$this->myDOMNode=$aDOMAttr;} - function Name() {return $this->myDOMNode->name;} - function Specified() {return $this->myDOMNode->specified;} - function Value() {return $this->myDOMNode->value;} -} - -class php4DOMDocument extends php4DOMNode -{ - function php4DOMDocument($filename='') - { - $this->myDOMNode=new DOMDocument(); - if ($filename!='') $this->myDOMNode->load($filename); - } - function create_attribute($name,$value) - { - $myAttr=$this->myDOMNode->createAttribute($name); - $myAttr->value=$value; - return new php4DOMAttr($myAttr,$this); - } - function create_cdata_section($content) {return new php4DOMNode($this->myDOMNode->createCDATASection($content),$this);} - function create_comment($data) {return new php4DOMNode($this->myDOMNode->createComment($data),$this);} - function create_element($name) {return new php4DOMElement($this->myDOMNode->createElement($name),$this);} - function create_text_node($content) {return new php4DOMNode($this->myDOMNode->createTextNode($content),$this);} - function document_element() {return new php4DOMElement($this->myDOMNode->documentElement,$this);} - function dump_file($filename,$compressionmode=false,$format=false) {return $this->myDOMNode->save($filename);} - function dump_mem($format=false,$encoding=false) {return $this->myDOMNode->saveXML();} - function get_element_by_id($id) {return new php4DOMElement($this->myDOMNode->getElementById($id),$this);} - function get_elements_by_tagname($name) - { - $myDOMNodeList=$this->myDOMNode->getElementsByTagName($name); - $nodeSet=array(); - $i=0; - if (isset($myDOMNodeList)) - while ($node=$myDOMNodeList->item($i)) - { - $nodeSet[]=new php4DOMElement($node,$this); - $i++; - } - return $nodeSet; - } - function html_dump_mem() {return $this->myDOMNode->saveHTML();} - function root() {return new php4DOMElement($this->myDOMNode->documentElement,$this);} -} - -class php4DOMElement extends php4DOMNode -{ - function get_attribute($name) {return $this->myDOMNode->getAttribute($name);} - function get_elements_by_tagname($name) - { - $myDOMNodeList=$this->myDOMNode->getElementsByTagName($name); - $nodeSet=array(); - $i=0; - if (isset($myDOMNodeList)) - while ($node=$myDOMNodeList->item($i)) - { - $nodeSet[]=new php4DOMElement($node,$this->myOwnerDocument); - $i++; - } - return $nodeSet; - } - function has_attribute($name) {return $this->myDOMNode->hasAttribute($name);} - function remove_attribute($name) {return $this->myDOMNode->removeAttribute($name);} - function set_attribute($name,$value) {return $this->myDOMNode->setAttribute($name,$value);} - function tagname() {return $this->myDOMNode->tagName;} -} - -class php4DOMNode -{ - var $myDOMNode; - var $myOwnerDocument; - function php4DOMNode($aDomNode,$aOwnerDocument) - { - $this->myDOMNode=$aDomNode; - $this->myOwnerDocument=$aOwnerDocument; - } - function __get($name) - { - if ($name=='type') return $this->myDOMNode->nodeType; - elseif ($name=='tagname') return $this->myDOMNode->tagName; - elseif ($name=='content') return $this->myDOMNode->textContent; - else - { - $myErrors=debug_backtrace(); - trigger_error('Undefined property: '.get_class($this).'::$'.$name.' ['.$myErrors[0]['file'].':'.$myErrors[0]['line'].']',E_USER_NOTICE); - return false; - } - } - function append_child($newnode) {return new php4DOMElement($this->myDOMNode->appendChild($newnode->myDOMNode),$this->myOwnerDocument);} - function append_sibling($newnode) {return new php4DOMElement($this->myDOMNode->parentNode->appendChild($newnode->myDOMNode),$this->myOwnerDocument);} - function attributes() - { - $myDOMNodeList=$this->myDOMNode->attributes; - $nodeSet=array(); - $i=0; - if (isset($myDOMNodeList)) - while ($node=$myDOMNodeList->item($i)) - { - $nodeSet[]=new php4DOMAttr($node,$this->myOwnerDocument); - $i++; - } - return $nodeSet; - } - function child_nodes() - { - $myDOMNodeList=$this->myDOMNode->childNodes; - $nodeSet=array(); - $i=0; - if (isset($myDOMNodeList)) - while ($node=$myDOMNodeList->item($i)) - { - $nodeSet[]=new php4DOMElement($node,$this->myOwnerDocument); - $i++; - } - return $nodeSet; - } - function children() {return $this->child_nodes();} - function clone_node($deep=false) {return new php4DOMElement($this->myDOMNode->cloneNode($deep),$this->myOwnerDocument);} - function first_child() {return new php4DOMElement($this->myDOMNode->firstChild,$this->myOwnerDocument);} - function get_content() {return $this->myDOMNode->textContent;} - function has_attributes() {return $this->myDOMNode->hasAttributes();} - function has_child_nodes() {return $this->myDOMNode->hasChildNodes();} - function insert_before($newnode,$refnode) {return new php4DOMElement($this->myDOMNode->insertBefore($newnode->myDOMNode,$refnode->myDOMNode),$this->myOwnerDocument);} - function is_blank_node() - { - $myDOMNodeList=$this->myDOMNode->childNodes; - $i=0; - if (isset($myDOMNodeList)) - while ($node=$myDOMNodeList->item($i)) - { - if (($node->nodeType==XML_ELEMENT_NODE)|| - (($node->nodeType==XML_TEXT_NODE)&&!ereg('^([[:cntrl:]]|[[:space:]])*$',$node->nodeValue))) - return false; - $i++; - } - return true; - } - function last_child() {return new php4DOMElement($this->myDOMNode->lastChild,$this->myOwnerDocument);} - function new_child($name,$content) - { - $mySubNode=$this->myDOMNode->ownerDocument->createElement($name); - $mySubNode->appendChild($this->myDOMNode->ownerDocument->createTextNode($content)); - $this->myDOMNode->appendChild($mySubNode); - return new php4DOMElement($mySubNode,$this->myOwnerDocument); - } - function next_sibling() {return new php4DOMElement($this->myDOMNode->nextSibling,$this->myOwnerDocument);} - function node_name() {return $this->myDOMNode->localName;} - function node_type() {return $this->myDOMNode->nodeType;} - function node_value() {return $this->myDOMNode->nodeValue;} - function owner_document() {return $this->myOwnerDocument;} - function parent_node() {return new php4DOMElement($this->myDOMNode->parentNode,$this->myOwnerDocument);} - function prefix() {return $this->myDOMNode->prefix;} - function previous_sibling() {return new php4DOMElement($this->myDOMNode->previousSibling,$this->myOwnerDocument);} - function remove_child($oldchild) {return new php4DOMElement($this->myDOMNode->removeChild($oldchild->myDOMNode),$this->myOwnerDocument);} - function replace_child($oldnode,$newnode) {return new php4DOMElement($this->myDOMNode->replaceChild($oldnode->myDOMNode,$newnode->myDOMNode),$this->myOwnerDocument);} - function set_content($text) - { - if (($this->myDOMNode->hasChildNodes())&&($this->myDOMNode->firstChild->nodeType==XML_TEXT_NODE)) - $this->myDOMNode->removeChild($this->myDOMNode->firstChild); - return $this->myDOMNode->appendChild($this->myDOMNode->ownerDocument->createTextNode($text)); - } -} - -class php4DOMNodelist -{ - var $myDOMNodelist; - var $nodeset; - function php4DOMNodelist($aDOMNodelist,$aOwnerDocument) - { - $this->myDOMNodelist=$aDOMNodelist; - $this->nodeset=array(); - $i=0; - if (isset($this->myDOMNodelist)) - while ($node=$this->myDOMNodelist->item($i)) - { - $this->nodeset[]=new php4DOMElement($node,$aOwnerDocument); - $i++; - } - } -} - -class php4DOMXPath -{ - var $myDOMXPath; - var $myOwnerDocument; - function php4DOMXPath($dom_document) - { - $this->myOwnerDocument=$dom_document; - $this->myDOMXPath=new DOMXPath($dom_document->myDOMNode); - } - function query($eval_str,$contextnode) - { - if (isset($contextnode)) return new php4DOMNodelist($this->myDOMXPath->query($eval_str,$contextnode->myDOMNode),$this->myOwnerDocument); - else return new php4DOMNodelist($this->myDOMXPath->query($eval_str),$this->myOwnerDocument); - } - function xpath_register_ns($prefix,$namespaceURI) {return $this->myDOMXPath->registerNamespace($prefix,$namespaceURI);} -} - -if (extension_loaded('xsl')) -{//See also: http://alexandre.alapetite.net/doc-alex/xslt-php4-php5/ - function domxml_xslt_stylesheet($xslstring) {return new php4DomXsltStylesheet(DOMDocument::loadXML($xslstring));} - function domxml_xslt_stylesheet_doc($dom_document) {return new php4DomXsltStylesheet($dom_document);} - function domxml_xslt_stylesheet_file($xslfile) {return new php4DomXsltStylesheet(DOMDocument::load($xslfile));} - class php4DomXsltStylesheet - { - var $myxsltProcessor; - function php4DomXsltStylesheet($dom_document) - { - $this->myxsltProcessor=new xsltProcessor(); - $this->myxsltProcessor->importStyleSheet($dom_document); - } - function process($dom_document,$xslt_parameters=array(),$param_is_xpath=false) - { - foreach ($xslt_parameters as $param=>$value) - $this->myxsltProcessor->setParameter('',$param,$value); - $myphp4DOMDocument=new php4DOMDocument(); - $myphp4DOMDocument->myDOMNode=$this->myxsltProcessor->transformToDoc($dom_document->myDOMNode); - return $myphp4DOMDocument; - } - function result_dump_file($dom_document,$filename) - { - $html=$dom_document->myDOMNode->saveHTML(); - file_put_contents($filename,$html); - return $html; - } - function result_dump_mem($dom_document) {return $dom_document->myDOMNode->saveHTML();} - } -} -?> \ No newline at end of file diff --git a/lib/cas/languages/english.php b/lib/cas/languages/english.php deleted file mode 100644 index d38d42c1f7c..00000000000 --- a/lib/cas/languages/english.php +++ /dev/null @@ -1,27 +0,0 @@ -<?php - -/** - * @file languages/english.php - * @author Pascal Aubry <pascal.aubry at univ-rennes1.fr> - * @sa @link internalLang Internationalization @endlink - * @ingroup internalLang - */ - -$this->_strings = array( - CAS_STR_USING_SERVER - => 'using server', - CAS_STR_AUTHENTICATION_WANTED - => 'CAS Authentication wanted!', - CAS_STR_LOGOUT - => 'CAS logout wanted!', - CAS_STR_SHOULD_HAVE_BEEN_REDIRECTED - => 'You should already have been redirected to the CAS server. Click <a href="%s">here</a> to continue.', - CAS_STR_AUTHENTICATION_FAILED - => 'CAS Authentication failed!', - CAS_STR_YOU_WERE_NOT_AUTHENTICATED - => '<p>You were not authenticated.</p><p>You may submit your request again by clicking <a href="%s">here</a>.</p><p>If the problem persists, you may contact <a href="mailto:%s">the administrator of this site</a>.</p>', - CAS_STR_SERVICE_UNAVAILABLE - => 'The service `<b>%s</b>\' is not available (<b>%s</b>).' -); - -?> \ No newline at end of file diff --git a/lib/cas/languages/french.php b/lib/cas/languages/french.php deleted file mode 100644 index 32d14168506..00000000000 --- a/lib/cas/languages/french.php +++ /dev/null @@ -1,28 +0,0 @@ -<?php - -/** - * @file languages/english.php - * @author Pascal Aubry <pascal.aubry at univ-rennes1.fr> - * @sa @link internalLang Internationalization @endlink - * @ingroup internalLang - */ - -$this->_strings = array( - CAS_STR_USING_SERVER - => 'utilisant le serveur', - CAS_STR_AUTHENTICATION_WANTED - => 'Authentication CAS n�cessaire !', - CAS_STR_LOGOUT - => 'D�connexion demand�e !', - CAS_STR_SHOULD_HAVE_BEEN_REDIRECTED - => 'Vous auriez du etre redirig�(e) vers le serveur CAS. Cliquez <a href="%s">ici</a> pour continuer.', - CAS_STR_AUTHENTICATION_FAILED - => 'Authentification CAS infructueuse !', - CAS_STR_YOU_WERE_NOT_AUTHENTICATED - => '<p>Vous n\'avez pas �t� authentifi�(e).</p><p>Vous pouvez soumettre votre requete � nouveau en cliquant <a href="%s">ici</a>.</p><p>Si le probl�me persiste, vous pouvez contacter <a href="mailto:%s">l\'administrateur de ce site</a>.</p>', - CAS_STR_SERVICE_UNAVAILABLE - => 'Le service `<b>%s</b>\' est indisponible (<b>%s</b>)' - -); - -?> \ No newline at end of file diff --git a/lib/cas/languages/greek.php b/lib/cas/languages/greek.php deleted file mode 100644 index c17b1d66377..00000000000 --- a/lib/cas/languages/greek.php +++ /dev/null @@ -1,27 +0,0 @@ -<?php - -/** - * @file languages/greek.php - * @author Vangelis Haniotakis <haniotak at ucnet.uoc.gr> - * @sa @link internalLang Internationalization @endlink - * @ingroup internalLang - */ - -$this->_strings = array( - CAS_STR_USING_SERVER - => '��������������� � ������������', - CAS_STR_AUTHENTICATION_WANTED - => '���������� � ����������� CAS!', - CAS_STR_LOGOUT - => '���������� � ���������� ��� CAS!', - CAS_STR_SHOULD_HAVE_BEEN_REDIRECTED - => '�� ������ �� ������ �������������� ���� ����������� CAS. ����� ���� <a href="%s">���</a> ��� �� ����������.', - CAS_STR_AUTHENTICATION_FAILED - => '� ����������� CAS �������!', - CAS_STR_YOU_WERE_NOT_AUTHENTICATED - => '<p>��� ���������������.</p><p>�������� �� ����������������, �������� ���� <a href="%s">���</a>.</p><p>��� �� �������� ���������, ����� �� ����� �� ��� <a href="mailto:%s">�����������</a>.</p>', - CAS_STR_SERVICE_UNAVAILABLE - => '� �������� `<b>%s</b>\' ��� ����� ��������� (<b>%s</b>).' -); - -?> \ No newline at end of file diff --git a/lib/cas/languages/languages.php b/lib/cas/languages/languages.php deleted file mode 100644 index 001cfe445cd..00000000000 --- a/lib/cas/languages/languages.php +++ /dev/null @@ -1,24 +0,0 @@ -<?php - -/** - * @file languages/languages.php - * Internationalization constants - * @author Pascal Aubry <pascal.aubry at univ-rennes1.fr> - * @sa @link internalLang Internationalization @endlink - * @ingroup internalLang - */ - -//@{ -/** - * a phpCAS string index - */ -define("CAS_STR_USING_SERVER", 1); -define("CAS_STR_AUTHENTICATION_WANTED", 2); -define("CAS_STR_LOGOUT", 3); -define("CAS_STR_SHOULD_HAVE_BEEN_REDIRECTED", 4); -define("CAS_STR_AUTHENTICATION_FAILED", 5); -define("CAS_STR_YOU_WERE_NOT_AUTHENTICATED", 6); -define("CAS_STR_SERVICE_UNAVAILABLE", 7); -//@} - -?> \ No newline at end of file diff --git a/lib/db/mysql.sql b/lib/db/mysql.sql deleted file mode 100644 index 0aa1e4f99d1..00000000000 --- a/lib/db/mysql.sql +++ /dev/null @@ -1,1009 +0,0 @@ -# phpMyAdmin MySQL-Dump -# version 2.3.0-dev -# http://phpwizard.net/phpMyAdmin/ -# http://www.phpmyadmin.net/ (download page) -# -# Host: localhost -# Generation Time: Jun 25, 2002 at 05:04 PM -# Server version: 3.23.49 -# PHP Version: 4.1.2 -# Database : `moodle` -# -------------------------------------------------------- - -# -# Table structure for table `config` -# - -CREATE TABLE `prefix_config` ( - `id` int(10) unsigned NOT NULL auto_increment, - `name` varchar(255) NOT NULL default '', - `value` text NOT NULL default '', - PRIMARY KEY (`id`), - UNIQUE KEY `name` (`name`) -) TYPE=MyISAM COMMENT='Moodle configuration variables'; -# -------------------------------------------------------- - -# -# Table structure for table `config_plugins` -# - -CREATE TABLE `prefix_config_plugins` ( - `id` int(10) unsigned NOT NULL auto_increment, - `plugin` varchar(100) NOT NULL default 'core', - `name` varchar(100) NOT NULL default '', - `value` text NOT NULL default '', - PRIMARY KEY (`id`), - UNIQUE KEY `plugin_name` (`plugin`, `name`) -) TYPE=MyISAM COMMENT='Moodle modules and plugins configuration variables'; -# -------------------------------------------------------- - - -# -# Table structure for table `course` -# - -CREATE TABLE `prefix_course` ( - `id` int(10) unsigned NOT NULL auto_increment, - `category` int(10) unsigned NOT NULL default '0', - `sortorder` int(10) unsigned NOT NULL default '0', - `password` varchar(50) NOT NULL default '', - `fullname` varchar(254) NOT NULL default '', - `shortname` varchar(100) NOT NULL default '', - `idnumber` varchar(100) NOT NULL default '', - `summary` text NOT NULL default '', - `format` varchar(10) NOT NULL default 'topics', - `showgrades` smallint(2) unsigned NOT NULL default '1', - `modinfo` longtext, - `newsitems` smallint(5) unsigned NOT NULL default '1', - `teacher` varchar(100) NOT NULL default 'Teacher', - `teachers` varchar(100) NOT NULL default 'Teachers', - `student` varchar(100) NOT NULL default 'Student', - `students` varchar(100) NOT NULL default 'Students', - `guest` tinyint(2) unsigned NOT NULL default '0', - `startdate` int(10) unsigned NOT NULL default '0', - `enrolperiod` int(10) unsigned NOT NULL default '0', - `numsections` smallint(5) unsigned NOT NULL default '1', - `marker` int(10) unsigned NOT NULL default '0', - `maxbytes` int(10) unsigned NOT NULL default '0', - `showreports` int(4) unsigned NOT NULL default '0', - `visible` int(1) unsigned NOT NULL default '1', - `hiddensections` int(2) unsigned NOT NULL default '0', - `groupmode` int(4) unsigned NOT NULL default '0', - `groupmodeforce` int(4) unsigned NOT NULL default '0', - `lang` varchar(10) NOT NULL default '', - `theme` varchar(50) NOT NULL default '', - `cost` varchar(10) NOT NULL default '', - `currency` char(3) NOT NULL default 'USD', - `timecreated` int(10) unsigned NOT NULL default '0', - `timemodified` int(10) unsigned NOT NULL default '0', - `metacourse` int(1) unsigned NOT NULL default '0', - `requested` int(1) unsigned NOT NULL default '0', - `restrictmodules` int(1) unsigned NOT NULL default '0', - `expirynotify` tinyint(1) unsigned NOT NULL default '0', - `expirythreshold` int(10) unsigned NOT NULL default '0', - `notifystudents` tinyint(1) unsigned NOT NULL default '0', - `enrollable` tinyint(1) unsigned NOT NULL default '1', - `enrolstartdate` int(10) unsigned NOT NULL default '0', - `enrolenddate` int(10) unsigned NOT NULL default '0', - `enrol` varchar(20) NOT NULL default '', - `defaultrole` int(10) unsigned NOT NULL default '0', - PRIMARY KEY (`id`), - KEY `category` (`category`), - KEY `idnumber` (`idnumber`), - KEY `shortname` (`shortname`) -) TYPE=MyISAM; -# -------------------------------------------------------- - -# -# Table structure for table `course_categories` -# - -CREATE TABLE `prefix_course_categories` ( - `id` int(10) unsigned NOT NULL auto_increment, - `name` varchar(255) NOT NULL default '', - `description` text, - `parent` int(10) unsigned NOT NULL default '0', - `sortorder` int(10) unsigned NOT NULL default '0', - `coursecount` int(10) unsigned NOT NULL default '0', - `visible` tinyint(1) NOT NULL default '1', - `timemodified` int(10) unsigned NOT NULL default '0', - `depth` int(10) unsigned NOT NULL default '0', - `path` varchar(255) NOT NULL default '', - PRIMARY KEY (`id`), - UNIQUE KEY `id` (`id`) -) TYPE=MyISAM COMMENT='Course categories'; -# -------------------------------------------------------- - - -# -# Table structure for table `course_display` -# - -CREATE TABLE `prefix_course_display` ( - `id` int(10) unsigned NOT NULL auto_increment, - `course` int(10) unsigned NOT NULL default '0', - `userid` int(10) unsigned NOT NULL default '0', - `display` int(10) NOT NULL default '0', - PRIMARY KEY (`id`), - UNIQUE KEY `id` (`id`), - KEY `courseuserid` (course,userid) -) TYPE=MyISAM COMMENT='Stores info about how to display the course'; -# -------------------------------------------------------- - - -# -# Table structure for table `course_meta` -# - -CREATE TABLE `prefix_course_meta` ( - `id` int(10) unsigned NOT NULL auto_increment, - `parent_course` int(10) NOT NULL default 0, - `child_course` int(10) NOT NULL default 0, - PRIMARY KEY (`id`), - KEY `parent_course` (parent_course), - KEY `child_course` (child_course) -); -# -------------------------------------------------------- - - -# -# Table structure for table `course_modules` -# - -CREATE TABLE `prefix_course_modules` ( - `id` int(10) unsigned NOT NULL auto_increment, - `course` int(10) unsigned NOT NULL default '0', - `module` int(10) unsigned NOT NULL default '0', - `instance` int(10) unsigned NOT NULL default '0', - `section` int(10) unsigned NOT NULL default '0', - `added` int(10) unsigned NOT NULL default '0', - `score` tinyint(4) NOT NULL default '0', - `indent` int(5) unsigned NOT NULL default '0', - `visible` tinyint(1) NOT NULL default '1', - `visibleold` tinyint(1) NOT NULL default '1', - `groupmode` tinyint(4) NOT NULL default '0', - PRIMARY KEY (`id`), - UNIQUE KEY `id` (`id`), - KEY `visible` (`visible`), - KEY `course` (`course`), - KEY `module` (`module`), - KEY `instance` (`instance`) -) TYPE=MyISAM; -# -------------------------------------------------------- - -# -# Table structure for table `course_sections` -# - -CREATE TABLE `prefix_course_sections` ( - `id` int(10) unsigned NOT NULL auto_increment, - `course` int(10) unsigned NOT NULL default '0', - `section` int(10) unsigned NOT NULL default '0', - `summary` text, - `sequence` text, - `visible` tinyint(1) NOT NULL default '1', - PRIMARY KEY (`id`), - KEY `coursesection` (course,section) -) TYPE=MyISAM; -# -------------------------------------------------------- - -# -# Table structure for table `course_request` -# - -CREATE TABLE `prefix_course_request` ( - `id` int(10) unsigned NOT NULL auto_increment, - `fullname` varchar(254) NOT NULL default '', - `shortname` varchar(15) NOT NULL default '', - `summary` text NOT NULL default '', - `reason` text NOT NULL default '', - `requester` int(10) NOT NULL default 0, - `password` varchar(50) NOT NULL default '', - PRIMARY KEY (`id`), - KEY `shortname` (`shortname`) -) TYPE=MyISAM; -# --------------------------------------------------------- - -# -# Table structure for table `coursre_allowed_modules` -# - -CREATE TABLE `prefix_course_allowed_modules` ( - `id` int(10) unsigned NOT NULL auto_increment, - `course` int(10) unsigned NOT NULL default 0, - `module` int(10) unsigned NOT NULL default 0, - PRIMARY KEY (`id`), - KEY `course` (`course`), - KEY `module` (`module`) -) TYPE=MyISAM; - ------------------------------------------------------------- - -# -# Table structure for table `event` -# - -CREATE TABLE `prefix_event` ( - `id` int(10) unsigned NOT NULL auto_increment, - `name` varchar(255) NOT NULL default '', - `description` text NOT NULL default '', - `format` int(4) unsigned NOT NULL default '0', - `courseid` int(10) unsigned NOT NULL default '0', - `groupid` int(10) unsigned NOT NULL default '0', - `userid` int(10) unsigned NOT NULL default '0', - `repeatid` int(10) unsigned NOT NULL default '0', - `modulename` varchar(20) NOT NULL default '', - `instance` int(10) unsigned NOT NULL default '0', - `eventtype` varchar(20) NOT NULL default '', - `timestart` int(10) unsigned NOT NULL default '0', - `timeduration` int(10) unsigned NOT NULL default '0', - `visible` tinyint(4) NOT NULL default '1', - `uuid` char(36) NOT NULL default '', - `sequence` int(10) unsigned NOT NULL default '1', - `timemodified` int(10) unsigned NOT NULL default '0', - PRIMARY KEY (`id`), - UNIQUE KEY `id` (`id`), - KEY `courseid` (`courseid`), - KEY `userid` (`userid`), - KEY `timestart` (`timestart`), - KEY `timeduration` (`timeduration`) -) TYPE=MyISAM COMMENT='For everything with a time associated to it'; -# -------------------------------------------------------- - -# -# Table structure for table `cache_filters` -# - -CREATE TABLE `prefix_cache_filters` ( - `id` int(10) unsigned NOT NULL auto_increment, - `filter` varchar(32) NOT NULL default '', - `version` int(10) unsigned NOT NULL default '0', - `md5key` varchar(32) NOT NULL default '', - `rawtext` text NOT NULL default '', - `timemodified` int(10) unsigned NOT NULL default '0', - PRIMARY KEY (`id`), - KEY `filtermd5key` (filter,md5key) -) TYPE=MyISAM COMMENT='For keeping information about cached data'; -# -------------------------------------------------------- - - -# -# Table structure for table `cache_text` -# - -CREATE TABLE `prefix_cache_text` ( - `id` int(10) unsigned NOT NULL auto_increment, - `md5key` varchar(32) NOT NULL default '', - `formattedtext` longtext NOT NULL default '', - `timemodified` int(10) unsigned NOT NULL default '0', - PRIMARY KEY (`id`), - KEY `md5key` (`md5key`) -) TYPE=MyISAM COMMENT='For storing temporary copies of processed texts'; -# -------------------------------------------------------- - - -# -# Table structure for table `grade_category` -# - -CREATE TABLE `prefix_grade_category` ( - `id` int(10) unsigned NOT NULL auto_increment, - `name` varchar(64) NOT NULL default '', - `courseid` int(10) unsigned NOT NULL default '0', - `drop_x_lowest` int(10) unsigned NOT NULL default '0', - `bonus_points` int(10) unsigned NOT NULL default '0', - `hidden` int(10) unsigned NOT NULL default '0', - `weight` decimal(5,2) NOT NULL default '0.00', - PRIMARY KEY (`id`), - KEY `courseid` (`courseid`) -) TYPE=MyISAM ; - -# -------------------------------------------------------- - -# -# Table structure for table `grade_exceptions` -# - -CREATE TABLE `prefix_grade_exceptions` ( - `id` int(10) unsigned NOT NULL auto_increment, - `courseid` int(10) unsigned NOT NULL default '0', - `grade_itemid` int(10) unsigned NOT NULL default '0', - `userid` int(10) unsigned NOT NULL default '0', - PRIMARY KEY (`id`), - KEY `courseid` (`courseid`) -) TYPE=MyISAM ; - -# -------------------------------------------------------- - -# -# Table structure for table `grade_item` -# - -CREATE TABLE `prefix_grade_item` ( - `id` int(10) unsigned NOT NULL auto_increment, - `courseid` int(10) unsigned NOT NULL default '0', - `category` int(10) unsigned NOT NULL default '0', - `modid` int(10) unsigned NOT NULL default '0', - `cminstance` int(10) unsigned NOT NULL default '0', - `scale_grade` float(11,10) NOT NULL default '1.0000000000', - `extra_credit` int(10) unsigned NOT NULL default '0', - `sort_order` int(10) unsigned NOT NULL default '0', - PRIMARY KEY (`id`), - KEY `courseid` (`courseid`) -) TYPE=MyISAM ; - -# -------------------------------------------------------- - -# -# Table structure for table `grade_letter` -# - -CREATE TABLE `prefix_grade_letter` ( - `id` int(10) unsigned NOT NULL auto_increment, - `courseid` int(10) unsigned NOT NULL default '0', - `letter` varchar(8) NOT NULL default 'NA', - `grade_high` decimal(5,2) NOT NULL default '100.00', - `grade_low` decimal(5,2) NOT NULL default '0.00', - PRIMARY KEY (`id`), - KEY `courseid` (`courseid`) -) TYPE=MyISAM ; - -# -------------------------------------------------------- - -# -# Table structure for table `grade_preferences` -# - -CREATE TABLE `prefix_grade_preferences` ( - `id` int(10) unsigned NOT NULL auto_increment, - `courseid` int(10) unsigned NOT NULL default '0', - `preference` int(10) NOT NULL default '0', - `value` int(10) NOT NULL default '0', - PRIMARY KEY (`id`), - UNIQUE KEY `courseidpreference` (`courseid`,`preference`) -) TYPE=MyISAM; - -# -------------------------------------------------------- - -# -# Table structure for table `log` -# - -CREATE TABLE `prefix_log` ( - `id` int(10) unsigned NOT NULL auto_increment, - `time` int(10) unsigned NOT NULL default '0', - `userid` int(10) unsigned NOT NULL default '0', - `ip` varchar(15) NOT NULL default '', - `course` int(10) unsigned NOT NULL default '0', - `module` varchar(20) NOT NULL default '', - `cmid` int(10) unsigned NOT NULL default '0', - `action` varchar(40) NOT NULL default '', - `url` varchar(100) NOT NULL default '', - `info` varchar(255) NOT NULL default '', - PRIMARY KEY (`id`), - KEY `timecoursemoduleaction` (time,course,module,action), - KEY `coursemoduleaction` (course,module,action), - KEY `courseuserid` (course,userid), - KEY `userid` (userid), - KEY `info` (info) -) TYPE=MyISAM COMMENT='Every action is logged as far as possible.'; -# -------------------------------------------------------- - -# -# Table structure for table `log_display` -# - -CREATE TABLE `prefix_log_display` ( - `id` int(10) unsigned NOT NULL auto_increment, - `module` varchar(20) NOT NULL default '', - `action` varchar(40) NOT NULL default '', - `mtable` varchar(30) NOT NULL default '', - `field` varchar(200) NOT NULL default '', - PRIMARY KEY (`id`) -) TYPE=MyISAM COMMENT='For a particular module/action, specifies a moodle table/field.'; -ALTER TABLE prefix_log_display ADD UNIQUE `moduleaction`(`module` , `action`); -# -------------------------------------------------------- - -# -# Table structure for table `message` -# - -CREATE TABLE `prefix_message` ( - `id` int(10) unsigned NOT NULL auto_increment, - `useridfrom` int(10) NOT NULL default '0', - `useridto` int(10) NOT NULL default '0', - `message` text NOT NULL default '', - `format` int(4) unsigned NOT NULL default '0', - `timecreated` int(10) NOT NULL default '0', - `messagetype` varchar(50) NOT NULL default '', - PRIMARY KEY (`id`), - KEY `useridfrom` (`useridfrom`), - KEY `useridto` (`useridto`) -) TYPE=MyISAM COMMENT='Stores all unread messages'; -# -------------------------------------------------------- - -# -# Table structure for table `message_read` -# - -CREATE TABLE `prefix_message_read` ( - `id` int(10) unsigned NOT NULL auto_increment, - `useridfrom` int(10) NOT NULL default '0', - `useridto` int(10) NOT NULL default '0', - `message` text NOT NULL default '', - `format` int(4) unsigned NOT NULL default '0', - `timecreated` int(10) NOT NULL default '0', - `timeread` int(10) NOT NULL default '0', - `messagetype` varchar(50) NOT NULL default '', - `mailed` tinyint(1) NOT NULL default '0', - PRIMARY KEY (`id`), - KEY `useridfrom` (`useridfrom`), - KEY `useridto` (`useridto`) -) TYPE=MyISAM COMMENT='Stores all messages that have been read'; -# -------------------------------------------------------- - -# -# Table structure for table `message_contacts` -# - -CREATE TABLE `prefix_message_contacts` ( - `id` int(10) unsigned NOT NULL auto_increment, - `userid` int(10) unsigned NOT NULL default '0', - `contactid` int(10) unsigned NOT NULL default '0', - `blocked` tinyint(1) unsigned NOT NULL default '0', - PRIMARY KEY (`id`), - UNIQUE KEY `usercontact` (`userid`,`contactid`) -) TYPE=MyISAM COMMENT='Maintains lists of relationships between users'; -# -------------------------------------------------------- - -# -# Table structure for table `modules` -# - -CREATE TABLE `prefix_modules` ( - `id` int(10) unsigned NOT NULL auto_increment, - `name` varchar(20) NOT NULL default '', - `version` int(10) NOT NULL default '0', - `cron` int(10) unsigned NOT NULL default '0', - `lastcron` int(10) unsigned NOT NULL default '0', - `search` varchar(255) NOT NULL default '', - `visible` tinyint(1) NOT NULL default '1', - PRIMARY KEY (`id`), - UNIQUE KEY `id` (`id`), - KEY `name` (`name`) -) TYPE=MyISAM; -# -------------------------------------------------------- - - -# -# Table structure for table `scale` -# - -CREATE TABLE `prefix_scale` ( - `id` int(10) unsigned NOT NULL auto_increment, - `courseid` int(10) unsigned NOT NULL default '0', - `userid` int(10) unsigned NOT NULL default '0', - `name` varchar(255) NOT NULL default '', - `scale` text NOT NULL default '', - `description` text NOT NULL default '', - `timemodified` int(10) unsigned NOT NULL default '0', - PRIMARY KEY (id), - KEY `courseid` (`courseid`) -) TYPE=MyISAM COMMENT='Defines grading scales'; -# -------------------------------------------------------- - - -# -# Table structure for table `sessions2` -# -CREATE TABLE prefix_sessions2 ( - sesskey VARCHAR(64) NOT NULL default '', - expiry DATETIME NOT NULL, - expireref VARCHAR(250), - created DATETIME NOT NULL, - modified DATETIME NOT NULL, - sessdata LONGTEXT, -CONSTRAINT PRIMARY KEY (sesskey) -) COMMENT='Optional database session storage in new format, not used by default'; - -CREATE INDEX prefix_sess_exp_ix ON prefix_sessions2 (expiry); -CREATE INDEX prefix_sess_exp2_ix ON prefix_sessions2 (expireref); -# -------------------------------------------------------- - -# -# Table structure for table `timezone` -# - -CREATE TABLE `prefix_timezone` ( - `id` int(10) NOT NULL auto_increment, - `name` varchar(100) NOT NULL default '', - `year` int(11) NOT NULL default '0', - `tzrule` varchar(20) NOT NULL default '', - `gmtoff` int(11) NOT NULL default '0', - `dstoff` int(11) NOT NULL default '0', - `dst_month` tinyint(2) NOT NULL default '0', - `dst_startday` tinyint(3) NOT NULL default '0', - `dst_weekday` tinyint(3) NOT NULL default '0', - `dst_skipweeks` tinyint(3) NOT NULL default '0', - `dst_time` varchar(5) NOT NULL default '00:00', - `std_month` tinyint(2) NOT NULL default '0', - `std_startday` tinyint(3) NOT NULL default '0', - `std_weekday` tinyint(3) NOT NULL default '0', - `std_skipweeks` tinyint(3) NOT NULL default '0', - `std_time` varchar(5) NOT NULL default '00:00', - PRIMARY KEY (`id`) -) TYPE=MyISAM COMMENT='Rules for calculating local wall clock time for users'; - - -# -# Table structure for table `user` -# -# When changing prefix_user, you may need to update -# truncate_userinfo() in moodlelib.php -# -CREATE TABLE `prefix_user` ( - `id` int(10) unsigned NOT NULL auto_increment, - `auth` varchar(20) NOT NULL default 'manual', - `confirmed` tinyint(1) NOT NULL default '0', - `policyagreed` tinyint(1) NOT NULL default '0', - `deleted` tinyint(1) NOT NULL default '0', - `username` varchar(100) NOT NULL default '', - `password` varchar(32) NOT NULL default '', - `idnumber` varchar(64) NOT NULL default '', - `firstname` varchar(100) NOT NULL default '', - `lastname` varchar(100) NOT NULL default '', - `email` varchar(100) NOT NULL default '', - `emailstop` tinyint(1) unsigned NOT NULL default '0', - `icq` varchar(15) NOT NULL default '', - `skype` varchar(50) NOT NULL default '', - `yahoo` varchar(50) NOT NULL default '', - `aim` varchar(50) NOT NULL default '', - `msn` varchar(50) NOT NULL default '', - `phone1` varchar(20) NOT NULL default '', - `phone2` varchar(20) NOT NULL default '', - `institution` varchar(40) NOT NULL default '', - `department` varchar(30) NOT NULL default '', - `address` varchar(70) NOT NULL default '', - `city` varchar(20) NOT NULL default '', - `country` char(2) NOT NULL default '', - `lang` varchar(10) NOT NULL default 'en', - `theme` varchar(50) NOT NULL default '', - `timezone` varchar(100) NOT NULL default '99', - `firstaccess` int(10) unsigned NOT NULL default '0', - `lastaccess` int(10) unsigned NOT NULL default '0', - `lastlogin` int(10) unsigned NOT NULL default '0', - `currentlogin` int(10) unsigned NOT NULL default '0', - `lastip` varchar(15) NOT NULL default '', - `secret` varchar(15) NOT NULL default '', - `picture` tinyint(1) NOT NULL default '0', - `url` varchar(255) NOT NULL default '', - `description` text, - `mailformat` tinyint(1) unsigned NOT NULL default '1', - `maildigest` tinyint(1) unsigned NOT NULL default '0', - `maildisplay` tinyint(2) unsigned NOT NULL default '2', - `htmleditor` tinyint(1) unsigned NOT NULL default '1', - `ajax` tinyint(1) unsigned NOT NULL default '1', - `autosubscribe` tinyint(1) unsigned NOT NULL default '1', - `trackforums` tinyint(1) unsigned NOT NULL default '0', - `timemodified` int(10) unsigned NOT NULL default '0', - PRIMARY KEY (`id`), - UNIQUE KEY `id` (`id`), - UNIQUE KEY `username` (`username`), - KEY `user_deleted` (`deleted`), - KEY `user_confirmed` (`confirmed`), - KEY `user_firstname` (`firstname`), - KEY `user_lastname` (`lastname`), - KEY `user_city` (`city`), - KEY `user_country` (`country`), - KEY `user_lastaccess` (`lastaccess`), - KEY `user_email` (`email`) -) TYPE=MyISAM COMMENT='One record for each person'; - -ALTER TABLE `prefix_user` ADD INDEX `auth` (`auth`); -ALTER TABLE `prefix_user` ADD INDEX `idnumber` (`idnumber`); -# -------------------------------------------------------- - -# -# Table structure for table `user_admins` -# - -CREATE TABLE `prefix_user_admins` ( - `id` int(10) unsigned NOT NULL auto_increment, - `userid` int(10) unsigned NOT NULL default '0', - PRIMARY KEY (`id`), - UNIQUE KEY `id` (`id`), - KEY `userid` (`userid`) -) TYPE=MyISAM COMMENT='One record per administrator user'; -# -------------------------------------------------------- - - - -# -# Table structure for table `user_preferences` -# - -CREATE TABLE `prefix_user_preferences` ( - `id` int(10) unsigned NOT NULL auto_increment, - `userid` int(10) unsigned NOT NULL default '0', - `name` varchar(50) NOT NULL default '', - `value` varchar(255) NOT NULL default '', - PRIMARY KEY (`id`), - UNIQUE KEY `id` (`id`), - KEY `useridname` (userid,name) -) TYPE=MyISAM COMMENT='Allows modules to store arbitrary user preferences'; -# -------------------------------------------------------- - - - -# -# Table structure for table `user_students` -# - -CREATE TABLE `prefix_user_students` ( - `id` int(10) unsigned NOT NULL auto_increment, - `userid` int(10) unsigned NOT NULL default '0', - `course` int(10) unsigned NOT NULL default '0', - `timestart` int(10) unsigned NOT NULL default '0', - `timeend` int(10) unsigned NOT NULL default '0', - `time` int(10) unsigned NOT NULL default '0', - `timeaccess` int(10) unsigned NOT NULL default '0', - `enrol` varchar(20) NOT NULL default '', - PRIMARY KEY (`id`), - UNIQUE KEY `id` (`id`), - UNIQUE KEY `courseuserid` (course,userid), - KEY `userid` (userid), - KEY `enrol` (enrol), - KEY `timeaccess` (timeaccess) -) TYPE=MyISAM; -# -------------------------------------------------------- - -# -# Table structure for table `user_teachers` -# - -CREATE TABLE `prefix_user_teachers` ( - `id` int(10) unsigned NOT NULL auto_increment, - `userid` int(10) unsigned NOT NULL default '0', - `course` int(10) unsigned NOT NULL default '0', - `authority` int(10) NOT NULL default '3', - `role` varchar(40) NOT NULL default '', - `editall` int(1) unsigned NOT NULL default '1', - `timestart` int(10) unsigned NOT NULL default '0', - `timeend` int(10) unsigned NOT NULL default '0', - `timemodified` int(10) unsigned NOT NULL default '0', - `timeaccess` int(10) unsigned NOT NULL default '0', - `enrol` varchar(20) NOT NULL default '', - PRIMARY KEY (`id`), - UNIQUE KEY `id` (`id`), - UNIQUE KEY `courseuserid` (course,userid), - KEY `userid` (userid), - KEY `enrol` (enrol) -) TYPE=MyISAM COMMENT='One record per teacher per course'; - -# -# Table structure for table `user_admins` -# - -CREATE TABLE `prefix_user_coursecreators` ( - `id` int(10) unsigned NOT NULL auto_increment, - `userid` int(10) unsigned NOT NULL default '0', - PRIMARY KEY (`id`), - UNIQUE KEY `id` (`id`), - KEY `userid` (`userid`) -) TYPE=MyISAM COMMENT='One record per course creator'; - - -# -# For debugging puposes, see admin/dbperformance.php -# - -CREATE TABLE `adodb_logsql` ( - `created` datetime NOT NULL default '0000-00-00 00:00:00', - `sql0` varchar(250) NOT NULL default '', - `sql1` text NOT NULL default '', - `params` text NOT NULL default '', - `tracer` text NOT NULL default '', - `timer` decimal(16,6) NOT NULL default '0' -); - -CREATE TABLE `prefix_stats_daily` ( - `id` int(10) unsigned NOT NULL auto_increment, - `courseid` int(10) unsigned NOT NULL default 0, - `roleid` int(10) unsigned NOT NULL default 0, - `timeend` int(10) unsigned NOT NULL default 0, - `stattype` enum('enrolments', 'activity', 'logins') NOT NULL default 'activity', - `stat1` int(10) unsigned NOT NULL default 0, - `stat2` int(10) unsigned NOT NULL default 0, - PRIMARY KEY (`id`), - KEY `courseid` (`courseid`), - KEY `timeend` (`timeend`) -); - -CREATE TABLE prefix_stats_weekly ( - `id` int(10) unsigned NOT NULL auto_increment, - `courseid` int(10) unsigned NOT NULL default 0, - `roleid` int(10) unsigned NOT NULL default 0, - `timeend` int(10) unsigned NOT NULL default 0, - `stattype` enum('enrolments', 'activity', 'logins') NOT NULL default 'activity', - `stat1` int(10) unsigned NOT NULL default 0, - `stat2` int(10) unsigned NOT NULL default 0, - PRIMARY KEY (`id`), - KEY `courseid` (`courseid`), - KEY `timeend` (`timeend`) -); - -CREATE TABLE prefix_stats_monthly ( - `id` int(10) unsigned NOT NULL auto_increment, - `courseid` int(10) unsigned NOT NULL default 0, - `roleid` int(10) unsigned NOT NULL default 0, - `timeend` int(10) unsigned NOT NULL default 0, - `stattype` enum('enrolments', 'activity', 'logins') NOT NULL default 'activity', - `stat1` int(10) unsigned NOT NULL default 0, - `stat2` int(10) unsigned NOT NULL default 0, - PRIMARY KEY (`id`), - KEY `courseid` (`courseid`), - KEY `timeend` (`timeend`) -); - -CREATE TABLE prefix_stats_user_daily ( - `id` int(10) unsigned NOT NULL auto_increment, - `courseid` int(10) unsigned NOT NULL default 0, - `userid` int(10) unsigned NOT NULL default 0, - `roleid` int(10) unsigned NOT NULL default 0, - `timeend` int(10) unsigned NOT NULL default 0, - `statsreads` int(10) unsigned NOT NULL default 0, - `statswrites` int(10) unsigned NOT NULL default 0, - `stattype` varchar(30) NOT NULL default '', - PRIMARY KEY (`id`), - KEY `courseid` (`courseid`), - KEY `userid` (`userid`), - KEY `roleid` (`roleid`), - KEY `timeend` (`timeend`) -); - -CREATE TABLE prefix_stats_user_weekly ( - `id` int(10) unsigned NOT NULL auto_increment, - `courseid` int(10) unsigned NOT NULL default 0, - `userid` int(10) unsigned NOT NULL default 0, - `roleid` int(10) unsigned NOT NULL default 0, - `timeend` int(10) unsigned NOT NULL default 0, - `statsreads` int(10) unsigned NOT NULL default 0, - `statswrites` int(10) unsigned NOT NULL default 0, - `stattype` varchar(30) NOT NULL default '', - PRIMARY KEY (`id`), - KEY `courseid` (`courseid`), - KEY `userid` (`userid`), - KEY `roleid` (`roleid`), - KEY `timeend` (`timeend`) -); - -CREATE TABLE prefix_stats_user_monthly ( - `id` int(10) unsigned NOT NULL auto_increment, - `courseid` int(10) unsigned NOT NULL default 0, - `userid` int(10) unsigned NOT NULL default 0, - `roleid` int(10) unsigned NOT NULL default 0, - `timeend` int(10) unsigned NOT NULL default 0, - `statsreads` int(10) unsigned NOT NULL default 0, - `statswrites` int(10) unsigned NOT NULL default 0, - `stattype` varchar(30) NOT NULL default '', - PRIMARY KEY (`id`), - KEY `courseid` (`courseid`), - KEY `userid` (`userid`), - KEY `roleid` (`roleid`), - KEY `timeend` (`timeend`) -); - -# -# Table structure for table `prefix_post` -# -CREATE TABLE prefix_post ( - `id` int(10) unsigned NOT NULL auto_increment, - `module` varchar(20) NOT NULL default '', - `userid` int(10) unsigned NOT NULL default '0', - `courseid` int(10) unsigned NOT NULL default '0', - `groupid` int(10) unsigned NOT NULL default '0', - `moduleid` int(10) unsigned NOT NULL default '0', - `coursemoduleid` int(10) unsigned NOT NULL default '0', - `subject` varchar(128) NOT NULL default '', - `summary` longtext, - `content` longtext, - `uniquehash` varchar(128) NOT NULL default '', - `rating` int(10) unsigned NOT NULL default '0', - `format` int(10) unsigned NOT NULL default '0', - `publishstate` enum('draft','site','public') NOT NULL default 'draft', - `lastmodified` int(10) unsigned NOT NULL default '0', - `created` int(10) unsigned NOT NULL default '0', - PRIMARY KEY (`id`), - UNIQUE KEY `id_user_idx` (`id`, `userid`), - KEY `post_lastmodified_idx` (`lastmodified`), - KEY `post_module_idx` (`module`), - KEY `post_subject_idx` (`subject`) -) TYPE=MyISAM COMMENT='Generic post table to hold data blog entries etc in different modules.'; - - -# tags are not limited to blogs -CREATE TABLE prefix_tags ( - `id` int(10) unsigned NOT NULL auto_increment, - `type` varchar(255) NOT NULL default 'official', - `userid` int(10) unsigned NOT NULL default '0', - `text` varchar(20) NOT NULL default '', - KEY `tags_typeuserid_idx` (`type`, `userid`), - KEY `tags_text_idx` (`text`), - PRIMARY KEY (`id`) -) TYPE=MyISAM COMMENT ='tags structure for moodle.'; - -# instance of a tag for a blog -CREATE TABLE prefix_blog_tag_instance ( - `id` int(10) unsigned NOT NULL auto_increment, - `entryid` int(10) unsigned NOT NULL default '0', - `tagid` int(10) unsigned NOT NULL default '0', - `groupid` int(10) unsigned NOT NULL default '0', - `courseid` int(10) unsigned NOT NULL default '0', - `userid` int(10) unsigned NOT NULL default '0', - `timemodified` int(10) unsigned NOT NULL default '0', - KEY `bti_entryid_idx` (`entryid`), - KEY `bti_tagid_idx` (`tagid`), - PRIMARY KEY (`id`) -) TYPE=MyISAM COMMENT ='tag instance for blogs.'; - -################################### -# Roles tables -################################### - -CREATE TABLE prefix_role ( - `id` int(10) unsigned NOT NULL auto_increment, - `name` varchar(255) NOT NULL default '', - `shortname` varchar(100) NOT NULL default '', - `description` text NOT NULL default '', - `sortorder` int(10) unsigned NOT NULL default '0', - KEY `sortorder` (`sortorder`), - PRIMARY KEY (`id`) -) TYPE=MyISAM COMMENT ='moodle roles'; - -CREATE TABLE prefix_context ( - `id` int(10) unsigned NOT NULL auto_increment, - `contextlevel` int(10) unsigned NOT NULL default '0', - `instanceid` int(10) unsigned NOT NULL default '0', - KEY `instanceid` (`instanceid`), - UNIQUE KEY `contextlevel-instanceid` (`contextlevel`, `instanceid`), - PRIMARY KEY (`id`) -) TYPE=MyISAM COMMENT ='one of these must be set'; - -CREATE TABLE prefix_role_assignments ( - `id` int(10) unsigned NOT NULL auto_increment, - `roleid` int(10) unsigned NOT NULL default '0', - `contextid` int(10) unsigned NOT NULL default '0', - `userid` int(10) unsigned NOT NULL default '0', - `hidden` int(1) unsigned NOT NULL default '0', - `timestart` int(10) unsigned NOT NULL default '0', - `timeend` int(10) unsigned NOT NULL default '0', - `timemodified` int(10) unsigned NOT NULL default '0', - `modifierid` int(10) unsigned NOT NULL default '0', - `enrol` varchar(20) NOT NULL default '', - `sortorder` int(10) unsigned NOT NULL default '0', - KEY `roleid` (`roleid`), - KEY `contextid` (`contextid`), - KEY `userid` (`userid`), - UNIQUE KEY `contextid-roleid-userid` (`contextid`, `roleid`, `userid`), - KEY `sortorder` (`sortorder`), - PRIMARY KEY (`id`) -) TYPE=MyISAM COMMENT ='assigning roles to different context'; - -CREATE TABLE prefix_role_capabilities ( - `id` int(10) unsigned NOT NULL auto_increment, - `contextid` int(10)unsigned NOT NULL default '0', - `roleid` int(10) unsigned NOT NULL default '0', - `capability` varchar(255) NOT NULL default '', - `permission` int(10) NOT NULL default '0', - `timemodified` int(10) unsigned NOT NULL default '0', - `modifierid` int(10) unsigned NOT NULL default '0', - KEY `roleid` (`roleid`), - KEY `contextid` (`contextid`), - KEY `modifierid` (`modifierid`), - UNIQUE KEY `roleid-contextid-capability` (`roleid`, `contextid`, `capability`), - PRIMARY KEY (`id`) -) TYPE=MYISAM COMMENT ='permission has to be signed, overriding a capability for a particular role in a particular context'; - -CREATE TABLE prefix_role_allow_assign ( - `id` int(10) unsigned NOT NULL auto_increment, - `roleid` int(10) unsigned NOT NULL default '0', - `allowassign` int(10) unsigned NOT NULL default '0', - KEY `roleid` (`roleid`), - KEY `allowassign` (`allowassign`), - UNIQUE KEY `roleid-allowassign` (`roleid`, `allowassign`), - PRIMARY KEY (`id`) -) TYPE=MYISAM COMMENT ='this defines what role can assign what role'; - -CREATE TABLE prefix_role_allow_override ( - `id` int(10) unsigned NOT NULL auto_increment, - `roleid` int(10) unsigned NOT NULL default '0', - `allowoverride` int(10) unsigned NOT NULL default '0', - KEY `roleid` (`roleid`), - KEY `allowoverride` (`allowoverride`), - UNIQUE KEY `roleid-allowoverride` (`roleid`, `allowoverride`), - PRIMARY KEY (`id`) -) TYPE=MYISAM COMMENT ='this defines what role can override what role'; - -CREATE TABLE prefix_capabilities ( - `id` int(10) unsigned NOT NULL auto_increment, - `name` varchar(255) NOT NULL default '', - `captype` varchar(50) NOT NULL default '', - `contextlevel` int(10) unsigned NOT NULL default '0', - `component` varchar(100) NOT NULL default '', - `riskbitmask` int(10) unsigned NOT NULL default '0', - UNIQUE KEY `name` (`name`), - PRIMARY KEY (`id`) -) TYPE=MYISAM COMMENT ='this defines all capabilities'; - -CREATE TABLE prefix_role_names ( - `id` int(10) unsigned NOT NULL auto_increment, - `roleid` int(10) unsigned NOT NULL default '0', - `contextid` int(10) unsigned NOT NULL default '0', - `text` text NOT NULL default '', - KEY `roleid` (`roleid`), - KEY `contextid` (`contextid`), - UNIQUE KEY `roleid-contextid` (`roleid`, `contextid`), - PRIMARY KEY (`id`) -) TYPE=MYISAM COMMENT ='role names in native strings'; - -CREATE TABLE prefix_user_lastaccess ( - `id` int(10) unsigned NOT NULL auto_increment, - `userid` int(10) unsigned NOT NULL default '0', - `courseid` int(10) unsigned NOT NULL default '0', - `timeaccess` int(10) unsigned NOT NULL default '0', - KEY `userid` (`userid`), - KEY `courseid` (`courseid`), - UNIQUE KEY `userid-courseid` (`userid`, `courseid`), - PRIMARY KEY (`id`) -) TYPE=MYISAM COMMENT ='time user last accessed any page in a course'; - -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('user', 'view', 'user', 'CONCAT(firstname," ",lastname)'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('course', 'user report', 'user', 'CONCAT(firstname," ",lastname)'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('course', 'view', 'course', 'fullname'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('course', 'update', 'course', 'fullname'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('course', 'enrol', 'course', 'fullname'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('course', 'report log', 'course', 'fullname'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('course', 'report live', 'course', 'fullname'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('course', 'report outline', 'course', 'fullname'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('course', 'report participation', 'course', 'fullname'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('course', 'report stats', 'course', 'fullname'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('message', 'write', 'user', 'CONCAT(firstname," ",lastname)'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('message', 'read', 'user', 'CONCAT(firstname," ",lastname)'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('message', 'add contact', 'user', 'CONCAT(firstname," ",lastname)'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('message', 'remove contact', 'user', 'CONCAT(firstname," ",lastname)'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('message', 'block contact', 'user', 'CONCAT(firstname," ",lastname)'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('message', 'unblock contact', 'user', 'CONCAT(firstname," ",lastname)'); - -CREATE TABLE prefix_user_info_field ( - id BIGINT(10) NOT NULL auto_increment, - name VARCHAR(255) NOT NULL default '', - datatype VARCHAR(255) NOT NULL default '', - categoryid BIGINT(10) unsigned NOT NULL default 0, - sortorder BIGINT(10) unsigned NOT NULL default 0, - required TINYINT(2) unsigned NOT NULL default 0, - locked TINYINT(2) unsigned NOT NULL default 0, - visible SMALLINT(4) unsigned NOT NULL default 0, - defaultdata LONGTEXT, -CONSTRAINT PRIMARY KEY (id) -); - -ALTER TABLE prefix_user_info_field COMMENT='Customisable user profile fields'; - -CREATE TABLE prefix_user_info_category ( - id BIGINT(10) NOT NULL auto_increment, - name VARCHAR(255) NOT NULL default '', - sortorder BIGINT(10) unsigned NOT NULL default 0, -CONSTRAINT PRIMARY KEY (id) -); - -ALTER TABLE prefix_user_info_category COMMENT='Customisable fields categories'; - -CREATE TABLE prefix_user_info_data ( - id BIGINT(10) NOT NULL auto_increment, - userid BIGINT(10) unsigned NOT NULL default 0, - fieldid BIGINT(10) unsigned NOT NULL default 0, - data LONGTEXT NOT NULL, -CONSTRAINT PRIMARY KEY (id) -); - -ALTER TABLE prefix_user_info_data COMMENT='Data for the customisable user fields'; diff --git a/lib/db/postgres7.sql b/lib/db/postgres7.sql deleted file mode 100644 index 7a7cb74b5d5..00000000000 --- a/lib/db/postgres7.sql +++ /dev/null @@ -1,789 +0,0 @@ -CREATE TABLE prefix_config ( - id SERIAL PRIMARY KEY, - name varchar(255) NOT NULL default '', - value text NOT NULL default '', - CONSTRAINT prefix_config_name_uk UNIQUE (name) -); - -CREATE TABLE prefix_config_plugins ( - id SERIAL PRIMARY KEY, - plugin varchar(100) NOT NULL default 'core', - name varchar(100) NOT NULL default '', - value text NOT NULL default '', - CONSTRAINT prefix_config_plugins_plugin_name_uk UNIQUE (plugin, name) -); - -CREATE TABLE prefix_course ( - id SERIAL PRIMARY KEY, - category integer NOT NULL default '0', - sortorder integer NOT NULL default '0', - password varchar(50) NOT NULL default '', - fullname varchar(254) NOT NULL default '', - shortname varchar(15) NOT NULL default '', - idnumber varchar(100) NOT NULL default '', - summary text NOT NULL default '', - format varchar(10) NOT NULL default 'topics', - showgrades integer NOT NULL default '1', - modinfo text, - newsitems integer NOT NULL default '1', - teacher varchar(100) NOT NULL default 'Teacher', - teachers varchar(100) NOT NULL default 'Teachers', - student varchar(100) NOT NULL default 'Student', - students varchar(100) NOT NULL default 'Students', - guest integer NOT NULL default '0', - startdate integer NOT NULL default '0', - enrolperiod integer NOT NULL default '0', - numsections integer NOT NULL default '1', - marker integer NOT NULL default '0', - maxbytes integer NOT NULL default '0', - showreports integer NOT NULL default '0', - visible integer NOT NULL default '1', - hiddensections integer NOT NULL default '0', - groupmode integer NOT NULL default '0', - groupmodeforce integer NOT NULL default '0', - lang varchar(10) NOT NULL default '', - theme varchar(50) NOT NULL default '', - cost varchar(10) NOT NULL default '', - currency varchar(3) NOT NULL default 'USD', - timecreated integer NOT NULL default '0', - timemodified integer NOT NULL default '0', - metacourse integer NOT NULL default '0', - requested integer NOT NULL default '0', - restrictmodules integer NOT NULL default '0', - expirynotify integer NOT NULL default '0', - expirythreshold integer NOT NULL default '0', - notifystudents integer NOT NULL default '0', - enrollable integer NOT NULL default '1', - enrolstartdate integer NOT NULL default '0', - enrolenddate integer NOT NULL default '0', - enrol varchar(20) NOT NULL default '', - defaultrole integer NOT NULL default '0' -); - -CREATE UNIQUE INDEX prefix_course_category_sortorder_uk ON prefix_course (category,sortorder); -CREATE INDEX prefix_course_idnumber_idx ON prefix_course (idnumber); -CREATE INDEX prefix_course_shortname_idx ON prefix_course (shortname); - -CREATE TABLE prefix_course_categories ( - id SERIAL PRIMARY KEY, - name varchar(255) NOT NULL default '', - description text, - parent integer NOT NULL default '0', - sortorder integer NOT NULL default '0', - coursecount integer NOT NULL default '0', - visible integer NOT NULL default '1', - timemodified integer NOT NULL default '0', - depth integer NOT NULL default '0', - path varchar(255) NOT NULL default '' -); - -CREATE TABLE prefix_course_display ( - id SERIAL PRIMARY KEY, - course integer NOT NULL default '0', - userid integer NOT NULL default '0', - display integer NOT NULL default '0' -); - -CREATE INDEX prefix_course_display_courseuserid_idx ON prefix_course_display (course,userid); - -CREATE TABLE prefix_course_meta ( - id SERIAL primary key, - parent_course integer NOT NULL, - child_course integer NOT NULL -); - -CREATE INDEX prefix_course_meta_parent_idx ON prefix_course_meta (parent_course); -CREATE INDEX prefix_course_meta_child_idx ON prefix_course_meta (child_course); - -CREATE TABLE prefix_course_modules ( - id SERIAL PRIMARY KEY, - course integer NOT NULL default '0', - module integer NOT NULL default '0', - instance integer NOT NULL default '0', - section integer NOT NULL default '0', - added integer NOT NULL default '0', - score integer NOT NULL default '0', - indent integer NOT NULL default '0', - visible integer NOT NULL default '1', - visibleold integer NOT NULL default '1', - groupmode integer NOT NULL default '0' -); - -CREATE INDEX prefix_course_modules_visible_idx ON prefix_course_modules (visible); -CREATE INDEX prefix_course_modules_course_idx ON prefix_course_modules (course); -CREATE INDEX prefix_course_modules_module_idx ON prefix_course_modules (module); -CREATE INDEX prefix_course_modules_instance_idx ON prefix_course_modules (instance); - -CREATE TABLE prefix_course_sections ( - id SERIAL PRIMARY KEY, - course integer NOT NULL default '0', - section integer NOT NULL default '0', - summary text, - sequence text, - visible integer NOT NULL default '1' -); - -CREATE INDEX prefix_course_sections_coursesection_idx ON prefix_course_sections (course,section); - -CREATE TABLE prefix_course_request ( - id SERIAL PRIMARY KEY, - fullname varchar(254) NOT NULL default '', - shortname varchar(15) NOT NULL default '', - summary text NOT NULL default '', - reason text NOT NULL default '', - requester INTEGER NOT NULL default 0, - password varchar(50) NOT NULL default '' -); - -CREATE INDEX prefix_course_request_shortname_idx ON prefix_course_request (shortname); - -CREATE TABLE prefix_course_allowed_modules ( - id SERIAL PRIMARY KEY, - course INTEGER NOT NULL default 0, - module INTEGER NOT NULL default 0 -); - -CREATE INDEX prefix_course_allowed_modules_course_idx ON prefix_course_allowed_modules (course); -CREATE INDEX prefix_course_allowed_modules_module_idx ON prefix_course_allowed_modules (module); - -CREATE TABLE prefix_event ( - id SERIAL PRIMARY KEY, - name varchar(255) NOT NULL default '', - description text, - format integer NOT NULL default '0', - courseid integer NOT NULL default '0', - groupid integer NOT NULL default '0', - userid integer NOT NULL default '0', - repeatid integer NOT NULL default '0', - modulename varchar(20) NOT NULL default '', - instance integer NOT NULL default '0', - eventtype varchar(20) NOT NULL default '', - timestart integer NOT NULL default '0', - timeduration integer NOT NULL default '0', - visible integer NOT NULL default '1', - uuid char(36) NOT NULL default '', - sequence integer NOT NULL default '1', - timemodified integer NOT NULL default '0' -); - -CREATE INDEX prefix_event_courseid_idx ON prefix_event (courseid); -CREATE INDEX prefix_event_userid_idx ON prefix_event (userid); -CREATE INDEX prefix_event_timestart_idx ON prefix_event (timestart); -CREATE INDEX prefix_event_timeduration_idx ON prefix_event (timeduration); - - -CREATE TABLE prefix_grade_category ( - id SERIAL PRIMARY KEY, - name varchar(64) default NULL, - courseid integer NOT NULL default '0', - drop_x_lowest integer NOT NULL default '0', - bonus_points integer NOT NULL default '0', - hidden integer NOT NULL default '0', - weight decimal(5,2) default '0.00' -); - -CREATE INDEX prefix_grade_category_courseid_idx ON prefix_grade_category (courseid); - -CREATE TABLE prefix_grade_exceptions ( - id SERIAL PRIMARY KEY, - courseid integer NOT NULL default '0', - grade_itemid integer NOT NULL default '0', - userid integer NOT NULL default '0' -); - -CREATE INDEX prefix_grade_exceptions_courseid_idx ON prefix_grade_exceptions (courseid); - - -CREATE TABLE prefix_grade_item ( - id SERIAL PRIMARY KEY, - courseid integer default NULL, - category integer default NULL, - modid integer default NULL, - cminstance integer default NULL, - scale_grade float(11) default '1.0000000000', - extra_credit integer NOT NULL default '0', - sort_order integer NOT NULL default '0' -); - -CREATE INDEX prefix_grade_item_courseid_idx ON prefix_grade_item (courseid); - -CREATE TABLE prefix_grade_letter ( - id SERIAL PRIMARY KEY, - courseid integer NOT NULL default '0', - letter varchar(8) NOT NULL default 'NA', - grade_high decimal(6,2) NOT NULL default '100.00', - grade_low decimal(6,2) NOT NULL default '0.00' -); - -CREATE INDEX prefix_grade_letter_courseid_idx ON prefix_grade_letter (courseid); - -CREATE TABLE prefix_grade_preferences ( - id SERIAL PRIMARY KEY, - courseid integer default NULL, - preference integer NOT NULL default '0', - value integer NOT NULL default '0' -); - -CREATE UNIQUE INDEX prefix_grade_prefs_courseidpref_uk ON prefix_grade_preferences (courseid,preference); - -CREATE TABLE prefix_log ( - id SERIAL PRIMARY KEY, - time integer NOT NULL default '0', - userid integer NOT NULL default '0', - ip varchar(15) NOT NULL default '', - course integer NOT NULL default '0', - module varchar(20) NOT NULL default '', - cmid integer NOT NULL default '0', - action varchar(40) NOT NULL default '', - url varchar(100) NOT NULL default '', - info varchar(255) NOT NULL default '' -); - -CREATE INDEX prefix_log_coursemoduleaction_idx ON prefix_log (course,module,action); -CREATE INDEX prefix_log_timecoursemoduleaction_idx ON prefix_log (time,course,module,action); -CREATE INDEX prefix_log_courseuserid_idx ON prefix_log (course,userid); -CREATE INDEX prefix_log_userid_idx ON prefix_log (userid); -CREATE INDEX prefix_log_info_idx ON prefix_log (info); - -CREATE TABLE prefix_log_display ( - id SERIAL PRIMARY KEY, - module varchar(20) NOT NULL default '', - action varchar(40) NOT NULL default '', - mtable varchar(30) NOT NULL default '', - field varchar(200) NOT NULL default '' -); -CREATE INDEX prefix_log_display_moduleaction ON prefix_log_display (module,action); - -CREATE TABLE prefix_message ( - id SERIAL PRIMARY KEY, - useridfrom integer NOT NULL default '0', - useridto integer NOT NULL default '0', - message text, - format integer NOT NULL default '0', - timecreated integer NOT NULL default '0', - messagetype varchar(50) NOT NULL default '' -); - -CREATE INDEX prefix_message_useridfrom_idx ON prefix_message (useridfrom); -CREATE INDEX prefix_message_useridto_idx ON prefix_message (useridto); - -CREATE TABLE prefix_message_read ( - id SERIAL PRIMARY KEY, - useridfrom integer NOT NULL default '0', - useridto integer NOT NULL default '0', - message text, - format integer NOT NULL default '0', - timecreated integer NOT NULL default '0', - timeread integer NOT NULL default '0', - messagetype varchar(50) NOT NULL default '', - mailed integer NOT NULL default '0' -); - -CREATE INDEX prefix_message_read_useridfrom_idx ON prefix_message_read (useridfrom); -CREATE INDEX prefix_message_read_useridto_idx ON prefix_message_read (useridto); - -CREATE TABLE prefix_message_contacts ( - id SERIAL PRIMARY KEY, - userid integer NOT NULL default '0', - contactid integer NOT NULL default '0', - blocked integer NOT NULL default '0' -); - -CREATE INDEX prefix_message_contacts_useridcontactid_idx ON prefix_message_contacts (userid,contactid); - -CREATE TABLE prefix_modules ( - id SERIAL PRIMARY KEY, - name varchar(20) NOT NULL default '', - version integer NOT NULL default '0', - cron integer NOT NULL default '0', - lastcron integer NOT NULL default '0', - search varchar(255) NOT NULL default '', - visible integer NOT NULL default '1' -); - -CREATE INDEX prefix_modules_name_idx ON prefix_modules (name); - -CREATE TABLE prefix_scale ( - id SERIAL PRIMARY KEY, - courseid integer NOT NULL default '0', - userid integer NOT NULL default '0', - name varchar(255) NOT NULL default '', - scale text, - description text, - timemodified integer NOT NULL default '0' -); - -CREATE TABLE prefix_sessions2 ( - sesskey VARCHAR(255) NOT NULL default '', - expiry TIMESTAMP NOT NULL, - expireref VARCHAR(255), - created TIMESTAMP NOT NULL, - modified TIMESTAMP NOT NULL, - sessdata TEXT, -CONSTRAINT prefix_sess_ses_pk PRIMARY KEY (sesskey) -); - -CREATE INDEX prefix_sess_exp_ix ON prefix_sessions2 (expiry); - -CREATE INDEX prefix_sess_exp2_ix ON prefix_sessions2 (expireref); - -CREATE TABLE prefix_timezone ( - id SERIAL PRIMARY KEY, - name varchar(100) NOT NULL default '', - year integer NOT NULL default '0', - tzrule varchar(20) NOT NULL default '', - gmtoff integer NOT NULL default '0', - dstoff integer NOT NULL default '0', - dst_month integer NOT NULL default '0', - dst_startday integer NOT NULL default '0', - dst_weekday integer NOT NULL default '0', - dst_skipweeks integer NOT NULL default '0', - dst_time varchar(5) NOT NULL default '00:00', - std_month integer NOT NULL default '0', - std_startday integer NOT NULL default '0', - std_weekday integer NOT NULL default '0', - std_skipweeks integer NOT NULL default '0', - std_time varchar(5) NOT NULL default '00:00' -); - - -CREATE TABLE prefix_cache_filters ( - id SERIAL PRIMARY KEY, - filter varchar(32) NOT NULL default '', - version integer NOT NULL default '0', - md5key varchar(32) NOT NULL default '', - rawtext text, - timemodified integer NOT NULL default '0' -); - -CREATE INDEX prefix_cache_filters_filtermd5key_idx ON prefix_cache_filters (filter,md5key); - -CREATE INDEX prefix_scale_courseid_idx ON prefix_scale (courseid); - - -CREATE TABLE prefix_cache_text ( - id SERIAL PRIMARY KEY, - md5key varchar(32) NOT NULL default '', - formattedtext text, - timemodified integer NOT NULL default '0' -); - -CREATE INDEX prefix_cache_text_md5key_idx ON prefix_cache_text (md5key); - --- --- Table structure for table `user` --- --- When updating field length, modify --- truncate_userinfo() in moodlelib.php --- -CREATE TABLE prefix_user ( - id SERIAL PRIMARY KEY, - auth varchar(20) NOT NULL default 'manual', - confirmed integer NOT NULL default '0', - policyagreed integer NOT NULL default '0', - deleted integer NOT NULL default '0', - username varchar(100) NOT NULL default '', - password varchar(32) NOT NULL default '', - idnumber varchar(64) default NULL, - firstname varchar(20) NOT NULL default '', - lastname varchar(20) NOT NULL default '', - email varchar(100) NOT NULL default '', - emailstop integer NOT NULL default '0', - icq varchar(15) default NULL, - skype varchar(50) default NULL, - yahoo varchar(50) default NULL, - aim varchar(50) default NULL, - msn varchar(50) default NULL, - phone1 varchar(20) default NULL, - phone2 varchar(20) default NULL, - institution varchar(40) default NULL, - department varchar(30) default NULL, - address varchar(70) default NULL, - city varchar(20) default NULL, - country char(2) default NULL, - lang varchar(10) NOT NULL default '', - theme varchar(50) NOT NULL default '', - timezone varchar(100) NOT NULL default '99', - firstaccess integer NOT NULL default '0', - lastaccess integer NOT NULL default '0', - lastlogin integer NOT NULL default '0', - currentlogin integer NOT NULL default '0', - lastip varchar(15) default NULL, - secret varchar(15) default NULL, - picture integer default NULL, - url varchar(255) default NULL, - description text, - mailformat integer NOT NULL default '1', - maildigest integer NOT NULL default '0', - maildisplay integer NOT NULL default '2', - htmleditor integer NOT NULL default '1', - ajax integer NOT NULL default '1', - autosubscribe integer NOT NULL default '1', - trackforums integer NOT NULL default '0', - timemodified integer NOT NULL default '0' -); - -CREATE UNIQUE INDEX prefix_user_username_uk ON prefix_user (username); -CREATE INDEX prefix_user_idnumber_idx ON prefix_user (idnumber); -CREATE INDEX prefix_user_auth_idx ON prefix_user (auth); -CREATE INDEX prefix_user_deleted_idx ON prefix_user (deleted); -CREATE INDEX prefix_user_confirmed_idx ON prefix_user (confirmed); -CREATE INDEX prefix_user_firstname_idx ON prefix_user (firstname); -CREATE INDEX prefix_user_lastname_idx ON prefix_user (lastname); -CREATE INDEX prefix_user_city_idx ON prefix_user (city); -CREATE INDEX prefix_user_country_idx ON prefix_user (country); -CREATE INDEX prefix_user_lastaccess_idx ON prefix_user (lastaccess); -CREATE INDEX prefix_user_email_idx ON prefix_user (email); - -CREATE TABLE prefix_user_admins ( - id SERIAL PRIMARY KEY, - userid integer NOT NULL default '0' -); - -CREATE INDEX prefix_user_admins_userid_idx ON prefix_user_admins (userid); - -CREATE TABLE prefix_user_preferences ( - id SERIAL PRIMARY KEY, - userid integer NOT NULL default '0', - name varchar(50) NOT NULL default '', - value varchar(255) NOT NULL default '' -); - -CREATE INDEX prefix_user_preferences_useridname_idx ON prefix_user_preferences (userid,name); - -CREATE TABLE prefix_user_students ( - id SERIAL PRIMARY KEY, - userid integer NOT NULL default '0', - course integer NOT NULL default '0', - timestart integer NOT NULL default '0', - timeend integer NOT NULL default '0', - time integer NOT NULL default '0', - timeaccess integer NOT NULL default '0', - enrol varchar (20) NOT NULL default '' -); - -CREATE UNIQUE INDEX prefix_user_students_courseuserid_uk ON prefix_user_students (course,userid); -CREATE INDEX prefix_user_students_userid_idx ON prefix_user_students (userid); -CREATE INDEX prefix_user_students_enrol_idx ON prefix_user_students (enrol); -CREATE INDEX prefix_user_students_timeaccess_idx ON prefix_user_students (timeaccess); - -CREATE TABLE prefix_user_teachers ( - id SERIAL PRIMARY KEY, - userid integer NOT NULL default '0', - course integer NOT NULL default '0', - authority integer NOT NULL default '3', - role varchar(40) NOT NULL default '', - editall integer NOT NULL default '1', - timestart integer NOT NULL default '0', - timeend integer NOT NULL default '0', - timemodified integer NOT NULL default '0', - timeaccess integer NOT NULL default '0', - enrol varchar (20) NOT NULL default '' -); - -CREATE UNIQUE INDEX prefix_user_teachers_courseuserid_uk ON prefix_user_teachers (course,userid); -CREATE INDEX prefix_user_teachers_userid_idx ON prefix_user_teachers (userid); -CREATE INDEX prefix_user_teachers_enrol_idx ON prefix_user_teachers (enrol); - -CREATE TABLE prefix_user_coursecreators ( - id SERIAL8 PRIMARY KEY, - userid int8 NOT NULL default '0' -); - -CREATE INDEX prefix_user_coursecreators_userid_idx ON prefix_user_coursecreators (userid); - -CREATE TABLE adodb_logsql ( - created timestamp NOT NULL, - sql0 varchar(250) NOT NULL, - sql1 text NOT NULL, - params text NOT NULL, - tracer text NOT NULL, - timer decimal(16,6) NOT NULL -); - -CREATE TABLE prefix_stats_daily ( - id SERIAL PRIMARY KEY, - courseid INTEGER NOT NULL default 0, - roleid INTEGER NOT NULL default 0, - timeend INTEGER NOT NULL default 0, - stattype varchar(20) NOT NULL default 'activity', - stat1 INTEGER NOT NULL default 0, - stat2 INTEGER NOT NULL default 0, - CHECK (stattype::text = 'enrolments' OR stattype::text = 'activity' OR stattype::text = 'logins') -); - -CREATE INDEX prefix_stats_daily_courseid_idx ON prefix_stats_daily (courseid); -CREATE INDEX prefix_stats_daily_timeend_idx ON prefix_stats_daily (timeend); - -CREATE TABLE prefix_stats_weekly ( - id SERIAL PRIMARY KEY, - courseid INTEGER NOT NULL default 0, - roleid INTEGER NOT NULL default 0, - timeend INTEGER NOT NULL default 0, - stattype varchar(20) NOT NULL default 'activity', - stat1 INTEGER NOT NULL default 0, - stat2 INTEGER NOT NULL default 0, - CHECK (stattype::text = 'enrolments' OR stattype::text = 'activity' OR stattype::text = 'logins') -); - -CREATE INDEX prefix_stats_weekly_courseid_idx ON prefix_stats_weekly (courseid); -CREATE INDEX prefix_stats_weekly_timeend_idx ON prefix_stats_weekly (timeend); - -CREATE TABLE prefix_stats_monthly ( - id SERIAL PRIMARY KEY, - courseid INTEGER NOT NULL default 0, - roleid INTEGER NOT NULL default 0, - timeend INTEGER NOT NULL default 0, - stattype varchar(20) NOT NULL default 'activity', - stat1 INTEGER NOT NULL default 0, - stat2 INTEGER NOT NULL default 0, - CHECK (stattype::text = 'enrolments' OR stattype::text = 'activity' OR stattype::text = 'logins') -); - -CREATE INDEX prefix_stats_monthly_courseid_idx ON prefix_stats_monthly (courseid); -CREATE INDEX prefix_stats_monthly_timeend_idx ON prefix_stats_monthly (timeend); - -CREATE TABLE prefix_stats_user_daily ( - id SERIAL PRIMARY KEY, - courseid INTEGER NOT NULL default 0, - userid INTEGER NOT NULL default 0, - roleid INTEGER NOT NULL default 0, - timeend INTEGER NOT NULL default 0, - statsreads INTEGER NOT NULL default 0, - statswrites INTEGER NOT NULL default 0, - stattype varchar(30) NOT NULL default '' -); - -CREATE INDEX prefix_stats_user_daily_courseid_idx ON prefix_stats_user_daily (courseid); -CREATE INDEX prefix_stats_user_daily_userid_idx ON prefix_stats_user_daily (userid); -CREATE INDEX prefix_stats_user_daily_roleid_idx ON prefix_stats_user_daily (roleid); -CREATE INDEX prefix_stats_user_daily_timeend_idx ON prefix_stats_user_daily (timeend); - -CREATE TABLE prefix_stats_user_weekly ( - id SERIAL PRIMARY KEY, - courseid INTEGER NOT NULL default 0, - userid INTEGER NOT NULL default 0, - roleid INTEGER NOT NULL default 0, - timeend INTEGER NOT NULL default 0, - statsreads INTEGER NOT NULL default 0, - statswrites INTEGER NOT NULL default 0, - stattype varchar(30) NOT NULL default '' -); - -CREATE INDEX prefix_stats_user_weekly_courseid_idx ON prefix_stats_user_weekly (courseid); -CREATE INDEX prefix_stats_user_weekly_userid_idx ON prefix_stats_user_weekly (userid); -CREATE INDEX prefix_stats_user_weekly_roleid_idx ON prefix_stats_user_weekly (roleid); -CREATE INDEX prefix_stats_user_weekly_timeend_idx ON prefix_stats_user_weekly (timeend); - -CREATE TABLE prefix_stats_user_monthly ( - id SERIAL PRIMARY KEY, - courseid INTEGER NOT NULL default 0, - userid INTEGER NOT NULL default 0, - roleid INTEGER NOT NULL default 0, - timeend INTEGER NOT NULL default 0, - statsreads INTEGER NOT NULL default 0, - statswrites INTEGER NOT NULL default 0, - stattype varchar(30) NOT NULL default '' -); - -CREATE INDEX prefix_stats_user_monthly_courseid_idx ON prefix_stats_user_monthly (courseid); -CREATE INDEX prefix_stats_user_monthly_userid_idx ON prefix_stats_user_monthly (userid); -CREATE INDEX prefix_stats_user_monthly_roleid_idx ON prefix_stats_user_monthly (roleid); -CREATE INDEX prefix_stats_user_monthly_timeend_idx ON prefix_stats_user_monthly (timeend); - -CREATE TABLE prefix_post ( - id SERIAL PRIMARY KEY, - module varchar(20) NOT NULL default '', - userid INTEGER NOT NULL default 0, - courseid INTEGER NOT NULL default 0, - groupid INTEGER NOT NULL default 0, - moduleid INTEGER NOT NULL default 0, - coursemoduleid INTEGER NOT NULL default 0, - subject varchar(128) NOT NULL default '', - summary text, - content text, - uniquehash varchar(128) NOT NULL default '', - rating INTEGER NOT NULL default 0, - format INTEGER NOT NULL default 0, - publishstate varchar(10) CHECK (publishstate IN ('draft','site','public')) NOT NULL default 'draft', - lastmodified INTEGER NOT NULL default '0', - created INTEGER NOT NULL default '0' -); - -CREATE INDEX prefix_id_user_idx ON prefix_post (id, courseid); -CREATE INDEX prefix_post_lastmodified_idx ON prefix_post (lastmodified); -CREATE INDEX prefix_post_module_idx ON prefix_post (moduleid); -CREATE INDEX prefix_post_subject_idx ON prefix_post (subject); - -CREATE TABLE prefix_tags ( - id SERIAL PRIMARY KEY, - type varchar(255) NOT NULL default 'official', - userid INTEGER NOT NULL default 0, - text varchar(255) NOT NULL default '' -); -CREATE INDEX prefix_tags_typeuserid_idx ON prefix_tags (type, userid); -CREATE INDEX prefix_tags_text_idx ON prefix_tags (text); - -CREATE TABLE prefix_blog_tag_instance ( - id SERIAL PRIMARY KEY, - entryid integer NOT NULL default 0, - tagid integer NOT NULL default 0, - groupid integer NOT NULL default 0, - courseid integer NOT NULL default 0, - userid integer NOT NULL default 0, - timemodified integer NOT NULL default 0 -); -CREATE INDEX prefix_bti_entryid_idx ON prefix_blog_tag_instance (entryid); -CREATE INDEX prefix_bti_tagid_idx ON prefix_blog_tag_instance (tagid); - -# Roles tables -CREATE TABLE prefix_role ( - id SERIAL PRIMARY KEY, - name varchar(255) NOT NULL default '', - shortname varchar(100) NOT NULL default '', - description text NOT NULL default '', - sortorder integer NOT NULL default '0' -); -CREATE INDEX prefix_role_sortorder_idx ON prefix_role (sortorder); - -CREATE TABLE prefix_context ( - id SERIAL PRIMARY KEY, - contextlevel integer NOT NULL default 0, - instanceid integer NOT NULL default 0 -); -CREATE INDEX prefix_context_instanceid_idx ON prefix_context (instanceid); -CREATE UNIQUE INDEX prefix_context_contextlevelinstanceid_idx ON prefix_context (contextlevel, instanceid); - -CREATE TABLE prefix_role_assignments ( - id SERIAL PRIMARY KEY, - roleid integer NOT NULL default 0, - contextid integer NOT NULL default 0, - userid integer NOT NULL default 0, - hidden integer NOT NULL default 0, - timestart integer NOT NULL default 0, - timeend integer NOT NULL default 0, - timemodified integer NOT NULL default 0, - modifierid integer NOT NULL default 0, - enrol varchar(20) NOT NULL default '', - sortorder integer NOT NULL default '0' -); -CREATE INDEX prefix_role_assignments_roleid_idx ON prefix_role_assignments (roleid); -CREATE INDEX prefix_role_assignments_contextidid_idx ON prefix_role_assignments (contextid); -CREATE INDEX prefix_role_assignments_userid_idx ON prefix_role_assignments (userid); -CREATE UNIQUE INDEX prefix_role_assignments_contextidroleiduserid_idx ON prefix_role_assignments (contextid, roleid, userid); -CREATE INDEX prefix_role_assignments_sortorder_idx ON prefix_role_assignments (sortorder); - -CREATE TABLE prefix_role_capabilities ( - id SERIAL PRIMARY KEY, - contextid integer NOT NULL default 0, - roleid integer NOT NULL default 0, - capability varchar(255) NOT NULL default '', - permission integer NOT NULL default 0, - timemodified integer NOT NULL default 0, - modifierid integer NOT NULL default 0 -); -CREATE INDEX prefix_role_capabilities_roleid_idx ON prefix_role_capabilities (roleid); -CREATE INDEX prefix_role_capabilities_contextid_idx ON prefix_role_capabilities (contextid); -CREATE INDEX prefix_role_capabilities_modifierid_idx ON prefix_role_capabilities (modifierid); -CREATE UNIQUE INDEX prefix_role_capabilities_roleidcontextidcapability_idx ON prefix_role_capabilities (roleid, contextid, capability); - -CREATE TABLE prefix_role_allow_assign ( - id SERIAL PRIMARY KEY, - roleid integer NOT NULL default '0', - allowassign integer NOT NULL default '0' -); -CREATE INDEX prefix_role_allow_assign_roleid_idx ON prefix_role_allow_assign (roleid); -CREATE INDEX prefix_role_allow_assign_allowassign_idx ON prefix_role_allow_assign (allowassign); -CREATE UNIQUE INDEX prefix_role_allow_assign_roleidallowassign_idx ON prefix_role_allow_assign (roleid, allowassign); - -CREATE TABLE prefix_role_allow_override ( - id SERIAL PRIMARY KEY, - roleid integer NOT NULL default '0', - allowoverride integer NOT NULL default '0' -); -CREATE INDEX prefix_role_allow_override_roleid_idx ON prefix_role_allow_override (roleid); -CREATE INDEX prefix_role_allow_override_allowoverride_idx ON prefix_role_allow_override (allowoverride); -CREATE UNIQUE INDEX prefix_role_allow_override_roleidallowoverride_idx ON prefix_role_allow_override (roleid, allowoverride); - -CREATE TABLE prefix_capabilities ( - id SERIAL PRIMARY KEY, - name varchar(255) NOT NULL default '', - captype varchar(50) NOT NULL default '', - contextlevel integer NOT NULL default 0, - component varchar(100) NOT NULL default '', - riskbitmask integer NOT NULL default 0 -); -CREATE UNIQUE INDEX prefix_capabilities_name_idx ON prefix_capabilities (name); - -CREATE TABLE prefix_role_names ( - id SERIAL PRIMARY KEY, - roleid integer NOT NULL default 0, - contextid integer NOT NULL default 0, - text text NOT NULL default '' -); -CREATE INDEX prefix_role_names_roleid_idx ON prefix_role_names (roleid); -CREATE INDEX prefix_role_names_contextid_idx ON prefix_role_names (contextid); -CREATE UNIQUE INDEX prefix_role_names_roleidcontextid_idx ON prefix_role_names (roleid, contextid); - -CREATE TABLE prefix_user_lastaccess ( - id SERIAL PRIMARY KEY, - userid integer NOT NULL default 0, - courseid integer NOT NULL default 0, - timeaccess integer NOT NULL default 0 -); - -CREATE INDEX prefix_user_lastaccess_userid_idx ON prefix_user_lastaccess (userid); -CREATE INDEX prefix_user_lastaccess_courseid_idx ON prefix_user_lastaccess (courseid); -CREATE UNIQUE INDEX prefix_user_lastaccess_useridcourseid_idx ON prefix_user_lastaccess (userid, courseid); - -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('user', 'view', 'user', 'firstname||\' \'||lastname'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('course', 'user report', 'user', 'firstname||\' \'||lastname'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('course', 'view', 'course', 'fullname'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('course', 'update', 'course', 'fullname'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('course', 'enrol', 'course', 'fullname'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('course', 'report log', 'course', 'fullname'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('course', 'report live', 'course', 'fullname'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('course', 'report outline', 'course', 'fullname'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('course', 'report participation', 'course', 'fullname'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('course', 'report stats', 'course', 'fullname'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('message', 'write', 'user', 'firstname||\' \'||lastname'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('message', 'read', 'user', 'firstname||\' \'||lastname'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('message', 'add contact', 'user', 'firstname||\' \'||lastname'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('message', 'remove contact', 'user', 'firstname||\' \'||lastname'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('message', 'block contact', 'user', 'firstname||\' \'||lastname'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('message', 'unblock contact', 'user', 'firstname||\' \'||lastname'); - - -CREATE TABLE prefix_user_info_field ( - id BIGSERIAL, - name VARCHAR(255) NOT NULL default '', - datatype VARCHAR(255) NOT NULL default '', - categoryid BIGINT NOT NULL default 0, - sortorder BIGINT NOT NULL default 0, - required SMALLINT NOT NULL default 0, - locked SMALLINT NOT NULL default 0, - visible SMALLINT NOT NULL default 0, - defaultdata TEXT, -CONSTRAINT prefix_userinfofiel_id_pk PRIMARY KEY (id) -); - -COMMENT ON TABLE prefix_user_info_field IS 'Customisable user profile fields'; - -CREATE TABLE prefix_user_info_category ( - id BIGSERIAL, - name VARCHAR(255) NOT NULL default '', - sortorder BIGINT NOT NULL default 0, -CONSTRAINT prefix_userinfocate_id_pk PRIMARY KEY (id) -); - -COMMENT ON TABLE prefix_user_info_category IS 'Customisable fields categories'; - -CREATE TABLE prefix_user_info_data ( - id BIGSERIAL, - userid BIGINT NOT NULL default 0, - fieldid BIGINT NOT NULL default 0, - data TEXT NOT NULL, -CONSTRAINT prefix_userinfodata_id_pk PRIMARY KEY (id) -); - -COMMENT ON TABLE prefix_user_info_data IS 'Data for the customisable user fields'; diff --git a/lib/db/upgrade.php b/lib/db/upgrade.php index d9ba7aecdf5..a10e85f92b2 100644 --- a/lib/db/upgrade.php +++ b/lib/db/upgrade.php @@ -1391,6 +1391,10 @@ function xmldb_main_upgrade($oldversion=0) { } + if ($result && $oldversion < 2007070603) { + // Small update of guest user to be 100% sure it has the correct mnethostid (MDL-10375) + set_field('user', 'mnethostid', $CFG->mnet_localhost_id, 'username', 'guest'); + } return $result; } diff --git a/lib/editor/tinymce/jscripts/tiny_mce/plugins/advimage/editor_plugin_src.js b/lib/editor/tinymce/jscripts/tiny_mce/plugins/advimage/editor_plugin_src.js index f001c63723c..deb3c7875a0 100644 --- a/lib/editor/tinymce/jscripts/tiny_mce/plugins/advimage/editor_plugin_src.js +++ b/lib/editor/tinymce/jscripts/tiny_mce/plugins/advimage/editor_plugin_src.js @@ -1,7 +1,7 @@ /** - * $RCSfile: editor_plugin_src.js,v $ - * $Revision: 1.1 $ - * $Date: 2006/03/04 15:54:06 $ + * $RCSfile$ + * $Revision$ + * $Date$ * * @author Moxiecode * @copyright Copyright � 2004-2006, Moxiecode Systems AB, All rights reserved. diff --git a/lib/editor/tinymce/jscripts/tiny_mce/plugins/fullscreen/editor_plugin_src.js b/lib/editor/tinymce/jscripts/tiny_mce/plugins/fullscreen/editor_plugin_src.js index ea11b49e037..ded727071b2 100644 --- a/lib/editor/tinymce/jscripts/tiny_mce/plugins/fullscreen/editor_plugin_src.js +++ b/lib/editor/tinymce/jscripts/tiny_mce/plugins/fullscreen/editor_plugin_src.js @@ -1,7 +1,7 @@ /** - * $RCSfile: editor_plugin_src.js,v $ - * $Revision: 1.1 $ - * $Date: 2006/03/04 15:55:13 $ + * $RCSfile$ + * $Revision$ + * $Date$ * * @author Moxiecode * @copyright Copyright � 2004-2006, Moxiecode Systems AB, All rights reserved. diff --git a/lib/editor/tinymce/jscripts/tiny_mce/themes/advanced/editor_template_src.js b/lib/editor/tinymce/jscripts/tiny_mce/themes/advanced/editor_template_src.js index db7afdfed96..39fe05d9c4c 100644 --- a/lib/editor/tinymce/jscripts/tiny_mce/themes/advanced/editor_template_src.js +++ b/lib/editor/tinymce/jscripts/tiny_mce/themes/advanced/editor_template_src.js @@ -1,7 +1,7 @@ /** - * $RCSfile: editor_template_src.js,v $ - * $Revision: 1.1 $ - * $Date: 2006/03/04 15:57:03 $ + * $RCSfile$ + * $Revision$ + * $Date$ * * @author Moxiecode * @copyright Copyright � 2004-2006, Moxiecode Systems AB, All rights reserved. diff --git a/lib/editor/tinymce/jscripts/tiny_mce/themes/simple/editor_template_src.js b/lib/editor/tinymce/jscripts/tiny_mce/themes/simple/editor_template_src.js index 31d2b882970..2979753e391 100644 --- a/lib/editor/tinymce/jscripts/tiny_mce/themes/simple/editor_template_src.js +++ b/lib/editor/tinymce/jscripts/tiny_mce/themes/simple/editor_template_src.js @@ -1,7 +1,7 @@ /** - * $RCSfile: editor_template_src.js,v $ - * $Revision: 1.1 $ - * $Date: 2006/03/04 15:57:31 $ + * $RCSfile$ + * $Revision$ + * $Date$ * * @author Moxiecode * @copyright Copyright � 2004-2006, Moxiecode Systems AB, All rights reserved. diff --git a/lib/editor/tinymce/jscripts/tiny_mce/tiny_mce_gzip.php b/lib/editor/tinymce/jscripts/tiny_mce/tiny_mce_gzip.php index 766a60e8db9..ce3fa787587 100644 --- a/lib/editor/tinymce/jscripts/tiny_mce/tiny_mce_gzip.php +++ b/lib/editor/tinymce/jscripts/tiny_mce/tiny_mce_gzip.php @@ -1,8 +1,8 @@ -<?php // $Id: tiny_mce_gzip.php,v 1.1 2006/03/04 15:57:32 julmis Exp $ +<?php // $Id$ /** - * $RCSfile: tiny_mce_gzip.php,v $ - * $Revision: 1.1 $ - * $Date: 2006/03/04 15:57:32 $ + * $RCSfile$ + * $Revision$ + * $Date$ * * @version 1.07 * @author Moxiecode diff --git a/lib/editor/tinymce/jscripts/tiny_mce/tiny_mce_popup.js b/lib/editor/tinymce/jscripts/tiny_mce/tiny_mce_popup.js index aba9f11807f..ac5c6870c97 100644 --- a/lib/editor/tinymce/jscripts/tiny_mce/tiny_mce_popup.js +++ b/lib/editor/tinymce/jscripts/tiny_mce/tiny_mce_popup.js @@ -1,7 +1,7 @@ /** - * $RCSfile: tiny_mce_popup.js,v $ - * $Revision: 1.1 $ - * $Date: 2006/03/04 15:57:32 $ + * $RCSfile$ + * $Revision$ + * $Date$ * * @author Moxiecode * @copyright Copyright � 2004-2006, Moxiecode Systems AB, All rights reserved. diff --git a/lib/editor/tinymce/jscripts/tiny_mce/utils/form_utils.js b/lib/editor/tinymce/jscripts/tiny_mce/utils/form_utils.js index 21989ca9fe3..cc3621736f3 100644 --- a/lib/editor/tinymce/jscripts/tiny_mce/utils/form_utils.js +++ b/lib/editor/tinymce/jscripts/tiny_mce/utils/form_utils.js @@ -1,7 +1,7 @@ /** - * $RCSfile: form_utils.js,v $ - * $Revision: 1.1 $ - * $Date: 2006/03/04 15:57:32 $ + * $RCSfile$ + * $Revision$ + * $Date$ * * Various form utilitiy functions. * diff --git a/lib/editor/tinymce/jscripts/tiny_mce/utils/mclayer.js b/lib/editor/tinymce/jscripts/tiny_mce/utils/mclayer.js index 7e7a0492305..09a949677aa 100644 --- a/lib/editor/tinymce/jscripts/tiny_mce/utils/mclayer.js +++ b/lib/editor/tinymce/jscripts/tiny_mce/utils/mclayer.js @@ -1,7 +1,7 @@ /** - * $RCSfile: mclayer.js,v $ - * $Revision: 1.1 $ - * $Date: 2006/03/04 15:57:32 $ + * $RCSfile$ + * $Revision$ + * $Date$ * * Moxiecode floating layer script. * diff --git a/lib/editor/tinymce/jscripts/tiny_mce/utils/mctabs.js b/lib/editor/tinymce/jscripts/tiny_mce/utils/mctabs.js index 258e9891343..39292c4a06f 100644 --- a/lib/editor/tinymce/jscripts/tiny_mce/utils/mctabs.js +++ b/lib/editor/tinymce/jscripts/tiny_mce/utils/mctabs.js @@ -1,7 +1,7 @@ /** - * $RCSfile: mctabs.js,v $ - * $Revision: 1.1 $ - * $Date: 2006/03/04 15:57:32 $ + * $RCSfile$ + * $Revision$ + * $Date$ * * Moxiecode DHTML Tabs script. * diff --git a/lib/editor/tinymce/jscripts/tiny_mce/utils/validate.js b/lib/editor/tinymce/jscripts/tiny_mce/utils/validate.js index ab0773feb84..db1034ab5c1 100644 --- a/lib/editor/tinymce/jscripts/tiny_mce/utils/validate.js +++ b/lib/editor/tinymce/jscripts/tiny_mce/utils/validate.js @@ -1,7 +1,7 @@ /** - * $RCSfile: validate.js,v $ - * $Revision: 1.1 $ - * $Date: 2006/03/04 15:57:32 $ + * $RCSfile$ + * $Revision$ + * $Date$ * * Various form validation methods. * diff --git a/lib/moodlelib.php b/lib/moodlelib.php index a669f443bf4..19cd7e9e798 100644 --- a/lib/moodlelib.php +++ b/lib/moodlelib.php @@ -2478,6 +2478,34 @@ function get_user_fieldnames() { return $fieldarray; } +/** + * Creates the default "guest" user. Used both from + * admin/index.php and login/index.php + * @return mixed user object created or boolean false if the creation has failed + */ +function create_guest_record() { + + global $CFG; + + $guest->auth = 'manual'; + $guest->username = 'guest'; + $guest->password = hash_internal_user_password('guest'); + $guest->firstname = addslashes(get_string('guestuser')); + $guest->lastname = ' '; + $guest->email = 'root@localhost'; + $guest->description = addslashes(get_string('guestuserinfo')); + $guest->mnethostid = $CFG->mnet_localhost_id; + $guest->confirmed = 1; + $guest->lang = $CFG->lang; + $guest->timemodified= time(); + + if (! $guest->id = insert_record("user", $guest)) { + return false; + } + + return $guest; +} + /** * Creates a bare-bones user record * diff --git a/lib/pear/HTML/QuickForm/Rule/Compare.php b/lib/pear/HTML/QuickForm/Rule/Compare.php index a976114ca64..594e51c4443 100644 --- a/lib/pear/HTML/QuickForm/Rule/Compare.php +++ b/lib/pear/HTML/QuickForm/Rule/Compare.php @@ -28,7 +28,7 @@ require_once 'HTML/QuickForm/Rule.php'; * * @access public * @package HTML_QuickForm - * @version $Revision: 1.1 $ + * @version $Revision$ */ class HTML_QuickForm_Rule_Compare extends HTML_QuickForm_Rule { diff --git a/lib/soap/nusoap.php b/lib/soap/nusoap.php index d5bafa25885..d7ad5d71425 100644 --- a/lib/soap/nusoap.php +++ b/lib/soap/nusoap.php @@ -83,7 +83,7 @@ class nusoap_base { * @var string * @access private */ - var $revision = '$Revision: 1.2 $'; + var $revision = '$Revision$'; /** * Current error string (manipulated by getError/setError) * diff --git a/login/index.php b/login/index.php index a4cb4f09e1f..115fbf7faff 100644 --- a/login/index.php +++ b/login/index.php @@ -26,19 +26,7 @@ /// Check if the guest user exists. If not, create one. if (! record_exists('user', 'username', 'guest')) { - $guest = new object(); - $guest->auth = 'manual'; - $guest->username = 'guest'; - $guest->password = hash_internal_user_password('guest'); - $guest->firstname = addslashes(get_string('guestuser')); - $guest->lastname = ' '; - $guest->email = 'root@localhost'; - $guest->description = addslashes(get_string('guestuserinfo')); - $guest->confirmed = 1; - $guest->lang = $CFG->lang; - $guest->timemodified= time(); - - if (! $guest->id = insert_record('user', $guest)) { + if (! $guest = create_guest_record()) { notify('Could not create guest user record !!!'); } } diff --git a/mod/assignment/db/mysql.sql b/mod/assignment/db/mysql.sql deleted file mode 100644 index 7ddd9445988..00000000000 --- a/mod/assignment/db/mysql.sql +++ /dev/null @@ -1,63 +0,0 @@ -# -# Table structure for table `assignment` -# - -CREATE TABLE `prefix_assignment` ( - `id` int(10) unsigned NOT NULL auto_increment, - `course` int(10) unsigned NOT NULL default '0', - `name` varchar(255) NOT NULL default '', - `description` text NOT NULL default '', - `format` tinyint(4) unsigned NOT NULL default '0', - `assignmenttype` varchar(50) NOT NULL default '', - `resubmit` tinyint(2) unsigned NOT NULL default '0', - `preventlate` tinyint(2) unsigned NOT NULL default '0', - `emailteachers` tinyint(2) unsigned NOT NULL default '0', - `var1` int(10) default '0', - `var2` int(10) default '0', - `var3` int(10) default '0', - `var4` int(10) default '0', - `var5` int(10) default '0', - `maxbytes` int(10) unsigned NOT NULL default '100000', - `timedue` int(10) unsigned NOT NULL default '0', - `timeavailable` int(10) unsigned NOT NULL default '0', - `grade` int(10) NOT NULL default '0', - `timemodified` int(10) unsigned NOT NULL default '0', - PRIMARY KEY (`id`), - KEY `course` (`course`) -) COMMENT='Defines assignments'; -# -------------------------------------------------------- - -# -# Table structure for table `assignment_submissions` -# - -CREATE TABLE `prefix_assignment_submissions` ( - `id` int(10) unsigned NOT NULL auto_increment, - `assignment` int(10) unsigned NOT NULL default '0', - `userid` int(10) unsigned NOT NULL default '0', - `timecreated` int(10) unsigned NOT NULL default '0', - `timemodified` int(10) unsigned NOT NULL default '0', - `numfiles` int(10) unsigned NOT NULL default '0', - `data1` text NOT NULL default '', - `data2` text NOT NULL default '', - `grade` int(11) NOT NULL default '0', - `submissioncomment` text NOT NULL default '', - `format` tinyint(4) unsigned NOT NULL default '0', - `teacher` int(10) unsigned NOT NULL default '0', - `timemarked` int(10) unsigned NOT NULL default '0', - `mailed` tinyint(1) unsigned NOT NULL default '0', - PRIMARY KEY (`id`), - KEY `assignment` (`assignment`), - KEY `userid` (`userid`), - KEY `mailed` (`mailed`), - KEY `timemarked` (`timemarked`) -) COMMENT='Info about submitted assignments'; -# -------------------------------------------------------- - - -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('assignment', 'view', 'assignment', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('assignment', 'add', 'assignment', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('assignment', 'update', 'assignment', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('assignment', 'view submission', 'assignment', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('assignment', 'upload', 'assignment', 'name'); - diff --git a/mod/assignment/db/postgres7.sql b/mod/assignment/db/postgres7.sql deleted file mode 100644 index 3cb739ece34..00000000000 --- a/mod/assignment/db/postgres7.sql +++ /dev/null @@ -1,66 +0,0 @@ -# -# Table structure for table assignment -# - -CREATE TABLE prefix_assignment ( - id SERIAL PRIMARY KEY, - course integer NOT NULL default '0', - name varchar(255) NOT NULL default '', - description text NOT NULL default '', - format integer NOT NULL default '0', - assignmenttype varchar(50) NOT NULL default '', - resubmit integer NOT NULL default '0', - preventlate integer NOT NULL default '0', - emailteachers integer NOT NULL default '0', - var1 integer default '0', - var2 integer default '0', - var3 integer default '0', - var4 integer default '0', - var5 integer default '0', - maxbytes integer NOT NULL default '100000', - timedue integer NOT NULL default '0', - timeavailable integer NOT NULL default '0', - grade integer NOT NULL default '0', - timemodified integer NOT NULL default '0' -); - -CREATE INDEX prefix_assignment_course_idx ON prefix_assignment (course); - -# -------------------------------------------------------- - -# -# Table structure for table assignment_submissions -# - -CREATE TABLE prefix_assignment_submissions ( - id SERIAL PRIMARY KEY, - assignment integer NOT NULL default '0', - userid integer NOT NULL default '0', - timecreated integer NOT NULL default '0', - timemodified integer NOT NULL default '0', - numfiles integer NOT NULL default '0', - data1 text NOT NULL default '', - data2 text NOT NULL default '', - grade integer NOT NULL default '0', - submissioncomment text NOT NULL default '', - format integer NOT NULL default '0', - teacher integer NOT NULL default '0', - timemarked integer NOT NULL default '0', - mailed integer NOT NULL default '0' -); - -CREATE INDEX prefix_assignment_submissions_assignment_idx ON prefix_assignment_submissions (assignment); -CREATE INDEX prefix_assignment_submissions_userid_idx ON prefix_assignment_submissions (userid); -CREATE INDEX prefix_assignment_submissions_mailed_idx ON prefix_assignment_submissions (mailed); -CREATE INDEX prefix_assignment_submissions_timemarked_idx ON prefix_assignment_submissions (timemarked); - - -# -------------------------------------------------------- - - -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('assignment', 'view', 'assignment', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('assignment', 'add', 'assignment', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('assignment', 'update', 'assignment', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('assignment', 'view submission', 'assignment', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('assignment', 'upload', 'assignment', 'name'); - diff --git a/mod/chat/db/mysql.sql b/mod/chat/db/mysql.sql deleted file mode 100644 index 60edbda4e12..00000000000 --- a/mod/chat/db/mysql.sql +++ /dev/null @@ -1,70 +0,0 @@ -# -# Table structure for table `chat` -# - -CREATE TABLE `prefix_chat` ( - `id` int(10) unsigned NOT NULL auto_increment, - `course` int(10) unsigned NOT NULL default '0', - `name` varchar(255) NOT NULL default '', - `intro` text NOT NULL default '', - `keepdays` int(11) NOT NULL default '0', - `studentlogs` int(4) NOT NULL default '0', - `chattime` int(10) unsigned NOT NULL default '0', - `schedule` int(4) NOT NULL default '0', - `timemodified` int(10) unsigned NOT NULL default '0', - PRIMARY KEY (`id`), - KEY `course` (`course`) -) TYPE=MyISAM COMMENT='Each of these is a chat room'; -# -------------------------------------------------------- - -# -# Table structure for table `chat_messages` -# - -CREATE TABLE `prefix_chat_messages` ( - `id` int(10) unsigned NOT NULL auto_increment, - `chatid` int(10) NOT NULL default '0', - `userid` int(10) NOT NULL default '0', - `groupid` int(10) NOT NULL default '0', - `system` int(1) unsigned NOT NULL default '0', - `message` text NOT NULL default '', - `timestamp` int(10) unsigned NOT NULL default '0', - PRIMARY KEY (`id`), - KEY `timemodifiedchat` (`timestamp`,`chatid`), - KEY `chatid` (`chatid`), - KEY `userid` (`userid`), - KEY `groupid` (`groupid`) -) TYPE=MyISAM COMMENT='Stores all the actual chat messages'; -# -------------------------------------------------------- - -# -# Table structure for table `chat_users` -# - -CREATE TABLE `prefix_chat_users` ( - `id` int(10) unsigned NOT NULL auto_increment, - `chatid` int(11) NOT NULL default '0', - `userid` int(11) NOT NULL default '0', - `groupid` int(11) NOT NULL default '0', - `version` varchar(16) NOT NULL default '', - `ip` varchar(15) NOT NULL default '', - `firstping` int(10) unsigned NOT NULL default '0', - `lastping` int(10) unsigned NOT NULL default '0', - `lastmessageping` int(10) unsigned NOT NULL default '0', - `sid` varchar(32) NOT NULL default '', - `course` int(10) NOT NULL default '0', - `lang` varchar(10) NOT NULL default '', - PRIMARY KEY (`id`), - KEY `userid` (`userid`), - KEY `lastping` (`lastping`), - KEY `chatid` (`chatid`), - KEY `groupid` (`groupid`) -) TYPE=MyISAM COMMENT='Keeps track of which users are in which chat rooms'; - - -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('chat', 'view', 'chat', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('chat', 'add', 'chat', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('chat', 'update', 'chat', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('chat', 'report', 'chat', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('chat', 'talk', 'chat', 'name'); - diff --git a/mod/chat/db/postgres7.sql b/mod/chat/db/postgres7.sql deleted file mode 100644 index c3fd7caeff4..00000000000 --- a/mod/chat/db/postgres7.sql +++ /dev/null @@ -1,73 +0,0 @@ -# -# Table structure for table `chat` -# - -CREATE TABLE prefix_chat ( - id SERIAL, - course INTEGER NOT NULL default '0', - name varchar(255) NOT NULL default '', - intro text NOT NULL default '', - keepdays INTEGER NOT NULL default '0', - studentlogs INTEGER NOT NULL default '0', - chattime INTEGER NOT NULL default '0', - schedule INTEGER NOT NULL default '0', - timemodified INTEGER NOT NULL default '0', - PRIMARY KEY (id) -); - -CREATE INDEX prefix_chat_course_idx ON prefix_chat(course); - -# -------------------------------------------------------- - -# -# Table structure for table `chat_messages` -# - -CREATE TABLE prefix_chat_messages ( - id SERIAL, - chatid integer NOT NULL default '0', - userid integer NOT NULL default '0', - groupid integer NOT NULL default '0', - system integer NOT NULL default '0', - message text NOT NULL default '', - timestamp integer NOT NULL default '0', - PRIMARY KEY (id) -); - -CREATE INDEX prefix_chat_messages_chatid_idx ON prefix_chat_messages (chatid); -CREATE INDEX prefix_chat_messages_userid_idx ON prefix_chat_messages (userid); -CREATE INDEX prefix_chat_messages_groupid_idx ON prefix_chat_messages (groupid); -CREATE INDEX prefix_chat_messages_timemodifiedchatid_idx ON prefix_chat_messages(timestamp,chatid); - -# -------------------------------------------------------- - -# -# Table structure for table `chat_users` -# - -CREATE TABLE prefix_chat_users ( - id SERIAL, - chatid integer NOT NULL default '0', - userid integer NOT NULL default '0', - groupid integer NOT NULL default '0', - version varchar(16) NOT NULL default '', - ip varchar(15) NOT NULL default '', - firstping integer NOT NULL default '0', - lastping integer NOT NULL default '0', - lastmessageping integer NOT NULL default '0', - sid varchar(32) NOT NULL default '', - course integer NOT NULL default '0', - lang varchar(10) NOT NULL default '', - PRIMARY KEY (id) -); - -CREATE INDEX prefix_chat_users_chatid_idx ON prefix_chat_users (chatid); -CREATE INDEX prefix_chat_users_userid_idx ON prefix_chat_users (userid); -CREATE INDEX prefix_chat_users_groupid_idx ON prefix_chat_users (groupid); -CREATE INDEX prefix_chat_users_lastping_idx ON prefix_chat_users (lastping); - -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('chat', 'view', 'chat', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('chat', 'add', 'chat', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('chat', 'update', 'chat', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('chat', 'report', 'chat', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('chat', 'talk', 'chat', 'name'); diff --git a/mod/chat/gui_header_js/index.php b/mod/chat/gui_header_js/index.php index 65e4d8656c9..231899521b6 100644 --- a/mod/chat/gui_header_js/index.php +++ b/mod/chat/gui_header_js/index.php @@ -32,7 +32,7 @@ /// Check to see if groups are being used here if ($groupmode = groupmode($course, $cm)) { // Groups are being used if ($groupid = get_and_set_current_group($course, $groupmode, $groupid)) { - if (! groups_group_exists($groupid)) { + if (!$group = groups_get_group($groupid, false)) { error("That group (id $groupid) doesn't exist!"); } $groupname = ': '.$group->name; diff --git a/mod/chat/view.php b/mod/chat/view.php index 8d1f0deae9f..2a3d854cab9 100644 --- a/mod/chat/view.php +++ b/mod/chat/view.php @@ -82,23 +82,11 @@ echo '<td id="middle-column">'; if (!empty($THEME->customcorners)) print_custom_corners_start(); - - if ($chat->studentlogs or has_capability('mod/chat:readlog',$context)) { - echo '<div class="reportlink">'; - echo "<a href=\"report.php?id=$cm->id\">". - get_string('viewreport', 'chat').'</a>'; - echo '</div>'; - } - - print_heading(format_string($chat->name)); /// Check to see if groups are being used here - if ($groupmode = groupmode($course, $cm)) { // Groups are being used - $currentgroup = setup_and_print_groups($course, $groupmode, "view.php?id=$cm->id"); - } else { - $currentgroup = 0; - } - + $groupmode = groupmode($course, $cm); + $currentgroup = setup_and_print_groups($course, $groupmode, "view.php?id=$cm->id"); + if ($currentgroup) { $groupselect = " AND groupid = '$currentgroup'"; $groupparam = "&groupid=$currentgroup"; @@ -107,10 +95,20 @@ $groupparam = ""; } + if ($chat->studentlogs or has_capability('mod/chat:readlog',$context)) { + echo '<div class="reportlink">'; + echo "<a href=\"report.php?id=$cm->id\">". + get_string('viewreport', 'chat').'</a>'; + echo '</div>'; + } + + + print_heading(format_string($chat->name)); + /// Print the main part of the page if (has_capability('mod/chat:chat',$context)) { - print_simple_box_start('center'); + print_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)) { @@ -120,30 +118,32 @@ } link_to_popup_window ($chattarget, - "chat$course->id$chat->id$groupparam", "$strenterchat", 500, 700, get_string('modulename', 'chat')); - print_simple_box_end(); + "chat$course->id$chat->id$groupparam", "<p>$strenterchat</p>", 500, 700, get_string('modulename', 'chat')); // if user is using screen reader, then there is no need to display this link again if ($CFG->chat_method == 'header_js' && empty($USER->screenreader)) { // show frame/js-less alternative - print_simple_box_start('center'); link_to_popup_window ("/mod/chat/gui_basic/index.php?id=$chat->id$groupparam", - "chat$course->id$chat->id$groupparam", '('.get_string('noframesjs', 'message').')', 500, 700, get_string('modulename', 'chat')); - print_simple_box_end(); + "chat$course->id$chat->id$groupparam", '<p>('.get_string('noframesjs', 'message').')</p>', 500, 700, get_string('modulename', 'chat')); } - } else { -/* XXX TODO + + print_box_end(); + + } else if (isguestuser()) { $wwwroot = $CFG->wwwroot.'/login/index.php'; if (!empty($CFG->loginhttps)) { $wwwroot = str_replace('http:','https:', $wwwroot); } notice_yesno(get_string('noguests', 'chat').'<br /><br />'.get_string('liketologin'), - $wwwroot, $_SERVER['HTTP_REFERER']); + $wwwroot, $CFG->wwwroot.'/course/view.php?id='.$course->id); print_footer($course); exit; -*/ + + } else { + // show some error message + require_capability('mod/chat:chat', $context); } diff --git a/mod/choice/db/mysql.sql b/mod/choice/db/mysql.sql deleted file mode 100755 index da0e6448efb..00000000000 --- a/mod/choice/db/mysql.sql +++ /dev/null @@ -1,85 +0,0 @@ -# phpMyAdmin MySQL-Dump -# version 2.2.1 -# http://phpwizard.net/phpMyAdmin/ -# http://phpmyadmin.sourceforge.net/ (download page) -# -# Host: localhost -# Generation Time: Nov 14, 2001 at 04:44 PM -# Server version: 3.23.36 -# PHP Version: 4.0.6 -# Database : `moodle` -# -------------------------------------------------------- - -# -# Table structure for table `choice` -# - -CREATE TABLE prefix_choice ( - id int(10) unsigned NOT NULL auto_increment, - course int(10) unsigned NOT NULL default '0', - name varchar(255) NOT NULL default '', - text text NOT NULL default '', - format tinyint(2) unsigned NOT NULL default '0', - publish tinyint(2) unsigned NOT NULL default '0', - showresults tinyint(2) unsigned NOT NULL default '0', - display tinyint(4) unsigned NOT NULL default '0', - allowupdate tinyint(2) unsigned NOT NULL default '0', - showunanswered tinyint(2) unsigned NOT NULL default '0', - limitanswers tinyint(2) unsigned NOT NULL default '0', - timeopen int(10) unsigned NOT NULL default '0', - timeclose int(10) unsigned NOT NULL default '0', - timemodified int(10) unsigned NOT NULL default '0', - PRIMARY KEY (id), - UNIQUE KEY id (id), - KEY course (course) -) TYPE=MyISAM COMMENT='Available choices are stored here.'; - - -# -------------------------------------------------------- - -# -# Table structure for table `choice_answers` -# - -CREATE TABLE prefix_choice_answers ( - id int(10) unsigned NOT NULL auto_increment, - choiceid int(10) unsigned NOT NULL default '0', - userid int(10) unsigned NOT NULL default '0', - optionid int(10) NOT NULL default '0', - timemodified int(10) NOT NULL default '0', - PRIMARY KEY (id), - UNIQUE KEY id (id), - KEY userid (userid), - KEY choiceid (choiceid) -) TYPE=MyISAM; - - -# -------------------------------------------------------- - -# -# Table structure for table `choice_options` -# - -CREATE TABLE prefix_choice_options ( - id int(10) unsigned NOT NULL auto_increment, - choiceid int(10) unsigned NOT NULL default '0', - `text` text default '', - maxanswers int(10) unsigned NULL default '0', - timemodified int(10) NOT NULL default '0', - PRIMARY KEY (id), - UNIQUE KEY id (id), - KEY choiceid (choiceid) -) TYPE=MyISAM; - -# -# Dumping data for table `log_display` -# - -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('choice', 'view', 'choice', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('choice', 'update', 'choice', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('choice', 'add', 'choice', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('choice', 'report', 'choice', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('choice', 'choose', 'choice', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('choice', 'choose again', 'choice', 'name'); - - diff --git a/mod/choice/db/postgres7.sql b/mod/choice/db/postgres7.sql deleted file mode 100755 index fa226d723e4..00000000000 --- a/mod/choice/db/postgres7.sql +++ /dev/null @@ -1,79 +0,0 @@ -# phpMyAdmin MySQL-Dump -# version 2.2.1 -# http://phpwizard.net/phpMyAdmin/ -# http://phpmyadmin.sourceforge.net/ (download page) -# -# Host: localhost -# Generation Time: Nov 14, 2001 at 04:44 PM -# Server version: 3.23.36 -# PHP Version: 4.0.6 -# Database : `moodle` -# -------------------------------------------------------- - -# -# Table structure for table `choice` -# - -CREATE TABLE prefix_choice ( - id SERIAL PRIMARY KEY, - course integer NOT NULL default '0', - name varchar(255) NOT NULL default '', - text text NOT NULL default '', - format integer NOT NULL default '0', - showunanswered integer NOT NULL default '0', - limitanswers integer NOT NULL default '0', - publish integer NOT NULL default '0', - showresults integer NOT NULL default '0', - display integer NOT NULL default '0', - allowupdate integer NOT NULL default '0', - timeopen integer NOT NULL default '0', - timeclose integer NOT NULL default '0', - timemodified integer NOT NULL default '0' -); - -CREATE INDEX prefix_choice_course_idx ON prefix_choice (course); - -# -------------------------------------------------------- - -# -# Table structure for table `choice_answers` -# - -CREATE TABLE prefix_choice_answers ( - id SERIAL PRIMARY KEY, - choiceid integer NOT NULL default '0', - userid integer NOT NULL default '0', - optionid integer NOT NULL default '0', - timemodified integer NOT NULL default '0' -); - -CREATE INDEX prefix_choice_answers_choice_idx ON prefix_choice_answers (choiceid); -CREATE INDEX prefix_choice_answers_userid_idx ON prefix_choice_answers (userid); - -# -------------------------------------------------------- - -# -# Table structure for table `choice_options` -# - -CREATE TABLE prefix_choice_options ( - id SERIAL PRIMARY KEY, - choiceid integer NOT NULL default '0', - text TEXT, - maxanswers integer NULL default '0', - timemodified integer NOT NULL default '0' -); - -CREATE INDEX prefix_choice_options_choice_idx ON prefix_choice_options (choiceid); - -# -# Dumping data for table `log_display` -# - -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('choice', 'view', 'choice', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('choice', 'update', 'choice', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('choice', 'add', 'choice', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('choice', 'report', 'choice', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('choice', 'choose', 'choice', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('choice', 'choose again', 'choice', 'name'); - diff --git a/mod/choice/lib.php b/mod/choice/lib.php index b0217f4493b..75a4d5cd658 100644 --- a/mod/choice/lib.php +++ b/mod/choice/lib.php @@ -283,12 +283,17 @@ function choice_user_submit_response($formanswer, $choice, $userid, $courseid, $ } -function choice_show_reportlink($choice, $courseid, $cmid) { - $context = get_context_instance(CONTEXT_MODULE, $cmid); - if ( $allanswers = get_records("choice_answers", "choiceid", $choice->id)) { +function choice_show_reportlink($choice, $courseid, $cmid, $groupmode) { + //TODO: rewrite with SQL + $currentgroup = get_current_group($courseid); + if ($allanswers = get_records("choice_answers", "choiceid", $choice->id)) { $responsecount = 0; foreach ($allanswers as $aa) { - if (has_capability('mod/choice:readresponses', $context)) { + if ($groupmode and $currentgroup) { + if (ismember($currentgroup, $aa->userid)) { + $responsecount++; + } + } else { $responsecount++; } } @@ -304,34 +309,34 @@ function choice_show_results($choice, $course, $cm, $forcepublish='') { global $CFG, $COLUMN_HEIGHT, $USER; $context = get_context_instance(CONTEXT_MODULE, $cm->id); + print_heading(get_string("responses", "choice")); + if (empty($forcepublish)) { //alow the publish setting to be overridden $forcepublish = $choice->publish; } - /// Check to see if groups are being used in this choice - if ($groupmode = groupmode($course, $cm)) { // Groups are being used - $currentgroup = setup_and_print_groups($course, $groupmode, $_SERVER['PHP_SELF']."?id=$cm->id"); - } else { - $currentgroup = false; - } + $groupmode = groupmode($course, $cm); + $currentgroup = get_current_group($course->id); - if ($currentgroup) { - $users = get_group_users($currentgroup, "u.firstname ASC", '', 'u.id, u.picture, u.firstname, u.lastname, u.idnumber'); - } else { - $users = get_users_by_capability($context, 'mod/choice:choose', 'u.id, u.picture, u.firstname, u.lastname, u.idnumber', 'u.firstname ASC'); - } + $users = get_users_by_capability($context, 'mod/choice:choose', 'u.id, u.picture, u.firstname, u.lastname, u.idnumber', 'u.firstname ASC', '', '', $currentgroup, '', false); if (!$users) { print_heading(get_string("nousersyet")); } + $answers = array () ; if ($allresponses = get_records("choice_answers", "choiceid", $choice->id)) { foreach ($allresponses as $aa) { - $answers[$aa->userid] = $aa; + //TODO: rewrite with SQL + if ($groupmode and $currentgroup) { + if (ismember($currentgroup, $aa->userid)) { + $answers[$aa->userid] = $aa; + } + } else { + $answers[$aa->userid] = $aa; + } } - } else { - $answers = array () ; } $timenow = time(); @@ -401,10 +406,7 @@ function choice_show_results($choice, $course, $cm, $forcepublish='') { // MDL-7861 echo "<table class=\"choiceresponse\"><tr><td></td></tr>"; foreach ($userlist as $user) { - // this needs to be fixed - // hide admin/editting teacher (users with editting privilages) - // show users without? I could be wrong. - if (!($optionid==0 && has_capability('mod/choice:readresponses', $context, $user->id))) { // make sure admins and hidden teachers are not shown in not answered yet column. + if ($optionid!=0 or has_capability('mod/choice:choose', $context, $user->id, false)) { $columncount[$optionid] += 1; echo "<tr>"; if (has_capability('mod/choice:readresponses', $context) && $optionid!=0) { @@ -494,7 +496,7 @@ function choice_show_results($choice, $course, $cm, $forcepublish='') { } $column[$optionid] = 0; foreach ($userlist as $user) { - if (!($optionid==0 && has_capability('mod/choice:readresponses', $context, $user->id))) { //make sure admins and hidden teachers are not shown in not answered yet column. + if ($optionid!=0 or has_capability('mod/choice:choose', $context, $user->id, false)) { $column[$optionid]++; } } diff --git a/mod/data/db/mysql.sql b/mod/data/db/mysql.sql deleted file mode 100755 index 13cbf8b81c4..00000000000 --- a/mod/data/db/mysql.sql +++ /dev/null @@ -1,118 +0,0 @@ -# -- phpMyAdmin SQL Dump -# -- version 2.6.2 -# -- http://www.phpmyadmin.net -# -- -# -- Host: localhost -# -- Generation Time: Aug 25, 2005 at 03:52 PM -# -- Server version: 3.23.54 -# -- PHP Version: 4.2.2 -# -- - -# -- -------------------------------------------------------- - -CREATE TABLE prefix_data ( - id int(10) unsigned NOT NULL auto_increment, - course int(10) unsigned NOT NULL default '0', - name varchar(255) NOT NULL default '', - intro text NOT NULL default '', - comments int(4) unsigned NOT NULL default '0', - timeavailablefrom int(10) unsigned NOT NULL default '0', - timeavailableto int(10) unsigned NOT NULL default '0', - timeviewfrom int(10) unsigned NOT NULL default '0', - timeviewto int(10) unsigned NOT NULL default '0', - requiredentries int(8) unsigned NOT NULL default '0', - requiredentriestoview int(8) unsigned NOT NULL default '0', - maxentries int(8) unsigned NOT NULL default '0', - rssarticles int(4) unsigned NOT NULL default '0', - singletemplate text, - listtemplate text, - listtemplateheader text, - listtemplatefooter text, - addtemplate text, - rsstemplate text, - rsstitletemplate text, - csstemplate text, - jstemplate text, - approval tinyint(4) unsigned NOT NULL default '0', - scale int(10) NOT NULL default '0', - assessed int(10) unsigned NOT NULL default '0', - defaultsort int(10) unsigned NOT NULL default '0', - defaultsortdir tinyint(4) unsigned NOT NULL default '0', - editany tinyint(4) unsigned NOT NULL default '0', - PRIMARY KEY (id) -) TYPE=MyISAM COMMENT='Defines settings for each Database activity'; - - -CREATE TABLE prefix_data_content ( - id int(10) unsigned NOT NULL auto_increment, - fieldid int(10) unsigned NOT NULL default '0', - recordid int(10) unsigned NOT NULL default '0', - content longtext, - content1 longtext, - content2 longtext, - content3 longtext, - content4 longtext, - PRIMARY KEY (id) -) TYPE=MyISAM; - - -CREATE TABLE prefix_data_fields ( - id int(10) unsigned NOT NULL auto_increment, - dataid int(10) unsigned NOT NULL default '0', - type varchar(255) NOT NULL default '', - name varchar(255) NOT NULL default '', - description text NOT NULL default '', - param1 text, - param2 text, - param3 text, - param4 text, - param5 text, - param6 text, - param7 text, - param8 text, - param9 text, - param10 text, - PRIMARY KEY (id) -) TYPE=MyISAM; - - -CREATE TABLE prefix_data_records ( - id int(10) unsigned NOT NULL auto_increment, - userid int(10) unsigned NOT NULL default '0', - groupid int(10) unsigned NOT NULL default '0', - dataid int(10) unsigned NOT NULL default '0', - timecreated int(10) unsigned NOT NULL default '0', - timemodified int(10) unsigned NOT NULL default '0', - approved tinyint(4) unsigned NOT NULL default '0', - PRIMARY KEY (id) -) TYPE=MyISAM; - - -CREATE TABLE prefix_data_comments ( - id int(10) unsigned NOT NULL auto_increment, - userid int(10) unsigned NOT NULL default '0', - recordid int(10) unsigned NOT NULL default '0', - content text NOT NULL default '', - created int(10) unsigned NOT NULL default '0', - modified int(10) unsigned NOT NULL default '0', - PRIMARY KEY (id) -) TYPE=MyISAM; - - -CREATE TABLE prefix_data_ratings ( - id int(10) unsigned NOT NULL auto_increment, - userid int(10) unsigned NOT NULL default '0', - recordid int(10) unsigned NOT NULL default '0', - rating int(10) unsigned NOT NULL default '0', - PRIMARY KEY (id) -) TYPE=MyISAM; - - -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('data', 'view', 'data', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('data', 'add', 'data', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('data', 'update', 'data', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('data', 'record delete', 'data', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('data', 'fields add', 'data_fields', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('data', 'fields update', 'data_fields', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('data', 'templates saved', 'data', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('data', 'templates def', 'data', 'name'); diff --git a/mod/data/db/postgres7.sql b/mod/data/db/postgres7.sql deleted file mode 100755 index e5413dca8d7..00000000000 --- a/mod/data/db/postgres7.sql +++ /dev/null @@ -1,100 +0,0 @@ - -CREATE TABLE prefix_data ( - id SERIAL PRIMARY KEY, - course integer NOT NULL default '0', - name varchar(255) NOT NULL default '', - intro text NOT NULL default '', - comments integer NOT NULL default '0', - timeavailablefrom integer NOT NULL default '0', - timeavailableto integer NOT NULL default '0', - timeviewfrom integer NOT NULL default '0', - timeviewto integer NOT NULL default '0', - requiredentries integer NOT NULL default '0', - requiredentriestoview integer NOT NULL default '0', - maxentries integer NOT NULL default '0', - rssarticles integer NOT NULL default '0', - singletemplate text, - listtemplate text, - listtemplateheader text, - listtemplatefooter text, - addtemplate text, - rsstemplate text, - rsstitletemplate text, - csstemplate text, - jstemplate text, - approval integer NOT NULL default '0', - scale integer NOT NULL default '0', - assessed integer NOT NULL default '0', - defaultsort integer NOT NULL default '0', - defaultsortdir integer NOT NULL default '0', - editany integer NOT NULL default '0' -); - - - -CREATE TABLE prefix_data_content ( - id SERIAL PRIMARY KEY, - fieldid integer NOT NULL default '0', - recordid integer NOT NULL default '0', - content text, - content1 text, - content2 text, - content3 text, - content text4 -); - - -CREATE TABLE prefix_data_fields ( - id SERIAL PRIMARY KEY, - dataid integer NOT NULL default '0', - type varchar(255) NOT NULL default '', - name varchar(255) NOT NULL default '', - description text NOT NULL default '', - param1 text, - param2 text, - param3 text, - param4 text, - param5 text, - param6 text, - param7 text, - param8 text, - param9 text, - param10 text -); - -CREATE TABLE prefix_data_records ( - id SERIAL PRIMARY KEY, - userid integer NOT NULL default '0', - groupid integer NOT NULL default '0', - dataid integer NOT NULL default '0', - timecreated integer NOT NULL default '0', - timemodified integer NOT NULL default '0', - approved integer NOT NULL default '0' -); - - -CREATE TABLE prefix_data_comments ( - id SERIAL PRIMARY KEY, - userid integer NOT NULL default '0', - recordid integer NOT NULL default '0', - content text NOT NULL default '', - created integer NOT NULL default '0', - modified integer NOT NULL default '0' -); - - -CREATE TABLE prefix_data_ratings ( - id SERIAL PRIMARY KEY, - userid integer NOT NULL default '0', - recordid integer NOT NULL default '0', - rating integer NOT NULL default '0' -); - -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('data', 'view', 'data', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('data', 'add', 'data', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('data', 'update', 'data', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('data', 'record delete', 'data', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('data', 'fields add', 'data_fields', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('data', 'fields update', 'data_fields', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('data', 'templates saved', 'data', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('data', 'templates def', 'data', 'name'); diff --git a/mod/exercise/db/mysql.sql b/mod/exercise/db/mysql.sql deleted file mode 100644 index b6f40b58bd0..00000000000 --- a/mod/exercise/db/mysql.sql +++ /dev/null @@ -1,128 +0,0 @@ -# -# Table structure for table `exercise` -# - -CREATE TABLE `prefix_exercise` ( - `id` int(10) unsigned NOT NULL auto_increment, - `course` int(10) unsigned NOT NULL default '0', - `name` varchar(255) NOT NULL default '', - `nelements` tinyint(3) unsigned NOT NULL default '1', - `phase` tinyint(3) unsigned NOT NULL default '0', - `gradingstrategy` tinyint(3) unsigned NOT NULL default '1', - `usemaximum` tinyint(3) unsigned NOT NULL default '0', - `assessmentcomps` tinyint(3) unsigned NOT NULL default '2', - `anonymous` tinyint(3) unsigned NOT NULL default '1', - `maxbytes` int(10) unsigned NOT NULL default '100000', - `deadline` int(10) unsigned NOT NULL default '0', - `timemodified` int(10) unsigned NOT NULL default '0', - `grade` tinyint(3) NOT NULL default '0', - `gradinggrade` tinyint(3) NOT NULL default '0', - `showleaguetable` tinyint(3) unsigned NOT NULL default '0', - `usepassword` tinyint(3) unsigned NOT NULL default '0', - `password` varchar(32) NOT NULL default '', - PRIMARY KEY (`id`), - KEY `course` (`course`) -) COMMENT='Defines exercise'; -# -------------------------------------------------------- - -# -# Table structure for table `exercise_submissions` -# - -CREATE TABLE `prefix_exercise_submissions` ( - `id` int(10) unsigned NOT NULL auto_increment, - `exerciseid` int(10) unsigned NOT NULL default '0', - `userid` int(10) unsigned NOT NULL default '0', - `title` varchar(100) NOT NULL default '', - `timecreated` int(10) unsigned NOT NULL default '0', - `resubmit` tinyint(3) unsigned NOT NULL default '0', - `mailed` tinyint(3) unsigned NOT NULL default '0', - `isexercise` tinyint(3) unsigned NOT NULL default '0', - `late` tinyint(3) unsigned NOT NULL default '0', - PRIMARY KEY (`id`), - INDEX `userid` (`userid`), - INDEX `exerciseid` (`exerciseid`) -) COMMENT='Info about submitted work from teacher and students'; -# -------------------------------------------------------- - -# -# Table structure for table `exercise_assessments` -# - -CREATE TABLE `prefix_exercise_assessments` ( - `id` int(10) unsigned NOT NULL auto_increment, - `exerciseid` int(10) unsigned NOT NULL default '0', - `submissionid` int(10) unsigned NOT NULL default '0', - `userid` int(10) unsigned NOT NULL default '0', - `timecreated` int(10) unsigned NOT NULL default '0', - `timegraded` int(10) unsigned NOT NULL default '0', - `grade` float NOT NULL default '0', - `gradinggrade` int(3) NOT NULL default '0', - `mailed` tinyint(2) unsigned NOT NULL default '0', - `generalcomment` text NOT NULL default '', - `teachercomment` text NOT NULL default '', - PRIMARY KEY (`id`), - INDEX (`submissionid`), - INDEX (`userid`), - INDEX (`exerciseid`) - ) COMMENT='Info about assessments by teacher and students'; -# -------------------------------------------------------- - -# -# Table structure for table `exercise_elements` -# - -CREATE TABLE `prefix_exercise_elements` ( - `id` int(10) unsigned NOT NULL auto_increment, - `exerciseid` int(10) unsigned NOT NULL default '0', - `elementno` tinyint(3) unsigned NOT NULL default '0', - `description` text NOT NULL default '', - `scale` tinyint(3) unsigned NOT NULL default '0', - `maxscore` tinyint(3) unsigned NOT NULL default '1', - `weight` tinyint(3) unsigned NOT NULL default '11', - PRIMARY KEY (`id`), - KEY `exerciseid` (`exerciseid`) -) COMMENT='Info about marking scheme of assignment'; -# -------------------------------------------------------- - - -# -# Table structure for table `exercise_rubrics` -# - -CREATE TABLE `prefix_exercise_rubrics` ( - `id` int(10) unsigned NOT NULL auto_increment, - `exerciseid` int(10) unsigned NOT NULL default '0', - `elementno` int(10) unsigned NOT NULL default '0', - `rubricno` tinyint(3) unsigned NOT NULL default '0', - `description` text NOT NULL default '', - PRIMARY KEY (`id`), - KEY `exerciseid` (`exerciseid`) -) COMMENT='Info about the rubrics marking scheme'; -# -------------------------------------------------------- - -# -# Table structure for table `exercise_grades` -# - -CREATE TABLE `prefix_exercise_grades` ( - `id` int(10) unsigned NOT NULL auto_increment, - `exerciseid` int(10) unsigned NOT NULL default '0', - `assessmentid` int(10) unsigned NOT NULL default '0', - `elementno` int(10) unsigned NOT NULL default '0', - `feedback` text NOT NULL default '', - `grade` tinyint(3) NOT NULL default '0', - PRIMARY KEY (`id`), - INDEX (`assessmentid`), - INDEX `exerciseid` (`exerciseid`) -) COMMENT='Info about individual grades given to each element'; -# -------------------------------------------------------- - - - -INSERT INTO `prefix_log_display` (module, action, mtable, field) VALUES ('exercise', 'close', 'exercise', 'name'); -INSERT INTO `prefix_log_display` (module, action, mtable, field) VALUES ('exercise', 'open', 'exercise', 'name'); -INSERT INTO `prefix_log_display` (module, action, mtable, field) VALUES ('exercise', 'submit', 'exercise', 'name'); -INSERT INTO `prefix_log_display` (module, action, mtable, field) VALUES ('exercise', 'view', 'exercise', 'name'); -INSERT INTO `prefix_log_display` (module, action, mtable, field) VALUES ('exercise', 'update', 'exercise', 'name'); - diff --git a/mod/exercise/db/postgres7.sql b/mod/exercise/db/postgres7.sql deleted file mode 100644 index 112a78bbfb0..00000000000 --- a/mod/exercise/db/postgres7.sql +++ /dev/null @@ -1,127 +0,0 @@ -# -# Table structure for table exercise -# - -CREATE TABLE prefix_exercise ( - id SERIAL8 PRIMARY KEY, - course INT8 NOT NULL default '0', - name varchar(255) NOT NULL default '', - nelements INT NOT NULL default '1', - phase INT NOT NULL default '0', - gradingstrategy INT NOT NULL default '1', - usemaximum INT NOT NULL default '0', - assessmentcomps INT NOT NULL default '2', - anonymous INT NOT NULL default '0', - maxbytes INT8 NOT NULL default '100000', - deadline INT8 NOT NULL default '0', - timemodified INT8 NOT NULL default '0', - grade INT NOT NULL default '0', - gradinggrade INT NOT NULL default '0', - showleaguetable INT NOT NULL default '0', - usepassword INT4 NOT NULL default '0', - password VARCHAR(32) NOT NULL default '' - -); - -CREATE INDEX prefix_exercise_course_idx ON prefix_exercise (course); - -# -------------------------------------------------------- - -# -# Table structure for table exercise_submissions -# - -CREATE TABLE prefix_exercise_submissions ( - id SERIAL8 PRIMARY KEY, - exerciseid INT8 NOT NULL default '0', - userid INT8 NOT NULL default '0', - title varchar(100) NOT NULL default '', - timecreated INT8 NOT NULL default '0', - resubmit INT NOT NULL default '0', - mailed INT NOT NULL default '0', - isexercise INT NOT NULL default '0' -); -CREATE INDEX prefix_exercise_submissions_userid_idx ON prefix_exercise_submissions (userid); -CREATE INDEX prefix_exercise_submissions_exerciseid_idx ON prefix_exercise_submissions (exerciseid); - -# -------------------------------------------------------- - -# -# Table structure for table exercise_assessments -# - -CREATE TABLE prefix_exercise_assessments ( - id SERIAL8 PRIMARY KEY, - exerciseid INT8 NOT NULL default '0', - submissionid INT8 NOT NULL default '0', - userid INT8 NOT NULL default '0', - timecreated INT8 NOT NULL default '0', - timegraded INT8 NOT NULL default '0', - grade float NOT NULL default '0', - gradinggrade INT NOT NULL default '0', - mailed INT2 NOT NULL default '0', - generalcomment text NOT NULL default '', - teachercomment text NOT NULL default '' - ); -# -------------------------------------------------------- -CREATE INDEX prefix_exercise_assessments_submissionid_idx ON prefix_exercise_assessments (submissionid); -CREATE INDEX prefix_exercise_assessments_userid_idx ON prefix_exercise_assessments (userid); -CREATE INDEX prefix_exercise_assessments_exerciseid_idx ON prefix_exercise_assessments (exerciseid); - -# Table structure for table exercise_elements -# - -CREATE TABLE prefix_exercise_elements ( - id SERIAL8 PRIMARY KEY, - exerciseid INT8 NOT NULL default '0', - elementno INT NOT NULL default '0', - description text NOT NULL, - scale INT NOT NULL default '0', - maxscore INT NOT NULL default '1', - weight INT NOT NULL default '11' -); -# -------------------------------------------------------- - - -# -# Table structure for table exercise_rubrics -# - -CREATE TABLE prefix_exercise_rubrics ( - id SERIAL8 PRIMARY KEY, - exerciseid INT8 NOT NULL default '0', - elementno INT8 NOT NULL default '0', - rubricno INT NOT NULL default '0', - description text NOT NULL -); - -CREATE INDEX prefix_exercise_rubrics_exerciseid_idx ON prefix_exercise_rubrics (exerciseid); - -# -------------------------------------------------------- - -# -# Table structure for table exercise_grades -# - -CREATE TABLE prefix_exercise_grades ( - id SERIAL8 PRIMARY KEY, - exerciseid INT8 NOT NULL default '0', - assessmentid INT8 NOT NULL default '0', - elementno INT8 NOT NULL default '0', - feedback text NOT NULL default '', - grade INT NOT NULL default '0' -); - -CREATE INDEX prefix_exercise_grades_assessmentid_idx ON prefix_exercise_grades (assessmentid); -CREATE INDEX prefix_exercise_grades_exerciseid_idx ON prefix_exercise_grades (exerciseid); - -# -------------------------------------------------------- - - - -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('exercise', 'close', 'exercise', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('exercise', 'open', 'exercise', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('exercise', 'submit', 'exercise', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('exercise', 'view', 'exercise', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('exercise', 'update', 'exercise', 'name'); - diff --git a/mod/forum/db/mysql.sql b/mod/forum/db/mysql.sql deleted file mode 100644 index 549a6cb06b6..00000000000 --- a/mod/forum/db/mysql.sql +++ /dev/null @@ -1,170 +0,0 @@ -# -# Table structure for table `forum` -# - -CREATE TABLE prefix_forum ( - id int(10) unsigned NOT NULL auto_increment, - course int(10) unsigned NOT NULL default '0', - type enum('single','news','general','social','eachuser','teacher','qanda') NOT NULL default 'general', - name varchar(255) NOT NULL default '', - intro text NOT NULL default '', - assessed int(10) unsigned NOT NULL default '0', - assesstimestart int(10) unsigned NOT NULL default '0', - assesstimefinish int(10) unsigned NOT NULL default '0', - scale int(10) NOT NULL default '0', - maxbytes int(10) unsigned NOT NULL default '0', - forcesubscribe tinyint(1) unsigned NOT NULL default '0', - trackingtype tinyint(2) unsigned NOT NULL default '1', - rsstype tinyint(2) unsigned NOT NULL default '0', - rssarticles tinyint(2) unsigned NOT NULL default '0', - timemodified int(10) unsigned NOT NULL default '0', - warnafter int(10) unsigned NOT NULL default '0', - blockafter int(10) unsigned NOT NULL default '0', - blockperiod int(10) unsigned NOT NULL default '0', - PRIMARY KEY (id), - UNIQUE KEY id (id), - KEY course (course) -) COMMENT='Forums contain and structure discussion'; -# -------------------------------------------------------- - -# -# Table structure for table `forum_discussions` -# - -CREATE TABLE prefix_forum_discussions ( - id int(10) unsigned NOT NULL auto_increment, - course int(10) unsigned NOT NULL default '0', - forum int(10) unsigned NOT NULL default '0', - name varchar(255) NOT NULL default '', - firstpost int(10) unsigned NOT NULL default '0', - userid int(10) unsigned NOT NULL default '0', - groupid int(10) NOT NULL default '-1', - assessed tinyint(1) NOT NULL default '1', - timemodified int(10) unsigned NOT NULL default '0', - usermodified int(10) unsigned NOT NULL default '0', - timestart int(10) unsigned NOT NULL default '0', - timeend int(10) unsigned NOT NULL default '0', - PRIMARY KEY (id), - KEY prefix_forum_discussions_forum_idx (forum), - KEY prefix_forum_discussions_userid_idx (userid) -) COMMENT='Forums are composed of discussions'; -# -------------------------------------------------------- - -# -# Table structure for table `forum_posts` -# - -CREATE TABLE prefix_forum_posts ( - id int(10) unsigned NOT NULL auto_increment, - discussion int(10) unsigned NOT NULL default '0', - parent int(10) unsigned NOT NULL default '0', - userid int(10) unsigned NOT NULL default '0', - created int(10) unsigned NOT NULL default '0', - modified int(10) unsigned NOT NULL default '0', - mailed tinyint(2) unsigned NOT NULL default '0', - subject varchar(255) NOT NULL default '', - message text NOT NULL default '', - format tinyint(2) NOT NULL default '0', - attachment VARCHAR(100) NOT NULL default '', - totalscore tinyint(4) NOT NULL default '0', - mailnow int(10) unsigned NOT NULL default '0', - PRIMARY KEY (id), - KEY prefix_forum_posts_parent_idx (parent), - KEY prefix_forum_posts_discussion_idx (discussion), - KEY prefix_forum_posts_userid_idx (userid), - KEY prefix_forum_posts_created_idx (created), - KEY prefix_forum_posts_mailed_idx (mailed) -) COMMENT='All posts are stored in this table'; -# -------------------------------------------------------- - -# -# Table structure for table `forum_queue` -# - -CREATE TABLE prefix_forum_queue ( - id int(10) unsigned NOT NULL auto_increment, - userid int(10) unsigned NOT NULL default 0, - discussionid int(10) unsigned NOT NULL default 0, - postid int(10) unsigned NOT NULL default 0, - PRIMARY KEY (id), - KEY user (userid), - KEY post (postid) -) COMMENT='For keeping track of posts that will be mailed in digest form'; -# -------------------------------------------------------- - -# -# Table structure for table `forum_ratings` -# - -CREATE TABLE prefix_forum_ratings ( - id int(10) unsigned NOT NULL auto_increment, - userid int(10) unsigned NOT NULL default '0', - post int(10) unsigned NOT NULL default '0', - time int(10) unsigned NOT NULL default '0', - rating tinyint(4) NOT NULL default '0', - PRIMARY KEY (id), - KEY userid (userid), - KEY post (post) -) COMMENT='Contains user ratings for individual posts'; -# -------------------------------------------------------- - -# -# Table structure for table `forum_subscriptions` -# - -CREATE TABLE prefix_forum_subscriptions ( - id int(10) unsigned NOT NULL auto_increment, - userid int(10) unsigned NOT NULL default '0', - forum int(10) unsigned NOT NULL default '0', - PRIMARY KEY (id), - UNIQUE KEY id (id), - KEY userid (userid), - KEY forum (forum) -) COMMENT='Keeps track of who is subscribed to what forum'; -# -------------------------------------------------------- - -# -# Table structure for table `forum_read` -# - -CREATE TABLE prefix_forum_read ( - `id` int(10) unsigned NOT NULL auto_increment, - `userid` int(10) NOT NULL default '0', - `forumid` int(10) NOT NULL default '0', - `discussionid` int(10) NOT NULL default '0', - `postid` int(10) NOT NULL default '0', - `firstread` int(10) NOT NULL default '0', - `lastread` int(10) NOT NULL default '0', - PRIMARY KEY (`id`), - KEY `prefix_forum_user_forum_idx` (`userid`,`forumid`), - KEY `prefix_forum_user_discussion_idx` (`userid`,`discussionid`), - KEY `prefix_forum_user_post_idx` (`userid`,`postid`) -) COMMENT='Tracks each users read posts'; - -# -# Table structure for table `forum_track_prefs` -# -CREATE TABLE prefix_forum_track_prefs ( - `id` int(10) unsigned NOT NULL auto_increment, - `userid` int(10) NOT NULL default '0', - `forumid` int(10) NOT NULL default '0', - PRIMARY KEY (`id`), - KEY `user_forum_idx` (`userid`,`forumid`) -) COMMENT='Tracks each users untracked forums.'; - -# -# Dumping data for table `log_display` -# - -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('forum', 'add', 'forum', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('forum', 'update', 'forum', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('forum', 'add discussion', 'forum_discussions', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('forum', 'add post', 'forum_posts', 'subject'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('forum', 'update post', 'forum_posts', 'subject'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('forum', 'user report', 'user', 'CONCAT(firstname,\' \',lastname)'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('forum', 'move discussion', 'forum_discussions', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('forum', 'view subscribers', 'forum', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('forum', 'view discussion', 'forum_discussions', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('forum', 'view forum', 'forum', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('forum', 'subscribe', 'forum', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('forum', 'unsubscribe', 'forum', 'name'); diff --git a/mod/forum/db/postgres7.sql b/mod/forum/db/postgres7.sql deleted file mode 100644 index 37fbe17d215..00000000000 --- a/mod/forum/db/postgres7.sql +++ /dev/null @@ -1,182 +0,0 @@ -# -# Table structure for table `forum` -# - -CREATE TABLE prefix_forum ( - id SERIAL PRIMARY KEY, - course integer NOT NULL default '0', - type varchar(10) CHECK (type IN ('single','news','general','social','eachuser','teacher','qanda')) NOT NULL default 'general', - name varchar(255) NOT NULL default '', - intro text NOT NULL default '', - assessed integer NOT NULL default '0', - assesstimestart integer NOT NULL default '0', - assesstimefinish integer NOT NULL default '0', - scale integer NOT NULL default '0', - maxbytes integer NOT NULL default '0', - forcesubscribe integer NOT NULL default '0', - trackingtype integer NOT NULL default '1', - rsstype integer NOT NULL default '0', - rssarticles integer NOT NULL default '0', - timemodified integer NOT NULL default '0', - warnafter integer NOT NULL default '0', - blockafter integer NOT NULL default '0', - blockperiod integer NOT NULL default '0' -); - -CREATE INDEX prefix_forum_course_idx ON prefix_forum (course); -# -------------------------------------------------------- - -# -# Table structure for table `forum_discussions` -# - -CREATE TABLE prefix_forum_discussions ( - id SERIAL PRIMARY KEY, - course integer NOT NULL default '0', - forum integer NOT NULL default '0', - name varchar(255) NOT NULL default '', - firstpost integer NOT NULL default '0', - userid integer NOT NULL default '0', - groupid integer NOT NULL default '0', - assessed integer NOT NULL default '1', - timemodified integer NOT NULL default '0', - usermodified integer NOT NULL default '0', - timestart integer NOT NULL default '0', - timeend integer NOT NULL default '0' -); - -CREATE INDEX prefix_forum_discussions_forum_idx ON prefix_forum_discussions (forum); -CREATE INDEX prefix_forum_discussions_userid_idx ON prefix_forum_discussions (userid); - -# -------------------------------------------------------- - -# -# Table structure for table `forum_posts` -# - -CREATE TABLE prefix_forum_posts ( - id SERIAL PRIMARY KEY, - discussion integer NOT NULL default '0', - parent integer NOT NULL default '0', - userid integer NOT NULL default '0', - created integer NOT NULL default '0', - modified integer NOT NULL default '0', - mailed integer NOT NULL default '0', - subject varchar(255) NOT NULL default '', - message text NOT NULL default '', - format integer NOT NULL default '0', - attachment VARCHAR(100) NOT NULL default '', - totalscore integer NOT NULL default '0', - mailnow integer NOT NULL default '0' -); - -CREATE INDEX prefix_forum_posts_discussion_idx ON prefix_forum_posts (discussion); -CREATE INDEX prefix_forum_posts_parent_idx ON prefix_forum_posts (parent); -CREATE INDEX prefix_forum_posts_userid_idx ON prefix_forum_posts (userid); -CREATE INDEX prefix_forum_posts_created_idx ON prefix_forum_posts (created); -CREATE INDEX prefix_forum_posts_mailed_idx ON prefix_forum_posts (mailed); - -# -------------------------------------------------------- - -# -# Table structure for table `forum_queue` -# - -CREATE TABLE prefix_forum_queue ( - id SERIAL PRIMARY KEY, - userid integer default 0 NOT NULL, - discussionid integer default 0 NOT NULL, - postid integer default 0 NOT NULL -); - -CREATE INDEX prefix_forum_queue_userid_idx ON prefix_forum_queue (userid); -CREATE INDEX prefix_forum_queue_discussion_idx ON prefix_forum_queue (discussionid); -CREATE INDEX prefix_forum_queue_postid_idx ON prefix_forum_queue (postid); - -# -------------------------------------------------------- - -# -# Table structure for table `forum_ratings` -# - -CREATE TABLE prefix_forum_ratings ( - id SERIAL PRIMARY KEY, - userid integer NOT NULL default '0', - post integer NOT NULL default '0', - time integer NOT NULL default '0', - rating integer NOT NULL default '0' -); - -CREATE INDEX prefix_forum_ratings_userid_idx ON prefix_forum_ratings (userid); -CREATE INDEX prefix_forum_ratings_post_idx ON prefix_forum_ratings (post); - -# -------------------------------------------------------- - -# -# Table structure for table `forum_subscriptions` -# - -CREATE TABLE prefix_forum_subscriptions ( - id SERIAL PRIMARY KEY, - userid integer NOT NULL default '0', - forum integer NOT NULL default '0' -); - -CREATE INDEX prefix_forum_subscriptions_userid_idx ON prefix_forum_subscriptions (userid); -CREATE INDEX prefix_forum_subscriptions_forum_idx ON prefix_forum_subscriptions (forum); - -# -------------------------------------------------------- - - -# -# Table structure for table `forum_read` -# - -CREATE TABLE prefix_forum_read ( - id SERIAL PRIMARY KEY, - userid integer NOT NULL default '0', - forumid integer NOT NULL default '0', - discussionid integer NOT NULL default '0', - postid integer NOT NULL default '0', - firstread integer NOT NULL default '0', - lastread integer NOT NULL default '0' -); - -CREATE INDEX prefix_forum_user_forum_idx ON prefix_forum_read (userid, forumid); -CREATE INDEX prefix_forum_user_discussion_idx ON prefix_forum_read (userid, discussionid); -CREATE INDEX prefix_forum_user_post_idx ON prefix_forum_read (userid, postid); - - -# -------------------------------------------------------- - - -# -# Table structure for table `forum_track_prefs` -# - -CREATE TABLE prefix_forum_track_prefs ( - id SERIAL PRIMARY KEY, - userid integer NOT NULL default '0', - forumid integer NOT NULL default '0' -); - -CREATE INDEX prefix_forum_track_user_forum_idx ON prefix_forum_track_prefs (userid, forumid); - - -# -------------------------------------------------------- -# -# Dumping data for table `log_display` -# - -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('forum', 'add', 'forum', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('forum', 'update', 'forum', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('forum', 'add discussion', 'forum_discussions', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('forum', 'add post', 'forum_posts', 'subject'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('forum', 'update post', 'forum_posts', 'subject'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('forum', 'user report', 'user', 'firstname||\' \'||lastname'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('forum', 'move discussion', 'forum_discussions', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('forum', 'view subscribers', 'forum', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('forum', 'view discussion', 'forum_discussions', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('forum', 'view forum', 'forum', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('forum', 'subscribe', 'forum', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('forum', 'unsubscribe', 'forum', 'name'); diff --git a/mod/glossary/db/mysql.sql b/mod/glossary/db/mysql.sql deleted file mode 100644 index a4c7bbf53a1..00000000000 --- a/mod/glossary/db/mysql.sql +++ /dev/null @@ -1,165 +0,0 @@ -# This file contains a complete database schema for all the -# tables used by this module, written in SQL - -# It may also contain INSERT statements for particular data -# that may be used, especially new entries in the table log_display - -# -# Table structure for table `glossary` -# - -CREATE TABLE prefix_glossary ( - id int(10) unsigned NOT NULL auto_increment, - course int(10) unsigned NOT NULL default '0', - name varchar(255) NOT NULL default '', - intro text NOT NULL default '', - studentcanpost tinyint(2) unsigned NOT NULL default '0', - allowduplicatedentries tinyint(2) unsigned NOT NULL default '0', - displayformat varchar(50) NOT NULL default 'dictionary', - mainglossary tinyint(2) unsigned NOT NULL default '0', - showspecial tinyint(2) unsigned NOT NULL default '1', - showalphabet tinyint(2) unsigned NOT NULL default '1', - showall tinyint(2) unsigned NOT NULL default '1', - allowcomments tinyint(2) unsigned NOT NULL default '0', - allowprintview tinyint(2) unsigned NOT NULL default '1', - usedynalink tinyint(2) unsigned NOT NULL default '1', - defaultapproval tinyint(2) unsigned NOT NULL default '1', - globalglossary tinyint(2) unsigned NOT NULL default '0', - entbypage tinyint(3) unsigned NOT NULL default '10', - editalways tinyint(2) unsigned NOT NULL default '0', - rsstype tinyint(2) unsigned NOT NULL default '0', - rssarticles tinyint(2) unsigned NOT NULL default '0', - assessed int(10) unsigned NOT NULL default '0', - assesstimestart int(10) unsigned NOT NULL default '0', - assesstimefinish int(10) unsigned NOT NULL default '0', - scale int(10) NOT NULL default '0', - timecreated int(10) unsigned NOT NULL default '0', - timemodified int(10) unsigned NOT NULL default '0', - PRIMARY KEY (id), - KEY course (course) -) TYPE=MyISAM COMMENT='all glossaries'; - -# -# Table structure for table `glossary_entries` -# - -CREATE TABLE prefix_glossary_entries ( - id int(10) unsigned NOT NULL auto_increment, - glossaryid int(10) unsigned NOT NULL default '0', - userid int(10) unsigned NOT NULL default '0', - concept varchar(255) NOT NULL default '', - definition text NOT NULL default '', - format tinyint(2) unsigned NOT NULL default '0', - attachment VARCHAR(100) NOT NULL default '', - timecreated int(10) unsigned NOT NULL default '0', - timemodified int(10) unsigned NOT NULL default '0', - teacherentry tinyint(2) unsigned NOT NULL default '0', - sourceglossaryid int(10) unsigned NOT NULL default '0', - usedynalink tinyint(2) unsigned NOT NULL default '1', - casesensitive tinyint(2) unsigned NOT NULL default '0', - fullmatch tinyint(2) unsigned NOT NULL default '1', - approved tinyint(2) unsigned NOT NULL default '1', - PRIMARY KEY (id), - KEY glossaryid (glossaryid), - KEY userid (userid), - KEY concept (concept) -) TYPE=MyISAM COMMENT='all glossary entries'; - -# -# Table structure for table `glossary_alias` -# - -CREATE TABLE prefix_glossary_alias ( - id int(10) unsigned NOT NULL auto_increment, - entryid int(10) unsigned NOT NULL default '0', - alias varchar(255) NOT NULL default '', - PRIMARY KEY (id), - KEY entryid (entryid) -) TYPE=MyISAM COMMENT='entries alias'; - -# -# Table structure for table `glossary_cageories` -# - -CREATE TABLE prefix_glossary_categories ( - id int(10) unsigned NOT NULL auto_increment, - glossaryid int(10) unsigned NOT NULL default '0', - name varchar(255) NOT NULL default '', - usedynalink tinyint(2) unsigned NOT NULL default '1', - PRIMARY KEY (id), - KEY glossaryid (glossaryid) -) TYPE=MyISAM COMMENT='all categories for glossary entries'; - -# -# Table structure for table `glossary_entries_category` -# - -CREATE TABLE prefix_glossary_entries_categories ( - id int(10) unsigned NOT NULL auto_increment, - categoryid int(10) unsigned NOT NULL default '0', - entryid int(10) unsigned NOT NULL default '0', - PRIMARY KEY (id), - KEY entryid (entryid), - KEY categoryid (categoryid) -) TYPE=MyISAM COMMENT='categories of each glossary entry'; - -CREATE TABLE prefix_glossary_comments ( - id int(10) unsigned NOT NULL auto_increment, - entryid int(10) unsigned NOT NULL default '0', - userid int(10) unsigned NOT NULL default '0', - entrycomment text NOT NULL default '', - format tinyint(2) unsigned NOT NULL default '0', - timemodified int(10) unsigned NOT NULL default '0', - PRIMARY KEY (id), - KEY userid (userid), - KEY entryid (entryid) -) TYPE=MyISAM COMMENT='comments on glossary entries'; - -CREATE TABLE prefix_glossary_formats ( - id int(10) unsigned NOT NULL auto_increment, - name varchar(50) NOT NULL default '', - popupformatname varchar(50) NOT NULL default '', - visible tinyint(2) unsigned NOT NULL default '1', - showgroup tinyint(2) unsigned NOT NULL default '1', - defaultmode varchar(50) NOT NULL default '', - defaulthook varchar(50) NOT NULL default '', - sortkey varchar(50) NOT NULL default '', - sortorder varchar(50) NOT NULL default '', - PRIMARY KEY (id) -) TYPE=MyISAM COMMENT='Setting of the display formats'; - -# -# Table structure for table `forum_ratings` -# - -CREATE TABLE prefix_glossary_ratings ( - id int(10) unsigned NOT NULL auto_increment, - userid int(10) unsigned NOT NULL default '0', - entryid int(10) unsigned NOT NULL default '0', - time int(10) unsigned NOT NULL default '0', - rating tinyint(4) NOT NULL default '0', - PRIMARY KEY (id), - KEY userid (userid), - KEY entryid (entryid) -) COMMENT='Contains user ratings for entries'; -# -------------------------------------------------------- - -# -# Dumping data for table `log_display` -# - -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('glossary', 'add', 'glossary', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('glossary', 'update', 'glossary', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('glossary', 'view', 'glossary', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('glossary', 'view all', 'glossary', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('glossary', 'add entry', 'glossary', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('glossary', 'update entry', 'glossary', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('glossary', 'add category', 'glossary', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('glossary', 'update category', 'glossary', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('glossary', 'delete category', 'glossary', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('glossary', 'add comment', 'glossary', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('glossary', 'update comment', 'glossary', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('glossary', 'delete comment', 'glossary', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('glossary', 'approve entry', 'glossary', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('glossary', 'view entry', 'glossary_entries', 'concept'); - diff --git a/mod/glossary/db/postgres7.sql b/mod/glossary/db/postgres7.sql deleted file mode 100644 index 2ae6bbd26ab..00000000000 --- a/mod/glossary/db/postgres7.sql +++ /dev/null @@ -1,180 +0,0 @@ -# This file contains a complete database schema for all the -# tables used by this module, written in SQL - -# It may also contain INSERT statements for particular data -# that may be used, especially new entries in the table log_display - -# -# Table structure for table `glossary` -# - -CREATE TABLE prefix_glossary ( - id SERIAL, - course int4 NOT NULL default '0', - name varchar(255) NOT NULL default '', - intro text NOT NULL default '', - studentcanpost int2 NOT NULL default '0', - allowduplicatedentries int2 NOT NULL default '0', - displayformat varchar(50) NOT NULL default 'dictionary', - mainglossary int2 NOT NULL default '0', - showspecial int2 NOT NULL default '1', - showalphabet int2 NOT NULL default '1', - showall int2 NOT NULL default '1', - allowcomments int2 NOT NULL default '0', - allowprintview int2 NOT NULL default '1', - usedynalink int2 NOT NULL default '1', - defaultapproval int2 NOT NULL default '1', - globalglossary int2 NOT NULL default '0', - entbypage int NOT NULL default '10', - editalways integer NOT NULL default '0', - rsstype integer NOT NULL default '0', - rssarticles integer NOT NULL default '0', - assessed int4 NOT NULL default '0', - assesstimestart int4 NOT NULL default '0', - assesstimefinish int4 NOT NULL default '0', - scale int4 NOT NULL default '0', - timecreated int4 NOT NULL default '0', - timemodified int4 NOT NULL default '0', - PRIMARY KEY (id) -); - -CREATE INDEX prefix_glossary_course_idx ON prefix_glossary (course); - - -# -# Table structure for table `glossary_entries` -# - -CREATE TABLE prefix_glossary_entries ( - id SERIAL, - glossaryid int4 NOT NULL default '0', - userid int4 NOT NULL default '0', - concept varchar(255) NOT NULL default '', - definition text NOT NULL, - format int2 NOT NULL default '0', - attachment VARCHAR(100) NOT NULL default '', - timecreated int4 NOT NULL default '0', - timemodified int4 NOT NULL default '0', - teacherentry int2 NOT NULL default '0', - sourceglossaryid int4 NOT NULL default '0', - usedynalink int2 NOT NULL default '1', - casesensitive int2 NOT NULL default '0', - fullmatch int2 NOT NULL default '1', - approved int2 NOT NULL default '1', - PRIMARY KEY(id) -); - -CREATE INDEX prefix_glossary_entries_glossaryid_idx ON prefix_glossary_entries (glossaryid); -CREATE INDEX prefix_glossary_entries_userid_idx ON prefix_glossary_entries (userid); -CREATE INDEX prefix_glossary_entries_concept_idx ON prefix_glossary_entries (concept); - -# -# Table structure for table `glossary_cageories` -# - -CREATE TABLE prefix_glossary_categories ( - id SERIAL, - glossaryid int4 NOT NULL default '0', - name varchar(255) NOT NULL default '', - usedynalink int2 NOT NULL default '1', - PRIMARY KEY (id) -); - -CREATE INDEX prefix_glossary_categories_glossaryid_idx ON prefix_glossary_categories (glossaryid); - -# -# Table structure for table `glossary_alias` -# - -CREATE TABLE prefix_glossary_alias ( - id SERIAL, - entryid int4 NOT NULL default '0', - alias varchar(255) NOT NULL, - PRIMARY KEY (id) -); - -CREATE INDEX prefix_glossary_alias_entryid_idx ON prefix_glossary_alias (entryid); - -# -# Table structure for table `glossary_entries_category` -# - -CREATE TABLE prefix_glossary_entries_categories ( - id SERIAL, - categoryid int4 NOT NULL default '0', - entryid int4 NOT NULL default '0', - PRIMARY KEY (id) -); - -CREATE INDEX prefix_glossary_entries_categories_category_idx ON prefix_glossary_entries_categories (categoryid); -CREATE INDEX prefix_glossary_entries_categories_entryid_idx ON prefix_glossary_entries_categories (entryid); - -# -# Table structure for table `glossary_comments` -# - -CREATE TABLE prefix_glossary_comments ( - id SERIAL, - entryid int4 NOT NULL default '0', - userid int4 NOT NULL default '0', - entrycomment text NOT NULL, - format int2 NOT NULL default '0', - timemodified int4 NOT NULL default '0', - PRIMARY KEY (id) -); - -CREATE INDEX prefix_glossary_comments_entryid_idx ON prefix_glossary_comments (entryid); -CREATE INDEX prefix_glossary_comments_userid_idx ON prefix_glossary_comments (userid); - -# -# Table structure for table `glossary_formats` -# - -CREATE TABLE prefix_glossary_formats ( - id SERIAL, - name varchar(50) NOT NULL, - popupformatname varchar(50) NOT NULL, - visible int2 NOT NULL default '1', - showgroup int2 NOT NULL default '1', - defaultmode varchar(50) NOT NULL default '', - defaulthook varchar(50) NOT NULL default '', - sortkey varchar(50) NOT NULL default '', - sortorder varchar(50) NOT NULL default '', - PRIMARY KEY (id) -); - - -# -# Table structure for table `glossary_ratings` -# - -CREATE TABLE prefix_glossary_ratings ( - id SERIAL, - userid int4 NOT NULL default '0', - entryid int4 NOT NULL default '0', - time int4 NOT NULL default '0', - rating int4 NOT NULL default '0', - PRIMARY KEY (id) -); - -CREATE INDEX prefix_glossary_ratings_userid_idx ON prefix_glossary_ratings (userid); -CREATE INDEX prefix_glossary_ratings_entryid_idx ON prefix_glossary_ratings (entryid); - -# -# Dumping data for table `log_display` -# - -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('glossary', 'add', 'glossary', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('glossary', 'update', 'glossary', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('glossary', 'view', 'glossary', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('glossary', 'view all', 'glossary', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('glossary', 'add entry', 'glossary', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('glossary', 'update entry', 'glossary', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('glossary', 'add category', 'glossary', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('glossary', 'update category', 'glossary', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('glossary', 'delete category', 'glossary', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('glossary', 'add comment', 'glossary', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('glossary', 'update comment', 'glossary', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('glossary', 'delete comment', 'glossary', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('glossary', 'approve entry', 'glossary', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('glossary', 'view entry', 'glossary_entries', 'concept'); diff --git a/mod/hotpot/db/mysql.sql b/mod/hotpot/db/mysql.sql deleted file mode 100644 index eb2725b6c43..00000000000 --- a/mod/hotpot/db/mysql.sql +++ /dev/null @@ -1,103 +0,0 @@ -# -# Table structure for table `hotpot` -# -CREATE TABLE prefix_hotpot ( - id int(10) unsigned NOT NULL auto_increment, - course int(10) unsigned NOT NULL default '0', - name varchar(255) NOT NULL default '', - summary text NOT NULL default '', - timeopen int(10) unsigned NOT NULL default '0', - timeclose int(10) unsigned NOT NULL default '0', - location int(4) unsigned NOT NULL default '0', - reference varchar(255) NOT NULL default '', - outputformat int(4) unsigned NOT NULL default '1', - navigation int(4) unsigned NOT NULL default '1', - studentfeedback tinyint(4) unsigned NOT NULL default '0', - studentfeedbackurl varchar(255) NOT NULL default '', - forceplugins int(4) unsigned NOT NULL default '0', - shownextquiz int(4) unsigned NOT NULL default '0', - review tinyint(4) NOT NULL default '0', - grade int(10) NOT NULL default '0', - grademethod tinyint(4) NOT NULL default '1', - attempts smallint(6) NOT NULL default '0', - password varchar(255) NOT NULL default '', - subnet varchar(255) NOT NULL default '', - clickreporting tinyint(4) unsigned NOT NULL default '0', - timecreated int(10) unsigned NOT NULL default '0', - timemodified int(10) unsigned NOT NULL default '0', - PRIMARY KEY (id) -) TYPE=MyISAM COMMENT='details about Hot Potatoes quizzes'; -# -# Table structure for table `hotpot_attempts` -# -CREATE TABLE prefix_hotpot_attempts ( - id int(10) unsigned NOT NULL auto_increment, - hotpot int(10) unsigned NOT NULL default '0', - userid int(10) unsigned NOT NULL default '0', - starttime int(10) unsigned NOT NULL default '0', - endtime int(10) unsigned NOT NULL default '0', - score int(6) unsigned NOT NULL default '0', - penalties int(6) unsigned NOT NULL default '0', - attempt int(6) unsigned NOT NULL default '0', - timestart int(10) unsigned NOT NULL default '0', - timefinish int(10) unsigned NOT NULL default '0', - status tinyint(4) unsigned NOT NULL default '1', - clickreportid int(10) unsigned NOT NULL default '0', - PRIMARY KEY (id), - KEY hotpot_attempts_hotpot_idx (hotpot), - KEY hotpot_attempts_userid_idx (userid) -) TYPE=MyISAM COMMENT='details about Hot Potatoes quiz attempts'; -# -# Table structure for table `hotpot_details` -# -CREATE TABLE prefix_hotpot_details ( - id int(10) unsigned NOT NULL auto_increment, - attempt int(10) unsigned NOT NULL default '0', - details text default '', - PRIMARY KEY (id), - KEY hotpot_details_attempt_idx (attempt) -) TYPE=MyISAM COMMENT='raw details (as XML) of Hot Potatoes quiz attempts'; -# -# Table structure for table `hotpot_questions` -# -CREATE TABLE prefix_hotpot_questions ( - id int(10) unsigned NOT NULL auto_increment, - name text NOT NULL default '', - type tinyint(4) unsigned NOT NULL default '0', - text int(10) unsigned NOT NULL default '0', - hotpot int(10) unsigned NOT NULL default '0', - md5key varchar(32) NOT NULL default '', - PRIMARY KEY (id), - KEY hotpot_questions_hotpot_idx (hotpot), - KEY hotpot_questions_md5key_idx (md5key) -) TYPE=MyISAM COMMENT='details about questions in Hot Potatoes quiz attempts'; -# -# Table structure for table `hotpot_responses` -# -CREATE TABLE prefix_hotpot_responses ( - id int(10) unsigned NOT NULL auto_increment, - attempt int(10) unsigned NOT NULL default '0', - question int(10) unsigned NOT NULL default '0', - score smallint(6) NOT NULL default '0', - weighting smallint(6) NOT NULL default '0', - correct varchar(255) NOT NULL default '', - wrong varchar(255) NOT NULL default '', - ignored varchar(255) NOT NULL default '', - hints smallint(6) unsigned NOT NULL default '0', - clues smallint(6) unsigned NOT NULL default '0', - checks smallint(6) unsigned NOT NULL default '0', - PRIMARY KEY (id), - KEY hotpot_responses_attempt_idx (attempt), - KEY hotpot_responses_question_idx (question) -) TYPE=MyISAM COMMENT='details about responses in Hot Potatoes quiz attempts'; -# -# Table structure for table `hotpot_strings` -# -CREATE TABLE prefix_hotpot_strings ( - id int(10) unsigned NOT NULL auto_increment, - string text NOT NULL default '', - md5key varchar(32) NOT NULL default '', - PRIMARY KEY (id), - KEY hotpot_strings_md5key_idx (md5key) -) TYPE=MyISAM COMMENT='strings used in Hot Potatoes questions and responses'; - diff --git a/mod/hotpot/db/postgres7.sql b/mod/hotpot/db/postgres7.sql deleted file mode 100644 index b2fbffd96ea..00000000000 --- a/mod/hotpot/db/postgres7.sql +++ /dev/null @@ -1,118 +0,0 @@ -# -# Table structure for table `hotpot` -# - -CREATE TABLE prefix_hotpot ( - id SERIAL PRIMARY KEY, - course INT4 NOT NULL default '0', - name VARCHAR(255) NOT NULL default '', - summary TEXT, - timeopen INT4 NOT NULL default '0', - timeclose INT4 NOT NULL default '0', - location INT2 NOT NULL default '0', - reference VARCHAR(255) NOT NULL default '', - outputformat INT2 NOT NULL default '1', - navigation INT2 NOT NULL default '1', - studentfeedback INT2 NOT NULL default '0', - studentfeedbackurl VARCHAR(255) NOT NULL default '', - forceplugins INT2 NOT NULL default '0', - shownextquiz INT2 NOT NULL default '0', - review INT2 NOT NULL default '0', - grade INT4 NOT NULL default '0', - grademethod INT2 NOT NULL default '1', - attempts INT2 NOT NULL default '0', - password VARCHAR(255) NOT NULL default '', - subnet VARCHAR(255) NOT NULL default '', - clickreporting INT2 NOT NULL default '0', - timecreated INT4 NOT NULL default '0', - timemodified INT4 NOT NULL default '0' -); -COMMENT ON TABLE prefix_hotpot IS 'details about Hot Potatoes quizzes'; - -# -# Table structure for table `hotpot_attempts` -# - -CREATE TABLE prefix_hotpot_attempts ( - id SERIAL PRIMARY KEY, - hotpot INT4 NOT NULL default '0', - userid INT4 NOT NULL default '0', - starttime INT4 NOT NULL default '0', - endtime INT4 NOT NULL default '0', - score INT2 NOT NULL default '0', - penalties INT2 NOT NULL default '0', - attempt INT2 NOT NULL default '0', - timestart INT4 NOT NULL default '0', - timefinish INT4 NOT NULL default '0', - status INT2 NOT NULL default '1', - clickreportid INT4 NOT NULL default '0' -); -COMMENT ON TABLE prefix_hotpot IS 'details about Hot Potatoes quiz attempts'; - -CREATE INDEX prefix_hotpot_attempts_hotpot_idx ON prefix_hotpot_attempts (hotpot); -CREATE INDEX prefix_hotpot_attempts_userid_idx ON prefix_hotpot_attempts (userid); - -# -# Table structure for table `prefix_hotpot_details` -# - -CREATE TABLE prefix_hotpot_details ( - id SERIAL PRIMARY KEY, - attempt INT4 NOT NULL default '0', - details TEXT NOT NULL default '' -); -COMMENT ON TABLE prefix_hotpot_details IS 'raw details (as XML) of Hot Potatoes quiz attempts'; - -CREATE INDEX prefix_hotpot_details_attempt_idx ON prefix_hotpot_details (attempt); - -# -# Table structure for table `hotpot_questions` -# - -CREATE TABLE prefix_hotpot_questions ( - id SERIAL PRIMARY KEY, - name TEXT NOT NULL default '', - type INT2 NOT NULL default '0', - text INT4 NOT NULL default '0', - hotpot INT4 NOT NULL default '0', - md5key VARCHAR(32) NOT NULL default '' -); -COMMENT ON TABLE prefix_hotpot_questions IS 'details about questions in Hot Potatoes quiz attempts'; - -CREATE INDEX prefix_hotpot_questions_hotpot_idx ON prefix_hotpot_questions (hotpot); -CREATE INDEX prefix_hotpot_questions_md5key_idx ON prefix_hotpot_questions (md5key); - -# -# Table structure for table `hotpot_responses` -# - -CREATE TABLE prefix_hotpot_responses ( - id SERIAL PRIMARY KEY, - attempt INT4 NOT NULL default '0', - question INT4 NOT NULL default '0', - score INT2 NOT NULL default '0', - weighting INT2 NOT NULL default '0', - correct VARCHAR(255) NOT NULL default '', - wrong VARCHAR(255) NOT NULL default '', - ignored VARCHAR(255) NOT NULL default '', - hints INT2 NOT NULL default '0', - clues INT2 NOT NULL default '0', - checks INT2 NOT NULL default '0' -); -COMMENT ON TABLE prefix_hotpot_responses IS 'details about responses in Hot Potatoes quiz attempts'; - -CREATE INDEX prefix_hotpot_responses_attempt_idx ON prefix_hotpot_responses (attempt); -CREATE INDEX prefix_hotpot_responses_question_idx ON prefix_hotpot_responses (question); - -# -# Table structure for table `hotpot_strings` -# - -CREATE TABLE prefix_hotpot_strings ( - id SERIAL PRIMARY KEY, - string TEXT NOT NULL default '', - md5key VARCHAR(32) NOT NULL default '' -); -COMMENT ON TABLE prefix_hotpot_strings IS 'strings used in Hot Potatoes questions and responses'; - -CREATE INDEX prefix_hotpot_strings_md5key_idx ON prefix_hotpot_strings (md5key); diff --git a/mod/journal/db/mysql.sql b/mod/journal/db/mysql.sql deleted file mode 100755 index af95f2149e0..00000000000 --- a/mod/journal/db/mysql.sql +++ /dev/null @@ -1,59 +0,0 @@ -# phpMyAdmin MySQL-Dump -# version 2.2.1 -# http://phpwizard.net/phpMyAdmin/ -# http://phpmyadmin.sourceforge.net/ (download page) -# -# Host: localhost -# Generation Time: Nov 14, 2001 at 04:44 PM -# Server version: 3.23.36 -# PHP Version: 4.0.6 -# Database : `moodle` -# -------------------------------------------------------- - -# -# Table structure for table `journal` -# - -CREATE TABLE prefix_journal ( - id int(10) unsigned NOT NULL auto_increment, - course int(10) unsigned NOT NULL default '0', - name varchar(255) NOT NULL default '', - intro text NOT NULL default '', - introformat tinyint(2) NOT NULL default '0', - days smallint(5) unsigned NOT NULL default '7', - assessed int(10) NOT NULL default '0', - timemodified int(10) unsigned NOT NULL default '0', - PRIMARY KEY (id), - KEY course (course) -) TYPE=MyISAM; -# -------------------------------------------------------- - -# -# Table structure for table `journal_entries` -# - -CREATE TABLE prefix_journal_entries ( - id int(10) unsigned NOT NULL auto_increment, - journal int(10) unsigned NOT NULL default '0', - userid int(10) unsigned NOT NULL default '0', - modified int(10) unsigned NOT NULL default '0', - text text NOT NULL default '', - format tinyint(2) NOT NULL default '0', - rating int(10) default '0', - entrycomment text default '', - teacher int(10) unsigned NOT NULL default '0', - timemarked int(10) unsigned NOT NULL default '0', - mailed int(1) unsigned NOT NULL default '0', - PRIMARY KEY (id), - KEY journal (journal), - KEY userid (userid) -) TYPE=MyISAM COMMENT='All the journal entries of all people'; - -# -# Dumping data for table `log_display` -# - -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('journal', 'view', 'journal', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('journal', 'add entry', 'journal', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('journal', 'update entry', 'journal', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('journal', 'view responses', 'journal', 'name'); diff --git a/mod/journal/db/postgres7.sql b/mod/journal/db/postgres7.sql deleted file mode 100755 index 5eeb51baf5b..00000000000 --- a/mod/journal/db/postgres7.sql +++ /dev/null @@ -1,60 +0,0 @@ -# phpMyAdmin MySQL-Dump -# version 2.2.1 -# http://phpwizard.net/phpMyAdmin/ -# http://phpmyadmin.sourceforge.net/ (download page) -# -# Host: localhost -# Generation Time: Nov 14, 2001 at 04:44 PM -# Server version: 3.23.36 -# PHP Version: 4.0.6 -# Database : `moodle` -# -------------------------------------------------------- - -# -# Table structure for table `journal` -# - -CREATE TABLE prefix_journal ( - id SERIAL PRIMARY KEY, - course integer NOT NULL default '0', - name varchar(255) default NULL, - intro text, - introformat integer NOT NULL default '0', - days integer NOT NULL default '7', - assessed integer NOT NULL default '0', - timemodified integer NOT NULL default '0' -); - -CREATE INDEX prefix_journal_course_idx ON prefix_journal (course); - -# -------------------------------------------------------- - -# -# Table structure for table `journal_entries` -# - -CREATE TABLE prefix_journal_entries ( - id SERIAL PRIMARY KEY, - journal integer NOT NULL default '0', - userid integer NOT NULL default '0', - modified integer NOT NULL default '0', - text text NOT NULL default '', - format integer NOT NULL default '0', - rating integer default '0', - entrycomment text, - teacher integer NOT NULL default '0', - timemarked integer NOT NULL default '0', - mailed integer NOT NULL default '0' -); - -CREATE INDEX prefix_journal_entries_journal_idx ON prefix_journal_entries (journal); -CREATE INDEX prefix_journal_entries_userid_idx ON prefix_journal_entries (userid); - -# -# Dumping data for table `log_display` -# - -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('journal', 'view', 'journal', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('journal', 'add entry', 'journal', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('journal', 'update entry', 'journal', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('journal', 'view responses', 'journal', 'name'); diff --git a/mod/label/db/mysql.sql b/mod/label/db/mysql.sql deleted file mode 100644 index cbbce05e3c9..00000000000 --- a/mod/label/db/mysql.sql +++ /dev/null @@ -1,12 +0,0 @@ -CREATE TABLE `prefix_label` ( - `id` int(10) unsigned NOT NULL auto_increment, - `course` int(10) unsigned NOT NULL default '0', - `name` varchar(255) NOT NULL default '', - `content` text NOT NULL default '', - `timemodified` int(10) unsigned NOT NULL default '0', - PRIMARY KEY (`id`), - KEY course (course) -) COMMENT='Defines labels'; - -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('label', 'add', 'quiz', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('label', 'update', 'quiz', 'name'); diff --git a/mod/label/db/postgres7.sql b/mod/label/db/postgres7.sql deleted file mode 100644 index e01f359300d..00000000000 --- a/mod/label/db/postgres7.sql +++ /dev/null @@ -1,12 +0,0 @@ -CREATE TABLE prefix_label ( - id SERIAL PRIMARY KEY, - course integer NOT NULL default '0', - name varchar(255) default NULL, - content text, - timemodified integer NOT NULL default '0' -); - -CREATE INDEX prefix_label_course_idx ON prefix_label (course); - -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('label', 'add', 'quiz', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('label', 'update', 'quiz', 'name'); diff --git a/mod/lams/db/mysql.sql b/mod/lams/db/mysql.sql deleted file mode 100644 index 1514bd4e844..00000000000 --- a/mod/lams/db/mysql.sql +++ /dev/null @@ -1,17 +0,0 @@ -# This file contains a complete database schema for all the -# tables used by this module, written in SQL - -# It may also contain INSERT statements for particular data -# that may be used, especially new entries in the table log_display - -CREATE TABLE prefix_lams ( - id int(10) unsigned NOT NULL auto_increment, - course int(10) unsigned NOT NULL default '0', - name varchar(255) NOT NULL default '', - introduction text NOT NULL default '', - learning_session_id bigint(20) default '0', - timemodified int(10) unsigned NOT NULL default '0', - PRIMARY KEY (id), - KEY course (course) -)COMMENT='LAMS activity'; - diff --git a/mod/lams/db/postgres7.sql b/mod/lams/db/postgres7.sql deleted file mode 100644 index 15bba367cb1..00000000000 --- a/mod/lams/db/postgres7.sql +++ /dev/null @@ -1,17 +0,0 @@ -# This file contains a complete database schema for all the -# tables used by this module, written in SQL - -# It may also contain INSERT statements for particular data -# that may be used, especially new entries in the table log_display - -CREATE TABLE prefix_lams ( - id SERIAL PRIMARY KEY, - course integer NOT NULL default '0', - name varchar(255) NOT NULL default '', - introduction text NOT NULL default '', - learning_session_id integer NOT NULL default '0', - timemodified integer NOT NULL default '0' -); - -CREATE INDEX prefix_lams_course_idx ON prefix_lams (course); - diff --git a/mod/lesson/db/mysql.sql b/mod/lesson/db/mysql.sql deleted file mode 100644 index 81b026c450f..00000000000 --- a/mod/lesson/db/mysql.sql +++ /dev/null @@ -1,192 +0,0 @@ -# This file contains a complete database schema for all the -# tables used by the mlesson module, written in SQL - -# It may also contain INSERT statements for particular data -# that may be used, especially new entries in the table log_display - -CREATE TABLE `prefix_lesson` ( - `id` int(10) unsigned NOT NULL auto_increment, - `course` int(10) unsigned NOT NULL default '0', - `name` varchar(255) NOT NULL default '', - `practice` TINYINT(3) UNSIGNED NOT NULL default '0', - `modattempts` TINYINT(3) UNSIGNED NOT NULL default '0', - `usepassword` TINYINT(3) UNSIGNED NOT NULL default '0', - `password` VARCHAR(32) NOT NULL default '', - `dependency` int(10) unsigned NOT NULL default '0', - `conditions` text NOT NULL default '', - `grade` tinyint(3) NOT NULL default '0', - `custom` TINYINT(3) UNSIGNED NOT NULL default '0', - `ongoing` TINYINT(3) UNSIGNED NOT NULL default '0', - `usemaxgrade` tinyint(3) NOT NULL default '0', - `maxanswers` int(3) unsigned NOT NULL default '4', - `maxattempts` int(3) unsigned NOT NULL default '5', - `review` TINYINT(3) UNSIGNED NOT NULL default '0', - `nextpagedefault` int(3) unsigned NOT NULL default '0', - `feedback` int(3) unsigned NOT NULL default '1', - `minquestions` int(3) unsigned NOT NULL default '0', - `maxpages` int(3) unsigned NOT NULL default '0', - `timed` TINYINT(3) UNSIGNED NOT NULL default '0', - `maxtime` INT(10) UNSIGNED NOT NULL default '0', - `retake` int(3) unsigned NOT NULL default '1', - `activitylink` INT(10) UNSIGNED NOT NULL default '0', - `mediafile` varchar(255) NOT NULL default '', - `mediaheight` INT(10) UNSIGNED NOT NULL DEFAULT '100', - `mediawidth` INT(10) UNSIGNED NOT NULL DEFAULT '650', - `mediaclose` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0', - `slideshow` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0', - `width` INT(10) UNSIGNED NOT NULL DEFAULT '640', - `height` INT(10) UNSIGNED NOT NULL DEFAULT '480', - `bgcolor` CHAR(7) NOT NULL DEFAULT '#FFFFFF', - `displayleft` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0', - `displayleftif` INT(3) UNSIGNED NOT NULL DEFAULT '0', - `progressbar` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0', - `highscores` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0', - `maxhighscores` INT(10) UNSIGNED NOT NULL DEFAULT '0', - `available` int(10) unsigned NOT NULL default '0', - `deadline` int(10) unsigned NOT NULL default '0', - `timemodified` int(10) unsigned NOT NULL default '0', - PRIMARY KEY (`id`), - KEY `course` (`course`) -) COMMENT='Defines lesson'; -# -------------------------------------------------------- - -CREATE TABLE `prefix_lesson_pages` ( - `id` int(10) unsigned NOT NULL auto_increment, - `lessonid` int(10) unsigned NOT NULL default '0', - `prevpageid` int(10) unsigned NOT NULL default '0', - `nextpageid` int(10) unsigned NOT NULL default '0', - `qtype` tinyint(3) unsigned NOT NULL default '0', - `qoption` tinyint(3) unsigned NOT NULL default '0', - `layout` TINYINT(3) UNSIGNED NOT NULL DEFAULT '1', - `display` TINYINT(3) UNSIGNED NOT NULL DEFAULT '1', - `timecreated` int(10) unsigned NOT NULL default '0', - `timemodified` int(10) unsigned NOT NULL default '0', - `title` varchar(255) NOT NULL default '', - `contents` text NOT NULL default '', - PRIMARY KEY (`id`), - KEY `lessonid` (`lessonid`) -) COMMENT='Defines lesson_pages'; -# -------------------------------------------------------- - -CREATE TABLE `prefix_lesson_answers` ( - `id` int(10) unsigned NOT NULL auto_increment, - `lessonid` int(10) unsigned NOT NULL default '0', - `pageid` int(10) unsigned NOT NULL default '0', - `jumpto` int(11) NOT NULL default '0', - `grade` tinyint(3) unsigned NOT NULL default '0', - `score` INT(10) NOT NULL DEFAULT '0', - `flags` tinyint(3) unsigned NOT NULL default '0', - `timecreated` int(10) unsigned NOT NULL default '0', - `timemodified` int(10) unsigned NOT NULL default '0', - `answer` text NOT NULL default '', - `response` text NOT NULL default '', - PRIMARY KEY (`id`), - KEY (`pageid`), - KEY `lessonid` (`lessonid`) -) COMMENT='Defines lesson_answers'; -# -------------------------------------------------------- - -CREATE TABLE `prefix_lesson_attempts` ( - `id` int(10) unsigned NOT NULL auto_increment, - `lessonid` int(10) unsigned NOT NULL default '0', - `pageid` int(10) unsigned NOT NULL default '0', - `userid` int(10) unsigned NOT NULL default '0', - `answerid` int(10) unsigned NOT NULL default '0', - `retry` int(3) unsigned NOT NULL default '0', - `correct` int(10) unsigned NOT NULL default '0', - `useranswer` text NOT NULL default '', - `timeseen` int(10) unsigned NOT NULL default '0', - PRIMARY KEY (`id`), - KEY (`userid`), - KEY `lessonid` (`lessonid`), - KEY `pageid` (`pageid`) -) COMMENT='Defines lesson_attempts'; -# -------------------------------------------------------- - -CREATE TABLE `prefix_lesson_grades` ( - `id` int(10) unsigned NOT NULL auto_increment, - `lessonid` int(10) unsigned NOT NULL default '0', - `userid` int(10) unsigned NOT NULL default '0', - `grade` float unsigned NOT NULL default '0', - `late` int(3) unsigned NOT NULL default '0', - `completed` int(10) unsigned NOT NULL default '0', - PRIMARY KEY (`id`), - KEY `lessonid` (`lessonid`), - KEY `userid` (`userid`) -) COMMENT='Defines lesson_grades'; -# -------------------------------------------------------- - -CREATE TABLE `prefix_lesson_default` - ( `id` int(10) unsigned NOT NULL auto_increment, - `course` int(10) unsigned NOT NULL default '0', - `practice` tinyint(3) unsigned NOT NULL default '0', - `modattempts` tinyint(3) unsigned NOT NULL default '0', - `usepassword` int(3) unsigned NOT NULL default '0', - `password` varchar(32) NOT NULL default '', - `conditions` text NOT NULL default '', - `grade` tinyint(3) NOT NULL default '0', - `custom` int(3) unsigned NOT NULL default '0', - `ongoing` int(3) unsigned NOT NULL default '0', - `usemaxgrade` tinyint(3) unsigned NOT NULL default '0', - `maxanswers` int(3) unsigned NOT NULL default '4', - `maxattempts` int(3) unsigned NOT NULL default '5', - `review` tinyint(3) unsigned NOT NULL default '0', - `nextpagedefault` int(3) unsigned NOT NULL default '0', - `feedback` int(3) unsigned NOT NULL default '1', - `minquestions` tinyint(3) unsigned NOT NULL default '0', - `maxpages` int(3) unsigned NOT NULL default '0', - `timed` int(3) unsigned NOT NULL default '0', - `maxtime` int(10) unsigned NOT NULL default '0', - `retake` int(3) unsigned NOT NULL default '1', - `mediaheight` INT(10) UNSIGNED NOT NULL DEFAULT '100', - `mediawidth` INT(10) UNSIGNED NOT NULL DEFAULT '650', - `mediaclose` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0', - `slideshow` int(3) unsigned NOT NULL default '0', - `width` int(10) unsigned NOT NULL default '640', - `height` int(10) unsigned NOT NULL default '480', - `bgcolor` varchar(7) default '#FFFFFF', - `displayleft` int(3) unsigned NOT NULL default '0', - `displayleftif` INT(3) UNSIGNED NOT NULL DEFAULT '0', - `progressbar` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0', - `highscores` int(3) unsigned NOT NULL default '0', - `maxhighscores` int(10) NOT NULL default '0', - PRIMARY KEY (`id`) - ) COMMENT = 'Defines lesson_default'; -# -------------------------------------------------------- - -CREATE TABLE `prefix_lesson_timer` - ( `id` int(10) unsigned NOT NULL auto_increment, - `lessonid` int(10) unsigned not null default '0', - `userid` int(10) unsigned not null default '0', - `starttime` int(10) unsigned not null default '0', - `lessontime` int(10) unsigned not null default '0', - PRIMARY KEY (`id`) - ); -# -------------------------------------------------------- - -CREATE TABLE `prefix_lesson_branch` - ( `id` int(10) unsigned not null auto_increment, - `lessonid` int(10) unsigned not null default '0', - `userid` int(10) unsigned not null default '0', - `pageid` int(10) unsigned not null default '0', - `retry` int(10) unsigned not null default '0', - `flag` tinyint(3) unsigned not null default '0', - `timeseen` int(10) unsigned not null default '0', - PRIMARY KEY (`id`) - ); -# -------------------------------------------------------- - -CREATE TABLE `prefix_lesson_high_scores` - ( `id` int(10) unsigned not null auto_increment, - `lessonid` int(10) unsigned not null default '0', - `userid` int(10) unsigned not null default '0', - `gradeid` int(10) unsigned not null default '0', - `nickname` varchar(5) not null default '', - PRIMARY KEY (`id`) - ); -# -------------------------------------------------------- - - -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('lesson', 'start', 'lesson', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('lesson', 'end', 'lesson', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('lesson', 'view', 'lesson_pages', 'title'); diff --git a/mod/lesson/db/postgres7.sql b/mod/lesson/db/postgres7.sql deleted file mode 100644 index 8e2963aa77b..00000000000 --- a/mod/lesson/db/postgres7.sql +++ /dev/null @@ -1,172 +0,0 @@ -CREATE TABLE prefix_lesson ( - id SERIAL8 PRIMARY KEY, - course INT8 NOT NULL default '0', - name varchar(255) NOT NULL default '', - practice INT NOT NULL DEFAULT '0', - modattempts INT4 NOT NULL DEFAULT '0', - usepassword INT NOT NULL DEFAULT '0', - password VARCHAR(32) NOT NULL default '', - dependency INT8 NOT NULL DEFAULT '0', - conditions text NOT NULL DEFAULT '', - grade INT NOT NULL default '0', - custom INT NOT NULL DEFAULT '0', - ongoing INT NOT NULL DEFAULT '0', - usemaxgrade INT NOT NULL default '0', - maxanswers INT NOT NULL default '4', - maxattempts INT NOT NULL default '5', - review INT NOT NULL DEFAULT '0', - nextpagedefault INT NOT NULL default '0', - feedback INT NOT NULL default '1', - minquestions INT NOT NULL default '0', - maxpages INT NOT NULL default '0', - timed INT NOT NULL DEFAULT '0', - maxtime INT8 NOT NULL DEFAULT '0', - retake INT NOT NULL default '1', - activitylink INT8 NOT NULL default '0', - mediafile varchar(255) NOT NULL default '', - mediaheight INT NOT NULL DEFAULT '100', - mediawidth INT NOT NULL DEFAULT '650', - mediaclose INT NOT NULL DEFAULT '0', - slideshow INT NOT NULL DEFAULT '0', - width INT8 NOT NULL DEFAULT '640', - height INT8 NOT NULL DEFAULT '480', - bgcolor VARCHAR(7) NOT NULL DEFAULT '#FFFFFF', - displayleft INT NOT NULL DEFAULT '0', - displayleftif INT NOT NULL DEFAULT '0', - progressbar INT NOT NULL DEFAULT '0', - highscores INT NOT NULL DEFAULT '0', - maxhighscores INT8 NOT NULL DEFAULT '0', - available INT8 NOT NULL default '0', - deadline INT8 NOT NULL default '0', - timemodified INT8 NOT NULL default '0' -); - -CREATE INDEX prefix_lesson_course_idx ON prefix_lesson (course); - -CREATE TABLE prefix_lesson_pages ( - id SERIAL8 PRIMARY KEY, - lessonid INT8 NOT NULL default '0', - prevpageid INT8 NOT NULL default '0', - nextpageid INT8 NOT NULL default '0', - qtype INT NOT NULL default '0', - qoption INT NOT NULL default '0', - layout INT NOT NULL DEFAULT '1', - display INT NOT NULL DEFAULT '1', - timecreated INT8 NOT NULL default '0', - timemodified INT8 NOT NULL default '0', - title varchar(255) NOT NULL default '', - contents text NOT NULL default '' -) ; - -CREATE INDEX prefix_lesson_pages_lessonid_idx ON prefix_lesson_pages (lessonid); - -CREATE TABLE prefix_lesson_answers ( - id SERIAL8 PRIMARY KEY, - lessonid INT8 NOT NULL default '0', - pageid INT8 NOT NULL default '0', - jumpto int8 NOT NULL default '0', - grade INT NOT NULL default '0', - score INT8 NOT NULL DEFAULT '0', - flags INT NOT NULL default '0', - timecreated INT8 NOT NULL default '0', - timemodified INT8 NOT NULL default '0', - answer text NOT NULL default '', - response text NOT NULL default '' -) ; - -CREATE INDEX prefix_lesson_answers_pageid_idx ON prefix_lesson_answers (pageid); -CREATE INDEX prefix_lesson_answers_lessonid_idx ON prefix_lesson_answers (lessonid); - -CREATE TABLE prefix_lesson_attempts ( - id SERIAL8 PRIMARY KEY, - lessonid INT8 NOT NULL default '0', - pageid INT8 NOT NULL default '0', - userid INT8 NOT NULL default '0', - answerid INT8 NOT NULL default '0', - retry INT NOT NULL default '0', - correct INT8 NOT NULL default '0', - useranswer text NOT NULL default '', - timeseen INT8 NOT NULL default '0' -) ; -CREATE INDEX prefix_lesson_attempts_lessonid_idx ON prefix_lesson_attempts (lessonid); -CREATE INDEX prefix_lesson_attempts_pageid_idx ON prefix_lesson_attempts (pageid); -CREATE INDEX prefix_lesson_attempts_userid_idx ON prefix_lesson_attempts (userid); - -CREATE TABLE prefix_lesson_grades ( - id SERIAL8 PRIMARY KEY, - lessonid INT8 NOT NULL default '0', - userid INT8 NOT NULL default '0', - grade real NOT NULL default '0', - late INT NOT NULL default '0', - completed INT8 NOT NULL default '0' -) ; - -CREATE INDEX prefix_lesson_grades_lessonid_idx ON prefix_lesson_grades (lessonid); -CREATE INDEX prefix_lesson_grades_userid_idx ON prefix_lesson_grades (userid); - -CREATE TABLE prefix_lesson_default - ( id SERIAL8 PRIMARY KEY, - course INT8 NOT NULL default '0', - practice INT NOT NULL default '0', - modattempts INT4 NOT NULL default '0', - usepassword INT NOT NULL default '0', - password varchar(32) NOT NULL default '', - conditions text NOT NULL DEFAULT '', - grade INT NOT NULL default '0', - custom INT NOT NULL default '0', - ongoing INT NOT NULL default '0', - usemaxgrade INT NOT NULL default '0', - maxanswers INT NOT NULL default '4', - maxattempts INT NOT NULL default '5', - review INT NOT NULL default '0', - nextpagedefault INT NOT NULL default '0', - feedback INT NOT NULL default '1', - minquestions INT NOT NULL default '0', - maxpages INT NOT NULL default '0', - timed INT NOT NULL default '0', - maxtime INT8 NOT NULL default '0', - retake INT NOT NULL default '1', - mediaheight INT NOT NULL DEFAULT '100', - mediawidth INT NOT NULL DEFAULT '650', - mediaclose INT NOT NULL DEFAULT '0', - slideshow INT NOT NULL default '0', - width INT8 NOT NULL default '640', - height INT8 NOT NULL default '480', - bgcolor varchar(7) default '#FFFFFF', - displayleft INT NOT NULL default '0', - displayleftif INT NOT NULL DEFAULT '0', - progressbar INT NOT NULL DEFAULT '0', - highscores INT NOT NULL default '0', - maxhighscores INT8 NOT NULL default '0' - ) ; - -CREATE TABLE prefix_lesson_timer - ( id SERIAL8 PRIMARY KEY, - lessonid INT8 not null default '0', - userid INT8 not null default '0', - starttime INT8 not null default '0', - lessontime INT8 not null default '0' - ); - -CREATE TABLE prefix_lesson_branch - ( id SERIAL8 PRIMARY KEY, - lessonid INT8 not null default '0', - userid INT8 not null default '0', - pageid INT8 not null default '0', - retry INT8 not null default '0', - flag INT not null default '0', - timeseen INT8 not null default '0' - ); - -CREATE TABLE prefix_lesson_high_scores - ( id SERIAL8 PRIMARY KEY, - lessonid INT8 not null default '0', - userid INT8 not null default '0', - gradeid INT8 not null default '0', - nickname varchar(5) not null default '' - ); - - -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('lesson', 'start', 'lesson', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('lesson', 'end', 'lesson', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('lesson', 'view', 'lesson_pages', 'title'); diff --git a/mod/quiz/db/mysql.sql b/mod/quiz/db/mysql.sql deleted file mode 100644 index bac5c73c7e0..00000000000 --- a/mod/quiz/db/mysql.sql +++ /dev/null @@ -1,251 +0,0 @@ --- -------------------------------------------------------- --- Quiz module and question bank table definitions. --- --- The tables are grouped divided by: --- quiz/questionbank and definition/runtime. --- -------------------------------------------------------- - --- -------------------------------------------------------- --- Quiz module, quiz definition data. --- -------------------------------------------------------- - -CREATE TABLE prefix_quiz ( - id int(10) unsigned NOT NULL auto_increment, - course int(10) unsigned NOT NULL default '0', - name varchar(255) NOT NULL default '', - intro text NOT NULL default '', - timeopen int(10) unsigned NOT NULL default '0', - timeclose int(10) unsigned NOT NULL default '0', - optionflags int(10) unsigned NOT NULL default '0', - penaltyscheme int(4) unsigned NOT NULL default '0', - attempts smallint(6) NOT NULL default '0', - attemptonlast tinyint(4) NOT NULL default '0', - grademethod tinyint(4) NOT NULL default '1', - decimalpoints int(4) NOT NULL default '2', - review int(10) unsigned NOT NULL default '0', - questionsperpage int(10) NOT NULL default '0', - shufflequestions tinyint(4) NOT NULL default '0', - shuffleanswers tinyint(4) NOT NULL default '0', - questions text NOT NULL default '', - sumgrades int(10) NOT NULL default '0', - grade int(10) NOT NULL default '0', - timecreated int(10) unsigned NOT NULL default '0', - timemodified int(10) unsigned NOT NULL default '0', - timelimit int(2) unsigned NOT NULL default '0', - password varchar(255) NOT NULL default '', - subnet varchar(255) NOT NULL default '', - popup tinyint(4) NOT NULL default '0', - delay1 int(10) NOT NULL default '0', - delay2 int(10) NOT NULL default '0', - PRIMARY KEY (id), - KEY course (course) -) TYPE=MyISAM COMMENT='Main information about each quiz'; - -CREATE TABLE prefix_quiz_question_instances ( - id int(10) unsigned NOT NULL auto_increment, - quiz int(10) unsigned NOT NULL default '0', - question int(10) unsigned NOT NULL default '0', - grade smallint(6) NOT NULL default '0', - PRIMARY KEY (id), - KEY quiz (quiz), - KEY question (question) -) TYPE=MyISAM COMMENT='The grade for a question in a quiz'; - -CREATE TABLE prefix_quiz_question_versions ( - id int(10) unsigned NOT NULL auto_increment, - quiz int(10) unsigned NOT NULL default '0', - oldquestion int(10) unsigned NOT NULL default '0', - newquestion int(10) unsigned NOT NULL default '0', - originalquestion int(10) unsigned NOT NULL default '0', - userid int(10) unsigned NOT NULL default '0', - timestamp int(10) unsigned NOT NULL default '0', - PRIMARY KEY (id) -) TYPE=MyISAM COMMENT='The mapping between old and new versions of a question'; - -CREATE TABLE prefix_quiz_feedback ( - id int(10) unsigned NOT NULL auto_increment, - quizid int(10) unsigned NOT NULL default '0', - feedbacktext text NOT NULL default '', - mingrade double NOT NULL default '0', - maxgrade double NOT NULL default '0', - PRIMARY KEY (id), - KEY quizid (quizid) -) TYPE=MyISAM COMMENT='Feedback given to students based on their overall score on the test'; - --- -------------------------------------------------------- --- Quiz module, quiz runtime data. --- -------------------------------------------------------- - -CREATE TABLE prefix_quiz_attempts ( - id int(10) unsigned NOT NULL auto_increment, - uniqueid int(10) unsigned NOT NULL default '0', - quiz int(10) unsigned NOT NULL default '0', - userid int(10) unsigned NOT NULL default '0', - attempt smallint(6) NOT NULL default '0', - sumgrades float NOT NULL default '0', - timestart int(10) unsigned NOT NULL default '0', - timefinish int(10) unsigned NOT NULL default '0', - timemodified int(10) unsigned NOT NULL default '0', - layout text NOT NULL default '', - preview tinyint(3) unsigned NOT NULL default '0', - PRIMARY KEY (id), - UNIQUE KEY `uniqueid` (`uniqueid`), - KEY quiz (quiz), - KEY userid (userid) -) TYPE=MyISAM COMMENT='Stores various attempts on a quiz'; - -CREATE TABLE prefix_quiz_grades ( - id int(10) unsigned NOT NULL auto_increment, - quiz int(10) unsigned NOT NULL default '0', - userid int(10) unsigned NOT NULL default '0', - grade double NOT NULL default '0', - timemodified int(10) unsigned NOT NULL default '0', - PRIMARY KEY (id), - KEY quiz (quiz), - KEY userid (userid) -) TYPE=MyISAM COMMENT='Final quiz grade (may be best of several attempts)'; - --- -------------------------------------------------------- --- Questionbank definition data. --- --- TODO, these tables no longer belong to the quiz module. --- They should be moved elsewhere when a good home for them --- is found. --- -------------------------------------------------------- - -CREATE TABLE prefix_question_categories ( - id int(10) unsigned NOT NULL auto_increment, - course int(10) unsigned NOT NULL default '0', - name varchar(255) NOT NULL default '', - info text NOT NULL default '', - publish tinyint(4) NOT NULL default '0', - stamp varchar(255) NOT NULL default '', - parent int(10) unsigned NOT NULL default '0', - sortorder int(10) unsigned NOT NULL default '999', - PRIMARY KEY (id), - KEY course (course) -) TYPE=MyISAM COMMENT='Categories are for grouping questions'; - -CREATE TABLE prefix_question ( - id int(10) NOT NULL auto_increment, - category int(10) NOT NULL default '0', - parent int(10) unsigned NOT NULL default '0', - name varchar(255) NOT NULL default '', - questiontext text NOT NULL, - questiontextformat tinyint(2) NOT NULL default '0', - image varchar(255) NOT NULL default '', - generalfeedback text NOT NULL, - defaultgrade int(10) unsigned NOT NULL default '1', - penalty float NOT NULL default '0.1', - qtype varchar(20) NOT NULL default '', - length int(10) unsigned NOT NULL default '1', - stamp varchar(255) NOT NULL default '', - version varchar(255) NOT NULL default '', - hidden int(1) unsigned NOT NULL default '0', - PRIMARY KEY (id), - KEY category (category) -) TYPE=MyISAM COMMENT='The quiz questions themselves'; - -CREATE TABLE prefix_question_answers ( - id int(10) unsigned NOT NULL auto_increment, - question int(10) unsigned NOT NULL default '0', - answer text NOT NULL default '', - fraction float NOT NULL default '0', - feedback text NOT NULL default '', - PRIMARY KEY (id), - KEY question (question) -) TYPE=MyISAM COMMENT='Answers, with a fractional grade (0-1) and feedback'; - -CREATE TABLE prefix_question_numerical_units ( - id int(10) unsigned NOT NULL auto_increment, - question int(10) unsigned NOT NULL default '0', - multiplier decimal(40,20) NOT NULL default '1.00000000000000000000', - unit varchar(50) NOT NULL default '', - PRIMARY KEY (id), - KEY question (question) -) TYPE=MyISAM COMMENT='Optional unit options for numerical questions'; - -CREATE TABLE prefix_question_datasets ( - id int(10) unsigned NOT NULL auto_increment, - question int(10) unsigned NOT NULL default '0', - datasetdefinition int(10) unsigned NOT NULL default '0', - PRIMARY KEY (id), - KEY question (question,datasetdefinition) -) TYPE=MyISAM COMMENT='Many-many relation between questions and dataset definitions'; - -CREATE TABLE prefix_question_dataset_definitions ( - id int(10) unsigned NOT NULL auto_increment, - category int(10) unsigned NOT NULL default '0', - name varchar(255) NOT NULL default '', - type int(10) NOT NULL default '0', - options varchar(255) NOT NULL default '', - itemcount int(10) unsigned NOT NULL default '0', - PRIMARY KEY (id), - KEY category (category) -) TYPE=MyISAM COMMENT='Organises and stores properties for dataset items'; - -CREATE TABLE prefix_question_dataset_items ( - id int(10) unsigned NOT NULL auto_increment, - definition int(10) unsigned NOT NULL default '0', - itemnumber int(10) unsigned NOT NULL default '0', - value varchar(255) NOT NULL default '', - PRIMARY KEY (id), - KEY definition (definition) -) TYPE=MyISAM COMMENT='Individual dataset items'; - --- -------------------------------------------------------- --- Questionbank runtime data. --- See above TODO. --- -------------------------------------------------------- - -CREATE TABLE prefix_question_attempts ( - id int(10) unsigned NOT NULL auto_increment, - modulename varchar(20) NOT NULL default 'quiz', - PRIMARY KEY (id) -) TYPE=MyISAM COMMENT='Student attempts. This table gets extended by the modules'; - -CREATE TABLE prefix_question_sessions ( - id int(10) unsigned NOT NULL auto_increment, - attemptid int(10) unsigned NOT NULL default '0', - questionid int(10) unsigned NOT NULL default '0', - newest int(10) unsigned NOT NULL default '0', - newgraded int(10) unsigned NOT NULL default '0', - sumpenalty float NOT NULL default '0', - manualcomment text NOT NULL default '', - PRIMARY KEY (id), - UNIQUE KEY attemptid (attemptid,questionid) -) TYPE=MyISAM COMMENT='Gives ids of the newest open and newest graded states'; - -CREATE TABLE prefix_question_states ( - id int(10) unsigned NOT NULL auto_increment, - attempt int(10) unsigned NOT NULL default '0', - question int(10) unsigned NOT NULL default '0', - originalquestion int(10) unsigned NOT NULL default '0', - seq_number int(6) unsigned NOT NULL default '0', - answer text NOT NULL default '', - timestamp int(10) unsigned NOT NULL default '0', - event int(4) unsigned NOT NULL default '0', - grade float NOT NULL default '0', - raw_grade float NOT NULL default '0', - penalty float NOT NULL default '0', - PRIMARY KEY (id), - KEY attempt (attempt), - KEY question (question) -) TYPE=MyISAM COMMENT='Stores user responses to a quiz, and percentage grades'; - --- -------------------------------------------------------- --- Quiz log actions. --- -------------------------------------------------------- - -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('quiz', 'add', 'quiz', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('quiz', 'update', 'quiz', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('quiz', 'view', 'quiz', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('quiz', 'report', 'quiz', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('quiz', 'attempt', 'quiz', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('quiz', 'submit', 'quiz', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('quiz', 'review', 'quiz', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('quiz', 'editquestions', 'quiz', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('quiz', 'preview', 'quiz', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('quiz', 'start attempt', 'quiz', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('quiz', 'close attempt', 'quiz', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('quiz', 'continue attempt', 'quiz', 'name'); diff --git a/mod/quiz/db/postgres7.sql b/mod/quiz/db/postgres7.sql deleted file mode 100644 index 143f6d1e7c4..00000000000 --- a/mod/quiz/db/postgres7.sql +++ /dev/null @@ -1,236 +0,0 @@ --- -------------------------------------------------------- --- Quiz module and question bank table definitions. --- --- The tables are grouped divided by: --- quiz/questionbank and definition/runtime. --- -------------------------------------------------------- - --- -------------------------------------------------------- --- Quiz module, quiz definition data. --- -------------------------------------------------------- - -CREATE TABLE prefix_quiz ( - id SERIAL PRIMARY KEY, - course integer NOT NULL default '0', - name varchar(255) NOT NULL default '', - intro text NOT NULL default '', - timeopen integer NOT NULL default '0', - timeclose integer NOT NULL default '0', - optionflags integer NOT NULL default '0', - penaltyscheme integer NOT NULL default '0', - attempts integer NOT NULL default '0', - attemptonlast integer NOT NULL default '0', - grademethod integer NOT NULL default '1', - decimalpoints integer NOT NULL default '2', - review integer NOT NULL default '0', - questionsperpage integer NOT NULL default '0', - shufflequestions integer NOT NULL default '0', - shuffleanswers integer NOT NULL default '0', - questions text NOT NULL default '', - sumgrades integer NOT NULL default '0', - grade integer NOT NULL default '0', - timecreated integer NOT NULL default '0', - timemodified integer NOT NULL default '0', - timelimit integer NOT NULL default '0', - password varchar(255) NOT NULL default '', - subnet varchar(255) NOT NULL default '', - popup integer NOT NULL default '0', - delay1 integer NOT NULL default '0', - delay2 integer NOT NULL default '0' -); -CREATE INDEX prefix_quiz_course_idx ON prefix_quiz (course); - -CREATE TABLE prefix_quiz_question_instances ( - id SERIAL PRIMARY KEY, - quiz integer NOT NULL default '0', - question integer NOT NULL default '0', - grade integer NOT NULL default '0' -); -CREATE INDEX prefix_quiz_question_instances_quiz_idx ON prefix_quiz_question_instances (quiz); -CREATE INDEX prefix_quiz_question_instances_question_idx ON prefix_quiz_question_instances (question); - -CREATE TABLE prefix_quiz_question_versions ( - id SERIAL PRIMARY KEY, - quiz integer NOT NULL default '0', - oldquestion integer NOT NULL default '0', - newquestion integer NOT NULL default '0', - originalquestion integer NOT NULL default '0', - userid integer NOT NULL default '0', - timestamp integer NOT NULL default '0' -); - -CREATE TABLE prefix_quiz_feedback ( - id SERIAL PRIMARY KEY, - quizid integer NOT NULL default '0', - feedbacktext text NOT NULL default '', - mingrade real NOT NULL default '0', - maxgrade real NOT NULL default '0' -); -CREATE INDEX prefix_quiz_feedback_quizid_idx ON prefix_quiz_feedback (quizid); - --- -------------------------------------------------------- --- Quiz module, quiz runtime data. --- -------------------------------------------------------- - -CREATE TABLE prefix_quiz_attempts ( - id SERIAL PRIMARY KEY, - uniqueid integer NOT NULL default '0', - quiz integer NOT NULL default '0', - userid integer NOT NULL default '0', - attempt integer NOT NULL default '0', - sumgrades real NOT NULL default '0', - timestart integer NOT NULL default '0', - timefinish integer NOT NULL default '0', - timemodified integer NOT NULL default '0', - layout text NOT NULL default '', - preview integer NOT NULL default '0' -); -CREATE INDEX prefix_quiz_attempts_quiz_idx ON prefix_quiz_attempts (quiz); -CREATE INDEX prefix_quiz_attempts_userid_idx ON prefix_quiz_attempts (userid); -CREATE UNIQUE INDEX prefix_quiz_attempts_uniqueid_uk ON prefix_quiz_attempts (uniqueid); - -CREATE TABLE prefix_quiz_grades ( - id SERIAL PRIMARY KEY, - quiz integer NOT NULL default '0', - userid integer NOT NULL default '0', - grade real NOT NULL default '0', - timemodified integer NOT NULL default '0' -); - -CREATE INDEX prefix_quiz_grades_quiz_idx ON prefix_quiz_grades (quiz); -CREATE INDEX prefix_quiz_grades_userid_idx ON prefix_quiz_grades (userid); - --- -------------------------------------------------------- --- Questionbank definition data. --- --- TODO, these tables no longer belong to the quiz module. --- They should be moved elsewhere when a good home for them --- is found. --- -------------------------------------------------------- - -CREATE TABLE prefix_question_categories ( - id SERIAL PRIMARY KEY, - course integer NOT NULL default '0', - name varchar(255) NOT NULL default '', - info text NOT NULL default '', - publish integer NOT NULL default '0', - stamp varchar(255) NOT NULL default '', - parent integer NOT NULL default '0', - sortorder integer NOT NULL default '999' -); -CREATE INDEX prefix_question_categories_course_idx ON prefix_question_categories (course); - -CREATE TABLE prefix_question ( - id SERIAL PRIMARY KEY, - category integer NOT NULL default '0', - parent integer NOT NULL default '0', - name varchar(255) NOT NULL default '', - questiontext text NOT NULL default '', - questiontextformat integer NOT NULL default '0', - image varchar(255) NOT NULL default '', - generalfeedback text NOT NULL default '', - defaultgrade integer NOT NULL default '1', - penalty real NOT NULL default '0.1', - qtype varchar(20) NOT NULL default '0', - length integer NOT NULL DEFAULT '1', - stamp varchar(255) NOT NULL default '', - version varchar(255) NOT NULL default '', - hidden integer NOT NULL default '0' -); -CREATE INDEX prefix_question_category_idx ON prefix_question (category); - -CREATE TABLE prefix_question_answers ( - id SERIAL PRIMARY KEY, - question integer NOT NULL default '0', - answer text NOT NULL default '', - fraction real NOT NULL default '0', - feedback text NOT NULL default '' -); -CREATE INDEX prefix_question_answers_question_idx ON prefix_question_answers (question); - -CREATE TABLE prefix_question_numerical_units ( - id SERIAL8 PRIMARY KEY, - question INT8 NOT NULL default '0', - multiplier decimal(40,20) NOT NULL default '1.00000000000000000000', - unit varchar(50) NOT NULL default '' -); -CREATE INDEX prefix_question_numerical_units_question_idx ON prefix_question_numerical_units (question); - -CREATE TABLE prefix_question_datasets ( - id SERIAL8 PRIMARY KEY, - question INT8 NOT NULL default '0', - datasetdefinition INT8 NOT NULL default '0' -); -CREATE INDEX prefix_question_datasets_question_datasetdefinition_idx ON prefix_question_datasets (question,datasetdefinition); - -CREATE TABLE prefix_question_dataset_definitions ( - id SERIAL8 PRIMARY KEY, - category INT8 NOT NULL default '0', - name varchar(255) NOT NULL default '', - type INT8 NOT NULL default '0', - options varchar(255) NOT NULL default '', - itemcount INT8 NOT NULL default '0' -); -CREATE INDEX prefix_question_dataset_definitions_category_idx ON prefix_question_dataset_definitions (category); - -CREATE TABLE prefix_question_dataset_items ( - id SERIAL8 PRIMARY KEY, - definition INT8 NOT NULL default '0', - itemnumber INT8 NOT NULL default '0', - value varchar(255) NOT NULL default '' -); -CREATE INDEX prefix_question_dataset_items_definition_idx ON prefix_question_dataset_items (definition); - --- -------------------------------------------------------- --- Questionbank runtime data. --- See above TODO. --- -------------------------------------------------------- - -CREATE TABLE prefix_question_attempts ( - id SERIAL PRIMARY KEY, - modulename varchar(20) NOT NULL default 'quiz' -); - -CREATE TABLE prefix_question_sessions ( - id SERIAL PRIMARY KEY, - attemptid integer NOT NULL default '0', - questionid integer NOT NULL default '0', - newest integer NOT NULL default '0', - newgraded integer NOT NULL default '0', - sumpenalty real NOT NULL default '0', - manualcomment text NOT NULL default '' -); -CREATE UNIQUE INDEX prefix_question_sessions_attempt_idx ON prefix_question_sessions (attemptid,questionid); - -CREATE TABLE prefix_question_states ( - id SERIAL PRIMARY KEY, - attempt integer NOT NULL default '0', - question integer NOT NULL default '0', - originalquestion integer NOT NULL default '0', - seq_number integer NOT NULL default '0', - answer text NOT NULL default '', - timestamp integer NOT NULL default '0', - event integer NOT NULL default '0', - grade real NOT NULL default '0', - raw_grade real NOT NULL default '0', - penalty real NOT NULL default '0' -); -CREATE INDEX prefix_question_states_attempt_idx ON prefix_question_states (attempt); -CREATE INDEX prefix_question_states_question_idx ON prefix_question_states (question); - --- -------------------------------------------------------- --- Quiz log actions. --- -------------------------------------------------------- - -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('quiz', 'add', 'quiz', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('quiz', 'update', 'quiz', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('quiz', 'view', 'quiz', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('quiz', 'report', 'quiz', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('quiz', 'attempt', 'quiz', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('quiz', 'submit', 'quiz', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('quiz', 'review', 'quiz', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('quiz', 'editquestions', 'quiz', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('quiz', 'preview', 'quiz', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('quiz', 'start attempt', 'quiz', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('quiz', 'close attempt', 'quiz', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('quiz', 'continue attempt', 'quiz', 'name'); diff --git a/mod/quiz/report/analysis/report.php b/mod/quiz/report/analysis/report.php index e77f03a5320..5d52978b83e 100644 --- a/mod/quiz/report/analysis/report.php +++ b/mod/quiz/report/analysis/report.php @@ -26,12 +26,10 @@ class quiz_report extends quiz_default_report { if (!$download) { $currentgroup = setup_and_print_groups($course, $groupmode, "report.php?id=$cm->id&mode=analysis"); } else { - $changegroup = optional_param('group', -1, PARAM_INT); - - $currentgroup = get_and_set_current_group($course, $groupmode, $changegroup); + $currentgroup = get_and_set_current_group($course, $groupmode); } } else { - $currentgroup = false; + $currentgroup = get_and_set_current_group($course, $groupmode); } // set Table and Analysis stats options @@ -76,13 +74,18 @@ class quiz_report extends quiz_default_report { $usermax = get_records_sql_menu($sql); } - $sql = 'SELECT qa.* FROM '.$CFG->prefix.'user u '. - 'JOIN '.$CFG->prefix.'quiz_attempts qa ON u.id = qa.userid '; - if (!empty($currentgroup)) { - $sql .= groups_members_join_sql($currentgroup); + $groupmembers = ''; + $groupwhere = ''; + + //Add this to the SQL to show only group users + if ($currentgroup) { + $groupmembers = ', '.groups_members_from_sql(); + $groupwhere = ' AND '.groups_members_where_sql($currentgroup, 'u.id'); } - $sql .= ' WHERE qa.quiz = '.$quiz->id. // ULPGC ecastro - ' AND ( qa.sumgrades >= '.$scorelimit.' ) '; + + $sql = 'SELECT qa.* FROM '.$CFG->prefix.'quiz_attempts qa, '.$CFG->prefix.'user u '.$groupmembers. + 'WHERE u.id = qa.userid AND qa.quiz = '.$quiz->id.' AND ( qa.sumgrades >= '.$scorelimit.' ) '.$groupwhere; + // ^^^^^^ es posible seleccionar aqu� TODOS los quizzes, como quiere Jussi, // pero habr�a que llevar la cuenta ed cada quiz para restaura las preguntas (quizquestions, states) diff --git a/mod/quiz/tabs.php b/mod/quiz/tabs.php index bd46d6a5ec4..059e435941e 100644 --- a/mod/quiz/tabs.php +++ b/mod/quiz/tabs.php @@ -37,7 +37,7 @@ if (has_capability('mod/quiz:preview', $context)) { $row[] = new tabobject('preview', "$CFG->wwwroot/mod/quiz/attempt.php?q=$quiz->id", get_string('preview', 'quiz')); } if (has_capability('mod/quiz:manage', $context)) { - $row[] = new tabobject('edit', "$CFG->wwwroot/mod/quiz/edit.php?quizid=$quiz->id", get_string('edit')); + $row[] = new tabobject('edit', "$CFG->wwwroot/mod/quiz/edit.php?cmid=$cm->id", get_string('edit')); } if ($currenttab == 'info' && count($row) == 1) { @@ -82,8 +82,9 @@ if ($currenttab == 'edit' and isset($mode)) { $strquiz = get_string('modulename', 'quiz'); $streditingquiz = get_string("editinga", "moodle", $strquiz); $strupdate = get_string('updatethis', 'moodle', $strquiz); - $row[] = new tabobject('editq', "$CFG->wwwroot/mod/quiz/edit.php?quizid=$quiz->id", $strquiz, $streditingquiz); - questionbank_navigation_tabs($row, $context, $course->id); + + $row[] = new tabobject('editq', "$CFG->wwwroot/mod/quiz/edit.php?".$thispageurl->get_query_string(), $strquiz, $streditingquiz); + questionbank_navigation_tabs($row, $context, $thispageurl->get_query_string()); $tabs[] = $row; } diff --git a/mod/resource/db/mysql.sql b/mod/resource/db/mysql.sql deleted file mode 100755 index dbd61a1d3a6..00000000000 --- a/mod/resource/db/mysql.sql +++ /dev/null @@ -1,40 +0,0 @@ -# phpMyAdmin MySQL-Dump -# version 2.2.1 -# http://phpwizard.net/phpMyAdmin/ -# http://phpmyadmin.sourceforge.net/ (download page) -# -# Host: localhost -# Generation Time: Nov 14, 2001 at 04:43 PM -# Server version: 3.23.36 -# PHP Version: 4.0.6 -# Database : `moodle` -# -------------------------------------------------------- - -# -# Table structure for table `resource` -# - -CREATE TABLE prefix_resource ( - id int(10) unsigned NOT NULL auto_increment, - course int(10) unsigned NOT NULL default '0', - name varchar(255) NOT NULL default '', - type varchar(30) NOT NULL default '', - reference varchar(255) NOT NULL default '', - summary text NOT NULL default '', - alltext text NOT NULL default '', - popup text NOT NULL default '', - options varchar(255) NOT NULL default '', - timemodified int(10) unsigned NOT NULL default '0', - PRIMARY KEY (id), - UNIQUE KEY id (id), - KEY `course` (`course`) -) TYPE=MyISAM; - - -# -# Dumping data for table `log_display` -# - -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('resource', 'view', 'resource', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('resource', 'update', 'resource', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('resource', 'add', 'resource', 'name'); diff --git a/mod/resource/db/postgres7.sql b/mod/resource/db/postgres7.sql deleted file mode 100644 index 8660faf5cb5..00000000000 --- a/mod/resource/db/postgres7.sql +++ /dev/null @@ -1,38 +0,0 @@ -# phpMyAdmin MySQL-Dump -# version 2.2.1 -# http://phpwizard.net/phpMyAdmin/ -# http://phpmyadmin.sourceforge.net/ (download page) -# -# Host: localhost -# Generation Time: Nov 14, 2001 at 04:43 PM -# Server version: 3.23.36 -# PHP Version: 4.0.6 -# Database : `moodle` -# -------------------------------------------------------- - -# -# Table structure for table `resource` -# - -CREATE TABLE prefix_resource ( - id SERIAL PRIMARY KEY, - course integer NOT NULL default '0', - name varchar(255) NOT NULL default '', - type varchar(30) NOT NULL default '', - reference varchar(255) default NULL, - summary text NOT NULL default '', - alltext text NOT NULL default '', - popup text NOT NULL default '', - options varchar(255) NOT NULL default '', - timemodified integer NOT NULL default '0' -); - -CREATE INDEX prefix_resource_course_idx ON prefix_resource (course); - -# -# Dumping data for table `log_display` -# - -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('resource', 'view', 'resource', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('resource', 'update', 'resource', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('resource', 'add', 'resource', 'name'); diff --git a/mod/resource/fetch.php b/mod/resource/fetch.php deleted file mode 100644 index 7c85b14dcfb..00000000000 --- a/mod/resource/fetch.php +++ /dev/null @@ -1,31 +0,0 @@ -<?php // $Id$ - // Fetches an external URL and passes it through the filters - - die; //not used anymore, please FIX SC #99 before enabling - - require_once("../../config.php"); - require_once("lib.php"); - - $id = required_param('id', PARAM_INT); // Course Module ID - $url = required_param('url', PARAM_URL); // url to fetch - - if (! $cm = get_coursemodule_from_id('resource', $id)) { - error("Course Module ID was incorrect"); - } - - if (! $course = get_record("course", "id", $cm->course)) { - error("Course is misconfigured"); - } - - require_course_login($course, true, $cm); - - if (! $resource = get_record("resource", "id", $cm->instance)) { - error("Resource ID was incorrect"); - } - - $content = resource_fetch_remote_file($cm, $url); - - $formatoptions->noclean = true; - echo format_text($content->results, FORMAT_HTML, $formatoptions, $course->id); - -?> diff --git a/mod/resource/mod.html b/mod/resource/mod.html deleted file mode 100644 index 47e759115b8..00000000000 --- a/mod/resource/mod.html +++ /dev/null @@ -1,13 +0,0 @@ -<?php // $Id$ - // This script prints the setup screen for any resource - // It does this by calling the setup method in the appropriate class - -require_once("$CFG->dirroot/mod/resource/lib.php"); -require_once("$CFG->dirroot/mod/resource/type/$form->type/resource.class.php"); - -$resourceclass = "resource_$form->type"; -$resource = new $resourceclass(); - -$resource->setup($form); - -?> diff --git a/mod/resource/type/common.html b/mod/resource/type/common.html deleted file mode 100644 index 8cacf6303b4..00000000000 --- a/mod/resource/type/common.html +++ /dev/null @@ -1,33 +0,0 @@ -<form id="form" method="post" action="<?php echo "$CFG->wwwroot/course/mod.php" ?>"> -<fieldset class="invisiblefieldset"> - -<input type="hidden" name="type" value="<?php p($form->type) ?>" /> -<input type="hidden" name="course" value="<?php p($form->course) ?>" /> -<input type="hidden" name="sesskey" value="<?php p($form->sesskey) ?>" /> -<input type="hidden" name="coursemodule" value="<?php p($form->coursemodule) ?>" /> -<input type="hidden" name="section" value="<?php p($form->section) ?>" /> -<input type="hidden" name="module" value="<?php p($form->module) ?>" /> -<input type="hidden" name="modulename" value="<?php p($form->modulename) ?>" /> -<input type="hidden" name="instance" value="<?php p($form->instance) ?>" /> -<input type="hidden" name="mode" value="<?php p($form->mode) ?>" /> - -<table cellpadding="5"> -<tr valign="top"> - <td align="right"><b><?php print_string("name") ?>:</b></td> - <td> - <input type="text" name="name" size="65" value="<?php p($form->name) ?>" alt="<?php print_string("name") ?>" /> - </td> -</tr> -<tr valign="top"> - <td align="right"><b><?php print_string("summary") ?>:</b><br /> - <?php - helpbutton("summary", get_string("summary"), "resource", true, true); - ?> - <br /> - </td> - <td> - <?php print_textarea($usehtmleditor, 10, 65, 680, 400, "summary", $form->summary); ?> - <br /> - </td> -</tr> - diff --git a/mod/resource/type/common_end.html b/mod/resource/type/common_end.html deleted file mode 100644 index 4e90c2d4c03..00000000000 --- a/mod/resource/type/common_end.html +++ /dev/null @@ -1,6 +0,0 @@ -</table> -<div class="boxaligncenter"> -<input type="submit" value="<?php print_string("savechanges") ?>" /> -</div> -</fieldset> -</form> diff --git a/mod/resource/type/directory/directory.html b/mod/resource/type/directory/directory.html deleted file mode 100644 index 76205331541..00000000000 --- a/mod/resource/type/directory/directory.html +++ /dev/null @@ -1,16 +0,0 @@ -<tr valign="top"> - <td align="right" style="white-space:nowrap;"> - <b><?php print_string("resourcetypedirectory", "resource") ?>:</b> - </td> - <td> - <?php choose_from_menu($dirs, "reference", $form->reference, get_string("maindirectory", "resource"), '', '') ?> - </td> -</tr> -<tr valign="top"> - <td align="right" nowrap="nowrap"> - </td> - <td> - <p><?php print_string("directoryinfo", "resource") ?></p> - </td> -</tr> -<?php print_visible_setting($form); ?> diff --git a/mod/resource/type/file/file.html b/mod/resource/type/file/file.html deleted file mode 100644 index 8f74f955ffc..00000000000 --- a/mod/resource/type/file/file.html +++ /dev/null @@ -1,215 +0,0 @@ - -<tr valign="top"> - <td align="right" style="white-space:nowrap;"> - - -<script type="text/javascript"> -//<![CDATA[ - function showhide (id, set) { - divobj = document.getElementById(id); - butobj = document.getElementById(id+'button'); - prefobj = document.getElementById(id+'pref'); - if (set == true) { - if (prefobj.value == '1') { - divobj.style.display = 'block'; - butobj.value = '<?php print_string("hidesettings") ?>'; - } else { - divobj.style.display = 'none'; - butobj.value = '<?php print_string("showsettings") ?>...'; - } - } else { - if (prefobj.value == '1') { - divobj.style.display = 'none'; - butobj.value = '<?php print_string("showsettings") ?>...'; - prefobj.value = '0'; - } else { - divobj.style.display = 'block'; - butobj.value = '<?php print_string("hidesettings") ?>'; - prefobj.value = '1'; - } - } - } -//]]> -</script> - - - <b><?php echo $strfilename ?>:</b> - </td> - <td> - <?php - echo "<input type=\"text\" name=\"reference\" size=\"90\" value=\"$form->reference\" alt=\"reference\" /><br />"; - button_to_popup_window ("/files/index.php?id=$form->course&choose=form.reference", "coursefiles", $strchooseafile, 500, 750, $strchooseafile); - echo "<input type=\"button\" name=\"searchbutton\" value=\"$strsearch ...\" ". - "onclick=\"return window.open('$CFG->resource_websearch', 'websearch', 'menubar=1,location=1,directories=1,toolbar=1,scrollbars,resizable,width=800,height=600');\" />\n"; - if ($CFG->resource_allowlocalfiles) { - button_to_popup_window ("/mod/resource/type/file/localfile.php?choose=form.reference", - "localfiles", get_string('localfilechoose', 'resource'), 400, 600, - get_string('localfilechoose', 'resource')); - } - ?> - </td> -</tr> - -<tr><td colspan="2"><hr /></td></tr> - -<tr> - <td align="right"><b><?php print_string("display", "resource") ?>:</b></td> - <td> - <input type="button" value="hide settings" id="windowsettingsbutton" onclick="javascript: return showhide('windowsettings');" /> - <input type="hidden" name="windowsettingspref" id="windowsettingspref" - value="<?php echo get_user_preferences('resource_windowsettingspref', $CFG->resource_windowsettings); ?>" /> - <?php helpbutton("window", get_string("display", "resource"), "resource", true) ?> - </td> -</tr> -<tr><td colspan="2"> - - <div id="windowsettings"> - -<table class="boxaligncenter"> - - -<tr valign="top"> - - <td colspan="2"> - <script type="text/javascript"> - //<![CDATA[ - var popupitems = [<?php echo $popupoptions; ?>]; - var frameitem = [<?php echo $frameoption; ?>]; - var allitems = [<?php echo $alloptions; ?>]; - //]]> - </script> - <input type="radio" name="windowpopup" value="0" alt="<?php print_string('pagewindow', 'resource') ?>" <?php echo ($windowtype != "popup") ? "checked=\"checked\"" : "" ?> - onclick="lockoptions('form', 'windowpopup[0]', frameitem); - return lockoptions('form', 'windowpopup[1]', popupitems);" /> - <b title="<?php print_string("pagedisplay", "resource") ?>"><?php print_string("pagewindow", "resource") ?></b> - <blockquote> - <fieldset class="invisiblefieldset"> - <input type="hidden" name="hframepage" value="0" /> - <input type="checkbox" name="framepage" value="1" <?php echo ($form->options == "frame") ? "checked=\"checked\"" : "" ?> alt="<?php print_string('frameifpossible', 'resource') ?>" /> - <?php print_string("frameifpossible", "resource") ?> - </fieldset> - </blockquote> - </td> -</tr> - -<tr valign="top"> - - <td colspan="2"> - <input name="windowpopup" type="radio" value="1" alt="<?php p($strnewwindow)?>" <?php echo ($windowtype == "popup") ? "checked=\"checked\"" : "" ?> - onclick="lockoptions('form', 'windowpopup[0]', frameitem); - return lockoptions('form', 'windowpopup[1]', popupitems);" /> - <b title="<?php p($strnewwindowopen) ?>"><?php p($strnewwindow) ?></b> - <blockquote> - <fieldset class="invisiblefieldset"> - <?php - foreach ($window as $name => $value) { - if ($name == "height" or $name == "width") { - continue; - } - echo "<input name=\"h$name\" type=\"hidden\" value=\"0\" />"; - echo "<input name=\"$name\" type=\"checkbox\" value=\"1\" ".$window->$name." alt=\"$name\" />"; - $stringname = "str$name"; - echo $$stringname."<br />"; - } - ?> - - <input name="hwidth" type="hidden" value="0" /> - <input name="width" type="text" size="4" value="<?php p($window->width) ?>" alt="<?php p($strwidth) ?>" /> - <?php p($strwidth) ?><br /> - - <input name="hheight" type="hidden" value="0" /> - <input name="height" type="text" size="4" value="<?php p($window->height) ?>" alt="<?php p($strheight) ?>" /> - <?php p($strheight) ?><br /> - <?php - if ($windowtype == "page") { - echo "<script type=\"text/javascript\">"; - echo "\n//<![CDATA[\n"; - echo "lockoptions('form','windowpopup[1]', popupitems);"; - echo "\n//]]>\n"; - echo "</script>"; - } else { - echo "<script type=\"text/javascript\">"; - echo "\n//<![CDATA[\n"; - echo "lockoptions('form','windowpopup[0]', frameitem);"; - echo "\n//]]>\n"; - echo "</script>"; - } - ?> - </fieldset> - </blockquote> - </td> -</tr> - -</table> - - </div> - -</td></tr> - -<tr> - <td align="right"><b><?php print_string("parameters", "resource") ?>:</b></td> - <td> - <input type="button" value="hide settings" id="parametersettingsbutton" onclick="javascript: return showhide('parametersettings');" /> - <input type="hidden" name="parametersettingspref" id="parametersettingspref" - value="<?php echo get_user_preferences('resource_parametersettingspref', $CFG->resource_parametersettings); ?>" /> - <?php helpbutton("parameters", get_string("parameters", "resource"), "resource", true) ?> - </td> -</tr> -<tr><td colspan="2"> - - <div id="parametersettings"> - -<table class="noxaligncenter"> - - <tr> - <td align="center"><?php print_string("parameter", "resource") ?></td> - <td align="center"><?php print_string("variablename", "resource") ?></td> - </tr> - -<?php - -for ($i=0; $i < $this->maxparameters; $i++) { - echo "<tr>\n"; - echo "<td valign=\"top\">\n"; - echo "<select name=\"parameter$i\">\n"; - echo "<option value=\"-\">-- ".get_string('chooseparameter', 'resource')." --</option>\n"; - foreach ($this->parameters as $field=>$fieldarr) { - if ($fieldarr['value'] === "optgroup") { - echo "<optgroup label=\"{$fieldarr['langstr']}\">\n"; - } elseif ($fieldarr['value'] === "/optgroup") { - echo "</optgroup>\n"; - } else { - echo "<option value=\"$field\""; - if ($alltextfield[$i]['parameter'] == $field) { - echo " selected=\"selected\""; - } - echo ">{$fieldarr['langstr']}</option>\n"; - } - } - echo "</select>\n"; - echo "</td>\n"; - echo "<td valign=\"top\">\n"; - echo "<input type=\"text\" name=\"parse$i\" value=\"{$alltextfield[$i]['parse']}\" alt=\"parameter$i\"/>\n"; - echo "</td>\n"; - echo "</tr>\n"; -} - -?> - - -</table> - - </div> - - -<script type="text/javascript"> -//<![CDATA[ - showhide('parametersettings', true); - showhide('windowsettings', true); -//]]> -</script> - - -</td></tr> - -<?php print_visible_setting($form); ?> diff --git a/mod/resource/type/file/localfile.php b/mod/resource/type/file/localfile.php index 8f412e1a5ce..576e7db020c 100644 --- a/mod/resource/type/file/localfile.php +++ b/mod/resource/type/file/localfile.php @@ -3,7 +3,7 @@ require('../../../../config.php'); require('../../lib.php'); - $choose = required_param('choose'); + $choose = required_param('choose', PARAM_FILE); require_login(); @@ -15,8 +15,6 @@ print_simple_box(get_string('localfileinfo', 'resource'), 'center'); - $chooseparts = explode('.', $choose); - ?> <script type="text/javascript"> //<![CDATA[ @@ -28,7 +26,7 @@ } else { window.close(); } - opener.document.forms['<?php echo $chooseparts[0]."'].".$chooseparts[1] ?>.value = '<?php p(RESOURCE_LOCALPATH) ?>'+path; + opener.document.getElementById('<?php echo $choose ?>').value = '<?php p(RESOURCE_LOCALPATH) ?>'+path; window.close(); } //]]> diff --git a/mod/resource/type/html/html.html b/mod/resource/type/html/html.html deleted file mode 100644 index 3b0c8b5459e..00000000000 --- a/mod/resource/type/html/html.html +++ /dev/null @@ -1,143 +0,0 @@ - -<tr valign="top"> - <td align="right" style="white-space:nowrap;"> - - -<script type="text/javascript"> -//<![CDATA[ - function showhide (id, set) { - divobj = document.getElementById(id); - butobj = document.getElementById(id+'button'); - prefobj = document.getElementById(id+'pref'); - if (set == true) { - if (prefobj.value == '1') { - divobj.style.display = 'block'; - butobj.value = '<?php print_string("hidesettings") ?>'; - } else { - divobj.style.display = 'none'; - butobj.value = '<?php print_string("showsettings") ?>...'; - } - } else { - if (prefobj.value == '1') { - divobj.style.display = 'none'; - butobj.value = '<?php print_string("showsettings") ?>...'; - prefobj.value = '0'; - } else { - divobj.style.display = 'block'; - butobj.value = '<?php print_string("hidesettings") ?>'; - prefobj.value = '1'; - } - } - } -//]]> -</script> - - - <b><?php print_string("fulltext", "resource") ?>:</b><br /> - <?php helpbutton("writing", get_string("helpwriting"), "moodle", true, true) ?><br /> - <?php helpbutton("text", get_string("helptext"), "moodle", true, true) ?><br /> - <?php emoticonhelpbutton("theform", "alltext") ?> <br /> - </td> - <td> - <?php print_textarea($usehtmleditor, 30, 60, 680, 500, "alltext", $form->alltext); ?> - </td> -</tr> - -<tr><td colspan="2"><hr /></td></tr> - -<tr> - <td align="right"><b><?php print_string("display", "resource") ?>:</b></td> - <td> - <input type="button" value="hide settings" id="windowsettingsbutton" onclick="javascript: return showhide('windowsettings');" /> - <input type="hidden" name="windowsettingspref" id="windowsettingspref" - value="<?php echo get_user_preferences('resource_windowsettingspref', $CFG->resource_windowsettings); ?>" /> - <?php helpbutton("window", get_string("display", "resource"), "resource", true) ?> - </td> -</tr> -<tr><td colspan="2"> - - <div id="windowsettings"> - -<table class="boxaligncenter"> - - -<tr valign="top"> - - <td colspan="2"> - <script type="text/javascript"> - //<![CDATA[ - var popupitems = [<?php echo $popupoptions; ?>]; - var blockitem = [<?php echo $blockoption; ?>]; - var allitems = [<?php echo $alloptions; ?>]; - //]]> - </script> - <input type="radio" name="windowpopup" value="0" alt="<?php print_string('pagewindow', 'resource') ?>" <?php echo ($windowtype != 'popup') ? 'checked="checked"' : '' ?> - onclick="lockoptions('form', 'windowpopup[0]', blockitem); - return lockoptions('form', 'windowpopup[1]', popupitems);" /> - <b title="<?php print_string('pagedisplay', 'resource') ?>"><?php print_string('pagewindow', 'resource') ?></b> - <blockquote> - <fieldset class="invisiblefieldset"> - <input type="hidden" name="hblockdisplay" value="0" /> - <input type="checkbox" name="blockdisplay" value="1" <?php echo ($form->options == "showblocks") ? "checked=\"checked\"" : "" ?> alt="<?php print_string('showcourseblocks', 'resource') ?>" /> - <?php print_string("showcourseblocks", "resource") ?> - </fieldset> - </blockquote> - - </td> -</tr> - -<tr valign="top"> - - <td colspan="2"> - <input name="windowpopup" type="radio" value="1" alt="<?php p($strnewwindow) ?>" <?php echo ($windowtype == "popup") ? "checked=\"checked\"" : "" ?> - onclick="lockoptions('form', 'windowpopup[0]', blockitem); - return lockoptions('form', 'windowpopup[1]', popupitems);" /> - <b title="<?php p($strnewwindowopen) ?>"><?php p($strnewwindow) ?></b> - <blockquote> - <fieldset class="invisiblefieldset"> - <?php - foreach ($window as $name => $value) { - if ($name == "height" or $name == "width") { - continue; - } - $stringname = "str$name"; - echo "<input name=\"h$name\" type=\"hidden\" value=\"0\" />"; - echo "<input name=\"$name\" type=\"checkbox\" value=\"1\" alt=\"".$$stringname."\" ".$window->$name." />"; - echo $$stringname."<br />"; - } - ?> - - <input name="hwidth" type="hidden" value="0" /> - <input name="width" type="text" size="4" value="<?php p($window->width) ?>" alt="<?php p($strwidth) ?>" /> - <?php p($strwidth) ?><br /> - - <input name="hheight" type="hidden" value="0" /> - <input name="height" type="text" size="4" value="<?php p($window->height) ?>" alt="<?php p($strheight) ?>"/> - <?php p($strheight) ?><br /> - <?php - if ($windowtype == "page") { - echo "<script type=\"text/javascript\">\n//<![CDATA[\n"; - echo "lockoptions('form','windowpopup[1]', popupitems);"; - echo "\n//]]>\n</script>"; - } - ?> - </fieldset> - </blockquote> - </td> -</tr> - -</table> - - </div> - - -<script type="text/javascript"> -//<![CDATA[ - showhide('windowsettings', true); -//]]> -</script> - - -</td></tr> - -<?php print_visible_setting($form); ?> diff --git a/mod/resource/type/ims/ims.html b/mod/resource/type/ims/ims.html deleted file mode 100644 index 22f1493f3e1..00000000000 --- a/mod/resource/type/ims/ims.html +++ /dev/null @@ -1,264 +0,0 @@ -<?php // $Id$ - -/////////////////////////////////////////////////////////////////////////// -// // -// NOTICE OF COPYRIGHT // -// // -// Moodle - Modular Object-Oriented Dynamic Learning Environment // -// http://moodle.com // -// // -// Copyright (C) 2001-3001 Martin Dougiamas http://dougiamas.com // -// (C) 2001-3001 Eloy Lafuente (stronk7) http://contiento.com // -// // -// This program is free software; you can redistribute it and/or modify // -// it under the terms of the GNU General Public License as published by // -// the Free Software Foundation; either version 2 of the License, or // -// (at your option) any later version. // -// // -// This program is distributed in the hope that it will be useful, // -// but WITHOUT ANY WARRANTY; without even the implied warranty of // -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // -// GNU General Public License for more details: // -// // -// http://www.gnu.org/copyleft/gpl.html // -// // -/////////////////////////////////////////////////////////////////////////// -?> - -<tr valign="top"> - <td align="right" style="white-space:nowrap;"> - - -<script type="text/javascript"> -//<![CDATA[ - function showhide (id, set) { - divobj = document.getElementById(id); - butobj = document.getElementById(id+'button'); - prefobj = document.getElementById(id+'pref'); - if (set == true) { - if (prefobj.value == '1') { - divobj.style.display = 'block'; - butobj.value = '<?php print_string("hidesettings") ?>'; - } else { - divobj.style.display = 'none'; - butobj.value = '<?php print_string("showsettings") ?>...'; - } - } else { - if (prefobj.value == '1') { - divobj.style.display = 'none'; - butobj.value = '<?php print_string("showsettings") ?>...'; - prefobj.value = '0'; - } else { - divobj.style.display = 'block'; - butobj.value = '<?php print_string("hidesettings") ?>'; - prefobj.value = '1'; - } - } - } - - function optiondeselector () { - document.getElementById('menuparam_tableofcontents').disabled = false; - document.getElementById('menuparam_skipsubmenus').disabled = false; - document.getElementById('menuparam_navigationupbutton').disabled = false; - - if (document.getElementById('menuparam_navigationmenu').value == 1) { - document.getElementById('menuparam_tableofcontents').value = 0; - document.getElementById('menuparam_skipsubmenus').value = 1; - document.getElementById('menuparam_navigationupbutton').value = 0; - document.getElementById('menuparam_tableofcontents').disabled = true; - document.getElementById('menuparam_skipsubmenus').disabled = true; - document.getElementById('menuparam_navigationupbutton').disabled = true; - } - - if (document.getElementById('menuparam_navigationbuttons').value == 0) { - document.getElementById('menuparam_navigationupbutton').value = 0; - document.getElementById('menuparam_navigationupbutton').disabled = true; - } - - } -//]]> -</script> - - - <b><?php echo $strfilename ?>:</b> - </td> - <td> - <?php - $strbrowserepository = get_string('browserepository', 'resource'); - echo "<input type=\"text\" name=\"reference\" size=\"90\" value=\"$form->reference\" alt=\"reference\" /><br />"; - button_to_popup_window ("/files/index.php?id=$form->course&choose=form.reference", "coursefiles", $strchooseafile, 500, 750, $strchooseafile); - if ($CFG->repositoryactivate) button_to_popup_window ("/mod/resource/type/ims/finder.php?directory=", "", $strbrowserepository, 500, 750, "Browse repository"); - - ?> - </td> -</tr> - -<tr><td colspan="2"><hr /></td></tr> - -<tr> - <td align="right"><b><?php print_string("display", "resource") ?>:</b></td> - <td> - <input type="button" value="hide settings" id="windowsettingsbutton" onclick="javascript: return showhide('windowsettings');" /> - <input type="hidden" name="windowsettingspref" id="windowsettingspref" - value="<?php echo get_user_preferences('resource_windowsettingspref', $CFG->resource_windowsettings); ?>" /> - <?php helpbutton("window", get_string("display", "resource"), "resource", true) ?> - </td> -</tr> -<tr><td colspan="2"> - - <div id="windowsettings"> - -<table class="boxaligncenter"> - - -<tr valign="top"> - - <td colspan="2"> - <script type="text/javascript"> - //<![CDATA[ - var popupitems = [<?php echo $popupoptions; ?>]; - var allitems = [<?php echo $alloptions; ?>]; - //]]> - </script> - <input type="radio" name="windowpopup" value="0" alt="<?php print_string('pagewindow', 'resource') ?>" <?php echo ($windowtype != "popup") ? "checked=\"checked\"" : "" ?> - onclick="lockoptions('form', 'windowpopup[1]', popupitems);" /> - <b title="<?php print_string("pagedisplay", "resource") ?>"><?php print_string("pagewindow", "resource") ?></b> - <blockquote> - <div> - <input type="hidden" name="framepage" value="1" /> - </div> - </blockquote> - </td> -</tr> - -<tr valign="top"> - - <td colspan="2"> - <input name="windowpopup" type="radio" value="1" alt="<?php p($strnewwindow)?>" <?php echo ($windowtype == "popup") ? "checked=\"checked\"" : "" ?> - onclick="lockoptions('form', 'windowpopup[1]', popupitems);" /> - <b title="<?php p($strnewwindowopen) ?>"><?php p($strnewwindow) ?></b> - <blockquote> - <fieldset class="invisiblefieldset"> - <?php - foreach ($window as $name => $value) { - if ($name == "height" or $name == "width") { - continue; - } - echo "<input name=\"h$name\" type=\"hidden\" value=\"0\" />"; - echo "<input name=\"$name\" type=\"checkbox\" value=\"1\" ".$window->$name." alt=\"$name\" />"; - $stringname = "str$name"; - echo $$stringname."<br />"; - } - ?> - - <input name="hwidth" type="hidden" value="0" /> - <input name="width" type="text" size="4" value="<?php p($window->width) ?>" alt="<?php p($strwidth) ?>" /> - <?php p($strwidth) ?><br /> - - <input name="hheight" type="hidden" value="0" /> - <input name="height" type="text" size="4" value="<?php p($window->height) ?>" alt="<?php p($strheight) ?>" /> - <?php p($strheight) ?><br /> - <?php - if ($windowtype == "page") { - echo "<script type=\"text/javascript\">\n//<![CDATA[\n"; - echo "lockoptions('form','windowpopup[1]', popupitems);"; - echo "\n//]]>\n</script>"; - } - ?> - </fieldset> - </blockquote> - </td> -</tr> - -</table> - - </div> - -</td></tr> - -<tr> - <td align="right"><b><?php print_string("parameters", "resource") ?>:</b></td> - <td> - <input type="button" value="hide settings" id="parametersettingsbutton" onclick="javascript: return showhide('parametersettings');" /> - <input type="hidden" name="parametersettingspref" id="parametersettingspref" - value="<?php echo get_user_preferences('resource_parametersettingspref', $CFG->resource_parametersettings); ?>" /> - <?php helpbutton("imsparameters", get_string("parameters", "resource"), "resource", true) ?> - </td> -</tr> -<tr><td colspan="2"> - - <div id="parametersettings"> - -<table class="boxaligncenter"> - -<?php - - $yesno = array(); - $yesno[0] = get_string('no'); - $yesno[1] = get_string('yes'); - - echo "<tr>\n"; - echo "<td valign=\"top\" align=\"right\">\n"; - echo get_string('navigationmenu','resource').': '; - echo "</td>\n"; - echo "<td valign=\"top\">\n"; - choose_from_menu($yesno, "param_navigationmenu", $form->param_navigationmenu, "", "optiondeselector();"); - echo "</td>\n"; - echo "</tr>\n"; - - echo "<tr>\n"; - echo "<td valign=\"top\" align=\"right\">\n"; - echo get_string('tableofcontents','resource').': '; - echo "</td>\n"; - echo "<td valign=\"top\">\n"; - choose_from_menu($yesno, "param_tableofcontents", $form->param_tableofcontents, ""); - echo "</td>\n"; - echo "</tr>\n"; - - echo "<tr>\n"; - echo "<td valign=\"top\" align=\"right\">\n"; - echo get_string('navigationbuttons','resource').': '; - echo "</td>\n"; - echo "<td valign=\"top\">\n"; - choose_from_menu($yesno, "param_navigationbuttons", $form->param_navigationbuttons, "", "optiondeselector();"); - echo "</td>\n"; - echo "</tr>\n"; - - echo "<tr>\n"; - echo "<td valign=\"top\" align=\"right\">\n"; - echo get_string('skipsubmenus','resource').': '; - echo "</td>\n"; - echo "<td valign=\"top\">\n"; - choose_from_menu($yesno, "param_skipsubmenus", $form->param_skipsubmenus, ""); - echo "</td>\n"; - echo "</tr>\n"; - - echo "<tr>\n"; - echo "<td valign=\"top\" align=\"right\">\n"; - echo get_string('navigationup','resource').': '; - echo "</td>\n"; - echo "<td valign=\"top\">\n"; - choose_from_menu($yesno, "param_navigationupbutton", $form->param_navigationupbutton, ""); - echo "</td>\n"; - echo "</tr>\n"; - -?> - - -</table> - - </div> - -<script type="text/javascript"> -//<![CDATA[ - optiondeselector(); - - showhide('parametersettings', true); - showhide('windowsettings', true); -//]]> -</script> - - -</td></tr> - -<?php print_visible_setting($form); ?> diff --git a/mod/resource/type/repository/repository.html b/mod/resource/type/repository/repository.html deleted file mode 100644 index 2f7dcfd3072..00000000000 --- a/mod/resource/type/repository/repository.html +++ /dev/null @@ -1,226 +0,0 @@ - -<tr valign="top"> - <td align="right" style="white-space:nowrap;"> - - -<script type="text/javascript"> -//<![CDATA[ - function showhide (id, set) { - divobj = document.getElementById(id); - butobj = document.getElementById(id+'button'); - prefobj = document.getElementById(id+'pref'); - if (set == true) { - if (prefobj.value == '1') { - divobj.style.display = 'block'; - butobj.value = '<?php print_string("hidesettings") ?>'; - } else { - divobj.style.display = 'none'; - butobj.value = '<?php print_string("showsettings") ?>...'; - } - } else { - if (prefobj.value == '1') { - divobj.style.display = 'none'; - butobj.value = '<?php print_string("showsettings") ?>...'; - prefobj.value = '0'; - } else { - divobj.style.display = 'block'; - butobj.value = '<?php print_string("hidesettings") ?>'; - prefobj.value = '1'; - } - } - } -//]]> -</script> - - - <b><?php echo $strfilename ?>:</b> - </td> - <td> - <?php - echo "<input type=\"text\" name=\"reference\" size=\"90\" value=\"$form->reference\" alt=\"reference\" /><br />"; - ?> - </td> - </tr> - <tr valign="top"> - <td align="right" style="white-space:nowrap;"> - <img src="<?php echo $CFG->wwwroot.'/mod/resource/type/repository/hive/hp-footer-hive-powered.gif' ?>" style="valign:top;" alt="" /> - </td> - <td> - <?php - $options = 'menubar,location,toolbar,scrollbars,resizable,width=750,height=500'; - button_to_popup_window ('/mod/resource/type/repository/hive/openlitebrowse.php', - 'LiteBrowse', 'Browse for content in Hive', 500, 750, - 'Browse for content in the HarvestRoad Hive repository', $options); - button_to_popup_window ('/mod/resource/type/repository/hive/openlitesearch.php', - 'LiteSearch', 'Search for content in Hive ', 500, 750, - 'Search for content in the HarvestRoad Hive repository', $options); - // wobble. - button_to_popup_window ('/mod/resource/type/repository/hive/openlitepublish.php', - 'LitePublish', 'Add new item to Hive ', 500, 750, - 'Add new content to the HarvestRoad Hive repository', $options); - - helpbutton("hive", "HarvestRoad Hive", "resource/type", true); - ?> - </td> -</tr> - -<tr><td colspan="2"><hr /></td></tr> - -<tr> - <td align="right"><b><?php print_string("display", "resource") ?>:</b></td> - <td> - <input type="button" value="hide settings" id="windowsettingsbutton" onclick="javascript: return showhide('windowsettings');" /> - <input type="hidden" name="windowsettingspref" id="windowsettingspref" - value="<?php echo get_user_preferences('resource_windowsettingspref', $CFG->resource_windowsettings); ?>" /> - <?php helpbutton("window", get_string("display", "resource"), "resource", true) ?> - </td> -</tr> -<tr><td colspan="2"> - - <div id="windowsettings"> - -<table style="boxaligncenter"> - - -<tr valign="top"> - - <td colspan="2"> - <script type="text/javascript"> - //<![CDATA[ - var popupitems = [<?php echo $popupoptions; ?>]; - var frameitem = [<?php echo $frameoption; ?>]; - var allitems = [<?php echo $alloptions; ?>]; - //]]> - </script> - <input type="radio" name="windowpopup" value="0" alt="<?php print_string('pagewindow', 'resource') ?>" <?php echo ($windowtype != "popup") ? "checked=\"checked\"" : "" ?> - onclick="lockoptions('form', 'windowpopup[0]', frameitem); - return lockoptions('form', 'windowpopup[1]', popupitems);" /> - <b title="<?php print_string("pagedisplay", "resource") ?>"><?php print_string("pagewindow", "resource") ?></b> - <blockquote> - <fieldset class="invisiblefieldset"> - <input type="hidden" name="hframepage" value="0" /> - <input type="checkbox" name="framepage" value="1" <?php echo ($form->options == "frame") ? "checked=\"checked\"" : "" ?> alt="<?php print_string('frameifpossible', 'resource') ?>" /> - <?php print_string("frameifpossible", "resource") ?> - </fieldset> - </blockquote> - </td> -</tr> - -<tr valign="top"> - - <td colspan="2"> - <input name="windowpopup" type="radio" value="1" alt="<?php p($strnewwindow)?>" <?php echo ($windowtype == "popup") ? "checked=\"checked\"" : "" ?> - onclick="lockoptions('form', 'windowpopup[0]', frameitem); - return lockoptions('form', 'windowpopup[1]', popupitems);" /> - <b title="<?php p($strnewwindowopen) ?>"><?php p($strnewwindow) ?></b> - <blockquote> - <fieldset class="invisiblefieldset"> - <?php - foreach ($window as $name => $value) { - if ($name == "height" or $name == "width") { - continue; - } - echo "<input name=\"h$name\" type=\"hidden\" value=\"0\" />"; - echo "<input name=\"$name\" type=\"checkbox\" value=\"1\" ".$window->$name." alt=\"$name\" />"; - $stringname = "str$name"; - echo $$stringname."<br />"; - } - ?> - - <input name="hwidth" type="hidden" value="0" /> - <input name="width" type="text" size="4" value="<?php p($window->width) ?>" alt="<?php p($strwidth) ?>" /> - <?php p($strwidth) ?><br /> - - <input name="hheight" type="hidden" value="0" /> - <input name="height" type="text" size="4" value="<?php p($window->height) ?>" alt="<?php p($strheight) ?>" /> - <?php p($strheight) ?><br /> - <?php - if ($windowtype == "page") { - echo "<script type=\"text/javascript\">\n//<![CDATA[\n"; - echo "lockoptions('form','windowpopup[1]', popupitems);"; - echo "\n//]]>\n</script>"; - } else { - echo "<script type=\"text/javascript\">\n//<![CDATA[\n"; - echo "lockoptions('form','windowpopup[0]', frameitem);"; - echo "\n//]]>\n</script>"; - } - ?> - </fieldset> - </blockquote> - </td> -</tr> - -</table> - - </div> - -</td></tr> - -<tr> - <td align="right"><b><?php print_string("parameters", "resource") ?>:</b></td> - <td> - <input type="button" value="hide settings" id="parametersettingsbutton" onclick="javascript: return showhide('parametersettings');" /> - <input type="hidden" name="parametersettingspref" id="parametersettingspref" - value="<?php echo get_user_preferences('resource_parametersettingspref', $CFG->resource_parametersettings); ?>" /> - <?php helpbutton("parameters", get_string("parameters", "resource"), "resource", true) ?> - </td> -</tr> -<tr><td colspan="2"> - - <div id="parametersettings"> - -<table class="boxaligncenter"> - - <tr> - <td align="center"><?php print_string("parameter", "resource") ?></td> - <td align="center"><?php print_string("variablename", "resource") ?></td> - </tr> - -<?php - -for ($i=0; $i < $this->maxparameters; $i++) { - echo "<tr>\n"; - echo "<td valign=\"top\">\n"; - echo "<select name=\"parameter$i\">\n"; - echo "<option value=\"-\">-- ".get_string('chooseparameter', 'resource')." --</option>\n"; - foreach ($this->parameters as $field=>$fieldarr) { - if ($fieldarr['value'] === "optgroup") { - echo "<optgroup label=\"{$fieldarr['langstr']}\">\n"; - } elseif ($fieldarr['value'] === "/optgroup") { - echo "</optgroup>\n"; - } else { - echo "<option value=\"$field\""; - if ($alltextfield[$i]['parameter'] == $field) { - echo " selected=\"selected\""; - } - echo ">{$fieldarr['langstr']}</option>\n"; - } - } - echo "</select>\n"; - echo "</td>\n"; - echo "<td valign=\"top\">\n"; - echo "<input type=\"text\" name=\"parse$i\" value=\"{$alltextfield[$i]['parse']}\" alt=\"parameter$i\"/>\n"; - echo "</td>\n"; - echo "</tr>\n"; -} - -?> - - -</table> - - </div> - - -<script type="text/javascript"> -//<![CDATA[ - showhide('parametersettings', true); - showhide('windowsettings', true); -//]]> -</script> - - -</td></tr> - -<?php print_visible_setting($form); ?> - diff --git a/mod/resource/type/text/text.html b/mod/resource/type/text/text.html deleted file mode 100644 index b4b71cff4b6..00000000000 --- a/mod/resource/type/text/text.html +++ /dev/null @@ -1,160 +0,0 @@ - -<tr valign="top"> - <td colspan="2"> - <script type="text/javascript"> - //<![CDATA[ - function showhide (id, set) { - divobj = document.getElementById(id); - butobj = document.getElementById(id+'button'); - prefobj = document.getElementById(id+'pref'); - if (set == true) { - if (prefobj.value == '1') { - divobj.style.display = 'block'; - butobj.value = '<?php print_string("hidesettings") ?>'; - } else { - divobj.style.display = 'none'; - butobj.value = '<?php print_string("showsettings") ?>...'; - } - } else { - if (prefobj.value == '1') { - divobj.style.display = 'none'; - butobj.value = '<?php print_string("showsettings") ?>...'; - prefobj.value = '0'; - } else { - divobj.style.display = 'block'; - butobj.value = '<?php print_string("hidesettings") ?>'; - prefobj.value = '1'; - } - } - } - //]]> - </script> - </td> -</tr> -<tr valign="top"> - <td align="right" style="white-space:nowrap;"> - - - <b><?php print_string("fulltext", "resource") ?>:</b><br /> - <?php helpbutton("writing", get_string("helpwriting"), "moodle", true, true) ?><br /> - <?php emoticonhelpbutton("theform", "alltext") ?> <br /> - </td> - <td> - <?php print_textarea(false, 30, 65, 680, 400, "alltext", $form->alltext); ?> - </td> -</tr> -<tr valign="top"> - <td align="right" style="white-space:nowrap;"> - <b><?php print_string("formattexttype") ?>:</b><br /> - </td> - <td> - <?php - choose_from_menu($format_array, "options", $form->options, ''); - helpbutton("textformat", get_string("formattexttype")); - ?> - </td> -</tr> - -<tr><td colspan="2"><hr /></td></tr> - - -<tr> - <td align="right"><b><?php print_string("display", "resource") ?>:</b></td> - <td> - <input type="button" value="hide settings" id="windowsettingsbutton" onclick="javascript: return showhide('windowsettings');" /> - <input type="hidden" name="windowsettingspref" id="windowsettingspref" - value="<?php echo get_user_preferences('resource_windowsettingspref', $CFG->resource_windowsettings); ?>" /> - <?php helpbutton("window", get_string("display", "resource"), "resource", true) ?> - </td> -</tr> -<tr><td colspan="2"> - - <div id="windowsettings"> - -<table class="boxaligncenter"> - - -<tr valign="top"> - - <td colspan="2"> - <script type="text/javascript"> - //<![CDATA[ - var popupitems = [<?php echo $popupoptions; ?>]; - var blockitem = [<?php echo $blockoption; ?>]; - var allitems = [<?php echo $alloptions; ?>]; - //]]> - </script> - - <input type="radio" name="windowpopup" value="0" alt="<?php print_string("pagewindow", "resource") ?>" <?php echo ($windowtype != "popup") ? 'checked="checked"' : '' ?> - onclick="lockoptions('form', 'windowpopup[0]', blockitem); - return lockoptions('form', 'windowpopup[1]', popupitems);" /> - <b title="<?php print_string("pagedisplay", "resource") ?>"><?php print_string("pagewindow", "resource") ?></b> - <?php print_string("pagedisplay", "resource") ?> - <blockquote> - <fieldset class="invisiblefieldset"> - <input type="hidden" name="hblockdisplay" value="0" /> - <input type="checkbox" name="blockdisplay" value="1" <?php echo ($form->options == "showblocks") ? "checked=\"checked\"" : "" ?> alt="<?php print_string('showcourseblocks', 'resource') ?>" /> - <?php print_string("showcourseblocks", "resource") ?> - </fieldset> - </blockquote> - - </td> -</tr> - -<tr valign="top"> - - <td colspan="2"> - <input name="windowpopup" type="radio" value="1" alt="<?php p($strnewwindowopen) ?>" <?php echo ($windowtype == "popup") ? "checked=\"checked\"" : "" ?> - onclick="lockoptions('form', 'windowpopup[0]', blockitem); - return lockoptions('form', 'windowpopup[1]', popupitems);" /> - <b title="<?php p($strnewwindowopen) ?>"><?php p($strnewwindow) ?></b> - <?php p($strnewwindowopen) ?> - <blockquote> - <fieldset class="invisiblefieldset"> - <?php - foreach ($window as $name => $value) { - if ($name == "height" or $name == "width") { - continue; - } - echo '<input name="h'.$name.'" type="hidden" value="0" />'; - echo '<input name="'.$name.'" type="checkbox" value="1" alt="'.$$stringname.'" '.$window->$name.' />'; - $stringname = "str$name"; - echo $$stringname."<br />"; - } - ?> - - <input name="hwidth" type="hidden" value="0" /> - <input name="width" type="text" size="4" value="<?php p($window->width) ?>" /> - <?php p($strwidth) ?><br /> - - <input name="hheight" type="hidden" value="0" /> - <input name="height" type="text" size="4" value="<?php p($window->height) ?>" /> - <?php p($strheight) ?><br /> - <?php - if ($windowtype == "page") { - echo "<script type=\"text/javascript\">\n//<![CDATA[\n"; - echo "lockoptions('form','windowpopup[1]', popupitems);"; - echo "\n//]]>\n</script>"; - } - ?> - </fieldset> - </blockquote> - </td> -</tr> - -</table> - - </div> - - -<script type="text/javascript"> -//<![CDATA[ - showhide('windowsettings', true); -//]]> -</script> - - -</td></tr> - -<?php print_visible_setting($form); ?> - diff --git a/mod/scorm/db/mysql.sql b/mod/scorm/db/mysql.sql deleted file mode 100755 index fa5b02cfbac..00000000000 --- a/mod/scorm/db/mysql.sql +++ /dev/null @@ -1,188 +0,0 @@ -# -# Table structure for table `scorm` -# - -CREATE TABLE prefix_scorm ( - id int(10) unsigned NOT NULL auto_increment, - course int(10) unsigned NOT NULL default '0', - name varchar(255) NOT NULL default '', - summary text NOT NULL default '', - reference varchar(255) NOT NULL default '', - version varchar(9) NOT NULL default '', - maxgrade float(3) NOT NULL default '0', - grademethod tinyint(2) NOT NULL default '0', - maxattempt int(10) NOT NULL default '1', - launch int(10) unsigned NOT NULL default '0', - skipview tinyint(1) unsigned NOT NULL default '1', - hidebrowse tinyint(1) NOT NULL default '0', - hideexit tinyint(1) NOT NULL default '0', - hideabandon tinyint(1) NOT NULL default '0', - hidetoc tinyint(1) NOT NULL default '0', - hidenav tinyint(1) NOT NULL default '0', - auto tinyint(1) unsigned NOT NULL default '0', - popup tinyint(1) unsigned NOT NULL default '0', - options varchar(255) NOT NULL default '', - width int(10) unsigned NOT NULL default '100', - height int(10) unsigned NOT NULL default '600', - timemodified int(10) unsigned NOT NULL default '0', - PRIMARY KEY (id), - KEY course (course) -) TYPE=MyISAM; - -CREATE TABLE prefix_scorm_scoes ( - id int(10) unsigned NOT NULL auto_increment, - scorm int(10) unsigned NOT NULL default '0', - manifest varchar(255) NOT NULL default '', - organization varchar(255) NOT NULL default '', - parent varchar(255) NOT NULL default '', - identifier varchar(255) NOT NULL default '', -/* launch varchar(255) NOT NULL default '', */ - launch int(10) NOT NULL default '0', - scormtype varchar(5) NOT NULL default '', - title varchar(255) NOT NULL default '', -/* parameters varchar(255) NOT NULL default '', - prerequisites varchar(200) NOT NULL default '', - maxtimeallowed varchar(19) NOT NULL default '', - timelimitaction varchar(19) NOT NULL default '', - datafromlms varchar(255) NOT NULL default '', - masteryscore varchar(200) NOT NULL default '', - next tinyint(1) unsigned NOT NULL default '0', - previous tinyint(1) unsigned NOT NULL default '0', */ - PRIMARY KEY (id), - KEY scorm (scorm) -) TYPE=MyISAM; - -CREATE TABLE prefix_scorm_scoes_data ( - id int(10) unsigned NOT NULL auto_increment, - scoid int(10) unsigned NOT NULL default '0', - name varchar(255) NOT NULL default '', - value text NOT NULL default '', - PRIMARY KEY (id), - KEY scoid (scoid) -) TYPE=MyISAM; - -CREATE TABLE prefix_scorm_scoes_track ( - id int(10) unsigned NOT NULL auto_increment, - userid int(10) unsigned NOT NULL default '0', - scormid int(10) NOT NULL default '0', - scoid int(10) unsigned NOT NULL default '0', - attempt int(10) unsigned NOT NULL default '1', - element varchar(255) NOT NULL default '', - value longtext NOT NULL default '', - timemodified int(10) unsigned NOT NULL default '0', - PRIMARY KEY (id), - KEY userid (userid), - KEY scormid (scormid), - KEY scoid (scoid), - KEY element (element), - UNIQUE track (userid, scormid, scoid, attempt, element) -) TYPE=MyISAM; - -CREATE TABLE prefix_scorm_sequencing_ruleconditions ( - id int(10) unsigned NOT NULL auto_increment, - scormid int(10) unsigned NOT NULL default '0', - scoid int(10) unsigned NOT NULL default '0', - conditioncombination varchar(3) NOT NULL default 'all', - ruletype tinyint(2) unsigned NOT NULL default '0', - action varchar(25) NOT NULL default '', - PRIMARY KEY (id), - UNIQUE (scormid, scoid,id), - KEY scormid (scormid), - KEY scoid (scoid) -) TYPE=MyISAM; - -CREATE TABLE prefix_scorm_sequencing_rulecondition ( - id int(10) unsigned NOT NULL auto_increment, - scormid int(10) unsigned NOT NULL default '0', - scoid int(10) unsigned NOT NULL default '0', - ruleconditionsid int(10) unsigned NOT NULL default '0', - refrencedobjective varchar(255) NOT NULL default '', - measurethreshold float(11,4) NOT NULL default '0.0000', - operator varchar(5) NOT NULL default 'noOp', - condition varchar(30) NOT NULL default 'always', - PRIMARY KEY (id), - UNIQUE (scormid, scoid,id,ruleconditionsid), - KEY ruleconditionsid (ruleconditionsid), - KEY scormid (scormid), - KEY scoid (scoid) -) TYPE=MyISAM; - -CREATE TABLE prefix_scorm_sequencing_rolluprules ( - id int(10) unsigned NOT NULL auto_increment, - scormid int(10) unsigned NOT NULL default '0', - scoid int(10) unsigned NOT NULL default '0', - rollupobjectivesatisfied TINYINT(1) unsigned NOT NULL default '1', - rollupprogresscompletion TINYINT(1) unsigned NOT NULL default '1', - objectivemeasureweight float(11,4) NOT NULL default '1.0000', - PRIMARY KEY (id), - KEY scormid (scormid), - KEY scoid (scoid) -) TYPE=MyISAM; - -CREATE TABLE prefix_scorm_sequencing_rolluprule ( - id int(10) unsigned NOT NULL auto_increment, - scormid int(10) unsigned NOT NULL default '0', - scoid int(10) unsigned NOT NULL default '0', - rolluprulesid int(10) unsigned NOT NULL default '0', - childactivityset varchar(15) NOT NULL default '', - minimumcount int(10) unsigned NOT NULL default '0', - minimumpercent float(11,4) unsigned NOT NULL default '0.0000', - conditioncombination varchar(3) NOT NULL default 'all', - action varchar(15) NOT NULL default '', - PRIMARY KEY (id), - UNIQUE (scormid, scoid, rolluprulesid, id), - KEY scormid (scormid), - KEY scoid (scoid) -) TYPE=MyISAM; - -CREATE TABLE prefix_scorm_sequencing_rolluprulecondition ( - id int(10) unsigned NOT NULL auto_increment, - scormid int(10) unsigned NOT NULL default '0', - scoid int(10) unsigned NOT NULL default '0', - rollupruleid int(10) unsigned NOT NULL default '0', - operator varchar(5) NOT NULL default 'noOp', - condition varchar(25) NOT NULL default '', - PRIMARY KEY (id), - UNIQUE (scormid, scoid, rollupruleid, id), - KEY scormid (scormid), - KEY scoid (scoid) -) TYPE=MyISAM; - -CREATE TABLE prefix_scorm_sequencing_objectives ( - id int(10) unsigned NOT NULL auto_increment, - scormid int(10) unsigned NOT NULL default '0', - scoid int(10) unsigned NOT NULL default '0', - primary tinyint(1) NOT NULL default '0', - objectiveid int(10) unsigned NOT NULL default '0', - satisfiedbymeasure tinyint(1) NOT NULL default '1', - minnormalizedmeasure float(11,4) unsigned NOT NULL default '1.0', - PRIMARY KEY (id), - UNIQUE (scormid, scoid, id), - KEY scormid (scormid), - KEY scoid (scoid) -) TYPE=MyISAM; - -CREATE TABLE prefix_scorm_sequencing_objective ( - id int(10) unsigned NOT NULL auto_increment, - scormid int(10) unsigned NOT NULL default '0', - scoid int(10) unsigned NOT NULL default '0', - objectiveid int(10) unsigned NOT NULL default '0', - targetobjectiveid int(10) unsigned NOT NULL default '0', - readsatisfiedstatus tinyint(1) NOT NULL default '1', - readnormalizedmeasure tinyint(1) NOT NULL default '1', - writesatisfiedstatus tinyint(1) NOT NULL default '0', - writenormalizedmeasure tinyint(1) NOT NULL default '0', - PRIMARY KEY (id), - UNIQUE (scormid, scoid, id, objectiveid), - KEY scormid (scormid), - KEY scoid (scoid) -) TYPE=MyISAM; - -# -# Dumping data for table log_display -# - -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('scorm', 'view', 'scorm', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('scorm', 'review', 'scorm', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('scorm', 'update', 'scorm', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('scorm', 'add', 'scorm', 'name'); diff --git a/mod/scorm/db/postgres7.sql b/mod/scorm/db/postgres7.sql deleted file mode 100755 index 9b3bc1c754a..00000000000 --- a/mod/scorm/db/postgres7.sql +++ /dev/null @@ -1,75 +0,0 @@ -# -# Table structure for table `scorm` -# - -CREATE TABLE prefix_scorm ( - id SERIAL PRIMARY KEY, - course integer NOT NULL default '0', - name varchar(255) NOT NULL default '', - reference varchar(255) NOT NULL default '', - maxgrade real NOT NULL default '0', - grademethod integer NOT NULL default '0', - maxattempt integer NOT NULL default '1', - launch integer NOT NULL default '0', - skipview integer NOT NULL default '1', - summary text NOT NULL default '', - hidebrowse integer NOT NULL default '0', - hidetoc integer NOT NULL default '0', - hidenav integer NOT NULL default '0', - auto integer NOT NULL default '0', - popup integer NOT NULL default '0', - options varchar(255) NOT NULL default '', - width integer NOT NULL default '100', - height integer NOT NULL default '500', - timemodified integer NOT NULL default '0' -); - -CREATE INDEX prefix_scorm_course_idx ON prefix_scorm (course); - -CREATE TABLE prefix_scorm_scoes ( - id SERIAL PRIMARY KEY, - scorm integer NOT NULL default '0', - manifest varchar(255) NOT NULL default '', - organization varchar(255) NOT NULL default '', - parent varchar(255) NOT NULL default '', - identifier varchar(255) NOT NULL default '', - launch varchar(255) NOT NULL default '', - parameters varchar(255) NOT NULL default '', - scormtype varchar(5) NOT NULL default '', - title varchar(255) NOT NULL default '', - prerequisites varchar(200) NOT NULL default '', - maxtimeallowed varchar(19) NOT NULL default '', - timelimitaction varchar(19) NOT NULL default '', - datafromlms varchar(255) NOT NULL default '', - masteryscore varchar(200) NOT NULL default '', - next integer NOT NULL default '0', - previous integer NOT NULL default '0' -); - -CREATE INDEX prefix_scorm_scoes_scorm_idx ON prefix_scorm_scoes (scorm); - -CREATE TABLE prefix_scorm_scoes_track ( - id SERIAL PRIMARY KEY, - userid integer NOT NULL default '0', - scormid integer NOT NULL default '0', - scoid integer NOT NULL default '0', - attempt integer NOT NULL default '1', - element varchar(255) NOT NULL default '', - value text NOT NULL default '', - timemodified integer NOT NULL default '0', - UNIQUE (userid, scormid, scoid, attempt, element) -); - -CREATE INDEX prefix_scorm_scoes_track_user_idx ON prefix_scorm_scoes_track (userid); -CREATE INDEX prefix_scorm_scoes_track_scorm_idx ON prefix_scorm_scoes_track (scormid); -CREATE INDEX prefix_scorm_scoes_track_sco_idx ON prefix_scorm_scoes_track (scoid); -CREATE INDEX prefix_scorm_scoes_track_element_idx ON prefix_scorm_scoes_track (element); - -# -# Dumping data for table `log_display` -# - -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('scorm', 'view', 'scorm', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('scorm', 'review', 'scorm', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('scorm', 'update', 'scorm', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('scorm', 'add', 'scorm', 'name'); diff --git a/mod/survey/db/mysql.sql b/mod/survey/db/mysql.sql deleted file mode 100755 index a618c9bfc8d..00000000000 --- a/mod/survey/db/mysql.sql +++ /dev/null @@ -1,193 +0,0 @@ -# phpMyAdmin MySQL-Dump -# version 2.2.1 -# http://phpwizard.net/phpMyAdmin/ -# http://phpmyadmin.sourceforge.net/ (download page) -# -# Host: localhost -# Generation Time: Nov 14, 2001 at 04:39 PM -# Server version: 3.23.36 -# PHP Version: 4.0.6 -# Database : `moodle` -# -------------------------------------------------------- - -# -# Table structure for table `survey` -# - -CREATE TABLE prefix_survey ( - id int(10) unsigned NOT NULL auto_increment, - course int(10) unsigned NOT NULL default '0', - template int(10) unsigned NOT NULL default '0', - days smallint(6) NOT NULL default '0', - timecreated int(10) unsigned NOT NULL default '0', - timemodified int(10) unsigned NOT NULL default '0', - name varchar(255) NOT NULL default '', - intro text NOT NULL default '', - questions varchar(255) NOT NULL default '', - PRIMARY KEY (id), - KEY `course` (`course`) -) TYPE=MyISAM COMMENT='all surveys'; - -# -# Dumping data for table `survey` -# - -INSERT INTO `prefix_survey` (`id`, `course`, `template`, `days`, `timecreated`, `timemodified`, `name`, `intro`, `questions`) VALUES (1, 0, 0, 0, 985017600, 985017600, 'collesaname', 'collesaintro', '25,26,27,28,29,30,43,44'); -INSERT INTO `prefix_survey` (`id`, `course`, `template`, `days`, `timecreated`, `timemodified`, `name`, `intro`, `questions`) VALUES (2, 0, 0, 0, 985017600, 985017600, 'collespname', 'collespintro', '31,32,33,34,35,36,43,44'); -INSERT INTO `prefix_survey` (`id`, `course`, `template`, `days`, `timecreated`, `timemodified`, `name`, `intro`, `questions`) VALUES (3, 0, 0, 0, 985017600, 985017600, 'collesapname', 'collesapintro', '37,38,39,40,41,42,43,44'); -INSERT INTO `prefix_survey` (`id`, `course`, `template`, `days`, `timecreated`, `timemodified`, `name`, `intro`, `questions`) VALUES (4, 0, 0, 0, 985017600, 985017600, 'attlsname', 'attlsintro', '65,67,68'); -INSERT INTO `prefix_survey` (`id`, `course`, `template`, `days`, `timecreated`, `timemodified`, `name`, `intro`, `questions`) VALUES (5, 0, 0, 0, 985017600, 985017600, 'ciqname', 'ciqintro', '69,70,71,72,73'); - - - -# -# Table structure for table `survey_analysis` -# - -CREATE TABLE prefix_survey_analysis ( - id int(10) unsigned NOT NULL auto_increment, - survey int(10) unsigned NOT NULL default '0', - userid int(10) unsigned NOT NULL default '0', - notes text NOT NULL default '', - PRIMARY KEY (id), - UNIQUE KEY id (id), - KEY survey (survey), - KEY userid (userid) -) TYPE=MyISAM; - -# -# Dumping data for table `survey_analysis` -# - -# -------------------------------------------------------- - -# -# Table structure for table `survey_answers` -# - -CREATE TABLE prefix_survey_answers ( - id int(10) unsigned NOT NULL auto_increment, - userid int(10) unsigned NOT NULL default '0', - survey int(10) unsigned NOT NULL default '0', - question int(10) unsigned NOT NULL default '0', - time int(10) unsigned NOT NULL default '0', - answer1 text NOT NULL default '', - answer2 text NOT NULL default '', - PRIMARY KEY (id), - UNIQUE KEY id (id), - KEY userid (userid), - KEY survey (survey), - KEY question (question) -) TYPE=MyISAM; - -# -# Dumping data for table `survey_answers` -# - -# -------------------------------------------------------- - -# -# Table structure for table `survey_questions` -# - -CREATE TABLE `prefix_survey_questions` ( - `id` int(10) unsigned NOT NULL auto_increment, - `text` varchar(255) NOT NULL default '', - `shorttext` varchar(30) NOT NULL default '', - `multi` varchar(100) NOT NULL default '', - `intro` varchar(50) NOT NULL default '', - `type` tinyint(3) NOT NULL default '0', - `options` text, - PRIMARY KEY (`id`) -) TYPE=MyISAM; - -# -# Dumping data for table `survey_questions` -# - -INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (1, 'colles1', 'colles1short', '', '', 1, 'scaletimes5'); -INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (2, 'colles2', 'colles2short', '', '', 1, 'scaletimes5'); -INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (3, 'colles3', 'colles3short', '', '', 1, 'scaletimes5'); -INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (4, 'colles4', 'colles4short', '', '', 1, 'scaletimes5'); -INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (5, 'colles5', 'colles5short', '', '', 1, 'scaletimes5'); -INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (6, 'colles6', 'colles6short', '', '', 1, 'scaletimes5'); -INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (7, 'colles7', 'colles7short', '', '', 1, 'scaletimes5'); -INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (8, 'colles8', 'colles8short', '', '', 1, 'scaletimes5'); -INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (9, 'colles9', 'colles9short', '', '', 1, 'scaletimes5'); -INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (10, 'colles10', 'colles10short', '', '', 1, 'scaletimes5'); -INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (11, 'colles11', 'colles11short', '', '', 1, 'scaletimes5'); -INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (12, 'colles12', 'colles12short', '', '', 1, 'scaletimes5'); -INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (13, 'colles13', 'colles13short', '', '', 1, 'scaletimes5'); -INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (14, 'colles14', 'colles14short', '', '', 1, 'scaletimes5'); -INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (15, 'colles15', 'colles15short', '', '', 1, 'scaletimes5'); -INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (16, 'colles16', 'colles16short', '', '', 1, 'scaletimes5'); -INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (17, 'colles17', 'colles17short', '', '', 1, 'scaletimes5'); -INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (18, 'colles18', 'colles18short', '', '', 1, 'scaletimes5'); -INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (19, 'colles19', 'colles19short', '', '', 1, 'scaletimes5'); -INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (20, 'colles20', 'colles20short', '', '', 1, 'scaletimes5'); -INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (21, 'colles21', 'colles21short', '', '', 1, 'scaletimes5'); -INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (22, 'colles22', 'colles22short', '', '', 1, 'scaletimes5'); -INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (23, 'colles23', 'colles23short', '', '', 1, 'scaletimes5'); -INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (24, 'colles24', 'colles24short', '', '', 1, 'scaletimes5'); -INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (25, 'collesm1', 'collesm1short', '1,2,3,4', 'collesmintro', 1, 'scaletimes5'); -INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (26, 'collesm2', 'collesm2short', '5,6,7,8', 'collesmintro', 1, 'scaletimes5'); -INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (27, 'collesm3', 'collesm3short', '9,10,11,12', 'collesmintro', 1, 'scaletimes5'); -INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (28, 'collesm4', 'collesm4short', '13,14,15,16', 'collesmintro', 1, 'scaletimes5'); -INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (29, 'collesm5', 'collesm5short', '17,18,19,20', 'collesmintro', 1, 'scaletimes5'); -INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (30, 'collesm6', 'collesm6short', '21,22,23,24', 'collesmintro', 1, 'scaletimes5'); -INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (31, 'collesm1', 'collesm1short', '1,2,3,4', 'collesmintro', 2, 'scaletimes5'); -INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (32, 'collesm2', 'collesm2short', '5,6,7,8', 'collesmintro', 2, 'scaletimes5'); -INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (33, 'collesm3', 'collesm3short', '9,10,11,12', 'collesmintro', 2, 'scaletimes5'); -INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (34, 'collesm4', 'collesm4short', '13,14,15,16', 'collesmintro', 2, 'scaletimes5'); -INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (35, 'collesm5', 'collesm5short', '17,18,19,20', 'collesmintro', 2, 'scaletimes5'); -INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (36, 'collesm6', 'collesm6short', '21,22,23,24', 'collesmintro', 2, 'scaletimes5'); -INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (37, 'collesm1', 'collesm1short', '1,2,3,4', 'collesmintro', 3, 'scaletimes5'); -INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (38, 'collesm2', 'collesm2short', '5,6,7,8', 'collesmintro', 3, 'scaletimes5'); -INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (39, 'collesm3', 'collesm3short', '9,10,11,12', 'collesmintro', 3, 'scaletimes5'); -INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (40, 'collesm4', 'collesm4short', '13,14,15,16', 'collesmintro', 3, 'scaletimes5'); -INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (41, 'collesm5', 'collesm5short', '17,18,19,20', 'collesmintro', 3, 'scaletimes5'); -INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (42, 'collesm6', 'collesm6short', '21,22,23,24', 'collesmintro', 3, 'scaletimes5'); -INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (43, 'howlong', '', '', '', 1, 'howlongoptions'); -INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (44, 'othercomments', '', '', '', 0, ''); -INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (64, 'attls20', 'attls20short', '', '', 1, 'scaleagree5'); -INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (58, 'attls14', 'attls14short', '', '', 1, 'scaleagree5'); -INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (59, 'attls15', 'attls15short', '', '', 1, 'scaleagree5'); -INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (60, 'attls16', 'attls16short', '', '', 1, 'scaleagree5'); -INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (61, 'attls17', 'attls17short', '', '', 1, 'scaleagree5'); -INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (62, 'attls18', 'attls18short', '', '', 1, 'scaleagree5'); -INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (63, 'attls19', 'attls19short', '', '', 1, 'scaleagree5'); -INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (56, 'attls12', 'attls12short', '', '', 1, 'scaleagree5'); -INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (57, 'attls13', 'attls13short', '', '', 1, 'scaleagree5'); -INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (55, 'attls11', 'attls11short', '', '', 1, 'scaleagree5'); -INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (54, 'attls10', 'attls10short', '', '', 1, 'scaleagree5'); -INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (53, 'attls9', 'attls9short', '', '', 1, 'scaleagree5'); -INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (52, 'attls8', 'attls8short', '', '', 1, 'scaleagree5'); -INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (51, 'attls7', 'attls7short', '', '', 1, 'scaleagree5'); -INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (50, 'attls6', 'attls6short', '', '', 1, 'scaleagree5'); -INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (49, 'attls5', 'attls5short', '', '', 1, 'scaleagree5'); -INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (48, 'attls4', 'attls4short', '', '', 1, 'scaleagree5'); -INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (47, 'attls3', 'attls3short', '', '', 1, 'scaleagree5'); -INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (45, 'attls1', 'attls1short', '', '', 1, 'scaleagree5'); -INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (46, 'attls2', 'attls2short', '', '', 1, 'scaleagree5'); -INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (65, 'attlsm1', 'attlsm1', '45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64', 'attlsmintro', 1, 'scaleagree5'); -INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (67, 'attlsm2', 'attlsm2', '63,62,59,57,55,49,52,50,48,47', 'attlsmintro', -1, 'scaleagree5'); -INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (68, 'attlsm3', 'attlsm3', '46,54,45,51,60,53,56,58,61,64', 'attlsmintro', -1, 'scaleagree5'); - -INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (69, 'ciq1', 'ciq1short', '', '', 0, ''); -INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (70, 'ciq2', 'ciq2short', '', '', 0, ''); -INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (71, 'ciq3', 'ciq3short', '', '', 0, ''); -INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (72, 'ciq4', 'ciq4short', '', '', 0, ''); -INSERT INTO `prefix_survey_questions` (`id`, `text`, `shorttext`, `multi`, `intro`, `type`, `options`) VALUES (73, 'ciq5', 'ciq5short', '', '', 0, ''); - - -# -# Dumping data for table `log_display` -# - -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('survey', 'add', 'survey', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('survey', 'update', 'survey', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('survey', 'download', 'survey', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('survey', 'view form', 'survey', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('survey', 'view graph', 'survey', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('survey', 'view report', 'survey', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('survey', 'submit', 'survey', 'name'); diff --git a/mod/survey/db/postgres7.sql b/mod/survey/db/postgres7.sql deleted file mode 100755 index 899c5df7485..00000000000 --- a/mod/survey/db/postgres7.sql +++ /dev/null @@ -1,202 +0,0 @@ -# phpMyAdmin MySQL-Dump -# version 2.2.1 -# http://phpwizard.net/phpMyAdmin/ -# http://phpmyadmin.sourceforge.net/ (download page) -# -# Host: localhost -# Generation Time: Nov 14, 2001 at 04:39 PM -# Server version: 3.23.36 -# PHP Version: 4.0.6 -# Database : moodle -# -------------------------------------------------------- - -# -# Table structure for table survey -# - -CREATE TABLE prefix_survey ( - id SERIAL PRIMARY KEY, - course integer NOT NULL default '0', - template integer NOT NULL default '0', - days integer NOT NULL default '0', - timecreated integer NOT NULL default '0', - timemodified integer NOT NULL default '0', - name varchar(255) NOT NULL default '', - intro text, - questions varchar(255) default NULL -); - -CREATE INDEX prefix_survey_course_idx ON prefix_survey (course); - -# -# Dumping data for table survey -# - -INSERT INTO prefix_survey (id, course, template, days, timecreated, timemodified, name, intro, questions) VALUES (1, 0, 0, 0, 985017600, 985017600, 'collesaname', 'collesaintro', '25,26,27,28,29,30,43,44'); -INSERT INTO prefix_survey (id, course, template, days, timecreated, timemodified, name, intro, questions) VALUES (2, 0, 0, 0, 985017600, 985017600, 'collespname', 'collespintro', '31,32,33,34,35,36,43,44'); -INSERT INTO prefix_survey (id, course, template, days, timecreated, timemodified, name, intro, questions) VALUES (3, 0, 0, 0, 985017600, 985017600, 'collesapname', 'collesapintro', '37,38,39,40,41,42,43,44'); -INSERT INTO prefix_survey (id, course, template, days, timecreated, timemodified, name, intro, questions) VALUES (4, 0, 0, 0, 985017600, 985017600, 'attlsname', 'attlsintro', '65,67,68'); -INSERT INTO prefix_survey (id, course, template, days, timecreated, timemodified, name, intro, questions) VALUES (5, 0, 0, 0, 985017600, 985017600, 'ciqname', 'ciqintro', '69,70,71,72,73'); - - -# Reset the sequence. doing it this way rather than simply taking out -# id from the preceeding sql to avoid missing fks. -SELECT setval('prefix_survey_id_seq', (select max(id) from prefix_survey)); - - - - -# -# Table structure for table survey_analysis -# - -CREATE TABLE prefix_survey_analysis ( - id SERIAL PRIMARY KEY, - survey integer NOT NULL default '0', - userid integer NOT NULL default '0', - notes text NOT NULL default '' -); - -CREATE INDEX prefix_survey_analysis_survey_idx ON prefix_survey_analysis (survey); -CREATE INDEX prefix_survey_analysis_userid_idx ON prefix_survey_analysis (userid); - -# -# Dumping data for table survey_analysis -# - -# -------------------------------------------------------- - -# -# Table structure for table survey_answers -# - -CREATE TABLE prefix_survey_answers ( - id SERIAL PRIMARY KEY, - userid integer NOT NULL default '0', - survey integer NOT NULL default '0', - question integer NOT NULL default '0', - time integer default NULL, - answer1 text default NULL, - answer2 text default NULL -); - -CREATE INDEX prefix_survey_answers_userid_idx ON prefix_survey_answers (userid); -CREATE INDEX prefix_survey_answers_survey_idx ON prefix_survey_answers (survey); -CREATE INDEX prefix_survey_answers_question_idx ON prefix_survey_answers (question); - -# -# Dumping data for table survey_answers -# - -# -------------------------------------------------------- - -# -# Table structure for table survey_questions -# - -CREATE TABLE prefix_survey_questions ( - id SERIAL PRIMARY KEY, - text varchar(255) NOT NULL default '', - shorttext varchar(30) NOT NULL default '', - multi varchar(100) NOT NULL default '', - intro varchar(50) default NULL, - type integer NOT NULL default '0', - options text -); - -# -# Dumping data for table survey_questions -# - -INSERT INTO prefix_survey_questions (id, text, shorttext, multi, intro, type, options) VALUES (1, 'colles1', 'colles1short', '', '', 1, 'scaletimes5'); -INSERT INTO prefix_survey_questions (id, text, shorttext, multi, intro, type, options) VALUES (2, 'colles2', 'colles2short', '', '', 1, 'scaletimes5'); -INSERT INTO prefix_survey_questions (id, text, shorttext, multi, intro, type, options) VALUES (3, 'colles3', 'colles3short', '', '', 1, 'scaletimes5'); -INSERT INTO prefix_survey_questions (id, text, shorttext, multi, intro, type, options) VALUES (4, 'colles4', 'colles4short', '', '', 1, 'scaletimes5'); -INSERT INTO prefix_survey_questions (id, text, shorttext, multi, intro, type, options) VALUES (5, 'colles5', 'colles5short', '', '', 1, 'scaletimes5'); -INSERT INTO prefix_survey_questions (id, text, shorttext, multi, intro, type, options) VALUES (6, 'colles6', 'colles6short', '', '', 1, 'scaletimes5'); -INSERT INTO prefix_survey_questions (id, text, shorttext, multi, intro, type, options) VALUES (7, 'colles7', 'colles7short', '', '', 1, 'scaletimes5'); -INSERT INTO prefix_survey_questions (id, text, shorttext, multi, intro, type, options) VALUES (8, 'colles8', 'colles8short', '', '', 1, 'scaletimes5'); -INSERT INTO prefix_survey_questions (id, text, shorttext, multi, intro, type, options) VALUES (9, 'colles9', 'colles9short', '', '', 1, 'scaletimes5'); -INSERT INTO prefix_survey_questions (id, text, shorttext, multi, intro, type, options) VALUES (10, 'colles10', 'colles10short', '', '', 1, 'scaletimes5'); -INSERT INTO prefix_survey_questions (id, text, shorttext, multi, intro, type, options) VALUES (11, 'colles11', 'colles11short', '', '', 1, 'scaletimes5'); -INSERT INTO prefix_survey_questions (id, text, shorttext, multi, intro, type, options) VALUES (12, 'colles12', 'colles12short', '', '', 1, 'scaletimes5'); -INSERT INTO prefix_survey_questions (id, text, shorttext, multi, intro, type, options) VALUES (13, 'colles13', 'colles13short', '', '', 1, 'scaletimes5'); -INSERT INTO prefix_survey_questions (id, text, shorttext, multi, intro, type, options) VALUES (14, 'colles14', 'colles14short', '', '', 1, 'scaletimes5'); -INSERT INTO prefix_survey_questions (id, text, shorttext, multi, intro, type, options) VALUES (15, 'colles15', 'colles15short', '', '', 1, 'scaletimes5'); -INSERT INTO prefix_survey_questions (id, text, shorttext, multi, intro, type, options) VALUES (16, 'colles16', 'colles16short', '', '', 1, 'scaletimes5'); -INSERT INTO prefix_survey_questions (id, text, shorttext, multi, intro, type, options) VALUES (17, 'colles17', 'colles17short', '', '', 1, 'scaletimes5'); -INSERT INTO prefix_survey_questions (id, text, shorttext, multi, intro, type, options) VALUES (18, 'colles18', 'colles18short', '', '', 1, 'scaletimes5'); -INSERT INTO prefix_survey_questions (id, text, shorttext, multi, intro, type, options) VALUES (19, 'colles19', 'colles19short', '', '', 1, 'scaletimes5'); -INSERT INTO prefix_survey_questions (id, text, shorttext, multi, intro, type, options) VALUES (20, 'colles20', 'colles20short', '', '', 1, 'scaletimes5'); -INSERT INTO prefix_survey_questions (id, text, shorttext, multi, intro, type, options) VALUES (21, 'colles21', 'colles21short', '', '', 1, 'scaletimes5'); -INSERT INTO prefix_survey_questions (id, text, shorttext, multi, intro, type, options) VALUES (22, 'colles22', 'colles22short', '', '', 1, 'scaletimes5'); -INSERT INTO prefix_survey_questions (id, text, shorttext, multi, intro, type, options) VALUES (23, 'colles23', 'colles23short', '', '', 1, 'scaletimes5'); -INSERT INTO prefix_survey_questions (id, text, shorttext, multi, intro, type, options) VALUES (24, 'colles24', 'colles24short', '', '', 1, 'scaletimes5'); -INSERT INTO prefix_survey_questions (id, text, shorttext, multi, intro, type, options) VALUES (25, 'collesm1', 'collesm1short', '1,2,3,4', 'collesmintro', 1, 'scaletimes5'); -INSERT INTO prefix_survey_questions (id, text, shorttext, multi, intro, type, options) VALUES (26, 'collesm2', 'collesm2short', '5,6,7,8', 'collesmintro', 1, 'scaletimes5'); -INSERT INTO prefix_survey_questions (id, text, shorttext, multi, intro, type, options) VALUES (27, 'collesm3', 'collesm3short', '9,10,11,12', 'collesmintro', 1, 'scaletimes5'); -INSERT INTO prefix_survey_questions (id, text, shorttext, multi, intro, type, options) VALUES (28, 'collesm4', 'collesm4short', '13,14,15,16', 'collesmintro', 1, 'scaletimes5'); -INSERT INTO prefix_survey_questions (id, text, shorttext, multi, intro, type, options) VALUES (29, 'collesm5', 'collesm5short', '17,18,19,20', 'collesmintro', 1, 'scaletimes5'); -INSERT INTO prefix_survey_questions (id, text, shorttext, multi, intro, type, options) VALUES (30, 'collesm6', 'collesm6short', '21,22,23,24', 'collesmintro', 1, 'scaletimes5'); -INSERT INTO prefix_survey_questions (id, text, shorttext, multi, intro, type, options) VALUES (31, 'collesm1', 'collesm1short', '1,2,3,4', 'collesmintro', 2, 'scaletimes5'); -INSERT INTO prefix_survey_questions (id, text, shorttext, multi, intro, type, options) VALUES (32, 'collesm2', 'collesm2short', '5,6,7,8', 'collesmintro', 2, 'scaletimes5'); -INSERT INTO prefix_survey_questions (id, text, shorttext, multi, intro, type, options) VALUES (33, 'collesm3', 'collesm3short', '9,10,11,12', 'collesmintro', 2, 'scaletimes5'); -INSERT INTO prefix_survey_questions (id, text, shorttext, multi, intro, type, options) VALUES (34, 'collesm4', 'collesm4short', '13,14,15,16', 'collesmintro', 2, 'scaletimes5'); -INSERT INTO prefix_survey_questions (id, text, shorttext, multi, intro, type, options) VALUES (35, 'collesm5', 'collesm5short', '17,18,19,20', 'collesmintro', 2, 'scaletimes5'); -INSERT INTO prefix_survey_questions (id, text, shorttext, multi, intro, type, options) VALUES (36, 'collesm6', 'collesm6short', '21,22,23,24', 'collesmintro', 2, 'scaletimes5'); -INSERT INTO prefix_survey_questions (id, text, shorttext, multi, intro, type, options) VALUES (37, 'collesm1', 'collesm1short', '1,2,3,4', 'collesmintro', 3, 'scaletimes5'); -INSERT INTO prefix_survey_questions (id, text, shorttext, multi, intro, type, options) VALUES (38, 'collesm2', 'collesm2short', '5,6,7,8', 'collesmintro', 3, 'scaletimes5'); -INSERT INTO prefix_survey_questions (id, text, shorttext, multi, intro, type, options) VALUES (39, 'collesm3', 'collesm3short', '9,10,11,12', 'collesmintro', 3, 'scaletimes5'); -INSERT INTO prefix_survey_questions (id, text, shorttext, multi, intro, type, options) VALUES (40, 'collesm4', 'collesm4short', '13,14,15,16', 'collesmintro', 3, 'scaletimes5'); -INSERT INTO prefix_survey_questions (id, text, shorttext, multi, intro, type, options) VALUES (41, 'collesm5', 'collesm5short', '17,18,19,20', 'collesmintro', 3, 'scaletimes5'); -INSERT INTO prefix_survey_questions (id, text, shorttext, multi, intro, type, options) VALUES (42, 'collesm6', 'collesm6short', '21,22,23,24', 'collesmintro', 3, 'scaletimes5'); -INSERT INTO prefix_survey_questions (id, text, shorttext, multi, intro, type, options) VALUES (43, 'howlong', '', '', '', 1, 'howlongoptions'); -INSERT INTO prefix_survey_questions (id, text, shorttext, multi, intro, type, options) VALUES (44, 'othercomments', '', '', '', 0, ''); -INSERT INTO prefix_survey_questions (id, text, shorttext, multi, intro, type, options) VALUES (64, 'attls20', 'attls20short', '', '', 1, 'scaleagree5'); -INSERT INTO prefix_survey_questions (id, text, shorttext, multi, intro, type, options) VALUES (58, 'attls14', 'attls14short', '', '', 1, 'scaleagree5'); -INSERT INTO prefix_survey_questions (id, text, shorttext, multi, intro, type, options) VALUES (59, 'attls15', 'attls15short', '', '', 1, 'scaleagree5'); -INSERT INTO prefix_survey_questions (id, text, shorttext, multi, intro, type, options) VALUES (60, 'attls16', 'attls16short', '', '', 1, 'scaleagree5'); -INSERT INTO prefix_survey_questions (id, text, shorttext, multi, intro, type, options) VALUES (61, 'attls17', 'attls17short', '', '', 1, 'scaleagree5'); -INSERT INTO prefix_survey_questions (id, text, shorttext, multi, intro, type, options) VALUES (62, 'attls18', 'attls18short', '', '', 1, 'scaleagree5'); -INSERT INTO prefix_survey_questions (id, text, shorttext, multi, intro, type, options) VALUES (63, 'attls19', 'attls19short', '', '', 1, 'scaleagree5'); -INSERT INTO prefix_survey_questions (id, text, shorttext, multi, intro, type, options) VALUES (56, 'attls12', 'attls12short', '', '', 1, 'scaleagree5'); -INSERT INTO prefix_survey_questions (id, text, shorttext, multi, intro, type, options) VALUES (57, 'attls13', 'attls13short', '', '', 1, 'scaleagree5'); -INSERT INTO prefix_survey_questions (id, text, shorttext, multi, intro, type, options) VALUES (55, 'attls11', 'attls11short', '', '', 1, 'scaleagree5'); -INSERT INTO prefix_survey_questions (id, text, shorttext, multi, intro, type, options) VALUES (54, 'attls10', 'attls10short', '', '', 1, 'scaleagree5'); -INSERT INTO prefix_survey_questions (id, text, shorttext, multi, intro, type, options) VALUES (53, 'attls9', 'attls9short', '', '', 1, 'scaleagree5'); -INSERT INTO prefix_survey_questions (id, text, shorttext, multi, intro, type, options) VALUES (52, 'attls8', 'attls8short', '', '', 1, 'scaleagree5'); -INSERT INTO prefix_survey_questions (id, text, shorttext, multi, intro, type, options) VALUES (51, 'attls7', 'attls7short', '', '', 1, 'scaleagree5'); -INSERT INTO prefix_survey_questions (id, text, shorttext, multi, intro, type, options) VALUES (50, 'attls6', 'attls6short', '', '', 1, 'scaleagree5'); -INSERT INTO prefix_survey_questions (id, text, shorttext, multi, intro, type, options) VALUES (49, 'attls5', 'attls5short', '', '', 1, 'scaleagree5'); -INSERT INTO prefix_survey_questions (id, text, shorttext, multi, intro, type, options) VALUES (48, 'attls4', 'attls4short', '', '', 1, 'scaleagree5'); -INSERT INTO prefix_survey_questions (id, text, shorttext, multi, intro, type, options) VALUES (47, 'attls3', 'attls3short', '', '', 1, 'scaleagree5'); -INSERT INTO prefix_survey_questions (id, text, shorttext, multi, intro, type, options) VALUES (45, 'attls1', 'attls1short', '', '', 1, 'scaleagree5'); -INSERT INTO prefix_survey_questions (id, text, shorttext, multi, intro, type, options) VALUES (46, 'attls2', 'attls2short', '', '', 1, 'scaleagree5'); -INSERT INTO prefix_survey_questions (id, text, shorttext, multi, intro, type, options) VALUES (65, 'attlsm1', 'attlsm1', '45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64', 'attlsmintro', 1, 'scaleagree5'); -INSERT INTO prefix_survey_questions (id, text, shorttext, multi, intro, type, options) VALUES (67, 'attlsm2', 'attlsm2', '63,62,59,57,55,49,52,50,48,47', 'attlsmintro', -1, 'scaleagree5'); -INSERT INTO prefix_survey_questions (id, text, shorttext, multi, intro, type, options) VALUES (68, 'attlsm3', 'attlsm3', '46,54,45,51,60,53,56,58,61,64', 'attlsmintro', -1, 'scaleagree5'); - - -INSERT INTO prefix_survey_questions (id, text, shorttext, multi, intro, type, options) VALUES (69, 'ciq1', 'ciq1short', '', '', 0, ''); -INSERT INTO prefix_survey_questions (id, text, shorttext, multi, intro, type, options) VALUES (70, 'ciq2', 'ciq2short', '', '', 0, ''); -INSERT INTO prefix_survey_questions (id, text, shorttext, multi, intro, type, options) VALUES (71, 'ciq3', 'ciq3short', '', '', 0, ''); -INSERT INTO prefix_survey_questions (id, text, shorttext, multi, intro, type, options) VALUES (72, 'ciq4', 'ciq4short', '', '', 0, ''); -INSERT INTO prefix_survey_questions (id, text, shorttext, multi, intro, type, options) VALUES (73, 'ciq5', 'ciq5short', '', '', 0, ''); - -# Reset the sequence. doing it this way rather than simply taking out -# id from the preceeding sql to avoid missing fks. -SELECT setval('prefix_survey_questions_id_seq', (select max(id) from prefix_survey_questions)); - - - -# -# Dumping data for table log_display -# - -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('survey', 'add', 'survey', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('survey', 'update', 'survey', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('survey', 'download', 'survey', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('survey', 'view form', 'survey', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('survey', 'view graph', 'survey', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('survey', 'view report', 'survey', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('survey', 'submit', 'survey', 'name'); diff --git a/mod/wiki/db/mysql.sql b/mod/wiki/db/mysql.sql deleted file mode 100644 index f69b494a566..00000000000 --- a/mod/wiki/db/mysql.sql +++ /dev/null @@ -1,67 +0,0 @@ -# This file contains a complete database schema for all the -# tables used by this module, written in SQL - -# It may also contain INSERT statements for particular data -# that may be used, especially new entries in the table log_display - - -CREATE TABLE `prefix_wiki` ( - `id` int(10) unsigned NOT NULL auto_increment, - `course` int(10) unsigned NOT NULL default '0', - `name` varchar(255) NOT NULL default '', - `summary` text NOT NULL default '', - `pagename` varchar(255) NOT NULL default '', - `wtype` enum('teacher','group','student') NOT NULL default 'group', - `ewikiprinttitle` tinyint(4) NOT NULL default '1', - `htmlmode` tinyint(4) NOT NULL default '0', - `ewikiacceptbinary` tinyint(4) NOT NULL default '0', - `disablecamelcase` tinyint(4) NOT NULL default '0', - `setpageflags` tinyint(4) NOT NULL default '1', - `strippages` tinyint(4) NOT NULL default '1', - `removepages` tinyint(4) NOT NULL default '1', - `revertchanges` tinyint(4) NOT NULL default '1', - `initialcontent` varchar(255) NOT NULL default '', - `timemodified` int(10) NOT NULL default '0', - PRIMARY KEY (`id`), - KEY `course` (`course`) -) TYPE=MyISAM COMMENT='Main wiki table'; - - -# -# Table structure for table `mdl_wiki_entries` -# - -CREATE TABLE `prefix_wiki_entries` ( - `id` int(10) NOT NULL auto_increment, - `wikiid` int(10) NOT NULL default '0', - `course` int(10) NOT NULL default '0', - `groupid` int(10) NOT NULL default '0', - `userid` int(10) NOT NULL default '0', - `pagename` varchar(255) NOT NULL default '', - `timemodified` int(10) NOT NULL default '0', - PRIMARY KEY (`id`), - KEY `wikiid` (`wikiid`), - KEY `course` (`course`), - KEY `gropuid` (`groupid`), - KEY `userid` (`userid`), - KEY `pagename` (`pagename`) -) TYPE=MyISAM COMMENT='Holds entries for each wiki start instance.'; - - -CREATE TABLE `prefix_wiki_pages` ( - `id` int(10) unsigned NOT NULL auto_increment, - `pagename` VARCHAR(160) NOT NULL, - `version` INTEGER UNSIGNED NOT NULL DEFAULT 0, - `flags` INTEGER UNSIGNED DEFAULT 0, - `content` MEDIUMTEXT default '', - `author` VARCHAR(100) DEFAULT 'ewiki', - `userid` INTEGER UNSIGNED NOT NULL DEFAULT 0, - `created` INTEGER UNSIGNED DEFAULT 0, - `lastmodified` INTEGER UNSIGNED DEFAULT 0, - `refs` MEDIUMTEXT default '', - `meta` MEDIUMTEXT default '', - `hits` INTEGER UNSIGNED DEFAULT 0, - `wiki` int(10) unsigned NOT NULL default 0, - PRIMARY KEY `id` (`id`), - UNIQUE KEY `wiki_pages_uk` (`pagename`, `version`, `wiki`) -) TYPE=MyISAM COMMENT='Holds the Wiki-Pages'; diff --git a/mod/wiki/db/postgres7.sql b/mod/wiki/db/postgres7.sql deleted file mode 100644 index 800a234aa1f..00000000000 --- a/mod/wiki/db/postgres7.sql +++ /dev/null @@ -1,66 +0,0 @@ -# This file contains a complete database schema for all the -# tables used by this module, written in SQL - -# It may also contain INSERT statements for particular data -# that may be used, especially new entries in the table log_display - - -CREATE TABLE prefix_wiki ( - id SERIAL8 PRIMARY KEY, - course INT8 NOT NULL default '0', - name varchar(255) NOT NULL default '', - summary text NOT NULL, - pagename varchar(255) , - wtype VARCHAR default 'group' CHECK( wtype IN('teacher', 'group', 'student')), - ewikiprinttitle INT NOT NULL default '1', - htmlmode INT NOT NULL default '0', - ewikiacceptbinary INT NOT NULL default '0', - disablecamelcase INT NOT NULL default '0', - setpageflags INT NOT NULL default '1', - strippages INT NOT NULL default '1', - removepages INT NOT NULL default '1', - revertchanges INT NOT NULL default '1', - initialcontent varchar(255) , - timemodified INT8 NOT NULL default '0' -) ; - -CREATE INDEX prefix_wiki_course_idx ON prefix_wiki (course); - -# -# Table structure for table mdl_wiki_entries -# - -CREATE TABLE prefix_wiki_entries ( - id SERIAL8 PRIMARY KEY, - wikiid INT8 NOT NULL default '0', - course INT8 NOT NULL default '0', - groupid INT8 NOT NULL default '0', - userid INT8 NOT NULL default '0', - pagename varchar(255) NOT NULL default '', - timemodified INT8 NOT NULL default '0' -) ; - -CREATE INDEX prefix_wiki_entries_wikiid_idx ON prefix_wiki_entries (wikiid); -CREATE INDEX prefix_wiki_entries_userid_idx ON prefix_wiki_entries (userid); -CREATE INDEX prefix_wiki_entries_groupid_idx ON prefix_wiki_entries (groupid); -CREATE INDEX prefix_wiki_entries_course_idx ON prefix_wiki_entries (course); -CREATE INDEX prefix_wiki_entries_pagename_idx ON prefix_wiki_entries (pagename); - - -CREATE TABLE prefix_wiki_pages ( - id SERIAL8 PRIMARY KEY, - pagename VARCHAR(160) NOT NULL, - version INTEGER NOT NULL DEFAULT 0, - flags INTEGER DEFAULT 0, - content bytea DEFAULT '', - author VARCHAR(100) DEFAULT 'ewiki', - userid INTEGER NOT NULL DEFAULT 0, - created INTEGER DEFAULT 0, - lastmodified INTEGER DEFAULT 0, - refs bytea DEFAULT '', - meta TEXT, - hits INTEGER DEFAULT 0, - wiki INT8 NOT NULL -) ; - -CREATE UNIQUE INDEX prefix_wiki_pages_pagename_version_wiki_uk ON prefix_wiki_pages (pagename, version, wiki) ; diff --git a/mod/workshop/db/mysql.sql b/mod/workshop/db/mysql.sql deleted file mode 100644 index 51c63867dc3..00000000000 --- a/mod/workshop/db/mysql.sql +++ /dev/null @@ -1,188 +0,0 @@ -# -# Table structure for table `workshop` -# - -CREATE TABLE `prefix_workshop` ( - `id` int(10) unsigned NOT NULL auto_increment, - `course` int(10) unsigned NOT NULL default '0', - `name` varchar(255) NOT NULL default '', - `description` text NOT NULL default '', - `wtype` tinyint(3) unsigned NOT NULL default '0', - `nelements` tinyint(3) unsigned NOT NULL default '1', - `nattachments` tinyint(3) unsigned NOT NULL default '0', - `phase` tinyint(2) unsigned NOT NULL default '0', - `format` tinyint(2) unsigned NOT NULL default '0', - `gradingstrategy` tinyint(2) unsigned NOT NULL default '1', - `resubmit` tinyint(2) unsigned NOT NULL default '0', - `agreeassessments` tinyint(2) unsigned NOT NULL default '0', - `hidegrades` tinyint(2) unsigned NOT NULL default '0', - `anonymous` tinyint(2) unsigned NOT NULL default '0', - `includeself` tinyint(2) unsigned NOT NULL default '0', - `maxbytes` int(10) unsigned NOT NULL default '100000', - `submissionstart` int(10) unsigned NOT NULL default '0', - `assessmentstart` int(10) unsigned NOT NULL default '0', - `submissionend` int(10) unsigned NOT NULL default '0', - `assessmentend` int(10) unsigned NOT NULL default '0', - `releasegrades` int(10) unsigned NOT NULL default '0', - `grade` tinyint(3) NOT NULL default '0', - `gradinggrade` tinyint(3) NOT NULL default '0', - `ntassessments` tinyint(3) unsigned NOT NULL default '0', - `assessmentcomps` tinyint(3) unsigned NOT NULL default '2', - `nsassessments` tinyint(3) unsigned NOT NULL default '0', - `overallocation` tinyint(3) unsigned NOT NULL default '0', - `timemodified` int(10) unsigned NOT NULL default '0', - `teacherweight` tinyint(3) unsigned NOT NULL default '1', - `showleaguetable` tinyint(3) unsigned NOT NULL default '0', - `usepassword` tinyint(3) unsigned NOT NULL default '0', - `password` varchar(32) NOT NULL default '', - PRIMARY KEY (`id`), - KEY `course` (`course`) -) COMMENT='Defines workshop'; -# -------------------------------------------------------- - -# -# Table structure for table `workshop_submissions` -# - -CREATE TABLE `prefix_workshop_submissions` ( - `id` int(10) unsigned NOT NULL auto_increment, - `workshopid` int(10) unsigned NOT NULL default '0', - `userid` int(10) unsigned NOT NULL default '0', - `title` varchar(100) NOT NULL default '', - `timecreated` int(10) unsigned NOT NULL default '0', - `mailed` tinyint(2) unsigned NOT NULL default '0', - `description` text NOT NULL default '', - `gradinggrade` int(3) unsigned NOT NULL default '0', - `finalgrade` int(3) unsigned NOT NULL default '0', - `late` int(3) unsigned NOT NULL default '0', - `nassessments` int(10) unsigned NOT NULL default '0', - PRIMARY KEY (`id`), - INDEX `userid` (`userid`), - INDEX `workshopid` (`workshopid`), - INDEX `mailed` (`mailed`) -) COMMENT='Info about submitted work from teacher and students'; -# -------------------------------------------------------- - -# -# Table structure for table `workshop_assessments` -# - -CREATE TABLE `prefix_workshop_assessments` ( - `id` int(10) unsigned NOT NULL auto_increment, - `workshopid` int(10) unsigned NOT NULL default '0', - `submissionid` int(10) unsigned NOT NULL default '0', - `userid` int(10) unsigned NOT NULL default '0', - `timecreated` int(10) unsigned NOT NULL default '0', - `timegraded` int(10) unsigned NOT NULL default '0', - `timeagreed` int(10) unsigned NOT NULL default '0', - `grade` float NOT NULL default '0', - `gradinggrade` int(3) NOT NULL default '0', - `teachergraded` int(3) NOT NULL default '0', - `mailed` tinyint(3) unsigned NOT NULL default '0', - `resubmission` tinyint(3) unsigned NOT NULL default '0', - `donotuse` tinyint(3) unsigned NOT NULL default '0', - `generalcomment` text NOT NULL default '', - `teachercomment` text NOT NULL default '', - PRIMARY KEY (`id`), - INDEX (`submissionid`), - INDEX (`userid`), - INDEX `workshopid` (`workshopid`), - INDEX `mailed` (`mailed`) - ) COMMENT='Info about assessments by teacher and students'; -# -------------------------------------------------------- - -# -# Table structure for table `workshop_elements` -# - -CREATE TABLE `prefix_workshop_elements` ( - `id` int(10) unsigned NOT NULL auto_increment, - `workshopid` int(10) unsigned NOT NULL default '0', - `elementno` tinyint(3) unsigned NOT NULL default '0', - `description` text NOT NULL default '', - `scale` tinyint(3) unsigned NOT NULL default '0', - `maxscore` tinyint(3) unsigned NOT NULL default '1', - `weight` tinyint(3) unsigned NOT NULL default '11', - `stddev` float NOT NULL default '0.0', - `totalassessments` int(10) NOT NULL default '0', - PRIMARY KEY (`id`), - KEY `workshopid` (`workshopid`) -) COMMENT='Info about marking scheme of assignment'; -# -------------------------------------------------------- - - -# -# Table structure for table `workshop_rubrics` -# - -CREATE TABLE `prefix_workshop_rubrics` ( - `id` int(10) unsigned NOT NULL auto_increment, - `workshopid` int(10) unsigned NOT NULL default '0', - `elementno` int(10) unsigned NOT NULL default '0', - `rubricno` tinyint(3) unsigned NOT NULL default '0', - `description` text NOT NULL default '', - PRIMARY KEY (`id`) -) COMMENT='Info about the rubrics marking scheme'; -# -------------------------------------------------------- - -# -# Table structure for table `workshop_grades` -# - -CREATE TABLE `prefix_workshop_grades` ( - `id` int(10) unsigned NOT NULL auto_increment, - `workshopid` int(10) unsigned NOT NULL default '0', - `assessmentid` int(10) unsigned NOT NULL default '0', - `elementno` int(10) unsigned NOT NULL default '0', - `feedback` text NOT NULL default '', - `grade` tinyint(3) NOT NULL default '0', - PRIMARY KEY (`id`), - INDEX (`assessmentid`), - INDEX `workshopid` (`workshopid`) -) COMMENT='Info about individual grades given to each element'; -# -------------------------------------------------------- - - -# -# Table structure for table `workshop_stockcomments` -# - -CREATE TABLE `prefix_workshop_stockcomments` ( - `id` int(10) unsigned NOT NULL auto_increment, - `workshopid` int(10) unsigned NOT NULL default '0', - `elementno` int(10) unsigned NOT NULL default '0', - `comments` text NOT NULL default '', - PRIMARY KEY (`id`) -) COMMENT='Info about the teacher comment bank'; -# -------------------------------------------------------- - -# -# Table structure for table `workshop_comments` -# - -CREATE TABLE `prefix_workshop_comments` ( - `id` int(10) unsigned NOT NULL auto_increment, - `workshopid` int(10) unsigned NOT NULL default '0', - `assessmentid` int(10) unsigned NOT NULL default '0', - `userid` int(10) unsigned NOT NULL default '0', - `timecreated` int(10) unsigned NOT NULL default '0', - `mailed` tinyint(2) unsigned NOT NULL default '0', - `comments` text NOT NULL default '', - PRIMARY KEY (`id`), - KEY `workshopid` (`workshopid`), - KEY `assessmentid` (`assessmentid`), - KEY `userid` (`userid`), - KEY `mailed` (`mailed`) -) COMMENT='Defines comments'; -# -------------------------------------------------------- - - - -INSERT INTO `prefix_log_display` (module, action, mtable, field) VALUES ('workshop', 'assessments', 'workshop', 'name'); -INSERT INTO `prefix_log_display` (module, action, mtable, field) VALUES ('workshop', 'close', 'workshop', 'name'); -INSERT INTO `prefix_log_display` (module, action, mtable, field) VALUES ('workshop', 'display', 'workshop', 'name'); -INSERT INTO `prefix_log_display` (module, action, mtable, field) VALUES ('workshop', 'resubmit', 'workshop', 'name'); -INSERT INTO `prefix_log_display` (module, action, mtable, field) VALUES ('workshop', 'set up', 'workshop', 'name'); -INSERT INTO `prefix_log_display` (module, action, mtable, field) VALUES ('workshop', 'submissions', 'workshop', 'name'); -INSERT INTO `prefix_log_display` (module, action, mtable, field) VALUES ('workshop', 'view', 'workshop', 'name'); -INSERT INTO `prefix_log_display` (module, action, mtable, field) VALUES ('workshop', 'update', 'workshop', 'name'); diff --git a/mod/workshop/db/postgres7.sql b/mod/workshop/db/postgres7.sql deleted file mode 100644 index 6b6300f3743..00000000000 --- a/mod/workshop/db/postgres7.sql +++ /dev/null @@ -1,177 +0,0 @@ -# -# Table structure for table workshop -# -BEGIN; -CREATE TABLE prefix_workshop ( - id SERIAL PRIMARY KEY, - course INT8 NOT NULL default '0', - name varchar(255) NOT NULL default '', - description text NOT NULL default '', - wtype INT NOT NULL DEFAULT '0', - nelements INT NOT NULL default '10', - nattachments INT NOT NULL DEFAULT '0', - phase INT2 NOT NULL default '0', - format INT2 NOT NULL default '0', - gradingstrategy INT2 NOT NULL default '1', - resubmit INT2 NOT NULL default '0', - agreeassessments INT2 NOT NULL default '0', - hidegrades INT2 NOT NULL default '0', - anonymous INT2 NOT NULL default '0', - includeself INT2 NOT NULL default '0', - maxbytes INT8 NOT NULL default '100000', - submissionstart INT8 NOT NULL default '0', - assessmentstart INT8 NOT NULL default '0', - submissionend INT8 NOT NULL default '0', - assessmentend INT8 NOT NULL default '0', - releasegrades INT8 NOT NULL default'0', - grade INT8 NOT NULL default '0', - gradinggrade INT4 NOT NULL default '0', - ntassessments INT NOT NULL default '0', - assessmentcomps int4 NOT NULL default '2', - nsassessments INT NOT NULL default '0', - overallocation INT NOT NULL default '0', - timemodified INT8 NOT NULL default '0', - teacherweight INT NOT NULL default '1', - showleaguetable INT4 NOT NULL default '0', - usepassword INT NOT NULL DEFAULT '0', - password VARCHAR(32) NOT NULL DEFAULT '' -); - -CREATE INDEX prefix_workshop_course_idx ON prefix_workshop (course); - -# -------------------------------------------------------- - -# -# Table structure for table workshop_submissions -# - -CREATE TABLE prefix_workshop_submissions ( - id SERIAL PRIMARY KEY, - workshopid INT8 NOT NULL default '0', - userid INT8 NOT NULL default '0', - title varchar(100) NOT NULL default '', - timecreated INT8 NOT NULL default '0', - mailed INT2 NOT NULL default '0', - description TEXT, - gradinggrade INT NOT NULL default '0', - late INT NOT NULL DEFAULT '0', - finalgrade INT NOT NULL default '0', - nassessments INT8 NOT NULL default '0' - -); -CREATE INDEX prefix_workshop_submissions_title_idx on prefix_workshop_submissions (title); -CREATE INDEX prefix_workshop_submissions_userid_idx ON prefix_workshop_submissions (userid); -CREATE INDEX prefix_workshop_submissions_workshopid_idx ON prefix_workshop_submissions (workshopid); -CREATE INDEX prefix_workshop_submissions_mailed_idx ON prefix_workshop_submissions (mailed); - -# -------------------------------------------------------- - -# -# Table structure for table workshop_assessments -# - -CREATE TABLE prefix_workshop_assessments ( - id SERIAL PRIMARY KEY, - workshopid INT8 NOT NULL default '0', - submissionid INT8 NOT NULL default '0', - userid INT8 NOT NULL default '0', - timecreated INT8 NOT NULL default '0', - timegraded INT8 NOT NULL default '0', - timeagreed INT8 NOT NULL default '0', - grade float NOT NULL default '0', - gradinggrade INT NOT NULL default '0', - teachergraded INT4 NOT NULL default '0', - mailed INT2 NOT NULL default '0', - resubmission INT2 NOT NULL default '0', - donotuse int4 NOT NULL default '0', - generalcomment text NOT NULL default '', - teachercomment text NOT NULL default '' - - ); - -CREATE INDEX prefix_workshop_assessments_workshopid_idx ON prefix_workshop_assessments (workshopid); -CREATE INDEX prefix_workshop_assessments_submissionid_idx ON prefix_workshop_assessments (submissionid); -CREATE INDEX prefix_workshop_assessments_userid_idx ON prefix_workshop_assessments (userid); -CREATE INDEX prefix_workshop_assessments_mailed_idx ON prefix_workshop_assessments (mailed); - -# -------------------------------------------------------- - -# -# Table structure for table workshop_elements -# - -CREATE TABLE prefix_workshop_elements ( - id SERIAL PRIMARY KEY, - workshopid INT8 NOT NULL default '0', - elementno INT NOT NULL default '0', - description text NOT NULL default '', - scale INT NOT NULL default '0', - maxscore INT NOT NULL default '1', - weight INT4 NOT NULL default '11', - stddev FLOAT NOT NULL default '0', - totalassessments INT8 NOT NULL DEFAULT '0' -); - -CREATE INDEX prefix_workshop_elements_workshopid_idx ON prefix_workshop_elements (workshopid); - -# -------------------------------------------------------- -CREATE TABLE prefix_workshop_rubrics ( - id SERIAL PRIMARY KEY, - workshopid int8 NOT NULL default '0', - elementno int8 NOT NULL default '0', - rubricno int4 NOT NULL default '0', - description text NOT NULL -) ; -# -------------------------------------------------------- - - -# -# Table structure for table workshop_grades -# - -CREATE TABLE prefix_workshop_grades ( - id SERIAL PRIMARY KEY, - workshopid INT8 NOT NULL default '0', - assessmentid INT8 NOT NULL default '0', - elementno INT8 NOT NULL default '0', - feedback text NOT NULL default '', - grade INT NOT NULL default '0' -); - -CREATE INDEX prefix_workshop_grades_workshopid_idx ON prefix_workshop_grades (workshopid); -CREATE INDEX prefix_workshop_grades_assessmentid_idx ON prefix_workshop_grades (assessmentid); - -# -------------------------------------------------------- -CREATE TABLE prefix_workshop_comments ( - id SERIAL PRIMARY KEY, - workshopid int8 NOT NULL default '0', - assessmentid int8 NOT NULL default '0', - userid int8 NOT NULL default '0', - timecreated int8 NOT NULL default '0', - mailed int2 NOT NULL default '0', - comments text NOT NULL default '' -); - -CREATE INDEX prefix_workshop_comments_workshopid_idx ON prefix_workshop_comments (workshopid); -CREATE INDEX prefix_workshop_comments_assessmentid_idx ON prefix_workshop_comments (assessmentid); -CREATE INDEX prefix_workshop_comments_userid_idx ON prefix_workshop_comments (userid); -CREATE INDEX prefix_workshop_comments_mailed_idx ON prefix_workshop_comments (mailed); - -#--------------------------------------------------------- -CREATE TABLE prefix_workshop_stockcomments ( - id SERIAL PRIMARY KEY, - workshopid INT8 NOT NULL default '0', - elementno INT8 NOT NULL default '0', - comments text NOT NULL -); - -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('workshop', 'assessments', 'workshop', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('workshop', 'close', 'workshop', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('workshop', 'display', 'workshop', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('workshop', 'resubmit', 'workshop', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('workshop', 'set up', 'workshop', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('workshop', 'submissions', 'workshop', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('workshop', 'view', 'workshop', 'name'); -INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('workshop', 'update', 'workshop', 'name'); - -COMMIT; diff --git a/question/showbank.php b/question/showbank.php deleted file mode 100644 index ede2540a4db..00000000000 --- a/question/showbank.php +++ /dev/null @@ -1,189 +0,0 @@ -<?php // $Id$ -/** - * Shows the question bank editing interface. To be included by other pages - * - * The script also processes a number of actions: - * - * Actions affecting the question pool: - * move Moves a question to a different category - * deleteselected Deletes the selected questions from the category - * Other actions: - * cat Chooses the category - * displayoptions Sets display options - * - * @author Martin Dougiamas and many others. This has recently been extensively - * rewritten by Gustav Delius and other members of the Serving Mathematics project - * {@link http://maths.york.ac.uk/serving_maths} - * @license http://www.gnu.org/copyleft/gpl.html GNU Public License - * @package questionbank - */ - - // Make sure this can only be used from within Moodle scripts - defined('MOODLE_INTERNAL') or die('Direct access to this script is forbidden.'); - - require_once($CFG->dirroot.'/question/editlib.php'); - - $page = optional_param('page', -1, PARAM_INT); - $perpage = optional_param('perpage', -1, PARAM_INT); - $sortorder = optional_param('sortorder', ''); - if (preg_match("/[';]/", $sortorder)) { - error("Incorrect use of the parameter 'sortorder'"); - } - - if ($page > -1) { - $SESSION->questionpage = $page; - } else { - $page = isset($SESSION->questionpage) ? $SESSION->questionpage : 0; - } - - if ($perpage > -1) { - $SESSION->questionperpage = $perpage; - } else { - $perpage = isset($SESSION->questionperpage) ? $SESSION->questionperpage : DEFAULT_QUESTIONS_PER_PAGE; - } - - if ($sortorder) { - $SESSION->questionsortorder = $sortorder; - } else { - $sortorder = isset($SESSION->questionsortorder) ? $SESSION->questionsortorder : 'qtype, name ASC'; - } - $SESSION->fromurl = $FULLME; - -/// Now, check for commands on this page and modify variables as necessary - if (isset($_REQUEST['move']) and confirm_sesskey()) { /// Move selected questions to new category - $tocategoryid = required_param('category', PARAM_INT); - if (!$tocategory = get_record('question_categories', 'id', $tocategoryid)) { - error('Invalid category'); - } - if (!has_capability('moodle/question:managecategory', get_context_instance(CONTEXT_COURSE, $tocategory->course))){ - error(get_string('categorynoedit', 'quiz', $tocategory->name), 'edit.php?courseid=$course->id'); - } - foreach ($_POST as $key => $value) { // Parse input for question ids - if (substr($key, 0, 1) == "q") { - $key = substr($key,1); - if (!set_field('question', 'category', $tocategory->id, 'id', $key)) { - error('Could not update category field'); - } - } - } - } - - if (isset($_REQUEST['deleteselected'])) { // delete selected questions from the category - - if (isset($_REQUEST['confirm']) and confirm_sesskey()) { // teacher has already confirmed the action - $deleteselected = required_param('deleteselected'); - if ($_REQUEST['confirm'] == md5($deleteselected)) { - if ($questionlist = explode(',', $deleteselected)) { - // for each question either hide it if it is in use or delete it - foreach ($questionlist as $questionid) { - if (record_exists('quiz_question_instances', 'question', $questionid) or - record_exists('question_states', 'originalquestion', $questionid)) { - if (!set_field('question', 'hidden', 1, 'id', $questionid)) { - error('Was not able to hide question'); - } - } else { - delete_question($questionid); - } - } - } - echo '</td></tr>'; - echo '</table>'; - echo '</div>'; - redirect("edit.php?courseid=$course->id"); - } else { - error("Confirmation string was incorrect"); - } - - } else { // teacher still has to confirm - // make a list of all the questions that are selected - $rawquestions = $_REQUEST; - $questionlist = ''; // comma separated list of ids of questions to be deleted - $questionnames = ''; // string with names of questions separated by <br /> with - // an asterix in front of those that are in use - $inuse = false; // set to true if at least one of the questions is in use - foreach ($rawquestions as $key => $value) { // Parse input for question ids - if (substr($key, 0, 1) == "q") { - $key = substr($key,1); - $questionlist .= $key.','; - if (record_exists('quiz_question_instances', 'question', $key) or - record_exists('question_states', 'originalquestion', $key)) { - $questionnames .= '* '; - $inuse = true; - } - $questionnames .= get_field('question', 'name', 'id', $key).'<br />'; - } - } - if (!$questionlist) { // no questions were selected - redirect("edit.php?courseid=$course->id"); - } - $questionlist = rtrim($questionlist, ','); - - // Add an explanation about questions in use - if ($inuse) { - $questionnames .= '<br />'.get_string('questionsinuse', 'quiz'); - } - notice_yesno(get_string("deletequestionscheck", "quiz", $questionnames), - "edit.php?courseid=$course->id&sesskey=$USER->sesskey&deleteselected=$questionlist&confirm=".md5($questionlist), "edit.php?courseid=$course->id"); - - echo '</td></tr>'; - echo '</table>'; - print_footer($course); - exit; - } - } - - // Unhide a question - if(isset($_REQUEST['unhide']) && confirm_sesskey()) { - $unhide = required_param('unhide', PARAM_INT); - if(!set_field('question', 'hidden', 0, 'id', $unhide)) { - error("Failed to unhide the question."); - } - redirect("edit.php?courseid=$course->id"); - } - - if ($categoryid = optional_param('cat', 0, PARAM_INT)) { /// coming from category selection drop-down menu - $SESSION->questioncat = $categoryid; - $page = 0; - $SESSION->questionpage = 0; - } - - if (empty($SESSION->questioncat) or !count_records_select("question_categories", "id = '{$SESSION->questioncat}' AND (course = '{$course->id}' OR publish = '1')")) { - $category = get_default_question_category($course->id); - $SESSION->questioncat = $category->id; - } - - if(($recurse = optional_param('recurse', -1, PARAM_BOOL)) != -1) { - $SESSION->questionrecurse = $recurse; - } - if (!isset($SESSION->questionrecurse)) { - $SESSION->questionrecurse = 1; - } - - if(($showhidden = optional_param('showhidden', -1, PARAM_BOOL)) != -1) { - $SESSION->questionshowhidden = $showhidden; - } - if (!isset($SESSION->questionshowhidden)) { - $SESSION->questionshowhidden = 0; - } - - if(($showquestiontext = optional_param('showquestiontext', -1, PARAM_BOOL)) != -1) { - $SESSION->questionshowquestiontext = $showquestiontext; - } - if (!isset($SESSION->questionshowquestiontext)) { - $SESSION->questionshowquestiontext = 0; - } - - // starts with category selection form - print_box_start('generalbox questionbank'); - print_heading(get_string('questionbank', 'question'), '', 2); - question_category_form($course, $SESSION->questioncat, $SESSION->questionrecurse, - $SESSION->questionshowhidden, $SESSION->questionshowquestiontext); - - // continues with list of questions - question_list($course, $SESSION->questioncat, isset($modform->instance) ? $modform->instance : 0, - $SESSION->questionrecurse, $page, $perpage, $SESSION->questionshowhidden, $sortorder, - $SESSION->questionshowquestiontext); - - print_box_end(); - -?> diff --git a/question/tabs.php b/question/tabs.php index 7aafe850bf7..da5847a38b6 100644 --- a/question/tabs.php +++ b/question/tabs.php @@ -18,7 +18,7 @@ $tabs = array(); $inactive = array(); $row = array(); - questionbank_navigation_tabs($row, $context, $course->id); + questionbank_navigation_tabs($row, $context, 'courseid='.$course->id); $tabs[] = $row; print_tabs($tabs, $currenttab, array()); diff --git a/question/type/calculated/db/mysql.sql b/question/type/calculated/db/mysql.sql deleted file mode 100644 index 70a633c27e7..00000000000 --- a/question/type/calculated/db/mysql.sql +++ /dev/null @@ -1,18 +0,0 @@ --- --- Table structure for table `prefix_question_calculated` --- - -CREATE TABLE prefix_question_calculated ( - id int(10) unsigned NOT NULL auto_increment, - question int(10) unsigned NOT NULL default '0', - answer int(10) unsigned NOT NULL default '0', - tolerance varchar(20) NOT NULL default '0.0', - tolerancetype int(10) NOT NULL default '1', - correctanswerlength int(10) NOT NULL default '2', - correctanswerformat int(10) NOT NULL default '2', - PRIMARY KEY (id), - KEY question (question), - KEY answer (answer) -) TYPE=MyISAM COMMENT='Options for questions of type calculated'; - --- -------------------------------------------------------- \ No newline at end of file diff --git a/question/type/calculated/db/postgres7.sql b/question/type/calculated/db/postgres7.sql deleted file mode 100644 index bc6d6e986b4..00000000000 --- a/question/type/calculated/db/postgres7.sql +++ /dev/null @@ -1,19 +0,0 @@ - -# -------------------------------------------------------- -# -# Table structure for table prefix_question_calculated -# - -CREATE TABLE prefix_question_calculated ( - id SERIAL8 PRIMARY KEY, - question INT8 NOT NULL default '0', - answer INT8 NOT NULL default '0', - tolerance varchar(20) NOT NULL default '0.0', - tolerancetype INT8 NOT NULL default '1', - correctanswerlength INT8 NOT NULL default '2', - correctanswerformat INT8 NOT NULL default '2' -); - -CREATE INDEX prefix_question_calculated_question_idx ON prefix_question_calculated (question); -CREATE INDEX prefix_question_calculated_answer_idx ON prefix_question_calculated (answer); - diff --git a/question/type/datasetdependent/categorydatasetdefinitions.php b/question/type/datasetdependent/categorydatasetdefinitions.php deleted file mode 100644 index 47a69237c4a..00000000000 --- a/question/type/datasetdependent/categorydatasetdefinitions.php +++ /dev/null @@ -1,102 +0,0 @@ -<?php // $Id$ - - ///////////////////////////////////////////////////////////////////// - ///// This page offers a way to define category level datasets ///// - ///////////////////////////////////////////////////////////////////// - - require_once(dirname(__FILE__) . '/../../../config.php'); - - $category = required_param('category', PARAM_ALPHANUM); - $question = optional_param('question', '', PARAM_INT); - - if (! $category = get_record("question_categories", "id", $category)) { - error("This wasn't a valid category!"); - } - - if (! $course = get_record("course", "id", $category->course)) { - error("This category doesn't belong to a valid course!"); - } - - require_login($course->id, false); - require_capability('moodle/question:import', get_context_instance(CONTEXT_COURSE, $course->id)); - - $DATASET_TYPES = array('1' => get_string('literal', 'quiz'), - '2' => get_string('file', 'quiz'), - '3' => get_string('link', 'quiz')); - - $streditingquiz = get_string("editingquiz", "quiz"); - $strdefinedataset = get_string("datasetdefinitions", "quiz", $category->name); - $strquestions = get_string("questions", "quiz"); - - print_header_simple("$strdefinedataset", "$strdefinedataset", - "<a href=\"../../edit.php\">$streditingquiz</a> -> $strdefinedataset"); - - if ($form = data_submitted()) { /// Filename - - $definition->category = $category->id; - foreach ($form->name as $key => $name) { - $definition->name = $name; - $definition->id = $form->id[$key]; - $definition->type = $form->type[$key]; - - if ($definition->id) { - if (!update_record('question_dataset_definitions', $definition)) { - notify("Could not update dataset item definition"); - } - - } else if ($definition->name) { - if (!insert_record('question_dataset_definitions', $definition)) { - notify("Could not insert dataset item defintion"); - } - - } else { - // No action - } - } - if ($form->question) { - redirect("../../question.php?id=$question"); - } else { - redirect("../../edit.php"); - } - } - - /// Print form - - print_heading_with_help($strdefinedataset, "datasets", "quiz"); - - print_simple_box_start("center"); - echo "<form method=\"post\" action=\"categorydatasetdefinitions.php\">"; - echo "<input type=\"hidden\" name=\"category\" value=\"$category->id\" />"; - if ($question) { - echo "<input type=\"hidden\" name=\"question\" value=\"$question\" />"; - } - - echo "<table cellpadding=\"5\">"; - - $definitions = get_records('question_dataset_definitions', - 'category', - $category->id); - for ($idef = 1, $total = max(5, count($definitions)) ; $idef <= $total ; ++$idef) { - if ($definitions) { - $definition = array_shift($definitions); - } else { - $definition = NULL; - } - - echo "<tr><td align=\"right\">"; - print_string("itemdefinition", "quiz"); - echo ":</td><td>"; - echo "<input name=\"name[]\" type=\"text\" size=\"20\" value=\"$definition->name\" />"; - echo "<input type=\"hidden\" name=\"id[]\" value=\"$definition->id\" />"; - echo " </td><td> "; - choose_from_menu($DATASET_TYPES, 'type[]', $definition->type, ''); - echo "</td></tr>\n"; - } - - echo "<tr><td align=\"CENTER\" colspan=\"3\"><input type=\"submit\" value=\"".get_string("continue")."\" /></td></tr>"; - echo "</table>"; - echo "</form>"; - print_simple_box_end(); - - print_footer($course); -?> diff --git a/question/type/match/db/mysql.sql b/question/type/match/db/mysql.sql deleted file mode 100644 index ebeb9e0bca4..00000000000 --- a/question/type/match/db/mysql.sql +++ /dev/null @@ -1,32 +0,0 @@ - - --- --- Table structure for table `prefix_question_match` --- - -CREATE TABLE prefix_question_match ( - id int(10) unsigned NOT NULL auto_increment, - question int(10) unsigned NOT NULL default '0', - subquestions varchar(255) NOT NULL default '', - shuffleanswers tinyint(4) NOT NULL default '1', - PRIMARY KEY (id), - KEY question (question) -) TYPE=MyISAM COMMENT='Defines fixed matching questions'; - --- -------------------------------------------------------- - --- --- Table structure for table `prefix_question_match_sub` --- - -CREATE TABLE prefix_question_match_sub ( - id int(10) unsigned NOT NULL auto_increment, - code int(10) unsigned NOT NULL default '0', - question int(10) unsigned NOT NULL default '0', - questiontext text NOT NULL default '', - answertext varchar(255) NOT NULL default '', - PRIMARY KEY (id), - KEY question (question) -) TYPE=MyISAM COMMENT='Defines the subquestions that make up a matching question'; - --- -------------------------------------------------------- \ No newline at end of file diff --git a/question/type/match/db/postgres7.sql b/question/type/match/db/postgres7.sql deleted file mode 100644 index 8bb5efe4575..00000000000 --- a/question/type/match/db/postgres7.sql +++ /dev/null @@ -1,30 +0,0 @@ - -# -------------------------------------------------------- - -# -# Table structure for table prefix_question_match -# - -CREATE TABLE prefix_question_match ( - id SERIAL PRIMARY KEY, - question integer NOT NULL default '0', - subquestions varchar(255) NOT NULL default '', - shuffleanswers integer NOT NULL default '1' -); - -CREATE INDEX prefix_question_match_question_idx ON prefix_question_match (question); - -# -------------------------------------------------------- - -# -# Table structure for table prefix_question_match_sub -# - -CREATE TABLE prefix_question_match_sub ( - id SERIAL PRIMARY KEY, - code integer NOT NULL default '0', - question integer NOT NULL default '0', - questiontext text NOT NULL default '', - answertext varchar(255) NOT NULL default '' -); -CREATE INDEX prefix_question_match_sub_question_idx ON prefix_question_match_sub (question); diff --git a/question/type/multianswer/db/mysql.sql b/question/type/multianswer/db/mysql.sql deleted file mode 100644 index e90d6977723..00000000000 --- a/question/type/multianswer/db/mysql.sql +++ /dev/null @@ -1,15 +0,0 @@ - - --- --- Table structure for table `prefix_question_multianswer` --- - -CREATE TABLE prefix_question_multianswer ( - id int(10) unsigned NOT NULL auto_increment, - question int(10) unsigned NOT NULL default '0', - sequence text NOT NULL default '', - PRIMARY KEY (id), - KEY question (question) -) TYPE=MyISAM COMMENT='Options for multianswer questions'; - --- -------------------------------------------------------- \ No newline at end of file diff --git a/question/type/multianswer/db/postgres7.sql b/question/type/multianswer/db/postgres7.sql deleted file mode 100644 index 626d0568677..00000000000 --- a/question/type/multianswer/db/postgres7.sql +++ /dev/null @@ -1,14 +0,0 @@ - -# -------------------------------------------------------- - -# -# Table structure for table prefix_question_multianswer -# - -CREATE TABLE prefix_question_multianswer ( - id SERIAL PRIMARY KEY, - question integer NOT NULL default '0', - sequence text NOT NULL default '' -); - -CREATE INDEX prefix_question_multianswer_question_idx ON prefix_question_multianswer (question); diff --git a/question/type/multichoice/db/mysql.sql b/question/type/multichoice/db/mysql.sql deleted file mode 100644 index 33016d3cfb6..00000000000 --- a/question/type/multichoice/db/mysql.sql +++ /dev/null @@ -1,21 +0,0 @@ - - --- --- Table structure for table `prefix_question_multichoice` --- - -CREATE TABLE prefix_question_multichoice ( - id int(10) unsigned NOT NULL auto_increment, - question int(10) unsigned NOT NULL default '0', - layout tinyint(4) NOT NULL default '0', - answers varchar(255) NOT NULL default '', - single tinyint(4) NOT NULL default '0', - shuffleanswers tinyint(4) NOT NULL default '1', - correctfeedback text NOT NULL default '', - partiallycorrectfeedback text NOT NULL default '', - incorrectfeedback text NOT NULL default '', - PRIMARY KEY (id), - KEY question (question) -) TYPE=MyISAM COMMENT='Options for multiple choice questions'; - --- -------------------------------------------------------- \ No newline at end of file diff --git a/question/type/multichoice/db/postgres7.sql b/question/type/multichoice/db/postgres7.sql deleted file mode 100644 index 44a425afb2f..00000000000 --- a/question/type/multichoice/db/postgres7.sql +++ /dev/null @@ -1,21 +0,0 @@ - -# -------------------------------------------------------- - -# -# Table structure for table prefix_question_multichoice -# - -CREATE TABLE prefix_question_multichoice ( - id SERIAL PRIMARY KEY, - question integer NOT NULL default '0', - layout integer NOT NULL default '0', - answers varchar(255) NOT NULL default '', - single integer NOT NULL default '0', - shuffleanswers integer NOT NULL default '1', - correctfeedback text NOT NULL default '', - partiallycorrectfeedback text NOT NULL default '', - incorrectfeedback text NOT NULL default '' -); - -CREATE INDEX prefix_question_multichoice_question_idx ON prefix_question_multichoice (question); - diff --git a/question/type/numerical/db/mysql.sql b/question/type/numerical/db/mysql.sql deleted file mode 100644 index c234b0bcd42..00000000000 --- a/question/type/numerical/db/mysql.sql +++ /dev/null @@ -1,17 +0,0 @@ - - --- --- Table structure for table `prefix_question_numerical` --- - -CREATE TABLE prefix_question_numerical ( - id int(10) unsigned NOT NULL auto_increment, - question int(10) unsigned NOT NULL default '0', - answer int(10) unsigned NOT NULL default '0', - tolerance varchar(255) NOT NULL default '0.0', - PRIMARY KEY (id), - KEY answer (answer), - KEY question (question) -) TYPE=MyISAM COMMENT='Options for numerical questions'; - --- -------------------------------------------------------- \ No newline at end of file diff --git a/question/type/numerical/db/postgres7.sql b/question/type/numerical/db/postgres7.sql deleted file mode 100644 index 4e3b53d834c..00000000000 --- a/question/type/numerical/db/postgres7.sql +++ /dev/null @@ -1,16 +0,0 @@ - -# -------------------------------------------------------- - -# -# Table structure for table prefix_question_numerical -# - -CREATE TABLE prefix_question_numerical ( - id SERIAL PRIMARY KEY, - question integer NOT NULL default '0', - answer integer NOT NULL default '0', - tolerance varchar(255) NOT NULL default '0.0' -); - -CREATE INDEX prefix_question_numerical_answer_idx ON prefix_question_numerical (answer); -CREATE INDEX prefix_question_numerical_question_idx ON prefix_question_numerical (question); diff --git a/question/type/randomsamatch/db/mysql.sql b/question/type/randomsamatch/db/mysql.sql deleted file mode 100644 index 79d8b4d45c9..00000000000 --- a/question/type/randomsamatch/db/mysql.sql +++ /dev/null @@ -1,13 +0,0 @@ --- --- Table structure for table `prefix_question_randomsamatch` --- - -CREATE TABLE prefix_question_randomsamatch ( - id int(10) unsigned NOT NULL auto_increment, - question int(10) unsigned NOT NULL default '0', - choose int(10) unsigned NOT NULL default '4', - PRIMARY KEY (id), - KEY question (question) -) TYPE=MyISAM COMMENT='Info about a random short-answer matching question'; - --- -------------------------------------------------------- \ No newline at end of file diff --git a/question/type/randomsamatch/db/postgres7.sql b/question/type/randomsamatch/db/postgres7.sql deleted file mode 100644 index 0afa172c87a..00000000000 --- a/question/type/randomsamatch/db/postgres7.sql +++ /dev/null @@ -1,14 +0,0 @@ - -# -------------------------------------------------------- - -# -# Table structure for table prefix_question_randomsamatch -# - -CREATE TABLE prefix_question_randomsamatch ( - id SERIAL PRIMARY KEY, - question integer NOT NULL default '0', - choose integer NOT NULL default '4' -); - -CREATE INDEX prefix_question_randomsamatch_question_idx ON prefix_question_randomsamatch (question); diff --git a/question/type/rqp/db/install.xml b/question/type/rqp/db/install.xml deleted file mode 100644 index 0eb69a09361..00000000000 --- a/question/type/rqp/db/install.xml +++ /dev/null @@ -1,57 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<XMLDB PATH="question/type/rqp/db" VERSION="20060812" COMMENT="XMLDB file for Moodle question/type/rqp"> - <TABLES> - <TABLE NAME="question_rqp" COMMENT="Options for RQP questions" NEXT="question_rqp_types"> - <FIELDS> - <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" ENUM="false" NEXT="question"/> - <FIELD NAME="question" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="id" NEXT="type"/> - <FIELD NAME="type" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="question" NEXT="source"/> - <FIELD NAME="source" TYPE="binary" LENGTH="big" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="type" NEXT="format"/> - <FIELD NAME="format" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="source" NEXT="flags"/> - <FIELD NAME="flags" TYPE="int" LENGTH="3" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="format" NEXT="maxscore"/> - <FIELD NAME="maxscore" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="1" SEQUENCE="false" ENUM="false" PREVIOUS="flags"/> - </FIELDS> - <KEYS> - <KEY NAME="primary" TYPE="primary" FIELDS="id" COMMENT="Primary key for question_rqp" NEXT="question"/> - <KEY NAME="question" TYPE="foreign" FIELDS="question" REFTABLE="questions" REFFIELDS="id" PREVIOUS="primary"/> - </KEYS> - </TABLE> - <TABLE NAME="question_rqp_types" COMMENT="RQP question types" PREVIOUS="question_rqp" NEXT="question_rqp_servers"> - <FIELDS> - <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" ENUM="false" NEXT="name"/> - <FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="id"/> - </FIELDS> - <KEYS> - <KEY NAME="primary" TYPE="primary" FIELDS="id" COMMENT="Primary key for question_rqp_types"/> - </KEYS> - <INDEXES> - <INDEX NAME="name" UNIQUE="true" FIELDS="name"/> - </INDEXES> - </TABLE> - <TABLE NAME="question_rqp_servers" COMMENT="Information about RQP servers" PREVIOUS="question_rqp_types" NEXT="question_rqp_states"> - <FIELDS> - <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" ENUM="false" NEXT="typeid"/> - <FIELD NAME="typeid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="id" NEXT="url"/> - <FIELD NAME="url" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="typeid" NEXT="can_render"/> - <FIELD NAME="can_render" TYPE="int" LENGTH="2" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="url" NEXT="can_author"/> - <FIELD NAME="can_author" TYPE="int" LENGTH="2" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="can_render"/> - </FIELDS> - <KEYS> - <KEY NAME="primary" TYPE="primary" FIELDS="id" COMMENT="Primary key for question_rqp_servers" NEXT="typeid"/> - <KEY NAME="typeid" TYPE="foreign" FIELDS="typeid" REFTABLE="rqp_types" REFFIELDS="id" PREVIOUS="primary"/> - </KEYS> - </TABLE> - <TABLE NAME="question_rqp_states" COMMENT="RQP question type specific state information" PREVIOUS="question_rqp_servers"> - <FIELDS> - <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" ENUM="false" NEXT="stateid"/> - <FIELD NAME="stateid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="id" NEXT="responses"/> - <FIELD NAME="responses" TYPE="text" LENGTH="small" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="stateid" NEXT="persistent_data"/> - <FIELD NAME="persistent_data" TYPE="text" LENGTH="small" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="responses" NEXT="template_vars"/> - <FIELD NAME="template_vars" TYPE="text" LENGTH="small" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="persistent_data"/> - </FIELDS> - <KEYS> - <KEY NAME="primary" TYPE="primary" FIELDS="id" COMMENT="Primary key for question_rqp_states"/> - </KEYS> - </TABLE> - </TABLES> -</XMLDB> \ No newline at end of file diff --git a/question/type/rqp/db/mysql.php b/question/type/rqp/db/mysql.php deleted file mode 100644 index c77dcd94977..00000000000 --- a/question/type/rqp/db/mysql.php +++ /dev/null @@ -1,18 +0,0 @@ -<?php //$Id$ - -// THIS FILE IS DEPRECATED! PLEASE DO NOT MAKE CHANGES TO IT! -// -// IT IS USED ONLY FOR UPGRADES FROM BEFORE MOODLE 1.7, ALL -// LATER CHANGES SHOULD USE upgrade.php IN THIS DIRECTORY. - -// MySQL commands for upgrading this question type - -function qtype_rqp_upgrade($oldversion=0) { - global $CFG; - - ////// DO NOT ADD NEW THINGS HERE!! USE upgrade.php and the lib/ddllib.php functions. - - return true; -} - -?> diff --git a/question/type/rqp/db/mysql.sql b/question/type/rqp/db/mysql.sql deleted file mode 100644 index 65b1f5b8611..00000000000 --- a/question/type/rqp/db/mysql.sql +++ /dev/null @@ -1,60 +0,0 @@ --- --- Table structure for table `prefix_question_rqp` --- - -CREATE TABLE prefix_question_rqp ( - id int(10) unsigned NOT NULL auto_increment, - question int(10) unsigned NOT NULL default '0', - type int(10) unsigned NOT NULL default '0', - source longblob NOT NULL default '', - format varchar(255) NOT NULL default '', - flags tinyint(3) unsigned NOT NULL default '0', - maxscore int(10) unsigned NOT NULL default '1', - PRIMARY KEY (id), - KEY question (question) -) TYPE=MyISAM COMMENT='Options for RQP questions'; - --- -------------------------------------------------------- - --- --- Table structure for table `prefix_question_rqp_servers` --- - -CREATE TABLE prefix_question_rqp_servers ( - id int(10) unsigned NOT NULL auto_increment, - typeid int(10) unsigned NOT NULL default '0', - url varchar(255) NOT NULL default '', - can_render tinyint(2) unsigned NOT NULL default '0', - can_author tinyint(2) unsigned NOT NULL default '0', - PRIMARY KEY (id) -) TYPE=MyISAM COMMENT='Information about RQP servers'; - --- -------------------------------------------------------- - --- --- Table structure for table `prefix_question_rqp_states` --- - -CREATE TABLE prefix_question_rqp_states ( - id int(10) unsigned NOT NULL auto_increment, - stateid int(10) unsigned NOT NULL default '0', - responses text NOT NULL default '', - persistent_data text NOT NULL default '', - template_vars text NOT NULL default '', - PRIMARY KEY (id) -) TYPE=MyISAM COMMENT='RQP question type specific state information'; - --- -------------------------------------------------------- - --- --- Table structure for table `prefix_question_rqp_types` --- - -CREATE TABLE prefix_question_rqp_types ( - id int(10) unsigned NOT NULL auto_increment, - name varchar(255) NOT NULL default '', - PRIMARY KEY (id), - UNIQUE KEY name (name) -) TYPE=MyISAM COMMENT='RQP question types'; - --- -------------------------------------------------------- \ No newline at end of file diff --git a/question/type/rqp/db/postgres7.php b/question/type/rqp/db/postgres7.php deleted file mode 100644 index 23ea199bc5e..00000000000 --- a/question/type/rqp/db/postgres7.php +++ /dev/null @@ -1,18 +0,0 @@ -<?php //$Id$ - -// THIS FILE IS DEPRECATED! PLEASE DO NOT MAKE CHANGES TO IT! -// -// IT IS USED ONLY FOR UPGRADES FROM BEFORE MOODLE 1.7, ALL -// LATER CHANGES SHOULD USE upgrade.php IN THIS DIRECTORY. - -// PostgreSQL commands for upgrading this question type - -function qtype_rqp_upgrade($oldversion=0) { - global $CFG; - - ////// DO NOT ADD NEW THINGS HERE!! USE upgrade.php and the lib/ddllib.php functions. - - return true; -} - -?> diff --git a/question/type/rqp/db/postgres7.sql b/question/type/rqp/db/postgres7.sql deleted file mode 100644 index 63ff3451cf3..00000000000 --- a/question/type/rqp/db/postgres7.sql +++ /dev/null @@ -1,50 +0,0 @@ - -# -------------------------------------------------------- - -# -# Table structure for table prefix_question_rqp -# - -CREATE TABLE prefix_question_rqp ( - id SERIAL PRIMARY KEY, - question integer NOT NULL default '0', - type integer NOT NULL default '0', - source text NOT NULL, - format varchar(255) NOT NULL default '', - flags integer NOT NULL default '0', - maxscore integer NOT NULL default '1' -); - -CREATE INDEX prefix_question_rqp_question_idx ON prefix_question_rqp (question); - - -# -------------------------------------------------------- - -# -# Table structure for table prefix_question_rqp_states -# - -CREATE TABLE prefix_question_rqp_states ( - id SERIAL PRIMARY KEY, - stateid integer NOT NULL default '0', - responses text NOT NULL, - persistent_data text NOT NULL, - template_vars text NOT NULL -); - -# -------------------------------------------------------- - -# -# Table structure for table prefix_question_rqp_type -# - -CREATE TABLE prefix_question_rqp_types ( - id SERIAL PRIMARY KEY, - name varchar(255) NOT NULL default '', - rendering_server varchar(255) NOT NULL default '', - cloning_server varchar(255) NOT NULL default '', - flags integer NOT NULL default '0' -); - -CREATE UNIQUE INDEX prefix_question_rqp_types_name_uk ON prefix_question_rqp_types (name); - diff --git a/question/type/rqp/db/upgrade.php b/question/type/rqp/db/upgrade.php deleted file mode 100644 index 394d98222fd..00000000000 --- a/question/type/rqp/db/upgrade.php +++ /dev/null @@ -1,38 +0,0 @@ -<?php //$Id$ - -// This file keeps track of upgrades to -// the rqp qtype plugin -// -// Sometimes, changes between versions involve -// alterations to database structures and other -// major things that may break installations. -// -// The upgrade function in this file will attempt -// to perform all the necessary actions to upgrade -// your older installtion to the current version. -// -// If there's something it cannot do itself, it -// will tell you what you need to do. -// -// The commands in here will all be database-neutral, -// using the functions defined in lib/ddllib.php - -function xmldb_qtype_rqp_upgrade($oldversion=0) { - - global $CFG, $THEME, $db; - - $result = true; - -/// And upgrade begins here. For each one, you'll need one -/// block of code similar to the next one. Please, delete -/// this comment lines once this file start handling proper -/// upgrade code. - -/// if ($result && $oldversion < YYYYMMDD00) { //New version in version.php -/// $result = result of "/lib/ddllib.php" function calls -/// } - - return $result; -} - -?> diff --git a/question/type/rqp/editquestion.html b/question/type/rqp/editquestion.html deleted file mode 100644 index 9c1cac82fea..00000000000 --- a/question/type/rqp/editquestion.html +++ /dev/null @@ -1,60 +0,0 @@ -<form id="theform" method="post" action="question.php"> -<fieldset class="invisiblefieldset"> -<table cellpadding="5"> - -<tr valign="top"> - <td align="right"><b><?php print_string('category', 'quiz'); ?>:</b></td> - <td align="left"> - <?php question_category_select_menu($course->id, true, true, $question->category); ?> - </td> -</tr> - -<tr valign="top"> - <td align="right"><b><?php print_string('questionname', 'quiz'); ?>:</b></td> - <td align="left"> - <input type="text" name="name" size="50" value="<?php p($question->name); ?>" /> - <input type="hidden" name="questiontext" value="" /> - <input type="hidden" name="questiontextformat" value="0" /> - <input type="hidden" name="image" value="" /> - <?php - if (isset($err['name'])) { - formerr($err['name']); - } - ?> - </td> -</tr> - -<tr valign="top"> - <td align="right"><b><?php print_string('itemsource', 'quiz'); ?>:</b> - </td> - <td align="left"> - <?php - print_textarea(false, 20, 60, 630, 300, "source", $question->options->source); - echo "<br />\n"; - if (isset($err['source'])) { - formerr($err['source']); - } - ?> - </td> -</tr> -<!-- Keep it simple for the moment -<tr valign="top"> - <td align="right"><b><?php print_string('itemsourceformat', 'quiz'); ?></b> - </td> - <td align="left"><input name="format" type="text" size="50" maxLength="255" value="<?php p($question->options->format); ?>" /> - <?php - if (isset($err['format'])) { - formerr($err['format']); - } - ?> - </td> -</tr> ---> -<?php - $QTYPES[$question->qtype]->print_replacement_options($question, $course, $contextquiz); - $QTYPES[$question->qtype]->print_question_form_end($question); -?> -</table> -<input type="hidden" name="type" value="<?php echo($type->id); ?>" /> -</fieldset> -</form> diff --git a/question/type/rqp/editquestion.php b/question/type/rqp/editquestion.php deleted file mode 100644 index c9e70a99824..00000000000 --- a/question/type/rqp/editquestion.php +++ /dev/null @@ -1,24 +0,0 @@ -<?php // $Id$ - - require_once($CFG->dirroot . '/question/type/rqp/lib.php'); - - if (empty($question->id)) { - if (!isset($typeid)) { - error('No remote question type specified'); - } - $question->options->type = $typeid; - $question->options->source = ''; - $question->options->format = ''; - } - else if (!$QTYPES[$question->qtype]->get_question_options($question)) { - error("Could not load the options for this question"); - } - - if (!$type = get_record('question_rqp_types', 'id', $question->options->type)) { - error("Invalid remote question type"); - } - - print_heading_with_help(get_string('editingrqp', 'quiz', $type->name), 'rqp', 'quiz'); - require('editquestion.html'); - -?> diff --git a/question/type/rqp/lib.php b/question/type/rqp/lib.php deleted file mode 100644 index f94b66f7c0f..00000000000 --- a/question/type/rqp/lib.php +++ /dev/null @@ -1,129 +0,0 @@ -<?php // $Id$ - -/** -* Library of functions used by the RQP question type -* -* @version $Id$ -* @author Alex Smith and other members of the Serving Mathematics project -* {@link http://maths.york.ac.uk/serving_maths} -* @license http://www.gnu.org/copyleft/gpl.html GNU Public License - * @package questionbank - * @subpackage questiontypes -*/ - - -function question_rqp_save_type($type) { - if (empty($type->id)) { - return insert_record('question_rqp_types', $type, false); - } - return update_record('question_rqp_types', $type); -} - -function question_rqp_delete_type($id) { - return delete_records('question_rqp_type', 'id', $id); -} - -/** -* Creates a colon separated list of space separated values from an associative -* array of arrays -* -* An associative array of values or an associative array of arrays is imploded -* to a string by creating a colon separated list of space separated values. The -* key is treated as the first value. The {@link question_rqp_explode} function can -* restore the array from this string representation. -* @return string The string representation of the array. This is a colon -* separated list of space separated values. -* @param array $array An associative array of single values or an associative -* array of arrays to be imploded. -*/ -function question_rqp_implode($array) { - if (count($array) < 1) { - return ''; - } - $str = ''; - foreach ($array as $key => $val) { - $str .= $key . ' '; - if (is_array($val)) { - if (count($val) > 0) { - foreach ($val as $subval) { - $str .= $subval . ' '; - } - // Remove the trailing space - $str = substr($str, 0, -1); - } - } else { - $str .= $val; - } - $str .= ':'; - } - // Remove the trailing semi-colon - return substr($str, 0, -1); -} - -/** -* Recreates an associative array or an associative array of arrays from the -* string representation -* -* Takes a colon separated list of space separated values as produced by -* {@link question_rqp_implode} and recreates the array. If an array of single values -* is expected then an error results if an element has more than one value. -* Otherwise every value is an array. -* @return array The associative array restored from the string. Every -* element is a single value if $multi is false or an array -* if $multi is true. -* @param string $str The string to explode. This is a colon separated list of -* space separated values. -* @param boolean $multi Flag indicating if the values in the array are expected -* to be of multiple cardinality (i.e. an array of arrays -* is expected) or single values (i.e. an array of values). -* The default is false indicating an array of single -* values is expected. -*/ -function question_rqp_explode($str, $multi=false) { - // Explode by colon - if ($str === '') { - return array(); - } - $array = explode(':', $str); - $n = count($array); - $return = array(); - for ($i = 0; $i < $n; $i++) { - // Explode by space - $array[$i] = explode(' ', $array[$i]); - // Get the key - $key = array_shift($array[$i]); - if (array_key_exists($key, $return)) { - // Element appears twice! - return false; - } - // Save the element - if ($multi) { - $return[$key] = $array[$i]; - } else if (count($array[$i]) > 1) { - return false; - } else { - $return[$key] = $array[$i][0]; - } - } - return $return; -} - -function question_rqp_print_serverinfo($serverinfo) { - $info->align = array('right', 'left'); - $info->data = array(); // will hold the data for the info table - $info->data[] = array('<b>'.get_string('url', 'quiz').':</b>',$serverinfo->url); - $info->data[] = array('<b>'.get_string('name').':</b>',$serverinfo->name); - $info->data[] = array('<b>'.get_string('serveridentifier', 'quiz').':</b>',$serverinfo->identifier); - $info->data[] = array('<b>'.get_string('description').':</b>',$serverinfo->description); - print_table($info); -} - -function question_rqp_debug_soap($item) { - global $CFG; - if (debugging()) { - echo 'Here is the dump of the soap fault:<pre>'; - var_dump($item); - echo '<pre>'; - } -} -?> diff --git a/question/type/rqp/questiontype.php b/question/type/rqp/questiontype.php deleted file mode 100644 index cc4a878acf4..00000000000 --- a/question/type/rqp/questiontype.php +++ /dev/null @@ -1,553 +0,0 @@ -<?php // $Id$ - -/** -* This file defines the RQP question type class -* -* @version $Id$ -* @author Alex Smith and other members of the Serving Mathematics project -* {@link http://maths.york.ac.uk/serving_maths} -* @license http://www.gnu.org/copyleft/gpl.html GNU Public License - * @package questionbank - * @subpackage questiontypes -*/ - -require_once($CFG->dirroot . '/question/type/rqp/lib.php'); -require_once($CFG->dirroot . '/question/type/rqp/remote.php'); - -/** -* RQP question type class -*/ -class question_rqp_qtype extends default_questiontype { - - function name() { - return 'rqp'; - } - - function menu_name() { - // Does not currently work, so don't include in the menu. - return false; - } - - /** - * Save the type-specific options - * - * This also saves additional information that it receives from - * an RQP_itemInformation call to the RQP server - */ - function save_question_options($form) { - global $CFG; - - // Check source type - if (!$type = get_record('question_rqp_types', 'id', $form->type)) { - $result->notice = get_string('invalidsourcetype', 'quiz'); - return $result; - } - - // Create the object to be stored in question_rqp table - $options = new object; - $options->question = $form->id; - $options->type = $form->type; - $options->type_name = $type->name; - $options->source = $form->source; - $options->format = isset($form->format) ? $form->format : ''; - - // Check source file - if (!$item = remote_item_info($options)) { - // We have not been able to obtain item information from any server - $result->notice = get_string('noconnection', 'quiz', $options); - return $result; - } - if (is_soap_fault($item)) { - $result->notice = get_string('invalidsource', 'quiz', $item); - question_rqp_debug_soap($item); - return $result; - } - if ($item->error) { - $result->notice = $item->error; - return $result; - } - if ($item->warning) { - $result->notice = $item->warning; - return $result; - } - // Time dependent items are not supported yet - if ($item->timeDependent) { - $result->noticeyesno = get_string('notimedependentitems', 'quiz'); - return $result; - } - - // Set the format and item specific flags - $options->format = $item->format; - $options->maxscore = $item->maxScore; - $options->flags = 0; - $options->flags |= $item->template ? REMOTE_TEMPLATE : 0; - $options->flags |= $item->adaptive ? REMOTE_ADAPTIVE : 0; - - // Save the options - if ($old = get_record('question_rqp', 'question', $form->id)) { - $old->type = $options->type; - $old->source = $options->source; - $old->format = $options->format; - $old->flags = $options->flags; - $old->maxscore = $options->maxscore; - if (!update_record('question_rqp', $old)) { - $result->error = "Could not update quiz rqp options! (id=$old->id)"; - return $result; - } - } else { - if (!insert_record('question_rqp', $options)) { - $result->error = 'Could not insert quiz rqp options!'; - return $result; - } - } - return true; - } - - /** - * Loads the question type specific options for the question. - * - * This function loads all question type specific options for the - * question from the database into the $question->options field. - * @return bool Indicates success or failure. - * @param object $question The question object for the question. - */ - function get_question_options(&$question) { - - $options =& $question->options; - if (! ($options = get_record('question_rqp', 'question', $question->id))) { - return false; - } - if (!$type = get_record('question_rqp_types', 'id', $options->type)) { - return false; - } - $options->type_name = $type->name; - return true; - } - - /** - * Deletes states from the question-type specific tables - * - * @param string $stateslist Comma separated list of state ids to be deleted - */ - function delete_states($stateslist) { - delete_records_select("question_rqp_states", "stateid IN ($stateslist)"); - return true; - } - - /** - * Deletes question from the question-type specific tables - * - * @return boolean Success/Failure - * @param object $question The question being deleted - */ - function delete_question($questionid) { - delete_records("question_rqp", "question", $questionid); - return true; - } - - /** - * Return a value or array of values which will give full marks if graded as - * the $state->responses field - * - * The correct answers are obtained from the RQP server via the - * RQP_SessionInformation operation - * @return mixed An array of values giving the responses corresponding - * to the (or a) correct answer to the question. - * @param object $question The question for which the correct answer is to - * be retrieved. - * @param object $state The state object that corresponds to the question, - * for which a correct answer is needed. - */ - function get_correct_responses(&$question, &$state) { - $info = remote_session_info($question, $state); - if (false === $info || is_soap_fault($info)) { - return null; - } - return $info->correctResponses; - } - - /** - * Creates empty session and response information for the question - * - * This function is called to start a question session. Empty question type - * specific session data and empty response data is added to the state object. - * @return bool Indicates success or failure. - * @param object $question The question for which the session is to be created. - * @param object $state The state to create the session for. This is passed by - * reference and will be updated. - * @param object $cmoptions (not used) - * @param object $attempt The attempt for which the session is to be - * started. (not used) - */ - function create_session_and_responses(&$question, &$state, $cmoptions, $attempt) { - $state->responses = array('' => ''); - $state->options->persistent_data = ''; - $state->options->template_vars = array(); - return true; - } - - /** - * Restores the session data and most recent responses for the given state - * - * This function loads any session data associated with the question session - * in the given state from the question_rqp_states table into the state object. - * @return bool Indicates success or failure. - * @param object $question The question object for the question including any - * question type specific information. - * @param object $state The saved state to load the session for. This - * object is updated to include the question - * type specific session information and responses - * (it is passed by reference). - */ - function restore_session_and_responses(&$question, &$state) { - if (!$options = get_record('question_rqp_states', 'stateid', $state->id)) { - return false; - } - $state->responses = question_rqp_explode($options->responses); - $state->options->persistent_data = $options->persistent_data; - $state->options->template_vars = - question_rqp_explode($options->template_vars, true); - return true; - } - - /** - * Saves the session data and responses for the question in a new state - * - * This function saves all session data from the state object into the - * question_rqp_states table - * @return bool Indicates success or failure. - * @param object $question The question object for the question including - * the question type specific information. - * @param object $state The state for which the question type specific - * data and responses should be saved. - */ - function save_session_and_responses(&$question, &$state) { - $options->stateid = $state->id; - $options->responses = question_rqp_implode($state->responses); - $options->persistent_data = $state->options->persistent_data; - $options->template_vars = - question_rqp_implode($state->options->template_vars); - if ($state->update) { - if (!$options->id = get_field('question_rqp_states', 'id', 'stateid', $state->id)) { - return false; - } - if (!update_record('question_rqp_states', $options)) { - return false; - } - } else { - if (!insert_record('question_rqp_states', $options)) { - return false; - } - } - return true; - } - - /** - * Prints the main content of the question including any interactions - * - * This function prints the main content of the question which it obtains - * from the RQP server via the Render operation. It also updates - * $state->options->persistent_data and $state->options->template_vars - * with the values returned by the RQP server. - * @param object $question The question to be rendered. - * @param object $state The state to render the question in. The grading - * information is in ->grade, ->raw_grade and - * ->penalty. The current responses are in - * ->responses. The last graded state is in - * ->last_graded (hence the most recently graded - * responses are in ->last_graded->responses). - * @param object $cmoptions - * @param object $options An object describing the rendering options. - */ - function print_question_formulation_and_controls(&$question, &$state, - $cmoptions, $options) { - - // Use the render output created during grading if it exists - if (isset($state->options->renderoutput)) { - $output =& $state->options->renderoutput; - } else { - // Otherwise perform a render operation - if (!$output = remote_render($question, $state, false, - $options->readonly ? 'readonly' : 'normal')) { - notify(get_string('noconnection', 'quiz')); - exit; - } - if (is_soap_fault($output)) { - notify(get_string('errorrendering', 'quiz')); - question_rqp_debug_soap($output); - unset($output); - exit; - } - } - $state->options->persistent_data = $output->persistentData; - $state->options->template_vars = $output->templateVars; - // Print the head (this may not work, really it should be in the head - // section of the html document but moodle doesn't allow question types - // to put things there) - if (isset($output->output[RQP_URI_COMPONENT . 'head'])) { - echo $output->output[RQP_URI_COMPONENT . 'head']->output; - } - // Print the title - if (isset($output->output[RQP_URI_COMPONENT . 'title'])) { - echo '<h2>' . $output->output[RQP_URI_COMPONENT . 'title']->output - . "</h2>\n"; - } - // Print the stem - if (isset($output->output[RQP_URI_COMPONENT . 'stem'])) { - echo '<div class="RQPstem">'; - echo $output->output[RQP_URI_COMPONENT . 'stem']->output; - echo '</div>'; - } - // Print the interactions - if (isset($output->output[RQP_URI_COMPONENT . 'interactions'])) { - echo '<div class="RQPinteractions" align="right">'; - echo $output->output[RQP_URI_COMPONENT . 'interactions']->output; - echo '</div>'; - } - // Print the last answer - if (isset($output->output[RQP_URI_COMPONENT . 'lastAnswer'])) { - echo '<div class="RQPlastAnswer">'; - echo $output->output[RQP_URI_COMPONENT . 'lastAnswer']->output; - echo '</div>'; - } - // Print the validation when required - if ($options->validation) { - if (isset($output->output[RQP_URI_COMPONENT . 'validation'])) { - echo '<div class="RQPvalidation">'; - echo $output->output[RQP_URI_COMPONENT . 'validation']->output; - echo '</div>'; - } - } - // Print the feedback when required - if ($options->feedback) { - if (isset($output->output[RQP_URI_COMPONENT . 'feedback'])) { - echo '<div class="RQPfeedback">'; - echo $output->output[RQP_URI_COMPONENT . 'feedback']->output; - echo '</div>'; - } - } - // Print the solution when required - if ($options->correct_responses) { - if (isset($output->output[RQP_URI_COMPONENT . 'solution'])) { - echo $output->output[RQP_URI_COMPONENT . 'solution']->output; - echo '</div>'; - } - } - // Note: hint(s) and modal feedback are ignored; moodle does not support - // them yet. - // Remove the render output created during grading (if any) - unset($state->options->renderoutput); - $this->print_question_submit_buttons($question, $state, $cmoptions, $options); - } - - /** - * Prints the submit and validate buttons - * @param object $question The question for which the buttons are to be printed - * @param object $state The state the question is in (not used) - * @param object $cmoptions - * @param object $options An object describing the rendering options. - * (not used. This function should only have been called - * if the options were such that the buttons are required) - */ - function print_question_submit_buttons(&$question, &$state, $cmoptions, $options) { - echo '<input type="submit" name="'; - echo $question->name_prefix; - echo 'validate" value="'; - print_string('validate', 'quiz'); - echo '" /> '; - if ($cmoptions->optionflags & QUESTION_ADAPTIVE) { - echo '<input type="submit" name="'; - echo $question->name_prefix; - echo 'submit" value="'; - print_string('mark', 'quiz'); - echo '" />'; - } - } - - /** - * Performs response processing and grading - * - * This function calls RQP_Render to perform response processing and grading - * and updates the state accordingly. It also caches the rendering output in case - * it is needed later. - * TODO: set $state->event appropriately - * @return boolean Indicates success or failure. - * @param object $question The question to be graded. - * @param object $state The state of the question to grade. The current - * responses are in ->responses. The last graded state - * is in ->last_graded (hence the most recently graded - * responses are in ->last_graded->responses). The - * question type specific information is also - * included. The ->raw_grade and ->penalty fields - * must be updated. The method is able to - * close the question session (preventing any further - * attempts at this question) by setting - * $state->event to QUESTION_EVENTCLOSE. - * @param object $cmoptions - */ - function grade_responses(&$question, &$state, $cmoptions) { - // Perform the grading and rendering - $output = remote_render($question, $state, QUESTION_EVENTGRADE == $state->event - || QUESTION_EVENTCLOSE == $state->event, 'normal'); - if (false === $output || is_soap_fault($output)) { - unset($output); - return false; - } - $state->options->persistent_data = $output->persistentData; - $state->options->template_vars = $output->templateVars; - // Save the rendering results for later - $state->options->renderoutput = $output; - if (isset($output->outcomeVars[RQP_URI_OUTCOME . 'rawScore'])) { - $state->raw_grade = (float) $output->outcomeVars[RQP_URI_OUTCOME . - 'rawScore'][0]; - if (isset($output->outcomeVars[RQP_URI_OUTCOME . 'penalty'])) { - $state->penalty = (float) $output->outcomeVars[RQP_URI_OUTCOME . - 'penalty'][0] * $question->maxgrade; - } else { - $state->penalty = 0; - } - } else if (isset($output->outcomeVars[RQP_URI_OUTCOME . 'grade'])) { - // This won't work quite as we would like but it is the best we can - // do given that the server won't tell us the information we need - $state->raw_grade = (float) $output->outcomeVars[RQP_URI_OUTCOME . - 'grade'][0]; - $state->penalty = 0; - } else { - $state->raw_grade = 0; - $state->penalty = 0; - } - $state->raw_grade = ($state->raw_grade * ((float) $question->maxgrade)) - / ((float) $question->options->maxscore); - return true; - } - - /** - * Includes configuration settings for the question type on the quiz admin - * page - * - * Returns an array of objects describing the options for the question type - * to be included on the quiz module admin page. - * This is currently only a link to the server setup page types.php - * @return array Array of objects describing the configuration options to - * be included on the quiz module admin page. - */ - function get_config_options() { - - // for the time being disable rqp unless we have php 5 - if(!check_php_version('5.0.0')) { - return false; - } - - $link->name = 'managetypes'; - $link->link = 'types.php'; - return array($link); - } - -/// BACKUP FUNCTIONS //////////////////////////// - - /* - * Backup the data in the question - * - * This is used in question/backuplib.php - */ - function backup($bf,$preferences,$question,$level=6) { - - $status = true; - - $rqps = get_records("question_rqp","question",$question,"id"); - //If there are rqps - if ($rqps) { - //Iterate over each rqp - foreach ($rqps as $rqp) { - $status = fwrite ($bf,start_tag("RQP",$level,true)); - //Print rqp contents - fwrite ($bf,full_tag("TYPE",$level+1,false,$rqp->type)); - fwrite ($bf,full_tag("SOURCE",$level+1,false,$rqp->source)); - fwrite ($bf,full_tag("FORMAT",$level+1,false,$rqp->format)); - fwrite ($bf,full_tag("FLAGS",$level+1,false,$rqp->flags)); - fwrite ($bf,full_tag("MAXSCORE",$level+1,false,$rqp->maxscore)); - $status = fwrite ($bf,end_tag("RQP",$level,true)); - } - } - return $status; - } - -/// RESTORE FUNCTIONS ///////////////// - - /* - * Restores the data in the question - * - * This is used in question/restorelib.php - */ - function restore($old_question_id,$new_question_id,$info,$restore) { - - $status = true; - - //Get the truefalse array - $rqps = $info['#']['RQP']; - - //Iterate over rqp - for($i = 0; $i < sizeof($rqps); $i++) { - $tru_info = $rqps[$i]; - - //Now, build the question_rqp record structure - $rqp->question = $new_question_id; - $rqp->type = backup_todb($tru_info['#']['TYPE']['0']['#']); - $rqp->source = backup_todb($tru_info['#']['SOURCE']['0']['#']); - $rqp->format = backup_todb($tru_info['#']['FORMAT']['0']['#']); - $rqp->flags = backup_todb($tru_info['#']['FLAGS']['0']['#']); - $rqp->maxscore = backup_todb($tru_info['#']['MAXSCORE']['0']['#']); - - //The structure is equal to the db, so insert the question_rqp - $newid = insert_record ("question_rqp",$rqp); - - //Do some output - if (($i+1) % 50 == 0) { - if (!defined('RESTORE_SILENTLY')) { - echo "."; - if (($i+1) % 1000 == 0) { - echo "<br />"; - } - } - backup_flush(300); - } - - if (!$newid) { - $status = false; - } - } - - return $status; - } - - - //This function restores the question_rqp_state - function restore_state($state_id,$info,$restore) { - - $status = true; - - //Get the question_rqp_state - $rqp_state = $info['#']['RQP_STATE']['0']; - if ($rqp_state) { - - //Now, build the RQP_STATES record structure - $state->stateid = $state_id; - $state->responses = backup_todb($rqp_state['#']['RESPONSES']['0']['#']); - $state->persistent_data = backup_todb($rqp_state['#']['PERSISTENT_DATA']['0']['#']); - $state->template_vars = backup_todb($rqp_state['#']['TEMPLATE_VARS']['0']['#']); - - //The structure is equal to the db, so insert the question_states - $newid = insert_record ("question_rqp_states",$state); - } - - return $status; - } - - -} -////////////////////////////////////////////////////////////////////////// -//// INITIATION - Without this line the question type is not in use... /// -////////////////////////////////////////////////////////////////////////// -question_register_questiontype(new question_rqp_qtype()); - -?> diff --git a/question/type/rqp/remote.php b/question/type/rqp/remote.php deleted file mode 100644 index 9b968df47ed..00000000000 --- a/question/type/rqp/remote.php +++ /dev/null @@ -1,163 +0,0 @@ -<?php // $Id$ -/** -* Remote question processing interface (using RQP) -* -* @version $Id$ -* @author Alex Smith and others members of the Serving Mathematics project -* {@link http://maths.york.ac.uk/serving_maths} -* @license http://www.gnu.org/copyleft/gpl.html GNU Public License -* @package questionbank -* @subpackage questiontypes -*/ - -// Load functions for the RQP-SOAP binding -require_once($CFG->dirroot . '/question/type/rqp/rqp.php'); - -// Remote item processing flags (cached from server) -define('REMOTE_TEMPLATE', 4); -define('REMOTE_ADAPTIVE', 8); - -// Global connection variable -global $remote_connections; -$remote_connections = array(); - - -/** -* Create connection to an RQP server of required type if it does not already exist -* -* If the global array $remote_connections does not already have an entry for this -* server type then it randomly goes through the existing servers and tries to connect -* using rqp_connect(). The connection is then added to the $remote_connections array. -* If the function fails to connect to any server it returns false. -* @param string $typeid The type of the RQP server -* @return boolean Indicates success or failure -* -* @todo flag dead servers -*/ -function remote_connect($typeid) { - global $remote_connections; - - if (!array_key_exists($typeid, $remote_connections)) { - // get the available servers - if (!$servers = get_records('question_rqp_servers', 'typeid', $typeid)) { - // we don't have a server for this question type - return false; - } - // put them in a random order - shuffle($servers); - // go through them and try to connect to each until we are successful - foreach ($servers as $server) { - if ($remote_connections[$typeid] = rqp_connect($server->url)) { - break; // we have a connection - } else { - // We have a dead server here, should somehow flag that - } - } - } - // check that we did get a connection - if (!$remote_connections[$typeid]) { - unset($remote_connections[$typeid]); - return false; - } - return true; -} - -/** -* Create connection to an RQP server and requests server information -* -* @param string $url The url of the RQP server -* @return object An object holding the results of the ServerInformation call -* plus the server url. Returns false in the case of failure -*/ -function remote_server_info($url) { - - if (!$connection = rqp_connect($url)) { - return false; - } - $return = rqp_server_info($connection); - if (is_soap_fault($return)) { - $return = false; - } - $return->url = $url; - return $return; -} - -/** -* Create connection to an RQP server and requests server information -* -* @param object $options The RQP question options as stored in the question_rqp table -* @return object An object holding the results of the ItemInformation call -* Returns false in the case of failure -*/ -function remote_item_info(&$options) { - global $remote_connections; - - if (!remote_connect($options->type)) { - return false; - } - - return rqp_item_info($remote_connections[$options->type], - $options->source, $options->format, 0); -} - -/** - * Perform a remote rendering operation on the RQP question - * - * @param object $question - * @param object $state - * @param boolean $advanceState - * @param string $output One of 'normal', 'readonly' or 'print'. - */ -function remote_render(&$question, &$state, $advanceState=false, $output='normal') { - global $remote_connections; - - // Make the code more readable - $options =& $question->options; - - // Add prefix to response variable names - $responses = array(); - foreach ($state->responses as $key => $resp) { - $responses[$question->name_prefix . $key] = $resp; - } - - // Prepare the render format - if ('print' === $output) { - $renderFormat = RQP_URI_FORMAT . 'latex-2e'; - } else if ('readonly' === $output) { - $renderFormat = RQP_URI_FORMAT . 'xhtml-1.0-print'; - } else { - $renderFormat = RQP_URI_FORMAT . 'xhtml-1.0-web'; - } - // Perform the RQP operation - if (!remote_connect($options->type)) { - return false; - } - return rqp_render($remote_connections[$options->type], - $options->source, $options->format, $state->options->persistent_data, - $question->name_prefix, $responses, $advanceState, - $renderFormat, $state->options->template_vars, 0); -} - -/** - * Perform a remote SessionInformation call - * - * @param object $question - * @param object $state - */ -function remote_session_info(&$question, &$state) { - global $remote_connections; - - // Make the code more readable - $options =& $question->options; - - // Perform the RQP operation - if (!remote_connect($options->type)) { - return false; - } - return rqp_session_info($remote_connections[$options->type], - $options->source, $options->format, $state->options->persistent_data, - $state->options->template_vars); -} - - -?> diff --git a/question/type/rqp/rqp.php b/question/type/rqp/rqp.php deleted file mode 100644 index d566122502a..00000000000 --- a/question/type/rqp/rqp.php +++ /dev/null @@ -1,236 +0,0 @@ -<?php // $Id$ -/** -* Library of functions binding RQP to SOAP -* -* @version $Id$ -* @author Alex Smith and others members of the Serving Mathematics project -* {@link http://maths.york.ac.uk/serving_maths} -* @license http://www.gnu.org/copyleft/gpl.html GNU Public License - * @package questionbank - * @subpackage questiontypes -*/ - -// Load the SOAP library that gives a unified wrapping to either the native -// PHP5 SOAP extension if available or to nuSOAP otherwise. -require_once($CFG->dirroot . '/lib/soaplib.php'); - -/** -* Base RQP URI for RQP-defined identifiers -* -* RQP defines standard URIs for common values of the parameters. Currently -* there is no RQP domain so we define a base URI here so that it can be -* changed later. -*/ -define('RQP_URI_BASE', 'http://rqp.org/'); - -/** -* RQP parameter URIs -* -* RQP defines standard URIs for common values of the parameters. These are -* defined in several categories under different directories under the base -* URI. -*/ -define('RQP_URI_ERROR', RQP_URI_BASE . 'errors/'); -define('RQP_URI_FORMAT', RQP_URI_BASE . 'formats/'); -define('RQP_URI_OUTCOME', RQP_URI_BASE . 'outcomes/'); -define('RQP_URI_COMPONENT', RQP_URI_BASE . 'components/'); - - -/** -* Start a SOAP connection -* -* @param string $server The URL of the RQP server that we want to connect to -* @return mixed Returns a SoapClient object if connection is successful -* or false in the case of a soap fault. -*/ -function rqp_connect($server) { - $connection = soap_connect($server . '?wsdl'); - if (is_soap_fault($connection)) { - return false; - } - return $connection; -} - -/** -* Get server information using the RQP_ServerInformation operation -* -* @param SoapClient $connection The URL of the RQP server that we want to connect to -* @return object Object holding the return parameters or a SoapFault. -*/ -function rqp_server_info($connection) { - return soap_call($connection, 'RQP_ServerInformation', array()); -} - -/** -* Get item information using the RQP_ItemInformation operation -* -* @param SoapClient $connection The URL of the RQP server that we want to connect to -* @param string $source Item source -* @param anyURI $format Item format -* @return object Object holding the return parameters or a SoapFault. -*/ -function rqp_item_info($connection, $source, $format='') { - $itemInfo = soap_call($connection, 'RQP_ItemInformation', - array('source'=>$source, 'format'=>$format)); - if (is_soap_fault($itemInfo)) { - return $itemInfo; - } - return $itemInfo; -} - -/** -* Process an item template to produce template variables using the RQP_ProcessTemplate operation -* -* @param SoapClient $connection The URL of the RQP server that we want to connect to -* @param string $source Item source -* @param anyURI $format Item format -* @param array $options Options array -* @return object Object holding the return parameters or a SoapFault. -*/ -function rqp_process_template($connection, $source, $format='', $options=array()) { - $return = soap_call($connection, 'RQP_ProcessTemplate', - array('source'=>$source, 'format'=>$format, 'options'=>$options)); - if (is_soap_fault($return)) { - return $return; - } - return $return; -} - -/** -* Clone an item template using the RQP_ProcessTemplate operation -* -* @param SoapClient $connection The URL of the RQP server that we want to connect to -* @param string $source Item source -* @param anyURI $format Item format -* @return object Object holding the return parameters or a SoapFault. -*/ -function rqp_clone($connection, $source, $format='') { - - $return = soap_call($connection, 'RQP_Clone', array('source'=>$source, - 'format'=>$format)); - if (is_soap_fault($return)) { - return $return; - } - return $return; -} - -/** -* Get runtime information about the item in the given state using the -* RQP_SessionInformation operation -* -* @param SoapClient $connection The URL of the RQP server that we want to connect to -* @param string $source Item source -* @param anyURI $format Item format -* @param array $options Options array -* @param string $persistentData String giving the state of the item session -* @return object Object holding the return parameters or a SoapFault. -*/ -function rqp_session_info($connection, $source, $format='', $options=array(), $persistentData='') { - // make an array of key-value pairs from the template variables array - array_walk($options, create_function('&$val, $key', - '$val = (object) array(\'identifier\'=>$key, \'values\'=>$val);')); - - $return = soap_call($connection, 'RQP_SessionInformation', - array('source'=>$source, 'format'=>$format, 'options'=>$options, - 'persistentData'=>$persistentData)); - if (is_soap_fault($return)) { - return $return; - } - $responses = array(); - if (!empty($return->correctResponses)) { - foreach ($return->correctResponses as $var) { - $responses[$var->name] = $var->value; - } - } - $return->correctResponses = $responses; - return $return; -} - -/** -* Process and render the item in the given state using the RQP_Render operation -* -* @param SoapClient $connection The URL of the RQP server that we want to connect to -* @param string $source Item source -* @param anyURI $format Item format -* @param array $options Options array -* @param string $persistentData String giving the state of the item session -* @param array $inputData Array of responses -* @param array $directives Array of directives -* @param array $mimetypes Array of mime types orederd by preference -* @param string $namePrefix -* @param anyURI $itemBase -* @param anyURI $resourceBase -* @param anyURI tempfileBase -* @return object Object holding the return parameters or a SoapFault. -*/ -function rqp_render($connection, $source, $format='', $options=array(), $persistentData='', - $inputData=array(), $directives=array(), $mimetypes=array(), $namePrefix='', - $itemBase='', $resourceBase='', $tempfileBase='') { - - // make an array of name-value pairs from the responses array - array_walk($responses, create_function('&$val, $key', - '$val = (object) array(\'name\'=>$key, \'value\'=>$val);')); - - $return = soap_call($connection, 'RQP_Render', array('source'=>$source, - 'format'=>$format, 'index'=>$index, 'templateVars'=>array_values($templateVars), - 'persistentData'=>$persistentData, 'responses'=>$responses, - 'advanceState'=>$advanceState, 'embedPrefix'=>$embedPrefix, - 'appletBase'=>$appletBase, 'mediaBase'=>$mediaBase, - 'renderFormat'=>$renderFormat, 'modalFormat'=>$modalFormat)); - if (is_soap_fault($return)) { - return $return; - } - $outcomeVars = array(); - if (!empty($return->outcomeVars)) { - foreach ($return->outcomeVars as $var) { - $outcomeVars[$var->identifier] = $var->values; - } - } - $return->outcomeVars = $outcomeVars; - - $templateVars = array(); - if (!empty($return->templateVars)) { - foreach ($return->templateVars as $var) { - $templateVars[$var->identifier] = $var->values; - } - } - $return->templateVars = $templateVars; - - $output = array(); - if (!empty($return->output)) { - foreach ($return->output as $out) { - $id = $out->identifier; - unset($out->identifier); - $output[$id] = $out; - } - } - $return->output = $output; - - return $return; -} - -/** -* Call to the RQP_Author operation -* -* @param SoapClient $connection The URL of the RQP server -* @param string $source Item source -* @param anyURI $format Item format -* @param string $persistentData String giving the state of the authoring session -* @param string $embedPrefix -* @param array $responses Teacher responses from the form elements -* @param anyURI $renderFormat -* @return object Object holding the return parameters or a SoapFault. -*/ -function rqp_author($connection, $source, $format='', $persistentData='', - $embedPrefix='', $responses=array(), $renderFormat='') { - - // make an array of name-value pairs from the responses array - array_walk($responses, create_function('&$val, $key', - '$val = (object) array(\'name\'=>$key, \'value\'=>$val);')); - - return soap_call($connection, 'RQP_Author', array('source'=>$source, - 'format'=>$format, 'persistentData'=>$persistentData, 'responses'=>$responses, - 'embedPrefix'=>$embedPrefix, 'renderFormat'=>$renderFormat)); -} - -?> diff --git a/question/type/rqp/types.php b/question/type/rqp/types.php deleted file mode 100644 index 2b6d157179c..00000000000 --- a/question/type/rqp/types.php +++ /dev/null @@ -1,172 +0,0 @@ -<?php - -// This page lists all the available RQP question types - - require_once('../../../config.php'); - require_once($CFG->libdir.'/tablelib.php'); - require_once($CFG->dirroot . '/question/type/rqp/lib.php'); - require_once($CFG->dirroot . '/question/type/rqp/remote.php'); - - $info = optional_param('info', 0, PARAM_INT); // id of server for which to show info - $delete = optional_param('delete', 0, PARAM_INT); // id of server to delete - $confirm = optional_param('confirm', false, PARAM_BOOL); // has the teacher confirmed the delete request? - - // Check user admin - require_login(); - require_capability('moodle/question:manage', get_context_instance(CONTEXT_SYSTEM, SITEID)); - - if (!$site = get_site()) { - error('Site isn\'t defined!'); - } - - // Print the header - $strmodulename = get_string('modulename', 'quiz'); - $stritemtypes = get_string('itemtypes', 'quiz'); - $navigation = '<a href="' . s($CFG->wwwroot) . '/' . s($CFG->admin) . '/index.php">' . get_string('admin') . '</a> -> ' . - '<a href="' . s($CFG->wwwroot) . '/' . s($CFG->admin) . '/configure.php">' . get_string('configuration') . '</a> -> ' . - '<a href="' . s($CFG->wwwroot) . '/' . s($CFG->admin) . '/modules.php">' . get_string('managemodules') . '</a> -> ' . - '<a href="' . s($CFG->wwwroot) . '/' . s($CFG->admin) . '/module.php?module=quiz&sesskey=' . sesskey() . '">' . - get_string('modulename', 'quiz') . '</a> -> ' . $stritemtypes; - print_header($site->shortname . ': ' . $strmodulename . ': ' . $stritemtypes, $site->fullname, $navigation, '', '', true, '', ''); - - $straddtypeurl = 'http://'; - $straddtypename = ''; - -/// Process submitted data - if ($form = data_submitted() and confirm_sesskey()) { - - while (isset($form->add)) { // using like if but with support for break - // check name was given - if (empty($form->name)) { - notify(get_string('missingitemtypename', 'quiz')); - break; - } - // check url was given - if (empty($form->url)) { - notify(get_string('missingitemtypeurl', 'quiz')); - break; - } - // Check server exists and works - if (!$serverinfo = remote_server_info($form->url)) { - notify(get_string('renderingserverconnectfailed', 'quiz', $form->url)); - break; - } - // add new type to database unless it exists already - if (!$type = get_record('question_rqp_types', 'name', $form->name)) { - $type->name = $form->name; - if (!$type->id = insert_record('question_rqp_types', $type)) { - error("Could not save type $type"); - } - } - // add new server to database unless it exists already - if (!$server = get_record('question_rqp_servers', 'url', $form->url)) { - $server->typeid = $type->id; - $server->url = $form->url; - $server->can_render = $serverinfo->rendering ? 1 : 0; - if (!insert_record('question_rqp_servers', $server)) { - error("Could not save server $form->url"); - } - } - // print info about new server - print_heading(get_string('serveradded', 'quiz')); - question_rqp_print_serverinfo($serverinfo); - - break; - - } - } - - if ($delete and confirm_sesskey()) { // delete server - if ($confirm) { - delete_records('question_rqp_servers', 'id', $delete); - } else { - if (!$server = get_record('question_rqp_servers', 'id', $delete)) { - error('Invalid server id'); - } - if ((count_records('question_rqp_servers', 'typeid', $server->typeid) == 1) // this is the last server of its type - and record_exists('question_rqp', 'type', $server->typeid)) { // and there are questions using it - $type = get_record('question_rqp_types', 'id', $server->typeid); - notify(get_string('serverinuse', 'quiz', $type->name)); - } - notice_yesno(get_string('confirmserverdelete', 'quiz', $server->url), 'types.php?delete='.$delete.'&sesskey='.sesskey().'&confirm=true', 'types.php'); - } - } - - if ($info) { // show info for server - if (!$server = get_record('question_rqp_servers', 'id', $info)) { - error('Invalid server id'); - } - // Check server exists and works - if (!$serverinfo = remote_server_info($server->url)) { - notify(get_string('renderingserverconnectfailed', 'quiz', $server->url)); - } else { - // print the info - print_heading(get_string('serverinfo', 'quiz')); - question_rqp_print_serverinfo($serverinfo); - } - } - - -/// Set up the table - - $table = new flexible_table('mod-quiz-questiontypes-rqp-types'); - - $table->define_columns(array('name', 'url', 'action')); - $table->define_headers(array(get_string('name'), get_string('serverurl', 'quiz'), get_string('action'))); - $table->define_baseurl($CFG->wwwroot.'/question/type/rqp/types.php'); - - //$table->sortable(true); - - $table->column_suppress('name'); - - $table->set_attribute('cellspacing', '15'); - $table->set_attribute('id', 'types'); - $table->set_attribute('class', 'generaltable generalbox'); - - // Start working -- this is necessary as soon as the niceties are over - $table->setup(); - -/// Create table rows - // Get list of types - $types = get_records('question_rqp_types', '', '', 'name ASC'); - - $strinfo = get_string('info'); - $strdelete = get_string('delete'); - $stradd = get_string('add'); - - if ($types) { - foreach ($types as $type) { - if (!$servers = get_records('question_rqp_servers', 'typeid', $type->id, 'id ASC')) { - delete_records('question_rqp_types', 'id', $type->id); - } else { - foreach ($servers as $server) { - $actions = '<a title="' . $strinfo . '" href="types.php?info='.$server->id.'&sesskey='.sesskey().'"><img src="'.$CFG->pixpath.'/i/info.gif" alt="'.$strinfo.'" align="absbottom" /></a> <a title="'.$strdelete.'" href="types.php?delete='.$server->id.'&sesskey='.sesskey().'"><img src="../../../../pix/t/delete.gif" alt="'.$strdelete.'" /></a>'; - $serverurl = ($info == $server->id) ? '<b>'.$server->url.'</b>' : $server->url; - $table->add_data(array($type->name, $serverurl, $actions)); - } - $table->add_data(array('','','')); - } - } - } - - // add input fields for adding new server - $typeinput = '<input type="text" size="15" maxlength="25" name="name" />'; - $urlinput = '<input type="text" size="50" maxlength="255" name="url" value="http://" />'; - $addbutton = '<input type="submit" value="'.get_string('add').'" name="add" />'; - $table->data[] = array($typeinput, $urlinput, $addbutton); - -/// Print the table - print_heading_with_help($stritemtypes, 'rqp', 'quiz'); - echo '<form action="types.php" method="post">'; - echo '<fieldset class="invisiblefieldset">'; - echo '<input type="hidden" name="sesskey" value="'.sesskey().'" />'; - echo '<div class="boxaligncenter">'; - $table->print_html(); - echo '</div>'; - echo '</fieldset>'; - echo '</form>'; - -/// Finish the page - print_footer(); - -?> diff --git a/question/type/rqp/version.php b/question/type/rqp/version.php deleted file mode 100644 index 2d2a8d9fa7f..00000000000 --- a/question/type/rqp/version.php +++ /dev/null @@ -1,6 +0,0 @@ -<?PHP // $Id$ - -$plugin->version = 2006032200; -$plugin->requires = 2006032200; - -?> diff --git a/question/type/shortanswer/db/mysql.sql b/question/type/shortanswer/db/mysql.sql deleted file mode 100644 index 5ce8966bcb7..00000000000 --- a/question/type/shortanswer/db/mysql.sql +++ /dev/null @@ -1,16 +0,0 @@ - - --- --- Table structure for table `prefix_question_shortanswer` --- - -CREATE TABLE prefix_question_shortanswer ( - id int(10) unsigned NOT NULL auto_increment, - question int(10) unsigned NOT NULL default '0', - answers varchar(255) NOT NULL default '', - usecase tinyint(2) NOT NULL default '0', - PRIMARY KEY (id), - KEY question (question) -) TYPE=MyISAM COMMENT='Options for short answer questions'; - --- -------------------------------------------------------- \ No newline at end of file diff --git a/question/type/shortanswer/db/postgres7.sql b/question/type/shortanswer/db/postgres7.sql deleted file mode 100644 index ff58a0b0f1a..00000000000 --- a/question/type/shortanswer/db/postgres7.sql +++ /dev/null @@ -1,14 +0,0 @@ - -# -------------------------------------------------------- - -# -# Table structure for table prefix_question_shortanswer -# - -CREATE TABLE prefix_question_shortanswer ( - id SERIAL PRIMARY KEY, - question integer NOT NULL default '0', - answers varchar(255) NOT NULL default '', - usecase integer NOT NULL default '0' -); -CREATE INDEX prefix_question_shortanswer_question_idx ON prefix_question_shortanswer (question); diff --git a/question/type/truefalse/db/mysql.sql b/question/type/truefalse/db/mysql.sql deleted file mode 100644 index 675df73f3bc..00000000000 --- a/question/type/truefalse/db/mysql.sql +++ /dev/null @@ -1,13 +0,0 @@ - --- --- Table structure for table `prefix_question_truefalse` --- - -CREATE TABLE prefix_question_truefalse ( - id int(10) unsigned NOT NULL auto_increment, - question int(10) unsigned NOT NULL default '0', - trueanswer int(10) unsigned NOT NULL default '0', - falseanswer int(10) unsigned NOT NULL default '0', - PRIMARY KEY (id), - KEY question (question) -) TYPE=MyISAM COMMENT='Options for True-False questions'; \ No newline at end of file diff --git a/question/type/truefalse/db/postgres7.sql b/question/type/truefalse/db/postgres7.sql deleted file mode 100644 index 07cb9eb5edd..00000000000 --- a/question/type/truefalse/db/postgres7.sql +++ /dev/null @@ -1,13 +0,0 @@ - -# -------------------------------------------------------- -# -# Table structure for table prefix_question_truefalse -# - -CREATE TABLE prefix_question_truefalse ( - id SERIAL PRIMARY KEY, - question integer NOT NULL default '0', - trueanswer integer NOT NULL default '0', - falseanswer integer NOT NULL default '0' -); -CREATE INDEX prefix_question_truefalse_question_idx ON prefix_question_truefalse (question); diff --git a/question/upgrade.php b/question/upgrade.php index ddf329c9675..12701a02e8c 100644 --- a/question/upgrade.php +++ b/question/upgrade.php @@ -32,4 +32,22 @@ function question_check_no_rqp_questions($result) { } return $result; } + +function question_remove_rqp_qtype() { + $result = true; + + $table = new XMLDBTable('question_rqp_states'); + $result = $result && drop_table($table); + + $table = new XMLDBTable('question_rqp'); + $result = $result && drop_table($table); + + $table = new XMLDBTable('question_rqp_types'); + $result = $result && drop_table($table); + + $table = new XMLDBTable('question_rqp_servers'); + $result = $result && drop_table($table); + + return $result; +} ?> diff --git a/theme/cornflower/styles_color.css b/theme/cornflower/styles_color.css deleted file mode 100644 index 1989e934a27..00000000000 --- a/theme/cornflower/styles_color.css +++ /dev/null @@ -1,787 +0,0 @@ -/******************************************************************* - styles_color.css - - This CSS file contains all color definitions like - background-color, font-color, border-color etc. - - Styles are organised into the following sections: - - core - header - footer - - admin - blocks - calendar - course - doc - login - message - tabs - user - - various modules - -*******************************************************************/ - -/*** - *** Core - ***/ - -a:link, -a:visited { - color:#4A677F; -} - -a.dimmed:link, -a.dimmed:visited { - color:#AAAAAA; -} - -a:hover { - color:#ffffff; - background-color: #4A677F; -} - -a.autolink:link, -a.autolink:visited { - color:#000000; - background: #DDDDDD; -} - -a.autolink.glossary:hover { - cursor: help; -} - -body { - background-color:#739FC4; - border-color:#F7F7F7; -} - -th.header, -td.header, -div.header { - background-color: #739FC4; -} - -.navbar { - background-color:#D0E2EE; - border-color:#D0E2EE; - -} - -table.formtable tbody th { - background: none; -} - -.highlight { - background-color:#AAFFAA; -} - -.highlight2 { - color:#AA0000; /* highlight missing terms in forum search */ -} - -/* Alternate rows even */ -.r0 { -} - -/* Alternate rows odd */ -.r1 { -} - -/* notification messages (can be good or bad) */ -.notifyproblem { - color:#660000; -} -.notifysuccess { - color:#006600; -} - -.required { - background-color:#DDDDDD; -} - -.generalbox { - border-color:#739FC4; -} -.informationbox { - border-color:#739FC4; -} -.feedbackbox { - border-color: #739FC4; -} -.feedbackby { - background-color:#BBBBBB; -} - -.noticebox { - border-color:#739FC4; -} - -.errorbox { - color:#ffffff; - border-color:#739FC4; - background-color:#990000; -} - -.tabledivider { - border-color:#739FC4; -} - -.sitetopic { -} - -.sitetopiccontent { - border-color:#739FC4; - background-color:#FFFFFF; -} - -.dimmed_text { - color:#AAAAAA; -} - -.teacheronly { - color:#990000; -} - -.unread { - background: #78A2CD; -} - -.censoredtext { - color:#000000; - background:#000000; -} - - -/* kept for backward compatibility with some non-standard modules - which use these classes for various things */ -.generaltab, .generaltabinactive { - background-color:#BBBBBB; -} -.generaltabselected { - background-color:#DDDDDD; -} -.generaltabinactive { - color:#CCCCCC; -} - - - -/*** - *** Header - ***/ - -/*** - *** Footer - ***/ - -.homelink a:link, -.homelink a:visited, -.homelink a:hover { - background-color: #739FC4; - color: #000; - text-decoration: none; -} -.homelink a:link, -.homelink a:visited { - border-top: 1px solid #cecece; - border-bottom: 2px solid #4a4a4a; - border-left: 1px solid #cecece; - border-right: 2px solid #4a4a4a; -} -.homelink a:hover { - border-bottom: 1px solid #cecece; - border-top: 2px solid #4a4a4a; - border-right: 1px solid #cecece; - border-left: 2px solid #4a4a4a; -} - - -/*** - *** Admin - ***/ - -.admin .generalboxcontent { - background-color:#EEEEEE; -} - -.admin .generalbox { - border-color:#739FC4; -} - -.admin .informationbox { - border-color:#739FC4; - background-color:#FFFFFF; -} - -body#admin-index .c0 { - background-color: #FAFAFA; -} - - - -/*** - *** Blocks - ***/ - -.sideblock { - border-top: 1px solid #739FC4; - border-right: 1px solid #4A677F; - border-bottom: 2px groove #4A677F; - border-left: 1px solid #4A677F; -} - - - -.sideblock .header { - background-color: #739FC4; - border-bottom: 2px groove #739FC4; -} - -.sideblock .content { - background-color:#FFFFFF; -} - -.sideblock .content hr { -} - -.sideblock .list { -} -.sideblock .header .hide-show img.hide-show-image { - background: url('../../pix/t/switch_minus.gif') no-repeat bottom; -} - -.sideblock.hidden .header .hide-show img.hide-show-image { - background: url('../../pix/t/switch_plus.gif') no-repeat bottom; -} - - - -/*** - *** Calendar - ***/ - -#calendar .maincalendar, -#calendar .sidecalendar { - border-color: #739FC4; -} - -#calendar .maincalendar table.calendarmonth th { - border-color: #000000; -} - -table.minicalendar { - border-color:#739FC4; -} - -#calendar .maincalendar .eventlist .event { - border-color:#739FC4; -} - -#calendar .maincalendar .eventlist .event .topic, -#calendar .maincalendar .eventlist .event .picture, -#calendar .maincalendar .eventlist .event .side { - background-color:#FFFFFF; -} - -#calendar .maincalendar table.calendarmonth ul.events-underway { - color:#739FC4; -} - -#calendar .event_global, -.minicalendar .event_global, -.block_calendar_month .event_global { - border-color:#2EBA0E !important; - background-color:#2EBA0E; -} - -#calendar .event_course, -.minicalendar .event_course, -.block_calendar_month .event_course { - border-color:#FF9966 !important; - background-color:#FF9966; -} - -#calendar .event_group, -.minicalendar .event_group, -.block_calendar_month .event_group { - border-color:#FBBB23 !important; - background-color:#FBBB23; -} - -#calendar .event_user, -.minicalendar .event_user, -.block_calendar_month .event_user { - border-color:#A1BECB !important; - background-color:#A1BECB; -} - -#calendar .duration_global, -.minicalendar .duration_global { - border-top-color:#2EBA0E !important; - border-bottom-color:#2EBA0E !important; -} - -#calendar .duration_course, -.minicalendar .duration_course { - border-top-color:#FF9966 !important; - border-bottom-color:#FF9966 !important; -} - -#calendar .duration_group, -.minicalendar .duration_group { - border-top-color:#FBBB23 !important; - border-bottom-color:#FBBB23 !important; -} - -#calendar .duration_user, -.minicalendar .duration_user { - border-top-color:#A1BECB !important; - border-bottom-color:#A1BECB !important; -} - -#calendar .weekend, -.minicalendar .weekend { - color:#FF0000; -} - -#calendar .today, -.minicalendar .today { - border-color:#000000 !important; -} - -.cal_popup_fg { - background-color:#FFFFFF; -} - -.cal_popup_bg { - border-color:#000000; - background-color:#FFFFFF; -} - -#calendar .maincalendar .filters table, -#calendar .sidecalendar .filters table, -.block_calendar_month .filters table { - background-color: #FFFFFF; -} - - - -/*** - *** Course - ***/ - -/* course, entry-page, login */ -.headingblock { - border-top: 1px solid #739FC4; - border-right: 1px solid #4A677F; - border-bottom: 2px groove #4A677F; - border-left: 1px solid #4A677F; -} - -/* course */ -.headingblock .outline { - border-color:#739FC4; -} - - -#course-view .section td { - border-color:#739FC4; -} - -#course-view .section .content { - background-color:#FFFFFF; -} - -#course-view .section .side { - background: #739FC4; -} - -#course-view .section .left { - background: #739FC4; -} - -#course-view .section .right { - -} - -#course-view .current .side{ - background: #A2BED8; -} - -#course-view .topics { -} - -#course-view .weeks { -} - -#course-view .section .spacer { -} - -#course-view .section .weekdates { - color:#4A677F; -} - -.categoryboxcontent, -.courseboxcontent { - border-top: 1px solid #739FC4; - border-right: 1px solid #4A677F; - border-bottom: 2px groove #4A677F; - border-left: 1px solid #4A677F; - background: #FFFFFF; -} -body#course-user .section { - border-color:#AAAAAA; -} - - - -/*** - *** Doc - ***/ - -/*** - *** Login - ***/ - -.loginbox, -.loginbox.twocolumns .loginpanel, -.loginbox .subcontent { - border-color:#739FC4; -} - - -/*** - *** Message - ***/ - -table.message_search_results td { - border-color:#739FC4; -} - -.message .author { - color: #739FC4; -} - -.message .time { - color: #739FC4; -} - -.message .content { -} - - -/*** - *** Tabs - ***/ - -.tablink a:link, -.tablink a:visited { - color:#4A677F; -} - -.tablink a:hover{ - background-color:#4A677F; - color:#FFFFFF; -} - -.selected .tablink a:link, -.selected .tablink a:visited { - color:#4A677F; -} - -.selected .tablink a:hover { - color:#FFFFFF; - background-color:#4A677F; -} - -.tabs .side { - border-color: #AAAAAA; -} -.tabrow td { - background:url(pix/tab/left.gif) top left no-repeat; -} -.tabrow td .tablink { - background:url(pix/tab/right.gif) top right no-repeat; -} -.tabrow td:hover { - background-image:url(pix/tab/left_hover.gif); -} -.tabrow td:hover .tablink { - background-image:url(pix/tab/right_hover.gif); -} -.tabrow .last span { - background:url(pix/tab/right_end.gif) top right no-repeat; -} -.tabrow .selected { - background:url(pix/tab/left_active.gif) top left no-repeat; -} -.tabrow .selected .tablink { - background:url(pix/tab/right_active.gif) top right no-repeat; -} -.tabrow td.selected:hover { - background-image:url(pix/tab/left_active_hover.gif); -} -.tabrow td.selected:hover .tablink { - background-image:url(pix/tab/right_active_hover.gif); -} - - -/*** - *** User - ***/ - -.userpicture { - background:#EEEEEE; -} - -.userinfobox { - border-color: #739FC4; - background-color: #F7F7F7; -} -.groupinfobox { - border-color: #739FC4; - background-color: #FCFCFC; -} - - -/*** - *** Modules: Assignment - ***/ - -.assignmentsubmission { -} - -.assignmentnew .assignmentfeedback{ - background-color:#DDDDDD; -} - -.assignmentold .assignmentfeedback{ - background-color:#BBBBBB; -} - -.assignmentheading { - background-color:#BBBBBB; -} - - -/*** - *** Modules: Chat - ***/ - -/*** - *** Modules: Choice - ***/ - -/*** - *** Modules: Forum - ***/ - -.forumheaderlist, -.forumpost { - border-color:#1D5083; -} - -.forumpost .content { - background: #FFFFFF; -} - -.forumpost .left { - background:#739FC4; -} - -.forumpost .topic { - border-bottom-color: #739FC4; - background:#D0E2EE; - -} - -.forumpost .starter { - background:#739FC4; -} - -.forumheaderlist .discussion .starter { - background:#D0E2EE; -} - -.forumheaderlist td { - border-color: #739FC4; -} - -.sideblock .post .head { - color:#555555; -} - -.forumthread .unread { - background: #78A2CD; -} -#mod-forum-discuss .forumpost { - background: none; -} - -#mod-forum-discuss .unread .forumpost .message { - border-color: #78A2CD; -} -#mod-forum-discuss .forumthread .unread { -} - -#mod-forum-index .unread { -} - - -/*** - *** Modules: Glossary - ***/ - -.entryboxheader { - border-color: #BBBBBB; -} - -.entrybox { - border-color: #BBBBBB; -} - -.entry { -} - -.glossarypost { - border-color: #739FC4; -} - -.glossarypost .entryheader, -.glossarypost .entryapproval, -.glossarypost .picture, -.glossarypost .entryattachment, -.glossarypost .left { - background-color: #F0F0F0; -} - -.glossarycomment { - border-color: #739FC4; -} - -.glossarycomment .entryheader, -.glossarycomment .picture, -.glossarycomment .left { - background-color: #F0F0F0; - -} - -#mod-glossary-report .generalbox .teacher { - background: #F0F0F0; -} - -.glosarycategoryheader { - background-color: #739FC4; -} - -.glossaryformatheader { - background-color: #739FC4; -} - - -/*** - *** Modules: Journal - ***/ - -#mod-journal-view .feedbackbox .left, -#mod-journal-view .feedbackbox .entryheader { - background-color: #739FC4; -} - -/*** - *** Modules: Label - ***/ - -/*** - *** Modules: Lesson - ***/ - -/*** - *** Modules: Quiz - ***/ - -body#mod-quiz-report table#attempts td { - border-color: #739FC4; -} -body#mod-quiz-report table#attempts .r1 { - background-color: #eeeeee; -} - - -/*** - *** Modules: Resource - ***/ - -/*** - *** Modules: Scorm - ***/ - -/*** - *** Modules: Survey - ***/ - -#mod-survey-view .r0 { - background-color: #EEEEEE; -} -#mod-survey-view .r1 { - background-color: #DDDDDD; -} - - -/*** - *** Modules: Wiki - ***/ - -/*** - *** Modules: Workshop - ***/ - -.workshoppostpicture { - background-color:#FEE6B9; -} - -.workshopassessmentheading { - background-color:#DDDDDD; -} - -.headermenu a:link { - text-decoration: none; - color: #ffffff; -} -.headermenu a:visited { - text-decoration: none; - color: #ffffff; -} -.headermenu a:hover { - text-decoration: underline; - color: #ffffff; -} - -.headerhomemain { - font-size: x-large; - font-weight: bold; -} - -.headerhomemenu a:link { - text-decoration: none; - color: #ffffff; -} -.headerhomemenu a:visited { - text-decoration: none; - color: #ffffff; -} -.headerhomemenu a:hover { - text-decoration: underline; - color: #ffffff; -} - -.cornflowersurround { - background: #D0E2EE; -} - -#header-home { - background: #739FC4; -} diff --git a/theme/cornflower/styles_fonts.css b/theme/cornflower/styles_fonts.css deleted file mode 100644 index d2d79978966..00000000000 --- a/theme/cornflower/styles_fonts.css +++ /dev/null @@ -1,500 +0,0 @@ -/******************************************************************* - styles_color.css - - This CSS file contains all font definitions like family, size, - weight, text-align, letter-spacing etc. - - Styles are organised into the following sections: - core - header - footer - - admin - blocks - calendar - course - doc - login - message - tabs - user - - various modules - -*******************************************************************/ - - -/*** - *** Core - ***/ - -.clearer { - font-size:1px; -} - -body, td, th, li { - font-family:"Trebuchet MS", Verdana, Arial, Helvetica, sans-serif; - font-size:0.95em; -} - -th { - font-weight: bold; -} - -a:link, -a:visited { - text-decoration:none; -} - -a:hover { - text-decoration: underline; -} - -h1.main, -h2.main, -h3.main, -h4.main, -h5.main, -h6.main { - font-weight:bold; -} - -h1 { - font-size:1.7em; -} - -h2 { - font-size:1.4em; -} -h3 { - font-size:1.1em; -} -h4 { - font-size:1.0em; -} - -.bold { - font-weight:bold; -} - -.warning { - font-weight: bold; - font-style: italic; -} - -.errorbox .title { - font-weight: bold; - font-size: 1.2em; - text-align: center; -} - -.pagingbar .title { - font-weight: bold; -} -.pagingbar .thispage { - font-weight: bold; -} - -.categorybox .category { - font-size:1.2em; - font-weight:bold; -} - -.helplink { - font-size:0.8em; -} - -.headingblock { - font-weight: normal; -} - -.headingblock .header .title { -font-weight:normal; - float: left; -} - -.headingblock .link { - font-size: 0.9em; -} - -.files .file { - font-size: 0.9em; -} - -.files .folder { - font-size: 0.9em; -} - -.files .folder .size { - font-weight: bold; -} - - -/*** - *** Header - ***/ - -.headermain { - font-weight:bold; -} - -#header-home .headermain { - font-size:1.5em; -} - -#header .headermain { - font-size:1.3em; -} - -.breadcrumb { - font-size:0.9em; - font-weight:bold; -} - -.logininfo, -#header-home .headermenu font { - font-size:x-small; -} - - -/*** - *** Footer - ***/ - -.homelink { -} - - - -/*** - *** Admin - ***/ - -table.formtable tbody th { - font-weight: normal; - text-align: right; -} - - -/*** - *** Blocks - ***/ - -.sideblock .content h3, -.sideblock .content h2 { - font-size:1.0em; -} -.sideblock .header .commands { - font-size: 0.75em; -} - -.sideblock .header .title { -font-weight:normal; -} - -.sideblock .footer { - font-size:0.75em; -} - -.sideblock .head, -.sideblock .info { - font-size: 0.85em; -} - -.sideblock .date { - font-style: italic; -} - - - -/*** - *** Calendar - ***/ - -#calendar .maincalendar .eventlist .event .referer { - font-weight:bold; -} - -#calendar .maincalendar .eventlist .event .course { - font-size:0.8em; -} - -#calendar .maincalendar .eventlist .event .description .commands { - text-align: right; -} - -#calendar .maincalendar table.calendarmonth td { - font-size:0.8em; -} - -#calendar div.header -{ - font-weight:bold; -} - -#calendar .sidecalendar .filters { - font-size:0.75em; -} - -#calendar .maincalendar .controls { - font-size:1.2em; -} - -#calendar .maincalendar .day { - font-weight: bold; -} - -table.minicalendar { - font-size:0.85em; -} - -.cal_popup_caption { - font-family:sans-serif; - font-size:0.8em; - font-weight:bold; -} - -.cal_popup_close { - font-family:sans-serif; - font-size:0.8em; - font-weight:bold; -} -#calendar .maincalendar .calendar-controls .current { - font-weight: bold; -} - - -/*** - *** Course - ***/ - -.activitydate, .activityhead { - font-size:0.7em; -} - -.weeklydatetext { - font-size:0.9em; - font-weight:bold; -} - -.coursebox .info { - font-size:1em; -} - -.coursebox .teachers, -.coursebox .cost { - font-size:0.8em; -} - -.coursebox .summary { - font-size:0.7em; -} - - -#course-view .section .left { - font-weight:bold; -} - - - -/*** - *** Doc - ***/ -body#doc-contents h1 { - font-size: 1em; -} -body#doc-contents ul { - font-size: 0.8em; -} - - - -/*** - *** Login - ***/ - - -/*** - *** Message - ***/ - -.message_summary_link { - font-size:small; -} - -.message_link { - font-size:x-small; -} - -.message_form { - font-size:0.78em; -} - -.message_heading { - font-size:medium; - font-weight:bold; -} - -.message_date, -.message_contact, -.message_summary { - font-size:small; -} - -.message_small_note, -.message_pix { - font-size:x-small; -} - -.message .author { - font-weight: bold; -} - -.message .time { - font-style: italic; -} - -.message .content { -} - - -/*** - *** Tabs - ***/ -.tablink a:hover { - text-decoration: none; -} - - -/*** - *** User - ***/ - -.userinfobox .username { - font-weight: bold; -} - -.userinfobox .links { - font-size: 0.7em; -} - - -/*** - *** Modules: Assignment - ***/ - -/*** - *** Modules: Chat - ***/ - -/*** - *** Modules: Choice - ***/ - -/*** - *** Modules: Forum - ***/ - -.forumnodiscuss{ - font-weight:bold; -} -.forumpost .topic .subject { - font-weight: bold; -} -.forumpost .topic .author { - font-size: 0.8em; -} -.forumheaderlist .discussion .lastpost { - font-size: 0.7em; -} -body#mod-forum-search .introcontent { - font-weight:bold; -} - - - -/*** - *** Modules: Glossary - ***/ - -.glossarypost .commands { - font-size: 0.7em; -} -.glossarypost .entryheader .author { - font-size: 0.7em; - font-style: italic; -} -.concept { - font-weight: bold; -} -.glossarycomment .time { - font-size: 0.7em; - font-style: italic; -} -.entrylowersection .aliases { - font-size: 0.8em; -} -.entrylowersection .icons, -.entrylowersection .ratings { - font-size: 0.8em; -} - - - -/*** - *** Modules: Journal - ***/ -#mod-journal-view .lastedit, -#mod-journal-view .editend { - font-size: 0.7em; -} -#mod-journal-view .author { - font-size: 1em; - font-weight: bold; -} -#mod-journal-view .time { - font-size: 0.7em; - font-style: italic; -} -#mod-journal-view .grade { - font-weight: bold; - font-style: italic; -} - -/*** - *** Modules: Label - ***/ - -/*** - *** Modules: Lesson - ***/ - -/*** - *** Modules: Quiz - ***/ - -.editorhelptext { - font-size:x-small; -} - - -/*** - *** Modules: Resource - ***/ - -/*** - *** Modules: Scorm - ***/ - -/*** - *** Modules: Survey - ***/ - -/*** - *** Modules: Wiki - ***/ - -/*** - *** Modules: Workshop - ***/ - diff --git a/theme/cornflower/styles_layout.css b/theme/cornflower/styles_layout.css deleted file mode 100644 index 309b5ef79fe..00000000000 --- a/theme/cornflower/styles_layout.css +++ /dev/null @@ -1,1252 +0,0 @@ -/******************************************************************* - styles_layout.css - - This CSS file contains all layout definitions like positioning, - floats, margins, padding, borders etc. - - Styles are organised into the following sections: - core - header - footer - - admin - blocks - calendar - course - doc - login - message - tabs - user - - various modules - -*******************************************************************/ - - -/*** - *** Core - ***/ - -h1.main, -h2.main, -h3.main, -h4.main, -h5.main, -h6.main { - text-align: center; -} - -#layout-table { - width:100%; - border-collapse:separate; - margin-top: 8px; -} - -#layout-table #left-column, -#layout-table #middle-column, -#layout-table #right-column -{ - vertical-align:top; -} - -#layout-table #middle-column { - padding-left:12px; - padding-right:12px; -} - -#layout-table #left-column { - padding-left:10px; -} - -#layout-table #right-column { - padding-right:10px; -} - -.clearer { - clear:both; - margin:0px; - padding:0px; - height:1px; - border:none; - background:transparent; -} - -.continuebutton { - text-align: center; -} - -form { - margin-bottom:0px; -} - -table { - border-spacing: 0px; - border-collapse: collapse; -} - -a img { - border:none; -} -.notifyproblem { - text-align: center; - padding: 10px; -} - -.notifysuccess { - text-align:center; - padding: 10px; -} - -.generalbox { - border-width:1px; - border-style:solid; -} - -.generalbox#intro { - text-align:center; -} - -.noticebox { - border-width:1px; - border-style:solid; -} -.errorbox { - border-width:1px; - border-style:solid; - margin: 1em 15%; - width: 70%; -} -.errorbox .title { - padding: 5px; -} -.informationbox { - border-width:1px; - border-style:solid; -} -.feedbackbox { - border-width:1px; - border-style:solid; -} -.feedbackby { -} -.feedback { -} -.initialbar { - text-align: center; -} - -#help .indent { - margin-left:3em; -} - -.tabledivider { - border-width:1px; - border-style:solid; - border-left:0px; - border-right:0px; - border-top:0px; -} - -.sitetopic { - margin-bottom:20px; -} - -.sitetopiccontent { - border-width:1px; - border-style:solid; -} - -.pagingbar { - text-align:center; -} -.pagingbar a { - padding-left: 10px; -} -.pagingbar .thispage { - padding-left: 10px; -} - -table.formtable { - margin: auto; -} - -table.formtable tbody th { - vertical-align: top; -} - -table.formtable tbody td, -table.formtable tbody th -{ - padding: 5px; -} - -.paging { - text-align: center; - margin: 10px 0px 10px 0px; -} - -.unread { - padding-right:2px; -} - -.cell { - vertical-align: top; -} - - -/*** - *** Header - ***/ - -#header-home { - padding:1em 0.5em; - height:2em; -} - -#header { - padding:0.1em 0.5em; -} - -.headermain { - float:left; -} - -#header .headermain { - margin:0.2em 0em; -} - -.headermenu { - float:right; - text-align:right; -} - -.navbar { - padding:3px 0.5em; - height:1.3em; - -} - -.navbar .breadcrumb { - float:left; - margin:0.2em 0em; -} - -.navbar .navbutton, -.navbar .menu { - float:right; -} - -#footer .navbar { - margin-top: 4em; -} - - -/*** - *** Footer - ***/ - -#footer { - text-align:center; -} - -.homelink { - margin: 1em 0; -} - -.homelink a { - padding-left:1em; - padding-right:1em; -} - - - -/*** - *** Admin - ***/ - -body#admin-index .c0 { - vertical-align: top; -} - -body#admin-modules table.generaltable td.cell, -body#admin-modules .generaltablecell { - padding-top: 2px; - padding-bottom: 2px; -} - -body#admin-blocks table.generaltable td.cell, -body#admin-blocks .generaltablecell { - padding-top: 1px; - padding-bottom: 1px; -} - -body#admin-config .confighelp { - display: block; - padding-bottom: 20px; -} - - -/*** - *** Blocks - ***/ - -.sideblock .content h3, -.sideblock .content h2 { - text-align: left; -} - -.sideblock { - width: 100%; - margin-bottom:1em; -} - -.sideblock .header { - background-image:url(images/sideblock.jpg); - text-align: left; - padding:4px; -} - -.sideblock .header .hide-show { - -} - -.sideblock .header .hide-show img.hide-show-image { - height:11px; - width:11px; - margin-top:0.25em; -} - -.sideblock .header .commands { - float: right; - margin-top: 0.3em; -} - -.sideblock .header .title { - -} - -.sideblock .header .commands a { - margin: 0px 2px; -} - -.sideblock .content { - padding:4px; -} - -.sideblock .content hr { - height:1px; - margin-top:4px; - margin-bottom:4px; - border:none; - border-top:1px solid; -} -.sideblock.hidden .content { - display: none; -} - -.sideblock .list { - width: 100%; -} - -.sideblock .list .c0{ - padding: 2px; -} - -.sideblock .footer { - margin-top:4px; - text-align:center; -} -.sideblock .header .icon.hide, -.sideblock .header .icon.edit { - margin-right: 6px; -} - -.sideblock .head { - margin-top: 5px; -} - - - - -/*** - *** Calendar - ***/ - -#calendar { - width: 100%; - border-spacing: 5px; - border-collapse: separate; -} - -#calendar .maincalendar, -#calendar .sidecalendar -{ - vertical-align: top; - border: 1px solid; -} - -#calendar .sidecalendar { - width: 25%; -} - -#calendar .maincalendar table.calendarmonth { - border-collapse: separate; - margin: 0px auto; - width: 98%; -} - -#calendar .maincalendar table.calendarmonth th { - padding:10px; - border-bottom:2px solid; -} - -#calendar .maincalendar table.calendarmonth td { - height: 5em; - padding-left: 4px; - padding-top: 4px; - line-height:1.2em; -} - -#calendar .maincalendar table.calendarmonth td, -table.minicalendar td, -table.minicalendar th { - width:14%; - vertical-align:top; -} -table.minicalendar td { - text-align: center; -} -#calendar .maincalendar table.calendarmonth td table td { - height: auto; -} - -#calendar div.header -{ - padding: 5px; -} - -#calendar .maincalendar .buttons { - float: right; -} - -#calendar .maincalendar .filters table, -#calendar .sidecalendar .filters table -{ - border-collapse:separate; - border-spacing: 2px; - padding: 2px; - width: 100%; -} - -#calendar .maincalendar .filters { - padding: 0px 10px; -} - -#calendar .sidecalendar .filters { - padding: 5px; -} - -#calendar .maincalendar .controls { - clear:both; - padding:10px; -} - -#calendar .maincalendar table.calendarmonth ul.events-new, -#calendar .maincalendar table.calendarmonth ul.events-underway -{ - padding:0px; - margin:0px; - list-style-type:none; -} - -#calendar .maincalendar table.calendarmonth ul li { - margin-top: 4px; -} - -table.minicalendar { - width: 100%; - margin:10px auto; - padding:2px; - border-width:1px; - border-style:solid; - border-collapse:separate; - border-spacing:1px !important; -} - -table.minicalendar th { - padding: 0px 2px; -} - -#calendar .maincalendar .eventlist { - padding: 10px; -} - -#calendar .maincalendar .eventlist .topic { - padding: 5px; - border-style:solid; - border-width: 0px; - border-bottom-color: #EEEEEE; - border-bottom-width: 1px; -} - -#calendar .maincalendar .eventlist .event { - width:100%; - margin-bottom:10px; - border-spacing:0px; - border-collapse:separate; - border-width:1px; - border-style:solid; -} - -#calendar .maincalendar .eventlist .event .name { - float:left; -} - -#calendar .maincalendar .eventlist .event .course { - float:left; - clear:left; -} - -#calendar .maincalendar .eventlist .event .date { - float:right; -} - -#calendar .maincalendar .eventlist .event .description .commands { - width:100%; -} - -#calendar .maincalendar .eventlist .event .description { - padding:5px; -} - -#calendar .maincalendar .eventlist .event .picture { - padding:8px; -} - -#calendar .maincalendar .eventlist .event .side { - width:32px; -} - -#calendar #selecteventtype table { - margin:auto; -} - -#calendar .event_global, -#calendar .event_course, -#calendar .event_group, -#calendar .event_user, -.minicalendar .event_global, -.minicalendar .event_course, -.minicalendar .event_group, -.minicalendar .event_user { - border:2px solid !important; -} - -#calendar .duration_global, -#calendar .duration_course, -#calendar .duration_group, -#calendar .duration_user, -.minicalendar .duration_global, -.minicalendar .duration_course, -.minicalendar .duration_group, -.minicalendar .duration_user -{ - border-top:2px solid !important; - border-bottom:2px solid !important; -} - -#calendar .today, -.minicalendar .today { - border:2px solid !important; -} - -.cal_popup_bg { - padding:0px; - margin:0px; - border:1px solid; -} - -.cal_popup_close { - margin-right:5px; -} - -.cal_popup_caption { - border-width:0px 0px 1px 0px; - border-style:solid; - padding-bottom:2px; -} - -table.calendar-controls { - width: 100%; -} - -table.calendar-controls .previous, -table.calendar-controls .next -{ - width: 12%; -} -table.calendar-controls .previous { - text-align: left; -} -table.calendar-controls .current { - text-align: center; -} -table.calendar-controls .next { - text-align: right; -} - -#calendar .maincalendar .calendar-controls .previous, -#calendar .maincalendar .calendar-controls .next -{ - width: 30%; -} - - -/*** - *** Course - ***/ -.activitydate, .activityhead { - text-align:center; -} - -#course-view .section td { - vertical-align:top; -} - -#course-view .section .content { - padding:5px; - border-style:solid; - border-width:1px; - border-left:0px; - border-right:0px; -} - -#course-view .section .side { - padding:5px; - border-style:solid; - border-width:1px; -} - -#course-view .section .left { - border-right:0px; - text-align:center; - width: 1.5em; -} - -#course-view .section .right { - border-left:0px; - text-align:center; - width: 1.5em; -} - -#course-view .current .side { -} - -#course-view .topics { - margin-top: 9px; -} - -#course-view .weeks { - margin-top: 9px; -} - -#course-view .section .spacer { - height:0.5em; -} - -#course-view .section .weekdates { -} - -.section .activity img.activityicon { - vertical-align:middle; - height:16px; - width:16px; -} - -.section img.movetarget { - height:16px; - width:80px; -} - -body#course-view .unread { - margin-left: 3em; -} - -body#course-enrol .generalbox { - margin-top: 20px; -} -body#course-enrol .coursebox { - margin-top: 20px; -} - -body#course-user .graph { - text-align: center; -} - -body#course-user .section, -body#course-user .content { - margin-left: 30px; - margin-right: 30px; -} - -body#course-user .section { - border-width:1px; - border-style:solid; - padding:10px; - margin-bottom: 20px; -} - -body#course-user .section h2 { - margin-top: 0px; -} - - -.headingblock { - padding:5px; -} - -.headingblock header{ - -} - -.headingblock .link { - text-align:right; -} - -body#site-index .headingblock { - margin-bottom: 8px; -} - -.coursebox { - margin-bottom: 8px; -} - -.categoryboxcontent, -.courseboxcontent { - border-width:1px; - border-style:solid; -} - - - -/*** - *** Doc - ***/ - -body#doc-contents h1 { - margin: 1em 0px 0px 0px; -} - -body#doc-contents ul { - list-style-type: none; - margin: 0px; - padding: 0px; - width: 90%; -} - - -/*** - *** Login - ***/ - -.loginbox .content { - border-width:1px; - border-style:solid; - padding:15px; -} - - -/*** - *** Message - ***/ - -.message_link { - vertical-align:middle; -} - -.message_search_results { - border-collapse:collapse; - border-spacing:0px; -} - -table.message_search_results td { - padding:5px; - border-width:1px; - border-style:solid; -} -.message_summary_link { - text-align:right; -} -.message_heading { - text-align:center; -} - - -/*** - *** Tabs - ***/ - -.tabs { - width: auto; - margin-bottom: 15px; -} -.tabs .side { - border-style: solid; - border-width: 0px 0px 1px 0px; - width: 50%; -} - -.tabrow { - border-collapse:collapse; - width:100%; - margin:0; -} -.tabrow td { - height:34px; - padding:0 0 0 14px; -} -.tabrow th { - display:none; -} -.tabrow td .tablink { - display:block; - height:34px; - line-height:38px; - padding:0 14px 0 0; - text-align:center; - white-space:nowrap; - text-decoration:none; -} -.tabrow .last span { - display:block; - padding:0px 1px 0px 0px; -} - -.tabrow .selected .tablink { - line-height:38px; -} - - -/*** - *** User - ***/ - -.userinfobox { - margin-bottom:5px; - border-width: 1px; - border-style: solid; - border-collapse: separate; -} - -.userinfobox .left { - padding: 10px; - width: 100px; - vertical-align: top; -} - -.userinfobox .content { - padding: 10px; - vertical-align: top; -} - -.userinfobox .links { - width: 100px; - padding: 5px; - vertical-align: bottom; -} - -.userinfobox .list td { - padding: 3px; -} - -.userinfobox .username { - padding-bottom: 20px; -} - - -table.userinfobox { - width: 80%; - margin-left: 10%; - margin-right: 10%; -} - -table.groupinfobox { - width: 60%; - margin-left: 20%; - margin-right: 20%; - border-width:1px; - border-style:solid; - margin-bottom: 20px; -} - -.groupinfobox .left { - padding: 10px; - width: 100px; - vertical-align: top; -} -body#user-index #longtimenosee { - text-align:center; -} - - -/*** - *** Modules: Assignment - ***/ - -/*** - *** Modules: Chat - ***/ - -/*** - *** Modules: Choice - ***/ - -/*** - *** Modules: Forum - ***/ - -.forumheaderlist, -.forumpost { - border-width:1px; - border-style:solid; - border-collapse:separate; -} - -.forumpost { - margin-top: 15px; -} - -.forumpost .topic { - padding: 4px; - border-style:solid; - border-width: 0px; - border-bottom-width: 1px; -} - -.forumpost .commands { - padding-top: 0.5em; - text-align:right; -} - -.forumpost .ratings { - padding-top: 1em; - text-align:right; -} - -.forumpost .content { - padding: 4px; -} - -.forumpost .footer { - padding-top: 0.5em; - text-align:right; -} - -.forumpost .link { - padding-top: 0.5em; - text-align:right; -} - -.forumpost .left { - width: 35px; - padding: 4px; - text-align: center; - vertical-align: top; -} - -.mod-forum .indent { - margin-left: 30px; -} - -body#user-view .forumpost, -.course .forumpost { - width: 100%; -} - -body#mod-forum-search .c0 { - text-align: right; -} - -body#mod-forum-search .introcontent { - padding: 15px; -} - -.forumolddiscuss { - text-align: right; -} - -.forumheaderlist { - width: 100%; -} - -.forumheaderlist td { - border-width:1px 0px 0px 1px; - border-style:solid; -} - -.forumheaderlist .replies { - text-align: center; -} - -.forumheaderlist .picture { - width: 35px; -} - -.forumheaderlist .discussion .starter { - vertical-align: middle; -} - -.forumheaderlist .discussion .lastpost { - white-space: nowrap; -} - -.forumheaderlist .discussion .author { - white-space: nowrap; -} -.forumolddiscuss { - text-align:right; -} -.forumaddnew, -.forumnodiscuss, -.noticeboxcontent { - text-align:center; -} -#mod-forum-view .unread { - padding-left: 3px; - padding-right: 3px; -} -#mod-forum-discuss .unread .forumpost .message { - border-style: solid; - border-width: 2px; -} - - -/*** - *** Modules: Glossary - ***/ - -.glossarypost .commands { - width: 200px; - white-space: nowrap; -} - -.entryboxheader { - border-width: 1px 1px 0px 1px; - border-style: solid; -} - -.entrybox { - border-width: 0px 1px 1px 1px; - border-style: solid; -} - -.glossarypost { - width: 95%; - border-width:1px; - border-style:solid; - border-collapse:separate; - margin-bottom: 5px; - text-align: left; -} - - -.entrylist { - border-width:0px; -} - -.entrylowersection { - padding-top: 10px; -} -.entrylowersection table{ - width: 100%; -} -.entrylowersection .aliases { - text-align:center; -} -.entrylowersection .icons, -.entrylowersection .ratings { - text-align:right; - padding-right: 5px; -} -.entrylowersection .ratings { - padding-bottom: 2px; -} -.glossarycategoryheader { - width: 95%; -} -.glossaryformatheader { - width: 90%; -} - -.glossarypost .entry { - padding: 3px; -} - -.glossarypost .picture { - width: 35px; -} - -.glossarycomment { - border-width:1px; - border-style:solid; - border-collapse:separate; - margin-bottom: 5px; - text-align: left; -} - - -.glossarycomment .entry { - padding: 3px; -} - -.glossarycomment .picture { - width: 35px; -} - -.glossarycomment .icons { - text-align: right; -} - -.glossarydisplay { - width: 70%; -} - -.glossarydisplay .tabs { - width: 100%; -} - -.glossarydisplay .separator { - width: 4px; -} - -.glossarydisplay .tabs .selected, -.glossarydisplay .tabs .inactive, -.glossarydisplay .tabs .general { -} - -.glossarypopup { - width: 95%; -} - -.glossaryapproval { - width: 100%; -} - -.mod-glossary .tabs { - margin-bottom: 0px; -} -.mod-glossary .tabs .side { - border-style: none; - border-width: 0px; - width: auto; -} - - -/*** - *** Modules: Journal - ***/ -#mod-journal-view .lastedit, -#mod-journal-view .editend { - margin: 5px; - text-align: center; -} -#mod-journal-view .feedbackbox { - width: 75%; - border-collapse: separate; -} -#mod-journal-view .entrycontent { - padding: 3px; -} -#mod-journal-view .picture { - width: 35px; -} -#mod-journal-view .grade { - text-align: right; -} -#mod-journal-view .info { - margin-bottom: 5px; - text-align: right; -} - - -/*** - *** Modules: Label - ***/ - -/*** - *** Modules: Lesson - ***/ - -/*** - *** Modules: Quiz - ***/ - -.feedbacktext { - display:block; -} - -body#mod-quiz-report table#attempts, -body#mod-quiz-report table#commands -{ - width: 80%; - margin: auto; -} -body#mod-quiz-report table#attempts { - margin: 20px auto; -} -body#mod-quiz-report table#attempts .header, -body#mod-quiz-report table#attempts .cell -{ - padding: 4px; -} -body#mod-quiz-report table#attempts .header .commands { - display: inline; -} -body#mod-quiz-report table#attempts .picture { - width: 40px; -} -body#mod-quiz-report table#attempts td { - border-left-width: 1px; - border-right-width: 1px; - border-left-style: solid; - border-right-style: solid; -} -.feedbacktext { - text-align:right; -} -body#mod-quiz-report table#attempts .header { - text-align: left; -} -body#mod-quiz-report table#attempts .picture { - text-align: center !important; -} -body#mod-quiz-report .controls { - text-align: center; -} - - - -/*** - *** Modules: Resource - ***/ - -/*** - *** Modules: Scorm - ***/ - -/*** - *** Modules: Survey - ***/ - -/*** - *** Modules: Wiki - ***/ - -/*** - *** Modules: Workshop - ***/ - -#header-home { - height:112px; -} diff --git a/theme/cornflower/styles_moz.css b/theme/cornflower/styles_moz.css deleted file mode 100644 index d757febb281..00000000000 --- a/theme/cornflower/styles_moz.css +++ /dev/null @@ -1,331 +0,0 @@ -/******************************************************************* - styles_moz.css - - This CSS file uses the non-standard Mozilla CSS extensions - to add round corners to the current theme. - - Styles are organised into the following sections: - core - header - footer - - admin - blocks - calendar - course - doc - login - message - tabs - user - - various modules - -*******************************************************************/ - - - -/*** - *** Core - ***/ - -.headingblock { - -moz-border-radius:3px; -} - -.notifyproblem { - -moz-border-radius:10px; -} - -.notifysuccess { - -moz-border-radius:10px; -} -.generalbox { - -moz-border-radius-topleft:3px; - -moz-border-radius-topright:3px; - -moz-border-radius-bottomleft:15px; - -moz-border-radius-bottomright:15px; -} - -.generalboxcontent { - -moz-border-radius-topleft:3px; - -moz-border-radius-topright:3px; - -moz-border-radius-bottomleft:15px; - -moz-border-radius-bottomright:15px; -} - -.noticebox { - -moz-border-radius:5px; -} - -.informationbox { - -moz-border-radius-topleft:3px; - -moz-border-radius-topright:3px; - -moz-border-radius-bottomleft:15px; - -moz-border-radius-bottomright:15px; -} - -.informationboxcontent { - -moz-border-radius-topleft:3px; - -moz-border-radius-topright:3px; - -moz-border-radius-bottomleft:15px; - -moz-border-radius-bottomright:15px; -} - -.sitetopiccontent { - -moz-border-radius:15px; -} - -.headingblock { - -moz-border-radius:3px; -} - -.categorybox, .categoryboxcontent, -.coursebox, .courseboxcontent { - -moz-border-radius:20px; -} - - - - -/* kept for backward compatibility with some non-standard modules - which use these classes for various things */ -.generaltab, .generaltabinactive{ - -moz-border-radius-topleft:15px; - -moz-border-radius-topright:15px; -} - -.generaltabselected { - -moz-border-radius-topleft:15px; - -moz-border-radius-topright:15px; -} - - -/*** - *** Header - ***/ - -/*** - *** Footer - ***/ - -/*** - *** Admin - ***/ - -/*** - *** Blocks - ***/ -.sideblock { - -moz-border-radius-bottomleft:20px; - -moz-border-radius-bottomright:20px; -} - -.sideblock.hidden { - -moz-border-radius: 0px; -} - -.sideblock { - -moz-border-radius-bottomleft:20px; - -moz-border-radius-bottomright:20px; -} - -.sideblock .content { - -moz-border-radius-bottomleft:20px; - -moz-border-radius-bottomright:20px; -} - - -.block_course_summary, .block_course_summary .content { - -moz-border-radius:20px; -} - - - -/*** - *** Calendar - ***/ - -#calendar .eventlist .event { - -moz-border-radius-bottomleft:15px; - -moz-border-radius-bottomright:15px; -} - -#calendar .eventlist .event .side { - -moz-border-radius-bottomleft:15px; -} - -#calendar .eventlist .event .description { - -moz-border-radius-bottomright:15px; -} - -#calendar .maincalendar, -#calendar .sidecalendar -{ - -moz-border-radius-bottomright:20px; - -moz-border-radius-bottomleft:20px; -} - -#calendar .maincalendar .filters table, -#calendar .sidecalendar .filters table, -.sideblock.block_calendar_month .filters table -{ - -moz-border-radius:4px; -} - -table.minicalendar { - -moz-border-radius:10px; -} - -table.minicalendar td { - -moz-border-radius:4px; -} - -/*** - *** Course - ***/ -body#course-user .section { - -moz-border-radius:20px; -} - - -/*** - *** Doc - ***/ - -/*** - *** Login - ***/ -.loginbox { - -moz-border-radius-bottomleft:20px; - -moz-border-radius-bottomright:20px; -} - -.loginbox .content.left { - -moz-border-radius-bottomleft:20px; -} -.loginbox .content.right { - -moz-border-radius-bottomright:20px; -} - -/*** - *** Message - ***/ - -/*** - *** Tabs - ***/ - -/*** - *** User - ***/ -.userinfobox { - -moz-border-radius-bottomleft:20px; - -moz-border-radius-bottomright:20px; -} - -.groupinfobox { - -moz-border-radius-bottomleft:20px; - -moz-border-radius-bottomright:20px; -} -#user-view .left { - -moz-border-radius-bottomleft:20px; -} - -/*** - *** Modules: Assignment - ***/ - -/*** - *** Modules: Chat - ***/ - -/*** - *** Modules: Choice - ***/ - -/*** - *** Modules: Forum - ***/ -.forumpost { - -moz-border-radius-bottomleft:20px; - -moz-border-radius-bottomright:20px; -} - -.forumpost .side { - -moz-border-radius-bottomleft:20px; -} - -.forumpost .content { - -moz-border-radius-bottomright:20px; -} - -.forumpost .message { - -moz-border-radius-bottomright:20px; -} - - -/*** - *** Modules: Glossary - ***/ -.glossarycategoryheader { - -moz-border-radius-topleft:15px; - -moz-border-radius-topright:15px; -} - -.glossaryformatheader { - -moz-border-radius-topleft:15px; - -moz-border-radius-topright:15px; -} - -.entryboxheader { - -moz-border-radius-topleft:10px; - -moz-border-radius-topright:10px; -} - -.entrybox { - -moz-border-radius-bottomleft:10px; - -moz-border-radius-bottomright:10px; -} - -.glossarypost { - -moz-border-radius-bottomleft:15px; - -moz-border-radius-bottomright:15px; -} - -.glossarypost .side { - -moz-border-radius-bottomleft:15px; -} - -.encyclopedia .entrylowersection { - -moz-border-radius-bottomright:15px; -} -.glossarycomment { - -moz-border-radius-bottomleft:20px; - -moz-border-radius-bottomright:20px; -} - -.glossarycomment .side { - -moz-border-radius-bottomleft:20px; -} - -.glossarycomment .entry { - -moz-border-radius-bottomright:20px; -} - - -/*** - *** Modules: Journal - ***/ - -#mod-journal-view .feedbackbox { - -moz-border-radius-bottomleft:15px; - -moz-border-radius-bottomright:15px; -} -#mod-journal-view .feedbackbox .side { - -moz-border-radius-bottomleft:15px; -} -#mod-journal-view .feedbackbox .entrycontent { - -moz-border-radius-bottomright:15px; -} - diff --git a/version.php b/version.php index 352dc5468f7..1896cc8aa2e 100644 --- a/version.php +++ b/version.php @@ -6,7 +6,7 @@ // This is compared against the values stored in the database to determine // whether upgrades should be performed (see lib/db/*.php) - $version = 2007070602; // YYYYMMDD = date + $version = 2007070603; // YYYYMMDD = date // XY = increments within a single day $release = '1.9 dev'; // Human-friendly version name