MDL-21693 Dropping _utf8 suffix from language codes and folder names; enabling new string managers - please note the transition is not yet fully complete because we need to wait for git to recognize the renames in cvs
This commit is contained in:
+1
-1
@@ -25,7 +25,7 @@ For more information, see the INSTALL DOCUMENTATION:
|
||||
|
||||
A local copy can also be found in
|
||||
|
||||
lang/en_utf8/help/install.html (or your language)
|
||||
lang/en/help/install.html (or your language)
|
||||
|
||||
|
||||
Good luck and have fun!
|
||||
|
||||
+13
-13
@@ -105,7 +105,7 @@ if (version_compare(phpversion(), "5.2.8") < 0) {
|
||||
|
||||
// set up configuration
|
||||
$CFG = new stdClass();
|
||||
$CFG->lang = 'en_utf8';
|
||||
$CFG->lang = 'en';
|
||||
$CFG->dirroot = str_replace('\\', '/', dirname(dirname(dirname(__FILE__)))); // Fix for win32
|
||||
$CFG->libdir = "$CFG->dirroot/lib";
|
||||
$CFG->wwwroot = "http://localhost";
|
||||
@@ -114,6 +114,8 @@ $CFG->dataroot = str_replace('\\', '/', dirname(dirname(dirname(__FI
|
||||
$CFG->docroot = 'http://docs.moodle.org';
|
||||
$CFG->directorypermissions = 00777;
|
||||
$CFG->running_installer = true;
|
||||
$CFG->early_install_lang = true;
|
||||
|
||||
$parts = explode('/', str_replace('\\', '/', dirname(dirname(__FILE__))));
|
||||
$CFG->admin = array_pop($parts);
|
||||
|
||||
@@ -170,10 +172,6 @@ $interactive = empty($options['non-interactive']);
|
||||
$lang = clean_param($options['lang'], PARAM_SAFEDIR);
|
||||
if (file_exists($CFG->dirroot.'/install/lang/'.$lang)) {
|
||||
$CFG->lang = $lang;
|
||||
} else {
|
||||
if (file_exists($CFG->dirroot.'/install/lang/'.$lang.'_utf8')) {
|
||||
$CFG->lang = $lang.'_utf8';
|
||||
}
|
||||
}
|
||||
|
||||
if ($unrecognized) {
|
||||
@@ -205,23 +203,23 @@ if ($interactive) {
|
||||
$langlist .= "\n";
|
||||
}
|
||||
}
|
||||
$default = str_replace('_utf8', '', $CFG->lang);
|
||||
$default = $CFG->lang;
|
||||
cli_heading(get_string('availablelangs', 'install'));
|
||||
echo $langlist."\n";
|
||||
$prompt = get_string('clitypevaluedefault', 'admin', $default);
|
||||
$prompt = get_string('clitypevaluedefault', 'admin', $CFG->lang);
|
||||
$error = '';
|
||||
do {
|
||||
echo $error;
|
||||
$input = cli_input($prompt, $default);
|
||||
$input = clean_param($input, PARAM_SAFEDIR);
|
||||
|
||||
if (!file_exists($CFG->dirroot.'/install/lang/'.$input.'_utf8')) {
|
||||
if (!file_exists($CFG->dirroot.'/install/lang/'.$input)) {
|
||||
$error = get_string('cliincorrectvalueretry', 'admin')."\n";
|
||||
} else {
|
||||
$error = '';
|
||||
}
|
||||
} while ($error !== '');
|
||||
$CFG->lang = $input.'_utf8';
|
||||
$CFG->lang = $input;
|
||||
} else {
|
||||
// already selected and verified
|
||||
}
|
||||
@@ -314,12 +312,12 @@ if ($interactive) {
|
||||
}
|
||||
|
||||
//download lang pack with optional notification
|
||||
if ($CFG->lang != 'en_utf8') {
|
||||
if ($cd = new component_installer('http://download.moodle.org', 'lang16', $CFG->lang.'.zip', 'languages.md5', 'lang')) {
|
||||
if ($CFG->lang != 'en') {
|
||||
if ($cd = new component_installer('http://download.moodle.org', 'lang20', $CFG->lang.'.zip', 'languages.md5', 'lang')) {
|
||||
if ($cd->install() == COMPONENT_ERROR) {
|
||||
if ($cd->get_error() == 'remotedownloaderror') {
|
||||
$a = new stdClass();
|
||||
$a->url = 'http://download.moodle.org/lang16/'.$CFG->lang.'.zip';
|
||||
$a->url = 'http://download.moodle.org/lang20/'.$CFG->lang.'.zip';
|
||||
$a->dest = $CFG->dataroot.'/lang';
|
||||
cli_problem(get_string($cd->get_error(), 'error', $a));
|
||||
} else {
|
||||
@@ -328,7 +326,7 @@ if ($CFG->lang != 'en_utf8') {
|
||||
} else {
|
||||
// install parent lang if defined
|
||||
if ($parentlang = get_parent_language()) {
|
||||
if ($cd = new component_installer('http://download.moodle.org', 'lang16', $parentlang.'.zip', 'languages.md5', 'lang')) {
|
||||
if ($cd = new component_installer('http://download.moodle.org', 'lang20', $parentlang.'.zip', 'languages.md5', 'lang')) {
|
||||
$cd->install();
|
||||
}
|
||||
}
|
||||
@@ -336,6 +334,8 @@ if ($CFG->lang != 'en_utf8') {
|
||||
}
|
||||
}
|
||||
|
||||
$CFG->early_install_lang = false;
|
||||
|
||||
// ask for db type - show only drivers available
|
||||
if ($interactive) {
|
||||
$options['dbtype'] = strtolower($options['dbtype']);
|
||||
|
||||
+21
-27
@@ -1,9 +1,11 @@
|
||||
<?php
|
||||
///This file only manages the installation of 1.6 lang packs.
|
||||
///in downloads.moodle.org, they are store in separate directory /lang16
|
||||
///This file only manages the installation of 2.0 lang packs.
|
||||
///in downloads.moodle.org, they are store in separate directory /lang20
|
||||
///in local server, they are stored in $CFG->dataroot/lang
|
||||
///This helps to avoid confusion.
|
||||
|
||||
die('Work in progress, to be replaced by the new language update interface...');
|
||||
|
||||
require_once('../config.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
require_once($CFG->libdir.'/filelib.php');
|
||||
@@ -60,7 +62,7 @@
|
||||
}
|
||||
|
||||
foreach ($packs as $pack) {
|
||||
if ($cd = new component_installer('http://download.moodle.org', 'lang16',
|
||||
if ($cd = new component_installer('http://download.moodle.org', 'lang20',
|
||||
$pack.'.zip', 'languages.md5', 'lang')) {
|
||||
$status = $cd->install(); //returns COMPONENT_(ERROR | UPTODATE | INSTALLED)
|
||||
switch ($status) {
|
||||
@@ -68,7 +70,7 @@
|
||||
case COMPONENT_ERROR:
|
||||
if ($cd->get_error() == 'remotedownloaderror') {
|
||||
$a = new object();
|
||||
$a->url = 'http://download.moodle.org/lang16/'.$pack.'.zip';
|
||||
$a->url = 'http://download.moodle.org/lang20/'.$pack.'.zip';
|
||||
$a->dest= $CFG->dataroot.'/lang';
|
||||
print_error($cd->get_error(), 'error', 'langimport.php', $a);
|
||||
} else {
|
||||
@@ -80,7 +82,7 @@
|
||||
$notice_ok[] = get_string('langpackinstalled','admin',$pack);
|
||||
if ($parentlang = get_parent_language($pack)) {
|
||||
// install also parent pack if specified
|
||||
if ($cd = new component_installer('http://download.moodle.org', 'lang16', $parentlang.'.zip', 'languages.md5', 'lang')) {
|
||||
if ($cd = new component_installer('http://download.moodle.org', 'lang20', $parentlang.'.zip', 'languages.md5', 'lang')) {
|
||||
$cd->install();
|
||||
}
|
||||
}
|
||||
@@ -99,8 +101,8 @@
|
||||
|
||||
case DELETION_OF_SELECTED_LANG: //delete a directory(ies) containing a lang pack completely
|
||||
|
||||
if ($uninstalllang == 'en_utf8') {
|
||||
$notice_error[] = 'en_utf8 can not be uninstalled!';
|
||||
if ($uninstalllang == 'en') {
|
||||
$notice_error[] = 'en can not be uninstalled!';
|
||||
|
||||
} else if (!$confirm && confirm_sesskey()) {
|
||||
echo $OUTPUT->header();
|
||||
@@ -139,7 +141,7 @@
|
||||
$md5array = array();
|
||||
$updated = 0; //any packs updated?
|
||||
$alllangs = array_keys(get_list_of_languages(false, true)); //get all available langs
|
||||
$lang16 = array(); //all the Moodle 1.6 unicode lang packs (updated and not updated)
|
||||
$lang20 = array(); //all the Moodle 1.6 unicode lang packs (updated and not updated)
|
||||
$packs = array(); //all the packs that needs updating
|
||||
|
||||
|
||||
@@ -162,12 +164,12 @@
|
||||
$dest2 = $CFG->dirroot.'/lang/'.$clang;
|
||||
|
||||
if (file_exists($dest1.'/langconfig.php') || file_exists($dest2.'/langconfig.php')){
|
||||
$lang16[] = $clang;
|
||||
$lang20[] = $clang;
|
||||
}
|
||||
}
|
||||
|
||||
//then filter out packs that have the same md5 key
|
||||
foreach ($lang16 as $clang) {
|
||||
foreach ($lang20 as $clang) {
|
||||
if (!is_installed_lang($clang, $md5array[$clang])){
|
||||
$packs[] = $clang;
|
||||
}
|
||||
@@ -176,7 +178,7 @@
|
||||
@mkdir ($CFG->dataroot.'/temp/', $CFG->directorypermissions);
|
||||
@mkdir ($CFG->dataroot.'/lang/', $CFG->directorypermissions);
|
||||
foreach ($packs as $pack){ //for each of the remaining in the list, we
|
||||
if ($pack == 'en_utf8') { // no update for en_utf8
|
||||
if ($pack == 'en') { // no update for en
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -201,7 +203,7 @@
|
||||
|
||||
//2. copy & unzip into new
|
||||
|
||||
if ($cd = new component_installer('http://download.moodle.org', 'lang16',
|
||||
if ($cd = new component_installer('http://download.moodle.org', 'lang20',
|
||||
$pack.'.zip', 'languages.md5', 'lang')) {
|
||||
$status = $cd->install(); //returns COMPONENT_(ERROR | UPTODATE | INSTALLED)
|
||||
switch ($status) {
|
||||
@@ -209,7 +211,7 @@
|
||||
case COMPONENT_ERROR:
|
||||
if ($cd->get_error() == 'remotedownloaderror') {
|
||||
$a = new stdClass();
|
||||
$a->url = 'http://download.moodle.org/lang16/'.$pack.'.zip';
|
||||
$a->url = 'http://download.moodle.org/lang20/'.$pack.'.zip';
|
||||
$a->dest= $CFG->dataroot.'/lang';
|
||||
print_error($cd->get_error(), 'error', "", $a); // not probable
|
||||
} else {
|
||||
@@ -251,7 +253,7 @@
|
||||
foreach($installedlangs as $l=>$unused) {
|
||||
$SESSION->lang = $l;
|
||||
$parent = get_string('parentlanguage');
|
||||
if ($parent == 'en_utf8') {
|
||||
if ($parent == 'en') {
|
||||
continue;
|
||||
}
|
||||
if (strpos($parent, '[[') !== false) {
|
||||
@@ -297,11 +299,7 @@
|
||||
$a->parent = $parent;
|
||||
foreach ($availablelangs as $alang) {
|
||||
if ($alang[0] == $parent) {
|
||||
if (substr($alang[0], -5) == '_utf8') { //Remove the _utf8 suffix from the lang to show
|
||||
$shortlang = substr($alang[0], 0, -5);
|
||||
} else {
|
||||
$shortlang = $alang[0];
|
||||
}
|
||||
$shortlang = $alang[0];
|
||||
$a->parent = $alang[2].' ('.$shortlang.')';
|
||||
}
|
||||
}
|
||||
@@ -359,18 +357,14 @@
|
||||
if ($alang[0] == '') {
|
||||
continue;
|
||||
}
|
||||
if (trim($alang[0]) != "en_utf8") {
|
||||
if (trim($alang[0]) != "en") {
|
||||
if ($remote) {
|
||||
if (substr($alang[0], -5) == '_utf8') { //Remove the _utf8 suffix from the lang to show
|
||||
$shortlang = substr($alang[0], 0, -5);
|
||||
} else {
|
||||
$shortlang = $alang[0];
|
||||
}
|
||||
$shortlang = $alang[0];
|
||||
if (!is_installed_lang($alang[0], $alang[1])){ //if not already installed
|
||||
echo '<option value="'.$alang[0].'">'.$alang[2].' ('.$shortlang.')</option>';
|
||||
}
|
||||
} else { //print list in local format, and instruction to install
|
||||
echo '<tr><td>'.$alang[2].'</td><td><a href="http://download.moodle.org/lang16/'.$alang[0].'.zip">'.get_string('download','admin').'</a></td></tr>';
|
||||
echo '<tr><td>'.$alang[2].'</td><td><a href="http://download.moodle.org/lang20/'.$alang[0].'.zip">'.get_string('download','admin').'</a></td></tr>';
|
||||
}
|
||||
$empty = 0;
|
||||
}
|
||||
@@ -433,7 +427,7 @@
|
||||
* @return array or false if can not download
|
||||
*/
|
||||
function get_remote_list_of_languages() {
|
||||
$source = 'http://download.moodle.org/lang16/languages.md5';
|
||||
$source = 'http://download.moodle.org/lang20/languages.md5';
|
||||
$availablelangs = array();
|
||||
|
||||
if ($content = download_file_content($source)) {
|
||||
|
||||
@@ -9,7 +9,7 @@ if ($hassiteconfig
|
||||
// "languageandlocation" settingpage
|
||||
$temp = new admin_settingpage('langsettings', get_string('languagesettings', 'admin'));
|
||||
$temp->add(new admin_setting_configcheckbox('autolang', get_string('autolang', 'admin'), get_string('configautolang', 'admin'), 1));
|
||||
$temp->add(new admin_setting_configselect('lang', get_string('lang', 'admin'), get_string('configlang', 'admin'), current_language(), get_list_of_languages())); // $CFG->lang might be set in installer already, default en or en_utf8 is in setup.php
|
||||
$temp->add(new admin_setting_configselect('lang', get_string('lang', 'admin'), get_string('configlang', 'admin'), current_language(), get_list_of_languages())); // $CFG->lang might be set in installer already, default en is in setup.php
|
||||
$temp->add(new admin_setting_configcheckbox('langmenu', get_string('langmenu', 'admin'), get_string('configlangmenu', 'admin'), 1));
|
||||
$temp->add(new admin_setting_langlist());
|
||||
$temp->add(new admin_setting_configcheckbox('langcache', get_string('langcache', 'admin'), get_string('configlangcache', 'admin'), 1));
|
||||
|
||||
@@ -25,7 +25,7 @@ Standard files
|
||||
Configuration file, mainly controlling default blocks for the format.
|
||||
See existing formats for examples.
|
||||
|
||||
* yourformat/lang/en_utf8/format_yourformat.php
|
||||
* yourformat/lang/en/format_yourformat.php
|
||||
|
||||
Language file containing basic language strings for your format. Here
|
||||
is a minimal language file:
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
|
||||
* @package
|
||||
*/
|
||||
//TODO (nfreear): Accessibility: evaluation, lang/en_utf8/moodle.php: $string['formattopicscss']
|
||||
//TODO (nfreear): Accessibility: evaluation, lang/en/moodle.php: $string['formattopicscss']
|
||||
|
||||
require_once($CFG->libdir.'/filelib.php');
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
|
||||
* @package
|
||||
*/
|
||||
//TODO (nfreear): Accessibility: evaluation, lang/en_utf8/moodle.php: $string['formatweekscss']
|
||||
//TODO (nfreear): Accessibility: evaluation, lang/en/moodle.php: $string['formatweekscss']
|
||||
|
||||
require_once($CFG->libdir.'/filelib.php');
|
||||
|
||||
|
||||
@@ -70,13 +70,13 @@ class multilang_filter extends moodle_text_filter {
|
||||
function multilang_filter_impl($langblock) {
|
||||
global $CFG;
|
||||
|
||||
$mylang = str_replace('_utf8', '', current_language());
|
||||
$mylang = current_language();
|
||||
static $parentcache;
|
||||
if (!isset($parentcache)) {
|
||||
$parentcache = array();
|
||||
}
|
||||
if (!array_key_exists($mylang, $parentcache)) {
|
||||
$parentlang = str_replace('_utf8', '', get_string('parentlanguage'));
|
||||
$parentlang = get_string('parentlanguage');
|
||||
$parentcache[$mylang] = $parentlang;
|
||||
} else {
|
||||
$parentlang = $parentcache[$mylang];
|
||||
@@ -91,7 +91,7 @@ function multilang_filter_impl($langblock) {
|
||||
|
||||
$langlist = array();
|
||||
foreach ($rawlanglist[1] as $index=>$lang) {
|
||||
$lang = str_replace('_utf8', '', str_replace('-','_',strtolower($lang))); // normalize languages
|
||||
$lang = str_replace('-','_',strtolower($lang)); // normalize languages
|
||||
$langlist[$lang] = $rawlanglist[2][$index];
|
||||
}
|
||||
|
||||
|
||||
@@ -12,205 +12,14 @@
|
||||
*/
|
||||
require_once('config.php');
|
||||
|
||||
// Get URL parameters.
|
||||
|
||||
// Legacy url parameters - just dispaply error
|
||||
$file = optional_param('file', '', PARAM_PATH);
|
||||
$text = optional_param('text', 'No text to display', PARAM_CLEAN);
|
||||
$module = optional_param('module', 'moodle', PARAM_ALPHAEXT);
|
||||
$forcelang = optional_param('forcelang', '', PARAM_SAFEDIR);
|
||||
$skiplocal = optional_param('skiplocal', 0, PARAM_INT); // shall _local help files be skipped?
|
||||
$fortooltip = optional_param('fortooltip', 0, PARAM_INT);
|
||||
|
||||
$PAGE->set_course($COURSE);
|
||||
// New get_string() parameters
|
||||
// $identifier =
|
||||
// $component =
|
||||
|
||||
$url = new moodle_url('/help.php');
|
||||
if ($file !== '') {
|
||||
$url->param('file', $file);
|
||||
}
|
||||
if ($text !== 'No text to display') {
|
||||
$url->param('text', $text);
|
||||
}
|
||||
if ($module !== 'moodle') {
|
||||
$url->param('module', $module);
|
||||
}
|
||||
if ($forcelang !== '') {
|
||||
$url->param('forcelang', $forcelang);
|
||||
}
|
||||
if ($skiplocal !== 0) {
|
||||
$url->param('skiplocal', $skiplocal);
|
||||
}
|
||||
if ($fortooltip !== 0) {
|
||||
$url->param('fortooltip', $fortooltip);
|
||||
}
|
||||
$PAGE->set_url($url);
|
||||
|
||||
// We look for the help to display in lots of different places, and
|
||||
// only display an error at the end if we can't find the help file
|
||||
// anywhere. This variable tracks that.
|
||||
$helpfound = false;
|
||||
|
||||
// Buffer output so that we can examine it later to extract metadata (page title)
|
||||
ob_start();
|
||||
|
||||
if (!empty($file)) {
|
||||
// The help to display is from a help file.
|
||||
list($filepath, $foundlang) = get_string_manager()->find_help_file($file, $module, $forcelang, $skiplocal);
|
||||
|
||||
if ($filepath) {
|
||||
$helpfound = true;
|
||||
@include($filepath); // The actual helpfile
|
||||
|
||||
// Now, we process some special cases.
|
||||
if ($module == 'moodle' and ($file == 'index.html' or $file == 'mods.html')) {
|
||||
include_help_for_each_module($file, $forcelang, $skiplocal);
|
||||
}
|
||||
if ($module == 'question' && $file == 'types.html') {
|
||||
include_help_for_each_qtype();
|
||||
}
|
||||
|
||||
// The remaining horrible hardcoded special cases should be delegated to modules somehow.
|
||||
if ($module == 'moodle' && $file == 'assignment/types.html') { // ASSIGNMENTS
|
||||
include_help_for_each_assignment_type($forcelang, $skiplocal);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// The help to display was given as an argument to this function.
|
||||
echo '<p>'.s($text).'</p>'; // This param was already cleaned
|
||||
$helpfound = true;
|
||||
}
|
||||
|
||||
// Finish buffer
|
||||
$output = ob_get_contents();
|
||||
|
||||
ob_end_clean();
|
||||
|
||||
if ($fortooltip) {
|
||||
echo shorten_text($output, 400, false, '<span class="readmore">' . get_string('clickhelpiconformoreinfo') . '</span>');
|
||||
die();
|
||||
}
|
||||
|
||||
// Determine title
|
||||
$title = get_string('help'); // Default is just 'Help'
|
||||
$matches = array();
|
||||
// You can include a <title> tag to override the standard behaviour:
|
||||
// 'Help - title contents'. Otherwise it looks for the text of the first
|
||||
// heading: 'Help - heading text'. If there aren't even any headings
|
||||
// you just get 'Help'
|
||||
if (preg_match('~^(.*?)<title>(.*?)</title>(.*)$~s', $output, $matches)) {
|
||||
// Extract title
|
||||
$title = $title.' - '.$matches[2];
|
||||
// Strip title from output
|
||||
$output = $matches[1].$matches[3];
|
||||
} else if(preg_match('~<h[0-9]+(\s[^>]*)?>(.*?)</h[0-9]+>~s',$output,$matches)) {
|
||||
// Use first heading as title (obviously leave it in output too). Strip
|
||||
// any tags from inside
|
||||
$matches[2] = preg_replace('~<[^>]*>~s','',$matches[2]);
|
||||
$title = $title.' - '.$matches[2];
|
||||
}
|
||||
|
||||
// use ##emoticons_html## to replace the emoticons documentation
|
||||
if(preg_match('~(##emoticons_html##)~', $output, $matches)) {
|
||||
$output = preg_replace('~(##emoticons_html##)~', get_emoticons_list_for_help_file(), $output);
|
||||
}
|
||||
|
||||
// Do the main output.
|
||||
$PAGE->set_pagelayout('popup');
|
||||
$PAGE->set_title($title);
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->box_start();
|
||||
print $output;
|
||||
echo $OUTPUT->box_end();
|
||||
|
||||
// Display an error if necessary.
|
||||
if (!$helpfound) {
|
||||
echo $OUTPUT->notification('Help file "'. $file .'" could not be found!');
|
||||
}
|
||||
|
||||
// End of page.
|
||||
echo $OUTPUT->close_window_button();
|
||||
echo '<p class="helpindex"><a href="help.php?file=index.html">'. get_string('helpindex') .'</a></p>';
|
||||
|
||||
// Offer a link to the alternative help file language
|
||||
$currentlang = current_language();
|
||||
if ($file && $helpfound && ($foundlang != 'en_utf8' || ($forcelang == 'en_utf8' && current_language() != 'en_utf8'))) {
|
||||
$url = new moodle_url($PAGE->url);
|
||||
if ($foundlang != 'en_utf8') {
|
||||
$url->param('forcelang', 'en_utf8');
|
||||
$nextlangname = get_string('english');
|
||||
} else {
|
||||
$url->param('forcelang', $currentlang);
|
||||
$nextlangname = get_string('thislanguage');
|
||||
}
|
||||
echo '<p><a href="' . $url->out() . '">' . get_string('showthishelpinlanguage', 'moodle', $nextlangname) . '</a></p>';
|
||||
}
|
||||
|
||||
$CFG->docroot = ''; // We don't want a doc link here
|
||||
echo $OUTPUT->footer();
|
||||
|
||||
function file_exists_and_readable($filepath) {
|
||||
return file_exists($filepath) and is_file($filepath) and is_readable($filepath);
|
||||
}
|
||||
|
||||
// Some functions for handling special cases ========================================
|
||||
|
||||
function include_help_for_each_module($file, $forcelang, $skiplocal) {
|
||||
global $CFG, $DB;
|
||||
|
||||
if (!$modules = $DB->get_records('modules', array('visible'=> 1))) {
|
||||
print_error('nomodules', 'debug'); // Should never happen
|
||||
}
|
||||
|
||||
// Horrible hack to show the help about grades here too.
|
||||
$grade = new stdClass();
|
||||
$grade->name = 'grade';
|
||||
$modules[] = $grade;
|
||||
|
||||
foreach ($modules as $mod) {
|
||||
$strmodulename = get_string('modulename', $mod->name);
|
||||
$modulebyname[$strmodulename] = $mod;
|
||||
}
|
||||
ksort($modulebyname, SORT_LOCALE_STRING);
|
||||
|
||||
foreach ($modulebyname as $mod) {
|
||||
list($filepath, $foundlang) = get_string_manager()->find_help_file($file, $mod->name, $forcelang, $skiplocal);
|
||||
if ($filepath) {
|
||||
echo '<hr />';
|
||||
include($filepath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function include_help_for_each_qtype() {
|
||||
global $CFG;
|
||||
require_once($CFG->libdir . '/questionlib.php');
|
||||
global $QTYPES;
|
||||
$types = question_type_menu();
|
||||
$fakeqtypes = array();
|
||||
foreach ($types as $qtype => $localizedname) {
|
||||
if ($QTYPES[$qtype]->is_real_question_type()) {
|
||||
include_help_for_qtype($qtype, $localizedname);
|
||||
} else {
|
||||
$fakeqtypes[$qtype] = $localizedname;
|
||||
}
|
||||
}
|
||||
foreach ($fakeqtypes as $qtype => $localizedname) {
|
||||
include_help_for_qtype($qtype, $localizedname);
|
||||
}
|
||||
}
|
||||
function include_help_for_qtype($qtype, $localizedname) {
|
||||
echo '<h2>' . $localizedname . "</h2>\n\n";
|
||||
echo '<p>' . get_string($qtype . 'summary', 'qtype_' . $qtype) . "</p>\n\n";
|
||||
}
|
||||
|
||||
function include_help_for_each_assignment_type() {
|
||||
global $CFG;
|
||||
|
||||
require_once($CFG->dirroot .'/mod/assignment/lib.php');
|
||||
$typelist = assignment_types();
|
||||
|
||||
foreach ($typelist as $type => $name) {
|
||||
echo '<h2>'.$name.'</h2>';
|
||||
echo get_string('help'.$type, 'assignment');
|
||||
echo '<hr />';
|
||||
}
|
||||
}
|
||||
?>
|
||||
die('TODO: help files will be soon reimplemented by using normal get_string().');
|
||||
|
||||
+14
-7
@@ -27,7 +27,7 @@
|
||||
if (isset($_REQUEST['lang'])) {
|
||||
$lang = preg_replace('/[^A-Za-z0-9_-]/i', '', $_REQUEST['lang']);
|
||||
} else {
|
||||
$lang = 'en_utf8';
|
||||
$lang = 'en';
|
||||
}
|
||||
|
||||
if (isset($_REQUEST['admin'])) {
|
||||
@@ -148,6 +148,7 @@ $CFG->admin = $config->admin;
|
||||
$CFG->docroot = 'http://docs.moodle.org';
|
||||
$CFG->directorypermissions = 00777;
|
||||
$CFG->running_installer = true;
|
||||
$CFG->early_install_lang = true;
|
||||
|
||||
// Require all needed libs
|
||||
require_once($CFG->libdir.'/setuplib.php');
|
||||
@@ -241,6 +242,8 @@ if ($config->stage > INSTALL_SAVE) {
|
||||
|
||||
|
||||
if ($config->stage == INSTALL_SAVE) {
|
||||
$CFG->early_install_lang = false;
|
||||
|
||||
$database = moodle_database::get_driver_instance($config->dbtype, 'native');
|
||||
if (!$database->driver_installed()) {
|
||||
$config->stage = INSTALL_DATABASETYPE;
|
||||
@@ -332,7 +335,7 @@ if ($config->stage == INSTALL_DOWNLOADLANG) {
|
||||
|
||||
if ($config->stage == INSTALL_DOWNLOADLANG) {
|
||||
// no need to download anything if en lang selected
|
||||
if ($CFG->lang == 'en_utf8') {
|
||||
if ($CFG->lang == 'en') {
|
||||
$config->stage = INSTALL_DATABASETYPE;
|
||||
}
|
||||
}
|
||||
@@ -355,11 +358,11 @@ if ($config->stage == INSTALL_DOWNLOADLANG) {
|
||||
$downloaderror = get_string('cannotcreatelangdir', 'error');
|
||||
|
||||
// Download and install lang component
|
||||
} else if ($cd = new component_installer('http://download.moodle.org', 'lang16', $CFG->lang.'.zip', 'languages.md5', 'lang')) {
|
||||
} else if ($cd = new component_installer('http://download.moodle.org', 'lang20', $CFG->lang.'.zip', 'languages.md5', 'lang')) {
|
||||
if ($cd->install() == COMPONENT_ERROR) {
|
||||
if ($cd->get_error() == 'remotedownloaderror') {
|
||||
$a = new stdClass();
|
||||
$a->url = 'http://download.moodle.org/lang16/'.$INSTALL['language'].'.zip';
|
||||
$a->url = 'http://download.moodle.org/lang20/'.$INSTALL['language'].'.zip';
|
||||
$a->dest = $CFG->dataroot.'/lang';
|
||||
$downloaderror = get_string($cd->get_error(), 'error', $a);
|
||||
} else {
|
||||
@@ -368,7 +371,7 @@ if ($config->stage == INSTALL_DOWNLOADLANG) {
|
||||
} else {
|
||||
// install parent lang if defined
|
||||
if ($parentlang = get_parent_language()) {
|
||||
if ($cd = new component_installer('http://download.moodle.org', 'lang16', $parentlang.'.zip', 'languages.md5', 'lang')) {
|
||||
if ($cd = new component_installer('http://download.moodle.org', 'lang20', $parentlang.'.zip', 'languages.md5', 'lang')) {
|
||||
$cd->install();
|
||||
}
|
||||
}
|
||||
@@ -390,6 +393,8 @@ if ($config->stage == INSTALL_DOWNLOADLANG) {
|
||||
|
||||
|
||||
if ($config->stage == INSTALL_DATABASE) {
|
||||
$CFG->early_install_lang = false;
|
||||
|
||||
$database = moodle_database::get_driver_instance($config->dbtype, 'native');
|
||||
|
||||
$sub = '<h3>'.$database->get_name().'</h3>'.$database->get_configuration_help();
|
||||
@@ -444,6 +449,8 @@ if ($config->stage == INSTALL_DATABASE) {
|
||||
|
||||
|
||||
if ($config->stage == INSTALL_DATABASETYPE) {
|
||||
$CFG->early_install_lang = false;
|
||||
|
||||
// Finally ask for DB type
|
||||
install_print_header($config, get_string('database', 'install'),
|
||||
get_string('databasetypehead', 'install'),
|
||||
@@ -487,8 +494,8 @@ if ($config->stage == INSTALL_DATABASETYPE) {
|
||||
|
||||
if ($config->stage == INSTALL_ENVIRONMENT or $config->stage == INSTALL_PATHS) {
|
||||
$version_fail = (version_compare(phpversion(), "5.2.8") < 0);
|
||||
$curl_fail = ($lang !== 'en_utf8' and !extension_loaded('curl')); // needed for lang pack download
|
||||
$zip_fail = ($lang !== 'en_utf8' and !extension_loaded('zip')); // needed for lang pack download
|
||||
$curl_fail = ($lang !== 'en' and !extension_loaded('curl')); // needed for lang pack download
|
||||
$zip_fail = ($lang !== 'en' and !extension_loaded('zip')); // needed for lang pack download
|
||||
|
||||
if ($version_fail or $curl_fail or $zip_fail) {
|
||||
$config->stage = INSTALL_ENVIRONMENT;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user