From: martinlanghoff Date: Mon, 31 Jul 2006 04:56:12 +0000 (+0000) Subject: wiki: Added a link to force reloading of the page (WR#515) X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=51886e2fb40888e79ddf681e5893084d338ceba1;p=moodle.git wiki: Added a link to force reloading of the page (WR#515) The link allows the page to be reloaded, which saves people from only seeing the cached copy. This is the equivalent of doing Shift+Reload in most browsers. Author: Luke Hudson --- diff --git a/lang/en_utf8/wiki.php b/lang/en_utf8/wiki.php index 9a2e9f609e..c55a0f6634 100644 --- a/lang/en_utf8/wiki.php +++ b/lang/en_utf8/wiki.php @@ -130,6 +130,8 @@ $string['plaintext'] = 'Plain Text'; $string['preview'] = 'Preview'; $string['readonly'] = 'Read only page'; $string['refs'] = 'References'; +$string['reloadlinkdescription'] = 'Reloads the page, so that any new content is shown.'; +$string['reloadlinktext'] = 'Reload this page'; $string['removenotice'] = 'Note that only unreferenced pages will be listed here. And because the ewiki engine itself does only limited testing if a page is referenced it may miss some of them here.
If you however empty a page first, it will get listed here too. Various other database diagnostics are made as well.'; $string['removepagecheck'] = 'Are you sure that you want to delete these pages ?'; $string['removepages'] = 'Remove pages'; @@ -187,5 +189,4 @@ $string['wikiusage'] = 'Wiki usage'; $string['withbinaries'] = 'Include binary content'; $string['withvirtualpages'] = 'Include Wiki-Links'; $string['wrongversionrange'] = '$a is not a correct range!'; - ?> diff --git a/mod/wiki/view.php b/mod/wiki/view.php index 979b488cda..fb73310061 100644 --- a/mod/wiki/view.php +++ b/mod/wiki/view.php @@ -16,12 +16,11 @@ $userid = optional_param('userid', 0, PARAM_INT); // User wiki. $groupid = optional_param('groupid', 0, PARAM_INT); // Group wiki. $canceledit = optional_param('canceledit','', PARAM_ALPHA); // Editing has been cancelled + $cacheme = optional_param('allowcache', 1, PARAM_INT); // Set this to 0 to try and disable page caching. // Only want to add edit log entries if we have made some changes ie submitted a form $editsave = optional_param('thankyou', ''); - - if ($id) { if (! $cm = get_record("course_modules", "id", $id)) { error("Course Module ID was incorrect"); @@ -245,7 +244,7 @@ print_header_simple($ewiki_title?$ewiki_title:format_string($wiki->name), "", "id\">$strwikis -> ".format_string($wiki->name,true)."".($ewiki_title?" -> $ewiki_title":""), - "", "", true, update_module_button($cm->id, $course->id, $strwiki), + "", "", $cacheme, update_module_button($cm->id, $course->id, $strwiki), navmenu($course, $cm)); @@ -346,7 +345,24 @@ print_tabs($tabrows, $currenttab); } + /// Insert a link to force page refresh if new content isn't showing. + // build new URL + query string + $queries = preg_split('/[?&]/', me()); + $nqueries = count($queries); + $me = $queries[0] . '?'; + for($i=1; $i < $nqueries; $i++) + { + if( !strstr($queries[$i], 'allowcache') ) + $me .= $queries[$i] . '&'; + } + $me .= 'allowcache=0'; + + // Insert the link + $linkdesc = get_string('reloadlinkdescription', 'wiki'); + $linktext = get_string('reloadlinktext', 'wiki'); + echo "
"; + print_simple_box_start('center', '100%', '', '20'); /// Don't filter any pages containing wiki actions (except view). A wiki page containing