From 706ea2faf34fb369bb1470a0f06d65693fc827d1 Mon Sep 17 00:00:00 2001 From: mudrd8mz Date: Sat, 16 Jun 2007 22:25:09 +0000 Subject: [PATCH] To choose a file to edit, popup_form() is used now. It saves some space on the screen. --- admin/lang.php | 50 ++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 44 insertions(+), 6 deletions(-) diff --git a/admin/lang.php b/admin/lang.php index 9a4a7614985..6a90ed044c7 100644 --- a/admin/lang.php +++ b/admin/lang.php @@ -282,13 +282,12 @@ print_heading_with_help($streditstrings, "langedit"); print_box_start('generalbox editstrings'); + $menufiles = array(); foreach ($stringfiles as $file) { - if ($file == $currentfile) { - echo "$file   "; - } else { - echo "$file   "; - } + $menufiles[$file] = $file; } + popup_form("$CFG->wwwroot/$CFG->admin/lang.php?mode=compare&currentfile=", $menufiles, "choosefile", + $currentfile, $strchoosefiletoedit); print_box_end(); print_heading("$strmissingstrings", "center", 4); // one-click way back @@ -475,7 +474,7 @@ } else { // no $currentfile specified - print_heading($strchoosefiletoedit, "", 4); + // no useful information to display - maybe some help? instructions? } } @@ -704,5 +703,44 @@ 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; + +} + ?>