Merged fixes for RTL support in 1.8 from Sharar Dolev and the Hebrew translation team
see MDL-10768
This commit is contained in:
@@ -308,7 +308,7 @@
|
||||
}
|
||||
if ($remote) {
|
||||
echo '</select>';
|
||||
echo '<br /><input type="submit" value="← '.get_string('install','admin').'" />';
|
||||
echo '<br /><input type="submit" value="'.$THEME->larrow.' '.get_string('install','admin').'" />';
|
||||
}
|
||||
echo '</fieldset>';
|
||||
echo '</form>';
|
||||
|
||||
@@ -324,6 +324,15 @@ class block_base {
|
||||
$this->str->assignroles = get_string('assignroles', 'role');
|
||||
}
|
||||
|
||||
// RTL support - exchange right and left arrows
|
||||
if (right_to_left()) {
|
||||
$rightarrow = 'left.gif';
|
||||
$leftarrow = 'right.gif';
|
||||
} else {
|
||||
$rightarrow = 'right.gif';
|
||||
$leftarrow = 'left.gif';
|
||||
}
|
||||
|
||||
$movebuttons = '<div class="commands">';
|
||||
|
||||
if ($this->instance->visible) {
|
||||
@@ -362,7 +371,7 @@ class block_base {
|
||||
|
||||
if ($options & BLOCK_MOVE_LEFT) {
|
||||
$movebuttons .= '<a class="icon left" title="'. $this->str->moveleft .'" href="'.$script.'&blockaction=moveleft">' .
|
||||
'<img src="'. $CFG->pixpath .'/t/left.gif" alt="'. $this->str->moveleft .'" /></a>';
|
||||
'<img src="'. $CFG->pixpath .'/t/'.$leftarrow.'" alt="'. $this->str->moveleft .'" /></a>';
|
||||
}
|
||||
if ($options & BLOCK_MOVE_UP) {
|
||||
$movebuttons .= '<a class="icon up" title="'. $this->str->moveup .'" href="'.$script.'&blockaction=moveup">' .
|
||||
@@ -374,7 +383,7 @@ class block_base {
|
||||
}
|
||||
if ($options & BLOCK_MOVE_RIGHT) {
|
||||
$movebuttons .= '<a class="icon right" title="'. $this->str->moveright .'" href="'.$script.'&blockaction=moveright">' .
|
||||
'<img src="'. $CFG->pixpath .'/t/right.gif" alt="'. $this->str->moveright .'" /></a>';
|
||||
'<img src="'. $CFG->pixpath .'/t/'.$rightarrow.'" alt="'. $this->str->moveright .'" /></a>';
|
||||
}
|
||||
|
||||
$movebuttons .= '</div>';
|
||||
|
||||
+11
-2
@@ -2309,16 +2309,25 @@ function make_editing_buttons($mod, $absolute=false, $moveselect=true, $indent=-
|
||||
}
|
||||
|
||||
$leftright = "";
|
||||
|
||||
if (right_to_left()) { // Exchange arrows on RTL
|
||||
$rightarrow = 'left.gif';
|
||||
$leftarrow = 'right.gif';
|
||||
} else {
|
||||
$rightarrow = 'right.gif';
|
||||
$leftarrow = 'left.gif';
|
||||
}
|
||||
|
||||
if ($indent > 0) {
|
||||
$leftright .= '<a class="editing_moveleft" title="'.$str->moveleft.'" href="'.$path.'/mod.php?id='.$mod->id.
|
||||
'&indent=-1&sesskey='.$sesskey.$section.'"><img'.
|
||||
' src="'.$CFG->pixpath.'/t/left.gif" class="iconsmall" '.
|
||||
' src="'.$CFG->pixpath.'/t/'.$leftarrow.'" class="iconsmall" '.
|
||||
' alt="'.$str->moveleft.'" /></a>'."\n";
|
||||
}
|
||||
if ($indent >= 0) {
|
||||
$leftright .= '<a class="editing_moveright" title="'.$str->moveright.'" href="'.$path.'/mod.php?id='.$mod->id.
|
||||
'&indent=1&sesskey='.$sesskey.$section.'"><img'.
|
||||
' src="'.$CFG->pixpath.'/t/right.gif" class="iconsmall" '.
|
||||
' src="'.$CFG->pixpath.'/t/'.$rightarrow.'" class="iconsmall" '.
|
||||
' alt="'.$str->moveright.'" /></a>'."\n";
|
||||
}
|
||||
|
||||
|
||||
+9
-6
@@ -549,7 +549,7 @@ if ($nextstage == SAVE) {
|
||||
//==========================================================================//
|
||||
|
||||
?>
|
||||
<html dir="<?php echo (get_string('this_direction') == 'rtl') ? 'rtl' : 'ltr' ?>">
|
||||
<html dir="<?php echo right_to_left() ? 'rtl' : 'ltr' ?>">
|
||||
<head>
|
||||
<link rel="shortcut icon" href="theme/standard/favicon.ico" />
|
||||
<title>Moodle Install</title>
|
||||
@@ -670,7 +670,7 @@ if ($nextstage == SAVE) {
|
||||
echo "</table>\n";
|
||||
|
||||
echo "<hr />\n";
|
||||
echo "<div style=\"text-align: left\">\n";
|
||||
echo "<div style=\"text-align: ".fix_align_rtl("left")."\">\n";
|
||||
echo "<pre>\n";
|
||||
print_r(s($str));
|
||||
echo "</pre>\n";
|
||||
@@ -924,8 +924,8 @@ function form_table($nextstage = WELCOME, $formaction = "install.php") {
|
||||
}
|
||||
?>
|
||||
|
||||
<?php echo ($nextstage < SAVE) ? "<input type=\"submit\" name=\"next\" value=\"".get_string('next')." »\" style=\"float: right\"/>\n" : " \n" ?>
|
||||
<?php echo ($nextstage > WELCOME) ? "<input type=\"submit\" name=\"prev\" value=\"« ".get_string('previous')."\" style=\"float: left\"/>\n" : " \n" ?>
|
||||
<?php echo ($nextstage < SAVE) ? "<input type=\"submit\" name=\"next\" value=\"".get_string('next')." »\" style=\"float: ".fix_align_rtl("right")."\"/>\n" : " \n" ?>
|
||||
<?php echo ($nextstage > WELCOME) ? "<input type=\"submit\" name=\"prev\" value=\"« ".get_string('previous')."\" style=\"float: ".fix_align_rtl("left")."\"/>\n" : " \n" ?>
|
||||
|
||||
<?php
|
||||
if ($needtoopenform) {
|
||||
@@ -1106,11 +1106,11 @@ function css_styles() {
|
||||
width: 500px;
|
||||
}
|
||||
.td_left {
|
||||
text-align: right;
|
||||
text-align: <?php echo fix_align_rtl("right") ?>;
|
||||
font-weight: bold;
|
||||
}
|
||||
.td_right {
|
||||
text-align: left;
|
||||
text-align: <?php echo fix_align_rtl("left") ?>;
|
||||
}
|
||||
.main {
|
||||
width: 500px;
|
||||
@@ -1204,6 +1204,9 @@ function css_styles() {
|
||||
#mysql, #postgres7, #mssql, #mssql_n, #odbc_mssql, #oci8po {
|
||||
display: none;
|
||||
}
|
||||
#menulanguage {
|
||||
direction: ltr;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
|
||||
@@ -728,7 +728,7 @@ HTMLArea.prototype.generate = function () {
|
||||
html += '<meta http-equiv="content-type" content="text/html; charset=utf-8" />\n';
|
||||
if (editor.config.baseURL)
|
||||
html += '<base href="' + editor.config.baseURL + '" />';
|
||||
html += '<style type="text/css">\n' + editor.config.pageStyle + "td { border: 1px dotted gray; }</style>\n";
|
||||
html += '<style type="text/css">\n' + editor.config.pageStyle + "td { border: 1px dotted gray; } body { direction: <?php echo get_string('thisdirection')?>; } </style>\n"; // RTL support: direction added for RTL support
|
||||
html += "</head>\n";
|
||||
html += '<body>\n';
|
||||
html += editor._textArea.value;
|
||||
|
||||
@@ -84,8 +84,13 @@ class MoodleQuickForm_date_time_selector extends MoodleQuickForm_group{
|
||||
$this->_elements[] =& MoodleQuickForm::createElement('select', 'day', get_string('day', 'form'), $days, $this->getAttributes(), true);
|
||||
$this->_elements[] =& MoodleQuickForm::createElement('select', 'month', get_string('month', 'form'), $months, $this->getAttributes(), true);
|
||||
$this->_elements[] =& MoodleQuickForm::createElement('select', 'year', get_string('year', 'form'), $years, $this->getAttributes(), true);
|
||||
$this->_elements[] =& MoodleQuickForm::createElement('select', 'hour', get_string('hour', 'form'), $hours, $this->getAttributes(), true);
|
||||
$this->_elements[] =& MoodleQuickForm::createElement('select', 'minute', get_string('minute', 'form'), $minutes, $this->getAttributes(), true);
|
||||
if (right_to_left()) { // Switch order of elements for Right-to-Left
|
||||
$this->_elements[] =& MoodleQuickForm::createElement('select', 'minute', get_string('minute', 'form'), $minutes, $this->getAttributes(), true);
|
||||
$this->_elements[] =& MoodleQuickForm::createElement('select', 'hour', get_string('hour', 'form'), $hours, $this->getAttributes(), true);
|
||||
} else {
|
||||
$this->_elements[] =& MoodleQuickForm::createElement('select', 'hour', get_string('hour', 'form'), $hours, $this->getAttributes(), true);
|
||||
$this->_elements[] =& MoodleQuickForm::createElement('select', 'minute', get_string('minute', 'form'), $minutes, $this->getAttributes(), true);
|
||||
}
|
||||
// If optional we add a checkbox which the user can use to turn if on
|
||||
if($this->_options['optional']) {
|
||||
$this->_elements[] =& MoodleQuickForm::createElement('checkbox', 'off', null, get_string('disable'), $this->getAttributes(), true);
|
||||
|
||||
+45
-1
@@ -2745,6 +2745,12 @@ function theme_setup($theme = '', $params=NULL) {
|
||||
}
|
||||
}
|
||||
|
||||
/// RTL support - only for RTL languages, add RTL CSS
|
||||
if (get_string('thisdirection') == 'rtl') {
|
||||
$CFG->stylesheets[] = $CFG->themewww.'/standard/rtl.css'.$paramstring;
|
||||
$CFG->stylesheets[] = $CFG->themewww.'/'.$theme.'/rtl.css'.$paramstring;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -2853,6 +2859,13 @@ function check_theme_arrows() {
|
||||
$THEME->rarrow = '>';
|
||||
$THEME->larrow = '<';
|
||||
}
|
||||
|
||||
/// RTL support - in RTL languages, swap r and l arrows
|
||||
if (right_to_left()) {
|
||||
$t = $THEME->rarrow;
|
||||
$THEME->rarrow = $THEME->larrow;
|
||||
$THEME->larrow = $t;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3601,7 +3614,7 @@ function print_table($table, $return=false) {
|
||||
if (isset($table->align)) {
|
||||
foreach ($table->align as $key => $aa) {
|
||||
if ($aa) {
|
||||
$align[$key] = ' text-align:'. $aa.';';
|
||||
$align[$key] = ' text-align:'. fix_align_rtl($aa) .';'; // Fix for RTL languages
|
||||
} else {
|
||||
$align[$key] = '';
|
||||
}
|
||||
@@ -5970,5 +5983,36 @@ function print_location_comment($file, $line, $return = false)
|
||||
echo "<!-- $file at line $line -->\n";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns boolean true if the current language is right-to-left (Hebrew, Arabic etc)
|
||||
*
|
||||
*/
|
||||
function right_to_left() {
|
||||
static $result;
|
||||
|
||||
if (isset($result)) {
|
||||
return $result;
|
||||
}
|
||||
return $result = (get_string('thisdirection') == 'rtl');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns swapped left<=>right if in RTL environment.
|
||||
* part of RTL support
|
||||
*
|
||||
* @param string $align align to check
|
||||
* @return string
|
||||
*/
|
||||
function fix_align_rtl($align) {
|
||||
if (!right_to_left()) {
|
||||
return $align;
|
||||
}
|
||||
if ($align=='left') { return 'right'; }
|
||||
if ($align=='right') { return 'left'; }
|
||||
return $align;
|
||||
}
|
||||
|
||||
// vim:autoindent:expandtab:shiftwidth=4:tabstop=4:tw=140:
|
||||
?>
|
||||
|
||||
@@ -337,7 +337,7 @@ class quiz_report extends quiz_default_report {
|
||||
$responses[] = $response;
|
||||
}
|
||||
|
||||
$facility = format_float($q['facility']*100,0)." %";
|
||||
$facility = format_float($q['facility']*100,0)."%";
|
||||
$qsd = format_float($q['qsd'],3);
|
||||
$di = format_float($q['disc_index'],2);
|
||||
$dc = format_float($q['disc_coeff'],2);
|
||||
|
||||
+1
-1
@@ -199,7 +199,7 @@
|
||||
$a->grade = $grade;
|
||||
$a->maxgrade = $quiz->grade;
|
||||
$rawscore = round($attempt->sumgrades, $CFG->quiz_decimalpoints);
|
||||
$table->data[] = array("$strscore:", "$rawscore/$quiz->sumgrades ($percentage %)");
|
||||
$table->data[] = array("$strscore:", "$rawscore/$quiz->sumgrades ($percentage%)");
|
||||
$table->data[] = array("$strgrade:", get_string('outof', 'quiz', $a));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user