Compare commits
46 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 29f8c0937a | |||
| 01d6191b81 | |||
| cd824e74d8 | |||
| abf0c9fc9e | |||
| 54c0c9e58e | |||
| 7c78db604b | |||
| a812924762 | |||
| ea8393591f | |||
| ecbf8aee6e | |||
| 8513176415 | |||
| 6b2510f4c7 | |||
| 4969eb20ac | |||
| db23afadac | |||
| eeb0efd7d8 | |||
| ddaf467f31 | |||
| b3a5ae03d0 | |||
| 2b2d3244cd | |||
| 86070a3ed9 | |||
| 7a28bba4d3 | |||
| a8a71bbad3 | |||
| aebfad51a0 | |||
| 484dcc9b90 | |||
| 46640b7e53 | |||
| a22f7cb864 | |||
| 13bb9cee30 | |||
| 2f286d7658 | |||
| 7b8110d4b0 | |||
| 6a34b93223 | |||
| c9b9abc090 | |||
| ff28c81cb6 | |||
| 494c554bf3 | |||
| 58c8b68c3c | |||
| 5d61ac8012 | |||
| 89bcfc4aac | |||
| 95d3b8e1f2 | |||
| d55276ee51 | |||
| c16e466de2 | |||
| 0e4511877e | |||
| 586fff6894 | |||
| 9dc58f9b26 | |||
| 0d9c836ab2 | |||
| 057f509fad | |||
| 3000c6bde7 | |||
| 9593527b54 | |||
| 04c258ee19 | |||
| 5fe2acd17b |
+11
-2
@@ -196,11 +196,20 @@
|
||||
}
|
||||
|
||||
list($extrasql, $params) = $ufiltering->get_sql_filter();
|
||||
$users = get_users_listing($sort, $dir, $page*$perpage, $perpage, '', '', '',
|
||||
$extrasql, $params, $context);
|
||||
|
||||
$usercount = get_users(false);
|
||||
$usersearchcount = get_users(false, '', false, null, "", '', '', '', '', '*', $extrasql, $params);
|
||||
|
||||
// Exclude guest user from list.
|
||||
$noguestsql = '';
|
||||
if (!empty($extrasql)) {
|
||||
$noguestsql .= ' AND';
|
||||
}
|
||||
$noguestsql .= " id <> :guestid";
|
||||
$params['guestid'] = $CFG->siteguest;
|
||||
$users = get_users_listing($sort, $dir, $page*$perpage, $perpage, '', '', '',
|
||||
$extrasql.$noguestsql, $params, $context);
|
||||
|
||||
if ($extrasql !== '') {
|
||||
echo $OUTPUT->heading("$usersearchcount / $usercount ".get_string('users'));
|
||||
$usercount = $usersearchcount;
|
||||
|
||||
@@ -206,10 +206,6 @@ class auth_plugin_cas extends auth_plugin_ldap {
|
||||
}
|
||||
}
|
||||
|
||||
if (!ldap_paged_results_supported($this->config->ldap_version)) {
|
||||
echo $OUTPUT->notification(get_string('pagedresultsnotsupp', 'auth_ldap'));
|
||||
}
|
||||
|
||||
include($CFG->dirroot.'/auth/cas/config.html');
|
||||
}
|
||||
|
||||
|
||||
@@ -92,6 +92,12 @@ if (!isset($config->removeuser)) {
|
||||
|
||||
$yesno = array( get_string('no'), get_string('yes') );
|
||||
|
||||
$disabled = '';
|
||||
if (!ldap_paged_results_supported($config->ldap_version)) {
|
||||
$disabled = ' disabled="disabled"';
|
||||
echo $OUTPUT->notification(get_string('pagedresultsnotsupp', 'auth_ldap'));
|
||||
}
|
||||
|
||||
?>
|
||||
<table cellspacing="0" cellpadding="5" border="0">
|
||||
<tr>
|
||||
@@ -266,7 +272,6 @@ $yesno = array( get_string('no'), get_string('yes') );
|
||||
<label for="pagesize"><?php print_string('pagesize_key', 'auth_ldap') ?></label>
|
||||
</td>
|
||||
<td>
|
||||
<?php $disabled = (!ldap_paged_results_supported($config->ldap_version)) ? ' disabled="disabled"' : '' ; ?>
|
||||
<input id="pagesize" name="pagesize" type="text" value="<?php echo $config->pagesize ?>" <?php echo $disabled ?>/>
|
||||
<?php
|
||||
if (isset($err['pagesize'])) { echo $OUTPUT->error_text($err['pagesize']); }
|
||||
|
||||
@@ -1711,10 +1711,6 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!ldap_paged_results_supported($this->config->ldap_version)) {
|
||||
echo $OUTPUT->notification(get_string('pagedresultsnotsupp', 'auth_ldap'));
|
||||
}
|
||||
|
||||
include($CFG->dirroot.'/auth/ldap/config.html');
|
||||
}
|
||||
|
||||
|
||||
@@ -103,6 +103,12 @@ if (!isset($config->ntlmsso_remoteuserformat)) {
|
||||
|
||||
$yesno = array(get_string('no'), get_string('yes'));
|
||||
|
||||
$disabled = '';
|
||||
if (!ldap_paged_results_supported($config->ldap_version)) {
|
||||
$disabled = ' disabled="disabled"';
|
||||
echo $OUTPUT->notification(get_string('pagedresultsnotsupp', 'auth_ldap'));
|
||||
}
|
||||
|
||||
?>
|
||||
<table cellspacing="0" cellpadding="5" border="0">
|
||||
<tr>
|
||||
@@ -156,7 +162,6 @@ $yesno = array(get_string('no'), get_string('yes'));
|
||||
<label for="pagesize"><?php print_string('pagesize_key', 'auth_ldap') ?></label>
|
||||
</td>
|
||||
<td>
|
||||
<?php $disabled = (!ldap_paged_results_supported($config->ldap_version)) ? ' disabled="disabled"' : '' ; ?>
|
||||
<input id="pagesize" name="pagesize" type="text" value="<?php echo $config->pagesize ?>" <?php echo $disabled ?>/>
|
||||
<?php
|
||||
if (isset($err['pagesize'])) { echo $OUTPUT->error_text($err['pagesize']); }
|
||||
|
||||
@@ -1040,6 +1040,24 @@ class moodle1_question_bank_handler extends moodle1_xml_handler {
|
||||
/** @var array holds the instances of qtype specific conversion handlers */
|
||||
private $qtypehandlers = null;
|
||||
|
||||
/**
|
||||
* Return the file manager instance used.
|
||||
*
|
||||
* @return moodle1_file_manager
|
||||
*/
|
||||
public function get_file_manager() {
|
||||
return $this->fileman;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the information about the question category context being currently parsed
|
||||
*
|
||||
* @return array with keys contextid, contextlevel and contextinstanceid
|
||||
*/
|
||||
public function get_current_category_context() {
|
||||
return $this->currentcategory;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers path that are not qtype-specific
|
||||
*/
|
||||
@@ -1191,6 +1209,17 @@ class moodle1_question_bank_handler extends moodle1_xml_handler {
|
||||
$data['generalfeedbackformat'] = FORMAT_HTML;
|
||||
}
|
||||
|
||||
// Migrate files in questiontext.
|
||||
$this->fileman->contextid = $this->currentcategory['contextid'];
|
||||
$this->fileman->component = 'question';
|
||||
$this->fileman->filearea = 'questiontext';
|
||||
$this->fileman->itemid = $data['id'];
|
||||
$data['questiontext'] = moodle1_converter::migrate_referenced_files($data['questiontext'], $this->fileman);
|
||||
|
||||
// Migrate files in generalfeedback.
|
||||
$this->fileman->filearea = 'generalfeedback';
|
||||
$data['generalfeedback'] = moodle1_converter::migrate_referenced_files($data['generalfeedback'], $this->fileman);
|
||||
|
||||
// replay the upgrade step 2010080901 - updating question image
|
||||
if (!empty($data['image'])) {
|
||||
if (textlib::substr(textlib::strtolower($data['image']), 0, 7) == 'http://') {
|
||||
@@ -1736,12 +1765,41 @@ abstract class moodle1_qtype_handler extends moodle1_plugin_handler {
|
||||
foreach ($answers as $elementname => $elements) {
|
||||
foreach ($elements as $element) {
|
||||
$answer = $this->convert_answer($element, $qtype);
|
||||
// Migrate images in answertext.
|
||||
if ($answer['answerformat'] == FORMAT_HTML) {
|
||||
$answer['answertext'] = $this->migrate_files($answer['answertext'], 'question', 'answer', $answer['id']);
|
||||
}
|
||||
// Migrate images in feedback.
|
||||
if ($answer['feedbackformat'] == FORMAT_HTML) {
|
||||
$answer['feedback'] = $this->migrate_files($answer['feedback'], 'question', 'answerfeedback', $answer['id']);
|
||||
}
|
||||
$this->write_xml('answer', $answer, array('/answer/id'));
|
||||
}
|
||||
}
|
||||
$this->xmlwriter->end_tag('answers');
|
||||
}
|
||||
|
||||
/**
|
||||
* Migrate files belonging to one qtype plugin text field.
|
||||
*
|
||||
* @param array $text the html fragment containing references to files
|
||||
* @param string $component the component for restored files
|
||||
* @param string $filearea the file area for restored files
|
||||
* @param int $itemid the itemid for restored files
|
||||
*
|
||||
* @return string the text for this field, after files references have been processed
|
||||
*/
|
||||
protected function migrate_files($text, $component, $filearea, $itemid) {
|
||||
$context = $this->qbankhandler->get_current_category_context();
|
||||
$fileman = $this->qbankhandler->get_file_manager();
|
||||
$fileman->contextid = $context['contextid'];
|
||||
$fileman->component = $component;
|
||||
$fileman->filearea = $filearea;
|
||||
$fileman->itemid = $itemid;
|
||||
$text = moodle1_converter::migrate_referenced_files($text, $fileman);
|
||||
return $text;
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes the grouped numerical_units structure
|
||||
*
|
||||
@@ -1900,7 +1958,8 @@ abstract class moodle1_qtype_handler extends moodle1_plugin_handler {
|
||||
if ($qtype !== 'multichoice') {
|
||||
$new['answerformat'] = FORMAT_PLAIN;
|
||||
} else {
|
||||
$new['answerformat'] = FORMAT_MOODLE;
|
||||
$new['answertext'] = text_to_html($new['answertext'], false, false, true);
|
||||
$new['answerformat'] = FORMAT_HTML;
|
||||
}
|
||||
|
||||
if ($CFG->texteditors !== 'textarea') {
|
||||
|
||||
+1
-1
@@ -601,7 +601,7 @@ function blog_get_options_for_module($module, $user=null) {
|
||||
}
|
||||
if (array_key_exists($key, $moduleoptions)) {
|
||||
// Serve from the cache so we don't have to regenerate
|
||||
return $moduleoptions[$module->id];
|
||||
return $moduleoptions[$key];
|
||||
}
|
||||
|
||||
$canparticipate = (is_enrolled($modcontext) or is_viewing($modcontext));
|
||||
|
||||
Vendored
+24
-3
@@ -511,6 +511,7 @@ class cache_helper {
|
||||
* Update the site identifier stored by the cache API.
|
||||
*
|
||||
* @param string $siteidentifier
|
||||
* @return string The new site identifier.
|
||||
*/
|
||||
public static function update_site_identifier($siteidentifier) {
|
||||
global $CFG;
|
||||
@@ -519,9 +520,10 @@ class cache_helper {
|
||||
$factory = cache_factory::instance();
|
||||
$factory->updating_started();
|
||||
$config = $factory->create_config_instance(true);
|
||||
$config->update_site_identifier($siteidentifier);
|
||||
$siteidentifier = $config->update_site_identifier($siteidentifier);
|
||||
$factory->updating_finished();
|
||||
cache_factory::reset();
|
||||
return $siteidentifier;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -530,11 +532,30 @@ class cache_helper {
|
||||
* @return string
|
||||
*/
|
||||
public static function get_site_identifier() {
|
||||
if (is_null(self::$siteidentifier)) {
|
||||
$factory = cache_factory::instance();
|
||||
global $CFG;
|
||||
if (!is_null(self::$siteidentifier)) {
|
||||
return self::$siteidentifier;
|
||||
}
|
||||
// If site identifier hasn't been collected yet attempt to get it from the cache config.
|
||||
$factory = cache_factory::instance();
|
||||
// If the factory is initialising then we don't want to try to get it from the config or we risk
|
||||
// causing the cache to enter an infinite initialisation loop.
|
||||
if (!$factory->is_initialising()) {
|
||||
$config = $factory->create_config_instance();
|
||||
self::$siteidentifier = $config->get_site_identifier();
|
||||
}
|
||||
if (is_null(self::$siteidentifier)) {
|
||||
// If the site identifier is still null then config isn't aware of it yet.
|
||||
// We'll see if the CFG is loaded, and if not we will just use unknown.
|
||||
// It's very important here that we don't use get_config. We don't want an endless cache loop!
|
||||
if (isset($CFG->siteidentifier)) {
|
||||
self::$siteidentifier = self::update_site_identifier($CFG->siteidentifier);
|
||||
} else {
|
||||
// It's not being recorded in MUC's config and the config data hasn't been loaded yet.
|
||||
// Likely we are initialising.
|
||||
return 'unknown';
|
||||
}
|
||||
}
|
||||
return self::$siteidentifier;
|
||||
}
|
||||
|
||||
|
||||
Vendored
+54
@@ -1410,6 +1410,17 @@ class cache_application extends cache implements cache_loader_with_locking {
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class cache_session extends cache {
|
||||
/**
|
||||
* The user the session has been established for.
|
||||
* @var int
|
||||
*/
|
||||
protected static $loadeduserid = null;
|
||||
|
||||
/**
|
||||
* The userid this cache is currently using.
|
||||
* @var int
|
||||
*/
|
||||
protected $currentuserid = null;
|
||||
/**
|
||||
* Override the cache::construct method.
|
||||
*
|
||||
@@ -1426,6 +1437,8 @@ class cache_session extends cache {
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(cache_definition $definition, cache_store $store, $loader = null) {
|
||||
// First up copy the loadeduserid to the current user id.
|
||||
$this->currentuserid = self::$loadeduserid;
|
||||
parent::__construct($definition, $store, $loader);
|
||||
if ($definition->has_invalidation_events()) {
|
||||
$lastinvalidation = $this->get('lastsessioninvalidation');
|
||||
@@ -1474,6 +1487,47 @@ class cache_session extends cache {
|
||||
$this->set('lastsessioninvalidation', cache::now());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses the key turning it into a string (or array is required) suitable to be passed to the cache store.
|
||||
*
|
||||
* This function is called for every operation that uses keys. For this reason we use this function to also check
|
||||
* that the current user is the same as the user who last used this cache.
|
||||
*
|
||||
* @param string|int $key As passed to get|set|delete etc.
|
||||
* @return string|array String unless the store supports multi-identifiers in which case an array if returned.
|
||||
*/
|
||||
protected function parse_key($key) {
|
||||
$this->check_tracked_user();
|
||||
return parent::parse_key($key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check that this cache instance is tracking the current user.
|
||||
*/
|
||||
protected function check_tracked_user() {
|
||||
if (isset($_SESSION['USER']->id)) {
|
||||
// Get the id of the current user.
|
||||
$new = $_SESSION['USER']->id;
|
||||
} else {
|
||||
// No user set up yet.
|
||||
$new = 0;
|
||||
}
|
||||
if ($new !== self::$loadeduserid) {
|
||||
// The current user doesn't match the tracker userid for this request.
|
||||
if (!is_null(self::$loadeduserid)) {
|
||||
// Purge the data we have for the old user.
|
||||
// This way we don't bloat the session.
|
||||
$this->purge();
|
||||
}
|
||||
self::$loadeduserid = $new;
|
||||
$this->currentuserid = $new;
|
||||
} else if ($new !== $this->currentuserid) {
|
||||
// The current user matches the loaded user but not the user last used by this cache.
|
||||
$this->purge();
|
||||
$this->currentuserid = $new;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Vendored
+2
@@ -529,10 +529,12 @@ class cache_config_writer extends cache_config {
|
||||
* Update the site identifier stored by the cache API.
|
||||
*
|
||||
* @param string $siteidentifier
|
||||
* @return string The new site identifier.
|
||||
*/
|
||||
public function update_site_identifier($siteidentifier) {
|
||||
$this->siteidentifier = md5((string)$siteidentifier);
|
||||
$this->config_save();
|
||||
return $this->siteidentifier;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Vendored
+59
@@ -849,4 +849,63 @@ class cache_phpunit_tests extends advanced_testcase {
|
||||
$this->assertTrue($cache->set('test', 'test'));
|
||||
$this->assertEquals('test', $cache->get('test'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test switching users with session caches.
|
||||
*/
|
||||
public function test_session_cache_switch_user() {
|
||||
$this->resetAfterTest(true);
|
||||
$cache = cache::make_from_params(cache_store::MODE_SESSION, 'phpunit', 'sessioncache');
|
||||
$user1 = $this->getDataGenerator()->create_user();
|
||||
$user2 = $this->getDataGenerator()->create_user();
|
||||
|
||||
// Log in as the first user.
|
||||
$this->setUser($user1);
|
||||
$sesskey1 = sesskey();
|
||||
|
||||
// Set a basic value in the cache.
|
||||
$cache->set('var', 1);
|
||||
$this->assertTrue($cache->has('var'));
|
||||
$this->assertEquals(1, $cache->get('var'));
|
||||
|
||||
// Change to the second user.
|
||||
$this->setUser($user2);
|
||||
$sesskey2 = sesskey();
|
||||
|
||||
// Make sure the cache doesn't give us the data for the last user.
|
||||
$this->assertNotEquals($sesskey1, $sesskey2);
|
||||
$this->assertFalse($cache->has('var'));
|
||||
$this->assertEquals(false, $cache->get('var'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test multiple session caches when switching user.
|
||||
*/
|
||||
public function test_session_cache_switch_user_multiple() {
|
||||
$this->resetAfterTest(true);
|
||||
$cache1 = cache::make_from_params(cache_store::MODE_SESSION, 'phpunit', 'sessioncache1');
|
||||
$cache2 = cache::make_from_params(cache_store::MODE_SESSION, 'phpunit', 'sessioncache2');
|
||||
$user1 = $this->getDataGenerator()->create_user();
|
||||
$user2 = $this->getDataGenerator()->create_user();
|
||||
|
||||
// Log in as the first user.
|
||||
$this->setUser($user1);
|
||||
$sesskey1 = sesskey();
|
||||
|
||||
// Set a basic value in the caches.
|
||||
$cache1->set('var', 1);
|
||||
$cache2->set('var', 2);
|
||||
$this->assertEquals(1, $cache1->get('var'));
|
||||
$this->assertEquals(2, $cache2->get('var'));
|
||||
|
||||
// Change to the second user.
|
||||
$this->setUser($user2);
|
||||
$sesskey2 = sesskey();
|
||||
|
||||
// Make sure the cache doesn't give us the data for the last user.
|
||||
// Also make sure that switching the user has lead to both caches being purged.
|
||||
$this->assertNotEquals($sesskey1, $sesskey2);
|
||||
$this->assertEquals(false, $cache1->get('var'));
|
||||
$this->assertEquals(false, $cache2->get('var'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,10 +20,13 @@ class editsection_form extends moodleform {
|
||||
|
||||
$mform = $this->_form;
|
||||
$course = $this->_customdata['course'];
|
||||
$mform->addElement('checkbox', 'usedefaultname', get_string('sectionusedefaultname'));
|
||||
$mform->setDefault('usedefaultname', true);
|
||||
|
||||
$mform->addElement('text', 'name', get_string('sectionname'), array('size'=>'30'));
|
||||
$elementgroup = array();
|
||||
$elementgroup[] = $mform->createElement('text', 'name', '', array('size' => '30'));
|
||||
$elementgroup[] = $mform->createElement('checkbox', 'usedefaultname', '', get_string('sectionusedefaultname'));
|
||||
$mform->addGroup($elementgroup, 'name_group', get_string('sectionname'), ' ', false);
|
||||
|
||||
$mform->setDefault('usedefaultname', true);
|
||||
$mform->setType('name', PARAM_TEXT);
|
||||
$mform->disabledIf('name','usedefaultname','checked');
|
||||
|
||||
|
||||
+1
-1
@@ -1251,7 +1251,7 @@ $string['other'] = 'Other';
|
||||
$string['outline'] = 'Outline';
|
||||
$string['outlinereport'] = 'Outline report';
|
||||
$string['page'] = 'Page';
|
||||
$string['pageheaderconfigablock'] = 'Configuring a block in %fullname%';
|
||||
$string['pageheaderconfigablock'] = 'Configuring a block in {$a->fullname}';
|
||||
$string['pagepath'] = 'Page path';
|
||||
$string['pageshouldredirect'] = 'This page should automatically redirect. If nothing is happening please use the continue link below.';
|
||||
$string['parentcategory'] = 'Parent category';
|
||||
|
||||
+2
-4
@@ -1610,9 +1610,7 @@ function xmldb_main_upgrade($oldversion) {
|
||||
upgrade_main_savepoint(true, 2012120301.13);
|
||||
}
|
||||
|
||||
// This is checking to see if the site has been running a specific version with a bug in it
|
||||
// because this upgrade step is slow and is only needed if the site has been running with the affected versions.
|
||||
if ($oldversion >= 2012062504.08 && $oldversion < 2012062504.13) {
|
||||
if ($oldversion < 2012120302.01) {
|
||||
// Retrieve the list of course_sections as a recordset to save memory.
|
||||
// This is to fix a regression caused by MDL-37939.
|
||||
// In this case the upgrade step is fixing records where:
|
||||
@@ -1670,7 +1668,7 @@ function xmldb_main_upgrade($oldversion) {
|
||||
}
|
||||
$coursesections->close();
|
||||
|
||||
// No save point needed for this change
|
||||
upgrade_main_savepoint(true, 2012120302.01);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
+2
-1
@@ -1277,7 +1277,8 @@ function download_file_content($url, $headers=null, $postdata=null, $fullrespons
|
||||
//reinstate affected curl options
|
||||
curl_setopt_array ($ch, array(
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_NOBODY => false)
|
||||
CURLOPT_NOBODY => false,
|
||||
CURLOPT_HTTPGET => true)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
+8
-3
@@ -18,11 +18,16 @@ YUI.add('moodle-core-formchangechecker',
|
||||
/**
|
||||
* Initialize the module
|
||||
*/
|
||||
initializer : function(config) {
|
||||
var formid = 'form#' + this.get('formid');
|
||||
initializer : function() {
|
||||
var formid = 'form#' + this.get('formid'),
|
||||
currentform = Y.one(formid);
|
||||
|
||||
if (!currentform) {
|
||||
// If the form was not found, then we can't check for changes.
|
||||
return;
|
||||
}
|
||||
|
||||
// Add change events to the form elements
|
||||
var currentform = Y.one(formid);
|
||||
currentform.delegate('change', M.core_formchangechecker.set_form_changed, 'input', this);
|
||||
currentform.delegate('change', M.core_formchangechecker.set_form_changed, 'textarea', this);
|
||||
currentform.delegate('change', M.core_formchangechecker.set_form_changed, 'select', this);
|
||||
|
||||
@@ -351,12 +351,15 @@ class core_message_renderer extends plugin_renderer_base {
|
||||
|
||||
$output .= html_writer::start_tag('fieldset', array('id' => 'messageprocessor_general', 'class' => 'clearfix'));
|
||||
$output .= html_writer::nonempty_tag('legend', get_string('generalsettings','admin'), array('class' => 'ftoggler'));
|
||||
|
||||
$output .= html_writer::start_tag('div');
|
||||
$output .= get_string('blocknoncontacts', 'message').': ';
|
||||
$output .= html_writer::checkbox('blocknoncontacts', 1, $preferences->blocknoncontacts, '');
|
||||
$output .= html_writer::checkbox('blocknoncontacts', 1, $preferences->blocknoncontacts, get_string('blocknoncontacts', 'message'));
|
||||
$output .= html_writer::end_tag('div');
|
||||
$disableallcheckbox = $this->output->help_icon('disableall', 'message') . get_string('disableall', 'message') . html_writer::checkbox('disableall', 1, $notificationsdisabled, '', array('class'=>'disableallcheckbox'));
|
||||
|
||||
$disableallcheckbox = html_writer::checkbox('disableall', 1, $notificationsdisabled, get_string('disableall', 'message'), array('class'=>'disableallcheckbox'));
|
||||
$disableallcheckbox .= $this->output->help_icon('disableall', 'message');
|
||||
$output .= html_writer::nonempty_tag('div', $disableallcheckbox, array('class'=>'disableall'));
|
||||
|
||||
$output .= html_writer::end_tag('fieldset');
|
||||
$output .= html_writer::start_tag('div', array('class' => 'mdl-align'));
|
||||
$output .= html_writer::empty_tag('input', array('type' => 'submit', 'value' => get_string('updatemyprofile'), 'class' => 'form-submit'));
|
||||
|
||||
+2
-2
@@ -121,9 +121,9 @@ if ($cancel) {
|
||||
|
||||
/// RSS and CSS and JS meta
|
||||
if (!empty($CFG->enablerssfeeds) && !empty($CFG->data_enablerssfeeds) && $data->rssarticles > 0) {
|
||||
$rsspath = rss_get_url($context->id, $USER->id, 'mod_data', $data->id);
|
||||
$courseshortname = format_string($course->shortname, true, array('context' => context_course::instance($course->id)));
|
||||
$PAGE->add_alternate_version($courseshortname . ': %fullname%', $rsspath, 'application/rss+xml');
|
||||
$rsstitle = $courseshortname . ': ' . format_string($data->name);
|
||||
rss_add_http_header($context, 'mod_data', $data, $rsstitle);
|
||||
}
|
||||
if ($data->csstemplate) {
|
||||
$PAGE->requires->css('/mod/data/css.php?d='.$data->id);
|
||||
|
||||
+1
-1
@@ -280,7 +280,7 @@
|
||||
/// RSS and CSS and JS meta
|
||||
$meta = '';
|
||||
if (!empty($CFG->enablerssfeeds) && !empty($CFG->data_enablerssfeeds) && $data->rssarticles > 0) {
|
||||
$rsstitle = $courseshortname . ': %fullname%';
|
||||
$rsstitle = $courseshortname . ': ' . format_string($data->name);
|
||||
rss_add_http_header($context, 'mod_data', $data, $rsstitle);
|
||||
}
|
||||
if ($data->csstemplate) {
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
if (!empty($CFG->enablerssfeeds) && !empty($CFG->forum_enablerssfeeds) && $forum->rsstype && $forum->rssarticles) {
|
||||
require_once("$CFG->libdir/rsslib.php");
|
||||
|
||||
$rsstitle = format_string($course->shortname, true, array('context' => context_course::instance($course->id))) . ': %fullname%';
|
||||
$rsstitle = format_string($course->shortname, true, array('context' => context_course::instance($course->id))) . ': ' . format_string($forum->name);
|
||||
rss_add_http_header($modcontext, 'mod_forum', $forum, $rsstitle);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -96,7 +96,7 @@
|
||||
if (!empty($CFG->enablerssfeeds) && !empty($CFG->forum_enablerssfeeds) && $forum->rsstype && $forum->rssarticles) {
|
||||
require_once("$CFG->libdir/rsslib.php");
|
||||
|
||||
$rsstitle = format_string($course->shortname, true, array('context' => context_course::instance($course->id))) . ': %fullname%';
|
||||
$rsstitle = format_string($course->shortname, true, array('context' => context_course::instance($course->id))) . ': ' . format_string($forum->name);
|
||||
rss_add_http_header($context, 'mod_forum', $forum, $rsstitle);
|
||||
}
|
||||
|
||||
|
||||
@@ -251,7 +251,7 @@ $PAGE->set_url($url);
|
||||
if (!empty($CFG->enablerssfeeds) && !empty($CFG->glossary_enablerssfeeds)
|
||||
&& $glossary->rsstype && $glossary->rssarticles) {
|
||||
|
||||
$rsstitle = format_string($course->shortname, true, array('context' => context_course::instance($course->id))) . ': %fullname%';
|
||||
$rsstitle = format_string($course->shortname, true, array('context' => context_course::instance($course->id))) . ': '. format_string($glossary->name);
|
||||
rss_add_http_header($context, 'mod_glossary', $glossary, $rsstitle);
|
||||
}
|
||||
|
||||
|
||||
@@ -289,6 +289,9 @@ class lesson_page_type_shortanswer extends lesson_page {
|
||||
} else {
|
||||
$answerdata->score = get_string("didnotreceivecredit", "lesson");
|
||||
}
|
||||
// We have found the correct answer, do not process any more answers.
|
||||
$answerpage->answerdata = $answerdata;
|
||||
break;
|
||||
} else {
|
||||
$answerdata->response = get_string("thatsthewronganswer", "lesson");
|
||||
if ($this->lesson->custom) {
|
||||
|
||||
+12
-5
@@ -287,10 +287,10 @@ if ($action === 'delete') {
|
||||
$numofattempts++;
|
||||
$avescore += $try["grade"];
|
||||
$avetime += $timetotake;
|
||||
if ($try["grade"] > $highscore || $highscore == NULL) {
|
||||
if ($try["grade"] > $highscore || $highscore === NULL) {
|
||||
$highscore = $try["grade"];
|
||||
}
|
||||
if ($try["grade"] < $lowscore || $lowscore == NULL) {
|
||||
if ($try["grade"] < $lowscore || $lowscore === NULL) {
|
||||
$lowscore = $try["grade"];
|
||||
}
|
||||
if ($timetotake > $hightime || $hightime == NULL) {
|
||||
@@ -349,10 +349,10 @@ if ($action === 'delete') {
|
||||
} else {
|
||||
$lowtime = format_time($lowtime);
|
||||
}
|
||||
if ($highscore == NULL) {
|
||||
if ($highscore === NULL) {
|
||||
$highscore = get_string("notcompleted", "lesson");
|
||||
}
|
||||
if ($lowscore == NULL) {
|
||||
if ($lowscore === NULL) {
|
||||
$lowscore = get_string("notcompleted", "lesson");
|
||||
}
|
||||
|
||||
@@ -365,7 +365,14 @@ if ($action === 'delete') {
|
||||
$stattable->align = array('center', 'center', 'center', 'center', 'center', 'center');
|
||||
$stattable->wrap = array('nowrap', 'nowrap', 'nowrap', 'nowrap', 'nowrap', 'nowrap');
|
||||
$stattable->attributes['class'] = 'standardtable generaltable';
|
||||
$stattable->data[] = array($avescore.'%', $avetime, $highscore.'%', $lowscore.'%', $hightime, $lowtime);
|
||||
|
||||
if (is_numeric($highscore)) {
|
||||
$highscore .= '%';
|
||||
}
|
||||
if (is_numeric($lowscore)) {
|
||||
$lowscore .= '%';
|
||||
}
|
||||
$stattable->data[] = array($avescore.'%', $avetime, $highscore, $lowscore, $hightime, $lowtime);
|
||||
|
||||
echo html_writer::table($stattable);
|
||||
} else if ($action === 'reportdetail') {
|
||||
|
||||
@@ -388,6 +388,10 @@ class mod_quiz_mod_form extends moodleform_mod {
|
||||
// Check and act on whether setting outcomes is considered an advanced setting.
|
||||
$mform->setAdvanced('modoutcomes', !empty($quizconfig->outcomes_adv));
|
||||
|
||||
// The standard_coursemodule_elements method sets this to 100, but the
|
||||
// quiz has its own setting, so use that.
|
||||
$mform->setDefault('grade', $quizconfig->maximumgrade);
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
$this->add_action_buttons();
|
||||
}
|
||||
|
||||
@@ -78,6 +78,8 @@ class moodle1_qtype_match_handler extends moodle1_qtype_handler {
|
||||
$match['questiontextformat'] = $data['oldquestiontextformat'];
|
||||
}
|
||||
|
||||
$match['questiontext'] = $this->migrate_files(
|
||||
$match['questiontext'], 'qtype_match', 'subquestion', $match['id']);
|
||||
$this->write_xml('match', $match, array('/match/id'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ class moodle1_qtype_multichoice_handler extends moodle1_qtype_handler {
|
||||
'answernumbering' => 'abc',
|
||||
));
|
||||
}
|
||||
$this->write_multichoice($data['multichoice'], $data['oldquestiontextformat']);
|
||||
$this->write_multichoice($data['multichoice'], $data['oldquestiontextformat'], $data['id']);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -73,8 +73,9 @@ class moodle1_qtype_multichoice_handler extends moodle1_qtype_handler {
|
||||
*
|
||||
* @param array $multichoices the grouped structure
|
||||
* @param int $oldquestiontextformat - {@see moodle1_question_bank_handler::process_question()}
|
||||
* @param int $questionid question id
|
||||
*/
|
||||
protected function write_multichoice(array $multichoices, $oldquestiontextformat) {
|
||||
protected function write_multichoice(array $multichoices, $oldquestiontextformat, $questionid) {
|
||||
global $CFG;
|
||||
|
||||
// the grouped array is supposed to have just one element - let us use foreach anyway
|
||||
@@ -101,6 +102,13 @@ class moodle1_qtype_multichoice_handler extends moodle1_qtype_handler {
|
||||
$multichoice['incorrectfeedbackformat'] = $oldquestiontextformat;
|
||||
}
|
||||
|
||||
$multichoice['correctfeedback'] = $this->migrate_files(
|
||||
$multichoice['correctfeedback'], 'question', 'correctfeedback', $questionid);
|
||||
$multichoice['partiallycorrectfeedback'] = $this->migrate_files(
|
||||
$multichoice['partiallycorrectfeedback'], 'question', 'partiallycorrectfeedback', $questionid);
|
||||
$multichoice['incorrectfeedback'] = $this->migrate_files(
|
||||
$multichoice['incorrectfeedback'], 'question', 'incorrectfeedback', $questionid);
|
||||
|
||||
$this->write_xml('multichoice', $multichoice, array('/multichoice/id'));
|
||||
}
|
||||
}
|
||||
|
||||
+25
-7
@@ -641,8 +641,11 @@ abstract class repository {
|
||||
public final function check_capability() {
|
||||
global $USER;
|
||||
|
||||
// The context we are on.
|
||||
$currentcontext = $this->context;
|
||||
|
||||
// Ensure that the user can view the repository in the current context.
|
||||
$can = has_capability('repository/'.$this->type.':view', $this->context);
|
||||
$can = has_capability('repository/'.$this->type.':view', $currentcontext);
|
||||
|
||||
// Context in which the repository has been created.
|
||||
$repocontext = context::instance_by_id($this->instance->contextid);
|
||||
@@ -652,14 +655,29 @@ abstract class repository {
|
||||
$can = false;
|
||||
}
|
||||
|
||||
// Ensure that the user can view the repository in the context of the repository.
|
||||
// Ne need to perform the check when already disallowed.
|
||||
// We are going to ensure that the current context was legit, and reliable to check
|
||||
// the capability against. (No need to do that if we already cannot).
|
||||
if ($can) {
|
||||
if ($repocontext->contextlevel == CONTEXT_USER && $repocontext->instanceid != $USER->id) {
|
||||
// Prevent URL hijack to access someone else's repository.
|
||||
$can = false;
|
||||
if ($repocontext->contextlevel == CONTEXT_USER) {
|
||||
// The repository is a user instance, ensure we're the right user to access it!
|
||||
if ($repocontext->instanceid != $USER->id) {
|
||||
$can = false;
|
||||
}
|
||||
} else if ($repocontext->contextlevel == CONTEXT_COURSE) {
|
||||
// The repository is a course one. Let's check that we are on the right course.
|
||||
if (in_array($currentcontext->contextlevel, array(CONTEXT_COURSE, CONTEXT_MODULE, CONTEXT_BLOCK))) {
|
||||
$coursecontext = $currentcontext->get_course_context();
|
||||
if ($coursecontext->instanceid != $repocontext->instanceid) {
|
||||
$can = false;
|
||||
}
|
||||
} else {
|
||||
// We are on a parent context, therefore it's legit to check the permissions
|
||||
// in the current context.
|
||||
}
|
||||
} else {
|
||||
$can = has_capability('repository/'.$this->type.':view', $repocontext);
|
||||
// Nothing to check here, system instances can have different permissions on different
|
||||
// levels. We do not want to prevent URL hack here, because it does not make sense to
|
||||
// prevent a user to access a repository in a context if it's accessible in another one.
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -306,7 +306,6 @@ h1.headermain {
|
||||
margin-right: auto;
|
||||
width: 100%;
|
||||
}
|
||||
#categoryquestions th,
|
||||
.user th,
|
||||
.user th.header,
|
||||
.group th.header,
|
||||
@@ -318,14 +317,12 @@ h1.headermain {
|
||||
border-bottom-color: #111;
|
||||
}
|
||||
.user th a:link,
|
||||
#categoryquestions th a:link,
|
||||
.group th a:link,
|
||||
.admin table tr th a:link {
|
||||
color: #FFF;
|
||||
text-decoration: none;
|
||||
}
|
||||
.user th a:visited,
|
||||
#categoryquestions th a:visited,
|
||||
.group th a:visited,
|
||||
.admin table tr th a:visited {
|
||||
color: #FFF;
|
||||
|
||||
@@ -99,6 +99,9 @@
|
||||
#page-question-preview #techinfo {
|
||||
margin: 1em 0;
|
||||
}
|
||||
#page-mod-quiz-edit #categoryquestions .header {
|
||||
background: none;
|
||||
}
|
||||
|
||||
/** Overide for RTL layout **/
|
||||
.dir-rtl #qtypechoicecontainer #chooseqtype .instruction,
|
||||
|
||||
@@ -1139,7 +1139,9 @@ div.questionbankwindow.block div.header {
|
||||
background: #eee !important;
|
||||
}
|
||||
|
||||
div.questionbankwindow.block div.header a {
|
||||
#page-mod-quiz-edit .questionbankwindow.block div.header div.title h2,
|
||||
#page-mod-quiz-edit .questionbankwindow a#showbankcmd,
|
||||
#page-mod-quiz-edit .questionbankwindow a#hidebankcmd {
|
||||
color: #333333 !important;
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
@@ -304,3 +304,9 @@ body.has_dock {
|
||||
-moz-box-shadow: 0px 1px 3px #ccc;
|
||||
box-shadow: 0px 1px 3px #ccc;
|
||||
}
|
||||
/* Question Bank Window
|
||||
-------------------------*/
|
||||
#page-mod-quiz-edit .questionbankwindow.block div.header {
|
||||
background-color: #9EB1BF;
|
||||
padding-top: 0;
|
||||
}
|
||||
@@ -59,11 +59,9 @@ body.splash-blue {
|
||||
.splash-blue .coursebox{
|
||||
border-bottom: 1px dashed #cbd3d6;
|
||||
}
|
||||
.splash-blue #categoryquestions tr th{
|
||||
background:#3d6276;
|
||||
}
|
||||
.splash-blue .path-mod-quiz .qnbutton {
|
||||
background:#3d6276; color:#fff;
|
||||
background:#3d6276;
|
||||
color:#fff;
|
||||
}
|
||||
.splash-blue .path-mod-quiz .qnbutton.open {
|
||||
background:#3d6276;
|
||||
|
||||
@@ -57,11 +57,9 @@ body.splash-green { background:url([[pix:theme|bggreen]]) top left repeat-x;
|
||||
.splash-green .coursebox{
|
||||
border-bottom: 1px dashed #dae0dc;
|
||||
}
|
||||
.splash-green #categoryquestions tr th{
|
||||
background:#446e4c;color:#fff;
|
||||
}
|
||||
.splash-green .path-mod-quiz .qnbutton{
|
||||
background:#446e4c;color:#fff;
|
||||
background:#446e4c;
|
||||
color:#fff;
|
||||
}
|
||||
.splash-green .path-mod-quiz .qnbutton.open{
|
||||
background:#446e4c;
|
||||
|
||||
@@ -50,7 +50,8 @@ body.splash-orange {
|
||||
color:#cb8f47;
|
||||
}
|
||||
.splash-orange .tabtree .tabrow0 .here a:hover{
|
||||
background:#fff;color: #5f564c;
|
||||
background:#fff;
|
||||
color: #5f564c;
|
||||
}
|
||||
.splash-orange .tabtree .here ul .here a.nolink:hover{
|
||||
color:#cb8f47;
|
||||
@@ -58,9 +59,6 @@ body.splash-orange {
|
||||
.splash-orange .coursebox{
|
||||
border-bottom:1px dashed #f0e7de;
|
||||
}
|
||||
.splash-orange #categoryquestions tr th{
|
||||
background:#cb8f47;
|
||||
}
|
||||
.splash-orange .path-mod-quiz .qnbutton{
|
||||
background:#cb8f47;
|
||||
}
|
||||
|
||||
@@ -299,6 +299,11 @@ h2.main,h3.main,h4.main,h5.main,h6.main{
|
||||
font-style:italic;
|
||||
padding:10px 30px;
|
||||
}
|
||||
.generalbox{
|
||||
display:block;
|
||||
margin-top:2px;
|
||||
width:98%;
|
||||
}
|
||||
.generalbox ul{
|
||||
padding:0 0 0 20px;
|
||||
}
|
||||
@@ -639,61 +644,57 @@ input[type=text],textarea,select,input[type=password]{
|
||||
font-weight:700;
|
||||
padding-top:12px;
|
||||
}
|
||||
table.quizreviewsummary {
|
||||
margin:10px 0 10px 30px;
|
||||
width:90%;
|
||||
}
|
||||
#page-mod-quiz-attempt .submitbtns,
|
||||
#page-mod-quiz-review .submitbtns,
|
||||
#page-mod-quiz-summary .submitbtns{
|
||||
padding:10px;
|
||||
}
|
||||
|
||||
#page-mod-quiz-edit .questionbankwindow div.header {
|
||||
font-size:1em;
|
||||
margin:0;
|
||||
padding:0;
|
||||
}
|
||||
|
||||
#page-mod-quiz-edit #region-main .questionbankwindow h2{
|
||||
#page-mod-quiz-edit #region-main .questionbankwindow h2 {
|
||||
background:none;
|
||||
font-size:1em;
|
||||
font-weight:700;
|
||||
margin:0;
|
||||
padding:10px 0 10px 10px;
|
||||
}
|
||||
|
||||
#page-mod-quiz-edit .questionbankwindow div.header a{
|
||||
#page-mod-quiz-edit .questionbankwindow div.header a {
|
||||
font-weight:400;
|
||||
}
|
||||
|
||||
#page-mod-quiz-edit div.quizpage .pagecontent .pagestatus
|
||||
{
|
||||
#page-mod-quiz-edit div.quizpage .pagecontent .pagestatus {
|
||||
font-weight:700;
|
||||
}
|
||||
|
||||
#page-mod-quiz-edit div.quizpage span.pagetitle{
|
||||
#page-mod-quiz-edit div.quizpage span.pagetitle {
|
||||
font-weight:700;
|
||||
margin-top:10px;
|
||||
}
|
||||
#page-mod-quiz-edit .editq div.question div.qnum{
|
||||
#page-mod-quiz-edit .editq div.question div.qnum {
|
||||
font-size:1.2em;
|
||||
font-weight:700;
|
||||
padding-top:3px;
|
||||
}
|
||||
table.quizreviewsummary{
|
||||
margin:10px 0 10px 30px;
|
||||
width:90%;
|
||||
#page-mod-quiz-edit .questionbank div.categoryquestionscontainer,
|
||||
#page-mod-quiz-edit .questionbank .categorysortopotionscontainer,
|
||||
#page-mod-quiz-edit .questionbank .categorypagingbarcontainer,
|
||||
#page-mod-quiz-edit .questionbank .categoryselectallcontainer {
|
||||
padding: 0;
|
||||
margin: 0 0.3em;
|
||||
}
|
||||
#categoryquestions tr th{
|
||||
border-bottom:0 none;
|
||||
#page-mod-quiz-edit form#displayoptions fieldset.invisiblefieldset div {
|
||||
margin: 0.3em;
|
||||
}
|
||||
.questioncategories{
|
||||
margin-bottom:10px;
|
||||
#page-mod-quiz-edit div.container div.generalbox {
|
||||
width: 100%;
|
||||
}
|
||||
.questionbank input[type=submit]{
|
||||
margin:5px;
|
||||
}
|
||||
.generalbox{
|
||||
display:block;
|
||||
margin-top:2px;
|
||||
width:98%;
|
||||
#page-mod-quiz-edit #categoryquestions .header {
|
||||
background: 0 none;
|
||||
}
|
||||
#page-admin-plugins #plugins-control-panel{
|
||||
display:block;
|
||||
|
||||
@@ -71,11 +71,11 @@ a:hover {
|
||||
color:#853650;
|
||||
}
|
||||
.path-mod-quiz .qnbutton {
|
||||
background:#853650;color:#fff;
|
||||
background:#853650;
|
||||
color:#fff;
|
||||
}
|
||||
.path-mod-quiz .qnbutton.open {
|
||||
background:#853650;}
|
||||
#categoryquestions tr th{background:#853650;
|
||||
background:#853650;
|
||||
}
|
||||
.pagelayout-redirect {
|
||||
border-top: 1px solid #6d1523;
|
||||
|
||||
+2
-2
@@ -30,11 +30,11 @@
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
|
||||
$version = 2012120302.00; // 20121203 = branching date YYYYMMDD - do not modify!
|
||||
$version = 2012120303.00; // 20121203 = branching date YYYYMMDD - do not modify!
|
||||
// RR = release increments - 00 in DEV branches
|
||||
// .XX = incremental changes
|
||||
|
||||
$release = '2.4.2 (Build: 20130311)'; // Human-friendly version name
|
||||
$release = '2.4.3 (Build: 20130318)'; // Human-friendly version name
|
||||
|
||||
$branch = '24'; // this version's branch
|
||||
$maturity = MATURITY_STABLE; // this version's maturity level
|
||||
|
||||
Reference in New Issue
Block a user