Skip to content

Commit

Permalink
Merge branch 'master' of git://github.com/moodle/moodle into master_M…
Browse files Browse the repository at this point in the history
…DL-30576
  • Loading branch information
mayankgupta committed Dec 12, 2011
2 parents b5a26fe + f89a83b commit 7ec0b1a
Show file tree
Hide file tree
Showing 472 changed files with 1,112 additions and 596 deletions.
13 changes: 12 additions & 1 deletion admin/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,16 @@ function admin_page_type_list($pagetype, $parentcontext, $currentcontext) {
'admin-*' => get_string('page-admin-x', 'pagetype'),
$pagetype => get_string('page-admin-current', 'pagetype')
);
// Add the missing * (any page) option for them. MDL-30340
// TODO: These pages are really 'pagetype-varying' - MDL-30564 -
// and some day we should stop behaving that way, so proper pagetypes
// can be specified for it (like course-category-* or so).
// Luckly... the option we are introducing '*' is independent
// of that varying behavior, so will work.
if ($pagetype == 'admin-course-category') {
$array += array(
'*' => get_string('page-x', 'pagetype')
);
}
return $array;
}
}
21 changes: 21 additions & 0 deletions admin/roles/admins.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,26 @@
}
}

} else if (optional_param('main', false, PARAM_BOOL) and confirm_sesskey()) {
if ($newmain = $admisselector->get_selected_users()) {
$newmain = reset($newmain);
$newmain = $newmain->id;
$admins = array();
foreach(explode(',', $CFG->siteadmins) as $admin) {
$admin = (int)$admin;
if ($admin) {
$admins[$admin] = $admin;
}
}

if (isset($admins[$newmain])) {
unset($admins[$newmain]);
array_unshift($admins, $newmain);
set_config('siteadmins', implode(',', $admins));
redirect($PAGE->url);
}
}

} else if ($confirmadd and confirm_sesskey()) {
$admins = array();
foreach(explode(',', $CFG->siteadmins) as $admin) {
Expand Down Expand Up @@ -115,6 +135,7 @@
<p class="arrow_button">
<input name="add" id="add" type="submit" value="<?php echo $OUTPUT->larrow().'&nbsp;'.get_string('add'); ?>" title="<?php print_string('add'); ?>" /><br />
<input name="remove" id="remove" type="submit" value="<?php echo get_string('remove').'&nbsp;'.$OUTPUT->rarrow(); ?>" title="<?php print_string('remove'); ?>" />
<input name="main" id="main" type="submit" value="<?php echo get_string('mainadminset', 'role'); ?>" title="<?php print_string('mainadminset', 'role'); ?>" />
</p>
</td>
<td id='potentialcell'>
Expand Down
28 changes: 23 additions & 5 deletions admin/roles/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -1584,13 +1584,31 @@ public function find_users($search) {
return array();
}

if ($search) {
$groupname = get_string('extusersmatching', 'role', $search);
} else {
$groupname = get_string('extusers', 'role');
$mainadmin = array();
$adminids = explode(',', $CFG->siteadmins);
foreach ($adminids as $id) {
if (isset($availableusers[$id])) {
$mainadmin = array($id=>$availableusers[$id]);
unset($availableusers[$id]);
break;
}
}

return array($groupname => $availableusers);
$result = array();
if ($mainadmin) {
$result[get_string('mainadmin', 'role')] = $mainadmin;
}

if ($availableusers) {
if ($search) {
$groupname = get_string('extusersmatching', 'role', $search);
} else {
$groupname = get_string('extusers', 'role');
}
$result[$groupname] = $availableusers;
}

return $result;
}

protected function get_options() {
Expand Down
1 change: 1 addition & 0 deletions admin/settings/security.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
$temp->add(new admin_setting_configcheckbox('cookiesecure', get_string('cookiesecure', 'admin'), get_string('configcookiesecure', 'admin'), 0));
$temp->add(new admin_setting_configcheckbox('cookiehttponly', get_string('cookiehttponly', 'admin'), get_string('configcookiehttponly', 'admin'), 0));
$temp->add(new admin_setting_configcheckbox('allowframembedding', get_string('allowframembedding', 'admin'), get_string('allowframembedding_help', 'admin'), 0));
$temp->add(new admin_setting_configcheckbox('loginpasswordautocomplete', get_string('loginpasswordautocomplete', 'admin'), get_string('loginpasswordautocomplete_help', 'admin'), 0));
$ADMIN->add('security', $temp);


Expand Down
3 changes: 2 additions & 1 deletion admin/tool/customlang/db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ function xmldb_tool_customlang_upgrade($oldversion) {

$dbman = $DB->get_manager();


// Moodle v2.2.0 release upgrade line
// Put any upgrade step following this

return true;
}
3 changes: 3 additions & 0 deletions auth/manual/db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,8 @@ function xmldb_auth_manual_upgrade($oldversion) {
// Moodle v2.1.0 release upgrade line
// Put any upgrade step following this

// Moodle v2.2.0 release upgrade line
// Put any upgrade step following this

return true;
}
3 changes: 3 additions & 0 deletions auth/mnet/db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,8 @@ function xmldb_auth_mnet_upgrade($oldversion) {
// Moodle v2.1.0 release upgrade line
// Put any upgrade step following this

// Moodle v2.2.0 release upgrade line
// Put any upgrade step following this

return true;
}
3 changes: 3 additions & 0 deletions blocks/community/db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,5 +76,8 @@ function xmldb_block_community_upgrade($oldversion) {
// Moodle v2.1.0 release upgrade line
// Put any upgrade step following this

// Moodle v2.2.0 release upgrade line
// Put any upgrade step following this

return true;
}
77 changes: 57 additions & 20 deletions blocks/edit_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,24 +93,44 @@ function definition() {
$mform->addElement('static', 'bui_homecontext', get_string('createdat', 'block'), print_context_name($parentcontext));
$mform->addHelpButton('bui_homecontext', 'createdat', 'block');

// For pre-calculated (fixed) pagetype lists
$pagetypelist = array();

// parse pagetype patterns
$bits = explode('-', $this->page->pagetype);

$contextoptions = array();
if ( ($parentcontext->contextlevel == CONTEXT_COURSE && $parentcontext->instanceid == SITEID) ||
($parentcontext->contextlevel == CONTEXT_SYSTEM)) { // Home page
if ($bits[0] == 'tag' || $bits[0] == 'admin') {
// tag and admin pages always use system context
// the contexts options don't make differences, so we use
// page type patterns only
$mform->addElement('hidden', 'bui_contexts', BUI_CONTEXTS_ENTIRE_SITE);
} else {
$contextoptions[BUI_CONTEXTS_FRONTPAGE_ONLY] = get_string('showonfrontpageonly', 'block');
$contextoptions[BUI_CONTEXTS_FRONTPAGE_SUBS] = get_string('showonfrontpageandsubs', 'block');
$contextoptions[BUI_CONTEXTS_ENTIRE_SITE] = get_string('showonentiresite', 'block');
$mform->addElement('select', 'bui_contexts', get_string('contexts', 'block'), $contextoptions);
$mform->addHelpButton('bui_contexts', 'contexts', 'block');
}
// First of all, check if we are editing blocks @ front-page or no and
// make some dark magic if so (MDL-30340) because each page context
// implies one (and only one) harcoded page-type that will be set later
// when processing the form data at {@link block_manager::process_url_edit()}

// There are some conditions to check related to contexts
$ctxconditions = $this->page->context->contextlevel == CONTEXT_COURSE &&
$this->page->context->instanceid == get_site()->id;
// And also some pagetype conditions
$pageconditions = isset($bits[0]) && isset($bits[1]) && $bits[0] == 'site' && $bits[1] == 'index';
// So now we can be 100% sure if edition is happening at frontpage
$editingatfrontpage = $ctxconditions && $pageconditions;

// Let the form to know about that, can be useful later
$mform->addElement('hidden', 'bui_editingatfrontpage', (int)$editingatfrontpage);

// Front page, show the page-contexts element and set $pagetypelist to 'any page' (*)
// as unique option. Processign the form will do any change if needed
if ($editingatfrontpage) {
$contextoptions = array();
$contextoptions[BUI_CONTEXTS_FRONTPAGE_ONLY] = get_string('showonfrontpageonly', 'block');
$contextoptions[BUI_CONTEXTS_FRONTPAGE_SUBS] = get_string('showonfrontpageandsubs', 'block');
$contextoptions[BUI_CONTEXTS_ENTIRE_SITE] = get_string('showonentiresite', 'block');
$mform->addElement('select', 'bui_contexts', get_string('contexts', 'block'), $contextoptions);
$mform->addHelpButton('bui_contexts', 'contexts', 'block');
$pagetypelist['*'] = '*'; // This is not going to be shown ever, it's an unique option

// Any other system context block, hide the page-contexts element,
// it's always system-wide BUI_CONTEXTS_ENTIRE_SITE
} else if ($parentcontext->contextlevel == CONTEXT_SYSTEM) {
$mform->addElement('hidden', 'bui_contexts', BUI_CONTEXTS_ENTIRE_SITE);

} else if ($parentcontext->contextlevel == CONTEXT_COURSE) {
// 0 means display on current context only, not child contexts
// but if course managers select mod-* as pagetype patterns, block system will overwrite this option
Expand All @@ -126,12 +146,10 @@ function definition() {
$mform->addElement('select', 'bui_contexts', get_string('contexts', 'block'), $contextoptions);
}

$displaypagetypewarning = false;
if ($this->page->pagetype == 'site-index') { // No need for pagetype list on home page
$pagetypelist = array('*'=>get_string('page-x', 'pagetype'));
} else {
// Generate pagetype patterns by callbacks
// Generate pagetype patterns by callbacks if necessary (has not been set specifically)
if (empty($pagetypelist)) {
$pagetypelist = generate_page_type_patterns($this->page->pagetype, $parentcontext, $this->page->context);
$displaypagetypewarning = false;
if (!array_key_exists($this->block->instance->pagetypepattern, $pagetypelist)) {
// Pushing block's existing page type pattern
$pagetypestringname = 'page-'.str_replace('*', 'x', $this->block->instance->pagetypepattern);
Expand All @@ -156,6 +174,25 @@ function definition() {
} else {
$value = array_pop(array_keys($pagetypelist));
$mform->addElement('hidden', 'bui_pagetypepattern', $value);
// Now we are really hiding a lot (both page-contexts and page-type-patterns),
// specially in some systemcontext pages having only one option (my/user...)
// so, until it's decided if we are going to add the 'bring-back' pattern to
// all those pages or no (see MDL-30574), we are going to show the unique
// element statically
// TODO: Revisit this once MDL-30574 has been decided and implemented, although
// perhaps it's not bad to always show this statically when only one pattern is
// available.
if (!$editingatfrontpage) {
// Try to beautify it
$strvalue = $value;
$strkey = 'page-'.str_replace('*', 'x', $strvalue);
if (get_string_manager()->string_exists($strkey, 'pagetype')) {
$strvalue = get_string($strkey, 'pagetype');
}
// Show as static (hidden has been set already)
$mform->addElement('static', 'bui_staticpagetypepattern',
get_string('restrictpagetypes','block'), $strvalue);
}
}

if ($this->page->subpage) {
Expand Down
3 changes: 3 additions & 0 deletions blocks/html/db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,8 @@ function xmldb_block_html_upgrade($oldversion) {
// Moodle v2.1.0 release upgrade line
// Put any upgrade step following this

// Moodle v2.2.0 release upgrade line
// Put any upgrade step following this

return true;
}
7 changes: 6 additions & 1 deletion blocks/login/block_login.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,12 @@ function get_content () {
$this->content->text .= '<input type="text" name="username" id="login_username" value="'.s($username).'" /></div>';

$this->content->text .= '<div class="c1 fld password"><label for="login_password">'.get_string('password').'</label>';
$this->content->text .= '<input type="password" name="password" id="login_password" value="" /></div>';

if (!empty($CFG->loginpasswordautocomplete)) {
$this->content->text .= '<input type="password" name="password" id="login_password" value="" autocomplete="off" /></div>';
} else {
$this->content->text .= '<input type="password" name="password" id="login_password" value="" /></div>';
}

if (isset($CFG->rememberusername) and $CFG->rememberusername == 2) {
$checked = $username ? 'checked="checked"' : '';
Expand Down
3 changes: 3 additions & 0 deletions blocks/navigation/db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,8 @@ function xmldb_block_navigation_upgrade($oldversion, $block) {
// Moodle v2.1.0 release upgrade line
// Put any upgrade step following this

// Moodle v2.2.0 release upgrade line
// Put any upgrade step following this

return true;
}
3 changes: 3 additions & 0 deletions blocks/settings/db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,8 @@ function xmldb_block_settings_upgrade($oldversion, $block) {
// Moodle v2.1.0 release upgrade line
// Put any upgrade step following this

// Moodle v2.2.0 release upgrade line
// Put any upgrade step following this

return true;
}
30 changes: 30 additions & 0 deletions course/format/scorm/version.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle 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 3 of the License, or
// (at your option) any later version.
//
// Moodle 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.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

/**
* Version details
*
* @package format
* @subpackage scorm
* @copyright 1999 onwards Martin Dougiamas (http://dougiamas.com)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

defined('MOODLE_INTERNAL') || die();

$plugin->version = 2011120100; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2011120100; // Requires this Moodle version
$plugin->component = 'format_scorm'; // Full name of the plugin (used for diagnostics)
30 changes: 30 additions & 0 deletions course/format/social/version.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle 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 3 of the License, or
// (at your option) any later version.
//
// Moodle 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.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

/**
* Version details
*
* @package format
* @subpackage social
* @copyright 1999 onwards Martin Dougiamas (http://dougiamas.com)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

defined('MOODLE_INTERNAL') || die();

$plugin->version = 2011120100; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2011120100; // Requires this Moodle version
$plugin->component = 'format_social'; // Full name of the plugin (used for diagnostics)
30 changes: 30 additions & 0 deletions course/format/topics/version.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle 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 3 of the License, or
// (at your option) any later version.
//
// Moodle 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.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

/**
* Version details
*
* @package format
* @subpackage topics
* @copyright 1999 onwards Martin Dougiamas (http://dougiamas.com)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

defined('MOODLE_INTERNAL') || die();

$plugin->version = 2011120100; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2011120100; // Requires this Moodle version
$plugin->component = 'format_topics'; // Full name of the plugin (used for diagnostics)
Loading

0 comments on commit 7ec0b1a

Please sign in to comment.