Skip to content
Browse files

Undoing last three commits - I did not realized they should go into t…

…he HEAD and not into the STABLE :-( I am sorry...

I rolled back using
cvs update -j 1.88.2.8 -j 1.88.2.5 lang.php
  • Loading branch information...
1 parent 46a4dde commit 331ecbe5b6f2f84012340f1d976248f9e703ba54 mudrd8mz committed Jun 17, 2007
Showing with 61 additions and 126 deletions.
  1. +61 −126 admin/lang.php
View
187 admin/lang.php
@@ -46,12 +46,8 @@
$strfilecreated = get_string('filecreated', 'admin');
$strprev = get_string('previous');
$strnext = get_string('next');
- $strlocalstringcustomization = 'Local string customization'; // TODO / FIXME
- $strlangpackmaintaining = 'Language pack maintaining'; // TODO / FIXME
- $strnomissingstrings = 'No missing strings'; // TODO / FIXME
- // TODO/FIXME add into en_utf8/admin.php:
- // $string['numberofmissingstrings'] = 'Number of missing strings: $a';
-
+
+
$currentlang = current_language();
switch ($mode) {
@@ -83,39 +79,14 @@
admin_externalpage_print_header($adminroot);
- // Prepare and render menu tabs
- $firstrow = array();
- $secondrow = array();
- $inactive = NULL;
- $activated = NULL;
- $currenttab = $mode;
- if ($uselocal) {
- $inactive = array('uselocal');
- $activated = array('uselocal');
- } else {
- $inactive = array('usemaster');
- $activated = array('usemaster');
- }
- $firstrow[] = new tabobject('uselocal',
- $CFG->wwwroot."/admin/lang.php?mode=$mode&currentfile=$currentfile&uselocal=1",
- $strlocalstringcustomization );
- $firstrow[] = new tabobject('usemaster',
- $CFG->wwwroot."/admin/lang.php?mode=$mode&currentfile=$currentfile&uselocal=0",
- $strlangpackmaintaining );
- $secondrow[] = new tabobject('missing', $CFG->wwwroot.'/admin/lang.php?mode=missing', $strmissingstrings );
- $secondrow[] = new tabobject('compare', $CFG->wwwroot.'/admin/lang.php?mode=compare', $streditstrings );
- // TODO
- // langdoc.php functionality is planned to be merged into lang.php
- $secondrow[] = new tabobject('langdoc', $CFG->wwwroot.'/admin/langdoc.php', $stredithelpdocs );
- $tabs = array($firstrow, $secondrow);
- print_tabs($tabs, $currenttab, $inactive, $activated);
-
-
if (!$mode) {
print_box_start();
$currlang = current_language();
$langs = get_list_of_languages(false, true);
popup_form ("$CFG->wwwroot/$CFG->admin/lang.php?lang=", $langs, "chooselang", $currlang, "", "", "", false, 'self', $strcurrentlanguage.':');
+ print_heading("<a href=\"lang.php?mode=missing\">$strmissingstrings</a>");
+ print_heading("<a href=\"lang.php?mode=compare\">$streditstrings</a>");
+ print_heading("<a href=\"langdoc.php\">$stredithelpdocs</a>");
print_box_end();
admin_externalpage_print_footer($adminroot);
exit;
@@ -308,21 +279,32 @@
unset($packstring);
}
+ print_heading_with_help($streditstrings, "langedit");
+
print_box_start('generalbox editstrings');
- $menufiles = array();
foreach ($stringfiles as $file) {
- $menufiles[$file] = $file;
+ if ($file == $currentfile) {
+ echo "<b>$file</b> &nbsp; ";
+ } else {
+ echo "<a href=\"lang.php?mode=compare&amp;currentfile=$file\">$file</a> &nbsp; ";
+ }
}
- popup_form("$CFG->wwwroot/$CFG->admin/lang.php?mode=compare&amp;currentfile=", $menufiles, "choosefile",
- $currentfile, $strchoosefiletoedit);
+ print_box_end();
+
+ print_heading("<a href=\"lang.php?mode=missing\">$strmissingstrings</a>", "center", 4); // one-click way back
- echo '<div class="filestorageinfobox">';
+ print_box_start();
echo $strfilestoredin;
- echo '<code class="path">';
echo $uselocal ? "{$currentlang}_local" : $currentlang;
- echo '</code>';
helpbutton('langswitchstorage', $strfilestoredinhelp, 'moodle');
- echo '</div>';
+
+ echo '<form '.$CFG->frametarget.' method="get" action="'.$CFG->wwwroot.'/'.$CFG->admin.'/lang.php">'.
+ '<div>'.
+ '<input type="hidden" name="mode" value="compare" />'.
+ '<input type="hidden" name="currentfile" value="'.$currentfile.'" />'.
+ '<input type="hidden" name="uselocal" value="'.(1 - $uselocal % 2).'" />'.
+ '<input type="submit" value="'.$strswitchlang.'" />'.
+ '</div></form>';
print_box_end();
if ($currentfile <> '') {
@@ -347,7 +329,11 @@
}
error_reporting($CFG->debug);
- $o = ''; // stores the HTML output to be echo-ed
+ print_heading("$currentfile", "", 4);
+ if (LANG_DISPLAY_MISSING_LINKS && $editable) {
+ print_heading('<a href="#missing1">'.$strgotofirst.'</a>', "", 4);
+ }
+
unset($string);
include("$enlangdir/$currentfile");
$enstring = $string;
@@ -368,36 +354,36 @@
@include("$langdir/$currentfile");
if ($editable) {
- $o .= "<form id=\"$currentfile\" action=\"lang.php\" method=\"post\">";
- $o .= '<div>';
+ echo "<form id=\"$currentfile\" action=\"lang.php\" method=\"post\">";
+ echo '<div>';
}
- $o .= "<table summary=\"\" width=\"100%\" class=\"translator\">";
+ echo "<table summary=\"\" width=\"100%\" class=\"translator\">";
$linescounter = 0;
$missingcounter = 0;
foreach ($enstring as $key => $envalue) {
$linescounter++ ;
if (LANG_SUBMIT_REPEAT && $editable && $linescounter % LANG_SUBMIT_REPEAT_EVERY == 0) {
- $o .= '<tr><td>&nbsp;</td><td><br />';
- $o .= '<input type="submit" name="update" value="'.get_string('savechanges').': '.$currentfile.'" />';
- $o .= '<br />&nbsp;</td></tr>';
+ echo '<tr><td>&nbsp;</td><td><br />';
+ echo ' <input type="submit" name="update" value="'.get_string('savechanges').': '.$currentfile.'" />';
+ echo '<br />&nbsp;</td></tr>';
}
$envalue = nl2br(htmlspecialchars($envalue));
$envalue = preg_replace('/(\$a\-\&gt;[a-zA-Z0-9]*|\$a)/', '<b>$0</b>', $envalue); // Make variables bold.
$envalue = str_replace("%%","%",$envalue);
$envalue = str_replace("\\","",$envalue); // Delete all slashes
- $o .= "\n\n".'<tr class="';
+ echo "\n\n".'<tr class="';
if ($linescounter % 2 == 0) {
- $o .= 'r0';
+ echo 'r0';
} else {
- $o .= 'r1';
+ echo 'r1';
}
- $o .= '">';
- $o .= '<td dir="ltr" lang="en">';
- $o .= '<span class="stren">'.$envalue.'</span>';
- $o .= '<br />'."\n";
- $o .= '<span class="strkey">'.$key.'</span>';
- $o .= '</td>'."\n";
+ echo '">';
+ echo '<td dir="ltr" lang="en">';
+ echo '<span class="stren">'.$envalue.'</span>';
+ echo '<br />'."\n";
+ echo '<span class="strkey">'.$key.'</span>';
+ echo '</td>'."\n";
// Missing array keys are not bugs here but missing strings
error_reporting(E_ALL ^ E_NOTICE);
@@ -447,7 +433,7 @@
}
if ($editable) {
- $o .= '<td '.$cellcolour.' valign="top">'. $missingprev . $missingtarget."\n";
+ echo '<td '.$cellcolour.' valign="top">'. $missingprev . $missingtarget."\n";
if (isset($string[$key])) {
$valuelen = strlen($value);
} else {
@@ -456,52 +442,40 @@
$cols=40;
if (strstr($value, "\r") or strstr($value, "\n") or $valuelen > $cols) {
$rows = ceil($valuelen / $cols);
- $o .= '<textarea name="stringXXX'.lang_form_string_key($key).'" cols="'.$cols.'" rows="'.$rows.'">'.$value.'</textarea>'."\n";
+ echo '<textarea name="stringXXX'.lang_form_string_key($key).'" cols="'.$cols.'" rows="'.$rows.'">'.$value.'</textarea>'."\n";
} else {
if ($valuelen) {
$cols = $valuelen + 5;
}
- $o .= '<input type="text" name="stringXXX'.lang_form_string_key($key).'" value="'.$value.'" size="'.$cols.'" />';
+ echo '<input type="text" name="stringXXX'.lang_form_string_key($key).'" value="'.$value.'" size="'.$cols.'" />';
}
if ($value2 <> '' && $value <> $value2) {
- $o .= '<br /><span style="font-size:small">'.$value2.'</span>';
+ echo '<br /><span style="font-size:small">'.$value2.'</span>';
}
- $o .= $missingnext . '</td>';
+ echo $missingnext . '</td>';
} else {
- $o .= '<td '.$cellcolour.' valign="top">'.$value.'</td>';
+ echo '<td '.$cellcolour.' valign="top">'.$value.'</td>';
}
- $o .= '</tr>'."\n";
+ echo '</tr>'."\n";
}
if ($editable) {
- $o .= '<tr><td>&nbsp;</td><td><br />';
- $o .= '<input type="hidden" name="sesskey" value="'.$USER->sesskey.'" />';
- $o .= '<input type="hidden" name="currentfile" value="'.$currentfile.'" />';
- $o .= '<input type="hidden" name="mode" value="compare" />';
- $o .= '<input type="submit" name="update" value="'.get_string('savechanges').': '.$currentfile.'" />';
- $o .= '</td></tr>';
+ echo '<tr><td>&nbsp;</td><td><br />';
+ echo '<input type="hidden" name="sesskey" value="'.$USER->sesskey.'" />';
+ echo ' <input type="hidden" name="currentfile" value="'.$currentfile.'" />';
+ echo ' <input type="hidden" name="mode" value="compare" />';
+ echo ' <input type="submit" name="update" value="'.get_string('savechanges').': '.$currentfile.'" />';
+ echo '</td></tr>';
}
- $o .= '</table>';
+ echo '</table>';
if ($editable) {
- $o .= '</div>';
- $o .= '</form>';
+ echo '</div>';
+ echo '</form>';
}
- if (LANG_DISPLAY_MISSING_LINKS) {
- if ($missingcounter > 0) {
- print_heading(get_string('numberofmissingstrings', 'admin', $missingcounter), '', 4);
- if ($editable) {
- print_heading('<a href="#missing1">'.$strgotofirst.'</a>', "", 4);
- }
- } else {
- print_heading($strnomissingstrings, '', 4, 'notifysuccess');
- }
- }
- echo $o;
-
} else {
// no $currentfile specified
- // no useful information to display - maybe some help? instructions?
+ print_heading($strchoosefiletoedit, "", 4);
}
}
@@ -730,44 +704,5 @@ function lang_xhtml_save_substr($str, $start, $length = NULL) {
}
}
-/**
-* Find all language location.
-*
-* Taken from lib/moodlelib.php::get_strig()
-*
-* @todo This is here just because I started to work on MDL-9361. It is not used yet. And maybe will not.
-*/
-function lang_locations($module = '') {
- global $CFG;
-
- // Default language packs locations
- $locations = array( $CFG->dataroot.'/lang/', $CFG->dirroot.'/lang/' );
-
- // Extra places to look for strings
- $rules = places_to_search_for_lang_strings();
- $exceptions = $rules['__exceptions'];
- unset($rules['__exceptions']);
-
- // Add all other possible locations
- if (!in_array($module, $exceptions)) {
- $dividerpos = strpos($module, '_');
- if ($dividerpos === false) {
- $type = '';
- $plugin = $module;
- } else {
- $type = substr($module, 0, $dividerpos + 1);
- $plugin = substr($module, $dividerpos + 1);
- }
- if (!empty($rules[$type])) {
- foreach ($rules[$type] as $location) {
- $locations[] = $CFG->dirroot . "/$location/$plugin/lang/";
- }
- }
- }
-
- return $locations;
-
-}
-
?>

0 comments on commit 331ecbe

Please sign in to comment.
Something went wrong with that request. Please try again.