From: vyshane
Date: Wed, 22 Mar 2006 03:13:31 +0000 (+0000)
Subject: Fixed preview link bug (Bug #4942). Made the preview popup use /help.php for a
X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=3b26532171ed31aaf1d30b80395fa02d1848d3b9;p=moodle.git
Fixed preview link bug (Bug #4942). Made the preview popup use /help.php for a
real preview of what the help content will look like.
---
diff --git a/admin/langdoc.php b/admin/langdoc.php
index 3f2304a8c6..d9f6b3e526 100755
--- a/admin/langdoc.php
+++ b/admin/langdoc.php
@@ -170,7 +170,8 @@ $langdir/$currentfile")."
";
echo "\n";
- link_to_popup_window("/lang/en_utf8/$currentfile", "popup", get_string("preview"));
+ //link_to_popup_window("/lang/en_utf8/$currentfile", "popup", get_string("preview"));
+ link_to_popup_window(help_preview_url($currentfile).'&forcelang=en_utf8', 'popup', get_string('preview'));
echo "\n";
if ($fileeditorinline == 1) {
echo "\n\n";
@@ -184,15 +185,13 @@ $langdir/$currentfile")."";
}
echo "\n";
- link_to_popup_window("/lang/$currentlang/$currentfile", "popup", get_string("preview"));
+ link_to_popup_window(help_preview_url($currentfile), 'popup', get_string('preview'));
echo "\n
\n";
if ($editable) {
@@ -241,4 +240,18 @@ function langdoc_save_file($path, $file, $content) {
return true;
}
-?>
+
+function help_preview_url($currentfile) {
+ if (substr($currentfile, 0, 5) == 'help/') {
+ $currentfile = substr($currentfile, 5);
+ }
+ $currentpathexp = explode('/', $currentfile);
+ if (count($currentpathexp) > 1) {
+ $url = '/help.php?module='.$currentpathexp[0].'&file='.$currentpathexp[1];
+ } else {
+ $url = '/help.php?module=moodle&file='.$currentfile;
+ }
+ return $url;
+}
+
+?>
\ No newline at end of file