From: mudrd8mz Date: Wed, 28 Jun 2006 01:02:54 +0000 (+0000) Subject: * Hide preview link when editing docs\ files. I have not found any way how to display X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=1bd9b44a33245ba2fd9d7c640f25484c1db125a0;p=moodle.git * Hide preview link when editing docs\ files. I have not found any way how to display local documenation pages in 1.6. More comment in bug 4972 * Hide the form when displaying non-editable files (like en_utf8 ones). --- diff --git a/admin/langdoc.php b/admin/langdoc.php index 604df51739..7530a9822a 100755 --- a/admin/langdoc.php +++ b/admin/langdoc.php @@ -1,14 +1,14 @@

"; echo htmlspecialchars(file_get_contents("$enlangdir/$currentfile")); echo "\n"; //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')); + $preview_url = langdoc_preview_url($currentfile); + if ($preview_url) { + link_to_popup_window($preview_url.'&forcelang=en_utf8', 'popup', get_string('preview')); + } echo "\n"; if ($fileeditorinline == 1) { echo "\n\n"; @@ -182,23 +185,25 @@ $langdir/$currentfile")."

"; echo "
"; echo ''; echo ''; - } - - echo "\n"; - link_to_popup_window(help_preview_url($currentfile), 'popup', get_string('preview')); - echo "\n\n"; - if ($editable) { + echo "\n"; + $preview_url = langdoc_preview_url($currentfile); + if ($preview_url) { + link_to_popup_window($preview_url, 'popup', get_string('preview')); + } echo '
'; echo '
'; } + echo "\n\n"; + + error_reporting($CFG->debug); } @@ -240,18 +245,26 @@ function langdoc_save_file($path, $file, $content) { return true; } - -function help_preview_url($currentfile) { +/** + * Return a preview URL for the file, if available. + * + * Documentation will be moved into moodle.org wiki and current version 1.6 does not + * seem to be able to display local documentation. Thus, return empty URL for doc files. + * See lib/moodlelib.php document_file() - it still relies on old pre-UTF8 lang/ location. + */ +function langdoc_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]; + $currentpathexp = explode('/', $currentfile); + if (count($currentpathexp) > 1) { + $url = '/help.php?module='.$currentpathexp[0].'&file='.$currentpathexp[1]; + } else { + $url = '/help.php?module=moodle&file='.$currentfile; + } } else { - $url = '/help.php?module=moodle&file='.$currentfile; + $url = ''; } return $url; } -?> \ No newline at end of file +?>